@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.
- package/dist/adapters/authoring-responses-request.d.ts +5 -0
- package/dist/adapters/authoring-responses-request.js +38 -0
- package/dist/adapters/evaluation-evidence-freshness.d.ts +7 -0
- package/dist/adapters/evaluation-evidence-freshness.js +76 -0
- package/dist/adapters/git-task-history.d.ts +67 -0
- package/dist/adapters/git-task-history.js +171 -0
- package/dist/adapters/integrated-repository-history.d.ts +21 -0
- package/dist/adapters/integrated-repository-history.js +175 -0
- package/dist/adapters/repository-command-diagnostic.d.ts +8 -0
- package/dist/adapters/repository-command-diagnostic.js +46 -0
- package/dist/adapters/repository-command-evidence.d.ts +13 -0
- package/dist/adapters/repository-command-evidence.js +102 -0
- package/dist/adapters/repository-command-runner.d.ts +238 -0
- package/dist/adapters/repository-command-runner.js +1483 -0
- package/dist/adapters/repository-import-context.d.ts +47 -0
- package/dist/adapters/repository-import-context.js +469 -0
- package/dist/adapters/repository-node-test-reporter.d.ts +3 -0
- package/dist/adapters/repository-node-test-reporter.js +27 -0
- package/dist/adapters/repository-review-evidence.d.ts +39 -0
- package/dist/adapters/repository-review-evidence.js +632 -0
- package/dist/adapters/repository-seed-selection.d.ts +7 -0
- package/dist/adapters/repository-seed-selection.js +79 -0
- package/dist/adapters/repository-solution-edits.d.ts +49 -0
- package/dist/adapters/repository-solution-edits.js +136 -0
- package/dist/adapters/repository-vitest-phase-adapter.d.ts +8 -0
- package/dist/adapters/repository-vitest-phase-adapter.js +310 -0
- package/dist/adapters/repository-vitest-reporter.d.ts +24 -0
- package/dist/adapters/repository-vitest-reporter.js +314 -0
- package/dist/adapters/strict-authoring-schema.d.ts +5 -0
- package/dist/adapters/strict-authoring-schema.js +158 -0
- package/dist/adapters/test-discovery.d.ts +30 -0
- package/dist/adapters/test-discovery.js +124 -0
- package/dist/adapters/typescript-repository-index.d.ts +51 -0
- package/dist/adapters/typescript-repository-index.js +226 -0
- package/dist/agentic-capabilities-protocol.d.ts +1373 -0
- package/dist/agentic-capabilities-protocol.js +786 -0
- package/dist/case-checkpoint-store.d.ts +29 -0
- package/dist/case-checkpoint-store.js +133 -0
- package/dist/case-pipeline-protocol-v2.d.ts +184 -0
- package/dist/case-pipeline-protocol-v2.js +193 -0
- package/dist/case-pipeline-protocol.d.ts +2626 -0
- package/dist/case-pipeline-protocol.js +371 -0
- package/dist/effect-api.d.ts +74 -10
- package/dist/effect-api.js +56 -6
- package/dist/errors.d.ts +31 -0
- package/dist/errors.js +10 -0
- package/dist/eval-capability-execution-envelope.d.ts +64 -0
- package/dist/eval-capability-execution-envelope.js +98 -0
- package/dist/eval-capability-policy.d.ts +90 -0
- package/dist/eval-capability-policy.js +107 -0
- package/dist/eval-event-log.d.ts +140 -0
- package/dist/eval-event-log.js +220 -0
- package/dist/evaluation-authoring-policy.d.ts +18 -0
- package/dist/evaluation-authoring-policy.js +19 -0
- package/dist/evaluation-authoring-validation.d.ts +22 -0
- package/dist/evaluation-authoring-validation.js +72 -0
- package/dist/evaluation-evidence.d.ts +20 -0
- package/dist/evaluation-evidence.js +319 -0
- package/dist/evaluation-grader-calibration-protocol.d.ts +108 -0
- package/dist/evaluation-grader-calibration-protocol.js +80 -0
- package/dist/evaluation-grader-calibration.d.ts +18 -0
- package/dist/evaluation-grader-calibration.js +334 -0
- package/dist/evaluation-grading-policy.d.ts +24 -0
- package/dist/evaluation-grading-policy.js +54 -0
- package/dist/evaluation-proposal-policy.d.ts +4 -0
- package/dist/evaluation-proposal-policy.js +91 -0
- package/dist/evaluation-source-retrieval.d.ts +68 -0
- package/dist/evaluation-source-retrieval.js +513 -0
- package/dist/evaluation-structure-policy.d.ts +29 -0
- package/dist/evaluation-structure-policy.js +138 -0
- package/dist/index.d.ts +124 -17
- package/dist/index.js +69 -11
- package/dist/inspection.js +2 -3
- package/dist/project-artifacts.d.ts +7 -2
- package/dist/project-artifacts.js +49 -136
- package/dist/project-authoring.d.ts +66 -5
- package/dist/project-authoring.js +783 -109
- package/dist/project-contracts.d.ts +419 -84
- package/dist/project-contracts.js +160 -52
- package/dist/project-store.js +2 -1
- package/dist/project-workflow.d.ts +5 -4
- package/dist/project-workflow.js +154 -35
- package/dist/repository-adversary-protocol.d.ts +64 -0
- package/dist/repository-adversary-protocol.js +105 -0
- package/dist/repository-behavior-protocol.d.ts +188 -0
- package/dist/repository-behavior-protocol.js +202 -0
- package/dist/repository-benchmark-protocol.d.ts +487 -0
- package/dist/repository-benchmark-protocol.js +96 -0
- package/dist/repository-execution-protocol.d.ts +150 -0
- package/dist/repository-execution-protocol.js +38 -0
- package/dist/repository-fixture-instructions.d.ts +3 -0
- package/dist/repository-fixture-instructions.js +91 -0
- package/dist/repository-fixture-protocol.d.ts +79 -0
- package/dist/repository-fixture-protocol.js +79 -0
- package/dist/repository-foundry-plan-protocol.d.ts +118 -0
- package/dist/repository-foundry-plan-protocol.js +296 -0
- package/dist/repository-foundry-progress-protocol.d.ts +52 -0
- package/dist/repository-foundry-progress-protocol.js +52 -0
- package/dist/repository-improvement-protocol.d.ts +100 -0
- package/dist/repository-improvement-protocol.js +106 -0
- package/dist/repository-language-model-protocol.d.ts +43 -0
- package/dist/repository-language-model-protocol.js +146 -0
- package/dist/repository-oracle-coverage-protocol.d.ts +18 -0
- package/dist/repository-oracle-coverage-protocol.js +39 -0
- package/dist/repository-oracle-execution-binding.d.ts +27 -0
- package/dist/repository-oracle-execution-binding.js +59 -0
- package/dist/repository-oracle-protocol.d.ts +230 -0
- package/dist/repository-oracle-protocol.js +156 -0
- package/dist/repository-oracle-scope-policy.d.ts +22 -0
- package/dist/repository-oracle-scope-policy.js +92 -0
- package/dist/repository-quality-policy.d.ts +15 -0
- package/dist/repository-quality-policy.js +357 -0
- package/dist/repository-routing-benchmark-protocol.d.ts +176 -0
- package/dist/repository-routing-benchmark-protocol.js +103 -0
- package/dist/repository-routing-model-protocol.d.ts +36 -0
- package/dist/repository-routing-model-protocol.js +89 -0
- package/dist/repository-routing-plan-protocol.d.ts +112 -0
- package/dist/repository-routing-plan-protocol.js +58 -0
- package/dist/repository-routing-quality-policy.d.ts +9 -0
- package/dist/repository-routing-quality-policy.js +191 -0
- package/dist/repository-seed-qualification-progress-protocol.d.ts +205 -0
- package/dist/repository-seed-qualification-progress-protocol.js +28 -0
- package/dist/repository-semantic-calibration-protocol.d.ts +768 -0
- package/dist/repository-semantic-calibration-protocol.js +276 -0
- package/dist/repository-semantic-calibration.d.ts +163 -0
- package/dist/repository-semantic-calibration.js +581 -0
- package/dist/repository-specification-contract-facts-protocol.d.ts +224 -0
- package/dist/repository-specification-contract-facts-protocol.js +276 -0
- package/dist/repository-specification-critique-protocol.d.ts +189 -0
- package/dist/repository-specification-critique-protocol.js +103 -0
- package/dist/repository-task-family-protocol.d.ts +24 -0
- package/dist/repository-task-family-protocol.js +37 -0
- package/dist/repository-task-seed-protocol.d.ts +384 -0
- package/dist/repository-task-seed-protocol.js +236 -0
- package/dist/repository-trajectory-protocol.d.ts +20 -0
- package/dist/repository-trajectory-protocol.js +42 -0
- package/dist/service.js +1 -1
- package/dist/services/adversary/service.d.ts +64 -0
- package/dist/services/adversary/service.js +330 -0
- package/dist/services/benchmark-compiler/service.d.ts +450 -0
- package/dist/services/benchmark-compiler/service.js +9 -0
- package/dist/services/budgeted-model/service.d.ts +118 -0
- package/dist/services/budgeted-model/service.js +460 -0
- package/dist/services/case-authoring/service.d.ts +163 -0
- package/dist/services/case-authoring/service.js +1456 -0
- package/dist/services/case-finalization/service.d.ts +283 -0
- package/dist/services/case-finalization/service.js +370 -0
- package/dist/services/case-generation/service.d.ts +619 -0
- package/dist/services/case-generation/service.js +2628 -0
- package/dist/services/case-pipeline/service.d.ts +31 -0
- package/dist/services/case-pipeline/service.js +485 -0
- package/dist/services/case-pipeline-v2/service.d.ts +70 -0
- package/dist/services/case-pipeline-v2/service.js +477 -0
- package/dist/services/command-observability/service.d.ts +13 -0
- package/dist/services/command-observability/service.js +3 -0
- package/dist/services/dimension-labeling/service.d.ts +77 -0
- package/dist/services/dimension-labeling/service.js +188 -0
- package/dist/services/eval-candidate/service.d.ts +208 -0
- package/dist/services/eval-candidate/service.js +64 -0
- package/dist/services/eval-capabilities/service.d.ts +183 -0
- package/dist/services/eval-capabilities/service.js +1433 -0
- package/dist/services/eval-environment/service.d.ts +173 -0
- package/dist/services/eval-environment/service.js +127 -0
- package/dist/services/evidence-reconstruction/service.d.ts +36 -0
- package/dist/services/evidence-reconstruction/service.js +145 -0
- package/dist/services/fixture-builder/service.d.ts +62 -0
- package/dist/services/fixture-builder/service.js +36 -0
- package/dist/services/fixture-validation/service.d.ts +75 -0
- package/dist/services/fixture-validation/service.js +295 -0
- package/dist/services/foundry/service.d.ts +831 -0
- package/dist/services/foundry/service.js +442 -0
- package/dist/services/foundry-progress/service.d.ts +62 -0
- package/dist/services/foundry-progress/service.js +149 -0
- package/dist/services/foundry-v2/service.d.ts +54 -0
- package/dist/services/foundry-v2/service.js +28 -0
- package/dist/services/grounded-authoring/service.d.ts +126 -0
- package/dist/services/grounded-authoring/service.js +822 -0
- package/dist/services/historical-case/service.d.ts +722 -0
- package/dist/services/historical-case/service.js +177 -0
- package/dist/services/improvement-loop/service.d.ts +59 -0
- package/dist/services/improvement-loop/service.js +176 -0
- package/dist/services/language-model/service.d.ts +52 -0
- package/dist/services/language-model/service.js +194 -0
- package/dist/services/oracle-builder/service.d.ts +146 -0
- package/dist/services/oracle-builder/service.js +513 -0
- package/dist/services/oracle-coverage/service.d.ts +28 -0
- package/dist/services/oracle-coverage/service.js +50 -0
- package/dist/services/oracle-coverage-witness/service.d.ts +130 -0
- package/dist/services/oracle-coverage-witness/service.js +538 -0
- package/dist/services/pipeline-challenge/service.d.ts +551 -0
- package/dist/services/pipeline-challenge/service.js +427 -0
- package/dist/services/pipeline-controls/service.d.ts +130 -0
- package/dist/services/pipeline-controls/service.js +483 -0
- package/dist/services/pipeline-oracle/service.d.ts +8 -0
- package/dist/services/pipeline-oracle/service.js +256 -0
- package/dist/services/pipeline-seed/service.d.ts +298 -0
- package/dist/services/pipeline-seed/service.js +428 -0
- package/dist/services/pipeline-spec/service.d.ts +103 -0
- package/dist/services/pipeline-spec/service.js +619 -0
- package/dist/services/pipeline-tournament/service.d.ts +258 -0
- package/dist/services/pipeline-tournament/service.js +476 -0
- package/dist/services/quality-gate/service.d.ts +233 -0
- package/dist/services/quality-gate/service.js +136 -0
- package/dist/services/repository-bundle/service.d.ts +33 -0
- package/dist/services/repository-bundle/service.js +114 -0
- package/dist/services/repository-model/service.d.ts +105 -0
- package/dist/services/repository-model/service.js +250 -0
- package/dist/services/repository-public-artifact/service.d.ts +133 -0
- package/dist/services/repository-public-artifact/service.js +330 -0
- package/dist/services/routing-benchmark/service.d.ts +362 -0
- package/dist/services/routing-benchmark/service.js +96 -0
- package/dist/services/specification-critic/service.d.ts +92 -0
- package/dist/services/specification-critic/service.js +172 -0
- package/dist/services/task-family/service.d.ts +40 -0
- package/dist/services/task-family/service.js +55 -0
- package/dist/services/task-seed/service.d.ts +906 -0
- package/dist/services/task-seed/service.js +1406 -0
- package/dist/services/task-specification/service.d.ts +27 -0
- package/dist/services/task-specification/service.js +40 -0
- package/dist/services/trajectory-policy/service.d.ts +110 -0
- package/dist/services/trajectory-policy/service.js +216 -0
- package/dist/test/agentic-capabilities-protocol.test.d.ts +1 -0
- package/dist/test/agentic-capabilities-protocol.test.js +570 -0
- package/dist/test/agentic-capabilities.test.d.ts +1 -0
- package/dist/test/agentic-capabilities.test.js +1461 -0
- package/dist/test/agentic-environment.test.d.ts +1 -0
- package/dist/test/agentic-environment.test.js +213 -0
- package/dist/test/case-pipeline-foundation.test.d.ts +1 -0
- package/dist/test/case-pipeline-foundation.test.js +535 -0
- package/dist/test/case-pipeline-protocol-v2.test.d.ts +1 -0
- package/dist/test/case-pipeline-protocol-v2.test.js +124 -0
- package/dist/test/case-pipeline-v2.test.d.ts +1 -0
- package/dist/test/case-pipeline-v2.test.js +286 -0
- package/dist/test/case-pipeline.test.d.ts +1 -0
- package/dist/test/case-pipeline.test.js +851 -0
- package/dist/test/eval-capability-policy.test.d.ts +1 -0
- package/dist/test/eval-capability-policy.test.js +50 -0
- package/dist/test/eval-event-log.test.d.ts +1 -0
- package/dist/test/eval-event-log.test.js +125 -0
- package/dist/test/evaluation-evidence-freshness.test.d.ts +1 -0
- package/dist/test/evaluation-evidence-freshness.test.js +44 -0
- package/dist/test/evaluation-evidence.test.d.ts +1 -0
- package/dist/test/evaluation-evidence.test.js +230 -0
- package/dist/test/evaluation-grader-calibration.test.d.ts +1 -0
- package/dist/test/evaluation-grader-calibration.test.js +373 -0
- package/dist/test/evaluation-proposal-digest.test.d.ts +1 -0
- package/dist/test/evaluation-proposal-digest.test.js +187 -0
- package/dist/test/evaluation-source-retrieval.test.d.ts +1 -0
- package/dist/test/evaluation-source-retrieval.test.js +237 -0
- package/dist/test/evaluation-structure-policy.test.d.ts +1 -0
- package/dist/test/evaluation-structure-policy.test.js +196 -0
- package/dist/test/fixtures/repository-resource-panel.d.ts +39 -0
- package/dist/test/fixtures/repository-resource-panel.js +111 -0
- package/dist/test/fixtures/vitest-boundary-panel.d.ts +84 -0
- package/dist/test/fixtures/vitest-boundary-panel.js +120 -0
- package/dist/test/fixtures/vitest-phase-panel.d.ts +135 -0
- package/dist/test/fixtures/vitest-phase-panel.js +213 -0
- package/dist/test/fixtures/vitest-reporter-results.d.ts +76 -0
- package/dist/test/fixtures/vitest-reporter-results.js +94 -0
- package/dist/test/grounded-authoring.test.d.ts +1 -0
- package/dist/test/grounded-authoring.test.js +565 -0
- package/dist/test/integrated-repository-history.test.d.ts +1 -0
- package/dist/test/integrated-repository-history.test.js +227 -0
- package/dist/test/project-authoring.test.js +593 -43
- package/dist/test/project-workflow.test.js +419 -40
- package/dist/test/repository-authoring-artifacts.test.d.ts +1 -0
- package/dist/test/repository-authoring-artifacts.test.js +185 -0
- package/dist/test/repository-bundle.test.d.ts +1 -0
- package/dist/test/repository-bundle.test.js +52 -0
- package/dist/test/repository-case-generation.test.d.ts +1 -0
- package/dist/test/repository-case-generation.test.js +3465 -0
- package/dist/test/repository-command-diagnostic.test.d.ts +1 -0
- package/dist/test/repository-command-diagnostic.test.js +55 -0
- package/dist/test/repository-command-signals.test.d.ts +1 -0
- package/dist/test/repository-command-signals.test.js +124 -0
- package/dist/test/repository-fixture-scope-coverage.test.d.ts +1 -0
- package/dist/test/repository-fixture-scope-coverage.test.js +127 -0
- package/dist/test/repository-fixture-validation.test.d.ts +1 -0
- package/dist/test/repository-fixture-validation.test.js +362 -0
- package/dist/test/repository-foundry-progress.test.d.ts +1 -0
- package/dist/test/repository-foundry-progress.test.js +110 -0
- package/dist/test/repository-foundry-quality.test.d.ts +1 -0
- package/dist/test/repository-foundry-quality.test.js +1138 -0
- package/dist/test/repository-import-context.test.d.ts +1 -0
- package/dist/test/repository-import-context.test.js +354 -0
- package/dist/test/repository-model-authoring.test.d.ts +1 -0
- package/dist/test/repository-model-authoring.test.js +544 -0
- package/dist/test/repository-model.test.d.ts +1 -0
- package/dist/test/repository-model.test.js +2195 -0
- package/dist/test/repository-node-test-reporter.test.d.ts +1 -0
- package/dist/test/repository-node-test-reporter.test.js +104 -0
- package/dist/test/repository-oracle-concurrency.test.d.ts +1 -0
- package/dist/test/repository-oracle-concurrency.test.js +542 -0
- package/dist/test/repository-oracle-coverage-witness.test.d.ts +1 -0
- package/dist/test/repository-oracle-coverage-witness.test.js +511 -0
- package/dist/test/repository-oracle-coverage.test.d.ts +1 -0
- package/dist/test/repository-oracle-coverage.test.js +168 -0
- package/dist/test/repository-oracle-evidence.test.d.ts +1 -0
- package/dist/test/repository-oracle-evidence.test.js +185 -0
- package/dist/test/repository-oracle-plan.test.d.ts +1 -0
- package/dist/test/repository-oracle-plan.test.js +176 -0
- package/dist/test/repository-overlay-isolation.test.d.ts +1 -0
- package/dist/test/repository-overlay-isolation.test.js +85 -0
- package/dist/test/repository-preparation-cache.test.d.ts +1 -0
- package/dist/test/repository-preparation-cache.test.js +414 -0
- package/dist/test/repository-public-artifact.test.d.ts +1 -0
- package/dist/test/repository-public-artifact.test.js +273 -0
- package/dist/test/repository-qualification-diagnostics.test.d.ts +1 -0
- package/dist/test/repository-qualification-diagnostics.test.js +524 -0
- package/dist/test/repository-reference-authoring.test.d.ts +1 -0
- package/dist/test/repository-reference-authoring.test.js +1633 -0
- package/dist/test/repository-review-evidence-v2.test.d.ts +1 -0
- package/dist/test/repository-review-evidence-v2.test.js +183 -0
- package/dist/test/repository-review-evidence.test.d.ts +1 -0
- package/dist/test/repository-review-evidence.test.js +124 -0
- package/dist/test/repository-seed-exclusions.test.d.ts +1 -0
- package/dist/test/repository-seed-exclusions.test.js +96 -0
- package/dist/test/repository-seed-selection.test.d.ts +1 -0
- package/dist/test/repository-seed-selection.test.js +504 -0
- package/dist/test/repository-semantic-calibration.test.d.ts +1 -0
- package/dist/test/repository-semantic-calibration.test.js +688 -0
- package/dist/test/repository-solution-edits.test.d.ts +1 -0
- package/dist/test/repository-solution-edits.test.js +377 -0
- package/dist/test/repository-specification-budget.test.d.ts +1 -0
- package/dist/test/repository-specification-budget.test.js +171 -0
- package/dist/test/repository-specification-contract-checkpoint.test.d.ts +1 -0
- package/dist/test/repository-specification-contract-checkpoint.test.js +228 -0
- package/dist/test/repository-specification-contract-facts.test.d.ts +1 -0
- package/dist/test/repository-specification-contract-facts.test.js +177 -0
- package/dist/test/repository-trajectory-authoring.test.d.ts +1 -0
- package/dist/test/repository-trajectory-authoring.test.js +176 -0
- package/dist/test/repository-valid-control-plan.test.d.ts +1 -0
- package/dist/test/repository-valid-control-plan.test.js +45 -0
- package/dist/test/repository-vitest-phase.test.d.ts +1 -0
- package/dist/test/repository-vitest-phase.test.js +848 -0
- package/dist/test/repository-vitest-reporter.test.d.ts +1 -0
- package/dist/test/repository-vitest-reporter.test.js +158 -0
- package/dist/test/repository-workspace-build.test.d.ts +1 -0
- package/dist/test/repository-workspace-build.test.js +160 -0
- package/dist/test/strict-authoring-schema.test.d.ts +1 -0
- package/dist/test/strict-authoring-schema.test.js +169 -0
- package/package.json +48 -6
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { Context, Effect, Layer } from "effect";
|
|
2
|
+
import type { RepositoryBehaviorMapV1 } from "../../repository-behavior-protocol.js";
|
|
3
|
+
import type { RepositoryBenchmarkCaseV1, RepositoryCandidateVisibleTaskV1 } from "../../repository-benchmark-protocol.js";
|
|
4
|
+
import type { RepositoryHiddenOracleV1 } from "../../repository-oracle-protocol.js";
|
|
5
|
+
import type { RepositorySpecificationCritiqueV1 } from "../../repository-specification-critique-protocol.js";
|
|
6
|
+
import type { RepositoryTaskFamilyV1 } from "../../repository-task-family-protocol.js";
|
|
7
|
+
import type { RepositoryTaskSeedV1 } from "../../repository-task-seed-protocol.js";
|
|
8
|
+
import type { RepositoryTrajectoryPolicyV1 } from "../../repository-trajectory-protocol.js";
|
|
9
|
+
export type QualityGateShape = {
|
|
10
|
+
readonly evaluate: (input: {
|
|
11
|
+
readonly map: RepositoryBehaviorMapV1;
|
|
12
|
+
readonly seed: RepositoryTaskSeedV1;
|
|
13
|
+
readonly family: RepositoryTaskFamilyV1;
|
|
14
|
+
readonly visible: RepositoryCandidateVisibleTaskV1;
|
|
15
|
+
readonly hidden: RepositoryHiddenOracleV1;
|
|
16
|
+
readonly specificationCritique: RepositorySpecificationCritiqueV1;
|
|
17
|
+
readonly trajectoryPolicy?: RepositoryTrajectoryPolicyV1;
|
|
18
|
+
}) => Effect.Effect<RepositoryBenchmarkCaseV1>;
|
|
19
|
+
};
|
|
20
|
+
declare const QualityGate_base: Context.ServiceClass<QualityGate, "@velum-labs/routekit-eval-setup/QualityGate", QualityGateShape>;
|
|
21
|
+
export declare class QualityGate extends QualityGate_base {
|
|
22
|
+
}
|
|
23
|
+
export declare const evaluateRepositoryBenchmarkDraftV1: (input: {
|
|
24
|
+
readonly map: RepositoryBehaviorMapV1;
|
|
25
|
+
readonly seed: RepositoryTaskSeedV1;
|
|
26
|
+
readonly family: RepositoryTaskFamilyV1;
|
|
27
|
+
readonly visible: RepositoryCandidateVisibleTaskV1;
|
|
28
|
+
readonly hidden: RepositoryHiddenOracleV1;
|
|
29
|
+
readonly specificationCritique: RepositorySpecificationCritiqueV1;
|
|
30
|
+
readonly trajectoryPolicy?: RepositoryTrajectoryPolicyV1;
|
|
31
|
+
}) => Effect.Effect<{
|
|
32
|
+
readonly id: string;
|
|
33
|
+
readonly version: 1;
|
|
34
|
+
readonly rejectionReasons: readonly string[];
|
|
35
|
+
readonly status: "rejected" | "valid-library" | "routing-eligible" | "routing-active";
|
|
36
|
+
readonly seedId: string;
|
|
37
|
+
readonly lane: "request" | "repository-agent";
|
|
38
|
+
readonly qualityFindings: readonly {
|
|
39
|
+
readonly axis: "coverage" | "stability" | "authenticity" | "specification-sufficiency" | "oracle-adequacy" | "distinctness" | "realism" | "leakage" | "triviality";
|
|
40
|
+
readonly outcome: "pass" | "fail" | "review-required";
|
|
41
|
+
readonly detail: string;
|
|
42
|
+
readonly evidence: readonly {
|
|
43
|
+
readonly kind: "symbol" | "package" | "public-surface" | "protocol" | "schema" | "test" | "command" | "history-episode" | "workload-signal" | "documentation";
|
|
44
|
+
readonly id: string;
|
|
45
|
+
readonly path?: string | undefined;
|
|
46
|
+
}[];
|
|
47
|
+
readonly evidenceIds: readonly string[];
|
|
48
|
+
}[];
|
|
49
|
+
readonly capabilityId: string;
|
|
50
|
+
readonly familyId: string;
|
|
51
|
+
readonly visible: {
|
|
52
|
+
readonly lane: "request";
|
|
53
|
+
readonly id: string;
|
|
54
|
+
readonly request: {
|
|
55
|
+
readonly endpoint: "chat" | "responses" | "anthropic";
|
|
56
|
+
readonly method: "POST";
|
|
57
|
+
readonly path: string;
|
|
58
|
+
readonly headers: readonly {
|
|
59
|
+
readonly name: string;
|
|
60
|
+
readonly value: string;
|
|
61
|
+
}[];
|
|
62
|
+
readonly bodyJson: string;
|
|
63
|
+
};
|
|
64
|
+
} | {
|
|
65
|
+
readonly lane: "repository-agent";
|
|
66
|
+
readonly id: string;
|
|
67
|
+
readonly requestText: string;
|
|
68
|
+
readonly checkoutCommit: string;
|
|
69
|
+
readonly allowedTools: readonly ("test" | "read" | "search" | "edit" | "shell")[];
|
|
70
|
+
readonly constraints: readonly string[];
|
|
71
|
+
};
|
|
72
|
+
readonly hidden: {
|
|
73
|
+
readonly version: 1;
|
|
74
|
+
readonly fixtures: readonly ({
|
|
75
|
+
readonly kind: "historical-regression";
|
|
76
|
+
readonly expectationMode: "changes";
|
|
77
|
+
readonly id: string;
|
|
78
|
+
readonly description: string;
|
|
79
|
+
readonly expectedBehavior: string;
|
|
80
|
+
readonly source: "historical" | "generated" | "reviewed";
|
|
81
|
+
readonly testPath: string;
|
|
82
|
+
} | {
|
|
83
|
+
readonly kind: "boundary";
|
|
84
|
+
readonly expectationMode: "changes" | "preserved";
|
|
85
|
+
readonly id: string;
|
|
86
|
+
readonly description: string;
|
|
87
|
+
readonly expectedBehavior: string;
|
|
88
|
+
readonly source: "historical" | "generated" | "reviewed";
|
|
89
|
+
readonly testPath: string;
|
|
90
|
+
} | {
|
|
91
|
+
readonly kind: "counterfactual";
|
|
92
|
+
readonly expectationMode: "changes";
|
|
93
|
+
readonly id: string;
|
|
94
|
+
readonly description: string;
|
|
95
|
+
readonly expectedBehavior: string;
|
|
96
|
+
readonly source: "historical" | "generated" | "reviewed";
|
|
97
|
+
readonly testPath: string;
|
|
98
|
+
} | {
|
|
99
|
+
readonly kind: "metamorphic";
|
|
100
|
+
readonly expectationMode: "preserved";
|
|
101
|
+
readonly id: string;
|
|
102
|
+
readonly description: string;
|
|
103
|
+
readonly expectedBehavior: string;
|
|
104
|
+
readonly source: "historical" | "generated" | "reviewed";
|
|
105
|
+
readonly testPath: string;
|
|
106
|
+
})[];
|
|
107
|
+
readonly caseId: string;
|
|
108
|
+
readonly hardFailurePolicy: "any-critical-hard-clause-fails";
|
|
109
|
+
readonly clauses: readonly ({
|
|
110
|
+
readonly kind: "candidate-policy";
|
|
111
|
+
readonly policyId: string;
|
|
112
|
+
readonly forbiddenPaths: readonly string[];
|
|
113
|
+
readonly id: string;
|
|
114
|
+
readonly critical: boolean;
|
|
115
|
+
readonly description: string;
|
|
116
|
+
} | {
|
|
117
|
+
readonly kind: "test-command";
|
|
118
|
+
readonly recipeId: string;
|
|
119
|
+
readonly expectedExitCode: number;
|
|
120
|
+
readonly fixtureIds: readonly string[];
|
|
121
|
+
readonly id: string;
|
|
122
|
+
readonly critical: boolean;
|
|
123
|
+
readonly description: string;
|
|
124
|
+
} | {
|
|
125
|
+
readonly kind: "json-field";
|
|
126
|
+
readonly id: string;
|
|
127
|
+
readonly description: string;
|
|
128
|
+
readonly critical: boolean;
|
|
129
|
+
readonly operator: "equals" | "present" | "absent";
|
|
130
|
+
readonly pointer: string;
|
|
131
|
+
readonly expectedJson?: string | undefined;
|
|
132
|
+
} | {
|
|
133
|
+
readonly kind: "ordered-events";
|
|
134
|
+
readonly id: string;
|
|
135
|
+
readonly description: string;
|
|
136
|
+
readonly critical: boolean;
|
|
137
|
+
readonly eventTypes: readonly string[];
|
|
138
|
+
readonly terminalEvent?: string | undefined;
|
|
139
|
+
} | {
|
|
140
|
+
readonly kind: "property";
|
|
141
|
+
readonly propertyId: string;
|
|
142
|
+
readonly fixtureIds: readonly string[];
|
|
143
|
+
readonly id: string;
|
|
144
|
+
readonly critical: boolean;
|
|
145
|
+
readonly description: string;
|
|
146
|
+
} | {
|
|
147
|
+
readonly kind: "differential";
|
|
148
|
+
readonly implementationIds: readonly string[];
|
|
149
|
+
readonly fixtureIds: readonly string[];
|
|
150
|
+
readonly id: string;
|
|
151
|
+
readonly critical: boolean;
|
|
152
|
+
readonly description: string;
|
|
153
|
+
} | {
|
|
154
|
+
readonly kind: "architecture";
|
|
155
|
+
readonly ruleId: string;
|
|
156
|
+
readonly expectedPaths: readonly string[];
|
|
157
|
+
readonly id: string;
|
|
158
|
+
readonly critical: boolean;
|
|
159
|
+
readonly description: string;
|
|
160
|
+
} | {
|
|
161
|
+
readonly kind: "transformation-completeness";
|
|
162
|
+
readonly ruleId: string;
|
|
163
|
+
readonly forbiddenLegacyPaths: readonly string[];
|
|
164
|
+
readonly requiredNewPaths: readonly string[];
|
|
165
|
+
readonly id: string;
|
|
166
|
+
readonly critical: boolean;
|
|
167
|
+
readonly description: string;
|
|
168
|
+
} | {
|
|
169
|
+
readonly kind: "semantic-residual";
|
|
170
|
+
readonly criterion: string;
|
|
171
|
+
readonly id: string;
|
|
172
|
+
readonly critical: boolean;
|
|
173
|
+
readonly description: string;
|
|
174
|
+
})[];
|
|
175
|
+
readonly solutions: readonly {
|
|
176
|
+
readonly kind: "historical-reference" | "independent-valid" | "simplified-valid" | "behavior-preserving-valid" | "historical-defect" | "mutation" | "model-near-miss" | "reward-hacking";
|
|
177
|
+
readonly id: string;
|
|
178
|
+
readonly expectedClass: "valid" | "wrong";
|
|
179
|
+
readonly family: string;
|
|
180
|
+
readonly commit?: string | undefined;
|
|
181
|
+
}[];
|
|
182
|
+
readonly observations: readonly {
|
|
183
|
+
readonly outcome: "pass" | "fail" | "unknown";
|
|
184
|
+
readonly solutionId: string;
|
|
185
|
+
readonly clauseId: string;
|
|
186
|
+
readonly repetition: number;
|
|
187
|
+
readonly detail: string;
|
|
188
|
+
readonly inconclusiveReason?: "unattributed-test-failure" | undefined;
|
|
189
|
+
}[];
|
|
190
|
+
readonly knownLimitations: readonly string[];
|
|
191
|
+
readonly executionBindingDigest?: string | undefined;
|
|
192
|
+
readonly executionRepetitions?: number | undefined;
|
|
193
|
+
};
|
|
194
|
+
readonly adequacy: {
|
|
195
|
+
readonly version: 1;
|
|
196
|
+
readonly caseId: string;
|
|
197
|
+
readonly admitted: boolean;
|
|
198
|
+
readonly validSolutionCount: number;
|
|
199
|
+
readonly wrongSolutionCount: number;
|
|
200
|
+
readonly falseRejectedSolutionIds: readonly string[];
|
|
201
|
+
readonly falseAcceptedSolutionIds: readonly string[];
|
|
202
|
+
readonly unstableSolutionIds: readonly string[];
|
|
203
|
+
readonly unobservedClauseIds: readonly string[];
|
|
204
|
+
readonly insufficientObservationPairs: readonly string[];
|
|
205
|
+
readonly mutationFamilyKills: readonly {
|
|
206
|
+
readonly family: string;
|
|
207
|
+
readonly killed: number;
|
|
208
|
+
readonly total: number;
|
|
209
|
+
}[];
|
|
210
|
+
readonly rejectionReasons: readonly string[];
|
|
211
|
+
};
|
|
212
|
+
readonly behavioralFingerprint: string;
|
|
213
|
+
readonly trajectoryPolicy?: {
|
|
214
|
+
readonly version: 1;
|
|
215
|
+
readonly caseId: string;
|
|
216
|
+
readonly purpose: "routing-signal";
|
|
217
|
+
readonly validationRecipeIds: readonly string[];
|
|
218
|
+
readonly protectedPaths: readonly string[];
|
|
219
|
+
readonly thresholds: {
|
|
220
|
+
readonly maximumToolCalls: number;
|
|
221
|
+
readonly maximumFailedToolCalls: number;
|
|
222
|
+
readonly maximumRepeatedFailedActions: number;
|
|
223
|
+
};
|
|
224
|
+
readonly requirements: {
|
|
225
|
+
readonly passingValidationAfterLastMutation: boolean;
|
|
226
|
+
readonly noProtectedPathMutations: boolean;
|
|
227
|
+
};
|
|
228
|
+
readonly rationale: string;
|
|
229
|
+
} | undefined;
|
|
230
|
+
}, never, never>;
|
|
231
|
+
export declare const makeQualityGate: Effect.Effect<QualityGateShape, never, never>;
|
|
232
|
+
export declare const QualityGateLive: Layer.Layer<QualityGate, never, never>;
|
|
233
|
+
export {};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { Context, Effect, Layer } from "effect";
|
|
2
|
+
import { admitRepositoryBenchmarkCaseV1, evaluateRepositoryOracleAdequacyV1, repositoryBehavioralFingerprintV1 } from "../../repository-quality-policy.js";
|
|
3
|
+
const finding = (axis, outcome, detail, evidence = [], evidenceIds = []) => ({
|
|
4
|
+
axis,
|
|
5
|
+
outcome,
|
|
6
|
+
detail,
|
|
7
|
+
evidence,
|
|
8
|
+
evidenceIds
|
|
9
|
+
});
|
|
10
|
+
const visibleText = (visible) => visible.lane === "repository-agent" ? visible.requestText : visible.request.bodyJson;
|
|
11
|
+
const leakedHiddenValue = (visible, oracle) => {
|
|
12
|
+
const text = visibleText(visible);
|
|
13
|
+
return oracle.solutions
|
|
14
|
+
.flatMap((solution) => [solution.commit, solution.id])
|
|
15
|
+
.filter((value) => value !== undefined && value.length >= 7)
|
|
16
|
+
.find((value) => text.includes(value));
|
|
17
|
+
};
|
|
18
|
+
export class QualityGate extends Context.Service()("@velum-labs/routekit-eval-setup/QualityGate") {
|
|
19
|
+
}
|
|
20
|
+
export const evaluateRepositoryBenchmarkDraftV1 = Effect.fn("QualityGate.evaluate")(function* (input) {
|
|
21
|
+
const adequacy = evaluateRepositoryOracleAdequacyV1(input.hidden);
|
|
22
|
+
const text = visibleText(input.visible);
|
|
23
|
+
const leak = leakedHiddenValue(input.visible, input.hidden);
|
|
24
|
+
const independentValidCount = input.hidden.solutions.filter((solution) => solution.expectedClass === "valid" &&
|
|
25
|
+
(solution.kind === "independent-valid" || solution.kind === "simplified-valid")).length;
|
|
26
|
+
const behaviorPreservingValidCount = input.hidden.solutions.filter((solution) => solution.expectedClass === "valid" && solution.kind === "behavior-preserving-valid").length;
|
|
27
|
+
const wrongSolutions = input.hidden.solutions.filter((solution) => solution.expectedClass === "wrong");
|
|
28
|
+
const hasHistoricalDefect = wrongSolutions.some((solution) => solution.kind === "historical-defect");
|
|
29
|
+
const integrationFamily = /(?:integration|cross-file|adapter|schema|protocol|facade|façade|reader|writer|cli|service|removed-path|new-path)/iu;
|
|
30
|
+
const hasIntegrationAdversary = wrongSolutions.some((solution) => integrationFamily.test(solution.family));
|
|
31
|
+
const hasSemanticAdversary = wrongSolutions.some((solution) => solution.kind === "mutation" && !integrationFamily.test(solution.family));
|
|
32
|
+
const hasRewardHackingAdversary = wrongSolutions.some((solution) => solution.kind === "reward-hacking");
|
|
33
|
+
const hasBoundaryOrCounterfactualFixture = input.hidden.fixtures.some((fixture) => fixture.kind === "boundary" || fixture.kind === "counterfactual");
|
|
34
|
+
const hasMetamorphicFixture = input.hidden.fixtures.some((fixture) => fixture.kind === "metamorphic");
|
|
35
|
+
const hasCandidatePolicyClause = input.hidden.clauses.some((clause) => clause.kind === "candidate-policy" && clause.critical);
|
|
36
|
+
const oraclePopulationGaps = [
|
|
37
|
+
...(independentValidCount > 0 ? [] : ["no independently implemented valid alternative"]),
|
|
38
|
+
...(behaviorPreservingValidCount > 0 ? [] : ["no behavior-preserving valid transformation"]),
|
|
39
|
+
...(hasHistoricalDefect ? [] : ["no historical defect control"]),
|
|
40
|
+
...(hasSemanticAdversary ? [] : ["no target-relevant semantic mutation"]),
|
|
41
|
+
...(hasIntegrationAdversary ? [] : ["no cross-file or integration adversary"]),
|
|
42
|
+
...(hasRewardHackingAdversary ? [] : ["no reward-hacking adversary"]),
|
|
43
|
+
...(hasBoundaryOrCounterfactualFixture
|
|
44
|
+
? []
|
|
45
|
+
: ["no boundary or counterfactual hidden fixture"]),
|
|
46
|
+
...(hasMetamorphicFixture ? [] : ["no metamorphic hidden fixture"]),
|
|
47
|
+
...(hasCandidatePolicyClause ? [] : ["no executable candidate-policy clause"])
|
|
48
|
+
];
|
|
49
|
+
const findings = [
|
|
50
|
+
finding("authenticity", input.seed.status === "qualified" ? "pass" : "fail", input.seed.status === "qualified"
|
|
51
|
+
? "The task is grounded in a replay-qualified repository seed."
|
|
52
|
+
: "The task seed has not passed replay qualification.", input.seed.capabilityEvidence, [
|
|
53
|
+
`generation:/qualification/seed/${input.seed.id}`,
|
|
54
|
+
...input.seed.capabilityEvidence.map((evidence) => `repository-evidence:${evidence.kind}:${evidence.id}`)
|
|
55
|
+
]),
|
|
56
|
+
finding("specification-sufficiency", input.specificationCritique.caseId === input.visible.id &&
|
|
57
|
+
input.specificationCritique.outcome === "pass"
|
|
58
|
+
? "pass"
|
|
59
|
+
: input.specificationCritique.outcome === "fail"
|
|
60
|
+
? "fail"
|
|
61
|
+
: "review-required", input.specificationCritique.outcome === "pass"
|
|
62
|
+
? `The task passed structured criticism and ${String(input.specificationCritique.independentApprovalCount)} independent sufficiency reviews.`
|
|
63
|
+
: input.specificationCritique.rejectionReasons.join("; "), [], [
|
|
64
|
+
`generation:/authored/specificationCritique/${input.specificationCritique.caseId}`,
|
|
65
|
+
...input.specificationCritique.reviews.map((review) => `generation:/authored/reviews/${review.reviewerId}`)
|
|
66
|
+
]),
|
|
67
|
+
finding("oracle-adequacy", adequacy.admitted && oraclePopulationGaps.length === 0 ? "pass" : "fail", adequacy.admitted && oraclePopulationGaps.length === 0
|
|
68
|
+
? "All required valid controls, mutation populations, hidden fixture classes, and candidate-policy checks passed."
|
|
69
|
+
: [...adequacy.rejectionReasons, ...oraclePopulationGaps].join("; "), [], [
|
|
70
|
+
`generation:/benchmarkCase/adequacy/${adequacy.caseId}`,
|
|
71
|
+
`generation:/benchmarkCase/hidden/clauses`,
|
|
72
|
+
`generation:/benchmarkCase/hidden/observations`
|
|
73
|
+
]),
|
|
74
|
+
finding("stability", adequacy.unstableSolutionIds.length === 0 ? "pass" : "fail", adequacy.unstableSolutionIds.length === 0
|
|
75
|
+
? "Repeated oracle observations are stable."
|
|
76
|
+
: `Unstable solutions: ${adequacy.unstableSolutionIds.join(", ")}`, [], [
|
|
77
|
+
`generation:/benchmarkCase/adequacy/${adequacy.caseId}/unstableSolutionIds`,
|
|
78
|
+
`generation:/benchmarkCase/hidden/observations`
|
|
79
|
+
]),
|
|
80
|
+
finding("distinctness", input.family.seedIds.includes(input.seed.id) ? "pass" : "fail", "The case is bound to its evidence-backed task family.", [], [`generation:/family/${input.family.id}/seedIds/${input.seed.id}`]),
|
|
81
|
+
finding("realism", input.seed.source.kind === "historical-fix" ||
|
|
82
|
+
input.seed.source.kind === "historical-feature" ||
|
|
83
|
+
input.seed.source.kind === "historical-refactor"
|
|
84
|
+
? "pass"
|
|
85
|
+
: "review-required", "Replay-qualified historical work is admitted directly; synthetic coverage gaps require review.", [], [
|
|
86
|
+
`generation:/qualification/seed/source/${input.seed.source.kind}`,
|
|
87
|
+
`generation:/qualification/seed/${input.seed.id}`
|
|
88
|
+
]),
|
|
89
|
+
finding("leakage", leak === undefined ? "pass" : "fail", leak === undefined
|
|
90
|
+
? "No hidden solution identifier or commit appears in the visible task."
|
|
91
|
+
: `Visible task leaks hidden value ${JSON.stringify(leak)}.`, [], [
|
|
92
|
+
`generation:/benchmarkCase/visible`,
|
|
93
|
+
`generation:/benchmarkCase/hidden/solutions`
|
|
94
|
+
]),
|
|
95
|
+
finding("triviality", text.length >= 100 && !/\breplace\s+[`'"].+[`'"]\s+with\s+[`'"].+[`'"]/iu.test(text)
|
|
96
|
+
? "pass"
|
|
97
|
+
: "fail", "The task is not a direct-copy or explicit string-substitution exercise.", [], [`generation:/benchmarkCase/visible`]),
|
|
98
|
+
finding("coverage", input.map.workloadSignals.some((signal) => input.seed.source.kind === "historical-fix" ||
|
|
99
|
+
input.seed.source.kind === "historical-feature" ||
|
|
100
|
+
input.seed.source.kind === "historical-refactor"
|
|
101
|
+
? signal.episodeIds.includes(input.seed.source.changeEpisodeId)
|
|
102
|
+
: false)
|
|
103
|
+
? "pass"
|
|
104
|
+
: "review-required", "The task contributes to an evidence-backed recurring workload signal.", [], [
|
|
105
|
+
`generation:/map/workloadSignals`,
|
|
106
|
+
`generation:/qualification/seed/${input.seed.id}`
|
|
107
|
+
])
|
|
108
|
+
];
|
|
109
|
+
const id = input.visible.id;
|
|
110
|
+
const behavioralFingerprint = repositoryBehavioralFingerprintV1({
|
|
111
|
+
capabilityId: input.family.capabilityId,
|
|
112
|
+
familyId: input.family.id,
|
|
113
|
+
behaviorClauses: input.seed.targetBehavior.map((clause) => clause.description),
|
|
114
|
+
oracle: input.hidden
|
|
115
|
+
});
|
|
116
|
+
return admitRepositoryBenchmarkCaseV1({
|
|
117
|
+
draft: {
|
|
118
|
+
version: 1,
|
|
119
|
+
id,
|
|
120
|
+
capabilityId: input.family.capabilityId,
|
|
121
|
+
familyId: input.family.id,
|
|
122
|
+
seedId: input.seed.id,
|
|
123
|
+
lane: input.family.lane,
|
|
124
|
+
visible: input.visible,
|
|
125
|
+
hidden: input.hidden,
|
|
126
|
+
...(input.trajectoryPolicy === undefined
|
|
127
|
+
? {}
|
|
128
|
+
: { trajectoryPolicy: input.trajectoryPolicy }),
|
|
129
|
+
adequacy,
|
|
130
|
+
qualityFindings: findings,
|
|
131
|
+
behavioralFingerprint
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
export const makeQualityGate = Effect.succeed(QualityGate.of({ evaluate: evaluateRepositoryBenchmarkDraftV1 }));
|
|
136
|
+
export const QualityGateLive = Layer.effect(QualityGate, makeQualityGate);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type PortableRepositoryArtifactV2 = {
|
|
2
|
+
readonly path: string;
|
|
3
|
+
readonly kind: "eval-definition" | "public-fixture" | "public-metadata" | "routing-labels";
|
|
4
|
+
readonly mediaType: "application/json" | "application/yaml" | "text/markdown" | "text/plain" | "text/typescript";
|
|
5
|
+
readonly content: string;
|
|
6
|
+
};
|
|
7
|
+
export type PortableRepositoryBundleFileV2 = Omit<PortableRepositoryArtifactV2, "content"> & {
|
|
8
|
+
readonly bytes: number;
|
|
9
|
+
readonly sha256: string;
|
|
10
|
+
};
|
|
11
|
+
export type PortableRepositoryBundleV2 = {
|
|
12
|
+
readonly version: 2;
|
|
13
|
+
readonly sourceCommitSha: string;
|
|
14
|
+
readonly files: readonly PortableRepositoryBundleFileV2[];
|
|
15
|
+
readonly totalBytes: number;
|
|
16
|
+
readonly contentDigest: string;
|
|
17
|
+
};
|
|
18
|
+
export type PortableRepositoryBundleMaterialV2 = Readonly<{
|
|
19
|
+
readonly bundle: PortableRepositoryBundleV2;
|
|
20
|
+
readonly files: readonly PortableRepositoryArtifactV2[];
|
|
21
|
+
}>;
|
|
22
|
+
/** Deterministic portable bundle core. */
|
|
23
|
+
export declare const makePortableRepositoryBundleV2: (input: {
|
|
24
|
+
readonly admitted: true;
|
|
25
|
+
readonly sourceCommitSha: string;
|
|
26
|
+
readonly artifacts: readonly PortableRepositoryArtifactV2[];
|
|
27
|
+
}) => PortableRepositoryBundleV2;
|
|
28
|
+
/** Returns the descriptors and the exact bytes that the compiler will publish. */
|
|
29
|
+
export declare const compilePortableRepositoryBundleV2: (input: {
|
|
30
|
+
readonly admitted: true;
|
|
31
|
+
readonly sourceCommitSha: string;
|
|
32
|
+
readonly artifacts: readonly PortableRepositoryArtifactV2[];
|
|
33
|
+
}) => PortableRepositoryBundleMaterialV2;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { posix } from "node:path";
|
|
3
|
+
const stableJson = (value) => JSON.stringify(value, (_key, entry) => {
|
|
4
|
+
if (entry === null || typeof entry !== "object" || Array.isArray(entry))
|
|
5
|
+
return entry;
|
|
6
|
+
const record = entry;
|
|
7
|
+
return Object.fromEntries(Object.keys(record)
|
|
8
|
+
.sort()
|
|
9
|
+
.map((key) => [key, record[key]]));
|
|
10
|
+
});
|
|
11
|
+
const digest = (value) => createHash("sha256").update(value, "utf8").digest("hex");
|
|
12
|
+
const credentialPatterns = [
|
|
13
|
+
/-----BEGIN (?:[A-Z ]+ )?PRIVATE KEY-----/u,
|
|
14
|
+
/\b(?:authorization|proxy-authorization)\s*:\s*bearer\s+\S+/iu,
|
|
15
|
+
/\b(?:api[_-]?key|access[_-]?token|client[_-]?secret|password)\s*[:=]\s*["']?[A-Za-z0-9_./+=-]{12,}/iu,
|
|
16
|
+
/\b(?:ghp|github_pat|sk)-[A-Za-z0-9_-]{16,}\b/u,
|
|
17
|
+
/\bAKIA[0-9A-Z]{16}\b/u
|
|
18
|
+
];
|
|
19
|
+
const normalizedPath = (path) => {
|
|
20
|
+
if (path.length === 0 ||
|
|
21
|
+
path.includes("\0") ||
|
|
22
|
+
path.includes("\\") ||
|
|
23
|
+
path.startsWith("/") ||
|
|
24
|
+
/^[A-Za-z]:/u.test(path)) {
|
|
25
|
+
throw new Error("repository artifact path must be a relative POSIX path");
|
|
26
|
+
}
|
|
27
|
+
const normalized = posix.normalize(path.normalize("NFC"));
|
|
28
|
+
if (normalized !== path ||
|
|
29
|
+
normalized === "." ||
|
|
30
|
+
normalized === ".." ||
|
|
31
|
+
normalized.startsWith("../")) {
|
|
32
|
+
throw new Error("repository artifact path must be normalized and cannot traverse");
|
|
33
|
+
}
|
|
34
|
+
const parts = normalized.split("/");
|
|
35
|
+
if (parts.some((part) => part.length === 0 || part === "." || part === "..") ||
|
|
36
|
+
parts.some((part, index) => part.startsWith(".") && !(index === 0 && part === ".routekit")) ||
|
|
37
|
+
parts[0] !== ".routekit" ||
|
|
38
|
+
parts[1] !== "evals") {
|
|
39
|
+
throw new Error("repository artifact path must be a visible .routekit/evals path");
|
|
40
|
+
}
|
|
41
|
+
return normalized;
|
|
42
|
+
};
|
|
43
|
+
const artifactKinds = new Set([
|
|
44
|
+
"eval-definition",
|
|
45
|
+
"public-fixture",
|
|
46
|
+
"public-metadata",
|
|
47
|
+
"routing-labels"
|
|
48
|
+
]);
|
|
49
|
+
const mediaTypes = new Set([
|
|
50
|
+
"application/json",
|
|
51
|
+
"application/yaml",
|
|
52
|
+
"text/markdown",
|
|
53
|
+
"text/plain",
|
|
54
|
+
"text/typescript"
|
|
55
|
+
]);
|
|
56
|
+
const assertArtifactSafe = (artifact) => {
|
|
57
|
+
const path = normalizedPath(artifact.path);
|
|
58
|
+
if (!artifactKinds.has(artifact.kind) || !mediaTypes.has(artifact.mediaType)) {
|
|
59
|
+
throw new Error(`repository artifact ${path} has an unsupported public classification`);
|
|
60
|
+
}
|
|
61
|
+
const bytes = Buffer.byteLength(artifact.content, "utf8");
|
|
62
|
+
if (bytes > 1024 * 1024)
|
|
63
|
+
throw new Error(`repository artifact ${path} exceeds the one MiB file bound`);
|
|
64
|
+
if (credentialPatterns.some((pattern) => pattern.test(`${path}\n${artifact.content}`))) {
|
|
65
|
+
throw new Error(`repository artifact ${path} resembles private credential material`);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const compileFiles = (artifacts) => {
|
|
69
|
+
const sortedArtifacts = artifacts
|
|
70
|
+
.map((artifact) => {
|
|
71
|
+
assertArtifactSafe(artifact);
|
|
72
|
+
return { ...artifact, path: normalizedPath(artifact.path) };
|
|
73
|
+
})
|
|
74
|
+
.sort((left, right) => left.path.localeCompare(right.path));
|
|
75
|
+
if (sortedArtifacts.length === 0)
|
|
76
|
+
throw new Error("portable repository bundle requires at least one admitted artifact");
|
|
77
|
+
if (new Set(sortedArtifacts.map(({ path }) => path)).size !== sortedArtifacts.length) {
|
|
78
|
+
throw new Error("portable repository bundle paths must be unique");
|
|
79
|
+
}
|
|
80
|
+
const files = sortedArtifacts.map(({ content, ...artifact }) => ({
|
|
81
|
+
...artifact,
|
|
82
|
+
bytes: Buffer.byteLength(content, "utf8"),
|
|
83
|
+
sha256: digest(content)
|
|
84
|
+
}));
|
|
85
|
+
const totalBytes = files.reduce((total, file) => total + file.bytes, 0);
|
|
86
|
+
if (totalBytes > 16 * 1024 * 1024)
|
|
87
|
+
throw new Error("portable repository bundle exceeds the sixteen MiB bundle bound");
|
|
88
|
+
return { sortedArtifacts, files, totalBytes };
|
|
89
|
+
};
|
|
90
|
+
/** Deterministic portable bundle core. */
|
|
91
|
+
export const makePortableRepositoryBundleV2 = (input) => {
|
|
92
|
+
if (input.admitted !== true) {
|
|
93
|
+
throw new Error("portable repository bundle accepts admitted artifacts only");
|
|
94
|
+
}
|
|
95
|
+
if (!/^[a-f0-9]{40}$/u.test(input.sourceCommitSha)) {
|
|
96
|
+
throw new Error("portable repository bundle requires an exact source commit SHA");
|
|
97
|
+
}
|
|
98
|
+
const { files, totalBytes } = compileFiles(input.artifacts);
|
|
99
|
+
return {
|
|
100
|
+
version: 2,
|
|
101
|
+
sourceCommitSha: input.sourceCommitSha,
|
|
102
|
+
files,
|
|
103
|
+
totalBytes,
|
|
104
|
+
contentDigest: digest(stableJson(files))
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
/** Returns the descriptors and the exact bytes that the compiler will publish. */
|
|
108
|
+
export const compilePortableRepositoryBundleV2 = (input) => {
|
|
109
|
+
const bundle = makePortableRepositoryBundleV2(input);
|
|
110
|
+
const sortedArtifacts = [...input.artifacts]
|
|
111
|
+
.map((artifact) => ({ ...artifact, path: normalizedPath(artifact.path) }))
|
|
112
|
+
.sort((left, right) => left.path.localeCompare(right.path));
|
|
113
|
+
return { bundle, files: sortedArtifacts };
|
|
114
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { Context, Effect, Layer } from "effect";
|
|
2
|
+
import type { RepositoryFoundryError } from "../../errors.js";
|
|
3
|
+
import { type RepositoryBehaviorMapV1 } from "../../repository-behavior-protocol.js";
|
|
4
|
+
export type RepositoryModelShape = {
|
|
5
|
+
readonly build: (input: {
|
|
6
|
+
readonly repositoryRoot: string;
|
|
7
|
+
readonly requestedRef: string;
|
|
8
|
+
readonly maximumHistoryEpisodes?: number;
|
|
9
|
+
}) => Effect.Effect<RepositoryBehaviorMapV1, RepositoryFoundryError>;
|
|
10
|
+
};
|
|
11
|
+
declare const RepositoryModel_base: Context.ServiceClass<RepositoryModel, "@velum-labs/routekit-eval-setup/RepositoryModel", RepositoryModelShape>;
|
|
12
|
+
export declare class RepositoryModel extends RepositoryModel_base {
|
|
13
|
+
}
|
|
14
|
+
export declare const buildRepositoryBehaviorMapV1: (input: {
|
|
15
|
+
readonly repositoryRoot: string;
|
|
16
|
+
readonly requestedRef: string;
|
|
17
|
+
readonly maximumHistoryEpisodes?: number;
|
|
18
|
+
}) => Effect.Effect<{
|
|
19
|
+
readonly version: 1;
|
|
20
|
+
readonly repository: {
|
|
21
|
+
readonly root: string;
|
|
22
|
+
readonly requestedRef: string;
|
|
23
|
+
readonly commit: string;
|
|
24
|
+
readonly tree: string;
|
|
25
|
+
};
|
|
26
|
+
readonly packages: readonly {
|
|
27
|
+
readonly id: string;
|
|
28
|
+
readonly name: string;
|
|
29
|
+
readonly path: string;
|
|
30
|
+
readonly manifestPath: string;
|
|
31
|
+
readonly dependencyPackageIds: readonly string[];
|
|
32
|
+
readonly publicExports: readonly string[];
|
|
33
|
+
}[];
|
|
34
|
+
readonly publicSurfaces: readonly {
|
|
35
|
+
readonly kind: "package-export" | "cli-command" | "http-endpoint" | "documented-example";
|
|
36
|
+
readonly id: string;
|
|
37
|
+
readonly path: string;
|
|
38
|
+
readonly symbols: readonly string[];
|
|
39
|
+
readonly packageId?: string | undefined;
|
|
40
|
+
}[];
|
|
41
|
+
readonly protocols: readonly {
|
|
42
|
+
readonly id: string;
|
|
43
|
+
readonly path: string;
|
|
44
|
+
readonly name: string;
|
|
45
|
+
readonly kind: "schema" | "wire" | "persistence" | "internal-boundary";
|
|
46
|
+
}[];
|
|
47
|
+
readonly commands: readonly {
|
|
48
|
+
readonly id: string;
|
|
49
|
+
readonly kind: "schema" | "test" | "build" | "check" | "custom";
|
|
50
|
+
readonly cwd: string;
|
|
51
|
+
readonly executable: string;
|
|
52
|
+
readonly args: readonly string[];
|
|
53
|
+
readonly timeoutMs: number;
|
|
54
|
+
}[];
|
|
55
|
+
readonly tests: readonly {
|
|
56
|
+
readonly id: string;
|
|
57
|
+
readonly path: string;
|
|
58
|
+
readonly names: readonly string[];
|
|
59
|
+
readonly commandIds: readonly string[];
|
|
60
|
+
}[];
|
|
61
|
+
readonly testBindings: readonly {
|
|
62
|
+
readonly testId: string;
|
|
63
|
+
readonly targetIds: readonly string[];
|
|
64
|
+
readonly signals: readonly ("direct-import" | "symbol-reference" | "fixture-reference" | "package-ownership" | "git-cochange" | "coverage" | "reviewed-hypothesis")[];
|
|
65
|
+
readonly confidence: "high" | "medium" | "hypothesis";
|
|
66
|
+
}[];
|
|
67
|
+
readonly historyEpisodes: readonly {
|
|
68
|
+
readonly id: string;
|
|
69
|
+
readonly commit: string;
|
|
70
|
+
readonly changedPaths: readonly {
|
|
71
|
+
readonly kind: "protocol" | "schema" | "test" | "documentation" | "implementation" | "operational" | "other";
|
|
72
|
+
readonly path: string;
|
|
73
|
+
readonly status: "added" | "modified" | "deleted" | "renamed" | "copied";
|
|
74
|
+
readonly previousPath?: string | undefined;
|
|
75
|
+
}[];
|
|
76
|
+
readonly testPaths: readonly string[];
|
|
77
|
+
readonly implementationPaths: readonly string[];
|
|
78
|
+
readonly protocolPaths: readonly string[];
|
|
79
|
+
readonly occurredAt: string;
|
|
80
|
+
readonly subject: string;
|
|
81
|
+
readonly body: string;
|
|
82
|
+
readonly behaviorChanging: boolean;
|
|
83
|
+
readonly seedEligible: boolean;
|
|
84
|
+
readonly parentCommit?: string | undefined;
|
|
85
|
+
}[];
|
|
86
|
+
readonly workloadSignals: readonly {
|
|
87
|
+
readonly id: string;
|
|
88
|
+
readonly kind: "recurring-cochange" | "recurring-behavior-change" | "recurring-command" | "public-contract" | "reviewed-critical";
|
|
89
|
+
readonly label: string;
|
|
90
|
+
readonly episodeIds: readonly string[];
|
|
91
|
+
readonly pathPatterns: readonly string[];
|
|
92
|
+
readonly frequency: number;
|
|
93
|
+
readonly importance: "critical" | "high" | "normal";
|
|
94
|
+
readonly confidence: "high" | "medium" | "review-required";
|
|
95
|
+
}[];
|
|
96
|
+
readonly blindSpots: readonly {
|
|
97
|
+
readonly id: string;
|
|
98
|
+
readonly kind: "unmapped-test" | "unreconstructible-command" | "unsupported-language" | "external-service" | "history-gap" | "unknown-relationship";
|
|
99
|
+
readonly detail: string;
|
|
100
|
+
readonly paths: readonly string[];
|
|
101
|
+
}[];
|
|
102
|
+
}, RepositoryFoundryError, never>;
|
|
103
|
+
export declare const makeRepositoryModel: Effect.Effect<RepositoryModelShape, never, never>;
|
|
104
|
+
export declare const RepositoryModelLive: Layer.Layer<RepositoryModel, never, never>;
|
|
105
|
+
export {};
|