gsd-pi 2.57.0 → 2.58.0-dev.394cb18

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 (834) hide show
  1. package/README.md +1 -1
  2. package/dist/cli.js +58 -35
  3. package/dist/headless-ui.d.ts +17 -0
  4. package/dist/headless-ui.js +97 -3
  5. package/dist/headless.js +67 -6
  6. package/dist/help-text.js +1 -0
  7. package/dist/onboarding.js +44 -0
  8. package/dist/resource-loader.js +16 -1
  9. package/dist/resources/agents/researcher.md +1 -1
  10. package/dist/resources/extensions/ask-user-questions.js +16 -3
  11. package/dist/resources/extensions/async-jobs/extension-manifest.json +1 -1
  12. package/dist/resources/extensions/bg-shell/extension-manifest.json +1 -1
  13. package/dist/resources/extensions/browser-tools/extension-manifest.json +1 -1
  14. package/dist/resources/extensions/claude-code-cli/partial-builder.js +14 -6
  15. package/dist/resources/extensions/claude-code-cli/stream-adapter.js +59 -36
  16. package/dist/resources/extensions/context7/extension-manifest.json +1 -1
  17. package/dist/resources/extensions/get-secrets-from-user.js +8 -5
  18. package/dist/resources/extensions/google-search/extension-manifest.json +1 -1
  19. package/dist/resources/extensions/google-search/index.js +2 -1
  20. package/dist/resources/extensions/gsd/auto/infra-errors.js +4 -0
  21. package/dist/resources/extensions/gsd/auto/phases.js +25 -21
  22. package/dist/resources/extensions/gsd/auto-artifact-paths.js +2 -2
  23. package/dist/resources/extensions/gsd/auto-dashboard.js +37 -20
  24. package/dist/resources/extensions/gsd/auto-dispatch.js +20 -5
  25. package/dist/resources/extensions/gsd/auto-model-selection.js +26 -3
  26. package/dist/resources/extensions/gsd/auto-post-unit.js +16 -4
  27. package/dist/resources/extensions/gsd/auto-prompts.js +1 -1
  28. package/dist/resources/extensions/gsd/auto-recovery.js +13 -5
  29. package/dist/resources/extensions/gsd/auto-start.js +35 -22
  30. package/dist/resources/extensions/gsd/auto-worktree.js +206 -14
  31. package/dist/resources/extensions/gsd/auto.js +4 -0
  32. package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +32 -0
  33. package/dist/resources/extensions/gsd/bootstrap/db-tools.js +82 -9
  34. package/dist/resources/extensions/gsd/bootstrap/dynamic-tools.js +32 -1
  35. package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +42 -34
  36. package/dist/resources/extensions/gsd/bootstrap/system-context.js +66 -12
  37. package/dist/resources/extensions/gsd/bootstrap/write-gate.js +67 -0
  38. package/dist/resources/extensions/gsd/captures.js +56 -4
  39. package/dist/resources/extensions/gsd/codebase-generator.js +279 -0
  40. package/dist/resources/extensions/gsd/commands/catalog.js +10 -1
  41. package/dist/resources/extensions/gsd/commands/handlers/ops.js +5 -0
  42. package/dist/resources/extensions/gsd/commands-codebase.js +115 -0
  43. package/dist/resources/extensions/gsd/commands-prefs-wizard.js +41 -4
  44. package/dist/resources/extensions/gsd/complexity-classifier.js +8 -6
  45. package/dist/resources/extensions/gsd/db-writer.js +116 -8
  46. package/dist/resources/extensions/gsd/dispatch-guard.js +11 -1
  47. package/dist/resources/extensions/gsd/doctor-git-checks.js +76 -1
  48. package/dist/resources/extensions/gsd/doctor-proactive.js +34 -1
  49. package/dist/resources/extensions/gsd/doctor-providers.js +2 -1
  50. package/dist/resources/extensions/gsd/doctor-runtime-checks.js +5 -4
  51. package/dist/resources/extensions/gsd/doctor.js +3 -1
  52. package/dist/resources/extensions/gsd/error-classifier.js +12 -10
  53. package/dist/resources/extensions/gsd/extension-manifest.json +16 -1
  54. package/dist/resources/extensions/gsd/forensics.js +123 -20
  55. package/dist/resources/extensions/gsd/git-service.js +105 -2
  56. package/dist/resources/extensions/gsd/gitignore.js +33 -0
  57. package/dist/resources/extensions/gsd/gsd-db.js +44 -10
  58. package/dist/resources/extensions/gsd/guided-flow.js +106 -44
  59. package/dist/resources/extensions/gsd/health-widget-core.js +31 -0
  60. package/dist/resources/extensions/gsd/health-widget.js +17 -0
  61. package/dist/resources/extensions/gsd/index.js +1 -1
  62. package/dist/resources/extensions/gsd/memory-extractor.js +7 -0
  63. package/dist/resources/extensions/gsd/migrate-external.js +8 -1
  64. package/dist/resources/extensions/gsd/milestone-validation-gates.js +45 -0
  65. package/dist/resources/extensions/gsd/model-cost-table.js +18 -0
  66. package/dist/resources/extensions/gsd/model-router.js +35 -1
  67. package/dist/resources/extensions/gsd/native-git-bridge.js +39 -0
  68. package/dist/resources/extensions/gsd/notifications.js +16 -1
  69. package/dist/resources/extensions/gsd/parallel-eligibility.js +13 -2
  70. package/dist/resources/extensions/gsd/parallel-merge.js +78 -5
  71. package/dist/resources/extensions/gsd/parallel-orchestrator.js +23 -6
  72. package/dist/resources/extensions/gsd/parsers-legacy.js +20 -3
  73. package/dist/resources/extensions/gsd/paths.js +45 -0
  74. package/dist/resources/extensions/gsd/preferences-models.js +14 -1
  75. package/dist/resources/extensions/gsd/preferences-types.js +3 -1
  76. package/dist/resources/extensions/gsd/preferences.js +42 -31
  77. package/dist/resources/extensions/gsd/prompt-loader.js +4 -1
  78. package/dist/resources/extensions/gsd/prompts/complete-milestone.md +1 -1
  79. package/dist/resources/extensions/gsd/prompts/complete-slice.md +4 -2
  80. package/dist/resources/extensions/gsd/prompts/discuss-headless.md +1 -1
  81. package/dist/resources/extensions/gsd/prompts/discuss.md +1 -1
  82. package/dist/resources/extensions/gsd/prompts/execute-task.md +3 -1
  83. package/dist/resources/extensions/gsd/prompts/forensics.md +2 -2
  84. package/dist/resources/extensions/gsd/prompts/guided-discuss-milestone.md +1 -1
  85. package/dist/resources/extensions/gsd/prompts/guided-discuss-slice.md +1 -1
  86. package/dist/resources/extensions/gsd/prompts/plan-slice.md +2 -0
  87. package/dist/resources/extensions/gsd/prompts/rethink.md +1 -1
  88. package/dist/resources/extensions/gsd/prompts/triage-captures.md +1 -0
  89. package/dist/resources/extensions/gsd/prompts/validate-milestone.md +2 -2
  90. package/dist/resources/extensions/gsd/repo-identity.js +205 -11
  91. package/dist/resources/extensions/gsd/rethink.js +5 -0
  92. package/dist/resources/extensions/gsd/roadmap-slices.js +5 -4
  93. package/dist/resources/extensions/gsd/state.js +85 -27
  94. package/dist/resources/extensions/gsd/tests/dist-redirect.mjs +20 -1
  95. package/dist/resources/extensions/gsd/tools/complete-task.js +34 -71
  96. package/dist/resources/extensions/gsd/tools/plan-milestone.js +12 -2
  97. package/dist/resources/extensions/gsd/tools/reassess-roadmap.js +29 -1
  98. package/dist/resources/extensions/gsd/tools/validate-milestone.js +18 -3
  99. package/dist/resources/extensions/gsd/triage-resolution.js +22 -7
  100. package/dist/resources/extensions/gsd/undo.js +2 -2
  101. package/dist/resources/extensions/gsd/unit-ownership.js +164 -33
  102. package/dist/resources/extensions/gsd/verdict-parser.js +20 -8
  103. package/dist/resources/extensions/gsd/watch/header-renderer.js +241 -0
  104. package/dist/resources/extensions/gsd/workflow-manifest.js +24 -5
  105. package/dist/resources/extensions/gsd/workflow-projections.js +95 -63
  106. package/dist/resources/extensions/gsd/workflow-reconcile.js +35 -5
  107. package/dist/resources/extensions/gsd/workspace-index.js +24 -0
  108. package/dist/resources/extensions/gsd/worktree-manager.js +105 -1
  109. package/dist/resources/extensions/gsd/worktree-resolver.js +20 -3
  110. package/dist/resources/extensions/mcp-client/index.js +11 -7
  111. package/dist/resources/extensions/ollama/index.js +112 -0
  112. package/dist/resources/extensions/ollama/model-capabilities.js +115 -0
  113. package/dist/resources/extensions/ollama/ollama-client.js +168 -0
  114. package/dist/resources/extensions/ollama/ollama-commands.js +194 -0
  115. package/dist/resources/extensions/ollama/ollama-discovery.js +69 -0
  116. package/dist/resources/extensions/ollama/ollama-tool.js +184 -0
  117. package/dist/resources/extensions/ollama/types.js +2 -0
  118. package/dist/resources/extensions/search-the-web/extension-manifest.json +1 -1
  119. package/dist/resources/extensions/shared/interview-ui.js +11 -1
  120. package/dist/resources/skills/create-gsd-extension/SKILL.md +5 -3
  121. package/dist/resources/skills/create-gsd-extension/references/key-rules-gotchas.md +5 -4
  122. package/dist/resources/skills/create-gsd-extension/workflows/add-capability.md +2 -2
  123. package/dist/resources/skills/create-gsd-extension/workflows/create-extension.md +4 -4
  124. package/dist/resources/skills/create-gsd-extension/workflows/debug-extension.md +5 -3
  125. package/dist/startup-model-validation.d.ts +39 -0
  126. package/dist/startup-model-validation.js +50 -0
  127. package/dist/web/standalone/.next/BUILD_ID +1 -1
  128. package/dist/web/standalone/.next/app-path-routes-manifest.json +9 -9
  129. package/dist/web/standalone/.next/build-manifest.json +4 -4
  130. package/dist/web/standalone/.next/prerender-manifest.json +3 -3
  131. package/dist/web/standalone/.next/react-loadable-manifest.json +1 -1
  132. package/dist/web/standalone/.next/required-server-files.json +3 -3
  133. package/dist/web/standalone/.next/server/app/_global-error/page.js +3 -3
  134. package/dist/web/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  135. package/dist/web/standalone/.next/server/app/_global-error.html +2 -2
  136. package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
  137. package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  138. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  139. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  140. package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  141. package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  142. package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  143. package/dist/web/standalone/.next/server/app/_not-found/page.js +2 -2
  144. package/dist/web/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  145. package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
  146. package/dist/web/standalone/.next/server/app/_not-found.rsc +4 -4
  147. package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +4 -4
  148. package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  149. package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +4 -4
  150. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  151. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  152. package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  153. package/dist/web/standalone/.next/server/app/api/boot/route.js +1 -1
  154. package/dist/web/standalone/.next/server/app/api/boot/route_client-reference-manifest.js +1 -1
  155. package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js +1 -1
  156. package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route_client-reference-manifest.js +1 -1
  157. package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js +1 -1
  158. package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route_client-reference-manifest.js +1 -1
  159. package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js +2 -2
  160. package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route_client-reference-manifest.js +1 -1
  161. package/dist/web/standalone/.next/server/app/api/browse-directories/route.js +1 -1
  162. package/dist/web/standalone/.next/server/app/api/browse-directories/route_client-reference-manifest.js +1 -1
  163. package/dist/web/standalone/.next/server/app/api/captures/route.js +1 -1
  164. package/dist/web/standalone/.next/server/app/api/captures/route_client-reference-manifest.js +1 -1
  165. package/dist/web/standalone/.next/server/app/api/cleanup/route.js +1 -1
  166. package/dist/web/standalone/.next/server/app/api/cleanup/route_client-reference-manifest.js +1 -1
  167. package/dist/web/standalone/.next/server/app/api/dev-mode/route.js +1 -1
  168. package/dist/web/standalone/.next/server/app/api/dev-mode/route_client-reference-manifest.js +1 -1
  169. package/dist/web/standalone/.next/server/app/api/doctor/route.js +1 -1
  170. package/dist/web/standalone/.next/server/app/api/doctor/route_client-reference-manifest.js +1 -1
  171. package/dist/web/standalone/.next/server/app/api/experimental/route.js +2 -2
  172. package/dist/web/standalone/.next/server/app/api/experimental/route_client-reference-manifest.js +1 -1
  173. package/dist/web/standalone/.next/server/app/api/export-data/route.js +1 -1
  174. package/dist/web/standalone/.next/server/app/api/export-data/route_client-reference-manifest.js +1 -1
  175. package/dist/web/standalone/.next/server/app/api/files/route.js +1 -1
  176. package/dist/web/standalone/.next/server/app/api/files/route_client-reference-manifest.js +1 -1
  177. package/dist/web/standalone/.next/server/app/api/forensics/route.js +1 -1
  178. package/dist/web/standalone/.next/server/app/api/forensics/route_client-reference-manifest.js +1 -1
  179. package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
  180. package/dist/web/standalone/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
  181. package/dist/web/standalone/.next/server/app/api/history/route.js +1 -1
  182. package/dist/web/standalone/.next/server/app/api/history/route_client-reference-manifest.js +1 -1
  183. package/dist/web/standalone/.next/server/app/api/hooks/route.js +1 -1
  184. package/dist/web/standalone/.next/server/app/api/hooks/route_client-reference-manifest.js +1 -1
  185. package/dist/web/standalone/.next/server/app/api/inspect/route.js +1 -1
  186. package/dist/web/standalone/.next/server/app/api/inspect/route_client-reference-manifest.js +1 -1
  187. package/dist/web/standalone/.next/server/app/api/knowledge/route.js +1 -1
  188. package/dist/web/standalone/.next/server/app/api/knowledge/route_client-reference-manifest.js +1 -1
  189. package/dist/web/standalone/.next/server/app/api/live-state/route.js +1 -1
  190. package/dist/web/standalone/.next/server/app/api/live-state/route_client-reference-manifest.js +1 -1
  191. package/dist/web/standalone/.next/server/app/api/onboarding/route.js +1 -1
  192. package/dist/web/standalone/.next/server/app/api/onboarding/route_client-reference-manifest.js +1 -1
  193. package/dist/web/standalone/.next/server/app/api/preferences/route.js +1 -1
  194. package/dist/web/standalone/.next/server/app/api/preferences/route_client-reference-manifest.js +1 -1
  195. package/dist/web/standalone/.next/server/app/api/projects/route.js +1 -1
  196. package/dist/web/standalone/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
  197. package/dist/web/standalone/.next/server/app/api/recovery/route.js +1 -1
  198. package/dist/web/standalone/.next/server/app/api/recovery/route_client-reference-manifest.js +1 -1
  199. package/dist/web/standalone/.next/server/app/api/remote-questions/route.js +2 -2
  200. package/dist/web/standalone/.next/server/app/api/remote-questions/route_client-reference-manifest.js +1 -1
  201. package/dist/web/standalone/.next/server/app/api/session/browser/route.js +1 -1
  202. package/dist/web/standalone/.next/server/app/api/session/browser/route_client-reference-manifest.js +1 -1
  203. package/dist/web/standalone/.next/server/app/api/session/command/route.js +1 -1
  204. package/dist/web/standalone/.next/server/app/api/session/command/route_client-reference-manifest.js +1 -1
  205. package/dist/web/standalone/.next/server/app/api/session/events/route.js +2 -2
  206. package/dist/web/standalone/.next/server/app/api/session/events/route_client-reference-manifest.js +1 -1
  207. package/dist/web/standalone/.next/server/app/api/session/manage/route.js +1 -1
  208. package/dist/web/standalone/.next/server/app/api/session/manage/route_client-reference-manifest.js +1 -1
  209. package/dist/web/standalone/.next/server/app/api/settings-data/route.js +1 -1
  210. package/dist/web/standalone/.next/server/app/api/settings-data/route_client-reference-manifest.js +1 -1
  211. package/dist/web/standalone/.next/server/app/api/shutdown/route.js +1 -1
  212. package/dist/web/standalone/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
  213. package/dist/web/standalone/.next/server/app/api/skill-health/route.js +1 -1
  214. package/dist/web/standalone/.next/server/app/api/skill-health/route_client-reference-manifest.js +1 -1
  215. package/dist/web/standalone/.next/server/app/api/steer/route.js +1 -1
  216. package/dist/web/standalone/.next/server/app/api/steer/route_client-reference-manifest.js +1 -1
  217. package/dist/web/standalone/.next/server/app/api/switch-root/route.js +1 -1
  218. package/dist/web/standalone/.next/server/app/api/switch-root/route_client-reference-manifest.js +1 -1
  219. package/dist/web/standalone/.next/server/app/api/terminal/input/route.js +2 -2
  220. package/dist/web/standalone/.next/server/app/api/terminal/input/route_client-reference-manifest.js +1 -1
  221. package/dist/web/standalone/.next/server/app/api/terminal/resize/route.js +2 -2
  222. package/dist/web/standalone/.next/server/app/api/terminal/resize/route_client-reference-manifest.js +1 -1
  223. package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js +2 -2
  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_client-reference-manifest.js +1 -1
  227. package/dist/web/standalone/.next/server/app/api/terminal/upload/route.js +1 -1
  228. package/dist/web/standalone/.next/server/app/api/terminal/upload/route_client-reference-manifest.js +1 -1
  229. package/dist/web/standalone/.next/server/app/api/undo/route.js +1 -1
  230. package/dist/web/standalone/.next/server/app/api/undo/route_client-reference-manifest.js +1 -1
  231. package/dist/web/standalone/.next/server/app/api/update/route.js +1 -1
  232. package/dist/web/standalone/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
  233. package/dist/web/standalone/.next/server/app/api/visualizer/route.js +1 -1
  234. package/dist/web/standalone/.next/server/app/api/visualizer/route_client-reference-manifest.js +1 -1
  235. package/dist/web/standalone/.next/server/app/index.html +1 -1
  236. package/dist/web/standalone/.next/server/app/index.rsc +5 -5
  237. package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  238. package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +5 -5
  239. package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  240. package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +4 -4
  241. package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  242. package/dist/web/standalone/.next/server/app/page.js +2 -2
  243. package/dist/web/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  244. package/dist/web/standalone/.next/server/app-paths-manifest.json +9 -9
  245. package/dist/web/standalone/.next/server/chunks/2229.js +2 -2
  246. package/dist/web/standalone/.next/server/chunks/7471.js +3 -3
  247. package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
  248. package/dist/web/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
  249. package/dist/web/standalone/.next/server/middleware.js +2 -2
  250. package/dist/web/standalone/.next/server/next-font-manifest.js +1 -1
  251. package/dist/web/standalone/.next/server/next-font-manifest.json +1 -1
  252. package/dist/web/standalone/.next/server/pages/404.html +1 -1
  253. package/dist/web/standalone/.next/server/pages/500.html +2 -2
  254. package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
  255. package/dist/web/standalone/.next/static/chunks/6502.7593d7797a4b3999.js +9 -0
  256. package/dist/web/standalone/.next/static/chunks/app/_not-found/{page-2f24283c162b6ab3.js → page-f2a7482d42a5614b.js} +1 -1
  257. package/dist/web/standalone/.next/static/chunks/app/{layout-9ecfd95f343793f0.js → layout-a16c7a7ecdf0c2cf.js} +1 -1
  258. package/dist/web/standalone/.next/static/chunks/app/page-0c485498795110d6.js +1 -0
  259. package/dist/web/standalone/.next/static/chunks/main-app-fdab67f7802d7832.js +1 -0
  260. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-459824ffb8c323dd.js +1 -0
  261. package/dist/web/standalone/.next/static/chunks/{webpack-4332cbd5dd1be584.js → webpack-a1c1e452c6b32d04.js} +1 -1
  262. package/dist/web/standalone/.next/static/css/f6e8833d46e738d8.css +1 -0
  263. package/dist/web/standalone/node_modules/node-pty/build/Makefile +2 -2
  264. package/dist/web/standalone/node_modules/node-pty/build/Release/pty.node +0 -0
  265. package/dist/web/standalone/node_modules/node-pty/build/pty.target.mk +14 -14
  266. package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api.target.mk +14 -14
  267. package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api_except.target.mk +14 -14
  268. package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api_maybe.target.mk +14 -14
  269. package/dist/web/standalone/server.js +1 -1
  270. package/dist/web-mode.js +2 -1
  271. package/dist/welcome-screen.d.ts +1 -0
  272. package/dist/welcome-screen.js +32 -6
  273. package/package.json +2 -2
  274. package/packages/daemon/src/cli.ts +49 -0
  275. package/packages/daemon/src/daemon.test.ts +104 -1
  276. package/packages/daemon/src/daemon.ts +24 -1
  277. package/packages/daemon/src/discord-bot.ts +73 -3
  278. package/packages/daemon/src/event-bridge.ts +15 -9
  279. package/packages/daemon/src/event-formatter.ts +30 -2
  280. package/packages/daemon/src/index.ts +9 -0
  281. package/packages/daemon/src/launchd.test.ts +356 -0
  282. package/packages/daemon/src/launchd.ts +242 -0
  283. package/packages/daemon/src/message-batcher.test.ts +2 -2
  284. package/packages/daemon/src/message-batcher.ts +9 -3
  285. package/packages/daemon/src/orchestrator.test.ts +1 -0
  286. package/packages/daemon/src/orchestrator.ts +106 -2
  287. package/packages/native/dist/ast/index.js +9 -5
  288. package/packages/native/dist/ast/types.js +2 -1
  289. package/packages/native/dist/clipboard/index.js +12 -7
  290. package/packages/native/dist/clipboard/types.js +2 -1
  291. package/packages/native/dist/diff/index.js +12 -7
  292. package/packages/native/dist/diff/types.js +2 -1
  293. package/packages/native/dist/fd/index.js +6 -3
  294. package/packages/native/dist/fd/types.js +2 -1
  295. package/packages/native/dist/glob/index.js +9 -5
  296. package/packages/native/dist/glob/types.js +2 -1
  297. package/packages/native/dist/grep/index.js +9 -5
  298. package/packages/native/dist/grep/types.js +2 -1
  299. package/packages/native/dist/gsd-parser/index.js +18 -11
  300. package/packages/native/dist/gsd-parser/types.js +2 -1
  301. package/packages/native/dist/highlight/index.js +12 -7
  302. package/packages/native/dist/highlight/types.js +2 -1
  303. package/packages/native/dist/html/index.js +6 -3
  304. package/packages/native/dist/html/types.js +2 -1
  305. package/packages/native/dist/image/index.js +10 -5
  306. package/packages/native/dist/image/types.js +7 -4
  307. package/packages/native/dist/index.js +70 -17
  308. package/packages/native/dist/json-parse/index.js +13 -8
  309. package/packages/native/dist/native.js +47 -10
  310. package/packages/native/dist/ps/index.js +15 -9
  311. package/packages/native/dist/ps/types.js +2 -1
  312. package/packages/native/dist/stream-process/index.js +12 -7
  313. package/packages/native/dist/text/index.js +24 -14
  314. package/packages/native/dist/text/types.js +5 -2
  315. package/packages/native/dist/truncate/index.js +12 -7
  316. package/packages/native/dist/ttsr/index.js +12 -7
  317. package/packages/native/dist/ttsr/types.js +2 -1
  318. package/packages/native/dist/xxhash/index.js +9 -5
  319. package/packages/native/package.json +19 -19
  320. package/packages/native/src/__tests__/module-compat.test.mjs +91 -0
  321. package/packages/native/src/native.ts +9 -8
  322. package/packages/pi-agent-core/dist/agent-loop.js +3 -2
  323. package/packages/pi-agent-core/dist/agent-loop.js.map +1 -1
  324. package/packages/pi-agent-core/dist/proxy.d.ts +1 -1
  325. package/packages/pi-agent-core/dist/proxy.d.ts.map +1 -1
  326. package/packages/pi-agent-core/dist/proxy.js.map +1 -1
  327. package/packages/pi-agent-core/src/agent-loop.test.ts +45 -0
  328. package/packages/pi-agent-core/src/agent-loop.ts +3 -2
  329. package/packages/pi-agent-core/src/proxy.ts +1 -1
  330. package/packages/pi-ai/dist/env-api-keys.js +1 -0
  331. package/packages/pi-ai/dist/env-api-keys.js.map +1 -1
  332. package/packages/pi-ai/dist/index.d.ts +1 -0
  333. package/packages/pi-ai/dist/index.d.ts.map +1 -1
  334. package/packages/pi-ai/dist/index.js +1 -0
  335. package/packages/pi-ai/dist/index.js.map +1 -1
  336. package/packages/pi-ai/dist/providers/anthropic-shared.d.ts.map +1 -1
  337. package/packages/pi-ai/dist/providers/anthropic-shared.js +19 -2
  338. package/packages/pi-ai/dist/providers/anthropic-shared.js.map +1 -1
  339. package/packages/pi-ai/dist/providers/anthropic-shared.test.d.ts +2 -0
  340. package/packages/pi-ai/dist/providers/anthropic-shared.test.d.ts.map +1 -0
  341. package/packages/pi-ai/dist/providers/anthropic-shared.test.js +25 -0
  342. package/packages/pi-ai/dist/providers/anthropic-shared.test.js.map +1 -0
  343. package/packages/pi-ai/dist/types.d.ts +3 -3
  344. package/packages/pi-ai/dist/types.d.ts.map +1 -1
  345. package/packages/pi-ai/dist/types.js.map +1 -1
  346. package/packages/pi-ai/dist/utils/json-parse.d.ts +3 -0
  347. package/packages/pi-ai/dist/utils/json-parse.d.ts.map +1 -1
  348. package/packages/pi-ai/dist/utils/json-parse.js +24 -1
  349. package/packages/pi-ai/dist/utils/json-parse.js.map +1 -1
  350. package/packages/pi-ai/dist/utils/repair-tool-json.d.ts +37 -0
  351. package/packages/pi-ai/dist/utils/repair-tool-json.d.ts.map +1 -0
  352. package/packages/pi-ai/dist/utils/repair-tool-json.js +75 -0
  353. package/packages/pi-ai/dist/utils/repair-tool-json.js.map +1 -0
  354. package/packages/pi-ai/dist/utils/tests/repair-tool-json.test.d.ts +2 -0
  355. package/packages/pi-ai/dist/utils/tests/repair-tool-json.test.d.ts.map +1 -0
  356. package/packages/pi-ai/dist/utils/tests/repair-tool-json.test.js +73 -0
  357. package/packages/pi-ai/dist/utils/tests/repair-tool-json.test.js.map +1 -0
  358. package/packages/pi-ai/src/env-api-keys.ts +1 -0
  359. package/packages/pi-ai/src/index.ts +1 -0
  360. package/packages/pi-ai/src/providers/anthropic-shared.test.ts +29 -0
  361. package/packages/pi-ai/src/providers/anthropic-shared.ts +17 -2
  362. package/packages/pi-ai/src/types.ts +3 -2
  363. package/packages/pi-ai/src/utils/json-parse.ts +28 -1
  364. package/packages/pi-ai/src/utils/repair-tool-json.ts +88 -0
  365. package/packages/pi-ai/src/utils/tests/repair-tool-json.test.ts +102 -0
  366. package/packages/pi-coding-agent/dist/core/agent-session.d.ts +4 -0
  367. package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
  368. package/packages/pi-coding-agent/dist/core/agent-session.js +31 -0
  369. package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
  370. package/packages/pi-coding-agent/dist/core/compaction/compaction.d.ts +17 -1
  371. package/packages/pi-coding-agent/dist/core/compaction/compaction.d.ts.map +1 -1
  372. package/packages/pi-coding-agent/dist/core/compaction/compaction.js +62 -2
  373. package/packages/pi-coding-agent/dist/core/compaction/compaction.js.map +1 -1
  374. package/packages/pi-coding-agent/dist/core/compaction/compaction.test.d.ts +6 -0
  375. package/packages/pi-coding-agent/dist/core/compaction/compaction.test.d.ts.map +1 -0
  376. package/packages/pi-coding-agent/dist/core/compaction/compaction.test.js +176 -0
  377. package/packages/pi-coding-agent/dist/core/compaction/compaction.test.js.map +1 -0
  378. package/packages/pi-coding-agent/dist/core/exec.d.ts.map +1 -1
  379. package/packages/pi-coding-agent/dist/core/exec.js +3 -1
  380. package/packages/pi-coding-agent/dist/core/exec.js.map +1 -1
  381. package/packages/pi-coding-agent/dist/core/extensions/extension-manifest.d.ts +28 -0
  382. package/packages/pi-coding-agent/dist/core/extensions/extension-manifest.d.ts.map +1 -0
  383. package/packages/pi-coding-agent/dist/core/extensions/extension-manifest.js +37 -0
  384. package/packages/pi-coding-agent/dist/core/extensions/extension-manifest.js.map +1 -0
  385. package/packages/pi-coding-agent/dist/core/extensions/extension-manifest.test.d.ts +2 -0
  386. package/packages/pi-coding-agent/dist/core/extensions/extension-manifest.test.d.ts.map +1 -0
  387. package/packages/pi-coding-agent/dist/core/extensions/extension-manifest.test.js +63 -0
  388. package/packages/pi-coding-agent/dist/core/extensions/extension-manifest.test.js.map +1 -0
  389. package/packages/pi-coding-agent/dist/core/extensions/extension-sort.d.ts +19 -0
  390. package/packages/pi-coding-agent/dist/core/extensions/extension-sort.d.ts.map +1 -0
  391. package/packages/pi-coding-agent/dist/core/extensions/extension-sort.js +115 -0
  392. package/packages/pi-coding-agent/dist/core/extensions/extension-sort.js.map +1 -0
  393. package/packages/pi-coding-agent/dist/core/extensions/extension-sort.test.d.ts +2 -0
  394. package/packages/pi-coding-agent/dist/core/extensions/extension-sort.test.d.ts.map +1 -0
  395. package/packages/pi-coding-agent/dist/core/extensions/extension-sort.test.js +109 -0
  396. package/packages/pi-coding-agent/dist/core/extensions/extension-sort.test.js.map +1 -0
  397. package/packages/pi-coding-agent/dist/core/extensions/index.d.ts +4 -0
  398. package/packages/pi-coding-agent/dist/core/extensions/index.d.ts.map +1 -1
  399. package/packages/pi-coding-agent/dist/core/extensions/index.js +2 -0
  400. package/packages/pi-coding-agent/dist/core/extensions/index.js.map +1 -1
  401. package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts +5 -0
  402. package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
  403. package/packages/pi-coding-agent/dist/core/extensions/loader.js +5 -0
  404. package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
  405. package/packages/pi-coding-agent/dist/core/image-overflow-recovery.d.ts +44 -0
  406. package/packages/pi-coding-agent/dist/core/image-overflow-recovery.d.ts.map +1 -0
  407. package/packages/pi-coding-agent/dist/core/image-overflow-recovery.js +97 -0
  408. package/packages/pi-coding-agent/dist/core/image-overflow-recovery.js.map +1 -0
  409. package/packages/pi-coding-agent/dist/core/image-overflow-recovery.test.d.ts +2 -0
  410. package/packages/pi-coding-agent/dist/core/image-overflow-recovery.test.d.ts.map +1 -0
  411. package/packages/pi-coding-agent/dist/core/image-overflow-recovery.test.js +181 -0
  412. package/packages/pi-coding-agent/dist/core/image-overflow-recovery.test.js.map +1 -0
  413. package/packages/pi-coding-agent/dist/core/index.d.ts +1 -1
  414. package/packages/pi-coding-agent/dist/core/index.d.ts.map +1 -1
  415. package/packages/pi-coding-agent/dist/core/index.js +1 -1
  416. package/packages/pi-coding-agent/dist/core/index.js.map +1 -1
  417. package/packages/pi-coding-agent/dist/core/lsp/index.d.ts.map +1 -1
  418. package/packages/pi-coding-agent/dist/core/lsp/index.js +3 -0
  419. package/packages/pi-coding-agent/dist/core/lsp/index.js.map +1 -1
  420. package/packages/pi-coding-agent/dist/core/lsp/lspmux.d.ts.map +1 -1
  421. package/packages/pi-coding-agent/dist/core/lsp/lspmux.js +3 -0
  422. package/packages/pi-coding-agent/dist/core/lsp/lspmux.js.map +1 -1
  423. package/packages/pi-coding-agent/dist/core/messages.d.ts.map +1 -1
  424. package/packages/pi-coding-agent/dist/core/messages.js +31 -2
  425. package/packages/pi-coding-agent/dist/core/messages.js.map +1 -1
  426. package/packages/pi-coding-agent/dist/core/messages.test.d.ts +9 -0
  427. package/packages/pi-coding-agent/dist/core/messages.test.d.ts.map +1 -0
  428. package/packages/pi-coding-agent/dist/core/messages.test.js +86 -0
  429. package/packages/pi-coding-agent/dist/core/messages.test.js.map +1 -0
  430. package/packages/pi-coding-agent/dist/core/model-resolver.d.ts.map +1 -1
  431. package/packages/pi-coding-agent/dist/core/model-resolver.js +1 -0
  432. package/packages/pi-coding-agent/dist/core/model-resolver.js.map +1 -1
  433. package/packages/pi-coding-agent/dist/core/resource-loader.d.ts +10 -0
  434. package/packages/pi-coding-agent/dist/core/resource-loader.d.ts.map +1 -1
  435. package/packages/pi-coding-agent/dist/core/resource-loader.js +12 -1
  436. package/packages/pi-coding-agent/dist/core/resource-loader.js.map +1 -1
  437. package/packages/pi-coding-agent/dist/core/retry-handler.d.ts +6 -0
  438. package/packages/pi-coding-agent/dist/core/retry-handler.d.ts.map +1 -1
  439. package/packages/pi-coding-agent/dist/core/retry-handler.js +48 -1
  440. package/packages/pi-coding-agent/dist/core/retry-handler.js.map +1 -1
  441. package/packages/pi-coding-agent/dist/core/retry-handler.test.d.ts +9 -0
  442. package/packages/pi-coding-agent/dist/core/retry-handler.test.d.ts.map +1 -0
  443. package/packages/pi-coding-agent/dist/core/retry-handler.test.js +193 -0
  444. package/packages/pi-coding-agent/dist/core/retry-handler.test.js.map +1 -0
  445. package/packages/pi-coding-agent/dist/core/tools/hashline-read.d.ts.map +1 -1
  446. package/packages/pi-coding-agent/dist/core/tools/hashline-read.js +10 -3
  447. package/packages/pi-coding-agent/dist/core/tools/hashline-read.js.map +1 -1
  448. package/packages/pi-coding-agent/dist/core/tools/read.d.ts.map +1 -1
  449. package/packages/pi-coding-agent/dist/core/tools/read.js +13 -4
  450. package/packages/pi-coding-agent/dist/core/tools/read.js.map +1 -1
  451. package/packages/pi-coding-agent/dist/core/tools/spawn-shell-windows.test.d.ts +16 -0
  452. package/packages/pi-coding-agent/dist/core/tools/spawn-shell-windows.test.d.ts.map +1 -0
  453. package/packages/pi-coding-agent/dist/core/tools/spawn-shell-windows.test.js +80 -0
  454. package/packages/pi-coding-agent/dist/core/tools/spawn-shell-windows.test.js.map +1 -0
  455. package/packages/pi-coding-agent/dist/index.d.ts +2 -2
  456. package/packages/pi-coding-agent/dist/index.d.ts.map +1 -1
  457. package/packages/pi-coding-agent/dist/index.js +1 -1
  458. package/packages/pi-coding-agent/dist/index.js.map +1 -1
  459. package/packages/pi-coding-agent/dist/modes/interactive/components/armin.d.ts +1 -1
  460. package/packages/pi-coding-agent/dist/modes/interactive/components/armin.d.ts.map +1 -1
  461. package/packages/pi-coding-agent/dist/modes/interactive/components/armin.js +9 -8
  462. package/packages/pi-coding-agent/dist/modes/interactive/components/armin.js.map +1 -1
  463. package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  464. package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js +0 -3
  465. package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js.map +1 -1
  466. package/packages/pi-coding-agent/dist/modes/interactive/components/bash-execution.d.ts +1 -0
  467. package/packages/pi-coding-agent/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
  468. package/packages/pi-coding-agent/dist/modes/interactive/components/bash-execution.js +2 -1
  469. package/packages/pi-coding-agent/dist/modes/interactive/components/bash-execution.js.map +1 -1
  470. package/packages/pi-coding-agent/dist/modes/interactive/components/bordered-loader.js +1 -1
  471. package/packages/pi-coding-agent/dist/modes/interactive/components/bordered-loader.js.map +1 -1
  472. package/packages/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.js +1 -1
  473. package/packages/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
  474. package/packages/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.js +1 -1
  475. package/packages/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
  476. package/packages/pi-coding-agent/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
  477. package/packages/pi-coding-agent/dist/modes/interactive/components/config-selector.js +5 -2
  478. package/packages/pi-coding-agent/dist/modes/interactive/components/config-selector.js.map +1 -1
  479. package/packages/pi-coding-agent/dist/modes/interactive/components/countdown-timer.d.ts +1 -0
  480. package/packages/pi-coding-agent/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -1
  481. package/packages/pi-coding-agent/dist/modes/interactive/components/countdown-timer.js +4 -0
  482. package/packages/pi-coding-agent/dist/modes/interactive/components/countdown-timer.js.map +1 -1
  483. package/packages/pi-coding-agent/dist/modes/interactive/components/custom-message.js +1 -1
  484. package/packages/pi-coding-agent/dist/modes/interactive/components/custom-message.js.map +1 -1
  485. package/packages/pi-coding-agent/dist/modes/interactive/components/daxnuts.d.ts +1 -1
  486. package/packages/pi-coding-agent/dist/modes/interactive/components/daxnuts.d.ts.map +1 -1
  487. package/packages/pi-coding-agent/dist/modes/interactive/components/daxnuts.js +4 -2
  488. package/packages/pi-coding-agent/dist/modes/interactive/components/daxnuts.js.map +1 -1
  489. package/packages/pi-coding-agent/dist/modes/interactive/components/diff.js +2 -2
  490. package/packages/pi-coding-agent/dist/modes/interactive/components/diff.js.map +1 -1
  491. package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
  492. package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.js +8 -1
  493. package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.js.map +1 -1
  494. package/packages/pi-coding-agent/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
  495. package/packages/pi-coding-agent/dist/modes/interactive/components/extension-input.js +2 -0
  496. package/packages/pi-coding-agent/dist/modes/interactive/components/extension-input.js.map +1 -1
  497. package/packages/pi-coding-agent/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
  498. package/packages/pi-coding-agent/dist/modes/interactive/components/extension-selector.js +4 -0
  499. package/packages/pi-coding-agent/dist/modes/interactive/components/extension-selector.js.map +1 -1
  500. package/packages/pi-coding-agent/dist/modes/interactive/components/footer.d.ts.map +1 -1
  501. package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js +26 -12
  502. package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js.map +1 -1
  503. package/packages/pi-coding-agent/dist/modes/interactive/components/oauth-selector.js +4 -4
  504. package/packages/pi-coding-agent/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  505. package/packages/pi-coding-agent/dist/modes/interactive/components/provider-manager.d.ts +3 -0
  506. package/packages/pi-coding-agent/dist/modes/interactive/components/provider-manager.d.ts.map +1 -1
  507. package/packages/pi-coding-agent/dist/modes/interactive/components/provider-manager.js +46 -14
  508. package/packages/pi-coding-agent/dist/modes/interactive/components/provider-manager.js.map +1 -1
  509. package/packages/pi-coding-agent/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  510. package/packages/pi-coding-agent/dist/modes/interactive/components/scoped-models-selector.js +2 -8
  511. package/packages/pi-coding-agent/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  512. package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.js +4 -4
  513. package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.js.map +1 -1
  514. package/packages/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.js +2 -2
  515. package/packages/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
  516. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  517. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +8 -3
  518. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
  519. package/packages/pi-coding-agent/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
  520. package/packages/pi-coding-agent/dist/modes/interactive/components/user-message-selector.js +3 -2
  521. package/packages/pi-coding-agent/dist/modes/interactive/components/user-message-selector.js.map +1 -1
  522. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
  523. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +19 -1
  524. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
  525. package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.d.ts.map +1 -1
  526. package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.js +16 -1
  527. package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.js.map +1 -1
  528. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +1 -0
  529. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  530. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +27 -4
  531. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
  532. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.d.ts.map +1 -1
  533. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.js +6 -0
  534. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.js.map +1 -1
  535. package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js +1 -1
  536. package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js.map +1 -1
  537. package/packages/pi-coding-agent/dist/modes/rpc/remote-terminal.d.ts +1 -0
  538. package/packages/pi-coding-agent/dist/modes/rpc/remote-terminal.d.ts.map +1 -1
  539. package/packages/pi-coding-agent/dist/modes/rpc/remote-terminal.js +5 -0
  540. package/packages/pi-coding-agent/dist/modes/rpc/remote-terminal.js.map +1 -1
  541. package/packages/pi-coding-agent/package.json +1 -1
  542. package/packages/pi-coding-agent/src/core/agent-session.ts +38 -1
  543. package/packages/pi-coding-agent/src/core/compaction/compaction.test.ts +236 -0
  544. package/packages/pi-coding-agent/src/core/compaction/compaction.ts +94 -1
  545. package/packages/pi-coding-agent/src/core/exec.ts +3 -1
  546. package/packages/pi-coding-agent/src/core/extensions/extension-manifest.test.ts +77 -0
  547. package/packages/pi-coding-agent/src/core/extensions/extension-manifest.ts +62 -0
  548. package/packages/pi-coding-agent/src/core/extensions/extension-sort.test.ts +134 -0
  549. package/packages/pi-coding-agent/src/core/extensions/extension-sort.ts +137 -0
  550. package/packages/pi-coding-agent/src/core/extensions/index.ts +4 -0
  551. package/packages/pi-coding-agent/src/core/extensions/loader.ts +5 -0
  552. package/packages/pi-coding-agent/src/core/image-overflow-recovery.test.ts +228 -0
  553. package/packages/pi-coding-agent/src/core/image-overflow-recovery.ts +118 -0
  554. package/packages/pi-coding-agent/src/core/index.ts +6 -0
  555. package/packages/pi-coding-agent/src/core/lsp/index.ts +3 -0
  556. package/packages/pi-coding-agent/src/core/lsp/lspmux.ts +3 -0
  557. package/packages/pi-coding-agent/src/core/messages.test.ts +114 -0
  558. package/packages/pi-coding-agent/src/core/messages.ts +29 -2
  559. package/packages/pi-coding-agent/src/core/model-resolver.ts +1 -0
  560. package/packages/pi-coding-agent/src/core/resource-loader.ts +20 -1
  561. package/packages/pi-coding-agent/src/core/retry-handler.test.ts +255 -0
  562. package/packages/pi-coding-agent/src/core/retry-handler.ts +52 -1
  563. package/packages/pi-coding-agent/src/core/tools/hashline-read.ts +11 -3
  564. package/packages/pi-coding-agent/src/core/tools/read.ts +14 -4
  565. package/packages/pi-coding-agent/src/core/tools/spawn-shell-windows.test.ts +92 -0
  566. package/packages/pi-coding-agent/src/index.ts +6 -0
  567. package/packages/pi-coding-agent/src/modes/interactive/components/armin.ts +9 -9
  568. package/packages/pi-coding-agent/src/modes/interactive/components/assistant-message.ts +0 -2
  569. package/packages/pi-coding-agent/src/modes/interactive/components/bash-execution.ts +3 -1
  570. package/packages/pi-coding-agent/src/modes/interactive/components/bordered-loader.ts +1 -1
  571. package/packages/pi-coding-agent/src/modes/interactive/components/branch-summary-message.ts +1 -1
  572. package/packages/pi-coding-agent/src/modes/interactive/components/compaction-summary-message.ts +1 -1
  573. package/packages/pi-coding-agent/src/modes/interactive/components/config-selector.ts +7 -2
  574. package/packages/pi-coding-agent/src/modes/interactive/components/countdown-timer.ts +3 -0
  575. package/packages/pi-coding-agent/src/modes/interactive/components/custom-message.ts +1 -1
  576. package/packages/pi-coding-agent/src/modes/interactive/components/daxnuts.ts +4 -3
  577. package/packages/pi-coding-agent/src/modes/interactive/components/diff.ts +2 -2
  578. package/packages/pi-coding-agent/src/modes/interactive/components/dynamic-border.ts +3 -1
  579. package/packages/pi-coding-agent/src/modes/interactive/components/extension-input.ts +1 -0
  580. package/packages/pi-coding-agent/src/modes/interactive/components/extension-selector.ts +4 -0
  581. package/packages/pi-coding-agent/src/modes/interactive/components/footer.ts +27 -13
  582. package/packages/pi-coding-agent/src/modes/interactive/components/oauth-selector.ts +4 -4
  583. package/packages/pi-coding-agent/src/modes/interactive/components/provider-manager.ts +45 -14
  584. package/packages/pi-coding-agent/src/modes/interactive/components/scoped-models-selector.ts +2 -7
  585. package/packages/pi-coding-agent/src/modes/interactive/components/session-selector.ts +4 -4
  586. package/packages/pi-coding-agent/src/modes/interactive/components/skill-invocation-message.ts +2 -2
  587. package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +8 -3
  588. package/packages/pi-coding-agent/src/modes/interactive/components/user-message-selector.ts +3 -2
  589. package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +24 -1
  590. package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.ts +14 -1
  591. package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +35 -3
  592. package/packages/pi-coding-agent/src/modes/interactive/slash-command-handlers.ts +7 -0
  593. package/packages/pi-coding-agent/src/modes/interactive/theme/themes.ts +1 -1
  594. package/packages/pi-coding-agent/src/modes/rpc/remote-terminal.ts +6 -0
  595. package/packages/pi-tui/dist/terminal.d.ts +2 -0
  596. package/packages/pi-tui/dist/terminal.d.ts.map +1 -1
  597. package/packages/pi-tui/dist/terminal.js +9 -0
  598. package/packages/pi-tui/dist/terminal.js.map +1 -1
  599. package/packages/pi-tui/dist/tui.d.ts.map +1 -1
  600. package/packages/pi-tui/dist/tui.js +9 -0
  601. package/packages/pi-tui/dist/tui.js.map +1 -1
  602. package/packages/pi-tui/src/terminal.ts +14 -0
  603. package/packages/pi-tui/src/tui.ts +8 -0
  604. package/pkg/dist/modes/interactive/theme/themes.js +1 -1
  605. package/pkg/dist/modes/interactive/theme/themes.js.map +1 -1
  606. package/pkg/package.json +1 -1
  607. package/scripts/ensure-workspace-builds.cjs +45 -14
  608. package/src/resources/agents/researcher.md +1 -1
  609. package/src/resources/extensions/ask-user-questions.ts +21 -3
  610. package/src/resources/extensions/async-jobs/extension-manifest.json +1 -1
  611. package/src/resources/extensions/bg-shell/extension-manifest.json +1 -1
  612. package/src/resources/extensions/browser-tools/extension-manifest.json +1 -1
  613. package/src/resources/extensions/claude-code-cli/partial-builder.ts +13 -6
  614. package/src/resources/extensions/claude-code-cli/stream-adapter.ts +63 -35
  615. package/src/resources/extensions/claude-code-cli/tests/partial-builder.test.ts +28 -0
  616. package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +108 -1
  617. package/src/resources/extensions/context7/extension-manifest.json +1 -1
  618. package/src/resources/extensions/get-secrets-from-user.ts +8 -5
  619. package/src/resources/extensions/google-search/extension-manifest.json +1 -1
  620. package/src/resources/extensions/google-search/index.ts +2 -1
  621. package/src/resources/extensions/gsd/auto/infra-errors.ts +3 -0
  622. package/src/resources/extensions/gsd/auto/loop-deps.ts +1 -0
  623. package/src/resources/extensions/gsd/auto/phases.ts +43 -34
  624. package/src/resources/extensions/gsd/auto-artifact-paths.ts +2 -2
  625. package/src/resources/extensions/gsd/auto-dashboard.ts +37 -19
  626. package/src/resources/extensions/gsd/auto-dispatch.ts +21 -5
  627. package/src/resources/extensions/gsd/auto-model-selection.ts +26 -5
  628. package/src/resources/extensions/gsd/auto-post-unit.ts +18 -4
  629. package/src/resources/extensions/gsd/auto-prompts.ts +1 -1
  630. package/src/resources/extensions/gsd/auto-recovery.ts +12 -5
  631. package/src/resources/extensions/gsd/auto-start.ts +35 -26
  632. package/src/resources/extensions/gsd/auto-worktree.ts +200 -11
  633. package/src/resources/extensions/gsd/auto.ts +5 -0
  634. package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +31 -0
  635. package/src/resources/extensions/gsd/bootstrap/db-tools.ts +87 -9
  636. package/src/resources/extensions/gsd/bootstrap/dynamic-tools.ts +38 -1
  637. package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +41 -35
  638. package/src/resources/extensions/gsd/bootstrap/system-context.ts +72 -12
  639. package/src/resources/extensions/gsd/bootstrap/write-gate.ts +75 -0
  640. package/src/resources/extensions/gsd/captures.ts +63 -3
  641. package/src/resources/extensions/gsd/codebase-generator.ts +351 -0
  642. package/src/resources/extensions/gsd/commands/catalog.ts +10 -1
  643. package/src/resources/extensions/gsd/commands/handlers/ops.ts +5 -0
  644. package/src/resources/extensions/gsd/commands-codebase.ts +164 -0
  645. package/src/resources/extensions/gsd/commands-prefs-wizard.ts +46 -4
  646. package/src/resources/extensions/gsd/complexity-classifier.ts +8 -6
  647. package/src/resources/extensions/gsd/db-writer.ts +140 -7
  648. package/src/resources/extensions/gsd/dispatch-guard.ts +12 -1
  649. package/src/resources/extensions/gsd/doctor-git-checks.ts +75 -1
  650. package/src/resources/extensions/gsd/doctor-proactive.ts +35 -1
  651. package/src/resources/extensions/gsd/doctor-providers.ts +2 -1
  652. package/src/resources/extensions/gsd/doctor-runtime-checks.ts +5 -4
  653. package/src/resources/extensions/gsd/doctor-types.ts +2 -0
  654. package/src/resources/extensions/gsd/doctor.ts +3 -1
  655. package/src/resources/extensions/gsd/error-classifier.ts +13 -11
  656. package/src/resources/extensions/gsd/extension-manifest.json +16 -1
  657. package/src/resources/extensions/gsd/forensics.ts +144 -20
  658. package/src/resources/extensions/gsd/git-service.ts +119 -3
  659. package/src/resources/extensions/gsd/gitignore.ts +33 -0
  660. package/src/resources/extensions/gsd/gsd-db.ts +49 -8
  661. package/src/resources/extensions/gsd/guided-flow.ts +114 -45
  662. package/src/resources/extensions/gsd/health-widget-core.ts +34 -0
  663. package/src/resources/extensions/gsd/health-widget.ts +17 -0
  664. package/src/resources/extensions/gsd/index.ts +1 -0
  665. package/src/resources/extensions/gsd/memory-extractor.ts +8 -0
  666. package/src/resources/extensions/gsd/migrate-external.ts +9 -1
  667. package/src/resources/extensions/gsd/milestone-validation-gates.ts +56 -0
  668. package/src/resources/extensions/gsd/model-cost-table.ts +19 -0
  669. package/src/resources/extensions/gsd/model-router.ts +35 -1
  670. package/src/resources/extensions/gsd/native-git-bridge.ts +41 -0
  671. package/src/resources/extensions/gsd/notifications.ts +16 -0
  672. package/src/resources/extensions/gsd/parallel-eligibility.ts +15 -2
  673. package/src/resources/extensions/gsd/parallel-merge.ts +87 -4
  674. package/src/resources/extensions/gsd/parallel-orchestrator.ts +23 -6
  675. package/src/resources/extensions/gsd/parsers-legacy.ts +22 -3
  676. package/src/resources/extensions/gsd/paths.ts +44 -0
  677. package/src/resources/extensions/gsd/preferences-models.ts +14 -1
  678. package/src/resources/extensions/gsd/preferences-types.ts +10 -1
  679. package/src/resources/extensions/gsd/preferences.ts +45 -29
  680. package/src/resources/extensions/gsd/prompt-loader.ts +4 -1
  681. package/src/resources/extensions/gsd/prompts/complete-milestone.md +1 -1
  682. package/src/resources/extensions/gsd/prompts/complete-slice.md +4 -2
  683. package/src/resources/extensions/gsd/prompts/discuss-headless.md +1 -1
  684. package/src/resources/extensions/gsd/prompts/discuss.md +1 -1
  685. package/src/resources/extensions/gsd/prompts/execute-task.md +3 -1
  686. package/src/resources/extensions/gsd/prompts/forensics.md +2 -2
  687. package/src/resources/extensions/gsd/prompts/guided-discuss-milestone.md +1 -1
  688. package/src/resources/extensions/gsd/prompts/guided-discuss-slice.md +1 -1
  689. package/src/resources/extensions/gsd/prompts/plan-slice.md +2 -0
  690. package/src/resources/extensions/gsd/prompts/rethink.md +1 -1
  691. package/src/resources/extensions/gsd/prompts/triage-captures.md +1 -0
  692. package/src/resources/extensions/gsd/prompts/validate-milestone.md +2 -2
  693. package/src/resources/extensions/gsd/repo-identity.ts +186 -11
  694. package/src/resources/extensions/gsd/rethink.ts +6 -0
  695. package/src/resources/extensions/gsd/roadmap-slices.ts +5 -4
  696. package/src/resources/extensions/gsd/state.ts +84 -32
  697. package/src/resources/extensions/gsd/tests/auto-loop.test.ts +47 -0
  698. package/src/resources/extensions/gsd/tests/auto-mode-interactive-guard.test.ts +71 -0
  699. package/src/resources/extensions/gsd/tests/auto-model-selection.test.ts +71 -1
  700. package/src/resources/extensions/gsd/tests/captures.test.ts +103 -0
  701. package/src/resources/extensions/gsd/tests/cli-provider-rate-limit.test.ts +47 -0
  702. package/src/resources/extensions/gsd/tests/codebase-generator.test.ts +488 -0
  703. package/src/resources/extensions/gsd/tests/complete-milestone.test.ts +27 -0
  704. package/src/resources/extensions/gsd/tests/complete-slice.test.ts +21 -0
  705. package/src/resources/extensions/gsd/tests/completion-hierarchy-guards.test.ts +192 -0
  706. package/src/resources/extensions/gsd/tests/complexity-classifier.test.ts +4 -4
  707. package/src/resources/extensions/gsd/tests/db-path-worktree-symlink.test.ts +131 -0
  708. package/src/resources/extensions/gsd/tests/db-writer.test.ts +7 -12
  709. package/src/resources/extensions/gsd/tests/derive-state-db.test.ts +78 -5
  710. package/src/resources/extensions/gsd/tests/derive-state.test.ts +29 -0
  711. package/src/resources/extensions/gsd/tests/discord-invite-links.test.ts +47 -0
  712. package/src/resources/extensions/gsd/tests/discuss-empty-db-fallback.test.ts +127 -0
  713. package/src/resources/extensions/gsd/tests/discuss-queued-milestones.test.ts +40 -0
  714. package/src/resources/extensions/gsd/tests/dispatch-guard.test.ts +47 -0
  715. package/src/resources/extensions/gsd/tests/dist-redirect.mjs +20 -1
  716. package/src/resources/extensions/gsd/tests/doctor-providers.test.ts +117 -0
  717. package/src/resources/extensions/gsd/tests/dynamic-routing-default.test.ts +20 -0
  718. package/src/resources/extensions/gsd/tests/empty-content-abort-loop.test.ts +74 -0
  719. package/src/resources/extensions/gsd/tests/event-replay-idempotency.test.ts +140 -0
  720. package/src/resources/extensions/gsd/tests/forensics-context-persist.test.ts +129 -0
  721. package/src/resources/extensions/gsd/tests/forensics-db-completion.test.ts +96 -0
  722. package/src/resources/extensions/gsd/tests/forensics-dedup.test.ts +31 -0
  723. package/src/resources/extensions/gsd/tests/gsd-tools.test.ts +125 -12
  724. package/src/resources/extensions/gsd/tests/gsdroot-worktree-detection.test.ts +164 -0
  725. package/src/resources/extensions/gsd/tests/guided-flow-dynamic-routing.test.ts +135 -0
  726. package/src/resources/extensions/gsd/tests/guided-flow-session-isolation.test.ts +97 -0
  727. package/src/resources/extensions/gsd/tests/health-widget.test.ts +67 -0
  728. package/src/resources/extensions/gsd/tests/hook-key-parsing.test.ts +107 -0
  729. package/src/resources/extensions/gsd/tests/integration/auto-recovery.test.ts +111 -1
  730. package/src/resources/extensions/gsd/tests/integration/auto-worktree-milestone-merge.test.ts +134 -0
  731. package/src/resources/extensions/gsd/tests/integration/auto-worktree.test.ts +59 -0
  732. package/src/resources/extensions/gsd/tests/integration/doctor-false-positives.test.ts +243 -0
  733. package/src/resources/extensions/gsd/tests/integration/doctor-git.test.ts +72 -0
  734. package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +68 -0
  735. package/src/resources/extensions/gsd/tests/integration/gitignore-staging-2570.test.ts +150 -0
  736. package/src/resources/extensions/gsd/tests/integration/parallel-merge.test.ts +110 -0
  737. package/src/resources/extensions/gsd/tests/integration/run-uat.test.ts +1 -1
  738. package/src/resources/extensions/gsd/tests/integration/state-machine-live-validation.test.ts +959 -0
  739. package/src/resources/extensions/gsd/tests/memory-extractor.test.ts +85 -2
  740. package/src/resources/extensions/gsd/tests/migrate-external-worktree.test.ts +105 -0
  741. package/src/resources/extensions/gsd/tests/milestone-status-authoritative.test.ts +116 -0
  742. package/src/resources/extensions/gsd/tests/model-cost-table.test.ts +34 -0
  743. package/src/resources/extensions/gsd/tests/model-router.test.ts +68 -3
  744. package/src/resources/extensions/gsd/tests/model-unittype-mapping.test.ts +28 -0
  745. package/src/resources/extensions/gsd/tests/notifications.test.ts +45 -0
  746. package/src/resources/extensions/gsd/tests/parallel-commit-scope.test.ts +159 -0
  747. package/src/resources/extensions/gsd/tests/parallel-eligibility-ghost.test.ts +150 -0
  748. package/src/resources/extensions/gsd/tests/parallel-worker-monitoring.test.ts +9 -8
  749. package/src/resources/extensions/gsd/tests/plan-milestone-title.test.ts +70 -0
  750. package/src/resources/extensions/gsd/tests/plan-milestone.test.ts +33 -1
  751. package/src/resources/extensions/gsd/tests/preferences.test.ts +34 -0
  752. package/src/resources/extensions/gsd/tests/project-relocation-recovery.test.ts +297 -0
  753. package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +36 -0
  754. package/src/resources/extensions/gsd/tests/prompt-loader-replacement.test.ts +178 -0
  755. package/src/resources/extensions/gsd/tests/prompt-tool-names.test.ts +69 -0
  756. package/src/resources/extensions/gsd/tests/provider-errors.test.ts +38 -0
  757. package/src/resources/extensions/gsd/tests/queue-execution-guard.test.ts +157 -0
  758. package/src/resources/extensions/gsd/tests/quick-turn-end-cleanup.test.ts +90 -0
  759. package/src/resources/extensions/gsd/tests/reassess-handler.test.ts +117 -0
  760. package/src/resources/extensions/gsd/tests/reconciliation-edge-cases.test.ts +162 -0
  761. package/src/resources/extensions/gsd/tests/roadmap-slices.test.ts +97 -0
  762. package/src/resources/extensions/gsd/tests/secure-env-collect.test.ts +134 -0
  763. package/src/resources/extensions/gsd/tests/slice-disk-reconcile.test.ts +233 -0
  764. package/src/resources/extensions/gsd/tests/stash-queued-context-files.test.ts +305 -0
  765. package/src/resources/extensions/gsd/tests/state-corruption-2945.test.ts +405 -0
  766. package/src/resources/extensions/gsd/tests/state-derivation-parity.test.ts +257 -0
  767. package/src/resources/extensions/gsd/tests/state-machine-full-walkthrough.test.ts +1628 -0
  768. package/src/resources/extensions/gsd/tests/stop-auto-race-null-unit.test.ts +106 -0
  769. package/src/resources/extensions/gsd/tests/stuck-detection-coverage.test.ts +174 -0
  770. package/src/resources/extensions/gsd/tests/summary-render-parity.test.ts +221 -0
  771. package/src/resources/extensions/gsd/tests/terminated-transient.test.ts +44 -0
  772. package/src/resources/extensions/gsd/tests/tool-naming.test.ts +2 -1
  773. package/src/resources/extensions/gsd/tests/triage-resolution.test.ts +8 -0
  774. package/src/resources/extensions/gsd/tests/uat-stuck-loop-orphaned-worktree.test.ts +289 -0
  775. package/src/resources/extensions/gsd/tests/unit-ownership.test.ts +100 -17
  776. package/src/resources/extensions/gsd/tests/vacuum-recovery.test.ts +154 -0
  777. package/src/resources/extensions/gsd/tests/validate-milestone-write-order.test.ts +27 -2
  778. package/src/resources/extensions/gsd/tests/validation-gate-patterns.test.ts +44 -2
  779. package/src/resources/extensions/gsd/tests/verdict-parser.test.ts +156 -0
  780. package/src/resources/extensions/gsd/tests/verification-operational-gate.test.ts +82 -0
  781. package/src/resources/extensions/gsd/tests/workflow-logger.test.ts +48 -0
  782. package/src/resources/extensions/gsd/tests/workflow-manifest.test.ts +92 -0
  783. package/src/resources/extensions/gsd/tests/workflow-projections.test.ts +4 -2
  784. package/src/resources/extensions/gsd/tests/worktree-db-respawn-truncation.test.ts +140 -0
  785. package/src/resources/extensions/gsd/tests/worktree-db-same-file.test.ts +175 -0
  786. package/src/resources/extensions/gsd/tests/worktree-nested-git-safety.test.ts +101 -0
  787. package/src/resources/extensions/gsd/tests/worktree-resolver.test.ts +48 -1
  788. package/src/resources/extensions/gsd/tests/worktree-sync-milestones.test.ts +29 -5
  789. package/src/resources/extensions/gsd/tests/zombie-gsd-state.test.ts +95 -0
  790. package/src/resources/extensions/gsd/tools/complete-task.ts +36 -74
  791. package/src/resources/extensions/gsd/tools/plan-milestone.ts +13 -1
  792. package/src/resources/extensions/gsd/tools/reassess-roadmap.ts +36 -0
  793. package/src/resources/extensions/gsd/tools/validate-milestone.ts +25 -2
  794. package/src/resources/extensions/gsd/triage-resolution.ts +23 -6
  795. package/src/resources/extensions/gsd/types.ts +4 -2
  796. package/src/resources/extensions/gsd/undo.ts +2 -2
  797. package/src/resources/extensions/gsd/unit-ownership.ts +206 -35
  798. package/src/resources/extensions/gsd/verdict-parser.ts +21 -6
  799. package/src/resources/extensions/gsd/watch/header-renderer.ts +275 -0
  800. package/src/resources/extensions/gsd/workflow-logger.ts +3 -1
  801. package/src/resources/extensions/gsd/workflow-manifest.ts +22 -5
  802. package/src/resources/extensions/gsd/workflow-projections.ts +97 -64
  803. package/src/resources/extensions/gsd/workflow-reconcile.ts +39 -10
  804. package/src/resources/extensions/gsd/workspace-index.ts +30 -0
  805. package/src/resources/extensions/gsd/worktree-manager.ts +120 -1
  806. package/src/resources/extensions/gsd/worktree-resolver.ts +22 -3
  807. package/src/resources/extensions/mcp-client/index.ts +13 -7
  808. package/src/resources/extensions/mcp-client/tests/server-name-spaces.test.ts +55 -0
  809. package/src/resources/extensions/ollama/index.ts +130 -0
  810. package/src/resources/extensions/ollama/model-capabilities.ts +145 -0
  811. package/src/resources/extensions/ollama/ollama-client.ts +196 -0
  812. package/src/resources/extensions/ollama/ollama-commands.ts +248 -0
  813. package/src/resources/extensions/ollama/ollama-discovery.ts +106 -0
  814. package/src/resources/extensions/ollama/ollama-tool.ts +218 -0
  815. package/src/resources/extensions/ollama/tests/model-capabilities.test.ts +162 -0
  816. package/src/resources/extensions/ollama/tests/ollama-client.test.ts +38 -0
  817. package/src/resources/extensions/ollama/tests/ollama-discovery.test.ts +28 -0
  818. package/src/resources/extensions/ollama/types.ts +130 -0
  819. package/src/resources/extensions/search-the-web/extension-manifest.json +1 -1
  820. package/src/resources/extensions/shared/interview-ui.ts +12 -1
  821. package/src/resources/extensions/shared/tests/ask-user-freetext.test.ts +156 -0
  822. package/src/resources/skills/create-gsd-extension/SKILL.md +5 -3
  823. package/src/resources/skills/create-gsd-extension/references/key-rules-gotchas.md +5 -4
  824. package/src/resources/skills/create-gsd-extension/workflows/add-capability.md +2 -2
  825. package/src/resources/skills/create-gsd-extension/workflows/create-extension.md +4 -4
  826. package/src/resources/skills/create-gsd-extension/workflows/debug-extension.md +5 -3
  827. package/dist/web/standalone/.next/static/chunks/6502.2305d0afd2385711.js +0 -9
  828. package/dist/web/standalone/.next/static/chunks/app/page-62be3b5fa91e4c8f.js +0 -1
  829. package/dist/web/standalone/.next/static/chunks/main-app-d3d4c336195465f9.js +0 -1
  830. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-ab5a8926e07ec673.js +0 -1
  831. package/dist/web/standalone/.next/static/css/a58ef8a151aa0493.css +0 -1
  832. package/src/resources/extensions/gsd/tests/empty-db-reconciliation.test.ts +0 -79
  833. /package/dist/web/standalone/.next/static/{yowc5qPtuKxjOr22KmOAy → uDm3eO1oo9lDfY2TyoO9t}/_buildManifest.js +0 -0
  834. /package/dist/web/standalone/.next/static/{yowc5qPtuKxjOr22KmOAy → uDm3eO1oo9lDfY2TyoO9t}/_ssgManifest.js +0 -0
