export const DEFAULT_SESSION_PREVIEW_LIMIT = 10;
const COMPACTION_SUMMARY_PREFIX = "[Conversation Summary";
export function isCompactionSummaryMessage(message) {
    return (message.role === "user" &&
        message.content.startsWith(COMPACTION_SUMMARY_PREFIX));
}
export function buildSessionPreview(messages, limit = DEFAULT_SESSION_PREVIEW_LIMIT) {
    if (limit <= 0) {
        return [];
    }
    return messages
        .filter((message) => !isCompactionSummaryMessage(message))
        .slice(-limit);
}
