import { truncateToWidth } from "@threadwell/tui";
const DEFAULT_SUMMARY_WIDTH = 240;
export function compactMemoryText(text, maxWidth = DEFAULT_SUMMARY_WIDTH) {
    return truncateToWidth(text.replace(/\s+/g, " ").trim(), maxWidth, "...");
}
export function summarizeMemoryEvent(event) {
    if (event.summary.trim()) {
        return compactMemoryText(event.summary);
    }
    const fileSuffix = event.filePaths && event.filePaths.length > 0 ? ` (${event.filePaths.join(", ")})` : "";
    const tagSuffix = event.tags && event.tags.length > 0 ? ` [${event.tags.join(", ")}]` : "";
    return compactMemoryText(`${event.type}${fileSuffix}${tagSuffix}`);
}
export function summarizeValidation(command, status, details) {
    return compactMemoryText(`validation ${status}: ${command}${details ? ` — ${details}` : ""}`);
}
export function summarizeFileChange(path, action) {
    return compactMemoryText(`file ${action}: ${path}`);
}
export function summarizeToolResult(toolName, status, details) {
    return compactMemoryText(`tool ${toolName}: ${status}${details ? ` — ${details}` : ""}`);
}
//# sourceMappingURL=event-summary.js.map