@velum-labs/routekit-eval-setup 1.3.2 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (342) hide show
  1. package/dist/adapters/authoring-responses-request.d.ts +5 -0
  2. package/dist/adapters/authoring-responses-request.js +38 -0
  3. package/dist/adapters/evaluation-evidence-freshness.d.ts +7 -0
  4. package/dist/adapters/evaluation-evidence-freshness.js +76 -0
  5. package/dist/adapters/git-task-history.d.ts +67 -0
  6. package/dist/adapters/git-task-history.js +171 -0
  7. package/dist/adapters/integrated-repository-history.d.ts +21 -0
  8. package/dist/adapters/integrated-repository-history.js +175 -0
  9. package/dist/adapters/repository-command-diagnostic.d.ts +8 -0
  10. package/dist/adapters/repository-command-diagnostic.js +46 -0
  11. package/dist/adapters/repository-command-evidence.d.ts +13 -0
  12. package/dist/adapters/repository-command-evidence.js +102 -0
  13. package/dist/adapters/repository-command-runner.d.ts +238 -0
  14. package/dist/adapters/repository-command-runner.js +1483 -0
  15. package/dist/adapters/repository-import-context.d.ts +47 -0
  16. package/dist/adapters/repository-import-context.js +469 -0
  17. package/dist/adapters/repository-node-test-reporter.d.ts +3 -0
  18. package/dist/adapters/repository-node-test-reporter.js +27 -0
  19. package/dist/adapters/repository-review-evidence.d.ts +39 -0
  20. package/dist/adapters/repository-review-evidence.js +632 -0
  21. package/dist/adapters/repository-seed-selection.d.ts +7 -0
  22. package/dist/adapters/repository-seed-selection.js +79 -0
  23. package/dist/adapters/repository-solution-edits.d.ts +49 -0
  24. package/dist/adapters/repository-solution-edits.js +136 -0
  25. package/dist/adapters/repository-vitest-phase-adapter.d.ts +8 -0
  26. package/dist/adapters/repository-vitest-phase-adapter.js +310 -0
  27. package/dist/adapters/repository-vitest-reporter.d.ts +24 -0
  28. package/dist/adapters/repository-vitest-reporter.js +314 -0
  29. package/dist/adapters/strict-authoring-schema.d.ts +5 -0
  30. package/dist/adapters/strict-authoring-schema.js +158 -0
  31. package/dist/adapters/test-discovery.d.ts +30 -0
  32. package/dist/adapters/test-discovery.js +124 -0
  33. package/dist/adapters/typescript-repository-index.d.ts +51 -0
  34. package/dist/adapters/typescript-repository-index.js +226 -0
  35. package/dist/agentic-capabilities-protocol.d.ts +1373 -0
  36. package/dist/agentic-capabilities-protocol.js +786 -0
  37. package/dist/case-checkpoint-store.d.ts +29 -0
  38. package/dist/case-checkpoint-store.js +133 -0
  39. package/dist/case-pipeline-protocol-v2.d.ts +184 -0
  40. package/dist/case-pipeline-protocol-v2.js +193 -0
  41. package/dist/case-pipeline-protocol.d.ts +2626 -0
  42. package/dist/case-pipeline-protocol.js +371 -0
  43. package/dist/effect-api.d.ts +74 -10
  44. package/dist/effect-api.js +56 -6
  45. package/dist/errors.d.ts +31 -0
  46. package/dist/errors.js +10 -0
  47. package/dist/eval-capability-execution-envelope.d.ts +64 -0
  48. package/dist/eval-capability-execution-envelope.js +98 -0
  49. package/dist/eval-capability-policy.d.ts +90 -0
  50. package/dist/eval-capability-policy.js +107 -0
  51. package/dist/eval-event-log.d.ts +140 -0
  52. package/dist/eval-event-log.js +220 -0
  53. package/dist/evaluation-authoring-policy.d.ts +18 -0
  54. package/dist/evaluation-authoring-policy.js +19 -0
  55. package/dist/evaluation-authoring-validation.d.ts +22 -0
  56. package/dist/evaluation-authoring-validation.js +72 -0
  57. package/dist/evaluation-evidence.d.ts +20 -0
  58. package/dist/evaluation-evidence.js +319 -0
  59. package/dist/evaluation-grader-calibration-protocol.d.ts +108 -0
  60. package/dist/evaluation-grader-calibration-protocol.js +80 -0
  61. package/dist/evaluation-grader-calibration.d.ts +18 -0
  62. package/dist/evaluation-grader-calibration.js +334 -0
  63. package/dist/evaluation-grading-policy.d.ts +24 -0
  64. package/dist/evaluation-grading-policy.js +54 -0
  65. package/dist/evaluation-proposal-policy.d.ts +4 -0
  66. package/dist/evaluation-proposal-policy.js +91 -0
  67. package/dist/evaluation-source-retrieval.d.ts +68 -0
  68. package/dist/evaluation-source-retrieval.js +513 -0
  69. package/dist/evaluation-structure-policy.d.ts +29 -0
  70. package/dist/evaluation-structure-policy.js +138 -0
  71. package/dist/index.d.ts +124 -17
  72. package/dist/index.js +69 -11
  73. package/dist/inspection.js +2 -3
  74. package/dist/project-artifacts.d.ts +7 -2
  75. package/dist/project-artifacts.js +49 -136
  76. package/dist/project-authoring.d.ts +66 -5
  77. package/dist/project-authoring.js +783 -109
  78. package/dist/project-contracts.d.ts +419 -84
  79. package/dist/project-contracts.js +160 -52
  80. package/dist/project-store.js +2 -1
  81. package/dist/project-workflow.d.ts +5 -4
  82. package/dist/project-workflow.js +154 -35
  83. package/dist/repository-adversary-protocol.d.ts +64 -0
  84. package/dist/repository-adversary-protocol.js +105 -0
  85. package/dist/repository-behavior-protocol.d.ts +188 -0
  86. package/dist/repository-behavior-protocol.js +202 -0
  87. package/dist/repository-benchmark-protocol.d.ts +487 -0
  88. package/dist/repository-benchmark-protocol.js +96 -0
  89. package/dist/repository-execution-protocol.d.ts +150 -0
  90. package/dist/repository-execution-protocol.js +38 -0
  91. package/dist/repository-fixture-instructions.d.ts +3 -0
  92. package/dist/repository-fixture-instructions.js +91 -0
  93. package/dist/repository-fixture-protocol.d.ts +79 -0
  94. package/dist/repository-fixture-protocol.js +79 -0
  95. package/dist/repository-foundry-plan-protocol.d.ts +118 -0
  96. package/dist/repository-foundry-plan-protocol.js +296 -0
  97. package/dist/repository-foundry-progress-protocol.d.ts +52 -0
  98. package/dist/repository-foundry-progress-protocol.js +52 -0
  99. package/dist/repository-improvement-protocol.d.ts +100 -0
  100. package/dist/repository-improvement-protocol.js +106 -0
  101. package/dist/repository-language-model-protocol.d.ts +43 -0
  102. package/dist/repository-language-model-protocol.js +146 -0
  103. package/dist/repository-oracle-coverage-protocol.d.ts +18 -0
  104. package/dist/repository-oracle-coverage-protocol.js +39 -0
  105. package/dist/repository-oracle-execution-binding.d.ts +27 -0
  106. package/dist/repository-oracle-execution-binding.js +59 -0
  107. package/dist/repository-oracle-protocol.d.ts +230 -0
  108. package/dist/repository-oracle-protocol.js +156 -0
  109. package/dist/repository-oracle-scope-policy.d.ts +22 -0
  110. package/dist/repository-oracle-scope-policy.js +92 -0
  111. package/dist/repository-quality-policy.d.ts +15 -0
  112. package/dist/repository-quality-policy.js +357 -0
  113. package/dist/repository-routing-benchmark-protocol.d.ts +176 -0
  114. package/dist/repository-routing-benchmark-protocol.js +103 -0
  115. package/dist/repository-routing-model-protocol.d.ts +36 -0
  116. package/dist/repository-routing-model-protocol.js +89 -0
  117. package/dist/repository-routing-plan-protocol.d.ts +112 -0
  118. package/dist/repository-routing-plan-protocol.js +58 -0
  119. package/dist/repository-routing-quality-policy.d.ts +9 -0
  120. package/dist/repository-routing-quality-policy.js +191 -0
  121. package/dist/repository-seed-qualification-progress-protocol.d.ts +205 -0
  122. package/dist/repository-seed-qualification-progress-protocol.js +28 -0
  123. package/dist/repository-semantic-calibration-protocol.d.ts +768 -0
  124. package/dist/repository-semantic-calibration-protocol.js +276 -0
  125. package/dist/repository-semantic-calibration.d.ts +163 -0
  126. package/dist/repository-semantic-calibration.js +581 -0
  127. package/dist/repository-specification-contract-facts-protocol.d.ts +224 -0
  128. package/dist/repository-specification-contract-facts-protocol.js +276 -0
  129. package/dist/repository-specification-critique-protocol.d.ts +189 -0
  130. package/dist/repository-specification-critique-protocol.js +103 -0
  131. package/dist/repository-task-family-protocol.d.ts +24 -0
  132. package/dist/repository-task-family-protocol.js +37 -0
  133. package/dist/repository-task-seed-protocol.d.ts +384 -0
  134. package/dist/repository-task-seed-protocol.js +236 -0
  135. package/dist/repository-trajectory-protocol.d.ts +20 -0
  136. package/dist/repository-trajectory-protocol.js +42 -0
  137. package/dist/service.js +1 -1
  138. package/dist/services/adversary/service.d.ts +64 -0
  139. package/dist/services/adversary/service.js +330 -0
  140. package/dist/services/benchmark-compiler/service.d.ts +450 -0
  141. package/dist/services/benchmark-compiler/service.js +9 -0
  142. package/dist/services/budgeted-model/service.d.ts +118 -0
  143. package/dist/services/budgeted-model/service.js +460 -0
  144. package/dist/services/case-authoring/service.d.ts +163 -0
  145. package/dist/services/case-authoring/service.js +1456 -0
  146. package/dist/services/case-finalization/service.d.ts +283 -0
  147. package/dist/services/case-finalization/service.js +370 -0
  148. package/dist/services/case-generation/service.d.ts +619 -0
  149. package/dist/services/case-generation/service.js +2628 -0
  150. package/dist/services/case-pipeline/service.d.ts +31 -0
  151. package/dist/services/case-pipeline/service.js +485 -0
  152. package/dist/services/case-pipeline-v2/service.d.ts +70 -0
  153. package/dist/services/case-pipeline-v2/service.js +477 -0
  154. package/dist/services/command-observability/service.d.ts +13 -0
  155. package/dist/services/command-observability/service.js +3 -0
  156. package/dist/services/dimension-labeling/service.d.ts +77 -0
  157. package/dist/services/dimension-labeling/service.js +188 -0
  158. package/dist/services/eval-candidate/service.d.ts +208 -0
  159. package/dist/services/eval-candidate/service.js +64 -0
  160. package/dist/services/eval-capabilities/service.d.ts +183 -0
  161. package/dist/services/eval-capabilities/service.js +1433 -0
  162. package/dist/services/eval-environment/service.d.ts +173 -0
  163. package/dist/services/eval-environment/service.js +127 -0
  164. package/dist/services/evidence-reconstruction/service.d.ts +36 -0
  165. package/dist/services/evidence-reconstruction/service.js +145 -0
  166. package/dist/services/fixture-builder/service.d.ts +62 -0
  167. package/dist/services/fixture-builder/service.js +36 -0
  168. package/dist/services/fixture-validation/service.d.ts +75 -0
  169. package/dist/services/fixture-validation/service.js +295 -0
  170. package/dist/services/foundry/service.d.ts +831 -0
  171. package/dist/services/foundry/service.js +442 -0
  172. package/dist/services/foundry-progress/service.d.ts +62 -0
  173. package/dist/services/foundry-progress/service.js +149 -0
  174. package/dist/services/foundry-v2/service.d.ts +54 -0
  175. package/dist/services/foundry-v2/service.js +28 -0
  176. package/dist/services/grounded-authoring/service.d.ts +126 -0
  177. package/dist/services/grounded-authoring/service.js +822 -0
  178. package/dist/services/historical-case/service.d.ts +722 -0
  179. package/dist/services/historical-case/service.js +177 -0
  180. package/dist/services/improvement-loop/service.d.ts +59 -0
  181. package/dist/services/improvement-loop/service.js +176 -0
  182. package/dist/services/language-model/service.d.ts +52 -0
  183. package/dist/services/language-model/service.js +194 -0
  184. package/dist/services/oracle-builder/service.d.ts +146 -0
  185. package/dist/services/oracle-builder/service.js +513 -0
  186. package/dist/services/oracle-coverage/service.d.ts +28 -0
  187. package/dist/services/oracle-coverage/service.js +50 -0
  188. package/dist/services/oracle-coverage-witness/service.d.ts +130 -0
  189. package/dist/services/oracle-coverage-witness/service.js +538 -0
  190. package/dist/services/pipeline-challenge/service.d.ts +551 -0
  191. package/dist/services/pipeline-challenge/service.js +427 -0
  192. package/dist/services/pipeline-controls/service.d.ts +130 -0
  193. package/dist/services/pipeline-controls/service.js +483 -0
  194. package/dist/services/pipeline-oracle/service.d.ts +8 -0
  195. package/dist/services/pipeline-oracle/service.js +256 -0
  196. package/dist/services/pipeline-seed/service.d.ts +298 -0
  197. package/dist/services/pipeline-seed/service.js +428 -0
  198. package/dist/services/pipeline-spec/service.d.ts +103 -0
  199. package/dist/services/pipeline-spec/service.js +619 -0
  200. package/dist/services/pipeline-tournament/service.d.ts +258 -0
  201. package/dist/services/pipeline-tournament/service.js +476 -0
  202. package/dist/services/quality-gate/service.d.ts +233 -0
  203. package/dist/services/quality-gate/service.js +136 -0
  204. package/dist/services/repository-bundle/service.d.ts +33 -0
  205. package/dist/services/repository-bundle/service.js +114 -0
  206. package/dist/services/repository-model/service.d.ts +105 -0
  207. package/dist/services/repository-model/service.js +250 -0
  208. package/dist/services/repository-public-artifact/service.d.ts +133 -0
  209. package/dist/services/repository-public-artifact/service.js +330 -0
  210. package/dist/services/routing-benchmark/service.d.ts +362 -0
  211. package/dist/services/routing-benchmark/service.js +96 -0
  212. package/dist/services/specification-critic/service.d.ts +92 -0
  213. package/dist/services/specification-critic/service.js +172 -0
  214. package/dist/services/task-family/service.d.ts +40 -0
  215. package/dist/services/task-family/service.js +55 -0
  216. package/dist/services/task-seed/service.d.ts +906 -0
  217. package/dist/services/task-seed/service.js +1406 -0
  218. package/dist/services/task-specification/service.d.ts +27 -0
  219. package/dist/services/task-specification/service.js +40 -0
  220. package/dist/services/trajectory-policy/service.d.ts +110 -0
  221. package/dist/services/trajectory-policy/service.js +216 -0
  222. package/dist/test/agentic-capabilities-protocol.test.d.ts +1 -0
  223. package/dist/test/agentic-capabilities-protocol.test.js +570 -0
  224. package/dist/test/agentic-capabilities.test.d.ts +1 -0
  225. package/dist/test/agentic-capabilities.test.js +1461 -0
  226. package/dist/test/agentic-environment.test.d.ts +1 -0
  227. package/dist/test/agentic-environment.test.js +213 -0
  228. package/dist/test/case-pipeline-foundation.test.d.ts +1 -0
  229. package/dist/test/case-pipeline-foundation.test.js +535 -0
  230. package/dist/test/case-pipeline-protocol-v2.test.d.ts +1 -0
  231. package/dist/test/case-pipeline-protocol-v2.test.js +124 -0
  232. package/dist/test/case-pipeline-v2.test.d.ts +1 -0
  233. package/dist/test/case-pipeline-v2.test.js +286 -0
  234. package/dist/test/case-pipeline.test.d.ts +1 -0
  235. package/dist/test/case-pipeline.test.js +851 -0
  236. package/dist/test/eval-capability-policy.test.d.ts +1 -0
  237. package/dist/test/eval-capability-policy.test.js +50 -0
  238. package/dist/test/eval-event-log.test.d.ts +1 -0
  239. package/dist/test/eval-event-log.test.js +125 -0
  240. package/dist/test/evaluation-evidence-freshness.test.d.ts +1 -0
  241. package/dist/test/evaluation-evidence-freshness.test.js +44 -0
  242. package/dist/test/evaluation-evidence.test.d.ts +1 -0
  243. package/dist/test/evaluation-evidence.test.js +230 -0
  244. package/dist/test/evaluation-grader-calibration.test.d.ts +1 -0
  245. package/dist/test/evaluation-grader-calibration.test.js +373 -0
  246. package/dist/test/evaluation-proposal-digest.test.d.ts +1 -0
  247. package/dist/test/evaluation-proposal-digest.test.js +187 -0
  248. package/dist/test/evaluation-source-retrieval.test.d.ts +1 -0
  249. package/dist/test/evaluation-source-retrieval.test.js +237 -0
  250. package/dist/test/evaluation-structure-policy.test.d.ts +1 -0
  251. package/dist/test/evaluation-structure-policy.test.js +196 -0
  252. package/dist/test/fixtures/repository-resource-panel.d.ts +39 -0
  253. package/dist/test/fixtures/repository-resource-panel.js +111 -0
  254. package/dist/test/fixtures/vitest-boundary-panel.d.ts +84 -0
  255. package/dist/test/fixtures/vitest-boundary-panel.js +120 -0
  256. package/dist/test/fixtures/vitest-phase-panel.d.ts +135 -0
  257. package/dist/test/fixtures/vitest-phase-panel.js +213 -0
  258. package/dist/test/fixtures/vitest-reporter-results.d.ts +76 -0
  259. package/dist/test/fixtures/vitest-reporter-results.js +94 -0
  260. package/dist/test/grounded-authoring.test.d.ts +1 -0
  261. package/dist/test/grounded-authoring.test.js +565 -0
  262. package/dist/test/integrated-repository-history.test.d.ts +1 -0
  263. package/dist/test/integrated-repository-history.test.js +227 -0
  264. package/dist/test/project-authoring.test.js +593 -43
  265. package/dist/test/project-workflow.test.js +419 -40
  266. package/dist/test/repository-authoring-artifacts.test.d.ts +1 -0
  267. package/dist/test/repository-authoring-artifacts.test.js +185 -0
  268. package/dist/test/repository-bundle.test.d.ts +1 -0
  269. package/dist/test/repository-bundle.test.js +52 -0
  270. package/dist/test/repository-case-generation.test.d.ts +1 -0
  271. package/dist/test/repository-case-generation.test.js +3465 -0
  272. package/dist/test/repository-command-diagnostic.test.d.ts +1 -0
  273. package/dist/test/repository-command-diagnostic.test.js +55 -0
  274. package/dist/test/repository-command-signals.test.d.ts +1 -0
  275. package/dist/test/repository-command-signals.test.js +124 -0
  276. package/dist/test/repository-fixture-scope-coverage.test.d.ts +1 -0
  277. package/dist/test/repository-fixture-scope-coverage.test.js +127 -0
  278. package/dist/test/repository-fixture-validation.test.d.ts +1 -0
  279. package/dist/test/repository-fixture-validation.test.js +362 -0
  280. package/dist/test/repository-foundry-progress.test.d.ts +1 -0
  281. package/dist/test/repository-foundry-progress.test.js +110 -0
  282. package/dist/test/repository-foundry-quality.test.d.ts +1 -0
  283. package/dist/test/repository-foundry-quality.test.js +1138 -0
  284. package/dist/test/repository-import-context.test.d.ts +1 -0
  285. package/dist/test/repository-import-context.test.js +354 -0
  286. package/dist/test/repository-model-authoring.test.d.ts +1 -0
  287. package/dist/test/repository-model-authoring.test.js +544 -0
  288. package/dist/test/repository-model.test.d.ts +1 -0
  289. package/dist/test/repository-model.test.js +2195 -0
  290. package/dist/test/repository-node-test-reporter.test.d.ts +1 -0
  291. package/dist/test/repository-node-test-reporter.test.js +104 -0
  292. package/dist/test/repository-oracle-concurrency.test.d.ts +1 -0
  293. package/dist/test/repository-oracle-concurrency.test.js +542 -0
  294. package/dist/test/repository-oracle-coverage-witness.test.d.ts +1 -0
  295. package/dist/test/repository-oracle-coverage-witness.test.js +511 -0
  296. package/dist/test/repository-oracle-coverage.test.d.ts +1 -0
  297. package/dist/test/repository-oracle-coverage.test.js +168 -0
  298. package/dist/test/repository-oracle-evidence.test.d.ts +1 -0
  299. package/dist/test/repository-oracle-evidence.test.js +185 -0
  300. package/dist/test/repository-oracle-plan.test.d.ts +1 -0
  301. package/dist/test/repository-oracle-plan.test.js +176 -0
  302. package/dist/test/repository-overlay-isolation.test.d.ts +1 -0
  303. package/dist/test/repository-overlay-isolation.test.js +85 -0
  304. package/dist/test/repository-preparation-cache.test.d.ts +1 -0
  305. package/dist/test/repository-preparation-cache.test.js +414 -0
  306. package/dist/test/repository-public-artifact.test.d.ts +1 -0
  307. package/dist/test/repository-public-artifact.test.js +273 -0
  308. package/dist/test/repository-qualification-diagnostics.test.d.ts +1 -0
  309. package/dist/test/repository-qualification-diagnostics.test.js +524 -0
  310. package/dist/test/repository-reference-authoring.test.d.ts +1 -0
  311. package/dist/test/repository-reference-authoring.test.js +1633 -0
  312. package/dist/test/repository-review-evidence-v2.test.d.ts +1 -0
  313. package/dist/test/repository-review-evidence-v2.test.js +183 -0
  314. package/dist/test/repository-review-evidence.test.d.ts +1 -0
  315. package/dist/test/repository-review-evidence.test.js +124 -0
  316. package/dist/test/repository-seed-exclusions.test.d.ts +1 -0
  317. package/dist/test/repository-seed-exclusions.test.js +96 -0
  318. package/dist/test/repository-seed-selection.test.d.ts +1 -0
  319. package/dist/test/repository-seed-selection.test.js +504 -0
  320. package/dist/test/repository-semantic-calibration.test.d.ts +1 -0
  321. package/dist/test/repository-semantic-calibration.test.js +688 -0
  322. package/dist/test/repository-solution-edits.test.d.ts +1 -0
  323. package/dist/test/repository-solution-edits.test.js +377 -0
  324. package/dist/test/repository-specification-budget.test.d.ts +1 -0
  325. package/dist/test/repository-specification-budget.test.js +171 -0
  326. package/dist/test/repository-specification-contract-checkpoint.test.d.ts +1 -0
  327. package/dist/test/repository-specification-contract-checkpoint.test.js +228 -0
  328. package/dist/test/repository-specification-contract-facts.test.d.ts +1 -0
  329. package/dist/test/repository-specification-contract-facts.test.js +177 -0
  330. package/dist/test/repository-trajectory-authoring.test.d.ts +1 -0
  331. package/dist/test/repository-trajectory-authoring.test.js +176 -0
  332. package/dist/test/repository-valid-control-plan.test.d.ts +1 -0
  333. package/dist/test/repository-valid-control-plan.test.js +45 -0
  334. package/dist/test/repository-vitest-phase.test.d.ts +1 -0
  335. package/dist/test/repository-vitest-phase.test.js +848 -0
  336. package/dist/test/repository-vitest-reporter.test.d.ts +1 -0
  337. package/dist/test/repository-vitest-reporter.test.js +158 -0
  338. package/dist/test/repository-workspace-build.test.d.ts +1 -0
  339. package/dist/test/repository-workspace-build.test.js +160 -0
  340. package/dist/test/strict-authoring-schema.test.d.ts +1 -0
  341. package/dist/test/strict-authoring-schema.test.js +169 -0
  342. package/package.json +48 -6
