export interface SettingsView { persisted: { godotPath: string; allowedProjectPaths: string[]; }; effective: { godotPath: string; allowedProjectPaths: string[]; unrestricted: boolean; godotAllowedList: string; }; /** godot-paths.json 已登记候选(CLI install 写入;只读点选,本批不做增删)。 */ candidates: string[]; readOnly: boolean; } export interface SettingsSavePatch { /** Godot 可执行路径;'' = 清除(恢复启动 env 快照);undefined = 不改。 */ godotPath?: string; /** 项目白名单根数组;[] = 清除;undefined = 不改。 */ allowedProjectPaths?: string[]; } export type SettingsSaveResult = { ok: true; persisted: SettingsView['persisted']; } | { ok: false; error: string; stage?: string; }; export type SettingsVerifyResult = { ok: true; version: string; } | { ok: false; stage: string; detail: string; }; export interface SettingsApi { get(): Promise; verify(path: string): Promise; save(patch: SettingsSavePatch): Promise; } export interface UserSettingsServiceOpts { /** settings.json 目录注入(测试隔离);缺省 ~/.godot-mcp/ */ settingsDir?: string; /** READ_ONLY 判定注入(接线层传,与 server.ts isReadOnly 同源);缺省非只读。 */ isReadOnly?: () => boolean; } export declare class UserSettingsService implements SettingsApi { private readonly settingsDir; private readonly readOnlyFn; constructor(opts?: UserSettingsServiceOpts); get(): Promise; /** 验证候选二进制:validateGodotBinaryDetailed 拿结构化 stage,ok 后 detectGodotVersion * 拿版本串(两次 spawn 仅发生在用户显式点「验证」,非热路径)。 */ verify(path: string): Promise; save(patch: SettingsSavePatch): Promise; /** 机器级审计(成功与失败都留痕;best-effort 不阻断响应)。 * project_path 用 settings.json 路径(机器级归属锚点;仅路径字符串,无敏感值)。 */ private auditSave; }