feat(tui): full event history, approval-decision events, status bar

- Events were hard-capped to the last 7 per session in addEvent, so the
  e-inspector and EVENTS panel could never show more. Raise to 1000
  (effectively all, bounded); the EVENTS panel now shows the latest that
  fit (tail), and the inspector scrolls a window around the selection
  with a position indicator.
- The TUI had no approval.resolved handling at all — the decision frame
  was ignored and pending only cleared on session.resumed. Add the
  constant + case: clear the gate and record an ApprovalResolved event
  (APPROVED/REJECTED/AUTO_APPROVED + reason) into the stream.
- Status bar now shows the current stage and session status alongside the
  name. Relabel the cryptic "N bg" badge to "N elsewhere".
This commit is contained in:
2026-06-03 01:24:52 +04:00
parent b56f0e88ca
commit f7fc10ddf5
4 changed files with 63 additions and 14 deletions
+28 -2
View File
@@ -227,9 +227,14 @@ func (m Model) eventInspectorModal() string {
evs := m.currentEvents()
var b strings.Builder
b.WriteString(m.titleLine("event inspector") + "\n\n")
b.WriteString(m.titleLine("event inspector"))
if len(evs) > 0 {
b.WriteString(mbg(t, " ("+itoa(m.overlayEventIdx+1)+"/"+itoa(len(evs))+")", t.P.Faint))
}
b.WriteString("\n\n")
if len(evs) == 0 {
b.WriteString(mbg(t, "no events", t.P.Faint))
return m.center(t.Overlay.Width(w).Render(b.String()))
}
// Budget the plain detail so the styled row never needs ANSI-aware truncation
// (truncating a styled string would cut through escape codes and corrupt it).
@@ -237,7 +242,28 @@ func (m Model) eventInspectorModal() string {
if detailBudget < 4 {
detailBudget = 4
}
for i, e := range evs {
// Window the (potentially long) list to a visible height, keeping the
// selected row in view — the modal must not grow past the screen.
bodyH := m.height*70/100 - 4
if bodyH < 3 {
bodyH = 3
}
off := 0
if len(evs) > bodyH {
off = m.overlayEventIdx - bodyH/2
if off < 0 {
off = 0
}
if off > len(evs)-bodyH {
off = len(evs) - bodyH
}
}
end := off + bodyH
if end > len(evs) {
end = len(evs)
}
for i := off; i < end; i++ {
e := evs[i]
cat := inferCategory(e.Type)
marker := mbg(t, " ", t.P.BgPanel)
fg := t.P.Fg