GenAI.Approval.Render (GenAI Approval v0.1.0)

Copy Markdown View Source

Shared rendering model for approval-script UIs (PRD §7.3).

Both reference UIs (LiveView, Hologram) consume the same structure so they stay in feature parity:

  • highlight/1 — tolerant token classifier: source → lines of {class, text} spans. Never raises, even on invalid scripts.
  • model/1 — a Runner.snapshot/0 → UI model: highlighted lines annotated with step ranges (current / dimmed-untaken / breakpoint gutter), step chips, and navbar affordances.

Classes: cmt tag kw str num ident punct ws txt.

Summary

Functions

highlight(source)

@spec highlight(String.t()) :: [
  %{no: pos_integer(), spans: [{String.t(), String.t()}]}
]

model(snapshot)

@spec model(map()) :: map()

Build the full UI model from a GenAI.Approval.snapshot/1.