@danielng23/dsh-studio-host-system-metrics 0.1.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.
@@ -0,0 +1,148 @@
1
+ /** Wire vocabulary for the system-monitor Host Remote. */
2
+ /** Point-in-time host resource snapshot for the terminal-shell monitor. */
3
+ export interface SystemMetricsSnapshot {
4
+ /** 1-, 5-, and 15-minute load averages in platform units. */
5
+ readonly loadavg: readonly [number, number, number];
6
+ /** Average CPU busy ratio since boot across all cores, 0..1. */
7
+ readonly cpuBusyRatio: number;
8
+ /** Total physical memory in bytes. */
9
+ readonly totalMemoryBytes: number;
10
+ /** Free physical memory in bytes. */
11
+ readonly freeMemoryBytes: number;
12
+ /** Seconds since the host process's machine booted. */
13
+ readonly uptimeSeconds: number;
14
+ /** Wall-clock capture time in epoch milliseconds. */
15
+ readonly timestamp: number;
16
+ }
17
+ /** One logical core's cumulative tick counts (node:os cpus()[i].times). */
18
+ export interface CoreTimes {
19
+ readonly user: number;
20
+ readonly nice: number;
21
+ readonly sys: number;
22
+ readonly idle: number;
23
+ readonly irq: number;
24
+ }
25
+ /** One top-process row (CPU-sorted). */
26
+ export interface ProcessSample {
27
+ readonly pid: number;
28
+ readonly name: string;
29
+ readonly cpuPct: number;
30
+ readonly memPct: number;
31
+ }
32
+ /** Best-effort static hardware identity (cached after the first read). */
33
+ export interface HardwareInfo {
34
+ readonly manufacturer: string;
35
+ readonly model: string;
36
+ readonly chassis: string;
37
+ }
38
+ /** Rich system overview for the left system panel. */
39
+ export interface SystemOverview {
40
+ /** Wall-clock capture time in epoch milliseconds. */
41
+ readonly timestamp: number;
42
+ /** Host platform identifier (darwin/linux/win32/...). */
43
+ readonly platform: string;
44
+ /** Seconds since the host process's machine booted. */
45
+ readonly uptimeSeconds: number;
46
+ /** 1-, 5-, and 15-minute load averages in platform units. */
47
+ readonly loadavg: readonly [number, number, number];
48
+ /** Physical memory totals. */
49
+ readonly memory: {
50
+ readonly totalBytes: number;
51
+ readonly usedBytes: number;
52
+ };
53
+ /** Swap totals (zeros when the platform exposes none). */
54
+ readonly swap: {
55
+ readonly totalBytes: number;
56
+ readonly usedBytes: number;
57
+ };
58
+ /** One entry per logical core: cumulative tick counts; the client computes deltas. */
59
+ readonly cores: readonly CoreTimes[];
60
+ /** CPU thermal level (0..100 on macOS; °C on Linux) when readable, else null. */
61
+ readonly thermalLevel: number | null;
62
+ /** Power state ('CHARGE' | 'AC' | 'BATTERY') when readable, else null. */
63
+ readonly powerState: string | null;
64
+ /** Static hardware identity (best-effort). */
65
+ readonly hardware: HardwareInfo;
66
+ /** Total active process count. */
67
+ readonly tasks: number;
68
+ /** Top processes by CPU, descending. */
69
+ readonly processes: readonly ProcessSample[];
70
+ /** Active network interface status (best-effort). */
71
+ readonly network: NetworkInfo;
72
+ /** Storage usage of the process cwd mount (best-effort). */
73
+ readonly storage: StorageInfo;
74
+ }
75
+ /** Active network interface status. */
76
+ export interface NetworkInfo {
77
+ /** Active interface name (e.g. en0, tun0); '—' when none is found. */
78
+ readonly interfaceName: string;
79
+ /** 'IPv4 ONLINE' when the interface has an IPv4 address, else 'IPv4 OFFLINE'. */
80
+ readonly state: string;
81
+ /** The interface's IPv4 address, or null. */
82
+ readonly ip: string | null;
83
+ /** Round-trip ping to 8.8.8.8 in ms, or null when unreachable. */
84
+ readonly pingMs: number | null;
85
+ /** Cumulative received bytes (client computes throughput deltas). */
86
+ readonly rxBytes: number;
87
+ /** Cumulative transmitted bytes (client computes throughput deltas). */
88
+ readonly txBytes: number;
89
+ }
90
+ /** Storage usage of one mount (best-effort). */
91
+ export interface StorageInfo {
92
+ /** The probed path (the process cwd). */
93
+ readonly path: string;
94
+ readonly totalBytes: number;
95
+ readonly usedBytes: number;
96
+ readonly usedPct: number;
97
+ }
98
+ /** One filesystem entry. */
99
+ export interface DirectoryEntry {
100
+ readonly name: string;
101
+ readonly isDirectory: boolean;
102
+ }
103
+ /** One directory listing result. */
104
+ export interface DirectoryListing {
105
+ /** The requested path. */
106
+ readonly path: string;
107
+ readonly entries: readonly DirectoryEntry[];
108
+ /** Present when the path could not be listed (access/permission/not-found). */
109
+ readonly error: string | null;
110
+ }
111
+ /** One file-preview result for the bottom-right preview pane. */
112
+ export interface FilePreview {
113
+ /** The requested absolute path. */
114
+ readonly path: string;
115
+ /** How the browser should render the content. */
116
+ readonly kind: 'text' | 'image' | 'video' | 'unsupported';
117
+ /** Guessed MIME type ('' when unknown). */
118
+ readonly mime: string;
119
+ /** Total file size in bytes (before truncation). */
120
+ readonly sizeBytes: number;
121
+ /** True when the payload was capped (text 4 MiB / image 4 MiB / video 12 MiB). */
122
+ readonly truncated: boolean;
123
+ /** UTF-8 text content (kind 'text'), else null. */
124
+ readonly text: string | null;
125
+ /** data: URL payload (kind 'image'/'video'), else null. */
126
+ readonly dataUrl: string | null;
127
+ /** Present when the file could not be read (access/permission/not-found). */
128
+ readonly error: string | null;
129
+ }
130
+ /** One file-write result for the bottom-right editor's save path. */
131
+ export interface WriteResult {
132
+ /** The requested absolute path. */
133
+ readonly path: string;
134
+ /** Bytes written (the UTF-8 byte length of the persisted content). */
135
+ readonly sizeBytes: number;
136
+ /** Present when the file could not be written (access/permission/not-found). */
137
+ readonly error: string | null;
138
+ }
139
+ /** One shell command result for the bottom-right terminal panel. */
140
+ export interface CommandResult {
141
+ /** Captured stdout (capped at 4 MiB). */
142
+ readonly stdout: string;
143
+ /** Captured stderr (capped at 4 MiB). */
144
+ readonly stderr: string;
145
+ /** Process exit code; null when the command could not be started (or was killed by the timeout). */
146
+ readonly exitCode: number | null;
147
+ }
148
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,2 @@
1
+ /** Wire vocabulary for the system-monitor Host Remote. */
2
+ export {};
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@danielng23/dsh-studio-host-system-metrics",
3
+ "description": "Studio console host metrics Remote: system overview, processes, filesystem, command execution",
4
+ "version": "0.1.0",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/ph4310822/dsh-edex-studio-ui.git",
11
+ "directory": "packages/host/system-metrics"
12
+ },
13
+ "type": "module",
14
+ "main": "lib/index.js",
15
+ "types": "lib/types/index.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./lib/types/index.d.ts",
19
+ "default": "./lib/index.js"
20
+ },
21
+ "./invariant": {
22
+ "types": "./lib/types/invariant.d.ts",
23
+ "default": "./lib/invariant.js"
24
+ },
25
+ "./types": {
26
+ "types": "./lib/types/types.d.ts",
27
+ "default": "./lib/types/types.js"
28
+ },
29
+ "./typert": {
30
+ "types": "./lib/typert.host.d.ts",
31
+ "default": "./lib/typert.host.js"
32
+ },
33
+ "./remote": {
34
+ "types": "./lib/typert.remote-client.d.ts",
35
+ "default": "./lib/typert.remote-client.js"
36
+ },
37
+ "./src/*": "./src/*",
38
+ "./package.json": "./package.json"
39
+ },
40
+ "files": [
41
+ "lib/index.js",
42
+ "lib/invariant.js",
43
+ "lib/types/**/*.js",
44
+ "lib/types/**/*.d.ts",
45
+ "lib/typert.host.js",
46
+ "lib/typert.host.d.ts",
47
+ "lib/typert.remote-client.js",
48
+ "lib/typert.remote-client.d.ts"
49
+ ],
50
+ "license": "MIT",
51
+ "dependencies": {
52
+ "zod": "^4.4.3"
53
+ },
54
+ "peerDependencies": {
55
+ "@deepseek-ai/dsh-invariants": "*",
56
+ "@deepseek-ai/dsh-typert-protocol": "*",
57
+ "@deepseek-ai/cordis": "*"
58
+ },
59
+ "devDependencies": {
60
+ "@deepseek-ai/dsh-invariants": "*",
61
+ "@deepseek-ai/dsh-typert-protocol": "*",
62
+ "@deepseek-ai/cordis": "*"
63
+ }
64
+ }