@@ -56,7 +56,7 @@ Then:
56
56
  - `followUps` (string) — Follow-up items for future milestones
57
57
  - `deviations` (string) — Deviations from the original plan
58
58
  10. For each requirement whose status changed in step 8, call `gsd_requirement_update` with the requirement ID and updated `status` and `validation` fields — the tool regenerates `.gsd/REQUIREMENTS.md` automatically.
59
- 11. Update `.gsd/PROJECT.md` to reflect milestone completion and current project state.
59
+ 11. Update `.gsd/PROJECT.md`: use the `write` tool with `path: ".gsd/PROJECT.md"` and `content` containing the full updated document reflecting milestone completion and current project state. Do NOT use the `edit` tool for this — PROJECT.md is a full-document refresh.
60
60
  12. Review all slice summaries for cross-cutting lessons, patterns, or gotchas that emerged during this milestone. Append any non-obvious, reusable insights to `.gsd/KNOWLEDGE.md`.
61
61
  13. Do not commit manually — the system auto-commits your changes after this unit completes.
62
62
  - Say: "Milestone {{milestoneId}} complete."
@@ -29,9 +29,11 @@ Then:
29
29
  8. Write `{{sliceUatPath}}` — 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.
30
30
  9. Review task summaries for `key_decisions`. Append any significant decisions to `.gsd/DECISIONS.md` if missing.
