Loading component…
Loading component…
Everything an agent changed in your systems, each change with an undo – pointing at Undo shows what builds on it and what can't be taken back
To reuse this local React demo, copy all files from the Code tab into the same folder, then import AgentLedger from ./agent-ledger.
import { AgentLedger, type LedgerEntry } from "@/components/ui/agent-ledger";
const entries: LedgerEntry[] = [
{ id: "price", action: "Changed price", target: "Pro plan", system: "Stripe", at: Date.now() - 120000,
change: ["$29 / month", "$34 / month"] },
{ id: "deals", action: "Updated 212 deals", target: "Renewals in Q4", system: "HubSpot", at: Date.now() - 60000,
change: ["$29 per seat", "$34 per seat"], dependsOn: ["price"] },
{ id: "email", action: "Sent email", target: "3,812 customers", system: "HubSpot", at: Date.now(),
detail: "New price and the code LAUNCH20", dependsOn: ["price"], reversible: false },
];
export function Changes() {
return <AgentLedger entries={entries} agent="Launch agent" onUndo={(ids) => revert(ids)} onRedo={(ids) => reapply(ids)} />;
}| Name | Type | Default | Description |
|---|---|---|---|
| entries | LedgerEntry[] | { id, action, target?, system, icon?, at, change?, detail?, reversible?, dependsOn? } – every change, any order; newest shows first | |
| change | [before, after] | Per entry – shown as before (struck) → after; or pass detail for a single line | |
| dependsOn | string[] | Per entry – the changes it builds on; undoing one of those undoes this one too, if it can be | |
| reversible | boolean | true | Per entry – false for things that can't be taken back (a sent email, a payout): no Undo, and "Can't undo" when something it builds on is undone |
| agent | string | Who made the changes, next to the title | |
| now | number | The clock for "2m ago" (epoch ms) – defaults to now, kept fresh | |
| undone / defaultUndone | string[] | Ids of undone changes, controlled or not | |
| onUndo / onRedo | (ids: string[]) => void | The change and its reversible dependents – revert or reapply them | |
| pointAt | string \| null | Lights up a change and what builds on it, as if its Undo were pointed at – for a walkthrough | |
| title | string | "Ledger" | Heading of the bar |
| className | string | Extra class on the root |
Built on a container query: under 480px the numbers move to a line of their own, the time drops the system's name and Undo / Redo shrink to round icon buttons
On touch screens Undo and Redo show on every row, in place of the time
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"