sneakoscope 2.0.13 → 2.0.15

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 (504) 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 +1 -0
  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 +11 -4
  11. package/dist/core/agents/agent-output-validator.js +1 -1
  12. package/dist/core/agents/agent-plan.js +3 -2
  13. package/dist/core/agents/native-cli-session-swarm.js +118 -0
  14. package/dist/core/agents/native-cli-worker.js +85 -0
  15. package/dist/core/codex-control/codex-fake-sdk-adapter.js +3 -3
  16. package/dist/core/codex-control/gpt-final-review-schema.js +61 -14
  17. package/dist/core/commands/basic-cli.js +1 -1
  18. package/dist/core/commands/command-suggestions.js +1 -1
  19. package/dist/core/commands/mad-db-command.js +106 -0
  20. package/dist/core/commands/mad-sks-command.js +50 -13
  21. package/dist/core/commands/naruto-command.js +82 -1
  22. package/dist/core/commands/research-command.js +83 -17
  23. package/dist/core/commands/team-command.js +25 -1
  24. package/dist/core/db-safety.js +26 -0
  25. package/dist/core/fsx.js +1 -1
  26. package/dist/core/mad-db/mad-db-capability.js +84 -0
  27. package/dist/core/mad-db/mad-db-ledger.js +17 -0
  28. package/dist/core/mad-db/mad-db-policy-resolver.js +46 -0
  29. package/dist/core/naruto/naruto-real-worker-child.js +11 -3
  30. package/dist/core/naruto/naruto-real-worker-runtime.js +4 -0
  31. package/dist/core/pipeline/final-gpt-patch-stage.js +20 -3
  32. package/dist/core/pipeline-internals/runtime-core.js +74 -8
  33. package/dist/core/pipeline-internals/runtime-gates.js +44 -0
  34. package/dist/core/proof/route-proof-gate.js +5 -3
  35. package/dist/core/proof/route-proof-policy.js +9 -1
  36. package/dist/core/release/release-gate-affected-selector.js +113 -0
  37. package/dist/core/release/release-gate-batch-runner.js +67 -0
  38. package/dist/core/release/release-gate-dag.js +22 -3
  39. package/dist/core/release/release-gate-resource-governor.js +23 -11
  40. package/dist/core/research/implementation-blueprint-densifier.js +124 -0
  41. package/dist/core/research/implementation-blueprint-markdown.js +1 -1
  42. package/dist/core/research/implementation-blueprint.js +68 -7
  43. package/dist/core/research/research-claim-builder.js +114 -0
  44. package/dist/core/research/research-cycle-runner.js +115 -11
  45. package/dist/core/research/research-final-reviewer.js +181 -1
  46. package/dist/core/research/research-handoff.js +69 -5
  47. package/dist/core/research/research-realistic-report.js +162 -0
  48. package/dist/core/research/research-repetition-detector.js +75 -0
  49. package/dist/core/research/research-report-quality.js +27 -5
  50. package/dist/core/research/research-source-ledger-merge.js +186 -0
  51. package/dist/core/research/research-source-shards.js +176 -0
  52. package/dist/core/research/research-stage-runner.js +537 -11
  53. package/dist/core/research/research-synthesis-prompt.js +52 -0
  54. package/dist/core/research/research-synthesis-writer.js +208 -0
  55. package/dist/core/research/research-work-graph.js +114 -23
  56. package/dist/core/research.js +72 -48
  57. package/dist/core/routes.js +23 -19
  58. package/dist/core/update/update-notice.js +120 -0
  59. package/dist/core/version.js +1 -1
  60. package/dist/core/zellij/zellij-dashboard-renderer.js +2 -0
  61. package/dist/core/zellij/zellij-slot-column-anchor.js +35 -1
  62. package/dist/core/zellij/zellij-slot-pane-renderer.js +57 -0
  63. package/dist/core/zellij/zellij-slot-telemetry.js +182 -0
  64. package/dist/scripts/release-gate-dag-runner.js +5 -0
  65. package/dist/scripts/release-speed-summary.js +25 -0
  66. package/package.json +67 -5
  67. package/schemas/codex/agent-result.schema.json +1 -1
  68. package/schemas/mad-db/mad-db-capability.schema.json +31 -0
  69. package/schemas/mad-db/mad-db-ledger.schema.json +14 -0
  70. package/schemas/research/implementation-blueprint.schema.json +6 -1
  71. package/schemas/research/research-final-review.schema.json +10 -0
  72. package/schemas/research/research-source-shard.schema.json +46 -0
  73. package/schemas/research/research-synthesis-output.schema.json +62 -0
  74. package/schemas/update/update-notice.schema.json +19 -0
  75. package/schemas/zellij/zellij-slot-telemetry.schema.json +89 -0
  76. package/dist/build-manifest.json +0 -1184
  77. package/dist/scripts/agent-ast-aware-work-graph-check.js +0 -25
  78. package/dist/scripts/agent-backfill-replenishment-check.js +0 -13
  79. package/dist/scripts/agent-backfill-route-blackbox.js +0 -5
  80. package/dist/scripts/agent-background-terminals-check.js +0 -16
  81. package/dist/scripts/agent-cleanup-command-ux-check.js +0 -12
  82. package/dist/scripts/agent-cleanup-executor-check.js +0 -53
  83. package/dist/scripts/agent-cleanup-executor-v2-check.js +0 -39
  84. package/dist/scripts/agent-cli-options-to-task-graph-check.js +0 -5
  85. package/dist/scripts/agent-codex-app-cockpit-check.js +0 -91
  86. package/dist/scripts/agent-codex-child-overlap-check.js +0 -21
  87. package/dist/scripts/agent-dynamic-cockpit-check.js +0 -10
  88. package/dist/scripts/agent-dynamic-pool-check.js +0 -13
  89. package/dist/scripts/agent-dynamic-pool-route-blackbox.js +0 -5
  90. package/dist/scripts/agent-fast-mode-default-check.js +0 -62
  91. package/dist/scripts/agent-fast-mode-worker-propagation-check.js +0 -7
  92. package/dist/scripts/agent-follow-up-work-schema-check.js +0 -80
  93. package/dist/scripts/agent-goal-mode-propagation-check.js +0 -9
  94. package/dist/scripts/agent-intelligent-work-graph-check.js +0 -25
  95. package/dist/scripts/agent-janitor-check.js +0 -76
  96. package/dist/scripts/agent-main-no-scout-check.js +0 -11
  97. package/dist/scripts/agent-model-authored-patch-envelope-check.js +0 -15
  98. package/dist/scripts/agent-multi-project-isolation-check.js +0 -86
  99. package/dist/scripts/agent-native-cli-session-proof-check.js +0 -7
  100. package/dist/scripts/agent-native-cli-session-swarm-10-check.js +0 -7
  101. package/dist/scripts/agent-native-cli-session-swarm-20-check.js +0 -7
  102. package/dist/scripts/agent-native-cli-session-swarm-check.js +0 -7
  103. package/dist/scripts/agent-no-subagent-scaling-check.js +0 -7
  104. package/dist/scripts/agent-parallel-write-blackbox.js +0 -56
  105. package/dist/scripts/agent-parallel-write-kernel-check.js +0 -103
  106. package/dist/scripts/agent-patch-conflict-rebase-check.js +0 -198
  107. package/dist/scripts/agent-patch-envelope-extraction-check.js +0 -17
  108. package/dist/scripts/agent-patch-proof-check.js +0 -41
  109. package/dist/scripts/agent-patch-proof-runtime-check.js +0 -63
  110. package/dist/scripts/agent-patch-queue-runtime-check.js +0 -36
  111. package/dist/scripts/agent-patch-rollback-check.js +0 -38
  112. package/dist/scripts/agent-patch-rollback-dag-check.js +0 -14
  113. package/dist/scripts/agent-patch-swarm-route-blackbox.js +0 -10
  114. package/dist/scripts/agent-patch-swarm-runtime-check.js +0 -10
  115. package/dist/scripts/agent-patch-swarm-runtime-truth-check.js +0 -76
  116. package/dist/scripts/agent-patch-transaction-journal-check.js +0 -57
  117. package/dist/scripts/agent-patch-verification-dag-check.js +0 -14
  118. package/dist/scripts/agent-proof-contract-reconciled-check.js +0 -5
  119. package/dist/scripts/agent-real-codex-dynamic-smoke-check.js +0 -166
  120. package/dist/scripts/agent-real-codex-dynamic-smoke-v2-check.js +0 -14
  121. package/dist/scripts/agent-real-codex-in-zellij-worker-pane-check.js +0 -229
  122. package/dist/scripts/agent-real-codex-parallel-workers-10-check.js +0 -5
  123. package/dist/scripts/agent-real-codex-parallel-workers-20-check.js +0 -5
  124. package/dist/scripts/agent-real-codex-parallel-workers-5-check.js +0 -5
  125. package/dist/scripts/agent-real-codex-parallel-workers-check.js +0 -5
  126. package/dist/scripts/agent-role-config-repair-check.js +0 -33
  127. package/dist/scripts/agent-rollback-command-check.js +0 -86
  128. package/dist/scripts/agent-route-truth-backfill-check.js +0 -5
  129. package/dist/scripts/agent-scheduler-proof-check.js +0 -13
  130. package/dist/scripts/agent-scheduler-proof-hardening-check.js +0 -22
  131. package/dist/scripts/agent-session-generation-check.js +0 -21
  132. package/dist/scripts/agent-slot-pane-binding-proof-check.js +0 -64
  133. package/dist/scripts/agent-source-intelligence-propagation-check.js +0 -9
  134. package/dist/scripts/agent-strategy-to-lease-wiring-check.js +0 -32
  135. package/dist/scripts/agent-strategy-to-patch-strict-check.js +0 -54
  136. package/dist/scripts/agent-task-graph-expansion-check.js +0 -14
  137. package/dist/scripts/agent-terminal-generations-check.js +0 -23
  138. package/dist/scripts/agent-visual-consistency-check.js +0 -9
  139. package/dist/scripts/agent-wiki-context-proof-check.js +0 -62
  140. package/dist/scripts/agent-worker-backend-router-check.js +0 -63
  141. package/dist/scripts/agent-worker-scout-limited-check.js +0 -17
  142. package/dist/scripts/agent-zellij-dynamic-backfill-panes-check.js +0 -34
  143. package/dist/scripts/agent-zellij-runtime-check.js +0 -84
  144. package/dist/scripts/all-feature-deep-completion-check.js +0 -31
  145. package/dist/scripts/appshots-capability-check.js +0 -18
  146. package/dist/scripts/appshots-evidence-check.js +0 -48
  147. package/dist/scripts/appshots-operator-policy-check.js +0 -25
  148. package/dist/scripts/appshots-privacy-safety-check.js +0 -48
  149. package/dist/scripts/appshots-source-intelligence-check.js +0 -53
  150. package/dist/scripts/appshots-thread-attachment-discovery-check.js +0 -87
  151. package/dist/scripts/appshots-triwiki-voxel-check.js +0 -46
  152. package/dist/scripts/architecture-guard-check.js +0 -55
  153. package/dist/scripts/changelog-check.js +0 -47
  154. package/dist/scripts/codex-0-133-official-compat-report.js +0 -53
  155. package/dist/scripts/codex-0-134-official-compat-report.js +0 -110
  156. package/dist/scripts/codex-0-134-runner-truth-check.js +0 -66
  157. package/dist/scripts/codex-0-135-compat-check.js +0 -57
  158. package/dist/scripts/codex-0-136-compat-check.js +0 -30
  159. package/dist/scripts/codex-0-137-compat-check.js +0 -27
  160. package/dist/scripts/codex-app-fast-ui-preservation-check.js +0 -32
  161. package/dist/scripts/codex-app-provider-badge-check.js +0 -37
  162. package/dist/scripts/codex-app-ui-clobber-guard-check.js +0 -22
  163. package/dist/scripts/codex-app-ui-preservation-check.js +0 -96
  164. package/dist/scripts/codex-control-all-pipelines-check.js +0 -36
  165. package/dist/scripts/codex-control-capability-check.js +0 -10
  166. package/dist/scripts/codex-control-empty-result-retry-check.js +0 -43
  167. package/dist/scripts/codex-control-event-stream-ledger-check.js +0 -10
  168. package/dist/scripts/codex-control-keepalive-no-cot-leak-check.js +0 -14
  169. package/dist/scripts/codex-control-no-legacy-fallback-check.js +0 -31
  170. package/dist/scripts/codex-control-side-effect-scope-check.js +0 -26
  171. package/dist/scripts/codex-control-stream-idle-watchdog-check.js +0 -18
  172. package/dist/scripts/codex-control-structured-output-check.js +0 -11
  173. package/dist/scripts/codex-control-thread-registry-check.js +0 -11
  174. package/dist/scripts/codex-control-tool-call-sequence-repair-check.js +0 -14
  175. package/dist/scripts/codex-environment-scoped-approvals-check.js +0 -10
  176. package/dist/scripts/codex-exec-output-schema-actual-syntax-check.js +0 -33
  177. package/dist/scripts/codex-fast-mode-profile-propagation-check.js +0 -12
  178. package/dist/scripts/codex-history-search-check.js +0 -19
  179. package/dist/scripts/codex-hook-semantic-check.js +0 -15
  180. package/dist/scripts/codex-hook-strict-subset-check.js +0 -61
  181. package/dist/scripts/codex-lb-config-toml-safety-check.js +0 -85
  182. package/dist/scripts/codex-lb-persistence-truth-check.js +0 -96
  183. package/dist/scripts/codex-lb-setup-fixture-check.js +0 -91
  184. package/dist/scripts/codex-lb-setup-truthfulness-check.js +0 -84
  185. package/dist/scripts/codex-legacy-profile-consumers-removed-check.js +0 -24
  186. package/dist/scripts/codex-managed-proxy-env-check.js +0 -17
  187. package/dist/scripts/codex-output-schema-fixture-check.js +0 -25
  188. package/dist/scripts/codex-permission-profiles-check.js +0 -36
  189. package/dist/scripts/codex-plugin-list-json-check.js +0 -8
  190. package/dist/scripts/codex-profile-primary-check.js +0 -13
  191. package/dist/scripts/codex-project-config-policy-splitter-check.js +0 -51
  192. package/dist/scripts/codex-resume-cwd-truth-check.js +0 -17
  193. package/dist/scripts/codex-sdk-all-pipelines-check.js +0 -32
  194. package/dist/scripts/codex-sdk-backend-router-check.js +0 -65
  195. package/dist/scripts/codex-sdk-capability-check.js +0 -11
  196. package/dist/scripts/codex-sdk-core-skill-pipeline-check.js +0 -9
  197. package/dist/scripts/codex-sdk-dfix-pipeline-check.js +0 -9
  198. package/dist/scripts/codex-sdk-event-stream-ledger-check.js +0 -9
  199. package/dist/scripts/codex-sdk-no-legacy-fallback-check.js +0 -33
  200. package/dist/scripts/codex-sdk-qa-pipeline-check.js +0 -8
  201. package/dist/scripts/codex-sdk-real-smoke-check.js +0 -39
  202. package/dist/scripts/codex-sdk-release-review-pipeline-check.js +0 -13
  203. package/dist/scripts/codex-sdk-research-pipeline-check.js +0 -15
  204. package/dist/scripts/codex-sdk-sandbox-policy-check.js +0 -21
  205. package/dist/scripts/codex-sdk-structured-output-check.js +0 -10
  206. package/dist/scripts/codex-sdk-team-naruto-agent-pipeline-check.js +0 -12
  207. package/dist/scripts/codex-sdk-thread-registry-check.js +0 -11
  208. package/dist/scripts/codex-sdk-ux-ppt-review-pipeline-check.js +0 -9
  209. package/dist/scripts/codex-sdk-zellij-pane-binding-check.js +0 -13
  210. package/dist/scripts/codex-thread-runtime-choice-check.js +0 -10
  211. package/dist/scripts/codex-web-adapter-check.js +0 -12
  212. package/dist/scripts/computer-use-live-evidence-check.js +0 -55
  213. package/dist/scripts/computer-use-live-optional-check.js +0 -32
  214. package/dist/scripts/computer-use-policy-check.js +0 -69
  215. package/dist/scripts/computer-use-visual-route-fixture-check.js +0 -37
  216. package/dist/scripts/core-skill-card-schema-check.js +0 -61
  217. package/dist/scripts/core-skill-deployment-snapshot-check.js +0 -54
  218. package/dist/scripts/core-skill-heldout-validation-check.js +0 -49
  219. package/dist/scripts/core-skill-no-inference-optimizer-check.js +0 -75
  220. package/dist/scripts/core-skill-patch-check.js +0 -79
  221. package/dist/scripts/core-skill-promotion-side-effect-ledger-check.js +0 -64
  222. package/dist/scripts/core-skill-rollout-scoring-check.js +0 -72
  223. package/dist/scripts/core-skill-route-runtime-integration-check.js +0 -49
  224. package/dist/scripts/dfix-fast-blackbox-check.js +0 -37
  225. package/dist/scripts/dfix-fast-kernel-check.js +0 -26
  226. package/dist/scripts/dfix-fixture-check.js +0 -6
  227. package/dist/scripts/dfix-parallel-write-blackbox.js +0 -48
  228. package/dist/scripts/dfix-patch-handoff-check.js +0 -13
  229. package/dist/scripts/dfix-patch-swarm-route-blackbox.js +0 -10
  230. package/dist/scripts/dfix-performance-check.js +0 -15
  231. package/dist/scripts/dfix-verification-check.js +0 -9
  232. package/dist/scripts/dfix-verification-recommendation-check.js +0 -15
  233. package/dist/scripts/docs-truthfulness-check.js +0 -61
  234. package/dist/scripts/doctor-codex-doctor-parity-check.js +0 -17
  235. package/dist/scripts/doctor-fix-proves-codex-read-check.js +0 -64
  236. package/dist/scripts/doctor-fix-recovers-corrupted-config-check.js +0 -122
  237. package/dist/scripts/doctor-fixes-codex-app-fast-ui-check.js +0 -39
  238. package/dist/scripts/evidence-fixture-check.js +0 -26
  239. package/dist/scripts/evidence-flagship-coverage-check.js +0 -55
  240. package/dist/scripts/fake-real-proof-policy-v2-check.js +0 -27
  241. package/dist/scripts/fake-vs-real-proof-policy-check.js +0 -14
  242. package/dist/scripts/fast-codex-service-tier-proof-check.js +0 -42
  243. package/dist/scripts/flagship-proof-graph-v2-check.js +0 -48
  244. package/dist/scripts/flagship-proof-graph-v3-check.js +0 -67
  245. package/dist/scripts/flagship-proof-graph-v4-check.js +0 -61
  246. package/dist/scripts/git-precommit-fixture-check.js +0 -41
  247. package/dist/scripts/git-worktree-cache-performance-check.js +0 -25
  248. package/dist/scripts/git-worktree-capability-check.js +0 -27
  249. package/dist/scripts/git-worktree-checkpoint-check.js +0 -20
  250. package/dist/scripts/git-worktree-cleanup-check.js +0 -27
  251. package/dist/scripts/git-worktree-cross-rebase-check.js +0 -39
  252. package/dist/scripts/git-worktree-diff-envelope-check.js +0 -17
  253. package/dist/scripts/git-worktree-diff-export-check.js +0 -43
  254. package/dist/scripts/git-worktree-dirty-lock-check.js +0 -17
  255. package/dist/scripts/git-worktree-dirty-main-detection-check.js +0 -14
  256. package/dist/scripts/git-worktree-integration-primary-check.js +0 -24
  257. package/dist/scripts/git-worktree-integration-primary-runtime-check.js +0 -20
  258. package/dist/scripts/git-worktree-manager-check.js +0 -37
  259. package/dist/scripts/git-worktree-manifest-append-check.js +0 -18
  260. package/dist/scripts/git-worktree-merge-queue-check.js +0 -31
  261. package/dist/scripts/git-worktree-pool-performance-check.js +0 -20
  262. package/dist/scripts/git-worktree-untracked-diff-check.js +0 -18
  263. package/dist/scripts/goal-mode-official-default-check.js +0 -12
  264. package/dist/scripts/gpt-final-arbiter-check.js +0 -63
  265. package/dist/scripts/gpt-final-arbiter-performance-check.js +0 -36
  266. package/dist/scripts/gpt-image-2-request-validator-check.js +0 -35
  267. package/dist/scripts/hooks-0.134-context-parity-check.js +0 -20
  268. package/dist/scripts/hooks-actual-parity-check.js +0 -17
  269. package/dist/scripts/hooks-actual-parity-v2-check.js +0 -21
  270. package/dist/scripts/hooks-latest-schema-check.js +0 -20
  271. package/dist/scripts/hooks-managed-install-fixture-check.js +0 -21
  272. package/dist/scripts/hooks-official-hash-oracle-check.js +0 -35
  273. package/dist/scripts/hooks-official-hash-parity-check.js +0 -17
  274. package/dist/scripts/hooks-subagent-events-check.js +0 -17
  275. package/dist/scripts/hooks-trust-state-check.js +0 -14
  276. package/dist/scripts/image-fidelity-fixture-check.js +0 -24
  277. package/dist/scripts/imagegen-capability-check.js +0 -30
  278. package/dist/scripts/imagegen-real-smoke-check.js +0 -155
  279. package/dist/scripts/install-update-preserves-config-check.js +0 -87
  280. package/dist/scripts/json-schema-recursive-check.js +0 -78
  281. package/dist/scripts/legacy-multiagent-removal-check.js +0 -85
  282. package/dist/scripts/legacy-upgrade-matrix-check.js +0 -300
  283. package/dist/scripts/local-collab-all-pipelines-final-gpt-check.js +0 -21
  284. package/dist/scripts/local-collab-gpt-final-availability-check.js +0 -58
  285. package/dist/scripts/local-collab-no-local-only-final-check.js +0 -27
  286. package/dist/scripts/local-collab-policy-check.js +0 -17
  287. package/dist/scripts/local-collab-worktree-gpt-final-apply-policy-check.js +0 -63
  288. package/dist/scripts/local-llm-all-pipelines-check.js +0 -11
  289. package/dist/scripts/local-llm-cache-performance-check.js +0 -10
  290. package/dist/scripts/local-llm-capability-check.js +0 -14
  291. package/dist/scripts/local-llm-smoke-check.js +0 -23
  292. package/dist/scripts/local-llm-structured-output-check.js +0 -11
  293. package/dist/scripts/local-llm-throughput-check.js +0 -10
  294. package/dist/scripts/local-llm-tool-call-repair-check.js +0 -10
  295. package/dist/scripts/local-llm-warmup-check.js +0 -11
  296. package/dist/scripts/loop-blocker-check.js +0 -15
  297. package/dist/scripts/mad-preflight-blocks-unreadable-config-check.js +0 -35
  298. package/dist/scripts/mad-sks-actual-executor-blackbox.js +0 -5
  299. package/dist/scripts/mad-sks-app-ui-no-mutation-check.js +0 -92
  300. package/dist/scripts/mad-sks-audit-proof-check.js +0 -34
  301. package/dist/scripts/mad-sks-db-executor-check.js +0 -5
  302. package/dist/scripts/mad-sks-executor-proof-graph-check.js +0 -5
  303. package/dist/scripts/mad-sks-fast-mode-propagation-check.js +0 -24
  304. package/dist/scripts/mad-sks-file-write-executor-check.js +0 -5
  305. package/dist/scripts/mad-sks-immutable-harness-check.js +0 -36
  306. package/dist/scripts/mad-sks-no-harness-modification-check.js +0 -25
  307. package/dist/scripts/mad-sks-package-executor-check.js +0 -5
  308. package/dist/scripts/mad-sks-permission-model-check.js +0 -22
  309. package/dist/scripts/mad-sks-rollback-apply-check.js +0 -5
  310. package/dist/scripts/mad-sks-service-executor-check.js +0 -5
  311. package/dist/scripts/mad-sks-shell-executor-check.js +0 -5
  312. package/dist/scripts/mad-sks-write-guard-check.js +0 -28
  313. package/dist/scripts/mad-sks-zellij-default-pane-worker-check.js +0 -37
  314. package/dist/scripts/mad-sks-zellij-launch-check.js +0 -102
  315. package/dist/scripts/mcp-0-134-modernization-check.js +0 -55
  316. package/dist/scripts/mcp-readonly-concurrency-check.js +0 -17
  317. package/dist/scripts/mcp-readonly-runtime-scheduler-check.js +0 -20
  318. package/dist/scripts/mcp-tool-naming-parity-check.js +0 -16
  319. package/dist/scripts/memory-summary-rebuild-check.js +0 -22
  320. package/dist/scripts/mutation-callsite-coverage-check.js +0 -180
  321. package/dist/scripts/naruto-active-pool-check.js +0 -39
  322. package/dist/scripts/naruto-actual-worker-control-plane-check.js +0 -56
  323. package/dist/scripts/naruto-allocation-policy-check.js +0 -33
  324. package/dist/scripts/naruto-allocation-runtime-wiring-check.js +0 -92
  325. package/dist/scripts/naruto-concurrency-governor-check.js +0 -53
  326. package/dist/scripts/naruto-extreme-parallelism-check.js +0 -22
  327. package/dist/scripts/naruto-extreme-parallelism-real-check.js +0 -43
  328. package/dist/scripts/naruto-gpt-final-pack-check.js +0 -34
  329. package/dist/scripts/naruto-orchestrator-runtime-source-check.js +0 -70
  330. package/dist/scripts/naruto-parallel-patch-apply-check.js +0 -41
  331. package/dist/scripts/naruto-readonly-routing-check.js +0 -116
  332. package/dist/scripts/naruto-real-active-pool-check.js +0 -39
  333. package/dist/scripts/naruto-real-active-pool-runtime-check.js +0 -55
  334. package/dist/scripts/naruto-rebalance-policy-check.js +0 -41
  335. package/dist/scripts/naruto-role-distribution-check.js +0 -23
  336. package/dist/scripts/naruto-shadow-clone-swarm-check.js +0 -153
  337. package/dist/scripts/naruto-verification-pool-check.js +0 -36
  338. package/dist/scripts/naruto-work-graph-check.js +0 -24
  339. package/dist/scripts/naruto-worktree-coding-blackbox.js +0 -29
  340. package/dist/scripts/naruto-worktree-coding-check.js +0 -44
  341. package/dist/scripts/naruto-worktree-gpt-final-check.js +0 -45
  342. package/dist/scripts/naruto-worktree-zellij-ui-check.js +0 -28
  343. package/dist/scripts/naruto-zellij-dynamic-right-column-check.js +0 -48
  344. package/dist/scripts/naruto-zellij-massive-ui-check.js +0 -23
  345. package/dist/scripts/non-recursive-pipeline-check.js +0 -68
  346. package/dist/scripts/npm-publish-performance-check.js +0 -65
  347. package/dist/scripts/official-docs-compat-report.js +0 -304
  348. package/dist/scripts/packlist-performance-check.js +0 -83
  349. package/dist/scripts/parallel-verification-engine-check.js +0 -85
  350. package/dist/scripts/postinstall-safe-side-effects-check.js +0 -65
  351. package/dist/scripts/ppt-full-e2e-artifact-graph-check.js +0 -40
  352. package/dist/scripts/ppt-full-e2e-blackbox-check.js +0 -109
  353. package/dist/scripts/ppt-image-voxel-relations-check.js +0 -9
  354. package/dist/scripts/ppt-imagegen-blackbox-check.js +0 -46
  355. package/dist/scripts/ppt-imagegen-review-fixture-check.js +0 -6
  356. package/dist/scripts/ppt-issue-extraction-fixture-check.js +0 -7
  357. package/dist/scripts/ppt-no-mock-as-real-check.js +0 -8
  358. package/dist/scripts/ppt-no-text-fallback-check.js +0 -7
  359. package/dist/scripts/ppt-proof-trust-fixture-check.js +0 -10
  360. package/dist/scripts/ppt-real-export-adapter-check.js +0 -13
  361. package/dist/scripts/ppt-real-imagegen-smoke-check.js +0 -42
  362. package/dist/scripts/ppt-real-imagegen-wiring-check.js +0 -16
  363. package/dist/scripts/ppt-reexport-rereview-check.js +0 -19
  364. package/dist/scripts/ppt-slide-export-fixture-check.js +0 -7
  365. package/dist/scripts/prepublish-fast-check.js +0 -128
  366. package/dist/scripts/priority-full-closure-check.js +0 -12
  367. package/dist/scripts/product-design-auto-install-check.js +0 -119
  368. package/dist/scripts/product-design-plugin-routing-check.js +0 -101
  369. package/dist/scripts/prompt-placeholder-guard-check.js +0 -33
  370. package/dist/scripts/provider-badge-context-check.js +0 -26
  371. package/dist/scripts/provider-context-config-toml-check.js +0 -63
  372. package/dist/scripts/python-codex-sdk-all-pipelines-check.js +0 -47
  373. package/dist/scripts/python-codex-sdk-capability-check.js +0 -75
  374. package/dist/scripts/python-codex-sdk-sandbox-policy-check.js +0 -10
  375. package/dist/scripts/python-codex-sdk-stream-bridge-check.js +0 -12
  376. package/dist/scripts/python-tools-smoke-check.js +0 -71
  377. package/dist/scripts/qa-actual-route-backfill-check.js +0 -5
  378. package/dist/scripts/qa-backfill-route-blackbox.js +0 -5
  379. package/dist/scripts/qa-patch-swarm-route-blackbox.js +0 -10
  380. package/dist/scripts/readme-architecture-imagegen-official-check.js +0 -448
  381. package/dist/scripts/release-cache-glob-hashing-check.js +0 -42
  382. package/dist/scripts/release-dag-full-coverage-check.js +0 -53
  383. package/dist/scripts/release-dist-freshness-check.js +0 -8
  384. package/dist/scripts/release-dynamic-performance-check.js +0 -103
  385. package/dist/scripts/release-gate-budget-check.js +0 -36
  386. package/dist/scripts/release-gate-dag-runner-check.js +0 -17
  387. package/dist/scripts/release-metadata-1-11-check.js +0 -37
  388. package/dist/scripts/release-metadata-1-12-check.js +0 -48
  389. package/dist/scripts/release-metadata-1-13-check.js +0 -53
  390. package/dist/scripts/release-metadata-1-14-check.js +0 -63
  391. package/dist/scripts/release-metadata-1-16-check.js +0 -81
  392. package/dist/scripts/release-metadata-1-17-check.js +0 -51
  393. package/dist/scripts/release-metadata-1-19-check.js +0 -371
  394. package/dist/scripts/release-metadata-check.js +0 -7
  395. package/dist/scripts/release-native-agent-fixture-check.js +0 -41
  396. package/dist/scripts/release-parallel-check.js +0 -374
  397. package/dist/scripts/release-parallel-full-coverage-check.js +0 -13
  398. package/dist/scripts/release-parallel-speed-budget-check.js +0 -79
  399. package/dist/scripts/release-provenance-check.js +0 -150
  400. package/dist/scripts/release-readiness-report.js +0 -1146
  401. package/dist/scripts/release-real-check.js +0 -330
  402. package/dist/scripts/release-registry-check.js +0 -344
  403. package/dist/scripts/release-runtime-truth-matrix-check.js +0 -47
  404. package/dist/scripts/release-stability-report-check.js +0 -99
  405. package/dist/scripts/release-version-truth-check.js +0 -134
  406. package/dist/scripts/research-actual-route-backfill-check.js +0 -5
  407. package/dist/scripts/research-backfill-route-blackbox.js +0 -5
  408. package/dist/scripts/research-quality-gate-check.js +0 -86
  409. package/dist/scripts/responses-retry-policy-centralized-check.js +0 -19
  410. package/dist/scripts/retention-cleanup-safety-check.js +0 -155
  411. package/dist/scripts/route-blackbox-realism-check.js +0 -21
  412. package/dist/scripts/route-proof-artifact-structure-check.js +0 -145
  413. package/dist/scripts/runtime-dist-parity-check.js +0 -78
  414. package/dist/scripts/runtime-no-mjs-scripts-check.js +0 -45
  415. package/dist/scripts/runtime-no-src-mjs-check.js +0 -32
  416. package/dist/scripts/runtime-no-tmux-check.js +0 -113
  417. package/dist/scripts/runtime-ts-python-boundary-check.js +0 -59
  418. package/dist/scripts/runtime-ts-rust-boundary-check.js +0 -74
  419. package/dist/scripts/runtime-ts-source-of-truth-check.js +0 -55
  420. package/dist/scripts/safety-check.js +0 -23
  421. package/dist/scripts/shared-memory-fixture-check.js +0 -27
  422. package/dist/scripts/side-effect-runtime-report-check.js +0 -19
  423. package/dist/scripts/side-effect-zero-gate-check.js +0 -226
  424. package/dist/scripts/sks-1-11-fixture-check.js +0 -130
  425. package/dist/scripts/source-intelligence-all-modes-check.js +0 -32
  426. package/dist/scripts/source-intelligence-policy-check.js +0 -13
  427. package/dist/scripts/strategy-adhd-orchestrating-gate-check.js +0 -22
  428. package/dist/scripts/strategy-file-ownership-plan-check.js +0 -18
  429. package/dist/scripts/strategy-parallel-modification-plan-check.js +0 -19
  430. package/dist/scripts/strategy-verification-rollback-dag-check.js +0 -19
  431. package/dist/scripts/team-actual-route-backfill-check.js +0 -5
  432. package/dist/scripts/team-backfill-route-blackbox.js +0 -5
  433. package/dist/scripts/team-parallel-write-blackbox.js +0 -55
  434. package/dist/scripts/team-patch-swarm-route-blackbox.js +0 -10
  435. package/dist/scripts/terminal-keyboard-enhancement-safety-check.js +0 -12
  436. package/dist/scripts/terminal-tui-output-stability-check.js +0 -35
  437. package/dist/scripts/test-no-orphan-dist-imports-check.js +0 -73
  438. package/dist/scripts/trust-fixture-check.js +0 -33
  439. package/dist/scripts/typescript-migration-report.js +0 -78
  440. package/dist/scripts/ultra-router-auto-router-check.js +0 -33
  441. package/dist/scripts/ultra-router-classification-check.js +0 -28
  442. package/dist/scripts/ux-patch-swarm-route-blackbox.js +0 -10
  443. package/dist/scripts/ux-ppt-structured-extraction-check.js +0 -21
  444. package/dist/scripts/ux-review-extract-real-callouts-fixture-check.js +0 -8
  445. package/dist/scripts/ux-review-extract-wires-real-extractor-check.js +0 -15
  446. package/dist/scripts/ux-review-generate-callouts-fixture-check.js +0 -9
  447. package/dist/scripts/ux-review-image-voxel-relations-check.js +0 -31
  448. package/dist/scripts/ux-review-imagegen-blackbox-check.js +0 -67
  449. package/dist/scripts/ux-review-no-fake-callouts-check.js +0 -8
  450. package/dist/scripts/ux-review-no-text-fallback-check.js +0 -25
  451. package/dist/scripts/ux-review-patch-diff-recheck-check.js +0 -20
  452. package/dist/scripts/ux-review-patch-handoff-fixture-check.js +0 -8
  453. package/dist/scripts/ux-review-real-imagegen-smoke-check.js +0 -31
  454. package/dist/scripts/ux-review-real-loop-fixture-check.js +0 -24
  455. package/dist/scripts/ux-review-recapture-recheck-fixture-check.js +0 -8
  456. package/dist/scripts/ux-review-run-wires-imagegen-check.js +0 -11
  457. package/dist/scripts/worker-pane-communication-contract-check.js +0 -54
  458. package/dist/scripts/wrongness-fixture-check.js +0 -65
  459. package/dist/scripts/xai-mcp-capability-check.js +0 -14
  460. package/dist/scripts/zellij-capability-check.js +0 -15
  461. package/dist/scripts/zellij-dashboard-pane-check.js +0 -70
  462. package/dist/scripts/zellij-developer-controls-check.js +0 -20
  463. package/dist/scripts/zellij-doctor-readiness-check.js +0 -63
  464. package/dist/scripts/zellij-dynamic-pane-lifecycle-check.js +0 -21
  465. package/dist/scripts/zellij-first-slot-down-stack-check.js +0 -20
  466. package/dist/scripts/zellij-first-slot-down-stack-real-check.js +0 -356
  467. package/dist/scripts/zellij-initial-main-only-blackbox.js +0 -28
  468. package/dist/scripts/zellij-lane-renderer-check.js +0 -65
  469. package/dist/scripts/zellij-launch-command-truth-check.js +0 -75
  470. package/dist/scripts/zellij-layout-valid-check.js +0 -90
  471. package/dist/scripts/zellij-pane-proof-check.js +0 -59
  472. package/dist/scripts/zellij-real-session-cleanup-check.js +0 -21
  473. package/dist/scripts/zellij-real-session-heartbeat-check.js +0 -49
  474. package/dist/scripts/zellij-real-session-launch-check.js +0 -57
  475. package/dist/scripts/zellij-right-column-headless-overflow-check.js +0 -22
  476. package/dist/scripts/zellij-right-column-manager-check.js +0 -27
  477. package/dist/scripts/zellij-screen-proof-check.js +0 -45
  478. package/dist/scripts/zellij-slot-column-anchor-check.js +0 -66
  479. package/dist/scripts/zellij-slot-only-ui-check.js +0 -26
  480. package/dist/scripts/zellij-slot-pane-renderer-check.js +0 -106
  481. package/dist/scripts/zellij-slot-renderer-proof-semantics-check.js +0 -59
  482. package/dist/scripts/zellij-spawn-on-demand-layout-check.js +0 -40
  483. package/dist/scripts/zellij-ui-design-check.js +0 -105
  484. package/dist/scripts/zellij-worker-pane-manager-check.js +0 -109
  485. package/dist/scripts/zellij-worker-pane-manager-single-owner-check.js +0 -47
  486. package/dist/scripts/zellij-worker-pane-real-ui-blackbox.js +0 -202
  487. package/dist/scripts/zellij-worker-pane-spawn-order-check.js +0 -35
  488. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/permission-request.command.input.schema.json +0 -61
  489. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/permission-request.command.output.schema.json +0 -103
  490. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/post-compact.command.input.schema.json +0 -52
  491. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/post-compact.command.output.schema.json +0 -24
  492. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/post-tool-use.command.input.schema.json +0 -67
  493. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/post-tool-use.command.output.schema.json +0 -84
  494. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/pre-compact.command.input.schema.json +0 -52
  495. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/pre-compact.command.output.schema.json +0 -24
  496. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/pre-tool-use.command.input.schema.json +0 -65
  497. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/pre-tool-use.command.output.schema.json +0 -105
  498. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/session-start.command.input.schema.json +0 -59
  499. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/session-start.command.output.schema.json +0 -63
  500. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/snapshot-metadata.json +0 -31
  501. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/stop.command.input.schema.json +0 -63
  502. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/stop.command.output.schema.json +0 -45
  503. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/user-prompt-submit.command.input.schema.json +0 -59
  504. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/user-prompt-submit.command.output.schema.json +0 -81