31
31
  10. Review task summaries for patterns, gotchas, or non-obvious lessons learned. If any would save future agents from repeating investigation or hitting the same issues, append them to `.gsd/KNOWLEDGE.md`. Only add entries that are genuinely useful — don't pad with obvious observations.
32
- 11. Call `gsd_complete_slice` with milestone_id, slice_id, the slice summary, and the UAT result. Do NOT manually mark the roadmap checkbox — the tool writes to the DB and renders the ROADMAP.md projection automatically.
32
+ 11. Call `gsd_complete_slice` with milestoneId, sliceId, the slice summary, and the UAT result. Do NOT manually mark the roadmap checkbox — the tool writes to the DB and renders the ROADMAP.md projection automatically.
33
33
  12. Do not run git commands — the system commits your changes and handles any merge after this unit succeeds.
34
- 13. Update `.gsd/PROJECT.md` if it exists — refresh current state if needed.
34
+ 13. Update `.gsd/PROJECT.md` if it exists — refresh current state if needed: use the `write` tool with `path: ".gsd/PROJECT.md"` and `content` containing the full updated document reflecting current project state. Do NOT use the `edit` tool for this — PROJECT.md is a full-document refresh.
35
+
36
+ **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.
35
37
 
36
38
  **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.**
37
39
 
