gsd-pi 2.75.0 → 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 (1031) hide show
  1. package/README.md +208 -151
  2. package/dist/claude-cli-check.d.ts +10 -0
  3. package/dist/claude-cli-check.js +13 -3
  4. package/dist/headless-events.d.ts +1 -1
  5. package/dist/headless-events.js +5 -2
  6. package/dist/headless.js +5 -6
  7. package/dist/loader.js +0 -0
  8. package/dist/onboarding.d.ts +20 -1
  9. package/dist/onboarding.js +99 -39
  10. package/dist/resources/agents/researcher.md +1 -1
  11. package/dist/resources/extensions/ask-user-questions.js +17 -5
  12. package/dist/resources/extensions/claude-code-cli/models.js +9 -0
  13. package/dist/resources/extensions/claude-code-cli/readiness.js +34 -2
  14. package/dist/resources/extensions/claude-code-cli/stream-adapter.js +76 -4
  15. package/dist/resources/extensions/gsd/auto/detect-stuck.js +9 -0
  16. package/dist/resources/extensions/gsd/auto/loop.js +67 -4
  17. package/dist/resources/extensions/gsd/auto/phases.js +118 -53
  18. package/dist/resources/extensions/gsd/auto/resolve.js +1 -1
  19. package/dist/resources/extensions/gsd/auto/run-unit.js +10 -1
  20. package/dist/resources/extensions/gsd/auto/session.js +5 -0
  21. package/dist/resources/extensions/gsd/auto-artifact-paths.js +20 -0
  22. package/dist/resources/extensions/gsd/auto-dashboard.js +37 -8
  23. package/dist/resources/extensions/gsd/auto-direct-dispatch.js +8 -2
  24. package/dist/resources/extensions/gsd/auto-dispatch.js +120 -14
  25. package/dist/resources/extensions/gsd/auto-loop.js +1 -1
  26. package/dist/resources/extensions/gsd/auto-model-selection.js +27 -6
  27. package/dist/resources/extensions/gsd/auto-post-unit.js +10 -8
  28. package/dist/resources/extensions/gsd/auto-prompts.js +190 -46
  29. package/dist/resources/extensions/gsd/auto-recovery.js +57 -0
  30. package/dist/resources/extensions/gsd/auto-start.js +5 -3
  31. package/dist/resources/extensions/gsd/auto-verification.js +36 -3
  32. package/dist/resources/extensions/gsd/auto-worktree.js +71 -2
  33. package/dist/resources/extensions/gsd/auto.js +57 -25
  34. package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +8 -21
  35. package/dist/resources/extensions/gsd/bootstrap/db-tools.js +45 -23
  36. package/dist/resources/extensions/gsd/bootstrap/memory-tools.js +131 -0
  37. package/dist/resources/extensions/gsd/bootstrap/query-tools.js +29 -0
  38. package/dist/resources/extensions/gsd/bootstrap/register-extension.js +12 -0
  39. package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +22 -0
  40. package/dist/resources/extensions/gsd/bootstrap/system-context.js +84 -10
  41. package/dist/resources/extensions/gsd/commands/catalog.js +81 -9
  42. package/dist/resources/extensions/gsd/commands/handlers/core.js +64 -24
  43. package/dist/resources/extensions/gsd/commands/handlers/escalate.js +171 -0
  44. package/dist/resources/extensions/gsd/commands/handlers/onboarding.js +159 -0
  45. package/dist/resources/extensions/gsd/commands/handlers/ops.js +21 -0
  46. package/dist/resources/extensions/gsd/commands/handlers/workflow.js +228 -29
  47. package/dist/resources/extensions/gsd/commands-cmux.js +5 -2
  48. package/dist/resources/extensions/gsd/commands-config.js +5 -0
  49. package/dist/resources/extensions/gsd/commands-debug.js +388 -0
  50. package/dist/resources/extensions/gsd/commands-do.js +1 -0
  51. package/dist/resources/extensions/gsd/commands-extract-learnings.js +200 -77
  52. package/dist/resources/extensions/gsd/commands-handlers.js +21 -2
  53. package/dist/resources/extensions/gsd/commands-memory.js +462 -0
  54. package/dist/resources/extensions/gsd/commands-prefs-wizard.js +40 -12
  55. package/dist/resources/extensions/gsd/commands-scan.js +94 -0
  56. package/dist/resources/extensions/gsd/commands-workflow-templates.js +101 -2
  57. package/dist/resources/extensions/gsd/custom-workflow-engine.js +74 -54
  58. package/dist/resources/extensions/gsd/db-writer.js +89 -16
  59. package/dist/resources/extensions/gsd/debug-session-store.js +238 -0
  60. package/dist/resources/extensions/gsd/definition-loader.js +7 -0
  61. package/dist/resources/extensions/gsd/docs/preferences-reference.md +9 -9
  62. package/dist/resources/extensions/gsd/doctor-environment.js +2 -1
  63. package/dist/resources/extensions/gsd/doctor-git-checks.js +50 -32
  64. package/dist/resources/extensions/gsd/doctor-proactive.js +4 -1
  65. package/dist/resources/extensions/gsd/doctor-providers.js +96 -22
  66. package/dist/resources/extensions/gsd/doctor-runtime-checks.js +22 -4
  67. package/dist/resources/extensions/gsd/doctor.js +7 -1
  68. package/dist/resources/extensions/gsd/ecosystem/gsd-extension-api.js +1 -0
  69. package/dist/resources/extensions/gsd/error-classifier.js +6 -3
  70. package/dist/resources/extensions/gsd/escalation.js +321 -0
  71. package/dist/resources/extensions/gsd/forensics.js +26 -29
  72. package/dist/resources/extensions/gsd/git-service.js +0 -1
  73. package/dist/resources/extensions/gsd/graph.js +26 -2
  74. package/dist/resources/extensions/gsd/gsd-db.js +517 -32
  75. package/dist/resources/extensions/gsd/health-widget-core.js +42 -14
  76. package/dist/resources/extensions/gsd/health-widget.js +7 -4
  77. package/dist/resources/extensions/gsd/hook-emitter.js +108 -0
  78. package/dist/resources/extensions/gsd/init-wizard.js +86 -45
  79. package/dist/resources/extensions/gsd/markdown-renderer.js +5 -5
  80. package/dist/resources/extensions/gsd/memory-backfill.js +126 -0
  81. package/dist/resources/extensions/gsd/memory-embeddings.js +219 -0
  82. package/dist/resources/extensions/gsd/memory-extractor.js +78 -27
  83. package/dist/resources/extensions/gsd/memory-ingest.js +218 -0
  84. package/dist/resources/extensions/gsd/memory-relations.js +189 -0
  85. package/dist/resources/extensions/gsd/memory-source-store.js +113 -0
  86. package/dist/resources/extensions/gsd/memory-store.js +318 -6
  87. package/dist/resources/extensions/gsd/metrics.js +1 -0
  88. package/dist/resources/extensions/gsd/model-cost-table.js +3 -1
  89. package/dist/resources/extensions/gsd/model-router.js +16 -6
  90. package/dist/resources/extensions/gsd/native-git-bridge.js +137 -5
  91. package/dist/resources/extensions/gsd/notification-overlay.js +7 -22
  92. package/dist/resources/extensions/gsd/notification-widget.js +24 -39
  93. package/dist/resources/extensions/gsd/notifications.js +4 -0
  94. package/dist/resources/extensions/gsd/onboarding-state.js +133 -0
  95. package/dist/resources/extensions/gsd/post-execution-checks.js +27 -11
  96. package/dist/resources/extensions/gsd/pre-execution-checks.js +105 -8
  97. package/dist/resources/extensions/gsd/preferences-models.js +1 -0
  98. package/dist/resources/extensions/gsd/preferences-types.js +2 -1
  99. package/dist/resources/extensions/gsd/preferences-validation.js +42 -8
  100. package/dist/resources/extensions/gsd/preferences.js +10 -10
  101. package/dist/resources/extensions/gsd/prompts/add-tests.md +1 -0
  102. package/dist/resources/extensions/gsd/prompts/complete-milestone.md +4 -1
  103. package/dist/resources/extensions/gsd/prompts/complete-slice.md +2 -2
  104. package/dist/resources/extensions/gsd/prompts/debug-diagnose.md +27 -0
  105. package/dist/resources/extensions/gsd/prompts/debug-session-manager.md +80 -0
  106. package/dist/resources/extensions/gsd/prompts/execute-task.md +16 -3
  107. package/dist/resources/extensions/gsd/prompts/plan-milestone.md +12 -0
  108. package/dist/resources/extensions/gsd/prompts/plan-slice.md +2 -0
  109. package/dist/resources/extensions/gsd/prompts/refine-slice.md +69 -0
  110. package/dist/resources/extensions/gsd/prompts/research-slice.md +1 -0
  111. package/dist/resources/extensions/gsd/prompts/scan.md +79 -0
  112. package/dist/resources/extensions/gsd/prompts/workflow-oneshot.md +26 -0
  113. package/dist/resources/extensions/gsd/python-resolver.js +70 -0
  114. package/dist/resources/extensions/gsd/run-manager.js +37 -17
  115. package/dist/resources/extensions/gsd/setup-catalog.js +75 -0
  116. package/dist/resources/extensions/gsd/state.js +90 -7
  117. package/dist/resources/extensions/gsd/templates/PREFERENCES.md +7 -7
  118. package/dist/resources/extensions/gsd/tools/complete-task.js +80 -0
  119. package/dist/resources/extensions/gsd/tools/memory-tools.js +331 -0
  120. package/dist/resources/extensions/gsd/tools/plan-milestone.js +37 -12
  121. package/dist/resources/extensions/gsd/tools/plan-slice.js +5 -2
  122. package/dist/resources/extensions/gsd/tools/skip-slice.js +78 -0
  123. package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +14 -0
  124. package/dist/resources/extensions/gsd/uok/flags.js +7 -7
  125. package/dist/resources/extensions/gsd/uok/kernel.js +8 -3
  126. package/dist/resources/extensions/gsd/verification-gate.js +2 -1
  127. package/dist/resources/extensions/gsd/workflow-dispatch.js +64 -0
  128. package/dist/resources/extensions/gsd/workflow-install.js +327 -0
  129. package/dist/resources/extensions/gsd/workflow-manifest.js +8 -0
  130. package/dist/resources/extensions/gsd/workflow-mcp.js +1 -6
  131. package/dist/resources/extensions/gsd/workflow-plugins.js +346 -0
  132. package/dist/resources/extensions/gsd/workflow-projections.js +17 -15
  133. package/dist/resources/extensions/gsd/workflow-templates/accessibility-audit.md +88 -0
  134. package/dist/resources/extensions/gsd/workflow-templates/api-breaking-change.md +117 -0
  135. package/dist/resources/extensions/gsd/workflow-templates/bugfix.md +1 -0
  136. package/dist/resources/extensions/gsd/workflow-templates/changelog-gen.md +82 -0
  137. package/dist/resources/extensions/gsd/workflow-templates/ci-bootstrap.md +144 -0
  138. package/dist/resources/extensions/gsd/workflow-templates/dead-code.md +81 -0
  139. package/dist/resources/extensions/gsd/workflow-templates/dep-upgrade.md +1 -0
  140. package/dist/resources/extensions/gsd/workflow-templates/docs-sync.yaml +76 -0
  141. package/dist/resources/extensions/gsd/workflow-templates/env-audit.yaml +88 -0
  142. package/dist/resources/extensions/gsd/workflow-templates/full-project.md +1 -0
  143. package/dist/resources/extensions/gsd/workflow-templates/hotfix.md +1 -0
  144. package/dist/resources/extensions/gsd/workflow-templates/issue-triage.md +84 -0
  145. package/dist/resources/extensions/gsd/workflow-templates/observability-setup.md +133 -0
  146. package/dist/resources/extensions/gsd/workflow-templates/onboarding-check.md +74 -0
  147. package/dist/resources/extensions/gsd/workflow-templates/performance-audit.md +125 -0
  148. package/dist/resources/extensions/gsd/workflow-templates/pr-review.md +67 -0
  149. package/dist/resources/extensions/gsd/workflow-templates/pr-triage.md +83 -0
  150. package/dist/resources/extensions/gsd/workflow-templates/refactor.md +1 -0
  151. package/dist/resources/extensions/gsd/workflow-templates/registry.json +184 -0
  152. package/dist/resources/extensions/gsd/workflow-templates/release.md +118 -0
  153. package/dist/resources/extensions/gsd/workflow-templates/rename-symbol.yaml +99 -0
  154. package/dist/resources/extensions/gsd/workflow-templates/security-audit.md +1 -0
  155. package/dist/resources/extensions/gsd/workflow-templates/small-feature.md +1 -0
  156. package/dist/resources/extensions/gsd/workflow-templates/spike.md +7 -0
  157. package/dist/resources/extensions/gsd/workflow-templates/test-backfill.yaml +73 -0
  158. package/dist/resources/extensions/gsd/worktree-resolver.js +42 -1
  159. package/dist/resources/extensions/remote-questions/commands.js +380 -0
  160. package/dist/resources/extensions/remote-questions/manager.js +39 -5
  161. package/dist/resources/extensions/remote-questions/telegram-adapter.js +79 -4
  162. package/dist/resources/extensions/search-the-web/command-search-provider.js +4 -1
  163. package/dist/resources/extensions/search-the-web/native-search.js +13 -2
  164. package/dist/resources/extensions/shared/interview-ui.js +189 -1
  165. package/dist/resources/extensions/shared/layout-utils.js +17 -0
  166. package/dist/resources/extensions/shared/rtk-shared.js +47 -0
  167. package/dist/resources/extensions/shared/rtk.js +3 -46
  168. package/dist/resources/skills/api-design/SKILL.md +190 -0
  169. package/dist/resources/skills/create-mcp-server/SKILL.md +121 -0
  170. package/dist/resources/skills/create-workflow/SKILL.md +33 -6
  171. package/dist/resources/skills/decompose-into-slices/SKILL.md +139 -0
  172. package/dist/resources/skills/dependency-upgrade/SKILL.md +158 -0
  173. package/dist/resources/skills/design-an-interface/SKILL.md +102 -0
  174. package/dist/resources/skills/forensics/SKILL.md +153 -0
  175. package/dist/resources/skills/grill-me/SKILL.md +93 -0
  176. package/dist/resources/skills/handoff/SKILL.md +121 -0
  177. package/dist/resources/skills/observability/SKILL.md +174 -0
  178. package/dist/resources/skills/security-review/SKILL.md +181 -0
  179. package/dist/resources/skills/spike-wrap-up/SKILL.md +138 -0
  180. package/dist/resources/skills/tdd/SKILL.md +112 -0
  181. package/dist/resources/skills/verify-before-complete/SKILL.md +97 -0
  182. package/dist/resources/skills/write-docs/SKILL.md +81 -0
  183. package/dist/resources/skills/write-milestone-brief/SKILL.md +135 -0
  184. package/dist/rtk-shared.d.ts +10 -0
  185. package/dist/rtk-shared.js +47 -0
  186. package/dist/rtk.d.ts +2 -6
  187. package/dist/rtk.js +3 -48
  188. package/dist/shared/workspace-types.d.ts +52 -0
  189. package/dist/shared/workspace-types.js +1 -0
  190. package/dist/tsconfig.extensions.tsbuildinfo +1 -1
  191. package/dist/update-check.d.ts +10 -0
  192. package/dist/update-check.js +24 -3
  193. package/dist/web/standalone/.next/BUILD_ID +1 -1
  194. package/dist/web/standalone/.next/app-path-routes-manifest.json +13 -13
  195. package/dist/web/standalone/.next/build-manifest.json +4 -4
  196. package/dist/web/standalone/.next/prerender-manifest.json +3 -3
  197. package/dist/web/standalone/.next/react-loadable-manifest.json +2 -2
  198. package/dist/web/standalone/.next/required-server-files.json +4 -4
  199. package/dist/web/standalone/.next/server/app/_global-error/page.js +3 -3
  200. package/dist/web/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  201. package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
  202. package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
  203. package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  204. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  205. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  206. package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  207. package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  208. package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  209. package/dist/web/standalone/.next/server/app/_not-found/page.js +2 -2
  210. package/dist/web/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  211. package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
  212. package/dist/web/standalone/.next/server/app/_not-found.rsc +4 -4
  213. package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +4 -4
  214. package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  215. package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +4 -4
  216. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  217. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  218. package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  219. package/dist/web/standalone/.next/server/app/api/boot/route.js +1 -1
  220. package/dist/web/standalone/.next/server/app/api/boot/route.js.nft.json +1 -1
  221. package/dist/web/standalone/.next/server/app/api/boot/route_client-reference-manifest.js +1 -1
  222. package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js +1 -1
  223. package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js.nft.json +1 -1
  224. package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route_client-reference-manifest.js +1 -1
  225. package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js +1 -1
  226. package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js.nft.json +1 -1
  227. package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route_client-reference-manifest.js +1 -1
  228. package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js +2 -2
  229. package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js.nft.json +1 -1
  230. package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route_client-reference-manifest.js +1 -1
  231. package/dist/web/standalone/.next/server/app/api/browse-directories/route.js +1 -1
  232. package/dist/web/standalone/.next/server/app/api/browse-directories/route_client-reference-manifest.js +1 -1
  233. package/dist/web/standalone/.next/server/app/api/captures/route.js +1 -1
  234. package/dist/web/standalone/.next/server/app/api/captures/route.js.nft.json +1 -1
  235. package/dist/web/standalone/.next/server/app/api/captures/route_client-reference-manifest.js +1 -1
  236. package/dist/web/standalone/.next/server/app/api/cleanup/route.js +1 -1
  237. package/dist/web/standalone/.next/server/app/api/cleanup/route.js.nft.json +1 -1
  238. package/dist/web/standalone/.next/server/app/api/cleanup/route_client-reference-manifest.js +1 -1
  239. package/dist/web/standalone/.next/server/app/api/dev-mode/route.js +1 -1
  240. package/dist/web/standalone/.next/server/app/api/dev-mode/route_client-reference-manifest.js +1 -1
  241. package/dist/web/standalone/.next/server/app/api/doctor/route.js +1 -1
  242. package/dist/web/standalone/.next/server/app/api/doctor/route.js.nft.json +1 -1
  243. package/dist/web/standalone/.next/server/app/api/doctor/route_client-reference-manifest.js +1 -1
  244. package/dist/web/standalone/.next/server/app/api/experimental/route.js +2 -2
  245. package/dist/web/standalone/.next/server/app/api/experimental/route_client-reference-manifest.js +1 -1
  246. package/dist/web/standalone/.next/server/app/api/export-data/route.js +1 -1
  247. package/dist/web/standalone/.next/server/app/api/export-data/route.js.nft.json +1 -1
  248. package/dist/web/standalone/.next/server/app/api/export-data/route_client-reference-manifest.js +1 -1
  249. package/dist/web/standalone/.next/server/app/api/files/route.js +1 -1
  250. package/dist/web/standalone/.next/server/app/api/files/route.js.nft.json +1 -1
  251. package/dist/web/standalone/.next/server/app/api/files/route_client-reference-manifest.js +1 -1
  252. package/dist/web/standalone/.next/server/app/api/forensics/route.js +1 -1
  253. package/dist/web/standalone/.next/server/app/api/forensics/route.js.nft.json +1 -1
  254. package/dist/web/standalone/.next/server/app/api/forensics/route_client-reference-manifest.js +1 -1
  255. package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
  256. package/dist/web/standalone/.next/server/app/api/git/route.js.nft.json +1 -1
  257. package/dist/web/standalone/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
  258. package/dist/web/standalone/.next/server/app/api/history/route.js +1 -1
  259. package/dist/web/standalone/.next/server/app/api/history/route.js.nft.json +1 -1
  260. package/dist/web/standalone/.next/server/app/api/history/route_client-reference-manifest.js +1 -1
  261. package/dist/web/standalone/.next/server/app/api/hooks/route.js +1 -1
  262. package/dist/web/standalone/.next/server/app/api/hooks/route.js.nft.json +1 -1
  263. package/dist/web/standalone/.next/server/app/api/hooks/route_client-reference-manifest.js +1 -1
  264. package/dist/web/standalone/.next/server/app/api/inspect/route.js +1 -1
  265. package/dist/web/standalone/.next/server/app/api/inspect/route.js.nft.json +1 -1
  266. package/dist/web/standalone/.next/server/app/api/inspect/route_client-reference-manifest.js +1 -1
  267. package/dist/web/standalone/.next/server/app/api/knowledge/route.js +1 -1
  268. package/dist/web/standalone/.next/server/app/api/knowledge/route.js.nft.json +1 -1
  269. package/dist/web/standalone/.next/server/app/api/knowledge/route_client-reference-manifest.js +1 -1
  270. package/dist/web/standalone/.next/server/app/api/live-state/route.js +1 -1
  271. package/dist/web/standalone/.next/server/app/api/live-state/route.js.nft.json +1 -1
  272. package/dist/web/standalone/.next/server/app/api/live-state/route_client-reference-manifest.js +1 -1
  273. package/dist/web/standalone/.next/server/app/api/notifications/route.js +2 -2
  274. package/dist/web/standalone/.next/server/app/api/notifications/route.js.nft.json +1 -1
  275. package/dist/web/standalone/.next/server/app/api/notifications/route_client-reference-manifest.js +1 -1
  276. package/dist/web/standalone/.next/server/app/api/onboarding/route.js +1 -1
  277. package/dist/web/standalone/.next/server/app/api/onboarding/route.js.nft.json +1 -1
  278. package/dist/web/standalone/.next/server/app/api/onboarding/route_client-reference-manifest.js +1 -1
  279. package/dist/web/standalone/.next/server/app/api/preferences/route.js +1 -1
  280. package/dist/web/standalone/.next/server/app/api/preferences/route_client-reference-manifest.js +1 -1
  281. package/dist/web/standalone/.next/server/app/api/projects/route.js +1 -1
  282. package/dist/web/standalone/.next/server/app/api/projects/route.js.nft.json +1 -1
  283. package/dist/web/standalone/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
  284. package/dist/web/standalone/.next/server/app/api/recovery/route.js +1 -1
  285. package/dist/web/standalone/.next/server/app/api/recovery/route.js.nft.json +1 -1
  286. package/dist/web/standalone/.next/server/app/api/recovery/route_client-reference-manifest.js +1 -1
  287. package/dist/web/standalone/.next/server/app/api/remote-questions/route.js +2 -2
  288. package/dist/web/standalone/.next/server/app/api/remote-questions/route_client-reference-manifest.js +1 -1
  289. package/dist/web/standalone/.next/server/app/api/session/browser/route.js +1 -1
  290. package/dist/web/standalone/.next/server/app/api/session/browser/route.js.nft.json +1 -1
  291. package/dist/web/standalone/.next/server/app/api/session/browser/route_client-reference-manifest.js +1 -1
  292. package/dist/web/standalone/.next/server/app/api/session/command/route.js +1 -1
  293. package/dist/web/standalone/.next/server/app/api/session/command/route.js.nft.json +1 -1
  294. package/dist/web/standalone/.next/server/app/api/session/command/route_client-reference-manifest.js +1 -1
  295. package/dist/web/standalone/.next/server/app/api/session/events/route.js +2 -2
  296. package/dist/web/standalone/.next/server/app/api/session/events/route.js.nft.json +1 -1
  297. package/dist/web/standalone/.next/server/app/api/session/events/route_client-reference-manifest.js +1 -1
  298. package/dist/web/standalone/.next/server/app/api/session/manage/route.js +1 -1
  299. package/dist/web/standalone/.next/server/app/api/session/manage/route.js.nft.json +1 -1
  300. package/dist/web/standalone/.next/server/app/api/session/manage/route_client-reference-manifest.js +1 -1
  301. package/dist/web/standalone/.next/server/app/api/settings-data/route.js +1 -1
  302. package/dist/web/standalone/.next/server/app/api/settings-data/route.js.nft.json +1 -1
  303. package/dist/web/standalone/.next/server/app/api/settings-data/route_client-reference-manifest.js +1 -1
  304. package/dist/web/standalone/.next/server/app/api/shutdown/route.js +1 -1
  305. package/dist/web/standalone/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
  306. package/dist/web/standalone/.next/server/app/api/skill-health/route.js +1 -1
  307. package/dist/web/standalone/.next/server/app/api/skill-health/route.js.nft.json +1 -1
  308. package/dist/web/standalone/.next/server/app/api/skill-health/route_client-reference-manifest.js +1 -1
  309. package/dist/web/standalone/.next/server/app/api/steer/route.js +1 -1
  310. package/dist/web/standalone/.next/server/app/api/steer/route.js.nft.json +1 -1
  311. package/dist/web/standalone/.next/server/app/api/steer/route_client-reference-manifest.js +1 -1
  312. package/dist/web/standalone/.next/server/app/api/switch-root/route.js +1 -1
  313. package/dist/web/standalone/.next/server/app/api/switch-root/route.js.nft.json +1 -1
  314. package/dist/web/standalone/.next/server/app/api/switch-root/route_client-reference-manifest.js +1 -1
  315. package/dist/web/standalone/.next/server/app/api/terminal/input/route.js +2 -2
  316. package/dist/web/standalone/.next/server/app/api/terminal/input/route_client-reference-manifest.js +1 -1
  317. package/dist/web/standalone/.next/server/app/api/terminal/resize/route.js +2 -2
  318. package/dist/web/standalone/.next/server/app/api/terminal/resize/route_client-reference-manifest.js +1 -1
  319. package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js +2 -2
  320. package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js.nft.json +1 -1
  321. package/dist/web/standalone/.next/server/app/api/terminal/sessions/route_client-reference-manifest.js +1 -1
  322. package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js +4 -4
  323. package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js.nft.json +1 -1
  324. package/dist/web/standalone/.next/server/app/api/terminal/stream/route_client-reference-manifest.js +1 -1
  325. package/dist/web/standalone/.next/server/app/api/terminal/upload/route.js +1 -1
  326. package/dist/web/standalone/.next/server/app/api/terminal/upload/route_client-reference-manifest.js +1 -1
  327. package/dist/web/standalone/.next/server/app/api/undo/route.js +1 -1
  328. package/dist/web/standalone/.next/server/app/api/undo/route.js.nft.json +1 -1
  329. package/dist/web/standalone/.next/server/app/api/undo/route_client-reference-manifest.js +1 -1
  330. package/dist/web/standalone/.next/server/app/api/update/route.js +1 -1
  331. package/dist/web/standalone/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
  332. package/dist/web/standalone/.next/server/app/api/visualizer/route.js +1 -1
  333. package/dist/web/standalone/.next/server/app/api/visualizer/route.js.nft.json +1 -1
  334. package/dist/web/standalone/.next/server/app/api/visualizer/route_client-reference-manifest.js +1 -1
  335. package/dist/web/standalone/.next/server/app/index.html +1 -1
  336. package/dist/web/standalone/.next/server/app/index.rsc +5 -5
  337. package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  338. package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +5 -5
  339. package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  340. package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +4 -4
  341. package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  342. package/dist/web/standalone/.next/server/app/page.js +2 -2
  343. package/dist/web/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  344. package/dist/web/standalone/.next/server/app-paths-manifest.json +13 -13
  345. package/dist/web/standalone/.next/server/chunks/63.js +3 -3
  346. package/dist/web/standalone/.next/server/chunks/6897.js +3 -3
  347. package/dist/web/standalone/.next/server/chunks/7461.js +1 -0
  348. package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
  349. package/dist/web/standalone/.next/server/middleware-manifest.json +5 -5
  350. package/dist/web/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
  351. package/dist/web/standalone/.next/server/middleware.js +2 -2
  352. package/dist/web/standalone/.next/server/next-font-manifest.js +1 -1
  353. package/dist/web/standalone/.next/server/next-font-manifest.json +1 -1
  354. package/dist/web/standalone/.next/server/pages/404.html +1 -1
  355. package/dist/web/standalone/.next/server/pages/500.html +1 -1
  356. package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
  357. package/dist/web/standalone/.next/static/chunks/2826.e59e8578e2e28639.js +9 -0
  358. package/dist/web/standalone/.next/static/chunks/{2008.71ee9230ad78df21.js → 3621.fc7480022c972438.js} +2 -2
  359. package/dist/web/standalone/.next/static/chunks/app/_not-found/{page-2f24283c162b6ab3.js → page-f2a7482d42a5614b.js} +1 -1
  360. package/dist/web/standalone/.next/static/chunks/app/{layout-9ecfd95f343793f0.js → layout-a16c7a7ecdf0c2cf.js} +1 -1
  361. package/dist/web/standalone/.next/static/chunks/app/page-5b113fd32bc2a1c3.js +1 -0
  362. package/dist/web/standalone/.next/static/chunks/main-app-fdab67f7802d7832.js +1 -0
  363. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-459824ffb8c323dd.js +1 -0
  364. package/dist/web/standalone/.next/static/chunks/{webpack-b868033a5834586d.js → webpack-5fc74f13a25fa1bb.js} +1 -1
  365. package/dist/web/standalone/.next/static/css/632cd626b1731d88.css +1 -0
  366. package/dist/web/standalone/node_modules/node-pty/build/Makefile +2 -2
  367. package/dist/web/standalone/node_modules/node-pty/build/Release/pty.node +0 -0
  368. package/dist/web/standalone/node_modules/node-pty/build/pty.target.mk +14 -14
  369. package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api.target.mk +14 -14
  370. package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api_except.target.mk +14 -14
  371. package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api_maybe.target.mk +14 -14
  372. package/dist/web/standalone/server.js +1 -1
  373. package/dist/welcome-screen.js +48 -24
  374. package/dist/wizard.js +2 -2
  375. package/dist/worktree-cli.d.ts +6 -5
  376. package/dist/worktree-cli.js +23 -7
  377. package/package.json +3 -3
  378. package/packages/daemon/package.json +2 -2
  379. package/packages/mcp-server/dist/server.d.ts.map +1 -1
  380. package/packages/mcp-server/dist/server.js +12 -10
  381. package/packages/mcp-server/dist/server.js.map +1 -1
  382. package/packages/mcp-server/dist/session-manager.d.ts.map +1 -1
  383. package/packages/mcp-server/dist/session-manager.js +8 -1
  384. package/packages/mcp-server/dist/session-manager.js.map +1 -1
  385. package/packages/mcp-server/dist/workflow-tools.d.ts +2 -1
  386. package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
  387. package/packages/mcp-server/dist/workflow-tools.js +306 -71
  388. package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
  389. package/packages/mcp-server/package.json +2 -2
  390. package/packages/mcp-server/src/mcp-server.test.ts +40 -4
  391. package/packages/mcp-server/src/server.ts +12 -10
  392. package/packages/mcp-server/src/session-manager.ts +10 -3
  393. package/packages/mcp-server/src/workflow-tools.test.ts +346 -1
  394. package/packages/mcp-server/src/workflow-tools.ts +359 -75
  395. package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
  396. package/packages/native/package.json +1 -1
  397. package/packages/native/tsconfig.tsbuildinfo +1 -1
  398. package/packages/pi-agent-core/dist/agent-loop.js +12 -0
  399. package/packages/pi-agent-core/dist/agent-loop.js.map +1 -1
  400. package/packages/pi-agent-core/dist/types.d.ts +30 -0
  401. package/packages/pi-agent-core/dist/types.d.ts.map +1 -1
  402. package/packages/pi-agent-core/dist/types.js.map +1 -1
  403. package/packages/pi-agent-core/package.json +1 -1
  404. package/packages/pi-agent-core/src/agent-loop.ts +14 -0
  405. package/packages/pi-agent-core/src/types.ts +34 -0
  406. package/packages/pi-agent-core/tsconfig.tsbuildinfo +1 -1
  407. package/packages/pi-ai/dist/index.d.ts +1 -0
  408. package/packages/pi-ai/dist/index.d.ts.map +1 -1
  409. package/packages/pi-ai/dist/index.js +1 -0
  410. package/packages/pi-ai/dist/index.js.map +1 -1
  411. package/packages/pi-ai/dist/models/capability-patches.d.ts.map +1 -1
  412. package/packages/pi-ai/dist/models/capability-patches.js +3 -2
  413. package/packages/pi-ai/dist/models/capability-patches.js.map +1 -1
  414. package/packages/pi-ai/dist/models/generated/amazon-bedrock.d.ts +68 -0
  415. package/packages/pi-ai/dist/models/generated/amazon-bedrock.d.ts.map +1 -1
  416. package/packages/pi-ai/dist/models/generated/amazon-bedrock.js +68 -0
  417. package/packages/pi-ai/dist/models/generated/amazon-bedrock.js.map +1 -1
  418. package/packages/pi-ai/dist/models/generated/anthropic.d.ts +17 -0
  419. package/packages/pi-ai/dist/models/generated/anthropic.d.ts.map +1 -1
  420. package/packages/pi-ai/dist/models/generated/anthropic.js +17 -0
  421. package/packages/pi-ai/dist/models/generated/anthropic.js.map +1 -1
  422. package/packages/pi-ai/dist/models/generated/google-antigravity.d.ts +17 -0
  423. package/packages/pi-ai/dist/models/generated/google-antigravity.d.ts.map +1 -1
  424. package/packages/pi-ai/dist/models/generated/google-antigravity.js +17 -0
  425. package/packages/pi-ai/dist/models/generated/google-antigravity.js.map +1 -1
  426. package/packages/pi-ai/dist/models/generated/groq.d.ts +0 -153
  427. package/packages/pi-ai/dist/models/generated/groq.d.ts.map +1 -1
  428. package/packages/pi-ai/dist/models/generated/groq.js +0 -153
  429. package/packages/pi-ai/dist/models/generated/groq.js.map +1 -1
  430. package/packages/pi-ai/dist/models/generated/index.d.ts +136 -153
  431. package/packages/pi-ai/dist/models/generated/index.d.ts.map +1 -1
  432. package/packages/pi-ai/dist/models/generated/openai-codex.d.ts +17 -0
  433. package/packages/pi-ai/dist/models/generated/openai-codex.d.ts.map +1 -1
  434. package/packages/pi-ai/dist/models/generated/openai-codex.js +17 -0
  435. package/packages/pi-ai/dist/models/generated/openai-codex.js.map +1 -1
  436. package/packages/pi-ai/dist/models/generated/openrouter.d.ts +17 -0
  437. package/packages/pi-ai/dist/models/generated/openrouter.d.ts.map +1 -1
  438. package/packages/pi-ai/dist/models/generated/openrouter.js +17 -0
  439. package/packages/pi-ai/dist/models/generated/openrouter.js.map +1 -1
  440. package/packages/pi-ai/dist/models.generated.test.js +17 -0
  441. package/packages/pi-ai/dist/models.generated.test.js.map +1 -1
  442. package/packages/pi-ai/dist/providers/amazon-bedrock.d.ts +22 -1
  443. package/packages/pi-ai/dist/providers/amazon-bedrock.d.ts.map +1 -1
  444. package/packages/pi-ai/dist/providers/amazon-bedrock.js +40 -6
  445. package/packages/pi-ai/dist/providers/amazon-bedrock.js.map +1 -1
  446. package/packages/pi-ai/dist/providers/amazon-bedrock.test.d.ts +2 -0
  447. package/packages/pi-ai/dist/providers/amazon-bedrock.test.d.ts.map +1 -0
  448. package/packages/pi-ai/dist/providers/amazon-bedrock.test.js +106 -0
  449. package/packages/pi-ai/dist/providers/amazon-bedrock.test.js.map +1 -0
  450. package/packages/pi-ai/dist/providers/anthropic-auth.test.js +42 -1
  451. package/packages/pi-ai/dist/providers/anthropic-auth.test.js.map +1 -1
  452. package/packages/pi-ai/dist/providers/anthropic-bearer-auth.test.d.ts +2 -0
  453. package/packages/pi-ai/dist/providers/anthropic-bearer-auth.test.d.ts.map +1 -0
  454. package/packages/pi-ai/dist/providers/anthropic-bearer-auth.test.js +13 -0
  455. package/packages/pi-ai/dist/providers/anthropic-bearer-auth.test.js.map +1 -0
  456. package/packages/pi-ai/dist/providers/anthropic-shared.d.ts +20 -1
  457. package/packages/pi-ai/dist/providers/anthropic-shared.d.ts.map +1 -1
  458. package/packages/pi-ai/dist/providers/anthropic-shared.js +32 -2
  459. package/packages/pi-ai/dist/providers/anthropic-shared.js.map +1 -1
  460. package/packages/pi-ai/dist/providers/anthropic-shared.test.js +12 -1
  461. package/packages/pi-ai/dist/providers/anthropic-shared.test.js.map +1 -1
  462. package/packages/pi-ai/dist/providers/anthropic.d.ts +11 -0
  463. package/packages/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
  464. package/packages/pi-ai/dist/providers/anthropic.js +23 -2
  465. package/packages/pi-ai/dist/providers/anthropic.js.map +1 -1
  466. package/packages/pi-ai/dist/providers/api-family.d.ts +27 -0
  467. package/packages/pi-ai/dist/providers/api-family.d.ts.map +1 -0
  468. package/packages/pi-ai/dist/providers/api-family.js +47 -0
  469. package/packages/pi-ai/dist/providers/api-family.js.map +1 -0
  470. package/packages/pi-ai/dist/providers/api-family.test.d.ts +2 -0
  471. package/packages/pi-ai/dist/providers/api-family.test.d.ts.map +1 -0
  472. package/packages/pi-ai/dist/providers/api-family.test.js +101 -0
  473. package/packages/pi-ai/dist/providers/api-family.test.js.map +1 -0
  474. package/packages/pi-ai/dist/utils/oauth/github-copilot.d.ts.map +1 -1
  475. package/packages/pi-ai/dist/utils/oauth/github-copilot.js +12 -2
  476. package/packages/pi-ai/dist/utils/oauth/github-copilot.js.map +1 -1
  477. package/packages/pi-ai/dist/utils/oauth/github-copilot.test.js +164 -14
  478. package/packages/pi-ai/dist/utils/oauth/github-copilot.test.js.map +1 -1
  479. package/packages/pi-ai/dist/utils/oauth/google-antigravity.d.ts.map +1 -1
  480. package/packages/pi-ai/dist/utils/oauth/google-antigravity.js +15 -3
  481. package/packages/pi-ai/dist/utils/oauth/google-antigravity.js.map +1 -1
  482. package/packages/pi-ai/dist/utils/oauth/google-antigravity.test.d.ts +2 -0
  483. package/packages/pi-ai/dist/utils/oauth/google-antigravity.test.d.ts.map +1 -0
  484. package/packages/pi-ai/dist/utils/oauth/google-antigravity.test.js +67 -0
  485. package/packages/pi-ai/dist/utils/oauth/google-antigravity.test.js.map +1 -0
  486. package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.d.ts.map +1 -1
  487. package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.js +16 -3
  488. package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.js.map +1 -1
  489. package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.test.d.ts +2 -0
  490. package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.test.d.ts.map +1 -0
  491. package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.test.js +67 -0
  492. package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.test.js.map +1 -0
  493. package/packages/pi-ai/dist/utils/oauth/oauth-providers.test.d.ts +2 -0
  494. package/packages/pi-ai/dist/utils/oauth/oauth-providers.test.d.ts.map +1 -0
  495. package/packages/pi-ai/dist/utils/oauth/oauth-providers.test.js +289 -0
  496. package/packages/pi-ai/dist/utils/oauth/oauth-providers.test.js.map +1 -0
  497. package/packages/pi-ai/dist/utils/oauth/openai-codex.d.ts.map +1 -1
  498. package/packages/pi-ai/dist/utils/oauth/openai-codex.js +12 -0
  499. package/packages/pi-ai/dist/utils/oauth/openai-codex.js.map +1 -1
  500. package/packages/pi-ai/package.json +2 -2
  501. package/packages/pi-ai/scripts/generate-models.ts +50 -0
  502. package/packages/pi-ai/src/index.ts +1 -0
  503. package/packages/pi-ai/src/models/capability-patches.ts +5 -2
  504. package/packages/pi-ai/src/models/generated/amazon-bedrock.ts +68 -0
  505. package/packages/pi-ai/src/models/generated/anthropic.ts +17 -0
  506. package/packages/pi-ai/src/models/generated/google-antigravity.ts +17 -0
  507. package/packages/pi-ai/src/models/generated/groq.ts +0 -153
  508. package/packages/pi-ai/src/models/generated/openai-codex.ts +17 -0
  509. package/packages/pi-ai/src/models/generated/openrouter.ts +17 -0
  510. package/packages/pi-ai/src/models.generated.test.ts +17 -0
  511. package/packages/pi-ai/src/providers/amazon-bedrock.test.ts +164 -0
  512. package/packages/pi-ai/src/providers/amazon-bedrock.ts +41 -7
  513. package/packages/pi-ai/src/providers/anthropic-auth.test.ts +47 -1
  514. package/packages/pi-ai/src/providers/anthropic-bearer-auth.test.ts +26 -0
  515. package/packages/pi-ai/src/providers/anthropic-shared.test.ts +15 -1
  516. package/packages/pi-ai/src/providers/anthropic-shared.ts +36 -3
  517. package/packages/pi-ai/src/providers/anthropic.ts +25 -2
  518. package/packages/pi-ai/src/providers/api-family.test.ts +129 -0
  519. package/packages/pi-ai/src/providers/api-family.ts +57 -0
  520. package/packages/pi-ai/src/utils/oauth/github-copilot.test.ts +200 -23
  521. package/packages/pi-ai/src/utils/oauth/github-copilot.ts +12 -2
  522. package/packages/pi-ai/src/utils/oauth/google-antigravity.test.ts +84 -0
  523. package/packages/pi-ai/src/utils/oauth/google-antigravity.ts +15 -5
  524. package/packages/pi-ai/src/utils/oauth/google-gemini-cli.test.ts +84 -0
  525. package/packages/pi-ai/src/utils/oauth/google-gemini-cli.ts +16 -5
  526. package/packages/pi-ai/src/utils/oauth/oauth-providers.test.ts +363 -0
  527. package/packages/pi-ai/src/utils/oauth/openai-codex.ts +15 -0
  528. package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
  529. package/packages/pi-coding-agent/dist/cli/args.d.ts +6 -0
  530. package/packages/pi-coding-agent/dist/cli/args.d.ts.map +1 -1
  531. package/packages/pi-coding-agent/dist/cli/args.js +14 -4
  532. package/packages/pi-coding-agent/dist/cli/args.js.map +1 -1
  533. package/packages/pi-coding-agent/dist/cli/args.test.d.ts +2 -0
  534. package/packages/pi-coding-agent/dist/cli/args.test.d.ts.map +1 -0
  535. package/packages/pi-coding-agent/dist/cli/args.test.js +38 -0
  536. package/packages/pi-coding-agent/dist/cli/args.test.js.map +1 -0
  537. package/packages/pi-coding-agent/dist/core/agent-session-abort-order.test.d.ts +2 -0
  538. package/packages/pi-coding-agent/dist/core/agent-session-abort-order.test.d.ts.map +1 -0
  539. package/packages/pi-coding-agent/dist/core/agent-session-abort-order.test.js +38 -0
  540. package/packages/pi-coding-agent/dist/core/agent-session-abort-order.test.js.map +1 -0
  541. package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
  542. package/packages/pi-coding-agent/dist/core/agent-session.js +25 -2
  543. package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
  544. package/packages/pi-coding-agent/dist/core/auth-storage.d.ts +14 -0
  545. package/packages/pi-coding-agent/dist/core/auth-storage.d.ts.map +1 -1
  546. package/packages/pi-coding-agent/dist/core/auth-storage.js +34 -0
  547. package/packages/pi-coding-agent/dist/core/auth-storage.js.map +1 -1
  548. package/packages/pi-coding-agent/dist/core/auth-storage.test.js +74 -0
  549. package/packages/pi-coding-agent/dist/core/auth-storage.test.js.map +1 -1
  550. package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js +4 -1
  551. package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js.map +1 -1
  552. package/packages/pi-coding-agent/dist/core/extensions/index.d.ts +1 -1
  553. package/packages/pi-coding-agent/dist/core/extensions/index.d.ts.map +1 -1
  554. package/packages/pi-coding-agent/dist/core/extensions/index.js.map +1 -1
  555. package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
  556. package/packages/pi-coding-agent/dist/core/extensions/loader.js +4 -0
  557. package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
  558. package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts +34 -2
  559. package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
  560. package/packages/pi-coding-agent/dist/core/extensions/runner.js +233 -0
  561. package/packages/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
  562. package/packages/pi-coding-agent/dist/core/extensions/types.d.ts +200 -3
  563. package/packages/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
  564. package/packages/pi-coding-agent/dist/core/extensions/types.js.map +1 -1
  565. package/packages/pi-coding-agent/dist/core/hooks-runner.d.ts +53 -0
  566. package/packages/pi-coding-agent/dist/core/hooks-runner.d.ts.map +1 -0
  567. package/packages/pi-coding-agent/dist/core/hooks-runner.js +337 -0
  568. package/packages/pi-coding-agent/dist/core/hooks-runner.js.map +1 -0
  569. package/packages/pi-coding-agent/dist/core/hooks-runner.test.d.ts +2 -0
  570. package/packages/pi-coding-agent/dist/core/hooks-runner.test.d.ts.map +1 -0
  571. package/packages/pi-coding-agent/dist/core/hooks-runner.test.js +234 -0
  572. package/packages/pi-coding-agent/dist/core/hooks-runner.test.js.map +1 -0
  573. package/packages/pi-coding-agent/dist/core/index.d.ts +1 -0
  574. package/packages/pi-coding-agent/dist/core/index.d.ts.map +1 -1
  575. package/packages/pi-coding-agent/dist/core/index.js +1 -0
  576. package/packages/pi-coding-agent/dist/core/index.js.map +1 -1
  577. package/packages/pi-coding-agent/dist/core/model-registry-auth-header.test.d.ts +2 -0
  578. package/packages/pi-coding-agent/dist/core/model-registry-auth-header.test.d.ts.map +1 -0
  579. package/packages/pi-coding-agent/dist/core/model-registry-auth-header.test.js +40 -0
  580. package/packages/pi-coding-agent/dist/core/model-registry-auth-header.test.js.map +1 -0
  581. package/packages/pi-coding-agent/dist/core/model-registry-auth-mode.test.js +32 -0
  582. package/packages/pi-coding-agent/dist/core/model-registry-auth-mode.test.js.map +1 -1
  583. package/packages/pi-coding-agent/dist/core/retry-handler.d.ts.map +1 -1
  584. package/packages/pi-coding-agent/dist/core/retry-handler.js +4 -1
  585. package/packages/pi-coding-agent/dist/core/retry-handler.js.map +1 -1
  586. package/packages/pi-coding-agent/dist/core/sdk.d.ts +10 -0
  587. package/packages/pi-coding-agent/dist/core/sdk.d.ts.map +1 -1
  588. package/packages/pi-coding-agent/dist/core/sdk.js +39 -1
  589. package/packages/pi-coding-agent/dist/core/sdk.js.map +1 -1
  590. package/packages/pi-coding-agent/dist/core/settings-manager.d.ts +55 -0
  591. package/packages/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
  592. package/packages/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
  593. package/packages/pi-coding-agent/dist/core/skill-tool.test.js +2 -2
  594. package/packages/pi-coding-agent/dist/core/skill-tool.test.js.map +1 -1
  595. package/packages/pi-coding-agent/dist/index.d.ts +1 -1
  596. package/packages/pi-coding-agent/dist/index.d.ts.map +1 -1
  597. package/packages/pi-coding-agent/dist/index.js.map +1 -1
  598. package/packages/pi-coding-agent/dist/main.d.ts.map +1 -1
  599. package/packages/pi-coding-agent/dist/main.js +3 -0
  600. package/packages/pi-coding-agent/dist/main.js.map +1 -1
  601. package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.d.ts.map +1 -1
  602. package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js +17 -7
  603. package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js.map +1 -1
  604. package/packages/pi-coding-agent/dist/modes/interactive/components/footer.d.ts.map +1 -1
  605. package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js +48 -34
  606. package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js.map +1 -1
  607. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts +4 -0
  608. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
  609. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +83 -33
  610. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
  611. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.d.ts +70 -0
  612. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -0
  613. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.js +77 -0
  614. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.js.map +1 -0
  615. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts +1 -66
  616. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  617. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js +1 -75
  618. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js.map +1 -1
  619. package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.d.ts +1 -1
  620. package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.d.ts.map +1 -1
  621. package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js +192 -24
  622. package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js.map +1 -1
  623. package/packages/pi-coding-agent/package.json +1 -1
  624. package/packages/pi-coding-agent/src/cli/args.test.ts +44 -0
  625. package/packages/pi-coding-agent/src/cli/args.ts +21 -6
  626. package/packages/pi-coding-agent/src/core/agent-session-abort-order.test.ts +56 -0
  627. package/packages/pi-coding-agent/src/core/agent-session.ts +27 -2
  628. package/packages/pi-coding-agent/src/core/auth-storage.test.ts +83 -0
  629. package/packages/pi-coding-agent/src/core/auth-storage.ts +35 -0
  630. package/packages/pi-coding-agent/src/core/chat-controller-ordering.test.ts +4 -1
  631. package/packages/pi-coding-agent/src/core/extensions/index.ts +16 -0
  632. package/packages/pi-coding-agent/src/core/extensions/loader.ts +5 -0
  633. package/packages/pi-coding-agent/src/core/extensions/runner.ts +353 -1
  634. package/packages/pi-coding-agent/src/core/extensions/types.ts +253 -2
  635. package/packages/pi-coding-agent/src/core/hooks-runner.test.ts +269 -0
  636. package/packages/pi-coding-agent/src/core/hooks-runner.ts +460 -0
  637. package/packages/pi-coding-agent/src/core/index.ts +10 -0
  638. package/packages/pi-coding-agent/src/core/model-registry-auth-header.test.ts +44 -0
  639. package/packages/pi-coding-agent/src/core/model-registry-auth-mode.test.ts +37 -1
  640. package/packages/pi-coding-agent/src/core/retry-handler.ts +4 -1
  641. package/packages/pi-coding-agent/src/core/sdk.ts +58 -1
  642. package/packages/pi-coding-agent/src/core/settings-manager.ts +57 -0
  643. package/packages/pi-coding-agent/src/core/skill-tool.test.ts +2 -2
  644. package/packages/pi-coding-agent/src/index.ts +16 -0
  645. package/packages/pi-coding-agent/src/main.ts +4 -0
  646. package/packages/pi-coding-agent/src/modes/interactive/components/chat-frame.ts +19 -7
  647. package/packages/pi-coding-agent/src/modes/interactive/components/footer.ts +53 -31
  648. package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +88 -36
  649. package/packages/pi-coding-agent/src/modes/interactive/theme/theme-schema.ts +83 -0
  650. package/packages/pi-coding-agent/src/modes/interactive/theme/theme.ts +2 -83
  651. package/packages/pi-coding-agent/src/modes/interactive/theme/themes.ts +208 -27
  652. package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
  653. package/packages/pi-tui/package.json +1 -1
  654. package/packages/pi-tui/tsconfig.tsbuildinfo +1 -1
  655. package/packages/rpc-client/package.json +1 -1
  656. package/packages/rpc-client/tsconfig.tsbuildinfo +1 -1
  657. package/pkg/dist/modes/interactive/theme/theme-schema.d.ts +70 -0
  658. package/pkg/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -0
  659. package/pkg/dist/modes/interactive/theme/theme-schema.js +77 -0
  660. package/pkg/dist/modes/interactive/theme/theme-schema.js.map +1 -0
  661. package/pkg/dist/modes/interactive/theme/theme.d.ts +1 -66
  662. package/pkg/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  663. package/pkg/dist/modes/interactive/theme/theme.js +1 -75
  664. package/pkg/dist/modes/interactive/theme/theme.js.map +1 -1
  665. package/pkg/dist/modes/interactive/theme/themes.d.ts +1 -1
  666. package/pkg/dist/modes/interactive/theme/themes.d.ts.map +1 -1
  667. package/pkg/dist/modes/interactive/theme/themes.js +192 -24
  668. package/pkg/dist/modes/interactive/theme/themes.js.map +1 -1
  669. package/pkg/package.json +1 -1
  670. package/src/resources/agents/researcher.md +1 -1
  671. package/src/resources/extensions/ask-user-questions.ts +24 -6
  672. package/src/resources/extensions/claude-code-cli/models.ts +9 -0
  673. package/src/resources/extensions/claude-code-cli/readiness.ts +36 -2
  674. package/src/resources/extensions/claude-code-cli/stream-adapter.ts +94 -4
  675. package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +84 -0
  676. package/src/resources/extensions/gsd/auto/detect-stuck.ts +10 -0
  677. package/src/resources/extensions/gsd/auto/loop-deps.ts +2 -9
  678. package/src/resources/extensions/gsd/auto/loop.ts +109 -3
  679. package/src/resources/extensions/gsd/auto/phases.ts +146 -66
  680. package/src/resources/extensions/gsd/auto/resolve.ts +1 -1
  681. package/src/resources/extensions/gsd/auto/run-unit.ts +11 -1
  682. package/src/resources/extensions/gsd/auto/session.ts +7 -0
  683. package/src/resources/extensions/gsd/auto-artifact-paths.ts +20 -0
  684. package/src/resources/extensions/gsd/auto-dashboard.ts +46 -5
  685. package/src/resources/extensions/gsd/auto-direct-dispatch.ts +15 -2
  686. package/src/resources/extensions/gsd/auto-dispatch.ts +141 -9
  687. package/src/resources/extensions/gsd/auto-loop.ts +1 -1
  688. package/src/resources/extensions/gsd/auto-model-selection.ts +37 -6
  689. package/src/resources/extensions/gsd/auto-post-unit.ts +10 -8
  690. package/src/resources/extensions/gsd/auto-prompts.ts +232 -47
  691. package/src/resources/extensions/gsd/auto-recovery.ts +63 -1
  692. package/src/resources/extensions/gsd/auto-start.ts +8 -6
  693. package/src/resources/extensions/gsd/auto-verification.ts +36 -3
  694. package/src/resources/extensions/gsd/auto-worktree.ts +81 -1
  695. package/src/resources/extensions/gsd/auto.ts +61 -28
  696. package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +8 -21
  697. package/src/resources/extensions/gsd/bootstrap/db-tools.ts +46 -24
  698. package/src/resources/extensions/gsd/bootstrap/memory-tools.ts +163 -0
  699. package/src/resources/extensions/gsd/bootstrap/query-tools.ts +31 -0
  700. package/src/resources/extensions/gsd/bootstrap/register-extension.ts +15 -0
  701. package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +22 -0
  702. package/src/resources/extensions/gsd/bootstrap/system-context.ts +89 -10
  703. package/src/resources/extensions/gsd/commands/catalog.ts +74 -9
  704. package/src/resources/extensions/gsd/commands/handlers/core.ts +69 -27
  705. package/src/resources/extensions/gsd/commands/handlers/escalate.ts +216 -0
  706. package/src/resources/extensions/gsd/commands/handlers/onboarding.ts +196 -0
  707. package/src/resources/extensions/gsd/commands/handlers/ops.ts +21 -0
  708. package/src/resources/extensions/gsd/commands/handlers/workflow.ts +279 -29
  709. package/src/resources/extensions/gsd/commands-cmux.ts +6 -2
  710. package/src/resources/extensions/gsd/commands-config.ts +10 -0
  711. package/src/resources/extensions/gsd/commands-debug.ts +484 -0
  712. package/src/resources/extensions/gsd/commands-do.ts +1 -0
  713. package/src/resources/extensions/gsd/commands-extract-learnings.ts +262 -78
  714. package/src/resources/extensions/gsd/commands-handlers.ts +19 -2
  715. package/src/resources/extensions/gsd/commands-memory.ts +551 -0
  716. package/src/resources/extensions/gsd/commands-prefs-wizard.ts +49 -12
  717. package/src/resources/extensions/gsd/commands-scan.ts +125 -0
  718. package/src/resources/extensions/gsd/commands-workflow-templates.ts +129 -2
  719. package/src/resources/extensions/gsd/custom-workflow-engine.ts +85 -60
  720. package/src/resources/extensions/gsd/db-writer.ts +91 -17
  721. package/src/resources/extensions/gsd/debug-session-store.ts +377 -0
  722. package/src/resources/extensions/gsd/definition-loader.ts +7 -0
  723. package/src/resources/extensions/gsd/docs/preferences-reference.md +9 -9
  724. package/src/resources/extensions/gsd/doctor-environment.ts +2 -1
  725. package/src/resources/extensions/gsd/doctor-git-checks.ts +51 -30
  726. package/src/resources/extensions/gsd/doctor-proactive.ts +4 -1
  727. package/src/resources/extensions/gsd/doctor-providers.ts +109 -26
  728. package/src/resources/extensions/gsd/doctor-runtime-checks.ts +23 -4
  729. package/src/resources/extensions/gsd/doctor-types.ts +1 -0
  730. package/src/resources/extensions/gsd/doctor.ts +7 -1
  731. package/src/resources/extensions/gsd/ecosystem/gsd-extension-api.ts +2 -0
  732. package/src/resources/extensions/gsd/error-classifier.ts +6 -3
  733. package/src/resources/extensions/gsd/escalation.ts +367 -0
  734. package/src/resources/extensions/gsd/forensics.ts +25 -29
  735. package/src/resources/extensions/gsd/git-service.ts +0 -1
  736. package/src/resources/extensions/gsd/graph.ts +33 -3
  737. package/src/resources/extensions/gsd/gsd-db.ts +617 -32
  738. package/src/resources/extensions/gsd/health-widget-core.ts +43 -14
  739. package/src/resources/extensions/gsd/health-widget.ts +7 -3
  740. package/src/resources/extensions/gsd/hook-emitter.ts +188 -0
  741. package/src/resources/extensions/gsd/init-wizard.ts +87 -54
  742. package/src/resources/extensions/gsd/markdown-renderer.ts +5 -5
  743. package/src/resources/extensions/gsd/memory-backfill.ts +140 -0
  744. package/src/resources/extensions/gsd/memory-embeddings.ts +235 -0
  745. package/src/resources/extensions/gsd/memory-extractor.ts +100 -34
  746. package/src/resources/extensions/gsd/memory-ingest.ts +286 -0
  747. package/src/resources/extensions/gsd/memory-relations.ts +240 -0
  748. package/src/resources/extensions/gsd/memory-source-store.ts +138 -0
  749. package/src/resources/extensions/gsd/memory-store.ts +377 -7
  750. package/src/resources/extensions/gsd/metrics.ts +1 -0
  751. package/src/resources/extensions/gsd/model-cost-table.ts +3 -1
  752. package/src/resources/extensions/gsd/model-router.ts +25 -6
  753. package/src/resources/extensions/gsd/native-git-bridge.ts +134 -6
  754. package/src/resources/extensions/gsd/notification-overlay.ts +9 -19
  755. package/src/resources/extensions/gsd/notification-widget.ts +25 -43
  756. package/src/resources/extensions/gsd/notifications.ts +6 -0
  757. package/src/resources/extensions/gsd/onboarding-state.ts +146 -0
  758. package/src/resources/extensions/gsd/post-execution-checks.ts +37 -14
  759. package/src/resources/extensions/gsd/pre-execution-checks.ts +106 -12
  760. package/src/resources/extensions/gsd/preferences-models.ts +1 -0
  761. package/src/resources/extensions/gsd/preferences-types.ts +10 -2
  762. package/src/resources/extensions/gsd/preferences-validation.ts +33 -7
  763. package/src/resources/extensions/gsd/preferences.ts +10 -10
  764. package/src/resources/extensions/gsd/prompts/add-tests.md +1 -0
  765. package/src/resources/extensions/gsd/prompts/complete-milestone.md +4 -1
  766. package/src/resources/extensions/gsd/prompts/complete-slice.md +2 -2
  767. package/src/resources/extensions/gsd/prompts/debug-diagnose.md +27 -0
  768. package/src/resources/extensions/gsd/prompts/debug-session-manager.md +80 -0
  769. package/src/resources/extensions/gsd/prompts/execute-task.md +16 -3
  770. package/src/resources/extensions/gsd/prompts/plan-milestone.md +12 -0
  771. package/src/resources/extensions/gsd/prompts/plan-slice.md +2 -0
  772. package/src/resources/extensions/gsd/prompts/refine-slice.md +69 -0
  773. package/src/resources/extensions/gsd/prompts/research-slice.md +1 -0
  774. package/src/resources/extensions/gsd/prompts/scan.md +79 -0
  775. package/src/resources/extensions/gsd/prompts/workflow-oneshot.md +26 -0
  776. package/src/resources/extensions/gsd/python-resolver.ts +76 -0
  777. package/src/resources/extensions/gsd/run-manager.ts +53 -19
  778. package/src/resources/extensions/gsd/setup-catalog.ts +105 -0
  779. package/src/resources/extensions/gsd/state.ts +95 -6
  780. package/src/resources/extensions/gsd/templates/PREFERENCES.md +7 -7
  781. package/src/resources/extensions/gsd/tests/agent-end-retry.test.ts +1 -34
  782. package/src/resources/extensions/gsd/tests/artifact-corruption-2630.test.ts +7 -0
  783. package/src/resources/extensions/gsd/tests/auto-dashboard.test.ts +49 -0
  784. package/src/resources/extensions/gsd/tests/auto-loop.test.ts +45 -31
  785. package/src/resources/extensions/gsd/tests/auto-migrating-recovery.test.ts +63 -0
  786. package/src/resources/extensions/gsd/tests/auto-model-selection.test.ts +95 -1
  787. package/src/resources/extensions/gsd/tests/auto-prompts-fallback.test.ts +35 -0
  788. package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +123 -1
  789. package/src/resources/extensions/gsd/tests/auto-wrapup-inflight-guard.test.ts +39 -0
  790. package/src/resources/extensions/gsd/tests/autocomplete-regressions-1675.test.ts +39 -0
  791. package/src/resources/extensions/gsd/tests/bundled-skill-triggers.test.ts +54 -0
  792. package/src/resources/extensions/gsd/tests/commands-do.test.ts +48 -0
  793. package/src/resources/extensions/gsd/tests/commands-extract-learnings.test.ts +335 -21
  794. package/src/resources/extensions/gsd/tests/commands-scan.test.ts +351 -0
  795. package/src/resources/extensions/gsd/tests/commands-workflow-custom.test.ts +8 -6
  796. package/src/resources/extensions/gsd/tests/complete-slice.test.ts +6 -8
  797. package/src/resources/extensions/gsd/tests/complete-task.test.ts +2 -2
  798. package/src/resources/extensions/gsd/tests/custom-workflow-engine.test.ts +63 -0
  799. package/src/resources/extensions/gsd/tests/debug-command-handler.test.ts +905 -0
  800. package/src/resources/extensions/gsd/tests/debug-command-lifecycle.integration.test.ts +1229 -0
  801. package/src/resources/extensions/gsd/tests/debug-session-store.test.ts +565 -0
  802. package/src/resources/extensions/gsd/tests/derive-state-db.test.ts +42 -0
  803. package/src/resources/extensions/gsd/tests/derive-state-helpers.test.ts +8 -4
  804. package/src/resources/extensions/gsd/tests/discuss-milestone-structured-questions.test.ts +64 -0
  805. package/src/resources/extensions/gsd/tests/dispatch-complete-milestone-guard.test.ts +67 -0
  806. package/src/resources/extensions/gsd/tests/doctor-providers.test.ts +175 -17
  807. package/src/resources/extensions/gsd/tests/enhanced-verification-integration.test.ts +5 -0
  808. package/src/resources/extensions/gsd/tests/ensure-db-open.test.ts +306 -1
  809. package/src/resources/extensions/gsd/tests/escalation.test.ts +818 -0
  810. package/src/resources/extensions/gsd/tests/finalize-timeout-guard.test.ts +29 -12
  811. package/src/resources/extensions/gsd/tests/flat-rate-routing-guard.test.ts +145 -8
  812. package/src/resources/extensions/gsd/tests/forensics-hook-key-parse.test.ts +74 -0
  813. package/src/resources/extensions/gsd/tests/freeform-decisions.test.ts +62 -0
  814. package/src/resources/extensions/gsd/tests/graph-operations.test.ts +0 -4
  815. package/src/resources/extensions/gsd/tests/gsd-db.test.ts +44 -1
  816. package/src/resources/extensions/gsd/tests/health-widget.test.ts +8 -2
  817. package/src/resources/extensions/gsd/tests/init-prefs-routing.test.ts +190 -0
  818. package/src/resources/extensions/gsd/tests/integration/doctor-git-symlink-cwd.test.ts +90 -0
  819. package/src/resources/extensions/gsd/tests/integration/doctor-git.test.ts +117 -0
  820. package/src/resources/extensions/gsd/tests/integration/doctor-proactive.test.ts +44 -0
  821. package/src/resources/extensions/gsd/tests/integration/doctor-runtime.test.ts +68 -1
  822. package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +109 -11
  823. package/src/resources/extensions/gsd/tests/integration/idle-recovery.test.ts +51 -0
  824. package/src/resources/extensions/gsd/tests/integration/integration-proof.test.ts +2 -2
  825. package/src/resources/extensions/gsd/tests/integration/test-isolation.ts +53 -0
  826. package/src/resources/extensions/gsd/tests/interactive-routing-bypass.test.ts +1 -1
  827. package/src/resources/extensions/gsd/tests/journal-integration.test.ts +206 -1
  828. package/src/resources/extensions/gsd/tests/load-memory-block.test.ts +36 -0
  829. package/src/resources/extensions/gsd/tests/md-importer.test.ts +1 -1
  830. package/src/resources/extensions/gsd/tests/memory-embeddings.test.ts +213 -0
  831. package/src/resources/extensions/gsd/tests/memory-ingest.test.ts +153 -0
  832. package/src/resources/extensions/gsd/tests/memory-maintenance.test.ts +107 -0
  833. package/src/resources/extensions/gsd/tests/memory-relations.test.ts +175 -0
  834. package/src/resources/extensions/gsd/tests/memory-store.test.ts +2 -2
  835. package/src/resources/extensions/gsd/tests/memory-tools.test.ts +295 -0
  836. package/src/resources/extensions/gsd/tests/milestone-status-tool.test.ts +3 -2
  837. package/src/resources/extensions/gsd/tests/model-cost-table.test.ts +2 -2
  838. package/src/resources/extensions/gsd/tests/model-router.test.ts +51 -1
  839. package/src/resources/extensions/gsd/tests/model-unittype-mapping.test.ts +59 -0
  840. package/src/resources/extensions/gsd/tests/notification-overlay.test.ts +56 -37
  841. package/src/resources/extensions/gsd/tests/notification-widget.test.ts +1 -1
  842. package/src/resources/extensions/gsd/tests/onboarding-state.test.ts +105 -0
  843. package/src/resources/extensions/gsd/tests/plan-milestone-boundary-map-preservation.test.ts +114 -0
  844. package/src/resources/extensions/gsd/tests/plan-milestone.test.ts +4 -5
  845. package/src/resources/extensions/gsd/tests/plan-slice.test.ts +17 -0
  846. package/src/resources/extensions/gsd/tests/post-execution-checks.test.ts +105 -1
  847. package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +341 -6
  848. package/src/resources/extensions/gsd/tests/preferences.test.ts +69 -1
  849. package/src/resources/extensions/gsd/tests/progressive-planning.test.ts +539 -0
  850. package/src/resources/extensions/gsd/tests/projection-no-plan-overwrite.test.ts +11 -2
  851. package/src/resources/extensions/gsd/tests/projection-regression.test.ts +7 -0
  852. package/src/resources/extensions/gsd/tests/prompt-budget-enforcement.test.ts +159 -8
  853. package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +24 -0
  854. package/src/resources/extensions/gsd/tests/prompt-db.test.ts +1 -1
  855. package/src/resources/extensions/gsd/tests/prompts-no-gitignored-test-refs.test.ts +56 -0
  856. package/src/resources/extensions/gsd/tests/provider-errors.test.ts +45 -4
  857. package/src/resources/extensions/gsd/tests/python-resolver.test.ts +131 -0
  858. package/src/resources/extensions/gsd/tests/register-hooks-depth-verification.test.ts +67 -0
  859. package/src/resources/extensions/gsd/tests/remote-notification-from-desktop.test.ts +107 -0
  860. package/src/resources/extensions/gsd/tests/requirements.test.ts +9 -0
  861. package/src/resources/extensions/gsd/tests/session-start-footer.test.ts +153 -0
  862. package/src/resources/extensions/gsd/tests/skip-slice-cascades-tasks.test.ts +125 -0
  863. package/src/resources/extensions/gsd/tests/slice-context-injection.test.ts +16 -4
  864. package/src/resources/extensions/gsd/tests/stash-queued-context-files.test.ts +54 -0
  865. package/src/resources/extensions/gsd/tests/state-corruption-2945.test.ts +3 -0
  866. package/src/resources/extensions/gsd/tests/stuck-detection-coverage.test.ts +15 -0
  867. package/src/resources/extensions/gsd/tests/summary-render-parity.test.ts +5 -0
  868. package/src/resources/extensions/gsd/tests/uok-contracts.test.ts +2 -1
  869. package/src/resources/extensions/gsd/tests/uok-flags.test.ts +31 -1
  870. package/src/resources/extensions/gsd/tests/uok-kernel-path.test.ts +166 -0
  871. package/src/resources/extensions/gsd/tests/validate-milestone.test.ts +9 -3
  872. package/src/resources/extensions/gsd/tests/verification-gate.test.ts +35 -0
  873. package/src/resources/extensions/gsd/tests/workflow-install.test.ts +113 -0
  874. package/src/resources/extensions/gsd/tests/workflow-logger-wiring.test.ts +15 -6
  875. package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +2 -2
  876. package/src/resources/extensions/gsd/tests/workflow-plugins.test.ts +310 -0
  877. package/src/resources/extensions/gsd/tests/workflow-projections.test.ts +7 -0
  878. package/src/resources/extensions/gsd/tests/workflow-templates.test.ts +8 -2
  879. package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +97 -0
  880. package/src/resources/extensions/gsd/tests/worktree-journal-events.test.ts +2 -1
  881. package/src/resources/extensions/gsd/tests/worktree-resolver.test.ts +77 -2
  882. package/src/resources/extensions/gsd/tools/complete-task.ts +87 -0
  883. package/src/resources/extensions/gsd/tools/memory-tools.ts +410 -0
  884. package/src/resources/extensions/gsd/tools/plan-milestone.ts +42 -8
  885. package/src/resources/extensions/gsd/tools/plan-slice.ts +6 -1
  886. package/src/resources/extensions/gsd/tools/skip-slice.ts +133 -0
  887. package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +14 -0
  888. package/src/resources/extensions/gsd/types.ts +62 -0
  889. package/src/resources/extensions/gsd/unit-runtime.ts +1 -0
  890. package/src/resources/extensions/gsd/uok/contracts.ts +2 -1
  891. package/src/resources/extensions/gsd/uok/flags.ts +7 -7
  892. package/src/resources/extensions/gsd/uok/kernel.ts +16 -4
  893. package/src/resources/extensions/gsd/verification-gate.ts +2 -1
  894. package/src/resources/extensions/gsd/workflow-dispatch.ts +106 -0
  895. package/src/resources/extensions/gsd/workflow-install.ts +423 -0
  896. package/src/resources/extensions/gsd/workflow-logger.ts +4 -1
  897. package/src/resources/extensions/gsd/workflow-manifest.ts +8 -0
  898. package/src/resources/extensions/gsd/workflow-mcp.ts +1 -6
  899. package/src/resources/extensions/gsd/workflow-plugins.ts +403 -0
  900. package/src/resources/extensions/gsd/workflow-projections.ts +18 -16
  901. package/src/resources/extensions/gsd/workflow-templates/accessibility-audit.md +88 -0
  902. package/src/resources/extensions/gsd/workflow-templates/api-breaking-change.md +117 -0
  903. package/src/resources/extensions/gsd/workflow-templates/bugfix.md +1 -0
  904. package/src/resources/extensions/gsd/workflow-templates/changelog-gen.md +82 -0
  905. package/src/resources/extensions/gsd/workflow-templates/ci-bootstrap.md +144 -0
  906. package/src/resources/extensions/gsd/workflow-templates/dead-code.md +81 -0
  907. package/src/resources/extensions/gsd/workflow-templates/dep-upgrade.md +1 -0
  908. package/src/resources/extensions/gsd/workflow-templates/docs-sync.yaml +76 -0
  909. package/src/resources/extensions/gsd/workflow-templates/env-audit.yaml +88 -0
  910. package/src/resources/extensions/gsd/workflow-templates/full-project.md +1 -0
  911. package/src/resources/extensions/gsd/workflow-templates/hotfix.md +1 -0
  912. package/src/resources/extensions/gsd/workflow-templates/issue-triage.md +84 -0
  913. package/src/resources/extensions/gsd/workflow-templates/observability-setup.md +133 -0
  914. package/src/resources/extensions/gsd/workflow-templates/onboarding-check.md +74 -0
  915. package/src/resources/extensions/gsd/workflow-templates/performance-audit.md +125 -0
  916. package/src/resources/extensions/gsd/workflow-templates/pr-review.md +67 -0
  917. package/src/resources/extensions/gsd/workflow-templates/pr-triage.md +83 -0
  918. package/src/resources/extensions/gsd/workflow-templates/refactor.md +1 -0
  919. package/src/resources/extensions/gsd/workflow-templates/registry.json +184 -0
  920. package/src/resources/extensions/gsd/workflow-templates/release.md +118 -0
  921. package/src/resources/extensions/gsd/workflow-templates/rename-symbol.yaml +99 -0
  922. package/src/resources/extensions/gsd/workflow-templates/security-audit.md +1 -0
  923. package/src/resources/extensions/gsd/workflow-templates/small-feature.md +1 -0
  924. package/src/resources/extensions/gsd/workflow-templates/spike.md +7 -0
  925. package/src/resources/extensions/gsd/workflow-templates/test-backfill.yaml +73 -0
  926. package/src/resources/extensions/gsd/workflow-templates.ts +7 -0
  927. package/src/resources/extensions/gsd/workspace-index.ts +9 -4
  928. package/src/resources/extensions/gsd/worktree-resolver.ts +47 -1
  929. package/src/resources/extensions/remote-questions/commands.ts +480 -0
  930. package/src/resources/extensions/remote-questions/manager.ts +49 -4
  931. package/src/resources/extensions/remote-questions/telegram-adapter.ts +86 -4
  932. package/src/resources/extensions/remote-questions/tests/command-polling.test.ts +246 -0
  933. package/src/resources/extensions/remote-questions/tests/remote-answer-normalization.test.ts +92 -0
  934. package/src/resources/extensions/remote-questions/tests/telegram-commands.test.ts +267 -0
  935. package/src/resources/extensions/search-the-web/command-search-provider.ts +4 -1
  936. package/src/resources/extensions/search-the-web/native-search.ts +13 -3
  937. package/src/resources/extensions/shared/interview-ui.ts +195 -1
  938. package/src/resources/extensions/shared/layout-utils.ts +26 -0
  939. package/src/resources/extensions/shared/rtk-shared.ts +58 -0
  940. package/src/resources/extensions/shared/rtk.ts +12 -52
  941. package/src/resources/extensions/shared/tests/interview-preview.test.ts +177 -0
  942. package/src/resources/extensions/shared/tests/preview-layout.test.ts +120 -0
  943. package/src/resources/skills/api-design/SKILL.md +190 -0
  944. package/src/resources/skills/create-mcp-server/SKILL.md +121 -0
  945. package/src/resources/skills/create-workflow/SKILL.md +33 -6
  946. package/src/resources/skills/decompose-into-slices/SKILL.md +139 -0
  947. package/src/resources/skills/dependency-upgrade/SKILL.md +158 -0
  948. package/src/resources/skills/design-an-interface/SKILL.md +102 -0
  949. package/src/resources/skills/forensics/SKILL.md +153 -0
  950. package/src/resources/skills/grill-me/SKILL.md +93 -0
  951. package/src/resources/skills/handoff/SKILL.md +121 -0
  952. package/src/resources/skills/observability/SKILL.md +174 -0
  953. package/src/resources/skills/security-review/SKILL.md +181 -0
  954. package/src/resources/skills/spike-wrap-up/SKILL.md +138 -0
  955. package/src/resources/skills/tdd/SKILL.md +112 -0
  956. package/src/resources/skills/verify-before-complete/SKILL.md +97 -0
  957. package/src/resources/skills/write-docs/SKILL.md +81 -0
  958. package/src/resources/skills/write-milestone-brief/SKILL.md +135 -0
  959. package/dist/web/standalone/.next/static/chunks/2826.dd3dc8bbd3025fa5.js +0 -9
  960. package/dist/web/standalone/.next/static/chunks/app/page-7115e62689b5fd84.js +0 -1
  961. package/dist/web/standalone/.next/static/chunks/main-app-d3d4c336195465f9.js +0 -1
  962. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-ab5a8926e07ec673.js +0 -1
  963. package/dist/web/standalone/.next/static/css/f6e8833d46e738d8.css +0 -1
  964. package/packages/native/dist/ps/types.d.ts +0 -5
  965. package/packages/native/dist/ps/types.js +0 -2
  966. package/packages/native/src/ps/types.ts +0 -5
  967. package/packages/pi-ai/node_modules/@smithy/node-http-handler/LICENSE +0 -201
  968. package/packages/pi-ai/node_modules/@smithy/node-http-handler/README.md +0 -9
  969. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-cjs/index.js +0 -762
  970. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/build-abort-error.js +0 -19
  971. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/constants.js +0 -1
  972. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/get-transformed-headers.js +0 -9
  973. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/index.js +0 -3
  974. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +0 -230
  975. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +0 -87
  976. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-pool.js +0 -32
  977. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +0 -169
  978. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/readable.mock.js +0 -21
  979. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/server.mock.js +0 -88
  980. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-connection-timeout.js +0 -36
  981. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-request-timeout.js +0 -21
  982. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-socket-keep-alive.js +0 -22
  983. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +0 -23
  984. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/stream-collector/collector.js +0 -8
  985. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/stream-collector/index.js +0 -41
  986. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/stream-collector/readable.mock.js +0 -21
  987. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/timing.js +0 -4
  988. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/write-request-body.js +0 -63
  989. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/build-abort-error.d.ts +0 -10
  990. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/constants.d.ts +0 -5
  991. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/get-transformed-headers.d.ts +0 -4
  992. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/index.d.ts +0 -3
  993. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/node-http-handler.d.ts +0 -46
  994. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-manager.d.ts +0 -24
  995. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-pool.d.ts +0 -12
  996. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/node-http2-handler.d.ts +0 -63
  997. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/readable.mock.d.ts +0 -13
  998. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/server.mock.d.ts +0 -12
  999. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/set-connection-timeout.d.ts +0 -2
  1000. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/set-request-timeout.d.ts +0 -6
  1001. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/set-socket-keep-alive.d.ts +0 -6
  1002. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/set-socket-timeout.d.ts +0 -2
  1003. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/stream-collector/collector.d.ts +0 -5
  1004. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/stream-collector/index.d.ts +0 -6
  1005. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/stream-collector/readable.mock.d.ts +0 -13
  1006. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/timing.d.ts +0 -8
  1007. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/build-abort-error.d.ts +0 -10
  1008. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/constants.d.ts +0 -5
  1009. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/get-transformed-headers.d.ts +0 -4
  1010. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/index.d.ts +0 -3
  1011. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http-handler.d.ts +0 -46
  1012. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-connection-manager.d.ts +0 -24
  1013. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-connection-pool.d.ts +0 -12
  1014. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-handler.d.ts +0 -63
  1015. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/readable.mock.d.ts +0 -13
  1016. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/server.mock.d.ts +0 -12
  1017. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-connection-timeout.d.ts +0 -2
  1018. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-request-timeout.d.ts +0 -6
  1019. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-keep-alive.d.ts +0 -6
  1020. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-timeout.d.ts +0 -2
  1021. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/collector.d.ts +0 -5
  1022. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/index.d.ts +0 -6
  1023. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/readable.mock.d.ts +0 -13
  1024. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/timing.d.ts +0 -8
  1025. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/write-request-body.d.ts +0 -12
  1026. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/write-request-body.d.ts +0 -12
  1027. package/packages/pi-ai/node_modules/@smithy/node-http-handler/package.json +0 -68
  1028. package/packages/pi-ai/oauth.d.ts +0 -1
  1029. package/packages/pi-ai/oauth.js +0 -1
  1030. /package/dist/web/standalone/.next/static/{prkokVQFxWtUVIku57_0z → pBwmOoye64ZrRp-_rf0v1}/_buildManifest.js +0 -0
  1031. /package/dist/web/standalone/.next/static/{prkokVQFxWtUVIku57_0z → pBwmOoye64ZrRp-_rf0v1}/_ssgManifest.js +0 -0
