gsd-pi 2.79.0-dev.ece5fd8ba → 2.80.0-dev.4ea7d80e7

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 (681) hide show
  1. package/dist/resources/.managed-resources-content-hash +1 -1
  2. package/dist/resources/extensions/github-sync/templates.js +90 -74
  3. package/dist/resources/extensions/gsd/auto/contracts.js +1 -0
  4. package/dist/resources/extensions/gsd/auto/custom-verify-retry-store.js +53 -0
  5. package/dist/resources/extensions/gsd/auto/loop.js +365 -522
  6. package/dist/resources/extensions/gsd/auto/orchestrator.js +146 -0
  7. package/dist/resources/extensions/gsd/auto/phases.js +55 -6
  8. package/dist/resources/extensions/gsd/auto/run-unit.js +19 -15
  9. package/dist/resources/extensions/gsd/auto/session.js +8 -0
  10. package/dist/resources/extensions/gsd/auto/workflow-custom-engine-dispatch-outcome.js +12 -0
  11. package/dist/resources/extensions/gsd/auto/workflow-custom-engine-iteration.js +24 -0
  12. package/dist/resources/extensions/gsd/auto/workflow-custom-engine-reconcile-outcome.js +33 -0
  13. package/dist/resources/extensions/gsd/auto/workflow-custom-engine-reconcile.js +26 -0
  14. package/dist/resources/extensions/gsd/auto/workflow-custom-engine-retry.js +49 -0
  15. package/dist/resources/extensions/gsd/auto/workflow-custom-engine-verify-outcome.js +25 -0
  16. package/dist/resources/extensions/gsd/auto/workflow-dispatch-claim.js +48 -0
  17. package/dist/resources/extensions/gsd/auto/workflow-dispatch-ledger.js +26 -0
  18. package/dist/resources/extensions/gsd/auto/workflow-iteration-completion.js +10 -0
  19. package/dist/resources/extensions/gsd/auto/workflow-journal-reporter.js +16 -0
  20. package/dist/resources/extensions/gsd/auto/workflow-kernel.js +263 -0
  21. package/dist/resources/extensions/gsd/auto/workflow-memory-pressure.js +36 -0
  22. package/dist/resources/extensions/gsd/auto/workflow-phase-reporter.js +9 -0
  23. package/dist/resources/extensions/gsd/auto/workflow-session-lock.js +35 -0
  24. package/dist/resources/extensions/gsd/auto/workflow-sidecar-iteration.js +24 -0
  25. package/dist/resources/extensions/gsd/auto/workflow-sidecar-queue.js +26 -0
  26. package/dist/resources/extensions/gsd/auto/workflow-turn-reporter.js +36 -0
  27. package/dist/resources/extensions/gsd/auto/workflow-unit-dispatch.js +44 -0
  28. package/dist/resources/extensions/gsd/auto/workflow-worker-heartbeat.js +15 -0
  29. package/dist/resources/extensions/gsd/auto-dashboard.js +54 -15
  30. package/dist/resources/extensions/gsd/auto-dispatch.js +10 -0
  31. package/dist/resources/extensions/gsd/auto-prompts.js +168 -3
  32. package/dist/resources/extensions/gsd/auto-recovery.js +198 -59
  33. package/dist/resources/extensions/gsd/auto-runtime-state.js +4 -0
  34. package/dist/resources/extensions/gsd/auto-start.js +2 -3
  35. package/dist/resources/extensions/gsd/auto-verification.js +2 -11
  36. package/dist/resources/extensions/gsd/auto-worktree.js +87 -38
  37. package/dist/resources/extensions/gsd/auto.js +168 -3
  38. package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +24 -2
  39. package/dist/resources/extensions/gsd/bootstrap/db-tools.js +10 -0
  40. package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +22 -6
  41. package/dist/resources/extensions/gsd/bootstrap/write-gate.js +129 -1
  42. package/dist/resources/extensions/gsd/commands-extract-learnings.js +17 -12
  43. package/dist/resources/extensions/gsd/commands-ship.js +23 -46
  44. package/dist/resources/extensions/gsd/commands-workflow-templates.js +12 -7
  45. package/dist/resources/extensions/gsd/component-loader.js +5 -11
  46. package/dist/resources/extensions/gsd/custom-workflow-engine.js +25 -1
  47. package/dist/resources/extensions/gsd/db-adapter.js +47 -0
  48. package/dist/resources/extensions/gsd/db-base-schema.js +351 -0
  49. package/dist/resources/extensions/gsd/db-connection-cache.js +31 -0
  50. package/dist/resources/extensions/gsd/db-coordination-schema.js +104 -0
  51. package/dist/resources/extensions/gsd/db-decision-requirement-rows.js +71 -0
  52. package/dist/resources/extensions/gsd/db-gate-rows.js +16 -0
  53. package/dist/resources/extensions/gsd/db-lightweight-query-rows.js +29 -0
  54. package/dist/resources/extensions/gsd/db-memory-fts-schema.js +56 -0
  55. package/dist/resources/extensions/gsd/db-migration-backup.js +22 -0
  56. package/dist/resources/extensions/gsd/db-migration-steps.js +410 -0
  57. package/dist/resources/extensions/gsd/db-milestone-artifact-rows.js +35 -0
  58. package/dist/resources/extensions/gsd/db-open-state.js +32 -0
  59. package/dist/resources/extensions/gsd/db-provider.js +108 -0
  60. package/dist/resources/extensions/gsd/db-runtime-kv-schema.js +27 -0
  61. package/dist/resources/extensions/gsd/db-schema-metadata.js +23 -0
  62. package/dist/resources/extensions/gsd/db-task-slice-rows.js +86 -0
  63. package/dist/resources/extensions/gsd/db-transaction.js +63 -0
  64. package/dist/resources/extensions/gsd/db-verification-evidence-rows.js +3 -0
  65. package/dist/resources/extensions/gsd/db-verification-evidence-schema.js +19 -0
  66. package/dist/resources/extensions/gsd/escalation.js +2 -0
  67. package/dist/resources/extensions/gsd/graph.js +9 -3
  68. package/dist/resources/extensions/gsd/gsd-db.js +316 -1520
  69. package/dist/resources/extensions/gsd/guided-flow.js +2 -2
  70. package/dist/resources/extensions/gsd/legacy-telemetry.js +70 -0
  71. package/dist/resources/extensions/gsd/markdown-renderer.js +2 -0
  72. package/dist/resources/extensions/gsd/model-router.js +9 -6
  73. package/dist/resources/extensions/gsd/notification-widget.js +21 -3
  74. package/dist/resources/extensions/gsd/post-execution-checks.js +27 -6
  75. package/dist/resources/extensions/gsd/pr-evidence.js +117 -0
  76. package/dist/resources/extensions/gsd/pre-execution-checks.js +2 -0
  77. package/dist/resources/extensions/gsd/process-task-path.js +61 -0
  78. package/dist/resources/extensions/gsd/prompt-loader.js +9 -5
  79. package/dist/resources/extensions/gsd/prompts/complete-milestone.md +32 -30
  80. package/dist/resources/extensions/gsd/prompts/complete-slice.md +23 -34
  81. package/dist/resources/extensions/gsd/prompts/discuss-headless.md +50 -96
  82. package/dist/resources/extensions/gsd/prompts/discuss.md +81 -181
  83. package/dist/resources/extensions/gsd/prompts/execute-task.md +40 -67
  84. package/dist/resources/extensions/gsd/prompts/forensics.md +41 -84
  85. package/dist/resources/extensions/gsd/prompts/guided-discuss-milestone.md +29 -39
  86. package/dist/resources/extensions/gsd/prompts/guided-discuss-project.md +30 -65
  87. package/dist/resources/extensions/gsd/prompts/guided-discuss-requirements.md +25 -52
  88. package/dist/resources/extensions/gsd/prompts/guided-discuss-slice.md +36 -36
  89. package/dist/resources/extensions/gsd/prompts/guided-research-project.md +20 -38
  90. package/dist/resources/extensions/gsd/prompts/plan-milestone.md +45 -59
  91. package/dist/resources/extensions/gsd/prompts/plan-slice.md +25 -87
  92. package/dist/resources/extensions/gsd/prompts/queue.md +46 -53
  93. package/dist/resources/extensions/gsd/prompts/refine-slice.md +23 -23
  94. package/dist/resources/extensions/gsd/prompts/research-slice.md +23 -23
  95. package/dist/resources/extensions/gsd/prompts/rethink.md +10 -10
  96. package/dist/resources/extensions/gsd/prompts/system.md +65 -107
  97. package/dist/resources/extensions/gsd/prompts/triage-captures.md +15 -15
  98. package/dist/resources/extensions/gsd/prompts/validate-milestone.md +24 -24
  99. package/dist/resources/extensions/gsd/prompts/worktree-merge.md +35 -35
  100. package/dist/resources/extensions/gsd/state.js +4 -0
  101. package/dist/resources/extensions/gsd/tools/complete-milestone.js +14 -9
  102. package/dist/resources/extensions/gsd/tools/complete-task.js +2 -0
  103. package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +6 -1
  104. package/dist/resources/extensions/gsd/unit-context-composer.js +1 -1
  105. package/dist/resources/extensions/gsd/uok/kernel.js +8 -3
  106. package/dist/resources/extensions/gsd/uok/plan-v2.js +2 -0
  107. package/dist/resources/extensions/gsd/workflow-logger.js +13 -13
  108. package/dist/resources/extensions/gsd/workflow-manifest.js +2 -0
  109. package/dist/resources/extensions/gsd/workflow-projections.js +2 -0
  110. package/dist/resources/extensions/gsd/workflow-templates.js +9 -0
  111. package/dist/resources/extensions/gsd/working-output-messages.js +64 -0
  112. package/dist/resources/extensions/shared/interview-ui.js +15 -4
  113. package/dist/tsconfig.extensions.tsbuildinfo +1 -1
  114. package/dist/web/standalone/.next/BUILD_ID +1 -1
  115. package/dist/web/standalone/.next/app-path-routes-manifest.json +14 -14
  116. package/dist/web/standalone/.next/build-manifest.json +3 -3
  117. package/dist/web/standalone/.next/prerender-manifest.json +3 -3
  118. package/dist/web/standalone/.next/react-loadable-manifest.json +1 -1
  119. package/dist/web/standalone/.next/required-server-files.json +1 -1
  120. package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
  121. package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
  122. package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  123. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  124. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  125. package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  126. package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  127. package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  128. package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
  129. package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
  130. package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  131. package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  132. package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  133. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  134. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  135. package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  136. package/dist/web/standalone/.next/server/app/api/boot/route.js +1 -1
  137. package/dist/web/standalone/.next/server/app/api/boot/route.js.nft.json +1 -1
  138. package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js +1 -1
  139. package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js.nft.json +1 -1
  140. package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js +1 -1
  141. package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js.nft.json +1 -1
  142. package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js +1 -1
  143. package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js.nft.json +1 -1
  144. package/dist/web/standalone/.next/server/app/api/captures/route.js +1 -1
  145. package/dist/web/standalone/.next/server/app/api/captures/route.js.nft.json +1 -1
  146. package/dist/web/standalone/.next/server/app/api/cleanup/route.js +1 -1
  147. package/dist/web/standalone/.next/server/app/api/cleanup/route.js.nft.json +1 -1
  148. package/dist/web/standalone/.next/server/app/api/doctor/route.js +1 -1
  149. package/dist/web/standalone/.next/server/app/api/doctor/route.js.nft.json +1 -1
  150. package/dist/web/standalone/.next/server/app/api/export-data/route.js +1 -1
  151. package/dist/web/standalone/.next/server/app/api/export-data/route.js.nft.json +1 -1
  152. package/dist/web/standalone/.next/server/app/api/files/route.js +1 -1
  153. package/dist/web/standalone/.next/server/app/api/files/route.js.nft.json +1 -1
  154. package/dist/web/standalone/.next/server/app/api/forensics/route.js +1 -1
  155. package/dist/web/standalone/.next/server/app/api/forensics/route.js.nft.json +1 -1
  156. package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
  157. package/dist/web/standalone/.next/server/app/api/git/route.js.nft.json +1 -1
  158. package/dist/web/standalone/.next/server/app/api/history/route.js +1 -1
  159. package/dist/web/standalone/.next/server/app/api/history/route.js.nft.json +1 -1
  160. package/dist/web/standalone/.next/server/app/api/hooks/route.js +1 -1
  161. package/dist/web/standalone/.next/server/app/api/hooks/route.js.nft.json +1 -1
  162. package/dist/web/standalone/.next/server/app/api/inspect/route.js +1 -1
  163. package/dist/web/standalone/.next/server/app/api/inspect/route.js.nft.json +1 -1
  164. package/dist/web/standalone/.next/server/app/api/knowledge/route.js +1 -1
  165. package/dist/web/standalone/.next/server/app/api/knowledge/route.js.nft.json +1 -1
  166. package/dist/web/standalone/.next/server/app/api/live-state/route.js +1 -1
  167. package/dist/web/standalone/.next/server/app/api/live-state/route.js.nft.json +1 -1
  168. package/dist/web/standalone/.next/server/app/api/notifications/route.js +1 -1
  169. package/dist/web/standalone/.next/server/app/api/notifications/route.js.nft.json +1 -1
  170. package/dist/web/standalone/.next/server/app/api/onboarding/route.js +1 -1
  171. package/dist/web/standalone/.next/server/app/api/onboarding/route.js.nft.json +1 -1
  172. package/dist/web/standalone/.next/server/app/api/projects/route.js +1 -1
  173. package/dist/web/standalone/.next/server/app/api/projects/route.js.nft.json +1 -1
  174. package/dist/web/standalone/.next/server/app/api/recovery/route.js +1 -1
  175. package/dist/web/standalone/.next/server/app/api/recovery/route.js.nft.json +1 -1
  176. package/dist/web/standalone/.next/server/app/api/session/browser/route.js +1 -1
  177. package/dist/web/standalone/.next/server/app/api/session/browser/route.js.nft.json +1 -1
  178. package/dist/web/standalone/.next/server/app/api/session/command/route.js +1 -1
  179. package/dist/web/standalone/.next/server/app/api/session/command/route.js.nft.json +1 -1
  180. package/dist/web/standalone/.next/server/app/api/session/events/route.js +1 -1
  181. package/dist/web/standalone/.next/server/app/api/session/events/route.js.nft.json +1 -1
  182. package/dist/web/standalone/.next/server/app/api/session/manage/route.js +1 -1
  183. package/dist/web/standalone/.next/server/app/api/session/manage/route.js.nft.json +1 -1
  184. package/dist/web/standalone/.next/server/app/api/settings-data/route.js +1 -1
  185. package/dist/web/standalone/.next/server/app/api/settings-data/route.js.nft.json +1 -1
  186. package/dist/web/standalone/.next/server/app/api/skill-health/route.js +1 -1
  187. package/dist/web/standalone/.next/server/app/api/skill-health/route.js.nft.json +1 -1
  188. package/dist/web/standalone/.next/server/app/api/steer/route.js +1 -1
  189. package/dist/web/standalone/.next/server/app/api/steer/route.js.nft.json +1 -1
  190. package/dist/web/standalone/.next/server/app/api/switch-root/route.js +1 -1
  191. package/dist/web/standalone/.next/server/app/api/switch-root/route.js.nft.json +1 -1
  192. package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js +1 -1
  193. package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js.nft.json +1 -1
  194. package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js +1 -1
  195. package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js.nft.json +1 -1
  196. package/dist/web/standalone/.next/server/app/api/undo/route.js +1 -1
  197. package/dist/web/standalone/.next/server/app/api/undo/route.js.nft.json +1 -1
  198. package/dist/web/standalone/.next/server/app/api/visualizer/route.js +1 -1
  199. package/dist/web/standalone/.next/server/app/api/visualizer/route.js.nft.json +1 -1
  200. package/dist/web/standalone/.next/server/app/index.html +1 -1
  201. package/dist/web/standalone/.next/server/app/index.rsc +1 -1
  202. package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  203. package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
  204. package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  205. package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
  206. package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  207. package/dist/web/standalone/.next/server/app-paths-manifest.json +14 -14
  208. package/dist/web/standalone/.next/server/chunks/167.js +2 -0
  209. package/dist/web/standalone/.next/server/chunks/6897.js +3 -3
  210. package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
  211. package/dist/web/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
  212. package/dist/web/standalone/.next/server/pages/404.html +1 -1
  213. package/dist/web/standalone/.next/server/pages/500.html +1 -1
  214. package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
  215. package/dist/web/standalone/.next/static/chunks/{8336.6f6f30e410419aff.js → 8336.631939fb583761fa.js} +1 -1
  216. package/dist/web/standalone/.next/static/chunks/{webpack-d82dbee6356c1733.js → webpack-0481f1221120a7c6.js} +1 -1
  217. package/dist/web/standalone/package.json +1 -0
  218. package/dist/web/standalone/server.js +1 -1
  219. package/package.json +18 -7
  220. package/packages/contracts/dist/index.d.ts +3 -0
  221. package/packages/contracts/dist/index.d.ts.map +1 -0
  222. package/packages/contracts/dist/index.js +5 -0
  223. package/packages/contracts/dist/index.js.map +1 -0
  224. package/packages/contracts/dist/rpc.d.ts +549 -0
  225. package/packages/contracts/dist/rpc.d.ts.map +1 -0
  226. package/packages/contracts/dist/rpc.js +53 -0
  227. package/packages/contracts/dist/rpc.js.map +1 -0
  228. package/packages/contracts/dist/rpc.test.d.ts +2 -0
  229. package/packages/contracts/dist/rpc.test.d.ts.map +1 -0
  230. package/packages/contracts/dist/rpc.test.js +47 -0
  231. package/packages/contracts/dist/rpc.test.js.map +1 -0
  232. package/packages/contracts/dist/workflow.d.ts +180 -0
  233. package/packages/contracts/dist/workflow.d.ts.map +1 -0
  234. package/packages/contracts/dist/workflow.js +201 -0
  235. package/packages/contracts/dist/workflow.js.map +1 -0
  236. package/packages/contracts/package.json +39 -0
  237. package/packages/contracts/src/index.ts +5 -0
  238. package/packages/contracts/src/rpc.test.ts +72 -0
  239. package/packages/contracts/src/rpc.ts +286 -0
  240. package/packages/contracts/src/workflow.ts +213 -0
  241. package/packages/contracts/tsconfig.json +25 -0
  242. package/packages/daemon/package.json +3 -2
  243. package/packages/daemon/src/event-bridge.test.ts +2 -1
  244. package/packages/daemon/src/event-bridge.ts +1 -1
  245. package/packages/daemon/src/event-formatter.test.ts +1 -2
  246. package/packages/daemon/src/event-formatter.ts +1 -2
  247. package/packages/daemon/src/session-manager.ts +2 -2
  248. package/packages/daemon/src/types.ts +3 -18
  249. package/packages/mcp-server/dist/server.d.ts +13 -0
  250. package/packages/mcp-server/dist/server.d.ts.map +1 -1
  251. package/packages/mcp-server/dist/server.js +77 -0
  252. package/packages/mcp-server/dist/server.js.map +1 -1
  253. package/packages/mcp-server/dist/session-manager.js +1 -1
  254. package/packages/mcp-server/dist/session-manager.js.map +1 -1
  255. package/packages/mcp-server/dist/types.d.ts +3 -11
  256. package/packages/mcp-server/dist/types.d.ts.map +1 -1
  257. package/packages/mcp-server/dist/types.js.map +1 -1
  258. package/packages/mcp-server/dist/workflow-tools.d.ts +1 -1
  259. package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
  260. package/packages/mcp-server/dist/workflow-tools.js +2 -40
  261. package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
  262. package/packages/mcp-server/package.json +3 -2
  263. package/packages/mcp-server/src/mcp-server.test.ts +138 -0
  264. package/packages/mcp-server/src/server.ts +99 -1
  265. package/packages/mcp-server/src/session-manager.ts +2 -2
  266. package/packages/mcp-server/src/types.ts +7 -18
  267. package/packages/mcp-server/src/workflow-tools.ts +2 -40
  268. package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
  269. package/packages/native/package.json +1 -1
  270. package/packages/pi-agent-core/package.json +1 -1
  271. package/packages/pi-ai/dist/models/fake-model.d.ts +12 -0
  272. package/packages/pi-ai/dist/models/fake-model.d.ts.map +1 -0
  273. package/packages/pi-ai/dist/models/fake-model.js +27 -0
  274. package/packages/pi-ai/dist/models/fake-model.js.map +1 -0
  275. package/packages/pi-ai/dist/models/index.d.ts.map +1 -1
  276. package/packages/pi-ai/dist/models/index.js +8 -0
  277. package/packages/pi-ai/dist/models/index.js.map +1 -1
  278. package/packages/pi-ai/dist/providers/fake.d.ts +42 -0
  279. package/packages/pi-ai/dist/providers/fake.d.ts.map +1 -0
  280. package/packages/pi-ai/dist/providers/fake.js +319 -0
  281. package/packages/pi-ai/dist/providers/fake.js.map +1 -0
  282. package/packages/pi-ai/dist/providers/register-builtins.d.ts.map +1 -1
  283. package/packages/pi-ai/dist/providers/register-builtins.js +24 -0
  284. package/packages/pi-ai/dist/providers/register-builtins.js.map +1 -1
  285. package/packages/pi-ai/package.json +1 -1
  286. package/packages/pi-ai/src/models/fake-model.ts +30 -0
  287. package/packages/pi-ai/src/models/index.ts +9 -0
  288. package/packages/pi-ai/src/providers/fake.ts +376 -0
  289. package/packages/pi-ai/src/providers/register-builtins.ts +23 -0
  290. package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
  291. package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js +74 -0
  292. package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js.map +1 -1
  293. package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts +2 -0
  294. package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
  295. package/packages/pi-coding-agent/dist/core/extensions/runner.js +14 -1
  296. package/packages/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
  297. package/packages/pi-coding-agent/dist/core/extensions/runner.test.js +97 -0
  298. package/packages/pi-coding-agent/dist/core/extensions/runner.test.js.map +1 -1
  299. package/packages/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -1
  300. package/packages/pi-coding-agent/dist/core/model-registry.js +5 -0
  301. package/packages/pi-coding-agent/dist/core/model-registry.js.map +1 -1
  302. package/packages/pi-coding-agent/dist/core/settings-manager.d.ts +4 -0
  303. package/packages/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
  304. package/packages/pi-coding-agent/dist/core/settings-manager.js +8 -0
  305. package/packages/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
  306. package/packages/pi-coding-agent/dist/core/slash-commands.d.ts.map +1 -1
  307. package/packages/pi-coding-agent/dist/core/slash-commands.js +1 -0
  308. package/packages/pi-coding-agent/dist/core/slash-commands.js.map +1 -1
  309. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/chat-frame-compaction-tone.test.js +6 -4
  310. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/chat-frame-compaction-tone.test.js.map +1 -1
  311. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js +67 -14
  312. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js.map +1 -1
  313. package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.d.ts +26 -0
  314. package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.d.ts.map +1 -0
  315. package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.js +112 -0
  316. package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.js.map +1 -0
  317. package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.test.d.ts +2 -0
  318. package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.test.d.ts.map +1 -0
  319. package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.test.js +51 -0
  320. package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.test.js.map +1 -0
  321. package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  322. package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js.map +1 -1
  323. package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.d.ts.map +1 -1
  324. package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js +10 -9
  325. package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js.map +1 -1
  326. package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.d.ts +3 -0
  327. package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  328. package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.js +11 -0
  329. package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.js.map +1 -1
  330. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.js +27 -6
  331. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.js.map +1 -1
  332. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts +16 -0
  333. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  334. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +112 -18
  335. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
  336. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
  337. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +60 -1
  338. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
  339. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.test.js +40 -1
  340. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.test.js.map +1 -1
  341. package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.test.js +1 -0
  342. package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.test.js.map +1 -1
  343. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.d.ts +1 -0
  344. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.d.ts.map +1 -1
  345. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.js.map +1 -1
  346. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +12 -1
  347. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  348. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +54 -10
  349. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
  350. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.d.ts.map +1 -1
  351. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.js +20 -0
  352. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.js.map +1 -1
  353. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.test.d.ts +2 -0
  354. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.test.d.ts.map +1 -0
  355. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.test.js +79 -0
  356. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.test.js.map +1 -0
  357. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.d.ts +12 -0
  358. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -1
  359. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.js +13 -0
  360. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.js.map +1 -1
  361. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts +1 -1
  362. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  363. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js +18 -1
  364. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js.map +1 -1
  365. package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.d.ts.map +1 -1
  366. package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js +36 -27
  367. package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js.map +1 -1
  368. package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.d.ts +11 -0
  369. package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.d.ts.map +1 -0
  370. package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.js +18 -0
  371. package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.js.map +1 -0
  372. package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.test.d.ts +2 -0
  373. package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.test.d.ts.map +1 -0
  374. package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.test.js +48 -0
  375. package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.test.js.map +1 -0
  376. package/packages/pi-coding-agent/dist/modes/rpc/rpc-types.d.ts +1 -512
  377. package/packages/pi-coding-agent/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  378. package/packages/pi-coding-agent/dist/modes/rpc/rpc-types.js +3 -7
  379. package/packages/pi-coding-agent/dist/modes/rpc/rpc-types.js.map +1 -1
  380. package/packages/pi-coding-agent/package.json +2 -1
  381. package/packages/pi-coding-agent/src/core/chat-controller-ordering.test.ts +87 -0
  382. package/packages/pi-coding-agent/src/core/extensions/runner.test.ts +108 -0
  383. package/packages/pi-coding-agent/src/core/extensions/runner.ts +16 -1
  384. package/packages/pi-coding-agent/src/core/model-registry.ts +4 -0
  385. package/packages/pi-coding-agent/src/core/settings-manager.ts +12 -0
  386. package/packages/pi-coding-agent/src/core/slash-commands.ts +1 -0
  387. package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/chat-frame-compaction-tone.test.ts +7 -5
  388. package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/tool-execution.test.ts +100 -16
  389. package/packages/pi-coding-agent/src/modes/interactive/components/adaptive-layout.test.ts +59 -0
  390. package/packages/pi-coding-agent/src/modes/interactive/components/adaptive-layout.ts +160 -0
  391. package/packages/pi-coding-agent/src/modes/interactive/components/assistant-message.ts +1 -0
  392. package/packages/pi-coding-agent/src/modes/interactive/components/chat-frame.ts +10 -9
  393. package/packages/pi-coding-agent/src/modes/interactive/components/settings-selector.ts +15 -0
  394. package/packages/pi-coding-agent/src/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.ts +41 -9
  395. package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +124 -18
  396. package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.test.ts +43 -1
  397. package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +75 -1
  398. package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.test.ts +1 -0
  399. package/packages/pi-coding-agent/src/modes/interactive/interactive-mode-state.ts +1 -1
  400. package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +75 -9
  401. package/packages/pi-coding-agent/src/modes/interactive/slash-command-handlers.test.ts +95 -0
  402. package/packages/pi-coding-agent/src/modes/interactive/slash-command-handlers.ts +24 -1
  403. package/packages/pi-coding-agent/src/modes/interactive/theme/theme-schema.ts +13 -0
  404. package/packages/pi-coding-agent/src/modes/interactive/theme/theme.ts +32 -2
  405. package/packages/pi-coding-agent/src/modes/interactive/theme/themes.ts +36 -27
  406. package/packages/pi-coding-agent/src/modes/interactive/tui-mode.test.ts +65 -0
  407. package/packages/pi-coding-agent/src/modes/interactive/tui-mode.ts +29 -0
  408. package/packages/pi-coding-agent/src/modes/rpc/rpc-types.ts +3 -336
  409. package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
  410. package/packages/pi-tui/dist/__tests__/style.test.d.ts +2 -0
  411. package/packages/pi-tui/dist/__tests__/style.test.d.ts.map +1 -0
  412. package/packages/pi-tui/dist/__tests__/style.test.js +63 -0
  413. package/packages/pi-tui/dist/__tests__/style.test.js.map +1 -0
  414. package/packages/pi-tui/dist/__tests__/tui.test.js +24 -3
  415. package/packages/pi-tui/dist/__tests__/tui.test.js.map +1 -1
  416. package/packages/pi-tui/dist/index.d.ts +1 -0
  417. package/packages/pi-tui/dist/index.d.ts.map +1 -1
  418. package/packages/pi-tui/dist/index.js +2 -0
  419. package/packages/pi-tui/dist/index.js.map +1 -1
  420. package/packages/pi-tui/dist/style.d.ts +41 -0
  421. package/packages/pi-tui/dist/style.d.ts.map +1 -0
  422. package/packages/pi-tui/dist/style.js +158 -0
  423. package/packages/pi-tui/dist/style.js.map +1 -0
  424. package/packages/pi-tui/dist/tui.d.ts.map +1 -1
  425. package/packages/pi-tui/dist/tui.js +1 -0
  426. package/packages/pi-tui/dist/tui.js.map +1 -1
  427. package/packages/pi-tui/package.json +1 -1
  428. package/packages/pi-tui/src/__tests__/style.test.ts +76 -0
  429. package/packages/pi-tui/src/__tests__/tui.test.ts +29 -3
  430. package/packages/pi-tui/src/index.ts +9 -0
  431. package/packages/pi-tui/src/style.ts +225 -0
  432. package/packages/pi-tui/src/tui.ts +1 -0
  433. package/packages/pi-tui/tsconfig.tsbuildinfo +1 -1
  434. package/packages/rpc-client/README.md +3 -3
  435. package/packages/rpc-client/dist/index.d.ts +1 -1
  436. package/packages/rpc-client/dist/index.d.ts.map +1 -1
  437. package/packages/rpc-client/dist/index.js.map +1 -1
  438. package/packages/rpc-client/dist/rpc-client.d.ts +2 -6
  439. package/packages/rpc-client/dist/rpc-client.d.ts.map +1 -1
  440. package/packages/rpc-client/dist/rpc-client.js.map +1 -1
  441. package/packages/rpc-client/dist/rpc-types.d.ts +1 -565
  442. package/packages/rpc-client/dist/rpc-types.d.ts.map +1 -1
  443. package/packages/rpc-client/dist/rpc-types.js +3 -11
  444. package/packages/rpc-client/dist/rpc-types.js.map +1 -1
  445. package/packages/rpc-client/package.json +4 -1
  446. package/packages/rpc-client/src/index.ts +1 -1
  447. package/packages/rpc-client/src/rpc-client.ts +3 -6
  448. package/packages/rpc-client/src/rpc-types.ts +3 -398
  449. package/packages/rpc-client/tsconfig.tsbuildinfo +1 -1
  450. package/pkg/dist/modes/interactive/theme/theme-schema.d.ts +12 -0
  451. package/pkg/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -1
  452. package/pkg/dist/modes/interactive/theme/theme-schema.js +13 -0
  453. package/pkg/dist/modes/interactive/theme/theme-schema.js.map +1 -1
  454. package/pkg/dist/modes/interactive/theme/theme.d.ts +1 -1
  455. package/pkg/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  456. package/pkg/dist/modes/interactive/theme/theme.js +18 -1
  457. package/pkg/dist/modes/interactive/theme/theme.js.map +1 -1
  458. package/pkg/dist/modes/interactive/theme/themes.d.ts.map +1 -1
  459. package/pkg/dist/modes/interactive/theme/themes.js +36 -27
  460. package/pkg/dist/modes/interactive/theme/themes.js.map +1 -1
  461. package/pkg/package.json +1 -1
  462. package/src/resources/extensions/github-sync/templates.ts +93 -88
  463. package/src/resources/extensions/github-sync/tests/inline-code.test.ts +66 -0
  464. package/src/resources/extensions/github-sync/tests/templates.test.ts +10 -2
  465. package/src/resources/extensions/gsd/auto/contracts.ts +87 -0
  466. package/src/resources/extensions/gsd/auto/custom-verify-retry-store.ts +72 -0
  467. package/src/resources/extensions/gsd/auto/loop-deps.ts +10 -3
  468. package/src/resources/extensions/gsd/auto/loop.ts +416 -596
  469. package/src/resources/extensions/gsd/auto/orchestrator.ts +161 -0
  470. package/src/resources/extensions/gsd/auto/phases.ts +82 -8
  471. package/src/resources/extensions/gsd/auto/run-unit.ts +24 -14
  472. package/src/resources/extensions/gsd/auto/session.ts +11 -0
  473. package/src/resources/extensions/gsd/auto/workflow-custom-engine-dispatch-outcome.ts +28 -0
  474. package/src/resources/extensions/gsd/auto/workflow-custom-engine-iteration.ts +52 -0
  475. package/src/resources/extensions/gsd/auto/workflow-custom-engine-reconcile-outcome.ts +58 -0
  476. package/src/resources/extensions/gsd/auto/workflow-custom-engine-reconcile.ts +71 -0
  477. package/src/resources/extensions/gsd/auto/workflow-custom-engine-retry.ts +90 -0
  478. package/src/resources/extensions/gsd/auto/workflow-custom-engine-verify-outcome.ts +50 -0
  479. package/src/resources/extensions/gsd/auto/workflow-dispatch-claim.ts +97 -0
  480. package/src/resources/extensions/gsd/auto/workflow-dispatch-ledger.ts +45 -0
  481. package/src/resources/extensions/gsd/auto/workflow-iteration-completion.ts +26 -0
  482. package/src/resources/extensions/gsd/auto/workflow-journal-reporter.ts +33 -0
  483. package/src/resources/extensions/gsd/auto/workflow-kernel.ts +520 -0
  484. package/src/resources/extensions/gsd/auto/workflow-memory-pressure.ts +58 -0
  485. package/src/resources/extensions/gsd/auto/workflow-phase-reporter.ts +22 -0
  486. package/src/resources/extensions/gsd/auto/workflow-session-lock.ts +68 -0
  487. package/src/resources/extensions/gsd/auto/workflow-sidecar-iteration.ts +46 -0
  488. package/src/resources/extensions/gsd/auto/workflow-sidecar-queue.ts +46 -0
  489. package/src/resources/extensions/gsd/auto/workflow-turn-reporter.ts +68 -0
  490. package/src/resources/extensions/gsd/auto/workflow-unit-dispatch.ts +89 -0
  491. package/src/resources/extensions/gsd/auto/workflow-worker-heartbeat.ts +38 -0
  492. package/src/resources/extensions/gsd/auto-dashboard.ts +61 -8
  493. package/src/resources/extensions/gsd/auto-dispatch.ts +17 -0
  494. package/src/resources/extensions/gsd/auto-prompts.ts +170 -3
  495. package/src/resources/extensions/gsd/auto-recovery.ts +194 -56
  496. package/src/resources/extensions/gsd/auto-runtime-state.ts +7 -0
  497. package/src/resources/extensions/gsd/auto-start.ts +7 -6
  498. package/src/resources/extensions/gsd/auto-verification.ts +5 -1
  499. package/src/resources/extensions/gsd/auto-worktree.ts +85 -36
  500. package/src/resources/extensions/gsd/auto.ts +179 -2
  501. package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +30 -2
  502. package/src/resources/extensions/gsd/bootstrap/db-tools.ts +11 -0
  503. package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +30 -6
  504. package/src/resources/extensions/gsd/bootstrap/write-gate.ts +135 -1
  505. package/src/resources/extensions/gsd/commands-extract-learnings.ts +17 -12
  506. package/src/resources/extensions/gsd/commands-ship.ts +24 -51
  507. package/src/resources/extensions/gsd/commands-workflow-templates.ts +13 -0
  508. package/src/resources/extensions/gsd/component-loader.ts +5 -11
  509. package/src/resources/extensions/gsd/custom-workflow-engine.ts +29 -0
  510. package/src/resources/extensions/gsd/db-adapter.ts +75 -0
  511. package/src/resources/extensions/gsd/db-base-schema.ts +383 -0
  512. package/src/resources/extensions/gsd/db-connection-cache.ts +45 -0
  513. package/src/resources/extensions/gsd/db-coordination-schema.ts +109 -0
  514. package/src/resources/extensions/gsd/db-decision-requirement-rows.ts +77 -0
  515. package/src/resources/extensions/gsd/db-gate-rows.ts +19 -0
  516. package/src/resources/extensions/gsd/db-lightweight-query-rows.ts +50 -0
  517. package/src/resources/extensions/gsd/db-memory-fts-schema.ts +66 -0
  518. package/src/resources/extensions/gsd/db-migration-backup.ts +34 -0
  519. package/src/resources/extensions/gsd/db-migration-steps.ts +451 -0
  520. package/src/resources/extensions/gsd/db-milestone-artifact-rows.ts +70 -0
  521. package/src/resources/extensions/gsd/db-open-state.ts +47 -0
  522. package/src/resources/extensions/gsd/db-provider.ts +148 -0
  523. package/src/resources/extensions/gsd/db-runtime-kv-schema.ts +30 -0
  524. package/src/resources/extensions/gsd/db-schema-metadata.ts +33 -0
  525. package/src/resources/extensions/gsd/db-task-slice-rows.ts +146 -0
  526. package/src/resources/extensions/gsd/db-transaction.ts +76 -0
  527. package/src/resources/extensions/gsd/db-verification-evidence-rows.ts +14 -0
  528. package/src/resources/extensions/gsd/db-verification-evidence-schema.ts +22 -0
  529. package/src/resources/extensions/gsd/escalation.ts +3 -1
  530. package/src/resources/extensions/gsd/graph.ts +12 -5
  531. package/src/resources/extensions/gsd/gsd-db.ts +379 -1660
  532. package/src/resources/extensions/gsd/guided-flow.ts +2 -2
  533. package/src/resources/extensions/gsd/interrupted-session.ts +1 -0
  534. package/src/resources/extensions/gsd/legacy-telemetry.ts +99 -0
  535. package/src/resources/extensions/gsd/markdown-renderer.ts +4 -1
  536. package/src/resources/extensions/gsd/model-router.ts +10 -6
  537. package/src/resources/extensions/gsd/notification-widget.ts +25 -4
  538. package/src/resources/extensions/gsd/post-execution-checks.ts +35 -7
  539. package/src/resources/extensions/gsd/pr-evidence.ts +182 -0
  540. package/src/resources/extensions/gsd/pre-execution-checks.ts +4 -1
  541. package/src/resources/extensions/gsd/process-task-path.ts +81 -0
  542. package/src/resources/extensions/gsd/prompt-loader.ts +9 -5
  543. package/src/resources/extensions/gsd/prompts/complete-milestone.md +32 -30
  544. package/src/resources/extensions/gsd/prompts/complete-slice.md +23 -34
  545. package/src/resources/extensions/gsd/prompts/discuss-headless.md +50 -96
  546. package/src/resources/extensions/gsd/prompts/discuss.md +81 -181
  547. package/src/resources/extensions/gsd/prompts/execute-task.md +40 -67
  548. package/src/resources/extensions/gsd/prompts/forensics.md +41 -84
  549. package/src/resources/extensions/gsd/prompts/guided-discuss-milestone.md +29 -39
  550. package/src/resources/extensions/gsd/prompts/guided-discuss-project.md +30 -65
  551. package/src/resources/extensions/gsd/prompts/guided-discuss-requirements.md +25 -52
  552. package/src/resources/extensions/gsd/prompts/guided-discuss-slice.md +36 -36
  553. package/src/resources/extensions/gsd/prompts/guided-research-project.md +20 -38
  554. package/src/resources/extensions/gsd/prompts/plan-milestone.md +45 -59
  555. package/src/resources/extensions/gsd/prompts/plan-slice.md +25 -87
  556. package/src/resources/extensions/gsd/prompts/queue.md +46 -53
  557. package/src/resources/extensions/gsd/prompts/refine-slice.md +23 -23
  558. package/src/resources/extensions/gsd/prompts/research-slice.md +23 -23
  559. package/src/resources/extensions/gsd/prompts/rethink.md +10 -10
  560. package/src/resources/extensions/gsd/prompts/system.md +65 -107
  561. package/src/resources/extensions/gsd/prompts/triage-captures.md +15 -15
  562. package/src/resources/extensions/gsd/prompts/validate-milestone.md +24 -24
  563. package/src/resources/extensions/gsd/prompts/worktree-merge.md +35 -35
  564. package/src/resources/extensions/gsd/state.ts +6 -3
  565. package/src/resources/extensions/gsd/tests/auto-abort-pause-regression.test.ts +38 -0
  566. package/src/resources/extensions/gsd/tests/auto-dashboard.test.ts +98 -0
  567. package/src/resources/extensions/gsd/tests/auto-loop.test.ts +117 -0
  568. package/src/resources/extensions/gsd/tests/auto-orchestrator.test.ts +353 -0
  569. package/src/resources/extensions/gsd/tests/auto-pr-bugs.test.ts +19 -0
  570. package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +170 -1
  571. package/src/resources/extensions/gsd/tests/auto-runtime-state.test.ts +39 -0
  572. package/src/resources/extensions/gsd/tests/auto-session-encapsulation.test.ts +3 -0
  573. package/src/resources/extensions/gsd/tests/commands-eval-review.test.ts +2 -2
  574. package/src/resources/extensions/gsd/tests/commands-extract-learnings.test.ts +9 -0
  575. package/src/resources/extensions/gsd/tests/commands-ship-eval-warn.test.ts +3 -2
  576. package/src/resources/extensions/gsd/tests/complete-milestone-prompt-rendering.test.ts +47 -0
  577. package/src/resources/extensions/gsd/tests/complete-milestone.test.ts +19 -5
  578. package/src/resources/extensions/gsd/tests/component-loader.test.ts +2 -9
  579. package/src/resources/extensions/gsd/tests/custom-engine-loop-integration.test.ts +144 -0
  580. package/src/resources/extensions/gsd/tests/custom-verify-retry-store.test.ts +139 -0
  581. package/src/resources/extensions/gsd/tests/custom-workflow-engine.test.ts +50 -0
  582. package/src/resources/extensions/gsd/tests/dashboard-custom-engine.test.ts +3 -3
  583. package/src/resources/extensions/gsd/tests/db-adapter.test.ts +82 -0
  584. package/src/resources/extensions/gsd/tests/db-base-schema.test.ts +62 -0
  585. package/src/resources/extensions/gsd/tests/db-connection-cache.test.ts +60 -0
  586. package/src/resources/extensions/gsd/tests/db-coordination-schema.test.ts +39 -0
  587. package/src/resources/extensions/gsd/tests/db-decision-requirement-rows.test.ts +135 -0
  588. package/src/resources/extensions/gsd/tests/db-gate-rows.test.ts +53 -0
  589. package/src/resources/extensions/gsd/tests/db-lightweight-query-rows.test.ts +45 -0
  590. package/src/resources/extensions/gsd/tests/db-memory-fts-schema.test.ts +86 -0
  591. package/src/resources/extensions/gsd/tests/db-migration-backup.test.ts +105 -0
  592. package/src/resources/extensions/gsd/tests/db-migration-steps.integration.test.ts +428 -0
  593. package/src/resources/extensions/gsd/tests/db-migration-steps.test.ts +159 -0
  594. package/src/resources/extensions/gsd/tests/db-milestone-artifact-rows.test.ts +53 -0
  595. package/src/resources/extensions/gsd/tests/db-open-state.test.ts +56 -0
  596. package/src/resources/extensions/gsd/tests/db-provider.test.ts +105 -0
  597. package/src/resources/extensions/gsd/tests/db-runtime-kv-schema.test.ts +37 -0
  598. package/src/resources/extensions/gsd/tests/db-schema-metadata.test.ts +115 -0
  599. package/src/resources/extensions/gsd/tests/db-task-slice-rows.test.ts +128 -0
  600. package/src/resources/extensions/gsd/tests/db-transaction.test.ts +110 -0
  601. package/src/resources/extensions/gsd/tests/db-verification-evidence-schema.test.ts +76 -0
  602. package/src/resources/extensions/gsd/tests/discuss-headless-rendering.test.ts +37 -0
  603. package/src/resources/extensions/gsd/tests/execute-task-rendering.test.ts +59 -0
  604. package/src/resources/extensions/gsd/tests/fixtures/pr-body/commands-ship-basic.md +52 -0
  605. package/src/resources/extensions/gsd/tests/fixtures/pr-body/commands-ship-empty-optionals.md +42 -0
  606. package/src/resources/extensions/gsd/tests/fixtures/pr-body/swarm-lane-no-blockers.md +55 -0
  607. package/src/resources/extensions/gsd/tests/fixtures/pr-body/swarm-lane-with-blockers.md +60 -0
  608. package/src/resources/extensions/gsd/tests/forensics-prompt-rendering.test.ts +36 -0
  609. package/src/resources/extensions/gsd/tests/graph-operations.test.ts +10 -0
  610. package/src/resources/extensions/gsd/tests/gsd-db.test.ts +139 -0
  611. package/src/resources/extensions/gsd/tests/guided-discuss-milestone-prompt-rendering.test.ts +43 -0
  612. package/src/resources/extensions/gsd/tests/guided-discuss-project-prompt-rendering.test.ts +41 -0
  613. package/src/resources/extensions/gsd/tests/guided-discuss-requirements-prompt-rendering.test.ts +45 -0
  614. package/src/resources/extensions/gsd/tests/has-pending-deep-stage.test.ts +33 -1
  615. package/src/resources/extensions/gsd/tests/integration/auto-recovery.test.ts +79 -0
  616. package/src/resources/extensions/gsd/tests/integration/auto-worktree-milestone-merge.test.ts +37 -0
  617. package/src/resources/extensions/gsd/tests/integration/state-machine-live-validation.test.ts +5 -3
  618. package/src/resources/extensions/gsd/tests/journal-integration.test.ts +134 -0
  619. package/src/resources/extensions/gsd/tests/legacy-component-format-telemetry.test.ts +62 -0
  620. package/src/resources/extensions/gsd/tests/legacy-telemetry.test.ts +144 -0
  621. package/src/resources/extensions/gsd/tests/memory-pressure-stuck-state.test.ts +40 -16
  622. package/src/resources/extensions/gsd/tests/model-router.test.ts +33 -12
  623. package/src/resources/extensions/gsd/tests/notification-store.test.ts +8 -0
  624. package/src/resources/extensions/gsd/tests/notification-widget.test.ts +40 -1
  625. package/src/resources/extensions/gsd/tests/paused-session-via-db.test.ts +2 -0
  626. package/src/resources/extensions/gsd/tests/plan-milestone-rendering.test.ts +45 -0
  627. package/src/resources/extensions/gsd/tests/plan-slice-prompt.test.ts +65 -16
  628. package/src/resources/extensions/gsd/tests/plan-slice.test.ts +27 -0
  629. package/src/resources/extensions/gsd/tests/post-execution-checks.test.ts +46 -0
  630. package/src/resources/extensions/gsd/tests/pr-evidence-equivalence.test.ts +102 -0
  631. package/src/resources/extensions/gsd/tests/pr-evidence-hardening.test.ts +165 -0
  632. package/src/resources/extensions/gsd/tests/pr-evidence.test.ts +79 -0
  633. package/src/resources/extensions/gsd/tests/process-task-path.test.ts +51 -0
  634. package/src/resources/extensions/gsd/tests/prompt-step-ordering.test.ts +16 -1
  635. package/src/resources/extensions/gsd/tests/queue-prompt-rendering.test.ts +37 -0
  636. package/src/resources/extensions/gsd/tests/start-auto-detached.test.ts +46 -2
  637. package/src/resources/extensions/gsd/tests/tool-naming.test.ts +32 -9
  638. package/src/resources/extensions/gsd/tests/unit-context-composer.test.ts +6 -6
  639. package/src/resources/extensions/gsd/tests/uok-kernel-path.test.ts +12 -0
  640. package/src/resources/extensions/gsd/tests/uok-plan-v2-wiring.test.ts +1 -1
  641. package/src/resources/extensions/gsd/tests/workflow-custom-engine-dispatch-outcome.test.ts +55 -0
  642. package/src/resources/extensions/gsd/tests/workflow-custom-engine-iteration.test.ts +93 -0
  643. package/src/resources/extensions/gsd/tests/workflow-custom-engine-reconcile-outcome.test.ts +108 -0
  644. package/src/resources/extensions/gsd/tests/workflow-custom-engine-reconcile.test.ts +146 -0
  645. package/src/resources/extensions/gsd/tests/workflow-custom-engine-retry.test.ts +136 -0
  646. package/src/resources/extensions/gsd/tests/workflow-custom-engine-verify-outcome.test.ts +95 -0
  647. package/src/resources/extensions/gsd/tests/workflow-dispatch-claim.test.ts +158 -0
  648. package/src/resources/extensions/gsd/tests/workflow-dispatch-ledger.test.ts +82 -0
  649. package/src/resources/extensions/gsd/tests/workflow-iteration-completion.test.ts +44 -0
  650. package/src/resources/extensions/gsd/tests/workflow-journal-reporter.test.ts +49 -0
  651. package/src/resources/extensions/gsd/tests/workflow-kernel.test.ts +607 -0
  652. package/src/resources/extensions/gsd/tests/workflow-logger.test.ts +20 -4
  653. package/src/resources/extensions/gsd/tests/workflow-memory-pressure.test.ts +71 -0
  654. package/src/resources/extensions/gsd/tests/workflow-phase-reporter.test.ts +40 -0
  655. package/src/resources/extensions/gsd/tests/workflow-session-lock.test.ts +135 -0
  656. package/src/resources/extensions/gsd/tests/workflow-sidecar-iteration.test.ts +110 -0
  657. package/src/resources/extensions/gsd/tests/workflow-sidecar-queue.test.ts +116 -0
  658. package/src/resources/extensions/gsd/tests/workflow-templates.test.ts +21 -0
  659. package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +32 -0
  660. package/src/resources/extensions/gsd/tests/workflow-turn-reporter.test.ts +87 -0
  661. package/src/resources/extensions/gsd/tests/workflow-unit-dispatch.test.ts +160 -0
  662. package/src/resources/extensions/gsd/tests/workflow-worker-heartbeat.test.ts +123 -0
  663. package/src/resources/extensions/gsd/tests/working-output-messages.test.ts +93 -0
  664. package/src/resources/extensions/gsd/tests/worktree-submodule-safety.test.ts +17 -33
  665. package/src/resources/extensions/gsd/tests/worktree-write-gate.test.ts +179 -0
  666. package/src/resources/extensions/gsd/tools/complete-milestone.ts +15 -9
  667. package/src/resources/extensions/gsd/tools/complete-task.ts +4 -1
  668. package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +6 -1
  669. package/src/resources/extensions/gsd/unit-context-composer.ts +1 -1
  670. package/src/resources/extensions/gsd/uok/kernel.ts +10 -3
  671. package/src/resources/extensions/gsd/uok/plan-v2.ts +5 -1
  672. package/src/resources/extensions/gsd/workflow-logger.ts +13 -13
  673. package/src/resources/extensions/gsd/workflow-manifest.ts +6 -15
  674. package/src/resources/extensions/gsd/workflow-projections.ts +5 -1
  675. package/src/resources/extensions/gsd/workflow-templates.ts +11 -0
  676. package/src/resources/extensions/gsd/working-output-messages.ts +120 -0
  677. package/src/resources/extensions/shared/interview-ui.ts +18 -5
  678. package/src/resources/extensions/shared/tests/interview-notes-loop.test.ts +41 -0
  679. package/dist/web/standalone/.next/server/chunks/6336.js +0 -1
  680. /package/dist/web/standalone/.next/static/{TzEVJ1Lh8vbez4n4Q9TqQ → vIAZSyxIuvqNkCvXt9oqb}/_buildManifest.js +0 -0
  681. /package/dist/web/standalone/.next/static/{TzEVJ1Lh8vbez4n4Q9TqQ → vIAZSyxIuvqNkCvXt9oqb}/_ssgManifest.js +0 -0
