import { mkdir, readFile, writeFile } from 'node:fs/promises';
import { dirname, join } from 'node:path';
const EMPTY_CONFIG = {};
export class RemoteControlConfigStore {
    filePath;
    constructor(agentDir) {
        this.filePath = join(agentDir, 'remote-control', 'config.json');
    }
    async load() {
        try {
            const raw = await readFile(this.filePath, 'utf-8');
            return JSON.parse(raw);
        }
        catch {
            return { ...EMPTY_CONFIG };
        }
    }
    async save(config) {
        await mkdir(dirname(this.filePath), { recursive: true });
        await writeFile(this.filePath, JSON.stringify(config, null, 2) + '\n', 'utf-8');
    }
}
//# sourceMappingURL=config-store.js.map