gsd-pi 2.64.0 → 2.65.0

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 (255) hide show
  1. package/dist/headless.js +3 -1
  2. package/dist/resources/extensions/bg-shell/bg-shell-lifecycle.js +22 -7
  3. package/dist/resources/extensions/bg-shell/process-manager.js +6 -1
  4. package/dist/resources/extensions/gsd/auto-dashboard.js +5 -5
  5. package/dist/resources/extensions/gsd/auto-post-unit.js +98 -1
  6. package/dist/resources/extensions/gsd/auto-verification.js +138 -1
  7. package/dist/resources/extensions/gsd/auto.js +5 -0
  8. package/dist/resources/extensions/gsd/bootstrap/db-tools.js +24 -13
  9. package/dist/resources/extensions/gsd/bootstrap/notify-interceptor.js +28 -0
  10. package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +8 -0
  11. package/dist/resources/extensions/gsd/bootstrap/register-shortcuts.js +16 -0
  12. package/dist/resources/extensions/gsd/bootstrap/system-context.js +20 -0
  13. package/dist/resources/extensions/gsd/commands/catalog.js +7 -1
  14. package/dist/resources/extensions/gsd/commands/handlers/core.js +1 -0
  15. package/dist/resources/extensions/gsd/commands/handlers/notifications-handler.js +104 -0
  16. package/dist/resources/extensions/gsd/commands/handlers/ops.js +5 -0
  17. package/dist/resources/extensions/gsd/notification-overlay.js +256 -0
  18. package/dist/resources/extensions/gsd/notification-store.js +273 -0
  19. package/dist/resources/extensions/gsd/notification-widget.js +56 -0
  20. package/dist/resources/extensions/gsd/post-execution-checks.js +407 -0
  21. package/dist/resources/extensions/gsd/pre-execution-checks.js +464 -0
  22. package/dist/resources/extensions/gsd/preferences-types.js +4 -0
  23. package/dist/resources/extensions/gsd/preferences-validation.js +33 -0
  24. package/dist/resources/extensions/gsd/preferences.js +4 -0
  25. package/dist/resources/extensions/gsd/verification-evidence.js +18 -0
  26. package/dist/resources/extensions/gsd/workflow-logger.js +8 -0
  27. package/dist/web/standalone/.next/BUILD_ID +1 -1
  28. package/dist/web/standalone/.next/app-path-routes-manifest.json +7 -6
  29. package/dist/web/standalone/.next/build-manifest.json +2 -2
  30. package/dist/web/standalone/.next/prerender-manifest.json +3 -3
  31. package/dist/web/standalone/.next/required-server-files.json +1 -1
  32. package/dist/web/standalone/.next/routes-manifest.json +6 -0
  33. package/dist/web/standalone/.next/server/app/_global-error.html +2 -2
  34. package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
  35. package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  36. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  37. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  38. package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  39. package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  40. package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  41. package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
  42. package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
  43. package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  44. package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  45. package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  46. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  47. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  48. package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  49. package/dist/web/standalone/.next/server/app/api/notifications/route.js +3 -0
  50. package/dist/web/standalone/.next/server/app/api/notifications/route.js.nft.json +1 -0
  51. package/dist/web/standalone/.next/server/app/api/notifications/route_client-reference-manifest.js +1 -0
  52. package/dist/web/standalone/.next/server/app/index.html +1 -1
  53. package/dist/web/standalone/.next/server/app/index.rsc +1 -1
  54. package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  55. package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
  56. package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  57. package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
  58. package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  59. package/dist/web/standalone/.next/server/app-paths-manifest.json +7 -6
  60. package/dist/web/standalone/.next/server/functions-config-manifest.json +1 -0
  61. package/dist/web/standalone/.next/server/pages/404.html +1 -1
  62. package/dist/web/standalone/.next/server/pages/500.html +2 -2
  63. package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
  64. package/dist/web/standalone/.next/static/MRM3OSYIAa4HMDqVGQ9nt/_buildManifest.js +1 -0
  65. package/dist/web/standalone/.next/static/chunks/app/_global-error/page-8805a20e15762c3c.js +1 -0
  66. package/dist/web/standalone/.next/static/chunks/app/api/boot/route-8805a20e15762c3c.js +1 -0
  67. package/dist/web/standalone/.next/static/chunks/app/api/bridge-terminal/input/route-8805a20e15762c3c.js +1 -0
  68. package/dist/web/standalone/.next/static/chunks/app/api/bridge-terminal/resize/route-8805a20e15762c3c.js +1 -0
  69. package/dist/web/standalone/.next/static/chunks/app/api/bridge-terminal/stream/route-8805a20e15762c3c.js +1 -0
  70. package/dist/web/standalone/.next/static/chunks/app/api/browse-directories/route-8805a20e15762c3c.js +1 -0
  71. package/dist/web/standalone/.next/static/chunks/app/api/captures/route-8805a20e15762c3c.js +1 -0
  72. package/dist/web/standalone/.next/static/chunks/app/api/cleanup/route-8805a20e15762c3c.js +1 -0
  73. package/dist/web/standalone/.next/static/chunks/app/api/dev-mode/route-8805a20e15762c3c.js +1 -0
  74. package/dist/web/standalone/.next/static/chunks/app/api/doctor/route-8805a20e15762c3c.js +1 -0
  75. package/dist/web/standalone/.next/static/chunks/app/api/experimental/route-8805a20e15762c3c.js +1 -0
  76. package/dist/web/standalone/.next/static/chunks/app/api/export-data/route-8805a20e15762c3c.js +1 -0
  77. package/dist/web/standalone/.next/static/chunks/app/api/files/route-8805a20e15762c3c.js +1 -0
  78. package/dist/web/standalone/.next/static/chunks/app/api/forensics/route-8805a20e15762c3c.js +1 -0
  79. package/dist/web/standalone/.next/static/chunks/app/api/git/route-8805a20e15762c3c.js +1 -0
  80. package/dist/web/standalone/.next/static/chunks/app/api/history/route-8805a20e15762c3c.js +1 -0
  81. package/dist/web/standalone/.next/static/chunks/app/api/hooks/route-8805a20e15762c3c.js +1 -0
  82. package/dist/web/standalone/.next/static/chunks/app/api/inspect/route-8805a20e15762c3c.js +1 -0
  83. package/dist/web/standalone/.next/static/chunks/app/api/knowledge/route-8805a20e15762c3c.js +1 -0
  84. package/dist/web/standalone/.next/static/chunks/app/api/live-state/route-8805a20e15762c3c.js +1 -0
  85. package/dist/web/standalone/.next/static/chunks/app/api/notifications/route-8805a20e15762c3c.js +1 -0
  86. package/dist/web/standalone/.next/static/chunks/app/api/onboarding/route-8805a20e15762c3c.js +1 -0
  87. package/dist/web/standalone/.next/static/chunks/app/api/preferences/route-8805a20e15762c3c.js +1 -0
  88. package/dist/web/standalone/.next/static/chunks/app/api/projects/route-8805a20e15762c3c.js +1 -0
  89. package/dist/web/standalone/.next/static/chunks/app/api/recovery/route-8805a20e15762c3c.js +1 -0
  90. package/dist/web/standalone/.next/static/chunks/app/api/remote-questions/route-8805a20e15762c3c.js +1 -0
  91. package/dist/web/standalone/.next/static/chunks/app/api/session/browser/route-8805a20e15762c3c.js +1 -0
  92. package/dist/web/standalone/.next/static/chunks/app/api/session/command/route-8805a20e15762c3c.js +1 -0
  93. package/dist/web/standalone/.next/static/chunks/app/api/session/events/route-8805a20e15762c3c.js +1 -0
  94. package/dist/web/standalone/.next/static/chunks/app/api/session/manage/route-8805a20e15762c3c.js +1 -0
  95. package/dist/web/standalone/.next/static/chunks/app/api/settings-data/route-8805a20e15762c3c.js +1 -0
  96. package/dist/web/standalone/.next/static/chunks/app/api/shutdown/route-8805a20e15762c3c.js +1 -0
  97. package/dist/web/standalone/.next/static/chunks/app/api/skill-health/route-8805a20e15762c3c.js +1 -0
  98. package/dist/web/standalone/.next/static/chunks/app/api/steer/route-8805a20e15762c3c.js +1 -0
  99. package/dist/web/standalone/.next/static/chunks/app/api/switch-root/route-8805a20e15762c3c.js +1 -0
  100. package/dist/web/standalone/.next/static/chunks/app/api/terminal/input/route-8805a20e15762c3c.js +1 -0
  101. package/dist/web/standalone/.next/static/chunks/app/api/terminal/resize/route-8805a20e15762c3c.js +1 -0
  102. package/dist/web/standalone/.next/static/chunks/app/api/terminal/sessions/route-8805a20e15762c3c.js +1 -0
  103. package/dist/web/standalone/.next/static/chunks/app/api/terminal/stream/route-8805a20e15762c3c.js +1 -0
  104. package/dist/web/standalone/.next/static/chunks/app/api/terminal/upload/route-8805a20e15762c3c.js +1 -0
  105. package/dist/web/standalone/.next/static/chunks/app/api/undo/route-8805a20e15762c3c.js +1 -0
  106. package/dist/web/standalone/.next/static/chunks/app/api/update/route-8805a20e15762c3c.js +1 -0
  107. package/dist/web/standalone/.next/static/chunks/app/api/visualizer/route-8805a20e15762c3c.js +1 -0
  108. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-8805a20e15762c3c.js +1 -0
  109. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-8805a20e15762c3c.js +1 -0
  110. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-8805a20e15762c3c.js +1 -0
  111. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-8805a20e15762c3c.js +1 -0
  112. package/dist/web/standalone/server.js +1 -1
  113. package/package.json +1 -1
  114. package/packages/pi-agent-core/dist/agent-loop.js +26 -9
  115. package/packages/pi-agent-core/dist/agent-loop.js.map +1 -1
  116. package/packages/pi-agent-core/src/agent-loop.test.ts +100 -4
  117. package/packages/pi-agent-core/src/agent-loop.ts +43 -12
  118. package/packages/pi-coding-agent/dist/core/agent-session-tool-refresh.test.d.ts +2 -0
  119. package/packages/pi-coding-agent/dist/core/agent-session-tool-refresh.test.d.ts.map +1 -0
  120. package/packages/pi-coding-agent/dist/core/agent-session-tool-refresh.test.js +38 -0
  121. package/packages/pi-coding-agent/dist/core/agent-session-tool-refresh.test.js.map +1 -0
  122. package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
  123. package/packages/pi-coding-agent/dist/core/agent-session.js +11 -0
  124. package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
  125. package/packages/pi-coding-agent/dist/core/resource-loader-cache-reset.test.d.ts +2 -0
  126. package/packages/pi-coding-agent/dist/core/resource-loader-cache-reset.test.d.ts.map +1 -0
  127. package/packages/pi-coding-agent/dist/core/resource-loader-cache-reset.test.js +24 -0
  128. package/packages/pi-coding-agent/dist/core/resource-loader-cache-reset.test.js.map +1 -0
  129. package/packages/pi-coding-agent/dist/core/resource-loader.d.ts.map +1 -1
  130. package/packages/pi-coding-agent/dist/core/resource-loader.js +4 -1
  131. package/packages/pi-coding-agent/dist/core/resource-loader.js.map +1 -1
  132. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts +1 -0
  133. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  134. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +8 -0
  135. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
  136. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +6 -0
  137. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  138. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +36 -0
  139. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
  140. package/packages/pi-coding-agent/package.json +1 -1
  141. package/packages/pi-coding-agent/src/core/agent-session-tool-refresh.test.ts +64 -0
  142. package/packages/pi-coding-agent/src/core/agent-session.ts +10 -0
  143. package/packages/pi-coding-agent/src/core/resource-loader-cache-reset.test.ts +42 -0
  144. package/packages/pi-coding-agent/src/core/resource-loader.ts +5 -1
  145. package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +9 -0
  146. package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +33 -0
  147. package/packages/pi-tui/dist/__tests__/overlay-layout.test.d.ts +2 -0
  148. package/packages/pi-tui/dist/__tests__/overlay-layout.test.d.ts.map +1 -0
  149. package/packages/pi-tui/dist/__tests__/overlay-layout.test.js +66 -0
  150. package/packages/pi-tui/dist/__tests__/overlay-layout.test.js.map +1 -0
  151. package/packages/pi-tui/dist/components/loader.d.ts +4 -2
  152. package/packages/pi-tui/dist/components/loader.d.ts.map +1 -1
  153. package/packages/pi-tui/dist/components/loader.js +27 -9
  154. package/packages/pi-tui/dist/components/loader.js.map +1 -1
  155. package/packages/pi-tui/dist/components/text.d.ts.map +1 -1
  156. package/packages/pi-tui/dist/components/text.js +2 -0
  157. package/packages/pi-tui/dist/components/text.js.map +1 -1
  158. package/packages/pi-tui/dist/overlay-layout.d.ts.map +1 -1
  159. package/packages/pi-tui/dist/overlay-layout.js +12 -1
  160. package/packages/pi-tui/dist/overlay-layout.js.map +1 -1
  161. package/packages/pi-tui/dist/tui.d.ts +4 -0
  162. package/packages/pi-tui/dist/tui.d.ts.map +1 -1
  163. package/packages/pi-tui/dist/tui.js +35 -0
  164. package/packages/pi-tui/dist/tui.js.map +1 -1
  165. package/packages/pi-tui/src/__tests__/overlay-layout.test.ts +82 -0
  166. package/packages/pi-tui/src/components/loader.ts +27 -10
  167. package/packages/pi-tui/src/components/text.ts +1 -0
  168. package/packages/pi-tui/src/overlay-layout.ts +13 -1
  169. package/packages/pi-tui/src/tui.ts +34 -0
  170. package/pkg/package.json +1 -1
  171. package/src/resources/extensions/bg-shell/bg-shell-lifecycle.ts +19 -7
  172. package/src/resources/extensions/bg-shell/process-manager.ts +8 -2
  173. package/src/resources/extensions/gsd/auto-dashboard.ts +5 -4
  174. package/src/resources/extensions/gsd/auto-post-unit.ts +122 -0
  175. package/src/resources/extensions/gsd/auto-verification.ts +190 -2
  176. package/src/resources/extensions/gsd/auto.ts +4 -0
  177. package/src/resources/extensions/gsd/bootstrap/db-tools.ts +25 -13
  178. package/src/resources/extensions/gsd/bootstrap/notify-interceptor.ts +34 -0
  179. package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +8 -0
  180. package/src/resources/extensions/gsd/bootstrap/register-shortcuts.ts +20 -0
  181. package/src/resources/extensions/gsd/bootstrap/system-context.ts +28 -0
  182. package/src/resources/extensions/gsd/commands/catalog.ts +7 -1
  183. package/src/resources/extensions/gsd/commands/handlers/core.ts +1 -0
  184. package/src/resources/extensions/gsd/commands/handlers/notifications-handler.ts +140 -0
  185. package/src/resources/extensions/gsd/commands/handlers/ops.ts +5 -0
  186. package/src/resources/extensions/gsd/notification-overlay.ts +295 -0
  187. package/src/resources/extensions/gsd/notification-store.ts +293 -0
  188. package/src/resources/extensions/gsd/notification-widget.ts +68 -0
  189. package/src/resources/extensions/gsd/post-execution-checks.ts +539 -0
  190. package/src/resources/extensions/gsd/pre-execution-checks.ts +573 -0
  191. package/src/resources/extensions/gsd/preferences-types.ts +28 -0
  192. package/src/resources/extensions/gsd/preferences-validation.ts +33 -0
  193. package/src/resources/extensions/gsd/preferences.ts +4 -0
  194. package/src/resources/extensions/gsd/tests/auto-start-time-persistence.test.ts +50 -0
  195. package/src/resources/extensions/gsd/tests/complete-slice-string-coercion.test.ts +36 -0
  196. package/src/resources/extensions/gsd/tests/discuss-tool-scope-leak.test.ts +76 -0
  197. package/src/resources/extensions/gsd/tests/enhanced-verification-integration.test.ts +526 -0
  198. package/src/resources/extensions/gsd/tests/notification-overlay.test.ts +73 -0
  199. package/src/resources/extensions/gsd/tests/notification-store.test.ts +282 -0
  200. package/src/resources/extensions/gsd/tests/post-exec-retry-bypass.test.ts +312 -0
  201. package/src/resources/extensions/gsd/tests/post-execution-checks.test.ts +813 -0
  202. package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +999 -0
  203. package/src/resources/extensions/gsd/tests/pre-execution-fail-closed.test.ts +266 -0
  204. package/src/resources/extensions/gsd/tests/pre-execution-pause-wiring.test.ts +457 -0
  205. package/src/resources/extensions/gsd/tests/unstructured-continue-context-injection.test.ts +163 -0
  206. package/src/resources/extensions/gsd/verification-evidence.ts +68 -0
  207. package/src/resources/extensions/gsd/workflow-logger.ts +13 -0
  208. package/dist/web/standalone/.next/static/chunks/app/_global-error/page-c4cc189e7b117ea2.js +0 -1
  209. package/dist/web/standalone/.next/static/chunks/app/api/boot/route-c4cc189e7b117ea2.js +0 -1
  210. package/dist/web/standalone/.next/static/chunks/app/api/bridge-terminal/input/route-c4cc189e7b117ea2.js +0 -1
  211. package/dist/web/standalone/.next/static/chunks/app/api/bridge-terminal/resize/route-c4cc189e7b117ea2.js +0 -1
  212. package/dist/web/standalone/.next/static/chunks/app/api/bridge-terminal/stream/route-c4cc189e7b117ea2.js +0 -1
  213. package/dist/web/standalone/.next/static/chunks/app/api/browse-directories/route-c4cc189e7b117ea2.js +0 -1
  214. package/dist/web/standalone/.next/static/chunks/app/api/captures/route-c4cc189e7b117ea2.js +0 -1
  215. package/dist/web/standalone/.next/static/chunks/app/api/cleanup/route-c4cc189e7b117ea2.js +0 -1
  216. package/dist/web/standalone/.next/static/chunks/app/api/dev-mode/route-c4cc189e7b117ea2.js +0 -1
  217. package/dist/web/standalone/.next/static/chunks/app/api/doctor/route-c4cc189e7b117ea2.js +0 -1
  218. package/dist/web/standalone/.next/static/chunks/app/api/experimental/route-c4cc189e7b117ea2.js +0 -1
  219. package/dist/web/standalone/.next/static/chunks/app/api/export-data/route-c4cc189e7b117ea2.js +0 -1
  220. package/dist/web/standalone/.next/static/chunks/app/api/files/route-c4cc189e7b117ea2.js +0 -1
  221. package/dist/web/standalone/.next/static/chunks/app/api/forensics/route-c4cc189e7b117ea2.js +0 -1
  222. package/dist/web/standalone/.next/static/chunks/app/api/git/route-c4cc189e7b117ea2.js +0 -1
  223. package/dist/web/standalone/.next/static/chunks/app/api/history/route-c4cc189e7b117ea2.js +0 -1
  224. package/dist/web/standalone/.next/static/chunks/app/api/hooks/route-c4cc189e7b117ea2.js +0 -1
  225. package/dist/web/standalone/.next/static/chunks/app/api/inspect/route-c4cc189e7b117ea2.js +0 -1
  226. package/dist/web/standalone/.next/static/chunks/app/api/knowledge/route-c4cc189e7b117ea2.js +0 -1
  227. package/dist/web/standalone/.next/static/chunks/app/api/live-state/route-c4cc189e7b117ea2.js +0 -1
  228. package/dist/web/standalone/.next/static/chunks/app/api/onboarding/route-c4cc189e7b117ea2.js +0 -1
  229. package/dist/web/standalone/.next/static/chunks/app/api/preferences/route-c4cc189e7b117ea2.js +0 -1
  230. package/dist/web/standalone/.next/static/chunks/app/api/projects/route-c4cc189e7b117ea2.js +0 -1
  231. package/dist/web/standalone/.next/static/chunks/app/api/recovery/route-c4cc189e7b117ea2.js +0 -1
  232. package/dist/web/standalone/.next/static/chunks/app/api/remote-questions/route-c4cc189e7b117ea2.js +0 -1
  233. package/dist/web/standalone/.next/static/chunks/app/api/session/browser/route-c4cc189e7b117ea2.js +0 -1
  234. package/dist/web/standalone/.next/static/chunks/app/api/session/command/route-c4cc189e7b117ea2.js +0 -1
  235. package/dist/web/standalone/.next/static/chunks/app/api/session/events/route-c4cc189e7b117ea2.js +0 -1
  236. package/dist/web/standalone/.next/static/chunks/app/api/session/manage/route-c4cc189e7b117ea2.js +0 -1
  237. package/dist/web/standalone/.next/static/chunks/app/api/settings-data/route-c4cc189e7b117ea2.js +0 -1
  238. package/dist/web/standalone/.next/static/chunks/app/api/shutdown/route-c4cc189e7b117ea2.js +0 -1
  239. package/dist/web/standalone/.next/static/chunks/app/api/skill-health/route-c4cc189e7b117ea2.js +0 -1
  240. package/dist/web/standalone/.next/static/chunks/app/api/steer/route-c4cc189e7b117ea2.js +0 -1
  241. package/dist/web/standalone/.next/static/chunks/app/api/switch-root/route-c4cc189e7b117ea2.js +0 -1
  242. package/dist/web/standalone/.next/static/chunks/app/api/terminal/input/route-c4cc189e7b117ea2.js +0 -1
  243. package/dist/web/standalone/.next/static/chunks/app/api/terminal/resize/route-c4cc189e7b117ea2.js +0 -1
  244. package/dist/web/standalone/.next/static/chunks/app/api/terminal/sessions/route-c4cc189e7b117ea2.js +0 -1
  245. package/dist/web/standalone/.next/static/chunks/app/api/terminal/stream/route-c4cc189e7b117ea2.js +0 -1
  246. package/dist/web/standalone/.next/static/chunks/app/api/terminal/upload/route-c4cc189e7b117ea2.js +0 -1
  247. package/dist/web/standalone/.next/static/chunks/app/api/undo/route-c4cc189e7b117ea2.js +0 -1
  248. package/dist/web/standalone/.next/static/chunks/app/api/update/route-c4cc189e7b117ea2.js +0 -1
  249. package/dist/web/standalone/.next/static/chunks/app/api/visualizer/route-c4cc189e7b117ea2.js +0 -1
  250. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-c4cc189e7b117ea2.js +0 -1
  251. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-c4cc189e7b117ea2.js +0 -1
  252. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-c4cc189e7b117ea2.js +0 -1
  253. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-c4cc189e7b117ea2.js +0 -1
  254. package/dist/web/standalone/.next/static/eebXKteM9EaWyseHKTjqp/_buildManifest.js +0 -1
  255. /package/dist/web/standalone/.next/static/{eebXKteM9EaWyseHKTjqp → MRM3OSYIAa4HMDqVGQ9nt}/_ssgManifest.js +0 -0
