import { YamlStore } from "./yaml-store.js";
function parsePersonality(data) {
    if (!data.name)
        return null;
    return {
        name: data.name,
        label: data.label ?? data.name,
        description: data.description ?? "",
        promptFragment: data.promptFragment ?? "",
        createdAt: data.createdAt ?? 0,
        updatedAt: data.updatedAt ?? 0,
    };
}
function serializePersonality(p) {
    return {
        name: p.name,
        label: p.label,
        description: p.description,
        promptFragment: p.promptFragment,
        createdAt: p.createdAt,
        updatedAt: p.updatedAt,
    };
}
/**
 * File-backed personality store with builtin cascade support.
 * Each personality is a YAML file in personalities/<name>.yaml.
 */
export class PersonalityStore extends YamlStore {
    constructor(configDir) {
        super(configDir, {
            subdir: "personalities",
            keyFn: p => p.name,
            parseItem: parsePersonality,
            serializeItem: serializePersonality,
            logPrefix: "[personality-store]",
        });
    }
}
//# sourceMappingURL=personality-store.js.map