/** * Model resolver for rolebox. * * Replaces placeholder/bare-name model strings with canonical * `provider/model_id` values using a two-source fallback chain: * 1. Known models (from opencode.jsonc) — passthrough if already canonical. * 2. User-configurable aliases (from role_config.yaml) — single-hop mapping. * * Unrecognized models pass through unchanged with a log message. * Callers must initialize via `initModelResolver()` before resolving. */ import type { Logger } from "tslog"; import type { ILogObj } from "tslog"; /** @internal Test seam — swap the module-level logger for a mock. */ export declare function __setLoggerForTest(mockLog: Logger): void; /** * @internal Test seam — reset all module-level state to defaults. * * Clears `initialized`, `knownModelIds`, `modelAliases`, the per-generation * advisory state (`reportedModels`, `uninitializedWarned`), and restores * the default logger. Useful for test isolation between scenario groups. */ export declare function __resetForTest(): void; /** * Initialize (or re-initialize) the model resolver from the filesystem. * * Every call reloads **both** caches from disk — there is no idempotency * check and no lazy initialization. This guarantees that edits to * `opencode.jsonc` or `role_config.yaml` take effect on the next * `initModelResolver()` call (which happens at every bootstrap and * hot-reload cycle). * * Advisory logs are scoped to a cache generation: this call clears * `reportedModels` and `uninitializedWarned`, so each distinct unresolvable * model is reported once per generation and the not-initialized warning is * re-armed. * * @param configDir — path to the opencode config directory (contains * `opencode.jsonc` and `role_config.yaml`). When omitted, falls back * to the XDG-aware `getOpencodeConfigDir()`. */ export declare function initModelResolver(configDir?: string): void; /** * Resolve a model string through the fallback chain: * * 1. Not initialized → warn once per generation + passthrough original. * 2. Empty / whitespace-only → passthrough original. * 3. Found in `knownModelIds` (from opencode.jsonc) → passthrough original * (already a canonical `provider/model_id`). * 4. Found in `modelAliases` → return the **single-hop** mapped value. * 5. Neither → `log.info` a hint + passthrough original. The hint is * emitted at most once per distinct model per generation. * * Advisory state is per cache generation: `initModelResolver()` and * `__resetForTest()` clear it, so a fresh generation re-reports. * * @param model — the model string to resolve (from a role's `model:` field). * @returns The resolved canonical model string, or the original string if * no resolution was possible. */ export declare function resolveModel(model: string): string; //# sourceMappingURL=model-resolver.d.ts.map