import type { CliAdapter, CliId } from '../adapters/cli/types.js'; export type ModelSource = 'static' | 'live'; /** live 探测成功结果的缓存时长(毫秒)。导出供测试断言 TTL 行为。 */ export declare const MODEL_DETECT_TTL_MS: number; /** detectModels 的可选注入依赖(生产代码不传,测试用 fake 验证缓存/去重)。 */ export interface DetectModelsOptions { /** 时钟注入(TTL 判定用),默认 Date.now。 */ readonly now?: () => number; /** 适配器工厂注入,默认 createCliAdapterSync。 */ readonly adapterFactory?: (cliId: CliId) => CliAdapter; } /** * 按 CLI 选择键取静态模型候选(shell-free,同步,绝不抛异常)。 * key 来自 CLI_SELECT_OPTIONS(普通 cliId 或 'ttadk-x-claude' 这类网关键)。 * - ttadk 网关项:ttadkAcceptsModel(wrapperCli) 为真 → [...TTADK_MODEL_SUGGESTIONS],否则 [] * - 其它:createCliAdapterSync(cliId).modelChoices ?? [](构造失败/无候选 → []) * - 未知 key → [] */ export declare function staticModelChoices(key: string): readonly string[]; /** * On-demand live 探测(异步,fail-soft,绝不抛异常)。 * - 未知 key / ttadk 网关项 / 适配器无 detectModels → null * - 调用 adapter.detectModels(),任何异常 → null * - 同一 key 并发调用去重(in-flight Promise 复用) * - 成功结果按 key 缓存 10 分钟(TTL);失败不缓存 */ export declare function detectModels(key: string, opts?: DetectModelsOptions): Promise; /** * 独立缓存实例:测试用它隔离 TTL/in-flight 状态,避免污染模块级单例。 * (staticModelChoices 无状态,故不在此重复。) */ export interface ModelCatalog { detectModels(key: string, opts?: DetectModelsOptions): Promise; } export declare function createModelCatalog(): ModelCatalog; /** * 合并静态 + live:静态顺序在前,live 多出的追加在后,整体去重。 * live 为 null 或空数组 → source='static',否则 source='live'。 */ export declare function mergeModelChoices(staticChoices: readonly string[], live: readonly string[] | null): { models: string[]; source: ModelSource; }; /** 选择键是否已知(GET /api/cli-options/models 的 400 分支判定)。 */ export declare function isKnownSelectionKey(key: string): boolean; /** GET /api/cli-options/models 的 200 响应体:静态候选 + live 增量合并, * detectedAt 为合并完成时刻(epoch millis)。fail-soft 语义同上游三个函数。 */ export interface ModelChoicesResponse { readonly models: string[]; readonly source: ModelSource; readonly detectedAt: number; } export declare function buildModelChoicesResponse(key: string, opts?: DetectModelsOptions): Promise; //# sourceMappingURL=model-catalog.d.ts.map