@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,296 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
import { EVAL_AUTHORING_REVIEW_REQUEST_BYTES } from "./project-authoring.js";
|
|
4
|
+
import { assertRepositoryFoundryModelPlanV1, REPOSITORY_FOUNDRY_MODEL_ROLES, RepositoryFoundryModelPlanV1 } from "./repository-language-model-protocol.js";
|
|
5
|
+
const REPOSITORY_FOUNDRY_EXPANSIVE_OUTPUT_ROLES = new Set([
|
|
6
|
+
"oracle-designer",
|
|
7
|
+
"valid-solution-generator-a",
|
|
8
|
+
"valid-solution-generator-b",
|
|
9
|
+
"adversary",
|
|
10
|
+
"held-out-adversary",
|
|
11
|
+
"hill-climb-planner"
|
|
12
|
+
]);
|
|
13
|
+
const REPOSITORY_FOUNDRY_BASE_ROLES = REPOSITORY_FOUNDRY_MODEL_ROLES.filter((role) => role !== "hill-climb-planner");
|
|
14
|
+
export const REPOSITORY_FOUNDRY_BASE_MODEL_CALLS = REPOSITORY_FOUNDRY_BASE_ROLES.length;
|
|
15
|
+
export const REPOSITORY_FOUNDRY_TRAJECTORY_REPAIR_ATTEMPTS = 2;
|
|
16
|
+
export const REPOSITORY_FOUNDRY_TRAJECTORY_REPAIR_CALLS = REPOSITORY_FOUNDRY_TRAJECTORY_REPAIR_ATTEMPTS * 2;
|
|
17
|
+
export const REPOSITORY_FOUNDRY_VALID_SOLUTION_REPAIR_ATTEMPTS = 2;
|
|
18
|
+
export const REPOSITORY_FOUNDRY_VALID_SOLUTION_REPAIR_CALLS = REPOSITORY_FOUNDRY_VALID_SOLUTION_REPAIR_ATTEMPTS * 4;
|
|
19
|
+
export const REPOSITORY_FOUNDRY_HELD_OUT_REPAIR_CALLS = 2;
|
|
20
|
+
export const REPOSITORY_FOUNDRY_MAXIMUM_HILL_CLIMB_ATTEMPTS = 3;
|
|
21
|
+
export const REPOSITORY_FOUNDRY_MAXIMUM_SPECIFICATION_REVISIONS = 2;
|
|
22
|
+
export const REPOSITORY_FOUNDRY_MAXIMUM_ORACLE_COVERAGE_REVISIONS = 2;
|
|
23
|
+
export const REPOSITORY_FOUNDRY_MAXIMUM_VALID_CONTROL_REGENERATIONS = 3;
|
|
24
|
+
export const REPOSITORY_FOUNDRY_TRANSIENT_RETRY_RESERVE = 3;
|
|
25
|
+
export const REPOSITORY_FOUNDRY_REQUEST_INPUT_CEILING = 512_000;
|
|
26
|
+
export const REPOSITORY_FOUNDRY_STANDARD_OUTPUT_CEILING = 32_768;
|
|
27
|
+
export const REPOSITORY_FOUNDRY_EXPANSIVE_OUTPUT_CEILING = 65_536;
|
|
28
|
+
export const REPOSITORY_FOUNDRY_PER_CALL_OUTPUT_CEILING = REPOSITORY_FOUNDRY_EXPANSIVE_OUTPUT_CEILING;
|
|
29
|
+
export const repositoryFoundryRoleOutputCeilingV1 = (role) => REPOSITORY_FOUNDRY_EXPANSIVE_OUTPUT_ROLES.has(role)
|
|
30
|
+
? REPOSITORY_FOUNDRY_EXPANSIVE_OUTPUT_CEILING
|
|
31
|
+
: REPOSITORY_FOUNDRY_STANDARD_OUTPUT_CEILING;
|
|
32
|
+
export const REPOSITORY_FOUNDRY_BASE_OUTPUT_CEILING = REPOSITORY_FOUNDRY_BASE_ROLES.reduce((total, role) => total + repositoryFoundryRoleOutputCeilingV1(role), 0);
|
|
33
|
+
export const REPOSITORY_FOUNDRY_HILL_CLIMB_OUTPUT_CEILING = repositoryFoundryRoleOutputCeilingV1("hill-climb-planner");
|
|
34
|
+
export const REPOSITORY_FOUNDRY_DEFAULT_WALL_TIME_MS = 2 * 60 * 60_000;
|
|
35
|
+
export const REPOSITORY_FOUNDRY_MINIMUM_WALL_TIME_MS = 15 * 60_000;
|
|
36
|
+
export const REPOSITORY_FOUNDRY_MAXIMUM_WALL_TIME_MS = 4 * 60 * 60_000;
|
|
37
|
+
export const RepositoryFoundryGenerationBudgetV1 = Schema.Struct({
|
|
38
|
+
plannedModelCalls: Schema.Finite,
|
|
39
|
+
maximumTransientRetries: Schema.Finite,
|
|
40
|
+
maximumHillClimbAttempts: Schema.Finite,
|
|
41
|
+
maximumSpecificationRevisions: Schema.optionalKey(Schema.Finite),
|
|
42
|
+
maximumOracleCoverageRevisions: Schema.optionalKey(Schema.Finite),
|
|
43
|
+
maximumFixtureRepairAttempts: Schema.optionalKey(Schema.Finite),
|
|
44
|
+
requiredTotalInputTokens: Schema.Finite,
|
|
45
|
+
requiredTotalOutputTokens: Schema.Finite,
|
|
46
|
+
perCallOutputTokens: Schema.Finite,
|
|
47
|
+
wallTimeMs: Schema.Finite
|
|
48
|
+
});
|
|
49
|
+
export const RepositoryIntegratedHistoryProvenanceV1 = Schema.Struct({
|
|
50
|
+
method: Schema.Literal("integrated-retained-history-v1"),
|
|
51
|
+
requestedRef: Schema.String,
|
|
52
|
+
requestedTipCommit: Schema.String,
|
|
53
|
+
requestedTipTree: Schema.String,
|
|
54
|
+
integrationCommit: Schema.String,
|
|
55
|
+
pathBlobs: Schema.Array(Schema.Struct({ path: Schema.String, blob: Schema.String }))
|
|
56
|
+
});
|
|
57
|
+
export const REPOSITORY_INTEGRATED_HISTORY_MAXIMUM_PATHS = 32;
|
|
58
|
+
export const validIntegratedHistoryProvenanceV1 = (proof) => {
|
|
59
|
+
const objectId = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u;
|
|
60
|
+
return (proof.method === "integrated-retained-history-v1" &&
|
|
61
|
+
proof.requestedRef.trim().length > 0 &&
|
|
62
|
+
[proof.requestedTipCommit, proof.requestedTipTree, proof.integrationCommit].every((value) => objectId.test(value)) &&
|
|
63
|
+
proof.pathBlobs.length > 0 &&
|
|
64
|
+
proof.pathBlobs.length <= REPOSITORY_INTEGRATED_HISTORY_MAXIMUM_PATHS &&
|
|
65
|
+
proof.pathBlobs.every((entry, index) => objectId.test(entry.blob) &&
|
|
66
|
+
entry.path.length > 0 &&
|
|
67
|
+
!entry.path.includes("\0") &&
|
|
68
|
+
!entry.path.includes("\\") &&
|
|
69
|
+
!entry.path.split("/").some((part) => part === "" || part === "." || part === "..") &&
|
|
70
|
+
(index === 0 || proof.pathBlobs[index - 1].path < entry.path)));
|
|
71
|
+
};
|
|
72
|
+
export const RepositoryFoundryGenerationPlanV1 = Schema.Struct({
|
|
73
|
+
version: Schema.Literal(1),
|
|
74
|
+
planDigest: Schema.String,
|
|
75
|
+
repository: Schema.Struct({
|
|
76
|
+
root: Schema.String,
|
|
77
|
+
requestedRef: Schema.String,
|
|
78
|
+
commit: Schema.String,
|
|
79
|
+
tree: Schema.String
|
|
80
|
+
}),
|
|
81
|
+
caseId: Schema.String,
|
|
82
|
+
requestedDimension: Schema.optionalKey(Schema.String),
|
|
83
|
+
excludedReferenceCommits: Schema.optionalKey(Schema.Array(Schema.String)),
|
|
84
|
+
historyProvenance: Schema.optionalKey(RepositoryIntegratedHistoryProvenanceV1),
|
|
85
|
+
validControlRegenerationSequence: Schema.optionalKey(Schema.Finite),
|
|
86
|
+
validControlReviewVersion: Schema.optionalKey(Schema.Literals([1, 2])),
|
|
87
|
+
dependencyContextVersion: Schema.optionalKey(Schema.Literals([1, 2])),
|
|
88
|
+
oracleCoverageWitnessVersion: Schema.optionalKey(Schema.Literals([1, 2])),
|
|
89
|
+
oracleCoverageWitnessRepairVersion: Schema.optionalKey(Schema.Literal(1)),
|
|
90
|
+
oracleRepairFeedbackVersion: Schema.optionalKey(Schema.Literal(1)),
|
|
91
|
+
reviewInputVersion: Schema.optionalKey(Schema.Literal(2)),
|
|
92
|
+
specificationContractFactsVersion: Schema.optionalKey(Schema.Literal(1)),
|
|
93
|
+
seedId: Schema.String,
|
|
94
|
+
initialCommit: Schema.String,
|
|
95
|
+
referenceCommit: Schema.String,
|
|
96
|
+
modelPlan: RepositoryFoundryModelPlanV1,
|
|
97
|
+
qualification: Schema.Struct({
|
|
98
|
+
batches: Schema.Finite,
|
|
99
|
+
repetitionsPerBatch: Schema.Finite,
|
|
100
|
+
oracleRepetitions: Schema.Finite,
|
|
101
|
+
oracleConcurrency: Schema.optionalKey(Schema.Finite)
|
|
102
|
+
}),
|
|
103
|
+
budget: RepositoryFoundryGenerationBudgetV1
|
|
104
|
+
});
|
|
105
|
+
export function assertRepositoryFoundryReferenceExclusionsV1(references) {
|
|
106
|
+
if (references === undefined)
|
|
107
|
+
return;
|
|
108
|
+
if (!Array.isArray(references) ||
|
|
109
|
+
references.length < 1 ||
|
|
110
|
+
references.length > 256 ||
|
|
111
|
+
references.some((reference, index) => typeof reference !== "string" ||
|
|
112
|
+
!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(reference) ||
|
|
113
|
+
(index > 0 && references[index - 1] >= reference))) {
|
|
114
|
+
throw new Error("reference exclusions must contain 1 to 256 sorted unique lowercase full commit SHAs");
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const digest = (value) => createHash("sha256").update(JSON.stringify(value)).digest("hex");
|
|
118
|
+
export const repositoryFoundryGenerationBudgetV1 = (maximumHillClimbAttempts, wallTimeMs = REPOSITORY_FOUNDRY_DEFAULT_WALL_TIME_MS, maximumSpecificationRevisions, maximumOracleCoverageRevisions, maximumFixtureRepairAttempts, reviewInputVersion, specificationContractFactsVersion) => {
|
|
119
|
+
if (specificationContractFactsVersion !== undefined &&
|
|
120
|
+
(specificationContractFactsVersion !== 1 || maximumSpecificationRevisions === undefined))
|
|
121
|
+
throw new Error("specification contract facts require version 1 and an explicit specification revision allowance");
|
|
122
|
+
if (reviewInputVersion !== undefined && reviewInputVersion !== 2)
|
|
123
|
+
throw new Error("repository foundry complete review input version must be 2");
|
|
124
|
+
if (maximumFixtureRepairAttempts !== undefined &&
|
|
125
|
+
(!Number.isSafeInteger(maximumFixtureRepairAttempts) ||
|
|
126
|
+
maximumFixtureRepairAttempts < 0 ||
|
|
127
|
+
maximumFixtureRepairAttempts > 3)) {
|
|
128
|
+
throw new Error("repository foundry fixture repairs must be an integer from 0 to 3");
|
|
129
|
+
}
|
|
130
|
+
if (maximumSpecificationRevisions !== undefined &&
|
|
131
|
+
(!Number.isSafeInteger(maximumSpecificationRevisions) ||
|
|
132
|
+
maximumSpecificationRevisions < 0 ||
|
|
133
|
+
maximumSpecificationRevisions > REPOSITORY_FOUNDRY_MAXIMUM_SPECIFICATION_REVISIONS)) {
|
|
134
|
+
throw new Error("repository foundry specification revisions must be an integer from 0 to 2");
|
|
135
|
+
}
|
|
136
|
+
const specificationRevisions = maximumSpecificationRevisions ?? 0;
|
|
137
|
+
// The base analyst is already reserved. Each marked revision adds exactly
|
|
138
|
+
// one private analyst clarification before the existing writer and critics.
|
|
139
|
+
const specificationContractFactCalls = specificationContractFactsVersion === 1 ? specificationRevisions : 0;
|
|
140
|
+
if (maximumOracleCoverageRevisions !== undefined &&
|
|
141
|
+
(!Number.isSafeInteger(maximumOracleCoverageRevisions) ||
|
|
142
|
+
maximumOracleCoverageRevisions < 0 ||
|
|
143
|
+
maximumOracleCoverageRevisions > REPOSITORY_FOUNDRY_MAXIMUM_ORACLE_COVERAGE_REVISIONS)) {
|
|
144
|
+
throw new Error("repository foundry oracle coverage revisions must be an integer from 0 to 2");
|
|
145
|
+
}
|
|
146
|
+
const oracleCoverageCalls = maximumOracleCoverageRevisions === undefined ? 0 : 2 + maximumOracleCoverageRevisions * 2;
|
|
147
|
+
const oracleCoverageOutput = maximumOracleCoverageRevisions === undefined
|
|
148
|
+
? 0
|
|
149
|
+
: 2 * repositoryFoundryRoleOutputCeilingV1("oracle-critic") +
|
|
150
|
+
maximumOracleCoverageRevisions *
|
|
151
|
+
(repositoryFoundryRoleOutputCeilingV1("oracle-critic") +
|
|
152
|
+
repositoryFoundryRoleOutputCeilingV1("oracle-designer"));
|
|
153
|
+
const boundedAttempts = Math.max(0, Math.min(Math.trunc(maximumHillClimbAttempts), REPOSITORY_FOUNDRY_MAXIMUM_HILL_CLIMB_ATTEMPTS));
|
|
154
|
+
const semanticModelCalls = REPOSITORY_FOUNDRY_BASE_MODEL_CALLS +
|
|
155
|
+
REPOSITORY_FOUNDRY_TRAJECTORY_REPAIR_CALLS +
|
|
156
|
+
REPOSITORY_FOUNDRY_VALID_SOLUTION_REPAIR_CALLS +
|
|
157
|
+
REPOSITORY_FOUNDRY_HELD_OUT_REPAIR_CALLS +
|
|
158
|
+
specificationRevisions * 3 +
|
|
159
|
+
specificationContractFactCalls +
|
|
160
|
+
oracleCoverageCalls +
|
|
161
|
+
(maximumFixtureRepairAttempts ?? 0) +
|
|
162
|
+
boundedAttempts;
|
|
163
|
+
const plannedModelCalls = semanticModelCalls + REPOSITORY_FOUNDRY_TRANSIENT_RETRY_RESERVE;
|
|
164
|
+
return {
|
|
165
|
+
plannedModelCalls,
|
|
166
|
+
maximumTransientRetries: REPOSITORY_FOUNDRY_TRANSIENT_RETRY_RESERVE,
|
|
167
|
+
maximumHillClimbAttempts: boundedAttempts,
|
|
168
|
+
...(maximumSpecificationRevisions === undefined ? {} : { maximumSpecificationRevisions }),
|
|
169
|
+
...(maximumOracleCoverageRevisions === undefined ? {} : { maximumOracleCoverageRevisions }),
|
|
170
|
+
...(maximumFixtureRepairAttempts === undefined ? {} : { maximumFixtureRepairAttempts }),
|
|
171
|
+
requiredTotalInputTokens: plannedModelCalls * REPOSITORY_FOUNDRY_REQUEST_INPUT_CEILING +
|
|
172
|
+
(reviewInputVersion === 2
|
|
173
|
+
? (1 + REPOSITORY_FOUNDRY_TRANSIENT_RETRY_RESERVE) *
|
|
174
|
+
(EVAL_AUTHORING_REVIEW_REQUEST_BYTES - REPOSITORY_FOUNDRY_REQUEST_INPUT_CEILING)
|
|
175
|
+
: 0),
|
|
176
|
+
requiredTotalOutputTokens: REPOSITORY_FOUNDRY_BASE_OUTPUT_CEILING +
|
|
177
|
+
oracleCoverageOutput +
|
|
178
|
+
specificationContractFactCalls * repositoryFoundryRoleOutputCeilingV1("repository-analyst") +
|
|
179
|
+
specificationRevisions *
|
|
180
|
+
(repositoryFoundryRoleOutputCeilingV1("specification-writer") +
|
|
181
|
+
repositoryFoundryRoleOutputCeilingV1("specification-critic-a") +
|
|
182
|
+
repositoryFoundryRoleOutputCeilingV1("specification-critic-b")) +
|
|
183
|
+
REPOSITORY_FOUNDRY_TRAJECTORY_REPAIR_CALLS * REPOSITORY_FOUNDRY_STANDARD_OUTPUT_CEILING +
|
|
184
|
+
REPOSITORY_FOUNDRY_VALID_SOLUTION_REPAIR_ATTEMPTS *
|
|
185
|
+
(repositoryFoundryRoleOutputCeilingV1("valid-solution-generator-a") +
|
|
186
|
+
repositoryFoundryRoleOutputCeilingV1("valid-solution-generator-b") +
|
|
187
|
+
repositoryFoundryRoleOutputCeilingV1("solution-critic-a") +
|
|
188
|
+
repositoryFoundryRoleOutputCeilingV1("solution-critic-b")) +
|
|
189
|
+
REPOSITORY_FOUNDRY_HELD_OUT_REPAIR_CALLS *
|
|
190
|
+
repositoryFoundryRoleOutputCeilingV1("held-out-adversary") +
|
|
191
|
+
(boundedAttempts +
|
|
192
|
+
(maximumFixtureRepairAttempts ?? 0) +
|
|
193
|
+
REPOSITORY_FOUNDRY_TRANSIENT_RETRY_RESERVE) *
|
|
194
|
+
REPOSITORY_FOUNDRY_HILL_CLIMB_OUTPUT_CEILING,
|
|
195
|
+
perCallOutputTokens: REPOSITORY_FOUNDRY_PER_CALL_OUTPUT_CEILING,
|
|
196
|
+
wallTimeMs
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
export const repositoryFoundryGenerationPlanDigestV1 = (plan) => digest(plan);
|
|
200
|
+
export function assertRepositoryFoundryGenerationPlanV1(value) {
|
|
201
|
+
const plan = Schema.decodeUnknownSync(RepositoryFoundryGenerationPlanV1)(value);
|
|
202
|
+
assertRepositoryFoundryModelPlanV1(plan.modelPlan);
|
|
203
|
+
if (plan.specificationContractFactsVersion !== undefined &&
|
|
204
|
+
plan.budget.maximumSpecificationRevisions === undefined)
|
|
205
|
+
throw new Error("specification contract facts require an explicit specification revision allowance");
|
|
206
|
+
if (plan.oracleCoverageWitnessRepairVersion !== undefined &&
|
|
207
|
+
(plan.oracleCoverageWitnessVersion === undefined ||
|
|
208
|
+
plan.budget.maximumFixtureRepairAttempts === undefined)) {
|
|
209
|
+
throw new Error("coverage witness repair budgeting requires versioned witnesses and an explicit fixture repair allowance");
|
|
210
|
+
}
|
|
211
|
+
if (plan.oracleCoverageWitnessVersion !== undefined &&
|
|
212
|
+
(plan.budget.maximumOracleCoverageRevisions === undefined ||
|
|
213
|
+
plan.budget.maximumOracleCoverageRevisions < 1)) {
|
|
214
|
+
throw new Error("executable coverage witnesses require a nonzero coverage allowance");
|
|
215
|
+
}
|
|
216
|
+
if (plan.budget.maximumOracleCoverageRevisions !== undefined &&
|
|
217
|
+
(plan.budget.maximumSpecificationRevisions === undefined ||
|
|
218
|
+
!plan.modelPlan.assignments.some((assignment) => assignment.role === "oracle-critic"))) {
|
|
219
|
+
throw new Error("oracle coverage review requires pinned reference grounding and an assigned oracle critic");
|
|
220
|
+
}
|
|
221
|
+
assertRepositoryFoundryReferenceExclusionsV1(plan.excludedReferenceCommits);
|
|
222
|
+
if (plan.excludedReferenceCommits?.includes(plan.referenceCommit)) {
|
|
223
|
+
throw new Error("repository foundry generation plan selected an excluded reference commit");
|
|
224
|
+
}
|
|
225
|
+
if (plan.historyProvenance !== undefined &&
|
|
226
|
+
!validIntegratedHistoryProvenanceV1(plan.historyProvenance)) {
|
|
227
|
+
throw new Error("repository foundry integrated history provenance is invalid");
|
|
228
|
+
}
|
|
229
|
+
const integers = [
|
|
230
|
+
plan.qualification.batches,
|
|
231
|
+
plan.qualification.repetitionsPerBatch,
|
|
232
|
+
plan.qualification.oracleRepetitions,
|
|
233
|
+
...(plan.qualification.oracleConcurrency === undefined
|
|
234
|
+
? []
|
|
235
|
+
: [plan.qualification.oracleConcurrency]),
|
|
236
|
+
...(plan.validControlRegenerationSequence === undefined
|
|
237
|
+
? []
|
|
238
|
+
: [plan.validControlRegenerationSequence]),
|
|
239
|
+
plan.budget.plannedModelCalls,
|
|
240
|
+
plan.budget.maximumTransientRetries,
|
|
241
|
+
plan.budget.maximumHillClimbAttempts,
|
|
242
|
+
...(plan.budget.maximumSpecificationRevisions === undefined
|
|
243
|
+
? []
|
|
244
|
+
: [plan.budget.maximumSpecificationRevisions]),
|
|
245
|
+
...(plan.budget.maximumOracleCoverageRevisions === undefined
|
|
246
|
+
? []
|
|
247
|
+
: [plan.budget.maximumOracleCoverageRevisions]),
|
|
248
|
+
...(plan.budget.maximumFixtureRepairAttempts === undefined
|
|
249
|
+
? []
|
|
250
|
+
: [plan.budget.maximumFixtureRepairAttempts]),
|
|
251
|
+
plan.budget.requiredTotalInputTokens,
|
|
252
|
+
plan.budget.requiredTotalOutputTokens,
|
|
253
|
+
plan.budget.perCallOutputTokens,
|
|
254
|
+
plan.budget.wallTimeMs
|
|
255
|
+
];
|
|
256
|
+
if (plan.caseId.trim().length === 0 ||
|
|
257
|
+
(plan.requestedDimension !== undefined &&
|
|
258
|
+
(plan.requestedDimension.length === 0 ||
|
|
259
|
+
plan.requestedDimension.length > 2000 ||
|
|
260
|
+
plan.requestedDimension !== plan.requestedDimension.trim())) ||
|
|
261
|
+
plan.seedId.trim().length === 0 ||
|
|
262
|
+
plan.repository.root.trim().length === 0 ||
|
|
263
|
+
plan.repository.commit.trim().length === 0 ||
|
|
264
|
+
plan.repository.tree.trim().length === 0 ||
|
|
265
|
+
plan.initialCommit.trim().length === 0 ||
|
|
266
|
+
plan.referenceCommit.trim().length === 0 ||
|
|
267
|
+
integers.some((entry) => !Number.isSafeInteger(entry) || entry < 0) ||
|
|
268
|
+
plan.qualification.batches < 2 ||
|
|
269
|
+
plan.qualification.repetitionsPerBatch < 2 ||
|
|
270
|
+
plan.qualification.oracleRepetitions < 2 ||
|
|
271
|
+
(plan.qualification.oracleConcurrency !== undefined &&
|
|
272
|
+
(plan.qualification.oracleConcurrency < 1 || plan.qualification.oracleConcurrency > 4)) ||
|
|
273
|
+
(plan.validControlRegenerationSequence !== undefined &&
|
|
274
|
+
(plan.validControlRegenerationSequence < 1 ||
|
|
275
|
+
plan.validControlRegenerationSequence >
|
|
276
|
+
REPOSITORY_FOUNDRY_MAXIMUM_VALID_CONTROL_REGENERATIONS)) ||
|
|
277
|
+
plan.budget.maximumHillClimbAttempts > REPOSITORY_FOUNDRY_MAXIMUM_HILL_CLIMB_ATTEMPTS ||
|
|
278
|
+
(plan.budget.maximumSpecificationRevisions !== undefined &&
|
|
279
|
+
plan.budget.maximumSpecificationRevisions >
|
|
280
|
+
REPOSITORY_FOUNDRY_MAXIMUM_SPECIFICATION_REVISIONS) ||
|
|
281
|
+
(plan.budget.maximumOracleCoverageRevisions !== undefined &&
|
|
282
|
+
plan.budget.maximumOracleCoverageRevisions >
|
|
283
|
+
REPOSITORY_FOUNDRY_MAXIMUM_ORACLE_COVERAGE_REVISIONS) ||
|
|
284
|
+
(plan.budget.maximumFixtureRepairAttempts !== undefined &&
|
|
285
|
+
plan.budget.maximumFixtureRepairAttempts > 3) ||
|
|
286
|
+
plan.budget.wallTimeMs < REPOSITORY_FOUNDRY_MINIMUM_WALL_TIME_MS ||
|
|
287
|
+
plan.budget.wallTimeMs > REPOSITORY_FOUNDRY_MAXIMUM_WALL_TIME_MS) {
|
|
288
|
+
throw new Error("repository foundry generation plan contains invalid identifiers, qualification bounds, or execution bounds");
|
|
289
|
+
}
|
|
290
|
+
const expectedBudget = repositoryFoundryGenerationBudgetV1(plan.budget.maximumHillClimbAttempts, plan.budget.wallTimeMs, plan.budget.maximumSpecificationRevisions, plan.budget.maximumOracleCoverageRevisions, plan.budget.maximumFixtureRepairAttempts, plan.reviewInputVersion, plan.specificationContractFactsVersion);
|
|
291
|
+
if (JSON.stringify(plan.budget) !== JSON.stringify(expectedBudget) ||
|
|
292
|
+
plan.planDigest !==
|
|
293
|
+
repositoryFoundryGenerationPlanDigestV1((({ planDigest: _planDigest, ...withoutDigest }) => withoutDigest)(plan))) {
|
|
294
|
+
throw new Error("repository foundry generation plan digest or immutable budget is invalid");
|
|
295
|
+
}
|
|
296
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
/**
|
|
3
|
+
* Runtime execute progress for repository foundry. Not part of the immutable
|
|
4
|
+
* generation plan / digest — idle stall is a fail-closed execute watchdog.
|
|
5
|
+
*/
|
|
6
|
+
export declare const REPOSITORY_FOUNDRY_DEFAULT_IDLE_STALL_MS: number;
|
|
7
|
+
export declare const REPOSITORY_FOUNDRY_MINIMUM_IDLE_STALL_MS = 60000;
|
|
8
|
+
export declare const REPOSITORY_FOUNDRY_MAXIMUM_IDLE_STALL_MS: number;
|
|
9
|
+
export declare const REPOSITORY_FOUNDRY_PROGRESS_STAGES: readonly ["execute-start", "replay-qualify", "author-specification", "trajectory-policy", "oracle-design", "valid-solutions", "adversaries", "tournament", "hill-climb", "held-out-tournament", "quality-review", "compile-reviewed-case", "admit", "execute-complete"];
|
|
10
|
+
export declare const RepositoryFoundryProgressStageV1: Schema.Literals<readonly ["execute-start", "replay-qualify", "author-specification", "trajectory-policy", "oracle-design", "valid-solutions", "adversaries", "tournament", "hill-climb", "held-out-tournament", "quality-review", "compile-reviewed-case", "admit", "execute-complete"]>;
|
|
11
|
+
export type RepositoryFoundryProgressStageV1 = typeof RepositoryFoundryProgressStageV1.Type;
|
|
12
|
+
export type RepositoryFoundryProgressSnapshotV1 = {
|
|
13
|
+
readonly stage: RepositoryFoundryProgressStageV1;
|
|
14
|
+
readonly modelCalls: number;
|
|
15
|
+
readonly lastProgressAtMs: number;
|
|
16
|
+
readonly lastEventKind: "stage" | "model-call" | "heartbeat";
|
|
17
|
+
};
|
|
18
|
+
export type RepositoryFoundryProgressEventV1 = {
|
|
19
|
+
readonly version: 1;
|
|
20
|
+
readonly at: string;
|
|
21
|
+
readonly kind: "stage" | "model-call" | "heartbeat";
|
|
22
|
+
readonly stage: RepositoryFoundryProgressStageV1;
|
|
23
|
+
readonly modelCalls: number;
|
|
24
|
+
readonly role?: string;
|
|
25
|
+
readonly phase?: "start" | "complete" | "failed" | "activity";
|
|
26
|
+
readonly operationId?: string;
|
|
27
|
+
readonly callId?: string;
|
|
28
|
+
readonly detail?: string;
|
|
29
|
+
};
|
|
30
|
+
/** Private authoring evidence. Never include this payload in terminal progress events. */
|
|
31
|
+
export type RepositoryFoundryAuthoringArtifactV1 = {
|
|
32
|
+
readonly version: 1;
|
|
33
|
+
readonly operationId: string;
|
|
34
|
+
readonly role: string;
|
|
35
|
+
readonly model: string;
|
|
36
|
+
readonly reasoningEffort: string;
|
|
37
|
+
readonly schemaName: string;
|
|
38
|
+
readonly validation: "received" | "validated";
|
|
39
|
+
readonly request: {
|
|
40
|
+
readonly instructions: string;
|
|
41
|
+
readonly input: unknown;
|
|
42
|
+
readonly jsonSchema: Readonly<Record<string, unknown>>;
|
|
43
|
+
readonly maximumOutputTokens: number;
|
|
44
|
+
};
|
|
45
|
+
readonly response: {
|
|
46
|
+
readonly text: string;
|
|
47
|
+
readonly callId?: string;
|
|
48
|
+
};
|
|
49
|
+
readonly value?: unknown;
|
|
50
|
+
};
|
|
51
|
+
export declare const formatRepositoryFoundryProgressLineV1: (event: RepositoryFoundryProgressEventV1) => string;
|
|
52
|
+
export declare const boundRepositoryFoundryIdleStallMsV1: (idleStallMs: number | undefined, wallTimeMs: number) => number;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
/**
|
|
3
|
+
* Runtime execute progress for repository foundry. Not part of the immutable
|
|
4
|
+
* generation plan / digest — idle stall is a fail-closed execute watchdog.
|
|
5
|
+
*/
|
|
6
|
+
export const REPOSITORY_FOUNDRY_DEFAULT_IDLE_STALL_MS = 20 * 60_000;
|
|
7
|
+
export const REPOSITORY_FOUNDRY_MINIMUM_IDLE_STALL_MS = 60_000;
|
|
8
|
+
export const REPOSITORY_FOUNDRY_MAXIMUM_IDLE_STALL_MS = 4 * 60 * 60_000;
|
|
9
|
+
export const REPOSITORY_FOUNDRY_PROGRESS_STAGES = [
|
|
10
|
+
"execute-start",
|
|
11
|
+
"replay-qualify",
|
|
12
|
+
"author-specification",
|
|
13
|
+
"trajectory-policy",
|
|
14
|
+
"oracle-design",
|
|
15
|
+
"valid-solutions",
|
|
16
|
+
"adversaries",
|
|
17
|
+
"tournament",
|
|
18
|
+
"hill-climb",
|
|
19
|
+
"held-out-tournament",
|
|
20
|
+
"quality-review",
|
|
21
|
+
"compile-reviewed-case",
|
|
22
|
+
"admit",
|
|
23
|
+
"execute-complete"
|
|
24
|
+
];
|
|
25
|
+
export const RepositoryFoundryProgressStageV1 = Schema.Literals(REPOSITORY_FOUNDRY_PROGRESS_STAGES);
|
|
26
|
+
export const formatRepositoryFoundryProgressLineV1 = (event) => {
|
|
27
|
+
const parts = [
|
|
28
|
+
"foundry progress",
|
|
29
|
+
`kind=${event.kind}`,
|
|
30
|
+
`stage=${event.stage}`,
|
|
31
|
+
`modelCalls=${String(event.modelCalls)}`
|
|
32
|
+
];
|
|
33
|
+
if (event.role !== undefined)
|
|
34
|
+
parts.push(`role=${event.role}`);
|
|
35
|
+
if (event.phase !== undefined)
|
|
36
|
+
parts.push(`phase=${event.phase}`);
|
|
37
|
+
if (event.operationId !== undefined)
|
|
38
|
+
parts.push(`operationId=${event.operationId}`);
|
|
39
|
+
if (event.callId !== undefined)
|
|
40
|
+
parts.push(`callId=${event.callId}`);
|
|
41
|
+
if (event.detail !== undefined)
|
|
42
|
+
parts.push(`detail=${event.detail}`);
|
|
43
|
+
return parts.join(" ");
|
|
44
|
+
};
|
|
45
|
+
export const boundRepositoryFoundryIdleStallMsV1 = (idleStallMs, wallTimeMs) => {
|
|
46
|
+
const requested = idleStallMs === undefined ? REPOSITORY_FOUNDRY_DEFAULT_IDLE_STALL_MS : Math.trunc(idleStallMs);
|
|
47
|
+
if (!Number.isSafeInteger(requested) || requested < 1) {
|
|
48
|
+
throw new Error("idleStallMs must be a positive safe integer");
|
|
49
|
+
}
|
|
50
|
+
const wall = Number.isSafeInteger(wallTimeMs) && wallTimeMs > 0 ? wallTimeMs : requested;
|
|
51
|
+
return Math.min(requested, wall);
|
|
52
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
export declare const RepositoryFoundryImprovementTriggerV1: Schema.Literals<readonly ["new-authentic-work", "oracle-escape", "false-rejection", "coverage-gap", "instability", "environment-drift", "contract-drift", "realism-drift", "semantic-duplicate", "superseded"]>;
|
|
3
|
+
export type RepositoryFoundryImprovementTriggerV1 = typeof RepositoryFoundryImprovementTriggerV1.Type;
|
|
4
|
+
export declare const RepositoryFoundryImprovementActionV1: Schema.Literals<readonly ["add-seed", "add-fixture", "strengthen-oracle", "add-valid-alternative", "regenerate-specification", "quarantine-case", "retire-case"]>;
|
|
5
|
+
export type RepositoryFoundryImprovementActionV1 = typeof RepositoryFoundryImprovementActionV1.Type;
|
|
6
|
+
export declare const RepositoryFoundryImprovementReviewV1: Schema.Struct<{
|
|
7
|
+
readonly reviewerId: Schema.String;
|
|
8
|
+
readonly independentlyProduced: Schema.Boolean;
|
|
9
|
+
readonly verdict: Schema.Literals<readonly ["approve", "reject"]>;
|
|
10
|
+
readonly detail: Schema.String;
|
|
11
|
+
}>;
|
|
12
|
+
export type RepositoryFoundryImprovementReviewV1 = typeof RepositoryFoundryImprovementReviewV1.Type;
|
|
13
|
+
export declare const RepositoryFoundryImprovementDraftV1: Schema.Struct<{
|
|
14
|
+
readonly id: Schema.String;
|
|
15
|
+
readonly trigger: Schema.Literals<readonly ["new-authentic-work", "oracle-escape", "false-rejection", "coverage-gap", "instability", "environment-drift", "contract-drift", "realism-drift", "semantic-duplicate", "superseded"]>;
|
|
16
|
+
readonly action: Schema.Literals<readonly ["add-seed", "add-fixture", "strengthen-oracle", "add-valid-alternative", "regenerate-specification", "quarantine-case", "retire-case"]>;
|
|
17
|
+
readonly summary: Schema.String;
|
|
18
|
+
readonly affectedCaseIds: Schema.$Array<Schema.String>;
|
|
19
|
+
readonly evidence: Schema.$Array<Schema.Struct<{
|
|
20
|
+
readonly kind: Schema.Literals<readonly ["package", "public-surface", "symbol", "protocol", "schema", "test", "command", "history-episode", "workload-signal", "documentation"]>;
|
|
21
|
+
readonly id: Schema.String;
|
|
22
|
+
readonly path: Schema.optionalKey<Schema.String>;
|
|
23
|
+
}>>;
|
|
24
|
+
readonly reviews: Schema.$Array<Schema.Struct<{
|
|
25
|
+
readonly reviewerId: Schema.String;
|
|
26
|
+
readonly independentlyProduced: Schema.Boolean;
|
|
27
|
+
readonly verdict: Schema.Literals<readonly ["approve", "reject"]>;
|
|
28
|
+
readonly detail: Schema.String;
|
|
29
|
+
}>>;
|
|
30
|
+
}>;
|
|
31
|
+
export type RepositoryFoundryImprovementDraftV1 = typeof RepositoryFoundryImprovementDraftV1.Type;
|
|
32
|
+
export declare const RepositoryFoundryImprovementRecordV1: Schema.Struct<{
|
|
33
|
+
readonly version: Schema.Literal<1>;
|
|
34
|
+
readonly id: Schema.String;
|
|
35
|
+
readonly trigger: Schema.Literals<readonly ["new-authentic-work", "oracle-escape", "false-rejection", "coverage-gap", "instability", "environment-drift", "contract-drift", "realism-drift", "semantic-duplicate", "superseded"]>;
|
|
36
|
+
readonly action: Schema.Literals<readonly ["add-seed", "add-fixture", "strengthen-oracle", "add-valid-alternative", "regenerate-specification", "quarantine-case", "retire-case"]>;
|
|
37
|
+
readonly summary: Schema.String;
|
|
38
|
+
readonly affectedCaseIds: Schema.$Array<Schema.String>;
|
|
39
|
+
readonly evidence: Schema.$Array<Schema.Struct<{
|
|
40
|
+
readonly kind: Schema.Literals<readonly ["package", "public-surface", "symbol", "protocol", "schema", "test", "command", "history-episode", "workload-signal", "documentation"]>;
|
|
41
|
+
readonly id: Schema.String;
|
|
42
|
+
readonly path: Schema.optionalKey<Schema.String>;
|
|
43
|
+
}>>;
|
|
44
|
+
readonly reviews: Schema.$Array<Schema.Struct<{
|
|
45
|
+
readonly reviewerId: Schema.String;
|
|
46
|
+
readonly independentlyProduced: Schema.Boolean;
|
|
47
|
+
readonly verdict: Schema.Literals<readonly ["approve", "reject"]>;
|
|
48
|
+
readonly detail: Schema.String;
|
|
49
|
+
}>>;
|
|
50
|
+
readonly decision: Schema.Literals<readonly ["applied", "rejected"]>;
|
|
51
|
+
readonly rejectionReasons: Schema.$Array<Schema.String>;
|
|
52
|
+
}>;
|
|
53
|
+
export type RepositoryFoundryImprovementRecordV1 = typeof RepositoryFoundryImprovementRecordV1.Type;
|
|
54
|
+
export declare const RepositoryBenchmarkLifecycleStateV1: Schema.Literals<readonly ["active", "audited-core", "quarantined", "retired"]>;
|
|
55
|
+
export type RepositoryBenchmarkLifecycleStateV1 = typeof RepositoryBenchmarkLifecycleStateV1.Type;
|
|
56
|
+
export declare const RepositoryBenchmarkLifecycleEntryV1: Schema.Struct<{
|
|
57
|
+
readonly caseId: Schema.String;
|
|
58
|
+
readonly state: Schema.Literals<readonly ["active", "audited-core", "quarantined", "retired"]>;
|
|
59
|
+
readonly improvementRecordId: Schema.optionalKey<Schema.String>;
|
|
60
|
+
readonly reason: Schema.String;
|
|
61
|
+
}>;
|
|
62
|
+
export type RepositoryBenchmarkLifecycleEntryV1 = typeof RepositoryBenchmarkLifecycleEntryV1.Type;
|
|
63
|
+
export declare const RepositoryFoundryImprovementCycleV1: Schema.Struct<{
|
|
64
|
+
readonly version: Schema.Literal<1>;
|
|
65
|
+
readonly cycleId: Schema.String;
|
|
66
|
+
readonly inputCaseIds: Schema.$Array<Schema.String>;
|
|
67
|
+
readonly records: Schema.$Array<Schema.Struct<{
|
|
68
|
+
readonly version: Schema.Literal<1>;
|
|
69
|
+
readonly id: Schema.String;
|
|
70
|
+
readonly trigger: Schema.Literals<readonly ["new-authentic-work", "oracle-escape", "false-rejection", "coverage-gap", "instability", "environment-drift", "contract-drift", "realism-drift", "semantic-duplicate", "superseded"]>;
|
|
71
|
+
readonly action: Schema.Literals<readonly ["add-seed", "add-fixture", "strengthen-oracle", "add-valid-alternative", "regenerate-specification", "quarantine-case", "retire-case"]>;
|
|
72
|
+
readonly summary: Schema.String;
|
|
73
|
+
readonly affectedCaseIds: Schema.$Array<Schema.String>;
|
|
74
|
+
readonly evidence: Schema.$Array<Schema.Struct<{
|
|
75
|
+
readonly kind: Schema.Literals<readonly ["package", "public-surface", "symbol", "protocol", "schema", "test", "command", "history-episode", "workload-signal", "documentation"]>;
|
|
76
|
+
readonly id: Schema.String;
|
|
77
|
+
readonly path: Schema.optionalKey<Schema.String>;
|
|
78
|
+
}>>;
|
|
79
|
+
readonly reviews: Schema.$Array<Schema.Struct<{
|
|
80
|
+
readonly reviewerId: Schema.String;
|
|
81
|
+
readonly independentlyProduced: Schema.Boolean;
|
|
82
|
+
readonly verdict: Schema.Literals<readonly ["approve", "reject"]>;
|
|
83
|
+
readonly detail: Schema.String;
|
|
84
|
+
}>>;
|
|
85
|
+
readonly decision: Schema.Literals<readonly ["applied", "rejected"]>;
|
|
86
|
+
readonly rejectionReasons: Schema.$Array<Schema.String>;
|
|
87
|
+
}>>;
|
|
88
|
+
readonly lifecycle: Schema.$Array<Schema.Struct<{
|
|
89
|
+
readonly caseId: Schema.String;
|
|
90
|
+
readonly state: Schema.Literals<readonly ["active", "audited-core", "quarantined", "retired"]>;
|
|
91
|
+
readonly improvementRecordId: Schema.optionalKey<Schema.String>;
|
|
92
|
+
readonly reason: Schema.String;
|
|
93
|
+
}>>;
|
|
94
|
+
readonly activeCaseIds: Schema.$Array<Schema.String>;
|
|
95
|
+
readonly auditedCoreCaseIds: Schema.$Array<Schema.String>;
|
|
96
|
+
readonly quarantinedCaseIds: Schema.$Array<Schema.String>;
|
|
97
|
+
readonly retiredCaseIds: Schema.$Array<Schema.String>;
|
|
98
|
+
}>;
|
|
99
|
+
export type RepositoryFoundryImprovementCycleV1 = typeof RepositoryFoundryImprovementCycleV1.Type;
|
|
100
|
+
export declare function assertRepositoryFoundryImprovementCycleV1(value: unknown): asserts value is RepositoryFoundryImprovementCycleV1;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { RepositoryEvidenceRefV1 } from "./repository-behavior-protocol.js";
|
|
3
|
+
export const RepositoryFoundryImprovementTriggerV1 = Schema.Literals([
|
|
4
|
+
"new-authentic-work",
|
|
5
|
+
"oracle-escape",
|
|
6
|
+
"false-rejection",
|
|
7
|
+
"coverage-gap",
|
|
8
|
+
"instability",
|
|
9
|
+
"environment-drift",
|
|
10
|
+
"contract-drift",
|
|
11
|
+
"realism-drift",
|
|
12
|
+
"semantic-duplicate",
|
|
13
|
+
"superseded"
|
|
14
|
+
]);
|
|
15
|
+
export const RepositoryFoundryImprovementActionV1 = Schema.Literals([
|
|
16
|
+
"add-seed",
|
|
17
|
+
"add-fixture",
|
|
18
|
+
"strengthen-oracle",
|
|
19
|
+
"add-valid-alternative",
|
|
20
|
+
"regenerate-specification",
|
|
21
|
+
"quarantine-case",
|
|
22
|
+
"retire-case"
|
|
23
|
+
]);
|
|
24
|
+
export const RepositoryFoundryImprovementReviewV1 = Schema.Struct({
|
|
25
|
+
reviewerId: Schema.String,
|
|
26
|
+
independentlyProduced: Schema.Boolean,
|
|
27
|
+
verdict: Schema.Literals(["approve", "reject"]),
|
|
28
|
+
detail: Schema.String
|
|
29
|
+
});
|
|
30
|
+
export const RepositoryFoundryImprovementDraftV1 = Schema.Struct({
|
|
31
|
+
id: Schema.String,
|
|
32
|
+
trigger: RepositoryFoundryImprovementTriggerV1,
|
|
33
|
+
action: RepositoryFoundryImprovementActionV1,
|
|
34
|
+
summary: Schema.String,
|
|
35
|
+
affectedCaseIds: Schema.Array(Schema.String),
|
|
36
|
+
evidence: Schema.Array(RepositoryEvidenceRefV1),
|
|
37
|
+
reviews: Schema.Array(RepositoryFoundryImprovementReviewV1)
|
|
38
|
+
});
|
|
39
|
+
export const RepositoryFoundryImprovementRecordV1 = Schema.Struct({
|
|
40
|
+
version: Schema.Literal(1),
|
|
41
|
+
id: Schema.String,
|
|
42
|
+
trigger: RepositoryFoundryImprovementTriggerV1,
|
|
43
|
+
action: RepositoryFoundryImprovementActionV1,
|
|
44
|
+
summary: Schema.String,
|
|
45
|
+
affectedCaseIds: Schema.Array(Schema.String),
|
|
46
|
+
evidence: Schema.Array(RepositoryEvidenceRefV1),
|
|
47
|
+
reviews: Schema.Array(RepositoryFoundryImprovementReviewV1),
|
|
48
|
+
decision: Schema.Literals(["applied", "rejected"]),
|
|
49
|
+
rejectionReasons: Schema.Array(Schema.String)
|
|
50
|
+
});
|
|
51
|
+
export const RepositoryBenchmarkLifecycleStateV1 = Schema.Literals([
|
|
52
|
+
"active",
|
|
53
|
+
"audited-core",
|
|
54
|
+
"quarantined",
|
|
55
|
+
"retired"
|
|
56
|
+
]);
|
|
57
|
+
export const RepositoryBenchmarkLifecycleEntryV1 = Schema.Struct({
|
|
58
|
+
caseId: Schema.String,
|
|
59
|
+
state: RepositoryBenchmarkLifecycleStateV1,
|
|
60
|
+
improvementRecordId: Schema.optionalKey(Schema.String),
|
|
61
|
+
reason: Schema.String
|
|
62
|
+
});
|
|
63
|
+
export const RepositoryFoundryImprovementCycleV1 = Schema.Struct({
|
|
64
|
+
version: Schema.Literal(1),
|
|
65
|
+
cycleId: Schema.String,
|
|
66
|
+
inputCaseIds: Schema.Array(Schema.String),
|
|
67
|
+
records: Schema.Array(RepositoryFoundryImprovementRecordV1),
|
|
68
|
+
lifecycle: Schema.Array(RepositoryBenchmarkLifecycleEntryV1),
|
|
69
|
+
activeCaseIds: Schema.Array(Schema.String),
|
|
70
|
+
auditedCoreCaseIds: Schema.Array(Schema.String),
|
|
71
|
+
quarantinedCaseIds: Schema.Array(Schema.String),
|
|
72
|
+
retiredCaseIds: Schema.Array(Schema.String)
|
|
73
|
+
});
|
|
74
|
+
export function assertRepositoryFoundryImprovementCycleV1(value) {
|
|
75
|
+
const cycle = Schema.decodeUnknownSync(RepositoryFoundryImprovementCycleV1)(value);
|
|
76
|
+
const inputCaseIds = new Set(cycle.inputCaseIds);
|
|
77
|
+
const recordIds = new Set(cycle.records.map((record) => record.id));
|
|
78
|
+
const lifecycleCaseIds = new Set(cycle.lifecycle.map((entry) => entry.caseId));
|
|
79
|
+
if (inputCaseIds.size !== cycle.inputCaseIds.length ||
|
|
80
|
+
recordIds.size !== cycle.records.length ||
|
|
81
|
+
lifecycleCaseIds.size !== cycle.lifecycle.length ||
|
|
82
|
+
lifecycleCaseIds.size !== inputCaseIds.size ||
|
|
83
|
+
[...lifecycleCaseIds].some((caseId) => !inputCaseIds.has(caseId))) {
|
|
84
|
+
throw new Error("repository foundry improvement cycle requires unique, complete case and record identities");
|
|
85
|
+
}
|
|
86
|
+
const byState = (state) => cycle.lifecycle
|
|
87
|
+
.filter((entry) => entry.state === state)
|
|
88
|
+
.map((entry) => entry.caseId)
|
|
89
|
+
.sort();
|
|
90
|
+
if (JSON.stringify([...cycle.activeCaseIds].sort()) !==
|
|
91
|
+
JSON.stringify(byState("active")) ||
|
|
92
|
+
JSON.stringify([...cycle.auditedCoreCaseIds].sort()) !==
|
|
93
|
+
JSON.stringify(byState("audited-core")) ||
|
|
94
|
+
JSON.stringify([...cycle.quarantinedCaseIds].sort()) !==
|
|
95
|
+
JSON.stringify(byState("quarantined")) ||
|
|
96
|
+
JSON.stringify([...cycle.retiredCaseIds].sort()) !==
|
|
97
|
+
JSON.stringify(byState("retired"))) {
|
|
98
|
+
throw new Error("repository foundry improvement lifecycle projections must match entry states");
|
|
99
|
+
}
|
|
100
|
+
for (const entry of cycle.lifecycle) {
|
|
101
|
+
if (entry.improvementRecordId !== undefined &&
|
|
102
|
+
!recordIds.has(entry.improvementRecordId)) {
|
|
103
|
+
throw new Error("repository foundry lifecycle refers to an unknown improvement record");
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|