"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getAssistantSettings = getAssistantSettings;
exports.updateAssistantSettings = updateAssistantSettings;
const node_fs_1 = require("node:fs");
const node_path_1 = require("node:path");
const paths_1 = require("../server/paths");
const fallback = {
    model: "sonnet",
    thinkingLevel: "high",
};
function settingsFile() {
    return (0, node_path_1.join)((0, paths_1.getCockpitDir)(), "assistant.json");
}
function getAssistantSettings() {
    try {
        const raw = JSON.parse((0, node_fs_1.readFileSync)(settingsFile(), "utf-8"));
        return { ...fallback, ...raw };
    }
    catch {
        return { ...fallback };
    }
}
function updateAssistantSettings(partial) {
    const current = getAssistantSettings();
    const updated = { ...current, ...partial };
    try {
        (0, node_fs_1.mkdirSync)((0, paths_1.getCockpitDir)(), { recursive: true });
        (0, node_fs_1.writeFileSync)(settingsFile(), JSON.stringify(updated, null, 2) + "\n");
    }
    catch {
        // best effort
    }
    return updated;
}
