sneakoscope 4.8.6 → 5.1.2

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 (390) hide show
  1. package/README.md +51 -726
  2. package/bench/tasks/t01-off-by-one/repo/package.json +9 -0
  3. package/bench/tasks/t01-off-by-one/repo/src/pagination.js +5 -0
  4. package/bench/tasks/t01-off-by-one/repo/test.js +5 -0
  5. package/bench/tasks/t01-off-by-one/task.json +13 -0
  6. package/bench/tasks/t02-signature-cochange/repo/package.json +9 -0
  7. package/bench/tasks/t02-signature-cochange/repo/src/admin.js +5 -0
  8. package/bench/tasks/t02-signature-cochange/repo/src/audit.js +5 -0
  9. package/bench/tasks/t02-signature-cochange/repo/src/labels.js +3 -0
  10. package/bench/tasks/t02-signature-cochange/repo/src/profile.js +5 -0
  11. package/bench/tasks/t02-signature-cochange/repo/test.js +9 -0
  12. package/bench/tasks/t02-signature-cochange/task.json +12 -0
  13. package/bench/tasks/t03-type-puzzle/repo/package.json +9 -0
  14. package/bench/tasks/t03-type-puzzle/repo/src/config.js +4 -0
  15. package/bench/tasks/t03-type-puzzle/repo/test.js +6 -0
  16. package/bench/tasks/t03-type-puzzle/task.json +13 -0
  17. package/bench/tasks/t04-refactor-preserve/repo/package.json +9 -0
  18. package/bench/tasks/t04-refactor-preserve/repo/src/cart.js +8 -0
  19. package/bench/tasks/t04-refactor-preserve/repo/test.js +4 -0
  20. package/bench/tasks/t04-refactor-preserve/task.json +12 -0
  21. package/bench/tasks/t05-performance/repo/package.json +9 -0
  22. package/bench/tasks/t05-performance/repo/src/pairs.js +9 -0
  23. package/bench/tasks/t05-performance/repo/test.js +11 -0
  24. package/bench/tasks/t05-performance/task.json +12 -0
  25. package/bench/tasks/t06-mistake-rule/repo/package.json +9 -0
  26. package/bench/tasks/t06-mistake-rule/repo/src/loader.js +6 -0
  27. package/bench/tasks/t06-mistake-rule/repo/test.js +7 -0
  28. package/bench/tasks/t06-mistake-rule/task.json +12 -0
  29. package/config/bench-baseline.json +7 -0
  30. package/crates/sks-core/Cargo.lock +1 -1
  31. package/crates/sks-core/Cargo.toml +1 -1
  32. package/crates/sks-core/src/main.rs +1 -1
  33. package/dist/bin/install.js +35 -0
  34. package/dist/bin/sks.js +1 -1
  35. package/dist/cli/cli-theme.js +51 -0
  36. package/dist/cli/command-registry.js +75 -42
  37. package/dist/cli/help-fast.js +18 -8
  38. package/dist/cli/insane-search-command.js +36 -8
  39. package/dist/cli/install-helpers.js +147 -47
  40. package/dist/cli/router.js +58 -2
  41. package/dist/commands/codex-lb.js +6 -4
  42. package/dist/commands/doctor.js +146 -8
  43. package/dist/commands/proof.js +6 -3
  44. package/dist/commands/zellij-monitor-pane.js +25 -0
  45. package/dist/commands/zellij-slot-pane.js +39 -2
  46. package/dist/commands/zellij-viewport-pane.js +56 -0
  47. package/dist/commands/zellij.js +55 -2
  48. package/dist/config/skills-manifest.json +493 -0
  49. package/dist/core/agents/agent-conflict-graph.js +5 -0
  50. package/dist/core/agents/agent-lease.js +5 -0
  51. package/dist/core/agents/agent-ledger-schemas.js +1 -0
  52. package/dist/core/agents/agent-lifecycle.js +86 -35
  53. package/dist/core/agents/agent-orchestrator.js +287 -72
  54. package/dist/core/agents/agent-output-validator.js +14 -3
  55. package/dist/core/agents/agent-patch-queue-store.js +108 -4
  56. package/dist/core/agents/agent-patch-queue.js +10 -3
  57. package/dist/core/agents/agent-patch-schema.js +13 -0
  58. package/dist/core/agents/agent-proof-evidence.js +6 -1
  59. package/dist/core/agents/agent-runner-fake.js +40 -0
  60. package/dist/core/agents/agent-scheduler.js +2 -3
  61. package/dist/core/agents/agent-worker-pipeline.js +36 -2
  62. package/dist/core/agents/codex-exec-worker-adapter.js +2 -0
  63. package/dist/core/agents/native-cli-session-swarm.js +30 -13
  64. package/dist/core/agents/native-cli-worker.js +2 -1
  65. package/dist/core/agents/native-worker-backend-router.js +58 -1
  66. package/dist/core/auto-review.js +25 -4
  67. package/dist/core/codex/agent-config-file-repair.js +15 -2
  68. package/dist/core/codex/codex-config-eperm-repair.js +8 -2
  69. package/dist/core/codex/codex-config-guard.js +289 -0
  70. package/dist/core/codex/codex-config-toml.js +122 -0
  71. package/dist/core/codex/codex-project-config-policy.js +59 -7
  72. package/dist/core/codex-app/sks-menubar.js +780 -122
  73. package/dist/core/codex-app.js +1 -0
  74. package/dist/core/codex-control/codex-fake-sdk-adapter.js +6 -4
  75. package/dist/core/codex-control/codex-sdk-config-policy.js +2 -1
  76. package/dist/core/codex-control/codex-sdk-env-policy.js +1 -1
  77. package/dist/core/codex-control/codex-task-runner.js +32 -14
  78. package/dist/core/codex-control/python-codex-sdk-adapter.js +4 -1
  79. package/dist/core/codex-control/schemas/agent-worker-result.schema.js +12 -3
  80. package/dist/core/codex-hooks/codex-hook-managed-install.js +5 -0
  81. package/dist/core/codex-hooks/codex-hook-state-writer.js +70 -11
  82. package/dist/core/codex-hooks/codex-hook-trust-doctor.js +2 -2
  83. package/dist/core/codex-lb/codex-lb-env.js +20 -1
  84. package/dist/core/codex-lb/codex-lb-setup.js +2 -5
  85. package/dist/core/codex-native/skill-registry-ledger.js +24 -5
  86. package/dist/core/commands/basic-cli.js +21 -2
  87. package/dist/core/commands/check-command.js +37 -5
  88. package/dist/core/commands/command-utils.js +22 -2
  89. package/dist/core/commands/computer-use-command.js +62 -7
  90. package/dist/core/commands/db-command.js +31 -5
  91. package/dist/core/commands/fast-mode-command.js +39 -11
  92. package/dist/core/commands/gate-result-contract.js +43 -0
  93. package/dist/core/commands/gates-command.js +6 -1
  94. package/dist/core/commands/gc-command.js +29 -2
  95. package/dist/core/commands/goal-command.js +9 -2
  96. package/dist/core/commands/gx-command.js +79 -7
  97. package/dist/core/commands/image-ux-review-command.js +188 -13
  98. package/dist/core/commands/mad-db-command.js +85 -176
  99. package/dist/core/commands/mad-sks-command.js +248 -34
  100. package/dist/core/commands/menubar-command.js +146 -0
  101. package/dist/core/commands/naruto-command.js +64 -10
  102. package/dist/core/commands/pipeline-command.js +21 -2
  103. package/dist/core/commands/plan-command.js +76 -0
  104. package/dist/core/commands/ppt-command.js +159 -24
  105. package/dist/core/commands/qa-loop-command.js +6 -2
  106. package/dist/core/commands/release-command.js +55 -2
  107. package/dist/core/commands/research-command.js +1 -1
  108. package/dist/core/commands/review-command.js +217 -0
  109. package/dist/core/commands/route-command.js +62 -0
  110. package/dist/core/commands/route-success-helpers.js +59 -0
  111. package/dist/core/commands/run-command.js +19 -7
  112. package/dist/core/commands/seo-command.js +49 -1
  113. package/dist/core/commands/status-command.js +21 -1
  114. package/dist/core/commands/team-legacy-observe-command.js +221 -3
  115. package/dist/core/commands/ui-command.js +161 -0
  116. package/dist/core/commands/uninstall-command.js +312 -0
  117. package/dist/core/db-safety.js +7 -3
  118. package/dist/core/doctor/codex-startup-config-repair.js +14 -3
  119. package/dist/core/doctor/confirm-repair.js +27 -0
  120. package/dist/core/doctor/context7-mcp-repair.js +35 -7
  121. package/dist/core/doctor/doctor-codex-startup-repair.js +10 -3
  122. package/dist/core/doctor/doctor-context7-repair.js +17 -4
  123. package/dist/core/doctor/doctor-dirty-planner.js +27 -9
  124. package/dist/core/doctor/doctor-native-capability-repair.js +12 -2
  125. package/dist/core/doctor/doctor-readiness-matrix.js +27 -2
  126. package/dist/core/doctor/doctor-repair-postcheck.js +4 -0
  127. package/dist/core/doctor/doctor-transaction.js +21 -5
  128. package/dist/core/doctor/doctor-zellij-repair.js +1 -0
  129. package/dist/core/doctor/imagegen-repair.js +161 -0
  130. package/dist/core/doctor/supabase-mcp-repair.js +23 -5
  131. package/dist/core/feature-fixture-runner.js +2 -2
  132. package/dist/core/feature-fixtures.js +65 -37
  133. package/dist/core/feature-registry.js +106 -3
  134. package/dist/core/fsx.js +91 -2
  135. package/dist/core/hooks-runtime/skill-reconcile-preflight.js +43 -0
  136. package/dist/core/hooks-runtime.js +86 -46
  137. package/dist/core/image-ux-review/imagegen-adapter.js +48 -11
  138. package/dist/core/image-ux-review.js +16 -0
  139. package/dist/core/imagegen/imagegen-capability.js +11 -5
  140. package/dist/core/imagegen/require-imagegen.js +57 -0
  141. package/dist/core/init/skills.js +271 -14
  142. package/dist/core/init.js +13 -10
  143. package/dist/core/mad-db/mad-db-coordinator.js +96 -20
  144. package/dist/core/mad-db/mad-db-policy.js +12 -10
  145. package/dist/core/mad-sks/executors/executor-base.js +8 -2
  146. package/dist/core/mad-sks/executors/index.js +4 -0
  147. package/dist/core/mad-sks/executors/sql-plane-executor.js +194 -0
  148. package/dist/core/mission.js +138 -5
  149. package/dist/core/naruto/naruto-active-pool.js +84 -30
  150. package/dist/core/naruto/naruto-backpressure.js +5 -1
  151. package/dist/core/naruto/naruto-real-worker-child.js +10 -0
  152. package/dist/core/naruto/naruto-real-worker-runtime.js +9 -7
  153. package/dist/core/naruto/naruto-role-policy.js +3 -0
  154. package/dist/core/naruto/naruto-task-hints.js +10 -0
  155. package/dist/core/naruto/naruto-work-graph.js +8 -2
  156. package/dist/core/naruto/naruto-work-item.js +6 -0
  157. package/dist/core/naruto/resource-pressure-monitor.js +33 -15
  158. package/dist/core/naruto/solution-tournament.js +101 -0
  159. package/dist/core/permission-gates.js +30 -0
  160. package/dist/core/pipeline-internals/runtime-core.js +72 -222
  161. package/dist/core/pipeline-internals/runtime-gates.js +140 -24
  162. package/dist/core/ppt-review/index.js +6 -1
  163. package/dist/core/ppt-review/slide-imagegen-review.js +75 -10
  164. package/dist/core/ppt.js +70 -2
  165. package/dist/core/proof/auto-finalize.js +70 -11
  166. package/dist/core/proof/proof-schema.js +2 -0
  167. package/dist/core/proof/route-adapter.js +5 -1
  168. package/dist/core/proof/route-finalizer.js +8 -5
  169. package/dist/core/proof/selftest-proof-fixtures.js +18 -5
  170. package/dist/core/proof/validation.js +2 -0
  171. package/dist/core/provider/model-router.js +53 -0
  172. package/dist/core/questions.js +1 -1
  173. package/dist/core/recallpulse.js +1 -1
  174. package/dist/core/release/gate-manifest.js +2 -2
  175. package/dist/core/release/release-gate-affected-selector.js +3 -10
  176. package/dist/core/release/release-gate-batch-runner.js +4 -2
  177. package/dist/core/release/release-gate-cache-v2.js +27 -14
  178. package/dist/core/release/release-gate-dag.js +6 -1
  179. package/dist/core/release/release-gate-hermetic-env.js +10 -0
  180. package/dist/core/release/release-gate-node.js +3 -0
  181. package/dist/core/release/release-gate-resource-governor.js +1 -0
  182. package/dist/core/retention.js +89 -4
  183. package/dist/core/routes/constants.js +1 -1
  184. package/dist/core/routes/diagnostic-allowlist.js +55 -0
  185. package/dist/core/routes.js +83 -33
  186. package/dist/core/safety/mutation-guard.js +5 -1
  187. package/dist/core/skill-forge.js +9 -4
  188. package/dist/core/stop-gate/gate-evaluator.js +102 -0
  189. package/dist/core/stop-gate/stop-gate-check.js +26 -4
  190. package/dist/core/stop-gate/stop-gate-resolver.js +19 -3
  191. package/dist/core/stop-gate/stop-gate-writer.js +20 -1
  192. package/dist/core/team-dag.js +12 -465
  193. package/dist/core/team-dashboard-renderer.js +13 -94
  194. package/dist/core/team-live.js +68 -804
  195. package/dist/core/triwiki/agents-md-projector.js +184 -0
  196. package/dist/core/triwiki-wrongness/wrongness-schema.js +3 -1
  197. package/dist/core/trust-kernel/trust-kernel-schema.js +1 -0
  198. package/dist/core/trust-kernel/trust-report.js +1 -1
  199. package/dist/core/trust-kernel/trust-status.js +2 -0
  200. package/dist/core/ui/dashboard-html.js +111 -0
  201. package/dist/core/update/update-migration-state.js +383 -42
  202. package/dist/core/update-check.js +201 -78
  203. package/dist/core/verification/diff-quality.js +100 -0
  204. package/dist/core/verification/impact-scan.js +164 -0
  205. package/dist/core/verification/machine-feedback.js +146 -0
  206. package/dist/core/verification/mistake-rule-compiler.js +195 -0
  207. package/dist/core/version.js +1 -1
  208. package/dist/core/zellij/zellij-layout-builder.js +44 -16
  209. package/dist/core/zellij/zellij-monitor-renderer.js +53 -0
  210. package/dist/core/zellij/zellij-self-heal.js +27 -32
  211. package/dist/core/zellij/zellij-slot-pane-renderer.js +162 -153
  212. package/dist/core/zellij/zellij-slot-telemetry.js +2 -0
  213. package/dist/core/zellij/zellij-theme.js +67 -0
  214. package/dist/core/zellij/zellij-ui-mode.js +16 -0
  215. package/dist/core/zellij/zellij-viewport-binder.js +59 -0
  216. package/dist/core/zellij/zellij-worker-pane-manager.js +53 -5
  217. package/dist/scripts/agent-patch-swarm-gate-lib.js +2 -2
  218. package/dist/scripts/build-dist.js +8 -0
  219. package/dist/scripts/check-feature-quality.js +2 -2
  220. package/dist/scripts/cli-output-consistency-check.js +57 -0
  221. package/dist/scripts/codex-lb-fast-ui-preservation-check.js +106 -0
  222. package/dist/scripts/codex-lb-gpt55-fast-profile-check.js +105 -0
  223. package/dist/scripts/codex-lb-missing-env-regression.js +2 -3
  224. package/dist/scripts/codex-project-config-policy-merge-regression.js +3 -3
  225. package/dist/scripts/coding-bench-check.js +136 -0
  226. package/dist/scripts/concurrent-session-collision-check.js +67 -0
  227. package/dist/scripts/docs-truthfulness-check.js +1 -1
  228. package/dist/scripts/doctor-imagegen-repair-check.js +62 -0
  229. package/dist/scripts/ensure-bin-executable.js +11 -3
  230. package/dist/scripts/gate-policy-audit-check.js +130 -0
  231. package/dist/scripts/harness-benchmark-check.js +104 -0
  232. package/dist/scripts/hook-latency-budget-check.js +45 -0
  233. package/dist/scripts/legacy-update-e2e-check.js +228 -0
  234. package/dist/scripts/lib/codex-sdk-gate-lib.js +2 -2
  235. package/dist/scripts/lib/real-codex-parallel-gate.js +2 -2
  236. package/dist/scripts/loop-directive-check-lib.js +1 -1
  237. package/dist/scripts/mad-db-command-check.js +11 -8
  238. package/dist/scripts/mad-db-real-supabase-e2e.js +2 -2
  239. package/dist/scripts/mad-db-route-identity-check.js +8 -6
  240. package/dist/scripts/mad-db-safety-conflict-matrix-check.js +31 -8
  241. package/dist/scripts/mad-db-skill-policy-snapshot-check.js +4 -5
  242. package/dist/scripts/mad-sks-zellij-default-pane-worker-check.js +3 -2
  243. package/dist/scripts/mad-sks-zellij-launch-check.js +1 -1
  244. package/dist/scripts/naruto-zellij-dynamic-right-column-check.js +7 -7
  245. package/dist/scripts/parallel-claim-enforcement-check.js +14 -5
  246. package/dist/scripts/ppt-real-imagegen-wiring-check.js +5 -1
  247. package/dist/scripts/project-skill-dedupe-check.js +23 -5
  248. package/dist/scripts/proof-root-cause-policy-check.js +2 -0
  249. package/dist/scripts/release-affected-selector-check.js +2 -2
  250. package/dist/scripts/release-cache-glob-hashing-check.js +1 -0
  251. package/dist/scripts/release-dag-full-coverage-check.js +13 -4
  252. package/dist/scripts/release-gate-dag-runner-check.js +10 -2
  253. package/dist/scripts/release-gate-dag-runner.js +22 -0
  254. package/dist/scripts/release-gate-existence-audit.js +2 -1
  255. package/dist/scripts/release-gate-planner.js +2 -1
  256. package/dist/scripts/release-gate-script-parity-check.js +1 -1
  257. package/dist/scripts/release-metadata-1-19-check.js +2 -1
  258. package/dist/scripts/release-readiness-report.js +38 -7
  259. package/dist/scripts/release-stability-report-check.js +12 -8
  260. package/dist/scripts/search-visibility-gate-lib.js +2 -2
  261. package/dist/scripts/seo-geo-feature-fixture-quality-check.js +1 -1
  262. package/dist/scripts/skills-manifest-continuity-check.js +46 -0
  263. package/dist/scripts/sks-1-11-gate-lib.js +8 -6
  264. package/dist/scripts/sks-menubar-install-check.js +87 -21
  265. package/dist/scripts/sks-uninstall-regression-check.js +54 -0
  266. package/dist/scripts/uninstall-inventory-check.js +3 -0
  267. package/dist/scripts/ux-review-real-loop-fixture-check.js +9 -4
  268. package/dist/scripts/ux-review-run-wires-imagegen-check.js +4 -0
  269. package/dist/scripts/zellij-layout-valid-check.js +18 -11
  270. package/dist/scripts/zellij-right-column-geometry-proof.js +2 -4
  271. package/dist/scripts/zellij-slot-pane-renderer-check.js +9 -9
  272. package/dist/scripts/zellij-slot-pane-stale-detection-check.js +3 -4
  273. package/dist/scripts/zellij-slot-pane-telemetry-renderer-check.js +3 -2
  274. package/dist/scripts/zellij-slot-telemetry-renderer-check.js +4 -2
  275. package/dist/scripts/zellij-spawn-on-demand-layout-check.js +8 -2
  276. package/dist/scripts/zellij-viewport-binder-check.js +9 -0
  277. package/docs/assets/sneakoscope-architecture-pipeline.jpg +0 -0
  278. package/docs/demo.tape +28 -0
  279. package/package.json +70 -3
  280. package/schemas/codex/completion-proof.schema.json +3 -2
  281. package/schemas/release/release-gate-node.schema.json +2 -1
  282. package/dist/scripts/agent-backfill-route-blackbox.js +0 -5
  283. package/dist/scripts/agent-dynamic-pool-route-blackbox.js +0 -5
  284. package/dist/scripts/agent-parallel-write-blackbox.js +0 -56
  285. package/dist/scripts/agent-patch-swarm-route-blackbox.js +0 -10
  286. package/dist/scripts/agent-route-blackbox-lib.js +0 -132
  287. package/dist/scripts/blackbox-command-import-smoke.js +0 -143
  288. package/dist/scripts/blackbox-global-shim.js +0 -77
  289. package/dist/scripts/blackbox-matrix.js +0 -70
  290. package/dist/scripts/blackbox-npx-one-shot.js +0 -69
  291. package/dist/scripts/blackbox-pack-install.js +0 -174
  292. package/dist/scripts/brand-neutrality-zero-leakage-blackbox.js +0 -4
  293. package/dist/scripts/build-once-runner-blackbox.js +0 -34
  294. package/dist/scripts/codex-0140-integration-blackbox.js +0 -13
  295. package/dist/scripts/codex-agent-type-blackbox.js +0 -4
  296. package/dist/scripts/codex-app-harness-blackbox.js +0 -4
  297. package/dist/scripts/codex-app-skill-agent-blackbox.js +0 -4
  298. package/dist/scripts/codex-hook-approval-blackbox.js +0 -4
  299. package/dist/scripts/codex-init-deep-directory-local-blackbox.js +0 -4
  300. package/dist/scripts/codex-native-feature-broker-blackbox.js +0 -4
  301. package/dist/scripts/codex-native-pattern-analysis-blackbox.js +0 -4
  302. package/dist/scripts/codex-native-read-repair-split-blackbox.js +0 -55
  303. package/dist/scripts/codex-native-reference-cache-blackbox.js +0 -41
  304. package/dist/scripts/core-skill-integrity-blackbox.js +0 -33
  305. package/dist/scripts/dfix-fast-blackbox-check.js +0 -37
  306. package/dist/scripts/dfix-parallel-write-blackbox.js +0 -48
  307. package/dist/scripts/dfix-patch-swarm-route-blackbox.js +0 -10
  308. package/dist/scripts/doctor-context7-mcp-repair-blackbox.js +0 -16
  309. package/dist/scripts/doctor-dirty-repair-blackbox.js +0 -22
  310. package/dist/scripts/doctor-dirty-semantic-blackbox.js +0 -8
  311. package/dist/scripts/doctor-fix-production-blackbox.js +0 -26
  312. package/dist/scripts/doctor-native-capability-repair-blackbox.js +0 -39
  313. package/dist/scripts/doctor-startup-config-repair-blackbox.js +0 -13
  314. package/dist/scripts/doctor-supabase-mcp-repair-blackbox.js +0 -14
  315. package/dist/scripts/doctor-transaction-engine-blackbox.js +0 -28
  316. package/dist/scripts/doctor-zellij-fix-blackbox.js +0 -4
  317. package/dist/scripts/doctor-zellij-no-homebrew-blackbox.js +0 -4
  318. package/dist/scripts/doctor-zellij-upgrade-blackbox.js +0 -4
  319. package/dist/scripts/gate-pack-runner-blackbox.js +0 -27
  320. package/dist/scripts/gate-pack-v2-blackbox.js +0 -18
  321. package/dist/scripts/geo-cli-blackbox-check.js +0 -18
  322. package/dist/scripts/loop-collision-blackbox.js +0 -3
  323. package/dist/scripts/loop-concurrency-oversubscription-blackbox.js +0 -3
  324. package/dist/scripts/loop-fixture-production-misuse-blackbox.js +0 -3
  325. package/dist/scripts/loop-kill-interrupt-real-blackbox.js +0 -3
  326. package/dist/scripts/loop-merge-strategy-blackbox.js +0 -3
  327. package/dist/scripts/loop-mesh-production-e2e-blackbox.js +0 -3
  328. package/dist/scripts/loop-side-effect-blackbox.js +0 -3
  329. package/dist/scripts/mad-db-operation-lifecycle-blackbox.js +0 -29
  330. package/dist/scripts/mad-sks-actual-executor-blackbox.js +0 -5
  331. package/dist/scripts/mad-zellij-headless-fallback-blackbox.js +0 -4
  332. package/dist/scripts/mad-zellij-self-heal-blackbox.js +0 -4
  333. package/dist/scripts/naruto-loop-mesh-blackbox.js +0 -3
  334. package/dist/scripts/naruto-real-parallelism-blackbox.js +0 -307
  335. package/dist/scripts/naruto-worktree-coding-blackbox.js +0 -29
  336. package/dist/scripts/parallel-runtime-real-blackbox.js +0 -44
  337. package/dist/scripts/pipeline-codex-native-doctor-mad-routing-real-blackbox.js +0 -77
  338. package/dist/scripts/pipeline-codex-native-e2e-blackbox.js +0 -13
  339. package/dist/scripts/pipeline-codex-native-image-routing-real-blackbox.js +0 -50
  340. package/dist/scripts/pipeline-codex-native-loop-routing-real-blackbox.js +0 -74
  341. package/dist/scripts/pipeline-codex-native-qa-routing-real-blackbox.js +0 -51
  342. package/dist/scripts/pipeline-codex-native-research-routing-real-blackbox.js +0 -45
  343. package/dist/scripts/pipeline-execution-profile-routing-blackbox.js +0 -4
  344. package/dist/scripts/postinstall-global-doctor-blackbox.js +0 -12
  345. package/dist/scripts/ppt-full-e2e-blackbox-check.js +0 -109
  346. package/dist/scripts/ppt-imagegen-blackbox-check.js +0 -46
  347. package/dist/scripts/project-skill-dedupe-blackbox.js +0 -36
  348. package/dist/scripts/qa-backfill-route-blackbox.js +0 -5
  349. package/dist/scripts/qa-patch-swarm-route-blackbox.js +0 -10
  350. package/dist/scripts/release-full-parallelism-blackbox.js +0 -41
  351. package/dist/scripts/release-triwiki-first-runner-blackbox.js +0 -48
  352. package/dist/scripts/release-wiring-3110-blackbox.js +0 -27
  353. package/dist/scripts/release-wiring-3112-blackbox.js +0 -17
  354. package/dist/scripts/release-wiring-3113-blackbox.js +0 -17
  355. package/dist/scripts/research-backfill-route-blackbox.js +0 -5
  356. package/dist/scripts/research-final-reviewer-blackbox.js +0 -70
  357. package/dist/scripts/research-stage-cycle-runtime-blackbox.js +0 -40
  358. package/dist/scripts/research-synthesis-writer-blackbox.js +0 -24
  359. package/dist/scripts/route-blackbox-realism-check.js +0 -21
  360. package/dist/scripts/scheduler-resource-claim-blackbox.js +0 -24
  361. package/dist/scripts/seo-cli-blackbox-check.js +0 -18
  362. package/dist/scripts/sks-3110-all-feature-regression-blackbox.js +0 -116
  363. package/dist/scripts/sks-3112-all-feature-regression-blackbox.js +0 -29
  364. package/dist/scripts/sks-3113-all-feature-regression-blackbox.js +0 -17
  365. package/dist/scripts/sks-400-all-feature-regression-blackbox.js +0 -21
  366. package/dist/scripts/sks-400-extreme-parallel-blackbox.js +0 -8
  367. package/dist/scripts/sks-400-five-minute-blackbox.js +0 -9
  368. package/dist/scripts/sks-400-legacy-purge-blackbox.js +0 -8
  369. package/dist/scripts/sks-401-all-feature-regression-blackbox.js +0 -46
  370. package/dist/scripts/sks-401-five-minute-actual-blackbox.js +0 -23
  371. package/dist/scripts/sks-402-all-feature-regression-blackbox.js +0 -9
  372. package/dist/scripts/sks-402-five-minute-real-blackbox.js +0 -22
  373. package/dist/scripts/sksd-warm-cache-blackbox.js +0 -12
  374. package/dist/scripts/supabase-secret-preservation-blackbox.js +0 -29
  375. package/dist/scripts/team-backfill-route-blackbox.js +0 -5
  376. package/dist/scripts/team-parallel-write-blackbox.js +0 -55
  377. package/dist/scripts/team-patch-swarm-route-blackbox.js +0 -10
  378. package/dist/scripts/triwiki-affected-graph-blackbox.js +0 -28
  379. package/dist/scripts/triwiki-proof-bank-blackbox.js +0 -30
  380. package/dist/scripts/triwiki-proof-bank-lock-blackbox.js +0 -7
  381. package/dist/scripts/update-preserves-supabase-keys-blackbox.js +0 -27
  382. package/dist/scripts/ux-patch-swarm-route-blackbox.js +0 -10
  383. package/dist/scripts/ux-review-imagegen-blackbox-check.js +0 -67
  384. package/dist/scripts/zellij-initial-main-only-blackbox.js +0 -28
  385. package/dist/scripts/zellij-pane-lock-concurrency-blackbox.js +0 -80
  386. package/dist/scripts/zellij-pane-lock-open-worker-integration-blackbox.js +0 -137
  387. package/dist/scripts/zellij-self-heal-typed-blackbox.js +0 -4
  388. package/dist/scripts/zellij-slot-telemetry-real-blackbox.js +0 -20
  389. package/dist/scripts/zellij-stacked-fallback-integration-blackbox.js +0 -81
  390. package/dist/scripts/zellij-worker-pane-real-ui-blackbox.js +0 -202
