/** * Dependency-free autorouting vocabulary and settings validators. * * This module deliberately does not import Settings, task code, or model * profiles. It is the shared contract used by settings and (later) routing * policy code. */ export declare const AUTOROUTING_TIERS: readonly ["fast", "balanced", "strong"]; export type AutoroutingTier = (typeof AUTOROUTING_TIERS)[number]; export declare const DEFAULT_AUTOROUTING_TIER: AutoroutingTier; /** * The single wording for "autorouting is switched on but cannot route". * * One constant so every delivery surface (interactive, print, and the SDK/ACP * host) reports the identical sentence and cannot drift apart. Bounded and free * of interpolation so it is always safe to render. */ export declare const AUTOROUTING_INACTIVE_WARNING = "Autorouting is enabled but has no usable tier chains; Task items fall back to manual model resolution. Run /routing to inspect, or /model \u2192 smart routing to generate tiers."; /** The normalized tier map consumed by routing policy. */ export type TierMap = Partial>; /** The permissive input shape accepted by the settings surface. */ export type AutoroutingTierMapInput = Partial>; export type AutoroutingSetup = { schema: 1; providers: string[]; models?: string[]; }; /** Fingerprints describing the generated autorouting declaration and materialized tiers. */ export type AutoroutingProvenance = { schema: 1; source: { catalogFingerprint: string; mapFingerprint: string; generatorVersion: number; }; declarationFingerprint: string; tiersFingerprint: string; }; /** Hard upper bound shared with the routing-evidence invariant in task/types.ts. */ export declare const AUTOROUTING_SELECTOR_MAX_LENGTH = 256; /** The exact selector grammar published by the generated config schema. */ export declare const AUTOROUTING_SELECTOR_PATTERN = "^[^/\\s*?\\[\\x00-\\x1F\\x7F-\\x9F\\u2028\\u2029]+\\/[^\\s*?\\[\\x00-\\x1F\\x7F-\\x9F\\u2028\\u2029]+(?::(?:minimal|low|medium|high|xhigh))?$"; export declare const AUTOROUTING_SELECTOR_DESCRIPTION = "provider/modelId with an optional valid thinking suffix (:minimal|low|medium|high|xhigh), no globs, no bare model ids, no pi/ role aliases."; export type AutoroutingReasonCode = "tier_unmatched" | "tier_missing_in_map" | "config_invalid" | "map_absent" | "selector_not_provider_qualified" | "auth_substituted" | "assistant_model_mismatch" | "provider_disabled" | "snapshot_missing" | "credential_unavailable" | "preflight_spawn_failed" | "preflight_exhausted"; export type AutoroutingLocalIssue = { path: string; code: AutoroutingReasonCode; /** Alias retained for callers that describe diagnostics as reasons. */ reason: AutoroutingReasonCode; detail: string; }; export type AutoroutingEffectiveIssue = { code: Extract; /** Alias retained for callers that describe diagnostics as reasons. */ reason: Extract; detail: string; }; export type AutoroutingEffective = { active: true; map: TierMap; } | { active: false; issue?: AutoroutingEffectiveIssue; }; /** * Validate one provider-qualified selector. A selector has one provider * segment, a non-empty model remainder, and may carry one supported thinking * suffix. Model ids may themselves contain slashes; the provider is always * the segment before the first slash. */ export declare function isValidAutoroutingSelector(value: unknown): value is string; export declare function normalizeTierMap(value: unknown): TierMap; /** True when at least one known tier contains one grammatically valid selector. */ export declare function isMeaningfulTierMap(value: unknown): value is TierMap; /** Validate the typed auto-setup declaration without consulting the model catalog. */ export declare function validateAutoroutingSetup(value: unknown): AutoroutingLocalIssue[]; /** Validate generated-tier provenance and its source identity. */ export declare function validateAutoroutingProvenance(value: unknown): AutoroutingLocalIssue[]; /** Validate only local types, keys, and selector grammar for one source layer. */ export declare function validateAutoroutingLocal(fragment: unknown): AutoroutingLocalIssue[]; export type AutoroutingProvenanceState = { staleMap: boolean; staleCatalog: boolean; handEdited: boolean; }; /** Compare recorded provenance with the current catalog/map/tier materialization. */ export declare function evaluateAutoroutingProvenanceState(provenance: AutoroutingProvenance | undefined, current: { catalogFingerprint: string; mapFingerprint: string; tiers: unknown; }): AutoroutingProvenanceState; /** Compare a recorded tier fingerprint with the current raw tier map. */ export declare function matchesRecordedTiersFingerprint(provenance: AutoroutingProvenance | undefined, tiers: unknown): boolean; /** Advisory comparison between a recorded declaration and the current provider priority. */ export type AutoroutingProviderOrderHint = { /** The declaration lists the same providers in a different relative order. */ reordered: boolean; /** Declared providers that the current catalog no longer offers, in declaration order. */ missing: string[]; }; /** * Compare a recorded `setup.providers` declaration against the current provider * priority, for an advisory panel hint only. * * Pure string comparison over two arrays, normalized exactly the way provider * selection normalizes ids (trim + lowercase). It deliberately never reaches * provenance, effective state, routing, preflight, or evidence: a changed priority * is a new suggestion, not proof that persisted tiers went stale. */ export declare function autoroutingProviderOrderHint(setupProviders: readonly string[], currentOrder: readonly string[]): AutoroutingProviderOrderHint; export type AutoroutingSettingsBatchPatch = { path: "task.autorouting.tiers"; op: "set"; value: TierMap; } | { path: "task.autorouting.setup"; op: "set"; value: AutoroutingSetup; } | { path: "task.autorouting.provenance"; op: "set"; value: AutoroutingProvenance; } | { path: "task.autorouting.tiers" | "task.autorouting.setup" | "task.autorouting.provenance"; op: "unset"; }; /** Build the one atomic settings batch used by autorouting Apply/Refresh or Clear. */ export declare function buildAutoroutingSettingsBatch(input: { tiers: TierMap; setup: AutoroutingSetup; provenance: AutoroutingProvenance; } | { clear: true; }): readonly AutoroutingSettingsBatchPatch[]; /** Convenience aliases for controller intents that all use one atomic batch. */ export declare const buildAutoroutingApplyPatches: typeof buildAutoroutingSettingsBatch; export declare const buildAutoroutingRefreshPatches: typeof buildAutoroutingSettingsBatch; export declare const buildAutoroutingClearPatches: () => readonly AutoroutingSettingsBatchPatch[]; /** Build the separate single-key enabled toggle mutation. */ export declare function buildAutoroutingEnabledPatch(enabled: boolean): { path: "task.autorouting.enabled"; op: "set"; value: boolean; }; /** Validate effective enablement and map cross-field semantics. */ export declare function validateAutoroutingEffective(fragment: unknown): AutoroutingEffective;