gsd-pi 2.63.0 → 2.64.0-dev.6fe1e44

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 (582) hide show
  1. package/README.md +46 -134
  2. package/dist/cli.js +48 -6
  3. package/dist/headless-query.js +11 -1
  4. package/dist/help-text.js +4 -1
  5. package/dist/onboarding.js +15 -8
  6. package/dist/resource-loader.js +18 -3
  7. package/dist/resources/extensions/cmux/index.js +21 -12
  8. package/dist/resources/extensions/gsd/auto/detect-stuck.js +27 -0
  9. package/dist/resources/extensions/gsd/auto/finalize-timeout.js +40 -0
  10. package/dist/resources/extensions/gsd/auto/loop.js +4 -0
  11. package/dist/resources/extensions/gsd/auto/phases.js +157 -22
  12. package/dist/resources/extensions/gsd/auto/session.js +12 -0
  13. package/dist/resources/extensions/gsd/auto-dashboard.js +14 -8
  14. package/dist/resources/extensions/gsd/auto-model-selection.js +32 -0
  15. package/dist/resources/extensions/gsd/auto-post-unit.js +222 -11
  16. package/dist/resources/extensions/gsd/auto-prompts.js +25 -0
  17. package/dist/resources/extensions/gsd/auto-recovery.js +15 -7
  18. package/dist/resources/extensions/gsd/auto-start.js +10 -21
  19. package/dist/resources/extensions/gsd/auto-timers.js +2 -1
  20. package/dist/resources/extensions/gsd/auto-tool-tracking.js +17 -0
  21. package/dist/resources/extensions/gsd/auto-verification.js +138 -1
  22. package/dist/resources/extensions/gsd/auto-worktree.js +13 -7
  23. package/dist/resources/extensions/gsd/auto.js +24 -2
  24. package/dist/resources/extensions/gsd/bootstrap/db-tools.js +147 -75
  25. package/dist/resources/extensions/gsd/bootstrap/dynamic-tools.js +13 -0
  26. package/dist/resources/extensions/gsd/bootstrap/notify-interceptor.js +28 -0
  27. package/dist/resources/extensions/gsd/bootstrap/query-tools.js +85 -0
  28. package/dist/resources/extensions/gsd/bootstrap/register-extension.js +3 -0
  29. package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +40 -1
  30. package/dist/resources/extensions/gsd/bootstrap/register-shortcuts.js +15 -0
  31. package/dist/resources/extensions/gsd/bootstrap/sanitize-complete-milestone.js +54 -0
  32. package/dist/resources/extensions/gsd/bootstrap/system-context.js +30 -2
  33. package/dist/resources/extensions/gsd/commands/catalog.js +7 -1
  34. package/dist/resources/extensions/gsd/commands/handlers/core.js +1 -0
  35. package/dist/resources/extensions/gsd/commands/handlers/notifications-handler.js +103 -0
  36. package/dist/resources/extensions/gsd/commands/handlers/ops.js +5 -0
  37. package/dist/resources/extensions/gsd/commands-handlers.js +9 -4
  38. package/dist/resources/extensions/gsd/constants.js +42 -0
  39. package/dist/resources/extensions/gsd/db-writer.js +72 -4
  40. package/dist/resources/extensions/gsd/forensics.js +20 -4
  41. package/dist/resources/extensions/gsd/gsd-db.js +64 -17
  42. package/dist/resources/extensions/gsd/guided-flow.js +19 -0
  43. package/dist/resources/extensions/gsd/metrics.js +27 -1
  44. package/dist/resources/extensions/gsd/native-git-bridge.js +5 -3
  45. package/dist/resources/extensions/gsd/notification-overlay.js +224 -0
  46. package/dist/resources/extensions/gsd/notification-store.js +268 -0
  47. package/dist/resources/extensions/gsd/notification-widget.js +56 -0
  48. package/dist/resources/extensions/gsd/post-execution-checks.js +407 -0
  49. package/dist/resources/extensions/gsd/pre-execution-checks.js +464 -0
  50. package/dist/resources/extensions/gsd/preferences-types.js +6 -0
  51. package/dist/resources/extensions/gsd/preferences-validation.js +33 -0
  52. package/dist/resources/extensions/gsd/preferences.js +11 -2
  53. package/dist/resources/extensions/gsd/prompt-loader.js +7 -0
  54. package/dist/resources/extensions/gsd/prompts/complete-milestone.md +2 -0
  55. package/dist/resources/extensions/gsd/prompts/complete-slice.md +2 -0
  56. package/dist/resources/extensions/gsd/prompts/doctor-heal.md +1 -0
  57. package/dist/resources/extensions/gsd/prompts/forensics.md +2 -0
  58. package/dist/resources/extensions/gsd/prompts/reassess-roadmap.md +2 -0
  59. package/dist/resources/extensions/gsd/prompts/system.md +4 -7
  60. package/dist/resources/extensions/gsd/prompts/validate-milestone.md +2 -0
  61. package/dist/resources/extensions/gsd/roadmap-mutations.js +1 -1
  62. package/dist/resources/extensions/gsd/roadmap-slices.js +9 -5
  63. package/dist/resources/extensions/gsd/safety/content-validator.js +73 -0
  64. package/dist/resources/extensions/gsd/safety/destructive-guard.js +34 -0
  65. package/dist/resources/extensions/gsd/safety/evidence-collector.js +109 -0
  66. package/dist/resources/extensions/gsd/safety/evidence-cross-ref.js +83 -0
  67. package/dist/resources/extensions/gsd/safety/file-change-validator.js +71 -0
  68. package/dist/resources/extensions/gsd/safety/git-checkpoint.js +91 -0
  69. package/dist/resources/extensions/gsd/safety/safety-harness.js +64 -0
  70. package/dist/resources/extensions/gsd/slice-parallel-conflict.js +67 -0
  71. package/dist/resources/extensions/gsd/slice-parallel-eligibility.js +51 -0
  72. package/dist/resources/extensions/gsd/slice-parallel-orchestrator.js +378 -0
  73. package/dist/resources/extensions/gsd/state.js +74 -14
  74. package/dist/resources/extensions/gsd/status-guards.js +11 -0
  75. package/dist/resources/extensions/gsd/tools/complete-milestone.js +17 -12
  76. package/dist/resources/extensions/gsd/tools/complete-slice.js +40 -26
  77. package/dist/resources/extensions/gsd/tools/complete-task.js +12 -12
  78. package/dist/resources/extensions/gsd/tools/plan-milestone.js +33 -25
  79. package/dist/resources/extensions/gsd/tools/plan-slice.js +5 -8
  80. package/dist/resources/extensions/gsd/verification-evidence.js +18 -0
  81. package/dist/resources/extensions/gsd/workflow-logger.js +8 -0
  82. package/dist/resources/extensions/gsd/workflow-projections.js +21 -5
  83. package/dist/resources/extensions/gsd/worktree-manager.js +82 -29
  84. package/dist/resources/extensions/gsd/worktree-resolver.js +4 -3
  85. package/dist/resources/extensions/mcp-client/auth.js +101 -0
  86. package/dist/resources/extensions/mcp-client/index.js +10 -1
  87. package/dist/resources/extensions/ollama/index.js +28 -22
  88. package/dist/resources/extensions/ollama/model-capabilities.js +37 -34
  89. package/dist/resources/extensions/ollama/ndjson-stream.js +54 -0
  90. package/dist/resources/extensions/ollama/ollama-chat-provider.js +380 -0
  91. package/dist/resources/extensions/ollama/ollama-client.js +23 -32
  92. package/dist/resources/extensions/ollama/ollama-discovery.js +2 -7
  93. package/dist/resources/extensions/ollama/ollama-tool.js +62 -0
  94. package/dist/resources/extensions/ollama/thinking-parser.js +104 -0
  95. package/dist/update-cmd.js +4 -2
  96. package/dist/web/standalone/.next/BUILD_ID +1 -1
  97. package/dist/web/standalone/.next/app-path-routes-manifest.json +14 -13
  98. package/dist/web/standalone/.next/build-manifest.json +3 -3
  99. package/dist/web/standalone/.next/prerender-manifest.json +3 -3
  100. package/dist/web/standalone/.next/required-server-files.json +4 -4
  101. package/dist/web/standalone/.next/routes-manifest.json +6 -0
  102. package/dist/web/standalone/.next/server/app/_global-error/page.js +3 -3
  103. package/dist/web/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  104. package/dist/web/standalone/.next/server/app/_global-error.html +2 -2
  105. package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
  106. package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  107. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  108. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  109. package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  110. package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  111. package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  112. package/dist/web/standalone/.next/server/app/_not-found/page.js +2 -2
  113. package/dist/web/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  114. package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
  115. package/dist/web/standalone/.next/server/app/_not-found.rsc +3 -3
  116. package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
  117. package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  118. package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +3 -3
  119. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  120. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  121. package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  122. package/dist/web/standalone/.next/server/app/api/boot/route.js +1 -1
  123. package/dist/web/standalone/.next/server/app/api/boot/route.js.nft.json +1 -1
  124. package/dist/web/standalone/.next/server/app/api/boot/route_client-reference-manifest.js +1 -1
  125. package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js +1 -1
  126. package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js.nft.json +1 -1
  127. package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route_client-reference-manifest.js +1 -1
  128. package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js +1 -1
  129. package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js.nft.json +1 -1
  130. package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route_client-reference-manifest.js +1 -1
  131. package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js +2 -2
  132. package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js.nft.json +1 -1
  133. package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route_client-reference-manifest.js +1 -1
  134. package/dist/web/standalone/.next/server/app/api/browse-directories/route.js +1 -1
  135. package/dist/web/standalone/.next/server/app/api/browse-directories/route_client-reference-manifest.js +1 -1
  136. package/dist/web/standalone/.next/server/app/api/captures/route.js +1 -1
  137. package/dist/web/standalone/.next/server/app/api/captures/route.js.nft.json +1 -1
  138. package/dist/web/standalone/.next/server/app/api/captures/route_client-reference-manifest.js +1 -1
  139. package/dist/web/standalone/.next/server/app/api/cleanup/route.js +1 -1
  140. package/dist/web/standalone/.next/server/app/api/cleanup/route.js.nft.json +1 -1
  141. package/dist/web/standalone/.next/server/app/api/cleanup/route_client-reference-manifest.js +1 -1
  142. package/dist/web/standalone/.next/server/app/api/dev-mode/route.js +1 -1
  143. package/dist/web/standalone/.next/server/app/api/dev-mode/route_client-reference-manifest.js +1 -1
  144. package/dist/web/standalone/.next/server/app/api/doctor/route.js +1 -1
  145. package/dist/web/standalone/.next/server/app/api/doctor/route.js.nft.json +1 -1
  146. package/dist/web/standalone/.next/server/app/api/doctor/route_client-reference-manifest.js +1 -1
  147. package/dist/web/standalone/.next/server/app/api/experimental/route.js +2 -2
  148. package/dist/web/standalone/.next/server/app/api/experimental/route_client-reference-manifest.js +1 -1
  149. package/dist/web/standalone/.next/server/app/api/export-data/route.js +1 -1
  150. package/dist/web/standalone/.next/server/app/api/export-data/route.js.nft.json +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.js.nft.json +1 -1
  154. package/dist/web/standalone/.next/server/app/api/files/route_client-reference-manifest.js +1 -1
  155. package/dist/web/standalone/.next/server/app/api/forensics/route.js +1 -1
  156. package/dist/web/standalone/.next/server/app/api/forensics/route.js.nft.json +1 -1
  157. package/dist/web/standalone/.next/server/app/api/forensics/route_client-reference-manifest.js +1 -1
  158. package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
  159. package/dist/web/standalone/.next/server/app/api/git/route.js.nft.json +1 -1
  160. package/dist/web/standalone/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
  161. package/dist/web/standalone/.next/server/app/api/history/route.js +1 -1
  162. package/dist/web/standalone/.next/server/app/api/history/route.js.nft.json +1 -1
  163. package/dist/web/standalone/.next/server/app/api/history/route_client-reference-manifest.js +1 -1
  164. package/dist/web/standalone/.next/server/app/api/hooks/route.js +1 -1
  165. package/dist/web/standalone/.next/server/app/api/hooks/route.js.nft.json +1 -1
  166. package/dist/web/standalone/.next/server/app/api/hooks/route_client-reference-manifest.js +1 -1
  167. package/dist/web/standalone/.next/server/app/api/inspect/route.js +1 -1
  168. package/dist/web/standalone/.next/server/app/api/inspect/route.js.nft.json +1 -1
  169. package/dist/web/standalone/.next/server/app/api/inspect/route_client-reference-manifest.js +1 -1
  170. package/dist/web/standalone/.next/server/app/api/knowledge/route.js +1 -1
  171. package/dist/web/standalone/.next/server/app/api/knowledge/route.js.nft.json +1 -1
  172. package/dist/web/standalone/.next/server/app/api/knowledge/route_client-reference-manifest.js +1 -1
  173. package/dist/web/standalone/.next/server/app/api/live-state/route.js +1 -1
  174. package/dist/web/standalone/.next/server/app/api/live-state/route.js.nft.json +1 -1
  175. package/dist/web/standalone/.next/server/app/api/live-state/route_client-reference-manifest.js +1 -1
  176. package/dist/web/standalone/.next/server/app/api/notifications/route.js +3 -0
  177. package/dist/web/standalone/.next/server/app/api/notifications/route.js.nft.json +1 -0
  178. package/dist/web/standalone/.next/server/app/api/notifications/route_client-reference-manifest.js +1 -0
  179. package/dist/web/standalone/.next/server/app/api/onboarding/route.js +1 -1
  180. package/dist/web/standalone/.next/server/app/api/onboarding/route.js.nft.json +1 -1
  181. package/dist/web/standalone/.next/server/app/api/onboarding/route_client-reference-manifest.js +1 -1
  182. package/dist/web/standalone/.next/server/app/api/preferences/route.js +1 -1
  183. package/dist/web/standalone/.next/server/app/api/preferences/route_client-reference-manifest.js +1 -1
  184. package/dist/web/standalone/.next/server/app/api/projects/route.js +1 -1
  185. package/dist/web/standalone/.next/server/app/api/projects/route.js.nft.json +1 -1
  186. package/dist/web/standalone/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
  187. package/dist/web/standalone/.next/server/app/api/recovery/route.js +1 -1
  188. package/dist/web/standalone/.next/server/app/api/recovery/route.js.nft.json +1 -1
  189. package/dist/web/standalone/.next/server/app/api/recovery/route_client-reference-manifest.js +1 -1
  190. package/dist/web/standalone/.next/server/app/api/remote-questions/route.js +2 -2
  191. package/dist/web/standalone/.next/server/app/api/remote-questions/route_client-reference-manifest.js +1 -1
  192. package/dist/web/standalone/.next/server/app/api/session/browser/route.js +1 -1
  193. package/dist/web/standalone/.next/server/app/api/session/browser/route.js.nft.json +1 -1
  194. package/dist/web/standalone/.next/server/app/api/session/browser/route_client-reference-manifest.js +1 -1
  195. package/dist/web/standalone/.next/server/app/api/session/command/route.js +1 -1
  196. package/dist/web/standalone/.next/server/app/api/session/command/route.js.nft.json +1 -1
  197. package/dist/web/standalone/.next/server/app/api/session/command/route_client-reference-manifest.js +1 -1
  198. package/dist/web/standalone/.next/server/app/api/session/events/route.js +2 -2
  199. package/dist/web/standalone/.next/server/app/api/session/events/route.js.nft.json +1 -1
  200. package/dist/web/standalone/.next/server/app/api/session/events/route_client-reference-manifest.js +1 -1
  201. package/dist/web/standalone/.next/server/app/api/session/manage/route.js +1 -1
  202. package/dist/web/standalone/.next/server/app/api/session/manage/route.js.nft.json +1 -1
  203. package/dist/web/standalone/.next/server/app/api/session/manage/route_client-reference-manifest.js +1 -1
  204. package/dist/web/standalone/.next/server/app/api/settings-data/route.js +1 -1
  205. package/dist/web/standalone/.next/server/app/api/settings-data/route.js.nft.json +1 -1
  206. package/dist/web/standalone/.next/server/app/api/settings-data/route_client-reference-manifest.js +1 -1
  207. package/dist/web/standalone/.next/server/app/api/shutdown/route.js +1 -1
  208. package/dist/web/standalone/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
  209. package/dist/web/standalone/.next/server/app/api/skill-health/route.js +1 -1
  210. package/dist/web/standalone/.next/server/app/api/skill-health/route.js.nft.json +1 -1
  211. package/dist/web/standalone/.next/server/app/api/skill-health/route_client-reference-manifest.js +1 -1
  212. package/dist/web/standalone/.next/server/app/api/steer/route.js +1 -1
  213. package/dist/web/standalone/.next/server/app/api/steer/route.js.nft.json +1 -1
  214. package/dist/web/standalone/.next/server/app/api/steer/route_client-reference-manifest.js +1 -1
  215. package/dist/web/standalone/.next/server/app/api/switch-root/route.js +1 -1
  216. package/dist/web/standalone/.next/server/app/api/switch-root/route.js.nft.json +1 -1
  217. package/dist/web/standalone/.next/server/app/api/switch-root/route_client-reference-manifest.js +1 -1
  218. package/dist/web/standalone/.next/server/app/api/terminal/input/route.js +2 -2
  219. package/dist/web/standalone/.next/server/app/api/terminal/input/route_client-reference-manifest.js +1 -1
  220. package/dist/web/standalone/.next/server/app/api/terminal/resize/route.js +2 -2
  221. package/dist/web/standalone/.next/server/app/api/terminal/resize/route_client-reference-manifest.js +1 -1
  222. package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js +2 -2
  223. package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js.nft.json +1 -1
  224. package/dist/web/standalone/.next/server/app/api/terminal/sessions/route_client-reference-manifest.js +1 -1
  225. package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js +4 -4
  226. package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js.nft.json +1 -1
  227. package/dist/web/standalone/.next/server/app/api/terminal/stream/route_client-reference-manifest.js +1 -1
  228. package/dist/web/standalone/.next/server/app/api/terminal/upload/route.js +1 -1
  229. package/dist/web/standalone/.next/server/app/api/terminal/upload/route_client-reference-manifest.js +1 -1
  230. package/dist/web/standalone/.next/server/app/api/undo/route.js +1 -1
  231. package/dist/web/standalone/.next/server/app/api/undo/route.js.nft.json +1 -1
  232. package/dist/web/standalone/.next/server/app/api/undo/route_client-reference-manifest.js +1 -1
  233. package/dist/web/standalone/.next/server/app/api/update/route.js +1 -1
  234. package/dist/web/standalone/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
  235. package/dist/web/standalone/.next/server/app/api/visualizer/route.js +1 -1
  236. package/dist/web/standalone/.next/server/app/api/visualizer/route.js.nft.json +1 -1
  237. package/dist/web/standalone/.next/server/app/api/visualizer/route_client-reference-manifest.js +1 -1
  238. package/dist/web/standalone/.next/server/app/index.html +1 -1
  239. package/dist/web/standalone/.next/server/app/index.rsc +4 -4
  240. package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  241. package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +4 -4
  242. package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  243. package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +3 -3
  244. package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  245. package/dist/web/standalone/.next/server/app/page.js +2 -2
  246. package/dist/web/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  247. package/dist/web/standalone/.next/server/app-paths-manifest.json +14 -13
  248. package/dist/web/standalone/.next/server/chunks/6897.js +12 -0
  249. package/dist/web/standalone/.next/server/chunks/7471.js +3 -3
  250. package/dist/web/standalone/.next/server/functions-config-manifest.json +1 -0
  251. package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
  252. package/dist/web/standalone/.next/server/middleware.js +2 -2
  253. package/dist/web/standalone/.next/server/next-font-manifest.js +1 -1
  254. package/dist/web/standalone/.next/server/next-font-manifest.json +1 -1
  255. package/dist/web/standalone/.next/server/pages/404.html +1 -1
  256. package/dist/web/standalone/.next/server/pages/500.html +2 -2
  257. package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
  258. package/dist/web/standalone/.next/static/KPMt-rZBouivKwIKcIral/_buildManifest.js +1 -0
  259. package/dist/web/standalone/.next/static/chunks/app/_global-error/page-8805a20e15762c3c.js +1 -0
  260. package/dist/web/standalone/.next/static/chunks/app/_not-found/{page-2f24283c162b6ab3.js → page-f2a7482d42a5614b.js} +1 -1
  261. package/dist/web/standalone/.next/static/chunks/app/api/boot/route-8805a20e15762c3c.js +1 -0
  262. package/dist/web/standalone/.next/static/chunks/app/api/bridge-terminal/input/route-8805a20e15762c3c.js +1 -0
  263. package/dist/web/standalone/.next/static/chunks/app/api/bridge-terminal/resize/route-8805a20e15762c3c.js +1 -0
  264. package/dist/web/standalone/.next/static/chunks/app/api/bridge-terminal/stream/route-8805a20e15762c3c.js +1 -0
  265. package/dist/web/standalone/.next/static/chunks/app/api/browse-directories/route-8805a20e15762c3c.js +1 -0
  266. package/dist/web/standalone/.next/static/chunks/app/api/captures/route-8805a20e15762c3c.js +1 -0
  267. package/dist/web/standalone/.next/static/chunks/app/api/cleanup/route-8805a20e15762c3c.js +1 -0
  268. package/dist/web/standalone/.next/static/chunks/app/api/dev-mode/route-8805a20e15762c3c.js +1 -0
  269. package/dist/web/standalone/.next/static/chunks/app/api/doctor/route-8805a20e15762c3c.js +1 -0
  270. package/dist/web/standalone/.next/static/chunks/app/api/experimental/route-8805a20e15762c3c.js +1 -0
  271. package/dist/web/standalone/.next/static/chunks/app/api/export-data/route-8805a20e15762c3c.js +1 -0
  272. package/dist/web/standalone/.next/static/chunks/app/api/files/route-8805a20e15762c3c.js +1 -0
  273. package/dist/web/standalone/.next/static/chunks/app/api/forensics/route-8805a20e15762c3c.js +1 -0
  274. package/dist/web/standalone/.next/static/chunks/app/api/git/route-8805a20e15762c3c.js +1 -0
  275. package/dist/web/standalone/.next/static/chunks/app/api/history/route-8805a20e15762c3c.js +1 -0
  276. package/dist/web/standalone/.next/static/chunks/app/api/hooks/route-8805a20e15762c3c.js +1 -0
  277. package/dist/web/standalone/.next/static/chunks/app/api/inspect/route-8805a20e15762c3c.js +1 -0
  278. package/dist/web/standalone/.next/static/chunks/app/api/knowledge/route-8805a20e15762c3c.js +1 -0
  279. package/dist/web/standalone/.next/static/chunks/app/api/live-state/route-8805a20e15762c3c.js +1 -0
  280. package/dist/web/standalone/.next/static/chunks/app/api/notifications/route-8805a20e15762c3c.js +1 -0
  281. package/dist/web/standalone/.next/static/chunks/app/api/onboarding/route-8805a20e15762c3c.js +1 -0
  282. package/dist/web/standalone/.next/static/chunks/app/api/preferences/route-8805a20e15762c3c.js +1 -0
  283. package/dist/web/standalone/.next/static/chunks/app/api/projects/route-8805a20e15762c3c.js +1 -0
  284. package/dist/web/standalone/.next/static/chunks/app/api/recovery/route-8805a20e15762c3c.js +1 -0
  285. package/dist/web/standalone/.next/static/chunks/app/api/remote-questions/route-8805a20e15762c3c.js +1 -0
  286. package/dist/web/standalone/.next/static/chunks/app/api/session/browser/route-8805a20e15762c3c.js +1 -0
  287. package/dist/web/standalone/.next/static/chunks/app/api/session/command/route-8805a20e15762c3c.js +1 -0
  288. package/dist/web/standalone/.next/static/chunks/app/api/session/events/route-8805a20e15762c3c.js +1 -0
  289. package/dist/web/standalone/.next/static/chunks/app/api/session/manage/route-8805a20e15762c3c.js +1 -0
  290. package/dist/web/standalone/.next/static/chunks/app/api/settings-data/route-8805a20e15762c3c.js +1 -0
  291. package/dist/web/standalone/.next/static/chunks/app/api/shutdown/route-8805a20e15762c3c.js +1 -0
  292. package/dist/web/standalone/.next/static/chunks/app/api/skill-health/route-8805a20e15762c3c.js +1 -0
  293. package/dist/web/standalone/.next/static/chunks/app/api/steer/route-8805a20e15762c3c.js +1 -0
  294. package/dist/web/standalone/.next/static/chunks/app/api/switch-root/route-8805a20e15762c3c.js +1 -0
  295. package/dist/web/standalone/.next/static/chunks/app/api/terminal/input/route-8805a20e15762c3c.js +1 -0
  296. package/dist/web/standalone/.next/static/chunks/app/api/terminal/resize/route-8805a20e15762c3c.js +1 -0
  297. package/dist/web/standalone/.next/static/chunks/app/api/terminal/sessions/route-8805a20e15762c3c.js +1 -0
  298. package/dist/web/standalone/.next/static/chunks/app/api/terminal/stream/route-8805a20e15762c3c.js +1 -0
  299. package/dist/web/standalone/.next/static/chunks/app/api/terminal/upload/route-8805a20e15762c3c.js +1 -0
  300. package/dist/web/standalone/.next/static/chunks/app/api/undo/route-8805a20e15762c3c.js +1 -0
  301. package/dist/web/standalone/.next/static/chunks/app/api/update/route-8805a20e15762c3c.js +1 -0
  302. package/dist/web/standalone/.next/static/chunks/app/api/visualizer/route-8805a20e15762c3c.js +1 -0
  303. package/dist/web/standalone/.next/static/chunks/app/{layout-9ecfd95f343793f0.js → layout-a16c7a7ecdf0c2cf.js} +1 -1
  304. package/dist/web/standalone/.next/static/chunks/app/page-0c485498795110d6.js +1 -0
  305. package/dist/web/standalone/.next/static/chunks/main-app-fdab67f7802d7832.js +1 -0
  306. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-8805a20e15762c3c.js +1 -0
  307. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-8805a20e15762c3c.js +1 -0
  308. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-459824ffb8c323dd.js +1 -0
  309. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-8805a20e15762c3c.js +1 -0
  310. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-8805a20e15762c3c.js +1 -0
  311. package/dist/web/standalone/node_modules/node-pty/build/Makefile +2 -2
  312. package/dist/web/standalone/node_modules/node-pty/build/Release/pty.node +0 -0
  313. package/dist/web/standalone/node_modules/node-pty/build/pty.target.mk +14 -14
  314. package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api.target.mk +14 -14
  315. package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api_except.target.mk +14 -14
  316. package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api_maybe.target.mk +14 -14
  317. package/dist/web/standalone/server.js +1 -1
  318. package/dist/welcome-screen.js +1 -1
  319. package/package.json +1 -1
  320. package/packages/pi-agent-core/dist/agent-loop.d.ts +8 -0
  321. package/packages/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
  322. package/packages/pi-agent-core/dist/agent-loop.js +70 -3
  323. package/packages/pi-agent-core/dist/agent-loop.js.map +1 -1
  324. package/packages/pi-agent-core/src/agent-loop.test.ts +317 -5
  325. package/packages/pi-agent-core/src/agent-loop.ts +90 -6
  326. package/packages/pi-ai/dist/types.d.ts +16 -1
  327. package/packages/pi-ai/dist/types.d.ts.map +1 -1
  328. package/packages/pi-ai/dist/types.js.map +1 -1
  329. package/packages/pi-ai/src/types.ts +18 -1
  330. package/packages/pi-coding-agent/dist/core/agent-session-tool-refresh.test.d.ts +2 -0
  331. package/packages/pi-coding-agent/dist/core/agent-session-tool-refresh.test.d.ts.map +1 -0
  332. package/packages/pi-coding-agent/dist/core/agent-session-tool-refresh.test.js +38 -0
  333. package/packages/pi-coding-agent/dist/core/agent-session-tool-refresh.test.js.map +1 -0
  334. package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
  335. package/packages/pi-coding-agent/dist/core/agent-session.js +11 -0
  336. package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
  337. package/packages/pi-coding-agent/dist/core/auth-storage.d.ts +9 -0
  338. package/packages/pi-coding-agent/dist/core/auth-storage.d.ts.map +1 -1
  339. package/packages/pi-coding-agent/dist/core/auth-storage.js +50 -1
  340. package/packages/pi-coding-agent/dist/core/auth-storage.js.map +1 -1
  341. package/packages/pi-coding-agent/dist/core/auth-storage.test.js +41 -0
  342. package/packages/pi-coding-agent/dist/core/auth-storage.test.js.map +1 -1
  343. package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts +7 -0
  344. package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
  345. package/packages/pi-coding-agent/dist/core/extensions/loader.js +31 -4
  346. package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
  347. package/packages/pi-coding-agent/dist/core/extensions/loader.test.js +28 -1
  348. package/packages/pi-coding-agent/dist/core/extensions/loader.test.js.map +1 -1
  349. package/packages/pi-coding-agent/dist/core/extensions/provider-registration.test.d.ts +2 -0
  350. package/packages/pi-coding-agent/dist/core/extensions/provider-registration.test.d.ts.map +1 -0
  351. package/packages/pi-coding-agent/dist/core/extensions/provider-registration.test.js +46 -0
  352. package/packages/pi-coding-agent/dist/core/extensions/provider-registration.test.js.map +1 -0
  353. package/packages/pi-coding-agent/dist/core/extensions/types.d.ts +2 -0
  354. package/packages/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
  355. package/packages/pi-coding-agent/dist/core/extensions/types.js.map +1 -1
  356. package/packages/pi-coding-agent/dist/core/model-registry.d.ts +1 -0
  357. package/packages/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -1
  358. package/packages/pi-coding-agent/dist/core/model-registry.js +12 -0
  359. package/packages/pi-coding-agent/dist/core/model-registry.js.map +1 -1
  360. package/packages/pi-coding-agent/dist/core/model-resolver.js +3 -3
  361. package/packages/pi-coding-agent/dist/core/model-resolver.js.map +1 -1
  362. package/packages/pi-coding-agent/dist/core/resource-loader-cache-reset.test.d.ts +2 -0
  363. package/packages/pi-coding-agent/dist/core/resource-loader-cache-reset.test.d.ts.map +1 -0
  364. package/packages/pi-coding-agent/dist/core/resource-loader-cache-reset.test.js +24 -0
  365. package/packages/pi-coding-agent/dist/core/resource-loader-cache-reset.test.js.map +1 -0
  366. package/packages/pi-coding-agent/dist/core/resource-loader.d.ts +23 -1
  367. package/packages/pi-coding-agent/dist/core/resource-loader.d.ts.map +1 -1
  368. package/packages/pi-coding-agent/dist/core/resource-loader.js +84 -57
  369. package/packages/pi-coding-agent/dist/core/resource-loader.js.map +1 -1
  370. package/packages/pi-coding-agent/dist/core/sdk.d.ts.map +1 -1
  371. package/packages/pi-coding-agent/dist/core/sdk.js +9 -0
  372. package/packages/pi-coding-agent/dist/core/sdk.js.map +1 -1
  373. package/packages/pi-coding-agent/package.json +1 -1
  374. package/packages/pi-coding-agent/src/core/agent-session-tool-refresh.test.ts +64 -0
  375. package/packages/pi-coding-agent/src/core/agent-session.ts +10 -0
  376. package/packages/pi-coding-agent/src/core/auth-storage.test.ts +53 -0
  377. package/packages/pi-coding-agent/src/core/auth-storage.ts +66 -1
  378. package/packages/pi-coding-agent/src/core/extensions/loader.test.ts +39 -1
  379. package/packages/pi-coding-agent/src/core/extensions/loader.ts +34 -4
  380. package/packages/pi-coding-agent/src/core/extensions/provider-registration.test.ts +81 -0
  381. package/packages/pi-coding-agent/src/core/extensions/types.ts +2 -0
  382. package/packages/pi-coding-agent/src/core/model-registry.ts +14 -0
  383. package/packages/pi-coding-agent/src/core/model-resolver.ts +3 -3
  384. package/packages/pi-coding-agent/src/core/resource-loader-cache-reset.test.ts +42 -0
  385. package/packages/pi-coding-agent/src/core/resource-loader.ts +94 -57
  386. package/packages/pi-coding-agent/src/core/sdk.ts +10 -0
  387. package/pkg/package.json +1 -1
  388. package/src/resources/extensions/cmux/index.ts +18 -12
  389. package/src/resources/extensions/gsd/auto/detect-stuck.ts +27 -0
  390. package/src/resources/extensions/gsd/auto/finalize-timeout.ts +46 -0
  391. package/src/resources/extensions/gsd/auto/loop.ts +5 -0
  392. package/src/resources/extensions/gsd/auto/phases.ts +194 -33
  393. package/src/resources/extensions/gsd/auto/session.ts +14 -0
  394. package/src/resources/extensions/gsd/auto-dashboard.ts +16 -7
  395. package/src/resources/extensions/gsd/auto-model-selection.ts +36 -0
  396. package/src/resources/extensions/gsd/auto-post-unit.ts +263 -12
  397. package/src/resources/extensions/gsd/auto-prompts.ts +21 -0
  398. package/src/resources/extensions/gsd/auto-recovery.ts +9 -8
  399. package/src/resources/extensions/gsd/auto-start.ts +11 -20
  400. package/src/resources/extensions/gsd/auto-timers.ts +2 -1
  401. package/src/resources/extensions/gsd/auto-tool-tracking.ts +19 -0
  402. package/src/resources/extensions/gsd/auto-verification.ts +190 -2
  403. package/src/resources/extensions/gsd/auto-worktree.ts +14 -6
  404. package/src/resources/extensions/gsd/auto.ts +26 -1
  405. package/src/resources/extensions/gsd/bootstrap/db-tools.ts +160 -88
  406. package/src/resources/extensions/gsd/bootstrap/dynamic-tools.ts +15 -0
  407. package/src/resources/extensions/gsd/bootstrap/notify-interceptor.ts +34 -0
  408. package/src/resources/extensions/gsd/bootstrap/query-tools.ts +98 -0
  409. package/src/resources/extensions/gsd/bootstrap/register-extension.ts +4 -0
  410. package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +44 -1
  411. package/src/resources/extensions/gsd/bootstrap/register-shortcuts.ts +19 -0
  412. package/src/resources/extensions/gsd/bootstrap/sanitize-complete-milestone.ts +57 -0
  413. package/src/resources/extensions/gsd/bootstrap/system-context.ts +31 -2
  414. package/src/resources/extensions/gsd/commands/catalog.ts +7 -1
  415. package/src/resources/extensions/gsd/commands/handlers/core.ts +1 -0
  416. package/src/resources/extensions/gsd/commands/handlers/notifications-handler.ts +139 -0
  417. package/src/resources/extensions/gsd/commands/handlers/ops.ts +5 -0
  418. package/src/resources/extensions/gsd/commands-handlers.ts +10 -4
  419. package/src/resources/extensions/gsd/constants.ts +44 -0
  420. package/src/resources/extensions/gsd/db-writer.ts +78 -4
  421. package/src/resources/extensions/gsd/forensics.ts +21 -5
  422. package/src/resources/extensions/gsd/gsd-db.ts +64 -17
  423. package/src/resources/extensions/gsd/guided-flow.ts +22 -0
  424. package/src/resources/extensions/gsd/metrics.ts +28 -1
  425. package/src/resources/extensions/gsd/native-git-bridge.ts +5 -3
  426. package/src/resources/extensions/gsd/notification-overlay.ts +267 -0
  427. package/src/resources/extensions/gsd/notification-store.ts +288 -0
  428. package/src/resources/extensions/gsd/notification-widget.ts +68 -0
  429. package/src/resources/extensions/gsd/post-execution-checks.ts +539 -0
  430. package/src/resources/extensions/gsd/pre-execution-checks.ts +573 -0
  431. package/src/resources/extensions/gsd/preferences-types.ts +44 -0
  432. package/src/resources/extensions/gsd/preferences-validation.ts +33 -0
  433. package/src/resources/extensions/gsd/preferences.ts +13 -2
  434. package/src/resources/extensions/gsd/prompt-loader.ts +8 -0
  435. package/src/resources/extensions/gsd/prompts/complete-milestone.md +2 -0
  436. package/src/resources/extensions/gsd/prompts/complete-slice.md +2 -0
  437. package/src/resources/extensions/gsd/prompts/doctor-heal.md +1 -0
  438. package/src/resources/extensions/gsd/prompts/forensics.md +2 -0
  439. package/src/resources/extensions/gsd/prompts/reassess-roadmap.md +2 -0
  440. package/src/resources/extensions/gsd/prompts/system.md +4 -7
  441. package/src/resources/extensions/gsd/prompts/validate-milestone.md +2 -0
  442. package/src/resources/extensions/gsd/roadmap-mutations.ts +1 -1
  443. package/src/resources/extensions/gsd/roadmap-slices.ts +10 -5
  444. package/src/resources/extensions/gsd/safety/content-validator.ts +98 -0
  445. package/src/resources/extensions/gsd/safety/destructive-guard.ts +49 -0
  446. package/src/resources/extensions/gsd/safety/evidence-collector.ts +151 -0
  447. package/src/resources/extensions/gsd/safety/evidence-cross-ref.ts +120 -0
  448. package/src/resources/extensions/gsd/safety/file-change-validator.ts +108 -0
  449. package/src/resources/extensions/gsd/safety/git-checkpoint.ts +106 -0
  450. package/src/resources/extensions/gsd/safety/safety-harness.ts +105 -0
  451. package/src/resources/extensions/gsd/slice-parallel-conflict.ts +86 -0
  452. package/src/resources/extensions/gsd/slice-parallel-eligibility.ts +73 -0
  453. package/src/resources/extensions/gsd/slice-parallel-orchestrator.ts +477 -0
  454. package/src/resources/extensions/gsd/state.ts +67 -12
  455. package/src/resources/extensions/gsd/status-guards.ts +13 -0
  456. package/src/resources/extensions/gsd/tests/artifact-corruption-2630.test.ts +288 -0
  457. package/src/resources/extensions/gsd/tests/auto-loop.test.ts +34 -13
  458. package/src/resources/extensions/gsd/tests/auto-start-time-persistence.test.ts +50 -0
  459. package/src/resources/extensions/gsd/tests/cmux.test.ts +58 -0
  460. package/src/resources/extensions/gsd/tests/cold-resume-db-reopen.test.ts +51 -0
  461. package/src/resources/extensions/gsd/tests/complete-milestone.test.ts +140 -0
  462. package/src/resources/extensions/gsd/tests/complete-slice-string-coercion.test.ts +211 -0
  463. package/src/resources/extensions/gsd/tests/complete-task.test.ts +39 -0
  464. package/src/resources/extensions/gsd/tests/dashboard-model-label-ordering.test.ts +107 -0
  465. package/src/resources/extensions/gsd/tests/db-access-guardrails.test.ts +109 -0
  466. package/src/resources/extensions/gsd/tests/db-path-worktree-symlink.test.ts +13 -9
  467. package/src/resources/extensions/gsd/tests/db-writer.test.ts +134 -0
  468. package/src/resources/extensions/gsd/tests/deferred-slice-dispatch.test.ts +203 -0
  469. package/src/resources/extensions/gsd/tests/discuss-tool-scope-leak.test.ts +76 -0
  470. package/src/resources/extensions/gsd/tests/discuss-tool-scoping.test.ts +130 -0
  471. package/src/resources/extensions/gsd/tests/doctor-fix-flag.test.ts +92 -0
  472. package/src/resources/extensions/gsd/tests/enhanced-verification-integration.test.ts +526 -0
  473. package/src/resources/extensions/gsd/tests/finalize-timeout-guard.test.ts +116 -0
  474. package/src/resources/extensions/gsd/tests/flat-rate-routing-guard.test.ts +50 -0
  475. package/src/resources/extensions/gsd/tests/forensics-stuck-loops.test.ts +103 -0
  476. package/src/resources/extensions/gsd/tests/git-checkpoint.test.ts +94 -0
  477. package/src/resources/extensions/gsd/tests/insert-slice-no-wipe.test.ts +88 -0
  478. package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +27 -7
  479. package/src/resources/extensions/gsd/tests/integration/idle-recovery.test.ts +34 -0
  480. package/src/resources/extensions/gsd/tests/metrics.test.ts +116 -1
  481. package/src/resources/extensions/gsd/tests/milestone-status-tool.test.ts +201 -0
  482. package/src/resources/extensions/gsd/tests/notification-store.test.ts +249 -0
  483. package/src/resources/extensions/gsd/tests/plan-milestone-title.test.ts +2 -1
  484. package/src/resources/extensions/gsd/tests/plan-milestone.test.ts +82 -18
  485. package/src/resources/extensions/gsd/tests/post-exec-retry-bypass.test.ts +312 -0
  486. package/src/resources/extensions/gsd/tests/post-execution-checks.test.ts +813 -0
  487. package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +999 -0
  488. package/src/resources/extensions/gsd/tests/pre-execution-fail-closed.test.ts +266 -0
  489. package/src/resources/extensions/gsd/tests/pre-execution-pause-wiring.test.ts +457 -0
  490. package/src/resources/extensions/gsd/tests/preferences.test.ts +10 -0
  491. package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +25 -0
  492. package/src/resources/extensions/gsd/tests/roadmap-slices.test.ts +69 -0
  493. package/src/resources/extensions/gsd/tests/shared-wal.test.ts +30 -0
  494. package/src/resources/extensions/gsd/tests/slice-context-injection.test.ts +50 -0
  495. package/src/resources/extensions/gsd/tests/slice-parallel-conflict.test.ts +92 -0
  496. package/src/resources/extensions/gsd/tests/slice-parallel-eligibility.test.ts +95 -0
  497. package/src/resources/extensions/gsd/tests/slice-parallel-orchestrator.test.ts +83 -0
  498. package/src/resources/extensions/gsd/tests/stuck-detection-coverage.test.ts +42 -0
  499. package/src/resources/extensions/gsd/tests/tool-invocation-error-loop-break.test.ts +103 -0
  500. package/src/resources/extensions/gsd/tests/tool-param-optionality.test.ts +349 -0
  501. package/src/resources/extensions/gsd/tests/worktree-health-dispatch.test.ts +35 -2
  502. package/src/resources/extensions/gsd/tests/worktree-health-monorepo.test.ts +73 -0
  503. package/src/resources/extensions/gsd/tests/worktree-resolver.test.ts +34 -0
  504. package/src/resources/extensions/gsd/tests/worktree-submodule-safety.test.ts +1 -1
  505. package/src/resources/extensions/gsd/tests/worktree-teardown-safety.test.ts +148 -0
  506. package/src/resources/extensions/gsd/tools/complete-milestone.ts +34 -20
  507. package/src/resources/extensions/gsd/tools/complete-slice.ts +41 -26
  508. package/src/resources/extensions/gsd/tools/complete-task.ts +12 -12
  509. package/src/resources/extensions/gsd/tools/plan-milestone.ts +55 -30
  510. package/src/resources/extensions/gsd/tools/plan-slice.ts +13 -8
  511. package/src/resources/extensions/gsd/types.ts +44 -22
  512. package/src/resources/extensions/gsd/verification-evidence.ts +68 -0
  513. package/src/resources/extensions/gsd/workflow-logger.ts +15 -1
  514. package/src/resources/extensions/gsd/workflow-projections.ts +23 -5
  515. package/src/resources/extensions/gsd/worktree-manager.ts +76 -28
  516. package/src/resources/extensions/gsd/worktree-resolver.ts +4 -3
  517. package/src/resources/extensions/mcp-client/auth.ts +149 -0
  518. package/src/resources/extensions/mcp-client/index.ts +16 -1
  519. package/src/resources/extensions/ollama/index.ts +26 -25
  520. package/src/resources/extensions/ollama/model-capabilities.ts +41 -34
  521. package/src/resources/extensions/ollama/ndjson-stream.ts +63 -0
  522. package/src/resources/extensions/ollama/ollama-auth-mode.test.ts +20 -0
  523. package/src/resources/extensions/ollama/ollama-chat-provider.ts +459 -0
  524. package/src/resources/extensions/ollama/ollama-client.ts +30 -30
  525. package/src/resources/extensions/ollama/ollama-discovery.ts +5 -8
  526. package/src/resources/extensions/ollama/ollama-tool.ts +69 -0
  527. package/src/resources/extensions/ollama/tests/ollama-chat-provider-stream.test.ts +82 -0
  528. package/src/resources/extensions/ollama/tests/ollama-discovery.test.ts +0 -27
  529. package/src/resources/extensions/ollama/thinking-parser.ts +116 -0
  530. package/src/resources/extensions/ollama/types.ts +23 -0
  531. package/dist/web/standalone/.next/server/chunks/2229.js +0 -12
  532. package/dist/web/standalone/.next/static/5FLUBNdqolRyyehCyChPd/_buildManifest.js +0 -1
  533. package/dist/web/standalone/.next/static/chunks/app/_global-error/page-c4cc189e7b117ea2.js +0 -1
  534. package/dist/web/standalone/.next/static/chunks/app/api/boot/route-c4cc189e7b117ea2.js +0 -1
  535. package/dist/web/standalone/.next/static/chunks/app/api/bridge-terminal/input/route-c4cc189e7b117ea2.js +0 -1
  536. package/dist/web/standalone/.next/static/chunks/app/api/bridge-terminal/resize/route-c4cc189e7b117ea2.js +0 -1
  537. package/dist/web/standalone/.next/static/chunks/app/api/bridge-terminal/stream/route-c4cc189e7b117ea2.js +0 -1
  538. package/dist/web/standalone/.next/static/chunks/app/api/browse-directories/route-c4cc189e7b117ea2.js +0 -1
  539. package/dist/web/standalone/.next/static/chunks/app/api/captures/route-c4cc189e7b117ea2.js +0 -1
  540. package/dist/web/standalone/.next/static/chunks/app/api/cleanup/route-c4cc189e7b117ea2.js +0 -1
  541. package/dist/web/standalone/.next/static/chunks/app/api/dev-mode/route-c4cc189e7b117ea2.js +0 -1
  542. package/dist/web/standalone/.next/static/chunks/app/api/doctor/route-c4cc189e7b117ea2.js +0 -1
  543. package/dist/web/standalone/.next/static/chunks/app/api/experimental/route-c4cc189e7b117ea2.js +0 -1
  544. package/dist/web/standalone/.next/static/chunks/app/api/export-data/route-c4cc189e7b117ea2.js +0 -1
  545. package/dist/web/standalone/.next/static/chunks/app/api/files/route-c4cc189e7b117ea2.js +0 -1
  546. package/dist/web/standalone/.next/static/chunks/app/api/forensics/route-c4cc189e7b117ea2.js +0 -1
  547. package/dist/web/standalone/.next/static/chunks/app/api/git/route-c4cc189e7b117ea2.js +0 -1
  548. package/dist/web/standalone/.next/static/chunks/app/api/history/route-c4cc189e7b117ea2.js +0 -1
  549. package/dist/web/standalone/.next/static/chunks/app/api/hooks/route-c4cc189e7b117ea2.js +0 -1
  550. package/dist/web/standalone/.next/static/chunks/app/api/inspect/route-c4cc189e7b117ea2.js +0 -1
  551. package/dist/web/standalone/.next/static/chunks/app/api/knowledge/route-c4cc189e7b117ea2.js +0 -1
  552. package/dist/web/standalone/.next/static/chunks/app/api/live-state/route-c4cc189e7b117ea2.js +0 -1
  553. package/dist/web/standalone/.next/static/chunks/app/api/onboarding/route-c4cc189e7b117ea2.js +0 -1
  554. package/dist/web/standalone/.next/static/chunks/app/api/preferences/route-c4cc189e7b117ea2.js +0 -1
  555. package/dist/web/standalone/.next/static/chunks/app/api/projects/route-c4cc189e7b117ea2.js +0 -1
  556. package/dist/web/standalone/.next/static/chunks/app/api/recovery/route-c4cc189e7b117ea2.js +0 -1
  557. package/dist/web/standalone/.next/static/chunks/app/api/remote-questions/route-c4cc189e7b117ea2.js +0 -1
  558. package/dist/web/standalone/.next/static/chunks/app/api/session/browser/route-c4cc189e7b117ea2.js +0 -1
  559. package/dist/web/standalone/.next/static/chunks/app/api/session/command/route-c4cc189e7b117ea2.js +0 -1
  560. package/dist/web/standalone/.next/static/chunks/app/api/session/events/route-c4cc189e7b117ea2.js +0 -1
  561. package/dist/web/standalone/.next/static/chunks/app/api/session/manage/route-c4cc189e7b117ea2.js +0 -1
  562. package/dist/web/standalone/.next/static/chunks/app/api/settings-data/route-c4cc189e7b117ea2.js +0 -1
  563. package/dist/web/standalone/.next/static/chunks/app/api/shutdown/route-c4cc189e7b117ea2.js +0 -1
  564. package/dist/web/standalone/.next/static/chunks/app/api/skill-health/route-c4cc189e7b117ea2.js +0 -1
  565. package/dist/web/standalone/.next/static/chunks/app/api/steer/route-c4cc189e7b117ea2.js +0 -1
  566. package/dist/web/standalone/.next/static/chunks/app/api/switch-root/route-c4cc189e7b117ea2.js +0 -1
  567. package/dist/web/standalone/.next/static/chunks/app/api/terminal/input/route-c4cc189e7b117ea2.js +0 -1
  568. package/dist/web/standalone/.next/static/chunks/app/api/terminal/resize/route-c4cc189e7b117ea2.js +0 -1
  569. package/dist/web/standalone/.next/static/chunks/app/api/terminal/sessions/route-c4cc189e7b117ea2.js +0 -1
  570. package/dist/web/standalone/.next/static/chunks/app/api/terminal/stream/route-c4cc189e7b117ea2.js +0 -1
  571. package/dist/web/standalone/.next/static/chunks/app/api/terminal/upload/route-c4cc189e7b117ea2.js +0 -1
  572. package/dist/web/standalone/.next/static/chunks/app/api/undo/route-c4cc189e7b117ea2.js +0 -1
  573. package/dist/web/standalone/.next/static/chunks/app/api/update/route-c4cc189e7b117ea2.js +0 -1
  574. package/dist/web/standalone/.next/static/chunks/app/api/visualizer/route-c4cc189e7b117ea2.js +0 -1
  575. package/dist/web/standalone/.next/static/chunks/app/page-62be3b5fa91e4c8f.js +0 -1
  576. package/dist/web/standalone/.next/static/chunks/main-app-d3d4c336195465f9.js +0 -1
  577. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-c4cc189e7b117ea2.js +0 -1
  578. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-c4cc189e7b117ea2.js +0 -1
  579. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-ab5a8926e07ec673.js +0 -1
  580. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-c4cc189e7b117ea2.js +0 -1
  581. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-c4cc189e7b117ea2.js +0 -1
  582. /package/dist/web/standalone/.next/static/{5FLUBNdqolRyyehCyChPd → KPMt-rZBouivKwIKcIral}/_ssgManifest.js +0 -0
