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
@@ -0,0 +1,573 @@
1
+ /**
2
+ * Pre-Execution Checks — Validate task plans before execution begins.
3
+ *
4
+ * Runs these checks against a slice's task plan:
5
+ * 1. Package existence — npm view calls in parallel with timeout
6
+ * 2. File path consistency — verify files exist or are in prior expected_output
7
+ * 3. Task ordering — detect impossible ordering (task reads file created later)
8
+ * 4. Interface contracts — detect contradictory function signatures (warn only)
9
+ *
10
+ * Design principles:
11
+ * - Pure functions taking (tasks: TaskRow[], basePath: string) for testability
12
+ * - Network failures warn, don't fail (R012 conservative design)
13
+ * - Total execution <2s target (R013)
14
+ * - No AST parsers — interface parsing is heuristic (regex on code blocks)
15
+ */
16
+
17
+ import { existsSync } from "node:fs";
18
+ import { spawn } from "node:child_process";
19
+ import { resolve } from "node:path";
20
+ import type { TaskRow } from "./gsd-db.ts";
21
+ import type { PreExecutionCheckJSON } from "./verification-evidence.ts";
22
+
23
+ // ─── Result Types ────────────────────────────────────────────────────────────
24
+
25
+ export interface PreExecutionResult {
26
+ /** Overall result: pass if no blocking failures, warn if non-blocking issues, fail if blocking issues */
27
+ status: "pass" | "warn" | "fail";
28
+ /** All check results */
29
+ checks: PreExecutionCheckJSON[];
30
+ /** Total duration in milliseconds */
31
+ durationMs: number;
32
+ }
33
+
34
+ // ─── Package Existence Check ─────────────────────────────────────────────────
35
+
36
+ /**
37
+ * Extract npm package names from task descriptions.
38
+ * Looks for:
39
+ * - `npm install <pkg>` patterns
40
+ * - Code blocks with `require('<pkg>')` or `import ... from '<pkg>'`
41
+ * - Explicit mentions like "uses lodash" or "package: axios"
42
+ */
43
+ export function extractPackageReferences(description: string): string[] {
44
+ const packages = new Set<string>();
45
+
46
+ // Common words that aren't package names but might appear after install
47
+ const stopwords = new Set([
48
+ "then", "and", "the", "to", "a", "an", "in", "for", "with", "from", "or",
49
+ "npm", "yarn", "pnpm", "i", // Don't capture the command itself
50
+ ]);
51
+
52
+ // npm install <pkg> patterns (handles npm i, npm add, yarn add, pnpm add)
53
+ // Use a global pattern to find all install commands, then parse following tokens
54
+ const installCmdPattern = /(?:npm\s+(?:install|i|add)|yarn\s+add|pnpm\s+add)\s+/g;
55
+ let cmdMatch: RegExpExecArray | null;
56
+
57
+ while ((cmdMatch = installCmdPattern.exec(description)) !== null) {
58
+ // Start after the install command
59
+ const afterCmd = description.slice(cmdMatch.index + cmdMatch[0].length);
60
+
61
+ // Match package-like tokens (alphanumeric, @, /, -, _) until we hit
62
+ // something that's not a package (non-token char after whitespace)
63
+ const tokenPattern = /^([@a-zA-Z][a-zA-Z0-9@/_-]*)(?:\s+|$)/;
64
+ let remaining = afterCmd;
65
+
66
+ while (remaining.length > 0) {
67
+ // Skip any flags like -D, --save-dev
68
+ const flagMatch = remaining.match(/^(-[a-zA-Z-]+)\s*/);
69
+ if (flagMatch) {
70
+ remaining = remaining.slice(flagMatch[0].length);
71
+ continue;
72
+ }
73
+
74
+ // Try to match a package name
75
+ const pkgMatch = remaining.match(tokenPattern);
76
+ if (pkgMatch) {
77
+ const token = pkgMatch[1];
78
+ // Skip stopwords - they indicate end of package list
79
+ if (stopwords.has(token.toLowerCase())) {
80
+ break;
81
+ }
82
+ packages.add(normalizePackageName(token));
83
+ remaining = remaining.slice(pkgMatch[0].length);
84
+ } else {
85
+ // Not a package name, stop parsing this install command
86
+ break;
87
+ }
88
+ }
89
+ }
90
+
91
+ // require('pkg') or import from 'pkg' in code blocks
92
+ const importPattern = /(?:require\s*\(\s*['"]|from\s+['"])([a-zA-Z0-9@/_-]+)['"\)]/g;
93
+ let importMatch: RegExpExecArray | null;
94
+ while ((importMatch = importPattern.exec(description)) !== null) {
95
+ // Skip relative imports and node builtins
96
+ const pkg = importMatch[1];
97
+ if (!pkg.startsWith(".") && !pkg.startsWith("node:")) {
98
+ packages.add(normalizePackageName(pkg));
99
+ }
100
+ }
101
+
102
+ return Array.from(packages);
103
+ }
104
+
105
+ /**
106
+ * Normalize package name to registry-checkable form.
107
+ * Handles scoped packages (@org/pkg) and subpaths (pkg/subpath → pkg).
108
+ */
109
+ function normalizePackageName(raw: string): string {
110
+ // Scoped package: @org/pkg or @org/pkg/subpath
111
+ if (raw.startsWith("@")) {
112
+ const parts = raw.split("/");
113
+ return parts.length >= 2 ? `${parts[0]}/${parts[1]}` : raw;
114
+ }
115
+ // Regular package: pkg or pkg/subpath
116
+ return raw.split("/")[0];
117
+ }
118
+
119
+ /**
120
+ * Check if a package exists on npm registry.
121
+ * Returns null on success, error message on failure.
122
+ * Times out after timeoutMs (default 5000ms).
123
+ */
124
+ async function checkPackageOnNpm(
125
+ packageName: string,
126
+ timeoutMs = 5000
127
+ ): Promise<{ exists: boolean; error?: string }> {
128
+ return new Promise((resolve) => {
129
+ const child = spawn("npm", ["view", packageName, "name"], {
130
+ stdio: ["ignore", "pipe", "pipe"],
131
+ timeout: timeoutMs,
132
+ });
133
+
134
+ let stdout = "";
135
+ let stderr = "";
136
+
137
+ child.stdout.on("data", (data: Buffer) => {
138
+ stdout += data.toString();
139
+ });
140
+ child.stderr.on("data", (data: Buffer) => {
141
+ stderr += data.toString();
142
+ });
143
+
144
+ const timer = setTimeout(() => {
145
+ child.kill("SIGTERM");
146
+ resolve({ exists: false, error: `Timeout after ${timeoutMs}ms` });
147
+ }, timeoutMs);
148
+
149
+ child.on("close", (code) => {
150
+ clearTimeout(timer);
151
+ if (code === 0 && stdout.trim()) {
152
+ resolve({ exists: true });
153
+ } else if (stderr.includes("404") || stderr.includes("not found")) {
154
+ resolve({ exists: false, error: `Package not found: ${packageName}` });
155
+ } else if (code !== 0) {
156
+ // Network error or other issue — warn, don't fail
157
+ resolve({ exists: true, error: `npm view failed (code ${code}): ${stderr.slice(0, 100)}` });
158
+ } else {
159
+ resolve({ exists: true });
160
+ }
161
+ });
162
+
163
+ child.on("error", (err) => {
164
+ clearTimeout(timer);
165
+ resolve({ exists: true, error: `npm spawn error: ${err.message}` });
166
+ });
167
+ });
168
+ }
169
+
170
+ /**
171
+ * Check all package references in tasks for existence on npm.
172
+ * Runs checks in parallel with a 5s timeout per package.
173
+ * Network failures warn but don't fail (R012 conservative design).
174
+ */
175
+ export async function checkPackageExistence(
176
+ tasks: TaskRow[],
177
+ _basePath: string
178
+ ): Promise<PreExecutionCheckJSON[]> {
179
+ const results: PreExecutionCheckJSON[] = [];
180
+ const packagesToCheck = new Set<string>();
181
+
182
+ // Collect all package references from task descriptions
183
+ for (const task of tasks) {
184
+ const packages = extractPackageReferences(task.description);
185
+ for (const pkg of packages) {
186
+ packagesToCheck.add(pkg);
187
+ }
188
+ }
189
+
190
+ if (packagesToCheck.size === 0) {
191
+ return results;
192
+ }
193
+
194
+ // Check packages in parallel
195
+ const checkPromises = Array.from(packagesToCheck).map(async (pkg) => {
196
+ const result = await checkPackageOnNpm(pkg);
197
+ return { pkg, result };
198
+ });
199
+
200
+ const checkResults = await Promise.all(checkPromises);
201
+
202
+ for (const { pkg, result } of checkResults) {
203
+ if (!result.exists && !result.error?.includes("Timeout") && !result.error?.includes("spawn error")) {
204
+ // Package genuinely doesn't exist — blocking failure
205
+ results.push({
206
+ category: "package",
207
+ target: pkg,
208
+ passed: false,
209
+ message: result.error || `Package '${pkg}' not found on npm`,
210
+ blocking: true,
211
+ });
212
+ } else if (result.error) {
213
+ // Network issue or timeout — warn but don't block
214
+ results.push({
215
+ category: "package",
216
+ target: pkg,
217
+ passed: true,
218
+ message: `Warning: ${result.error}`,
219
+ blocking: false,
220
+ });
221
+ }
222
+ // Silent success for existing packages — no need to report
223
+ }
224
+
225
+ return results;
226
+ }
227
+
228
+ // ─── File Path Consistency Check ─────────────────────────────────────────────
229
+
230
+ /**
231
+ * Normalize a file path for consistent comparison.
232
+ * - Strips leading ./
233
+ * - Normalizes path separators to forward slashes
234
+ * - Resolves redundant segments (e.g., foo/../bar → bar)
235
+ *
236
+ * This ensures that "./src/a.ts", "src/a.ts", and "src//a.ts" all compare equal.
237
+ */
238
+ export function normalizeFilePath(filePath: string): string {
239
+ if (!filePath) return filePath;
240
+
241
+ // Normalize path separators to forward slashes
242
+ let normalized = filePath.replace(/\\/g, "/");
243
+
244
+ // Remove leading ./
245
+ while (normalized.startsWith("./")) {
246
+ normalized = normalized.slice(2);
247
+ }
248
+
249
+ // Remove duplicate slashes
250
+ normalized = normalized.replace(/\/+/g, "/");
251
+
252
+ // Remove trailing slash unless it's the root
253
+ if (normalized.length > 1 && normalized.endsWith("/")) {
254
+ normalized = normalized.slice(0, -1);
255
+ }
256
+
257
+ return normalized;
258
+ }
259
+
260
+ /**
261
+ * Build a set of files that will be created by tasks up to (but not including) taskIndex.
262
+ * All paths are normalized for consistent comparison.
263
+ */
264
+ function getExpectedOutputsUpTo(tasks: TaskRow[], taskIndex: number): Set<string> {
265
+ const outputs = new Set<string>();
266
+ for (let i = 0; i < taskIndex; i++) {
267
+ for (const file of tasks[i].expected_output) {
268
+ outputs.add(normalizeFilePath(file));
269
+ }
270
+ }
271
+ return outputs;
272
+ }
273
+
274
+ /**
275
+ * Check that all files referenced in task.files and task.inputs either:
276
+ * 1. Exist on disk, OR
277
+ * 2. Are in a prior task's expected_output
278
+ *
279
+ * All paths are normalized before comparison to ensure ./src/a.ts matches src/a.ts.
280
+ */
281
+ export function checkFilePathConsistency(
282
+ tasks: TaskRow[],
283
+ basePath: string
284
+ ): PreExecutionCheckJSON[] {
285
+ const results: PreExecutionCheckJSON[] = [];
286
+
287
+ for (let i = 0; i < tasks.length; i++) {
288
+ const task = tasks[i];
289
+ const priorOutputs = getExpectedOutputsUpTo(tasks, i);
290
+ const filesToCheck = [...task.files, ...task.inputs];
291
+
292
+ for (const file of filesToCheck) {
293
+ // Skip empty strings
294
+ if (!file.trim()) continue;
295
+
296
+ // Normalize path for consistent comparison
297
+ const normalizedFile = normalizeFilePath(file);
298
+
299
+ // Check if file exists on disk
300
+ const absolutePath = resolve(basePath, normalizedFile);
301
+ const existsOnDisk = existsSync(absolutePath);
302
+
303
+ // Check if file is in prior expected outputs (priorOutputs already normalized)
304
+ const inPriorOutputs = priorOutputs.has(normalizedFile);
305
+
306
+ if (!existsOnDisk && !inPriorOutputs) {
307
+ results.push({
308
+ category: "file",
309
+ target: file,
310
+ passed: false,
311
+ message: `Task ${task.id} references '${file}' which doesn't exist and isn't created by prior tasks`,
312
+ blocking: true,
313
+ });
314
+ }
315
+ }
316
+ }
317
+
318
+ return results;
319
+ }
320
+
321
+ // ─── Task Ordering Check ─────────────────────────────────────────────────────
322
+
323
+ /**
324
+ * Detect impossible task ordering: task N reads a file that task N+M creates.
325
+ * This is a fatal error — the plan has an impossible dependency.
326
+ *
327
+ * All paths are normalized before comparison to ensure ./src/a.ts matches src/a.ts.
328
+ */
329
+ export function checkTaskOrdering(
330
+ tasks: TaskRow[],
331
+ _basePath: string
332
+ ): PreExecutionCheckJSON[] {
333
+ const results: PreExecutionCheckJSON[] = [];
334
+
335
+ // Build map: normalized file → task index that creates it
336
+ const fileCreators = new Map<string, { taskId: string; index: number; originalPath: string }>();
337
+ for (let i = 0; i < tasks.length; i++) {
338
+ const task = tasks[i];
339
+ for (const file of task.expected_output) {
340
+ const normalizedFile = normalizeFilePath(file);
341
+ if (!fileCreators.has(normalizedFile)) {
342
+ fileCreators.set(normalizedFile, { taskId: task.id, index: i, originalPath: file });
343
+ }
344
+ }
345
+ }
346
+
347
+ // Check each task's inputs against file creators
348
+ for (let i = 0; i < tasks.length; i++) {
349
+ const task = tasks[i];
350
+ const filesToCheck = [...task.files, ...task.inputs];
351
+
352
+ for (const file of filesToCheck) {
353
+ const normalizedFile = normalizeFilePath(file);
354
+ const creator = fileCreators.get(normalizedFile);
355
+ if (creator && creator.index > i) {
356
+ // Task reads file that is created later — impossible ordering
357
+ results.push({
358
+ category: "file",
359
+ target: file,
360
+ passed: false,
361
+ message: `Task ${task.id} reads '${file}' but it's created by task ${creator.taskId} (sequence violation)`,
362
+ blocking: true,
363
+ });
364
+ }
365
+ }
366
+ }
367
+
368
+ return results;
369
+ }
370
+
371
+ // ─── Interface Contract Check ────────────────────────────────────────────────
372
+
373
+ interface FunctionSignature {
374
+ name: string;
375
+ params: string;
376
+ returnType: string;
377
+ taskId: string;
378
+ raw: string;
379
+ }
380
+
381
+ /**
382
+ * Extract function signatures from code blocks in task description.
383
+ * Uses heuristic regex — not an AST parser.
384
+ */
385
+ function extractFunctionSignatures(description: string, taskId: string): FunctionSignature[] {
386
+ const signatures: FunctionSignature[] = [];
387
+
388
+ // Match code blocks (```...```)
389
+ const codeBlockPattern = /```(?:typescript|ts|javascript|js)?\n([\s\S]*?)```/g;
390
+ let blockMatch: RegExpExecArray | null;
391
+
392
+ while ((blockMatch = codeBlockPattern.exec(description)) !== null) {
393
+ const codeBlock = blockMatch[1];
394
+
395
+ // Match function declarations and exports
396
+ // Patterns:
397
+ // function name(params): ReturnType
398
+ // export function name(params): ReturnType
399
+ // export async function name(params): Promise<ReturnType>
400
+ // const name = (params): ReturnType =>
401
+ // export const name = (params): ReturnType =>
402
+ const funcPattern = /(?:export\s+)?(?:async\s+)?(?:function\s+|const\s+)(\w+)(?:\s*=\s*)?\s*\(([^)]*)\)(?:\s*:\s*([^{=>\n]+))?/g;
403
+ let funcMatch: RegExpExecArray | null;
404
+
405
+ while ((funcMatch = funcPattern.exec(codeBlock)) !== null) {
406
+ const [raw, name, params, returnType] = funcMatch;
407
+ signatures.push({
408
+ name,
409
+ params: normalizeParams(params),
410
+ returnType: normalizeType(returnType || "void"),
411
+ taskId,
412
+ raw: raw.trim(),
413
+ });
414
+ }
415
+
416
+ // Match interface method signatures
417
+ // Pattern: methodName(params): ReturnType;
418
+ const methodPattern = /^\s*(\w+)\s*\(([^)]*)\)\s*:\s*([^;]+);/gm;
419
+ let methodMatch: RegExpExecArray | null;
420
+
421
+ while ((methodMatch = methodPattern.exec(codeBlock)) !== null) {
422
+ const [raw, name, params, returnType] = methodMatch;
423
+ signatures.push({
424
+ name,
425
+ params: normalizeParams(params),
426
+ returnType: normalizeType(returnType),
427
+ taskId,
428
+ raw: raw.trim(),
429
+ });
430
+ }
431
+ }
432
+
433
+ return signatures;
434
+ }
435
+
436
+ /**
437
+ * Normalize parameter list for comparison.
438
+ * Removes whitespace, comments, and default values.
439
+ */
440
+ function normalizeParams(params: string): string {
441
+ return params
442
+ .replace(/\/\*[\s\S]*?\*\//g, "") // Remove block comments
443
+ .replace(/\/\/[^\n]*/g, "") // Remove line comments
444
+ .replace(/\s*=\s*[^,)]+/g, "") // Remove default values
445
+ .replace(/\s+/g, " ") // Normalize whitespace
446
+ .trim();
447
+ }
448
+
449
+ /**
450
+ * Normalize type for comparison.
451
+ */
452
+ function normalizeType(type: string): string {
453
+ return type
454
+ .replace(/\s+/g, " ")
455
+ .trim();
456
+ }
457
+
458
+ /**
459
+ * Check for contradictory function signatures across tasks.
460
+ * Same function name with different signatures is a warning (not blocking).
461
+ */
462
+ export function checkInterfaceContracts(
463
+ tasks: TaskRow[],
464
+ _basePath: string
465
+ ): PreExecutionCheckJSON[] {
466
+ const results: PreExecutionCheckJSON[] = [];
467
+
468
+ // Collect all signatures
469
+ const allSignatures: FunctionSignature[] = [];
470
+ for (const task of tasks) {
471
+ const sigs = extractFunctionSignatures(task.description, task.id);
472
+ allSignatures.push(...sigs);
473
+ }
474
+
475
+ // Group by function name
476
+ const byName = new Map<string, FunctionSignature[]>();
477
+ for (const sig of allSignatures) {
478
+ const existing = byName.get(sig.name) || [];
479
+ existing.push(sig);
480
+ byName.set(sig.name, existing);
481
+ }
482
+
483
+ // Check for contradictions
484
+ for (const [name, sigs] of byName) {
485
+ if (sigs.length < 2) continue;
486
+
487
+ // Compare signatures
488
+ const first = sigs[0];
489
+ for (let i = 1; i < sigs.length; i++) {
490
+ const current = sigs[i];
491
+
492
+ // Check parameter mismatch
493
+ if (first.params !== current.params) {
494
+ results.push({
495
+ category: "schema",
496
+ target: name,
497
+ passed: true, // Warning only, not blocking
498
+ message: `Function '${name}' has different parameters: '${first.params}' (${first.taskId}) vs '${current.params}' (${current.taskId})`,
499
+ blocking: false,
500
+ });
501
+ }
502
+
503
+ // Check return type mismatch
504
+ if (first.returnType !== current.returnType) {
505
+ results.push({
506
+ category: "schema",
507
+ target: name,
508
+ passed: true, // Warning only, not blocking
509
+ message: `Function '${name}' has different return types: '${first.returnType}' (${first.taskId}) vs '${current.returnType}' (${current.taskId})`,
510
+ blocking: false,
511
+ });
512
+ }
513
+ }
514
+ }
515
+
516
+ return results;
517
+ }
518
+
519
+ // ─── Main Entry Point ────────────────────────────────────────────────────────
520
+
521
+ /**
522
+ * Run all pre-execution checks against a slice's task plan.
523
+ *
524
+ * @param tasks - Array of TaskRow from the slice
525
+ * @param basePath - Base path for resolving file references
526
+ * @returns PreExecutionResult with status, checks, and duration
527
+ */
528
+ export async function runPreExecutionChecks(
529
+ tasks: TaskRow[],
530
+ basePath: string
531
+ ): Promise<PreExecutionResult> {
532
+ const startTime = Date.now();
533
+ const allChecks: PreExecutionCheckJSON[] = [];
534
+
535
+ // Run sync checks first
536
+ const fileChecks = checkFilePathConsistency(tasks, basePath);
537
+ const orderingChecks = checkTaskOrdering(tasks, basePath);
538
+ const contractChecks = checkInterfaceContracts(tasks, basePath);
539
+
540
+ allChecks.push(...fileChecks, ...orderingChecks, ...contractChecks);
541
+
542
+ // Run async package checks
543
+ const packageChecks = await checkPackageExistence(tasks, basePath);
544
+ allChecks.push(...packageChecks);
545
+
546
+ const durationMs = Date.now() - startTime;
547
+
548
+ // Determine overall status
549
+ const hasBlockingFailure = allChecks.some((c) => !c.passed && c.blocking);
550
+ const hasNonBlockingFailure = allChecks.some((c) => !c.passed && !c.blocking);
551
+ // Interface contract checks pass but still report warnings via message
552
+ const hasInterfaceWarning = allChecks.some(
553
+ (c) => c.category === "schema" && c.message && !c.message.startsWith("Warning:")
554
+ );
555
+ const hasNetworkWarning = allChecks.some(
556
+ (c) => c.passed && c.message?.startsWith("Warning:")
557
+ );
558
+
559
+ let status: "pass" | "warn" | "fail";
560
+ if (hasBlockingFailure) {
561
+ status = "fail";
562
+ } else if (hasNonBlockingFailure || hasInterfaceWarning || hasNetworkWarning) {
563
+ status = "warn";
564
+ } else {
565
+ status = "pass";
566
+ }
567
+
568
+ return {
569
+ status,
570
+ checks: allChecks,
571
+ durationMs,
572
+ };
573
+ }
@@ -106,6 +106,10 @@ export const KNOWN_PREFERENCE_KEYS = new Set<string>([
106
106
  "codebase",
107
107
  "slice_parallel",
108
108
  "safety_harness",
109
+ "enhanced_verification",
110
+ "enhanced_verification_pre",
111
+ "enhanced_verification_post",
112
+ "enhanced_verification_strict",
109
113
  ]);