@@ -1,7 +1,11 @@
1
1
  import path from 'node:path';
2
- import { appendJsonl, readJson, writeJsonAtomic } from '../fsx.js';
2
+ import { appendJsonl, appendJsonlMany, ensureDir, readJson, writeJsonAtomic } from '../fsx.js';
3
3
  import { AGENT_PATCH_QUEUE_SCHEMA, InMemoryAgentPatchQueue, buildAgentPatchOwnershipLedger } from './agent-patch-queue.js';
4
4
  import { AgentPatchTransactionJournal } from './agent-patch-transaction-journal.js';
5
+ import { normalizeAgentPatchEnvelope } from './agent-patch-schema.js';
6
+ import { scanImpact } from '../verification/impact-scan.js';
7
+ import { runMachineFeedback } from '../verification/machine-feedback.js';
8
+ import { analyzeDiffQuality } from '../verification/diff-quality.js';
5
9
  export const AGENT_PATCH_QUEUE_ARTIFACT = 'agent-patch-queue.json';
6
10
  export const AGENT_PATCH_QUEUE_EVENTS_ARTIFACT = 'agent-patch-queue-events.jsonl';
7
11
  export const AGENT_PATCH_OWNERSHIP_LEDGER_ARTIFACT = 'agent-patch-ownership-ledger.json';
