/** * History Markdown I/O — parse and serialize history.md files. * * Wraps the existing section-parsing logic from history-shadow.ts * and adds serialization for round-trip support. * * @module state/io/history-io */ import type { ParsedHistory, HistorySection } from '../../agents/history-shadow.js'; export type { ParsedHistory, HistorySection }; /** * Parse history markdown into typed sections. * * Mirrors the section-extraction logic in `readHistory()` from * history-shadow.ts but operates purely on a string (no filesystem). * * Note: the original regex uses `\Z` which is not a valid JS anchor. * We use an explicit section-split approach to correctly handle the * last section in the file. */ export declare function parseHistory(markdown: string): ParsedHistory; /** * Serialize a ParsedHistory back to markdown. * * Reconstructs the history.md with `# AgentName` header and `## Section` blocks. */ export declare function serializeHistory(history: ParsedHistory): string; /** * Produce a string fragment for appending a new entry to a history section. * * @param section - Target section name (e.g., 'Learnings') * @param entry - Content to append (without date header) * @param date - Optional ISO date string (defaults to today) * @returns Formatted entry string including `### YYYY-MM-DD` sub-header */ export declare function serializeHistoryAppend(section: HistorySection, entry: string, date?: string): string; //# sourceMappingURL=history-io.d.ts.map