@appkit/llamacpp-cli 1.4.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +87 -1
  3. package/dist/cli.js +14 -0
  4. package/dist/cli.js.map +1 -1
  5. package/dist/commands/monitor.d.ts +2 -0
  6. package/dist/commands/monitor.d.ts.map +1 -0
  7. package/dist/commands/monitor.js +76 -0
  8. package/dist/commands/monitor.js.map +1 -0
  9. package/dist/lib/metrics-aggregator.d.ts +39 -0
  10. package/dist/lib/metrics-aggregator.d.ts.map +1 -0
  11. package/dist/lib/metrics-aggregator.js +200 -0
  12. package/dist/lib/metrics-aggregator.js.map +1 -0
  13. package/dist/lib/system-collector.d.ts +75 -0
  14. package/dist/lib/system-collector.d.ts.map +1 -0
  15. package/dist/lib/system-collector.js +310 -0
  16. package/dist/lib/system-collector.js.map +1 -0
  17. package/dist/tui/MonitorApp.d.ts +4 -0
  18. package/dist/tui/MonitorApp.d.ts.map +1 -0
  19. package/dist/tui/MonitorApp.js +293 -0
  20. package/dist/tui/MonitorApp.js.map +1 -0
  21. package/dist/tui/MultiServerMonitorApp.d.ts +4 -0
  22. package/dist/tui/MultiServerMonitorApp.d.ts.map +1 -0
  23. package/dist/tui/MultiServerMonitorApp.js +496 -0
  24. package/dist/tui/MultiServerMonitorApp.js.map +1 -0
  25. package/dist/tui/components/ErrorState.d.ts +8 -0
  26. package/dist/tui/components/ErrorState.d.ts.map +1 -0
  27. package/dist/tui/components/ErrorState.js +22 -0
  28. package/dist/tui/components/ErrorState.js.map +1 -0
  29. package/dist/tui/components/LoadingState.d.ts +8 -0
  30. package/dist/tui/components/LoadingState.d.ts.map +1 -0
  31. package/dist/tui/components/LoadingState.js +21 -0
  32. package/dist/tui/components/LoadingState.js.map +1 -0
  33. package/dist/types/monitor-types.d.ts +122 -0
  34. package/dist/types/monitor-types.d.ts.map +1 -0
  35. package/dist/types/monitor-types.js +3 -0
  36. package/dist/types/monitor-types.js.map +1 -0
  37. package/dist/utils/process-utils.d.ts +16 -1
  38. package/dist/utils/process-utils.d.ts.map +1 -1
  39. package/dist/utils/process-utils.js +144 -27
  40. package/dist/utils/process-utils.js.map +1 -1
  41. package/package.json +3 -1
  42. package/src/cli.ts +14 -0
  43. package/src/commands/monitor.ts +90 -0
  44. package/src/lib/metrics-aggregator.ts +244 -0
  45. package/src/lib/system-collector.ts +312 -0
  46. package/src/tui/MonitorApp.ts +361 -0
  47. package/src/tui/MultiServerMonitorApp.ts +547 -0
  48. package/src/types/monitor-types.ts +161 -0
  49. package/src/utils/process-utils.ts +160 -26
package/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
4
4
 