@@ -9,13 +9,15 @@
9
9
  * value instead of calling return/pauseAuto directly — the caller
10
10
  * checks the result and handles control flow.
11
11
  */
12
+ import { mkdirSync, writeFileSync } from "node:fs";
12
13
  import { resolveSlicePath } from "./paths.js";
13
14
  import { parseUnitId } from "./unit-id.js";
14
- import { isDbAvailable, getTask } from "./gsd-db.js";
15
+ import { isDbAvailable, getTask, getSliceTasks } from "./gsd-db.js";
15
16
  import { loadEffectiveGSDPreferences } from "./preferences.js";
16
17
  import { runVerificationGate, formatFailureContext, captureRuntimeErrors, runDependencyAudit, } from "./verification-gate.js";
17
18
  import { writeVerificationJSON } from "./verification-evidence.js";
18
19
  import { logWarning } from "./workflow-logger.js";
20
+ import { runPostExecutionChecks } from "./post-execution-checks.js";
19
21
  import { join } from "node:path";
20
22
  function isInfraVerificationFailure(stderr) {
21
23
  return /\b(ENOENT|ENOTFOUND|ETIMEDOUT|ECONNRESET|EAI_AGAIN|spawn\s+\S+\s+ENOENT|command not found)\b/i.test(stderr);
@@ -128,12 +130,104 @@ export async function runPostUnitVerification(vctx, pauseAuto) {
128
130
  : "Verification failed due to infrastructure/runtime environment issues — treating as advisory.", "warning");
129
131
  return "continue";
130
132
  }
