LedgerUI.Components.Trace (LedgerUI v0.2.0)

Copy Markdown View Source

What an agent did, one line per step: an icon, a title that truncates, an optional description (a count, a duration, a diff) and a status. A step can open to show its output, link somewhere, or group the steps under it.

<.trace>
  <.trace_line icon="brain" title="Thought for 5s" />
  <.trace_line icon="terminal" description="0.4s">Ran <code>pnpm --version</code></.trace_line>
  <.trace_step icon="terminal" title="Ran node --version" open>
    <pre>v24.18.0</pre>
  </.trace_step>
  <.trace_line icon="terminal" status="error">Failed to run <code>pnpm install</code></.trace_line>
</.trace>

trace_line/1 also draws a timing waterfall: pass bar (%{start: 18, width: 30, color: "var(--teal-400)", delay: "0.6s"}, percentages of the total), duration (at the end) and depth (indent) to show spans.

trace_step/1 is a native <details>: the line is its summary and the block shows under it.

Summary

Functions

The list of steps.

One step: icon, title, description and status; a link with href, navigate or patch.

A step that opens: the line is the summary and the block shows under it.

Functions

trace(assigns)

The list of steps.

Attributes

  • spans (:list) - Lines as data, before the inner block: maps with :title (or :name) and optionally :icon, :description, :status, :duration, :depth and the bar (:start, :width, :color, :delay, percentages of the total). Defaults to [].
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block

trace_line(assigns)

One step: icon, title, description and status; a link with href, navigate or patch.

Attributes

  • icon (:string) - A huge-* icon name. Defaults to nil.
  • title (:string) - The title; or pass it as the block. Defaults to nil.
  • description (:any) - Secondary text after the title: a count, a duration, a diff. Defaults to nil.
  • status (:string) - Defaults to nil.Must be one of nil, "", "running", "error", or "pending".
  • end_icon (:string) - Defaults to nil.
  • href (:string) - Defaults to nil.
  • navigate (:string) - Defaults to nil.
  • patch (:string) - Defaults to nil.
  • depth (:integer) - Indent level (18px each). Defaults to 0.
  • bar (:map) - %{start, width, color, delay}: a span bar (percentages). Defaults to nil.
  • duration (:string) - Text at the end of the row (a time). Defaults to nil.
  • class (:any) - Defaults to nil.
  • Global attributes are accepted. Supports all globals plus: ["target", "rel", "download"].

Slots

  • inner_block

trace_step(assigns)

A step that opens: the line is the summary and the block shows under it.

Attributes

  • icon (:string) - Defaults to nil.
  • title (:string) - Defaults to nil.
  • description (:any) - Defaults to nil.
  • status (:string) - Defaults to nil.Must be one of nil, "", "running", "error", or "pending".
  • open (:boolean) - Defaults to false.
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block (required)
  • summary - The title with markup, in place of title.