package/dist/headless.js CHANGED
@@ -184,7 +184,9 @@ async function runHeadlessOnce(options, restartCount) {
184
184
  // per-unit timeout via auto-supervisor. Disable the overall timeout unless the
185
185
  // user explicitly set --timeout.
186
186
  const isAutoMode = options.command === 'auto';
187
- const isMultiTurnCommand = options.command === 'auto' || options.command === 'next';
187
+ // discuss and plan are multi-turn: they involve multiple question rounds,
188
+ // codebase scanning, and artifact writing before the workflow completes (#3547).
189
+ const isMultiTurnCommand = options.command === 'auto' || options.command === 'next' || options.command === 'discuss' || options.command === 'plan';
188
190
  if (isAutoMode && options.timeout === 300_000) {
189
191
  options.timeout = 0;
190
192
  }
@@ -3,7 +3,7 @@
3
3
  * context injection, process discovery, footer widget, and periodic maintenance.
4
4
  */
5
5
  import { truncateToWidth, visibleWidth, } from "@gsd/pi-tui";
6
- import { processes, pendingAlerts, cleanupAll, cleanupSessionProcesses, persistManifest, loadManifest, pruneDeadProcesses, } from "./process-manager.js";
6
+ import { processes, pendingAlerts, pushAlert, cleanupAll, cleanupSessionProcesses, persistManifest, loadManifest, pruneDeadProcesses, } from "./process-manager.js";
7
7
  import { formatUptime, getBgShellLiveCwd, resolveBgShellPersistenceCwd } from "./utilities.js";
8
8
  import { formatTokenCount } from "../shared/format-utils.js";
9
9
  export function registerBgShellLifecycle(pi, state) {
@@ -15,17 +15,32 @@ export function registerBgShellLifecycle(pi, state) {
15
15
  state.latestCtx = { ...state.latestCtx, cwd: syncedCwd };
16
16
  }
17
17
  }
18
- // Clean up on session shutdown
19
- pi.on("session_shutdown", async () => {
20
- cleanupAll();
21
- });
22
18
  // Register signal handlers to clean up bg processes on unexpected exit (fixes #428)
23
19
  const signalCleanup = () => {
24
20
  cleanupAll();
21
+ // Also kill bash-tool spawned children that bg-shell doesn't track
22
+ try {
23
+ const { listDescendants } = require("@gsd/native");
24
+ const descendants = listDescendants(process.pid);
25
+ for (const childPid of descendants) {
26
+ try {
27
+ process.kill(childPid, "SIGKILL");
28
+ }
29
+ catch { }
30
+ }
31
+ }
32
+ catch { }
25
33
  };
26
34
  process.on("SIGTERM", signalCleanup);
27
35
  process.on("SIGINT", signalCleanup);
28
36
  process.on("beforeExit", signalCleanup);
37
+ // Clean up on session shutdown — remove signal handlers to prevent accumulation
38
+ pi.on("session_shutdown", async () => {
39
+ process.off("SIGTERM", signalCleanup);
40
+ process.off("SIGINT", signalCleanup);
41
+ process.off("beforeExit", signalCleanup);
42
+ cleanupAll();
43
+ });
29
44
  // ── Compaction Awareness: Survive Context Resets ───────────────
30
45
  /** Build a compact state summary of all alive processes for context re-injection */
31
46
  function buildProcessStateAlert(reason) {
@@ -39,7 +54,7 @@ export function registerBgShellLifecycle(pi, state) {
39
54
  const groupInfo = p.group ? ` [${p.group}]` : "";
40
55
  return ` - id:${p.id} "${p.label}" [${p.processType}] status:${p.status} uptime:${formatUptime(Date.now() - p.startedAt)}${portInfo}${urlInfo}${errInfo}${groupInfo}`;
41
56
  }).join("\n");
42
- pendingAlerts.push(`${reason} ${alive.length} background process(es) are still running:\n${processSummaries}\nUse bg_shell digest/output/kill with these IDs.`);
57
+ pushAlert(null, `${reason} ${alive.length} background process(es) are still running:\n${processSummaries}\nUse bg_shell digest/output/kill with these IDs.`);
43
58
  }