133
+ // ── Post-execution checks (run after main verification passes for execute-task units) ──
134
+ let postExecChecks;
135
+ let postExecBlockingFailure = false;
136
+ if (result.passed && mid && sid && tid) {
137
+ // Check preferences — respect enhanced_verification and enhanced_verification_post
138
+ const enhancedEnabled = prefs?.enhanced_verification !== false; // default true
139
+ const postEnabled = prefs?.enhanced_verification_post !== false; // default true
140
+ if (enhancedEnabled && postEnabled && isDbAvailable()) {
141
+ try {
142
+ // Get the completed task from DB
143
+ const taskRow = getTask(mid, sid, tid);
144
+ if (taskRow && taskRow.key_files && taskRow.key_files.length > 0) {
145
+ // Get all tasks in the slice
146
+ const allTasks = getSliceTasks(mid, sid);
147
+ // Filter to prior completed tasks (status = 'complete' or 'done', before current task)
148
+ const priorTasks = allTasks.filter((t) => (t.status === "complete" || t.status === "done") &&
149
+ t.id !== tid &&
150
+ t.sequence < taskRow.sequence);
151
+ // Run post-execution checks
152
+ const postExecResult = runPostExecutionChecks(taskRow, priorTasks, s.basePath);
153
+ // Store checks for evidence JSON
154
+ postExecChecks = postExecResult.checks;
155
+ // Log summary to stderr with gsd-post-exec: prefix
156
+ const emoji = postExecResult.status === "pass"
157
+ ? "✅"
158
+ : postExecResult.status === "warn"
159
+ ? "⚠️"
160
+ : "❌";
161
+ process.stderr.write(`gsd-post-exec: ${emoji} Post-execution checks ${postExecResult.status} for ${mid}/${sid}/${tid} (${postExecResult.durationMs}ms)\n`);
162
+ // Log individual check results
163
+ for (const check of postExecResult.checks) {
164
+ const checkEmoji = check.passed
165
+ ? "✓"
166
+ : check.blocking
167
+ ? "✗"
168
+ : "⚠";
169
+ process.stderr.write(`gsd-post-exec: ${checkEmoji} [${check.category}] ${check.target}: ${check.message}\n`);
170
+ }
171
+ // Check for blocking failures
172
+ if (postExecResult.status === "fail") {
173
+ postExecBlockingFailure = true;
174
+ const blockingCount = postExecResult.checks.filter((c) => !c.passed && c.blocking).length;
175
+ ctx.ui.notify(`Post-execution checks failed: ${blockingCount} blocking issue${blockingCount === 1 ? "" : "s"} found`, "error");
176
+ }
177
+ else if (postExecResult.status === "warn") {
178
+ ctx.ui.notify(`Post-execution checks passed with warnings`, "warning");
179
+ // Strict mode: treat warnings as blocking
180
+ if (prefs?.enhanced_verification_strict === true) {
181
+ postExecBlockingFailure = true;
182
+ }
183
+ }
184
+ }
185
+ }
186
+ catch (postExecErr) {
187
+ // Post-execution check errors are non-fatal — log and continue
188
+ logWarning("engine", `gsd-post-exec: error — ${postExecErr.message}`);
189
+ }
190
+ }
191
+ }
192
+ // Re-write verification evidence JSON with post-execution checks
193
+ if (postExecChecks && postExecChecks.length > 0 && mid && sid && tid) {
194
+ try {
195
+ const sDir = resolveSlicePath(s.basePath, mid, sid);
196
+ if (sDir) {
197
+ const tasksDir = join(sDir, "tasks");
198
+ // Add postExecutionChecks to the result for the JSON write
199
+ const resultWithPostExec = {
200
+ ...result,
201
+ // Mark as failed if there was a blocking post-exec failure
202
+ passed: result.passed && !postExecBlockingFailure,
203
+ };
204
+ // Manually write with postExecutionChecks field
205
+ writeVerificationJSONWithPostExec(resultWithPostExec, tasksDir, tid, s.currentUnit.id, postExecChecks, postExecBlockingFailure ? attempt + 1 : undefined, postExecBlockingFailure ? maxRetries : undefined);
206
+ }
207
+ }
208
+ catch (evidenceErr) {
209
+ logWarning("engine", `verification-evidence: post-exec write error — ${evidenceErr.message}`);
210
+ }
211
+ }
212
+ // Update result.passed based on post-execution checks
213
+ if (postExecBlockingFailure) {
214
+ result.passed = false;
215
+ }
131
216
  // ── Auto-fix retry logic ──
