Checkpoint
Mark a point in a conversation the work can return to, and restore it after a confirm step.
Overview
Checkpoint marks a point in an agent's work that can be put back: the files, the plan, or whatever your app saves. It sits between messages as a hairline with a label and a time. Restore asks first, then shows Restoring and Restored.
CheckpointList shows several checkpoints in one panel, with the one the work is at now marked Current.
Saving and restoring are your app's work. The component shows the state and calls your handler.
Anatomy
- LabelWhat the checkpoint marks, and when it was made
- DividerA hairline that sets it apart from the messages around it
- RestoreA quiet button, when you handle restoring
- ConfirmThe question, Cancel, and Restore, shown in place of the button
- TitleA heading for the panel
- ItemA dot on a rail, the label, the time and a note, and Restore or Current
Installing checkpoint brings Button along as a registry dependency.
Behavior
Confirm step
Restore replaces itself with "Discard the changes made after this?", Cancel, and Restore. Focus moves to the confirming Restore, and back to the first one on Cancel or Escape. Nothing is called until the person confirms.
Restoring and restored
If onRestore returns a promise, the checkpoint shows Restoring until it settles. To control the state yourself, pass status: "available", "restoring", or "restored". A status you pass wins over the promise.
List
CheckpointList calls onRestore with the checkpoint's id. The checkpoint matching currentId shows Current instead of Restore.
Accessibility
Each checkpoint is a group named by its label. Restore is named with its checkpoint, such as "Restore: Before the rounding refactor", and the confirm step is a group with the same name. Times use the time element; pass dateTime for a machine-readable value. The icon and divider are decorative.
Installation
Usage
import { Checkpoint } from "@/components/ai/checkpoint"
<Checkpoint
label={checkpoint.title}
time={formatTime(checkpoint.createdAt)}
dateTime={checkpoint.createdAt}
onRestore={() => workspace.restore(checkpoint.id)}
/>Examples
List
Several checkpoints in a panel. Restoring one makes it Current.
API reference
Checkpoint
Accepts native div props beyond those listed.
CheckpointList
Accepts native section props beyond those listed.