@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 @@
1
+ export {};
@@ -0,0 +1,354 @@
1
+ import assert from "node:assert/strict";
2
+ import { execFile } from "node:child_process";
3
+ import { mkdir, mkdtemp, realpath, rm, writeFile } from "node:fs/promises";
4
+ import { tmpdir } from "node:os";
5
+ import { dirname, join } from "node:path";
6
+ import { test } from "node:test";
7
+ import { promisify } from "node:util";
8
+ import { Effect } from "effect";
9
+ import { captureGitTreeSnapshotV1, readGitTreeFileV1 } from "../adapters/git-task-history.js";
10
+ import { readRepositoryLocalImportsV1 } from "../adapters/repository-import-context.js";
11
+ const execute = promisify(execFile);
12
+ async function fixture(t) {
13
+ const root = await realpath(await mkdtemp(join(tmpdir(), "foundry-import-context-")));
14
+ t.after(() => rm(root, { recursive: true, force: true }));
15
+ const file = async (path, content) => {
16
+ await mkdir(dirname(join(root, path)), { recursive: true });
17
+ await writeFile(join(root, path), content);
18
+ };
19
+ const git = (...args) => execute("git", ["-C", root, ...args]);
20
+ await git("init", "-q");
21
+ const commit = async () => {
22
+ await git("add", ".");
23
+ await git("-c", "core.hooksPath=/dev/null", "-c", "commit.gpgsign=false", "-c", "user.name=Fixture", "-c", "user.email=fixture@example.test", "commit", "-qm", "pinned context fixture");
24
+ return (await git("rev-parse", "HEAD")).stdout.trim();
25
+ };
26
+ const context = (ref, paths, dependencyContextVersion) => Effect.runPromise(Effect.gen(function* () {
27
+ const snapshot = yield* captureGitTreeSnapshotV1({
28
+ repositoryRoot: root,
29
+ requestedRef: ref
30
+ });
31
+ const sources = yield* Effect.forEach(paths, (path) => Effect.map(readGitTreeFileV1({ snapshot, path }), (content) => ({ path, content })));
32
+ return yield* readRepositoryLocalImportsV1({
33
+ snapshot,
34
+ sources,
35
+ ...(dependencyContextVersion === undefined ? {} : { dependencyContextVersion })
36
+ });
37
+ }));
38
+ return { file, commit, context };
39
+ }
40
+ test("local helper context stays pinned and separates initial, reference, and dirty source", async (t) => {
41
+ const f = await fixture(t);
42
+ await f.file("src/subject.ts", 'export { create } from "./test/helpers.js";\n');
43
+ await f.file("src/test/helpers.ts", 'export const create = () => "INITIAL_HELPER";\n');
44
+ await f.file("src/test/helpers.js", 'export const create = () => "STALE_GENERATED_OUTPUT";\n');
45
+ const initial = await f.commit();
46
+ await f.file("src/test/helpers.ts", 'export const create = () => "REFERENCE_HELPER";\n');
47
+ const reference = await f.commit();
48
+ await f.file("src/test/helpers.ts", 'export const create = () => "DIRTY_WORKING_TREE";\n');
49
+ const before = await f.context(initial, ["src/subject.ts"]);
50
+ const after = await f.context(reference, ["src/subject.ts"]);
51
+ assert.equal(before.commit, initial);
52
+ assert.equal(after.commit, reference);
53
+ assert.deepEqual(before.sources, [
54
+ { path: "src/test/helpers.ts", content: 'export const create = () => "INITIAL_HELPER";\n' }
55
+ ]);
56
+ assert.deepEqual(after.sources, [
57
+ { path: "src/test/helpers.ts", content: 'export const create = () => "REFERENCE_HELPER";\n' }
58
+ ]);
59
+ assert.deepEqual(before.omitted, []);
60
+ assert.deepEqual(before.unresolved, []);
61
+ assert.equal(JSON.stringify([before, after]).includes("DIRTY_WORKING_TREE"), false);
62
+ });
63
+ test("local imports resolve source extensions, stop at the depth boundary, and disclose unresolved paths", async (t) => {
64
+ const f = await fixture(t);
65
+ await f.file("src/subject.ts", `
66
+ import {
67
+ create
68
+ } from "./helpers.mjs";
69
+ const settings = require("./settings.json");
70
+ const dynamic = import("./directory");
71
+ import absent from "./missing.js";
72
+ import outside from "../../outside.js";
73
+ import secret from "../.env";
74
+ export { create };
75
+ `);
76
+ await f.file("src/helpers.mts", 'export { create } from "./inner.cjs";\n');
77
+ await f.file("src/inner.cts", 'export { create } from "./deeper.js";\n');
78
+ await f.file("src/deeper.ts", "export const create = () => 1;\n");
79
+ await f.file("src/settings.json", '{"delay":10}\n');
80
+ await f.file("src/directory/index.ts", "export const value = 1;\n");
81
+ await f.file(".env", "PRIVATE_CONTEXT_CANARY\n");
82
+ const ref = await f.commit();
83
+ const context = await f.context(ref, ["src/subject.ts"]);
84
+ assert.deepEqual(context.sources.map((source) => source.path).sort(), [
85
+ "src/directory/index.ts",
86
+ "src/helpers.mts",
87
+ "src/inner.cts",
88
+ "src/settings.json"
89
+ ]);
90
+ assert.deepEqual(context.omitted, [{ path: "src/deeper.ts", reason: "depth" }]);
91
+ assert.deepEqual(context.unresolved.map((entry) => entry.specifier).sort(), [
92
+ "../../outside.js",
93
+ "../.env",
94
+ "./missing.js"
95
+ ]);
96
+ assert.equal(JSON.stringify(context).includes("PRIVATE_CONTEXT_CANARY"), false);
97
+ });
98
+ test("oversized supporting APIs are explicitly omitted, never presented as truncated complete code", async (t) => {
99
+ const f = await fixture(t);
100
+ await f.file("src/subject.ts", `
101
+ import "./large.js";
102
+ import "./first.js";
103
+ import "./second.js";
104
+ import "./test/helpers.js";
105
+ `);
106
+ await f.file("src/large.ts", "x".repeat(48_001));
107
+ const first = `export const first = "${"a".repeat(35_000)}";\n`;
108
+ await f.file("src/first.ts", first);
109
+ await f.file("src/second.ts", `export const second = "${"b".repeat(35_000)}";\n`);
110
+ await f.file("src/test/helpers.ts", "export const create = () => 1;\n");
111
+ const context = await f.context(await f.commit(), ["src/subject.ts"]);
112
+ assert.equal(context.sources[0]?.path, "src/test/helpers.ts");
113
+ assert.equal(context.sources.find((source) => source.path === "src/first.ts")?.content, first);
114
+ assert.deepEqual(context.omitted, [
115
+ { path: "src/large.ts", reason: "file-size" },
116
+ { path: "src/second.ts", reason: "total-size" }
117
+ ]);
118
+ assert.equal(context.sources.some((source) => source.content.includes("[truncated]")), false);
119
+ });
120
+ test("direct task dependencies take precedence over unrelated exports in a large facade", async (t) => {
121
+ const f = await fixture(t);
122
+ await f.file("src/subject.ts", 'import { create } from "./z-required.js";\nexport { create };\n');
123
+ await f.file("src/index.ts", 'export * from "./a-unrelated.js";\nexport * from "./z-required.js";\n');
124
+ const required = `export const create = () => "${"x".repeat(39_000)}";\n`;
125
+ await f.file("src/z-required.ts", required);
126
+ await f.file("src/a-unrelated.ts", `export const unrelated = "${"y".repeat(39_000)}";\n`);
127
+ const context = await f.context(await f.commit(), ["src/index.ts", "src/subject.ts"]);
128
+ assert.deepEqual(context.sources, [{ path: "src/z-required.ts", content: required }]);
129
+ assert.deepEqual(context.omitted, [{ path: "src/a-unrelated.ts", reason: "total-size" }]);
130
+ });
131
+ test("workspace exports load pinned implementation and transitive facade sources without changing legacy context", async (t) => {
132
+ const f = await fixture(t);
133
+ await f.file("package.json", '{"name":"root","private":true}\n');
134
+ await f.file("pnpm-workspace.yaml", "packages:\n - packages/*\n");
135
+ await f.file("packages/app/package.json", '{"name":"app"}\n');
136
+ await f.file("packages/app/src/subject.ts", 'import { Decoder } from "@fixture/runtime/sse";\nexport { Decoder };\n');
137
+ await f.file("packages/runtime/package.json", JSON.stringify({
138
+ name: "@fixture/runtime",
139
+ exports: {
140
+ "./sse": { types: "./dist/sse-api.d.ts", default: "./dist/sse-api.js" },
141
+ "./utility/*": { import: "./dist/utilities/*.js" }
142
+ }
143
+ }));
144
+ await f.file("packages/runtime/tsconfig.json", '{"compilerOptions":{"rootDir":"src","outDir":"dist"}}\n');
145
+ await f.file("packages/runtime/src/sse-api.ts", 'export { Decoder } from "./streaming/decoder.js";\n');
146
+ await f.file("packages/runtime/src/streaming/decoder.ts", 'export class Decoder { flush() { throw new Error("INITIAL_EOF_CONTRACT"); } }\n');
147
+ await f.file("packages/runtime/src/utilities/value.ts", "export const value = 1;\n");
148
+ await f.file("packages/app/src/pattern.ts", 'import { value } from "@fixture/runtime/utility/value";\nexport { value };\n');
149
+ const initial = await f.commit();
150
+ await f.file("packages/runtime/src/streaming/decoder.ts", 'export class Decoder { flush() { return "REFERENCE_EOF_CONTRACT"; } }\n');
151
+ const reference = await f.commit();
152
+ await f.file("packages/runtime/src/streaming/decoder.ts", "export const DIRTY_WORKSPACE_CANARY = true;\n");
153
+ const paths = ["packages/app/src/subject.ts", "packages/app/src/pattern.ts"];
154
+ const legacy = await f.context(initial, paths);
155
+ assert.deepEqual(legacy.sources, []);
156
+ assert.deepEqual(legacy.unresolved, [], "old request envelopes retain their original omission semantics");
157
+ const before = await f.context(initial, paths, 1);
158
+ const after = await f.context(reference, paths, 1);
159
+ assert.deepEqual(before.sources.map((source) => source.path).sort(), [
160
+ "packages/runtime/src/sse-api.ts",
161
+ "packages/runtime/src/streaming/decoder.ts",
162
+ "packages/runtime/src/utilities/value.ts"
163
+ ]);
164
+ assert.ok(before.sources.some((source) => source.content.includes("INITIAL_EOF_CONTRACT")));
165
+ assert.ok(after.sources.some((source) => source.content.includes("REFERENCE_EOF_CONTRACT")));
166
+ assert.equal(JSON.stringify([before, after]).includes("DIRTY_WORKSPACE_CANARY"), false);
167
+ assert.deepEqual(before.omitted, []);
168
+ assert.deepEqual(before.unresolved, []);
169
+ });
170
+ test("direct dependency chains receive context before unrelated facade exports consume the fixed budget", async (t) => {
171
+ const f = await fixture(t);
172
+ await f.file("src/subject.ts", 'import { needed } from "./z-api.js";\nexport { needed };\n');
173
+ await f.file("src/z-api.ts", 'export { needed } from "./z-implementation.js";\n');
174
+ await f.file("src/z-implementation.ts", "export const needed = 'CRITICAL_TRANSITIVE_CONTRACT';\n");
175
+ const exports = [];
176
+ for (let index = 0; index < 20; index += 1) {
177
+ const name = `a-unrelated-${String(index).padStart(2, "0")}`;
178
+ exports.push(`export * from "./${name}.js";`);
179
+ await f.file(`src/${name}.ts`, `export const value${index} = "${"x".repeat(5000)}";\n`);
180
+ }
181
+ await f.file("src/index.ts", exports.join("\n"));
182
+ const ref = await f.commit();
183
+ const context = await f.context(ref, ["src/index.ts", "src/subject.ts"], 1);
184
+ assert.ok(context.sources.some((source) => source.path === "src/z-implementation.ts"));
185
+ assert.equal(context.sources.length <= 16, true);
186
+ assert.equal(context.sources.reduce((total, source) => total + Buffer.byteLength(source.content), 0) <=
187
+ 64000, true);
188
+ assert.ok(context.omitted.length > 0);
189
+ assert.equal(context.omitted.some((entry) => entry.path === "src/z-implementation.ts"), false);
190
+ });
191
+ test("workspace context excludes nonmembers, ambiguous names, unsupported exports, and escaping targets", async (t) => {
192
+ const f = await fixture(t);
193
+ await f.file("pnpm-workspace.yaml", "packages:\n - packages/*\n - '!packages/excluded'\n");
194
+ await f.file("package.json", '{"name":"root"}\n');
195
+ await f.file("src/subject.ts", `
196
+ import "node:fs";
197
+ import "@fixture/runtime/private";
198
+ import "@fixture/runtime/escape";
199
+ import "@fixture/excluded";
200
+ import "@fixture/duplicate";
201
+ import "external-library";
202
+ `);
203
+ await f.file("packages/runtime/package.json", JSON.stringify({
204
+ name: "@fixture/runtime",
205
+ exports: { "./private": "./.env", "./escape": "./../../private.ts" }
206
+ }));
207
+ await f.file("packages/runtime/.env", "PRIVATE_CONTEXT_CANARY\n");
208
+ await f.file("private.ts", "export const secret = 'PRIVATE_CONTEXT_CANARY';\n");
209
+ await f.file("packages/excluded/package.json", '{"name":"@fixture/excluded","main":"./index.js"}\n');
210
+ await f.file("packages/excluded/index.js", "export const secret = 'NONMEMBER_CONTEXT_CANARY';\n");
211
+ for (const path of ["packages/first", "packages/second"]) {
212
+ await f.file(`${path}/package.json`, '{"name":"@fixture/duplicate","main":"./index.js"}\n');
213
+ await f.file(`${path}/index.js`, "export const secret = 'AMBIGUOUS_CONTEXT_CANARY';\n");
214
+ }
215
+ const context = await f.context(await f.commit(), ["src/subject.ts"], 1);
216
+ assert.deepEqual(context.sources, []);
217
+ assert.deepEqual(context.unresolved.map((entry) => entry.specifier).sort(), [
218
+ "@fixture/duplicate",
219
+ "@fixture/runtime/escape",
220
+ "@fixture/runtime/private"
221
+ ]);
222
+ assert.doesNotMatch(JSON.stringify(context), /PRIVATE_CONTEXT_CANARY|NONMEMBER_CONTEXT_CANARY|AMBIGUOUS_CONTEXT_CANARY/u);
223
+ });
224
+ test("requested symbols cross aliases without a broad imported facade exhausting the context budget", async (t) => {
225
+ const f = await fixture(t);
226
+ await f.file("src/subject.ts", `
227
+ import type { RouteError } from "./a-types-api.js";
228
+ import { publicDecoder as Decoder } from "./z-runtime-api.js";
229
+ // import "../.env";
230
+ const documentation = 'import "../.env"';
231
+ export { Decoder };
232
+ `);
233
+ const unrelated = [];
234
+ for (let index = 0; index < 20; index += 1) {
235
+ unrelated.push(`export { unused${index} } from "./a-unrelated-${index}.js";`);
236
+ await f.file(`src/a-unrelated-${index}.ts`, `export const unused${index} = 1;\n`);
237
+ }
238
+ await f.file("src/a-types-api.ts", `${unrelated.join("\n")}\nexport { Failure as RouteError } from "./errors.js";\n`);
239
+ await f.file("src/errors.ts", "export class Failure extends Error {}\n");
240
+ await f.file("src/z-runtime-api.ts", `${unrelated.join("\n")}\nexport { default as publicDecoder } from "./decoder.js";\n`);
241
+ await f.file("src/decoder.ts", 'export default class Decoder { flush() { throw new Error("PARTIAL_EVENT"); } }\n');
242
+ const context = await f.context(await f.commit(), ["src/subject.ts"], 1);
243
+ assert.deepEqual(context.sources.map((source) => source.path), ["src/z-runtime-api.ts", "src/decoder.ts", "src/a-types-api.ts", "src/errors.ts"]);
244
+ assert.deepEqual(context.omitted, []);
245
+ assert.deepEqual(context.unresolved, []);
246
+ });
247
+ test("namespace and dynamic imports retain complete modules while named reexports select their original binding", async (t) => {
248
+ const f = await fixture(t);
249
+ await f.file("src/subject.ts", 'import * as utilities from "./api.js";\nconst dynamic = import("./dynamic.js");\n');
250
+ await f.file("src/api.ts", 'export * as nested from "./helpers.js";\n');
251
+ await f.file("src/helpers.ts", "export const needed = 1;\n");
252
+ await f.file("src/dynamic.ts", 'export { needed as value } from "./helpers.js";\n');
253
+ const context = await f.context(await f.commit(), ["src/subject.ts"], 1);
254
+ assert.deepEqual(context.sources.map((source) => source.path).sort(), [
255
+ "src/api.ts",
256
+ "src/dynamic.ts",
257
+ "src/helpers.ts"
258
+ ]);
259
+ assert.deepEqual(context.omitted, []);
260
+ assert.deepEqual(context.unresolved, []);
261
+ });
262
+ test("V2 preserves small API definitions under the budget pressure that excludes them from V1", async (t) => {
263
+ const f = await fixture(t);
264
+ await f.file("src/subject.ts", `
265
+ import "./test/helpers.js";
266
+ import { first } from "./a-first.js";
267
+ import { second } from "./b-second.js";
268
+ import { third } from "./c-third.js";
269
+ import type { Strategy } from "./z-types.js";
270
+ import { Failure } from "./y-errors.js";
271
+ `);
272
+ await f.file("src/test/helpers.ts", "export const create = () => 1;\n");
273
+ for (const [path, name] of [
274
+ ["a-first", "first"],
275
+ ["b-second", "second"],
276
+ ["c-third", "third"]
277
+ ]) {
278
+ await f.file(`src/${path}.ts`, `export const ${name} = "${"x".repeat(31_000)}";\n`);
279
+ }
280
+ const types = `export type Strategy = "round_robin" | "most_capacity";\n/* ${"type documentation ".repeat(160)} */\n`;
281
+ const errors = "export class Failure extends Error { readonly retryable = true; }\n";
282
+ await f.file("src/z-types.ts", types);
283
+ await f.file("src/y-errors.ts", errors);
284
+ const ref = await f.commit();
285
+ const before = await f.context(ref, ["src/subject.ts"], 1);
286
+ const after = await f.context(ref, ["src/subject.ts"], 2);
287
+ assert.equal(before.sources.some((source) => source.path === "src/z-types.ts"), false, "the old runtime-first packet must reproduce the original failure");
288
+ assert.deepEqual(after.sources.find((source) => source.path === "src/z-types.ts"), { path: "src/z-types.ts", content: types });
289
+ assert.deepEqual(after.sources.find((source) => source.path === "src/y-errors.ts"), { path: "src/y-errors.ts", content: errors });
290
+ assert.equal(after.sources[0]?.path, "src/test/helpers.ts");
291
+ assert.ok(after.omitted.some((entry) => entry.reason === "total-size"));
292
+ assert.ok(after.sources.length <= 24);
293
+ assert.ok(after.sources.reduce((total, source) => total + Buffer.byteLength(source.content), 0) <= 96_000);
294
+ assert.equal(after.sources.some((source) => source.content.includes("[truncated]")), false);
295
+ assert.deepEqual(await f.context(ref, ["src/subject.ts"], 1), before);
296
+ });
297
+ test("V2 follows requested facade aliases through pinned trees without expanding unrelated exports", async (t) => {
298
+ const f = await fixture(t);
299
+ await f.file("package.json", '{"name":"root","private":true}\n');
300
+ await f.file("pnpm-workspace.yaml", "packages:\n - packages/*\n");
301
+ await f.file("packages/app/package.json", '{"name":"app"}\n');
302
+ await f.file("packages/app/src/subject.ts", 'import type { Strategy } from "@fixture/contracts";\n');
303
+ await f.file("packages/contracts/package.json", '{"name":"@fixture/contracts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}}}\n');
304
+ await f.file("packages/contracts/tsconfig.json", '{"compilerOptions":{"rootDir":"src","outDir":"dist"}}\n');
305
+ await f.file("packages/contracts/src/index.ts", 'export type { PublicStrategy as Strategy } from "./api.js";\nexport { unrelated } from "./unrelated.js";\n');
306
+ await f.file("packages/contracts/src/api.ts", 'export type { InternalStrategy as PublicStrategy } from "./implementation.js";\n');
307
+ await f.file("packages/contracts/src/implementation.ts", 'export type { InternalStrategy } from "./types.js";\n');
308
+ const typesPath = "packages/contracts/src/types.ts";
309
+ await f.file(typesPath, 'export type InternalStrategy = "INITIAL_STRATEGY";\n');
310
+ await f.file("packages/contracts/src/unrelated.ts", 'export const unrelated = "UNRELATED_EXPORT_CANARY";\n');
311
+ const initial = await f.commit();
312
+ await f.file(typesPath, 'export type InternalStrategy = "REFERENCE_STRATEGY";\n');
313
+ const reference = await f.commit();
314
+ await f.file(typesPath, 'export type InternalStrategy = "DIRTY_STRATEGY_CANARY";\n');
315
+ await f.file("packages/contracts/dist/index.d.ts", 'export type Strategy = "STALE_OUTPUT_CANARY";\n');
316
+ const paths = ["packages/app/src/subject.ts"];
317
+ const old = await f.context(initial, paths, 1);
318
+ assert.equal(old.sources.some((source) => source.path === typesPath), false);
319
+ const before = await f.context(initial, paths, 2);
320
+ const after = await f.context(reference, paths, 2);
321
+ assert.equal(before.commit, initial);
322
+ assert.equal(after.commit, reference);
323
+ assert.ok(before.sources.some((source) => source.content.includes("INITIAL_STRATEGY")));
324
+ assert.ok(after.sources.some((source) => source.content.includes("REFERENCE_STRATEGY")));
325
+ assert.deepEqual(before.sources.map((source) => source.path).sort(), [
326
+ "packages/contracts/src/api.ts",
327
+ "packages/contracts/src/implementation.ts",
328
+ "packages/contracts/src/index.ts",
329
+ typesPath
330
+ ]);
331
+ assert.deepEqual(before.omitted, []);
332
+ assert.deepEqual(before.unresolved, []);
333
+ assert.doesNotMatch(JSON.stringify([before, after]), /DIRTY_STRATEGY_CANARY|STALE_OUTPUT_CANARY|UNRELATED_EXPORT_CANARY/u);
334
+ });
335
+ test("V2 facade traversal terminates on cycles and retains behavioral depth and whole-file limits", async (t) => {
336
+ const f = await fixture(t);
337
+ await f.file("src/subject.ts", 'import { value } from "./api.js";\nimport "./large.js";\nimport * as root from "./broad.js";\n');
338
+ await f.file("src/api.ts", 'export { value } from "./loop.js";\nexport { unused } from "./unrelated.js";\n');
339
+ await f.file("src/loop.ts", 'export { value } from "./api.js";\nimport "./runtime.js";\n');
340
+ await f.file("src/runtime.ts", 'import "./deep.js";\nexport const runtime = 1;\n');
341
+ await f.file("src/deep.ts", 'export const deep = "BEHAVIORAL_DEPTH_CANARY";\n');
342
+ await f.file("src/broad.ts", 'export * from "./broad-inner.js";\n');
343
+ await f.file("src/broad-inner.ts", 'export * from "./broad-deep.js";\n');
344
+ await f.file("src/broad-deep.ts", 'export const broad = "BROAD_DEPTH_CANARY";\n');
345
+ await f.file("src/unrelated.ts", 'export const unused = "UNREQUESTED_EXPORT_CANARY";\n');
346
+ await f.file("src/large.ts", "x".repeat(48_001));
347
+ const context = await f.context(await f.commit(), ["src/subject.ts"], 2);
348
+ assert.equal(new Set(context.sources.map((source) => source.path)).size, context.sources.length);
349
+ assert.ok(context.sources.some((source) => source.path === "src/runtime.ts"));
350
+ assert.ok(context.omitted.some((entry) => entry.path === "src/deep.ts" && entry.reason === "depth"));
351
+ assert.ok(context.omitted.some((entry) => entry.path === "src/broad-deep.ts" && entry.reason === "depth"));
352
+ assert.ok(context.omitted.some((entry) => entry.path === "src/large.ts" && entry.reason === "file-size"));
353
+ assert.doesNotMatch(JSON.stringify(context), /BEHAVIORAL_DEPTH_CANARY|BROAD_DEPTH_CANARY|UNREQUESTED_EXPORT_CANARY/u);
354
+ });
@@ -0,0 +1 @@
1
+ export {};