import { type RoutingBasisV3 } from "@velum-labs/routekit-eval-contracts";
import { type EvalAuthoringTransport, type RepositoryBenchmarkCaseV1, type RepositoryFoundryArtifactEmit, type RepositoryFoundryAuthoringArtifactV1, RepositoryFoundryError, type RepositoryFoundryGenerationPlanV1, type RepositoryFoundryModelPlanV1, type RepositoryFoundryProgressEventV1, type RepositoryFoundrySmokeResultV1, type RepositoryRoutingEligibilityPolicyV1, type RepositoryRoutingLabelingExecutionResultV1, type RepositoryRoutingLabelingPlanV1, type RepositoryRoutingModelPlanV1 } from "@velum-labs/routekit-eval-setup";
import { type RouteKitPlatform } from "@velum-labs/routekit-runtime/effect";
import { Effect, FileSystem, Layer, Path } from "effect";
export type EvalFoundryPlanInput = {
readonly repositoryRoot: string;
readonly requestedRef?: string;
readonly referenceCommit?: string;
readonly caseId: string;
readonly requestedDimension?: string;
readonly validControlRegenerationSequence?: number;
readonly validControlReviewVersion?: 1 | 2;
readonly dependencyContextVersion?: 1 | 2;
readonly oracleCoverageWitnessVersion?: 1 | 2;
readonly oracleCoverageWitnessRepairVersion?: 1;
readonly oracleRepairFeedbackVersion?: 1;
readonly reviewInputVersion?: 2;
readonly specificationContractFactsVersion?: 1;
readonly modelPlan: RepositoryFoundryModelPlanV1;
readonly maximumHistoryEpisodes?: number;
readonly maximumSeedCandidates?: number;
readonly excludedReferenceCommits?: readonly string[];
readonly qualificationBatches?: number;
readonly qualificationRepetitionsPerBatch?: number;
readonly oracleRepetitions?: number;
readonly oracleConcurrency?: number;
readonly maximumHillClimbAttempts?: number;
readonly maximumSpecificationRevisions?: number;
readonly maximumOracleCoverageRevisions?: number;
readonly maximumFixtureRepairAttempts?: number;
readonly wallTimeMs?: number;
};
export type EvalFoundryExecutionSummary = {
readonly operation: "repository-foundry-generate";
readonly outputPath: string;
readonly plan: RepositoryFoundryGenerationPlanV1;
readonly qualification: {
readonly seedId: string;
readonly stable: boolean;
readonly batches: number;
readonly repetitionsPerBatch: number;
};
readonly task: {
readonly id: string;
readonly requestText: string;
readonly checkoutCommit: string;
};
readonly generation: {
readonly status: string;
readonly modelCalls: number;
readonly modelRoles: readonly {
readonly role: string;
readonly model: string;
readonly reasoningEffort: string;
readonly callId?: string;
}[];
readonly trajectoryPolicy: {
readonly purpose: "routing-signal";
readonly thresholds: {
readonly maximumToolCalls: number;
readonly maximumFailedToolCalls: number;
readonly maximumRepeatedFailedActions: number;
};
readonly requirements: {
readonly passingValidationAfterLastMutation: boolean;
readonly noProtectedPathMutations: boolean;
};
readonly independentReview: "approve" | "reject";
readonly revisionAttempts: readonly {
readonly sequence: number;
readonly decision: "accepted" | "rejected";
readonly beforeDetail: string;
readonly candidateDetail: string;
}[];
};
readonly fixtureIds: readonly string[];
readonly validSolutionFamilies: readonly string[];
readonly adversaryFamilies: readonly string[];
readonly heldOutAdversaryFamilies: readonly string[];
readonly weakFalseAccepts: readonly string[];
readonly initialStrongFalseAccepts: readonly string[];
readonly initialStrongFalseRejects: readonly string[];
readonly finalFalseAccepts: readonly string[];
readonly finalFalseRejects: readonly string[];
readonly unstableSolutions: readonly string[];
readonly heldOutFalseAccepts: readonly string[];
readonly heldOutFalseRejects: readonly string[];
readonly heldOutUnstableSolutions: readonly string[];
readonly hillClimbAttempts: readonly {
readonly sequence: number;
readonly targetedFalseAcceptIds: readonly string[];
readonly targetedFalseRejectIds: readonly string[];
readonly decision: "accepted" | "rejected";
readonly rejectionReasons: readonly string[];
readonly candidateFalseAccepts: readonly string[] | null;
readonly candidateFalseRejects: readonly string[] | null;
readonly referencePreflight?: "passed" | "rejected";
readonly beforeFalseAccepts: readonly string[];
readonly beforeFalseRejects: readonly string[];
readonly afterFalseAccepts: readonly string[];
readonly afterFalseRejects: readonly string[];
}[];
};
};
export type EvalFoundryRoutingInputs = {
readonly foundryPlanDigest: string;
readonly benchmarkCase: RepositoryBenchmarkCaseV1;
readonly basis: RoutingBasisV3;
};
export type EvalFoundryRoutingSummary = {
readonly operation: "repository-foundry-route";
readonly outputPath: string;
readonly plan: RepositoryRoutingLabelingPlanV1;
readonly assignment: RepositoryRoutingLabelingExecutionResultV1["routing"]["assignments"][number];
readonly reviews: readonly {
readonly role: string;
readonly model: string;
readonly reasoningEffort: string;
readonly callId?: string;
}[];
readonly routingReady: boolean;
readonly coverageGaps: readonly string[];
};
export type EvalFoundrySmokeSummary = RepositoryFoundrySmokeResultV1 & {
readonly outputPath: string;
};
export declare const FOUNDRY_PLAN_DIGEST_PATTERN: RegExp;
declare const EvalFoundryPreparePinError_base: new = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
readonly _tag: "EvalFoundryPreparePinError";
} & Readonly;
export declare class EvalFoundryPreparePinError extends EvalFoundryPreparePinError_base<{
readonly caseId: string;
readonly pinnedDigest: string;
readonly attemptedDigest?: string;
readonly detail: string;
}> {
get message(): string;
}
/**
* Persist an immutable prepare-plan artifact and park its digest for the caseId.
* Overnight execute must reuse this digest via `--plan-digest` instead of reminting.
*/
export declare function evalFoundryPersistPreparePlan(input: {
readonly plan: RepositoryFoundryGenerationPlanV1;
}): Effect.Effect<{
readonly planPath: string;
readonly pinPath: string;
}, unknown, FileSystem.FileSystem | Path.Path>;
export declare function evalFoundryReadPreparePin(input: {
readonly repositoryRoot: string;
readonly caseId: string;
}): Effect.Effect;
/**
* Fail closed when a prepare pin is parked for this caseId: bare execute must not remint.
*/
export declare function evalFoundryRefuseBareRemintWhenPreparePinned(input: {
readonly repositoryRoot: string;
readonly caseId: string;
}): Effect.Effect;
/**
* Load a previously persisted prepare plan by digest and refuse caseId / digest mismatch.
*/
export declare function evalFoundryLoadPlanByDigest(input: {
readonly repositoryRoot: string;
readonly planDigest: string;
readonly caseId: string;
readonly requestedDimension?: string;
readonly oracleConcurrency?: number;
readonly excludedReferenceCommits?: readonly string[];
}): Effect.Effect;
export declare function evalFoundryReadRoutingInputs(input: {
readonly repositoryRoot: string;
readonly foundryResultPath: string;
readonly basisPath: string;
}): Effect.Effect;
export declare const evalFoundryPlanCommand: (input: EvalFoundryPlanInput) => Effect.Effect<{
readonly version: 1;
readonly caseId: string;
readonly repository: {
readonly root: string;
readonly requestedRef: string;
readonly commit: string;
readonly tree: string;
};
readonly referenceCommit: string;
readonly seedId: string;
readonly modelPlan: {
readonly version: 1;
readonly assignments: readonly {
readonly role: "oracle-critic" | "repository-analyst" | "specification-writer" | "specification-critic-a" | "specification-critic-b" | "trajectory-designer" | "trajectory-critic" | "oracle-designer" | "valid-solution-generator-a" | "valid-solution-generator-b" | "adversary" | "solution-critic-a" | "solution-critic-b" | "held-out-adversary" | "held-out-solution-critic-a" | "held-out-solution-critic-b" | "quality-reviewer" | "hill-climb-planner";
readonly model: string;
readonly reasoningEffort: "high" | "medium" | "low" | "xhigh" | "max" | "ultra";
}[];
};
readonly budget: {
readonly wallTimeMs: number;
readonly requiredTotalInputTokens: number;
readonly requiredTotalOutputTokens: number;
readonly plannedModelCalls: number;
readonly maximumTransientRetries: number;
readonly maximumHillClimbAttempts: number;
readonly perCallOutputTokens: number;
readonly maximumSpecificationRevisions?: number | undefined;
readonly maximumOracleCoverageRevisions?: number | undefined;
readonly maximumFixtureRepairAttempts?: number | undefined;
};
readonly qualification: {
readonly batches: number;
readonly repetitionsPerBatch: number;
readonly oracleRepetitions: number;
readonly oracleConcurrency?: number | undefined;
};
readonly planDigest: string;
readonly initialCommit: string;
readonly reviewInputVersion?: 2 | undefined;
readonly requestedDimension?: string | undefined;
readonly excludedReferenceCommits?: readonly string[] | undefined;
readonly historyProvenance?: {
readonly method: "integrated-retained-history-v1";
readonly requestedRef: string;
readonly requestedTipCommit: string;
readonly requestedTipTree: string;
readonly integrationCommit: string;
readonly pathBlobs: readonly {
readonly path: string;
readonly blob: string;
}[];
} | undefined;
readonly validControlRegenerationSequence?: number | undefined;
readonly validControlReviewVersion?: 1 | 2 | undefined;
readonly dependencyContextVersion?: 1 | 2 | undefined;
readonly oracleCoverageWitnessVersion?: 1 | 2 | undefined;
readonly oracleCoverageWitnessRepairVersion?: 1 | undefined;
readonly oracleRepairFeedbackVersion?: 1 | undefined;
readonly specificationContractFactsVersion?: 1 | undefined;
}, import("effect/PlatformError").PlatformError | RepositoryFoundryError, FileSystem.FileSystem | Path.Path>;
export declare function evalFoundrySmokeCommand(input: {
readonly repositoryRoot: string;
readonly requestedRef?: string;
readonly referenceCommit?: string;
readonly maximumHistoryEpisodes?: number;
readonly qualificationBatches?: number;
readonly qualificationRepetitionsPerBatch?: number;
readonly outputPath: string;
}): Effect.Effect;
export declare const evalFoundryRoutingPlanCommand: (input: {
readonly foundryPlanDigest: string;
readonly benchmarkCase: EvalFoundryRoutingInputs["benchmarkCase"];
readonly basis: RoutingBasisV3;
readonly modelPlan: RepositoryRoutingModelPlanV1;
readonly policy: RepositoryRoutingEligibilityPolicyV1;
}) => Effect.Effect<{
readonly version: 1;
readonly planDigest: string;
readonly foundryPlanDigest: string;
readonly caseId: string;
readonly behavioralFingerprint: string;
readonly basis: {
readonly version: 3;
readonly basisDigest: string;
readonly dimensions: readonly {
readonly id: string;
readonly name: string;
readonly description: string;
readonly inclusions: readonly string[];
readonly exclusions: readonly string[];
readonly confusableDimensionIds: readonly string[];
readonly boundaryRules: readonly string[];
readonly repositoryFacets: {
readonly componentIds: readonly string[];
readonly pathAnchors: readonly string[];
readonly symbolAnchors: readonly string[];
};
readonly positiveExamples: readonly string[];
readonly negativeExamples: readonly string[];
readonly codeSummaries: readonly string[];
readonly representativeSnippets: readonly string[];
}[];
readonly repositoryDigest: string;
readonly basisId: string;
readonly facetSnapshot: {
readonly repositoryId: string;
readonly repositoryDigest: string;
readonly name: string;
readonly purpose: string;
readonly languages: readonly string[];
readonly frameworks: readonly string[];
readonly components: readonly {
readonly id: string;
readonly name: string;
readonly purpose: string;
readonly paths: readonly string[];
}[];
};
readonly provenance: {
readonly recipeId: string;
readonly generatorVersion: string;
readonly sourceDigests: readonly string[];
readonly authorModel?: string | undefined;
readonly constructionTaskDigest?: string | undefined;
readonly origin?: {
readonly kind: "generated" | "incumbent-enriched" | "repair";
readonly sourceBasisId?: string | undefined;
readonly sourceBasisVersion?: number | undefined;
} | undefined;
};
readonly validation?: {
readonly validationDatasetDigest: string;
readonly caseCount: number;
readonly activeMae: number;
readonly activeF1: number;
readonly topDimensionAgreement: number;
readonly unknownMae: number;
readonly referenceUnknownRate: number;
readonly selectionScore: number;
} | undefined;
};
readonly modelPlan: {
readonly version: 1;
readonly assignments: readonly {
readonly role: "dimension-labeler" | "dimension-critic-terra" | "dimension-critic-luna";
readonly model: string;
readonly reasoningEffort: "high" | "medium" | "low" | "xhigh" | "max" | "ultra";
}[];
};
readonly policy: {
readonly activeDimensionThreshold: number;
readonly maximumUnknownProbability: number;
readonly minimumDominanceMargin: number;
readonly minimumCasesPerDimension: number;
};
readonly budget: {
readonly semanticModelCalls: number;
readonly plannedModelCalls: number;
readonly maximumTransientRetries: number;
readonly requiredTotalInputTokens: number;
readonly requiredTotalOutputTokens: number;
readonly perCallOutputTokens: number;
readonly wallTimeMs: number;
};
}, RepositoryFoundryError, never>;
type EvalFoundryVisibleArtifactSample = {
readonly requestText?: string;
readonly constraints?: readonly string[];
readonly fixtureIntents?: readonly {
readonly id: string;
readonly kind: string;
readonly description: string;
}[];
};
/** Explicit projection: hidden expectations, overlays, solutions and raw responses stay private. */
export declare function evalFoundryVisibleArtifactSample(artifact: RepositoryFoundryAuthoringArtifactV1): EvalFoundryVisibleArtifactSample | undefined;
/** Each preparation keeps private replay diagnostics even when no immutable plan is produced. */
export declare const makeEvalFoundryPrepareArtifactWriter: (input: {
readonly repositoryRoot: string;
readonly caseId: string;
}) => Effect.Effect;
/** Diagnostic artifacts only: the writer does not enable stage resume or confer admission. */
export declare const makeEvalFoundryArtifactWriter: (input: {
readonly repositoryRoot: string;
readonly planDigest: string;
readonly caseId: string;
}) => Effect.Effect;
export declare function evalFoundryExecuteCommand(input: {
readonly plan: RepositoryFoundryGenerationPlanV1;
readonly transport: Layer.Layer;
readonly outputPath?: string;
readonly idleStallMs?: number;
readonly onProgress?: (event: RepositoryFoundryProgressEventV1) => void;
}): Effect.Effect;
export declare function evalFoundryRoutingExecuteCommand(input: {
readonly repositoryRoot: string;
readonly plan: RepositoryRoutingLabelingPlanV1;
readonly benchmarkCase: EvalFoundryRoutingInputs["benchmarkCase"];
readonly transport: Layer.Layer;
readonly outputPath?: string;
}): Effect.Effect;
export {};