132
217
  if (result.passed) {
133
218
  s.verificationRetryCount.delete(s.currentUnit.id);
134
219
  s.pendingVerificationRetry = null;
135
220
  return "continue";
136
221
  }
222
+ else if (postExecBlockingFailure) {
223
+ // Post-execution failures are cross-task consistency issues — retrying the same task won't fix them.
224
+ // Skip retry and pause immediately for human review.
225
+ s.verificationRetryCount.delete(s.currentUnit.id);
226
+ s.pendingVerificationRetry = null;
227
+ ctx.ui.notify(`Post-execution checks failed — cross-task consistency issue detected, pausing for human review`, "error");
228
+ await pauseAuto(ctx, pi);
229
+ return "pause";
230
+ }
137
231
  else if (autoFixEnabled && attempt + 1 <= maxRetries) {
138
232
  const nextAttempt = attempt + 1;
139
233
  s.verificationRetryCount.set(s.currentUnit.id, nextAttempt);
@@ -173,3 +267,46 @@ export async function runPostUnitVerification(vctx, pauseAuto) {
173
267
  return "continue";
174
268
  }
175
269
  }
270
+ /**
271
+ * Write verification evidence JSON with post-execution checks included.
272
+ * This is a variant of writeVerificationJSON that adds the postExecutionChecks field.
273
+ */
274
+ function writeVerificationJSONWithPostExec(result, tasksDir, taskId, unitId, postExecutionChecks, retryAttempt, maxRetries) {
275
+ mkdirSync(tasksDir, { recursive: true });
276
+ const evidence = {
277
+ schemaVersion: 1,
278
+ taskId,
279
+ unitId: unitId ?? taskId,
280
+ timestamp: result.timestamp,
281
+ passed: result.passed,
282
+ discoverySource: result.discoverySource,
283
+ checks: result.checks.map((check) => ({
284
+ command: check.command,
285
+ exitCode: check.exitCode,
286
+ durationMs: check.durationMs,
287
+ verdict: check.exitCode === 0 ? "pass" : "fail",
288
+ })),
289
+ ...(retryAttempt !== undefined ? { retryAttempt } : {}),
290
+ ...(maxRetries !== undefined ? { maxRetries } : {}),
291
+ postExecutionChecks,
292
+ };
293
+ if (result.runtimeErrors && result.runtimeErrors.length > 0) {
294
+ evidence.runtimeErrors = result.runtimeErrors.map(e => ({
295
+ source: e.source,
296
+ severity: e.severity,
297
+ message: e.message,
298
+ blocking: e.blocking,
299
+ }));
300
+ }
301
+ if (result.auditWarnings && result.auditWarnings.length > 0) {
302
+ evidence.auditWarnings = result.auditWarnings.map(w => ({
303
+ name: w.name,
304
+ severity: w.severity,
305
+ title: w.title,
306
+ url: w.url,
307
+ fixAvailable: w.fixAvailable,
308
+ }));
309
+ }
310
+ const filePath = join(tasksDir, `${taskId}-VERIFY.json`);
311
+ writeFileSync(filePath, JSON.stringify(evidence, null, 2) + "\n", "utf-8");
312
+ }
@@ -14,7 +14,7 @@ import { atomicWriteSync } from "./atomic-write.js";
14
14
  import { execFileSync } from "node:child_process";
