import type { ProviderMoniker } from '@xyo-network/xl1-protocol/protocol-model';
import type { ConnectionConfig } from '../config/connections/Connection.js';
import type { ProviderDescriptor } from './Provider.js';
export interface ResolutionPlan {
    /** Capability moniker -> winning descriptor id (for snapshot diffing). */
    readonly bindings: Readonly<Record<ProviderMoniker, string>>;
    /** Descriptors that lost; included for diagnostics. */
    readonly rejected: readonly RejectedDescriptor[];
    /** Descriptors that should be instantiated, in topological order. */
    readonly selected: readonly ProviderDescriptor[];
}
export interface RejectedDescriptor {
    readonly descriptor: ProviderDescriptor;
    readonly reason: string;
}
export declare class MissingCapabilityError extends Error {
    readonly moniker: ProviderMoniker;
    readonly reasons: readonly string[];
    constructor(moniker: ProviderMoniker, reasons: readonly string[]);
}
export declare class AmbiguousProviderError extends Error {
    readonly candidates: readonly string[];
    readonly moniker: ProviderMoniker;
    constructor(moniker: ProviderMoniker, candidates: readonly ProviderDescriptor[]);
}
export declare class UnboundProviderError extends Error {
    readonly moniker: ProviderMoniker;
    constructor(moniker: ProviderMoniker);
}
export declare class UnknownConnectionError extends Error {
    readonly connectionName: string;
    readonly moniker: ProviderMoniker;
    constructor(moniker: ProviderMoniker, connectionName: string);
}
interface ProviderBindingLike {
    connection?: string;
}
export interface ResolveProvidersOptions {
    readonly connections?: Readonly<Record<string, ConnectionConfig>>;
    readonly providerBindings?: Readonly<Partial<Record<ProviderMoniker, ProviderBindingLike>>>;
}
/**
 * Plans which providers to register for a given set of needs.
 *
 * 1. Fixpoint-expand monikers from selected descriptor `dependencies`.
 * 2. Require `providerBindings[moniker].connection` for every connection-consuming
 *    moniker. A moniker satisfied by a single wildcard candidate consumes no
 *    connection of its own (it delegates storage to its dependencies) and binds
 *    directly, with no binding required.
 * 3. Filter candidates by bound connection type.
 * 4. Throw when zero or multiple candidates remain.
 * 5. Toposort selected descriptors using `dependencies`.
 */
export declare function resolveProviders(needs: ReadonlySet<ProviderMoniker>, candidates: readonly ProviderDescriptor[], options?: ResolveProvidersOptions): ResolutionPlan;
export {};
//# sourceMappingURL=resolveProviders.d.ts.map