import type { DeterministicError, Result } from "@astragenie/plugin-std"; import type { AgentRun, Candidate, CrewArtifact, EvalCase, JudgeCost, ScoreResult, Trial } from "./types/index.ts"; export type { AgentRun, Candidate, CrewArtifact, EvalCase, JudgeCost, ScoreResult, Trial }; export interface Scorer { score(run: AgentRun, expected: EvalCase): Promise; } export interface TrialStore { /** * Validates and persists `trial`. Never throws (Gate Zero, FEAT-001 SLICE-01): * schema validation failures surface as `err(new DeterministicError(...))`. */ put(trial: Trial): Promise>; recall(filter: { agent?: string; phase?: string; source?: "eval" | "captured" | "soak"; minScore?: number; failuresOnly?: boolean; since?: string; limit?: number; }): Promise; invalidate(filter: { tag?: string; trial_ids?: string[]; agent?: string; since?: string; }): Promise; } export interface RunnerAdapter { runCandidates(candidates: Candidate[], cases: EvalCase[], scorer: Scorer, opts: { meter: BudgetMeter; signal?: AbortSignal; }): Promise; } export interface CandidateGenerator { generate(currentChampionPath: string, failingTrials: Trial[], k: number, opts: { meter: BudgetMeter; }): Promise; } export interface PromotionPolicy { eligibleAgents: string[]; minPassDelta: number; minCaseScoreFloor: number; soakPercent: number; soakDays: number; minSoakTrials: number; maxSoakDays: number; soakEpsilon: number; allowCostRegression: boolean; allowLatencyRegression: boolean; } export interface BudgetMeter { reserve(estimateUsd: number, opts?: { ttlSeconds?: number; }): Promise<{ reservationId: string; ok: boolean; remainingUsd: number; }>; /** * Record actual cost against a reservation. * * FEAT-186 S2 (0.4.0) widened the signature to accept the canonical * `JudgeCost` shape in addition to a plain `number`. Both call patterns * are equivalent at the meter — only `cost.usd` is consumed for * accumulator math today. Adapters that surface richer cost fields * (`tokens`, `cache`) pass the full `JudgeCost` so future observability * extensions can read it without changing this signature. * * Number form retained for backward compatibility with 0.3.x callers. */ record(reservationId: string, cost: number | JudgeCost): Promise; release(reservationId: string): Promise; spentToday(): Promise; dailyCap(): number; } export interface LLMJudge { evaluate(opts: { candidateOutput: unknown; expected: EvalCase; rubric: string[]; signal?: AbortSignal; /** * Langfuse / observability provenance fields. * Adapters MUST forward this to their underlying call or telemetry; never drop it. */ context?: { fixture?: string; promptId?: string; version?: string; }; }): Promise<{ pass: boolean; score: number; rubricScores: Record; rationale: string; cost_usd: number; latency_ms: number; /** * Token counts from the underlying model call. * Load-bearing for evals/cli.ts cost-attribution telemetry. * Optional because some adapters (claude-p subprocess) cannot surface token counts. */ tokens?: { in: number; out: number; }; /** * Raw provider response — load-bearing for Langfuse debug emission. * Optional because some adapters discard the raw response. */ raw?: unknown; }>; describe(): { provider: string; model: string; }; } export interface LockManager { /** * Attempts to acquire the lock. Infra-error policy (DEC-002, refines * DEC-001): contention is an expected domain outcome and never throws — * - `ok(handle)` — lock acquired. * - `ok(null)` — lock unavailable (held by a live process); expected * contention, not an error. * * An unexpected filesystem failure while acquiring (not plain lock * contention) is genuinely exceptional infrastructure and `throw`s a * `TransientError` instead — caught at the caller's boundary, not returned * as a `Result` error. */ acquire(agent: string, op: "eval" | "optimize"): Promise Promise; } | null, never>>; isLocked(agent: string): Promise; } //# sourceMappingURL=interfaces.d.ts.map