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

View Source

Renders the blast radius of an agent-harness action: everything it will touch, grouped by effect kind, with destructive/irreversible effects made impossible to miss.

Render-dual of the blast_radius field carried by the harness's approval_requested payload (see docs/proposals/in-flight/harness-spec-frontend.md, §4 row A6). Typically embedded inside Raxol.UI.Components.Harness.ApprovalPrompt, but stands alone for the playground and for testing.

Props

  • :blast_radius - %{writes: [path], deletes: [path], commands: [string], network: [host], reversible: boolean}. Every key is optional; missing lists default to [], missing :reversible defaults to true (a missing/absent flag is not itself a danger signal -- but deletes are still shown loud regardless, see below). A missing PROP defaults to %{} -- a caller that never mentions a blast radius at all is presumed to have nothing to declare, and renders the calm "No tracked effects." line. An explicit nil VALUE is a different claim entirely: it means a producer somewhere upstream had an approval to show but no blast radius payload for it (see Raxol.UI.Components.Harness.Block.extract_approval_content/1) -- that renders a standalone warning instead (see below), never the "No tracked effects." line, because an undeclared radius is not known to be safe.

Visual hierarchy

Per the tui-design-science skill: hue carries identity (what kind of effect this is), weight carries importance (how much attention it needs) -- kept independent so red stays reserved for the one thing it means.

  • :deletes are always red + bold. Deleting earns a second look even inside an otherwise-reversible action.
  • :commands are yellow (caution -- unpredictable side effects), :network is cyan (informational -- reaching outside the sandbox), :writes carry no hue, just weight.
  • When blast_radius.reversible == false, every group loses its dim/default weight and renders bold -- nothing here is a "minor" effect anymore -- and a standalone IRREVERSIBLE marker leads the list, in red (the one other case the alarm hue is reserved for).
  • When blast_radius.reversible == true, :commands / :network / :writes render dim -- present, but not competing with the deletes group for attention.

Every group is glyph-prefixed, not color-only, so the hierarchy survives for colorblind readers: delete, run, network, write.

Summary

Functions

Structural row-count estimate of this preview's rendered height (content rows only -- no outer frame/padding), for callers that need to size an enclosing overlay before render/2 has run (see Raxol.UI.Components.Harness.ApprovalPrompt.estimate_height/1). Generous by design, mirroring Raxol.UI.Components.Modal.Rendering.estimate_height/1.

Types

blast_radius()

@type blast_radius() :: %{
  optional(:writes) => [String.t()],
  optional(:deletes) => [String.t()],
  optional(:commands) => [String.t()],
  optional(:network) => [String.t()],
  optional(:reversible) => boolean()
}

t()

@type t() :: %{
  id: String.t() | atom(),
  blast_radius: blast_radius() | nil,
  style: map(),
  theme: map()
}

Functions

broadcast(msg)

command(cmd)

estimate_rows(blast_radius)

@spec estimate_rows(blast_radius() | nil) :: pos_integer()

Structural row-count estimate of this preview's rendered height (content rows only -- no outer frame/padding), for callers that need to size an enclosing overlay before render/2 has run (see Raxol.UI.Components.Harness.ApprovalPrompt.estimate_height/1). Generous by design, mirroring Raxol.UI.Components.Modal.Rendering.estimate_height/1.

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)

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.