feat: correx-managed model lifecycle slice 5 — Go TUI model swap + telemetry
Go TUI decodes model.changed / model.list / resource.status and renders a status-bar VRAM/GPU%/RAM gauge plus a models overlay (m key / palette 'models'): lists configured models with the resident one marked, enter swaps (SwapModel), c clears the pin (ClearModelPin). All three new server messages are non-event-bearing control/gauge frames, applied immediately like provider.status_changed. Server addition required for the picker: ServerMessage.ModelList (model.list, NonEventMessage) sent once in the initial snapshot from ManagedInferenceRouter.availableModelIds()/currentModelId() — the TUI otherwise cannot enumerate swap targets. Completes the 5-slice model-lifecycle feature. ./gradlew check green; go build/vet clean. Plan: docs/plans/2026-05-31-model-lifecycle-management.md (slice 5 of 5).
This commit is contained in:
@@ -190,6 +190,22 @@ func (m *Model) applyServer(msg protocol.ServerMessage) {
|
||||
for _, w := range msg.Workflows {
|
||||
m.workflows = append(m.workflows, Workflow{ID: w.WorkflowID, Description: w.Description})
|
||||
}
|
||||
case protocol.TypeModelChanged:
|
||||
if msg.Loaded {
|
||||
m.currentModel = msg.ModelID
|
||||
m.providerType = "LOCAL"
|
||||
}
|
||||
case protocol.TypeModelList:
|
||||
m.availableModels = append(m.availableModels[:0], msg.Models...)
|
||||
if msg.Current != "" {
|
||||
m.currentModel = msg.Current
|
||||
m.providerType = "LOCAL"
|
||||
}
|
||||
case protocol.TypeResourceStatus:
|
||||
m.gpuUsedMB = msg.GpuMemoryUsedMb
|
||||
m.gpuTotalMB = msg.GpuMemoryTotalMb
|
||||
m.gpuUtil = msg.GpuUtilizationPct
|
||||
m.ramMB = msg.ProcessRssMb
|
||||
}
|
||||
|
||||
// Background-update badge for non-selected sessions.
|
||||
@@ -202,7 +218,8 @@ func sessionIDOf(msg protocol.ServerMessage) string {
|
||||
switch msg.Type {
|
||||
case protocol.TypeStageManifest, protocol.TypeSnapshotComplete,
|
||||
protocol.TypeProtocolError, protocol.TypeProviderStatus,
|
||||
protocol.TypeWorkflowList, protocol.TypeRouterResponse:
|
||||
protocol.TypeWorkflowList, protocol.TypeRouterResponse,
|
||||
protocol.TypeModelChanged, protocol.TypeModelList, protocol.TypeResourceStatus:
|
||||
return ""
|
||||
default:
|
||||
return msg.SessionID
|
||||
|
||||
Reference in New Issue
Block a user