feat(tui): show router inference metrics beside router lines

This commit is contained in:
2026-06-03 15:41:51 +04:00
parent c2fb17f6ee
commit 80a72d370e
6 changed files with 45 additions and 7 deletions
@@ -88,6 +88,17 @@ func TestDecodeGoldenServerFrames(t *testing.T) {
}
},
},
{
name: "chat.turn carries router metrics",
json: `{"type":"chat.turn","sessionId":"s1","turnId":"t9","role":"ROUTER","content":"hi","latencyMs":3000,"totalTokens":943,"sequence":7,"sessionSequence":2}`,
wantType: TypeChatTurn,
eventBear: true,
check: func(t *testing.T, m ServerMessage) {
if m.LatencyMs == nil || *m.LatencyMs != 3000 || m.TotalTokens == nil || *m.TotalTokens != 943 {
t.Fatalf("chat.turn metrics: %+v", m)
}
},
},
{
name: "snapshot_complete (non-event control frame)",
json: `{"type":"snapshot_complete"}`,
@@ -87,6 +87,10 @@ type ServerMessage struct {
Models []string `json:"models"`
Current string `json:"current"`
// chat.turn router metrics (nil when not a ROUTER turn or server omits them)
LatencyMs *int64 `json:"latencyMs"`
TotalTokens *int `json:"totalTokens"`
// resource.status (nil = unavailable)
GpuMemoryUsedMb *int64 `json:"gpuMemoryUsedMb"`
GpuMemoryTotalMb *int64 `json:"gpuMemoryTotalMb"`