@@ -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,79 @@
1
+ You are performing a focused codebase scan.
2
+
3
+ ## Scan Parameters
4
+
5
+ - **Focus:** {{focus}}
6
+ - **Documents to produce:** {{documents}}
7
+ - **Output directory:** `{{outputDir}}`
8
+
9
+ ## Working Directory
10
+
11
+ `{{workingDirectory}}`
12
+
13
+ ## Instructions
14
+
15
+ 1. Explore the codebase to understand its structure, technology choices, and patterns
16
+ 2. For each document listed above, produce a well-structured Markdown file in `{{outputDir}}/`
17
+ 3. Use the document schemas below as a guide for each output file
18
+
19
+ For this scan, only these documents are relevant: **{{documents}}**. Refer only to those schemas below and ignore the rest.
20
+
21
+ ### Document Schemas
22
+
23
+ **STACK.md** — Technology stack overview
24
+ - Languages, runtimes, and versions
25
+ - Key frameworks and libraries (with versions where visible)
26
+ - Build tools and bundlers
27
+ - Package manager
28
+
29
+ **INTEGRATIONS.md** — External dependencies and integrations
30
+ - Third-party APIs and services
31
+ - Database systems
32
+ - Authentication providers
33
+ - Infrastructure and deployment platforms
34
+ - Communication services (email, messaging, etc.)
35
+
36
+ **ARCHITECTURE.md** — Architectural patterns and design decisions
37
+ - Overall architecture style (monolith, microservices, monorepo, etc.)
38
+ - Core data flow
39
+ - Key design patterns in use
40
+ - Module/package boundaries
41
+
42
+ **STRUCTURE.md** — Directory and code organization
43
+ - Top-level directory layout with purpose
44
+ - Source code organization
45
+ - Test organization
46
+ - Configuration file locations
47
+
48
+ **CONVENTIONS.md** — Coding conventions and standards
49
+ - Naming conventions (files, functions, variables)
50
+ - Code style and formatting rules
51
+ - Import/export patterns
52
+ - Error handling patterns
53
+ - TypeScript/language-specific conventions
54
+
55
+ **TESTING.md** — Testing patterns and practices
56
+ - Test framework(s) in use
57
+ - Test file naming and location conventions
58
+ - Test helper and fixture patterns
59
+ - Coverage requirements (if any)
60
+ - How to run tests
61
+
62
+ **CONCERNS.md** — Technical debt and risks
63
+ - Known areas of technical debt
64
+ - Fragile or high-risk code areas
65
+ - Missing test coverage
66
+ - Outdated dependencies
67
+ - Performance bottlenecks
68
+ - Security considerations
69
+
70
+ ## Rules
71
+
72
+ - Write only the documents listed in **Documents to produce** — do not generate extra files
73
+ - Each document must be a clean, standalone Markdown file starting with a `# Heading`
74
+ - Be factual: report what you observe in the code, not what might be ideal
75
+ - Keep each document focused and scannable — use headers, bullet points, and code snippets
76
+ - Do NOT modify any source files
77
+ - After writing all documents, summarize what was produced (file names and line counts)
78
+
79
+ {{skillActivation}}
@@ -0,0 +1,26 @@
1
+ # Oneshot Workflow: {{displayName}}
2
+
3
+ You are running a **oneshot** workflow called `{{name}}`. Oneshot workflows are
4
+ prompt-only — there is no STATE.json, no phase tracking, no artifact directory,
5
+ and no resume mechanism. Just execute the instructions below and return.
6
+
7
+ ## User Arguments
8
+
9
+ `{{userArgs}}`
10
+
11
+ (If empty, use sensible defaults from the workflow body.)
12
+
13
+ ## Workflow Instructions
14
+
15
+ {{body}}
16
+
17
+ ## Execution Rules
18
+
19
+ 1. **No scaffolding.** Do not create `.gsd/workflows/` directories, STATE.json
20
+ files, or run directories unless the instructions explicitly tell you to
21
+ write a specific artifact.
22
+ 2. **No branch switching.** Work on the current branch.
23
+ 3. **Be concise.** Oneshot workflows produce a single focused output (a report,
24
+ a summary, a code change, a PR comment) — finish in this turn.
25
+ 4. **Ask only when blocked.** If the instructions need information you can't
26
+ discover, ask one clear question. Otherwise proceed.
@@ -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
+ }
@@ -15,8 +15,9 @@
15
15
  import { mkdirSync, writeFileSync, existsSync, readdirSync, statSync } from "node:fs";
