gsd-pi 2.75.0-next.9c0ec0ba1 → 2.76.0-dev.b072ebb73

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 (680) hide show
  1. package/README.md +145 -125
  2. package/dist/claude-cli-check.d.ts +10 -0
  3. package/dist/claude-cli-check.js +13 -3
  4. package/dist/onboarding.d.ts +20 -1
  5. package/dist/onboarding.js +60 -25
  6. package/dist/resources/agents/researcher.md +1 -1
  7. package/dist/resources/extensions/ask-user-questions.js +6 -3
  8. package/dist/resources/extensions/claude-code-cli/readiness.js +34 -2
  9. package/dist/resources/extensions/claude-code-cli/stream-adapter.js +44 -2
  10. package/dist/resources/extensions/gsd/auto/phases.js +48 -6
  11. package/dist/resources/extensions/gsd/auto-artifact-paths.js +20 -0
  12. package/dist/resources/extensions/gsd/auto-dashboard.js +37 -8
  13. package/dist/resources/extensions/gsd/auto-direct-dispatch.js +8 -2
  14. package/dist/resources/extensions/gsd/auto-dispatch.js +87 -9
  15. package/dist/resources/extensions/gsd/auto-model-selection.js +27 -6
  16. package/dist/resources/extensions/gsd/auto-post-unit.js +7 -5
  17. package/dist/resources/extensions/gsd/auto-prompts.js +188 -44
  18. package/dist/resources/extensions/gsd/auto-recovery.js +48 -0
  19. package/dist/resources/extensions/gsd/auto-start.js +5 -3
  20. package/dist/resources/extensions/gsd/auto-verification.js +33 -0
  21. package/dist/resources/extensions/gsd/auto-worktree.js +71 -2
  22. package/dist/resources/extensions/gsd/auto.js +25 -3
  23. package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +8 -21
  24. package/dist/resources/extensions/gsd/bootstrap/db-tools.js +45 -23
  25. package/dist/resources/extensions/gsd/bootstrap/memory-tools.js +131 -0
  26. package/dist/resources/extensions/gsd/bootstrap/query-tools.js +29 -0
  27. package/dist/resources/extensions/gsd/bootstrap/register-extension.js +12 -0
  28. package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +22 -0
  29. package/dist/resources/extensions/gsd/bootstrap/system-context.js +84 -10
  30. package/dist/resources/extensions/gsd/commands/catalog.js +15 -7
  31. package/dist/resources/extensions/gsd/commands/handlers/core.js +58 -24
  32. package/dist/resources/extensions/gsd/commands/handlers/escalate.js +171 -0
  33. package/dist/resources/extensions/gsd/commands/handlers/onboarding.js +159 -0
  34. package/dist/resources/extensions/gsd/commands/handlers/ops.js +10 -0
  35. package/dist/resources/extensions/gsd/commands-config.js +5 -0
  36. package/dist/resources/extensions/gsd/commands-extract-learnings.js +200 -77
  37. package/dist/resources/extensions/gsd/commands-memory.js +462 -0
  38. package/dist/resources/extensions/gsd/commands-prefs-wizard.js +39 -11
  39. package/dist/resources/extensions/gsd/custom-workflow-engine.js +74 -54
  40. package/dist/resources/extensions/gsd/db-writer.js +89 -16
  41. package/dist/resources/extensions/gsd/docs/preferences-reference.md +2 -2
  42. package/dist/resources/extensions/gsd/doctor-environment.js +2 -1
  43. package/dist/resources/extensions/gsd/doctor-git-checks.js +50 -32
  44. package/dist/resources/extensions/gsd/doctor-proactive.js +4 -1
  45. package/dist/resources/extensions/gsd/doctor-providers.js +51 -5
  46. package/dist/resources/extensions/gsd/doctor-runtime-checks.js +21 -1
  47. package/dist/resources/extensions/gsd/doctor.js +7 -1
  48. package/dist/resources/extensions/gsd/ecosystem/gsd-extension-api.js +1 -0
  49. package/dist/resources/extensions/gsd/error-classifier.js +5 -2
  50. package/dist/resources/extensions/gsd/escalation.js +321 -0
  51. package/dist/resources/extensions/gsd/graph.js +26 -0
  52. package/dist/resources/extensions/gsd/gsd-db.js +517 -32
  53. package/dist/resources/extensions/gsd/health-widget-core.js +42 -14
  54. package/dist/resources/extensions/gsd/health-widget.js +7 -4
  55. package/dist/resources/extensions/gsd/hook-emitter.js +108 -0
  56. package/dist/resources/extensions/gsd/init-wizard.js +86 -45
  57. package/dist/resources/extensions/gsd/markdown-renderer.js +5 -5
  58. package/dist/resources/extensions/gsd/memory-backfill.js +126 -0
  59. package/dist/resources/extensions/gsd/memory-embeddings.js +219 -0
  60. package/dist/resources/extensions/gsd/memory-extractor.js +78 -27
  61. package/dist/resources/extensions/gsd/memory-ingest.js +218 -0
  62. package/dist/resources/extensions/gsd/memory-relations.js +189 -0
  63. package/dist/resources/extensions/gsd/memory-source-store.js +113 -0
  64. package/dist/resources/extensions/gsd/memory-store.js +318 -6
  65. package/dist/resources/extensions/gsd/metrics.js +1 -0
  66. package/dist/resources/extensions/gsd/model-cost-table.js +1 -0
  67. package/dist/resources/extensions/gsd/model-router.js +12 -5
  68. package/dist/resources/extensions/gsd/native-git-bridge.js +121 -5
  69. package/dist/resources/extensions/gsd/notification-overlay.js +7 -22
  70. package/dist/resources/extensions/gsd/notification-widget.js +24 -39
  71. package/dist/resources/extensions/gsd/onboarding-state.js +133 -0
  72. package/dist/resources/extensions/gsd/post-execution-checks.js +27 -11
  73. package/dist/resources/extensions/gsd/pre-execution-checks.js +98 -8
  74. package/dist/resources/extensions/gsd/preferences-models.js +1 -0
  75. package/dist/resources/extensions/gsd/preferences-types.js +2 -1
  76. package/dist/resources/extensions/gsd/preferences-validation.js +42 -8
  77. package/dist/resources/extensions/gsd/prompts/add-tests.md +1 -0
  78. package/dist/resources/extensions/gsd/prompts/complete-milestone.md +4 -1
  79. package/dist/resources/extensions/gsd/prompts/complete-slice.md +2 -2
  80. package/dist/resources/extensions/gsd/prompts/debug-diagnose.md +2 -0
  81. package/dist/resources/extensions/gsd/prompts/execute-task.md +16 -3
  82. package/dist/resources/extensions/gsd/prompts/plan-milestone.md +12 -0
  83. package/dist/resources/extensions/gsd/prompts/plan-slice.md +2 -0
  84. package/dist/resources/extensions/gsd/prompts/refine-slice.md +69 -0
  85. package/dist/resources/extensions/gsd/prompts/research-slice.md +1 -0
  86. package/dist/resources/extensions/gsd/python-resolver.js +70 -0
  87. package/dist/resources/extensions/gsd/setup-catalog.js +75 -0
  88. package/dist/resources/extensions/gsd/state.js +90 -7
  89. package/dist/resources/extensions/gsd/templates/PREFERENCES.md +1 -1
  90. package/dist/resources/extensions/gsd/tools/complete-task.js +80 -0
  91. package/dist/resources/extensions/gsd/tools/memory-tools.js +331 -0
  92. package/dist/resources/extensions/gsd/tools/plan-milestone.js +37 -12
  93. package/dist/resources/extensions/gsd/tools/plan-slice.js +5 -2
  94. package/dist/resources/extensions/gsd/tools/skip-slice.js +78 -0
  95. package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +14 -0
  96. package/dist/resources/extensions/gsd/uok/flags.js +1 -1
  97. package/dist/resources/extensions/gsd/verification-gate.js +2 -1
  98. package/dist/resources/extensions/gsd/workflow-manifest.js +8 -0
  99. package/dist/resources/extensions/gsd/workflow-mcp.js +1 -0
  100. package/dist/resources/extensions/gsd/workflow-projections.js +17 -15
  101. package/dist/resources/extensions/gsd/workflow-templates/spike.md +6 -0
  102. package/dist/resources/extensions/gsd/worktree-resolver.js +42 -1
  103. package/dist/resources/extensions/remote-questions/manager.js +11 -1
  104. package/dist/resources/extensions/search-the-web/command-search-provider.js +4 -1
  105. package/dist/resources/extensions/search-the-web/native-search.js +13 -2
  106. package/dist/resources/skills/api-design/SKILL.md +190 -0
  107. package/dist/resources/skills/create-mcp-server/SKILL.md +121 -0
  108. package/dist/resources/skills/decompose-into-slices/SKILL.md +139 -0
  109. package/dist/resources/skills/dependency-upgrade/SKILL.md +158 -0
  110. package/dist/resources/skills/design-an-interface/SKILL.md +102 -0
  111. package/dist/resources/skills/forensics/SKILL.md +153 -0
  112. package/dist/resources/skills/grill-me/SKILL.md +93 -0
  113. package/dist/resources/skills/handoff/SKILL.md +121 -0
  114. package/dist/resources/skills/observability/SKILL.md +174 -0
  115. package/dist/resources/skills/security-review/SKILL.md +181 -0
  116. package/dist/resources/skills/spike-wrap-up/SKILL.md +138 -0
  117. package/dist/resources/skills/tdd/SKILL.md +112 -0
  118. package/dist/resources/skills/verify-before-complete/SKILL.md +97 -0
  119. package/dist/resources/skills/write-docs/SKILL.md +81 -0
  120. package/dist/resources/skills/write-milestone-brief/SKILL.md +135 -0
  121. package/dist/tsconfig.extensions.tsbuildinfo +1 -1
  122. package/dist/web/standalone/.next/BUILD_ID +1 -1
  123. package/dist/web/standalone/.next/app-path-routes-manifest.json +11 -11
  124. package/dist/web/standalone/.next/build-manifest.json +3 -3
  125. package/dist/web/standalone/.next/prerender-manifest.json +3 -3
  126. package/dist/web/standalone/.next/react-loadable-manifest.json +2 -2
  127. package/dist/web/standalone/.next/required-server-files.json +1 -1
  128. package/dist/web/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  129. package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
  130. package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
  131. package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  132. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  133. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  134. package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  135. package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  136. package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  137. package/dist/web/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  138. package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
  139. package/dist/web/standalone/.next/server/app/_not-found.rsc +2 -2
  140. package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  141. package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  142. package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  143. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  144. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  145. package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  146. package/dist/web/standalone/.next/server/app/api/boot/route.js +1 -1
  147. package/dist/web/standalone/.next/server/app/api/boot/route.js.nft.json +1 -1
  148. package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js +1 -1
  149. package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js.nft.json +1 -1
  150. package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js +1 -1
  151. package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js.nft.json +1 -1
  152. package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js +2 -2
  153. package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js.nft.json +1 -1
  154. package/dist/web/standalone/.next/server/app/api/captures/route.js +1 -1
  155. package/dist/web/standalone/.next/server/app/api/captures/route.js.nft.json +1 -1
  156. package/dist/web/standalone/.next/server/app/api/cleanup/route.js +1 -1
  157. package/dist/web/standalone/.next/server/app/api/cleanup/route.js.nft.json +1 -1
  158. package/dist/web/standalone/.next/server/app/api/doctor/route.js +1 -1
  159. package/dist/web/standalone/.next/server/app/api/doctor/route.js.nft.json +1 -1
  160. package/dist/web/standalone/.next/server/app/api/export-data/route.js +1 -1
  161. package/dist/web/standalone/.next/server/app/api/export-data/route.js.nft.json +1 -1
  162. package/dist/web/standalone/.next/server/app/api/files/route.js +1 -1
  163. package/dist/web/standalone/.next/server/app/api/files/route.js.nft.json +1 -1
  164. package/dist/web/standalone/.next/server/app/api/forensics/route.js +1 -1
  165. package/dist/web/standalone/.next/server/app/api/forensics/route.js.nft.json +1 -1
  166. package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
  167. package/dist/web/standalone/.next/server/app/api/git/route.js.nft.json +1 -1
  168. package/dist/web/standalone/.next/server/app/api/history/route.js +1 -1
  169. package/dist/web/standalone/.next/server/app/api/history/route.js.nft.json +1 -1
  170. package/dist/web/standalone/.next/server/app/api/hooks/route.js +1 -1
  171. package/dist/web/standalone/.next/server/app/api/hooks/route.js.nft.json +1 -1
  172. package/dist/web/standalone/.next/server/app/api/inspect/route.js +1 -1
  173. package/dist/web/standalone/.next/server/app/api/inspect/route.js.nft.json +1 -1
  174. package/dist/web/standalone/.next/server/app/api/knowledge/route.js +1 -1
  175. package/dist/web/standalone/.next/server/app/api/knowledge/route.js.nft.json +1 -1
  176. package/dist/web/standalone/.next/server/app/api/live-state/route.js +1 -1
  177. package/dist/web/standalone/.next/server/app/api/live-state/route.js.nft.json +1 -1
  178. package/dist/web/standalone/.next/server/app/api/notifications/route.js +2 -2
  179. package/dist/web/standalone/.next/server/app/api/notifications/route.js.nft.json +1 -1
  180. package/dist/web/standalone/.next/server/app/api/onboarding/route.js +1 -1
  181. package/dist/web/standalone/.next/server/app/api/onboarding/route.js.nft.json +1 -1
  182. package/dist/web/standalone/.next/server/app/api/projects/route.js +1 -1
  183. package/dist/web/standalone/.next/server/app/api/projects/route.js.nft.json +1 -1
  184. package/dist/web/standalone/.next/server/app/api/recovery/route.js +1 -1
  185. package/dist/web/standalone/.next/server/app/api/recovery/route.js.nft.json +1 -1
  186. package/dist/web/standalone/.next/server/app/api/session/browser/route.js +1 -1
  187. package/dist/web/standalone/.next/server/app/api/session/browser/route.js.nft.json +1 -1
  188. package/dist/web/standalone/.next/server/app/api/session/command/route.js +1 -1
  189. package/dist/web/standalone/.next/server/app/api/session/command/route.js.nft.json +1 -1
  190. package/dist/web/standalone/.next/server/app/api/session/events/route.js +2 -2
  191. package/dist/web/standalone/.next/server/app/api/session/events/route.js.nft.json +1 -1
  192. package/dist/web/standalone/.next/server/app/api/session/manage/route.js +1 -1
  193. package/dist/web/standalone/.next/server/app/api/session/manage/route.js.nft.json +1 -1
  194. package/dist/web/standalone/.next/server/app/api/settings-data/route.js +1 -1
  195. package/dist/web/standalone/.next/server/app/api/settings-data/route.js.nft.json +1 -1
  196. package/dist/web/standalone/.next/server/app/api/skill-health/route.js +1 -1
  197. package/dist/web/standalone/.next/server/app/api/skill-health/route.js.nft.json +1 -1
  198. package/dist/web/standalone/.next/server/app/api/steer/route.js +1 -1
  199. package/dist/web/standalone/.next/server/app/api/steer/route.js.nft.json +1 -1
  200. package/dist/web/standalone/.next/server/app/api/switch-root/route.js +1 -1
  201. package/dist/web/standalone/.next/server/app/api/switch-root/route.js.nft.json +1 -1
  202. package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js +2 -2
  203. package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js.nft.json +1 -1
  204. package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js +2 -2
  205. package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js.nft.json +1 -1
  206. package/dist/web/standalone/.next/server/app/api/undo/route.js +1 -1
  207. package/dist/web/standalone/.next/server/app/api/undo/route.js.nft.json +1 -1
  208. package/dist/web/standalone/.next/server/app/api/visualizer/route.js +1 -1
  209. package/dist/web/standalone/.next/server/app/api/visualizer/route.js.nft.json +1 -1
  210. package/dist/web/standalone/.next/server/app/index.html +1 -1
  211. package/dist/web/standalone/.next/server/app/index.rsc +3 -3
  212. package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  213. package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
  214. package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  215. package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
  216. package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  217. package/dist/web/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  218. package/dist/web/standalone/.next/server/app-paths-manifest.json +11 -11
  219. package/dist/web/standalone/.next/server/chunks/6897.js +2 -2
  220. package/dist/web/standalone/.next/server/chunks/7461.js +1 -0
  221. package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
  222. package/dist/web/standalone/.next/server/middleware-manifest.json +5 -5
  223. package/dist/web/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
  224. package/dist/web/standalone/.next/server/pages/404.html +1 -1
  225. package/dist/web/standalone/.next/server/pages/500.html +1 -1
  226. package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
  227. package/dist/web/standalone/.next/static/chunks/{2826.02df9631042cc18e.js → 2826.e59e8578e2e28639.js} +2 -2
  228. package/dist/web/standalone/.next/static/chunks/{2008.71ee9230ad78df21.js → 3621.fc7480022c972438.js} +2 -2
  229. package/dist/web/standalone/.next/static/chunks/app/{page-f1e30ab6bb269149.js → page-5b113fd32bc2a1c3.js} +1 -1
  230. package/dist/web/standalone/.next/static/chunks/{webpack-6c7cda3e318eedb6.js → webpack-5fc74f13a25fa1bb.js} +1 -1
  231. package/dist/web/standalone/.next/static/css/632cd626b1731d88.css +1 -0
  232. package/dist/web/standalone/server.js +1 -1
  233. package/dist/welcome-screen.js +48 -24
  234. package/package.json +1 -1
  235. package/packages/daemon/package.json +2 -2
  236. package/packages/mcp-server/dist/server.d.ts.map +1 -1
  237. package/packages/mcp-server/dist/server.js +12 -10
  238. package/packages/mcp-server/dist/server.js.map +1 -1
  239. package/packages/mcp-server/dist/session-manager.d.ts.map +1 -1
  240. package/packages/mcp-server/dist/session-manager.js +8 -1
  241. package/packages/mcp-server/dist/session-manager.js.map +1 -1
  242. package/packages/mcp-server/dist/workflow-tools.d.ts +2 -1
  243. package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
  244. package/packages/mcp-server/dist/workflow-tools.js +306 -71
  245. package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
  246. package/packages/mcp-server/package.json +2 -2
  247. package/packages/mcp-server/src/mcp-server.test.ts +40 -4
  248. package/packages/mcp-server/src/server.ts +12 -10
  249. package/packages/mcp-server/src/session-manager.ts +10 -3
  250. package/packages/mcp-server/src/workflow-tools.test.ts +346 -1
  251. package/packages/mcp-server/src/workflow-tools.ts +359 -75
  252. package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
  253. package/packages/native/package.json +1 -1
  254. package/packages/pi-agent-core/dist/agent-loop.js +12 -0
  255. package/packages/pi-agent-core/dist/agent-loop.js.map +1 -1
  256. package/packages/pi-agent-core/dist/types.d.ts +30 -0
  257. package/packages/pi-agent-core/dist/types.d.ts.map +1 -1
  258. package/packages/pi-agent-core/dist/types.js.map +1 -1
  259. package/packages/pi-agent-core/package.json +1 -1
  260. package/packages/pi-agent-core/src/agent-loop.ts +14 -0
  261. package/packages/pi-agent-core/src/types.ts +34 -0
  262. package/packages/pi-agent-core/tsconfig.tsbuildinfo +1 -1
  263. package/packages/pi-ai/dist/index.d.ts +1 -0
  264. package/packages/pi-ai/dist/index.d.ts.map +1 -1
  265. package/packages/pi-ai/dist/index.js +1 -0
  266. package/packages/pi-ai/dist/index.js.map +1 -1
  267. package/packages/pi-ai/dist/models/generated/index.d.ts +17 -0
  268. package/packages/pi-ai/dist/models/generated/index.d.ts.map +1 -1
  269. package/packages/pi-ai/dist/models/generated/openai-codex.d.ts +17 -0
  270. package/packages/pi-ai/dist/models/generated/openai-codex.d.ts.map +1 -1
  271. package/packages/pi-ai/dist/models/generated/openai-codex.js +17 -0
  272. package/packages/pi-ai/dist/models/generated/openai-codex.js.map +1 -1
  273. package/packages/pi-ai/dist/models.generated.test.js +1 -0
  274. package/packages/pi-ai/dist/models.generated.test.js.map +1 -1
  275. package/packages/pi-ai/dist/providers/amazon-bedrock.d.ts +22 -1
  276. package/packages/pi-ai/dist/providers/amazon-bedrock.d.ts.map +1 -1
  277. package/packages/pi-ai/dist/providers/amazon-bedrock.js +40 -7
  278. package/packages/pi-ai/dist/providers/amazon-bedrock.js.map +1 -1
  279. package/packages/pi-ai/dist/providers/amazon-bedrock.test.d.ts +2 -0
  280. package/packages/pi-ai/dist/providers/amazon-bedrock.test.d.ts.map +1 -0
  281. package/packages/pi-ai/dist/providers/amazon-bedrock.test.js +106 -0
  282. package/packages/pi-ai/dist/providers/amazon-bedrock.test.js.map +1 -0
  283. package/packages/pi-ai/dist/providers/anthropic-auth.test.js +42 -1
  284. package/packages/pi-ai/dist/providers/anthropic-auth.test.js.map +1 -1
  285. package/packages/pi-ai/dist/providers/anthropic-bearer-auth.test.d.ts +2 -0
  286. package/packages/pi-ai/dist/providers/anthropic-bearer-auth.test.d.ts.map +1 -0
  287. package/packages/pi-ai/dist/providers/anthropic-bearer-auth.test.js +13 -0
  288. package/packages/pi-ai/dist/providers/anthropic-bearer-auth.test.js.map +1 -0
  289. package/packages/pi-ai/dist/providers/anthropic-shared.d.ts +19 -0
  290. package/packages/pi-ai/dist/providers/anthropic-shared.d.ts.map +1 -1
  291. package/packages/pi-ai/dist/providers/anthropic-shared.js +25 -1
  292. package/packages/pi-ai/dist/providers/anthropic-shared.js.map +1 -1
  293. package/packages/pi-ai/dist/providers/anthropic.d.ts +11 -0
  294. package/packages/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
  295. package/packages/pi-ai/dist/providers/anthropic.js +23 -2
  296. package/packages/pi-ai/dist/providers/anthropic.js.map +1 -1
  297. package/packages/pi-ai/dist/providers/api-family.d.ts +27 -0
  298. package/packages/pi-ai/dist/providers/api-family.d.ts.map +1 -0
  299. package/packages/pi-ai/dist/providers/api-family.js +47 -0
  300. package/packages/pi-ai/dist/providers/api-family.js.map +1 -0
  301. package/packages/pi-ai/dist/providers/api-family.test.d.ts +2 -0
  302. package/packages/pi-ai/dist/providers/api-family.test.d.ts.map +1 -0
  303. package/packages/pi-ai/dist/providers/api-family.test.js +101 -0
  304. package/packages/pi-ai/dist/providers/api-family.test.js.map +1 -0
  305. package/packages/pi-ai/dist/utils/oauth/github-copilot.d.ts.map +1 -1
  306. package/packages/pi-ai/dist/utils/oauth/github-copilot.js +12 -2
  307. package/packages/pi-ai/dist/utils/oauth/github-copilot.js.map +1 -1
  308. package/packages/pi-ai/dist/utils/oauth/github-copilot.test.js +164 -14
  309. package/packages/pi-ai/dist/utils/oauth/github-copilot.test.js.map +1 -1
  310. package/packages/pi-ai/dist/utils/oauth/google-antigravity.d.ts.map +1 -1
  311. package/packages/pi-ai/dist/utils/oauth/google-antigravity.js +15 -3
  312. package/packages/pi-ai/dist/utils/oauth/google-antigravity.js.map +1 -1
  313. package/packages/pi-ai/dist/utils/oauth/google-antigravity.test.d.ts +2 -0
  314. package/packages/pi-ai/dist/utils/oauth/google-antigravity.test.d.ts.map +1 -0
  315. package/packages/pi-ai/dist/utils/oauth/google-antigravity.test.js +67 -0
  316. package/packages/pi-ai/dist/utils/oauth/google-antigravity.test.js.map +1 -0
  317. package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.d.ts.map +1 -1
  318. package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.js +16 -3
  319. package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.js.map +1 -1
  320. package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.test.d.ts +2 -0
  321. package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.test.d.ts.map +1 -0
  322. package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.test.js +67 -0
  323. package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.test.js.map +1 -0
  324. package/packages/pi-ai/dist/utils/oauth/oauth-providers.test.d.ts +2 -0
  325. package/packages/pi-ai/dist/utils/oauth/oauth-providers.test.d.ts.map +1 -0
  326. package/packages/pi-ai/dist/utils/oauth/oauth-providers.test.js +289 -0
  327. package/packages/pi-ai/dist/utils/oauth/oauth-providers.test.js.map +1 -0
  328. package/packages/pi-ai/dist/utils/oauth/openai-codex.d.ts.map +1 -1
  329. package/packages/pi-ai/dist/utils/oauth/openai-codex.js +12 -0
  330. package/packages/pi-ai/dist/utils/oauth/openai-codex.js.map +1 -1
  331. package/packages/pi-ai/package.json +1 -1
  332. package/packages/pi-ai/scripts/generate-models.ts +12 -0
  333. package/packages/pi-ai/src/index.ts +1 -0
  334. package/packages/pi-ai/src/models/generated/openai-codex.ts +17 -0
  335. package/packages/pi-ai/src/models.generated.test.ts +1 -0
  336. package/packages/pi-ai/src/providers/amazon-bedrock.test.ts +164 -0
  337. package/packages/pi-ai/src/providers/amazon-bedrock.ts +41 -8
  338. package/packages/pi-ai/src/providers/anthropic-auth.test.ts +47 -1
  339. package/packages/pi-ai/src/providers/anthropic-bearer-auth.test.ts +26 -0
  340. package/packages/pi-ai/src/providers/anthropic-shared.ts +30 -1
  341. package/packages/pi-ai/src/providers/anthropic.ts +25 -2
  342. package/packages/pi-ai/src/providers/api-family.test.ts +129 -0
  343. package/packages/pi-ai/src/providers/api-family.ts +57 -0
  344. package/packages/pi-ai/src/utils/oauth/github-copilot.test.ts +200 -23
  345. package/packages/pi-ai/src/utils/oauth/github-copilot.ts +12 -2
  346. package/packages/pi-ai/src/utils/oauth/google-antigravity.test.ts +84 -0
  347. package/packages/pi-ai/src/utils/oauth/google-antigravity.ts +15 -5
  348. package/packages/pi-ai/src/utils/oauth/google-gemini-cli.test.ts +84 -0
  349. package/packages/pi-ai/src/utils/oauth/google-gemini-cli.ts +16 -5
  350. package/packages/pi-ai/src/utils/oauth/oauth-providers.test.ts +363 -0
  351. package/packages/pi-ai/src/utils/oauth/openai-codex.ts +15 -0
  352. package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
  353. package/packages/pi-coding-agent/dist/cli/args.d.ts +6 -0
  354. package/packages/pi-coding-agent/dist/cli/args.d.ts.map +1 -1
  355. package/packages/pi-coding-agent/dist/cli/args.js +14 -4
  356. package/packages/pi-coding-agent/dist/cli/args.js.map +1 -1
  357. package/packages/pi-coding-agent/dist/cli/args.test.d.ts +2 -0
  358. package/packages/pi-coding-agent/dist/cli/args.test.d.ts.map +1 -0
  359. package/packages/pi-coding-agent/dist/cli/args.test.js +38 -0
  360. package/packages/pi-coding-agent/dist/cli/args.test.js.map +1 -0
  361. package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
  362. package/packages/pi-coding-agent/dist/core/agent-session.js +25 -2
  363. package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
  364. package/packages/pi-coding-agent/dist/core/auth-storage.d.ts +7 -0
  365. package/packages/pi-coding-agent/dist/core/auth-storage.d.ts.map +1 -1
  366. package/packages/pi-coding-agent/dist/core/auth-storage.js +25 -0
  367. package/packages/pi-coding-agent/dist/core/auth-storage.js.map +1 -1
  368. package/packages/pi-coding-agent/dist/core/auth-storage.test.js +38 -0
  369. package/packages/pi-coding-agent/dist/core/auth-storage.test.js.map +1 -1
  370. package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js +4 -1
  371. package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js.map +1 -1
  372. package/packages/pi-coding-agent/dist/core/extensions/index.d.ts +1 -1
  373. package/packages/pi-coding-agent/dist/core/extensions/index.d.ts.map +1 -1
  374. package/packages/pi-coding-agent/dist/core/extensions/index.js.map +1 -1
  375. package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
  376. package/packages/pi-coding-agent/dist/core/extensions/loader.js +4 -0
  377. package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
  378. package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts +34 -2
  379. package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
  380. package/packages/pi-coding-agent/dist/core/extensions/runner.js +233 -0
  381. package/packages/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
  382. package/packages/pi-coding-agent/dist/core/extensions/types.d.ts +200 -3
  383. package/packages/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
  384. package/packages/pi-coding-agent/dist/core/extensions/types.js.map +1 -1
  385. package/packages/pi-coding-agent/dist/core/hooks-runner.d.ts +53 -0
  386. package/packages/pi-coding-agent/dist/core/hooks-runner.d.ts.map +1 -0
  387. package/packages/pi-coding-agent/dist/core/hooks-runner.js +337 -0
  388. package/packages/pi-coding-agent/dist/core/hooks-runner.js.map +1 -0
  389. package/packages/pi-coding-agent/dist/core/hooks-runner.test.d.ts +2 -0
  390. package/packages/pi-coding-agent/dist/core/hooks-runner.test.d.ts.map +1 -0
  391. package/packages/pi-coding-agent/dist/core/hooks-runner.test.js +234 -0
  392. package/packages/pi-coding-agent/dist/core/hooks-runner.test.js.map +1 -0
  393. package/packages/pi-coding-agent/dist/core/index.d.ts +1 -0
  394. package/packages/pi-coding-agent/dist/core/index.d.ts.map +1 -1
  395. package/packages/pi-coding-agent/dist/core/index.js +1 -0
  396. package/packages/pi-coding-agent/dist/core/index.js.map +1 -1
  397. package/packages/pi-coding-agent/dist/core/model-registry-auth-header.test.d.ts +2 -0
  398. package/packages/pi-coding-agent/dist/core/model-registry-auth-header.test.d.ts.map +1 -0
  399. package/packages/pi-coding-agent/dist/core/model-registry-auth-header.test.js +40 -0
  400. package/packages/pi-coding-agent/dist/core/model-registry-auth-header.test.js.map +1 -0
  401. package/packages/pi-coding-agent/dist/core/model-registry-auth-mode.test.js +32 -0
  402. package/packages/pi-coding-agent/dist/core/model-registry-auth-mode.test.js.map +1 -1
  403. package/packages/pi-coding-agent/dist/core/retry-handler.d.ts.map +1 -1
  404. package/packages/pi-coding-agent/dist/core/retry-handler.js +4 -1
  405. package/packages/pi-coding-agent/dist/core/retry-handler.js.map +1 -1
  406. package/packages/pi-coding-agent/dist/core/sdk.d.ts +10 -0
  407. package/packages/pi-coding-agent/dist/core/sdk.d.ts.map +1 -1
  408. package/packages/pi-coding-agent/dist/core/sdk.js +33 -5
  409. package/packages/pi-coding-agent/dist/core/sdk.js.map +1 -1
  410. package/packages/pi-coding-agent/dist/core/settings-manager.d.ts +55 -0
  411. package/packages/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
  412. package/packages/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
  413. package/packages/pi-coding-agent/dist/index.d.ts +1 -1
  414. package/packages/pi-coding-agent/dist/index.d.ts.map +1 -1
  415. package/packages/pi-coding-agent/dist/index.js.map +1 -1
  416. package/packages/pi-coding-agent/dist/main.d.ts.map +1 -1
  417. package/packages/pi-coding-agent/dist/main.js +3 -0
  418. package/packages/pi-coding-agent/dist/main.js.map +1 -1
  419. package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.d.ts.map +1 -1
  420. package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js +17 -7
  421. package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js.map +1 -1
  422. package/packages/pi-coding-agent/dist/modes/interactive/components/footer.d.ts.map +1 -1
  423. package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js +48 -34
  424. package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js.map +1 -1
  425. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts +4 -0
  426. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
  427. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +83 -33
  428. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
  429. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.d.ts +1 -0
  430. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -1
  431. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.js +1 -0
  432. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.js.map +1 -1
  433. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts +1 -1
  434. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  435. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js.map +1 -1
  436. package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.d.ts.map +1 -1
  437. package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js +13 -9
  438. package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js.map +1 -1
  439. package/packages/pi-coding-agent/package.json +1 -1
  440. package/packages/pi-coding-agent/src/cli/args.test.ts +44 -0
  441. package/packages/pi-coding-agent/src/cli/args.ts +21 -6
  442. package/packages/pi-coding-agent/src/core/agent-session.ts +27 -2
  443. package/packages/pi-coding-agent/src/core/auth-storage.test.ts +42 -0
  444. package/packages/pi-coding-agent/src/core/auth-storage.ts +25 -0
  445. package/packages/pi-coding-agent/src/core/chat-controller-ordering.test.ts +4 -1
  446. package/packages/pi-coding-agent/src/core/extensions/index.ts +16 -0
  447. package/packages/pi-coding-agent/src/core/extensions/loader.ts +5 -0
  448. package/packages/pi-coding-agent/src/core/extensions/runner.ts +353 -1
  449. package/packages/pi-coding-agent/src/core/extensions/types.ts +253 -2
  450. package/packages/pi-coding-agent/src/core/hooks-runner.test.ts +269 -0
  451. package/packages/pi-coding-agent/src/core/hooks-runner.ts +460 -0
  452. package/packages/pi-coding-agent/src/core/index.ts +10 -0
  453. package/packages/pi-coding-agent/src/core/model-registry-auth-header.test.ts +44 -0
  454. package/packages/pi-coding-agent/src/core/model-registry-auth-mode.test.ts +37 -1
  455. package/packages/pi-coding-agent/src/core/retry-handler.ts +4 -1
  456. package/packages/pi-coding-agent/src/core/sdk.ts +48 -5
  457. package/packages/pi-coding-agent/src/core/settings-manager.ts +57 -0
  458. package/packages/pi-coding-agent/src/index.ts +16 -0
  459. package/packages/pi-coding-agent/src/main.ts +4 -0
  460. package/packages/pi-coding-agent/src/modes/interactive/components/chat-frame.ts +19 -7
  461. package/packages/pi-coding-agent/src/modes/interactive/components/footer.ts +53 -31
  462. package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +88 -36
  463. package/packages/pi-coding-agent/src/modes/interactive/theme/theme-schema.ts +1 -0
  464. package/packages/pi-coding-agent/src/modes/interactive/theme/theme.ts +1 -0
  465. package/packages/pi-coding-agent/src/modes/interactive/theme/themes.ts +13 -9
  466. package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
  467. package/packages/pi-tui/package.json +1 -1
  468. package/packages/rpc-client/package.json +1 -1
  469. package/pkg/dist/modes/interactive/theme/theme-schema.d.ts +1 -0
  470. package/pkg/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -1
  471. package/pkg/dist/modes/interactive/theme/theme-schema.js +1 -0
  472. package/pkg/dist/modes/interactive/theme/theme-schema.js.map +1 -1
  473. package/pkg/dist/modes/interactive/theme/theme.d.ts +1 -1
  474. package/pkg/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  475. package/pkg/dist/modes/interactive/theme/theme.js.map +1 -1
  476. package/pkg/dist/modes/interactive/theme/themes.d.ts.map +1 -1
  477. package/pkg/dist/modes/interactive/theme/themes.js +13 -9
  478. package/pkg/dist/modes/interactive/theme/themes.js.map +1 -1
  479. package/pkg/package.json +1 -1
  480. package/src/resources/agents/researcher.md +1 -1
  481. package/src/resources/extensions/ask-user-questions.ts +7 -4
  482. package/src/resources/extensions/claude-code-cli/readiness.ts +36 -2
  483. package/src/resources/extensions/claude-code-cli/stream-adapter.ts +59 -1
  484. package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +66 -0
  485. package/src/resources/extensions/gsd/auto/loop-deps.ts +2 -10
  486. package/src/resources/extensions/gsd/auto/phases.ts +52 -6
  487. package/src/resources/extensions/gsd/auto-artifact-paths.ts +20 -0
  488. package/src/resources/extensions/gsd/auto-dashboard.ts +46 -5
  489. package/src/resources/extensions/gsd/auto-direct-dispatch.ts +15 -2
  490. package/src/resources/extensions/gsd/auto-dispatch.ts +96 -4
  491. package/src/resources/extensions/gsd/auto-model-selection.ts +37 -6
  492. package/src/resources/extensions/gsd/auto-post-unit.ts +7 -5
  493. package/src/resources/extensions/gsd/auto-prompts.ts +225 -45
  494. package/src/resources/extensions/gsd/auto-recovery.ts +47 -0
  495. package/src/resources/extensions/gsd/auto-start.ts +8 -6
  496. package/src/resources/extensions/gsd/auto-verification.ts +33 -0
  497. package/src/resources/extensions/gsd/auto-worktree.ts +81 -1
  498. package/src/resources/extensions/gsd/auto.ts +27 -2
  499. package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +8 -21
  500. package/src/resources/extensions/gsd/bootstrap/db-tools.ts +46 -24
  501. package/src/resources/extensions/gsd/bootstrap/memory-tools.ts +163 -0
  502. package/src/resources/extensions/gsd/bootstrap/query-tools.ts +31 -0
  503. package/src/resources/extensions/gsd/bootstrap/register-extension.ts +15 -0
  504. package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +22 -0
  505. package/src/resources/extensions/gsd/bootstrap/system-context.ts +89 -10
  506. package/src/resources/extensions/gsd/commands/catalog.ts +15 -7
  507. package/src/resources/extensions/gsd/commands/handlers/core.ts +63 -27
  508. package/src/resources/extensions/gsd/commands/handlers/escalate.ts +216 -0
  509. package/src/resources/extensions/gsd/commands/handlers/onboarding.ts +196 -0
  510. package/src/resources/extensions/gsd/commands/handlers/ops.ts +10 -0
  511. package/src/resources/extensions/gsd/commands-config.ts +10 -0
  512. package/src/resources/extensions/gsd/commands-extract-learnings.ts +262 -78
  513. package/src/resources/extensions/gsd/commands-memory.ts +551 -0
  514. package/src/resources/extensions/gsd/commands-prefs-wizard.ts +48 -11
  515. package/src/resources/extensions/gsd/custom-workflow-engine.ts +85 -60
  516. package/src/resources/extensions/gsd/db-writer.ts +91 -17
  517. package/src/resources/extensions/gsd/docs/preferences-reference.md +2 -2
  518. package/src/resources/extensions/gsd/doctor-environment.ts +2 -1
  519. package/src/resources/extensions/gsd/doctor-git-checks.ts +51 -30
  520. package/src/resources/extensions/gsd/doctor-proactive.ts +4 -1
  521. package/src/resources/extensions/gsd/doctor-providers.ts +59 -6
  522. package/src/resources/extensions/gsd/doctor-runtime-checks.ts +22 -1
  523. package/src/resources/extensions/gsd/doctor-types.ts +1 -0
  524. package/src/resources/extensions/gsd/doctor.ts +7 -1
  525. package/src/resources/extensions/gsd/ecosystem/gsd-extension-api.ts +2 -0
  526. package/src/resources/extensions/gsd/error-classifier.ts +5 -2
  527. package/src/resources/extensions/gsd/escalation.ts +367 -0
  528. package/src/resources/extensions/gsd/graph.ts +33 -0
  529. package/src/resources/extensions/gsd/gsd-db.ts +617 -32
  530. package/src/resources/extensions/gsd/health-widget-core.ts +43 -14
  531. package/src/resources/extensions/gsd/health-widget.ts +7 -3
  532. package/src/resources/extensions/gsd/hook-emitter.ts +188 -0
  533. package/src/resources/extensions/gsd/init-wizard.ts +87 -54
  534. package/src/resources/extensions/gsd/markdown-renderer.ts +5 -5
  535. package/src/resources/extensions/gsd/memory-backfill.ts +140 -0
  536. package/src/resources/extensions/gsd/memory-embeddings.ts +235 -0
  537. package/src/resources/extensions/gsd/memory-extractor.ts +100 -34
  538. package/src/resources/extensions/gsd/memory-ingest.ts +286 -0
  539. package/src/resources/extensions/gsd/memory-relations.ts +240 -0
  540. package/src/resources/extensions/gsd/memory-source-store.ts +138 -0
  541. package/src/resources/extensions/gsd/memory-store.ts +377 -7
  542. package/src/resources/extensions/gsd/metrics.ts +1 -0
  543. package/src/resources/extensions/gsd/model-cost-table.ts +1 -0
  544. package/src/resources/extensions/gsd/model-router.ts +21 -5
  545. package/src/resources/extensions/gsd/native-git-bridge.ts +118 -6
  546. package/src/resources/extensions/gsd/notification-overlay.ts +9 -19
  547. package/src/resources/extensions/gsd/notification-widget.ts +25 -43
  548. package/src/resources/extensions/gsd/onboarding-state.ts +146 -0
  549. package/src/resources/extensions/gsd/post-execution-checks.ts +37 -14
  550. package/src/resources/extensions/gsd/pre-execution-checks.ts +100 -12
  551. package/src/resources/extensions/gsd/preferences-models.ts +1 -0
  552. package/src/resources/extensions/gsd/preferences-types.ts +9 -1
  553. package/src/resources/extensions/gsd/preferences-validation.ts +33 -7
  554. package/src/resources/extensions/gsd/prompts/add-tests.md +1 -0
  555. package/src/resources/extensions/gsd/prompts/complete-milestone.md +4 -1
  556. package/src/resources/extensions/gsd/prompts/complete-slice.md +2 -2
  557. package/src/resources/extensions/gsd/prompts/debug-diagnose.md +2 -0
  558. package/src/resources/extensions/gsd/prompts/execute-task.md +16 -3
  559. package/src/resources/extensions/gsd/prompts/plan-milestone.md +12 -0
  560. package/src/resources/extensions/gsd/prompts/plan-slice.md +2 -0
  561. package/src/resources/extensions/gsd/prompts/refine-slice.md +69 -0
  562. package/src/resources/extensions/gsd/prompts/research-slice.md +1 -0
  563. package/src/resources/extensions/gsd/python-resolver.ts +76 -0
  564. package/src/resources/extensions/gsd/setup-catalog.ts +105 -0
  565. package/src/resources/extensions/gsd/state.ts +95 -6
  566. package/src/resources/extensions/gsd/templates/PREFERENCES.md +1 -1
  567. package/src/resources/extensions/gsd/tests/artifact-corruption-2630.test.ts +7 -0
  568. package/src/resources/extensions/gsd/tests/auto-dashboard.test.ts +49 -0
  569. package/src/resources/extensions/gsd/tests/auto-migrating-recovery.test.ts +63 -0
  570. package/src/resources/extensions/gsd/tests/auto-model-selection.test.ts +95 -1
  571. package/src/resources/extensions/gsd/tests/auto-prompts-fallback.test.ts +35 -0
  572. package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +123 -1
  573. package/src/resources/extensions/gsd/tests/auto-wrapup-inflight-guard.test.ts +39 -0
  574. package/src/resources/extensions/gsd/tests/bundled-skill-triggers.test.ts +54 -0
  575. package/src/resources/extensions/gsd/tests/commands-extract-learnings.test.ts +335 -21
  576. package/src/resources/extensions/gsd/tests/complete-slice.test.ts +6 -8
  577. package/src/resources/extensions/gsd/tests/complete-task.test.ts +2 -2
  578. package/src/resources/extensions/gsd/tests/custom-workflow-engine.test.ts +63 -0
  579. package/src/resources/extensions/gsd/tests/derive-state-db.test.ts +42 -0
  580. package/src/resources/extensions/gsd/tests/derive-state-helpers.test.ts +8 -4
  581. package/src/resources/extensions/gsd/tests/doctor-providers.test.ts +117 -3
  582. package/src/resources/extensions/gsd/tests/enhanced-verification-integration.test.ts +5 -0
  583. package/src/resources/extensions/gsd/tests/ensure-db-open.test.ts +306 -1
  584. package/src/resources/extensions/gsd/tests/escalation.test.ts +818 -0
  585. package/src/resources/extensions/gsd/tests/flat-rate-routing-guard.test.ts +145 -8
  586. package/src/resources/extensions/gsd/tests/freeform-decisions.test.ts +62 -0
  587. package/src/resources/extensions/gsd/tests/gsd-db.test.ts +44 -1
  588. package/src/resources/extensions/gsd/tests/health-widget.test.ts +8 -2
  589. package/src/resources/extensions/gsd/tests/init-prefs-routing.test.ts +190 -0
  590. package/src/resources/extensions/gsd/tests/integration/doctor-git-symlink-cwd.test.ts +90 -0
  591. package/src/resources/extensions/gsd/tests/integration/doctor-git.test.ts +117 -0
  592. package/src/resources/extensions/gsd/tests/integration/doctor-proactive.test.ts +44 -0
  593. package/src/resources/extensions/gsd/tests/integration/doctor-runtime.test.ts +32 -1
  594. package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +72 -5
  595. package/src/resources/extensions/gsd/tests/integration/integration-proof.test.ts +2 -2
  596. package/src/resources/extensions/gsd/tests/integration/test-isolation.ts +53 -0
  597. package/src/resources/extensions/gsd/tests/interactive-routing-bypass.test.ts +1 -1
  598. package/src/resources/extensions/gsd/tests/journal-integration.test.ts +35 -0
  599. package/src/resources/extensions/gsd/tests/load-memory-block.test.ts +36 -0
  600. package/src/resources/extensions/gsd/tests/md-importer.test.ts +1 -1
  601. package/src/resources/extensions/gsd/tests/memory-embeddings.test.ts +213 -0
  602. package/src/resources/extensions/gsd/tests/memory-ingest.test.ts +153 -0
  603. package/src/resources/extensions/gsd/tests/memory-maintenance.test.ts +107 -0
  604. package/src/resources/extensions/gsd/tests/memory-relations.test.ts +175 -0
  605. package/src/resources/extensions/gsd/tests/memory-store.test.ts +2 -2
  606. package/src/resources/extensions/gsd/tests/memory-tools.test.ts +295 -0
  607. package/src/resources/extensions/gsd/tests/milestone-status-tool.test.ts +3 -2
  608. package/src/resources/extensions/gsd/tests/model-cost-table.test.ts +2 -2
  609. package/src/resources/extensions/gsd/tests/model-router.test.ts +51 -1
  610. package/src/resources/extensions/gsd/tests/model-unittype-mapping.test.ts +59 -0
  611. package/src/resources/extensions/gsd/tests/notification-overlay.test.ts +56 -37
  612. package/src/resources/extensions/gsd/tests/notification-widget.test.ts +1 -1
  613. package/src/resources/extensions/gsd/tests/onboarding-state.test.ts +105 -0
  614. package/src/resources/extensions/gsd/tests/plan-milestone-boundary-map-preservation.test.ts +114 -0
  615. package/src/resources/extensions/gsd/tests/plan-milestone.test.ts +4 -5
  616. package/src/resources/extensions/gsd/tests/plan-slice.test.ts +17 -0
  617. package/src/resources/extensions/gsd/tests/post-execution-checks.test.ts +105 -1
  618. package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +317 -1
  619. package/src/resources/extensions/gsd/tests/progressive-planning.test.ts +539 -0
  620. package/src/resources/extensions/gsd/tests/projection-no-plan-overwrite.test.ts +11 -2
  621. package/src/resources/extensions/gsd/tests/projection-regression.test.ts +7 -0
  622. package/src/resources/extensions/gsd/tests/prompt-budget-enforcement.test.ts +159 -8
  623. package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +24 -0
  624. package/src/resources/extensions/gsd/tests/prompts-no-gitignored-test-refs.test.ts +56 -0
  625. package/src/resources/extensions/gsd/tests/provider-errors.test.ts +41 -4
  626. package/src/resources/extensions/gsd/tests/python-resolver.test.ts +131 -0
  627. package/src/resources/extensions/gsd/tests/register-hooks-depth-verification.test.ts +67 -0
  628. package/src/resources/extensions/gsd/tests/requirements.test.ts +9 -0
  629. package/src/resources/extensions/gsd/tests/session-start-footer.test.ts +153 -0
  630. package/src/resources/extensions/gsd/tests/skip-slice-cascades-tasks.test.ts +125 -0
  631. package/src/resources/extensions/gsd/tests/slice-context-injection.test.ts +16 -4
  632. package/src/resources/extensions/gsd/tests/stash-queued-context-files.test.ts +54 -0
  633. package/src/resources/extensions/gsd/tests/state-corruption-2945.test.ts +3 -0
  634. package/src/resources/extensions/gsd/tests/summary-render-parity.test.ts +5 -0
  635. package/src/resources/extensions/gsd/tests/uok-contracts.test.ts +2 -1
  636. package/src/resources/extensions/gsd/tests/uok-flags.test.ts +1 -1
  637. package/src/resources/extensions/gsd/tests/validate-milestone.test.ts +9 -3
  638. package/src/resources/extensions/gsd/tests/verification-gate.test.ts +35 -0
  639. package/src/resources/extensions/gsd/tests/workflow-projections.test.ts +7 -0
  640. package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +97 -0
  641. package/src/resources/extensions/gsd/tests/worktree-journal-events.test.ts +2 -1
  642. package/src/resources/extensions/gsd/tests/worktree-resolver.test.ts +77 -2
  643. package/src/resources/extensions/gsd/tools/complete-task.ts +87 -0
  644. package/src/resources/extensions/gsd/tools/memory-tools.ts +410 -0
  645. package/src/resources/extensions/gsd/tools/plan-milestone.ts +42 -8
  646. package/src/resources/extensions/gsd/tools/plan-slice.ts +6 -1
  647. package/src/resources/extensions/gsd/tools/skip-slice.ts +133 -0
  648. package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +14 -0
  649. package/src/resources/extensions/gsd/types.ts +62 -0
  650. package/src/resources/extensions/gsd/uok/contracts.ts +2 -1
  651. package/src/resources/extensions/gsd/uok/flags.ts +1 -1
  652. package/src/resources/extensions/gsd/verification-gate.ts +2 -1
  653. package/src/resources/extensions/gsd/workflow-logger.ts +4 -1
  654. package/src/resources/extensions/gsd/workflow-manifest.ts +8 -0
  655. package/src/resources/extensions/gsd/workflow-mcp.ts +1 -0
  656. package/src/resources/extensions/gsd/workflow-projections.ts +18 -16
  657. package/src/resources/extensions/gsd/workflow-templates/spike.md +6 -0
  658. package/src/resources/extensions/gsd/worktree-resolver.ts +47 -1
  659. package/src/resources/extensions/remote-questions/manager.ts +13 -1
  660. package/src/resources/extensions/remote-questions/tests/remote-answer-normalization.test.ts +92 -0
  661. package/src/resources/extensions/search-the-web/command-search-provider.ts +4 -1
  662. package/src/resources/extensions/search-the-web/native-search.ts +13 -3
  663. package/src/resources/skills/api-design/SKILL.md +190 -0
  664. package/src/resources/skills/create-mcp-server/SKILL.md +121 -0
  665. package/src/resources/skills/decompose-into-slices/SKILL.md +139 -0
  666. package/src/resources/skills/dependency-upgrade/SKILL.md +158 -0
  667. package/src/resources/skills/design-an-interface/SKILL.md +102 -0
  668. package/src/resources/skills/forensics/SKILL.md +153 -0
  669. package/src/resources/skills/grill-me/SKILL.md +93 -0
  670. package/src/resources/skills/handoff/SKILL.md +121 -0
  671. package/src/resources/skills/observability/SKILL.md +174 -0
  672. package/src/resources/skills/security-review/SKILL.md +181 -0
  673. package/src/resources/skills/spike-wrap-up/SKILL.md +138 -0
  674. package/src/resources/skills/tdd/SKILL.md +112 -0
  675. package/src/resources/skills/verify-before-complete/SKILL.md +97 -0
  676. package/src/resources/skills/write-docs/SKILL.md +81 -0
  677. package/src/resources/skills/write-milestone-brief/SKILL.md +135 -0
  678. package/dist/web/standalone/.next/static/css/3e9cdadb4d23b8a4.css +0 -1
  679. /package/dist/web/standalone/.next/static/{JncJywFxCugMuXGs56m-b → pBwmOoye64ZrRp-_rf0v1}/_buildManifest.js +0 -0
  680. /package/dist/web/standalone/.next/static/{JncJywFxCugMuXGs56m-b → pBwmOoye64ZrRp-_rf0v1}/_ssgManifest.js +0 -0
