/** * Evidence-driven orchestration decision engine. * * Encapsulates the full decision flow: * task & runtime context → feature extraction → candidate generation → * hard policy filtering → evidence lookup → candidate scoring → * uncertainty assessment → orchestration decision → outcome capture. */ import { type HardPolicyInput } from "./candidates.js"; import { type TaskContext } from "./features.js"; import { type SelectionOptions } from "./scoring.js"; import type { CandidateEvidence, ExecutionTopology, OrchestrationCandidate, OrchestrationCandidateScore, OrchestrationConfidence, OrchestrationDecision } from "./types.js"; export interface RoutingPolicyContext { policyId: string; policyVersion: number; /** Deterministic baseline candidate preferences. */ preferences?: { candidateId: string; quality: number; }[]; /** Dominated candidate IDs the policy will not select. */ dominatedCandidateIds?: string[]; } /** Outcome capture for evaluation linkage. */ export interface DecisionOutcome { decisionId: string; success: boolean; correctnessRate?: number; safetyRate?: number; medianLatencyMs?: number; avgCostUsd?: number; toolFailureRate?: number; flakyRate?: number; } export interface EngineOptions { runId?: string; policyOverride?: RoutingPolicyContext; hardPolicy?: Partial; selection?: Partial; operatorOverride?: OrchestrationOperatorOverride; } export interface OrchestrationOperatorOverride { authorizedBy: string; candidateId?: string; reason?: string; } /** Context describing all configured candidate sources (canonical registries). */ export interface CandidateRegistryContext { providerProfiles: string[]; models: { provider: string; model: string; }[]; topologies: ExecutionTopology[]; skills: string[]; subagents: string[]; retrievalPolicies: string[]; budgetClasses: string[]; fallbackPolicies: string[]; } export interface DecideInput { task: string | TaskContext; registry?: Partial; hardPolicy?: Partial; selectionPolicy?: SelectionOptions["policy"]; operatorOverride?: OrchestrationOperatorOverride; evidence?: Record; policyContext?: RoutingPolicyContext; runId?: string; } export interface DecideResult { decision: OrchestrationDecision; selectedCandidate?: OrchestrationCandidate; evidenceById: Record; } /** * Execute the full decision flow for a task. * Returns the decision (durable) and the selected candidate (if any). */ export declare function decide(input: DecideInput): DecideResult; /** Assess decision confidence deterministically. */ export declare function assessConfidence(_scored: OrchestrationCandidateScore[], selected: OrchestrationCandidateScore | undefined, policy: SelectionOptions["policy"]): OrchestrationConfidence; export { buildCandidateId } from "./baseline.js"; export declare function replayDecision(decisionId: string): OrchestrationDecision | undefined; //# sourceMappingURL=engine.d.ts.map