import type { FabricThinking } from "../thinking.js"; import { normalizeModelAliases, type FabricModelAliases } from "./model-aliases.js"; export { normalizeModelAliases }; export type { FabricModelAlias, FabricModelAliases } from "./model-aliases.js"; /** How a Pi `model` selector is matched. Omitted keeps alias, closest and fuzzy resolution. */ export type FabricModelMatch = "exact"; export declare const EXACT_MODEL_FORM_ERROR = "modelMatch \"exact\" requires model in provider/id form, as listed by agents.models({ runner: \"pi\" })."; export declare const EXACT_MODEL_RUNNER_ERROR = "modelMatch \"exact\" is supported only by the pi and pi-durable runners."; /** Minimal model view needed for resolution; satisfied by pi Model entries. */ export interface FabricModelCandidate { provider: string; id: string; name?: string; } export type FabricModelResolution = { kind: "resolved"; model: FabricModelCandidate; via?: string; } | { kind: "already-active"; model: FabricModelCandidate; } | { kind: "ambiguous"; query: string; candidates: FabricModelCandidate[]; } | { kind: "not-found"; query: string; tried?: string[]; }; /** Markers reported in `via` when an inexact selector is fuzzy-resolved. */ export declare const FUZZY_RESOLUTION_MARKERS: readonly ["closest", "recent", "latest"]; /** * Default thinking level configured for a selector that names an alias, or * undefined when the selector is not an alias or carries no level. */ export declare const aliasThinking: (aliases: FabricModelAliases | undefined, selector: string) => FabricThinking | undefined; export type FabricModelUsage = Record; /** * Resolve a model selector against aliases and the available (authenticated) * registry. Order: alias lookup first so a configured name always wins, then * exact provider/id, exact id, then fuzzy selection. A lone partial match is * returned directly; broader candidate pools are ranked by closeness, with * equal-closeness ties falling to the most recently used model (when usage * timestamps are supplied, e.g. from pi-model-sort) and then to the * highest-sorting key, mirroring pi's newest-alias convention. Only a pool * with no resemblance at all stays not-found; `ambiguous` is retained for * defensive completeness but the ranker always produces a deterministic pick. */ export declare const resolveFabricModel: (query: string, options: { aliases: FabricModelAliases; available: readonly FabricModelCandidate[]; current?: FabricModelCandidate; provider?: string; lastUsed?: FabricModelUsage; }) => FabricModelResolution; /** * Resolve a Pi participant selector strictly within the execution owner's * visible registry. Provider-qualified selectors prefer exact IDs, then the * closest visible ID/name on that same provider. Aliases retain their ordered * exact-target policy; bare selectors retain normal Fabric fuzzy resolution. */ export declare const resolveAvailablePiModel: (selector: string, options: { aliases: FabricModelAliases; available: readonly FabricModelCandidate[]; lastUsed?: FabricModelUsage; /** Why the visible set is empty, when reading the registry threw. */ registryError?: unknown; }) => FabricModelCandidate; /** * Resolve a Pi participant selector with no alias, closest-match or fuzzy step. * The selector must be a provider/id the visible registry lists. Matching keeps * the case-insensitive rule of every other exact lookup here (an identical * spelling is preferred), and the returned candidate carries the registry's own casing. Used when a request sets * `modelMatch: "exact"`, where a model that is not listed must be refused rather * than replaced by a different one. */ export declare const resolveExactAvailablePiModel: (selector: string, options: { available: readonly FabricModelCandidate[]; registryError?: unknown; }) => FabricModelCandidate; /** Resolve a Pi selector by the request's match mode; omitted keeps alias, closest and fuzzy resolution. */ export declare const resolvePiModelSelector: (selector: string, options: { aliases: FabricModelAliases; available: readonly FabricModelCandidate[]; lastUsed?: FabricModelUsage; registryError?: unknown; }, modelMatch?: FabricModelMatch) => FabricModelCandidate; /** * Structural checks for an exact-match request that need no model registry: * only Pi runners resolve against the Pi registry, and the model must be a * provider/id. Refusing a non-Pi runner is deliberate: its model string is * forwarded verbatim to a backend that may apply its own aliases, so forwarding * it could not honour "exactly this model". */ export declare const assertExactModelRequest: (request: { modelMatch?: unknown; runner: string; model?: unknown; }) => void; //# sourceMappingURL=model-resolution.d.ts.map