44
59
  // After compaction, the LLM loses all memory of running processes.
45
60
  // Queue a detailed alert so the next before_agent_start injects full state.
@@ -108,7 +123,7 @@ export function registerBgShellLifecycle(pi, state) {
108
123
  }
109
124
  if (surviving.length > 0) {
110
125
  const summary = surviving.map(s => ` - ${s.id}: ${s.label} (pid ${s.pid}, type: ${s.processType}${s.group ? `, group: ${s.group}` : ""})`).join("\n");
111
- pendingAlerts.push(`${surviving.length} background process(es) from previous session still running:\n${summary}\n Note: These processes are outside bg_shell's control. Kill them manually if needed.`);
126
+ pushAlert(null, `${surviving.length} background process(es) from previous session still running:\n${summary}\n Note: These processes are outside bg_shell's control. Kill them manually if needed.`);
112
127
  }
113
128
  }
114
129
  });
@@ -16,6 +16,7 @@ import { startPortProbing, transitionToReady } from "./readiness-detector.js";
16
16
  export const processes = new Map();
17
17
  /** Pending alerts to inject into the next agent context */
18
18
  export let pendingAlerts = [];
19
+ const MAX_PENDING_ALERTS = 50;
19
20
  /** Replace the pendingAlerts array (used by the extension entry point) */