@@ -15,7 +19,13 @@ export class PersistentAgentPatchQueueStore {
15
19
  this.journal = new AgentPatchTransactionJournal(artifactDir);
16
20
  }
17
21
  async enqueue(input, context = {}) {
18
- const entry = this.queue.enqueue(input, context);
22
+ const preflight = await this.runQualityPreflight(input, context);
23
+ const entry = this.queue.enqueue(input, {
24
+ ...(context.mission_id ? { mission_id: context.mission_id } : {}),
25
+ ...(context.route ? { route: context.route } : {}),
26
+ preflight_violations: preflight.violations,
27
+ preflight_reports: preflight.reports
28
+ });
19
29
  await this.persistSnapshot();
20
30
  await this.appendEvent(this.queue.events.at(-1));
21
31
  await this.journal.append({
@@ -29,9 +39,55 @@ export class PersistentAgentPatchQueueStore {
29
39
  });
30
40
  return entry;
31
41
  }
42
+ async runQualityPreflight(input, context = {}) {
43
+ const envelope = normalizeAgentPatchEnvelope(input);
44
+ const changedFiles = changedFilesForEnvelope(envelope);
45
+ const patchText = patchTextForEnvelope(envelope);
46
+ const root = envelope.git_worktree?.worktree_path || context.root || process.cwd();
47
+ const reportDir = path.join(this.artifactDir, 'patch-quality', safeName(`${envelope.agent_id}-${envelope.session_id}-${Date.now()}`));
48
+ await ensureDir(reportDir);
49
+ const [impact, diffQuality, feedback] = await Promise.all([
50
+ scanImpact(root, changedFiles, patchText).catch((err) => ({ schema: 'sks.impact-scan.v1', changed_symbols: [], references: [], cochange_required: [], tool: 'builtin', error: errorMessage(err) })),
51
+ analyzeDiffQuality({
52
+ root,
53
+ changedFiles,
54
+ patchText,
55
+ plannedFiles: envelope.allowed_paths || envelope.lease_proof?.allowed_paths || []
56
+ }).catch((err) => ({ schema: 'sks.diff-quality.v1', minimality: { plan_files: 0, touched_files: changedFiles.length, ratio: 1 }, dead_additions: [], comment_noise: 0, guard_bloat: 0, warnings: [], errors: [`diff_quality_failed:${errorMessage(err)}`] })),
57
+ runMachineFeedback(root, changedFiles, { timeoutMs: 60_000 }).catch((err) => ({ schema: 'sks.machine-feedback.v1', ok: false, typecheck: { ok: false, errors: [errorMessage(err)] }, lint: { ok: true, errors: [] }, tests: { ok: true, selected: [], failed: [], skipped_reason: 'machine_feedback_exception' }, duration_ms: 0 }))
58
+ ]);
59
+ await writeJsonAtomic(path.join(reportDir, 'impact-scan.json'), impact);
60
+ await writeJsonAtomic(path.join(reportDir, 'diff-quality.json'), diffQuality);
61
+ await writeJsonAtomic(path.join(reportDir, 'machine-feedback.json'), feedback);
62
+ const cochangeAck = envelope.cochange_acknowledged === true && String(envelope.cochange_acknowledged_reason || '').trim().length > 0;
63
+ const violations = [
64
+ ...(impact.cochange_required?.length && !cochangeAck ? [`impact_scan_cochange_missing:${impact.cochange_required.slice(0, 5).join(',')}`] : []),
65
+ ...((diffQuality.errors || []).map((issue) => `diff_quality:${issue}`)),
66
+ ...(feedback.ok === false ? ['machine_feedback_failed'] : []),
67
+ ...(isBugfixKind(context.work_item_kind, envelope.task_slice_id) && !validRegressionProof(envelope.regression_proof || context.regression_proof) ? ['tdd_evidence_missing'] : []),
68
+ ...(isRepairKind(context.work_item_kind, envelope.task_slice_id) && !(envelope.repair_hypothesis || context.repair_hypothesis) ? ['repair_without_hypothesis'] : [])
69
+ ];
70
+ return {
71
+ violations,
72
+ reports: {
73
+ impact_scan: path.relative(this.artifactDir, path.join(reportDir, 'impact-scan.json')),
74
+ diff_quality: path.relative(this.artifactDir, path.join(reportDir, 'diff-quality.json')),
75
+ machine_feedback: path.relative(this.artifactDir, path.join(reportDir, 'machine-feedback.json'))
76
+ }
77
+ };
78
+ }
32
79
  async markApplying(id) {
33
80
  await this.transition(id, () => this.queue.markApplying(id));
34
81
  }
82
+ async markApplyingBatch(ids) {
83
+ const uniqueIds = [...new Set(ids.map(String).filter(Boolean))];
84
+ if (!uniqueIds.length)
85
+ return;
86
+ const beforeEventCount = this.queue.events.length;
87
+ this.queue.markApplyingBatch(uniqueIds);
88
+ await this.persistSnapshot();
89
+ await this.appendEvents(this.queue.events.slice(beforeEventCount));
90
+ }
35
91
  async markApplied(id) {
36
92
  await this.transition(id, () => this.queue.markApplied(id));
37
93
  }
@@ -66,8 +122,7 @@ export class PersistentAgentPatchQueueStore {
66
122
  const beforeEventCount = this.queue.events.length;
67
123
  mutate();
68
124
  await this.persistSnapshot();
69
- for (const event of this.queue.events.slice(beforeEventCount))
70
- await this.appendEvent(event);
125
+ await this.appendEvents(this.queue.events.slice(beforeEventCount));
71
126
  const entry = this.queue.entries.find((item) => item.id === id);
72
127
  if (entry && ['verified', 'conflicted', 'rolled_back', 'rejected'].includes(entry.status)) {
73
128
  await this.journal.append({
@@ -86,5 +141,54 @@ export class PersistentAgentPatchQueueStore {
86
141
  return;
87
142
  await appendJsonl(path.join(this.artifactDir, AGENT_PATCH_QUEUE_EVENTS_ARTIFACT), event);
88
143
  }
144
+ async appendEvents(events) {
145
+ await appendJsonlMany(path.join(this.artifactDir, AGENT_PATCH_QUEUE_EVENTS_ARTIFACT), events.filter(Boolean));
146
+ }
147
+ }
148
+ function isBugfixKind(kind, id) {
149
+ const text = `${String(kind || '')} ${String(id || '')}`.toLowerCase();
150
+ return /\b(bugfix|fix|bug|regression|broken|failure|crash|error)\b|버그|회귀/.test(text);
151
+ }
152
+ function isRepairKind(kind, id) {
153
+ const text = `${String(kind || '')} ${String(id || '')}`.toLowerCase();
154
+ return /\b(conflict_resolution|repair|conflict|rebase|rollback)\b|수리|충돌/.test(text);
155
+ }
156
+ function validRegressionProof(proof) {
157
+ return Boolean(proof && proof.failed_before === true && proof.passed_after === true && String(proof.test_file || '').trim());
158
+ }
159
+ function changedFilesForEnvelope(envelope) {
160
+ const files = envelope.git_worktree?.changed_files?.length
161
+ ? envelope.git_worktree.changed_files
162
+ : envelope.operations.map((operation) => operation.path);
163
+ return [...new Set(files.map(normalizePath).filter(Boolean))];
164
+ }
165
+ function patchTextForEnvelope(envelope) {
166
+ return envelope.operations.map((operation) => {
167
+ if (operation.diff)
168
+ return operation.diff;
169
+ if (operation.op === 'replace')
170
+ return [
171
+ `--- a/${operation.path}`,
172
+ `+++ b/${operation.path}`,
173
+ `-${operation.search || ''}`,
174
+ `+${operation.replace || ''}`
175
+ ].join('\n');
176
+ if (operation.op === 'write')
177
+ return [
178
+ `--- /dev/null`,
179
+ `+++ b/${operation.path}`,
180
+ ...String(operation.content || '').split(/\r?\n/).map((line) => `+${line}`)
181
+ ].join('\n');
182
+ return '';
183
+ }).join('\n');
184
+ }
185
+ function normalizePath(value) {
186
+ return String(value || '').replace(/\\/g, '/').replace(/^\.\/+/, '');
187
+ }
188
+ function safeName(value) {
189
+ return String(value || 'patch').replace(/[^A-Za-z0-9_.-]+/g, '-').slice(0, 160);
190
+ }
191
+ function errorMessage(err) {
192
+ return err instanceof Error ? err.message : String(err);
89
193
  }
90
194
  //# sourceMappingURL=agent-patch-queue-store.js.map
@@ -6,6 +6,7 @@ export class InMemoryAgentPatchQueue {
6
6
  enqueue(input, context = {}) {
7
7
  const envelope = normalizeAgentPatchEnvelope(input);
8
8
  const validation = validateAgentPatchEnvelope(envelope);
9
+ const preflightViolations = Array.isArray(context.preflight_violations) ? context.preflight_violations.map(String) : [];
9
10
  const now = new Date().toISOString();
10
11
  const leaseId = envelope.lease_id || envelope.lease_proof?.lease_id;
11
12
  const entry = {
@@ -19,8 +20,9 @@ export class InMemoryAgentPatchQueue {
19
20
  ...(leaseId ? { lease_id: leaseId } : {}),
20
21
  write_paths: envelope.operations.map((operation) => operation.path),
21
22
  envelope,
22
- status: validation.ok ? 'pending' : 'rejected',
23
- violations: validation.violations,
23
+ status: validation.ok && preflightViolations.length === 0 ? 'pending' : 'rejected',
24
+ violations: [...validation.violations, ...preflightViolations],
25
+ ...(context.preflight_reports ? { quality_reports: context.preflight_reports } : {}),
24
26
  created_at: now,
25
27
  updated_at: now
26
28
  };
@@ -34,6 +36,10 @@ export class InMemoryAgentPatchQueue {
34
36
  markApplying(id) {
35
37
  this.transition(id, 'applying');
36
38
  }
39
+ markApplyingBatch(ids) {
40
+ for (const id of ids)
41
+ this.transition(id, 'applying');
42
+ }
37
43
  markApplied(id) {
38
44
  this.transition(id, 'applied');
39
45
  }
@@ -93,7 +99,8 @@ export function buildAgentPatchOwnershipLedger(entries) {
93
99
  status: entry.status,
94
100
  created_at: entry.created_at,
95
101
  updated_at: entry.updated_at,
96
- violations: [...entry.violations]
102
+ violations: [...entry.violations],
103
+ quality_reports: entry.quality_reports || null
97
104
  }));
98
105
  }
99
106
  //# sourceMappingURL=agent-patch-queue.js.map
@@ -31,6 +31,11 @@ export function normalizeAgentPatchEnvelope(input) {
31
31
  ...(input?.rationale ? { rationale: String(input.rationale) } : {}),
32
32
  ...(input?.verification_hint ? { verification_hint: normalizeHint(input.verification_hint) } : {}),
33
33
  ...(input?.rollback_hint ? { rollback_hint: normalizeHint(input.rollback_hint) } : {}),
34
+ ...(input?.cochange_acknowledged === undefined ? {} : { cochange_acknowledged: Boolean(input.cochange_acknowledged) }),
35
+ ...(input?.cochange_acknowledged_reason === undefined ? {} : { cochange_acknowledged_reason: String(input.cochange_acknowledged_reason) }),
36
+ ...(input?.regression_proof ? { regression_proof: normalizeRegressionProof(input.regression_proof) } : {}),
37
+ ...(input?.repair_hypothesis && typeof input.repair_hypothesis === 'object' ? { repair_hypothesis: input.repair_hypothesis } : {}),
38
+ ...(input?.tournament && typeof input.tournament === 'object' ? { tournament: input.tournament } : {}),
34
39
  operations: Array.isArray(input?.operations) ? input.operations.map(normalizeOperation) : []
35
40
  };
36
41
  }
@@ -135,6 +140,14 @@ function normalizeHint(input) {
135
140
  ...(input?.notes === undefined ? {} : { notes: String(input.notes) })
136
141
  };
137
142
  }
143
+ function normalizeRegressionProof(input) {
144
+ return {
145
+ ...(input?.test_file === undefined ? {} : { test_file: String(input.test_file) }),
146
+ ...(input?.failed_before === undefined ? {} : { failed_before: Boolean(input.failed_before) }),
147
+ ...(input?.passed_after === undefined ? {} : { passed_after: Boolean(input.passed_after) }),
148
+ ...(input?.output_digest === undefined ? {} : { output_digest: String(input.output_digest) })
149
+ };
150
+ }
138
151
  function pathAllowedByLease(operationPath, allowedPaths) {
139
152
  const rel = normalizePatchPath(operationPath);
140
153
  return allowedPaths.map(normalizePatchPath).some((allowed) => rel === allowed || rel.startsWith(`${allowed}/`));
@@ -129,6 +129,11 @@ export async function writeAgentProofEvidence(root, input) {
129
129
  narutoWorkGraph
130
130
  });
131
131
  const changedFileLeaseBlockers = readOnlyNoWriteLeaseMode ? [] : agentChangedFileLeaseViolations(input.results || [], input.partition?.leases || []);
132
+ const schedulerBackfillSatisfied = !scheduler
133
+ || Number(scheduler.expected_backfill_count || 0) <= Number(scheduler.backfill_count || 0)
134
+ || (scheduler.pending_queue_drained === true
135
+ && Number(scheduler.active_slot_count || 0) === 0
136
+ && Number(scheduler.max_observed_active_slots || 0) >= Number(scheduler.target_active_slots || 0));
132
137
  const blockers = [
133
138
  ...(lifecycle.ok ? [] : ['agent_lifecycle_not_all_closed']),
134
139
  ...(lifecycle.ok ? [] : lifecycle.open_sessions.map((id) => 'session_open:' + id)),
@@ -144,7 +149,7 @@ export async function writeAgentProofEvidence(root, input) {
144
149
  ...(scheduler && scheduler.pending_count > 0 && scheduler.active_slot_count === 0 ? ['scheduler_pending_queue_without_active_sessions'] : []),
145
150
  ...(scheduler && scheduler.pending_queue_drained !== true ? ['scheduler_pending_queue_not_drained'] : []),
146
151
  ...(scheduler && Number(scheduler.active_slot_count || 0) !== 0 ? ['scheduler_active_slots_not_zero_at_finalization'] : []),
147
- ...(scheduler && Number(scheduler.expected_backfill_count || 0) > Number(scheduler.backfill_count || 0) ? ['scheduler_backfill_count_below_expected'] : []),
152
+ ...(schedulerBackfillSatisfied ? [] : ['scheduler_backfill_count_below_expected']),
148
153
  ...(scheduler && Number(scheduler.total_work_items || 0) >= Number(scheduler.target_active_slots || 0) && Number(scheduler.max_observed_active_slots || 0) !== Number(scheduler.target_active_slots || 0) ? ['scheduler_max_observed_active_slots_mismatch'] : []),
149
154
  ...(taskGraph && !taskGraphMatchesCliOptions ? ['task_graph_cli_options_mismatch'] : []),
150
155
  ...(workQueue && taskGraph && !workQueueMatchesTaskGraph ? ['work_queue_task_graph_mismatch'] : []),
@@ -23,6 +23,10 @@ export async function runFakeAgent(agent, slice, opts = {}) {
23
23
  unverified: ['fake backend does not prove real parallel execution'],
24
24
  writes: [],
25
25
  ...(patchEnvelopes.length ? { patch_envelopes: patchEnvelopes } : {}),
26
+ ...(isBugfixSlice(slice) && patchEnvelopes.length ? { regression_proof: fixtureRegressionProof(slice) } : {}),
27
+ ...(isRepairSlice(slice) && patchEnvelopes.length ? { repair_hypothesis: fixtureRepairHypothesis(slice) } : {}),
28
+ ...(slice?.work_item_kind ? { work_item_kind: String(slice.work_item_kind) } : {}),
29
+ ...(slice?.tournament_group_id ? { tournament: fixtureTournament(slice) } : {}),
26
30
  source_intelligence_refs: agent.source_intelligence_refs || null,
27
31
  goal_mode_ref: agent.goal_mode_ref || null,
28
32
  ...(opts.emitFollowUpWorkItems ? { follow_up_work_items: [buildFixtureFollowUp(agent, slice)] } : {}),
@@ -94,10 +98,46 @@ export function buildFixturePatchEnvelopes(agent, slice, opts = {}) {
94
98
  path: file,
95
99
  content: `patched by ${String(agent.id)} for ${String(slice?.id || 'fixture')}\n`
96
100
  }],
101
+ ...(isBugfixSlice(slice) ? { regression_proof: fixtureRegressionProof(slice) } : {}),
102
+ ...(isRepairSlice(slice) ? { repair_hypothesis: fixtureRepairHypothesis(slice) } : {}),
103
+ ...(slice?.tournament_group_id ? { tournament: fixtureTournament(slice) } : {}),
97
104
  rationale: 'Fixture patch envelope emitted by fake backend for a leased write task.',
98
105
  verification_hint: { node_id: verificationNodeId, expected_status: 'applied_hashes_recorded' },
99
106
  rollback_hint: { node_id: rollbackNodeId, strategy: 'restore content_before or delete newly created file' }
100
107
  };
101
108
  });
102
109
  }
110
+ function isBugfixSlice(slice) {
111
+ const text = `${String(slice?.work_item_kind || '')} ${String(slice?.title || '')}`.toLowerCase();
112
+ return /\b(bugfix|fix|bug|regression|broken|failure|crash|error)\b|버그|회귀/.test(text);
113
+ }
114
+ function isRepairSlice(slice) {
115
+ const text = `${String(slice?.work_item_kind || '')} ${String(slice?.title || '')}`.toLowerCase();
116
+ return /\b(conflict_resolution|repair|conflict|rebase|rollback)\b|수리|충돌/.test(text);
117
+ }
118
+ function fixtureRegressionProof(slice) {
119
+ return {
120
+ test_file: String(slice?.target_paths?.[0] || slice?.write_paths?.[0] || 'fixture.test.js'),
121
+ failed_before: true,
122
+ passed_after: true,
123
+ output_digest: 'fixture-regression-proof'
124
+ };
125
+ }
126
+ function fixtureRepairHypothesis(slice) {
127
+ return {
128
+ failure: 'fixture repair target',
129
+ hypotheses: [{ cause: 'fixture conflict', evidence_for: 'simulated failed worker', evidence_against: 'none' }],
130
+ chosen: 'fixture conflict',
131
+ minimal_probe: String(slice?.id || 'fixture')
132
+ };
133
+ }
134
+ function fixtureTournament(slice) {
135
+ return {
136
+ schema: 'sks.solution-tournament-candidate.v1',
137
+ group_id: String(slice.tournament_group_id),
138
+ candidate_index: Number(slice.tournament_candidate_index || 1),
139
+ candidate_count: Number(slice.tournament_candidate_count || 1),
140
+ approach: String(slice.approach_directive || '')
141
+ };
142
+ }
103
143
  //# sourceMappingURL=agent-runner-fake.js.map
@@ -1,5 +1,5 @@
1
1
  import path from 'node:path';
2
- import { appendJsonl, nowIso, writeJsonAtomic } from '../fsx.js';
2
+ import { appendJsonl, appendJsonlMany, nowIso, writeJsonAtomic } from '../fsx.js';
3
3
  import { MAX_AGENT_COUNT } from './agent-schema.js';
4
4
  import { appendAgentWorkQueueEvent, completeWorkItem, createAgentWorkQueue, enqueueFollowUpWorkItems, leaseNextWorkItem, pendingWorkItems, writeAgentWorkQueue } from './agent-work-queue.js';
5
5
  import { closeWorkerSlotsAfterDrain, createAgentWorkerSlots, markWorkerSlotGenerationClosed, openWorkerSlotGeneration, writeAgentWorkerSlots } from './agent-worker-slot.js';
@@ -290,8 +290,7 @@ export async function runAgentScheduler(input) {
290
290
  finally {
291
291
  batchDispatchInProgress = false;
292
292
  }
293
- for (const event of launchEvents)
294
- await appendJsonl(path.join(input.root, 'agent-scheduler-events.jsonl'), { schema: AGENT_SCHEDULER_EVENT_SCHEMA, ts: nowIso(), ...event });
293
+ await appendJsonlMany(path.join(input.root, 'agent-scheduler-events.jsonl'), launchEvents.map((event) => ({ schema: AGENT_SCHEDULER_EVENT_SCHEMA, ts: nowIso(), ...event })));
295
294
  }
296
295
  function collectLaunchBatch() {
297
296
  const launches = [];
@@ -27,6 +27,7 @@ export function validateAgentWorkerResult(result) {
27
27
  session_id: String(result?.session_id || 'unknown'),
28
28
  persona_id: String(result?.persona_id || result?.agent_id || 'unknown'),
29
29
  task_slice_id: String(result?.task_slice_id || 'unknown'),
30
+ ...(result?.work_item_kind === undefined ? {} : { work_item_kind: String(result.work_item_kind) }),
30
31
  status: guard.ok ? (result?.status === undefined ? 'done' : String(result.status)) : 'blocked',
31
32
  backend: result?.backend || 'fake',
32
33
  summary: String(result?.summary || ''),
@@ -52,6 +53,10 @@ export function validateAgentWorkerResult(result) {
52
53
  ...(result?.model_authored_patch_envelopes === undefined ? {} : { model_authored_patch_envelopes: Boolean(result.model_authored_patch_envelopes) }),
53
54
  ...(result?.fixture_patch_envelopes === undefined ? {} : { fixture_patch_envelopes: Boolean(result.fixture_patch_envelopes) }),
54
55
  ...(result?.no_patch_reason === undefined ? {} : { no_patch_reason: result.no_patch_reason }),
56
+ ...(result?.machine_feedback === undefined ? {} : { machine_feedback: result.machine_feedback }),
57
+ ...(result?.regression_proof === undefined ? {} : { regression_proof: result.regression_proof }),
58
+ ...(result?.repair_hypothesis === undefined ? {} : { repair_hypothesis: result.repair_hypothesis }),
59
+ ...(result?.tournament === undefined ? {} : { tournament: result.tournament }),
55
60
  ...(result?.source_intelligence_refs === undefined ? {} : { source_intelligence_refs: result.source_intelligence_refs }),
56
61
  ...(result?.goal_mode_ref === undefined ? {} : { goal_mode_ref: result.goal_mode_ref }),
57
62
  ...(result?.follow_up_work_items === undefined ? {} : { follow_up_work_items: followUps.accepted }),
@@ -69,6 +74,12 @@ export function validateAgentWorkerResult(result) {
69
74
  normalized.blockers.push(...patchEnvelopeValidation.blockers.map((issue) => 'patch_envelope_invalid:' + issue));
70
75
  normalized.verification = { status: 'failed', checks: [...normalized.verification.checks, 'agent-patch-envelope-schema'] };
71
76
  }
77
+ const protocolBlockers = qualityProtocolBlockers(normalized);
78
+ if (protocolBlockers.length) {
79
+ normalized.status = 'blocked';
80
+ normalized.blockers.push(...protocolBlockers);
81
+ normalized.verification = { status: 'failed', checks: [...normalized.verification.checks, 'agent-worker-quality-protocol'] };
82
+ }
72
83
  const readOnlyOrNoopWithoutPatch = acceptsNoPatchReadOnlyOrNoop(result?.no_patch_reason);
73
84
  if (patchEnvelopeValidation.envelopes.length === 0 && (normalized.writes.length > 0 || (!readOnlyOrNoopWithoutPatch && normalized.changed_files.length > 0))) {
74
85
  normalized.status = 'blocked';
@@ -83,6 +94,24 @@ export function validateAgentWorkerResult(result) {
83
94
  }
84
95
  return normalized;
85
96
  }
97
+ function qualityProtocolBlockers(result) {
98
+ const writesPatch = result.writes.length > 0 || result.changed_files.length > 0 || Boolean(result.patch_envelopes?.length);
99
+ if (!writesPatch)
100
+ return [];
101
+ const kind = String(result.work_item_kind || result.naruto_runtime?.work_item_kind || '').toLowerCase();
102
+ const text = [kind, result.task_slice_id].join(' ').toLowerCase();
103
+ const proof = result.regression_proof || result.patch_envelopes?.find((envelope) => envelope.regression_proof)?.regression_proof || null;
104
+ const repair = result.repair_hypothesis || result.patch_envelopes?.find((envelope) => envelope.repair_hypothesis)?.repair_hypothesis || null;
105
+ const blockers = [];
106
+ if ((kind === 'bugfix' || /\b(fix|bug|regression|broken|failure|crash|error)\b|버그|회귀/.test(text)) && !validRegressionProof(proof))
107
+ blockers.push('tdd_evidence_missing');
108
+ if ((kind === 'conflict_resolution' || /\b(repair|conflict|rebase|rollback)\b|수리|충돌/.test(text)) && !repair)
109
+ blockers.push('repair_without_hypothesis');
110
+ return blockers;
111
+ }
112
+ function validRegressionProof(proof) {
113
+ return Boolean(proof && proof.failed_before === true && proof.passed_after === true && String(proof.test_file || '').trim());
114
+ }
86
115
  export function agentWorkerPipelineContract() {
87
116
  return {
88
117
  schema: 'sks.agent-worker-pipeline.v1',
@@ -97,7 +126,7 @@ export function agentWorkerPipelineContract() {
97
126
  required_for_write_tasks: true,
98
127
  envelope_schema: 'sks.agent-patch-envelope.v1',
99
128
  metadata: ['agent_id', 'session_id', 'slot_id', 'generation_index', 'lease_id_or_lease_proof'],
100
- optional_hints: ['rationale', 'verification_hint', 'rollback_hint']
129
+ optional_hints: ['rationale', 'verification_hint', 'rollback_hint', 'cochange_acknowledged_reason', 'regression_proof', 'repair_hypothesis']
101
130
  }
102
131
  };
103
132
  }
@@ -111,7 +140,12 @@ function normalizePatchEnvelopes(value) {
111
140
  ...(raw?.generation_index === undefined ? {} : { generation_index: Number(raw.generation_index) }),
112
141
  ...(raw?.task_slice_id === undefined ? {} : { task_slice_id: String(raw.task_slice_id) }),
113
142
  ...(raw?.verification_hint === undefined ? {} : { verification_hint: raw.verification_hint }),
114
- ...(raw?.rollback_hint === undefined ? {} : { rollback_hint: raw.rollback_hint })
143
+ ...(raw?.rollback_hint === undefined ? {} : { rollback_hint: raw.rollback_hint }),
144
+ ...(raw?.cochange_acknowledged === undefined ? {} : { cochange_acknowledged: Boolean(raw.cochange_acknowledged) }),
145
+ ...(raw?.cochange_acknowledged_reason === undefined ? {} : { cochange_acknowledged_reason: String(raw.cochange_acknowledged_reason) }),
146
+ ...(raw?.regression_proof === undefined ? {} : { regression_proof: raw.regression_proof }),
147
+ ...(raw?.repair_hypothesis === undefined ? {} : { repair_hypothesis: raw.repair_hypothesis }),
148
+ ...(raw?.tournament === undefined ? {} : { tournament: raw.tournament })
115
149
  })) : [];
116
150
  const blockers = envelopes.flatMap((envelope, index) => {
117
151
  const validation = validateAgentPatchEnvelope(envelope);
@@ -112,6 +112,8 @@ function buildWorkerPrompt(slice) {
112
112
  `Write-capable slice. write_paths=${JSON.stringify(writePaths)}.`,
113
113
  'Return at least one patch_envelopes item with source "model_authored".',
114
114
  `Use a write operation for ${JSON.stringify(writePaths[0])}, allowed_paths equal to write_paths, lease_proof.protected_path_check "passed", and non-empty verification_hint and rollback_hint.`,
115
+ 'Impact-scan, machine-feedback, diff-quality, and compiled mistake rules run before queue acceptance; exported signature changes must include cochanged callers or a concrete cochange_acknowledged_reason.',
116
+ 'For bugfix work, add a regression test first and include regression_proof with failed_before true and passed_after true. For repair work, include repair_hypothesis before patching.',
115
117
  'For patch envelope runtime ids you cannot know yet, use numeric 0 or empty strings; SKS will bind actual worker and Codex child process ids from the process report.',
116
118
  'Set changed_files and writes consistently with the patch envelope operation.'
117
119
  ].join('\n')
@@ -4,7 +4,7 @@ import path from 'node:path';
4
4
  import { appendJsonl, ensureDir, exists, nowIso, packageRoot, readJson, writeJsonAtomic } from '../fsx.js';
5
5
  import { fastModeEnv } from './fast-mode-policy.js';
6
6
  import { validateAgentWorkerResult } from './agent-worker-pipeline.js';
7
- import { closeWorkerPane, openWorkerPane } from '../zellij/zellij-worker-pane-manager.js';
7
+ import { closeWorkerPane, openHeadlessByDesignViewportWorker, openWorkerPane } from '../zellij/zellij-worker-pane-manager.js';
8
8
  import { closeWorkerInRightColumn, recordHeadlessWorkerInRightColumn } from '../zellij/zellij-right-column-manager.js';
9
9
  import { resolveProviderContext } from '../provider/provider-context.js';
10
10
  import { buildZellijSlotPaneCommand } from '../zellij/zellij-slot-pane-renderer.js';
@@ -110,17 +110,19 @@ class NativeCliSessionSwarmRecorder {
110
110
  const stdout = fs.createWriteStream(path.join(this.root, stdoutRel), { flags: 'a' });
111
111
  const stderr = fs.createWriteStream(path.join(this.root, stderrRel), { flags: 'a' });
112
112
  const placement = String(ctx.opts.workerPlacement || this.input.workerPlacement || (this.input.backend === 'zellij' ? 'zellij-pane' : 'process'));
113
- const zellijReservation = placement === 'zellij-pane'
113
+ const legacyWorkerPanes = process.env.SKS_ZELLIJ_LEGACY_WORKER_PANES === '1';
114
+ const wantsZellijUi = placement === 'zellij-pane'
114
115
  && ctx.opts.zellijPaneWorker !== false
115
- && (ctx.opts.zellijSessionName || this.input.missionId)
116
+ && (ctx.opts.zellijSessionName || this.input.missionId);
117
+ const zellijReservation = wantsZellijUi && legacyWorkerPanes
116
118
  ? this.reserveVisibleZellijPane(ctx.opts, String(ctx.agent.session_id || ctx.agent.id || `${Date.now()}:${Math.random()}`))
117
119
  : null;
118
- const useZellijPane = Boolean(zellijReservation);
120
+ const useZellijPane = Boolean(zellijReservation) || (wantsZellijUi && !legacyWorkerPanes);
119
121
  await this.telemetry(ctx, {
120
122
  eventType: 'slot_reserved',
121
123
  status: placement === 'zellij-pane' && !useZellijPane ? 'headless' : 'queued',
122
124
  artifacts: [intakeRel, heartbeatRel, resultRel],
123
- logTail: `placement=${placement}`
125
+ logTail: `placement=${placement}${wantsZellijUi && !legacyWorkerPanes ? ';viewport-ui=headless-by-design' : ''}`
124
126
  });
125
127
  if (useZellijPane) {
126
128
  stdout.end();
@@ -342,6 +344,11 @@ class NativeCliSessionSwarmRecorder {
342
344
  artifactDir: path.join(this.root, input.workerDirRel),
343
345
  backend: this.input.backend,
344
346
  role,
347
+ provider: providerContext.provider,
348
+ model: String(process.env.SKS_MODEL || process.env.OPENAI_MODEL || process.env.CODEX_MODEL || ''),
349
+ serviceTier: this.input.fastModePolicy.service_tier,
350
+ reasoningEffort: String(input.ctx.agent.model_reasoning_effort || input.ctx.agent.reasoning_effort || process.env.SKS_REASONING_EFFORT || ''),
351
+ currentTask: String(input.ctx.slice?.title || input.ctx.slice?.description || input.ctx.slice?.id || ''),
345
352
  mode: uiMode,
346
353
  watch: true
347
354
  });
@@ -371,14 +378,14 @@ class NativeCliSessionSwarmRecorder {
371
378
  session_id: input.ctx.agent.session_id || null,
372
379
  pid: processRun.pid,
373
380
  backend: this.input.backend,
374
- placement: 'zellij-pane',
381
+ placement: process.env.SKS_ZELLIJ_LEGACY_WORKER_PANES === '1' ? 'zellij-pane' : 'headless_by_design_viewport_ui',
375
382
  worktree_id: worktree?.id || null
376
383
  }).catch(() => undefined);
377
384
  await this.record(input.record);
378
385
  }
379
386
  let paneRecord;
380
387
  try {
381
- paneRecord = await openWorkerPane({
388
+ const paneInput = {
382
389
  root: this.root,
383
390
  missionId: this.input.missionId,
384
391
  sessionName,
@@ -402,22 +409,26 @@ class NativeCliSessionSwarmRecorder {
402
409
  projectRoot: input.ctx.opts.projectRoot || this.input.projectRoot || input.ctx.opts.cwd,
403
410
  rightColumnMode: 'spawn-on-first-worker',
404
411
  visiblePaneCap: this.zellijVisiblePaneCap(input.ctx.opts),
412
+ plannedAgentCount: this.input.targetActiveSlots,
405
413
  dashboardSnapshot: {
406
414
  mode: this.input.route || '$Agent',
407
415
  backend_counts: { [this.input.backend]: this.input.targetActiveSlots },
408
416
  placement_counts: {
409
- 'zellij-pane': this.zellijVisiblePaneCap(input.ctx.opts),
410
- headless: Math.max(0, this.input.targetActiveSlots - this.zellijVisiblePaneCap(input.ctx.opts))
417
+ 'zellij-pane': process.env.SKS_ZELLIJ_LEGACY_WORKER_PANES === '1' ? this.zellijVisiblePaneCap(input.ctx.opts) : 0,
418
+ headless_by_design_viewport_ui: process.env.SKS_ZELLIJ_LEGACY_WORKER_PANES === '1' ? 0 : this.input.targetActiveSlots
411
419
  },
412
420
  active_workers: this.input.targetActiveSlots,
413
- visible_panes: this.zellijVisiblePaneCap(input.ctx.opts),
414
- headless_workers: Math.max(0, this.input.targetActiveSlots - this.zellijVisiblePaneCap(input.ctx.opts)),
421
+ visible_panes: Number(process.env.SKS_ZELLIJ_VIEWPORTS || 4),
422
+ headless_workers: process.env.SKS_ZELLIJ_LEGACY_WORKER_PANES === '1' ? Math.max(0, this.input.targetActiveSlots - this.zellijVisiblePaneCap(input.ctx.opts)) : this.input.targetActiveSlots,
415
423
  queue_depth: Math.max(0, this.input.requestedAgents - this.input.targetActiveSlots),
416
424
  local_llm: { tps: 0, queue: 0 },
417
425
  gpt_final_status: 'pending',
418
426
  gate_progress: 'worker-spawn'
419
427
  }
420
- });
428
+ };
429
+ paneRecord = process.env.SKS_ZELLIJ_LEGACY_WORKER_PANES === '1'
430
+ ? await openWorkerPane(paneInput)
431
+ : await openHeadlessByDesignViewportWorker(paneInput);
421
432
  }
422
433
  finally {
423
434
  if (input.zellijReservation)
@@ -426,7 +437,9 @@ class NativeCliSessionSwarmRecorder {
426
437
  const zellijRequired = process.env.SKS_REQUIRE_ZELLIJ === '1';
427
438
  const launchBlockers = zellijRequired ? paneRecord.blockers || [] : [];
428
439
  const launchWarnings = zellijRequired ? [] : paneRecord.blockers || [];
429
- input.record.command_line = ['zellij', '--session', sessionName, 'action', 'new-pane', '--direction', paneRecord.direction_applied, '--name', paneRecord.pane_name, '--', 'sh', '-lc', liveWorkerPane ? '<native-cli-worker-command>' : '<zellij-slot-pane-renderer-command>'];
440
+ input.record.command_line = paneRecord.pane_id_source === 'headless_by_design_viewport_ui'
441
+ ? ['node', '<native-cli-worker-command>', '# headless-by-design viewport UI']
442
+ : ['zellij', '--session', sessionName, 'action', 'new-pane', '--direction', paneRecord.direction_applied, '--name', paneRecord.pane_name, '--', 'sh', '-lc', liveWorkerPane ? '<native-cli-worker-command>' : '<zellij-slot-pane-renderer-command>'];
430
443
  input.record.zellij_session_name = sessionName;
431
444
  input.record.zellij_pane_id = paneRecord.pane_id || null;
432
445
  input.record.zellij_pane_id_source = paneRecord.pane_id_source;
@@ -441,6 +454,10 @@ class NativeCliSessionSwarmRecorder {
441
454
  input.record.worktree = worktree;
442
455
  input.record.zellij_ui_mode = uiMode;
443
456
  input.record.slot_visualization = liveWorkerPane ? 'worker-command-pane' : 'zellij-slot-pane-renderer';
457
+ if (paneRecord.pane_id_source === 'headless_by_design_viewport_ui') {
458
+ input.record.worker_placement = 'headless_by_design_viewport_ui';
459
+ input.record.slot_visualization = 'monitor-plus-viewport';
460
+ }
444
461
  input.record.status = launchBlockers.length ? 'failed' : 'running';
445
462
  input.record.blockers = launchBlockers;
446
463
  input.record.warnings = [...(input.record.warnings || []), ...launchWarnings];
@@ -323,10 +323,11 @@ function startWorkerProgressTelemetry(input) {
323
323
  progress: null
324
324
  }, 2 * 1024 * 1024).catch(() => undefined);
325
325
  workerTelemetry(input.agentRoot, input.intake, input.agent, input.slice, {
326
- eventType: 'heartbeat',
326
+ eventType: 'task_progress',
327
327
  status: 'running',
328
328
  backend: input.backend,
329
329
  serviceTier: input.serviceTier,
330
+ progress: { done: tick, total: 0, label: 'heartbeat' },
330
331
  artifacts: [input.heartbeatRel],
331
332
  logTail: `backend running ${tick}`
332
333
  }).catch(() => undefined);