Tool renderers for approval widgets - registry pattern.
Split a unified diff back into the lines it was assembled from.
Deliberately not splitlines(). Every diff reaching this function is
"\n"-joined from lines that themselves came from splitlines() or
split("\n"), so no element can contain a line boundary and "\n" is the
exact inverse. splitlines() also breaks on \r, \v, \f, U+2028,
U+2029 and U+0085, which splits a single diff line into fragments. The tail
fragment carries no +/- marker, so it would render as an unmarked note —
on the approval prompt that means changed content shown as neutral metadata.
Check any new producer against that invariant rather than against a list of the current ones.
Get the renderer for a tool by name.
Strategy for building a tool's HITL approval widget.
Each renderer maps a tool name to a (widget_class, data) pair that
controls what the user sees in the approval box. Tools not registered
in _RENDERER_REGISTRY fall through to the default, which dumps all
args as key: value lines via GenericApprovalWidget.
Renderer for write_file tool - shows full file content.
Renderer for task tool — interrupt description provides full context.
Renderer for delete tool - shows removed file content when available.
Renderer for edit_file tool - shows unified diff.