@@ -0,0 +1,114 @@
1
+ import { normalizeClaimEvidenceMatrix } from './claim-evidence-matrix.js';
2
+ export async function buildClaimEvidenceMatrixFromSourceShards(input) {
3
+ const sources = [
4
+ ...(Array.isArray(input.sourceLedger?.sources) ? input.sourceLedger.sources : []),
5
+ ...(Array.isArray(input.sourceLedger?.counterevidence_sources) ? input.sourceLedger.counterevidence_sources : [])
6
+ ];
7
+ const noveltyEntries = Array.isArray(input.noveltyLedger?.entries) ? input.noveltyLedger.entries : [];
8
+ const candidates = new Map();
9
+ for (const entry of noveltyEntries) {
10
+ const id = String(entry?.id || '').trim();
11
+ if (!id)
12
+ continue;
13
+ candidates.set(id, {
14
+ id,
15
+ claim: String(entry?.claim || entry?.title || id),
16
+ claim_type: entry?.type === 'implementation_guidance' ? 'implementation_guidance' : 'hypothesis',
17
+ importance: candidates.size < 2 ? 'critical' : 'high',
18
+ source_ids: normalizeStringList(entry?.source_ids || entry?.evidence),
19
+ counterevidence_ids: normalizeStringList(entry?.counterevidence_ids || entry?.falsifiers),
20
+ test_or_probe: String(entry?.next_experiment || entry?.test_or_probe || '').trim()
21
+ });
22
+ }
23
+ for (const source of sources) {
24
+ const claimIds = normalizeStringList(source?.claim_ids);
25
+ if (claimIds.length) {
26
+ for (const claimId of claimIds) {
27
+ const existing = candidates.get(claimId) || {
28
+ id: claimId,
29
+ claim: claimTextFromSource(source, claimId),
30
+ claim_type: 'inference',
31
+ importance: candidates.size < 2 ? 'critical' : candidates.size < 8 ? 'high' : 'medium',
32
+ source_ids: [],
33
+ counterevidence_ids: [],
34
+ test_or_probe: ''
35
+ };
36
+ if (source?.stance === 'undermines')
37
+ existing.counterevidence_ids = [...new Set([...(existing.counterevidence_ids || []), source.id])];
38
+ else
39
+ existing.source_ids = [...new Set([...(existing.source_ids || []), source.id])];
40
+ if (!existing.test_or_probe)
41
+ existing.test_or_probe = `Probe ${claimId} against supporting and undermining source layers.`;
42
+ candidates.set(claimId, existing);
43
+ }
44
+ }
45
+ else if (String(source?.notes || '').trim()) {
46
+ const id = `hypothesis-${candidates.size + 1}`;
47
+ candidates.set(id, {
48
+ id,
49
+ claim: String(source.notes).slice(0, 240),
50
+ claim_type: 'hypothesis',
51
+ importance: 'medium',
52
+ source_ids: source?.stance === 'undermines' ? [] : [source.id].filter(Boolean),
53
+ counterevidence_ids: source?.stance === 'undermines' ? [source.id].filter(Boolean) : [],
54
+ test_or_probe: `Turn ${source.id || id} notes into a decisive source-backed probe.`
55
+ });
56
+ }
57
+ }
58
+ const falsificationCounterIds = new Set((Array.isArray(input.falsificationLedger?.cases) ? input.falsificationLedger.cases : [])
59
+ .flatMap((row) => [...normalizeStringList(row?.counterevidence_source_ids), ...normalizeStringList(row?.source_ids)]));
60
+ const claims = [...candidates.values()].slice(0, Math.max(8, candidates.size)).map((candidate, index) => {
61
+ const sourceIds = normalizeStringList(candidate.source_ids).filter((id) => sourceById(sources, id));
62
+ const counterIds = normalizeStringList(candidate.counterevidence_ids).filter((id) => sourceById(sources, id) || falsificationCounterIds.has(id));
63
+ const layers = sourceLayersForSourceIds(sources, [...sourceIds, ...counterIds]);
64
+ return {
65
+ id: candidate.id,
66
+ claim: candidate.claim,
67
+ claim_type: candidate.claim_type,
68
+ importance: candidate.importance || (index < 2 ? 'critical' : 'high'),
69
+ source_ids: sourceIds,
70
+ local_evidence_ids: sources.filter((source) => source.layer === 'local_project_evidence' && normalizeStringList(source.claim_ids).includes(candidate.id)).map((source) => source.id),
71
+ counterevidence_ids: counterIds,
72
+ triangulation: {
73
+ source_layers: layers,
74
+ independent_confirmation_count: layers.length,
75
+ conflicts: counterIds.length ? [`counterevidence:${counterIds.join(',')}`] : []
76
+ },
77
+ confidence: layers.length >= 3 && counterIds.length ? 'high' : layers.length >= 2 ? 'medium' : 'low',
78
+ falsifiable: true,
79
+ test_or_probe: candidate.test_or_probe || `Run a source-layer replication probe for ${candidate.id}.`
80
+ };
81
+ });
82
+ const unsupported = claims
83
+ .filter((claim) => {
84
+ const important = claim.importance === 'high' || claim.importance === 'critical';
85
+ return important && (claim.triangulation.source_layers.length < 2 || (claim.importance === 'critical' && claim.counterevidence_ids.length === 0));
86
+ })
87
+ .map((claim) => claim.id);
88
+ return normalizeClaimEvidenceMatrix({
89
+ schema: 'sks.claim-evidence-matrix.v1',
90
+ mission_id: input.plan?.mission_id || '',
91
+ claims,
92
+ key_claim_ids: claims.slice(0, 8).map((claim) => claim.id),
93
+ unsupported_claims: unsupported,
94
+ triangulated_claim_count: claims.filter((claim) => claim.triangulation.source_layers.length >= 2).length,
95
+ blockers: unsupported.map((id) => `unsupported_important_claim:${id}`)
96
+ });
97
+ }
98
+ function claimTextFromSource(source, claimId) {
99
+ const notes = String(source?.notes || '').trim();
100
+ if (notes)
101
+ return `${claimId}: ${notes.slice(0, 220)}`;
102
+ return `${claimId}: Evidence row ${source?.id || 'unknown'} contributes to this research claim.`;
103
+ }
104
+ function sourceById(sources, id) {
105
+ return sources.find((source) => String(source?.id || '') === id) || null;
106
+ }
107
+ function sourceLayersForSourceIds(sources, ids) {
108
+ const idSet = new Set(ids);
109
+ return [...new Set(sources.filter((source) => idSet.has(String(source?.id || ''))).map((source) => String(source?.layer || '')).filter(Boolean))];
110
+ }
111
+ function normalizeStringList(value) {
112
+ return [...new Set((Array.isArray(value) ? value : value == null ? [] : [value]).map((item) => String(item || '').trim()).filter(Boolean))];
113
+ }
114
+ //# sourceMappingURL=research-claim-builder.js.map
@@ -1,25 +1,129 @@
1
1
  import path from 'node:path';