@@ -1716,8 +1716,8 @@ export async function showSmartEntry(ctx, pi, basePath, options) {
1716
1716
  // standard wizard below.
1717
1717
  {
1718
1718
  const prefs = loadEffectiveGSDPreferences(basePath)?.preferences;
1719
- const { hasPendingDeepStage } = await import("./auto-dispatch.js");
1720
- if (hasPendingDeepStage(prefs, basePath)) {
1719
+ const { shouldRunDeepProjectSetup } = await import("./auto-dispatch.js");
1720
+ if (shouldRunDeepProjectSetup(state, prefs, basePath)) {
1721
1721
  await startDeepProjectSetupForeground(ctx, pi, basePath, stepMode);
1722
1722
  return;
1723
1723
  }
@@ -0,0 +1,70 @@
1
+ // Project/App: GSD-2
2
+ // File Purpose: Runtime counters for telemetry-gated legacy compatibility paths.
3
+ import { mkdirSync, writeFileSync } from "node:fs";
4
+ import { dirname } from "node:path";
5
+ import { logWarning } from "./workflow-logger.js";
6
+ const COUNTERS = [
7
+ "legacy.markdownFallbackUsed",
8
+ "legacy.workflowEngineUsed",
9
+ "legacy.uokFallbackUsed",
10
+ "legacy.mcpAliasUsed",
11
+ "legacy.componentFormatUsed",
12
+ "legacy.providerDefaultUsed",
13
+ ];
14
+ const values = Object.fromEntries(COUNTERS.map((counter) => [counter, 0]));
15
+ const warnedCounters = new Set();
16
+ const DIAGNOSTICS = {
17
+ "legacy.markdownFallbackUsed": "Deprecated markdown state fallback used; migrate projects to DB-authoritative state before removing markdown derivation.",
18
+ "legacy.workflowEngineUsed": "Deprecated workflow engine path used; prefer auto-milestone workflow templates before removing legacy engines.",
19
+ "legacy.uokFallbackUsed": "Deprecated UOK fallback path used; resolve UOK kernel blockers before removing parity fallback wrappers.",
20
+ "legacy.mcpAliasUsed": "Deprecated MCP alias tool used; update callers to the canonical gsd_* tool name before alias removal.",
21
+ "legacy.componentFormatUsed": "Deprecated component format loaded; migrate skills/agents to component.yaml before removing legacy loaders.",
22
+ "legacy.providerDefaultUsed": "Provider-specific default fallback used without an explicit available model; configure provider-aware model preferences before removing defaults.",
23
+ };
24
+ process.once("beforeExit", persistLegacyTelemetry);
25
+ export function incrementLegacyTelemetry(counter, amount = 1) {
26
+ if (!Number.isFinite(amount) || amount <= 0)
27
+ return;
28
+ values[counter] += amount;
29
+ emitLegacyDiagnostic(counter);
30
+ persistLegacyTelemetry();
31
+ }
32
+ export function getLegacyTelemetry() {
33
+ return { ...values };
34
+ }
35
+ export function resetLegacyTelemetry() {
36
+ for (const counter of COUNTERS) {
37
+ values[counter] = 0;
38
+ }
39
+ warnedCounters.clear();
40
+ }
41
+ export function listLegacyTelemetryCounters() {
42
+ return [...COUNTERS];
43
+ }
44
+ export function getLegacyTelemetryReport() {
45
+ return {
46
+ ts: new Date().toISOString(),
47
+ counters: getLegacyTelemetry(),
48
+ };
49
+ }
50
+ export function persistLegacyTelemetrySnapshot() {
51
+ persistLegacyTelemetry();
52
+ }
53
+ function emitLegacyDiagnostic(counter) {
54
+ if (warnedCounters.has(counter))
55
+ return;
56
+ warnedCounters.add(counter);
57
+ logWarning("migration", DIAGNOSTICS[counter], { counter });
58
+ }
59
+ function persistLegacyTelemetry() {
60
+ const outputPath = process.env.GSD_LEGACY_TELEMETRY_FILE?.trim();
61
+ if (!outputPath)
62
+ return;
63
+ try {
64
+ mkdirSync(dirname(outputPath), { recursive: true });
65
+ writeFileSync(outputPath, `${JSON.stringify(getLegacyTelemetryReport(), null, 2)}\n`, "utf-8");
66
+ }
67
+ catch {
68
+ // Legacy cleanup telemetry must never block runtime paths.
69
+ }
70
+ }
@@ -1,3 +1,5 @@
1
+ // Project/App: GSD-2
2
+ // File Purpose: Markdown projection renderer for GSD workflow database rows.
1
3
  // GSD Markdown Renderer — DB → Markdown file generation
2
4
  //
3
5
  // Transforms DB state into correct markdown files on disk.
@@ -1,9 +1,9 @@
1
- // GSD Extension — Dynamic Model Router
2
- // Maps complexity tiers to models, enforcing downgrade-only semantics.
3
- // The user's configured model is always the ceiling.
1
+ // Project/App: GSD-2
2
+ // File Purpose: Routes work to appropriate models while preserving configured ceilings.
4
3
  import { tierOrdinal } from "./complexity-classifier.js";
5
4
  import { getProviderCapabilities } from "@gsd/pi-ai";
6
5
  import { getToolCompatibility } from "@gsd/pi-coding-agent";
6
+ import { incrementLegacyTelemetry } from "./legacy-telemetry.js";
7
7
  // ─── Known Model Tiers ───────────────────────────────────────────────────────
8
8
  // Maps known model IDs to their capability tier. Used when tier_models is not
9
9
  // explicitly configured to pick the best available model for each tier.
@@ -474,13 +474,16 @@ export function resolveModelForTier(tier, availableModelIds, routingConfigOrCros
474
474
  : crossProvider ?? routingConfig.cross_provider !== false;
475
475
  // No available models known — return canonical fallback
476
476
  if (availableModelIds.length === 0) {
477
+ incrementLegacyTelemetry("legacy.providerDefaultUsed");
477
478
  return canonicalModelForTier(tier);
478
479
  }
479
480
  // Cross-provider tier search
480
481
  const resolved = findModelForTier(tier, routingConfig, availableModelIds, allowCrossProvider);
481
- return resolved
482
- ? normalizeResolvedTierModelId(resolved, tier, routingConfig)
483
- : canonicalModelForTier(tier);
482
+ if (resolved) {
483
+ return normalizeResolvedTierModelId(resolved, tier, routingConfig);
484
+ }
485
+ incrementLegacyTelemetry("legacy.providerDefaultUsed");
486
+ return canonicalModelForTier(tier);
484
487
  }
485
488
  // ─── Internal ────────────────────────────────────────────────────────────────
486
489
  /**
@@ -21,14 +21,32 @@ export function buildNotificationWidgetLines() {
21
21
  return chip ? [` ${chip}`] : [];
22
22
  }
23
23
  const REFRESH_INTERVAL_MS = 30_000;
24
+ let notificationWidgetCleanup;
24
25
  export function initNotificationWidget(ctx) {
26
+ notificationWidgetCleanup?.();
27
+ notificationWidgetCleanup = undefined;
25
28
  if (!ctx.hasUI)
26
- return;
29
+ return () => { };
27
30
  const push = () => {
28
31
  const chip = buildNotificationChip();
29
32
  ctx.ui.setStatus(STATUS_KEY, chip.length > 0 ? chip : undefined);
30
33
  };
31
34
  push();
32
- onNotificationStoreChange(push);
33
- setInterval(push, REFRESH_INTERVAL_MS).unref?.();
35
+ const unsubscribe = onNotificationStoreChange(push);
36
+ const interval = setInterval(push, REFRESH_INTERVAL_MS);
37
+ interval.unref?.();
38
+ const cleanup = () => {
39
+ unsubscribe();
40
+ clearInterval(interval);
41
+ if (notificationWidgetCleanup === cleanup) {
42
+ ctx.ui.setStatus(STATUS_KEY, undefined);
43
+ notificationWidgetCleanup = undefined;
44
+ }
45
+ };
46
+ notificationWidgetCleanup = cleanup;
47
+ return cleanup;
48
+ }
49
+ export function _resetNotificationWidgetForTests() {
50
+ notificationWidgetCleanup?.();
51
+ notificationWidgetCleanup = undefined;
34
52
  }
@@ -1,3 +1,5 @@
1
+ // Project/App: GSD-2
2
+ // File Purpose: Post-execution validation checks for completed GSD task output.
1
3
  /**
2
4
  * Post-Execution Checks — Validate task output after execution completes.
3
5
  *
@@ -96,12 +98,25 @@ export function resolveImportPath(importPath, sourceFile, basePath) {
96
98
  if (existsSync(directPath)) {
97
99
  return { exists: true, resolvedPath: directPath };
98
100
  }
99
- // Only .js/.jsx/.mjs/.cjs imports legitimately fall through for the TS
100
- // ESM convention (.js .ts). Any other explicit extension (.css, .json,
101
- // .svg, images, fonts, .ts, .tsx, …) must stay unresolved when the direct
102
- // path is missing — otherwise a stray `./missing.css.ts` could shadow a
103
- // genuinely missing `./missing.css` import.
104
- if (![".js", ".jsx", ".mjs", ".cjs"].includes(explicitExt)) {
101
+ // Known concrete extensions that should NOT fall through to code-shadow
102
+ // probing when missing. This preserves the "missing.css must stay missing"
103
+ // guarantee while still allowing dotted module stems like ./route.server
104
+ // to resolve as ./route.server.ts.
105
+ const nonFallbackExtensions = new Set([
106
+ ".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs",
107
+ ".json", ".css", ".scss", ".sass", ".less", ".styl",
108
+ ".svg", ".png", ".jpg", ".jpeg", ".gif", ".webp", ".avif", ".ico", ".bmp",
109
+ ".woff", ".woff2", ".ttf", ".otf", ".eot",
110
+ ]);
111
+ const runtimeFallbackExtensions = new Set([".js", ".jsx", ".mjs", ".cjs"]);
112
+ const dottedStemFallbackExtensions = new Set([".server", ".client", ".webhook"]);
113
+ if (explicitExt !== "" &&
114
+ !runtimeFallbackExtensions.has(explicitExt) &&
115
+ !nonFallbackExtensions.has(explicitExt) &&
116
+ !dottedStemFallbackExtensions.has(explicitExt)) {
117
+ return { exists: false, resolvedPath: null };
118
+ }
119
+ if (nonFallbackExtensions.has(explicitExt) && !runtimeFallbackExtensions.has(explicitExt)) {
105
120
  return { exists: false, resolvedPath: null };
106
121
  }
107
122
  }
@@ -163,6 +178,12 @@ export function checkImportResolution(taskRow, _priorTasks, basePath) {
163
178
  }
164
179
  const imports = extractRelativeImports(source);
165
180
  for (const { importPath, lineNum } of imports) {
181
+ // React Router generated +types modules may not exist on disk during
182
+ // post-exec checks (generated during framework build). Don't block task
183
+ // completion on these imports.
184
+ if (/^\.{1,2}\/\+types\//.test(importPath)) {
185
+ continue;
186
+ }
166
187
  const resolution = resolveImportPath(importPath, file, basePath);
167
188
  if (!resolution.exists) {
168
189
  results.push({
@@ -0,0 +1,117 @@
1
+ // Project/App: GSD-2
2
+ // File Purpose: Shared pull request evidence generator for GSD shipping paths.
3
+ const CHANGE_TYPE_LABELS = {
4
+ feat: "New feature or capability",
5
+ fix: "Bug fix",
6
+ refactor: "Code restructuring",
7
+ test: "Adding or updating tests",
8
+ docs: "Documentation only",
9
+ chore: "Build, CI, or tooling changes",
10
+ };
11
+ // Per-item cap for user-supplied content. 2 KB gives slice titles plus
12
+ // descriptions room while still bounding malicious DoS-via-PR-body input.
13
+ const USER_CONTENT_CAP_BYTES = 2048;
14
+ const TRUNCATION_SUFFIX = " … [truncated]";
15
+ // Strips HTML comments, fake commit trailers (Co-Authored-By, Signed-off-by —
16
+ // case-insensitive on the trailer name), and caps total length. Designed to
17
+ // be a no-op for well-formed input; golden fixtures must remain byte-stable.
18
+ // Trailer lines are removed (not rejected) so that a single bad line in an
19
+ // otherwise legitimate description does not block the entire PR.
20
+ function sanitizeUserContent(s) {
21
+ if (!s)
22
+ return s;
23
+ // Strip HTML comments greedily across newlines.
24
+ let out = s.replace(/<!--[\s\S]*?-->/g, "");
25
+ // Drop lines that look like commit trailers we do not want forged.
26
+ out = out
27
+ .split("\n")
28
+ .filter((line) => !/^\s*(co-authored-by|signed-off-by)\s*:/i.test(line))
29
+ .join("\n");
30
+ if (Buffer.byteLength(out, "utf8") > USER_CONTENT_CAP_BYTES) {
31
+ const budget = USER_CONTENT_CAP_BYTES - Buffer.byteLength(TRUNCATION_SUFFIX, "utf8");
32
+ // Truncate by code units to stay safely under the byte budget for ASCII;
33
+ // for multibyte content we conservatively walk back until under budget.
34
+ let sliced = out.slice(0, Math.max(0, budget));
35
+ while (Buffer.byteLength(sliced, "utf8") > budget && sliced.length > 0) {
36
+ sliced = sliced.slice(0, -1);
37
+ }
38
+ out = sliced + TRUNCATION_SUFFIX;
39
+ }
40
+ return out;
41
+ }
42
+ // Strips HTML comments and fake trailers without applying the length cap.
43
+ // Used for short fields like linkedIssue where truncation would be confusing.
44
+ function sanitizeIssueRef(s) {
45
+ if (!s)
46
+ return s;
47
+ let out = s.replace(/<!--[\s\S]*?-->/g, "");
48
+ out = out
49
+ .split("\n")
50
+ .filter((line) => !/^\s*(co-authored-by|signed-off-by)\s*:/i.test(line))
51
+ .join("\n");
52
+ return out;
53
+ }
54
+ function normalizeList(values) {
55
+ return (values ?? [])
56
+ .map((value) => sanitizeUserContent(value).trim())
57
+ .filter(Boolean);
58
+ }
59
+ function changeTypeChecklist(selected) {
60
+ return Object.keys(CHANGE_TYPE_LABELS).map((type) => {
61
+ const checked = type === selected ? "x" : " ";
62
+ return `- [${checked}] \`${type}\` - ${CHANGE_TYPE_LABELS[type]}`;
63
+ });
64
+ }
65
+ function bulletList(values, fallback) {
66
+ if (values.length === 0)
67
+ return `- ${fallback}`;
68
+ return values.map((value) => `- ${value}`).join("\n");
69
+ }
70
+ export function buildPrEvidence(input) {
71
+ const subjectId = input.subjectId?.trim() || input.milestoneId;
72
+ const subjectKind = input.subjectKind ?? "milestone";
73
+ const subjectTitle = input.milestoneTitle?.trim() || subjectId;
74
+ const changeType = input.changeType ?? "feat";
75
+ const summaries = normalizeList(input.summaries);
76
+ const blockers = normalizeList(input.blockers);
77
+ const roadmapItems = normalizeList(input.roadmapItems);
78
+ const metrics = normalizeList(input.metrics);
79
+ const testsRun = normalizeList(input.testsRun);
80
+ const rollbackNotes = normalizeList(input.rollbackNotes);
81
+ // linkedIssue is sanitized but not length-capped: legitimate issue refs
82
+ // are short by nature, and truncating "Closes #123" would be unhelpful.
83
+ const linkedIssueRaw = input.linkedIssue ? sanitizeIssueRef(input.linkedIssue).trim() : "";
84
+ const linkedIssue = linkedIssueRaw || "Not specified. Add an issue link before marking this PR ready if CONTRIBUTING.md requires one.";
85
+ const why = (input.why ? sanitizeUserContent(input.why).trim() : "") || `${capitalize(subjectKind)} work is complete and ready for review.`;
86
+ const how = (input.how ? sanitizeUserContent(input.how).trim() : "") || "Generated from GSD evidence and local workflow artifacts.";
87
+ const title = `${changeType}: ${subjectTitle}`;
88
+ const sections = [
89
+ "## TL;DR",
90
+ "",
91
+ `**What:** Ship ${subjectKind} ${subjectId} - ${subjectTitle}`,
92
+ `**Why:** ${why}`,
93
+ `**How:** ${how}`,
94
+ "",
95
+ "## What",
96
+ "",
97
+ summaries.length > 0 ? summaries.join("\n\n") : `${capitalize(subjectKind)} ${subjectId} completed.`,
98
+ ];
99
+ if (blockers.length > 0) {
100
+ sections.push("", "## Blockers", "", blockers.map((blocker) => `- ${blocker}`).join("\n"));
101
+ }
102
+ sections.push("", "## Why", "", why, "", "## How", "", how, "", "## Linked Issue", "", linkedIssue);
103
+ if (roadmapItems.length > 0) {
104
+ sections.push("", "## Roadmap", "", roadmapItems.join("\n"));
105
+ }
106
+ if (metrics.length > 0) {
107
+ sections.push("", "## Metrics", "", bulletList(metrics, "No metrics recorded."));
108
+ }
109
+ sections.push("", "## Tests Run", "", bulletList(testsRun, "Not specified. Add exact verification commands before requesting review."), "", "## Change Type", "", ...changeTypeChecklist(changeType), "", "## Rollback And Compatibility", "", bulletList(rollbackNotes, "No behavior-changing rollback notes recorded."));
110
+ if (input.aiAssisted !== false) {
111
+ sections.push("", "## AI Assistance Disclosure", "", "This PR was prepared with AI assistance.");
112
+ }
113
+ return { title, body: sections.join("\n") };
114
+ }
115
+ function capitalize(value) {
116
+ return value.slice(0, 1).toUpperCase() + value.slice(1);
117
+ }
@@ -1,3 +1,5 @@
1
+ // Project/App: GSD-2
2
+ // File Purpose: Pre-execution validation checks for GSD task plans.
1
3
  /**
2
4
  * Pre-Execution Checks — Validate task plans before execution begins.
3
5
  *
@@ -0,0 +1,61 @@
1
+ // Project/App: GSD-2
2
+ // File Purpose: Canonical process recommendations for routing work by task size.
3
+ const TASK_PATHS = {
4
+ hotfix: {
5
+ taskSize: "hotfix",
6
+ label: "Hotfix",
7
+ templateId: "hotfix",
8
+ command: "/gsd start hotfix <description>",
9
+ phases: ["fix", "ship"],
10
+ guidance: "Use for urgent production fixes that need minimal ceremony and fast verification.",
11
+ },
12
+ bugfix: {
13
+ taskSize: "bugfix",
14
+ label: "Bugfix",
15
+ templateId: "bugfix",
16
+ command: "/gsd start bugfix <description> --issue <ref>",
17
+ phases: ["triage", "fix", "verify", "ship"],
18
+ guidance: "Use for reproducible defects where a linked issue and regression test are expected.",
19
+ },
20
+ "small-feature": {
21
+ taskSize: "small-feature",
22
+ label: "Small Feature",
23
+ templateId: "small-feature",
24
+ command: "/gsd start small-feature <description>",
25
+ phases: ["scope", "plan", "implement", "verify"],
26
+ guidance: "Use for contained feature work that does not need the full milestone machinery.",
27
+ },
28
+ "large-feature": {
29
+ taskSize: "large-feature",
30
+ label: "Large Feature",
31
+ templateId: "full-project",
32
+ command: "/gsd discuss <description>, then /gsd auto",
33
+ phases: ["discuss", "plan", "execute", "verify"],
34
+ guidance: "Use for multi-slice work that should run through the DB-backed milestone flow.",
35
+ },
36
+ "architecture-change": {
37
+ taskSize: "architecture-change",
38
+ label: "Architecture Change",
39
+ templateId: "refactor",
40
+ command: "/gsd start refactor <description>",
41
+ phases: ["inventory", "plan", "migrate", "verify"],
42
+ guidance: "Use for structural changes that require inventory, compatibility notes, and staged verification.",
43
+ },
44
+ };
45
+ export function recommendProcessPath(taskSize) {
46
+ return TASK_PATHS[taskSize];
47
+ }
48
+ export function listRecommendedProcessPaths() {
49
+ return [
50
+ TASK_PATHS.hotfix,
51
+ TASK_PATHS.bugfix,
52
+ TASK_PATHS["small-feature"],
53
+ TASK_PATHS["large-feature"],
54
+ TASK_PATHS["architecture-change"],
55
+ ];
56
+ }
57
+ export function formatRecommendedProcessPaths() {
58
+ return listRecommendedProcessPaths()
59
+ .map((path) => ` ${path.taskSize.padEnd(19)} ${path.command}`)
60
+ .join("\n");
61
+ }
@@ -10,7 +10,7 @@
10
10
  * Templates are snapshotted shortly after module init via warmCache().
11
11
  * This keeps import/extension-registration fast while still preventing a
12
12
  * running session from being invalidated when another `gsd` launch overwrites
13
- * ~/.gsd/agent/ with newer templates via initResources(). Without caching, the
13
+ * the user-local agent tree with newer templates via initResources(). Without caching, the
14
14
  * in-memory extension code (which knows variable set A) can read a newer
15
15
  * template from disk (which expects variable set B), causing a
16
16
  * "template declares {{X}} but no value was provided" crash mid-session.
@@ -47,9 +47,9 @@ export function resolveExtensionDirFromCandidates(moduleDir, agentGsdDir, exists
47
47
  *
48
48
  * `import.meta.url` resolves to whichever copy of this module is executing.
49
49
  * On Windows (npm global install via MSYS2 / Git Bash) this can resolve to
50
- * the npm-global `AppData/Roaming/npm/…` path, which does NOT contain the
51
- * prompts/ and templates/ subtrees that initResources() copies to
52
- * `~/.gsd/agent/extensions/gsd/`. Detect the mismatch and fall back to
50
+ * the npm-global package path, which does NOT contain the prompts/ and
51
+ * templates/ subtrees that initResources() copies to the user-local agent
52
+ * extension directory. Detect the mismatch and fall back to
53
53
  * the user-local agent directory.
54
54
  */
55
55
  function resolveExtensionDir() {
@@ -62,7 +62,7 @@ const promptsDir = join(__extensionDir, "prompts");
62
62
  const templatesDir = join(__extensionDir, "templates");
63
63
  /**
64
64
  * Return the resolved templates directory path for use in prompts.
65
- * Avoids hardcoding `~/.gsd/agent/extensions/gsd/templates/` in templates. (#3575)
65
+ * Avoids hardcoding the user-local templates directory in templates. (#3575)
66
66
  */
67
67
  export function getTemplatesDir() {
68
68
  return templatesDir;
@@ -138,6 +138,10 @@ export function loadPrompt(name, vars = {}) {
138
138
  templateCache.set(name, content);
139
139
  }
140
140
  const effectiveVars = {
141
+ templatesDir: getTemplatesDir(),
142
+ planTemplatePath: join(getTemplatesDir(), "plan.md"),
143
+ taskPlanTemplatePath: join(getTemplatesDir(), "task-plan.md"),
144
+ taskSummaryTemplatePath: join(getTemplatesDir(), "task-summary.md"),
141
145
  skillActivation: "If a `GSD Skill Preferences` block is present in system context, use it and the `<available_skills>` catalog in your system prompt to decide which skills to load and follow for this unit, without relaxing required verification or artifact rules.",
142
146
  ...vars,
143
147
  };
@@ -6,55 +6,61 @@ You are executing GSD auto-mode.
6
6
 
7
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
8
 
9
- ## Your Role in the Pipeline
9
+ ## Mission
10
10
 
11
- All slices are done. You are closing out the milestone — verifying that the assembled work actually delivers the promised outcome, writing the milestone summary, and updating project state. The milestone summary is the final record. After you finish, the system merges the worktree back to the integration branch. If there are queued milestones, the next one starts its own research → plan → execute cycle from a clean slate — the milestone summary is how it learns what was already built.
11
+ All slices are complete. Verify the integrated work, persist milestone completion, refresh project state, and write the final record future milestones will rely on.
12
12
 
13
- Preloaded context below — the roadmap, compact slice-summary excerpts, requirements, decisions, and project context. **Slice summaries are excerpts, not full files.** They include frontmatter fields, section heads (deviations, known limitations, follow-ups), and short narrative only. When drafting LEARNINGS, the Decision Re-evaluation table, or cross-slice narrative, Read the full slice SUMMARY.md files listed under "On-demand Slice Summaries" do that selectively as needed, not preemptively.
13
+ Preloaded context includes roadmap, requirements, decisions, project context, and compact slice-summary excerpts. Slice summaries are excerpts, not full files: use them first, then selectively read full SUMMARY.md files listed under "On-demand Slice Summaries" only when section headings indicate needed evidence for LEARNINGS, Decision Re-evaluation, deviations, limitations, or cross-slice narrative.
14
14
 
15
15
  Start with what the excerpts give you. Read full files when the section heads signal richer context you need.
16
16
 
17
- **On-demand Read ordering:** Complete all slice SUMMARY Reads you need for cross-slice synthesis, the Decision Re-evaluation table, and LEARNINGS **before** calling `gsd_complete_milestone` (step 10). Once that tool runs, the milestone is marked complete in the DB running out of tool budget between step 10 and the LEARNINGS write (step 12) leaves the milestone committed without its LEARNINGS artifact.
17
+ **On-demand Read ordering:** Complete all slice SUMMARY Reads you need for cross-slice synthesis, the Decision Re-evaluation table, and LEARNINGS **before** calling `gsd_complete_milestone` (step 12). Once that tool runs, the milestone is marked complete in the DB, so it must be the final persistent milestone-closeout write.
18
18
 
19
19
  ### Delegate Review Work
20
20
 
21
- This unit runs under the `planning-dispatch` tools-policy: you may use the `subagent` tool to delegate review work that benefits from a fresh context window. For non-trivial milestones, delegate before drafting LEARNINGS:
21
+ Use `subagent` for review work needing fresh context, before drafting LEARNINGS:
22
22
 
23
- - **Cross-slice integrations or new public APIs** dispatch the **reviewer** agent with the milestone diff and roadmap; treat its findings as input to your Decision Re-evaluation and LEARNINGS sections.
24
- - **Touched auth, network, parsing, file IO, shell exec, or crypto** dispatch the **security** agent for an OWASP-style audit across the merged slices.
25
- - **Significant test surface added or changed** dispatch the **tester** agent to assess coverage gaps relative to the milestone success criteria.
23
+ - Cross-slice integrations or new public APIs -> **reviewer** with milestone diff and roadmap.
24
+ - Auth, network, parsing, file IO, shell exec, or crypto -> **security** audit.
25
+ - Significant tests added or changed -> **tester** coverage check against success criteria.
26
26
 
27
- Subagents read the diff and report findings they do **not** write user source. Apply their feedback into the milestone summary and any captured decisions before calling `gsd_complete_milestone`.
27
+ Subagents report only; they do not write user source. Fold findings into Decision Re-evaluation and LEARNINGS before completion.
28
28
 
29
29
  {{inlinedContext}}
30
30
 
31
- Then:
31
+ ## Steps
32
+
32
33
  1. Use the **Milestone Summary** output template from the inlined context above
33
34
  2. {{skillActivation}}
34
- 3. **Verify code changes exist.** Compare the milestone against its integration branch (usually `main`, `master`, or the recorded integration branch), using the merge-base as the older revision and `HEAD` as the newer revision. If that branch diff lists non-`.gsd/` files, code-change verification passes. If `HEAD` is already the same commit as the integration branch/merge-base (a retry-on-main self-diff), do **not** treat the empty branch diff as proof of missing code. Instead, inspect milestone-scoped commit evidence such as recent commits with `GSD-Unit: {{milestoneId}}` or production `GSD-Task: Sxx/Tyy` trailers whose diff also touches `.gsd/milestones/{{milestoneId}}/`, then check those commits for non-`.gsd/` files. Only record a **verification failure** when neither the branch diff nor milestone-scoped commit evidence shows implementation files.
35
- 4. Verify each **success criterion** from the milestone definition in `{{roadmapPath}}`. For each criterion, confirm it was met with specific evidence from slice summaries, test results, or observable behavior. Record any criterion that was NOT met as a **verification failure**.
36
- 5. Verify the milestone's **definition of done** all slices are `[x]`, all slice summaries exist, and any cross-slice integration points work correctly. Record any unmet items as a **verification failure**.
37
- 6. If the roadmap includes a **Horizontal Checklist**, verify each item was addressed during the milestone. Note unchecked items in the milestone summary.
38
- 7. Fill the **Decision Re-evaluation** table in the milestone summary. For each key decision from `.gsd/DECISIONS.md` made during this milestone, evaluate whether it is still valid given what was actually built. Flag decisions that should be revisited next milestone.
39
- 8. Validate **requirement status transitions**. For each requirement that changed status during this milestone, confirm the transition is supported by evidence. Requirements can move between Active, Validated, Deferred, Blocked, or Out of Scope — but only with proof.
35
+ 3. **Verify code changes exist.** Compare milestone work against the integration branch (`main`, `master`, or recorded branch), using merge-base as older revision and `HEAD` as newer. If the diff lists non-`.gsd/` files, pass. If `HEAD` equals the integration branch/merge-base, treat it as a self-diff retry: inspect milestone-scoped commit evidence (`GSD-Unit: {{milestoneId}}` or production `GSD-Task: Sxx/Tyy` trailers touching `.gsd/milestones/{{milestoneId}}/`) and verify those commits touched non-`.gsd/` files. Record **verification failure** only when neither source shows implementation files.
36
+ 4. Verify every **success criterion** from `{{roadmapPath}}` with evidence from summaries, tests, or observable behavior. Record unmet criteria as **verification failure**.
37
+ 5. Verify **definition of done**: all slices `[x]`, summaries exist, and integrations work. Record unmet items as **verification failure**.
38
+ 6. If the roadmap includes a **Horizontal Checklist**, verify each item and note unchecked items in the summary.
39
+ 7. Fill the **Decision Re-evaluation** table: compare each key `.gsd/DECISIONS.md` decision from this milestone with what shipped, and flag decisions to revisit.
40
+ 8. Validate **requirement status transitions**. For each changed requirement, confirm evidence supports the new status. Requirements may move between Active, Validated, Deferred, Blocked, or Out of Scope only with proof.
40
41
 
41
- **DB access safety:** Do NOT query `.gsd/gsd.db` directly via `sqlite3` or `node -e require('better-sqlite3')` the engine owns the WAL connection. Use `gsd_milestone_status` to read milestone and slice state. All data you need is already inlined in the context above or accessible via the `gsd_*` tools never via direct SQL.
42
+ **DB access safety:** Do NOT query `.gsd/gsd.db` directly via `sqlite3` or `node -e require('better-sqlite3')`; the engine owns the WAL connection. Use `gsd_milestone_status`, inlined context, or `gsd_*` tools; never direct SQL.
42
43
 
43
44
  ### Verification Gate — STOP if verification failed
44
45
 
45
- **If ANY verification failure was recorded in steps 3, 4, or 5, you MUST follow the failure path below. Do NOT proceed to step 10.**
46
+ **If ANY verification failure was recorded in steps 3, 4, or 5, you MUST follow the failure path below. Do NOT proceed with steps 9–13.**
46
47
 
47
48
  **Failure path** (verification failed):
48
- - Do NOT call `gsd_complete_milestone` — the milestone must not be marked as complete.
49
+ - Do NOT call `gsd_complete_milestone`.
49
50
  - Do NOT update `.gsd/PROJECT.md` to reflect completion.
50
- - Do NOT update `.gsd/REQUIREMENTS.md` to mark requirements as validated.
51
- - Write a clear summary of what failed and why to help the next attempt.
51
+ - Do NOT update `.gsd/REQUIREMENTS.md` to mark requirements validated.
52
+ - Write a clear failed-verification summary for the next attempt.
52
53
  - Say: "Milestone {{milestoneId}} verification FAILED — not complete." and stop.
53
54
 
54
- **Success path** (all verifications passed — continue with steps 9–13):
55
+ **Success path** (all verifications passed):
55
56
 
56
57
  9. For each requirement whose status changed in step 8, call `gsd_requirement_update` with the requirement ID and updated `status` and `validation` fields — the tool regenerates `.gsd/REQUIREMENTS.md` automatically. Do this BEFORE completing the milestone so requirement updates are persisted.
57
- 10. **Persist completion through `gsd_complete_milestone`.** Call it with the parameters below. The tool updates the milestone status in the DB, renders `{{milestoneSummaryPath}}`, and validates all slices are complete before proceeding.
58
+ 10. Update `.gsd/PROJECT.md`: use the `write` tool with `path: ".gsd/PROJECT.md"` and `content` containing the full updated document reflecting milestone completion and current project state. Do NOT use the `edit` tool for this PROJECT.md is a full-document refresh.
59
+ 11. Extract structured learnings from this milestone and persist them to the GSD memory store. Follow the procedure block immediately below — it writes `{{milestoneId}}-LEARNINGS.md` as the audit trail and persists Patterns, Lessons, and Decisions via `capture_thought` (categories: pattern, gotcha/convention, architecture). The memory store is the single source of truth for cross-session durable knowledge (ADR-013).
60
+
61
+ {{extractLearningsSteps}}
62
+
63
+ 12. **Persist completion through `gsd_complete_milestone`.** Call it with the parameters below. This must be the final persistent write in the unit. The tool updates the milestone status in the DB, renders `{{milestoneSummaryPath}}`, and validates all slices are complete.
58
64
 
59
65
  **Required parameters:**
60
66
  - `milestoneId` (string) — Milestone ID (e.g. M001)
@@ -67,19 +73,15 @@ Then:
67
73
  - `keyDecisions` (array of strings) — Key architectural/pattern decisions made during the milestone
68
74
  - `keyFiles` (array of strings) — Key files created or modified during the milestone
69
75
  - `lessonsLearned` (array of strings) — Lessons learned during the milestone
70
- - `verificationPassed` (boolean) — Must be `true` confirms that code change verification, success criteria, and definition of done checks all passed before completion
76
+ - `verificationPassed` (boolean) — Must be `true`; confirms code-change verification, success criteria, and definition-of-done checks all passed
71
77
 
72
78
  **Optional parameters:**
73
79
  - `followUps` (string) — Follow-up items for future milestones
74
80
  - `deviations` (string) — Deviations from the original plan
75
- 11. Update `.gsd/PROJECT.md`: use the `write` tool with `path: ".gsd/PROJECT.md"` and `content` containing the full updated document reflecting milestone completion and current project state. Do NOT use the `edit` tool for this — PROJECT.md is a full-document refresh.
76
- 12. Extract structured learnings from this milestone and persist them to the GSD memory store. Follow the procedure block immediately below — it writes `{{milestoneId}}-LEARNINGS.md` as the audit trail and persists Patterns, Lessons, and Decisions via `capture_thought` (categories: pattern, gotcha/convention, architecture). The memory store is the single source of truth for cross-session durable knowledge (ADR-013).
77
-
78
- {{extractLearningsSteps}}
79
81
 
80
82
  13. Do not commit manually — the system auto-commits your changes after this unit completes.
81
83
  - Say: "Milestone {{milestoneId}} complete."
82
84
 
83
- **Important:** Do NOT skip the code change verification, success criteria, or definition of done verification (steps 3-5). The milestone summary must reflect actual verified outcomes, not assumed success. Verification failures BLOCK completion there is no override. The milestone stays in its current state until issues are resolved and verification is re-run. **If a verification tool itself fails, errors, or returns unexpected output, treat it as a verification failure** — never rationalize past a tool error ("tool didn't respond, assuming success" is forbidden). A tool that cannot verify is a tool that did not verify.
85
+ **Important:** Do NOT skip code-change, success-criteria, or definition-of-done verification (steps 3-5). The summary must reflect verified outcomes. Verification failures block completion; there is no override. If a verification tool fails, errors, or returns unexpected output, treat it as failure.
84
86
 
85
- **File system safety:** When scanning milestone directories for evidence, use `ls` or `find` to list directory contents first never pass a directory path (e.g. `tasks/`, `slices/`) directly to the `read` tool. The `read` tool only accepts file paths, not directories.
87
+ **File system safety:** When scanning milestone directories for evidence, use `ls` or `find` first. Never pass a directory path (e.g. `tasks/`, `slices/`) to `read`; it only accepts file paths.