import { ExecutionMode, SessionProvider, WandConfig } from "./types.js"; import type { WandStorage } from "./storage.js"; /** * 通过 UI 设置面板可改的"用户偏好"字段。这些字段从 SQLite app_config 表读取, * 不再写入 ~/.wand/config.json。JSON 只保留服务部署/启动期参数(host/port/shell 等)。 * * 升级路径:老 JSON 里仍存有这些字段时,首次启动会被搬到 DB(见 migrateLegacyPreferencesToDb), * 然后下一次 saveConfig 写回 JSON 时它们会被剥离(见 stripPreferenceFields)。 */ export declare const PREFERENCE_KEYS: readonly ["defaultProvider", "defaultSessionKind", "defaultTaskWorktree", "defaultMode", "defaultCwd", "defaultModel", "defaultCodexModel", "defaultOpenCodeModel", "defaultGrokModel", "defaultQoderModel", "defaultPiModel", "commitCli", "commitModel", "commitAiSource", "systemAi", "defaultThinkingEffort", "structuredRunner", "language", "cardDefaults", "inheritEnv"]; export type PreferenceKey = (typeof PREFERENCE_KEYS)[number]; export declare function isPreferenceKey(key: string): key is PreferenceKey; /** * The user's login shell from passwd, then $SHELL, then a platform default. * Launchd / systemd usually omit $SHELL, so falling back to /bin/bash made PTY * sessions look like a generic sh even when the account default is zsh. */ export declare function resolveDefaultShell(): string; export declare const defaultConfig: () => WandConfig; export declare function resolveConfigPath(inputPath?: string): string; export declare function resolveConfigDir(configPath: string): string; export declare function hasConfigFile(configPath: string): boolean; /** saveConfig 写出时去掉偏好字段——这些已经移到 SQLite。 */ export declare function saveConfig(configPath: string, config: WandConfig): Promise; /** * 启动期合并 JSON + DB 偏好。语义: * 1. 读 raw JSON * 2. 把 JSON 中残留的偏好字段搬到 DB(只在 DB 没值时迁移) * 3. mergeWithDefaults(raw) 得到 baseline * 4. applyStoragePreferences 用 DB 覆盖 baseline 的偏好字段 * 5. 如果 JSON 里仍含偏好字段(来自 1),用 saveConfig 重写一次 JSON(剥离后) */ export declare function loadConfigWithStorage(configPath: string, storage: WandStorage): Promise; /** * 用 DB 里的偏好覆盖 config 对象(in-place),返回同一个引用, * 方便各 manager 持有引用后继续工作。DB 里没有的字段不动,保留 JSON 默认值。 */ export declare function applyStoragePreferences(config: WandConfig, storage: WandStorage): WandConfig; /** Write a single preference value to DB and (in-place) update the live config object. */ export declare function writePreferenceToStorage(config: WandConfig, storage: WandStorage, key: PreferenceKey, value: unknown, options?: { deferCommitAiValidation?: boolean; }): void; /** * Kept as a compatibility seam for callers that validate preference batches. * Commit API profiles are discovered from the configured tools at request time, * so selecting API is valid even when no manual systemAi profile is stored. */ export declare function validateCommitAiConfig(_config: Pick): void; export declare function isExecutionMode(value: unknown): value is ExecutionMode; export declare function getProviderDefaultModels(config: Pick): { claude: string; codex: string; opencode: string; grok: string; qoder: string; pi: string; }; export declare function getDefaultModelForProvider(config: Pick, provider: SessionProvider | undefined): string;