// ---------------------------------------------------------------------------
// to-turn-text — render one ConversationSession as a timestamped text block
// for memory-classify (mode='chat'). Bodies are opaque; the
// scanner already preserved the source's `Sender:` segment inside `body`,
// so a WhatsApp session renders as:
//
//   [YYYY-MM-DD HH:MM:SS ±HH:MM] Sender: body text
//   [YYYY-MM-DD HH:MM:SS ±HH:MM] Sender: body text
//
// Other sources whose body shape is different (system message, vCard,
// forwarded block) flow through unchanged — the chat-mode prompt is
// instructed to keep these prefixes verbatim in chunk bodies.
// ---------------------------------------------------------------------------
export function toTurnText(session) {
    const lines = [];
    for (const m of session.messages) {
        lines.push(`[${formatWallClock(m.dateSent)}] ${m.body}`);
    }
    return lines.join("\n");
}
function formatWallClock(iso) {
    const m = iso.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.\d+)?(Z|[+-]\d{2}:?\d{2})$/);
    if (!m)
        return iso;
    const [, y, mo, d, h, mi, s, off] = m;
    const offsetLabel = off === "Z" ? "+00:00" : off;
    return `${y}-${mo}-${d} ${h}:${mi}:${s} ${offsetLabel}`;
}
//# sourceMappingURL=to-turn-text.js.map