20
21
  export function setPendingAlerts(alerts) {
21
22
  pendingAlerts = alerts;
@@ -41,7 +42,11 @@ export function addEvent(bg, event) {
41
42
  }
42
43
  }
43
44
  export function pushAlert(bg, message) {
44
- pendingAlerts.push(`[bg:${bg.id} ${bg.label}] ${message}`);
45
+ const prefix = bg ? `[bg:${bg.id} ${bg.label}] ` : "";
46
+ pendingAlerts.push(`${prefix}${message}`);
47
+ if (pendingAlerts.length > MAX_PENDING_ALERTS) {
48
+ pendingAlerts.splice(0, pendingAlerts.length - MAX_PENDING_ALERTS);
49
+ }
45
50
  }
46
51
  export function getInfo(p) {
47
52
  return {
@@ -472,11 +472,11 @@ export function updateProgressWidget(ctx, unitType, unitId, state, accessors, ti
472
472
  : "";
473
473
  lines.push(rightAlign(headerLeft, headerRight, width));
474
474
  // Worktree/branch right-aligned below header
475
- if (worktreeName && cachedBranch) {
476
- lines.push(rightAlign("", theme.fg("dim", `${worktreeName} (${cachedBranch})`), width));
477
- }
478
- else if (cachedBranch) {
479
- lines.push(rightAlign("", theme.fg("dim", cachedBranch), width));
475
+ const branchLabel = worktreeName && cachedBranch
476
+ ? `${worktreeName} (${cachedBranch})`
477
+ : cachedBranch ?? "";
478
+ if (branchLabel) {
479
+ lines.push(rightAlign("", theme.fg("dim", branchLabel), width));
480
480
  }
481
481
  // Show health signal details when degraded (yellow/red)
482
482
  if (score.level !== "green" && score.signals.length > 0 && widgetMode !== "min") {
@@ -14,7 +14,7 @@ import { deriveState } from "./state.js";
14
14
  import { logWarning, logError } from "./workflow-logger.js";
15
15
  import { loadFile, parseSummary, resolveAllOverrides } from "./files.js";
16
16
  import { loadPrompt } from "./prompt-loader.js";
17
- import { resolveSliceFile, resolveTaskFile, resolveMilestoneFile, resolveTasksDir, buildTaskFileName, } from "./paths.js";
17
+ import { resolveSliceFile, resolveSlicePath, resolveTaskFile, resolveMilestoneFile, resolveTasksDir, buildTaskFileName, } from "./paths.js";
18
18
  import { invalidateAllCaches } from "./cache.js";
19
19
  import { parseUnitId } from "./unit-id.js";
20
20
  import { closeoutUnit } from "./auto-unit-closeout.js";
@@ -36,6 +36,10 @@ import { validateFileChanges } from "./safety/file-change-validator.js";
36
36
  import { validateContent } from "./safety/content-validator.js";
37
37
  import { resolveSafetyHarnessConfig } from "./safety/safety-harness.js";
38
38
  import { resolveExpectedArtifactPath as resolveArtifactForContent } from "./auto-artifact-paths.js";
39
+ import { loadEffectiveGSDPreferences } from "./preferences.js";
40
+ import { getSliceTasks } from "./gsd-db.js";
41
+ import { runPreExecutionChecks } from "./pre-execution-checks.js";
42
+ import { writePreExecutionEvidence } from "./verification-evidence.js";
39
43
  /** Maximum verification retry attempts before escalating to blocker placeholder (#2653). */
40
44
  const MAX_VERIFICATION_RETRIES = 3;
41
45
  /** Enqueue a sidecar item (hook, triage, or quick-task) for the main loop to
@@ -634,6 +638,99 @@ export async function postUnitPostVerification(pctx) {
634
638
  debugLog("postUnit", { phase: "capture-protection-error", error: String(e) });
635
639
  }
636
640
  }
641
+ // ── Pre-execution checks (after plan-slice completes) ──
642
+ if (s.currentUnit &&
643
+ s.currentUnit.type === "plan-slice") {
644
+ let preExecPauseNeeded = false;
645
+ await runSafely("postUnitPostVerification", "pre-execution-checks", async () => {
646
+ try {
647
+ // Check preferences — respect enhanced_verification and enhanced_verification_pre
648
+ const prefs = loadEffectiveGSDPreferences()?.preferences;
649
+ const enhancedEnabled = prefs?.enhanced_verification !== false; // default true
650
+ const preEnabled = prefs?.enhanced_verification_pre !== false; // default true
651
+ if (!enhancedEnabled || !preEnabled) {
652
+ debugLog("postUnitPostVerification", {
653
+ phase: "pre-execution-checks",
654
+ skipped: true,
655
+ reason: "disabled by preferences",
656
+ });
657
+ return;
658
+ }
659
+ // Parse the unit ID to get milestone/slice IDs
660
+ const { milestone: mid, slice: sid } = parseUnitId(s.currentUnit.id);
661
+ if (!mid || !sid) {
662
+ debugLog("postUnitPostVerification", {
663
+ phase: "pre-execution-checks",
664
+ skipped: true,
665
+ reason: "could not parse milestone/slice from unit ID",
666
+ });
667
+ return;
668
+ }
669
+ // Get tasks for this slice from DB
670
+ const tasks = getSliceTasks(mid, sid);
671
+ if (tasks.length === 0) {
672
+ debugLog("postUnitPostVerification", {
673
+ phase: "pre-execution-checks",
674
+ skipped: true,
675
+ reason: "no tasks found for slice",
676
+ });
677
+ return;
678
+ }
679
+ // Run pre-execution checks
680
+ const result = await runPreExecutionChecks(tasks, s.basePath);
681
+ // Log summary to stderr in existing verification output format
682
+ const emoji = result.status === "pass" ? "✅" : result.status === "warn" ? "⚠️" : "❌";
683
+ process.stderr.write(`gsd-pre-exec: ${emoji} Pre-execution checks ${result.status} for ${mid}/${sid} (${result.durationMs}ms)\n`);
684
+ // Log individual check results
685
+ for (const check of result.checks) {
686
+ const checkEmoji = check.passed ? "✓" : check.blocking ? "✗" : "⚠";
687
+ process.stderr.write(`gsd-pre-exec: ${checkEmoji} [${check.category}] ${check.target}: ${check.message}\n`);
688
+ }
689
+ // Write evidence JSON to slice artifacts directory
690
+ const slicePath = resolveSlicePath(s.basePath, mid, sid);
691
+ if (slicePath) {
692
+ writePreExecutionEvidence(result, slicePath, mid, sid);
693
+ }
694
+ // Notify UI
695
+ if (result.status === "fail") {
696
+ const blockingCount = result.checks.filter(c => !c.passed && c.blocking).length;
697
+ ctx.ui.notify(`Pre-execution checks failed: ${blockingCount} blocking issue${blockingCount === 1 ? "" : "s"} found`, "error");
698
+ preExecPauseNeeded = true;
699
+ }
700
+ else if (result.status === "warn") {
701
+ ctx.ui.notify(`Pre-execution checks passed with warnings`, "warning");
702
+ // Strict mode: treat warnings as blocking
703
+ if (prefs?.enhanced_verification_strict === true) {
704
+ preExecPauseNeeded = true;
705
+ }
706
+ }
707
+ debugLog("postUnitPostVerification", {
708
+ phase: "pre-execution-checks",
709
+ status: result.status,
710
+ checkCount: result.checks.length,
711
+ durationMs: result.durationMs,
712
+ });
713
+ }
714
+ catch (preExecError) {
715
+ // Fail-closed: if runPreExecutionChecks throws, pause auto-mode instead of silently continuing
716
+ const errorMessage = preExecError instanceof Error ? preExecError.message : String(preExecError);
717
+ debugLog("postUnitPostVerification", {
718
+ phase: "pre-execution-checks",
719
+ error: errorMessage,
720
+ failClosed: true,
721
+ });
722
+ logError("engine", `gsd-pre-exec: Pre-execution checks threw an error: ${errorMessage}`);
723
+ ctx.ui.notify(`Pre-execution checks error: ${errorMessage} — pausing for human review`, "error");
724
+ preExecPauseNeeded = true;
725
+ }
726
+ });
727
+ // Check for blocking failures after runSafely completes
728
+ if (preExecPauseNeeded) {
729
+ debugLog("postUnitPostVerification", { phase: "pre-execution-checks", pausing: true, reason: "blocking failures detected" });
730
+ await pauseAuto(ctx, pi);
731
+ return "stopped";
732
+ }
733
+ }
637
734
  // ── Triage check ──
638
735
  if (!s.stepMode &&
639
736
  s.currentUnit &&
@@ -9,13 +9,15 @@
9
9
  * value instead of calling return/pauseAuto directly — the caller
10
10
  * checks the result and handles control flow.
11
11
  */
12
+ import { mkdirSync, writeFileSync } from "node:fs";
12
13
  import { resolveSlicePath } from "./paths.js";
13
14
  import { parseUnitId } from "./unit-id.js";
14
- import { isDbAvailable, getTask } from "./gsd-db.js";
15
+ import { isDbAvailable, getTask, getSliceTasks } from "./gsd-db.js";
15
16
  import { loadEffectiveGSDPreferences } from "./preferences.js";
16
17
  import { runVerificationGate, formatFailureContext, captureRuntimeErrors, runDependencyAudit, } from "./verification-gate.js";
17
18
  import { writeVerificationJSON } from "./verification-evidence.js";
18
19
  import { logWarning } from "./workflow-logger.js";
20
+ import { runPostExecutionChecks } from "./post-execution-checks.js";
19
21
  import { join } from "node:path";
20
22
  function isInfraVerificationFailure(stderr) {
21
23
  return /\b(ENOENT|ENOTFOUND|ETIMEDOUT|ECONNRESET|EAI_AGAIN|spawn\s+\S+\s+ENOENT|command not found)\b/i.test(stderr);
@@ -128,12 +130,104 @@ export async function runPostUnitVerification(vctx, pauseAuto) {
128
130
  : "Verification failed due to infrastructure/runtime environment issues — treating as advisory.", "warning");
129
131
  return "continue";
130
132
  }
133
+ // ── Post-execution checks (run after main verification passes for execute-task units) ──
134
+ let postExecChecks;
135
+ let postExecBlockingFailure = false;
136
+ if (result.passed && mid && sid && tid) {
137
+ // Check preferences — respect enhanced_verification and enhanced_verification_post
138
+ const enhancedEnabled = prefs?.enhanced_verification !== false; // default true
139
+ const postEnabled = prefs?.enhanced_verification_post !== false; // default true
140
+ if (enhancedEnabled && postEnabled && isDbAvailable()) {
141
+ try {
142
+ // Get the completed task from DB
143
+ const taskRow = getTask(mid, sid, tid);
144
+ if (taskRow && taskRow.key_files && taskRow.key_files.length > 0) {
145
+ // Get all tasks in the slice
146
+ const allTasks = getSliceTasks(mid, sid);
147
+ // Filter to prior completed tasks (status = 'complete' or 'done', before current task)
148
+ const priorTasks = allTasks.filter((t) => (t.status === "complete" || t.status === "done") &&
149
+ t.id !== tid &&
150
+ t.sequence < taskRow.sequence);
151
+ // Run post-execution checks
152
+ const postExecResult = runPostExecutionChecks(taskRow, priorTasks, s.basePath);
153
+ // Store checks for evidence JSON
154
+ postExecChecks = postExecResult.checks;
155
+ // Log summary to stderr with gsd-post-exec: prefix
156
+ const emoji = postExecResult.status === "pass"
157
+ ? "✅"
158
+ : postExecResult.status === "warn"
159
+ ? "⚠️"
160
+ : "❌";
161
+ process.stderr.write(`gsd-post-exec: ${emoji} Post-execution checks ${postExecResult.status} for ${mid}/${sid}/${tid} (${postExecResult.durationMs}ms)\n`);
162
+ // Log individual check results
163
+ for (const check of postExecResult.checks) {
164
+ const checkEmoji = check.passed
165
+ ? "✓"
166
+ : check.blocking
167
+ ? "✗"
168
+ : "⚠";
169
+ process.stderr.write(`gsd-post-exec: ${checkEmoji} [${check.category}] ${check.target}: ${check.message}\n`);
170
+ }
171
+ // Check for blocking failures
172
+ if (postExecResult.status === "fail") {
173
+ postExecBlockingFailure = true;
174
+ const blockingCount = postExecResult.checks.filter((c) => !c.passed && c.blocking).length;
175
+ ctx.ui.notify(`Post-execution checks failed: ${blockingCount} blocking issue${blockingCount === 1 ? "" : "s"} found`, "error");
176
+ }
177
+ else if (postExecResult.status === "warn") {
178
+ ctx.ui.notify(`Post-execution checks passed with warnings`, "warning");
179
+ // Strict mode: treat warnings as blocking
180
+ if (prefs?.enhanced_verification_strict === true) {
181
+ postExecBlockingFailure = true;
182
+ }
183
+ }
184
+ }
185
+ }
186
+ catch (postExecErr) {
187
+ // Post-execution check errors are non-fatal — log and continue
188
+ logWarning("engine", `gsd-post-exec: error — ${postExecErr.message}`);
189
+ }
190
+ }
191
+ }
192
+ // Re-write verification evidence JSON with post-execution checks
193
+ if (postExecChecks && postExecChecks.length > 0 && mid && sid && tid) {
194
+ try {
195
+ const sDir = resolveSlicePath(s.basePath, mid, sid);
196
+ if (sDir) {
197
+ const tasksDir = join(sDir, "tasks");
198
+ // Add postExecutionChecks to the result for the JSON write
199
+ const resultWithPostExec = {
200
+ ...result,
201
+ // Mark as failed if there was a blocking post-exec failure
202
+ passed: result.passed && !postExecBlockingFailure,
203
+ };
204
+ // Manually write with postExecutionChecks field
205
+ writeVerificationJSONWithPostExec(resultWithPostExec, tasksDir, tid, s.currentUnit.id, postExecChecks, postExecBlockingFailure ? attempt + 1 : undefined, postExecBlockingFailure ? maxRetries : undefined);
206
+ }
207
+ }
208
+ catch (evidenceErr) {
209
+ logWarning("engine", `verification-evidence: post-exec write error — ${evidenceErr.message}`);
210
+ }
211
+ }
212
+ // Update result.passed based on post-execution checks
213
+ if (postExecBlockingFailure) {
214
+ result.passed = false;
215
+ }
131
216
  // ── Auto-fix retry logic ──
132
217
  if (result.passed) {
133
218
  s.verificationRetryCount.delete(s.currentUnit.id);
134
219
  s.pendingVerificationRetry = null;
135
220
  return "continue";
136
221
  }
222
+ else if (postExecBlockingFailure) {
223
+ // Post-execution failures are cross-task consistency issues — retrying the same task won't fix them.
224
+ // Skip retry and pause immediately for human review.
225
+ s.verificationRetryCount.delete(s.currentUnit.id);
226
+ s.pendingVerificationRetry = null;
227
+ ctx.ui.notify(`Post-execution checks failed — cross-task consistency issue detected, pausing for human review`, "error");
228
+ await pauseAuto(ctx, pi);
229
+ return "pause";
230
+ }
137
231
  else if (autoFixEnabled && attempt + 1 <= maxRetries) {
138
232
  const nextAttempt = attempt + 1;
139
233
  s.verificationRetryCount.set(s.currentUnit.id, nextAttempt);
@@ -173,3 +267,46 @@ export async function runPostUnitVerification(vctx, pauseAuto) {
173
267
  return "continue";
174
268
  }
175
269
  }
270
+ /**
271
+ * Write verification evidence JSON with post-execution checks included.
272
+ * This is a variant of writeVerificationJSON that adds the postExecutionChecks field.
273
+ */
274
+ function writeVerificationJSONWithPostExec(result, tasksDir, taskId, unitId, postExecutionChecks, retryAttempt, maxRetries) {
275
+ mkdirSync(tasksDir, { recursive: true });
276
+ const evidence = {
277
+ schemaVersion: 1,
278
+ taskId,
279
+ unitId: unitId ?? taskId,
280
+ timestamp: result.timestamp,
281
+ passed: result.passed,
282
+ discoverySource: result.discoverySource,
283
+ checks: result.checks.map((check) => ({
284
+ command: check.command,
285
+ exitCode: check.exitCode,
286
+ durationMs: check.durationMs,
287
+ verdict: check.exitCode === 0 ? "pass" : "fail",
288
+ })),
289
+ ...(retryAttempt !== undefined ? { retryAttempt } : {}),
290
+ ...(maxRetries !== undefined ? { maxRetries } : {}),
291
+ postExecutionChecks,
292
+ };
293
+ if (result.runtimeErrors && result.runtimeErrors.length > 0) {
294
+ evidence.runtimeErrors = result.runtimeErrors.map(e => ({
295
+ source: e.source,
296
+ severity: e.severity,
297
+ message: e.message,
298
+ blocking: e.blocking,
299
+ }));
300
+ }
301
+ if (result.auditWarnings && result.auditWarnings.length > 0) {
302
+ evidence.auditWarnings = result.auditWarnings.map(w => ({
303
+ name: w.name,
304
+ severity: w.severity,
305
+ title: w.title,
306
+ url: w.url,
307
+ fixAvailable: w.fixAvailable,
308
+ }));
309
+ }
310
+ const filePath = join(tasksDir, `${taskId}-VERIFY.json`);
311
+ writeFileSync(filePath, JSON.stringify(evidence, null, 2) + "\n", "utf-8");
312
+ }
@@ -643,6 +643,7 @@ export async function pauseAuto(ctx, _pi, _errorContext) {
643
643
  sessionFile: s.pausedSessionFile,
644
644
  activeEngineId: s.activeEngineId,
645
645
  activeRunDir: s.activeRunDir,
646
+ autoStartTime: s.autoStartTime,
646
647
  };
647
648
  const runtimeDir = join(gsdRoot(s.originalBasePath || s.basePath), "runtime");
648
649
  mkdirSync(runtimeDir, { recursive: true });
@@ -842,6 +843,7 @@ export async function startAuto(ctx, pi, base, verboseMode, options) {
842
843
  s.activeRunDir = meta.activeRunDir ?? null;
843
844
  s.originalBasePath = meta.originalBasePath || base;
844
845
  s.stepMode = meta.stepMode ?? requestedStepMode;
846
+ s.autoStartTime = meta.autoStartTime || Date.now();
845
847
  s.paused = true;
846
848
  try {
847
849
  unlinkSync(pausedPath);
@@ -869,6 +871,7 @@ export async function startAuto(ctx, pi, base, verboseMode, options) {
869
871
  s.currentMilestoneId = meta.milestoneId;
870
872
  s.originalBasePath = meta.originalBasePath || base;
871
873
  s.stepMode = meta.stepMode ?? requestedStepMode;
874
+ s.autoStartTime = meta.autoStartTime || Date.now();
872
875
  s.paused = true;
873
876
  // Clean up the persisted file — we're consuming it
874
877
  try {
@@ -900,6 +903,8 @@ export async function startAuto(ctx, pi, base, verboseMode, options) {
900
903
  s.cmdCtx = ctx;
901
904
  s.basePath = base;
902
905
  setLogBasePath(base);
906
+ if (!s.autoStartTime || s.autoStartTime <= 0)
907
+ s.autoStartTime = Date.now();
903
908
  s.unitDispatchCount.clear();
904
909
  s.unitLifetimeDispatches.clear();
905
910
  if (!getLedger())
@@ -768,31 +768,42 @@ export function registerDbTools(pi) {
768
768
  return m ? [m[1].trim(), m[2].trim()] : [s.trim(), ""];
769
769
  };
770
770
  const coerced = { ...params };
771
- coerced.filesModified = (params.filesModified ?? []).map((f) => {
771
+ // Coerce simple string-array fields: LLMs sometimes pass a plain string
772
+ // instead of a single-element array (#3585).
773
+ const wrapArray = (v) => v == null ? [] : Array.isArray(v) ? v : [v];
774
+ coerced.provides = wrapArray(params.provides);
775
+ coerced.keyFiles = wrapArray(params.keyFiles);
776
+ coerced.keyDecisions = wrapArray(params.keyDecisions);
777
+ coerced.patternsEstablished = wrapArray(params.patternsEstablished);
778
+ coerced.observabilitySurfaces = wrapArray(params.observabilitySurfaces);
779
+ coerced.requirementsSurfaced = wrapArray(params.requirementsSurfaced);
780
+ coerced.drillDownPaths = wrapArray(params.drillDownPaths);
781
+ coerced.affects = wrapArray(params.affects);
782
+ coerced.filesModified = wrapArray(params.filesModified).map((f) => {
772
783
  if (typeof f !== "string")
773
784
  return f;
774
785
  const [path, description] = splitPair(f);
775
786
  return { path, description };
776
787
  });
777
- coerced.requires = (params.requires ?? []).map((r) => {
788
+ coerced.requires = wrapArray(params.requires).map((r) => {
778
789
  if (typeof r !== "string")
779
790
  return r;
780
791
  const [slice, provides] = splitPair(r);
781
792
  return { slice, provides };
782
793
  });
783
- coerced.requirementsAdvanced = (params.requirementsAdvanced ?? []).map((r) => {
794
+ coerced.requirementsAdvanced = wrapArray(params.requirementsAdvanced).map((r) => {
784
795
  if (typeof r !== "string")
785
796
  return r;
786
797
  const [id, how] = splitPair(r);
787
798
  return { id, how };
788
799
  });
789
- coerced.requirementsValidated = (params.requirementsValidated ?? []).map((r) => {
800
+ coerced.requirementsValidated = wrapArray(params.requirementsValidated).map((r) => {
790
801
  if (typeof r !== "string")
791
802
  return r;
792
803
  const [id, proof] = splitPair(r);
793
804
  return { id, proof };
794
805
  });
795
- coerced.requirementsInvalidated = (params.requirementsInvalidated ?? []).map((r) => {
806
+ coerced.requirementsInvalidated = wrapArray(params.requirementsInvalidated).map((r) => {
796
807
  if (typeof r !== "string")
797
808
  return r;
798
809
  const [id, what] = splitPair(r);
@@ -851,14 +862,14 @@ export function registerDbTools(pi) {
851
862
  deviations: Type.Optional(Type.String({ description: "Deviations from the slice plan, or 'None.'" })),
852
863
  knownLimitations: Type.Optional(Type.String({ description: "Known limitations or gaps, or 'None.'" })),
853
864
  followUps: Type.Optional(Type.String({ description: "Follow-up work discovered during execution, or 'None.'" })),
854
- keyFiles: Type.Optional(Type.Array(Type.String(), { description: "Key files created or modified" })),
855
- keyDecisions: Type.Optional(Type.Array(Type.String(), { description: "Key decisions made during this slice" })),
856
- patternsEstablished: Type.Optional(Type.Array(Type.String(), { description: "Patterns established by this slice" })),
857
- observabilitySurfaces: Type.Optional(Type.Array(Type.String(), { description: "Observability surfaces added" })),
858
- provides: Type.Optional(Type.Array(Type.String(), { description: "What this slice provides to downstream slices" })),
859
- requirementsSurfaced: Type.Optional(Type.Array(Type.String(), { description: "New requirements surfaced" })),
860
- drillDownPaths: Type.Optional(Type.Array(Type.String(), { description: "Paths to task summaries for drill-down" })),
861
- affects: Type.Optional(Type.Array(Type.String(), { description: "Downstream slices affected" })),
865
+ keyFiles: Type.Optional(Type.Union([Type.Array(Type.String()), Type.String()], { description: "Key files created or modified" })),
866
+ keyDecisions: Type.Optional(Type.Union([Type.Array(Type.String()), Type.String()], { description: "Key decisions made during this slice" })),
867
+ patternsEstablished: Type.Optional(Type.Union([Type.Array(Type.String()), Type.String()], { description: "Patterns established by this slice" })),
868
+ observabilitySurfaces: Type.Optional(Type.Union([Type.Array(Type.String()), Type.String()], { description: "Observability surfaces added" })),
869
+ provides: Type.Optional(Type.Union([Type.Array(Type.String()), Type.String()], { description: "What this slice provides to downstream slices" })),
870
+ requirementsSurfaced: Type.Optional(Type.Union([Type.Array(Type.String()), Type.String()], { description: "New requirements surfaced" })),
871
+ drillDownPaths: Type.Optional(Type.Union([Type.Array(Type.String()), Type.String()], { description: "Paths to task summaries for drill-down" })),
872
+ affects: Type.Optional(Type.Union([Type.Array(Type.String()), Type.String()], { description: "Downstream slices affected" })),
862
873
  requirementsAdvanced: Type.Optional(Type.Array(Type.Union([
863
874
  Type.Object({
864
875
  id: Type.String({ description: "Requirement ID" }),
@@ -0,0 +1,28 @@
1
+ // GSD Extension — Notify Interceptor
2
+ // Wraps ctx.ui.notify() in-place to persist every notification through the
3
+ // notification store. Uses a WeakSet to prevent double-wrapping and handle
4
+ // UI context replacement on /reload gracefully.
5
+ import { appendNotification } from "../notification-store.js";
6
+ // Track which ui context objects have been wrapped to prevent double-install.
7
+ // WeakSet allows GC to collect replaced uiContext instances after /reload.
8
+ const _wrappedContexts = new WeakSet();
9
+ /**
10
+ * Install the notify interceptor on a context's UI object.
11
+ * Mutates ctx.ui.notify in place — the original is called after persistence.
12
+ * Safe to call multiple times; no-ops if already installed on the same ui object.
13
+ */
14
+ export function installNotifyInterceptor(ctx) {
15
+ if (_wrappedContexts.has(ctx.ui))
16
+ return;
17
+ const originalNotify = ctx.ui.notify.bind(ctx.ui);
18
+ ctx.ui.notify = (message, type) => {
19
+ try {
20
+ appendNotification(message, (type ?? "info"), "notify");
21
+ }
22
+ catch {
23
+ // Non-fatal — never let persistence break the UI
24
+ }
25
+ originalNotify(message, type);
26
+ };
27
+ _wrappedContexts.add(ctx.ui);
28
+ }
@@ -18,6 +18,9 @@ import { resetAskUserQuestionsCache } from "../../ask-user-questions.js";
18
18
  import { recordToolCall as safetyRecordToolCall, recordToolResult as safetyRecordToolResult } from "../safety/evidence-collector.js";
19
19
  import { classifyCommand } from "../safety/destructive-guard.js";
20
20
  import { logWarning as safetyLogWarning } from "../workflow-logger.js";
21
+ import { installNotifyInterceptor } from "./notify-interceptor.js";
22
+ import { initNotificationStore } from "../notification-store.js";
23
+ import { initNotificationWidget } from "../notification-widget.js";
21
24
  // Skip the welcome screen on the very first session_start — cli.ts already
22
25
  // printed it before the TUI launched. Only re-print on /clear (subsequent sessions).
23
26
  let isFirstSession = true;
@@ -27,6 +30,9 @@ async function syncServiceTierStatus(ctx) {
27
30
  }
28
31
  export function registerHooks(pi) {
29
32
  pi.on("session_start", async (_event, ctx) => {
33
+ initNotificationStore(process.cwd());
34
+ installNotifyInterceptor(ctx);
35
+ initNotificationWidget(ctx);
30
36
  resetWriteGateState();
31
37
  resetToolCallLoopGuard();
32
38
  resetAskUserQuestionsCache();
@@ -63,6 +69,8 @@ export function registerHooks(pi) {
63
69
  loadToolApiKeys();
64
70
  });
65
71
  pi.on("session_switch", async (_event, ctx) => {
72
+ initNotificationStore(process.cwd());
73
+ installNotifyInterceptor(ctx);
66
74
  resetWriteGateState();
67
75
  resetToolCallLoopGuard();
68
76
  resetAskUserQuestionsCache();
@@ -2,6 +2,7 @@ import { existsSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { Key } from "@gsd/pi-tui";
4
4
  import { GSDDashboardOverlay } from "../dashboard-overlay.js";
5
+ import { GSDNotificationOverlay } from "../notification-overlay.js";
5
6
  import { ParallelMonitorOverlay } from "../parallel-monitor-overlay.js";
6
7
  import { shortcutDesc } from "../../shared/mod.js";
7
8
  export function registerShortcuts(pi) {
@@ -23,6 +24,21 @@ export function registerShortcuts(pi) {
23
24
  });
24
25
  },
25
26
  });
27
+ pi.registerShortcut(Key.ctrlAlt("n"), {
28
+ description: shortcutDesc("Open notification history", "/gsd notifications"),
29
+ handler: async (ctx) => {
30
+ await ctx.ui.custom((tui, theme, _kb, done) => new GSDNotificationOverlay(tui, theme, () => done()), {
31
+ overlay: true,
32
+ overlayOptions: {
33
+ width: "80%",
34
+ minWidth: 60,
35
+ maxHeight: "88%",
36
+ anchor: "center",
37
+ backdrop: true,
38
+ },
39
+ });
40
+ },
41
+ });
26
42
  pi.registerShortcut(Key.ctrlAlt("p"), {
27
43
  description: shortcutDesc("Open parallel worker monitor", "/gsd parallel watch"),
28
44
  handler: async (ctx) => {
@@ -229,6 +229,12 @@ function buildWorktreeContextBlock() {
229
229
  }
230
230
  return "";
231
231
  }
232
+ /**
233
+ * Low-entropy resume intent patterns — short phrases a user types to
234
+ * continue work after a pause, rate limit, or context reset (#3615).
235
+ * Tested against the trimmed, lowercased prompt with trailing punctuation stripped.
236
+ */
237
+ const RESUME_INTENT_PATTERNS = /^(continue|resume|ok|go|go ahead|proceed|keep going|carry on|next|yes|yeah|yep|sure|do it|let's go|pick up where you left off)$/;
232
238
  async function buildGuidedExecuteContextInjection(prompt, basePath) {
233
239
  const executeMatch = prompt.match(/Execute the next task:\s+(T\d+)\s+\("([^"]+)"\)\s+in slice\s+(S\d+)\s+of milestone\s+(M\d+(?:-[a-z0-9]{6})?)/i);
234
240
  if (executeMatch) {
@@ -243,6 +249,20 @@ async function buildGuidedExecuteContextInjection(prompt, basePath) {
243
249
  return buildTaskExecutionContextInjection(basePath, milestoneId, sliceId, state.activeTask.id, state.activeTask.title);
244
250
  }
245
251
  }
252
+ // Fallback: low-entropy resume prompt (e.g., "continue", "ok", "go ahead")
253
+ // during an active executing task — inject task context so the agent
254
+ // doesn't rebuild from scratch (#3615).
255
+ // Intent-gated: only fire for short, resume-like prompts to avoid hijacking
256
+ // control/help/diagnostic prompts with unrelated execution context.
257
+ // Phase-gated: only fire during "executing" to avoid misrouting during
258
+ // replanning, gate evaluation, or other non-execution phases.
259
+ const trimmed = prompt.trim().toLowerCase().replace(/[.!?,]+$/g, "");
260
+ if (RESUME_INTENT_PATTERNS.test(trimmed)) {
261
+ const state = await deriveState(basePath);
262
+ if (state.phase === "executing" && state.activeTask && state.activeMilestone && state.activeSlice) {
263
+ return buildTaskExecutionContextInjection(basePath, state.activeMilestone.id, state.activeSlice.id, state.activeTask.id, state.activeTask.title);
264
+ }
265
+ }
246
266
  return null;
247
267
  }
248
268
  async function buildTaskExecutionContextInjection(basePath, milestoneId, sliceId, taskId, taskTitle) {