@@ -32,11 +32,12 @@ A researcher explored the codebase and a planner decomposed the work — you are
32
32
 
33
33
  Then:
34
34
  0. Narrate step transitions, key implementation decisions, and verification outcomes as you work. Keep it terse — one line between tool-call clusters, not between every call — but write complete sentences in user-facing prose, not shorthand notes or scratchpad fragments.
35
+ 0a. Call `memory_query` with 2-4 keywords drawn from the task title and the files it touches. Surface any prior gotchas, conventions, or architectural decisions before you start changing code. Skip only if the task is trivially mechanical.
35
36
  1. {{skillActivation}} Follow any activated skills before writing code. If no skills match this task, skip this step.
36
37
  2. Execute the steps in the inlined task plan, adapting minor local mismatches when the surrounding code differs from the planner's snapshot
37
38
  3. Before any `Write` that creates an artifact or output file, check whether that path already exists. If it does, read it first and decide whether the work is already done, should be extended, or truly needs replacement. "Create" in the plan does **not** mean the file is missing — a prior session may already have started it.
38
39
  4. Build the real thing. If the task plan says "create login endpoint", build an endpoint that actually authenticates against a real store, not one that returns a hardcoded success response. If the task plan says "create dashboard page", build a page that renders real data from the API, not a component with hardcoded props. Stubs and mocks are for tests, not for the shipped feature.
