sneakoscope 2.0.14 → 2.0.16

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 (491) hide show
  1. package/README.md +6 -3
  2. package/crates/sks-core/Cargo.lock +1 -1
  3. package/crates/sks-core/Cargo.toml +1 -1
  4. package/crates/sks-core/src/main.rs +1 -1
  5. package/dist/.sks-build-stamp.json +4 -4
  6. package/dist/bin/sks.js +1 -1
  7. package/dist/cli/command-registry.js +2 -1
  8. package/dist/commands/mad-db.js +5 -0
  9. package/dist/commands/zellij-slot-pane.js +3 -1
  10. package/dist/core/agents/agent-orchestrator.js +66 -3
  11. package/dist/core/agents/agent-plan.js +3 -2
  12. package/dist/core/agents/agent-scheduler.js +204 -86
  13. package/dist/core/agents/agent-schema.js +1 -1
  14. package/dist/core/agents/native-cli-session-swarm.js +199 -15
  15. package/dist/core/agents/native-cli-worker.js +85 -0
  16. package/dist/core/agents/parallel-runtime-proof.js +217 -0
  17. package/dist/core/codex-control/codex-task-runner.js +32 -4
  18. package/dist/core/codex-control/model-call-concurrency.js +106 -0
  19. package/dist/core/commands/basic-cli.js +1 -1
  20. package/dist/core/commands/command-suggestions.js +1 -1
  21. package/dist/core/commands/mad-db-command.js +106 -0
  22. package/dist/core/commands/mad-sks-command.js +50 -13
  23. package/dist/core/commands/naruto-command.js +128 -5
  24. package/dist/core/commands/research-command.js +13 -1
  25. package/dist/core/commands/team-command.js +23 -175
  26. package/dist/core/db-safety.js +55 -1
  27. package/dist/core/fsx.js +1 -1
  28. package/dist/core/git/git-worktree-capability.js +18 -0
  29. package/dist/core/git/git-worktree-manager.js +80 -0
  30. package/dist/core/git/git-worktree-pool.js +4 -0
  31. package/dist/core/mad-db/mad-db-capability.js +116 -0
  32. package/dist/core/mad-db/mad-db-ledger.js +31 -0
  33. package/dist/core/mad-db/mad-db-policy-resolver.js +48 -0
  34. package/dist/core/naruto/naruto-concurrency-governor.js +14 -1
  35. package/dist/core/pipeline-internals/runtime-core.js +74 -8
  36. package/dist/core/pipeline-internals/runtime-gates.js +44 -0
  37. package/dist/core/proof/route-proof-gate.js +5 -3
  38. package/dist/core/proof/route-proof-policy.js +9 -1
  39. package/dist/core/release/release-gate-affected-selector.js +113 -0
  40. package/dist/core/release/release-gate-batch-runner.js +67 -0
  41. package/dist/core/release/release-gate-dag.js +22 -3
  42. package/dist/core/release/release-gate-resource-governor.js +23 -11
  43. package/dist/core/research/implementation-blueprint-densifier.js +1 -1
  44. package/dist/core/research/implementation-blueprint-markdown.js +1 -1
  45. package/dist/core/research/implementation-blueprint.js +68 -7
  46. package/dist/core/research/research-final-reviewer.js +27 -1
  47. package/dist/core/research/research-handoff.js +69 -5
  48. package/dist/core/research/research-realistic-report.js +162 -0
  49. package/dist/core/research/research-repetition-detector.js +75 -0
  50. package/dist/core/research/research-report-quality.js +27 -5
  51. package/dist/core/research/research-stage-runner.js +40 -13
  52. package/dist/core/research/research-synthesis-prompt.js +52 -0
  53. package/dist/core/research/research-synthesis-writer.js +208 -0
  54. package/dist/core/research.js +60 -48
  55. package/dist/core/routes.js +23 -19
  56. package/dist/core/update/update-notice.js +120 -0
  57. package/dist/core/version.js +1 -1
  58. package/dist/core/zellij/zellij-dashboard-renderer.js +2 -0
  59. package/dist/core/zellij/zellij-slot-column-anchor.js +35 -1
  60. package/dist/core/zellij/zellij-slot-pane-renderer.js +57 -0
  61. package/dist/core/zellij/zellij-slot-telemetry.js +237 -0
  62. package/dist/scripts/release-gate-dag-runner.js +5 -0
  63. package/dist/scripts/release-speed-summary.js +27 -0
  64. package/package.json +76 -5
  65. package/schemas/agents/parallel-runtime-proof.schema.json +48 -0
  66. package/schemas/mad-db/mad-db-capability.schema.json +31 -0
  67. package/schemas/mad-db/mad-db-ledger.schema.json +14 -0
  68. package/schemas/research/implementation-blueprint.schema.json +6 -1
  69. package/schemas/research/research-final-review.schema.json +10 -0
  70. package/schemas/research/research-synthesis-output.schema.json +62 -0
  71. package/schemas/update/update-notice.schema.json +19 -0
  72. package/schemas/zellij/zellij-slot-telemetry.schema.json +89 -0
  73. package/dist/scripts/agent-ast-aware-work-graph-check.js +0 -25
  74. package/dist/scripts/agent-backfill-replenishment-check.js +0 -13
  75. package/dist/scripts/agent-backfill-route-blackbox.js +0 -5
  76. package/dist/scripts/agent-background-terminals-check.js +0 -16
  77. package/dist/scripts/agent-cleanup-command-ux-check.js +0 -12
  78. package/dist/scripts/agent-cleanup-executor-check.js +0 -53
  79. package/dist/scripts/agent-cleanup-executor-v2-check.js +0 -39
  80. package/dist/scripts/agent-cli-options-to-task-graph-check.js +0 -5
  81. package/dist/scripts/agent-codex-app-cockpit-check.js +0 -91
  82. package/dist/scripts/agent-codex-child-overlap-check.js +0 -21
  83. package/dist/scripts/agent-dynamic-cockpit-check.js +0 -10
  84. package/dist/scripts/agent-dynamic-pool-check.js +0 -13
  85. package/dist/scripts/agent-dynamic-pool-route-blackbox.js +0 -5
  86. package/dist/scripts/agent-fast-mode-default-check.js +0 -62
  87. package/dist/scripts/agent-fast-mode-worker-propagation-check.js +0 -7
  88. package/dist/scripts/agent-follow-up-work-schema-check.js +0 -80
  89. package/dist/scripts/agent-goal-mode-propagation-check.js +0 -9
  90. package/dist/scripts/agent-intelligent-work-graph-check.js +0 -25
  91. package/dist/scripts/agent-janitor-check.js +0 -76
  92. package/dist/scripts/agent-main-no-scout-check.js +0 -11
  93. package/dist/scripts/agent-model-authored-patch-envelope-check.js +0 -15
  94. package/dist/scripts/agent-multi-project-isolation-check.js +0 -86
  95. package/dist/scripts/agent-native-cli-session-proof-check.js +0 -7
  96. package/dist/scripts/agent-native-cli-session-swarm-10-check.js +0 -7
  97. package/dist/scripts/agent-native-cli-session-swarm-20-check.js +0 -7
  98. package/dist/scripts/agent-native-cli-session-swarm-check.js +0 -7
  99. package/dist/scripts/agent-no-subagent-scaling-check.js +0 -7
  100. package/dist/scripts/agent-parallel-write-blackbox.js +0 -56
  101. package/dist/scripts/agent-parallel-write-kernel-check.js +0 -103
  102. package/dist/scripts/agent-patch-conflict-rebase-check.js +0 -198
  103. package/dist/scripts/agent-patch-envelope-extraction-check.js +0 -17
  104. package/dist/scripts/agent-patch-proof-check.js +0 -41
  105. package/dist/scripts/agent-patch-proof-runtime-check.js +0 -63
  106. package/dist/scripts/agent-patch-queue-runtime-check.js +0 -36
  107. package/dist/scripts/agent-patch-rollback-check.js +0 -38
  108. package/dist/scripts/agent-patch-rollback-dag-check.js +0 -14
  109. package/dist/scripts/agent-patch-swarm-route-blackbox.js +0 -10
  110. package/dist/scripts/agent-patch-swarm-runtime-check.js +0 -10
  111. package/dist/scripts/agent-patch-swarm-runtime-truth-check.js +0 -76
  112. package/dist/scripts/agent-patch-transaction-journal-check.js +0 -57
  113. package/dist/scripts/agent-patch-verification-dag-check.js +0 -14
  114. package/dist/scripts/agent-proof-contract-reconciled-check.js +0 -5
  115. package/dist/scripts/agent-real-codex-dynamic-smoke-check.js +0 -166
  116. package/dist/scripts/agent-real-codex-dynamic-smoke-v2-check.js +0 -14
  117. package/dist/scripts/agent-real-codex-in-zellij-worker-pane-check.js +0 -229
  118. package/dist/scripts/agent-real-codex-parallel-workers-10-check.js +0 -5
  119. package/dist/scripts/agent-real-codex-parallel-workers-20-check.js +0 -5
  120. package/dist/scripts/agent-real-codex-parallel-workers-5-check.js +0 -5
  121. package/dist/scripts/agent-real-codex-parallel-workers-check.js +0 -5
  122. package/dist/scripts/agent-role-config-repair-check.js +0 -33
  123. package/dist/scripts/agent-rollback-command-check.js +0 -86
  124. package/dist/scripts/agent-route-truth-backfill-check.js +0 -5
  125. package/dist/scripts/agent-scheduler-proof-check.js +0 -13
  126. package/dist/scripts/agent-scheduler-proof-hardening-check.js +0 -22
  127. package/dist/scripts/agent-session-generation-check.js +0 -21
  128. package/dist/scripts/agent-slot-pane-binding-proof-check.js +0 -64
  129. package/dist/scripts/agent-source-intelligence-propagation-check.js +0 -9
  130. package/dist/scripts/agent-strategy-to-lease-wiring-check.js +0 -32
  131. package/dist/scripts/agent-strategy-to-patch-strict-check.js +0 -54
  132. package/dist/scripts/agent-task-graph-expansion-check.js +0 -14
  133. package/dist/scripts/agent-terminal-generations-check.js +0 -23
  134. package/dist/scripts/agent-visual-consistency-check.js +0 -9
  135. package/dist/scripts/agent-wiki-context-proof-check.js +0 -62
  136. package/dist/scripts/agent-worker-backend-router-check.js +0 -63
  137. package/dist/scripts/agent-worker-scout-limited-check.js +0 -17
  138. package/dist/scripts/agent-zellij-dynamic-backfill-panes-check.js +0 -34
  139. package/dist/scripts/agent-zellij-runtime-check.js +0 -84
  140. package/dist/scripts/all-feature-deep-completion-check.js +0 -31
  141. package/dist/scripts/appshots-capability-check.js +0 -18
  142. package/dist/scripts/appshots-evidence-check.js +0 -48
  143. package/dist/scripts/appshots-operator-policy-check.js +0 -25
  144. package/dist/scripts/appshots-privacy-safety-check.js +0 -48
  145. package/dist/scripts/appshots-source-intelligence-check.js +0 -53
  146. package/dist/scripts/appshots-thread-attachment-discovery-check.js +0 -87
  147. package/dist/scripts/appshots-triwiki-voxel-check.js +0 -46
  148. package/dist/scripts/architecture-guard-check.js +0 -55
  149. package/dist/scripts/changelog-check.js +0 -47
  150. package/dist/scripts/codex-0-133-official-compat-report.js +0 -53
  151. package/dist/scripts/codex-0-134-official-compat-report.js +0 -110
  152. package/dist/scripts/codex-0-134-runner-truth-check.js +0 -66
  153. package/dist/scripts/codex-0-135-compat-check.js +0 -57
  154. package/dist/scripts/codex-0-136-compat-check.js +0 -30
  155. package/dist/scripts/codex-0-137-compat-check.js +0 -27
  156. package/dist/scripts/codex-app-fast-ui-preservation-check.js +0 -32
  157. package/dist/scripts/codex-app-provider-badge-check.js +0 -37
  158. package/dist/scripts/codex-app-ui-clobber-guard-check.js +0 -22
  159. package/dist/scripts/codex-app-ui-preservation-check.js +0 -96
  160. package/dist/scripts/codex-control-all-pipelines-check.js +0 -36
  161. package/dist/scripts/codex-control-capability-check.js +0 -10
  162. package/dist/scripts/codex-control-empty-result-retry-check.js +0 -43
  163. package/dist/scripts/codex-control-event-stream-ledger-check.js +0 -10
  164. package/dist/scripts/codex-control-keepalive-no-cot-leak-check.js +0 -14
  165. package/dist/scripts/codex-control-no-legacy-fallback-check.js +0 -31
  166. package/dist/scripts/codex-control-side-effect-scope-check.js +0 -26
  167. package/dist/scripts/codex-control-stream-idle-watchdog-check.js +0 -18
  168. package/dist/scripts/codex-control-structured-output-check.js +0 -11
  169. package/dist/scripts/codex-control-thread-registry-check.js +0 -11
  170. package/dist/scripts/codex-control-tool-call-sequence-repair-check.js +0 -14
  171. package/dist/scripts/codex-environment-scoped-approvals-check.js +0 -10
  172. package/dist/scripts/codex-exec-output-schema-actual-syntax-check.js +0 -33
  173. package/dist/scripts/codex-fast-mode-profile-propagation-check.js +0 -12
  174. package/dist/scripts/codex-history-search-check.js +0 -19
  175. package/dist/scripts/codex-hook-semantic-check.js +0 -15
  176. package/dist/scripts/codex-hook-strict-subset-check.js +0 -61
  177. package/dist/scripts/codex-lb-config-toml-safety-check.js +0 -85
  178. package/dist/scripts/codex-lb-persistence-truth-check.js +0 -96
  179. package/dist/scripts/codex-lb-setup-fixture-check.js +0 -91
  180. package/dist/scripts/codex-lb-setup-truthfulness-check.js +0 -84
  181. package/dist/scripts/codex-legacy-profile-consumers-removed-check.js +0 -24
  182. package/dist/scripts/codex-managed-proxy-env-check.js +0 -17
  183. package/dist/scripts/codex-output-schema-fixture-check.js +0 -25
  184. package/dist/scripts/codex-permission-profiles-check.js +0 -36
  185. package/dist/scripts/codex-plugin-list-json-check.js +0 -8
  186. package/dist/scripts/codex-profile-primary-check.js +0 -13
  187. package/dist/scripts/codex-project-config-policy-splitter-check.js +0 -51
  188. package/dist/scripts/codex-resume-cwd-truth-check.js +0 -17
  189. package/dist/scripts/codex-sdk-all-pipelines-check.js +0 -32
  190. package/dist/scripts/codex-sdk-backend-router-check.js +0 -65
  191. package/dist/scripts/codex-sdk-capability-check.js +0 -11
  192. package/dist/scripts/codex-sdk-core-skill-pipeline-check.js +0 -9
  193. package/dist/scripts/codex-sdk-dfix-pipeline-check.js +0 -9
  194. package/dist/scripts/codex-sdk-event-stream-ledger-check.js +0 -9
  195. package/dist/scripts/codex-sdk-no-legacy-fallback-check.js +0 -33
  196. package/dist/scripts/codex-sdk-qa-pipeline-check.js +0 -8
  197. package/dist/scripts/codex-sdk-real-smoke-check.js +0 -39
  198. package/dist/scripts/codex-sdk-release-review-pipeline-check.js +0 -13
  199. package/dist/scripts/codex-sdk-research-pipeline-check.js +0 -47
  200. package/dist/scripts/codex-sdk-sandbox-policy-check.js +0 -21
  201. package/dist/scripts/codex-sdk-structured-output-check.js +0 -10
  202. package/dist/scripts/codex-sdk-team-naruto-agent-pipeline-check.js +0 -12
  203. package/dist/scripts/codex-sdk-thread-registry-check.js +0 -11
  204. package/dist/scripts/codex-sdk-ux-ppt-review-pipeline-check.js +0 -9
  205. package/dist/scripts/codex-sdk-zellij-pane-binding-check.js +0 -13
  206. package/dist/scripts/codex-thread-runtime-choice-check.js +0 -10
  207. package/dist/scripts/codex-web-adapter-check.js +0 -12
  208. package/dist/scripts/computer-use-live-evidence-check.js +0 -55
  209. package/dist/scripts/computer-use-live-optional-check.js +0 -32
  210. package/dist/scripts/computer-use-policy-check.js +0 -69
  211. package/dist/scripts/computer-use-visual-route-fixture-check.js +0 -37
  212. package/dist/scripts/core-skill-card-schema-check.js +0 -61
  213. package/dist/scripts/core-skill-deployment-snapshot-check.js +0 -54
  214. package/dist/scripts/core-skill-heldout-validation-check.js +0 -49
  215. package/dist/scripts/core-skill-no-inference-optimizer-check.js +0 -75
  216. package/dist/scripts/core-skill-patch-check.js +0 -79
  217. package/dist/scripts/core-skill-promotion-side-effect-ledger-check.js +0 -64
  218. package/dist/scripts/core-skill-rollout-scoring-check.js +0 -72
  219. package/dist/scripts/core-skill-route-runtime-integration-check.js +0 -49
  220. package/dist/scripts/dfix-fast-blackbox-check.js +0 -37
  221. package/dist/scripts/dfix-fast-kernel-check.js +0 -26
  222. package/dist/scripts/dfix-fixture-check.js +0 -6
  223. package/dist/scripts/dfix-parallel-write-blackbox.js +0 -48
  224. package/dist/scripts/dfix-patch-handoff-check.js +0 -13
  225. package/dist/scripts/dfix-patch-swarm-route-blackbox.js +0 -10
  226. package/dist/scripts/dfix-performance-check.js +0 -15
  227. package/dist/scripts/dfix-verification-check.js +0 -9
  228. package/dist/scripts/dfix-verification-recommendation-check.js +0 -15
  229. package/dist/scripts/docs-truthfulness-check.js +0 -61
  230. package/dist/scripts/doctor-codex-doctor-parity-check.js +0 -17
  231. package/dist/scripts/doctor-fix-proves-codex-read-check.js +0 -64
  232. package/dist/scripts/doctor-fix-recovers-corrupted-config-check.js +0 -122
  233. package/dist/scripts/doctor-fixes-codex-app-fast-ui-check.js +0 -39
  234. package/dist/scripts/evidence-fixture-check.js +0 -26
  235. package/dist/scripts/evidence-flagship-coverage-check.js +0 -55
  236. package/dist/scripts/fake-real-proof-policy-v2-check.js +0 -27
  237. package/dist/scripts/fake-vs-real-proof-policy-check.js +0 -14
  238. package/dist/scripts/fast-codex-service-tier-proof-check.js +0 -42
  239. package/dist/scripts/flagship-proof-graph-v2-check.js +0 -48
  240. package/dist/scripts/flagship-proof-graph-v3-check.js +0 -67
  241. package/dist/scripts/flagship-proof-graph-v4-check.js +0 -61
  242. package/dist/scripts/git-precommit-fixture-check.js +0 -41
  243. package/dist/scripts/git-worktree-cache-performance-check.js +0 -25
  244. package/dist/scripts/git-worktree-capability-check.js +0 -27
  245. package/dist/scripts/git-worktree-checkpoint-check.js +0 -20
  246. package/dist/scripts/git-worktree-cleanup-check.js +0 -27
  247. package/dist/scripts/git-worktree-cross-rebase-check.js +0 -39
  248. package/dist/scripts/git-worktree-diff-envelope-check.js +0 -17
  249. package/dist/scripts/git-worktree-diff-export-check.js +0 -43
  250. package/dist/scripts/git-worktree-dirty-lock-check.js +0 -17
  251. package/dist/scripts/git-worktree-dirty-main-detection-check.js +0 -14
  252. package/dist/scripts/git-worktree-integration-primary-check.js +0 -24
  253. package/dist/scripts/git-worktree-integration-primary-runtime-check.js +0 -20
  254. package/dist/scripts/git-worktree-manager-check.js +0 -37
  255. package/dist/scripts/git-worktree-manifest-append-check.js +0 -18
  256. package/dist/scripts/git-worktree-merge-queue-check.js +0 -31
  257. package/dist/scripts/git-worktree-pool-performance-check.js +0 -20
  258. package/dist/scripts/git-worktree-untracked-diff-check.js +0 -18
  259. package/dist/scripts/goal-mode-official-default-check.js +0 -12
  260. package/dist/scripts/gpt-final-arbiter-check.js +0 -63
  261. package/dist/scripts/gpt-final-arbiter-performance-check.js +0 -36
  262. package/dist/scripts/gpt-image-2-request-validator-check.js +0 -35
  263. package/dist/scripts/hooks-0.134-context-parity-check.js +0 -20
  264. package/dist/scripts/hooks-actual-parity-check.js +0 -17
  265. package/dist/scripts/hooks-actual-parity-v2-check.js +0 -21
  266. package/dist/scripts/hooks-latest-schema-check.js +0 -20
  267. package/dist/scripts/hooks-managed-install-fixture-check.js +0 -21
  268. package/dist/scripts/hooks-official-hash-oracle-check.js +0 -35
  269. package/dist/scripts/hooks-official-hash-parity-check.js +0 -17
  270. package/dist/scripts/hooks-subagent-events-check.js +0 -17
  271. package/dist/scripts/hooks-trust-state-check.js +0 -14
  272. package/dist/scripts/image-fidelity-fixture-check.js +0 -24
  273. package/dist/scripts/imagegen-capability-check.js +0 -30
  274. package/dist/scripts/imagegen-real-smoke-check.js +0 -155
  275. package/dist/scripts/install-update-preserves-config-check.js +0 -87
  276. package/dist/scripts/json-schema-recursive-check.js +0 -78
  277. package/dist/scripts/legacy-multiagent-removal-check.js +0 -85
  278. package/dist/scripts/legacy-upgrade-matrix-check.js +0 -300
  279. package/dist/scripts/local-collab-all-pipelines-final-gpt-check.js +0 -21
  280. package/dist/scripts/local-collab-gpt-final-availability-check.js +0 -58
  281. package/dist/scripts/local-collab-no-local-only-final-check.js +0 -27
  282. package/dist/scripts/local-collab-policy-check.js +0 -17
  283. package/dist/scripts/local-collab-worktree-gpt-final-apply-policy-check.js +0 -63
  284. package/dist/scripts/local-llm-all-pipelines-check.js +0 -11
  285. package/dist/scripts/local-llm-cache-performance-check.js +0 -10
  286. package/dist/scripts/local-llm-capability-check.js +0 -14
  287. package/dist/scripts/local-llm-smoke-check.js +0 -23
  288. package/dist/scripts/local-llm-structured-output-check.js +0 -11
  289. package/dist/scripts/local-llm-throughput-check.js +0 -10
  290. package/dist/scripts/local-llm-tool-call-repair-check.js +0 -10
  291. package/dist/scripts/local-llm-warmup-check.js +0 -11
  292. package/dist/scripts/loop-blocker-check.js +0 -15
  293. package/dist/scripts/mad-preflight-blocks-unreadable-config-check.js +0 -35
  294. package/dist/scripts/mad-sks-actual-executor-blackbox.js +0 -5
  295. package/dist/scripts/mad-sks-app-ui-no-mutation-check.js +0 -92
  296. package/dist/scripts/mad-sks-audit-proof-check.js +0 -34
  297. package/dist/scripts/mad-sks-db-executor-check.js +0 -5
  298. package/dist/scripts/mad-sks-executor-proof-graph-check.js +0 -5
  299. package/dist/scripts/mad-sks-fast-mode-propagation-check.js +0 -24
  300. package/dist/scripts/mad-sks-file-write-executor-check.js +0 -5
  301. package/dist/scripts/mad-sks-immutable-harness-check.js +0 -36
  302. package/dist/scripts/mad-sks-no-harness-modification-check.js +0 -25
  303. package/dist/scripts/mad-sks-package-executor-check.js +0 -5
  304. package/dist/scripts/mad-sks-permission-model-check.js +0 -22
  305. package/dist/scripts/mad-sks-rollback-apply-check.js +0 -5
  306. package/dist/scripts/mad-sks-service-executor-check.js +0 -5
  307. package/dist/scripts/mad-sks-shell-executor-check.js +0 -5
  308. package/dist/scripts/mad-sks-write-guard-check.js +0 -28
  309. package/dist/scripts/mad-sks-zellij-default-pane-worker-check.js +0 -37
  310. package/dist/scripts/mad-sks-zellij-launch-check.js +0 -102
  311. package/dist/scripts/mcp-0-134-modernization-check.js +0 -55
  312. package/dist/scripts/mcp-readonly-concurrency-check.js +0 -17
  313. package/dist/scripts/mcp-readonly-runtime-scheduler-check.js +0 -20
  314. package/dist/scripts/mcp-tool-naming-parity-check.js +0 -16
  315. package/dist/scripts/memory-summary-rebuild-check.js +0 -22
  316. package/dist/scripts/mutation-callsite-coverage-check.js +0 -180
  317. package/dist/scripts/naruto-active-pool-check.js +0 -39
  318. package/dist/scripts/naruto-actual-worker-control-plane-check.js +0 -56
  319. package/dist/scripts/naruto-allocation-policy-check.js +0 -33
  320. package/dist/scripts/naruto-allocation-runtime-wiring-check.js +0 -92
  321. package/dist/scripts/naruto-concurrency-governor-check.js +0 -53
  322. package/dist/scripts/naruto-extreme-parallelism-check.js +0 -22
  323. package/dist/scripts/naruto-extreme-parallelism-real-check.js +0 -43
  324. package/dist/scripts/naruto-gpt-final-pack-check.js +0 -34
  325. package/dist/scripts/naruto-orchestrator-runtime-source-check.js +0 -70
  326. package/dist/scripts/naruto-parallel-patch-apply-check.js +0 -41
  327. package/dist/scripts/naruto-readonly-routing-check.js +0 -116
  328. package/dist/scripts/naruto-real-active-pool-check.js +0 -39
  329. package/dist/scripts/naruto-real-active-pool-runtime-check.js +0 -55
  330. package/dist/scripts/naruto-rebalance-policy-check.js +0 -41
  331. package/dist/scripts/naruto-role-distribution-check.js +0 -23
  332. package/dist/scripts/naruto-shadow-clone-swarm-check.js +0 -153
  333. package/dist/scripts/naruto-verification-pool-check.js +0 -36
  334. package/dist/scripts/naruto-work-graph-check.js +0 -24
  335. package/dist/scripts/naruto-worktree-coding-blackbox.js +0 -29
  336. package/dist/scripts/naruto-worktree-coding-check.js +0 -44
  337. package/dist/scripts/naruto-worktree-gpt-final-check.js +0 -45
  338. package/dist/scripts/naruto-worktree-zellij-ui-check.js +0 -28
  339. package/dist/scripts/naruto-zellij-dynamic-right-column-check.js +0 -48
  340. package/dist/scripts/naruto-zellij-massive-ui-check.js +0 -23
  341. package/dist/scripts/non-recursive-pipeline-check.js +0 -68
  342. package/dist/scripts/npm-publish-performance-check.js +0 -65
  343. package/dist/scripts/official-docs-compat-report.js +0 -304
  344. package/dist/scripts/packlist-performance-check.js +0 -83
  345. package/dist/scripts/parallel-verification-engine-check.js +0 -85
  346. package/dist/scripts/postinstall-safe-side-effects-check.js +0 -65
  347. package/dist/scripts/ppt-full-e2e-artifact-graph-check.js +0 -40
  348. package/dist/scripts/ppt-full-e2e-blackbox-check.js +0 -109
  349. package/dist/scripts/ppt-image-voxel-relations-check.js +0 -9
  350. package/dist/scripts/ppt-imagegen-blackbox-check.js +0 -46
  351. package/dist/scripts/ppt-imagegen-review-fixture-check.js +0 -6
  352. package/dist/scripts/ppt-issue-extraction-fixture-check.js +0 -7
  353. package/dist/scripts/ppt-no-mock-as-real-check.js +0 -8
  354. package/dist/scripts/ppt-no-text-fallback-check.js +0 -7
  355. package/dist/scripts/ppt-proof-trust-fixture-check.js +0 -10
  356. package/dist/scripts/ppt-real-export-adapter-check.js +0 -13
  357. package/dist/scripts/ppt-real-imagegen-smoke-check.js +0 -42
  358. package/dist/scripts/ppt-real-imagegen-wiring-check.js +0 -16
  359. package/dist/scripts/ppt-reexport-rereview-check.js +0 -19
  360. package/dist/scripts/ppt-slide-export-fixture-check.js +0 -7
  361. package/dist/scripts/prepublish-fast-check.js +0 -128
  362. package/dist/scripts/priority-full-closure-check.js +0 -12
  363. package/dist/scripts/product-design-auto-install-check.js +0 -119
  364. package/dist/scripts/product-design-plugin-routing-check.js +0 -101
  365. package/dist/scripts/prompt-placeholder-guard-check.js +0 -33
  366. package/dist/scripts/provider-badge-context-check.js +0 -26
  367. package/dist/scripts/provider-context-config-toml-check.js +0 -63
  368. package/dist/scripts/python-codex-sdk-all-pipelines-check.js +0 -47
  369. package/dist/scripts/python-codex-sdk-capability-check.js +0 -75
  370. package/dist/scripts/python-codex-sdk-sandbox-policy-check.js +0 -10
  371. package/dist/scripts/python-codex-sdk-stream-bridge-check.js +0 -12
  372. package/dist/scripts/python-tools-smoke-check.js +0 -71
  373. package/dist/scripts/qa-actual-route-backfill-check.js +0 -5
  374. package/dist/scripts/qa-backfill-route-blackbox.js +0 -5
  375. package/dist/scripts/qa-patch-swarm-route-blackbox.js +0 -10
  376. package/dist/scripts/readme-architecture-imagegen-official-check.js +0 -448
  377. package/dist/scripts/release-cache-glob-hashing-check.js +0 -42
  378. package/dist/scripts/release-dag-full-coverage-check.js +0 -66
  379. package/dist/scripts/release-dist-freshness-check.js +0 -8
  380. package/dist/scripts/release-dynamic-performance-check.js +0 -103
  381. package/dist/scripts/release-gate-budget-check.js +0 -36
  382. package/dist/scripts/release-gate-dag-runner-check.js +0 -17
  383. package/dist/scripts/release-metadata-1-11-check.js +0 -37
  384. package/dist/scripts/release-metadata-1-12-check.js +0 -48
  385. package/dist/scripts/release-metadata-1-13-check.js +0 -53
  386. package/dist/scripts/release-metadata-1-14-check.js +0 -63
  387. package/dist/scripts/release-metadata-1-16-check.js +0 -81
  388. package/dist/scripts/release-metadata-1-17-check.js +0 -51
  389. package/dist/scripts/release-metadata-1-19-check.js +0 -371
  390. package/dist/scripts/release-metadata-check.js +0 -7
  391. package/dist/scripts/release-native-agent-fixture-check.js +0 -41
  392. package/dist/scripts/release-parallel-check.js +0 -374
  393. package/dist/scripts/release-parallel-full-coverage-check.js +0 -13
  394. package/dist/scripts/release-parallel-speed-budget-check.js +0 -84
  395. package/dist/scripts/release-provenance-check.js +0 -150
  396. package/dist/scripts/release-real-check.js +0 -330
  397. package/dist/scripts/release-registry-check.js +0 -344
  398. package/dist/scripts/release-runtime-truth-matrix-check.js +0 -47
  399. package/dist/scripts/release-stability-report-check.js +0 -99
  400. package/dist/scripts/release-version-truth-check.js +0 -134
  401. package/dist/scripts/research-actual-route-backfill-check.js +0 -5
  402. package/dist/scripts/research-backfill-route-blackbox.js +0 -5
  403. package/dist/scripts/research-blueprint-densifier-check.js +0 -21
  404. package/dist/scripts/research-claim-builder-check.js +0 -19
  405. package/dist/scripts/research-complete-package-fixture-check.js +0 -23
  406. package/dist/scripts/research-final-reviewer-blackbox.js +0 -22
  407. package/dist/scripts/research-parallel-source-shards-check.js +0 -22
  408. package/dist/scripts/research-quality-gate-check.js +0 -111
  409. package/dist/scripts/research-real-cycle-no-legacy-final-md-check.js +0 -14
  410. package/dist/scripts/research-short-report-rejection-check.js +0 -46
  411. package/dist/scripts/research-source-ledger-merge-check.js +0 -26
  412. package/dist/scripts/research-stage-cycle-runtime-blackbox.js +0 -24
  413. package/dist/scripts/responses-retry-policy-centralized-check.js +0 -19
  414. package/dist/scripts/retention-cleanup-safety-check.js +0 -155
  415. package/dist/scripts/route-blackbox-realism-check.js +0 -21
  416. package/dist/scripts/route-proof-artifact-structure-check.js +0 -145
  417. package/dist/scripts/runtime-dist-parity-check.js +0 -78
  418. package/dist/scripts/runtime-no-mjs-scripts-check.js +0 -45
  419. package/dist/scripts/runtime-no-src-mjs-check.js +0 -32
  420. package/dist/scripts/runtime-no-tmux-check.js +0 -113
  421. package/dist/scripts/runtime-ts-python-boundary-check.js +0 -59
  422. package/dist/scripts/runtime-ts-rust-boundary-check.js +0 -74
  423. package/dist/scripts/runtime-ts-source-of-truth-check.js +0 -55
  424. package/dist/scripts/safety-check.js +0 -23
  425. package/dist/scripts/shared-memory-fixture-check.js +0 -27
  426. package/dist/scripts/side-effect-runtime-report-check.js +0 -19
  427. package/dist/scripts/side-effect-zero-gate-check.js +0 -226
  428. package/dist/scripts/sks-1-11-fixture-check.js +0 -130
  429. package/dist/scripts/source-intelligence-all-modes-check.js +0 -32
  430. package/dist/scripts/source-intelligence-policy-check.js +0 -13
  431. package/dist/scripts/strategy-adhd-orchestrating-gate-check.js +0 -22
  432. package/dist/scripts/strategy-file-ownership-plan-check.js +0 -18
  433. package/dist/scripts/strategy-parallel-modification-plan-check.js +0 -19
  434. package/dist/scripts/strategy-verification-rollback-dag-check.js +0 -19
  435. package/dist/scripts/team-actual-route-backfill-check.js +0 -5
  436. package/dist/scripts/team-backfill-route-blackbox.js +0 -5
  437. package/dist/scripts/team-parallel-write-blackbox.js +0 -55
  438. package/dist/scripts/team-patch-swarm-route-blackbox.js +0 -10
  439. package/dist/scripts/terminal-keyboard-enhancement-safety-check.js +0 -12
  440. package/dist/scripts/terminal-tui-output-stability-check.js +0 -35
  441. package/dist/scripts/test-no-orphan-dist-imports-check.js +0 -73
  442. package/dist/scripts/trust-fixture-check.js +0 -33
  443. package/dist/scripts/typescript-migration-report.js +0 -78
  444. package/dist/scripts/ultra-router-auto-router-check.js +0 -33
  445. package/dist/scripts/ultra-router-classification-check.js +0 -28
  446. package/dist/scripts/ux-patch-swarm-route-blackbox.js +0 -10
  447. package/dist/scripts/ux-ppt-structured-extraction-check.js +0 -21
  448. package/dist/scripts/ux-review-extract-real-callouts-fixture-check.js +0 -8
  449. package/dist/scripts/ux-review-extract-wires-real-extractor-check.js +0 -15
  450. package/dist/scripts/ux-review-generate-callouts-fixture-check.js +0 -9
  451. package/dist/scripts/ux-review-image-voxel-relations-check.js +0 -31
  452. package/dist/scripts/ux-review-imagegen-blackbox-check.js +0 -67
  453. package/dist/scripts/ux-review-no-fake-callouts-check.js +0 -8
  454. package/dist/scripts/ux-review-no-text-fallback-check.js +0 -25
  455. package/dist/scripts/ux-review-patch-diff-recheck-check.js +0 -20
  456. package/dist/scripts/ux-review-patch-handoff-fixture-check.js +0 -8
  457. package/dist/scripts/ux-review-real-imagegen-smoke-check.js +0 -31
  458. package/dist/scripts/ux-review-real-loop-fixture-check.js +0 -24
  459. package/dist/scripts/ux-review-recapture-recheck-fixture-check.js +0 -8
  460. package/dist/scripts/ux-review-run-wires-imagegen-check.js +0 -11
  461. package/dist/scripts/worker-pane-communication-contract-check.js +0 -54
  462. package/dist/scripts/wrongness-fixture-check.js +0 -65
  463. package/dist/scripts/xai-mcp-capability-check.js +0 -14
  464. package/dist/scripts/zellij-capability-check.js +0 -15
  465. package/dist/scripts/zellij-dashboard-pane-check.js +0 -70
  466. package/dist/scripts/zellij-developer-controls-check.js +0 -20
  467. package/dist/scripts/zellij-doctor-readiness-check.js +0 -63
  468. package/dist/scripts/zellij-dynamic-pane-lifecycle-check.js +0 -21
  469. package/dist/scripts/zellij-first-slot-down-stack-check.js +0 -20
  470. package/dist/scripts/zellij-first-slot-down-stack-real-check.js +0 -356
  471. package/dist/scripts/zellij-initial-main-only-blackbox.js +0 -28
  472. package/dist/scripts/zellij-lane-renderer-check.js +0 -65
  473. package/dist/scripts/zellij-launch-command-truth-check.js +0 -75
  474. package/dist/scripts/zellij-layout-valid-check.js +0 -90
  475. package/dist/scripts/zellij-pane-proof-check.js +0 -59
  476. package/dist/scripts/zellij-real-session-cleanup-check.js +0 -21
  477. package/dist/scripts/zellij-real-session-heartbeat-check.js +0 -49
  478. package/dist/scripts/zellij-real-session-launch-check.js +0 -57
  479. package/dist/scripts/zellij-right-column-headless-overflow-check.js +0 -22
  480. package/dist/scripts/zellij-right-column-manager-check.js +0 -27
  481. package/dist/scripts/zellij-screen-proof-check.js +0 -45
  482. package/dist/scripts/zellij-slot-column-anchor-check.js +0 -66
  483. package/dist/scripts/zellij-slot-only-ui-check.js +0 -26
  484. package/dist/scripts/zellij-slot-pane-renderer-check.js +0 -106
  485. package/dist/scripts/zellij-slot-renderer-proof-semantics-check.js +0 -59
  486. package/dist/scripts/zellij-spawn-on-demand-layout-check.js +0 -40
  487. package/dist/scripts/zellij-ui-design-check.js +0 -105
  488. package/dist/scripts/zellij-worker-pane-manager-check.js +0 -109
  489. package/dist/scripts/zellij-worker-pane-manager-single-owner-check.js +0 -47
  490. package/dist/scripts/zellij-worker-pane-real-ui-blackbox.js +0 -202
  491. package/dist/scripts/zellij-worker-pane-spawn-order-check.js +0 -35