@@ -38,7 +38,7 @@ Do a mandatory investigation pass before making any decisions. This is not optio
38
38
  3. **Web search** — `search-the-web` if the domain is unfamiliar, if you need current best practices, or if the spec references external services/APIs you need facts about. Use `fetch_page` for full content when snippets aren't enough.
39
39
 
40
40
  **Web search budget:** Budget carefully across investigation + focused research:
41
- - Prefer `resolve_library` / `get_library_docs` over `web_search` for library documentation.
41
+ - Prefer `resolve_library` / `get_library_docs` over `search-the-web` for library documentation.
42
42
  - Prefer `search_and_read` for one-shot topic research.
43
43
  - Target 2-3 web searches in this investigation pass. Save remaining budget for focused research.
44
44
  - Do NOT repeat the same or similar queries.
@@ -37,7 +37,7 @@ Before asking your first question, do a mandatory investigation pass. This is no
37
37
  3. **Web search** — `search-the-web` if the domain is unfamiliar, if you need current best practices, or if the user referenced external services/APIs you need facts about. Use `fetch_page` for full content when snippets aren't enough.
38
38
 
39
39
  **Web search budget:** You have a limited number of web searches per turn (typically 3-5). The discuss phase spans many turns (investigation, question rounds, focused research, requirements), so budget carefully:
