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
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'node:fs/promises';
3
+ import os from 'node:os';
4
+ import path from 'node:path';
5
+ import { evaluateHookPayload } from '../core/hooks-runtime.js';
6
+ import { loadStateForSession, listSessionStates, stateFile } from '../core/mission.js';
7
+ const root = await fs.mkdtemp(path.join(os.tmpdir(), 'sks-concurrent-session-'));
8
+ await fs.mkdir(path.join(root, '.sneakoscope', 'state'), { recursive: true });
9
+ const aPrompt = await evaluateHookPayload('user-prompt-submit', {
10
+ cwd: root,
11
+ conversation_id: 'chat-a',
12
+ prompt: '$Naruto concurrent session A fixture'
13
+ }, { root });
14
+ const aState = await loadStateForSession(root, 'chat-a');
15
+ const bPrompt = await evaluateHookPayload('user-prompt-submit', {
16
+ cwd: root,
17
+ conversation_id: 'chat-b',
18
+ prompt: '$QA-LOOP concurrent session B fixture'
19
+ }, { root });
20
+ const bState = await loadStateForSession(root, 'chat-b');
21
+ const aReload = await loadStateForSession(root, 'chat-a');
22
+ const stopA = await evaluateHookPayload('stop', {
23
+ cwd: root,
24
+ conversation_id: 'chat-a',
25
+ last_assistant_message: 'Done.'
26
+ }, { root });
27
+ const aAfterStop = await loadStateForSession(root, 'chat-a');
28
+ await evaluateHookPayload('user-prompt-submit', {
29
+ cwd: root,
30
+ prompt: '$DFix fallback warning fixture A'
31
+ }, { root });
32
+ await evaluateHookPayload('stop', {
33
+ cwd: root,
34
+ last_assistant_message: 'DFix 완료 요약: fallback warning fixture.\nDFix 솔직모드: verified: warning path checked; not verified: none; remaining: none.'
35
+ }, { root });
36
+ const sessions = await listSessionStates(root);
37
+ const legacy = JSON.parse(await fs.readFile(stateFile(root), 'utf8'));
38
+ const warningPath = path.join(root, '.sneakoscope', 'state', 'session-id-fallback-warning.jsonl');
39
+ const warningLines = (await fs.readFile(warningPath, 'utf8').catch(() => '')).trim().split(/\n/).filter(Boolean);
40
+ const blockers = [
41
+ ...(aState.mission_id ? [] : ['session_a_mission_missing']),
42
+ ...(bState.mission_id ? [] : ['session_b_mission_missing']),
43
+ ...(aState.mission_id && bState.mission_id && aState.mission_id !== bState.mission_id ? [] : ['session_missions_not_distinct']),
44
+ ...(aReload.mission_id === aState.mission_id ? [] : ['session_a_reloaded_as_other_mission']),
45
+ ...(aAfterStop.mission_id === aState.mission_id ? [] : ['session_a_stop_state_contaminated']),
46
+ ...(legacy._session_key ? [] : ['legacy_current_missing_session_key']),
47
+ ...(sessions.length >= 2 ? [] : ['session_state_table_missing_rows']),
48
+ ...(warningLines.length >= 2 ? [] : ['missing_explicit_session_warning_log']),
49
+ ...(String(stopA?.reason || stopA?.systemMessage || '').includes(bState.mission_id || 'never-match') ? ['stop_a_mentions_session_b_mission'] : [])
50
+ ];
51
+ const report = {
52
+ schema: 'sks.concurrent-session-collision-check.v1',
53
+ ok: blockers.length === 0,
54
+ a_prompt_continue: aPrompt?.continue === true,
55
+ b_prompt_continue: bPrompt?.continue === true,
56
+ session_a: { mission_id: aState.mission_id, phase: aState.phase, key: aState._session_key },
57
+ session_b: { mission_id: bState.mission_id, phase: bState.phase, key: bState._session_key },
58
+ legacy_current: { mission_id: legacy.mission_id, session_key: legacy._session_key },
59
+ sessions: sessions.map((row) => ({ session_key: row.session_key, mission_id: row.mission_id, phase: row.phase })),
60
+ fallback_warning_count: warningLines.length,
61
+ stop_a_decision: stopA?.decision || (stopA?.continue ? 'continue' : 'unknown'),
62
+ blockers
63
+ };
64
+ console.log(JSON.stringify(report, null, 2));
65
+ if (!report.ok)
66
+ process.exitCode = 1;
67
+ //# sourceMappingURL=concurrent-session-collision-check.js.map
@@ -21,7 +21,7 @@ const required = {
21
21
  'README.md': ['CHANGELOG.md', 'docs/release-readiness.md', 'gpt-image-2'],
22
22
  'CHANGELOG.md': ['1.14.0', 'DFix Extreme Speed Kernel', 'hook trust doctor', 'warning-zero'],
23
23
  'docs/computer-use-evidence.md': ['sks.computer-use-live-evidence.v1', 'probe_only', 'live_capture_blocked', 'local-only', 'Codex Chrome Extension'],
24
- 'docs/codex-lb.md': ['durable_env_file', 'durable_keychain', 'durable_launchctl', 'shell_profile', 'process_only_ephemeral'],
24
+ 'docs/codex-lb.md': ['durable_env_file', 'durable_keychain', 'shell_profile', 'process_only_ephemeral', 'base URL only'],
25
25
  'docs/codex-0.136-compat.md': ['rust-v0.136.0', 'codex:0.136-compat', 'codex archive', 'codex app-server --stdio', 'CODEX_API_KEY', 'server tokens'],
26
26
  'docs/codex-0.135-compat.md': ['rust-v0.135.0', 'codex:0.135-compat', 'named permission profiles'],
27
27
  'docs/codex-cli-compat.md': ['rust-v0.136.0', 'session_archive_restore', 'profile_primary_selector', 'managed_network_proxy_env', 'goals_default_enabled', 'permission_profiles_requirements', 'SubagentStart', 'sks_zero_warning_disallowed', 'strict subset'],
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env node
2
+ // @ts-nocheck
3
+ import fs from 'node:fs/promises';
4
+ import os from 'node:os';
5
+ import path from 'node:path';
6
+ import { repairCodexImagegen } from '../core/doctor/imagegen-repair.js';
7
+ const root = await fs.mkdtemp(path.join(os.tmpdir(), 'sks-doctor-imagegen-repair-'));
8
+ const stateFile = path.join(root, 'imagegen-enabled');
9
+ const reportPath = path.join(root, 'doctor-imagegen-repair.json');
10
+ const codexBin = path.join(root, 'codex');
11
+ await fs.writeFile(codexBin, `#!/usr/bin/env node
12
+ const fs = require('fs');
13
+ const stateFile = ${JSON.stringify(stateFile)};
14
+ const args = process.argv.slice(2).join(' ');
15
+ if (args === '--version') {
16
+ console.log('codex-cli 99.0.0');
17
+ process.exit(0);
18
+ }
19
+ if (args === 'features enable image_generation') {
20
+ fs.writeFileSync(stateFile, '1');
21
+ console.log('enabled image_generation');
22
+ process.exit(0);
23
+ }
24
+ if (args === 'features list --json') {
25
+ const enabled = fs.existsSync(stateFile);
26
+ console.log(JSON.stringify({ features: { image_generation: enabled } }));
27
+ process.exit(0);
28
+ }
29
+ if (args === 'features list') {
30
+ const enabled = fs.existsSync(stateFile) ? 'true' : 'false';
31
+ console.log('image_generation stable ' + enabled);
32
+ process.exit(0);
33
+ }
34
+ console.error('unexpected fake codex args: ' + args);
35
+ process.exit(64);
36
+ `, { mode: 0o755 });
37
+ const report = await repairCodexImagegen({
38
+ root,
39
+ apply: true,
40
+ codexBin,
41
+ reportPath,
42
+ timeoutMs: 1000
43
+ });
44
+ const reportFile = JSON.parse(await fs.readFile(reportPath, 'utf8'));
45
+ const ok = report.schema === 'sks.doctor-imagegen-repair.v1'
46
+ && report.attempted === true
47
+ && report.recovered === true
48
+ && report.after?.core_ready === true
49
+ && report.steps?.some((step) => step.id === 'image_generation_feature_enable' && step.ok === true)
50
+ && reportFile.recovered === true;
51
+ console.log(JSON.stringify({
52
+ schema: 'sks.doctor-imagegen-repair-check.v1',
53
+ ok,
54
+ repair_schema: report.schema,
55
+ attempted: report.attempted,
56
+ recovered: report.recovered,
57
+ after_core_ready: report.after?.core_ready === true,
58
+ report_path: reportPath
59
+ }, null, 2));
60
+ if (!ok)
61
+ process.exitCode = 1;
62
+ //# sourceMappingURL=doctor-imagegen-repair-check.js.map
@@ -4,7 +4,15 @@ import fsp from 'node:fs/promises';
4
4
  import path from 'node:path';
5
5
  import { fileURLToPath } from 'node:url';
6
6
  const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..');
7
- const bin = path.join(root, 'dist', 'bin', 'sks.js');
8
- await fsp.chmod(bin, 0o755);
9
- console.log(`bin executable: ${path.relative(root, bin)}`);
7
+ const bins = [
8
+ path.join(root, 'dist', 'bin', 'sks.js'),
9
+ path.join(root, 'dist', 'bin', 'install.js')
10
+ ];
11
+ for (const bin of bins) {
12
+ await fsp.chmod(bin, 0o755).catch((err) => {
13
+ if (err?.code !== 'ENOENT')
14
+ throw err;
15
+ });
16
+ console.log(`bin executable: ${path.relative(root, bin)}`);
17
+ }
10
18
  //# sourceMappingURL=ensure-bin-executable.js.map
@@ -3,6 +3,7 @@
3
3
  import fs from 'node:fs';
4
4
  import path from 'node:path';
5
5
  import { spawnSync } from 'node:child_process';
6
+ import { COMMANDS } from '../cli/command-registry.js';
6
7
  const root = process.cwd();
7
8
  const release = JSON.parse(fs.readFileSync(path.join(root, 'release-gates.v2.json'), 'utf8'));
8
9
  const pkg = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'));
@@ -21,6 +22,10 @@ const splitReviewLineCounts = splitReviewFiles.map((file) => ({
21
22
  file,
22
23
  lines: lineCount(path.join(root, file))
23
24
  }));
25
+ const directCodexConfigWrites = scanDirectCodexConfigWrites();
26
+ const commandGateContract = scanCommandGateContract();
27
+ const directMkdtempCalls = scanDirectMkdtempCalls();
28
+ const rustTempdirCalls = scanRustTempdirCalls();
24
29
  if (releaseGates.length > 200)
25
30
  blockers.push(`release_preset_gate_budget_exceeded:${releaseGates.length}`);
26
31
  if (gates.length > 200)
@@ -33,6 +38,14 @@ if (fs.existsSync(path.join(root, 'src/core/pipeline-runtime.ts')))
33
38
  blockers.push('pipeline_runtime_duplicate_facade_present');
34
39
  if (gitTracked('*sks-backup*').length)
35
40
  blockers.push('tracked_sks_backup_files_present');
41
+ if (directCodexConfigWrites.length)
42
+ blockers.push(`direct_codex_config_write_callsite:${directCodexConfigWrites[0].file}:${directCodexConfigWrites[0].line}`);
43
+ if (!commandGateContract.ok)
44
+ blockers.push(`command_gate_contract:${commandGateContract.issues[0]}`);
45
+ if (directMkdtempCalls.length)
46
+ blockers.push(`direct_mkdtemp_callsite:${directMkdtempCalls[0].file}:${directMkdtempCalls[0].line}`);
47
+ if (rustTempdirCalls.length)
48
+ blockers.push(`rust_tempdir_without_raii:${rustTempdirCalls[0].file}:${rustTempdirCalls[0].line}`);
36
49
  for (const row of splitReviewLineCounts) {
37
50
  if (row.lines > splitReviewBudget)
38
51
  blockers.push(`split_review_budget_exceeded:${row.file}:${row.lines}`);
@@ -45,6 +58,12 @@ const result = {
45
58
  package_script_count: Object.keys(pkg.scripts || {}).length,
46
59
  split_review_budget_lines: splitReviewBudget,
47
60
  split_review_line_counts: splitReviewLineCounts,
61
+ direct_codex_config_write_callsite_count: directCodexConfigWrites.length,
62
+ direct_codex_config_write_callsites: directCodexConfigWrites.slice(0, 20),
63
+ command_gate_contract: commandGateContract,
64
+ direct_mkdtemp_callsite_count: directMkdtempCalls.length,
65
+ direct_mkdtemp_callsites: directMkdtempCalls.slice(0, 20),
66
+ rust_tempdir_raii: { ok: rustTempdirCalls.length === 0, direct_tempdir_callsites: rustTempdirCalls.slice(0, 20) },
48
67
  blockers
49
68
  };
50
69
  console.log(JSON.stringify(result, null, 2));
@@ -59,6 +78,76 @@ function gitTracked(pattern) {
59
78
  return [];
60
79
  }
61
80
  }
81
+ function scanCommandGateContract() {
82
+ const issues = [];
83
+ for (const [name, entry] of Object.entries(COMMANDS)) {
84
+ if (entry.readonly === true && entry.skipMigrationGate !== true)
85
+ issues.push(`${name}:readonly_without_skipMigrationGate`);
86
+ if (entry.diagnostic === true && entry.allowedDuringActiveRoute !== true)
87
+ issues.push(`${name}:diagnostic_without_active_route_allow`);
88
+ if (entry.ownsGates === true && entry.mutatesRouteState !== true)
89
+ issues.push(`${name}:ownsGates_without_mutatesRouteState`);
90
+ if (entry.mutatesRouteState === true && (!Array.isArray(entry.ownedGateFiles) || entry.ownedGateFiles.length === 0))
91
+ issues.push(`${name}:route_mutator_without_owned_gate_files`);
92
+ if (entry.allowedDuringActiveRoute === true && !entry.activeRoutePolicy)
93
+ issues.push(`${name}:missing_active_route_policy`);
94
+ }
95
+ for (const required of ['help', 'version', 'commands', 'status', 'root', 'stop-gate', 'route', 'doctor']) {
96
+ const entry = COMMANDS[required];
97
+ if (!entry?.skipMigrationGate)
98
+ issues.push(`${required}:missing_skipMigrationGate`);
99
+ }
100
+ for (const routeStarter of ['naruto', 'goal', 'dfix', 'team', 'agent', 'loop', 'qa-loop', 'research', 'autoresearch', 'mad-sks', 'mad-db', 'ppt', 'image-ux-review', 'computer-use']) {
101
+ const entry = COMMANDS[routeStarter];
102
+ if (entry?.mutatesRouteState !== true)
103
+ issues.push(`${routeStarter}:missing_route_state_mutator_contract`);
104
+ }
105
+ for (const migrationBypass of ['check', 'gates', 'task', 'release', 'triwiki', 'daemon', 'pipeline', 'wiki', 'stop-gate']) {
106
+ const entry = COMMANDS[migrationBypass];
107
+ if (entry?.skipMigrationGate !== true)
108
+ issues.push(`${migrationBypass}:missing_skip_migration_gate_contract`);
109
+ }
110
+ return { ok: issues.length === 0, issues };
111
+ }
112
+ function scanDirectMkdtempCalls() {
113
+ const files = [
114
+ ...walk(path.join(root, 'src', 'core')),
115
+ ...walk(path.join(root, 'src', 'cli')),
116
+ ...walk(path.join(root, 'src', 'commands')),
117
+ ...walk(path.join(root, 'src', 'scripts'))
118
+ ].filter((file) => file.endsWith('.ts'));
119
+ const out = [];
120
+ for (const file of files) {
121
+ const rel = path.relative(root, file);
122
+ if (rel === 'src/core/fsx.ts')
123
+ continue;
124
+ if (/(?:__tests__|fixture|fixtures|bench|blackbox|check|probe|smoke|selftest|feature-commands|feature-probes)/i.test(rel))
125
+ continue;
126
+ const lines = fs.readFileSync(file, 'utf8').split(/\r?\n/);
127
+ for (let index = 0; index < lines.length; index += 1) {
128
+ const line = lines[index] || '';
129
+ if (/\bmkdtemp(?:Sync)?\s*\(/.test(line))
130
+ out.push({ file: rel, line: index + 1, text: line.trim().slice(0, 220) });
131
+ }
132
+ }
133
+ return out;
134
+ }
135
+ function scanRustTempdirCalls() {
136
+ const crateRoot = path.join(root, 'crates');
137
+ const files = walk(crateRoot).filter((file) => file.endsWith('.rs'));
138
+ const out = [];
139
+ for (const file of files) {
140
+ const rel = path.relative(root, file);
141
+ const lines = fs.readFileSync(file, 'utf8').split(/\r?\n/);
142
+ for (let index = 0; index < lines.length; index += 1) {
143
+ const line = lines[index] || '';
144
+ if (/\b(?:std::env::temp_dir|tempfile::tempdir|TempDir::new|mktemp)\b/.test(line)) {
145
+ out.push({ file: rel, line: index + 1, text: line.trim().slice(0, 220) });
146
+ }
147
+ }
148
+ }
149
+ return out;
150
+ }
62
151
  function lineCount(file) {
63
152
  if (!fs.existsSync(file))
64
153
  return 0;
@@ -67,4 +156,45 @@ function lineCount(file) {
67
156
  return 0;
68
157
  return text.split(/\r?\n/).length - (text.endsWith('\n') ? 1 : 0);
69
158
  }
159
+ function scanDirectCodexConfigWrites() {
160
+ const files = [
161
+ ...walk(path.join(root, 'src', 'core')),
162
+ ...walk(path.join(root, 'src', 'cli')),
163
+ ...walk(path.join(root, 'src', 'commands'))
164
+ ].filter((file) => file.endsWith('.ts'));
165
+ const out = [];
166
+ for (const file of files) {
167
+ const rel = path.relative(root, file);
168
+ if (rel === 'src/core/codex/codex-config-guard.ts')
169
+ continue;
170
+ const lines = fs.readFileSync(file, 'utf8').split(/\r?\n/);
171
+ let inInstallHelperSelftest = false;
172
+ for (let index = 0; index < lines.length; index += 1) {
173
+ const line = lines[index] || '';
174
+ if (rel === 'src/cli/install-helpers.ts' && /export\s+async\s+function\s+selftest/.test(line))
175
+ inInstallHelperSelftest = true;
176
+ if (inInstallHelperSelftest)
177
+ continue;
178
+ if (!/\bwriteTextAtomic\s*\(/.test(line))
179
+ continue;
180
+ if (!/(?:config\.toml|configPath|candidate\.path|config\.path|userConfigPath|codexHomeConfigPath)/.test(line))
181
+ continue;
182
+ out.push({ file: rel, line: index + 1, text: line.trim().slice(0, 220) });
183
+ }
184
+ }
185
+ return out;
186
+ }
187
+ function walk(dir) {
188
+ if (!fs.existsSync(dir))
189
+ return [];
190
+ const out = [];
191
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
192
+ const file = path.join(dir, entry.name);
193
+ if (entry.isDirectory())
194
+ out.push(...walk(file));
195
+ else
196
+ out.push(file);
197
+ }
198
+ return out;
199
+ }
70
200
  //# sourceMappingURL=gate-policy-audit-check.js.map
@@ -0,0 +1,104 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'node:fs/promises';
3
+ import os from 'node:os';
4
+ import path from 'node:path';
5
+ import { performance } from 'node:perf_hooks';
6
+ import { assertGate, emitGate, root } from './sks-1-18-gate-lib.js';
7
+ import { ensureDir, nowIso, runProcess, writeJsonAtomic } from '../core/fsx.js';
8
+ import { reviewCommand } from '../core/commands/review-command.js';
9
+ import { collectUiState } from '../core/commands/ui-command.js';
10
+ import { simulateNarutoActivePool } from '../core/naruto/naruto-active-pool.js';
11
+ import { decideNarutoConcurrency } from '../core/naruto/naruto-concurrency-governor.js';
12
+ import { buildNarutoWorkGraph } from '../core/naruto/naruto-work-graph.js';
13
+ const reportPath = path.join(root, '.sneakoscope', 'reports', 'harness-benchmark.json');
14
+ const metrics = [];
15
+ metrics.push(await measure('install_entrypoint_readiness', 300000, async () => {
16
+ await assertFile('dist/bin/install.js');
17
+ await assertFile('plugins/sks/.codex-plugin/plugin.json');
18
+ return { mode: 'hermetic_readiness', command: 'npx sneakoscope install --yes' };
19
+ }));
20
+ metrics.push(await measure('stop_hook_light_budget', 25, async () => {
21
+ const started = performance.now();
22
+ await assertFile('dist/scripts/hook-latency-budget-check.js');
23
+ return { mode: 'script_presence_budget_proxy', measured_ms: performance.now() - started };
24
+ }));
25
+ metrics.push(await measure('swarm_14_worker_fixture', 20000, async () => {
26
+ const graph = buildNarutoWorkGraph({
27
+ requestedClones: 14,
28
+ totalWorkItems: 14,
29
+ honorExplicitTotalWorkItems: true,
30
+ readonly: true,
31
+ writeCapable: false,
32
+ maxActiveWorkers: 14
33
+ });
34
+ const governor = decideNarutoConcurrency({
35
+ requestedClones: 14,
36
+ totalWorkItems: 14,
37
+ pendingWorkQueueSize: 14,
38
+ backend: 'fake',
39
+ hardware: { remoteApiRateLimitBudget: 14, fileDescriptorLimit: 4096, freeMemoryBytes: 8 * 1024 * 1024 * 1024, totalMemoryBytes: 16 * 1024 * 1024 * 1024 }
40
+ });
41
+ const report = simulateNarutoActivePool({ graph, governor: { ...governor, safe_active_workers: 14 } });
42
+ return {
43
+ command: 'simulateNarutoActivePool --fake --clones 14',
44
+ ok: report.ok === true && report.completed_count >= 14 && report.max_observed_active_workers >= 7,
45
+ completed_count: report.completed_count,
46
+ max_observed_active_workers: report.max_observed_active_workers,
47
+ blockers: report.blockers
48
+ };
49
+ }));
50
+ metrics.push(await measure('review_10_file_diff', 120000, async () => {
51
+ const fixture = await makeReviewFixture();
52
+ const previousExitCode = process.exitCode;
53
+ const review = await reviewCommand(['--root', fixture]);
54
+ process.exitCode = previousExitCode;
55
+ return {
56
+ files: review?.files || 0,
57
+ machine_evidence: (review?.findings || []).filter((finding) => finding.evidence === 'machine').length,
58
+ verdict: review?.verdict || 'unknown'
59
+ };
60
+ }));
61
+ metrics.push(await measure('dashboard_first_state', 2000, async () => {
62
+ const state = await collectUiState(root, 'latest');
63
+ return { ok: state.ok === true, mission_id: state.mission_id || null, gates: Array.isArray(state.gates) ? state.gates.length : 0 };
64
+ }));
65
+ const report = {
66
+ schema: 'sks.harness-benchmark.v1',
67
+ generated_at: nowIso(),
68
+ ok: metrics.every((metric) => metric.ok),
69
+ metrics,
70
+ report_path: path.relative(root, reportPath)
71
+ };
72
+ await writeJsonAtomic(reportPath, report);
73
+ assertGate(report.ok, 'harness benchmark check failed', report);
74
+ emitGate('harness:benchmark', report);
75
+ async function measure(id, budgetMs, fn) {
76
+ const started = performance.now();
77
+ try {
78
+ const detail = await fn();
79
+ const elapsed_ms = Math.round((performance.now() - started) * 100) / 100;
80
+ return { id, ok: elapsed_ms <= budgetMs && detail.ok !== false, budget_ms: budgetMs, elapsed_ms, detail };
81
+ }
82
+ catch (err) {
83
+ const elapsed_ms = Math.round((performance.now() - started) * 100) / 100;
84
+ return { id, ok: false, budget_ms: budgetMs, elapsed_ms, error: err?.message || String(err) };
85
+ }
86
+ }
87
+ async function assertFile(rel) {
88
+ await fs.access(path.join(root, rel));
89
+ }
90
+ async function makeReviewFixture() {
91
+ const dir = await fs.mkdtemp(path.join(os.tmpdir(), 'sks-review-bench-'));
92
+ await runProcess('git', ['init'], { cwd: dir, timeoutMs: 15000, maxOutputBytes: 64 * 1024 });
93
+ for (let i = 0; i < 10; i += 1) {
94
+ await ensureDir(path.join(dir, 'src'));
95
+ await fs.writeFile(path.join(dir, 'src', `file-${i}.txt`), `baseline ${i}\n`, 'utf8');
96
+ }
97
+ await runProcess('git', ['add', '.'], { cwd: dir, timeoutMs: 15000, maxOutputBytes: 64 * 1024 });
98
+ for (let i = 0; i < 10; i += 1) {
99
+ const content = i === 0 ? '<<<<<<< HEAD\nleft\n=======\nright\n>>>>>>> branch\n' : `changed ${i}\n`;
100
+ await fs.writeFile(path.join(dir, 'src', `file-${i}.txt`), content, 'utf8');
101
+ }
102
+ return dir;
103
+ }
104
+ //# sourceMappingURL=harness-benchmark-check.js.map
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env node
2
+ // @ts-nocheck
3
+ import fs from 'node:fs';
4
+ import fsp from 'node:fs/promises';
5
+ import os from 'node:os';
6
+ import path from 'node:path';
7
+ import { performance } from 'node:perf_hooks';
8
+ import { assertGate, emitGate, importDist } from './sks-1-18-gate-lib.js';
9
+ const budgetMs = Number(process.env.SKS_HOOK_LATENCY_BUDGET_MS || 25);
10
+ const readBudget = Number(process.env.SKS_HOOK_LATENCY_READ_BUDGET || 3);
11
+ const root = await fsp.mkdtemp(path.join(os.tmpdir(), 'sks-hook-latency-'));
12
+ await fsp.mkdir(path.join(root, '.sneakoscope', 'state'), { recursive: true });
13
+ let readCount = 0;
14
+ const originalReadFile = fsp.readFile.bind(fsp);
15
+ fsp.readFile = async function patchedReadFile(file, ...rest) {
16
+ if (String(file).includes('.sneakoscope'))
17
+ readCount += 1;
18
+ return originalReadFile(file, ...rest);
19
+ };
20
+ try {
21
+ const { evaluateStop } = await importDist('core/pipeline-internals/runtime-gates.js');
22
+ const started = performance.now();
23
+ const decision = await evaluateStop(root, {
24
+ mission_id: 'M-light',
25
+ mode: 'ANSWER',
26
+ route: 'Answer',
27
+ route_command: '$Answer',
28
+ stop_gate: 'none',
29
+ reflection_required: false,
30
+ proof_required: false,
31
+ agents_required: false,
32
+ context7_required: false,
33
+ subagents_required: false
34
+ }, { message: 'done' });
35
+ const elapsed = performance.now() - started;
36
+ assertGate(decision === null, 'light stop route must early-exit without a block decision', { decision });
37
+ assertGate(elapsed <= budgetMs, 'light stop route exceeded latency budget', { elapsed_ms: elapsed, budget_ms: budgetMs, read_count: readCount });
38
+ assertGate(readCount <= readBudget, 'light stop route exceeded .sneakoscope read budget', { read_count: readCount, read_budget: readBudget, elapsed_ms: elapsed });
39
+ emitGate('hook:latency-budget', { elapsed_ms: Math.round(elapsed * 100) / 100, read_count: readCount, budget_ms: budgetMs, read_budget: readBudget });
40
+ }
41
+ finally {
42
+ fsp.readFile = originalReadFile;
43
+ fs.rmSync(root, { recursive: true, force: true });
44
+ }
45
+ //# sourceMappingURL=hook-latency-budget-check.js.map