import { REASONING_LEVELS } from "./types.js";
export function parsePersonaReference(raw) {
    const trimmed = raw.trim();
    if (!trimmed) {
        return { error: "empty-persona" };
    }
    const colonIndex = trimmed.indexOf(":");
    if (colonIndex === -1) {
        return { personaId: trimmed };
    }
    const personaId = trimmed.slice(0, colonIndex).trim();
    const rawReasoning = trimmed.slice(colonIndex + 1).trim();
    if (!personaId) {
        return { error: "empty-persona" };
    }
    if (!rawReasoning) {
        return { personaId, error: "missing-reasoning" };
    }
    if (!REASONING_LEVELS.includes(rawReasoning)) {
        return { personaId, rawReasoning, error: "invalid-reasoning" };
    }
    return { personaId, reasoning: rawReasoning };
}
export function formatPersonaReference(args) {
    return args.reasoning ? `${args.personaId}:${args.reasoning}` : args.personaId;
}
//# sourceMappingURL=persona_reference.js.map