Documentation
¶
Overview ¶
Package approval renders one pending tool-approval request inline and turns keypresses into a ports.Decision.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DecisionMsg ¶
DecisionMsg is emitted when the user resolves the active request.
type Model ¶
Model holds at most one pending request: a new SetRequest replaces whatever was pending. This is the inline prompt the build spec calls for (uikit/config.ApprovalDefaultInline), not a queue-visualising dialog - promotion to a full alt-screen dialog is a later screen, not this component's job.
func (*Model) Clear ¶
func (m *Model) Clear()
Clear dismisses the prompt without emitting a decision (e.g. tool started out-of-band or turn ended).
func (Model) Height ¶
Height is the number of terminal rows View() claims, border included, so the enclosing screen can reserve them without re-rendering. It is 0 when nothing is pending, and CONSTANT while scrolling: the window never grows or shrinks with the offset.
func (Model) ScrollBy ¶
ScrollBy moves the diff preview window by n lines and returns the model. The offset clamps to [0, total-window], so scrolling past either end is a no-op, never an empty window.
func (*Model) SetRequest ¶
func (m *Model) SetRequest(b uievent.ToolPendingBody)
SetRequest arms the prompt for a new pending tool call. The scroll offset restarts at the top: a new request is a new diff, and a stale offset could land the first view halfway through it.
func (*Model) SetWidth ¶
SetWidth records the terminal width so the box renders at a fixed size. Call it on WindowSizeMsg, like the composer.
func (Model) View ¶
View renders the prompt, or "" when nothing is pending.
The diff preview is a FIXED-height window (ApprovalDiffPreviewLines) into the full diff at the current scroll offset, with a position row ("lines X-Y of Z") when the diff is longer than the window. Fixed height matters: scrolling must never change the rows the prompt claims, or every wrapped line above it reflows on every keystroke (ux-rules.md rule 2.7).