40
- - Prefer `resolve_library` / `get_library_docs` over `web_search` for library documentation — they don't consume the web search budget.
40
+ - Prefer `resolve_library` / `get_library_docs` over `search-the-web` for library documentation — they don't consume the web search budget.
41
41
  - Prefer `search_and_read` for one-shot topic research — it combines search + page fetch in a single call.
42
42
  - Target 2-3 web searches in the investigation pass. Save remaining budget for the focused research pass before roadmap creation.
43
43
  - Do NOT repeat the same or similar queries. If a search didn't find what you need, rephrase once or move on.
@@ -68,11 +68,13 @@ Then:
68
68
  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.
69
69
  18. Read the template at `~/.gsd/agent/extensions/gsd/templates/task-summary.md`
70
70
  19. Write `{{taskSummaryPath}}`
71
- 20. Call `gsd_complete_task` with milestone_id, slice_id, task_id, and a summary of what was accomplished. This is your final required step — do NOT manually edit PLAN.md checkboxes. The tool marks the task complete, updates the DB, and renders PLAN.md automatically.
71
+ 20. Call `gsd_complete_task` with milestoneId, sliceId, taskId, and a summary of what was accomplished. This is your final required step — do NOT manually edit PLAN.md checkboxes. The tool marks the task complete, updates the DB, and renders PLAN.md automatically.
72
72
  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.
