/** * ADR-322B proposer adapter. * * Proposers are untrusted candidate generators. This adapter normalizes local * and Darwin output, enforces hard policy/resource admissibility before Pareto * ranking, and makes auto-mode substitution evaluation-only by default. */ import { type ProposerName } from './flywheel-receipt.js'; export type ProposerMode = 'auto' | ProposerName; export interface SafetyEnvelope { ref: string; allowedPolicyKeys: string[]; numericBounds?: Record; maxP95LatencyMicros: number; maxCostMicrosPerTask: number; maxTokensPerTask: number; maxFailureRate: number; maxEvaluationCostMicros: number; } export interface CandidateResources { p95LatencyMicros: number; costMicrosPerTask: number; tokensPerTask: number; failureRate: number; evaluationCostMicros: number; } export interface ProposedCandidate { policy: Record; resources: CandidateResources; score?: number; mutation?: string; parentIds?: string[]; } export interface NormalizedCandidate extends ProposedCandidate { candidateId: string; admissible: boolean; rejectionReasons: string[]; } export interface CandidateArchive { archiveVersion: 'ruflo.candidate-archive/v1'; archiveId: string; requestedProposer: ProposerMode; effectiveProposer: ProposerName; proposerSubstitution?: string; promotionAllowed: boolean; baselineRef: string; safetyEnvelopeRef: string; seed: number; candidates: NormalizedCandidate[]; admissibleCandidates: NormalizedCandidate[]; paretoCandidates: NormalizedCandidate[]; completed: boolean; } export interface DarwinRunInput { baselinePolicy: Record; seed: number; budget: { maxEvaluationCostMicros: number; maxConcurrency: number; maxWallTimeMs: number; }; } export type DarwinInvoker = (input: DarwinRunInput) => Promise<{ completed: boolean; candidates: ProposedCandidate[]; reason?: string; }>; export interface ProposeCandidatesInput { mode: ProposerMode; baselinePolicy: Record; safetyEnvelope: SafetyEnvelope; seed: number; localProposer: (baseline: Record, seed: number) => ProposedCandidate[] | Promise; darwinInvoker?: DarwinInvoker; allowSubstitutionPromotion?: boolean; maxConcurrency?: number; maxWallTimeMs?: number; maxCandidates?: number; } export declare class DarwinUnavailableError extends Error { constructor(message: string); } export declare function proposeFlywheelCandidates(input: ProposeCandidatesInput): Promise; //# sourceMappingURL=flywheel-proposer.d.ts.map