15
15
  import { safeCopy, safeCopyRecursive } from "./safe-fs.js";
16
16
  import { gsdRoot } from "./paths.js";
17
- import { createWorktree, removeWorktree, resolveGitDir, worktreePath, } from "./worktree-manager.js";
17
+ import { createWorktree, removeWorktree, resolveGitDir, worktreePath, isInsideWorktreesDir, } from "./worktree-manager.js";
18
18
  import { detectWorktreeName, nudgeGitBranchCache, } from "./worktree.js";
19
19
  import { MergeConflictError, readIntegrationBranch, RUNTIME_EXCLUSION_PATHS } from "./git-service.js";
20
20
  import { debugLog } from "./debug-logger.js";
@@ -1025,13 +1025,19 @@ export function teardownAutoWorktree(originalBasePath, milestoneId, opts = {}) {
1025
1025
  logWarning("reconcile", `Worktree directory still exists after teardown: ${wtDir}. ` +
1026
1026
  `This is likely an orphaned directory consuming disk space. ` +
1027
1027
  `Remove it manually with: rm -rf "${wtDir.replaceAll("\\", "/")}"`, { worktree: milestoneId });
1028
- // Attempt a direct filesystem removal as a fallback
1029
- try {
1030
- rmSync(wtDir, { recursive: true, force: true });
1028
+ // Attempt a direct filesystem removal as a fallback — but ONLY if the
1029
+ // path is safely inside .gsd/worktrees/ to prevent #2365 data loss.
1030
+ if (isInsideWorktreesDir(originalBasePath, wtDir)) {
1031
+ try {
1032
+ rmSync(wtDir, { recursive: true, force: true });
1033
+ }
1034
+ catch (err) {
1035
+ // Non-fatal — the warning above tells the user how to clean up
1036
+ logWarning("worktree", `worktree directory removal failed: ${err instanceof Error ? err.message : String(err)}`);
1037
+ }
1031
1038
  }
1032
- catch (err) {
1033
- // Non-fatal the warning above tells the user how to clean up
1034
- logWarning("worktree", `worktree directory removal failed: ${err instanceof Error ? err.message : String(err)}`);
1039
+ else {
1040
+ console.error(`[GSD] REFUSING fallback rmSync path is outside .gsd/worktrees/: ${wtDir}`);
1035
1041
  }
1036
1042
  }
1037
1043
  }
@@ -23,7 +23,7 @@ import { acquireSessionLock, getSessionLockStatus, releaseSessionLock, updateSes
23
23
  import { resolveAutoSupervisorConfig, loadEffectiveGSDPreferences, getIsolationMode, } from "./preferences.js";
24
24
  import { sendDesktopNotification } from "./notifications.js";
25
25
  import { getBudgetAlertLevel, getNewBudgetAlertLevel, getBudgetEnforcementAction, } from "./auto-budget.js";
26
- import { markToolStart as _markToolStart, markToolEnd as _markToolEnd, getOldestInFlightToolAgeMs as _getOldestInFlightToolAgeMs, clearInFlightTools, } from "./auto-tool-tracking.js";
26
+ import { markToolStart as _markToolStart, markToolEnd as _markToolEnd, getOldestInFlightToolAgeMs as _getOldestInFlightToolAgeMs, clearInFlightTools, isToolInvocationError, } from "./auto-tool-tracking.js";
27
27
  import { closeoutUnit } from "./auto-unit-closeout.js";
28
28
  import { selectAndApplyModel, resolveModelId } from "./auto-model-selection.js";
29
29
  import { resetRoutingHistory, recordOutcome } from "./routing-history.js";
@@ -57,7 +57,7 @@ import { clearCmuxSidebar, logCmuxEvent, syncCmuxSidebar } from "../cmux/index.j
57
57
  import { startUnitSupervision } from "./auto-timers.js";
58
58
  import { runPostUnitVerification } from "./auto-verification.js";
59
59
  import { postUnitPreVerification, postUnitPostVerification, } from "./auto-post-unit.js";
60
- import { bootstrapAutoSession } from "./auto-start.js";
60
+ import { bootstrapAutoSession, openProjectDbIfPresent } from "./auto-start.js";
61
61
  import { autoLoop, resolveAgentEnd, resolveAgentEndCancelled, _resetPendingResolve, isSessionSwitchInFlight } from "./auto-loop.js";
62
62
  import { WorktreeResolver, } from "./worktree-resolver.js";
63
63
  import { reorderForCaching } from "./prompt-ordering.js";
@@ -192,6 +192,19 @@ export function markToolStart(toolCallId, toolName) {
192
192
  export function markToolEnd(toolCallId) {
193
193
  _markToolEnd(toolCallId);
194
194
  }
195
+ /**
196
+ * Record a tool invocation error on the current session (#2883).
197
+ * Called from tool_execution_end when a GSD tool fails with isError.
198
+ * Only stores the error if it matches the tool-invocation-error pattern
199
+ * (malformed/truncated JSON), not normal business-logic errors.
200
+ */
201
+ export function recordToolInvocationError(toolName, errorMsg) {
202
+ if (!s.active)
203
+ return;
204
+ if (isToolInvocationError(errorMsg)) {
205
+ s.lastToolInvocationError = `${toolName}: ${errorMsg}`;
206
+ }
207
+ }
195
208
  export function getOldestInFlightToolAgeMs() {
196
209
  return _getOldestInFlightToolAgeMs();
197
210
  }
@@ -630,6 +643,7 @@ export async function pauseAuto(ctx, _pi, _errorContext) {
630
643
  sessionFile: s.pausedSessionFile,
631
644
  activeEngineId: s.activeEngineId,
632
645
  activeRunDir: s.activeRunDir,
646
+ autoStartTime: s.autoStartTime,
633
647
  };
634
648
  const runtimeDir = join(gsdRoot(s.originalBasePath || s.basePath), "runtime");
635
649
  mkdirSync(runtimeDir, { recursive: true });
@@ -829,6 +843,7 @@ export async function startAuto(ctx, pi, base, verboseMode, options) {
829
843
  s.activeRunDir = meta.activeRunDir ?? null;
830
844
  s.originalBasePath = meta.originalBasePath || base;
831
845
  s.stepMode = meta.stepMode ?? requestedStepMode;
846
+ s.autoStartTime = meta.autoStartTime || Date.now();
832
847
  s.paused = true;
833
848
  try {
834
849
  unlinkSync(pausedPath);
@@ -856,6 +871,7 @@ export async function startAuto(ctx, pi, base, verboseMode, options) {
856
871
  s.currentMilestoneId = meta.milestoneId;
857
872
  s.originalBasePath = meta.originalBasePath || base;
858
873
  s.stepMode = meta.stepMode ?? requestedStepMode;
874
+ s.autoStartTime = meta.autoStartTime || Date.now();
859
875
  s.paused = true;
860
876
  // Clean up the persisted file — we're consuming it
861
877
  try {
@@ -887,6 +903,8 @@ export async function startAuto(ctx, pi, base, verboseMode, options) {
887
903
  s.cmdCtx = ctx;
888
904
  s.basePath = base;
889
905
  setLogBasePath(base);
906
+ if (!s.autoStartTime || s.autoStartTime <= 0)
907
+ s.autoStartTime = Date.now();
890
908
  s.unitDispatchCount.clear();
891
909
  s.unitLifetimeDispatches.clear();
892
910
  if (!getLedger())
@@ -909,6 +927,9 @@ export async function startAuto(ctx, pi, base, verboseMode, options) {
909
927
  ctx.ui.setFooter(hideFooter);
910
928
  ctx.ui.notify(s.stepMode ? "Step-mode resumed." : "Auto-mode resumed.", "info");
911
929
  restoreHookState(s.basePath);
930
+ // Open the project DB before rebuild/derive so resume uses DB-backed
931
+ // state instead of falling back to stale markdown parsing (#2940).
932
+ await openProjectDbIfPresent(s.basePath);
912
933
  try {
913
934
  await rebuildState(s.basePath);
914
935
  syncCmuxSidebar(loadEffectiveGSDPreferences()?.preferences, await deriveState(s.basePath));
@@ -1005,6 +1026,7 @@ const widgetStateAccessors = {
1005
1026
  getBasePath: () => s.basePath,
1006
1027
  isVerbose: () => s.verbose,
1007
1028
  isSessionSwitching: isSessionSwitchInFlight,
1029
+ getCurrentDispatchedModelId: () => s.currentDispatchedModelId,
1008
1030
  };
1009
1031
  // ─── Preconditions ────────────────────────────────────────────────────────────
1010
1032
  /**
@@ -486,28 +486,10 @@ export function registerDbTools(pi) {
486
486
  "Use the canonical name gsd_plan_milestone; gsd_milestone_plan is only an alias.",
487
487
  ],
488
488
  parameters: Type.Object({
489
+ // ── Core identification + content (required) ──────────────────────
489
490
  milestoneId: Type.String({ description: "Milestone ID (e.g. M001)" }),
490
491
  title: Type.String({ description: "Milestone title" }),
491
- status: Type.Optional(Type.String({ description: "Milestone status (defaults to active)" })),
492
- dependsOn: Type.Optional(Type.Array(Type.String(), { description: "Milestone dependencies" })),
493
492
  vision: Type.String({ description: "Milestone vision" }),
494
- successCriteria: Type.Array(Type.String(), { description: "Top-level success criteria bullets" }),
495
- keyRisks: Type.Array(Type.Object({
496
- risk: Type.String({ description: "Risk statement" }),
497
- whyItMatters: Type.String({ description: "Why the risk matters" }),
498
- }), { description: "Structured risk entries" }),
499
- proofStrategy: Type.Array(Type.Object({
500
- riskOrUnknown: Type.String({ description: "Risk or unknown to retire" }),
501
- retireIn: Type.String({ description: "Where it will be retired" }),
502
- whatWillBeProven: Type.String({ description: "What proof will be produced" }),
503
- }), { description: "Structured proof strategy entries" }),
504
- verificationContract: Type.String({ description: "Verification contract text" }),
505
- verificationIntegration: Type.String({ description: "Integration verification text" }),
506
- verificationOperational: Type.String({ description: "Operational verification text" }),
507
- verificationUat: Type.String({ description: "UAT verification text" }),
508
- definitionOfDone: Type.Array(Type.String(), { description: "Definition of done bullets" }),
509
- requirementCoverage: Type.String({ description: "Requirement coverage text" }),
510
- boundaryMapMarkdown: Type.String({ description: "Boundary map markdown block" }),
511
493
  slices: Type.Array(Type.Object({
512
494
  sliceId: Type.String({ description: "Slice ID (e.g. S01)" }),
513
495
  title: Type.String({ description: "Slice title" }),
@@ -520,6 +502,26 @@ export function registerDbTools(pi) {
520
502
  integrationClosure: Type.String({ description: "Slice integration closure" }),
521
503
  observabilityImpact: Type.String({ description: "Slice observability impact" }),
522
504
  }), { description: "Planned slices for the milestone" }),
505
+ // ── Enrichment metadata (optional — defaults to empty) ────────────
506
+ status: Type.Optional(Type.String({ description: "Milestone status (defaults to active)" })),
507
+ dependsOn: Type.Optional(Type.Array(Type.String(), { description: "Milestone dependencies" })),
508
+ successCriteria: Type.Optional(Type.Array(Type.String(), { description: "Top-level success criteria bullets" })),
509
+ keyRisks: Type.Optional(Type.Array(Type.Object({
510
+ risk: Type.String({ description: "Risk statement" }),
511
+ whyItMatters: Type.String({ description: "Why the risk matters" }),
512
+ }), { description: "Structured risk entries" })),
513
+ proofStrategy: Type.Optional(Type.Array(Type.Object({
514
+ riskOrUnknown: Type.String({ description: "Risk or unknown to retire" }),
515
+ retireIn: Type.String({ description: "Where it will be retired" }),
516
+ whatWillBeProven: Type.String({ description: "What proof will be produced" }),
517
+ }), { description: "Structured proof strategy entries" })),
518
+ verificationContract: Type.Optional(Type.String({ description: "Verification contract text" })),
519
+ verificationIntegration: Type.Optional(Type.String({ description: "Integration verification text" })),
520
+ verificationOperational: Type.Optional(Type.String({ description: "Operational verification text" })),
521
+ verificationUat: Type.Optional(Type.String({ description: "UAT verification text" })),
522
+ definitionOfDone: Type.Optional(Type.Array(Type.String(), { description: "Definition of done bullets" })),
523
+ requirementCoverage: Type.Optional(Type.String({ description: "Requirement coverage text" })),
524
+ boundaryMapMarkdown: Type.Optional(Type.String({ description: "Boundary map markdown block" })),
523
525
  }),
524
526
  execute: planMilestoneExecute,
525
527
  };
@@ -575,13 +577,10 @@ export function registerDbTools(pi) {
575
577
  "Use the canonical name gsd_plan_slice; gsd_slice_plan is only an alias.",
576
578
  ],
577
579
  parameters: Type.Object({
580
+ // ── Core identification + content (required) ──────────────────────
578
581
  milestoneId: Type.String({ description: "Milestone ID (e.g. M001)" }),
579
582
  sliceId: Type.String({ description: "Slice ID (e.g. S01)" }),
580
583
  goal: Type.String({ description: "Slice goal" }),
581
- successCriteria: Type.String({ description: "Slice success criteria block" }),
582
- proofLevel: Type.String({ description: "Slice proof level" }),
583
- integrationClosure: Type.String({ description: "Slice integration closure" }),
584
- observabilityImpact: Type.String({ description: "Slice observability impact" }),
585
584
  tasks: Type.Array(Type.Object({
586
585
  taskId: Type.String({ description: "Task ID (e.g. T01)" }),
587
586
  title: Type.String({ description: "Task title" }),
@@ -593,6 +592,11 @@ export function registerDbTools(pi) {
593
592
  expectedOutput: Type.Array(Type.String(), { description: "Expected output files or artifacts" }),
594
593
  observabilityImpact: Type.Optional(Type.String({ description: "Task observability impact" })),
595
594
  }), { description: "Planned tasks for the slice" }),
595
+ // ── Enrichment metadata (optional — defaults to empty) ────────────
596
+ successCriteria: Type.Optional(Type.String({ description: "Slice success criteria block" })),
597
+ proofLevel: Type.Optional(Type.String({ description: "Slice proof level" })),
598
+ integrationClosure: Type.Optional(Type.String({ description: "Slice integration closure" })),
599
+ observabilityImpact: Type.Optional(Type.String({ description: "Slice observability impact" })),
596
600
  }),
597
601
  execute: planSliceExecute,
598
602
  };
@@ -674,8 +678,11 @@ export function registerDbTools(pi) {
674
678
  };
675
679
  }
676
680
  try {
681
+ // Coerce string items to objects for verificationEvidence (#3541).
682
+ const coerced = { ...params };
683
+ coerced.verificationEvidence = (params.verificationEvidence ?? []).map((v) => typeof v === "string" ? { command: v, exitCode: -1, verdict: "unknown (coerced from string)", durationMs: 0 } : v);
677
684
  const { handleCompleteTask } = await import("../tools/complete-task.js");
678
- const result = await handleCompleteTask(params, process.cwd());
685
+ const result = await handleCompleteTask(coerced, process.cwd());
679
686
  if ("error" in result) {
680
687
  return {
681
688
  content: [{ type: "text", text: `Error completing task: ${result.error}` }],
@@ -716,23 +723,28 @@ export function registerDbTools(pi) {
716
723
  "Idempotent — calling with the same params twice will upsert (INSERT OR REPLACE) without error.",
717
724
  ],
718
725
  parameters: Type.Object({
726
+ // ── Core identification + content (required) ──────────────────────
719
727
  taskId: Type.String({ description: "Task ID (e.g. T01)" }),
720
728
  sliceId: Type.String({ description: "Slice ID (e.g. S01)" }),
721
729
  milestoneId: Type.String({ description: "Milestone ID (e.g. M001)" }),
722
730
  oneLiner: Type.String({ description: "One-line summary of what was accomplished" }),
723
731
  narrative: Type.String({ description: "Detailed narrative of what happened during the task" }),
724
732
  verification: Type.String({ description: "What was verified and how — commands run, tests passed, behavior confirmed" }),
725
- deviations: Type.String({ description: "Deviations from the task plan, or 'None.'" }),
726
- knownIssues: Type.String({ description: "Known issues discovered but not fixed, or 'None.'" }),
727
- keyFiles: Type.Array(Type.String(), { description: "List of key files created or modified" }),
728
- keyDecisions: Type.Array(Type.String(), { description: "List of key decisions made during this task" }),
729
- blockerDiscovered: Type.Boolean({ description: "Whether a plan-invalidating blocker was discovered" }),
730
- verificationEvidence: Type.Array(Type.Object({
731
- command: Type.String({ description: "Verification command that was run" }),
732
- exitCode: Type.Number({ description: "Exit code of the command" }),
733
- verdict: Type.String({ description: "Pass/fail verdict (e.g. '✅ pass', '❌ fail')" }),
734
- durationMs: Type.Number({ description: "Duration of the command in milliseconds" }),
735
- }), { description: "Array of verification evidence entries" }),
733
+ // ── Enrichment metadata (optional defaults to empty) ────────────
734
+ deviations: Type.Optional(Type.String({ description: "Deviations from the task plan, or 'None.'" })),
735
+ knownIssues: Type.Optional(Type.String({ description: "Known issues discovered but not fixed, or 'None.'" })),
736
+ keyFiles: Type.Optional(Type.Array(Type.String(), { description: "List of key files created or modified" })),
737
+ keyDecisions: Type.Optional(Type.Array(Type.String(), { description: "List of key decisions made during this task" })),
738
+ blockerDiscovered: Type.Optional(Type.Boolean({ description: "Whether a plan-invalidating blocker was discovered" })),
739
+ verificationEvidence: Type.Optional(Type.Array(Type.Union([
740
+ Type.Object({
741
+ command: Type.String({ description: "Verification command that was run" }),
742
+ exitCode: Type.Number({ description: "Exit code of the command" }),
743
+ verdict: Type.String({ description: "Pass/fail verdict (e.g. '✅ pass', '❌ fail')" }),
744
+ durationMs: Type.Number({ description: "Duration of the command in milliseconds" }),
745
+ }),
746
+ Type.String({ description: "Fallback: verification summary string" }),
747
+ ]), { description: "Array of verification evidence entries" })),
736
748
  }),
737
749
  execute: taskCompleteExecute,
738
750
  };
@@ -748,8 +760,46 @@ export function registerDbTools(pi) {
748
760
  };
749
761
  }
750
762
  try {
763
+ // Coerce string items to objects for fields where LLMs sometimes pass
764
+ // plain strings instead of the expected { key, value } shape (#3541).
765
+ // Parses "key — value" or "key - value" format when possible.
766
+ const splitPair = (s) => {
767
+ const m = s.match(/^(.+?)\s*(?:—|-)\s+(.+)$/);
768
+ return m ? [m[1].trim(), m[2].trim()] : [s.trim(), ""];
769
+ };
770
+ const coerced = { ...params };
771
+ coerced.filesModified = (params.filesModified ?? []).map((f) => {
772
+ if (typeof f !== "string")
773
+ return f;
774
+ const [path, description] = splitPair(f);
775
+ return { path, description };
776
+ });
777
+ coerced.requires = (params.requires ?? []).map((r) => {
778
+ if (typeof r !== "string")
779
+ return r;
780
+ const [slice, provides] = splitPair(r);
781
+ return { slice, provides };
782
+ });
783
+ coerced.requirementsAdvanced = (params.requirementsAdvanced ?? []).map((r) => {
784
+ if (typeof r !== "string")
785
+ return r;
786
+ const [id, how] = splitPair(r);
787
+ return { id, how };
788
+ });
789
+ coerced.requirementsValidated = (params.requirementsValidated ?? []).map((r) => {
790
+ if (typeof r !== "string")
791
+ return r;
792
+ const [id, proof] = splitPair(r);
793
+ return { id, proof };
794
+ });
795
+ coerced.requirementsInvalidated = (params.requirementsInvalidated ?? []).map((r) => {
796
+ if (typeof r !== "string")
797
+ return r;
798
+ const [id, what] = splitPair(r);
799
+ return { id, what };
800
+ });
751
801
  const { handleCompleteSlice } = await import("../tools/complete-slice.js");
752
- const result = await handleCompleteSlice(params, process.cwd());
802
+ const result = await handleCompleteSlice(coerced, process.cwd());
753
803
  if ("error" in result) {
754
804
  return {
755
805
  content: [{ type: "text", text: `Error completing slice: ${result.error}` }],
@@ -789,44 +839,61 @@ export function registerDbTools(pi) {
789
839
  "Idempotent — calling with the same params twice will not crash.",
790
840
  ],
791
841
  parameters: Type.Object({
842
+ // ── Core identification + content (required) ──────────────────────
792
843
  sliceId: Type.String({ description: "Slice ID (e.g. S01)" }),
793
844
  milestoneId: Type.String({ description: "Milestone ID (e.g. M001)" }),
794
845
  sliceTitle: Type.String({ description: "Title of the slice" }),
795
846
  oneLiner: Type.String({ description: "One-line summary of what the slice accomplished" }),
796
847
  narrative: Type.String({ description: "Detailed narrative of what happened across all tasks" }),
797
848
  verification: Type.String({ description: "What was verified across all tasks" }),
798
- deviations: Type.String({ description: "Deviations from the slice plan, or 'None.'" }),
799
- knownLimitations: Type.String({ description: "Known limitations or gaps, or 'None.'" }),
800
- followUps: Type.String({ description: "Follow-up work discovered during execution, or 'None.'" }),
801
- keyFiles: Type.Array(Type.String(), { description: "Key files created or modified" }),
802
- keyDecisions: Type.Array(Type.String(), { description: "Key decisions made during this slice" }),
803
- patternsEstablished: Type.Array(Type.String(), { description: "Patterns established by this slice" }),
804
- observabilitySurfaces: Type.Array(Type.String(), { description: "Observability surfaces added" }),
805
- provides: Type.Array(Type.String(), { description: "What this slice provides to downstream slices" }),
806
- requirementsSurfaced: Type.Array(Type.String(), { description: "New requirements surfaced" }),
807
- drillDownPaths: Type.Array(Type.String(), { description: "Paths to task summaries for drill-down" }),
808
- affects: Type.Array(Type.String(), { description: "Downstream slices affected" }),
809
- requirementsAdvanced: Type.Array(Type.Object({
810
- id: Type.String({ description: "Requirement ID" }),
811
- how: Type.String({ description: "How it was advanced" }),
812
- }), { description: "Requirements advanced by this slice" }),
813
- requirementsValidated: Type.Array(Type.Object({
814
- id: Type.String({ description: "Requirement ID" }),
815
- proof: Type.String({ description: "What proof validates it" }),
816
- }), { description: "Requirements validated by this slice" }),
817
- requirementsInvalidated: Type.Array(Type.Object({
818
- id: Type.String({ description: "Requirement ID" }),
819
- what: Type.String({ description: "What changed" }),
820
- }), { description: "Requirements invalidated or re-scoped" }),
821
- filesModified: Type.Array(Type.Object({
822
- path: Type.String({ description: "File path" }),
823
- description: Type.String({ description: "What changed" }),
824
- }), { description: "Files modified with descriptions" }),
825
- requires: Type.Array(Type.Object({
826
- slice: Type.String({ description: "Dependency slice ID" }),
827
- provides: Type.String({ description: "What was consumed from it" }),
828
- }), { description: "Upstream slice dependencies consumed" }),
829
849
  uatContent: Type.String({ description: "UAT test content (markdown body)" }),
850
+ // ── Enrichment metadata (optional — defaults to empty) ────────────
851
+ deviations: Type.Optional(Type.String({ description: "Deviations from the slice plan, or 'None.'" })),
852
+ knownLimitations: Type.Optional(Type.String({ description: "Known limitations or gaps, or 'None.'" })),
853
+ followUps: Type.Optional(Type.String({ description: "Follow-up work discovered during execution, or 'None.'" })),
854
+ keyFiles: Type.Optional(Type.Array(Type.String(), { description: "Key files created or modified" })),
855
+ keyDecisions: Type.Optional(Type.Array(Type.String(), { description: "Key decisions made during this slice" })),
856
+ patternsEstablished: Type.Optional(Type.Array(Type.String(), { description: "Patterns established by this slice" })),
857
+ observabilitySurfaces: Type.Optional(Type.Array(Type.String(), { description: "Observability surfaces added" })),
858
+ provides: Type.Optional(Type.Array(Type.String(), { description: "What this slice provides to downstream slices" })),
859
+ requirementsSurfaced: Type.Optional(Type.Array(Type.String(), { description: "New requirements surfaced" })),
860
+ drillDownPaths: Type.Optional(Type.Array(Type.String(), { description: "Paths to task summaries for drill-down" })),
861
+ affects: Type.Optional(Type.Array(Type.String(), { description: "Downstream slices affected" })),
862
+ requirementsAdvanced: Type.Optional(Type.Array(Type.Union([
863
+ Type.Object({
864
+ id: Type.String({ description: "Requirement ID" }),
865
+ how: Type.String({ description: "How it was advanced" }),
866
+ }),
867
+ Type.String({ description: "Fallback: 'ID — how' string" }),
868
+ ]), { description: "Requirements advanced by this slice" })),
869
+ requirementsValidated: Type.Optional(Type.Array(Type.Union([
870
+ Type.Object({
871
+ id: Type.String({ description: "Requirement ID" }),
872
+ proof: Type.String({ description: "What proof validates it" }),
873
+ }),
874
+ Type.String({ description: "Fallback: 'ID — proof' string" }),
875
+ ]), { description: "Requirements validated by this slice" })),
876
+ requirementsInvalidated: Type.Optional(Type.Array(Type.Union([
877
+ Type.Object({
878
+ id: Type.String({ description: "Requirement ID" }),
879
+ what: Type.String({ description: "What changed" }),
880
+ }),
881
+ Type.String({ description: "Fallback: 'ID — what' string" }),
882
+ ]), { description: "Requirements invalidated or re-scoped" })),
883
+ filesModified: Type.Optional(Type.Array(Type.Union([
884
+ Type.Object({
885
+ path: Type.String({ description: "File path" }),
886
+ description: Type.String({ description: "What changed" }),
887
+ }),
888
+ Type.String({ description: "Fallback: file path string" }),
889
+ ]), { description: "Files modified with descriptions" })),
890
+ requires: Type.Optional(Type.Array(Type.Union([
891
+ Type.Object({
892
+ slice: Type.String({ description: "Dependency slice ID" }),
893
+ provides: Type.String({ description: "What was consumed from it" }),
894
+ }),
895
+ Type.String({ description: "Fallback: slice ID string" }),
896
+ ]), { description: "Upstream slice dependencies consumed" })),
830
897
  }),
831
898
  execute: sliceCompleteExecute,
832
899
  };
@@ -912,8 +979,11 @@ export function registerDbTools(pi) {
912
979
  };
913
980
  }
914
981
  try {
982
+ // ── Input sanitization: normalize markdown parameters (#3013) ──────
983
+ const { sanitizeCompleteMilestoneParams } = await import("./sanitize-complete-milestone.js");
984
+ const sanitized = sanitizeCompleteMilestoneParams(params);
915
985
  const { handleCompleteMilestone } = await import("../tools/complete-milestone.js");
916
- const result = await handleCompleteMilestone(params, process.cwd());
986
+ const result = await handleCompleteMilestone(sanitized, process.cwd());
917
987
  if ("error" in result) {
918
988
  return {
919
989
  content: [{ type: "text", text: `Error completing milestone: ${result.error}` }],
@@ -951,19 +1021,21 @@ export function registerDbTools(pi) {
951
1021
  "On success, returns summaryPath where the MILESTONE-SUMMARY.md was written.",
952
1022
  ],
953
1023
  parameters: Type.Object({
1024
+ // ── Core identification + content (required) ──────────────────────
954
1025
  milestoneId: Type.String({ description: "Milestone ID (e.g. M001)" }),
955
1026
  title: Type.String({ description: "Milestone title" }),
956
1027
  oneLiner: Type.String({ description: "One-sentence summary of what the milestone achieved" }),
957
1028
  narrative: Type.String({ description: "Detailed narrative of what happened during the milestone" }),
958
- successCriteriaResults: Type.String({ description: "Markdown detailing how each success criterion was met or not met" }),
959
- definitionOfDoneResults: Type.String({ description: "Markdown detailing how each definition-of-done item was met" }),
960
- requirementOutcomes: Type.String({ description: "Markdown detailing requirement status transitions with evidence" }),
961
- keyDecisions: Type.Array(Type.String(), { description: "Key architectural/pattern decisions made during the milestone" }),
962
- keyFiles: Type.Array(Type.String(), { description: "Key files created or modified during the milestone" }),
963
- lessonsLearned: Type.Array(Type.String(), { description: "Lessons learned during the milestone" }),
1029
+ verificationPassed: Type.Boolean({ description: "Must be true confirms that code change verification, success criteria, and definition of done checks all passed before completion" }),
1030
+ // ── Enrichment metadata (optional defaults to empty) ────────────
1031
+ successCriteriaResults: Type.Optional(Type.String({ description: "Markdown detailing how each success criterion was met or not met" })),
1032
+ definitionOfDoneResults: Type.Optional(Type.String({ description: "Markdown detailing how each definition-of-done item was met" })),
1033
+ requirementOutcomes: Type.Optional(Type.String({ description: "Markdown detailing requirement status transitions with evidence" })),
1034
+ keyDecisions: Type.Optional(Type.Array(Type.String(), { description: "Key architectural/pattern decisions made during the milestone" })),
1035
+ keyFiles: Type.Optional(Type.Array(Type.String(), { description: "Key files created or modified during the milestone" })),
1036
+ lessonsLearned: Type.Optional(Type.Array(Type.String(), { description: "Lessons learned during the milestone" })),
964
1037
  followUps: Type.Optional(Type.String({ description: "Follow-up items for future milestones" })),
965
1038
  deviations: Type.Optional(Type.String({ description: "Deviations from the original plan" })),
966
- verificationPassed: Type.Boolean({ description: "Must be true — confirms that code change verification, success criteria, and definition of done checks all passed before completion" }),
967
1039
  }),
968
1040
  execute: milestoneCompleteExecute,
969
1041
  };
@@ -26,6 +26,19 @@ export function resolveProjectRootDbPath(basePath) {
26
26
  const projectRoot = basePath.slice(0, fwdIdx);
27
27
  return join(projectRoot, ".gsd", "gsd.db");
28
28
  }
29
+ // External-state layout: ~/.gsd/projects/<hash>/worktrees/<MID>/...
30
+ // Resolve to ~/.gsd/projects/<hash>/gsd.db (the canonical project DB) (#2952).
31
+ // Must be checked before the generic symlink-resolved handler: both match
32
+ // /.gsd/projects/<hash>/worktrees/ but require different resolution targets.
33
+ const extRe = /[/\\]\.gsd[/\\]projects[/\\][a-f0-9]+[/\\]worktrees(?:[/\\]|$)/;
34
+ const extMatch = extRe.exec(basePath);
35
+ if (extMatch) {
36
+ const matchStr = extMatch[0];
37
+ // Find the "/worktrees" portion within the match and slice up to it
38
+ const wtIdx = matchStr.search(/[/\\]worktrees(?:[/\\]|$)/);
39
+ const projectStateRoot = basePath.slice(0, extMatch.index + wtIdx);
40
+ return join(projectStateRoot, "gsd.db");
41
+ }
29
42
  // Symlink-resolved layout: /.gsd/projects/<hash>/worktrees/M001/...
30
43
  // The project root is everything before /.gsd/projects/ (#2517)
31
44
  const symlinkMarker = `${sep}.gsd${sep}projects${sep}`;