39
- 5. Write or update tests as part of execution — tests are verification, not an afterthought. If the slice plan defines test files in its Verification section and this is the first task, create them (they should initially fail).
40
+ 5. Write or update tests as part of execution — tests are verification, not an afterthought. If the slice plan defines test files in its Verification section and this is the first task, create them (they should initially fail). Tests must only reference files tracked in git; never import, read, or assert on paths listed in `.gitignore` (e.g. `.gsd/`, `.planning/`, `.audits/`) — those files are local-only and the test will fail for anyone else. Use inline fixtures or tracked samples instead.
40
41
  6. When implementing non-trivial runtime behavior (async flows, API boundaries, background processes, error paths), add or preserve agent-usable observability. Skip this for simple changes where it doesn't apply.
41
42
 
42
43
  **Background process rule:** Never use bare `command &` to run background processes. The shell's `&` operator leaves stdout/stderr attached to the parent, which causes the Bash tool to hang indefinitely waiting for those streams to close. Always redirect output before backgrounding:
@@ -69,8 +70,20 @@ Then:
69
70
  - Know when to stop. If you've tried 3+ fixes without progress, your mental model is probably wrong. Stop. List what you know for certain. List what you've ruled out. Form fresh hypotheses from there.
70
71
  - Don't fix symptoms. Understand *why* something fails before changing code. A test that passes after a change you don't understand is luck, not a fix.
