Skip to content
Eskais UI

Agent tasks

Activity Log

Who changed what, and when, with undo: createActivityLog records the page's UI SDK control changes (from people, agents and the app) and the app's own records, and steps back and forward through them. ActivityLog lists them newest first; pressing an entry seeks to it, Undo and Redo bind Cmd/Ctrl+Z and Shift+Cmd/Ctrl+Z outside text fields, and undoToast shows a toast with Undo. Agents call undo, redo and seek; a seek that undoes more than confirmAbove entries needs a person (data-agent-confirm).

Example

Activity

No changes yet

Installation

npx shadcn@latest add @eskais/activity-log
npm packageslucide-react

Usage

Import
import { actorOf, createActivityLog } from "@/components/ui/activity-log-store"import { activityLog } from "@/components/ui/activity-log-primitive"import { ActivityLog, activityLogLabels, undoToast, useActivityLog } from "@/components/ui/activity-log"

Show who changed what and when, and let people and agents step back: record the page's controls with createActivityLog, add your own changes with record, list them with ActivityLog.

API reference

ActivityLog

PropTypeDefault
logrequiredActivityLogStore–
labelrequiredNames the log, for screen readers and agents.string–
labelsPartial<Omit<ActivityLogLabels, "actors">> & { actors?: Partial<Record<ActivityActor, string>> }–
headerA heading beside Undo and Redo.ReactNode–
confirmAboveSeeks that undo more entries than this need a person's approval when an agent asks for them.number3
shortcutsBinds Cmd/Ctrl+Z and Shift+Cmd/Ctrl+Z, listed in `ShortcutsDialog`. Turn off for a second log on the page.booleantrue
nowPass one `useNow()` per screen.Instant–
localestring–

Also takes ComponentProps except log, children.

Other exports

actorOfcreateActivityLogactivityLogactivityLogLabelsundoToastuseActivityLogtype ActivityActortype ActivityEntrytype ActivityLogtype ActivityLogOptionstype ActivityLogSnapshottype ActivityNotRestoredtype ActivityRecordtype ActivityLogPrimitiveOptionstype ActivityLogLabelstype ActivityLogPropstype UndoToastOptions

Accessibility

  • The log is a named group; the current point in its history has aria-current="step", and undone entries say so to screen readers.
  • Undo and Redo bind Cmd/Ctrl+Z and Shift+Cmd/Ctrl+Z, listed in ShortcutsDialog, and leave those keys to a focused text field.

Agent actions

Agents read the entries as items and call undo, redo and seek (by position or by an entry's sentence). A seek that undoes more than confirmAbove entries carries data-agent-confirm, so a person approves it.

Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.