2
2
  import { appendJsonlBounded, nowIso, writeJsonAtomic } from '../fsx.js';
3
3
  import { runResearchStage } from './research-stage-runner.js';
4
- export async function runResearchCycle(dir, graph = null, opts = {}) {
4
+ export async function runResearchCycle(inputOrDir, legacyGraph = null, legacyOpts = {}) {
5
+ const input = typeof inputOrDir === 'string'
6
+ ? {
7
+ root: process.cwd(),
8
+ dir: inputOrDir,
9
+ plan: null,
10
+ graph: legacyGraph,
11
+ cycle: Number(legacyOpts.cycle || 0),
12
+ backend: legacyOpts.mock ? 'mock' : 'deterministic',
13
+ timeoutMs: Number(legacyOpts.timeoutMs || 120000),
14
+ maxParallelStages: Number(legacyOpts.maxParallelStages || legacyOpts.maxParallel || 4),
15
+ mock: legacyOpts.mock === true
16
+ }
17
+ : inputOrDir;
5
18
  const startedAt = nowIso();
6
- const stages = Array.isArray(graph?.work_items) ? graph.work_items : [];
7
- const stageResults = [];
8
- for (const stage of stages) {
9
- stageResults.push(await runResearchStage(dir, stage, { status: opts.status || 'planned', startedAt }));
19
+ const stages = normalizeStages(input.graph);
20
+ const pending = new Map(stages.map((stage) => [String(stage.id), stage]));
21
+ const completed = new Map();
22
+ const running = new Map();
23
+ const blockers = [];
24
+ const maxParallel = Math.max(1, Math.min(16, Number(input.maxParallelStages || 4)));
25
+ let maxObservedParallel = 0;
26
+ while (pending.size || running.size) {
27
+ const ready = readyStages([...pending.values()], completed);
28
+ while (running.size < maxParallel && ready.length) {
29
+ const stage = ready.shift();
30
+ if (!stage)
31
+ break;
32
+ pending.delete(String(stage.id));
33
+ const promise = runResearchStage({ ...input, stage }).catch((err) => failureStage(input, stage, err));
34
+ running.set(String(stage.id), promise);
35
+ maxObservedParallel = Math.max(maxObservedParallel, running.size);
36
+ }
37
+ if (!running.size) {
38
+ const blockedIds = [...pending.keys()];
39
+ blockers.push(...blockedIds.map((id) => `stage_dependencies_unresolved:${id}`));
40
+ for (const stage of pending.values()) {
41
+ const failed = failureStage(input, stage, new Error(`dependencies unresolved: ${(stage.dependencies || []).join(',')}`));
42
+ completed.set(String(stage.id), failed);
43
+ }
44
+ pending.clear();
45
+ break;
46
+ }
47
+ const done = await Promise.race([...running.entries()].map(async ([id, promise]) => ({ id, result: await promise })));
48
+ running.delete(done.id);
49
+ completed.set(done.id, done.result);
50
+ if (done.result.status !== 'passed' && pendingStageRequired(stages.find((stage) => String(stage.id) === done.id))) {
51
+ blockers.push(...(done.result.blockers.length ? done.result.blockers.map((blocker) => `${done.id}:${blocker}`) : [`${done.id}:stage_not_passed`]));
52
+ }
10
53
  }
54
+ const stageResults = [...completed.values()];
11
55
  const record = {
12
- schema: 'sks.research-cycle-runner.v1',
13
- cycle: opts.cycle || 0,
56
+ schema: 'sks.research-cycle-runner.v2',
57
+ cycle: input.cycle,
14
58
  readonly: true,
15
59
  started_at: startedAt,
16
60
  completed_at: nowIso(),
17
61
  stage_count: stageResults.length,
18
- status: opts.status || 'planned',
19
- stages: stageResults.map((stage) => stage.stage_id)
62
+ status: blockers.length ? 'blocked' : 'passed',
63
+ blockers: [...new Set(blockers)],
64
+ stages: stageResults.map((stage) => stage.stage_id),
65
+ stage_results: stageResults,
66
+ parallelism: {
67
+ max_parallel_stages: maxParallel,
68
+ max_observed_parallel: maxObservedParallel,
69
+ stage_count: stageResults.length,
70
+ critical_path_length: criticalPathLength(stages)
71
+ },
72
+ legacy_final_md_loop: false
20
73
  };
21
- await writeJsonAtomic(path.join(dir, 'research-cycle-runner.json'), record);
22
- await appendJsonlBounded(path.join(dir, 'events.jsonl'), { ts: nowIso(), type: 'research.cycle_runner.recorded', cycle: record.cycle, stage_count: record.stage_count });
74
+ await writeJsonAtomic(path.join(input.dir, 'research', `cycle-${input.cycle}`, 'research-cycle-runner.json'), record);
75
+ await writeJsonAtomic(path.join(input.dir, 'research-cycle-runner.json'), record);
76
+ await appendJsonlBounded(path.join(input.dir, 'events.jsonl'), { ts: nowIso(), type: 'research.cycle_runner.completed', cycle: record.cycle, stage_count: record.stage_count, status: record.status, max_observed_parallel: maxObservedParallel });
23
77
  return record;
24
78
  }
79
+ export function readyStages(pending, completed) {
80
+ return pending.filter((stage) => (Array.isArray(stage.dependencies) ? stage.dependencies : []).every((id) => completed.has(String(id))));
81
+ }
82
+ function normalizeStages(graph) {
83
+ const stages = Array.isArray(graph?.work_items) ? graph.work_items : [];
84
+ return stages.map((stage, index) => ({
85
+ ...stage,
86
+ id: String(stage?.id || `research-stage-${index + 1}`),
87
+ dependencies: Array.isArray(stage?.dependencies) ? stage.dependencies.map(String) : []
88
+ }));
89
+ }
90
+ function pendingStageRequired(stage) {
91
+ return stage?.required !== false;
92
+ }
93
+ function failureStage(input, stage, err) {
94
+ const ts = nowIso();
95
+ return {
96
+ schema: 'sks.research-stage-result.v1',
97
+ mission_id: String(input.plan?.mission_id || ''),
98
+ cycle: input.cycle,
99
+ stage_id: String(stage?.id || 'unknown'),
100
+ stage_kind: 'verification',
101
+ status: 'failed',
102
+ started_at: ts,
103
+ completed_at: ts,
104
+ input_artifacts: [],
105
+ output_artifacts: [],
106
+ backend: input.backend,
107
+ worker_result_path: null,
108
+ blockers: [err instanceof Error ? err.message : String(err)],
109
+ metrics: {}
110
+ };
111
+ }
112
+ function criticalPathLength(stages) {
113
+ const byId = new Map(stages.map((stage) => [String(stage.id), stage]));
114
+ const memo = new Map();
115
+ const visit = (id, seen = new Set()) => {
116
+ if (memo.has(id))
117
+ return memo.get(id);
118
+ if (seen.has(id))
119
+ return 1;
120
+ seen.add(id);
121
+ const stage = byId.get(id);
122
+ const deps = Array.isArray(stage?.dependencies) ? stage.dependencies.map(String) : [];
123
+ const value = 1 + (deps.length ? Math.max(...deps.map((dep) => visit(dep, new Set(seen)))) : 0);
124
+ memo.set(id, value);
125
+ return value;
126
+ };
127
+ return stages.length ? Math.max(...stages.map((stage) => visit(String(stage.id)))) : 0;
128
+ }
25
129
  //# sourceMappingURL=research-cycle-runner.js.map
@@ -1,5 +1,6 @@
1
1
  import path from 'node:path';
2
2
  import { nowIso, readJson, readText, writeJsonAtomic } from '../fsx.js';
3
+ import { runCodexTask } from '../codex-control/codex-task-runner.js';
3
4
  import { analyzeResearchReportQuality } from './research-report-quality.js';
4
5
  import { validateClaimEvidenceMatrix } from './claim-evidence-matrix.js';
5
6
  import { validateImplementationBlueprint } from './implementation-blueprint.js';
@@ -7,10 +8,12 @@ import { validateExperimentPlan } from './experiment-plan.js';
7
8
  import { validateReplicationPack } from './replication-pack.js';
8
9
  import { validateFalsificationCoverage } from './falsification.js';
9
10
  export const RESEARCH_FINAL_REVIEW_ARTIFACT = 'research-final-review.json';
11
+ export const RESEARCH_STATIC_FINAL_REVIEW_ARTIFACT = 'research-final-review.static.json';
12
+ export const RESEARCH_CODEX_FINAL_REVIEW_ARTIFACT = 'research-final-review.codex.json';
10
13
  export async function readResearchFinalReview(dir) {
11
14
  return readJson(path.join(dir, RESEARCH_FINAL_REVIEW_ARTIFACT), null);
12
15
  }
13
- export async function runResearchFinalReviewer(dir, input = {}) {
16
+ export async function runResearchStaticFinalReview(dir, input = {}) {
14
17
  const contract = input.contract || await readJson(path.join(dir, 'research-quality-contract.json'), null);
15
18
  const sourceLedger = input.sourceLedger || await readJson(path.join(dir, 'source-ledger.json'), null);
16
19
  const claimMatrix = input.claimMatrix || await readJson(path.join(dir, 'claim-evidence-matrix.json'), null);
@@ -52,7 +55,184 @@ export async function runResearchFinalReviewer(dir, input = {}) {
52
55
  },
53
56
  reviewer: 'research_final_reviewer_static_gate'
54
57
  };
58
+ await writeJsonAtomic(path.join(dir, RESEARCH_STATIC_FINAL_REVIEW_ARTIFACT), review);
59
+ return review;
60
+ }
61
+ export async function runResearchCodexFinalReviewer(input) {
62
+ if (input.staticReview?.approved !== true) {
63
+ const skipped = {
64
+ schema: 'sks.research-codex-final-review.v1',
65
+ reviewed_at: nowIso(),
66
+ verdict: 'revise',
67
+ unsupported_claim_ids: [],
68
+ missing_evidence: [],
69
+ blueprint_findings: [],
70
+ falsification_findings: [],
71
+ template_like_prose: true,
72
+ source_density_ok: false,
73
+ implementation_concreteness_ok: false,
74
+ evidence_bound_synthesis_ok: false,
75
+ required_revisions: ['static_review_failed'],
76
+ confidence: 'low',
77
+ skipped: true,
78
+ skip_reason: 'static_review_failed'
79
+ };
80
+ await writeJsonAtomic(path.join(input.dir, RESEARCH_CODEX_FINAL_REVIEW_ARTIFACT), skipped);
81
+ return skipped;
82
+ }
83
+ if (input.mock === true) {
84
+ const approved = {
85
+ schema: 'sks.research-codex-final-review.v1',
86
+ reviewed_at: nowIso(),
87
+ verdict: 'approve',
88
+ unsupported_claim_ids: [],
89
+ missing_evidence: [],
90
+ blueprint_findings: ['mock final reviewer approves the complete package fixture'],
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,
96
+ required_revisions: [],
97
+ confidence: 'high',
98
+ mock: true
99
+ };
100
+ await writeJsonAtomic(path.join(input.dir, RESEARCH_CODEX_FINAL_REVIEW_ARTIFACT), approved);
101
+ return approved;
102
+ }
103
+ const result = await runCodexTask({
104
+ route: '$Research',
105
+ tier: 'worker',
106
+ missionId: String(input.plan?.mission_id || 'research-final-review'),
107
+ workItemId: 'research_final_review',
108
+ cwd: input.root,
109
+ prompt: buildResearchFinalReviewPrompt(input.plan, input.staticReview),
110
+ outputSchema: researchCodexFinalReviewSchema,
111
+ outputSchemaId: 'sks.research-codex-final-review.v1',
112
+ sandboxPolicy: 'read-only',
113
+ requestedScopeContract: {
114
+ id: 'research-final-review',
115
+ route: '$Research',
116
+ read_only: true,
117
+ allowed_paths: [`.sneakoscope/missions/${input.plan?.mission_id || ''}/`],
118
+ write_paths: [],
119
+ allowed_write_prefixes: [`.sneakoscope/missions/${input.plan?.mission_id || ''}/`],
120
+ source_mutation_allowed: false
121
+ },
122
+ backendPreference: input.backendPreference || ['codex-sdk', 'python-codex-sdk'],
123
+ localLlmPolicy: { mode: 'disabled', requiresGptFinal: true },
124
+ allowLocalLlm: false,
125
+ mutationLedgerRoot: path.join(input.dir, 'research', 'final-review-codex-control'),
126
+ reliabilityPolicy: {
127
+ timeoutClass: 'standard',
128
+ idleTimeoutMs: input.timeoutMs || 120000
129
+ }
130
+ });
131
+ const worker = await readJson(result.workerResultPath, null);
132
+ const review = normalizeCodexReview(worker, result);
133
+ await writeJsonAtomic(path.join(input.dir, RESEARCH_CODEX_FINAL_REVIEW_ARTIFACT), review);
134
+ return review;
135
+ }
136
+ export async function runResearchFinalReviewer(dir, input = {}) {
137
+ const staticReview = await runResearchStaticFinalReview(dir, input);
138
+ const existingCodex = await readJson(path.join(dir, RESEARCH_CODEX_FINAL_REVIEW_ARTIFACT), null);
139
+ const codexReview = existingCodex || (input.mock === true ? await runResearchCodexFinalReviewer({
140
+ root: input.root || process.cwd(),
141
+ dir,
142
+ plan: input.plan || await readJson(path.join(dir, 'research-plan.json'), null),
143
+ staticReview,
144
+ mock: true
145
+ }) : null);
146
+ const codexApproved = codexReview?.verdict === 'approve';
147
+ const codexRequired = input.codexRequired !== false;
148
+ const blockers = [
149
+ ...(Array.isArray(staticReview?.blockers) ? staticReview.blockers : []),
150
+ ...(codexRequired && !codexReview ? ['research_codex_final_review_missing'] : []),
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'] : []),
156
+ ...(Array.isArray(codexReview?.required_revisions) ? codexReview.required_revisions.map((revision) => `codex_revision:${revision}`) : [])
157
+ ];
158
+ const review = {
159
+ schema: 'sks.research-final-reviewer.v2',
160
+ reviewed_at: nowIso(),
161
+ approved: staticReview?.approved === true && (!codexRequired || codexApproved) && blockers.length === 0,
162
+ blockers: [...new Set(blockers)],
163
+ static_review: staticReview,
164
+ codex_review: codexReview,
165
+ reviewer: 'research_final_reviewer_static_plus_codex_gate'
166
+ };
55
167
  await writeJsonAtomic(path.join(dir, RESEARCH_FINAL_REVIEW_ARTIFACT), review);
56
168
  return review;
57
169
  }
170
+ function buildResearchFinalReviewPrompt(plan, staticReview) {
171
+ return [
172
+ 'You are the Codex/GPT final reviewer for an SKS Research package.',
173
+ `Mission: ${plan?.mission_id || 'unknown'}`,
174
+ `Prompt: ${plan?.prompt || ''}`,
175
+ '',
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.',
179
+ 'Return only JSON matching sks.research-codex-final-review.v1 with verdict approve, revise, or reject.',
180
+ '',
181
+ `Static review summary:\n${JSON.stringify(staticReview, null, 2).slice(0, 12000)}`
182
+ ].join('\n');
183
+ }
184
+ function normalizeCodexReview(worker, result) {
185
+ if (!result?.ok) {
186
+ return {
187
+ schema: 'sks.research-codex-final-review.v1',
188
+ reviewed_at: nowIso(),
189
+ verdict: 'revise',
190
+ unsupported_claim_ids: [],
191
+ missing_evidence: [],
192
+ blueprint_findings: [],
193
+ falsification_findings: [],
194
+ template_like_prose: false,
195
+ source_density_ok: false,
196
+ implementation_concreteness_ok: false,
197
+ evidence_bound_synthesis_ok: false,
198
+ required_revisions: Array.isArray(result?.blockers) ? result.blockers : ['codex_final_reviewer_unavailable'],
199
+ confidence: 'low',
200
+ worker_result_path: result?.workerResultPath || null
201
+ };
202
+ }
203
+ return {
204
+ schema: 'sks.research-codex-final-review.v1',
205
+ reviewed_at: nowIso(),
206
+ verdict: ['approve', 'revise', 'reject'].includes(worker?.verdict) ? worker.verdict : 'revise',
207
+ unsupported_claim_ids: Array.isArray(worker?.unsupported_claim_ids) ? worker.unsupported_claim_ids.map(String) : [],
208
+ missing_evidence: Array.isArray(worker?.missing_evidence) ? worker.missing_evidence.map(String) : [],
209
+ blueprint_findings: Array.isArray(worker?.blueprint_findings) ? worker.blueprint_findings.map(String) : [],
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,
215
+ required_revisions: Array.isArray(worker?.required_revisions) ? worker.required_revisions.map(String) : [],
216
+ confidence: ['low', 'medium', 'high'].includes(worker?.confidence) ? worker.confidence : 'medium',
217
+ worker_result_path: result.workerResultPath
218
+ };
219
+ }
220
+ export const researchCodexFinalReviewSchema = {
221
+ type: 'object',
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'],
223
+ properties: {
224
+ schema: { const: 'sks.research-codex-final-review.v1' },
225
+ verdict: { enum: ['approve', 'revise', 'reject'] },
226
+ unsupported_claim_ids: { type: 'array' },
227
+ missing_evidence: { type: 'array' },
228
+ blueprint_findings: { type: 'array' },
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' },
234
+ required_revisions: { type: 'array' },
235
+ confidence: { enum: ['low', 'medium', 'high'] }
236
+ }
237
+ };
58
238
  //# sourceMappingURL=research-final-reviewer.js.map
@@ -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