feat(tui): dock approval gate + two-column diff viewer

Replace the floating approval modal (which blanked the whole UI) with an
opencode-style band that takes the input bar's slot while a gate is
pending: tool/tier/risk header above a side-by-side old|new diff, with
the session output and event stream still visible above it. The band
height adapts to the diff length.

Add a unified-diff parser that aligns removals/additions into split rows
(blank left cell for a create, blank right for a delete) and a
two-column renderer shared by the band preview and the ^x fullscreen
view. Wire plain a/r to approve/reject to match the advertised keys.
This commit is contained in:
2026-06-03 00:17:08 +04:00
parent 6956102cf7
commit 03ccac76c7
6 changed files with 363 additions and 80 deletions
+29 -23
View File
@@ -5,23 +5,26 @@ import "github.com/charmbracelet/lipgloss"
// Palette is the "Soft" chrome from docs/visual/ref with the blue accent:
// rounded borders, opaque dark panels, generous spacing.
type Palette struct {
Bg lipgloss.Color // panel/background fill
BgDeep lipgloss.Color // outermost backdrop (slightly darker)
BgPanel lipgloss.Color // inside-panel fill
Sel lipgloss.Color // selection row background
Border lipgloss.Color // idle panel border
BorderHi lipgloss.Color // active panel border
Fg lipgloss.Color // primary text
FgStrong lipgloss.Color // headings / emphasis
Dim lipgloss.Color // labels, secondary text
Faint lipgloss.Color // tertiary, hints
Accent lipgloss.Color // blue accent
Accent2 lipgloss.Color // secondary accent
Bg lipgloss.Color // panel/background fill
BgDeep lipgloss.Color // outermost backdrop (slightly darker)
BgPanel lipgloss.Color // inside-panel fill
Sel lipgloss.Color // selection row background
Border lipgloss.Color // idle panel border
BorderHi lipgloss.Color // active panel border
Fg lipgloss.Color // primary text
FgStrong lipgloss.Color // headings / emphasis
Dim lipgloss.Color // labels, secondary text
Faint lipgloss.Color // tertiary, hints
Accent lipgloss.Color // blue accent
Accent2 lipgloss.Color // secondary accent
OK lipgloss.Color
Warn lipgloss.Color
Bad lipgloss.Color
DiffAdd lipgloss.Color // added-line cell background
DiffDel lipgloss.Color // removed-line cell background
CatLifecycle lipgloss.Color
CatContext lipgloss.Color
CatInference lipgloss.Color
@@ -50,6 +53,9 @@ var SoftBlue = Palette{
Warn: lipgloss.Color("#e8c06a"),
Bad: lipgloss.Color("#e87f7f"),
DiffAdd: lipgloss.Color("#1b2a1d"),
DiffDel: lipgloss.Color("#2c1c1f"),
CatLifecycle: lipgloss.Color("#c98fd9"),
CatContext: lipgloss.Color("#b9c0c9"),
CatInference: lipgloss.Color("#56c8d8"),
@@ -69,17 +75,17 @@ type Theme struct {
PanelTitle lipgloss.Style // uppercase dim header label
TitleHi lipgloss.Style // active header label
Text lipgloss.Style
Strong lipgloss.Style
Dim lipgloss.Style
Faint lipgloss.Style
Accent lipgloss.Style
SelRow lipgloss.Style
Status lipgloss.Style // top bar
Footer lipgloss.Style // bottom hints
Input lipgloss.Style // input bar panel
Overlay lipgloss.Style // modal box
Scrim lipgloss.Style // dim backdrop behind modals
Text lipgloss.Style
Strong lipgloss.Style
Dim lipgloss.Style
Faint lipgloss.Style
Accent lipgloss.Style
SelRow lipgloss.Style
Status lipgloss.Style // top bar
Footer lipgloss.Style // bottom hints
Input lipgloss.Style // input bar panel
Overlay lipgloss.Style // modal box
Scrim lipgloss.Style // dim backdrop behind modals
}
// NewTheme builds the style set for a palette.