import type { Message } from "../types.ts"; /** * For harnesses that cannot be seeded with prior messages: prefix the new * input with the conversation so far as a transcript. */ export function withTranscript(history: Message[], input: string): string { const turns = history.filter((m) => (m.role === "user" || m.role === "assistant") && m.content); if (turns.length === 0) return input; const transcript = turns.map((m) => `${m.role === "user" ? "User" : "Assistant"}: ${m.content}`).join("\n\n"); return `\n${transcript}\n\n\n${input}`; }