110
114
 
111
115
  /** Canonical list of all dispatch unit types. */
@@ -304,6 +308,30 @@ export interface GSDPreferences {
304
308
  auto_rollback?: boolean;
305
309
  timeout_scale_cap?: number;
306
310
  };
311
+
312
+ // ─── Enhanced Verification ──────────────────────────────────────────────────
313
+ /**
314
+ * Enable enhanced verification (both pre-execution and post-execution checks).
315
+ * Default: true (opt-out, not opt-in). Set false to disable all enhanced verification.
316
+ */
317
+ enhanced_verification?: boolean;
318
+ /**
319
+ * Enable pre-execution checks (package existence, file references, etc.).
320
+ * Only applies when enhanced_verification is true.
321
+ * Default: true.
322
+ */
323
+ enhanced_verification_pre?: boolean;
324
+ /**
325
+ * Enable post-execution checks (runtime error detection, audit warnings, etc.).
326
+ * Only applies when enhanced_verification is true.
327
+ * Default: true.
328
+ */
329
+ enhanced_verification_post?: boolean;
330
+ /**
331
+ * Strict mode: treat any pre-execution check failure as blocking.
332
+ * Default: false (warnings only for non-critical failures).
333
+ */
334
+ enhanced_verification_strict?: boolean;
307
335
  }
