Planning & Execution
Checkpoint Timeline
Checkpoints the agent made along the way — scrub through turns, see what changed, restore to any point.
3 variantsMIT
Preview
Installation
Copies the component into components/ui and installs its dependencies and theme tokens.
pnpm dlx shadcn@latest add https://uilab.tmih06.com/r/checkpoint-timeline.jsonUsage
Pass your own data and wire the callbacks to your agent runtime.
import { CheckpointTimeline } from "@/components/ui/checkpoint-timeline";
export function SessionHistory({ query }: { query: SessionQuery }) {
// null keeps the timeline and preview space reserved while the first request
// is in flight. Keep stale checkpoints in data when refetching.
const checkpoints = query.data
? query.data.checkpoints.map((c) => ({
id: c.id,
label: c.summary,
at: formatRelative(c.createdAt),
files: c.diffStat, // [{ path, additions, deletions }]
}))
: null;
return (
<CheckpointTimeline
data={checkpoints}
loading={query.isRefetching}
skeleton={{ count: 8, files: 2 }}
onRestore={async (checkpoint) => {
await session.rewind(checkpoint.id); // reverts files and drops later turns
}}
/>
);
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
| data* | Checkpoint[] | null | — | Checkpoints oldest first. The last one is treated as the current state. Pass null while they load. |
| loading | boolean | false | Force the layout-preserving skeleton while refetching, even when stale checkpoints are available. The timeline and preview reserve their space instead of collapsing. |
| skeleton | { count?: number; files?: number } | — | Shape hints for the loading state: count is the number of checkpoint ticks and files the number of preview file rows. |
| variant | "timeline" | "compact" | "timeline" | A scrubber with a preview of the hovered or selected checkpoint, or a single row with previous / next. |
| selectedId | string | — | Controlled selection. Defaults to the latest checkpoint. |
| onSelect | (checkpoint: Checkpoint) => void | — | Called on click, focus or arrow keys (← → Home End). |
| onRestore | (checkpoint: Checkpoint) => void | — | Called after the inline confirmation. Remove the later checkpoints from data — the track trims with an animation. |
| confirming | boolean | — | Controls the confirmation step. Leave unset to let the component own it. |
| onConfirmingChange | (confirming: boolean) => void | — | Called when the user opens or cancels the confirmation. |
| labels | Partial<CheckpointTimelineLabels> | — | Your own UI strings: the labels.loading announcement, headings, counts, restore buttons and screen-reader text, for translating. Right-to-left works under `dir="rtl"`; checkpoints then run from the right. |
| className | string | — | Extra classes for the root element. |
type Checkpoint = {
id: string;
label: string; // what the turn did
at: string; // display time, e.g. "4m ago"
files: { path: string; additions: number; deletions: number }[];
};