@@ -0,0 +1,156 @@
1
+ import { Schema } from "effect";
2
+ import { RepositoryOracleFixtureV1 } from "./repository-fixture-protocol.js";
3
+ const OracleClauseCommon = {
4
+ id: Schema.String,
5
+ critical: Schema.Boolean,
6
+ description: Schema.String
7
+ };
8
+ export const RepositoryOracleClauseV1 = Schema.Union([
9
+ Schema.Struct({
10
+ ...OracleClauseCommon,
11
+ kind: Schema.Literal("candidate-policy"),
12
+ policyId: Schema.String,
13
+ forbiddenPaths: Schema.Array(Schema.String)
14
+ }),
15
+ Schema.Struct({
16
+ ...OracleClauseCommon,
17
+ kind: Schema.Literal("test-command"),
18
+ recipeId: Schema.String,
19
+ expectedExitCode: Schema.Finite,
20
+ fixtureIds: Schema.Array(Schema.String)
21
+ }),
22
+ Schema.Struct({
23
+ ...OracleClauseCommon,
24
+ kind: Schema.Literal("json-field"),
25
+ pointer: Schema.String,
26
+ operator: Schema.Literals(["equals", "present", "absent"]),
27
+ expectedJson: Schema.optionalKey(Schema.String)
28
+ }),
29
+ Schema.Struct({
30
+ ...OracleClauseCommon,
31
+ kind: Schema.Literal("ordered-events"),
32
+ eventTypes: Schema.Array(Schema.String),
33
+ terminalEvent: Schema.optionalKey(Schema.String)
34
+ }),
35
+ Schema.Struct({
36
+ ...OracleClauseCommon,
37
+ kind: Schema.Literal("property"),
38
+ propertyId: Schema.String,
39
+ fixtureIds: Schema.Array(Schema.String)
40
+ }),
41
+ Schema.Struct({
42
+ ...OracleClauseCommon,
43
+ kind: Schema.Literal("differential"),
44
+ implementationIds: Schema.Array(Schema.String),
45
+ fixtureIds: Schema.Array(Schema.String)
46
+ }),
47
+ Schema.Struct({
48
+ ...OracleClauseCommon,
49
+ kind: Schema.Literal("architecture"),
50
+ ruleId: Schema.String,
51
+ expectedPaths: Schema.Array(Schema.String)
52
+ }),
53
+ Schema.Struct({
54
+ ...OracleClauseCommon,
55
+ kind: Schema.Literal("transformation-completeness"),
56
+ ruleId: Schema.String,
57
+ forbiddenLegacyPaths: Schema.Array(Schema.String),
58
+ requiredNewPaths: Schema.Array(Schema.String)
59
+ }),
60
+ Schema.Struct({
61
+ ...OracleClauseCommon,
62
+ kind: Schema.Literal("semantic-residual"),
63
+ criterion: Schema.String
64
+ })
65
+ ]);
66
+ export const RepositoryReferenceSolutionV1 = Schema.Struct({
67
+ id: Schema.String,
68
+ kind: Schema.Literals([
69
+ "historical-reference",
70
+ "independent-valid",
71
+ "simplified-valid",
72
+ "behavior-preserving-valid",
73
+ "historical-defect",
74
+ "mutation",
75
+ "model-near-miss",
76
+ "reward-hacking"
77
+ ]),
78
+ family: Schema.String,
79
+ expectedClass: Schema.Literals(["valid", "wrong"]),
80
+ commit: Schema.optionalKey(Schema.String)
81
+ });
82
+ export const RepositoryOracleObservationV1 = Schema.Struct({
83
+ solutionId: Schema.String,
84
+ clauseId: Schema.String,
85
+ repetition: Schema.Finite,
86
+ outcome: Schema.Literals(["pass", "fail", "unknown"]),
87
+ detail: Schema.String,
88
+ inconclusiveReason: Schema.optionalKey(Schema.Literal("unattributed-test-failure"))
89
+ });
90
+ export const RepositoryHiddenOracleV1 = Schema.Struct({
91
+ version: Schema.Literal(1),
92
+ caseId: Schema.String,
93
+ hardFailurePolicy: Schema.Literal("any-critical-hard-clause-fails"),
94
+ /** Host binding includes executable patches and environment, not only public solution metadata. */
95
+ executionBindingDigest: Schema.optionalKey(Schema.String.check(Schema.isPattern(/^[a-f0-9]{64}$/u))),
96
+ /** Planned repetition count, including repetitions not yet present in a continuation. */
97
+ executionRepetitions: Schema.optionalKey(Schema.Finite.check(Schema.makeFilter((value) => Number.isInteger(value) && value >= 1 && value <= 5
98
+ ? undefined
99
+ : "execution repetitions must be an integer from 1 to 5"))),
100
+ fixtures: Schema.Array(RepositoryOracleFixtureV1),
101
+ clauses: Schema.Array(RepositoryOracleClauseV1),
102
+ solutions: Schema.Array(RepositoryReferenceSolutionV1),
103
+ observations: Schema.Array(RepositoryOracleObservationV1),
104
+ knownLimitations: Schema.Array(Schema.String)
105
+ });
106
+ export const RepositoryOracleAdequacyReportV1 = Schema.Struct({
107
+ version: Schema.Literal(1),
108
+ caseId: Schema.String,
109
+ admitted: Schema.Boolean,
110
+ validSolutionCount: Schema.Finite,
111
+ wrongSolutionCount: Schema.Finite,
112
+ falseRejectedSolutionIds: Schema.Array(Schema.String),
113
+ falseAcceptedSolutionIds: Schema.Array(Schema.String),
114
+ unstableSolutionIds: Schema.Array(Schema.String),
115
+ unobservedClauseIds: Schema.Array(Schema.String),
116
+ insufficientObservationPairs: Schema.Array(Schema.String),
117
+ mutationFamilyKills: Schema.Array(Schema.Struct({
118
+ family: Schema.String,
119
+ killed: Schema.Finite,
120
+ total: Schema.Finite
121
+ })),
122
+ rejectionReasons: Schema.Array(Schema.String)
123
+ });
124
+ export function assertRepositoryHiddenOracleV1(value) {
125
+ const oracle = Schema.decodeUnknownSync(RepositoryHiddenOracleV1)(value);
126
+ if (oracle.caseId.trim().length === 0 ||
127
+ oracle.clauses.length === 0 ||
128
+ !oracle.clauses.some((clause) => clause.critical)) {
129
+ throw new Error("repository hidden oracle requires a case id and critical hard clause");
130
+ }
131
+ const clauseIds = new Set(oracle.clauses.map((clause) => clause.id));
132
+ const fixtureIds = new Set(oracle.fixtures.map((fixture) => fixture.id));
133
+ const solutionIds = new Set(oracle.solutions.map((solution) => solution.id));
134
+ if (clauseIds.size !== oracle.clauses.length || solutionIds.size !== oracle.solutions.length) {
135
+ throw new Error("repository hidden oracle ids must be unique");
136
+ }
137
+ if (!oracle.solutions.some((solution) => solution.expectedClass === "valid") ||
138
+ !oracle.solutions.some((solution) => solution.expectedClass === "wrong")) {
139
+ throw new Error("repository hidden oracle requires valid and wrong solution populations");
140
+ }
141
+ for (const observation of oracle.observations) {
142
+ if (!solutionIds.has(observation.solutionId) ||
143
+ !clauseIds.has(observation.clauseId) ||
144
+ !Number.isInteger(observation.repetition) ||
145
+ observation.repetition < 1 ||
146
+ (observation.inconclusiveReason !== undefined && observation.outcome !== "unknown")) {
147
+ throw new Error("repository hidden oracle observation refers to an unknown solution or clause");
148
+ }
149
+ }
150
+ for (const clause of oracle.clauses) {
151
+ if (clause.kind === "test-command" &&
152
+ clause.fixtureIds.some((fixtureId) => !fixtureIds.has(fixtureId))) {
153
+ throw new Error("repository hidden oracle test clause refers to an unknown fixture");
154
+ }
155
+ }
156
+ }
@@ -0,0 +1,22 @@
1
+ import type { OracleCheckpointV1, SpecCheckpointV1 } from "./case-pipeline-protocol.js";
2
+ import type { RepositoryHiddenOracleV1, RepositoryOracleClauseV1, RepositoryOracleObservationV1 } from "./repository-oracle-protocol.js";
3
+ /** Shared executed-evidence policy for tournament repair and final admission. */
4
+ export declare const repositoryOracleRepeatedRowsV1: (rows: readonly RepositoryOracleObservationV1[], repetitions: number) => boolean;
5
+ export declare const repositoryOracleAttributedSemanticFailureV1: (row: RepositoryOracleObservationV1, clause: RepositoryOracleClauseV1) => boolean;
6
+ /**
7
+ * Resolve every grounded scope through the author's persisted fixture mapping
8
+ * and repeated execution. The mapping is advisory until these observations
9
+ * prove it: every scope needs a reference-passing fixture with compatible
10
+ * metadata, and changed scopes additionally need the same fixture to reject
11
+ * the pinned historical defect through attributed assertion evidence.
12
+ */
13
+ export declare const evaluateRepositoryOracleScopeCoverageV1: (input: {
14
+ readonly spec: SpecCheckpointV1;
15
+ readonly oracleCheckpoint: OracleCheckpointV1;
16
+ readonly oracle: RepositoryHiddenOracleV1;
17
+ readonly repetitions: number;
18
+ readonly label: string;
19
+ }) => {
20
+ readonly reasons: readonly string[];
21
+ readonly unresolvedScopeIds: readonly string[];
22
+ };
@@ -0,0 +1,92 @@
1
+ /** Shared executed-evidence policy for tournament repair and final admission. */
2
+ export const repositoryOracleRepeatedRowsV1 = (rows, repetitions) => rows.length === repetitions &&
3
+ new Set(rows.map(({ repetition }) => repetition)).size === repetitions &&
4
+ rows.every(({ repetition }) => Number.isSafeInteger(repetition) && repetition >= 1 && repetition <= repetitions);
5
+ export const repositoryOracleAttributedSemanticFailureV1 = (row, clause) => clause.kind === "test-command" &&
6
+ row.outcome === "fail" &&
7
+ row.detail.includes("stage=grade") &&
8
+ row.detail.includes("gradeExecuted=true") &&
9
+ row.detail.includes("timeout=false") &&
10
+ row.detail.includes("exit=1") &&
11
+ row.detail.includes("assertionFailures=") &&
12
+ !row.detail.includes("output=truncated");
13
+ const fixtureClauseOf = (oracle, fixtureId) => oracle.clauses.find((clause) => clause.kind === "test-command" && clause.critical && clause.fixtureIds.includes(fixtureId));
14
+ const repeatedFixturePass = (input) => {
15
+ const rows = input.oracle.observations.filter((row) => row.solutionId === input.solutionId && row.clauseId === input.clauseId);
16
+ return (repositoryOracleRepeatedRowsV1(rows, input.repetitions) &&
17
+ rows.every((row) => row.outcome === "pass" &&
18
+ row.detail.includes("stage=grade") &&
19
+ row.detail.includes("gradeExecuted=true") &&
20
+ row.detail.includes("timeout=false") &&
21
+ row.detail.includes("exit=0") &&
22
+ !row.detail.includes("output=truncated")));
23
+ };
24
+ const repeatedFixtureKill = (input) => {
25
+ const rows = input.oracle.observations.filter((row) => row.solutionId === input.solutionId && row.clauseId === input.clause.id);
26
+ return (repositoryOracleRepeatedRowsV1(rows, input.repetitions) &&
27
+ rows.every((row) => repositoryOracleAttributedSemanticFailureV1(row, input.clause)));
28
+ };
29
+ /**
30
+ * Resolve every grounded scope through the author's persisted fixture mapping
31
+ * and repeated execution. The mapping is advisory until these observations
32
+ * prove it: every scope needs a reference-passing fixture with compatible
33
+ * metadata, and changed scopes additionally need the same fixture to reject
34
+ * the pinned historical defect through attributed assertion evidence.
35
+ */
36
+ export const evaluateRepositoryOracleScopeCoverageV1 = (input) => {
37
+ const reasons = [];
38
+ const unresolvedScopeIds = new Set();
39
+ const expectedScopeIds = new Set(input.spec.scope.map(({ id }) => id));
40
+ const submittedScopeIds = input.oracleCheckpoint.scopeCoverage.map(({ scopeId }) => scopeId);
41
+ if (submittedScopeIds.length !== input.spec.scope.length ||
42
+ new Set(submittedScopeIds).size !== submittedScopeIds.length ||
43
+ submittedScopeIds.some((scopeId) => !expectedScopeIds.has(scopeId))) {
44
+ reasons.push(`${input.label}: scope fixture mapping must contain every grounded scope exactly once`);
45
+ }
46
+ const coverageByScope = new Map(input.oracleCheckpoint.scopeCoverage.map((coverage) => [coverage.scopeId, coverage]));
47
+ const mappingValid = reasons.length === 0;
48
+ for (const scope of input.spec.scope) {
49
+ unresolvedScopeIds.add(scope.id);
50
+ const coverage = coverageByScope.get(scope.id);
51
+ if (coverage === undefined || coverage.fixtureIds.length === 0) {
52
+ reasons.push(`${input.label}: grounded scope ${scope.id} has no mapped executable fixture`);
53
+ continue;
54
+ }
55
+ if (new Set(coverage.fixtureIds).size !== coverage.fixtureIds.length) {
56
+ reasons.push(`${input.label}: grounded scope ${scope.id} has duplicate fixture mappings`);
57
+ continue;
58
+ }
59
+ const resolved = coverage.fixtureIds.some((fixtureId) => {
60
+ const fixture = input.oracle.fixtures.find(({ id }) => id === fixtureId);
61
+ const clause = fixtureClauseOf(input.oracle, fixtureId);
62
+ if (fixture === undefined ||
63
+ (scope.kind === "changed" && fixture.expectationMode !== "changes") ||
64
+ clause === undefined) {
65
+ return false;
66
+ }
67
+ const referencePassed = repeatedFixturePass({
68
+ oracle: input.oracle,
69
+ clauseId: clause.id,
70
+ solutionId: "historical-reference",
71
+ repetitions: input.repetitions
72
+ });
73
+ if (!referencePassed)
74
+ return false;
75
+ return (scope.kind === "preserved" ||
76
+ repeatedFixtureKill({
77
+ oracle: input.oracle,
78
+ clause,
79
+ solutionId: "historical-defect",
80
+ repetitions: input.repetitions
81
+ }));
82
+ });
83
+ if (resolved && mappingValid)
84
+ unresolvedScopeIds.delete(scope.id);
85
+ if (!resolved) {
86
+ reasons.push(scope.kind === "changed"
87
+ ? `${input.label}: changed scope ${scope.id} lacks one mapped changes fixture with repeated historical-reference passes and attributed historical-defect failures`
88
+ : `${input.label}: preserved scope ${scope.id} lacks one mapped fixture with repeated historical-reference passes`);
89
+ }
90
+ }
91
+ return { reasons, unresolvedScopeIds: [...unresolvedScopeIds].sort() };
92
+ };
@@ -0,0 +1,15 @@
1
+ import type { RepositoryBenchmarkCaseV1, RepositoryValidatedBenchmarkLibraryV1 } from "./repository-benchmark-protocol.js";
2
+ import { type RepositoryHiddenOracleV1, type RepositoryOracleAdequacyReportV1 } from "./repository-oracle-protocol.js";
3
+ /** Partial execution is measurable progress, but never a completed control verdict. */
4
+ export declare const repositoryOracleSolutionObservationsCompleteV1: (oracle: RepositoryHiddenOracleV1, solutionId: string) => boolean;
5
+ export declare function evaluateRepositoryOracleAdequacyV1(oracle: RepositoryHiddenOracleV1): RepositoryOracleAdequacyReportV1;
6
+ export declare function repositoryBehavioralFingerprintV1(input: {
7
+ readonly capabilityId: string;
8
+ readonly familyId: string;
9
+ readonly behaviorClauses: readonly string[];
10
+ readonly oracle: RepositoryHiddenOracleV1;
11
+ }): string;
12
+ export declare function admitRepositoryBenchmarkCaseV1(input: {
13
+ readonly draft: Omit<RepositoryBenchmarkCaseV1, "status" | "rejectionReasons">;
14
+ }): RepositoryBenchmarkCaseV1;
15
+ export declare function compileValidatedBenchmarkLibraryV1(cases: readonly RepositoryBenchmarkCaseV1[]): RepositoryValidatedBenchmarkLibraryV1;
@@ -0,0 +1,357 @@
1
+ import { createHash } from "node:crypto";
2
+ import { assertRepositoryHiddenOracleV1 } from "./repository-oracle-protocol.js";
3
+ const HARD_FINDING_AXES = new Set([
4
+ "authenticity",
5
+ "specification-sufficiency",
6
+ "oracle-adequacy",
7
+ "stability",
8
+ "distinctness",
9
+ "realism",
10
+ "leakage",
11
+ "triviality"
12
+ ]);
13
+ const completeRepetitions = (oracle, observations) => {
14
+ // Older whole-solution checkpoints did not retain the plan cardinality.
15
+ // Infer their already-observed cardinality, never lower the scientific minimum.
16
+ const required = Math.max(2, oracle.executionRepetitions ??
17
+ oracle.observations.reduce((maximum, row) => Math.max(maximum, row.repetition), 2));
18
+ return observations.length === required &&
19
+ new Set(observations.map((row) => row.repetition)).size === required &&
20
+ observations.every((row) => Number.isInteger(row.repetition) &&
21
+ row.repetition >= 1 && row.repetition <= required);
22
+ };
23
+ /** Partial execution is measurable progress, but never a completed control verdict. */
24
+ export const repositoryOracleSolutionObservationsCompleteV1 = (oracle, solutionId) => {
25
+ if (rejectedByCandidatePolicy(oracle, solutionId))
26
+ return true;
27
+ const clauses = oracle.clauses.filter((clause) => clause.critical && clause.kind !== "semantic-residual");
28
+ return clauses.length > 0 && clauses.every((clause) => {
29
+ const rows = oracle.observations.filter((row) => row.solutionId === solutionId && row.clauseId === clause.id);
30
+ return completeRepetitions(oracle, rows) && rows.every((row) => row.outcome !== "unknown");
31
+ });
32
+ };
33
+ const solutionPasses = (oracle, solutionId) => {
34
+ const criticalClauseIds = new Set(oracle.clauses
35
+ .filter((clause) => clause.critical && clause.kind !== "semantic-residual")
36
+ .map((clause) => clause.id));
37
+ if (criticalClauseIds.size === 0)
38
+ return false;
39
+ return [...criticalClauseIds].every((clauseId) => {
40
+ const observations = oracle.observations.filter((observation) => observation.solutionId === solutionId &&
41
+ observation.clauseId === clauseId);
42
+ return (completeRepetitions(oracle, observations) &&
43
+ observations.every((observation) => observation.outcome === "pass"));
44
+ });
45
+ };
46
+ const unstableSolutions = (oracle) => {
47
+ const unstable = new Set();
48
+ for (const solution of oracle.solutions) {
49
+ for (const clause of oracle.clauses.filter((entry) => entry.critical && entry.kind !== "semantic-residual")) {
50
+ const outcomes = new Set(oracle.observations
51
+ .filter((observation) => observation.solutionId === solution.id &&
52
+ observation.clauseId === clause.id)
53
+ .map((observation) => observation.outcome));
54
+ if (outcomes.size > 1 || outcomes.has("unknown")) {
55
+ unstable.add(solution.id);
56
+ }
57
+ }
58
+ }
59
+ return [...unstable].sort();
60
+ };
61
+ const rejectedByCandidatePolicy = (oracle, solutionId) => oracle.clauses
62
+ .filter((clause) => clause.critical && clause.kind === "candidate-policy")
63
+ .some((clause) => {
64
+ const observations = oracle.observations.filter((observation) => observation.solutionId === solutionId &&
65
+ observation.clauseId === clause.id);
66
+ return (completeRepetitions(oracle, observations) &&
67
+ observations.every((observation) => observation.outcome === "fail"));
68
+ });
69
+ const solutionHasObservedFailure = (oracle, solutionId) => oracle.clauses.some((clause) => clause.critical &&
70
+ clause.kind !== "semantic-residual" &&
71
+ oracle.observations.some((observation) => observation.solutionId === solutionId &&
72
+ observation.clauseId === clause.id &&
73
+ observation.outcome === "fail"));
74
+ const solutionIsConclusivelyRejected = (oracle, solutionId) => {
75
+ if (rejectedByCandidatePolicy(oracle, solutionId))
76
+ return true;
77
+ if (!solutionHasObservedFailure(oracle, solutionId))
78
+ return false;
79
+ return oracle.clauses
80
+ .filter((clause) => clause.critical && clause.kind !== "semantic-residual")
81
+ .every((clause) => {
82
+ const observations = oracle.observations.filter((observation) => observation.solutionId === solutionId && observation.clauseId === clause.id);
83
+ return (completeRepetitions(oracle, observations) &&
84
+ !observations.some((observation) => observation.outcome === "unknown") &&
85
+ new Set(observations.map((observation) => observation.outcome)).size === 1);
86
+ });
87
+ };
88
+ export function evaluateRepositoryOracleAdequacyV1(oracle) {
89
+ assertRepositoryHiddenOracleV1(oracle);
90
+ const valid = oracle.solutions.filter((solution) => solution.expectedClass === "valid");
91
+ const wrong = oracle.solutions.filter((solution) => solution.expectedClass === "wrong");
92
+ const falseRejectedSolutionIds = valid
93
+ .filter((solution) => solutionHasObservedFailure(oracle, solution.id))
94
+ .map((solution) => solution.id)
95
+ .sort();
96
+ const falseAcceptedSolutionIds = wrong
97
+ .filter((solution) => solutionPasses(oracle, solution.id))
98
+ .map((solution) => solution.id)
99
+ .sort();
100
+ const unstableSolutionIds = unstableSolutions(oracle);
101
+ const inconclusiveSolutionIds = [
102
+ ...new Set(oracle.observations
103
+ .filter((observation) => observation.outcome === "unknown" &&
104
+ oracle.clauses.some((clause) => clause.id === observation.clauseId &&
105
+ clause.critical &&
106
+ clause.kind !== "semantic-residual"))
107
+ .map((observation) => observation.solutionId))
108
+ ].sort();
109
+ const observedClauseIds = new Set(oracle.observations.map((observation) => observation.clauseId));
110
+ const unobservedClauseIds = oracle.clauses
111
+ .filter((clause) => clause.critical &&
112
+ clause.kind !== "semantic-residual" &&
113
+ !observedClauseIds.has(clause.id))
114
+ .map((clause) => clause.id)
115
+ .sort();
116
+ const insufficientObservationPairs = oracle.solutions.flatMap((solution) => rejectedByCandidatePolicy(oracle, solution.id)
117
+ ? []
118
+ : oracle.clauses
119
+ .filter((clause) => clause.critical && clause.kind !== "semantic-residual")
120
+ .flatMap((clause) => {
121
+ const observations = oracle.observations.filter((observation) => observation.solutionId === solution.id &&
122
+ observation.clauseId === clause.id);
123
+ return completeRepetitions(oracle, observations)
124
+ ? []
125
+ : [`${solution.id}/${clause.id}`];
126
+ }));
127
+ const families = [...new Set(wrong.map((solution) => solution.family))].sort();
128
+ const mutationFamilyKills = families.map((family) => {
129
+ const members = wrong.filter((solution) => solution.family === family);
130
+ return {
131
+ family,
132
+ killed: members.filter((solution) => solutionIsConclusivelyRejected(oracle, solution.id)).length,
133
+ total: members.length
134
+ };
135
+ });
136
+ const rejectionReasons = [
137
+ ...(falseRejectedSolutionIds.length === 0
138
+ ? []
139
+ : [
140
+ `known valid solutions rejected: ${falseRejectedSolutionIds.join(", ")}`
141
+ ]),
142
+ ...(falseAcceptedSolutionIds.length === 0
143
+ ? []
144
+ : [
145
+ `plausible wrong solutions accepted: ${falseAcceptedSolutionIds.join(", ")}`
146
+ ]),
147
+ ...(unstableSolutionIds.length === 0
148
+ ? []
149
+ : [`unstable solution observations: ${unstableSolutionIds.join(", ")}`]),
150
+ ...(inconclusiveSolutionIds.length === 0
151
+ ? []
152
+ : [`inconclusive solution observations: ${inconclusiveSolutionIds.join(", ")}`]),
153
+ ...(unobservedClauseIds.length === 0
154
+ ? []
155
+ : [`critical clauses unobserved: ${unobservedClauseIds.join(", ")}`]),
156
+ ...(insufficientObservationPairs.length === 0
157
+ ? []
158
+ : [
159
+ `critical solution/clause pairs need repeated observations: ${insufficientObservationPairs.join(", ")}`
160
+ ]),
161
+ ...mutationFamilyKills
162
+ .filter((family) => family.killed !== family.total)
163
+ .map((family) => `mutation family ${JSON.stringify(family.family)} killed ${String(family.killed)}/${String(family.total)}`)
164
+ ];
165
+ return {
166
+ version: 1,
167
+ caseId: oracle.caseId,
168
+ admitted: rejectionReasons.length === 0,
169
+ validSolutionCount: valid.length,
170
+ wrongSolutionCount: wrong.length,
171
+ falseRejectedSolutionIds,
172
+ falseAcceptedSolutionIds,
173
+ unstableSolutionIds,
174
+ unobservedClauseIds,
175
+ insufficientObservationPairs,
176
+ mutationFamilyKills,
177
+ rejectionReasons
178
+ };
179
+ }
180
+ const normalize = (value) => value
181
+ .normalize("NFKC")
182
+ .toLowerCase()
183
+ .replace(/\b[0-9a-f]{7,64}\b/gu, "<digest>")
184
+ .replace(/\b\d+\b/gu, "<number>")
185
+ .replace(/\s+/gu, " ")
186
+ .trim();
187
+ export function repositoryBehavioralFingerprintV1(input) {
188
+ const semantic = {
189
+ capabilityId: normalize(input.capabilityId),
190
+ familyId: normalize(input.familyId),
191
+ behaviorClauses: [...new Set(input.behaviorClauses.map(normalize))].sort(),
192
+ oracleClauses: input.oracle.clauses
193
+ .filter((clause) => clause.kind !== "semantic-residual")
194
+ .map((clause) => ({
195
+ kind: clause.kind,
196
+ critical: clause.critical,
197
+ description: normalize(clause.description)
198
+ }))
199
+ .sort((left, right) => JSON.stringify(left).localeCompare(JSON.stringify(right)))
200
+ };
201
+ return createHash("sha256").update(JSON.stringify(semantic)).digest("hex");
202
+ }
203
+ export function admitRepositoryBenchmarkCaseV1(input) {
204
+ const { draft } = input;
205
+ const seenAxes = new Set(draft.qualityFindings.map((finding) => finding.axis));
206
+ const missingAxes = [...HARD_FINDING_AXES].filter((axis) => !seenAxes.has(axis));
207
+ const failed = draft.qualityFindings.filter((finding) => HARD_FINDING_AXES.has(finding.axis) && finding.outcome !== "pass");
208
+ const evidenceUnlinked = draft.qualityFindings.filter((finding) => HARD_FINDING_AXES.has(finding.axis) &&
209
+ finding.outcome === "pass" &&
210
+ (finding.evidenceIds.length === 0 ||
211
+ finding.evidenceIds.some((evidenceId) => evidenceId.trim().length === 0)));
212
+ const rejectionReasons = [
213
+ ...(draft.hidden.caseId === draft.id
214
+ ? []
215
+ : ["hidden oracle case id does not match benchmark case"]),
216
+ ...(draft.visible.id === draft.id
217
+ ? []
218
+ : ["visible task id does not match benchmark case"]),
219
+ ...(draft.visible.lane === draft.lane
220
+ ? []
221
+ : ["visible task lane does not match benchmark case"]),
222
+ ...missingAxes.map((axis) => `missing quality finding: ${axis}`),
223
+ ...failed.map((finding) => `${finding.axis} ${finding.outcome}: ${finding.detail}`),
224
+ ...evidenceUnlinked.map((finding) => `${finding.axis} pass is not linked to concrete evidence ids`),
225
+ ...draft.adequacy.rejectionReasons
226
+ ];
227
+ return {
228
+ ...draft,
229
+ status: rejectionReasons.length === 0 ? "valid-library" : "rejected",
230
+ rejectionReasons
231
+ };
232
+ }
233
+ const QUALITY_GATES = [
234
+ "authenticity",
235
+ "specification-sufficiency",
236
+ "oracle-adequacy",
237
+ "stability",
238
+ "distinctness",
239
+ "leakage",
240
+ "realism",
241
+ "triviality",
242
+ "case-integrity",
243
+ "deduplication"
244
+ ];
245
+ const counts = (values) => [...values.reduce((accumulator, value) => {
246
+ accumulator.set(value, (accumulator.get(value) ?? 0) + 1);
247
+ return accumulator;
248
+ }, new Map())]
249
+ .sort((left, right) => left[0].localeCompare(right[0]))
250
+ .map(([id, count]) => ({ id, count }));
251
+ const packageRoot = (path) => {
252
+ const parts = path.split("/");
253
+ return parts.length >= 2 &&
254
+ (parts[0] === "packages" || parts[0] === "apps")
255
+ ? parts.slice(0, 2).join("/")
256
+ : undefined;
257
+ };
258
+ export function compileValidatedBenchmarkLibraryV1(cases) {
259
+ let active = [...cases];
260
+ const rejectedByPipeline = new Map();
261
+ const acceptanceFunnel = [];
262
+ for (const gate of QUALITY_GATES) {
263
+ const input = active.length;
264
+ if (gate === "deduplication") {
265
+ const byFingerprint = new Map();
266
+ for (const benchmarkCase of active) {
267
+ const matching = byFingerprint.get(benchmarkCase.behavioralFingerprint) ?? [];
268
+ matching.push(benchmarkCase);
269
+ byFingerprint.set(benchmarkCase.behavioralFingerprint, matching);
270
+ }
271
+ const duplicateLoserIds = new Set();
272
+ for (const matching of byFingerprint.values()) {
273
+ if (matching.length < 2)
274
+ continue;
275
+ const ordered = [...matching].sort((left, right) => left.hidden.knownLimitations.length -
276
+ right.hidden.knownLimitations.length ||
277
+ left.id.localeCompare(right.id));
278
+ for (const duplicate of ordered.slice(1)) {
279
+ duplicateLoserIds.add(duplicate.id);
280
+ rejectedByPipeline.set(duplicate.id, "semantic duplicate behavioral fingerprint");
281
+ }
282
+ }
283
+ active = active.filter((benchmarkCase) => !duplicateLoserIds.has(benchmarkCase.id));
284
+ }
285
+ else if (gate === "case-integrity") {
286
+ const failed = active.filter((benchmarkCase) => benchmarkCase.status !== "valid-library");
287
+ for (const benchmarkCase of failed) {
288
+ rejectedByPipeline.set(benchmarkCase.id, "case failed invariant admission");
289
+ }
290
+ active = active.filter((benchmarkCase) => benchmarkCase.status === "valid-library");
291
+ }
292
+ else {
293
+ const failed = active.filter((benchmarkCase) => {
294
+ const quality = benchmarkCase.qualityFindings.find((finding) => finding.axis === gate);
295
+ return quality === undefined || quality.outcome !== "pass";
296
+ });
297
+ for (const benchmarkCase of failed) {
298
+ rejectedByPipeline.set(benchmarkCase.id, `case failed sequential quality gate ${gate}`);
299
+ }
300
+ const failedIds = new Set(failed.map((benchmarkCase) => benchmarkCase.id));
301
+ active = active.filter((benchmarkCase) => !failedIds.has(benchmarkCase.id));
302
+ }
303
+ acceptanceFunnel.push({
304
+ gate,
305
+ input,
306
+ admitted: active.length,
307
+ rejected: input - active.length
308
+ });
309
+ }
310
+ const acceptedIds = new Set(active.map((benchmarkCase) => benchmarkCase.id));
311
+ const normalized = cases.map((benchmarkCase) => {
312
+ if (acceptedIds.has(benchmarkCase.id))
313
+ return benchmarkCase;
314
+ const pipelineReason = rejectedByPipeline.get(benchmarkCase.id);
315
+ if (pipelineReason === undefined ||
316
+ benchmarkCase.rejectionReasons.includes(pipelineReason)) {
317
+ return benchmarkCase;
318
+ }
319
+ return {
320
+ ...benchmarkCase,
321
+ status: "rejected",
322
+ rejectionReasons: [...benchmarkCase.rejectionReasons, pipelineReason]
323
+ };
324
+ });
325
+ const coverage = {
326
+ capabilities: counts(active.map((benchmarkCase) => benchmarkCase.capabilityId)),
327
+ families: counts(active.map((benchmarkCase) => benchmarkCase.familyId)),
328
+ lanes: counts(active.map((benchmarkCase) => benchmarkCase.lane)),
329
+ packages: counts(active.flatMap((benchmarkCase) => [
330
+ ...benchmarkCase.qualityFindings.flatMap((finding) => finding.evidence.flatMap((evidence) => {
331
+ const root = evidence.path === undefined
332
+ ? undefined
333
+ : packageRoot(evidence.path);
334
+ return root === undefined ? [] : [root];
335
+ })),
336
+ ...benchmarkCase.hidden.fixtures.flatMap((fixture) => {
337
+ const root = packageRoot(fixture.testPath);
338
+ return root === undefined ? [] : [root];
339
+ })
340
+ ])),
341
+ oracleKinds: counts(active.flatMap((benchmarkCase) => benchmarkCase.hidden.clauses.map((clause) => clause.kind))),
342
+ fixtureKinds: counts(active.flatMap((benchmarkCase) => benchmarkCase.hidden.fixtures.map((fixture) => fixture.kind))),
343
+ mutationFamilies: counts(active.flatMap((benchmarkCase) => benchmarkCase.hidden.solutions
344
+ .filter((solution) => solution.expectedClass === "wrong")
345
+ .map((solution) => solution.family)))
346
+ };
347
+ return {
348
+ version: 1,
349
+ cases: active,
350
+ rejectedCaseIds: normalized
351
+ .filter((benchmarkCase) => benchmarkCase.status === "rejected")
352
+ .map((benchmarkCase) => benchmarkCase.id)
353
+ .sort(),
354
+ acceptanceFunnel,
355
+ coverage
356
+ };
357
+ }