export const MEMORY_EVENT_TYPES = [
    "session_started",
    "session_ended",
    "user_message",
    "assistant_response",
    "assistant_summary",
    "compaction_snapshot",
    "tool_call",
    "tool_result",
    "file_modified",
    "validation_started",
    "validation_passed",
    "validation_failed",
    "decision",
    "decision_candidate",
    "blocker",
    "open_question",
    "handoff",
    "context_candidate",
    "adr_candidate",
    "task_started",
    "task_completed",
    "task_blocked",
    "snapshot_warning",
];
export const MEMORY_PRIORITIES = [0, 1, 2, 3, 4, 5];
export const DEFAULT_MEMORY_PRIORITY_BY_TYPE = {
    session_started: 2,
    session_ended: 2,
    user_message: 3,
    assistant_response: 2,
    assistant_summary: 2,
    compaction_snapshot: 4,
    tool_call: 1,
    tool_result: 1,
    file_modified: 4,
    validation_started: 2,
    validation_passed: 4,
    validation_failed: 4,
    decision: 5,
    decision_candidate: 3,
    blocker: 5,
    open_question: 4,
    handoff: 5,
    context_candidate: 3,
    adr_candidate: 4,
    task_started: 3,
    task_completed: 4,
    task_blocked: 5,
    snapshot_warning: 4,
};
export const MEMORY_RETENTION_HINT_BY_TYPE = {
    session_started: "normal",
    session_ended: "normal",
    user_message: "normal",
    assistant_response: "normal",
    assistant_summary: "normal",
    compaction_snapshot: "normal",
    tool_call: "ephemeral",
    tool_result: "ephemeral",
    file_modified: "normal",
    validation_started: "ephemeral",
    validation_passed: "normal",
    validation_failed: "normal",
    decision: "durable",
    decision_candidate: "normal",
    blocker: "durable",
    open_question: "durable",
    handoff: "durable",
    context_candidate: "normal",
    adr_candidate: "normal",
    task_started: "normal",
    task_completed: "normal",
    task_blocked: "durable",
    snapshot_warning: "normal",
};
const MEMORY_EVENT_TYPE_SET = new Set(MEMORY_EVENT_TYPES);
const MEMORY_PRIORITY_SET = new Set(MEMORY_PRIORITIES);
export function isMemoryEventType(value) {
    return MEMORY_EVENT_TYPE_SET.has(value);
}
export function isMemoryPriority(value) {
    return MEMORY_PRIORITY_SET.has(value);
}
export function getDefaultMemoryPriority(type) {
    return DEFAULT_MEMORY_PRIORITY_BY_TYPE[type];
}
export function normalizeMemoryEventInput(input) {
    const summary = input.summary.trim();
    const priority = input.priority ?? getDefaultMemoryPriority(input.type);
    const filePaths = input.filePaths?.map((filePath) => filePath.trim()).filter(Boolean);
    const tags = input.tags?.map((tag) => tag.trim()).filter(Boolean);
    return {
        ...input,
        summary,
        priority,
        filePaths: filePaths && filePaths.length > 0 ? [...new Set(filePaths)] : undefined,
        tags: tags && tags.length > 0 ? [...new Set(tags)] : undefined,
    };
}
export function validateMemoryEventInput(input) {
    const errors = [];
    if (!isMemoryEventType(input.type)) {
        errors.push(`Unknown memory event type: ${input.type}`);
    }
    if (!input.summary.trim()) {
        errors.push("Memory event summary is required");
    }
    if (input.priority !== undefined && !isMemoryPriority(input.priority)) {
        errors.push(`Invalid memory priority: ${input.priority}`);
    }
    return errors;
}
//# sourceMappingURL=memory-schema.js.map