71
72
  16. **Blocker discovery:** If execution reveals that the remaining slice plan is fundamentally invalid — not just a bug or minor deviation, but a plan-invalidating finding like a wrong API, missing capability, or architectural mismatch — set `blocker_discovered: true` in the task summary frontmatter and describe the blocker clearly in the summary narrative. Do NOT set `blocker_discovered: true` for ordinary debugging, minor deviations, or issues that can be fixed within the current task or the remaining plan. This flag triggers an automatic replan of the slice.
72
- 17. If you made an architectural, pattern, library, or observability decision during this task that downstream work should know about, append it to `.gsd/DECISIONS.md` (read the template at `~/.gsd/agent/extensions/gsd/templates/decisions.md` if the file doesn't exist yet). Not every task produces decisions — only append when a meaningful choice was made.
73
- 18. If you discover a non-obvious rule, recurring gotcha, or useful pattern during execution, append it to `.gsd/KNOWLEDGE.md`. Only add entries that would save future agents from repeating your investigation. Don't add obvious things.
73
+ 16a. **Mid-execution escalation (ADR-011 Phase 2):** If you hit an ambiguity that is *not* a plan-invalidating blocker but whose resolution materially affects downstream work AND cannot be derived from the task plan, CONTEXT.md, DECISIONS.md, or codebase evidence, you MAY escalate to the user. Populate an `escalation` object alongside the milestoneId/sliceId/taskId fields on your completion tool call with:
74
+ - `question` — one clear sentence
75
+ - `options` — 2–4 entries with `id` (short, e.g. "A", "B"), `label`, and 1–2 sentence `tradeoffs`
76
+ - `recommendation` — the option `id` you recommend
77
+ - `recommendationRationale` — 1–2 sentences on why
78
+ - `continueWithDefault` — `true` means finish the task using your recommendation now and let the user's later response inject a correction into the NEXT task; `false` means auto-mode pauses until the user resolves via `/gsd escalate resolve <taskId> <choice>`.
79
+
80
+ Escalate ONLY when the answer materially affects downstream tasks AND cannot be resolved from available context. Do NOT escalate for implementation style, minor deviations, or anything already covered by DECISIONS.md. Escalations must include a real recommendation — do not ask the user to pick without giving your best judgment.
81
+
82
+ **Scope:** Escalation is instrumented only in `execute-task`. Refine-slice escalation is deferred. Reactive-execute batches run to completion before escalations are surfaced — the dispatch pause happens on the next loop iteration, not mid-batch.
83
+
84
+ The `escalation` payload is ignored unless `phases.mid_execution_escalation` is enabled; populate it anyway for audit logs.
85
+ 17. If you made an architectural, pattern, library, or observability decision during this task that downstream work should know about, call `capture_thought` with `category: "architecture"` (or `"pattern"`). For decisions, populate `structuredFields` with `{ scope, decision, choice, rationale, made_by: "agent", revisable }` so future projection back to a human-visible decisions register stays lossless. Not every task produces decisions — only capture when a meaningful choice was made.
86
+ 18. If you discover a non-obvious rule, recurring gotcha, or useful pattern during execution, call `capture_thought` with `category: "gotcha"`, `"convention"`, `"pattern"`, or `"environment"` as appropriate. Only capture entries that would save future agents from repeating your investigation — don't capture obvious things. The memory store is the single source of truth for cross-session knowledge (ADR-013); do not append to `.gsd/DECISIONS.md` or `.gsd/KNOWLEDGE.md` directly.
74
87
  19. Read the template at `~/.gsd/agent/extensions/gsd/templates/task-summary.md`
75
88
  20. Use that template to prepare the completion content you will pass to `gsd_complete_task` using the camelCase fields `milestoneId`, `sliceId`, `taskId`, `oneLiner`, `narrative`, `verification`, and `verificationEvidence`. Do **not** manually write `{{taskSummaryPath}}` — the DB-backed tool is the canonical write path and renders the summary file for you.
76
89
  21. Call `gsd_complete_task` with milestoneId, sliceId, taskId, and the completion fields derived from the template. This is your final required step — do NOT manually edit PLAN.md checkboxes. The tool marks the task complete, updates the DB, renders `{{taskSummaryPath}}`, and updates PLAN.md automatically.
@@ -78,6 +78,18 @@ Apply these when decomposing and ordering slices:
78
78
  - **Ambition matches the milestone.** The number and depth of slices should match the milestone's ambition. A milestone promising "core platform with auth, data model, and primary user loop" should have enough slices to actually deliver all three as working features — not two proof-of-concept slices and a note that "the rest will come in the next milestone." If the milestone's context promises an outcome, the roadmap must deliver it.
79
79
  - **Right-size the decomposition.** Match slice count to actual complexity. If the work is small enough to build and verify in one pass, it's one slice — don't split it into three just because you can identify sub-steps. Multiple requirements can share a single slice. Conversely, don't cram genuinely independent capabilities into one slice just to keep the count low. Let the work dictate the structure.
80
80
 
81
+ ## Progressive Planning (ADR-011)
82
+
83
+ If the preference `phases.progressive_planning` is enabled and the roadmap has **2 or more slices**, you SHOULD plan S01 in full detail and S02+ as sketches. Plan S02+ full only when the slice is trivially determined (pure boilerplate that cannot meaningfully change based on what S01 ships).
84
+
85
+ A **sketch slice** has the same roadmap entry as today (title, risk, depends, demo line) plus a `sketchScope` of 2–3 sentences describing the scope boundary. Do NOT attempt to decompose it into tasks during this unit — provide a one-sentence `goal` (the tool schema requires it; keep it at the same level of detail as the roadmap demo line) and leave `successCriteria`, `proofLevel`, `integrationClosure`, `observabilityImpact` blank (or provide them if genuinely known). When the prior slice completes, a separate `refine-slice` unit will expand the sketch into a full plan using the real codebase state and the prior slice SUMMARY.
86
+
87
+ **To mark a slice as a sketch in the `gsd_plan_milestone` tool call:** set `isSketch: true` and `sketchScope: "<2-3 sentence scope>"` on that slice entry.
88
+
89
+ S01 is never a sketch — it must always be fully decomposed in this unit.
90
+
91
+ If the preference is off, ignore this section and plan every slice in full detail as you would normally.
92
+
81
93
  ## Single-Slice Fast Path
82
94
 
83
95
  If the roadmap has only one slice, also plan the slice and its tasks inline during this unit — don't leave them for a separate planning session.
@@ -44,6 +44,7 @@ Narrate your decomposition reasoning — why you're grouping work this way, what
44
44
 
45
45
  Then:
46
46
  0. If `REQUIREMENTS.md` was preloaded above, identify which Active requirements the roadmap says this slice owns or supports. These are the requirements this plan must deliver — every owned requirement needs at least one task that directly advances it, and verification must prove the requirement is met.
47
+ 0a. Call `memory_query` with keywords from the slice title and the source files listed below. Prior architectural decisions, conventions, and gotchas in this area should inform task decomposition — not be re-derived during execution.
47
48
  1. Read the templates:
48
49
  - `~/.gsd/agent/extensions/gsd/templates/plan.md`
49
50
  - `~/.gsd/agent/extensions/gsd/templates/task-plan.md`
@@ -53,6 +54,7 @@ Then:
53
54
  - For simple slices: executable commands or script assertions are fine.
54
55
  - If the project is non-trivial and has no test framework, the first task should set one up.
55
56
  - If this slice establishes a boundary contract, verification must exercise that contract.
57
+ - Planned test files must only read from or import paths that are tracked in git. Do NOT plan tests whose inputs or fixtures are paths listed in `.gitignore` (e.g. `.gsd/`, `.planning/`, `.audits/`). If the scenario seems to require such a file, plan an inline fixture or a tracked sample instead.
56
58
  4. **For non-trivial slices only** — plan observability, proof level, and integration closure:
57
59
  - Include `Observability / Diagnostics` for backend, integration, async, stateful, or UI slices where failure diagnosis matters.
58
60
  - Fill `Proof Level` and `Integration Closure` when the slice crosses runtime boundaries or has meaningful integration concerns.
@@ -0,0 +1,69 @@
1
+ You are executing GSD auto-mode.
2
+
3
+ ## UNIT: Refine Slice {{sliceId}} ("{{sliceTitle}}") — Milestone {{milestoneId}}
4
+
5
+ ## Working Directory
6
+
7
+ Your working directory is `{{workingDirectory}}`. All file reads, writes, and shell commands MUST operate relative to this directory. Do NOT `cd` to any other directory.
8
+
9
+ This unit **expands an approved sketch into a full plan**. It is not a blank-sheet planning pass — the sketch's scope is the authoritative boundary, and the prior slice's real outcomes are the authoritative context. Your job is to produce a detailed plan that fits inside the sketch while reflecting what actually shipped in earlier slices.
10
+
11
+ All relevant context has been preloaded below — start working immediately without re-reading these files.
12
+
13
+ {{inlinedContext}}
14
+
15
+ ### Dependency Slice Summaries
16
+
17
+ Pay particular attention to **Forward Intelligence** sections — they contain hard-won knowledge about what's fragile, what assumptions changed, and what this slice should watch out for. These summaries are the single most important input to refinement: the sketch was written before these slices shipped, so your plan MUST reconcile against what they actually built.
18
+
19
+ {{dependencySummaries}}
20
+
21
+ ## Your Role in the Pipeline
22
+
23
+ ### Respect the Sketch Scope
24
+
25
+ The sketch scope inlined above is a **hard constraint**. Plan within it. If, after exploring the codebase, the scope is too narrow to deliver the goal, surface this as a deviation in the plan's narrative and still produce the plan — do not silently expand the scope.
26
+
27
+ ### Reconcile Against Reality
28
+
29
+ Before decomposing:
30
+
31
+ 1. Read the prior slice SUMMARY files that were inlined above. Note any interface shifts, file-layout changes, or discovered constraints.
32
+ 2. Use `rg`, `find`, and targeted reads to confirm the current codebase state for files the sketch references. If an assumed module/type/API has moved or changed shape, your plan must reflect that.
33
+ 3. If prior slices flagged fragility or known issues relevant to this slice, fold them into task verification.
34
+
35
+ ### Source Files
36
+
37
+ {{sourceFilePaths}}
38
+
39
+ If slice research exists (inlined above), trust those findings and skip redundant exploration.
40
+
41
+ After you finish, **executor agents** implement each task in isolated fresh context windows. They see only their task plan, the slice plan excerpt, and compressed summaries of prior tasks. Everything an executor needs must be in the task plan itself — file paths, specific steps, expected inputs and outputs.
42
+
43
+ Narrate your decomposition reasoning in complete sentences. Explain what the sketch promised, what prior slices changed, and how those two inputs shape the decomposition. Keep narration proportional to the work.
44
+
45
+ **Right-size the plan.** If the slice is simple enough to be 1 task, plan 1 task. Don't fill in sections with "None" — omit them entirely.
46
+
47
+ {{executorContextConstraints}}
48
+
49
+ Then:
50
+ 0. If `REQUIREMENTS.md` was preloaded above, identify which Active requirements the sketch says this slice owns or supports. Every owned requirement needs at least one task that directly advances it.
51
+ 1. Read the templates:
52
+ - `~/.gsd/agent/extensions/gsd/templates/plan.md`
53
+ - `~/.gsd/agent/extensions/gsd/templates/task-plan.md`
54
+ 2. {{skillActivation}} Record the installed skills you expect executors to use in each task plan's `skills_used` frontmatter.
55
+ 3. Define slice-level verification — the objective stopping condition. Plan real test files with real assertions; for simple slices, executable commands are fine.
56
+ 4. For non-trivial slices, plan observability / proof level / integration closure, threat surface, and requirement impact. Omit entirely for simple slices.
57
+ 5. Decompose the slice into tasks that fit one context window each. Every task must have Why / Files / Do / Verify / Done-when, plus a task plan with description, steps, must-haves, verification, inputs (backtick-wrapped paths), and expected output (backtick-wrapped paths).
58
+ 6. **Persist planning state through `gsd_plan_slice`.** Call it with the full payload. The tool writes to the DB and renders `{{outputPath}}` and `{{slicePath}}/tasks/T##-PLAN.md` automatically. Do NOT rely on direct `PLAN.md` writes.
59
+ 7. **Self-audit the plan.** If every task were completed exactly as written, the slice goal/demo should actually be true. Every must-have maps to at least one task. Inputs and Expected Output are backtick-wrapped file paths.
60
+ 8. If refinement produced structural decisions that diverge from the sketch, append them to `.gsd/DECISIONS.md`.
61
+ 9. {{commitInstruction}}
62
+
63
+ The slice directory and tasks/ subdirectory already exist. Do NOT mkdir.
64
+
65
+ **Autonomous execution:** Do not call `ask_user_questions` or `secure_env_collect`. Document assumptions in the plan.
66
+
67
+ **You MUST call `gsd_plan_slice` to persist the planning state before finishing.** After it returns successfully, the pipeline will automatically clear the sketch flag on the next state derivation (the on-disk PLAN file is the signal).
68
+
69
+ When done, say: "Slice {{sliceId}} refined."
@@ -42,6 +42,7 @@ An honest "this is straightforward, here's the pattern to follow" is more valuab
42
42
 
43
43
  Research what this slice needs. Narrate key findings and surprises as you go — what exists, what's missing, what constrains the approach.
44
44
  0. If `REQUIREMENTS.md` was preloaded above, identify which Active requirements this slice owns or supports. Research should target these requirements — surfacing risks, unknowns, and implementation constraints that could affect whether the slice actually delivers them.
45
+ 0a. Call `memory_query` with keywords from the slice title and scope. Prior slices may have captured architecture notes, conventions, or gotchas in subsystems you're about to explore — pulling them now prevents re-discovering known constraints.
45
46
  1. {{skillActivation}} Reference specific rules from loaded skills in your findings where they inform the implementation approach.
46
47
  2. **Skill Discovery ({{skillDiscoveryMode}}):**{{skillDiscoveryInstructions}}
47
48
  3. Explore relevant code for this slice's scope. For targeted exploration, use `rg`, `find`, and reads. For broad or unfamiliar subsystems, use `scout` to map the relevant area first.
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Cross-platform Python interpreter resolver.
3
+ *
4
+ * Provides utilities to detect the available Python interpreter on the current
5
+ * system and to normalize shell commands that reference `python`/`python3` so
6
+ * that they use whichever interpreter is actually installed.
7
+ *
8
+ * On Windows the canonical names differ (`py -3`, `python`, `python3`), so
9
+ * hard-coded `python3` invocations fail with exit 127. This module detects the
10
+ * working interpreter once (cached for the process lifetime) and rewrites
11
+ * commands accordingly.
12
+ *
13
+ * @module python-resolver
14
+ */
15
+ import { spawnSync } from "node:child_process";
16
+ /** Cached result of `detectPythonExecutable`. `undefined` means not yet probed. */
17
+ let cached;
18
+ /**
19
+ * Returns the first working Python invocation on this system, or `null` if no
20
+ * Python interpreter is found.
21
+ *
22
+ * Probe order:
23
+ * - Windows: `py -3` → `python` → `python3`
24
+ * - All other platforms: `python3` → `python`
25
+ *
26
+ * The result is cached for the lifetime of the process to avoid repeated
27
+ * `spawnSync` calls.
28
+ */
29
+ export function detectPythonExecutable() {
30
+ if (cached !== undefined)
31
+ return cached;
32
+ const candidates = process.platform === "win32"
33
+ ? ["py -3", "python", "python3"]
34
+ : ["python3", "python"];
35
+ for (const candidate of candidates) {
36
+ const [bin, ...args] = candidate.split(" ");
37
+ const r = spawnSync(bin, [...args, "--version"], { stdio: "ignore" });
38
+ if (!r.error && r.status === 0) {
39
+ cached = candidate;
40
+ return candidate;
41
+ }
42
+ }
43
+ cached = null;
44
+ return null;
45
+ }
46
+ /**
47
+ * Rewrites a shell command string so that leading `python`/`python3`/`py`
48
+ * tokens at command boundaries are replaced with the interpreter returned by
49
+ * `detectPythonExecutable`.
50
+ *
51
+ * Only tokens at command boundaries (start of string, or after `&&`, `||`,
52
+ * `;`) are rewritten — mid-string occurrences (e.g. file paths containing
53
+ * "python") are left intact.
54
+ *
55
+ * When no Python interpreter is detected, the command is returned unchanged so
56
+ * that the caller receives a meaningful "command not found" error rather than a
57
+ * silent no-op.
58
+ *
59
+ * @param command - The shell command string to normalize.
60
+ * @returns The command with Python interpreter tokens rewritten, or the
61
+ * original command if no rewrite is needed.
62
+ */
63
+ export function normalizePythonCommand(command) {
64
+ const executable = detectPythonExecutable();
65
+ if (!executable)
66
+ return command;
67
+ // Split on common shell separators to handle compound commands.
68
+ // We reconstruct the string preserving the original separators.
69
+ return command.replace(/(^\s*|(?:&&|\|\||;)\s*)(?:python3?|py(?:\s+-\d+)?)(?=\s|$)/g, (_match, pre) => `${pre}${executable}`);
70
+ }
@@ -0,0 +1,75 @@
1
+ // GSD — Setup catalog (single source of truth for onboarding steps + provider sub-views)
2
+ //
3
+ // Re-exports filtered views over PROVIDER_REGISTRY (key-manager.ts) and owns the
4
+ // canonical ONBOARDING_STEPS list. Consumers (CLI wizard, /gsd setup hub,
5
+ // onboarding handler, web alignment) all read from here so adding a step or
6
+ // provider lands in one place. Keep this module thin: no behavior beyond
7
+ // filters + lookup helpers, so it stays cycle-safe even though it depends on
8
+ // key-manager for the provider catalog.
9
+ import { PROVIDER_REGISTRY } from "./key-manager.js";
10
+ /**
11
+ * Canonical ordered list of onboarding steps.
12
+ *
13
+ * To add a new step:
14
+ * 1. Append here (or insert at the right position).
15
+ * 2. Bump FLOW_VERSION in onboarding-state.ts so existing users get re-prompted.
16
+ * 3. Wire its CLI runner in src/onboarding.ts (and handlers/onboarding.ts for --step).
17
+ */
18
+ export const ONBOARDING_STEPS = [
19
+ { id: "llm", label: "LLM provider & auth", required: true, hint: "Sign in or paste an API key" },
20
+ { id: "model", label: "Default model", required: false, hint: "Pick a default model for the chosen provider" },
21
+ { id: "search", label: "Web search provider", required: false, hint: "Brave, Tavily, or Anthropic built-in" },
22
+ { id: "remote", label: "Remote questions", required: false, hint: "Discord / Slack / Telegram notifications" },
23
+ { id: "tool-keys", label: "Tool API keys", required: false, hint: "Context7, Jina, Groq voice, etc." },
24
+ { id: "prefs", label: "Global preferences", required: false, hint: "Mode, profile, notifications" },
25
+ { id: "skills", label: "Skills install", required: false, hint: "Browse and install skill plugins" },
26
+ { id: "doctor", label: "Validate setup", required: false, hint: "Run provider doctor checks" },
27
+ { id: "project", label: "Project init", required: false, hint: "Bootstrap .gsd/ in this repo" },
28
+ ];
29
+ const STEP_INDEX = new Map(ONBOARDING_STEPS.map((s, i) => [s.id, i]));
30
+ export function getStep(id) {
31
+ const idx = STEP_INDEX.get(id);
32
+ return idx === undefined ? undefined : ONBOARDING_STEPS[idx];
33
+ }
34
+ export function isValidStepId(id) {
35
+ return STEP_INDEX.has(id);
36
+ }
37
+ /**
38
+ * Given a possibly-stale resume point, return the nearest next step that is
39
+ * still defined in the catalog. Falls back to the first step.
40
+ */
41
+ export function nearestResumeStep(lastResumePoint, completedSteps) {
42
+ const completed = new Set(completedSteps);
43
+ // First incomplete step at or after the lastResumePoint
44
+ let startIdx = 0;
45
+ if (lastResumePoint && STEP_INDEX.has(lastResumePoint)) {
46
+ startIdx = STEP_INDEX.get(lastResumePoint) ?? 0;
47
+ }
48
+ for (let i = startIdx; i < ONBOARDING_STEPS.length; i++) {
49
+ if (!completed.has(ONBOARDING_STEPS[i].id))
50
+ return ONBOARDING_STEPS[i].id;
51
+ }
52
+ // Everything from the resume point is complete — try from the start
53
+ for (const step of ONBOARDING_STEPS) {
54
+ if (!completed.has(step.id))
55
+ return step.id;
56
+ }
57
+ return ONBOARDING_STEPS[0].id;
58
+ }
59
+ // ─── Provider catalog views ───────────────────────────────────────────────────
60
+ export function getLlmProviders() {
61
+ return PROVIDER_REGISTRY.filter(p => p.category === "llm");
62
+ }
63
+ export function getToolProviders() {
64
+ return PROVIDER_REGISTRY.filter(p => p.category === "tool");
65
+ }
66
+ export function getSearchProviders() {
67
+ return PROVIDER_REGISTRY.filter(p => p.category === "search");
68
+ }
69
+ export function getRemoteProviders() {
70
+ return PROVIDER_REGISTRY.filter(p => p.category === "remote");
71
+ }
72
+ /** Provider IDs that count as "the user has an LLM configured" for shouldRunOnboarding. */
73
+ export function getLlmProviderIds() {
74
+ return Array.from(new Set([...getLlmProviders().map(p => p.id), "claude-code"]));
75
+ }
@@ -13,7 +13,9 @@ import { existsSync, readdirSync, readFileSync } from 'node:fs';
13
13
  import { debugCount, debugTime } from './debug-logger.js';
14
14
  import { logWarning, logError } from './workflow-logger.js';
15
15
  import { extractVerdict } from './verdict-parser.js';
16
- import { isDbAvailable, wasDbOpenAttempted, getAllMilestones, getMilestone, getMilestoneSlices, getSliceTasks, getReplanHistory, getSlice, insertMilestone, insertSlice, insertTask, updateSliceStatus, updateTaskStatus, getPendingGateCountForTurn, } from './gsd-db.js';
16
+ import { loadEffectiveGSDPreferences } from './preferences.js';
17
+ import { detectPendingEscalation } from './escalation.js';
18
+ import { isDbAvailable, wasDbOpenAttempted, getAllMilestones, getMilestone, getMilestoneSlices, getSliceTasks, getReplanHistory, getSlice, insertMilestone, insertSlice, insertTask, updateSliceStatus, updateTaskStatus, getPendingGateCountForTurn, autoHealSketchFlags, } from './gsd-db.js';
17
19
  /**
18
20
  * A "ghost" milestone directory contains only META.json (and no substantive
19
21
  * files like CONTEXT, CONTEXT-DRAFT, ROADMAP, or SUMMARY). These appear when
@@ -499,7 +501,7 @@ async function handleAllSlicesDone(basePath, activeMilestone, registry, requirem
499
501
  const validationContent = validationFile ? await loadFile(validationFile) : null;
500
502
  const validationTerminal = validationContent ? isValidationTerminal(validationContent) : false;
501
503
  const verdict = validationContent ? extractVerdict(validationContent) : undefined;
502
- if (!validationTerminal || verdict === 'needs-remediation') {
504
+ if (!validationTerminal) {
503
505
  return {
504
506
  activeMilestone, activeSlice: null, activeTask: null,
505
507
  phase: 'validating-milestone',
@@ -509,6 +511,23 @@ async function handleAllSlicesDone(basePath, activeMilestone, registry, requirem
509
511
  progress: { milestones: milestoneProgress, slices: sliceProgress },
510
512
  };
511
513
  }
514
+ // All roadmap slices are done (enforced by caller) and verdict is
515
+ // needs-remediation — remediation cannot progress without new slices.
516
+ // Return blocked instead of re-dispatching validate-milestone (#4506).
517
+ if (verdict === 'needs-remediation') {
518
+ return {
519
+ activeMilestone, activeSlice: null, activeTask: null,
520
+ phase: 'blocked',
521
+ recentDecisions: [],
522
+ blockers: [
523
+ `Milestone ${activeMilestone.id} validation verdict is needs-remediation but all slices are complete. ` +
524
+ `Add remediation slices via gsd_reassess_roadmap or override the verdict manually.`,
525
+ ],
526
+ nextAction: `Resolve ${activeMilestone.id} remediation before proceeding.`,
527
+ registry, requirements,
528
+ progress: { milestones: milestoneProgress, slices: sliceProgress },
529
+ };
530
+ }
512
531
  return {
513
532
  activeMilestone, activeSlice: null, activeTask: null,
514
533
  phase: 'completing-milestone',
@@ -710,7 +729,13 @@ export async function deriveStateFromDb(basePath) {
710
729
  if (allSlicesDone) {
711
730
  return handleAllSlicesDone(basePath, activeMilestone, registry, requirements, milestoneProgress, sliceProgress);
712
731
  }
713
- const activeSliceContext = resolveSliceDependencies(activeMilestoneSlices);
732
+ // ADR-011 auto-heal: if a slice has a PLAN on disk but is still flagged is_sketch=1
733
+ // (e.g. a crash between plan-slice write and the sketch flip), reconcile before
734
+ // running phase derivation so the flag doesn't misroute state.
735
+ autoHealSketchFlags(activeMilestone.id, (sid) => !!resolveSliceFile(basePath, activeMilestone.id, sid, "PLAN"));
736
+ // Re-read slices after auto-heal so downstream reads see fresh is_sketch values.
737
+ const healedSlices = getMilestoneSlices(activeMilestone.id);
738
+ const activeSliceContext = resolveSliceDependencies(healedSlices);
714
739
  if (!activeSliceContext.activeSlice) {
715
740
  // If locked slice wasn't found, it returns null but logs warning, we need to return 'blocked'
716
741
  if (process.env.GSD_SLICE_LOCK) {
@@ -730,9 +755,23 @@ export async function deriveStateFromDb(basePath) {
730
755
  progress: { milestones: milestoneProgress, slices: sliceProgress },
731
756
  };
732
757
  }
733
- const { activeSlice } = activeSliceContext;
758
+ const { activeSlice, activeSliceRow } = activeSliceContext;
734
759
  const planFile = resolveSliceFile(basePath, activeMilestone.id, activeSlice.id, "PLAN");
735
760
  if (!planFile) {
761
+ // ADR-011: sketch slices with progressive_planning enabled enter the
762
+ // `refining` phase — a refine-slice unit expands the sketch into a full plan
763
+ // before execution. When the flag is off, sketches are indistinguishable
764
+ // from a missing plan and fall through to the normal `planning` phase.
765
+ const progressive = loadEffectiveGSDPreferences()?.preferences?.phases?.progressive_planning === true;
766
+ if (progressive && activeSliceRow?.is_sketch === 1) {
767
+ return {
768
+ activeMilestone, activeSlice, activeTask: null,
769
+ phase: 'refining', recentDecisions: [], blockers: [],
770
+ nextAction: `Refine sketch slice ${activeSlice.id} (${activeSlice.title}) using prior slice context.`,
771
+ registry, requirements,
772
+ progress: { milestones: milestoneProgress, slices: sliceProgress },
773
+ };
774
+ }
736
775
  return {
737
776
  activeMilestone, activeSlice, activeTask: null,
738
777
  phase: 'planning', recentDecisions: [], blockers: [],
@@ -811,6 +850,28 @@ export async function deriveStateFromDb(basePath) {
811
850
  };
812
851
  }
813
852
  }
853
+ // ADR-011 Phase 2: pause-on-escalation takes precedence over dispatching the
854
+ // next task. `awaiting_review` tasks (continueWithDefault=true) are NOT
855
+ // surfaced here — they let the loop continue.
856
+ //
857
+ // We do NOT gate this on `phases.mid_execution_escalation` — creation of
858
+ // new escalations is gated at the write site (tools/complete-task.ts:315),
859
+ // but any escalation_pending row already persisted in the DB must be
860
+ // honored even if the user later toggles the flag off. Otherwise those
861
+ // rows would silently orphan, the loop would advance past the paused task,
862
+ // and the user's prior resolution never lands.
863
+ const escalatingTaskId = detectPendingEscalation(tasks, basePath);
864
+ if (escalatingTaskId) {
865
+ return {
866
+ activeMilestone, activeSlice, activeTask,
867
+ phase: 'escalating-task', recentDecisions: [],
868
+ blockers: [`Task ${escalatingTaskId} requires a user decision before the loop can proceed`],
869
+ nextAction: `Run /gsd escalate show ${escalatingTaskId} to review, then /gsd escalate resolve ${escalatingTaskId} <choice> to proceed.`,
870
+ activeWorkspace: undefined,
871
+ registry, requirements,
872
+ progress: { milestones: milestoneProgress, slices: sliceProgress, tasks: taskProgress },
873
+ };
874
+ }
814
875
  if (!blockerTaskId) {
815
876
  const isTriggered = checkReplanTrigger(basePath, activeMilestone.id, activeSlice.id);
816
877
  if (isTriggered) {
@@ -1234,9 +1295,11 @@ export async function _deriveStateImpl(basePath) {
1234
1295
  done: activeRoadmap.slices.length,
1235
1296
  total: activeRoadmap.slices.length,
1236
1297
  };
1237
- // Force re-validation when verdict is needs-remediation — remediation slices
1238
- // may have completed since the stale validation was written (#3596).
1239
- if (!validationTerminal || verdict === 'needs-remediation') {
1298
+ // Force re-validation when VALIDATION.md is absent or non-terminal —
1299
+ // remediation slices may have completed since the stale validation was
1300
+ // written (#3596). But needs-remediation with all slices done is a dead
1301
+ // end — return blocked to avoid an infinite dispatch loop (#4506).
1302
+ if (!validationTerminal) {
1240
1303
  return {
1241
1304
  activeMilestone,
1242
1305
  activeSlice: null,
@@ -1253,6 +1316,26 @@ export async function _deriveStateImpl(basePath) {
1253
1316
  },
1254
1317
  };
1255
1318
  }
1319
+ if (verdict === 'needs-remediation') {
1320
+ return {
1321
+ activeMilestone,
1322
+ activeSlice: null,
1323
+ activeTask: null,
1324
+ phase: 'blocked',
1325
+ recentDecisions: [],
1326
+ blockers: [
1327
+ `Milestone ${activeMilestone.id} validation verdict is needs-remediation but all slices are complete. ` +
1328
+ `Add remediation slices via gsd_reassess_roadmap or override the verdict manually.`,
1329
+ ],
1330
+ nextAction: `Resolve ${activeMilestone.id} remediation before proceeding.`,
1331
+ registry,
1332
+ requirements,
1333
+ progress: {
1334
+ milestones: milestoneProgress,
1335
+ slices: sliceProgress,
1336
+ },
1337
+ };
1338
+ }
1256
1339
  return {
1257
1340
  activeMilestone,
1258
1341
  activeSlice: null,
@@ -51,7 +51,7 @@ uok:
51
51
  enabled: true
52
52
  gitops:
53
53
  enabled: true
54
- turn_action: status-only
54
+ turn_action: commit
55
55
  turn_push: false
56
56
  audit_unified:
57
57
  enabled: true
@@ -20,6 +20,8 @@ import { renderAllProjections, renderSummaryContent } from "../workflow-projecti
20
20
  import { writeManifest } from "../workflow-manifest.js";
21
21
  import { appendEvent } from "../workflow-events.js";
22
22
  import { logWarning, logError } from "../workflow-logger.js";
23
+ import { loadEffectiveGSDPreferences } from "../preferences.js";
24
+ import { buildEscalationArtifact, writeEscalationArtifact } from "../escalation.js";
23
25
  /**
24
26
  * Map an execute-task-owned gate id to the CompleteTaskParams field whose
25
27
  * presence drives `pass` vs. `omitted`. Keep in lockstep with the gates
@@ -80,6 +82,11 @@ function paramsToTaskRow(params, completedAt) {
80
82
  observability_impact: "",
81
83
  full_plan_md: "",
82
84
  sequence: 0,
85
+ blocker_source: "",
86
+ escalation_pending: 0,
87
+ escalation_awaiting_review: 0,
88
+ escalation_artifact_path: null,
89
+ escalation_override_applied_at: null,
83
90
  };
84
91
  }
85
92
  /**
@@ -111,6 +118,39 @@ export async function handleCompleteTask(params, basePath) {
111
118
  // ── Guards + DB writes inside a single transaction (prevents TOCTOU) ───
112
119
  const completedAt = new Date().toISOString();
113
120
  let guardError = null;
121
+ // ── ADR-011 Phase 2: validate escalation payload BEFORE any side effects ─
122
+ // Building the artifact runs the full shape validation (2-4 options, unique
123
+ // ids, recommendation references a real id). If the payload is malformed
124
+ // we must reject the call before marking the task complete, writing
125
+ // SUMMARY.md, flipping the plan checkbox, or closing execute-task gates —
126
+ // otherwise a rejected payload would leave the task marked complete with
127
+ // no escalation recorded, and the loop would silently advance past it.
128
+ // The filesystem write happens later (after side effects) because that's
129
+ // the cheapest ordering and validation is where 99% of failures live.
130
+ let validatedEscalationArtifact = null;
131
+ let escalationWriteEnabled = false;
132
+ if (params.escalation) {
133
+ escalationWriteEnabled = loadEffectiveGSDPreferences()?.preferences?.phases?.mid_execution_escalation === true;
134
+ if (escalationWriteEnabled) {
135
+ try {
136
+ validatedEscalationArtifact = buildEscalationArtifact({
137
+ taskId: params.taskId,
138
+ sliceId: params.sliceId,
139
+ milestoneId: params.milestoneId,
140
+ question: params.escalation.question,
141
+ options: params.escalation.options,
142
+ recommendation: params.escalation.recommendation,
143
+ recommendationRationale: params.escalation.recommendationRationale,
144
+ continueWithDefault: params.escalation.continueWithDefault,
145
+ });
146
+ }
147
+ catch (validationErr) {
148
+ return {
149
+ error: `complete-task escalation payload invalid for ${params.milestoneId}/${params.sliceId}/${params.taskId}: ${validationErr.message}`,
150
+ };
151
+ }
152
+ }
153
+ }
114
154
  transaction(() => {
115
155
  // State machine preconditions (inside txn for atomicity).
116
156
  // Milestone/slice not existing is OK — insertMilestone/insertSlice below will auto-create.
@@ -239,6 +279,46 @@ export async function handleCompleteTask(params, basePath) {
239
279
  catch (gateErr) {
240
280
  logWarning("tool", `complete-task gate close warning for ${params.milestoneId}/${params.sliceId}/${params.taskId}: ${gateErr.message}`);
241
281
  }
282
+ // ── ADR-011 Phase 2: write escalation artifact (opt-in) ────────────────
283
+ // Validation already happened BEFORE side effects — this block only
284
+ // performs the disk write for a pre-validated artifact. For
285
+ // continueWithDefault=false, a write failure here would otherwise leave
286
+ // the task marked complete with SUMMARY.md + closed gates but no
287
+ // escalation, which silently advances the loop past a pause the user
288
+ // asked for. We compensate by reverting the DB-level completion: set
289
+ // status back to 'pending' and delete the verification_evidence rows
290
+ // (same shape as the disk-render-failure rollback above). SUMMARY.md
291
+ // on disk is left in place because the next complete-task retry will
292
+ // overwrite it; gate rows are UPSERT-keyed per task and will also be
293
+ // overwritten. This restores the invariant that deriveState() sees a
294
+ // consistent "task not done" view so the loop re-dispatches the task.
295
+ if (validatedEscalationArtifact) {
296
+ try {
297
+ writeEscalationArtifact(basePath, validatedEscalationArtifact);
298
+ }
299
+ catch (escalationErr) {
300
+ const msg = `complete-task escalation write failed for ${params.milestoneId}/${params.sliceId}/${params.taskId}: ${escalationErr.message}`;
301
+ logWarning("tool", msg);
302
+ if (validatedEscalationArtifact.continueWithDefault === false) {
303
+ // Compensating rollback: revert DB completion so the loop pauses on
304
+ // re-dispatch instead of silently advancing. Mirror the existing
305
+ // renderErr rollback (line ~261).
306
+ try {
307
+ deleteVerificationEvidence(params.milestoneId, params.sliceId, params.taskId);
308
+ updateTaskStatus(params.milestoneId, params.sliceId, params.taskId, 'pending');
309
+ invalidateStateCache();
310
+ logWarning("tool", `complete-task rolled back DB completion for ${params.milestoneId}/${params.sliceId}/${params.taskId} after escalation write failure; SUMMARY.md left on disk for retry.`);
311
+ }
312
+ catch (rollbackErr) {
313
+ logWarning("tool", `complete-task rollback failed after escalation write failure for ${params.milestoneId}/${params.sliceId}/${params.taskId}: ${rollbackErr.message}`);
314
+ }
315
+ return { error: msg };
316
+ }
317
+ }
318
+ }
319
+ else if (params.escalation && !escalationWriteEnabled) {
320
+ logWarning("tool", `complete-task received escalation payload but phases.mid_execution_escalation is not enabled; ignoring (${params.milestoneId}/${params.sliceId}/${params.taskId})`);
321
+ }
242
322
  // Invalidate all caches
243
323
  invalidateStateCache();
244
324
  clearPathCache();