16
16
  import { join } from "node:path";
17
17
  import { stringify } from "yaml";
18
- import { loadDefinition, substituteParams } from "./definition-loader.js";
18
+ import { loadDefinition, loadDefinitionFromFile, substituteParams } from "./definition-loader.js";
19
19
  import { initializeGraph, writeGraph, readGraph } from "./graph.js";
20
+ import { resolvePlugin } from "./workflow-plugins.js";
20
21
  // ─── Constants ───────────────────────────────────────────────────────────
21
22
  const RUNS_DIR = "workflow-runs";
22
23
  const DEFS_DIR = "workflow-defs";
@@ -42,38 +43,57 @@ function deriveStatus(graph) {
42
43
  return "pending";
43
44
  }
44
45
  // ─── Public API ──────────────────────────────────────────────────────────
46
+ /**
47
+ * Create a run directory from an explicit definition file path.
48
+ * Preferred over `createRun` when the caller has already resolved the file
49
+ * (e.g. via the plugin resolver).
50
+ */
51
+ export function createRunFromDefinition(basePath, defName, definitionFile, overrides) {
52
+ const rawDef = loadDefinitionFromFile(definitionFile);
53
+ const def = overrides
54
+ ? substituteParams(rawDef, overrides)
55
+ : substituteParams(rawDef);
56
+ const timestamp = makeTimestamp();
57
+ const runDir = join(basePath, ".gsd", RUNS_DIR, defName, timestamp);
58
+ mkdirSync(runDir, { recursive: true });
59
+ writeFileSync(join(runDir, "DEFINITION.yaml"), stringify(def), "utf-8");
60
+ const graph = initializeGraph(def);
61
+ writeGraph(runDir, graph);
62
+ if (overrides && Object.keys(overrides).length > 0) {
63
+ writeFileSync(join(runDir, "PARAMS.json"), JSON.stringify(overrides, null, 2), "utf-8");
64
+ }
65
+ return runDir;
66
+ }
45
67
  /**
46
68
  * Create a new isolated run directory for a workflow definition.
47
69
  *
48
- * 1. Loads the definition from `<basePath>/.gsd/workflow-defs/<defName>.yaml`
49
- * 2. Applies parameter substitution if overrides are provided
50
- * 3. Creates `<basePath>/.gsd/workflow-runs/<defName>/<timestamp>/`
51
- * 4. Writes frozen DEFINITION.yaml, initialized GRAPH.yaml, and optional PARAMS.json
70
+ * Resolution order:
71
+ * 1. Plugin resolver (project global bundled), YAML format only.
72
+ * 2. Legacy `.gsd/workflow-defs/<defName>.yaml`.
52
73
  *
53
- * @param basePath — project root directory
54
- * @param defName definition filename (without .yaml extension)
55
- * @param overrides — optional parameter overrides (merged with definition defaults)
56
- * @returns Full path to the created run directory
57
- * @throws Error if the definition file doesn't exist or is invalid
74
+ * Creates `<basePath>/.gsd/workflow-runs/<defName>/<timestamp>/` containing
75
+ * DEFINITION.yaml (frozen), GRAPH.yaml (initialized), and optional PARAMS.json.
76
+ *
77
+ * @throws Error if no matching definition is found anywhere.
58
78
  */
