import type { Connection, Providers } from "../../../SofyaTranscriber"; import { SessionPlan, SessionPlanErrorCode } from "./types"; /** * Direct mode: interprets and statically validates a public Connection into * one SessionPlan. Each variant has its own parser in `./parsers/`; add a * branch here when a variant migrates. Discovery mode goes through * `createSessionPlanResolver`. */ export declare const resolveDirectSessionPlan: (connection: Connection) => SessionPlan; /** Reasoner call of Discovery mode. The only collaborator that sees the Api-key. */ export type DiscoveryClient = (apiKey: string) => Promise; /** * An ordered provider-and-endpoint possibility from the reasoner. `valid` * means its configuration normalized into a plan; it says nothing about * whether its Primary channel will connect. `endpoint` is the redacted * protocol/host/path description only. */ export type SessionCandidate = { providerIdentity: Providers; endpoint?: string; } & ({ status: "valid"; plan: SessionPlan; } | { status: "rejected"; code: SessionPlanErrorCode; }); export type SessionResolution = { mode: "direct"; plan: SessionPlan; } | { mode: "discovery"; candidates: SessionCandidate[]; }; export interface SessionPlanResolver { resolve(connection: Connection): Promise; } /** * One `resolve(connection)` entry point: Direct mode returns one plan, * Discovery mode calls the injected client and returns ordered Session * candidates. The Api-key goes to the client call and nowhere else. */ export declare const createSessionPlanResolver: ({ discoveryClient, }: { discoveryClient: DiscoveryClient; }) => SessionPlanResolver; export interface CandidateRejectionSummary { providerIdentity: Providers; endpoint?: string; code: SessionPlanErrorCode | "CONSTRUCTION_FAILED"; } /** Every Session candidate was rejected. Carries sanitized summaries only. */ export declare class DiscoveryExhaustedError extends Error { readonly summaries: CandidateRejectionSummary[]; constructor(summaries: CandidateRejectionSummary[]); } /** * Picks the first candidate, in order, whose plan is valid and whose * service constructs. Not a connectivity check: failover after the Primary * channel starts opening is out of scope. Raw causes are dropped. */ export declare const selectSessionCandidate: (candidates: SessionCandidate[], construct: (plan: SessionPlan) => TService) => { candidate: SessionCandidate & { status: "valid"; }; service: TService; }; //# sourceMappingURL=SessionPlanResolver.d.ts.map