308
336
 
309
337
  export interface LoadedGSDPreferences {
@@ -902,5 +902,38 @@ export function validatePreferences(preferences: GSDPreferences): {
902
902
  }
903
903
  }
904
904
 
905
+ // ─── Enhanced Verification ──────────────────────────────────────────────────
906
+ if (preferences.enhanced_verification !== undefined) {
907
+ if (typeof preferences.enhanced_verification === "boolean") {
908
+ validated.enhanced_verification = preferences.enhanced_verification;
909
+ } else {
910
+ errors.push("enhanced_verification must be a boolean");
911
+ }
912
+ }
913
+
914
+ if (preferences.enhanced_verification_pre !== undefined) {
915
+ if (typeof preferences.enhanced_verification_pre === "boolean") {
916
+ validated.enhanced_verification_pre = preferences.enhanced_verification_pre;
917
+ } else {
918
+ errors.push("enhanced_verification_pre must be a boolean");
919
+ }
920
+ }
921
+
922
+ if (preferences.enhanced_verification_post !== undefined) {
923
+ if (typeof preferences.enhanced_verification_post === "boolean") {
924
+ validated.enhanced_verification_post = preferences.enhanced_verification_post;
925
+ } else {
926
+ errors.push("enhanced_verification_post must be a boolean");
927
+ }
928
+ }
929
+
930
+ if (preferences.enhanced_verification_strict !== undefined) {
931
+ if (typeof preferences.enhanced_verification_strict === "boolean") {
932
+ validated.enhanced_verification_strict = preferences.enhanced_verification_strict;
933
+ } else {
934
+ errors.push("enhanced_verification_strict must be a boolean");
935
+ }
936
+ }
937
+
905
938
  return { preferences: validated, errors, warnings };
906
939
  }
@@ -367,6 +367,10 @@ function mergePreferences(base: GSDPreferences, override: GSDPreferences): GSDPr
367
367
  verification_commands: mergeStringLists(base.verification_commands, override.verification_commands),
368
368
  verification_auto_fix: override.verification_auto_fix ?? base.verification_auto_fix,
369
369
  verification_max_retries: override.verification_max_retries ?? base.verification_max_retries,
370
+ enhanced_verification: override.enhanced_verification ?? base.enhanced_verification,
371
+ enhanced_verification_pre: override.enhanced_verification_pre ?? base.enhanced_verification_pre,
372
+ enhanced_verification_post: override.enhanced_verification_post ?? base.enhanced_verification_post,
373
+ enhanced_verification_strict: override.enhanced_verification_strict ?? base.enhanced_verification_strict,
370
374
  search_provider: override.search_provider ?? base.search_provider,
371
375
  context_selection: override.context_selection ?? base.context_selection,
372
376
  auto_visualize: override.auto_visualize ?? base.auto_visualize,