59
79
  export function createRun(basePath, defName, overrides) {
80
+ // Try the unified plugin resolver first — honors project/global overrides.
81
+ const plugin = resolvePlugin(basePath, defName);
82
+ if (plugin && plugin.format === "yaml") {
83
+ return createRunFromDefinition(basePath, defName, plugin.path, overrides);
84
+ }
85
+ // Fall back to legacy `.gsd/workflow-defs/<defName>.yaml`.
60
86
  const defsDir = join(basePath, ".gsd", DEFS_DIR);
61
- // Load and validate the definition
62
87
  const rawDef = loadDefinition(defsDir, defName);
63
- // Apply parameter substitution if overrides provided
64
88
  const def = overrides
65
89
  ? substituteParams(rawDef, overrides)
66
- : substituteParams(rawDef); // still resolve default params if any
67
- // Create the run directory
90
+ : substituteParams(rawDef);
68
91
  const timestamp = makeTimestamp();
69
92
  const runDir = join(basePath, ".gsd", RUNS_DIR, defName, timestamp);
70
93
  mkdirSync(runDir, { recursive: true });
71
- // Freeze the definition as DEFINITION.yaml
72
94
  writeFileSync(join(runDir, "DEFINITION.yaml"), stringify(def), "utf-8");
73
- // Initialize and write GRAPH.yaml
74
95
  const graph = initializeGraph(def);
75
96
  writeGraph(runDir, graph);
76
- // Write PARAMS.json if overrides were provided
77
97
  if (overrides && Object.keys(overrides).length > 0) {
78
98
  writeFileSync(join(runDir, "PARAMS.json"), JSON.stringify(overrides, null, 2), "utf-8");
79
99
  }
@@ -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,
@@ -44,19 +44,19 @@ uok:
44
44
  legacy_fallback:
45
45
  enabled: false
46
46
  gates:
47
- enabled: false
47
+ enabled: true
48
48
  model_policy:
49
- enabled: false
49
+ enabled: true
50
50
  execution_graph:
51
- enabled: false
51
+ enabled: true
52
52
  gitops:
53
- enabled: false
54
- turn_action: status-only
53
+ enabled: true
54
+ turn_action: commit
55
55
  turn_push: false
56
56
  audit_unified:
57
- enabled: false
57
+ enabled: true
58
58
  plan_v2:
59
- enabled: false
59
+ enabled: true
60
60
  auto_visualize:
61
61
  auto_report:
62
62
  parallel:
@@ -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();