import { readJsonFile, writeJsonFile } from "./utils/fs.js";
import { sdkStateSchema } from "./schemas.js";
export async function loadState(stateFile) {
    const raw = await readJsonFile(stateFile, {
        mcpServers: {},
        skills: {},
    });
    const parsed = sdkStateSchema.safeParse(raw);
    if (!parsed.success) {
        return {
            mcpServers: {},
            skills: {},
        };
    }
    return parsed.data;
}
export async function saveState(stateFile, state) {
    await writeJsonFile(stateFile, state);
}
