feat(server,tui): session stats pane — metrics over the WS bus + Bubble Tea overlay
Surfaces the observability metrics (observability-spec §3-tier-2) in the Go TUI: a session-summary pane showing duration, token throughput per provider, tool time, approval latency per tier, failure counts, and the session wall-time accounting split. Press `S` (or palette → "session stats"). Mirrors the artifacts/config fetch pattern exactly — a WS request/response, not a new transport. Server-side reuses the already-tested MetricsInspectionService (one MetricsReport definition, two wires: REST `correx stats` + WS). Server: - ClientMessage.GetSessionStats + ServerMessage.SessionStats(@SerialName session.stats), reusing MetricsReport as the nested payload. - StreamQueries.sessionStats replays via MetricsInspectionService (pure read, replay-neutral); routed in GlobalStreamHandler. - ServerMessageSerializationTest golden pins the session.stats wire format. TUI (Go/Bubble Tea): - protocol: TypeSessionStats + StatsDto/nested structs + GetSessionStats encoder + golden decode test (cross-language contract). - OverlayStats pane (statsModal), `S` key + palette entry + footer hint, loading/cache-by-session state, bounded breakdown rows. - demo `stats` preview case for serverless visual verification.
This commit is contained in:
@@ -49,6 +49,7 @@ const (
|
||||
OverlayModels
|
||||
OverlayArtifacts
|
||||
OverlayConfig
|
||||
OverlayStats
|
||||
)
|
||||
|
||||
// RouterEntry is one line in a session's conversation transcript.
|
||||
@@ -143,15 +144,15 @@ type Model struct {
|
||||
reconnecting bool
|
||||
|
||||
// sessions
|
||||
sessions []Session
|
||||
selectedID string
|
||||
filter string
|
||||
workflows []Workflow
|
||||
wfIndex int // -1 = not in workflow picker
|
||||
wfVisible bool
|
||||
sessions []Session
|
||||
selectedID string
|
||||
filter string
|
||||
workflows []Workflow
|
||||
wfIndex int // -1 = not in workflow picker
|
||||
wfVisible bool
|
||||
wfPendingID string // workflow chosen, awaiting an intent line before StartSession
|
||||
wfPendingName string
|
||||
bgUpdates int
|
||||
bgUpdates int
|
||||
|
||||
// input
|
||||
editMode EditMode
|
||||
@@ -209,6 +210,11 @@ type Model struct {
|
||||
configRestart []string // keys from the last save that need a restart
|
||||
configLoading bool
|
||||
|
||||
// session stats (OverlayStats) — populated by the session.stats reply
|
||||
stats *protocol.StatsDto
|
||||
statsFor string // sessionId the current stats belong to
|
||||
statsLoading bool
|
||||
|
||||
// command palette
|
||||
paletteFilter string
|
||||
paletteIndex int
|
||||
|
||||
Reference in New Issue
Block a user