73
73
 
74
74
  All work stays in your working directory: `{{workingDirectory}}`.
75
75
 
76
+ **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 task summary. If a decision genuinely requires human input, note it in the summary and proceed with the best available option.
77
+
76
78
  **You MUST call `gsd_complete_task` AND write `{{taskSummaryPath}}` before finishing.**
77
79
 
78
80
  When done, say: "Task {{taskId}} complete."
@@ -102,6 +102,8 @@ A stale lock (PID is dead) means the previous auto-mode session crashed mid-unit
102
102
 
103
103
  A unit dispatched more than once (`type/id` appears multiple times) indicates a stuck loop — the unit completed but artifact verification failed.
104
104
 
105
+ {{dedupSection}}
106
+
105
107
  ## Investigation Protocol
106
108
 
107
109
  1. **Start with the pre-parsed forensic report** above. The anomaly section contains automated findings — treat these as leads, not conclusions.
@@ -133,8 +135,6 @@ Explain your findings:
133
135
  - **Code snippet** — the problematic code and what it should do instead
134
136
  - **Recovery** — what the user can do right now to get unstuck
135
137
 
136
- {{dedupSection}}
137
-
138
138
  Then **offer GitHub issue creation**: "Would you like me to create a GitHub issue for this on gsd-build/gsd-2?"
