TUI: Machine on two lines, status bar with the address last (#28 closed)
The GPU load shows on the user's Mac (#28 task 1), but the Machine line and the status bar were too full and got cut. The Dashboard's Machine line is now two lines (gpu, pressure, rzb footprint; then memory), and the status bar puts version, gpu, pressure, memory and model first, the address last (cut first on a narrow terminal). Docs EN+FR. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
783675c parent: 5c534c9 modified
.memory/handoffs/2026-11-27-v0-3-tui-foundation.md +1 -0 | @@ -39,3 +39,4 @@ | ||
| 39 | 39 | - Open: the TUI download failure the user saw (message not known yet); #63 (reasoning colour, v0.3); #28 task 1 (GPU key); #62 (HF token spike, no milestone); user to run `scripts/compat.sh` on the Mac after the bump and to try Mellum. |
| 40 | 40 | - User confirmed after the bump: "ok all good", `scripts/compat.sh` on the Mac 79 passed (93.6 s). |
| 41 | 41 | - The Models screen download works (user, 2026-11-27): not a bug. |
| 42 | +- #28 closed (GPU shows on the Mac). Machine line now two lines; status bar address last. v0.3 left: #63 (reasoning colour), then the 0.3.0 release. | |
| @@ -39,3 +39,4 @@ | |||
| 39 | - Open: the TUI download failure the user saw (message not known yet); #63 (reasoning colour, v0.3); #28 task 1 (GPU key); #62 (HF token spike, no milestone); user to run `scripts/compat.sh` on the Mac after the bump and to try Mellum. | 39 | - Open: the TUI download failure the user saw (message not known yet); #63 (reasoning colour, v0.3); #28 task 1 (GPU key); #62 (HF token spike, no milestone); user to run `scripts/compat.sh` on the Mac after the bump and to try Mellum. |
| 40 | - User confirmed after the bump: "ok all good", `scripts/compat.sh` on the Mac 79 passed (93.6 s). | 40 | - User confirmed after the bump: "ok all good", `scripts/compat.sh` on the Mac 79 passed (93.6 s). |
| 41 | - The Models screen download works (user, 2026-11-27): not a bug. | 41 | - The Models screen download works (user, 2026-11-27): not a bug. |
| 42 | +- #28 closed (GPU shows on the Mac). Machine line now two lines; status bar address last. v0.3 left: #63 (reasoning colour), then the 0.3.0 release. | ||
modified
.memory/history.md +1 -0 | @@ -547,3 +547,4 @@ open, a comment on each. main fast-forwarded. | ||
| 547 | 547 | - **Still to check by the user**: Mellum itself loads and answers; `scripts/compat.sh` on the Mac; the TUI download error message. |
| 548 | 548 | - 2026-11-27, later: the user confirmed the 3.33.0 bump on the Mac ("ok all good"); `scripts/compat.sh` with real models: 79 passed in 93.6 s. |
| 549 | 549 | - 2026-11-27, later: the TUI Models screen download works (user: "je me suis trompé"); nothing to fix there. |
| 550 | +- 2026-11-27, later: GPU load confirmed shown on the Mac (#28 closed); the Machine line was too full → split in two, status bar reordered (version, gpu, pressure, memory, model, address last). Linux 336, Mac green. | |
| @@ -547,3 +547,4 @@ open, a comment on each. main fast-forwarded. | |||
| 547 | - **Still to check by the user**: Mellum itself loads and answers; `scripts/compat.sh` on the Mac; the TUI download error message. | 547 | - **Still to check by the user**: Mellum itself loads and answers; `scripts/compat.sh` on the Mac; the TUI download error message. |
| 548 | - 2026-11-27, later: the user confirmed the 3.33.0 bump on the Mac ("ok all good"); `scripts/compat.sh` with real models: 79 passed in 93.6 s. | 548 | - 2026-11-27, later: the user confirmed the 3.33.0 bump on the Mac ("ok all good"); `scripts/compat.sh` with real models: 79 passed in 93.6 s. |
| 549 | - 2026-11-27, later: the TUI Models screen download works (user: "je me suis trompé"); nothing to fix there. | 549 | - 2026-11-27, later: the TUI Models screen download works (user: "je me suis trompé"); nothing to fix there. |
| 550 | +- 2026-11-27, later: GPU load confirmed shown on the Mac (#28 closed); the Machine line was too full → split in two, status bar reordered (version, gpu, pressure, memory, model, address last). Linux 336, Mac green. | ||
modified
.tickets/issues/0028-show-gpu-load.yaml +13 -3 | @@ -1,12 +1,13 @@ | ||
| 1 | 1 | # Managed by IssueSpec. Hand edits are welcome; keep the schema valid. |
| 2 | 2 | id: 28 |
| 3 | 3 | title: Show GPU load |
| 4 | -state: open | |
| 4 | +state: closed | |
| 5 | 5 | author: |
| 6 | 6 | name: k33g |
| 7 | 7 | email: ph.charriere@gmail.com |
| 8 | 8 | createdAt: 2026-11-24T05:48:30.000Z |
| 9 | -updatedAt: 2026-11-27T06:40:00.000Z | |
| 9 | +updatedAt: 2026-11-27T10:30:00.000Z | |
| 10 | +closedAt: 2026-11-27T10:30:00.000Z | |
| 10 | 11 | labels: |
| 11 | 12 | - "kind::feature" |
| 12 | 13 | - "area::tui" |
| @@ -40,12 +41,14 @@ body: | | ||
| 40 | 41 | tasks: |
| 41 | 42 | - id: 1 |
| 42 | 43 | title: Read IOAccelerator PerformanceStatistics on the Mac and check the keys on this machine's GPU / macOS version |
| 43 | - state: open | |
| 44 | + state: closed | |
| 44 | 45 | priority: medium |
| 45 | 46 | author: |
| 46 | 47 | name: k33g |
| 47 | 48 | email: ph.charriere@gmail.com |
| 48 | 49 | createdAt: 2026-11-24T05:48:30.000Z |
| 50 | + updatedAt: 2026-11-27T10:30:00.000Z | |
| 51 | + closedAt: 2026-11-27T10:30:00.000Z | |
| 49 | 52 | - id: 2 |
| 50 | 53 | title: Add GPU utilisation to the system monitor of #26 (Darwin implementation + fake) |
| 51 | 54 | state: closed |
| @@ -82,3 +85,10 @@ comments: | ||
| 82 | 85 | body: | |
| 83 | 86 | Tasks 2-3 done (1dea285, docs bb36d60): SystemMonitor reads the highest "Device Utilization %" of the IOAccelerator services' PerformanceStatistics (IOKit, no root) on each status request; /rzb/status system.gpu_utilization, null when absent (Linux, or a GPU that does not publish the key); rzb tui shows "gpu N%" in the status bar and the Machine line, and hides it when null. The CLI stats part belonged to the removed agent. |
| 84 | 87 | Task 1 stays open: the code compiles and runs on the Mac, but whether this Mac's GPU publishes the key (and its value under load) was not seen yet — check during the manual tests (Dashboard while generating, or curl /rzb/status | jq .system). |
| 88 | + - id: 3 | |
| 89 | + author: | |
| 90 | + name: k33g | |
| 91 | + email: ph.charriere@gmail.com | |
| 92 | + createdAt: 2026-11-27T10:30:00.000Z | |
| 93 | + body: | | |
| 94 | + Task 1 checked by the user on the Mac (2026-11-27): the GPU load shows in rzb tui. The line was too full and got cut: the Dashboard's Machine line is now two lines (gpu, pressure, rzb footprint; then memory), and the status bar puts version, gpu, pressure, memory and model first, the address last (cut first on a narrow terminal). | |
| @@ -1,12 +1,13 @@ | |||
| 1 | # Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | 1 | # Managed by IssueSpec. Hand edits are welcome; keep the schema valid. |
| 2 | id: 28 | 2 | id: 28 |
| 3 | title: Show GPU load | 3 | title: Show GPU load |
| 4 | -state: open | 4 | +state: closed |
| 5 | author: | 5 | author: |
| 6 | name: k33g | 6 | name: k33g |
| 7 | email: ph.charriere@gmail.com | 7 | email: ph.charriere@gmail.com |
| 8 | createdAt: 2026-11-24T05:48:30.000Z | 8 | createdAt: 2026-11-24T05:48:30.000Z |
| 9 | -updatedAt: 2026-11-27T06:40:00.000Z | 9 | +updatedAt: 2026-11-27T10:30:00.000Z |
| 10 | +closedAt: 2026-11-27T10:30:00.000Z | ||
| 10 | labels: | 11 | labels: |
| 11 | - "kind::feature" | 12 | - "kind::feature" |
| 12 | - "area::tui" | 13 | - "area::tui" |
| @@ -40,12 +41,14 @@ body: | | |||
| 40 | tasks: | 41 | tasks: |
| 41 | - id: 1 | 42 | - id: 1 |
| 42 | title: Read IOAccelerator PerformanceStatistics on the Mac and check the keys on this machine's GPU / macOS version | 43 | title: Read IOAccelerator PerformanceStatistics on the Mac and check the keys on this machine's GPU / macOS version |
| 43 | - state: open | 44 | + state: closed |
| 44 | priority: medium | 45 | priority: medium |
| 45 | author: | 46 | author: |
| 46 | name: k33g | 47 | name: k33g |
| 47 | email: ph.charriere@gmail.com | 48 | email: ph.charriere@gmail.com |
| 48 | createdAt: 2026-11-24T05:48:30.000Z | 49 | createdAt: 2026-11-24T05:48:30.000Z |
| 50 | + updatedAt: 2026-11-27T10:30:00.000Z | ||
| 51 | + closedAt: 2026-11-27T10:30:00.000Z | ||
| 49 | - id: 2 | 52 | - id: 2 |
| 50 | title: Add GPU utilisation to the system monitor of #26 (Darwin implementation + fake) | 53 | title: Add GPU utilisation to the system monitor of #26 (Darwin implementation + fake) |
| 51 | state: closed | 54 | state: closed |
| @@ -82,3 +85,10 @@ comments: | |||
| 82 | body: | | 85 | body: | |
| 83 | Tasks 2-3 done (1dea285, docs bb36d60): SystemMonitor reads the highest "Device Utilization %" of the IOAccelerator services' PerformanceStatistics (IOKit, no root) on each status request; /rzb/status system.gpu_utilization, null when absent (Linux, or a GPU that does not publish the key); rzb tui shows "gpu N%" in the status bar and the Machine line, and hides it when null. The CLI stats part belonged to the removed agent. | 86 | Tasks 2-3 done (1dea285, docs bb36d60): SystemMonitor reads the highest "Device Utilization %" of the IOAccelerator services' PerformanceStatistics (IOKit, no root) on each status request; /rzb/status system.gpu_utilization, null when absent (Linux, or a GPU that does not publish the key); rzb tui shows "gpu N%" in the status bar and the Machine line, and hides it when null. The CLI stats part belonged to the removed agent. |
| 84 | Task 1 stays open: the code compiles and runs on the Mac, but whether this Mac's GPU publishes the key (and its value under load) was not seen yet — check during the manual tests (Dashboard while generating, or curl /rzb/status | jq .system). | 87 | Task 1 stays open: the code compiles and runs on the Mac, but whether this Mac's GPU publishes the key (and its value under load) was not seen yet — check during the manual tests (Dashboard while generating, or curl /rzb/status | jq .system). |
| 88 | + - id: 3 | ||
| 89 | + author: | ||
| 90 | + name: k33g | ||
| 91 | + email: ph.charriere@gmail.com | ||
| 92 | + createdAt: 2026-11-27T10:30:00.000Z | ||
| 93 | + body: | | ||
| 94 | + Task 1 checked by the user on the Mac (2026-11-27): the GPU load shows in rzb tui. The line was too full and got cut: the Dashboard's Machine line is now two lines (gpu, pressure, rzb footprint; then memory), and the status bar puts version, gpu, pressure, memory and model first, the address last (cut first on a narrow terminal). | ||
modified
Sources/RazorbillTUI/AppRenderer.swift +9 -7 | @@ -50,7 +50,7 @@ public struct AppRenderer: Sendable { | ||
| 50 | 50 | let keys = "Ctrl-T next · Ctrl-Q quit" |
| 51 | 51 | let (mark, text) = connectionText(state) |
| 52 | 52 | let left = TextLayout.truncate(text, width: max(0, width - 2)) |
| 53 | - let room = width - 2 - left.count - keys.count - 1 | |
| 53 | + let room = width - 2 - TextLayout.visibleCount(left) - keys.count - 1 | |
| 54 | 54 | let right = room >= 0 ? String(repeating: " ", count: room + 1) + style.dim(keys) : "" |
| 55 | 55 | return mark + " " + left + right |
| 56 | 56 | } |
| @@ -61,16 +61,18 @@ public struct AppRenderer: Sendable { | ||
| 61 | 61 | case .connecting: |
| 62 | 62 | return (style.dim("…"), "connecting to \(url)") |
| 63 | 63 | case .connected(let version): |
| 64 | - var parts = ["rzb \(version) at \(url)"] | |
| 65 | - if let model = state.model { parts.append(model) } | |
| 64 | + // Most useful first: what is cut when the terminal is narrow is the address, which the | |
| 65 | + // Dashboard also shows. | |
| 66 | + var parts = ["rzb \(version)"] | |
| 67 | + if let gpu = state.gpuUtilization { parts.append("gpu \(gpu)%") } | |
| 68 | + if let pressure = state.pressure { parts.append(self.pressure(pressure)) } | |
| 66 | 69 | if let memory = state.memory { |
| 67 | 70 | let used = Self.gigabytes(memory.used) |
| 68 | 71 | parts.append("memory \(used) / \(Self.gigabytes(memory.limit))") |
| 69 | 72 | } |
| 70 | - if let gpu = state.gpuUtilization { parts.append("gpu \(gpu)%") } | |
| 71 | - var text = parts.joined(separator: " · ") | |
| 72 | - if let pressure = state.pressure { text += " · " + self.pressure(pressure) } | |
| 73 | - return (style.green("●"), text) | |
| 73 | + if let model = state.model { parts.append(model) } | |
| 74 | + parts.append(url) | |
| 75 | + return (style.green("●"), parts.joined(separator: " · ")) | |
| 74 | 76 | case .unreachable: |
| 75 | 77 | return (style.red("○"), "no server at \(url) — start one with: rzb serve") |
| 76 | 78 | case .unauthorized: |
| @@ -50,7 +50,7 @@ public struct AppRenderer: Sendable { | |||
| 50 | let keys = "Ctrl-T next · Ctrl-Q quit" | 50 | let keys = "Ctrl-T next · Ctrl-Q quit" |
| 51 | let (mark, text) = connectionText(state) | 51 | let (mark, text) = connectionText(state) |
| 52 | let left = TextLayout.truncate(text, width: max(0, width - 2)) | 52 | let left = TextLayout.truncate(text, width: max(0, width - 2)) |
| 53 | - let room = width - 2 - left.count - keys.count - 1 | 53 | + let room = width - 2 - TextLayout.visibleCount(left) - keys.count - 1 |
| 54 | let right = room >= 0 ? String(repeating: " ", count: room + 1) + style.dim(keys) : "" | 54 | let right = room >= 0 ? String(repeating: " ", count: room + 1) + style.dim(keys) : "" |
| 55 | return mark + " " + left + right | 55 | return mark + " " + left + right |
| 56 | } | 56 | } |
| @@ -61,16 +61,18 @@ public struct AppRenderer: Sendable { | |||
| 61 | case .connecting: | 61 | case .connecting: |
| 62 | return (style.dim("…"), "connecting to \(url)") | 62 | return (style.dim("…"), "connecting to \(url)") |
| 63 | case .connected(let version): | 63 | case .connected(let version): |
| 64 | - var parts = ["rzb \(version) at \(url)"] | 64 | + // Most useful first: what is cut when the terminal is narrow is the address, which the |
| 65 | - if let model = state.model { parts.append(model) } | 65 | + // Dashboard also shows. |
| 66 | + var parts = ["rzb \(version)"] | ||
| 67 | + if let gpu = state.gpuUtilization { parts.append("gpu \(gpu)%") } | ||
| 68 | + if let pressure = state.pressure { parts.append(self.pressure(pressure)) } | ||
| 66 | if let memory = state.memory { | 69 | if let memory = state.memory { |
| 67 | let used = Self.gigabytes(memory.used) | 70 | let used = Self.gigabytes(memory.used) |
| 68 | parts.append("memory \(used) / \(Self.gigabytes(memory.limit))") | 71 | parts.append("memory \(used) / \(Self.gigabytes(memory.limit))") |
| 69 | } | 72 | } |
| 70 | - if let gpu = state.gpuUtilization { parts.append("gpu \(gpu)%") } | 73 | + if let model = state.model { parts.append(model) } |
| 71 | - var text = parts.joined(separator: " · ") | 74 | + parts.append(url) |
| 72 | - if let pressure = state.pressure { text += " · " + self.pressure(pressure) } | 75 | + return (style.green("●"), parts.joined(separator: " · ")) |
| 73 | - return (style.green("●"), text) | ||
| 74 | case .unreachable: | 76 | case .unreachable: |
| 75 | return (style.red("○"), "no server at \(url) — start one with: rzb serve") | 77 | return (style.red("○"), "no server at \(url) — start one with: rzb serve") |
| 76 | case .unauthorized: | 78 | case .unauthorized: |
modified
Sources/RazorbillTUI/DashboardScreen.swift +17 -8 | @@ -44,6 +44,7 @@ public struct DashboardScreen: Sendable, Equatable { | ||
| 44 | 44 | + " · \(snapshot.host):\(snapshot.port)", |
| 45 | 45 | " Memory " + Self.memory(snapshot.memory), |
| 46 | 46 | " Machine " + Self.machine(snapshot.system, style: style), |
| 47 | + " " + Self.machineMemory(snapshot.system), | |
| 47 | 48 | "", |
| 48 | 49 | style.bold(" Models") + style.dim(" ↑↓ select · u unload"), |
| 49 | 50 | style.dim(Self.modelHeader), |
| @@ -118,26 +119,34 @@ public struct DashboardScreen: Sendable, Equatable { | ||
| 118 | 119 | |
| 119 | 120 | /// `pressure normal · 18.2 GB available of 32.0 GB · compressed 1.1 GB · swap 0.0 GB · |
| 120 | 121 | /// rzb 4.1 GB · gpu 87%`, each part only when measured. |
| 122 | + /// The machine's first line, what changes while a model works: `gpu 87% · pressure normal · | |
| 123 | + /// rzb 4.1 GB`; each part only when measured. | |
| 121 | 124 | static func machine(_ system: MachineState?, style: Style) -> String { |
| 122 | 125 | guard let system else { return "not reported by this server" } |
| 123 | 126 | var parts: [String] = [] |
| 127 | + if let gpu = system.gpuUtilization { parts.append("gpu \(gpu)%") } | |
| 124 | 128 | if let pressure = system.pressure { |
| 125 | 129 | parts.append(AppRenderer(style: style).pressure(pressure)) |
| 126 | 130 | } |
| 131 | + if let process = system.processBytes { | |
| 132 | + parts.append("rzb \(AppRenderer.gigabytes(process))") | |
| 133 | + } | |
| 134 | + return parts.joined(separator: " · ") | |
| 135 | + } | |
| 136 | + | |
| 137 | + /// The machine's second line, its memory: `18.2 GB available of 32.0 GB · compressed 1.1 GB · | |
| 138 | + /// swap 0.0 GB`; empty when the server reports no machine. | |
| 139 | + static func machineMemory(_ system: MachineState?) -> String { | |
| 140 | + guard let system else { return "" } | |
| 127 | 141 | let total = AppRenderer.gigabytes(system.physicalBytes) |
| 128 | - if let available = system.availableBytes { | |
| 129 | - parts.append("\(AppRenderer.gigabytes(available)) available of \(total)") | |
| 130 | - } else { | |
| 131 | - parts.append("\(total) installed") | |
| 142 | + let available = system.availableBytes.map { | |
| 143 | + "\(AppRenderer.gigabytes($0)) available of \(total)" | |
| 132 | 144 | } |
| 145 | + var parts = [available ?? "\(total) installed"] | |
| 133 | 146 | if let compressed = system.compressedBytes { |
| 134 | 147 | parts.append("compressed \(AppRenderer.gigabytes(compressed))") |
| 135 | 148 | } |
| 136 | 149 | if let swap = system.swapUsedBytes { parts.append("swap \(AppRenderer.gigabytes(swap))") } |
| 137 | - if let process = system.processBytes { | |
| 138 | - parts.append("rzb \(AppRenderer.gigabytes(process))") | |
| 139 | - } | |
| 140 | - if let gpu = system.gpuUtilization { parts.append("gpu \(gpu)%") } | |
| 141 | 150 | return parts.joined(separator: " · ") |
| 142 | 151 | } |
| 143 | 152 | |
| @@ -44,6 +44,7 @@ public struct DashboardScreen: Sendable, Equatable { | |||
| 44 | + " · \(snapshot.host):\(snapshot.port)", | 44 | + " · \(snapshot.host):\(snapshot.port)", |
| 45 | " Memory " + Self.memory(snapshot.memory), | 45 | " Memory " + Self.memory(snapshot.memory), |
| 46 | " Machine " + Self.machine(snapshot.system, style: style), | 46 | " Machine " + Self.machine(snapshot.system, style: style), |
| 47 | + " " + Self.machineMemory(snapshot.system), | ||
| 47 | "", | 48 | "", |
| 48 | style.bold(" Models") + style.dim(" ↑↓ select · u unload"), | 49 | style.bold(" Models") + style.dim(" ↑↓ select · u unload"), |
| 49 | style.dim(Self.modelHeader), | 50 | style.dim(Self.modelHeader), |
| @@ -118,26 +119,34 @@ public struct DashboardScreen: Sendable, Equatable { | |||
| 118 | 119 | ||
| 119 | /// `pressure normal · 18.2 GB available of 32.0 GB · compressed 1.1 GB · swap 0.0 GB · | 120 | /// `pressure normal · 18.2 GB available of 32.0 GB · compressed 1.1 GB · swap 0.0 GB · |
| 120 | /// rzb 4.1 GB · gpu 87%`, each part only when measured. | 121 | /// rzb 4.1 GB · gpu 87%`, each part only when measured. |
| 122 | + /// The machine's first line, what changes while a model works: `gpu 87% · pressure normal · | ||
| 123 | + /// rzb 4.1 GB`; each part only when measured. | ||
| 121 | static func machine(_ system: MachineState?, style: Style) -> String { | 124 | static func machine(_ system: MachineState?, style: Style) -> String { |
| 122 | guard let system else { return "not reported by this server" } | 125 | guard let system else { return "not reported by this server" } |
| 123 | var parts: [String] = [] | 126 | var parts: [String] = [] |
| 127 | + if let gpu = system.gpuUtilization { parts.append("gpu \(gpu)%") } | ||
| 124 | if let pressure = system.pressure { | 128 | if let pressure = system.pressure { |
| 125 | parts.append(AppRenderer(style: style).pressure(pressure)) | 129 | parts.append(AppRenderer(style: style).pressure(pressure)) |
| 126 | } | 130 | } |
| 131 | + if let process = system.processBytes { | ||
| 132 | + parts.append("rzb \(AppRenderer.gigabytes(process))") | ||
| 133 | + } | ||
| 134 | + return parts.joined(separator: " · ") | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + /// The machine's second line, its memory: `18.2 GB available of 32.0 GB · compressed 1.1 GB · | ||
| 138 | + /// swap 0.0 GB`; empty when the server reports no machine. | ||
| 139 | + static func machineMemory(_ system: MachineState?) -> String { | ||
| 140 | + guard let system else { return "" } | ||
| 127 | let total = AppRenderer.gigabytes(system.physicalBytes) | 141 | let total = AppRenderer.gigabytes(system.physicalBytes) |
| 128 | - if let available = system.availableBytes { | 142 | + let available = system.availableBytes.map { |
| 129 | - parts.append("\(AppRenderer.gigabytes(available)) available of \(total)") | 143 | + "\(AppRenderer.gigabytes($0)) available of \(total)" |
| 130 | - } else { | ||
| 131 | - parts.append("\(total) installed") | ||
| 132 | } | 144 | } |
| 145 | + var parts = [available ?? "\(total) installed"] | ||
| 133 | if let compressed = system.compressedBytes { | 146 | if let compressed = system.compressedBytes { |
| 134 | parts.append("compressed \(AppRenderer.gigabytes(compressed))") | 147 | parts.append("compressed \(AppRenderer.gigabytes(compressed))") |
| 135 | } | 148 | } |
| 136 | if let swap = system.swapUsedBytes { parts.append("swap \(AppRenderer.gigabytes(swap))") } | 149 | if let swap = system.swapUsedBytes { parts.append("swap \(AppRenderer.gigabytes(swap))") } |
| 137 | - if let process = system.processBytes { | ||
| 138 | - parts.append("rzb \(AppRenderer.gigabytes(process))") | ||
| 139 | - } | ||
| 140 | - if let gpu = system.gpuUtilization { parts.append("gpu \(gpu)%") } | ||
| 141 | return parts.joined(separator: " · ") | 150 | return parts.joined(separator: " · ") |
| 142 | } | 151 | } |
| 143 | 152 | ||
modified
Tests/RazorbillTUITests/AppShellTests.swift +13 -1 | @@ -66,7 +66,7 @@ import Testing | ||
| 66 | 66 | state.memory = MemoryUse(used: 1 << 30, limit: 32 << 30) |
| 67 | 67 | #expect( |
| 68 | 68 | text(state)[5].hasPrefix( |
| 69 | - "● rzb 0.2.0 at http://127.0.0.1:7920 · qwen · memory 1.0 GB / 32.0 GB")) | |
| 69 | + "● rzb 0.2.0 · memory 1.0 GB / 32.0 GB · qwen · http://127.0.0.1:7920")) | |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | @Test(arguments: [ |
| @@ -80,6 +80,18 @@ import Testing | ||
| 80 | 80 | #expect(text(state)[5].hasPrefix(expected)) |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | + @Test func narrowTerminalCutsTheAddressFirst() { | |
| 84 | + var state = AppState(serverURL: "http://127.0.0.1:7920") | |
| 85 | + state.connection = .connected(version: "0.3.0") | |
| 86 | + state.gpuUtilization = 87 | |
| 87 | + state.pressure = "normal" | |
| 88 | + state.memory = MemoryUse(used: 1 << 30, limit: 32 << 30) | |
| 89 | + state.model = "qwen" | |
| 90 | + let status = text(state, columns: 60)[5] | |
| 91 | + #expect(status.hasPrefix("● rzb 0.3.0 · gpu 87% · pressure normal · memory 1.0 GB")) | |
| 92 | + #expect(status.hasSuffix("…") && !status.contains("http")) | |
| 93 | + } | |
| 94 | + | |
| 83 | 95 | @Test func narrowTerminalDropsTheKeysThenCutsTheText() { |
| 84 | 96 | var state = AppState(serverURL: "http://127.0.0.1:7920") |
| 85 | 97 | state.connection = .unreachable |
| @@ -66,7 +66,7 @@ import Testing | |||
| 66 | state.memory = MemoryUse(used: 1 << 30, limit: 32 << 30) | 66 | state.memory = MemoryUse(used: 1 << 30, limit: 32 << 30) |
| 67 | #expect( | 67 | #expect( |
| 68 | text(state)[5].hasPrefix( | 68 | text(state)[5].hasPrefix( |
| 69 | - "● rzb 0.2.0 at http://127.0.0.1:7920 · qwen · memory 1.0 GB / 32.0 GB")) | 69 | + "● rzb 0.2.0 · memory 1.0 GB / 32.0 GB · qwen · http://127.0.0.1:7920")) |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | @Test(arguments: [ | 72 | @Test(arguments: [ |
| @@ -80,6 +80,18 @@ import Testing | |||
| 80 | #expect(text(state)[5].hasPrefix(expected)) | 80 | #expect(text(state)[5].hasPrefix(expected)) |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | + @Test func narrowTerminalCutsTheAddressFirst() { | ||
| 84 | + var state = AppState(serverURL: "http://127.0.0.1:7920") | ||
| 85 | + state.connection = .connected(version: "0.3.0") | ||
| 86 | + state.gpuUtilization = 87 | ||
| 87 | + state.pressure = "normal" | ||
| 88 | + state.memory = MemoryUse(used: 1 << 30, limit: 32 << 30) | ||
| 89 | + state.model = "qwen" | ||
| 90 | + let status = text(state, columns: 60)[5] | ||
| 91 | + #expect(status.hasPrefix("● rzb 0.3.0 · gpu 87% · pressure normal · memory 1.0 GB")) | ||
| 92 | + #expect(status.hasSuffix("…") && !status.contains("http")) | ||
| 93 | + } | ||
| 94 | + | ||
| 83 | @Test func narrowTerminalDropsTheKeysThenCutsTheText() { | 95 | @Test func narrowTerminalDropsTheKeysThenCutsTheText() { |
| 84 | var state = AppState(serverURL: "http://127.0.0.1:7920") | 96 | var state = AppState(serverURL: "http://127.0.0.1:7920") |
| 85 | state.connection = .unreachable | 97 | state.connection = .unreachable |
modified
Tests/RazorbillTUITests/DashboardAndChatTests.swift +8 -5 | @@ -38,20 +38,23 @@ let plain = Style(colors: false) | ||
| 38 | 38 | physicalBytes: 32 << 30, pressure: "warning", availableBytes: 8 << 30, |
| 39 | 39 | compressedBytes: 1 << 30, swapUsedBytes: 0, processBytes: 4 << 30, gpuUtilization: 87) |
| 40 | 40 | var dashboard = DashboardScreen() |
| 41 | + let lines = render(&dashboard, status) | |
| 42 | + #expect(lines[2] == " Machine gpu 87% · pressure warning · rzb 4.0 GB") | |
| 41 | 43 | #expect( |
| 42 | - render(&dashboard, status)[2] | |
| 43 | - == " Machine pressure warning · 8.0 GB available of 32.0 GB · compressed 1.0 GB" | |
| 44 | - + " · swap 0.0 GB · rzb 4.0 GB · gpu 87%") | |
| 44 | + lines[3] == " 8.0 GB available of 32.0 GB · compressed 1.0 GB · swap 0.0 GB") | |
| 45 | 45 | #expect(DashboardScreen.machine(nil, style: plain) == "not reported by this server") |
| 46 | 46 | let linux = MachineState(physicalBytes: 16 << 30) |
| 47 | - #expect(DashboardScreen.machine(linux, style: plain) == "16.0 GB installed") | |
| 47 | + #expect(DashboardScreen.machine(linux, style: plain) == "") | |
| 48 | + #expect(DashboardScreen.machineMemory(linux) == "16.0 GB installed") | |
| 48 | 49 | var state = AppState(serverURL: "u") |
| 49 | 50 | state.connection = .connected(version: "0.3.0") |
| 50 | 51 | state.gpuUtilization = 87 |
| 51 | 52 | state.pressure = "critical" |
| 52 | 53 | let colored = AppRenderer(style: Style(colors: true)).render( |
| 53 | 54 | state, body: [], rows: 4, columns: 120) |
| 54 | - #expect(colored.lines[3].contains("gpu 87% · \u{1B}[31mpressure critical\u{1B}[0m")) | |
| 55 | + let critical = "rzb 0.3.0 · gpu 87% · \u{1B}[31mpressure critical\u{1B}[0m" | |
| 56 | + #expect(colored.lines[3].contains(critical)) | |
| 57 | + #expect(colored.lines[3].contains("Ctrl-T next")) | |
| 55 | 58 | } |
| 56 | 59 | |
| 57 | 60 | @Test func arrowsSelectAndUUnloadsTheSelectedModel() { |
| @@ -38,20 +38,23 @@ let plain = Style(colors: false) | |||
| 38 | physicalBytes: 32 << 30, pressure: "warning", availableBytes: 8 << 30, | 38 | physicalBytes: 32 << 30, pressure: "warning", availableBytes: 8 << 30, |
| 39 | compressedBytes: 1 << 30, swapUsedBytes: 0, processBytes: 4 << 30, gpuUtilization: 87) | 39 | compressedBytes: 1 << 30, swapUsedBytes: 0, processBytes: 4 << 30, gpuUtilization: 87) |
| 40 | var dashboard = DashboardScreen() | 40 | var dashboard = DashboardScreen() |
| 41 | + let lines = render(&dashboard, status) | ||
| 42 | + #expect(lines[2] == " Machine gpu 87% · pressure warning · rzb 4.0 GB") | ||
| 41 | #expect( | 43 | #expect( |
| 42 | - render(&dashboard, status)[2] | 44 | + lines[3] == " 8.0 GB available of 32.0 GB · compressed 1.0 GB · swap 0.0 GB") |
| 43 | - == " Machine pressure warning · 8.0 GB available of 32.0 GB · compressed 1.0 GB" | ||
| 44 | - + " · swap 0.0 GB · rzb 4.0 GB · gpu 87%") | ||
| 45 | #expect(DashboardScreen.machine(nil, style: plain) == "not reported by this server") | 45 | #expect(DashboardScreen.machine(nil, style: plain) == "not reported by this server") |
| 46 | let linux = MachineState(physicalBytes: 16 << 30) | 46 | let linux = MachineState(physicalBytes: 16 << 30) |
| 47 | - #expect(DashboardScreen.machine(linux, style: plain) == "16.0 GB installed") | 47 | + #expect(DashboardScreen.machine(linux, style: plain) == "") |
| 48 | + #expect(DashboardScreen.machineMemory(linux) == "16.0 GB installed") | ||
| 48 | var state = AppState(serverURL: "u") | 49 | var state = AppState(serverURL: "u") |
| 49 | state.connection = .connected(version: "0.3.0") | 50 | state.connection = .connected(version: "0.3.0") |
| 50 | state.gpuUtilization = 87 | 51 | state.gpuUtilization = 87 |
| 51 | state.pressure = "critical" | 52 | state.pressure = "critical" |
| 52 | let colored = AppRenderer(style: Style(colors: true)).render( | 53 | let colored = AppRenderer(style: Style(colors: true)).render( |
| 53 | state, body: [], rows: 4, columns: 120) | 54 | state, body: [], rows: 4, columns: 120) |
| 54 | - #expect(colored.lines[3].contains("gpu 87% · \u{1B}[31mpressure critical\u{1B}[0m")) | 55 | + let critical = "rzb 0.3.0 · gpu 87% · \u{1B}[31mpressure critical\u{1B}[0m" |
| 56 | + #expect(colored.lines[3].contains(critical)) | ||
| 57 | + #expect(colored.lines[3].contains("Ctrl-T next")) | ||
| 55 | } | 58 | } |
| 56 | 59 | ||
| 57 | @Test func arrowsSelectAndUUnloadsTheSelectedModel() { | 60 | @Test func arrowsSelectAndUUnloadsTheSelectedModel() { |
modified
Tests/RazorbillTUITests/TUIAppTests.swift +1 -1 | @@ -132,7 +132,7 @@ func waitForScreen(_ terminal: FakeTerminal, containing text: String) async thro | ||
| 132 | 132 | try await waitForScreen(terminal, containing: "idle 7s, unloads in 9m 52s") |
| 133 | 133 | #expect( |
| 134 | 134 | terminal.lastText.last?.hasPrefix( |
| 135 | - "● rzb 0.2.0 at http://127.0.0.1:7920 · qwen · memory 1.0 GB / 32.0 GB") == true) | |
| 135 | + "● rzb 0.2.0 · memory 1.0 GB / 32.0 GB · qwen · http://127.0.0.1:7920") == true) | |
| 136 | 136 | terminal.press(.control("q")) |
| 137 | 137 | await running.value |
| 138 | 138 | #expect(terminal.enterCount == 1 && terminal.leaveCount == 1) |
| @@ -132,7 +132,7 @@ func waitForScreen(_ terminal: FakeTerminal, containing text: String) async thro | |||
| 132 | try await waitForScreen(terminal, containing: "idle 7s, unloads in 9m 52s") | 132 | try await waitForScreen(terminal, containing: "idle 7s, unloads in 9m 52s") |
| 133 | #expect( | 133 | #expect( |
| 134 | terminal.lastText.last?.hasPrefix( | 134 | terminal.lastText.last?.hasPrefix( |
| 135 | - "● rzb 0.2.0 at http://127.0.0.1:7920 · qwen · memory 1.0 GB / 32.0 GB") == true) | 135 | + "● rzb 0.2.0 · memory 1.0 GB / 32.0 GB · qwen · http://127.0.0.1:7920") == true) |
| 136 | terminal.press(.control("q")) | 136 | terminal.press(.control("q")) |
| 137 | await running.value | 137 | await running.value |
| 138 | #expect(terminal.enterCount == 1 && terminal.leaveCount == 1) | 138 | #expect(terminal.enterCount == 1 && terminal.leaveCount == 1) |
modified
docs/en/reference/tui.md +2 -2 | @@ -13,7 +13,7 @@ | ||
| 13 | 13 | | Mark in the last row | Meaning | |
| 14 | 14 | | --- | --- | |
| 15 | 15 | | `…` | Waiting for the server's first answer | |
| 16 | -| `●` | Connected: the server's version and address, the first loaded model, the engine's memory in use over its limit, the GPU load, the memory pressure (green normal, yellow warning, red critical) | | |
| 16 | +| `●` | Connected, in this order: the server's version, the GPU load, the memory pressure (green normal, yellow warning, red critical), the engine's memory in use over its limit, the first loaded model, the server's address. A narrow terminal cuts the end first | | |
| 17 | 17 | | `○` | No server answers; every screen shows the `rzb serve` command to run (with `--config` when `rzb tui` got one) | |
| 18 | 18 | | `✕` | The server refused the API key (401), or it is on another machine (403 `local_only`) | |
| 19 | 19 | |
| @@ -32,7 +32,7 @@ Memory and sizes are in GB of 2³⁰ bytes. | ||
| 32 | 32 | |
| 33 | 33 | ## Dashboard (F2) |
| 34 | 34 | |
| 35 | -The server's version, uptime and address; the engine's memory as a gauge of active over limit, with cache and peak (`not reported by this engine` on Linux); the machine (memory pressure, available memory over installed, compressed memory, swap, the server's footprint as `rzb …`, GPU load; each part only when the server can measure it); the loaded models; the last requests. | |
| 35 | +The server's version, uptime and address; the engine's memory as a gauge of active over limit, with cache and peak (`not reported by this engine` on Linux); the machine on two lines (GPU load, memory pressure and the server's footprint as `rzb …`; then available memory over installed, compressed memory and swap; each part only when the server can measure it); the loaded models; the last requests. | |
| 36 | 36 | |
| 37 | 37 | | Models column | Content | |
| 38 | 38 | | --- | --- | |
| @@ -13,7 +13,7 @@ | |||
| 13 | | Mark in the last row | Meaning | | 13 | | Mark in the last row | Meaning | |
| 14 | | --- | --- | | 14 | | --- | --- | |
| 15 | | `…` | Waiting for the server's first answer | | 15 | | `…` | Waiting for the server's first answer | |
| 16 | -| `●` | Connected: the server's version and address, the first loaded model, the engine's memory in use over its limit, the GPU load, the memory pressure (green normal, yellow warning, red critical) | | 16 | +| `●` | Connected, in this order: the server's version, the GPU load, the memory pressure (green normal, yellow warning, red critical), the engine's memory in use over its limit, the first loaded model, the server's address. A narrow terminal cuts the end first | |
| 17 | | `○` | No server answers; every screen shows the `rzb serve` command to run (with `--config` when `rzb tui` got one) | | 17 | | `○` | No server answers; every screen shows the `rzb serve` command to run (with `--config` when `rzb tui` got one) | |
| 18 | | `✕` | The server refused the API key (401), or it is on another machine (403 `local_only`) | | 18 | | `✕` | The server refused the API key (401), or it is on another machine (403 `local_only`) | |
| 19 | 19 | ||
| @@ -32,7 +32,7 @@ Memory and sizes are in GB of 2³⁰ bytes. | |||
| 32 | 32 | ||
| 33 | ## Dashboard (F2) | 33 | ## Dashboard (F2) |
| 34 | 34 | ||
| 35 | -The server's version, uptime and address; the engine's memory as a gauge of active over limit, with cache and peak (`not reported by this engine` on Linux); the machine (memory pressure, available memory over installed, compressed memory, swap, the server's footprint as `rzb …`, GPU load; each part only when the server can measure it); the loaded models; the last requests. | 35 | +The server's version, uptime and address; the engine's memory as a gauge of active over limit, with cache and peak (`not reported by this engine` on Linux); the machine on two lines (GPU load, memory pressure and the server's footprint as `rzb …`; then available memory over installed, compressed memory and swap; each part only when the server can measure it); the loaded models; the last requests. |
| 36 | 36 | ||
| 37 | | Models column | Content | | 37 | | Models column | Content | |
| 38 | | --- | --- | | 38 | | --- | --- | |
modified
docs/fr/reference/tui.md +2 -2 | @@ -13,7 +13,7 @@ | ||
| 13 | 13 | | Signe de la dernière ligne | Signification | |
| 14 | 14 | | --- | --- | |
| 15 | 15 | | `…` | En attente de la première réponse du serveur | |
| 16 | -| `●` | Connecté : la version et l'adresse du serveur, le premier modèle chargé, la mémoire du moteur utilisée sur sa limite, la charge du GPU, la pression mémoire (vert normal, jaune warning, rouge critical) | | |
| 16 | +| `●` | Connecté, dans cet ordre : la version du serveur, la charge du GPU, la pression mémoire (vert normal, jaune warning, rouge critical), la mémoire du moteur utilisée sur sa limite, le premier modèle chargé, l'adresse du serveur. Un terminal étroit coupe d'abord la fin | | |
| 17 | 17 | | `○` | Aucun serveur ne répond ; chaque écran donne la commande `rzb serve` à lancer (avec `--config` quand `rzb tui` en a reçu un) | |
| 18 | 18 | | `✕` | Le serveur a refusé la clé d'API (401), ou il est sur une autre machine (403 `local_only`) | |
| 19 | 19 | |
| @@ -32,7 +32,7 @@ Les mémoires et les tailles sont en Go de 2³⁰ octets. | ||
| 32 | 32 | |
| 33 | 33 | ## Dashboard (F2) |
| 34 | 34 | |
| 35 | -La version, la durée de fonctionnement et l'adresse du serveur ; la mémoire du moteur en jauge (active sur limite), avec le cache et le maximum (`not reported by this engine` sous Linux) ; la machine (pression mémoire, mémoire disponible sur installée, mémoire compressée, swap, empreinte du serveur sous la forme `rzb …`, charge du GPU ; chaque partie seulement quand le serveur sait la mesurer) ; les modèles chargés ; les dernières requêtes. | |
| 35 | +La version, la durée de fonctionnement et l'adresse du serveur ; la mémoire du moteur en jauge (active sur limite), avec le cache et le maximum (`not reported by this engine` sous Linux) ; la machine sur deux lignes (charge du GPU, pression mémoire et empreinte du serveur sous la forme `rzb …` ; puis mémoire disponible sur installée, mémoire compressée et swap ; chaque partie seulement quand le serveur sait la mesurer) ; les modèles chargés ; les dernières requêtes. | |
| 36 | 36 | |
| 37 | 37 | | Colonne des modèles | Contenu | |
| 38 | 38 | | --- | --- | |
| @@ -13,7 +13,7 @@ | |||
| 13 | | Signe de la dernière ligne | Signification | | 13 | | Signe de la dernière ligne | Signification | |
| 14 | | --- | --- | | 14 | | --- | --- | |
| 15 | | `…` | En attente de la première réponse du serveur | | 15 | | `…` | En attente de la première réponse du serveur | |
| 16 | -| `●` | Connecté : la version et l'adresse du serveur, le premier modèle chargé, la mémoire du moteur utilisée sur sa limite, la charge du GPU, la pression mémoire (vert normal, jaune warning, rouge critical) | | 16 | +| `●` | Connecté, dans cet ordre : la version du serveur, la charge du GPU, la pression mémoire (vert normal, jaune warning, rouge critical), la mémoire du moteur utilisée sur sa limite, le premier modèle chargé, l'adresse du serveur. Un terminal étroit coupe d'abord la fin | |
| 17 | | `○` | Aucun serveur ne répond ; chaque écran donne la commande `rzb serve` à lancer (avec `--config` quand `rzb tui` en a reçu un) | | 17 | | `○` | Aucun serveur ne répond ; chaque écran donne la commande `rzb serve` à lancer (avec `--config` quand `rzb tui` en a reçu un) | |
| 18 | | `✕` | Le serveur a refusé la clé d'API (401), ou il est sur une autre machine (403 `local_only`) | | 18 | | `✕` | Le serveur a refusé la clé d'API (401), ou il est sur une autre machine (403 `local_only`) | |
| 19 | 19 | ||
| @@ -32,7 +32,7 @@ Les mémoires et les tailles sont en Go de 2³⁰ octets. | |||
| 32 | 32 | ||
| 33 | ## Dashboard (F2) | 33 | ## Dashboard (F2) |
| 34 | 34 | ||
| 35 | -La version, la durée de fonctionnement et l'adresse du serveur ; la mémoire du moteur en jauge (active sur limite), avec le cache et le maximum (`not reported by this engine` sous Linux) ; la machine (pression mémoire, mémoire disponible sur installée, mémoire compressée, swap, empreinte du serveur sous la forme `rzb …`, charge du GPU ; chaque partie seulement quand le serveur sait la mesurer) ; les modèles chargés ; les dernières requêtes. | 35 | +La version, la durée de fonctionnement et l'adresse du serveur ; la mémoire du moteur en jauge (active sur limite), avec le cache et le maximum (`not reported by this engine` sous Linux) ; la machine sur deux lignes (charge du GPU, pression mémoire et empreinte du serveur sous la forme `rzb …` ; puis mémoire disponible sur installée, mémoire compressée et swap ; chaque partie seulement quand le serveur sait la mesurer) ; les modèles chargés ; les dernières requêtes. |
| 36 | 36 | ||
| 37 | | Colonne des modèles | Contenu | | 37 | | Colonne des modèles | Contenu | |
| 38 | | --- | --- | | 38 | | --- | --- | |