Raxol.UI.Components.Harness.ToolCallBlock (Raxol v2.6.1)

View Source

Renders one tool invocation from the harness protocol stream.

Render-dual of the event pair item_started{item_id, item_type: :tool_use} followed by item_completed{item_type: :tool_use, content: %{name, args}} (see docs/proposals/in-flight/harness-spec-protocol.md sec 3, family :loop). It is a pure projection of name + args + status -- it holds no protocol state of its own; the caller re-inits or updates props as the envelope's events arrive (:pending on item_started, then :running, landing on :done/:failed when item_completed closes the item).

Renders as one row: a status glyph, the tool name (bold), and a compact, width-bounded rendering of args.

Summary

Functions

Formats args (a map or a preformatted string) into a compact, width-bounded single-line summary suitable for an inline row.

Glyph and colour for a tool-call/tool-result status.

Types

status()

@type status() :: :pending | :running | :done | :failed

t()

@type t() :: %{
  id: String.t() | atom(),
  name: String.t(),
  args: map() | String.t(),
  status: status(),
  frame: non_neg_integer(),
  style: map(),
  theme: map()
}

Functions

broadcast(msg)

command(cmd)

compact_args(args)

@spec compact_args(map() | String.t()) :: String.t()

Formats args (a map or a preformatted string) into a compact, width-bounded single-line summary suitable for an inline row.

handle_event(event, state, context)

Callback implementation for Raxol.UI.Components.Base.Component.handle_event/3.

mount(state)

Callback implementation for Raxol.UI.Components.Base.Component.mount/1.

schedule(msg, delay)

status_glyph(arg1, frame)

@spec status_glyph(status(), non_neg_integer()) :: {String.t(), atom()}

Glyph and colour for a tool-call/tool-result status.

:running returns a spinner-frame character (reuses Raxol.UI.Components.Progress.Spinner's frame table so a caller driving frame from a tick subscription gets real animation); :done is a green check, :failed a red cross; anything else (including :pending) falls back to a neutral marker.

unmount(state)

Callback implementation for Raxol.UI.Components.Base.Component.unmount/1.

update(props, state)

Callback implementation for Raxol.UI.Components.Base.Component.update/2.