@@ -0,0 +1,113 @@
1
+ import { spawnSync } from 'node:child_process';
2
+ const ALWAYS_KEEP = new Set([
3
+ 'release:version-truth',
4
+ 'release:dag-full-coverage',
5
+ 'runtime:ts-source-of-truth',
6
+ 'typecheck',
7
+ 'schema:check'
8
+ ]);
9
+ export function selectAffectedReleaseGates(root, manifest, gates, input = {}) {
10
+ if (input.full) {
11
+ return selectionResult(gates, gates, [], 'full', {}, []);
12
+ }
13
+ const changedFiles = resolveChangedFiles(root, input.changedSince || 'auto');
14
+ const selected = [];
15
+ const reasons = {};
16
+ for (const gate of gates) {
17
+ const reason = gateSelectionReason(gate, changedFiles, input.preset || 'affected');
18
+ if (reason) {
19
+ selected.push(gate);
20
+ reasons[gate.id] = reason;
21
+ }
22
+ }
23
+ const byId = new Map(gates.map((gate) => [gate.id, gate]));
24
+ for (const id of ALWAYS_KEEP) {
25
+ const gate = byId.get(id) || manifest.gates.find((candidate) => candidate.id === id);
26
+ if (gate && !selected.some((row) => row.id === gate.id)) {
27
+ selected.push(gate);
28
+ reasons[gate.id] = 'always_keep_core_release_safety';
29
+ }
30
+ }
31
+ const expanded = expandWithDependencies(selected, manifest);
32
+ const ordered = manifest.gates.filter((gate) => expanded.some((row) => row.id === gate.id));
33
+ return selectionResult(gates, ordered, changedFiles, 'affected', reasons, gates.filter((gate) => !ordered.some((row) => row.id === gate.id)).map((gate) => gate.id));
34
+ }
35
+ function expandWithDependencies(selected, manifest) {
36
+ const byId = new Map(manifest.gates.map((gate) => [gate.id, gate]));
37
+ const out = new Map(selected.map((gate) => [gate.id, gate]));
38
+ const visit = (gate) => {
39
+ for (const dep of gate.deps || []) {
40
+ const depGate = byId.get(dep);
41
+ if (depGate && !out.has(depGate.id)) {
42
+ out.set(depGate.id, depGate);
43
+ visit(depGate);
44
+ }
45
+ }
46
+ };
47
+ for (const gate of selected)
48
+ visit(gate);
49
+ return [...out.values()];
50
+ }
51
+ function gateSelectionReason(gate, changedFiles, preset) {
52
+ if (ALWAYS_KEEP.has(gate.id))
53
+ return 'always_keep_core_release_safety';
54
+ if (!changedFiles.length)
55
+ return preset === 'fast' ? 'fast_no_diff_core_only_skip' : 'no_changed_files';
56
+ if (changedFiles.some((file) => file === 'package.json' || file === 'package-lock.json')) {
57
+ if (/^(release:|publish:|prepublish|runtime:|typecheck|schema:check)/.test(gate.id))
58
+ return 'package_metadata_changed';
59
+ }
60
+ if (changedFiles.some((file) => file === 'release-gates.v2.json' || file.startsWith('src/core/release/') || file.startsWith('src/scripts/release-')))
61
+ return 'release_gate_system_changed';
62
+ if (changedFiles.some((file) => file.startsWith('src/core/research/')))
63
+ return gate.id.startsWith('research:') ? 'research_source_changed' : null;
64
+ if (changedFiles.some((file) => file.startsWith('src/core/zellij/') || file.startsWith('src/commands/zellij')))
65
+ return gate.id.startsWith('zellij:') || gate.id.startsWith('agent:zellij') || gate.id.startsWith('naruto:zellij') ? 'zellij_source_changed' : null;
66
+ if (changedFiles.some((file) => file.includes('/db') || file.includes('mad-db') || file.includes('mcp')))
67
+ return /db|mcp|mad-db|mad-sks/.test(gate.id) ? 'db_mcp_or_mad_db_changed' : null;
68
+ const inputs = gate.cache?.inputs || [];
69
+ if (inputs.some((pattern) => changedFiles.some((file) => matchesGlobish(file, pattern))))
70
+ return 'cache_input_changed';
71
+ return null;
72
+ }
73
+ function selectionResult(all, selected, changedFiles, mode, reasons, skipped) {
74
+ return {
75
+ gates: selected,
76
+ selection: {
77
+ schema: 'sks.release-gate-affected-selection.v1',
78
+ mode,
79
+ changed_files: changedFiles,
80
+ selected_gate_ids: selected.map((gate) => gate.id),
81
+ skipped_gate_ids: skipped.length ? skipped : all.filter((gate) => !selected.some((row) => row.id === gate.id)).map((gate) => gate.id),
82
+ reasons
83
+ }
84
+ };
85
+ }
86
+ function resolveChangedFiles(root, changedSince) {
87
+ const base = changedSince === 'auto' ? 'HEAD' : changedSince;
88
+ const args = base === 'HEAD'
89
+ ? ['diff', '--name-only', 'HEAD']
90
+ : ['diff', '--name-only', String(base)];
91
+ const diff = spawnSync('git', args, { cwd: root, encoding: 'utf8' });
92
+ const status = spawnSync('git', ['status', '--short'], { cwd: root, encoding: 'utf8' });
93
+ const files = [
94
+ ...String(diff.stdout || '').split(/\n/),
95
+ ...String(status.stdout || '').split(/\n/).map((line) => line.slice(3))
96
+ ].map((file) => file.trim()).filter(Boolean);
97
+ return [...new Set(files)].sort();
98
+ }
99
+ function matchesGlobish(file, pattern) {
100
+ const normalized = pattern.replace(/\\/g, '/');
101
+ if (normalized === file)
102
+ return true;
103
+ if (normalized.endsWith('/**'))
104
+ return file.startsWith(normalized.slice(0, -3));
105
+ if (normalized.endsWith('/**/*'))
106
+ return file.startsWith(normalized.slice(0, -5));
107
+ if (normalized.includes('**'))
108
+ return file.startsWith(normalized.split('**')[0] || '');
109
+ if (normalized.endsWith('*'))
110
+ return file.startsWith(normalized.slice(0, -1));
111
+ return false;
112
+ }
113
+ //# sourceMappingURL=release-gate-affected-selector.js.map
@@ -0,0 +1,67 @@
1
+ import { spawn } from 'node:child_process';
2
+ import path from 'node:path';
3
+ import { writeReleaseGateJson } from './release-gate-report.js';
4
+ const DISALLOWED_BATCH_RESOURCES = new Set(['zellij-real', 'git-worktree', 'local-llm-real', 'remote-model-real', 'publish', 'global-config']);
5
+ export function isReleaseGateBatchable(gate) {
6
+ if (gate.side_effect !== 'hermetic')
7
+ return false;
8
+ if (!gate.resource.includes('cpu-light') || !gate.resource.includes('fs-read'))
9
+ return false;
10
+ return gate.resource.every((resource) => resource === 'cpu-light' || resource === 'fs-read') && !gate.resource.some((resource) => DISALLOWED_BATCH_RESOURCES.has(resource));
11
+ }
12
+ export async function runReleaseGateBatch(root, gates, input = {}) {
13
+ const concurrency = Math.max(1, Math.floor(Number(input.concurrency || process.env.SKS_RELEASE_BATCH_CONCURRENCY || 4)));
14
+ const nonBatchable = gates.filter((gate) => !isReleaseGateBatchable(gate));
15
+ if (nonBatchable.length) {
16
+ return {
17
+ schema: 'sks.release-gate-batch-result.v1',
18
+ ok: false,
19
+ batch_size: gates.length,
20
+ completed: 0,
21
+ failed: nonBatchable.length,
22
+ results: nonBatchable.map((gate) => ({ id: gate.id, ok: false, exit_code: null, duration_ms: 0 }))
23
+ };
24
+ }
25
+ const queue = [...gates];
26
+ const results = [];
27
+ const workers = Array.from({ length: Math.min(concurrency, queue.length) }, async () => {
28
+ while (queue.length) {
29
+ const gate = queue.shift();
30
+ if (!gate)
31
+ continue;
32
+ const result = await runOne(root, gate);
33
+ results.push(result);
34
+ if (input.reportRoot)
35
+ writeChildResult(input.reportRoot, result);
36
+ }
37
+ });
38
+ await Promise.all(workers);
39
+ const failed = results.filter((row) => !row.ok).length;
40
+ return {
41
+ schema: 'sks.release-gate-batch-result.v1',
42
+ ok: failed === 0,
43
+ batch_size: gates.length,
44
+ completed: results.length - failed,
45
+ failed,
46
+ results
47
+ };
48
+ }
49
+ function runOne(root, gate) {
50
+ const started = Date.now();
51
+ return new Promise((resolve) => {
52
+ const child = spawn(gate.command, { cwd: root, shell: true, stdio: ['ignore', 'ignore', 'ignore'] });
53
+ const timer = setTimeout(() => child.kill('SIGTERM'), gate.timeout_ms);
54
+ child.on('close', (code) => {
55
+ clearTimeout(timer);
56
+ resolve({ id: gate.id, ok: code === 0, exit_code: code, duration_ms: Date.now() - started });
57
+ });
58
+ });
59
+ }
60
+ function writeChildResult(reportRoot, result) {
61
+ const dir = path.join(reportRoot, result.id.replace(/[^A-Za-z0-9_.:-]/g, '_'));
62
+ writeReleaseGateJson(path.join(dir, 'result.json'), {
63
+ schema: 'sks.release-gate-batch-child-result.v1',
64
+ ...result
65
+ });
66
+ }
67
+ //# sourceMappingURL=release-gate-batch-runner.js.map
@@ -7,6 +7,7 @@ import { findReadyReleaseGateNodes, findReleaseGatesBlockedByFailedDeps, pickRea
7
7
  import { readReleaseGateCacheHit, writeReleaseGateCacheHit } from './release-gate-cache-v2.js';
8
8
  import { RELEASE_GATE_NODE_SCHEMA, validateReleaseGateManifest } from './release-gate-node.js';
9
9
  import { countReleaseGateResources, defaultReleaseGateBudget, summarizeReleaseGateBudget } from './release-gate-resource-governor.js';
10
+ import { selectAffectedReleaseGates } from './release-gate-affected-selector.js';
10
11
  export function loadReleaseGateManifest(root, file = 'release-gates.v2.json') {
11
12
  const manifestPath = path.join(root, file);
12
13
  const parsed = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
@@ -20,7 +21,11 @@ export async function runReleaseGateDag(input) {
20
21
  const root = path.resolve(input.root);
21
22
  const preset = input.preset || 'release';
22
23
  const manifest = loadReleaseGateManifest(root);
23
- const selected = selectPreset(manifest, preset);
24
+ const presetGates = selectReleaseGatePreset(manifest, preset);
25
+ const affected = (preset === 'affected' || preset === 'fast') && input.full !== true
26
+ ? selectAffectedReleaseGates(root, manifest, presetGates, { changedSince: input.changedSince || 'auto', preset })
27
+ : selectAffectedReleaseGates(root, manifest, presetGates, { full: true, preset });
28
+ const selected = affected.gates;
24
29
  const runId = `rg-${new Date().toISOString().replace(/[:.]/g, '-')}-${process.pid}`;
25
30
  const reportDir = path.join(root, '.sneakoscope', 'reports', 'release-gates', runId);
26
31
  fs.mkdirSync(reportDir, { recursive: true });
@@ -33,6 +38,8 @@ export async function runReleaseGateDag(input) {
33
38
  const budget = defaultReleaseGateBudget();
34
39
  const peakResources = {};
35
40
  let cached = 0;
41
+ const cachedGates = [];
42
+ const executedGates = [];
36
43
  let sumGateMs = 0;
37
44
  let peakRunning = 0;
38
45
  const writeSummarySnapshot = (finished = false) => {
@@ -45,6 +52,9 @@ export async function runReleaseGateDag(input) {
45
52
  selected_preset: preset,
46
53
  total_gates: manifest.gates.length,
47
54
  selected_gates: selected.length,
55
+ selected_gate_ids: selected.map((gate) => gate.id),
56
+ skipped_by_affected: affected.selection.mode === 'affected' ? affected.selection.skipped_gate_ids : [],
57
+ affected_selection: affected.selection,
48
58
  completed: completed.size,
49
59
  failed: failed.size,
50
60
  cached,
@@ -55,6 +65,12 @@ export async function runReleaseGateDag(input) {
55
65
  critical_path_ms: estimateCriticalPath(selected, completed),
56
66
  peak_running: peakRunning,
57
67
  peak_resources: peakResources,
68
+ cached_gates: cachedGates,
69
+ executed_gates: executedGates,
70
+ slowest_gates: [...completed.values(), ...failed.values()]
71
+ .sort((a, b) => b.duration_ms - a.duration_ms)
72
+ .slice(0, 10)
73
+ .map((row) => ({ id: row.id, duration_ms: row.duration_ms, cached: row.cached })),
58
74
  budget_snapshot: budget,
59
75
  budget_summary: summarizeReleaseGateBudget(budget),
60
76
  report_dir: reportDir,
@@ -82,12 +98,14 @@ export async function runReleaseGateDag(input) {
82
98
  const result = { id: gate.id, ok: true, exit_code: 0, duration_ms: 0, cached: true, stderr_tail: '' };
83
99
  completed.set(gate.id, result);
84
100
  cached += 1;
101
+ cachedGates.push(gate.id);
85
102
  progressed = true;
86
103
  appendReleaseGateJsonl(timeline, { event: 'cache_hit', gate_id: gate.id, at: new Date().toISOString() });
87
104
  writeSummarySnapshot(false);
88
105
  continue;
89
106
  }
90
107
  appendReleaseGateJsonl(timeline, { event: 'start', gate_id: gate.id, resource: gate.resource, at: new Date().toISOString() });
108
+ executedGates.push(gate.id);
91
109
  running.set(gate.id, { gate, promise: runGate(root, runId, reportDir, gate) });
92
110
  peakRunning = Math.max(peakRunning, running.size);
93
111
  const used = countReleaseGateResources([...running.values()].map((row) => row.gate));
@@ -141,8 +159,9 @@ export async function runReleaseGateDag(input) {
141
159
  const result = writeSummarySnapshot(true);
142
160
  return result;
143
161
  }
144
- function selectPreset(manifest, preset) {
145
- return manifest.gates.filter((gate) => gate.preset.includes(preset));
162
+ export function selectReleaseGatePreset(manifest, preset) {
163
+ const effectivePreset = preset === 'affected' || preset === 'fast' ? 'release' : preset;
164
+ return manifest.gates.filter((gate) => gate.preset.includes(effectivePreset));
146
165
  }
147
166
  function runGate(root, runId, reportRoot, gate) {
148
167
  const started = Date.now();
@@ -1,22 +1,27 @@
1
1
  import os from 'node:os';
2
2
  export function defaultReleaseGateBudget() {
3
3
  const cores = Math.max(1, os.cpus().length || 1);
4
- return {
5
- 'cpu-light': Math.min(32, cores * 4),
6
- 'cpu-heavy': Math.max(1, cores - 1),
7
- 'io-light': Math.min(64, cores * 8),
8
- 'io-heavy': Math.min(8, cores),
9
- git: Math.min(8, cores),
10
- 'git-worktree': Math.min(6, cores),
11
- python: Math.min(8, cores),
12
- network: 8,
4
+ const base = {
5
+ 'cpu-light': Math.min(48, cores * 6),
6
+ 'cpu-heavy': Math.max(1, cores),
7
+ 'io-light': Math.min(96, cores * 10),
8
+ 'io-heavy': Math.min(12, Math.max(1, cores)),
9
+ git: Math.min(12, Math.max(1, cores)),
10
+ 'git-worktree': Math.min(8, Math.max(1, cores)),
11
+ python: Math.min(12, Math.max(1, cores)),
12
+ network: 12,
13
13
  'zellij-real': 1,
14
14
  'local-llm-real': Math.max(1, Number(process.env.SKS_LOCAL_LLM_MAX_PARALLEL || 1)),
15
- 'remote-model-real': 4,
15
+ 'remote-model-real': 6,
16
16
  'global-config': 1,
17
17
  publish: 1,
18
- 'fs-read': Math.min(64, cores * 8)
18
+ 'fs-read': Math.min(96, cores * 10)
19
19
  };
20
+ for (const key of Object.keys(base)) {
21
+ const envName = `SKS_RELEASE_MAX_${key.toUpperCase().replace(/[^A-Z0-9]+/g, '_')}`;
22
+ base[key] = envInt(envName, base[key]);
23
+ }
24
+ return base;
20
25
  }
21
26
  export function summarizeReleaseGateBudget(budget = defaultReleaseGateBudget()) {
22
27
  return Object.entries(budget)
@@ -31,7 +36,10 @@ export function pickLaunchableReleaseGates(input) {
31
36
  const budget = input.budget || defaultReleaseGateBudget();
32
37
  const used = usedResources(input.running);
33
38
  const launchable = [];
39
+ const maxTotal = envInt('SKS_RELEASE_MAX_TOTAL', Number.POSITIVE_INFINITY);
34
40
  for (const gate of input.ready) {
41
+ if (input.running.length + launchable.length >= maxTotal)
42
+ break;
35
43
  if (fits(gate, used, budget)) {
36
44
  launchable.push(gate);
37
45
  for (const resource of gate.resource)
@@ -40,6 +48,10 @@ export function pickLaunchableReleaseGates(input) {
40
48
  }
41
49
  return launchable;
42
50
  }
51
+ function envInt(name, fallback) {
52
+ const parsed = Number(process.env[name]);
53
+ return Number.isFinite(parsed) && parsed > 0 ? Math.floor(parsed) : fallback;
54
+ }
43
55
  function usedResources(running) {
44
56
  const used = {};
45
57
  for (const gate of running) {
@@ -25,7 +25,7 @@ export async function densifyImplementationBlueprint(input) {
25
25
  generated_at: nowIso(),
26
26
  prompt: input.plan?.prompt || base.prompt || '',
27
27
  implementation_allowed_in_research: false,
28
- handoff_route: '$Team',
28
+ handoff_route: '$Naruto',
29
29
  repository_aware: true,
30
30
  existing_files: likelyFiles,
31
31
  possible_new_files: possibleNewFiles,
@@ -4,7 +4,7 @@ export function renderImplementationBlueprintMarkdown(blueprint = null) {
4
4
  lines.push('# Research Implementation Blueprint');
5
5
  lines.push('');
6
6
  lines.push(`Prompt: ${blueprint?.prompt || ''}`);
7
- lines.push(`Handoff route: ${blueprint?.handoff_route || '$Team'}`);
7
+ lines.push(`Handoff route: ${blueprint?.handoff_route || '$Naruto'}`);
8
8
  lines.push(`Implementation allowed in Research: ${blueprint?.implementation_allowed_in_research === true ? 'yes' : 'no'}`);
9
9
  lines.push('');
10
10
  lines.push('## Sections');
@@ -13,20 +13,50 @@ const DEFAULT_SECTION_IDS = Object.freeze([
13
13
  ]);
14
14
  export function defaultImplementationBlueprint(plan = null) {
15
15
  const prompt = String(plan?.prompt || 'research mission');
16
+ const existingFiles = [
17
+ 'src/core/research/research-stage-runner.ts',
18
+ 'src/core/research/research-report-quality.ts',
19
+ 'src/core/research/research-final-reviewer.ts',
20
+ 'package.json',
21
+ 'release-gates.v2.json',
22
+ 'docs/research-pipeline.md'
23
+ ];
16
24
  return {
17
25
  schema: 'sks.research-implementation-blueprint.v1',
18
26
  generated_at: nowIso(),
19
27
  prompt,
20
28
  implementation_allowed_in_research: false,
21
- handoff_route: '$Team',
29
+ handoff_route: '$Naruto',
30
+ repository_aware: true,
31
+ existing_files: existingFiles,
32
+ possible_new_files: [
33
+ 'src/core/research/research-synthesis-writer.ts',
34
+ 'src/core/research/research-repetition-detector.ts',
35
+ 'src/scripts/research-handoff-consumability-check.ts'
36
+ ],
37
+ test_commands: [
38
+ 'npm run research:implementation-blueprint',
39
+ 'npm run research:blueprint-densifier',
40
+ 'npm run research:handoff-consumability'
41
+ ],
42
+ rollback_steps: [
43
+ 'Revert the research blueprint and handoff changes as one bounded patch.',
44
+ 'Rerun the blueprint, handoff, and release DAG checks after rollback.'
45
+ ],
46
+ parallel_work_decomposition: [
47
+ 'WS-A synthesis writer and schema wiring.',
48
+ 'WS-B report quality and repetition checks.',
49
+ 'WS-C final reviewer and gate validation.',
50
+ 'WS-D CLI, release, and documentation closure.'
51
+ ],
22
52
  sections: DEFAULT_SECTION_IDS.map((id, index) => ({
23
53
  id,
24
54
  title: id.split('_').map((part) => part[0]?.toUpperCase() + part.slice(1)).join(' '),
25
55
  order: index + 1,
26
- detail: `Research handoff detail for ${id} on: ${prompt}`,
27
- evidence_claim_ids: [],
28
- target_paths: [],
29
- acceptance_checks: [`${id} is reviewed against cited research artifacts before implementation.`]
56
+ detail: sectionDetail(id, prompt, existingFiles),
57
+ evidence_claim_ids: [`claim-${(index % 8) + 1}`],
58
+ target_paths: existingFiles.slice(0, 3 + (index % 3)),
59
+ acceptance_checks: [`${id} is reviewed against cited source ids, claim ids, concrete files, and rollback evidence before implementation.`]
30
60
  })),
31
61
  dependencies: [],
32
62
  out_of_scope: ['Repository source mutation during $Research runs.'],
@@ -43,17 +73,38 @@ export function validateImplementationBlueprint(blueprint = null, contract = nul
43
73
  && Array.isArray(section?.acceptance_checks)
44
74
  && section.acceptance_checks.length > 0;
45
75
  });
76
+ const existingFiles = normalizeStringList(blueprint?.existing_files);
77
+ const testCommands = normalizeStringList(blueprint?.test_commands);
78
+ const rollbackSteps = normalizeStringList(blueprint?.rollback_steps);
79
+ const parallelWork = normalizeStringList(blueprint?.parallel_work_decomposition);
80
+ const thinSections = sections
81
+ .filter((section) => String(section?.detail || '').trim().length < 120)
82
+ .map((section) => String(section?.id || section?.title || 'unknown'));
83
+ const executionPlan = sections.find((section) => String(section?.id || '').trim() === 'execution_plan' || /execution|step/i.test(String(section?.title || '')));
84
+ const executionPlanHasNumberedSteps = /(?:^|\n)\s*(?:\d+\.|[-*]\s+\d+\.)\s+/.test(String(executionPlan?.detail || ''));
46
85
  const blockers = [
47
86
  ...(blueprint ? [] : ['implementation_blueprint_missing']),
48
87
  ...(sections.length < minSections ? ['implementation_blueprint_sections_below_contract'] : []),
49
- ...(completeSections.length < minSections ? ['implementation_blueprint_incomplete_sections'] : [])
88
+ ...(completeSections.length < minSections ? ['implementation_blueprint_incomplete_sections'] : []),
89
+ ...(blueprint?.repository_aware === true ? [] : ['implementation_blueprint_not_repository_aware']),
90
+ ...(existingFiles.length >= 3 && existingFiles.some((file) => /^src\/|^package\.json$|^release-gates|^docs\//.test(file)) ? [] : ['implementation_blueprint_file_map_too_thin']),
91
+ ...(testCommands.length >= 3 ? [] : ['implementation_blueprint_test_plan_too_thin']),
92
+ ...(rollbackSteps.length >= 2 ? [] : ['implementation_blueprint_rollback_too_thin']),
93
+ ...(parallelWork.length >= 4 ? [] : ['implementation_blueprint_parallel_work_missing']),
94
+ ...thinSections.map((id) => `implementation_blueprint_section_too_thin:${id}`),
95
+ ...(executionPlanHasNumberedSteps ? [] : ['implementation_blueprint_execution_plan_not_numbered'])
50
96
  ];
51
97
  return {
52
98
  ok: blockers.length === 0,
53
99
  blockers,
54
100
  sections: sections.length,
55
101
  complete_sections: completeSections.length,
56
- min_sections: minSections
102
+ min_sections: minSections,
103
+ existing_files: existingFiles.length,
104
+ test_commands: testCommands.length,
105
+ rollback_steps: rollbackSteps.length,
106
+ parallel_work_items: parallelWork.length,
107
+ thin_sections: thinSections
57
108
  };
58
109
  }
59
110
  export async function readImplementationBlueprint(dir) {
@@ -63,4 +114,14 @@ export async function writeImplementationBlueprint(dir, blueprint) {
63
114
  await writeJsonAtomic(path.join(dir, IMPLEMENTATION_BLUEPRINT_ARTIFACT), blueprint);
64
115
  return blueprint;
65
116
  }
117
+ function normalizeStringList(value) {
118
+ return [...new Set((Array.isArray(value) ? value : value == null ? [] : [value]).map((item) => String(item || '').trim()).filter(Boolean))];
119
+ }
120
+ function sectionDetail(id, prompt, files) {
121
+ const fileList = files.slice(0, 4).join(', ');
122
+ if (id === 'execution_plan') {
123
+ return `1. Inspect the cited research artifacts for ${prompt}. 2. Apply the smallest implementation patch across ${fileList}. 3. Run the listed research and release gates. 4. Keep rollback scoped to the files named in this blueprint.`;
124
+ }
125
+ return `For ${prompt}, the ${id} section links source-backed claims to concrete repository files such as ${fileList}, names the acceptance evidence expected from tests, and keeps Research itself read-only while preparing a Naruto handoff.`;
126
+ }
66
127
  //# sourceMappingURL=implementation-blueprint.js.map
@@ -68,6 +68,10 @@ export async function runResearchCodexFinalReviewer(input) {
68
68
  missing_evidence: [],
69
69
  blueprint_findings: [],
70
70
  falsification_findings: [],
71
+ template_like_prose: true,
72
+ source_density_ok: false,
73
+ implementation_concreteness_ok: false,
74
+ evidence_bound_synthesis_ok: false,
71
75
  required_revisions: ['static_review_failed'],
72
76
  confidence: 'low',
73
77
  skipped: true,
@@ -85,6 +89,10 @@ export async function runResearchCodexFinalReviewer(input) {
85
89
  missing_evidence: [],
86
90
  blueprint_findings: ['mock final reviewer approves the complete package fixture'],
87
91
  falsification_findings: ['mock counterevidence and falsification cases are present'],
92
+ template_like_prose: false,
93
+ source_density_ok: true,
94
+ implementation_concreteness_ok: true,
95
+ evidence_bound_synthesis_ok: true,
88
96
  required_revisions: [],
89
97
  confidence: 'high',
90
98
  mock: true
@@ -141,6 +149,10 @@ export async function runResearchFinalReviewer(dir, input = {}) {
141
149
  ...(Array.isArray(staticReview?.blockers) ? staticReview.blockers : []),
142
150
  ...(codexRequired && !codexReview ? ['research_codex_final_review_missing'] : []),
143
151
  ...(codexReview && !codexApproved ? ['research_codex_final_review_not_approved'] : []),
152
+ ...(codexReview?.template_like_prose === true ? ['research_codex_template_like_prose'] : []),
153
+ ...(codexReview && codexReview.source_density_ok === false ? ['research_codex_source_density_not_ok'] : []),
154
+ ...(codexReview && codexReview.implementation_concreteness_ok === false ? ['research_codex_implementation_concreteness_not_ok'] : []),
155
+ ...(codexReview && codexReview.evidence_bound_synthesis_ok === false ? ['research_codex_evidence_bound_synthesis_not_ok'] : []),
144
156
  ...(Array.isArray(codexReview?.required_revisions) ? codexReview.required_revisions.map((revision) => `codex_revision:${revision}`) : [])
145
157
  ];
146
158
  const review = {
@@ -162,6 +174,8 @@ function buildResearchFinalReviewPrompt(plan, staticReview) {
162
174
  `Prompt: ${plan?.prompt || ''}`,
163
175
  '',
164
176
  'Review the mission artifacts read-only. Reject if claims lack evidence, blueprint steps are template-like, falsification is missing, or the package is only a short summary.',
177
+ 'Reject repeated paragraphs, template-like prose, unsupported synthesis, source IDs that do not exist in source-ledger, and implementation blueprints that lack concrete files/tests.',
178
+ 'Set template_like_prose=true for repeated or boilerplate reports. Set source_density_ok=false for sparse source ids. Set implementation_concreteness_ok=false for weak file/test/rollback plans. Set evidence_bound_synthesis_ok=false when recommendations are not tied to evidence.',
165
179
  'Return only JSON matching sks.research-codex-final-review.v1 with verdict approve, revise, or reject.',
166
180
  '',
167
181
  `Static review summary:\n${JSON.stringify(staticReview, null, 2).slice(0, 12000)}`
@@ -177,6 +191,10 @@ function normalizeCodexReview(worker, result) {
177
191
  missing_evidence: [],
178
192
  blueprint_findings: [],
179
193
  falsification_findings: [],
194
+ template_like_prose: false,
195
+ source_density_ok: false,
196
+ implementation_concreteness_ok: false,
197
+ evidence_bound_synthesis_ok: false,
180
198
  required_revisions: Array.isArray(result?.blockers) ? result.blockers : ['codex_final_reviewer_unavailable'],
181
199
  confidence: 'low',
182
200
  worker_result_path: result?.workerResultPath || null
@@ -190,6 +208,10 @@ function normalizeCodexReview(worker, result) {
190
208
  missing_evidence: Array.isArray(worker?.missing_evidence) ? worker.missing_evidence.map(String) : [],
191
209
  blueprint_findings: Array.isArray(worker?.blueprint_findings) ? worker.blueprint_findings.map(String) : [],
192
210
  falsification_findings: Array.isArray(worker?.falsification_findings) ? worker.falsification_findings.map(String) : [],
211
+ template_like_prose: worker?.template_like_prose === true,
212
+ source_density_ok: worker?.source_density_ok === true,
213
+ implementation_concreteness_ok: worker?.implementation_concreteness_ok === true,
214
+ evidence_bound_synthesis_ok: worker?.evidence_bound_synthesis_ok === true,
193
215
  required_revisions: Array.isArray(worker?.required_revisions) ? worker.required_revisions.map(String) : [],
194
216
  confidence: ['low', 'medium', 'high'].includes(worker?.confidence) ? worker.confidence : 'medium',
195
217
  worker_result_path: result.workerResultPath
@@ -197,7 +219,7 @@ function normalizeCodexReview(worker, result) {
197
219
  }
198
220
  export const researchCodexFinalReviewSchema = {
199
221
  type: 'object',
200
- required: ['schema', 'verdict', 'unsupported_claim_ids', 'missing_evidence', 'blueprint_findings', 'falsification_findings', 'required_revisions', 'confidence'],
222
+ required: ['schema', 'verdict', 'unsupported_claim_ids', 'missing_evidence', 'blueprint_findings', 'falsification_findings', 'template_like_prose', 'source_density_ok', 'implementation_concreteness_ok', 'evidence_bound_synthesis_ok', 'required_revisions', 'confidence'],
201
223
  properties: {
202
224
  schema: { const: 'sks.research-codex-final-review.v1' },
203
225
  verdict: { enum: ['approve', 'revise', 'reject'] },
@@ -205,6 +227,10 @@ export const researchCodexFinalReviewSchema = {
205
227
  missing_evidence: { type: 'array' },
206
228
  blueprint_findings: { type: 'array' },
207
229
  falsification_findings: { type: 'array' },
230
+ template_like_prose: { type: 'boolean' },
231
+ source_density_ok: { type: 'boolean' },
232
+ implementation_concreteness_ok: { type: 'boolean' },
233
+ evidence_bound_synthesis_ok: { type: 'boolean' },
208
234
  required_revisions: { type: 'array' },
209
235
  confidence: { enum: ['low', 'medium', 'high'] }
210
236
  }
@@ -1,15 +1,23 @@
1
1
  import path from 'node:path';
2
- import { nowIso, writeJsonAtomic, writeTextAtomic } from '../fsx.js';
2
+ import { nowIso, readJson, writeJsonAtomic, writeTextAtomic } from '../fsx.js';
3
3
  export const IMPLEMENTATION_HANDOFF_PATCH_PLAN_ARTIFACT = 'implementation-handoff.patch-plan.json';
4
4
  export const TEAM_HANDOFF_GOAL_ARTIFACT = 'team-handoff-goal.md';
5
5
  export const DECISION_LOG_ARTIFACT = 'decision-log.md';
6
6
  export async function writeResearchHandoffArtifacts(dir, plan = null, blueprint = null) {
7
+ const claimMatrix = await readJson(path.join(dir, 'claim-evidence-matrix.json'), null);
8
+ const sourceLedger = await readJson(path.join(dir, 'source-ledger.json'), null);
9
+ const claims = Array.isArray(claimMatrix?.claims) ? claimMatrix.claims : [];
10
+ const sourceRows = [
11
+ ...(Array.isArray(sourceLedger?.sources) ? sourceLedger.sources : []),
12
+ ...(Array.isArray(sourceLedger?.counterevidence_sources) ? sourceLedger.counterevidence_sources : [])
13
+ ];
14
+ const workItems = parallelWorkItems(blueprint);
7
15
  const patchPlan = {
8
16
  schema: 'sks.research-implementation-handoff-patch-plan.v1',
9
17
  generated_at: nowIso(),
10
18
  mission_id: plan?.mission_id || null,
11
19
  implementation_allowed_in_research: false,
12
- intended_route: '$Team',
20
+ intended_route: '$Naruto',
13
21
  prompt: plan?.prompt || '',
14
22
  source_artifacts: [
15
23
  'research-report.md',
@@ -20,20 +28,55 @@ export async function writeResearchHandoffArtifacts(dir, plan = null, blueprint
20
28
  'source-quality-report.json'
21
29
  ],
22
30
  proposed_changes: [],
31
+ parallel_work_items: workItems,
23
32
  notes: [
24
33
  'This is a handoff artifact. Research records implementation guidance but does not mutate repository source.'
25
34
  ]
26
35
  };
27
36
  const goalLines = [
28
- '# Research-To-Team Handoff Goal',
37
+ '# Research-To-Naruto Handoff Goal',
38
+ '',
39
+ '## Context',
29
40
  '',
30
41
  `Mission: ${plan?.mission_id || 'unknown'}`,
31
42
  `Prompt: ${plan?.prompt || ''}`,
43
+ 'Route: Use `$Naruto` for implementation, integration, and parallel non-overlapping lanes.',
32
44
  '',
33
45
  'Use the implementation blueprint, claim-evidence matrix, source-quality report, experiment plan, replication pack, and final reviewer output before changing code.',
34
46
  '',
35
- 'Blueprint sections:',
36
- ...(Array.isArray(blueprint?.sections) ? blueprint.sections.map((section) => `- ${section.id}: ${section.title}`) : [])
47
+ '## Key Claims',
48
+ '',
49
+ ...(claims.length ? claims.slice(0, 8).map((claim) => `- ${claim.id}: ${claim.claim} Sources: ${normalizeList(claim.source_ids).join(', ') || 'explicit blocker: source ids missing'}. Counterevidence: ${normalizeList(claim.counterevidence_ids).join(', ') || 'explicit blocker: counterevidence missing'}.`) : ['- explicit blocker: claim-evidence-matrix.json has no claim rows.']),
50
+ '',
51
+ '## Evidence Summary',
52
+ '',
53
+ `- Source rows: ${sourceRows.length}.`,
54
+ `- Key claims: ${Array.isArray(claimMatrix?.key_claim_ids) ? claimMatrix.key_claim_ids.length : 0}.`,
55
+ `- Counterevidence rows: ${Array.isArray(sourceLedger?.counterevidence_sources) ? sourceLedger.counterevidence_sources.length : 0}.`,
56
+ '- Read `source-quality-report.json` and `research-final-review.json` before implementation.',
57
+ '',
58
+ '## Implementation Blueprint',
59
+ '',
60
+ ...(Array.isArray(blueprint?.sections) ? blueprint.sections.map((section) => `- ${section.id}: ${section.title}. Files: ${normalizeList(section.target_paths).join(', ') || 'explicit blocker: no target paths'}. Checks: ${normalizeList(section.acceptance_checks).join(' | ') || 'explicit blocker: no acceptance checks'}.`) : ['- explicit blocker: implementation-blueprint.json missing sections.']),
61
+ '',
62
+ '## Parallel Work Items',
63
+ '',
64
+ ...workItems.map((item, index) => `${index + 1}. ${item.title}. Files: ${item.files.length ? item.files.join(', ') : 'explicit blocker: file list missing'}. Tests: ${item.tests.length ? item.tests.join(', ') : 'explicit blocker: tests missing'}. Acceptance: ${item.acceptance}.`),
65
+ '',
66
+ '## Acceptance Tests',
67
+ '',
68
+ ...normalizeList(blueprint?.test_commands).map((command) => `- ${command}`),
69
+ ...(normalizeList(blueprint?.test_commands).length ? [] : ['- explicit blocker: no test commands in implementation blueprint.']),
70
+ '',
71
+ '## Rollback Plan',
72
+ '',
73
+ ...normalizeList(blueprint?.rollback_steps).map((step) => `- ${step}`),
74
+ ...(normalizeList(blueprint?.rollback_steps).length ? [] : ['- explicit blocker: no rollback steps in implementation blueprint.']),
75
+ '',
76
+ '## Source Appendix',
77
+ '',
78
+ ...sourceRows.slice(0, 20).map((source) => `- ${source.id}: ${source.title || source.locator || 'source row'}; claims=${normalizeList(source.claim_ids).join(', ') || 'none'}.`),
79
+ ...(sourceRows.length ? [] : ['- explicit blocker: source-ledger.json has no source rows.'])
37
80
  ];
38
81
  const decisionLog = [
39
82
  '# Research Decision Log',
@@ -48,4 +91,25 @@ export async function writeResearchHandoffArtifacts(dir, plan = null, blueprint
48
91
  await writeTextAtomic(path.join(dir, DECISION_LOG_ARTIFACT), `${decisionLog.join('\n')}\n`);
49
92
  return { patch_plan: patchPlan, goal_artifact: TEAM_HANDOFF_GOAL_ARTIFACT, decision_log: DECISION_LOG_ARTIFACT };
50
93
  }
94
+ function parallelWorkItems(blueprint) {
95
+ const sections = Array.isArray(blueprint?.sections) ? blueprint.sections : [];
96
+ const fallbackFiles = normalizeList(blueprint?.existing_files).slice(0, 8);
97
+ const tests = normalizeList(blueprint?.test_commands);
98
+ const rows = normalizeList(blueprint?.parallel_work_decomposition);
99
+ const source = rows.length >= 4 ? rows : ['Synthesis writer lane', 'Report quality lane', 'Final reviewer lane', 'Release and docs lane'];
100
+ return source.slice(0, Math.max(4, source.length)).map((title, index) => {
101
+ const section = sections[index % Math.max(1, sections.length)] || {};
102
+ const files = normalizeList(section.target_paths).length ? normalizeList(section.target_paths) : fallbackFiles.slice(index, index + 3);
103
+ return {
104
+ id: `handoff-work-${index + 1}`,
105
+ title,
106
+ files,
107
+ tests: tests.slice(0, 3),
108
+ acceptance: normalizeList(section.acceptance_checks).join(' | ') || 'Complete the lane and rerun the relevant research gate.'
109
+ };
110
+ });
111
+ }
112
+ function normalizeList(value) {
113
+ return [...new Set((Array.isArray(value) ? value : value == null ? [] : [value]).map((item) => String(item || '').trim()).filter(Boolean))];
114
+ }
51
115
  //# sourceMappingURL=research-handoff.js.map