139
139
 
140
140
  **CRITICAL: The `github_issues` tool ONLY targets the current user's repository — it has no `repo` parameter. You MUST use `gh issue create --repo gsd-build/gsd-2` via the `bash` tool to file on the correct repo. Do NOT use the `github_issues` tool for this.**
@@ -13,7 +13,7 @@ Discuss milestone {{milestoneId}} ("{{milestoneTitle}}"). Identify gray areas, a
13
13
  Do a lightweight targeted investigation so your questions are grounded in reality:
14
14
  - Scout the codebase (`rg`, `find`, or `scout`) to understand what already exists that this milestone touches or builds on
15
15
  - Check the roadmap context above (if present) to understand what surrounds this milestone
16
- - Use `resolve_library` / `get_library_docs` for unfamiliar libraries — prefer this over `web_search` for library documentation
16
+ - Use `resolve_library` / `get_library_docs` for unfamiliar libraries — prefer this over `search-the-web` for library documentation
17
17
  - Identify the 3–5 biggest behavioural and architectural unknowns: things where the user's answer will materially change what gets built
18
18
 
19
19
  **Web search budget:** You have a limited number of web searches per turn (typically 3-5). Prefer `resolve_library` / `get_library_docs` for library documentation and `search_and_read` for one-shot topic research — they are more budget-efficient. Target 2-3 web searches in the investigation pass. Distribute remaining searches across subsequent question rounds rather than clustering them.
@@ -13,7 +13,7 @@ Your goal is **not** to center the discussion on tech stack trivia, naming conve
13
13
  Do a lightweight targeted investigation so your questions are grounded in reality:
14
14
  - Scout the codebase (`rg`, `find`, or `scout` for broad unfamiliar areas) to understand what already exists that this slice touches or builds on
15
15
  - Check the roadmap context above to understand what surrounds this slice — what comes before, what depends on it
16
- - Use `resolve_library` / `get_library_docs` for unfamiliar libraries — prefer this over `web_search` for library documentation
16
+ - Use `resolve_library` / `get_library_docs` for unfamiliar libraries — prefer this over `search-the-web` for library documentation
17
17
  - Identify the 3–5 biggest behavioural unknowns: things where the user's answer will materially change what gets built
18
18
 
19
19
  **Web search budget:** You have a limited number of web searches per turn (typically 3-5). Prefer `resolve_library` / `get_library_docs` for library documentation and `search_and_read` for one-shot topic research — they are more budget-efficient. Target 2-3 web searches in the investigation pass. Distribute remaining searches across subsequent question rounds rather than clustering them.
@@ -82,6 +82,8 @@ Then:
82
82
 
83
83
  The slice directory and tasks/ subdirectory already exist. Do NOT mkdir. All work stays in your working directory: `{{workingDirectory}}`.
84
84
 
85
+ **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 plan. If a decision genuinely requires human input, write a note in the relevant task's description and call `gsd_plan_slice` with what you have.
86
+
85
87
  **You MUST call `gsd_plan_slice` to persist the planning state before finishing.**
86
88
 
87
89
  When done, say: "Slice {{sliceId}} planned."
@@ -80,4 +80,4 @@ If a proposed order would violate constraints, explain the issue and suggest alt
80
80
  - Do NOT park completed milestones — it would corrupt dependency satisfaction
81
81
  - Park is preferred over discard when a milestone has any completed work
82
82
  - Always persist queue order changes to `.gsd/QUEUE-ORDER.json`
83
- - After changes, run `git add .gsd/ && git commit -m "docs(gsd): rethink milestone plan"` to persist (rethink runs interactively outside auto-mode, so no system auto-commit)
83
+ - {{commitInstruction}}
@@ -54,6 +54,7 @@ For each capture, classify it as one of:
54
54
  - Add `**Resolution:** <brief description of what will happen>`
55
55
  - Add `**Rationale:** <why this classification>`
56
56
  - Add `**Resolved:** <current ISO timestamp>`
57
+ - Add `**Milestone:** <current milestone ID>` (e.g., `**Milestone:** M003`)
57
58
 
58
59
  4. **Summarize** what was triaged: how many captures, what classifications were assigned, and what actions are pending (e.g., "2 quick-tasks ready for execution, 1 deferred to S03").
59
60
 
@@ -26,7 +26,7 @@ All relevant context has been preloaded below — the roadmap, all slice summari
26
26
  4. Check **requirement coverage** — are all active requirements addressed by at least one slice?
27
27
  5. If **Verification Classes** are provided in the inlined context above, check each non-empty class:
28
28
  - For each verification class (Contract, Integration, Operational, UAT), determine whether slice summaries, UAT results, or observable behavior provide evidence that this verification tier was addressed.
29
- - Document the compliance status of each class in your verdict rationale.
29
+ - Document the compliance status of each class in a dedicated verification classes section.
30
30
  - If `Operational` verification is non-empty and no evidence of operational verification exists, flag this explicitly — it means planned operational checks (migrations, deployments, runtime verification) were not proven.
31
31
  - A milestone with unaddressed verification classes may still pass if the gaps are minor, but the gaps MUST be documented in the Deferred Work Inventory.
32
32
  6. Determine a verdict:
@@ -36,7 +36,7 @@ All relevant context has been preloaded below — the roadmap, all slice summari
36
36
 
37
37
  ## Persist Validation
38
38
 
39
- **Persist validation results through `gsd_validate_milestone`.** Call it with: `milestoneId`, `verdict`, `remediationRound`, `successCriteriaChecklist`, `sliceDeliveryAudit`, `crossSliceIntegration`, `requirementCoverage`, `verdictRationale`, and `remediationPlan` (if verdict is `needs-remediation`). The tool writes the validation to the DB and renders VALIDATION.md to disk.
39
+ **Persist validation results through `gsd_validate_milestone`.** Call it with: `milestoneId`, `verdict`, `remediationRound`, `successCriteriaChecklist`, `sliceDeliveryAudit`, `crossSliceIntegration`, `requirementCoverage`, `verificationClasses` (when non-empty), `verdictRationale`, and `remediationPlan` (if verdict is `needs-remediation`). The tool writes the validation to the DB and renders VALIDATION.md to disk.
40
40
 
41
41
  If verdict is `needs-remediation`:
42
42
  - After calling `gsd_validate_milestone`, use `gsd_reassess_roadmap` to add remediation slices. Pass `milestoneId`, a synthetic `completedSliceId` (e.g. "VALIDATION"), `verdict: "roadmap-adjusted"`, `assessment` text, and `sliceChanges` with the new slices in the `added` array. The tool persists the changes to the DB and re-renders ROADMAP.md.
@@ -8,7 +8,7 @@
8
8
 
9
9
  import { createHash } from "node:crypto";
10
10
  import { execFileSync } from "node:child_process";