5
+ ## [1.5.0](https://github.com/appkitstudio/llamacpp-cli/compare/v1.4.1...v1.5.0) (2026-01-13)
6
+
7
+
8
+ ### Features
9
+
10
+ * add multi-server monitor with optimized metrics collection ([9deaf2b](https://github.com/appkitstudio/llamacpp-cli/commit/9deaf2b12280304a0941b0da82a0838d2a80bf6a))
11
+ * add real-time monitoring TUI with GPU/CPU metrics ([5f762f5](https://github.com/appkitstudio/llamacpp-cli/commit/5f762f542817e405fd05c1fe3282a4621456c068))
12
+
5
13
  ## [1.4.1](https://github.com/appkitstudio/llamacpp-cli/compare/v1.4.0...v1.4.1) (2026-01-09)
6
14
 
7
15
 
package/README.md CHANGED
@@ -15,7 +15,7 @@ CLI tool to manage local llama.cpp servers on macOS. Provides an Ollama-like exp
15
15
  - 🤖 **Model downloads** - Pull GGUF models from Hugging Face
16
16
  - ⚙️ **Smart defaults** - Auto-configure threads, context size, and GPU layers based on model size
17
17
  - 🔌 **Auto port assignment** - Automatically find available ports (9000-9999)
18
- - 📊 **Status monitoring** - Real-time server status with memory usage and uptime tracking
18
+ - 📊 **Real-time monitoring TUI** - Live server metrics with GPU/CPU usage, token generation speeds, and active slots
19
19
  - 🪵 **Smart logging** - Compact one-line request format with optional full JSON details
20
20
 
21
21
  ## Why llamacpp-cli?
@@ -76,6 +76,12 @@ llamacpp server create llama-3.2-3b-instruct-q4_k_m.gguf
76
76
  # View running servers
77
77
  llamacpp ps
78
78
 
79
+ # Monitor all servers (multi-server dashboard)
80
+ llamacpp server monitor
81
+
82
+ # Or monitor a specific server
83
+ llamacpp server monitor llama-3.2-3b
84
+
79
85
  # Chat with your model interactively
80
86
  llamacpp server run llama-3.2-3b
81
87
 
@@ -451,6 +457,86 @@ The compact format shows one line per HTTP request and includes:
451
457
 
452
458
  Use `--http` to see full request/response JSON, or `--verbose` option to see all internal server logs.
453
459
 
460
+ ### `llamacpp server monitor [identifier]`
461
+ Real-time monitoring TUI showing server metrics, GPU/CPU usage, and active inference slots.
462
+
463
+ **Two Modes:**
464
+
465
+ **1. Multi-Server Dashboard (no identifier):**
466
+ ```bash
467
+ llamacpp server monitor
468
+ ```
469
+ Shows overview of all servers with system resources. Press 1-9 to drill down into individual server details.
470
+
471
+ **2. Single-Server Monitor (with identifier):**
472
+ ```bash
473
+ # Monitor by partial name
474
+ llamacpp server monitor llama-3.2-3b
475
+
476
+ # Monitor by port
477
+ llamacpp server monitor 9000
478
+
479
+ # Monitor by server ID
480
+ llamacpp server monitor llama-3-2-3b
481
+ ```
482
+
483
+ **Multi-Server Dashboard:**
484
+ ```
485
+ ┌─────────────────────────────────────────────────────────┐
486
+ │ System Resources │
487
+ │ GPU: [████░░░] 65% CPU: [███░░░] 38% Memory: 58% │
488
+ ├─────────────────────────────────────────────────────────┤
489
+ │ Servers (3 running, 0 stopped) │
490
+ │ # │ Server ID │ Port │ Status │ Slots │ tok/s │
491
+ │───┼────────────────┼──────┼────────┼───────┼──────────┤
492
+ │ 1 │ llama-3-2-3b │ 9000 │ ● RUN │ 2/4 │ 245 │
493
+ │ 2 │ qwen2-7b │ 9001 │ ● RUN │ 1/4 │ 198 │
494
+ │ 3 │ llama-3-1-8b │ 9002 │ ○ IDLE │ 0/4 │ - │
495
+ └─────────────────────────────────────────────────────────┘
496
+ Press 1-9 for details | [Q] Quit
497
+ ```
498
+
499
+ **Single-Server View:**
500
+ - **Server Information** - Status, uptime, model name, endpoint, slot counts
501
+ - **Request Metrics** - Active/idle slots, prompt speed, generation speed
502
+ - **Active Slots** - Per-slot token generation rates and progress
503
+ - **System Resources** - GPU/CPU/ANE utilization, memory usage, temperature
504
+
505
+ **Keyboard Shortcuts:**
506
+ - **Multi-Server Mode:**
507
+ - `1-9` - View details for server #N
508
+ - `ESC` - Back to list (from detail view)
509
+ - `R` - Force refresh now
510
+ - `+/-` - Adjust update speed
511
+ - `Q` - Quit
512
+ - **Single-Server Mode:**
513
+ - `R` - Force refresh now
514
+ - `+/-` - Adjust update speed
515
+ - `Q` - Quit
516
+
517
+ **Features:**
518
+ - **Multi-server dashboard** - Monitor all servers at once
519
+ - **Real-time updates** - Metrics refresh every 2 seconds (adjustable)
520
+ - **Token-per-second calculation** - Shows actual generation speed per slot
521
+ - **Progress bars** - Visual representation of GPU/CPU/memory usage
522
+ - **Error recovery** - Shows stale data with warnings if connection lost
523
+ - **Graceful degradation** - Works without GPU metrics (uses memory-only mode)
524
+
525
+ **Optional: GPU/CPU Metrics**
526
+
527
+ For GPU and CPU utilization metrics, install macmon:
528
+ ```bash
529
+ brew install vladkens/tap/macmon
530
+ ```
531
+
532
+ Without macmon, the monitor still shows:
533
+ - ✅ Server status and uptime
534
+ - ✅ Active slots and token generation speeds
535
+ - ✅ Memory usage (via built-in vm_stat)
536
+ - ❌ GPU/CPU/ANE utilization (requires macmon)
537
+
538
+ **Identifiers:** Port number, server ID, or partial model name
539
+
454
540
  ## Configuration
455
541
 
456
542
  llamacpp-cli stores its configuration in `~/.llamacpp/`:
package/dist/cli.js CHANGED
@@ -21,6 +21,7 @@ const show_1 = require("./commands/show");
21
21
  const server_show_1 = require("./commands/server-show");
22
22
  const config_1 = require("./commands/config");
23
23
  const config_global_1 = require("./commands/config-global");
24
+ const monitor_1 = require("./commands/monitor");
24
25
  const package_json_1 = __importDefault(require("../package.json"));
25
26
  const program = new commander_1.Command();
26
27
  program
@@ -268,6 +269,19 @@ server
268
269
  process.exit(1);
269
270
  }
270
271
  });
272
+ // Monitor server
273
+ server
274
+ .command('monitor [identifier]')
275
+ .description('Monitor server with real-time metrics TUI')
276
+ .action(async (identifier) => {
277
+ try {
278
+ await (0, monitor_1.monitorCommand)(identifier);
279
+ }
280
+ catch (error) {
281
+ console.error(chalk_1.default.red('❌ Error:'), error.message);
282
+ process.exit(1);
283
+ }
284
+ });
271
285
  // Parse arguments
272
286
  program.parse();
273
287
  //# sourceMappingURL=cli.js.map
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;AAEA,yCAAoC;AACpC,kDAA0B;AAC1B,0CAA8C;AAC9C,sCAA0C;AAC1C,8CAAkD;AAClD,4CAAgD;AAChD,wCAA4C;AAC5C,0CAA8C;AAC9C,8CAAkD;AAClD,0CAA8C;AAC9C,sCAA0C;AAC1C,0CAA8C;AAC9C,8CAAkD;AAClD,0CAA8C;AAC9C,wDAA2D;AAC3D,8CAAwD;AACxD,4DAA+D;AAC/D,mEAA0C;AAE1C,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,UAAU,CAAC;KAChB,WAAW,CAAC,qDAAqD,CAAC;KAClE,OAAO,CAAC,sBAAW,CAAC,OAAO,CAAC,CAAC;AAEhC,cAAc;AACd,OAAO;KACJ,OAAO,CAAC,IAAI,CAAC;KACb,WAAW,CAAC,4BAA4B,CAAC;KACzC,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,IAAI,CAAC;QACH,MAAM,IAAA,kBAAW,GAAE,CAAC;IACtB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OA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AC"}
@@ -0,0 +1,2 @@
1
+ export declare function monitorCommand(identifier?: string): Promise<void>;
2
+ //# sourceMappingURL=monitor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"monitor.d.ts","sourceRoot":"","sources":["../../src/commands/monitor.ts"],"names":[],"mappings":"AAMA,wBAAsB,cAAc,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAmFvE"}
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.monitorCommand = monitorCommand;
7
+ const blessed_1 = __importDefault(require("blessed"));
8
+ const state_manager_js_1 = require("../lib/state-manager.js");
9
+ const MonitorApp_js_1 = require("../tui/MonitorApp.js");
10
+ const MultiServerMonitorApp_js_1 = require("../tui/MultiServerMonitorApp.js");
11
+ async function monitorCommand(identifier) {
12
+ // Initialize state manager
13
+ await state_manager_js_1.stateManager.initialize();
14
+ // Get all servers
15
+ const allServers = await state_manager_js_1.stateManager.getAllServers();
16
+ if (allServers.length === 0) {
17
+ throw new Error(`No servers configured.\n\n` +
18
+ `Create a server first: llamacpp server create <model>`);
19
+ }
20
+ // Create blessed screen
21
+ const screen = blessed_1.default.screen({
22
+ smartCSR: true,
23
+ title: 'llama.cpp Server Monitor',
24
+ });
25
+ // Determine which UI to launch
26
+ if (identifier) {
27
+ // User specified a server - single server mode
28
+ const server = await state_manager_js_1.stateManager.findServer(identifier);
29
+ if (!server) {
30
+ screen.destroy();
31
+ throw new Error(`Server not found: ${identifier}\n\n` +
32
+ `Use: llamacpp ps\n` +
33
+ `Or create a new server: llamacpp server create <model>`);
34
+ }
35
+ // Check if server is running
36
+ if (server.status !== 'running') {
37
+ screen.destroy();
38
+ throw new Error(`Server ${server.modelName} is not running.\n\n` +
39
+ `Start it first: llamacpp server start ${server.id}`);
40
+ }
41
+ // Launch single-server TUI
42
+ await (0, MonitorApp_js_1.createMonitorUI)(screen, server);
43
+ }
44
+ else if (allServers.length === 1) {
45
+ // Only one server - single server mode
46
+ const server = allServers[0];
47
+ // Check if server is running
48
+ if (server.status !== 'running') {
49
+ screen.destroy();
50
+ throw new Error(`Server ${server.modelName} is not running.\n\n` +
51
+ `Start it first: llamacpp server start ${server.id}`);
52
+ }
53
+ // Launch single-server TUI
54
+ await (0, MonitorApp_js_1.createMonitorUI)(screen, server);
55
+ }
56
+ else {
57
+ // Multiple servers - multi-server mode
58
+ // Filter to only running servers for monitoring
59
+ const runningServers = allServers.filter(s => s.status === 'running');
60
+ if (runningServers.length === 0) {
61
+ screen.destroy();
62
+ throw new Error(`No servers are currently running.\n\n` +
63
+ `Start a server first:\n` +
64
+ allServers
65
+ .map((s) => ` llamacpp server start ${s.id} # ${s.modelName}`)
66
+ .join('\n'));
67
+ }
68
+ // Launch multi-server TUI
69
+ await (0, MultiServerMonitorApp_js_1.createMultiServerMonitorUI)(screen, allServers);
70
+ }
71
+ // Render the screen
72
+ screen.render();
73
+ // Note: TUI functions handle their own key events and exit directly
74
+ // The process will stay alive until user presses Q/Ctrl+C
75
+ }
76
+ //# sourceMappingURL=monitor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"monitor.js","sourceRoot":"","sources":["../../src/commands/monitor.ts"],"names":[],"mappings":";;;;;AAMA,wCAmFC;AAxFD,sDAA8B;AAC9B,8DAAuD;AACvD,wDAAuD;AACvD,8EAA6E;AAEtE,KAAK,UAAU,cAAc,CAAC,UAAmB;IACtD,2BAA2B;IAC3B,MAAM,+BAAY,CAAC,UAAU,EAAE,CAAC;IAEhC,kBAAkB;IAClB,MAAM,UAAU,GAAG,MAAM,+BAAY,CAAC,aAAa,EAAE,CAAC;IACtD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CACb,4BAA4B;YAC1B,uDAAuD,CAC1D,C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AC;QACN,uCAAuC;QACvC,gDAAgD;QAChD,MAAM,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC;QAEtE,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAChC,MAAM,CAAC,OAAO,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CACb,uCAAuC;gBACrC,yBAAyB;gBACzB,UAAU;qBACP,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,2BAA2B,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,SAAS,EAAE,CAAC;qBAC/D,IAAI,CAAC,IAAI,CAAC,CAChB,CAAC;QACJ,CAAC;QAED,0BAA0B;QAC1B,MAAM,IAAA,qDAA0B,EAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACvD,CAAC;IAED,oBAAoB;IACpB,MAAM,CAAC,MAAM,EAAE,CAAC;IAEhB,oEAAoE;IACpE,0DAA0D;AAC5D,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { ServerConfig } from '../types/server-config.js';
2
+ import { ServerMetrics, MonitorData } from '../types/monitor-types.js';
3
+ /**
4
+ * Aggregates metrics from llama.cpp server API endpoints
5
+ * Combines server health, slot status, and model properties
6
+ */
7
+ export declare class MetricsAggregator {
8
+ private serverUrl;
9
+ private timeout;
10
+ private previousSlots;
11
+ constructor(server: ServerConfig, timeout?: number);
12
+ /**
13
+ * Fetch data from llama.cpp API with timeout
14
+ */
15
+ private fetchWithTimeout;
16
+ /**
17
+ * Get server health status
18
+ */
19
+ private getHealth;
20
+ /**
21
+ * Get server properties (model info, context size, etc.)
22
+ */
23
+ private getProps;
24
+ /**
25
+ * Get active slots information with calculated tok/s
26
+ */
27
+ private getSlots;
28
+ /**
29
+ * Aggregate all server metrics
30
+ * @param server - Server configuration
31
+ * @param processMemory - Optional pre-fetched process memory (for batch collection)
32
+ */
33
+ collectServerMetrics(server: ServerConfig, processMemory?: number | null): Promise<ServerMetrics>;
34
+ /**
35
+ * Collect complete monitoring data (server + system metrics)
36
+ */
37
+ collectMonitorData(server: ServerConfig, updateInterval?: number): Promise<MonitorData>;
38
+ }
39
+ //# sourceMappingURL=metrics-aggregator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metrics-aggregator.d.ts","sourceRoot":"","sources":["../../src/lib/metrics-aggregator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAY,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAKjF;;;GAGG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,aAAa,CAAoE;gBAE7E,MAAM,EAAE,YAAY,EAAE,OAAO,GAAE,MAAa;IAOxD;;OAEG;YACW,gBAAgB;IA0B9B;;OAEG;YACW,SAAS;IAKvB;;OAEG;YACW,QAAQ;IAItB;;OAEG;YACW,QAAQ;IAyDtB;;;;OAIG;IACG,oBAAoB,CACxB,MAAM,EAAE,YAAY,EACpB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,GAC5B,OAAO,CAAC,aAAa,CAAC;IAwFzB;;OAEG;IACG,kBAAkB,CACtB,MAAM,EAAE,YAAY,EACpB,cAAc,GAAE,MAAa,GAC5B,OAAO,CAAC,WAAW,CAAC;CAexB"}
@@ -0,0 +1,200 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MetricsAggregator = void 0;
4
+ const status_checker_js_1 = require("./status-checker.js");
5
+ const system_collector_js_1 = require("./system-collector.js");
6
+ const process_utils_js_1 = require("../utils/process-utils.js");
7
+ /**
8
+ * Aggregates metrics from llama.cpp server API endpoints
9
+ * Combines server health, slot status, and model properties
10
+ */
11
+ class MetricsAggregator {
12
+ constructor(server, timeout = 5000) {
13
+ this.previousSlots = new Map();
14
+ // Handle null host (legacy configs) by defaulting to 127.0.0.1
15
+ const host = server.host || '127.0.0.1';
16
+ this.serverUrl = `http://${host}:${server.port}`;
17
+ this.timeout = timeout;
18
+ }
19
+ /**
20
+ * Fetch data from llama.cpp API with timeout
21
+ */
22
+ async fetchWithTimeout(endpoint, customTimeout) {
23
+ try {
24
+ const controller = new AbortController();
25
+ const timeoutMs = customTimeout ?? this.timeout;
26
+ const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
27
+ const response = await fetch(`${this.serverUrl}${endpoint}`, {
28
+ signal: controller.signal,
29
+ });
30
+ clearTimeout(timeoutId);
31
+ if (!response.ok) {
32
+ return null;
33
+ }
34
+ return await response.json();
35
+ }
36
+ catch (err) {
37
+ // Network error, timeout, or parse error
38
+ return null;
39
+ }
40
+ }
41
+ /**
42
+ * Get server health status
43
+ */
44
+ async getHealth() {
45
+ const health = await this.fetchWithTimeout('/health');
46
+ return health !== null && health.status === 'ok';
47
+ }
48
+ /**
49
+ * Get server properties (model info, context size, etc.)
50
+ */
51
+ async getProps() {
52
+ return await this.fetchWithTimeout('/props');
53
+ }
54
+ /**
55
+ * Get active slots information with calculated tok/s
56
+ */
57
+ async getSlots() {
58
+ const data = await this.fetchWithTimeout('/slots');
59
+ if (!data || !Array.isArray(data)) {
60
+ return [];
61
+ }
62
+ const now = Date.now();
63
+ return data.map((slot) => {
64
+ const slotId = slot.id;
65
+ const n_decoded = slot.next_token?.[0]?.n_decoded || 0;
66
+ const isProcessing = slot.is_processing;
67
+ // Calculate tokens per second by comparing with previous poll
68
+ let predicted_per_second;
69
+ if (isProcessing && n_decoded > 0) {
70
+ const previous = this.previousSlots.get(slotId);
71
+ if (previous && previous.n_decoded < n_decoded) {
72
+ const tokensGenerated = n_decoded - previous.n_decoded;
73
+ const timeElapsed = (now - previous.timestamp) / 1000; // Convert to seconds
74
+ if (timeElapsed > 0) {
75
+ predicted_per_second = tokensGenerated / timeElapsed;
76
+ }
77
+ }
78
+ // Store current state for next comparison
79
+ this.previousSlots.set(slotId, { n_decoded, timestamp: now });
80
+ }
81
+ else if (!isProcessing) {
82
+ // Clear history when slot becomes idle
83
+ this.previousSlots.delete(slotId);
84
+ }
85
+ return {
86
+ id: slotId,
87
+ state: isProcessing ? 'processing' : 'idle',
88
+ n_prompt_tokens: slot.n_prompt_tokens,
89
+ n_decoded,
90
+ n_ctx: slot.n_ctx || 0,
91
+ timings: predicted_per_second
92
+ ? {
93
+ prompt_n: 0,
94
+ prompt_ms: 0,
95
+ prompt_per_token_ms: 0,
96
+ prompt_per_second: 0,
97
+ predicted_n: n_decoded,
98
+ predicted_ms: 0,
99
+ predicted_per_token_ms: 0,
100
+ predicted_per_second,
101
+ }
102
+ : undefined,
103
+ };
104
+ });
105
+ }
106
+ /**
107
+ * Aggregate all server metrics
108
+ * @param server - Server configuration
109
+ * @param processMemory - Optional pre-fetched process memory (for batch collection)
110
+ */
111
+ async collectServerMetrics(server, processMemory) {
112
+ const now = Date.now();
113
+ // Check basic server status first
114
+ const status = await status_checker_js_1.statusChecker.checkServer(server);
115
+ // Calculate uptime if server is running and has lastStarted
116
+ let uptime;
117
+ if (status.isRunning && server.lastStarted) {
118
+ const startTime = new Date(server.lastStarted).getTime();
119
+ const uptimeSeconds = Math.floor((now - startTime) / 1000);
120
+ const hours = Math.floor(uptimeSeconds / 3600);
121
+ const minutes = Math.floor((uptimeSeconds % 3600) / 60);
122
+ const seconds = uptimeSeconds % 60;
123
+ uptime = `${hours}h ${minutes}m ${seconds}s`;
124
+ }
125
+ // If server not running, return minimal data
126
+ if (!status.isRunning) {
127
+ return {
128
+ server,
129
+ healthy: false,
130
+ modelLoaded: false,
131
+ modelName: server.modelName,
132
+ contextSize: server.ctxSize,
133
+ totalSlots: 0,
134
+ activeSlots: 0,
135
+ idleSlots: 0,
136
+ slots: [],
137
+ timestamp: now,
138
+ stale: false,
139
+ };
140
+ }
141
+ // Fetch detailed metrics in parallel
142
+ // If processMemory was pre-fetched (batch mode), use it; otherwise fetch individually
143
+ const [healthy, props, slots, fetchedMemory] = await Promise.all([
144
+ this.getHealth(),
145
+ this.getProps(),
146
+ this.getSlots(),
147
+ processMemory !== undefined
148
+ ? Promise.resolve(processMemory)
149
+ : (server.pid ? (0, process_utils_js_1.getProcessMemory)(server.pid) : Promise.resolve(null)),
150
+ ]);
151
+ // Calculate slot statistics
152
+ const activeSlots = slots.filter((s) => s.state === 'processing').length;
153
+ const idleSlots = slots.filter((s) => s.state === 'idle').length;
154
+ const totalSlots = props?.total_slots || slots.length;
155
+ // Calculate average speeds (only from processing slots)
156
+ const processingSlots = slots.filter((s) => s.state === 'processing' && s.timings);
157
+ const avgPromptSpeed = processingSlots.length > 0
158
+ ? processingSlots.reduce((sum, s) => sum + (s.timings?.prompt_per_second || 0), 0) / processingSlots.length
159
+ : undefined;
160
+ const avgGenerateSpeed = processingSlots.length > 0
161
+ ? processingSlots.reduce((sum, s) => sum + (s.timings?.predicted_per_second || 0), 0) / processingSlots.length
162
+ : undefined;
163
+ return {
164
+ server,
165
+ healthy,
166
+ uptime,
167
+ modelLoaded: props !== null,
168
+ modelName: server.modelName,
169
+ contextSize: props?.default_generation_settings?.n_ctx || server.ctxSize,
170
+ totalSlots,
171
+ activeSlots,
172
+ idleSlots,
173
+ slots,
174
+ avgPromptSpeed,
175
+ avgGenerateSpeed,
176
+ processMemory: fetchedMemory ?? undefined,
177
+ timestamp: now,
178
+ stale: false,
179
+ };
180
+ }
181
+ /**
182
+ * Collect complete monitoring data (server + system metrics)
183
+ */
184
+ async collectMonitorData(server, updateInterval = 2000) {
185
+ // Collect server and system metrics in parallel
186
+ const [serverMetrics, systemMetrics] = await Promise.all([
187
+ this.collectServerMetrics(server),
188
+ system_collector_js_1.systemCollector.collectSystemMetrics(),
189
+ ]);
190
+ return {
191
+ server: serverMetrics,
192
+ system: systemMetrics,
193
+ lastUpdated: new Date(),
194
+ updateInterval,
195
+ consecutiveFailures: 0,
196
+ };
197
+ }
198
+ }
199
+ exports.MetricsAggregator = MetricsAggregator;
200
+ //# sourceMappingURL=metrics-aggregator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metrics-aggregator.js","sourceRoot":"","sources":["../../src/lib/metrics-aggregator.ts"],"names":[],"mappings":";;;AAEA,2DAAoD;AACpD,+DAAwD;AACxD,gEAA6D;AAE7D;;;GAGG;AACH,MAAa,iBAAiB;IAK5B,YAAY,MAAoB,EAAE,UAAkB,IAAI;QAFhD,kBAAa,GAA0D,IAAI,GAAG,EAAE,CAAC;QAGvF,+DAA+D;QAC/D,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,WAAW,CAAC;QACxC,IAAI,CAAC,SAAS,GAAG,UAAU,IAAI,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;QACjD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,gBAAgB,CAC5B,QAAgB,EAChB,aAAsB;QAEtB,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;YACzC,MAAM,SAAS,GAAG,aAAa,IAAI,IAAI,CAAC,OAAO,CAAC;YAChD,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,SAAS,CAAC,CAAC;YAElE,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,GAAG,QAAQ,EAAE,EAAE;gBAC3D,MAAM,EAAE,UAAU,CAAC,MAAM;aAC1B,CAAC,CAAC;YAEH,YAAY,CAAC,SAAS,CAAC,CAAC;YAExB,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,OAAO,IAAI,CAAC;YACd,CAAC;YAED,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC/B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,yCAAyC;YACzC,OAAO,IAAI,CAAC;QACd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,CAAC,CAAC,SAAS,CAAC;QAEhB,OAAO;YACL,MAAM;YACN,OAAO;YACP,MAAM;YACN,WAAW,EAAE,KAAK,KAAK,IAAI;YAC3B,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,WAAW,EAAE,KAAK,EAAE,2BAA2B,EAAE,KAAK,IAAI,MAAM,CAAC,OAAO;YACxE,UAAU;YACV,WAAW;YACX,SAAS;YACT,KAAK;YACL,cAAc;YACd,gBAAgB;YAChB,aAAa,EAAE,aAAa,IAAI,SAAS;YACzC,SAAS,EAAE,GAAG;YACd,KAAK,EAAE,KAAK;SACb,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,kBAAkB,CACtB,MAAoB,EACpB,iBAAyB,IAAI;QAE7B,gDAAgD;QAChD,MAAM,CAAC,aAAa,EAAE,aAAa,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YACvD,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC;YACjC,qCAAe,CAAC,oBAAoB,EAAE;SACvC,CAAC,CAAC;QAEH,OAAO;YACL,MAAM,EAAE,aAAa;YACrB,MAAM,EAAE,aAAa;YACrB,WAAW,EAAE,IAAI,IAAI,EAAE;YACvB,cAAc;YACd,mBAAmB,EAAE,CAAC;SACvB,CAAC;IACJ,CAAC;CACF;AAzOD,8CAyOC"}
@@ -0,0 +1,75 @@
1
+ import { SystemMetrics } from '../types/monitor-types.js';
2
+ /**
3
+ * System metrics collector using macmon (optional) and vm_stat (fallback)
4
+ * Provides GPU, CPU, ANE, and memory metrics on macOS
5
+ */
6
+ export declare class SystemCollector {
7
+ private macmonPath;
8
+ private macmonAvailable;
9
+ private lastSystemMetrics;
10
+ private lastCollectionTime;
11
+ private readonly CACHE_TTL_MS;
12
+ private collectingLock;
13
+ private pCoreCount;
14
+ private eCoreCount;
15
+ private totalCores;
16
+ constructor(macmonPath?: string);
17
+ /**
18
+ * Get CPU core counts for weighted average calculation
19
+ */
20
+ private initializeCoreCount;
21
+ /**
22
+ * Check if macmon is available
23
+ */
24
+ private checkMacmonAvailability;
25
+ /**
26
+ * Parse macmon JSON output
27
+ * Expected format from 'macmon pipe':
28
+ * {
29
+ * "gpu_usage": [count, percentage],
30
+ * "pcpu_usage": [count, percentage],
31
+ * "ecpu_usage": [count, percentage],
32
+ * "ane_power": number,
33
+ * "temp": {"cpu_temp_avg": number, "gpu_temp_avg": number}
34
+ * }
35
+ */
36
+ private parseMacmonJson;
37
+ /**
38
+ * Collect macmon metrics (GPU, CPU, ANE)
39
+ * Uses 'macmon pipe' which outputs one JSON line per update
40
+ * Spawns macmon, reads one line, and kills it to prevent process leaks
41
+ */
42
+ private getMacmonMetrics;
43
+ /**
44
+ * Parse vm_stat output for memory metrics
45
+ * Expected format:
46
+ * Pages free: 123456.
47
+ * Pages active: 234567.
48
+ * Pages inactive: 345678.
49
+ * Pages speculative: 45678.
50
+ * Pages throttled: 0.
51
+ * Pages wired down: 123456.
52
+ * Pages purgeable count: 0.
53
+ * "Translation faults": 12345678.
54
+ * Pages copy-on-write: 123456.
55
+ * ...
56
+ */
57
+ private parseVmStatOutput;
58
+ /**
59
+ * Collect vm_stat memory metrics
60
+ */
61
+ private getVmStatMetrics;
62
+ /**
63
+ * Collect all system metrics
64
+ * Attempts macmon first (GPU/CPU/ANE + memory), falls back to vm_stat (memory only)
65
+ * Caches results for 1.5s to prevent spawning multiple macmon processes
66
+ */
67
+ collectSystemMetrics(): Promise<SystemMetrics>;
68
+ /**
69
+ * Internal method to actually collect system metrics
70
+ * Called by collectSystemMetrics with caching/locking
71
+ */
72
+ private doCollectSystemMetrics;
73
+ }
74
+ export declare const systemCollector: SystemCollector;
75
+ //# sourceMappingURL=system-collector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system-collector.d.ts","sourceRoot":"","sources":["../../src/lib/system-collector.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D;;;GAGG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,eAAe,CAAwB;IAC/C,OAAO,CAAC,iBAAiB,CAA8B;IACvD,OAAO,CAAC,kBAAkB,CAAa;IACvC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAQ;IACrC,OAAO,CAAC,cAAc,CAAuC;IAC7D,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,UAAU,CAAa;gBAEnB,UAAU,GAAE,MAAmC;IAK3D;;OAEG;YACW,mBAAmB;IA4BjC;;OAEG;YACW,uBAAuB;IAerC;;;;;;;;;;OAUG;IACH,OAAO,CAAC,eAAe;IAiDvB;;;;OAIG;YACW,gBAAgB;IA2B9B;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,iBAAiB;IA6CzB;;OAEG;YACW,gBAAgB;IAa9B;;;;OAIG;IACG,oBAAoB,IAAI,OAAO,CAAC,aAAa,CAAC;IA0BpD;;;OAGG;YACW,sBAAsB;CAkCrC;AAGD,eAAO,MAAM,eAAe,iBAAwB,CAAC"}