@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,786 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { pipelineDigestV2 } from "./case-pipeline-protocol-v2.js";
|
|
3
|
+
/** Additive foundry-tool boundary. A schema-valid handle is not proof of acceptance. */
|
|
4
|
+
export const AGENTIC_CAPABILITIES_PROTOCOL_VERSION_V1 = 1;
|
|
5
|
+
/**
|
|
6
|
+
* Request-scoped negotiation for the additive trusted-invocation ceilings.
|
|
7
|
+
* Cloud must not emit those members unless the invoking Sandbox Agent
|
|
8
|
+
* advertises this exact extension: N-1 readers decode the v1 invocation
|
|
9
|
+
* strictly and reject unknown members.
|
|
10
|
+
*/
|
|
11
|
+
export const AGENTIC_SCIENTIFIC_INVOCATION_CEILINGS_V1 = "scientific-invocation-ceilings-v1";
|
|
12
|
+
export const AGENTIC_CAPABILITY_NAMES_V1 = [
|
|
13
|
+
"inspect_repository",
|
|
14
|
+
"list_candidates",
|
|
15
|
+
"read_source",
|
|
16
|
+
"search_source",
|
|
17
|
+
"draft_specification",
|
|
18
|
+
"plan_environment",
|
|
19
|
+
"probe_fixture",
|
|
20
|
+
"qualify_reference",
|
|
21
|
+
"author_oracle",
|
|
22
|
+
"generate_controls",
|
|
23
|
+
"evaluate_oracle",
|
|
24
|
+
"repair_oracle",
|
|
25
|
+
"freeze_candidate",
|
|
26
|
+
"run_held_out_challenge",
|
|
27
|
+
"request_admission",
|
|
28
|
+
"get_progress",
|
|
29
|
+
"read_diagnostics",
|
|
30
|
+
"reject_candidate",
|
|
31
|
+
"finish_campaign"
|
|
32
|
+
];
|
|
33
|
+
const AGENTIC_CAPABILITY_SOURCE_HANDLE_DESCRIPTIONS_V1 = {
|
|
34
|
+
read_source: {
|
|
35
|
+
source: "Use the exact opaque source handle returned by inspect_repository or list_candidates. A Git commit SHA, tree SHA, repository name, path, candidate handle, or guessed digest is not a source handle."
|
|
36
|
+
},
|
|
37
|
+
search_source: {
|
|
38
|
+
source: "Use the exact opaque source handle returned by inspect_repository or list_candidates. A Git commit SHA, tree SHA, repository name, path, candidate handle, or guessed digest is not a source handle."
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
export const AGENTIC_CAPABILITY_ARTIFACT_HANDLE_DESCRIPTIONS_V1 = {
|
|
42
|
+
draft_specification: {
|
|
43
|
+
previousDraft: "Previously accepted specification-draft handle to revise.",
|
|
44
|
+
feedback: "Specification-review findings handle to address."
|
|
45
|
+
},
|
|
46
|
+
probe_fixture: {
|
|
47
|
+
environment: "Accepted environment-plan handle.",
|
|
48
|
+
fixtureDraft: "Accepted fixture-draft handle."
|
|
49
|
+
},
|
|
50
|
+
qualify_reference: {
|
|
51
|
+
environment: "Accepted environment-plan handle."
|
|
52
|
+
},
|
|
53
|
+
author_oracle: {
|
|
54
|
+
specification: "Accepted specification handle.",
|
|
55
|
+
previousOracle: "Previously accepted oracle handle to revise.",
|
|
56
|
+
findings: "Oracle-review findings handle to address."
|
|
57
|
+
},
|
|
58
|
+
generate_controls: {
|
|
59
|
+
specification: "Accepted specification handle.",
|
|
60
|
+
environment: "Accepted environment-plan handle."
|
|
61
|
+
},
|
|
62
|
+
evaluate_oracle: {
|
|
63
|
+
oracle: "Accepted oracle handle.",
|
|
64
|
+
controls: "Pass a one-element list containing the latest cumulative controls checkpoint handle returned by generate_controls. Each generation returns a new snapshot containing all accepted valid and wrong controls and supersedes earlier snapshots; do not combine old and new handles."
|
|
65
|
+
},
|
|
66
|
+
repair_oracle: {
|
|
67
|
+
oracle: "Accepted oracle handle to repair.",
|
|
68
|
+
findings: "Accepted oracle-evaluation findings handle to address."
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const AGENTIC_CAPABILITY_ARTIFACT_HANDLE_INSTRUCTION_V1 = "Supply the exact opaque artifact handle returned by a prior foundry tool result; never paste artifact contents, prose, commands, or an invented identifier.";
|
|
72
|
+
/**
|
|
73
|
+
* Effect's JSON Schema renderer does not consistently retain annotations on
|
|
74
|
+
* refined schemas. Apply the canonical agent-facing handle descriptions after
|
|
75
|
+
* rendering so every generated transport contract is derived from one durable
|
|
76
|
+
* protocol-owned mechanism.
|
|
77
|
+
*/
|
|
78
|
+
export const agenticCapabilityRequestJsonSchemaV1 = (schema) => {
|
|
79
|
+
const decorated = structuredClone(schema);
|
|
80
|
+
const root = decorated;
|
|
81
|
+
const descriptionsByTool = AGENTIC_CAPABILITY_ARTIFACT_HANDLE_DESCRIPTIONS_V1;
|
|
82
|
+
const sourceDescriptionsByTool = AGENTIC_CAPABILITY_SOURCE_HANDLE_DESCRIPTIONS_V1;
|
|
83
|
+
for (const branch of root.anyOf ?? []) {
|
|
84
|
+
const tool = branch.properties?.tool?.enum?.[0];
|
|
85
|
+
const descriptions = typeof tool === "string" ? descriptionsByTool[tool] : undefined;
|
|
86
|
+
const sourceDescriptions = typeof tool === "string" ? sourceDescriptionsByTool[tool] : undefined;
|
|
87
|
+
const args = branch.properties?.args;
|
|
88
|
+
const properties = args?.properties ??
|
|
89
|
+
args?.anyOf?.find((candidate) => candidate.properties !== undefined)
|
|
90
|
+
?.properties;
|
|
91
|
+
if (properties === undefined)
|
|
92
|
+
continue;
|
|
93
|
+
for (const [field, description] of Object.entries(descriptions ?? {})) {
|
|
94
|
+
const property = properties[field];
|
|
95
|
+
if (property === undefined)
|
|
96
|
+
continue;
|
|
97
|
+
property.description =
|
|
98
|
+
`${description} ${AGENTIC_CAPABILITY_ARTIFACT_HANDLE_INSTRUCTION_V1}`;
|
|
99
|
+
}
|
|
100
|
+
for (const [field, description] of Object.entries(sourceDescriptions ?? {})) {
|
|
101
|
+
const property = properties[field];
|
|
102
|
+
if (property !== undefined)
|
|
103
|
+
property.description = description;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return decorated;
|
|
107
|
+
};
|
|
108
|
+
const boundedText = (bytes, nonempty = false) => {
|
|
109
|
+
const base = Schema.String.check(Schema.isMaxLength(bytes), Schema.makeFilter((value) => Buffer.byteLength(value, "utf8") <= bytes && (!nonempty || value.trim().length > 0)
|
|
110
|
+
? undefined
|
|
111
|
+
: `must contain ${nonempty ? "1 to " : "at most "}${bytes} UTF-8 bytes`));
|
|
112
|
+
return nonempty
|
|
113
|
+
? base.check(Schema.isPattern(/\S/u, {
|
|
114
|
+
expected: `a nonempty string with at most ${bytes} UTF-8 bytes`
|
|
115
|
+
}))
|
|
116
|
+
: base;
|
|
117
|
+
};
|
|
118
|
+
const handle = boundedText(256, true).pipe(Schema.check(Schema.isTrimmed()), Schema.check(Schema.isPattern(/^[^\u0000-\u001f\u007f]+$/u, {
|
|
119
|
+
expected: "a normalized opaque handle without control characters"
|
|
120
|
+
})), Schema.check(Schema.makeFilter((value) => value.trim() === value && !/[\u0000-\u001f\u007f]/u.test(value)
|
|
121
|
+
? undefined
|
|
122
|
+
: "invalid opaque handle")));
|
|
123
|
+
const artifactHandle = (description) => handle.annotate({
|
|
124
|
+
description: `${description} ${AGENTIC_CAPABILITY_ARTIFACT_HANDLE_INSTRUCTION_V1}`
|
|
125
|
+
});
|
|
126
|
+
const digest = Schema.String.pipe(Schema.check(Schema.isPattern(/^[a-f0-9]{64}$/u)), Schema.check(Schema.makeFilter((value) => /^[a-f0-9]{64}$/u.test(value) ? undefined : "must be a lowercase SHA-256 digest")));
|
|
127
|
+
const integer = (maximum = Number.MAX_SAFE_INTEGER, minimum = 0) => Schema.Finite.pipe(Schema.check(Schema.isInt()), Schema.check(Schema.isBetween({ minimum, maximum })), Schema.check(Schema.makeFilter((value) => Number.isSafeInteger(value) && value >= minimum && value <= maximum
|
|
128
|
+
? undefined
|
|
129
|
+
: `must be an integer between ${minimum} and ${maximum}`)));
|
|
130
|
+
const timestamp = boundedText(64, true).pipe(Schema.check(Schema.isPattern(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}(Z|[+-]\d{2}:\d{2})$/u)), Schema.check(Schema.makeFilter((value) => /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}(Z|[+-]\d{2}:\d{2})$/u.test(value) &&
|
|
131
|
+
Number.isFinite(Date.parse(value))
|
|
132
|
+
? undefined
|
|
133
|
+
: "must be an ISO timestamp with milliseconds and timezone")));
|
|
134
|
+
const decimal = Schema.String.pipe(Schema.check(Schema.isPattern(/^(0|[1-9]\d{0,14})(\.\d{1,12})?$/u)), Schema.check(Schema.makeFilter((value) => /^(0|[1-9]\d{0,14})(\.\d{1,12})?$/u.test(value)
|
|
135
|
+
? undefined
|
|
136
|
+
: "must be a nonnegative decimal amount")));
|
|
137
|
+
const path = boundedText(4096, true).pipe(Schema.check(Schema.isPattern(/^(?!\/)(?![a-z]:)(?!.*[\\\u0000-\u001f\u007f])(?!(?:.*\/)?(?:\.|\.\.)(?:\/|$))[^/]+(?:\/[^/]+)*$/iu, { expected: "a normalized repository-relative path without traversal" })), Schema.check(Schema.makeFilter((value) => !value.startsWith("/") &&
|
|
138
|
+
!/^[a-z]:/iu.test(value) &&
|
|
139
|
+
!/[\\\u0000-\u001f\u007f]/u.test(value) &&
|
|
140
|
+
value.split("/").every((part) => part !== "" && part !== "." && part !== "..")
|
|
141
|
+
? undefined
|
|
142
|
+
: "must be a normalized repository-relative path without traversal")));
|
|
143
|
+
// Package roots may name the repository itself. File and artifact paths remain
|
|
144
|
+
// strict relative paths, so accepting a root never admits "." as a file.
|
|
145
|
+
const packageRoot = Schema.Union([Schema.Literal("."), path]);
|
|
146
|
+
const struct = (fields) => Schema.Struct(fields).annotate({ parseOptions: { onExcessProperty: "error" } });
|
|
147
|
+
const list = (schema, maximum = 32, minimum = 0) => Schema.Array(schema).pipe(Schema.check(Schema.isLengthBetween(minimum, maximum)), Schema.check(Schema.makeFilter((value) => value.length >= minimum && value.length <= maximum
|
|
148
|
+
? undefined
|
|
149
|
+
: `must contain ${minimum} to ${maximum} entries`)));
|
|
150
|
+
const capability = (tool, fields) => struct({ tool: Schema.Literal(tool), args: struct(fields) });
|
|
151
|
+
export const AgenticCapabilityRequestV1 = Schema.Union([
|
|
152
|
+
capability("inspect_repository", {}),
|
|
153
|
+
capability("list_candidates", {
|
|
154
|
+
coverageCell: handle,
|
|
155
|
+
cursor: Schema.optionalKey(handle),
|
|
156
|
+
limit: integer(50, 1)
|
|
157
|
+
}),
|
|
158
|
+
capability("read_source", {
|
|
159
|
+
source: handle,
|
|
160
|
+
path,
|
|
161
|
+
offset: integer(),
|
|
162
|
+
length: integer(120_000, 1)
|
|
163
|
+
}),
|
|
164
|
+
capability("search_source", {
|
|
165
|
+
source: handle,
|
|
166
|
+
query: boundedText(512, true),
|
|
167
|
+
cursor: Schema.optionalKey(handle)
|
|
168
|
+
}),
|
|
169
|
+
capability("draft_specification", {
|
|
170
|
+
candidate: handle,
|
|
171
|
+
previousDraft: Schema.optionalKey(artifactHandle(AGENTIC_CAPABILITY_ARTIFACT_HANDLE_DESCRIPTIONS_V1.draft_specification
|
|
172
|
+
.previousDraft)),
|
|
173
|
+
feedback: Schema.optionalKey(artifactHandle(AGENTIC_CAPABILITY_ARTIFACT_HANDLE_DESCRIPTIONS_V1.draft_specification
|
|
174
|
+
.feedback))
|
|
175
|
+
}),
|
|
176
|
+
capability("plan_environment", {
|
|
177
|
+
candidate: handle,
|
|
178
|
+
recipeIds: list(handle, 32, 1).annotate({
|
|
179
|
+
description: "Select one to 32 existing repository-owned grade recipe IDs for this candidate; never submit an empty list or invent commands."
|
|
180
|
+
}),
|
|
181
|
+
executionMode: Schema.Literals(["source", "emitted", "repository-default"]),
|
|
182
|
+
targetRoots: list(packageRoot, 32, 1).annotate({
|
|
183
|
+
description: "Select one to 32 normalized repository package roots required by the chosen recipes."
|
|
184
|
+
}),
|
|
185
|
+
requiredArtifacts: list(path),
|
|
186
|
+
justification: boundedText(4096, true)
|
|
187
|
+
}),
|
|
188
|
+
capability("probe_fixture", {
|
|
189
|
+
candidate: handle,
|
|
190
|
+
environment: artifactHandle(AGENTIC_CAPABILITY_ARTIFACT_HANDLE_DESCRIPTIONS_V1.probe_fixture.environment),
|
|
191
|
+
fixtureDraft: artifactHandle(AGENTIC_CAPABILITY_ARTIFACT_HANDLE_DESCRIPTIONS_V1.probe_fixture.fixtureDraft)
|
|
192
|
+
}),
|
|
193
|
+
capability("qualify_reference", {
|
|
194
|
+
candidate: handle,
|
|
195
|
+
environment: artifactHandle(AGENTIC_CAPABILITY_ARTIFACT_HANDLE_DESCRIPTIONS_V1.qualify_reference
|
|
196
|
+
.environment)
|
|
197
|
+
}),
|
|
198
|
+
capability("author_oracle", {
|
|
199
|
+
candidate: handle,
|
|
200
|
+
specification: artifactHandle(AGENTIC_CAPABILITY_ARTIFACT_HANDLE_DESCRIPTIONS_V1.author_oracle
|
|
201
|
+
.specification),
|
|
202
|
+
previousOracle: Schema.optionalKey(artifactHandle(AGENTIC_CAPABILITY_ARTIFACT_HANDLE_DESCRIPTIONS_V1.author_oracle
|
|
203
|
+
.previousOracle)),
|
|
204
|
+
findings: Schema.optionalKey(artifactHandle(AGENTIC_CAPABILITY_ARTIFACT_HANDLE_DESCRIPTIONS_V1.author_oracle.findings))
|
|
205
|
+
}),
|
|
206
|
+
capability("generate_controls", {
|
|
207
|
+
candidate: handle,
|
|
208
|
+
specification: artifactHandle(AGENTIC_CAPABILITY_ARTIFACT_HANDLE_DESCRIPTIONS_V1.generate_controls
|
|
209
|
+
.specification),
|
|
210
|
+
environment: artifactHandle(AGENTIC_CAPABILITY_ARTIFACT_HANDLE_DESCRIPTIONS_V1.generate_controls
|
|
211
|
+
.environment),
|
|
212
|
+
kind: Schema.Literals(["valid", "wrong"])
|
|
213
|
+
}),
|
|
214
|
+
capability("evaluate_oracle", {
|
|
215
|
+
candidate: handle,
|
|
216
|
+
oracle: artifactHandle(AGENTIC_CAPABILITY_ARTIFACT_HANDLE_DESCRIPTIONS_V1.evaluate_oracle.oracle),
|
|
217
|
+
controls: list(handle, 32, 1).annotate({
|
|
218
|
+
description: AGENTIC_CAPABILITY_ARTIFACT_HANDLE_DESCRIPTIONS_V1.evaluate_oracle.controls
|
|
219
|
+
})
|
|
220
|
+
}),
|
|
221
|
+
capability("repair_oracle", {
|
|
222
|
+
candidate: handle,
|
|
223
|
+
oracle: artifactHandle(AGENTIC_CAPABILITY_ARTIFACT_HANDLE_DESCRIPTIONS_V1.repair_oracle.oracle),
|
|
224
|
+
findings: artifactHandle(AGENTIC_CAPABILITY_ARTIFACT_HANDLE_DESCRIPTIONS_V1.repair_oracle.findings)
|
|
225
|
+
}),
|
|
226
|
+
capability("freeze_candidate", { candidate: handle, revision: handle }),
|
|
227
|
+
capability("run_held_out_challenge", { frozenCandidate: handle }),
|
|
228
|
+
capability("request_admission", { frozenCandidate: handle, qualification: handle }),
|
|
229
|
+
capability("get_progress", { candidate: Schema.optionalKey(handle) }),
|
|
230
|
+
capability("read_diagnostics", {
|
|
231
|
+
operation: handle,
|
|
232
|
+
cursor: Schema.optionalKey(handle),
|
|
233
|
+
maximumBytes: integer(65_536, 1)
|
|
234
|
+
}),
|
|
235
|
+
capability("reject_candidate", {
|
|
236
|
+
candidate: handle,
|
|
237
|
+
reason: boundedText(4096, true),
|
|
238
|
+
evidence: list(handle)
|
|
239
|
+
}),
|
|
240
|
+
capability("finish_campaign", { reason: boundedText(4096, true) })
|
|
241
|
+
]);
|
|
242
|
+
export const decodeAgenticCapabilityRequestV1 = Schema.decodeUnknownSync(AgenticCapabilityRequestV1);
|
|
243
|
+
export const AgenticTrustedInvocationV1 = struct({
|
|
244
|
+
orgId: handle,
|
|
245
|
+
campaignId: handle,
|
|
246
|
+
executionId: handle,
|
|
247
|
+
epoch: integer(Number.MAX_SAFE_INTEGER, 1),
|
|
248
|
+
operationId: handle,
|
|
249
|
+
inputDigest: digest,
|
|
250
|
+
candidateRevision: Schema.optionalKey(handle),
|
|
251
|
+
actorRole: handle,
|
|
252
|
+
modelBinding: handle,
|
|
253
|
+
reservation: handle,
|
|
254
|
+
deadlineAt: timestamp,
|
|
255
|
+
maximumModelCalls: Schema.optionalKey(integer(Number.MAX_SAFE_INTEGER, 1)),
|
|
256
|
+
maximumWallTimeMs: Schema.optionalKey(integer(Number.MAX_SAFE_INTEGER, 1)),
|
|
257
|
+
toolBundleDigest: digest,
|
|
258
|
+
traceparent: Schema.optionalKey(Schema.String.pipe(Schema.check(Schema.makeFilter((value) => /^00-(?!0{32})[a-f0-9]{32}-(?!0{16})[a-f0-9]{16}-[a-f0-9]{2}$/u.test(value)
|
|
259
|
+
? undefined
|
|
260
|
+
: "invalid W3C traceparent")))),
|
|
261
|
+
request: AgenticCapabilityRequestV1
|
|
262
|
+
});
|
|
263
|
+
export const decodeAgenticTrustedInvocationV1 = Schema.decodeUnknownSync(AgenticTrustedInvocationV1);
|
|
264
|
+
export const AgenticProgressFingerprintV1 = struct({
|
|
265
|
+
version: Schema.Literal(1),
|
|
266
|
+
acceptedEvidenceDigest: digest,
|
|
267
|
+
completedGateDigest: digest,
|
|
268
|
+
environmentDigest: Schema.NullOr(digest),
|
|
269
|
+
continuationProgressDigest: Schema.optionalKey(Schema.NullOr(digest))
|
|
270
|
+
});
|
|
271
|
+
export const decodeAgenticProgressFingerprintV1 = Schema.decodeUnknownSync(AgenticProgressFingerprintV1);
|
|
272
|
+
const scientificBudgetRemaining = struct({
|
|
273
|
+
phaseCalls: integer(),
|
|
274
|
+
phaseSpendUsd: Schema.NullOr(decimal),
|
|
275
|
+
phaseWallTimeMs: integer(),
|
|
276
|
+
phaseAttempts: integer(),
|
|
277
|
+
downstreamCalls: integer(),
|
|
278
|
+
downstreamSpendUsd: Schema.NullOr(decimal),
|
|
279
|
+
downstreamWallTimeMs: integer(),
|
|
280
|
+
downstreamAttempts: integer()
|
|
281
|
+
});
|
|
282
|
+
/** Host-computed scientific progress; model prose and activity are never inputs. */
|
|
283
|
+
export const AgenticScientificProgressReceiptV1 = struct({
|
|
284
|
+
version: Schema.Literal(1),
|
|
285
|
+
receiptId: handle,
|
|
286
|
+
operationId: handle,
|
|
287
|
+
capability: Schema.Literals(AGENTIC_CAPABILITY_NAMES_V1),
|
|
288
|
+
scientificRole: handle,
|
|
289
|
+
phase: handle,
|
|
290
|
+
inputRevision: Schema.NullOr(handle),
|
|
291
|
+
outputRevision: Schema.NullOr(handle),
|
|
292
|
+
acceptedEvidenceDigest: digest,
|
|
293
|
+
previousFingerprint: Schema.NullOr(AgenticProgressFingerprintV1),
|
|
294
|
+
resultingFingerprint: AgenticProgressFingerprintV1,
|
|
295
|
+
acceptedEvidenceAdded: list(handle, 128),
|
|
296
|
+
acceptedEvidenceRemoved: list(handle, 128),
|
|
297
|
+
gatesCompleted: list(handle, 64),
|
|
298
|
+
gatesInvalidated: list(handle, 64),
|
|
299
|
+
sameFingerprintCount: integer(),
|
|
300
|
+
consumption: struct({
|
|
301
|
+
wallTimeMs: integer(),
|
|
302
|
+
receivedCalls: integer(),
|
|
303
|
+
spendKnownUsd: decimal,
|
|
304
|
+
spendUnknown: Schema.Boolean
|
|
305
|
+
}),
|
|
306
|
+
remaining: scientificBudgetRemaining,
|
|
307
|
+
recordedAt: timestamp
|
|
308
|
+
}).pipe(Schema.check(Schema.makeFilter((value) => value.acceptedEvidenceDigest === value.resultingFingerprint.acceptedEvidenceDigest
|
|
309
|
+
? undefined
|
|
310
|
+
: "receipt evidence digest must equal resulting fingerprint")));
|
|
311
|
+
export const decodeAgenticScientificProgressReceiptV1 = Schema.decodeUnknownSync(AgenticScientificProgressReceiptV1);
|
|
312
|
+
/** Privacy-safe sequence evidence returned at the control error boundary. */
|
|
313
|
+
export const AgenticScientificProgressSequenceDiagnosticV1 = struct({
|
|
314
|
+
accepted: Schema.Boolean,
|
|
315
|
+
previousFingerprintPresent: Schema.Boolean,
|
|
316
|
+
previousFingerprintComponentsMatch: struct({
|
|
317
|
+
acceptedEvidence: Schema.Boolean,
|
|
318
|
+
completedGates: Schema.Boolean,
|
|
319
|
+
environment: Schema.Boolean
|
|
320
|
+
}),
|
|
321
|
+
resultingFingerprintUnchanged: Schema.Boolean,
|
|
322
|
+
previousCapability: Schema.Literals(AGENTIC_CAPABILITY_NAMES_V1),
|
|
323
|
+
receivedCapability: Schema.Literals(AGENTIC_CAPABILITY_NAMES_V1),
|
|
324
|
+
capabilityContinued: Schema.Boolean,
|
|
325
|
+
expectedSameFingerprintCount: integer(),
|
|
326
|
+
receivedSameFingerprintCount: integer()
|
|
327
|
+
});
|
|
328
|
+
export const decodeAgenticScientificProgressSequenceDiagnosticV1 = Schema.decodeUnknownSync(AgenticScientificProgressSequenceDiagnosticV1);
|
|
329
|
+
export const AgenticCapabilityReconciliationV1 = struct({
|
|
330
|
+
kind: Schema.Literals([
|
|
331
|
+
"applied",
|
|
332
|
+
"already_applied",
|
|
333
|
+
"scientific_progress_stale",
|
|
334
|
+
"scientific_progress_conflict"
|
|
335
|
+
]),
|
|
336
|
+
latestProgressReceipt: Schema.NullOr(handle),
|
|
337
|
+
recoveryAction: Schema.Literals(["continue", "get_progress", "stop"])
|
|
338
|
+
});
|
|
339
|
+
export const decodeAgenticCapabilityReconciliationV1 = Schema.decodeUnknownSync(AgenticCapabilityReconciliationV1);
|
|
340
|
+
/**
|
|
341
|
+
* Bounded Sandbox-to-Cloud settlement for an admitted capability that failed
|
|
342
|
+
* before it could produce a normal scientific receipt. This closes known
|
|
343
|
+
* local failures immediately while preserving genuinely ambiguous external
|
|
344
|
+
* effects as uncertain.
|
|
345
|
+
*/
|
|
346
|
+
export const AgenticCapabilityExecutionFailureV1 = struct({
|
|
347
|
+
classification: Schema.Literals([
|
|
348
|
+
"deterministic_local",
|
|
349
|
+
"external_outcome_unknown",
|
|
350
|
+
"cancelled"
|
|
351
|
+
]),
|
|
352
|
+
code: handle
|
|
353
|
+
});
|
|
354
|
+
export const decodeAgenticCapabilityExecutionFailureV1 = Schema.decodeUnknownSync(AgenticCapabilityExecutionFailureV1);
|
|
355
|
+
export const AgenticCapabilityResultV1 = struct({
|
|
356
|
+
outcome: Schema.Literals([
|
|
357
|
+
"completed",
|
|
358
|
+
"progress",
|
|
359
|
+
"environment_blocked",
|
|
360
|
+
"scientific_rejection",
|
|
361
|
+
"budget_exhausted",
|
|
362
|
+
"cancelled",
|
|
363
|
+
"infrastructure_uncertain"
|
|
364
|
+
]),
|
|
365
|
+
operation: handle,
|
|
366
|
+
inputDigest: digest,
|
|
367
|
+
candidateRevision: Schema.optionalKey(handle),
|
|
368
|
+
accepted: list(handle),
|
|
369
|
+
evidenceSummary: boundedText(8192),
|
|
370
|
+
gradeExecuted: Schema.optionalKey(Schema.Boolean),
|
|
371
|
+
diagnostics: Schema.optionalKey(handle),
|
|
372
|
+
logCursor: Schema.optionalKey(handle),
|
|
373
|
+
pendingJob: Schema.optionalKey(handle),
|
|
374
|
+
exhaustionScope: Schema.optionalKey(Schema.Literals([
|
|
375
|
+
"campaign",
|
|
376
|
+
"execution_epoch_orchestration",
|
|
377
|
+
"scientific_role"
|
|
378
|
+
])),
|
|
379
|
+
progressReceipt: Schema.optionalKey(AgenticScientificProgressReceiptV1),
|
|
380
|
+
reconciliation: Schema.optionalKey(AgenticCapabilityReconciliationV1),
|
|
381
|
+
usage: struct({ receivedCalls: integer(), spendKnownUsd: decimal, spendUnknown: Schema.Boolean }),
|
|
382
|
+
allowedNext: list(Schema.Literals(AGENTIC_CAPABILITY_NAMES_V1), AGENTIC_CAPABILITY_NAMES_V1.length)
|
|
383
|
+
})
|
|
384
|
+
.pipe(Schema.check(Schema.makeFilter((value) => {
|
|
385
|
+
if (Buffer.byteLength(JSON.stringify(value), "utf8") > 65_536)
|
|
386
|
+
return "model-facing result exceeds 64 KiB";
|
|
387
|
+
if (value.outcome === "environment_blocked" && value.gradeExecuted !== false)
|
|
388
|
+
return "environment blockage must explicitly report gradeExecuted=false";
|
|
389
|
+
return undefined;
|
|
390
|
+
})))
|
|
391
|
+
.annotate({ parseOptions: { onExcessProperty: "error" } });
|
|
392
|
+
export const decodeAgenticCapabilityResultV1 = Schema.decodeUnknownSync(AgenticCapabilityResultV1);
|
|
393
|
+
export const AgenticEnvironmentPlanV1 = struct({
|
|
394
|
+
version: Schema.Literal(1),
|
|
395
|
+
planId: handle,
|
|
396
|
+
candidate: handle,
|
|
397
|
+
revision: handle,
|
|
398
|
+
sourceDigest: digest,
|
|
399
|
+
commitSha: Schema.String.pipe(Schema.check(Schema.makeFilter((value) => /^[a-f0-9]{40}$/u.test(value) ? undefined : "invalid commit SHA"))),
|
|
400
|
+
recipeIds: list(handle, 32, 1),
|
|
401
|
+
executionMode: Schema.Literals(["source", "emitted", "repository-default"]),
|
|
402
|
+
targetRoots: list(packageRoot, 32, 1),
|
|
403
|
+
// A root-scoped test command can legitimately require the repository's
|
|
404
|
+
// project-reference graph; keep it bounded without rejecting a 36-package
|
|
405
|
+
// TypeScript workspace before any scientific command can run.
|
|
406
|
+
dependencyClosure: list(packageRoot, 64),
|
|
407
|
+
requiredArtifacts: list(path),
|
|
408
|
+
lockfileDigest: Schema.NullOr(digest),
|
|
409
|
+
packageManager: Schema.NullOr(struct({ name: handle, version: handle })),
|
|
410
|
+
runtime: struct({ name: handle, version: handle, platform: handle, architecture: handle }),
|
|
411
|
+
commands: list(struct({
|
|
412
|
+
id: handle,
|
|
413
|
+
purpose: Schema.Literals(["install", "build", "generate", "probe", "grade"]),
|
|
414
|
+
executable: boundedText(4096, true),
|
|
415
|
+
args: list(boundedText(4096), 128),
|
|
416
|
+
cwd: Schema.NullOr(path),
|
|
417
|
+
timeoutMs: integer(600_000, 1)
|
|
418
|
+
}), 64),
|
|
419
|
+
expectedCost: struct({ wallTimeMs: integer(), spendUsd: Schema.NullOr(decimal) }),
|
|
420
|
+
justification: boundedText(4096, true),
|
|
421
|
+
justificationEvidence: list(handle)
|
|
422
|
+
});
|
|
423
|
+
export const decodeAgenticEnvironmentPlanV1 = Schema.decodeUnknownSync(AgenticEnvironmentPlanV1);
|
|
424
|
+
export const AgenticScientificInputsV1 = struct({
|
|
425
|
+
sourceDigest: digest,
|
|
426
|
+
environmentDigest: digest,
|
|
427
|
+
specificationDigest: digest,
|
|
428
|
+
oracleDigest: digest,
|
|
429
|
+
controlsDigest: digest,
|
|
430
|
+
policyDigest: digest,
|
|
431
|
+
modelPlanDigest: digest
|
|
432
|
+
});
|
|
433
|
+
const NON_SCIENTIFIC_EVIDENCE_KINDS = new Set([
|
|
434
|
+
"budget_exhaustion", "diagnostics", "message", "model_call", "progress_receipt",
|
|
435
|
+
"qualification_progress", "continuation_progress", "read", "scorecard", "scientific_checkpoint"
|
|
436
|
+
]);
|
|
437
|
+
export const makeAgenticProgressFingerprintV1 = (input) => {
|
|
438
|
+
// Continuations are accepted state, but not completed scientific evidence.
|
|
439
|
+
// Derive both components from the artifact set carried by receipt deltas.
|
|
440
|
+
const continuations = input.acceptedEvidence
|
|
441
|
+
.filter((entry) => entry.kind === "qualification_progress" || entry.kind === "continuation_progress")
|
|
442
|
+
.map(({ kind, contentDigest }) => ({ kind, contentDigest }))
|
|
443
|
+
.sort((left, right) => left.contentDigest.localeCompare(right.contentDigest));
|
|
444
|
+
const continuationProgressDigest = input.continuationProgressDigest === undefined
|
|
445
|
+
? continuations.length === 0 ? null : agenticDigestV1(continuations)
|
|
446
|
+
: input.continuationProgressDigest;
|
|
447
|
+
return decodeAgenticProgressFingerprintV1({
|
|
448
|
+
version: 1,
|
|
449
|
+
acceptedEvidenceDigest: agenticDigestV1([
|
|
450
|
+
...new Map(input.acceptedEvidence
|
|
451
|
+
.filter((entry) => !NON_SCIENTIFIC_EVIDENCE_KINDS.has(entry.kind))
|
|
452
|
+
.map(({ contentDigest, kind }) => {
|
|
453
|
+
const accepted = {
|
|
454
|
+
contentDigest: Schema.decodeUnknownSync(digest)(contentDigest),
|
|
455
|
+
kind: Schema.decodeUnknownSync(handle)(kind)
|
|
456
|
+
};
|
|
457
|
+
return [`${accepted.kind}:${accepted.contentDigest}`, accepted];
|
|
458
|
+
})).values()
|
|
459
|
+
].sort((left, right) => `${left.kind}:${left.contentDigest}`.localeCompare(`${right.kind}:${right.contentDigest}`))),
|
|
460
|
+
completedGateDigest: agenticDigestV1([...input.completedGates]
|
|
461
|
+
.map((gate) => Schema.decodeUnknownSync(handle)(gate))
|
|
462
|
+
.sort((left, right) => left.localeCompare(right))),
|
|
463
|
+
environmentDigest: input.environmentDigest === null
|
|
464
|
+
? null
|
|
465
|
+
: Schema.decodeUnknownSync(digest)(input.environmentDigest),
|
|
466
|
+
continuationProgressDigest: continuationProgressDigest === null
|
|
467
|
+
? null
|
|
468
|
+
: Schema.decodeUnknownSync(digest)(continuationProgressDigest)
|
|
469
|
+
});
|
|
470
|
+
};
|
|
471
|
+
const candidateFields = {
|
|
472
|
+
version: Schema.Literal(1),
|
|
473
|
+
candidate: handle,
|
|
474
|
+
revision: handle,
|
|
475
|
+
coverageCell: handle,
|
|
476
|
+
sourceDigest: digest,
|
|
477
|
+
proposal: handle,
|
|
478
|
+
createdAt: timestamp
|
|
479
|
+
};
|
|
480
|
+
const qualifiedFields = { ...candidateFields, environment: handle, referenceQualification: handle };
|
|
481
|
+
const frozenFields = {
|
|
482
|
+
...qualifiedFields,
|
|
483
|
+
specification: handle,
|
|
484
|
+
oracle: handle,
|
|
485
|
+
controls: list(handle, 32, 1),
|
|
486
|
+
tournament: handle,
|
|
487
|
+
inputs: AgenticScientificInputsV1,
|
|
488
|
+
frozenAt: timestamp
|
|
489
|
+
};
|
|
490
|
+
export const AgenticCandidateV1 = Schema.Union([
|
|
491
|
+
struct({ ...candidateFields, state: Schema.Literal("draft") }),
|
|
492
|
+
struct({
|
|
493
|
+
...candidateFields,
|
|
494
|
+
state: Schema.Literal("probed"),
|
|
495
|
+
environment: handle,
|
|
496
|
+
observation: handle,
|
|
497
|
+
gradeExecuted: Schema.Boolean
|
|
498
|
+
}),
|
|
499
|
+
struct({ ...qualifiedFields, state: Schema.Literal("reference_qualified") }),
|
|
500
|
+
struct({ ...frozenFields, state: Schema.Literal("frozen") }),
|
|
501
|
+
struct({
|
|
502
|
+
...frozenFields,
|
|
503
|
+
state: Schema.Literal("admitted"),
|
|
504
|
+
challenge: handle,
|
|
505
|
+
admission: handle
|
|
506
|
+
}),
|
|
507
|
+
struct({
|
|
508
|
+
...candidateFields,
|
|
509
|
+
state: Schema.Literal("superseded"),
|
|
510
|
+
reason: boundedText(4096, true),
|
|
511
|
+
replacementRevision: handle,
|
|
512
|
+
evidence: list(handle)
|
|
513
|
+
}),
|
|
514
|
+
struct({
|
|
515
|
+
...candidateFields,
|
|
516
|
+
state: Schema.Literal("rejected"),
|
|
517
|
+
reason: boundedText(4096, true),
|
|
518
|
+
evidence: list(handle)
|
|
519
|
+
})
|
|
520
|
+
]);
|
|
521
|
+
export const decodeAgenticCandidateV1 = Schema.decodeUnknownSync(AgenticCandidateV1);
|
|
522
|
+
export const AgenticAcceptedArtifactV1 = struct({
|
|
523
|
+
handle,
|
|
524
|
+
candidate: handle,
|
|
525
|
+
revision: handle,
|
|
526
|
+
contentDigest: digest,
|
|
527
|
+
kind: Schema.Literals([
|
|
528
|
+
"proposal",
|
|
529
|
+
"specification",
|
|
530
|
+
"environment",
|
|
531
|
+
"fixture",
|
|
532
|
+
"observation",
|
|
533
|
+
"reference_qualification",
|
|
534
|
+
"oracle",
|
|
535
|
+
"valid_controls",
|
|
536
|
+
"wrong_controls",
|
|
537
|
+
"tournament",
|
|
538
|
+
"frozen_candidate",
|
|
539
|
+
"held_out_challenge",
|
|
540
|
+
"admission",
|
|
541
|
+
"diagnostics"
|
|
542
|
+
]),
|
|
543
|
+
state: Schema.Literals([
|
|
544
|
+
"draft",
|
|
545
|
+
"probed",
|
|
546
|
+
"reference_qualified",
|
|
547
|
+
"frozen",
|
|
548
|
+
"admitted",
|
|
549
|
+
"superseded",
|
|
550
|
+
"rejected"
|
|
551
|
+
]),
|
|
552
|
+
dependencies: struct({
|
|
553
|
+
sourceDigest: Schema.optionalKey(digest),
|
|
554
|
+
environmentDigest: Schema.optionalKey(digest),
|
|
555
|
+
specificationDigest: Schema.optionalKey(digest),
|
|
556
|
+
oracleDigest: Schema.optionalKey(digest),
|
|
557
|
+
controlsDigest: Schema.optionalKey(digest),
|
|
558
|
+
policyDigest: Schema.optionalKey(digest),
|
|
559
|
+
modelPlanDigest: Schema.optionalKey(digest)
|
|
560
|
+
}),
|
|
561
|
+
gradeExecuted: Schema.optionalKey(Schema.Boolean),
|
|
562
|
+
fresh: Schema.optionalKey(Schema.Boolean)
|
|
563
|
+
});
|
|
564
|
+
export const decodeAgenticAcceptedArtifactV1 = Schema.decodeUnknownSync(AgenticAcceptedArtifactV1);
|
|
565
|
+
const measurement = struct({
|
|
566
|
+
passed: integer(),
|
|
567
|
+
failed: integer(),
|
|
568
|
+
missing: integer(),
|
|
569
|
+
evidence: list(handle)
|
|
570
|
+
});
|
|
571
|
+
export const AgenticQualityScorecardV1 = struct({
|
|
572
|
+
version: Schema.Literal(1),
|
|
573
|
+
candidate: handle,
|
|
574
|
+
revision: handle,
|
|
575
|
+
reference: measurement,
|
|
576
|
+
validControls: measurement,
|
|
577
|
+
wrongControls: measurement,
|
|
578
|
+
heldOut: measurement,
|
|
579
|
+
coverage: list(struct({ cell: handle, observed: Schema.Boolean, evidence: list(handle) }), 128),
|
|
580
|
+
disposition: Schema.Literals([
|
|
581
|
+
"draft",
|
|
582
|
+
"environment_blocked",
|
|
583
|
+
"qualified",
|
|
584
|
+
"rejected",
|
|
585
|
+
"admitted",
|
|
586
|
+
"exhausted"
|
|
587
|
+
]),
|
|
588
|
+
reasons: list(boundedText(4096, true)),
|
|
589
|
+
missingEvidence: list(handle),
|
|
590
|
+
usage: struct({
|
|
591
|
+
elapsedMs: integer(),
|
|
592
|
+
receivedCalls: integer(),
|
|
593
|
+
spendKnownUsd: decimal,
|
|
594
|
+
spendUnknown: Schema.Boolean
|
|
595
|
+
}),
|
|
596
|
+
admission: Schema.NullOr(handle)
|
|
597
|
+
})
|
|
598
|
+
.pipe(Schema.check(Schema.makeFilter((value) => {
|
|
599
|
+
if (value.disposition !== "admitted")
|
|
600
|
+
return value.admission === null
|
|
601
|
+
? undefined
|
|
602
|
+
: "only admitted scorecards have an admission receipt";
|
|
603
|
+
if (value.admission === null || value.missingEvidence.length > 0)
|
|
604
|
+
return "admission requires a receipt and complete evidence";
|
|
605
|
+
for (const measurement of [
|
|
606
|
+
value.reference,
|
|
607
|
+
value.validControls,
|
|
608
|
+
value.wrongControls,
|
|
609
|
+
value.heldOut
|
|
610
|
+
]) {
|
|
611
|
+
if (measurement.passed === 0 ||
|
|
612
|
+
measurement.missing > 0 ||
|
|
613
|
+
measurement.evidence.length === 0)
|
|
614
|
+
return "admission requires measured reference, controls and held-out evidence";
|
|
615
|
+
}
|
|
616
|
+
return undefined;
|
|
617
|
+
})))
|
|
618
|
+
.annotate({ parseOptions: { onExcessProperty: "error" } });
|
|
619
|
+
export const decodeAgenticQualityScorecardV1 = Schema.decodeUnknownSync(AgenticQualityScorecardV1);
|
|
620
|
+
/** Existing V2 canonical digest: path-independent and stable across object key ordering. */
|
|
621
|
+
export const agenticDigestV1 = pipelineDigestV2;
|
|
622
|
+
/** Deliberately excludes transport tool-call IDs, attempt epoch, deadlines and reservations. */
|
|
623
|
+
export const agenticSemanticOperationDigestV1 = (input) => agenticDigestV1({
|
|
624
|
+
orgId: Schema.decodeUnknownSync(handle)(input.orgId),
|
|
625
|
+
campaignId: Schema.decodeUnknownSync(handle)(input.campaignId),
|
|
626
|
+
candidateRevision: input.candidateRevision === undefined
|
|
627
|
+
? undefined
|
|
628
|
+
: Schema.decodeUnknownSync(handle)(input.candidateRevision),
|
|
629
|
+
toolBundleDigest: Schema.decodeUnknownSync(digest)(input.toolBundleDigest),
|
|
630
|
+
request: decodeAgenticCapabilityRequestV1(input.request)
|
|
631
|
+
});
|
|
632
|
+
/** Conservative invalidation: every recorded dependency must still match. */
|
|
633
|
+
export const assertAgenticEvidenceInputsV1 = (artifactValue, current) => {
|
|
634
|
+
const artifact = decodeAgenticAcceptedArtifactV1(artifactValue);
|
|
635
|
+
const sourceOnly = ["sourceDigest"];
|
|
636
|
+
const executable = ["sourceDigest", "environmentDigest"];
|
|
637
|
+
const authored = ["sourceDigest", "policyDigest", "modelPlanDigest"];
|
|
638
|
+
const qualified = [
|
|
639
|
+
"sourceDigest",
|
|
640
|
+
"environmentDigest",
|
|
641
|
+
"policyDigest",
|
|
642
|
+
"modelPlanDigest"
|
|
643
|
+
];
|
|
644
|
+
const oracle = [...qualified, "specificationDigest"];
|
|
645
|
+
const full = [...oracle, "oracleDigest", "controlsDigest"];
|
|
646
|
+
const required = {
|
|
647
|
+
proposal: sourceOnly,
|
|
648
|
+
specification: authored,
|
|
649
|
+
environment: sourceOnly,
|
|
650
|
+
fixture: sourceOnly,
|
|
651
|
+
observation: executable,
|
|
652
|
+
reference_qualification: qualified,
|
|
653
|
+
oracle,
|
|
654
|
+
valid_controls: oracle,
|
|
655
|
+
wrong_controls: oracle,
|
|
656
|
+
tournament: full,
|
|
657
|
+
frozen_candidate: full,
|
|
658
|
+
held_out_challenge: full,
|
|
659
|
+
admission: full,
|
|
660
|
+
diagnostics: sourceOnly
|
|
661
|
+
};
|
|
662
|
+
for (const key of required[artifact.kind]) {
|
|
663
|
+
if (artifact.dependencies[key] === undefined)
|
|
664
|
+
throw new Error(`scientific evidence is missing dependency: ${key}`);
|
|
665
|
+
}
|
|
666
|
+
for (const [key, value] of Object.entries(artifact.dependencies)) {
|
|
667
|
+
if (current[key] !== value)
|
|
668
|
+
throw new Error(`stale scientific evidence: ${key}`);
|
|
669
|
+
}
|
|
670
|
+
};
|
|
671
|
+
/** The caller passes host-resolved records, never model-provided checkpoint objects. */
|
|
672
|
+
export const assertAgenticArtifactPrerequisitesV1 = (input) => {
|
|
673
|
+
if (input.handles.length === 0)
|
|
674
|
+
throw new Error("scientific prerequisites require accepted evidence");
|
|
675
|
+
const records = input.accepted.map((value) => decodeAgenticAcceptedArtifactV1(value));
|
|
676
|
+
if (new Set(records.map((entry) => entry.handle)).size !== records.length)
|
|
677
|
+
throw new Error("conflicting accepted handle records");
|
|
678
|
+
if (new Set(input.handles).size !== input.handles.length)
|
|
679
|
+
throw new Error("duplicate prerequisite handles");
|
|
680
|
+
for (const requested of input.handles) {
|
|
681
|
+
const artifact = records.find((entry) => entry.handle === requested);
|
|
682
|
+
if (!artifact || artifact.candidate !== input.candidate || artifact.revision !== input.revision)
|
|
683
|
+
throw new Error("unaccepted or mismatched candidate revision handle");
|
|
684
|
+
if (artifact.state === "superseded" || artifact.state === "rejected")
|
|
685
|
+
throw new Error("retired evidence cannot satisfy prerequisites");
|
|
686
|
+
if (input.kinds && !input.kinds.includes(artifact.kind))
|
|
687
|
+
throw new Error("incorrect prerequisite artifact kind");
|
|
688
|
+
if (input.states && !input.states.includes(artifact.state))
|
|
689
|
+
throw new Error("incorrect prerequisite artifact state");
|
|
690
|
+
if (input.requireGrade && artifact.gradeExecuted !== true)
|
|
691
|
+
throw new Error("preparation is not an executed grade");
|
|
692
|
+
if (input.requireFresh && artifact.fresh !== true)
|
|
693
|
+
throw new Error("development evidence is not a fresh challenge");
|
|
694
|
+
assertAgenticEvidenceInputsV1(artifact, input.inputs);
|
|
695
|
+
}
|
|
696
|
+
};
|
|
697
|
+
/** State transitions validate evidence references; scientific services still decide the verdict. */
|
|
698
|
+
export const assertAgenticCandidateTransitionV1 = (previousValue, nextValue, accepted, currentInputs = {}) => {
|
|
699
|
+
const previous = decodeAgenticCandidateV1(previousValue);
|
|
700
|
+
const next = decodeAgenticCandidateV1(nextValue);
|
|
701
|
+
for (const field of [
|
|
702
|
+
"candidate",
|
|
703
|
+
"revision",
|
|
704
|
+
"coverageCell",
|
|
705
|
+
"sourceDigest",
|
|
706
|
+
"proposal",
|
|
707
|
+
"createdAt"
|
|
708
|
+
]) {
|
|
709
|
+
if (previous[field] !== next[field])
|
|
710
|
+
throw new Error(`immutable candidate field changed: ${field}`);
|
|
711
|
+
}
|
|
712
|
+
if (previous.state === next.state && agenticDigestV1(previous) === agenticDigestV1(next))
|
|
713
|
+
return;
|
|
714
|
+
const transitions = {
|
|
715
|
+
draft: ["probed", "reference_qualified", "rejected", "superseded"],
|
|
716
|
+
probed: ["reference_qualified", "rejected", "superseded"],
|
|
717
|
+
reference_qualified: ["frozen", "rejected", "superseded"],
|
|
718
|
+
frozen: ["admitted", "rejected", "superseded"],
|
|
719
|
+
admitted: [],
|
|
720
|
+
rejected: [],
|
|
721
|
+
superseded: []
|
|
722
|
+
};
|
|
723
|
+
if (!transitions[previous.state].includes(next.state))
|
|
724
|
+
throw new Error("invalid candidate state transition");
|
|
725
|
+
const inputs = "inputs" in next ? next.inputs : { ...currentInputs, sourceDigest: next.sourceDigest };
|
|
726
|
+
const requireArtifact = (requested, kinds, requireGrade = false, requireFresh = false) => assertAgenticArtifactPrerequisitesV1({
|
|
727
|
+
candidate: next.candidate,
|
|
728
|
+
revision: next.revision,
|
|
729
|
+
handles: typeof requested === "string" ? [requested] : requested,
|
|
730
|
+
accepted,
|
|
731
|
+
kinds,
|
|
732
|
+
inputs,
|
|
733
|
+
states: ["probed", "reference_qualified", "frozen", "admitted"],
|
|
734
|
+
requireGrade,
|
|
735
|
+
requireFresh
|
|
736
|
+
});
|
|
737
|
+
if (next.state === "probed") {
|
|
738
|
+
requireArtifact(next.observation, ["observation"]);
|
|
739
|
+
const observation = accepted.find((entry) => entry.handle === next.observation);
|
|
740
|
+
if (observation?.gradeExecuted !== next.gradeExecuted)
|
|
741
|
+
throw new Error("probe grade flag does not match observation");
|
|
742
|
+
}
|
|
743
|
+
if ("referenceQualification" in next) {
|
|
744
|
+
requireArtifact(next.environment, ["environment"]);
|
|
745
|
+
requireArtifact(next.referenceQualification, ["reference_qualification"], true);
|
|
746
|
+
}
|
|
747
|
+
if ("inputs" in next) {
|
|
748
|
+
if (next.sourceDigest !== next.inputs.sourceDigest)
|
|
749
|
+
throw new Error("frozen source identity differs from candidate");
|
|
750
|
+
requireArtifact(next.specification, ["specification"]);
|
|
751
|
+
requireArtifact(next.environment, ["environment"]);
|
|
752
|
+
requireArtifact(next.oracle, ["oracle"]);
|
|
753
|
+
for (const [requested, expected] of [
|
|
754
|
+
[next.specification, next.inputs.specificationDigest],
|
|
755
|
+
[next.environment, next.inputs.environmentDigest],
|
|
756
|
+
[next.oracle, next.inputs.oracleDigest]
|
|
757
|
+
]) {
|
|
758
|
+
if (accepted.find((entry) => entry.handle === requested)?.contentDigest !== expected)
|
|
759
|
+
throw new Error("frozen artifact digest does not match scientific inputs");
|
|
760
|
+
}
|
|
761
|
+
requireArtifact(next.controls, ["valid_controls", "wrong_controls"], true);
|
|
762
|
+
const kinds = new Set(accepted.filter((entry) => next.controls.includes(entry.handle)).map((entry) => entry.kind));
|
|
763
|
+
if (!kinds.has("valid_controls") || !kinds.has("wrong_controls"))
|
|
764
|
+
throw new Error("freeze requires valid and wrong controls");
|
|
765
|
+
requireArtifact(next.tournament, ["tournament"], true);
|
|
766
|
+
}
|
|
767
|
+
if (next.state === "admitted") {
|
|
768
|
+
if (previous.state !== "frozen" ||
|
|
769
|
+
agenticDigestV1(previous.inputs) !== agenticDigestV1(next.inputs))
|
|
770
|
+
throw new Error("admission must preserve frozen scientific inputs");
|
|
771
|
+
for (const field of [
|
|
772
|
+
"environment",
|
|
773
|
+
"referenceQualification",
|
|
774
|
+
"specification",
|
|
775
|
+
"oracle",
|
|
776
|
+
"controls",
|
|
777
|
+
"tournament",
|
|
778
|
+
"frozenAt"
|
|
779
|
+
]) {
|
|
780
|
+
if (agenticDigestV1(previous[field]) !== agenticDigestV1(next[field]))
|
|
781
|
+
throw new Error(`frozen artifact binding changed: ${field}`);
|
|
782
|
+
}
|
|
783
|
+
requireArtifact(next.challenge, ["held_out_challenge"], true, true);
|
|
784
|
+
requireArtifact(next.admission, ["admission"], true);
|
|
785
|
+
}
|
|
786
|
+
};
|