Watch the cluster and edit every setting from the console

The console gains live views of nodes, GPUs, models, replicas, usage and
agent logs, and a settings tree over every key of server.yaml (agent.yaml on
a node), generated from the configuration structs: values with their
defaults and doc comments, edited in dialogs, saved only once the service's
own loader accepts them, comments kept. The generator now tells blocks apart
by package, which brings the TLS, engine and supervisor settings back into
the reference.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ilker ManapandClaude Opus 5.5 committed 2026-10-03 22:54:09 +02:00
1 parent aa3efcebbe
commit 9ab93a0aa6
13 files changed
+2702 -472

No files matched your search

+54 -19
View File
@@ -1,6 +1,8 @@
package cli
import (
"os"
"path/filepath"
"strings"
"testing"
@@ -104,35 +106,68 @@ func TestTheChecksHoldTheSetupBackOnlyForAFailure(t *testing.T) {
func TestTheConsoleOffersToReplicateOnlyAStoreThatIsNot(t *testing.T) {
m := consoleModel{}
if !strings.Contains(m.items()[1].label, "Replicate") {
if !m.entryOK(cReplicate) {
t.Error("a single store is not offered replication")
}
m.store = true
for _, it := range m.items() {
if strings.Contains(it.label, "Replicate") {
t.Error("a replicated store is offered replication")
}
m.data.sum.Store = []adminapi.StoreMember{{Name: "a", Role: "leader"}}
if m.entryOK(cReplicate) {
t.Error("a replicated store is offered replication")
}
// A node is asked for, then the console closes with it to do.
var mm tea.Model = consoleModel{summary: "x", loaded: true}
// A node is asked for in a dialog, then the console closes with it to do.
var mm tea.Model = consoleModel{menu: cAddNode, loaded: true, width: 100, height: 30}
mm = press(mm, "enter", "ubuntu@10.0.0.9", "enter")
if a := mm.(consoleModel).action; a.kind != "node" || a.targets[0] != "ubuntu@10.0.0.9" {
t.Errorf("%+v", a)
}
_ = adminapi.Summary{}
}
func TestTheSetupIsDrawnAsWindows(t *testing.T) {
m := newSetupModel("ctl", []string{"10.0.0.5"})
m.width, m.height = 100, 30
v := m.View()
lines := strings.Split(v, "\n")
if len(lines) != 30 {
t.Errorf("%d lines for a 30-line terminal", len(lines))
func TestTheConsoleWatchesTheClusterAndEditsItsSettings(t *testing.T) {
dir := t.TempDir()
file := filepath.Join(dir, "server.yaml")
if err := os.WriteFile(file, []byte("# mine\nlisten: \":8080\"\n"), 0o644); err != nil {
t.Fatal(err)
}
for _, want := range []string{"llmgw setup", "Steps", "Start", "╭", "One machine", "Ctrl+C"} {
if !strings.Contains(v, want) {
t.Errorf("the screen lacks %q:\n%s", want, v)
m := newConsoleModel("127.0.0.1:1", file)
m.width, m.height, m.loaded = 120, 40, true
m.data.nodes = []adminapi.NodeView{{ID: "cuda01", State: "ready", GPUTotal: 1, GPUs: []adminapi.GPUView{{Index: 0, Name: "Quadro RTX 6000"}}}}
m.data.replicas = []adminapi.ReplicaView{{ID: "r1", Model: "coder-14b", State: "ready",
Shards: []adminapi.ShardView{{Node: "cuda01", GPUs: []int{0}}}}}
// Watching: the GPUs view says which model holds each card.
m.menu = cGPUs
if v := m.View(); !strings.Contains(v, "Quadro RTX 6000") || !strings.Contains(v, "coder-14b") {
t.Errorf("the GPUs view:\n%s", v)
}
// Settings: into router, change retries, save.
var mm tea.Model = m
mm.(consoleModel).View()
cm := mm.(consoleModel)
cm.menu, cm.inPanel = cSettings, true
for i, r := range cm.settingsRows() {
if r.label == "router" {
cm.row = i
}
}
mm = press(cm, "enter") // into router
cm = mm.(consoleModel)
for i, r := range cm.settingsRows() {
if r.label == "retries" {
cm.row = i
}
}
if v := cm.View(); !strings.Contains(v, "(default)") {
t.Errorf("an unset key does not show its default:\n%s", v)
}
mm = press(cm, "enter") // the edit dialog
cm = mm.(consoleModel)
cm.prompt.SetValue("5")
mm = press(cm, "enter", "s")
if d := mm.(consoleModel).dialog; d != "saved" {
t.Fatalf("after saving the dialog is %q: %s", d, mm.(consoleModel).dialogText)
}
b, _ := os.ReadFile(file)
if !strings.Contains(string(b), "retries: 5") || !strings.Contains(string(b), "# mine") {
t.Errorf("server.yaml:\n%s", b)
}
}