Agent timeline

A chronological trace of an agent's run: messages, reasoning, tool calls, handoffs, errors and notes, with agent-timeline-item. Built on ds::timeline (its list, its items, its rail), not a fork of it: the three options it needed were added to timeline-item under the unchanged-output rule (specs/timeline.md). Host-driven; no script but the optional x-ds-keep-toggle.

Anatomy

[follow] div[role=region][tabindex=0][data-ds-agent-follow]  flex-col-reverse, max-height
└── ol (ds::timeline)[aria-label=label][data-ds-agent-timeline]
    ├── [fold] li.peer/fold[data-ds-agent-fold]
    │   └── ⋮  details > summary "Show 3 earlier steps" / "Hide earlier steps"
    └── li (ds::timeline-item)[data-ds-agent-item=type][data-ds-agent-status][data-ds-folded?]
        ├── rail piece          solid, or dashed while pending, running, waiting
        ├── marker              see below
        └── title line          [actor avatar + name]  sr-only "Done: "  title  · 1.2s   time
            body (slot)         a tool call, a reasoning block, text

Markers

Marker
donethe type's icon on a neutral tint: message chat-bubble-left-ellipsis, reasoning light-bulb, tool wrench-screwdriver, handoff arrows-right-left, error exclamation-triangle, note pencil-square
runningds::loader's pulse, in the timeline-item marker slot: the node pulses, motion-safe, and is a still ring with reduced motion
any other statusthe status's icon on its tone's tint (the shared set)
type errordanger, whatever the status

A finished run reads at a glance by kind; a failure or a wait stands out by shape and colour, and the status is in words before the title either way.

The rail

Each row draws its own piece (the timeline's rule). Pending, running and waiting rows draw it dashed (rail="dashed"), so the line is solid through what has happened and dashed toward what has not.

Rows

type, status, title (default: the type in words), time, datetime, timeFormat (as timeline-item), duration (seconds, short form with the full words visually hidden), actor (a name, or avatar props: a 24px avatar and the name before the title, for a run with several agents), collapsed (only the title line; the body opens under it: timeline-item's collapsible). A message's body is text-fg-body; the rest keep the timeline's muted body.

Fold

fold = keep the last N rows in view. The rows stay where the host rendered them: moving them into a details element of their own would split a Livewire loop's [if BLOCK] markers across two parents, which its morph cannot follow. So the fold is a toggle row before them (a details with only a summary, peer/fold), and the earlier rows, which the list marks data-ds-folded in the rendered HTML, are hidden by CSS while it is closed (data-[ds-folded]:peer-has-[details:not([open])]/fold:hidden). They are in the page either way; a re-render that adds a row moves the mark and the count with it. Hidden rows are display: none, so find-in-page does not reach them until the fold is opened.

Follow

follow puts the list in a scroll box (maxHeight, a number of pixels or a CSS length, default 24rem) laid out with flex-col-reverse, as the reasoning block's body is while it runs: it opens on the newest row, keeps a new row in view, and leaves a reader who has scrolled up where they are. No script.

Motion

A row the host adds grows in from @starting-style (opacity and a 4px rise, the popover's enter timing), motion-safe: only. Rows present on first paint do the same once.

Accessibility

Rolean ordered list named by label; with follow, a region named the same, a Tab stop to scroll
Timestime datetime for a moment; a duration's words are visually hidden beside its short form
Statusin words before each title
KeyboardTab to the fold's summary, each collapsed row's summary and anything in the bodies; Enter or Space opens a summary
Focusevery summary and the follow box draw the system ring

Do not

  • Do not render the whole history unfolded on a long run. Fold it.
  • Do not key rows by position. Give each row a stable wire:key (its step's id), or a morph turns one row into the next.
  • Do not put a link in a collapsed row's title. The title is the summary, which is itself the control.

From the package repo: edit this page on GitHub.

Was this page helpful?