11
- import { existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, realpathSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
11
+ import { cpSync, existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, realpathSync, renameSync, rmSync, symlinkSync, unlinkSync, writeFileSync } from "node:fs";
12
12
  import { homedir } from "node:os";
13
13
  import { basename, dirname, join, resolve } from "node:path";
14
14
 
@@ -276,9 +276,14 @@ export function validateProjectId(id: string): boolean {
276
276
  * If `GSD_PROJECT_ID` is set, returns it directly (validation is expected
277
277
  * to have already happened at startup via `validateProjectId`).
278
278
  *
279
- * Otherwise returns SHA-256 of `${remoteUrl}\n${resolvedRoot}`, truncated
280
- * to 12 hex chars. Deterministic: same repo always produces the same hash
281
- * regardless of which worktree the caller is inside.
279
+ * For repos with a remote URL, returns SHA-256 of the remote URL only —
280
+ * this makes the identity stable across directory moves/renames (#2750).
281
+ *
282
+ * For local-only repos (no remote), includes the git root in the hash.
283
+ * Local repos use a `.gsd-id` marker file for recovery after moves.
284
+ *
285
+ * Deterministic: same repo always produces the same hash regardless of
286
+ * which worktree the caller is inside.
282
287
  */
283
288
  export function repoIdentity(basePath: string): string {
284
289
  const projectId = process.env.GSD_PROJECT_ID;
@@ -286,8 +291,14 @@ export function repoIdentity(basePath: string): string {
286
291
  return projectId;
287
292
  }
288
293
  const remoteUrl = getRemoteUrl(basePath);
294
+ if (remoteUrl) {
295
+ // Remote URL alone uniquely identifies the repo — path is redundant.
296
+ // This makes moves transparent for repos with remotes (#2750).
297
+ return createHash("sha256").update(remoteUrl).digest("hex").slice(0, 12);
298
+ }
299
+ // Local-only repo: include git root since there's no remote to anchor identity.
289
300
  const root = resolveGitRoot(basePath);
290
- const input = `${remoteUrl}\n${root}`;
301
+ const input = `\n${root}`;
291
302
  return createHash("sha256").update(input).digest("hex").slice(0, 12);
292
303
  }
293
304
 
@@ -351,21 +362,148 @@ export function cleanNumberedGsdVariants(projectPath: string): string[] {
351
362
  return removed;
352
363
  }
353
364
 
365
+ // ─── .gsd-id Marker ─────────────────────────────────────────────────────────
366
+
367
+ /**
368
+ * Write a `.gsd-id` marker file in the project root.
369
+ *
370
+ * This file records the identity hash used for the external state directory.
371
+ * For local-only repos (no remote), this marker survives directory moves and
372
+ * enables automatic recovery of orphaned state (#2750).
373
+ *
374
+ * The marker is gitignored by ensureGitignore(). Non-fatal: failure to write
375
+ * the marker must never block project setup.
376
+ */
377
+ function writeGsdIdMarker(projectPath: string, identity: string): void {
378
+ try {
379
+ const markerPath = join(projectPath, ".gsd-id");
380
+ // Only write if content differs to avoid unnecessary disk writes.
381
+ if (existsSync(markerPath)) {
382
+ try {
383
+ if (readFileSync(markerPath, "utf-8").trim() === identity) return;
384
+ } catch { /* fall through and overwrite */ }
385
+ }
386
+ writeFileSync(markerPath, identity + "\n", "utf-8");
387
+ } catch {
388
+ // Non-fatal — marker write failure should not block project setup
389
+ }
390
+ }
391
+
392
+ /**
393
+ * Read the `.gsd-id` marker from the project root.
394
+ * Returns the identity hash, or null if the marker doesn't exist or is unreadable.
395
+ */
396
+ function readGsdIdMarker(projectPath: string): string | null {
397
+ try {
398
+ const markerPath = join(projectPath, ".gsd-id");
399
+ if (!existsSync(markerPath)) return null;
400
+ const content = readFileSync(markerPath, "utf-8").trim();
401
+ return /^[a-zA-Z0-9_-]+$/.test(content) ? content : null;
402
+ } catch {
403
+ return null;
404
+ }
405
+ }
406
+
407
+ /**
408
+ * Check whether an external state directory has meaningful content.
409
+ * Returns true if the directory contains any files or subdirectories
410
+ * beyond just repo-meta.json.
411
+ */
412
+ function hasProjectState(externalPath: string): boolean {
413
+ try {
414
+ if (!existsSync(externalPath)) return false;
415
+ const entries = readdirSync(externalPath);
416
+ return entries.some(e => e !== "repo-meta.json");
417
+ } catch {
418
+ return false;
419
+ }
420
+ }
421
+
422
+ /**
423
+ * Resolve the external state directory, with recovery for relocated projects.
424
+ *
425
+ * For local-only repos where the computed identity produces an empty state dir,
426
+ * checks the `.gsd-id` marker for the original identity hash and recovers
427
+ * the old state directory if it still exists and contains data (#2750).
428
+ *
429
+ * Returns the resolved external path (may differ from the computed identity).
430
+ */
431
+ function resolveExternalPathWithRecovery(projectPath: string): string {
432
+ const computedPath = externalGsdRoot(projectPath);
433
+ const computedId = repoIdentity(projectPath);
434
+
435
+ // Check if computed path already has state — fast path, no recovery needed.
436
+ if (hasProjectState(computedPath)) {
437
+ return computedPath;
438
+ }
439
+
440
+ // Check for .gsd-id marker from a previous location.
441
+ const markerId = readGsdIdMarker(projectPath);
442
+ if (markerId && markerId !== computedId) {
443
+ // The marker points to a different identity — the repo was likely moved.
444
+ const base = process.env.GSD_STATE_DIR || gsdHome;
445
+ const markerPath = join(base, "projects", markerId);
446
+ if (hasProjectState(markerPath)) {
447
+ // Recover: use the old state directory and update the marker to the new identity.
448
+ // Move the state from the old hash dir to the new one so future lookups work
449
+ // without the marker.
450
+ try {
451
+ mkdirSync(computedPath, { recursive: true });
452
+ const entries = readdirSync(markerPath);
453
+ for (const entry of entries) {
454
+ try {
455
+ const src = join(markerPath, entry);
456
+ const dst = join(computedPath, entry);
457
+ // Use rename for same-filesystem (fast) or fall back to copy.
458
+ try {
459
+ renameSync(src, dst);
460
+ } catch {
461
+ cpSync(src, dst, { recursive: true, force: true });
462
+ }
463
+ } catch { /* continue with remaining entries */ }
464
+ }
465
+ // Clean up old directory after successful migration.
466
+ try { rmSync(markerPath, { recursive: true, force: true }); } catch { /* non-fatal */ }
467
+ } catch {
468
+ // If migration fails, just point at the old directory.
469
+ return markerPath;
470
+ }
471
+ }
472
+ }
473
+
474
+ return computedPath;
475
+ }
476
+
354
477
  // ─── Symlink Management ─────────────────────────────────────────────────────
355
478
 
356
479
  /**
357
480
  * Ensure the `<project>/.gsd` symlink points to the external state directory.
358
481
  *
359
482
  * 1. Clean up any macOS numbered collision variants (`.gsd 2`, `.gsd 3`, etc.)
360
- * 2. mkdir -p the external dir
361
- * 3. If `<project>/.gsd` doesn't exist → create symlink
362
- * 4. If `<project>/.gsd` is already the correct symlink → no-op
363
- * 5. If `<project>/.gsd` is a real directoryreturn as-is (migration handles later)
483
+ * 2. Resolve external dir (with relocation recovery via `.gsd-id` marker)
484
+ * 3. mkdir -p the external dir
485
+ * 4. If `<project>/.gsd` doesn't exist create symlink
486
+ * 5. If `<project>/.gsd` is already the correct symlink no-op
487
+ * 6. If `<project>/.gsd` is a real directory → return as-is (migration handles later)
488
+ * 7. Write `.gsd-id` marker for future relocation recovery
364
489
  *
365
490
  * Returns the resolved external path.
366
491
  */
367
492
  export function ensureGsdSymlink(projectPath: string): string {
368
- const externalPath = externalGsdRoot(projectPath);
493
+ const result = ensureGsdSymlinkCore(projectPath);
494
+
495
+ // Write .gsd-id marker so future relocations can recover this state (#2750).
496
+ // Only write for the project root (not subdirectories or worktrees that
497
+ // delegate to a parent .gsd).
498
+ if (!isInsideWorktree(projectPath)) {
499
+ writeGsdIdMarker(projectPath, repoIdentity(projectPath));
500
+ }
501
+
502
+ return result;
503
+ }
504
+
505
+ function ensureGsdSymlinkCore(projectPath: string): string {
506
+ const externalPath = resolveExternalPathWithRecovery(projectPath);
369
507
  const localGsd = join(projectPath, ".gsd");
370
508
  const inWorktree = isInsideWorktree(projectPath);
371
509
 
@@ -418,12 +556,28 @@ export function ensureGsdSymlink(projectPath: string): string {
418
556
 
419
557
  const replaceWithSymlink = (): string => {
420
558
  rmSync(localGsd, { recursive: true, force: true });
559
+ // Defensive: remove any residual entry (e.g. dangling symlink) before creating.
560
+ try { unlinkSync(localGsd); } catch { /* already gone */ }
421
561
  symlinkSync(externalPath, localGsd, "junction");
422
562
  return externalPath;
423
563
  };
424
564
 
565
+ // Check for dangling symlinks (e.g. after relocation recovery removed the old
566
+ // state dir). existsSync follows symlinks, so it returns false for dangling ones.
567
+ // lstatSync does NOT follow, so we can detect the dangling symlink and replace it.
425
568
  if (!existsSync(localGsd)) {
426
- // Nothing exists yet — create symlink
569
+ try {
570
+ const stat = lstatSync(localGsd);
571
+ if (stat.isSymbolicLink()) {
572
+ // Dangling symlink — replace with correct one (#2750).
573
+ return replaceWithSymlink();
574
+ }
575
+ } catch {
576
+ // lstat also failed — nothing exists at this path
577
+ }
578
+ // Nothing exists yet — create symlink.
579
+ // Defensive: remove any residual entry to avoid EEXIST race (#2750).
580
+ try { unlinkSync(localGsd); } catch { /* nothing to remove */ }
427
581
  symlinkSync(externalPath, localGsd, "junction");
428
582
  return externalPath;
429
583
  }
@@ -442,6 +596,27 @@ export function ensureGsdSymlink(projectPath: string): string {
442
596
  if (inWorktree) {
443
597
  return replaceWithSymlink();
444
598
  }
599
+ // After identity hash change (e.g. upgrade from path-based to remote-only
600
+ // hash, or relocation recovery), migrate data from old target to new path
601
+ // and update the symlink (#2750).
602
+ if (!hasProjectState(externalPath) && hasProjectState(target)) {
603
+ try {
604
+ mkdirSync(externalPath, { recursive: true });
605
+ const oldEntries = readdirSync(target);
606
+ for (const entry of oldEntries) {
607
+ try {
608
+ const src = join(target, entry);
609
+ const dst = join(externalPath, entry);
610
+ try { renameSync(src, dst); } catch { cpSync(src, dst, { recursive: true, force: true }); }
611
+ } catch { /* continue */ }
612
+ }
613
+ try { rmSync(target, { recursive: true, force: true }); } catch { /* non-fatal */ }
614
+ return replaceWithSymlink();
615
+ } catch {
616
+ // Migration failed — preserve old symlink
617
+ return target;
618
+ }
619
+ }
445
620
  // Outside worktrees, preserve custom overrides or legacy symlinks.
446
621
  return target;
447
622
  }
@@ -19,6 +19,7 @@ import { isParked, getParkedReason } from "./milestone-actions.js";
19
19
  import { getMilestoneSlices, isDbAvailable } from "./gsd-db.js";
20
20
  import { buildExistingMilestonesContext } from "./guided-flow-queue.js";
21
21
  import { loadPrompt } from "./prompt-loader.js";
22
+ import { isGsdGitignored } from "./gitignore.js";
22
23
 
23
24
  // ─── Entry Point ──────────────────────────────────────────────────────────────
24
25
 
@@ -53,9 +54,14 @@ export async function handleRethink(
53
54
  const rethinkData = buildRethinkData(basePath, milestoneIds, state, queueOrder);
54
55
  const existingMilestonesContext = await buildExistingMilestonesContext(basePath, milestoneIds, state);
55
56
 
57
+ const commitInstruction = isGsdGitignored(basePath)
58
+ ? "Do not commit planning artifacts — .gsd/ is gitignored in this project."
59
+ : 'After changes, run `git add .gsd/ && git commit -m "docs(gsd): rethink milestone plan"` to persist (rethink runs interactively outside auto-mode, so no system auto-commit)';
60
+
56
61
  const content = loadPrompt("rethink", {
57
62
  rethinkData,
58
63
  existingMilestonesContext,
64
+ commitInstruction,
59
65
  });
60
66
 
61
67
  pi.sendMessage(
@@ -219,13 +219,14 @@ export function parseRoadmapSlices(content: string): RoadmapSliceEntry[] {
219
219
  function parseProseSliceHeaders(content: string): RoadmapSliceEntry[] {
220
220
  const slices: RoadmapSliceEntry[] = [];
221
221
  // Match H1-H4 headers containing S<digits> with optional "Slice" prefix, bold markers,
222
- // and optional checkmark completion marker before the slice ID.
222
+ // numeric prefixes (e.g., "1.", "(1)"), bracketed IDs (e.g., "[S01]"),
223
+ // optional checkmark completion marker, and optional leading indentation.
223
224
  // Separator after the ID is flexible: colon, dash, em/en dash, dot, or just whitespace.
224
- const headerPattern = /^#{1,4}\s+\*{0,2}(?:\u2713\s+)?(?:Slice\s+)?(S\d+)\*{0,2}[:\s.\u2014\u2013-]*\s*(.+)/gm;
225
+ const headerPattern = /^\s*#{1,4}\s+\*{0,2}(?:\u2713\s+)?(?:\d+[.)]\s+)?(?:\(\d+\)\s+)?(?:Slice\s+)?\[?(S\d+)\]?\*{0,2}[:\s.\u2014\u2013-]*\s*(.+)/gm;
225
226
  let match: RegExpExecArray | null;
226
227
 
227
228
  // Check for checkmark before the slice ID (e.g., "## checkmark S01: Title")
228
- const prefixCheckPattern = /^#{1,4}\s+\*{0,2}\u2713\s+/;
229
+ const prefixCheckPattern = /^\s*#{1,4}\s+\*{0,2}\u2713\s+/;
229
230
 
230
231
  while ((match = headerPattern.exec(content)) !== null) {
231
232
  const id = match[1]!;
@@ -251,7 +252,7 @@ function parseProseSliceHeaders(content: string): RoadmapSliceEntry[] {
251
252
 
252
253
  // Try to extract depends from prose: "Depends on: S01" or "**Depends on:** S01, S02"
253
254
  const afterHeader = content.slice(match.index + match[0].length);
254
- const nextHeader = afterHeader.search(/^#{1,4}\s/m);
255
+ const nextHeader = afterHeader.search(/^\s*#{1,4}\s/m);
255
256
  const section = nextHeader !== -1 ? afterHeader.slice(0, nextHeader) : afterHeader.slice(0, 500);
256
257
 
257
258
  const depsMatch = section.match(/\*{0,2}Depends\s+on:?\*{0,2}\s*(.+)/i);