import type { AgentToolResult } from "@earendil-works/pi-coding-agent"; import type { Theme } from "@earendil-works/pi-coding-agent"; import { Text } from "@earendil-works/pi-tui"; import type { InvokedBy, RollbackArgs } from "./types"; export function renderRestoreCall(args: RollbackArgs & { invokedBy?: InvokedBy }, theme: Theme) { const checkpoint = theme.fg("accent", args.checkpoint_id); const invokedBy = theme.fg("muted", `invoked by ${args.invokedBy ?? "assistant"}`); const summary = theme.fg("text", args.summary); const text = `${theme.fg("toolTitle", theme.bold("restore conversation "))}${checkpoint} ยท ${invokedBy}\n${summary}`; return new Text(text, 0, 0); } export function renderRestoreResult( result: AgentToolResult, theme: Theme, ) { const textBlock = result.content.find((block) => block.type === "text"); const text = textBlock?.type === "text" ? textBlock.text : ""; return new Text(theme.fg("success", text), 0, 0); }