@ebowwa/codespaces-types 1.4.1 → 1.4.2

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.
package/compile/index.js CHANGED
@@ -1,126 +1,256 @@
1
- "use strict";
2
- /**
3
- * Shared type definitions for frontend and server
4
- */
5
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- var desc = Object.getOwnPropertyDescriptor(m, k);
8
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
- desc = { enumerable: true, get: function() { return m[k]; } };
10
- }
11
- Object.defineProperty(o, k2, desc);
12
- }) : (function(o, m, k, k2) {
13
- if (k2 === undefined) k2 = k;
14
- o[k2] = m[k];
15
- }));
16
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
17
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1
+ // @bun
2
+ var __create = Object.create;
3
+ var __getProtoOf = Object.getPrototypeOf;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __reExport = (target, mod, secondTarget) => {
8
+ for (let key of __getOwnPropNames(mod))
9
+ if (!__hasOwnProp.call(target, key) && key !== "default")
10
+ __defProp(target, key, {
11
+ get: () => mod[key],
12
+ enumerable: true
13
+ });
14
+ if (secondTarget) {
15
+ for (let key of __getOwnPropNames(mod))
16
+ if (!__hasOwnProp.call(secondTarget, key) && key !== "default")
17
+ __defProp(secondTarget, key, {
18
+ get: () => mod[key],
19
+ enumerable: true
20
+ });
21
+ return secondTarget;
22
+ }
23
+ };
24
+ var __toESM = (mod, isNodeMode, target) => {
25
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
26
+ const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
27
+ for (let key of __getOwnPropNames(mod))
28
+ if (!__hasOwnProp.call(to, key))
29
+ __defProp(to, key, {
30
+ get: () => mod[key],
31
+ enumerable: true
32
+ });
33
+ return to;
18
34
  };
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.LoopStatus = exports.VolumeStatus = exports.ActionStatus = exports.EnvironmentStatus = void 0;
21
- exports.getEnvLocation = getEnvLocation;
22
- exports.getEnvRegionName = getEnvRegionName;
23
- exports.getEnvLocationLabel = getEnvLocationLabel;
24
- // ============================================================================
25
- // WebSocket Types (shared between terminal and frontend)
26
- // ============================================================================
27
- __exportStar(require("./terminal-websocket.js"), exports);
28
- // ============================================================================
29
- // Resources (parse and validate resource specs)
30
- // ============================================================================
31
- __exportStar(require("./resources.js"), exports);
32
- // ============================================================================
33
- // Application Types
34
- // ============================================================================
35
- // ============================================================================
36
- // Shared Status Enums
37
- // ============================================================================
38
- /**
39
- * Environment status - used by Environment interface and HetznerServer mapping
40
- *
41
- * Hetzner API returns: "running" | "stopped" | "starting" | "stopping" | "initializing"
42
- * Environment uses subset: "running" | "stopped" | "creating" | "deleting"
43
- *
44
- * Mapping:
45
- * - "running" → "running"
46
- * - "stopped" → "stopped"
47
- * - "starting" → "creating"
48
- * - "stopping" → "deleting"
49
- * - "initializing" → "creating"
50
- */
35
+ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
36
+ var __export = (target, all) => {
37
+ for (var name in all)
38
+ __defProp(target, name, {
39
+ get: all[name],
40
+ enumerable: true,
41
+ configurable: true,
42
+ set: (newValue) => all[name] = () => newValue
43
+ });
44
+ };
45
+
46
+ // compile/terminal-websocket.js
47
+ var require_terminal_websocket = __commonJS((exports) => {
48
+ Object.defineProperty(exports, "__esModule", { value: true });
49
+ exports.WebSocketCloseCode = undefined;
50
+ exports.WebSocketCloseCode = {
51
+ NORMAL_CLOSURE: 1000,
52
+ ENDPOINT_GOING_AWAY: 1001,
53
+ PROTOCOL_ERROR: 1002,
54
+ UNSUPPORTED_DATA: 1003,
55
+ NO_STATUS_RECEIVED: 1005,
56
+ ABNORMAL_CLOSURE: 1006,
57
+ INVALID_FRAME_PAYLOAD_DATA: 1007,
58
+ POLICY_VIOLATION: 1008,
59
+ MESSAGE_TOO_BIG: 1009,
60
+ MISSING_MANDATORY_EXTENSION: 1010,
61
+ INTERNAL_ERROR: 1011,
62
+ SERVICE_RESTART: 1012,
63
+ TRY_AGAIN_LATER: 1013,
64
+ SESSION_NOT_FOUND: 4001,
65
+ SESSION_ALREADY_CLOSED: 4002,
66
+ INVALID_MESSAGE_FORMAT: 4003,
67
+ AUTHENTICATION_FAILED: 4004,
68
+ CONNECTION_TIMEOUT: 4005,
69
+ SESSION_LIMIT_REACHED: 4006,
70
+ INVALID_HOST: 4007,
71
+ SSH_CONNECTION_FAILED: 4008,
72
+ NETWORK_BLOCKED: 4009
73
+ };
74
+ });
75
+
76
+ // compile/resources.js
77
+ var require_resources = __commonJS((exports) => {
78
+ var __assign = exports && exports.__assign || function() {
79
+ __assign = Object.assign || function(t) {
80
+ for (var s, i = 1, n = arguments.length;i < n; i++) {
81
+ s = arguments[i];
82
+ for (var p in s)
83
+ if (Object.prototype.hasOwnProperty.call(s, p))
84
+ t[p] = s[p];
85
+ }
86
+ return t;
87
+ };
88
+ return __assign.apply(this, arguments);
89
+ };
90
+ Object.defineProperty(exports, "__esModule", { value: true });
91
+ exports.parseCPU = parseCPU;
92
+ exports.parseMemory = parseMemory;
93
+ exports.parseDisk = parseDisk;
94
+ exports.parseGPU = parseGPU;
95
+ exports.parseResources = parseResources;
96
+ function parseCPU(raw) {
97
+ if (!raw || typeof raw !== "string") {
98
+ return 0;
99
+ }
100
+ var num = parseFloat(raw);
101
+ if (isNaN(num)) {
102
+ console.warn("Invalid CPU value:", raw);
103
+ return 0;
104
+ }
105
+ return Math.round(num * 10) / 10;
106
+ }
107
+ function parseMemory(raw) {
108
+ if (!raw || typeof raw !== "string") {
109
+ return { percent: 0, used: "0 GB", total: "0 GB" };
110
+ }
111
+ var parts = raw.split(/\s+/);
112
+ if (parts.length < 3) {
113
+ console.warn("Invalid memory output:", raw);
114
+ return { percent: 0, used: "0 GB", total: "0 GB" };
115
+ }
116
+ return {
117
+ percent: Math.round(parseFloat(parts[0]) * 10) / 10,
118
+ used: "".concat((parseFloat(parts[1]) || 0).toFixed(1), " GB"),
119
+ total: "".concat((parseFloat(parts[2]) || 0).toFixed(1), " GB")
120
+ };
121
+ }
122
+ function parseDisk(raw) {
123
+ var _a;
124
+ if (!raw || typeof raw !== "string") {
125
+ return { percent: 0, used: "0 GB", total: "0 GB" };
126
+ }
127
+ var parts = raw.split(/\s+/);
128
+ var percent = parseFloat(((_a = parts[0]) === null || _a === undefined ? undefined : _a.replace("%", "")) || "0") || 0;
129
+ var formatSize = function(size) {
130
+ if (size.endsWith("G") || size.endsWith("M") || size.endsWith("K")) {
131
+ return size.replace(/([GMK])$/, " $1B");
132
+ }
133
+ return size;
134
+ };
135
+ return {
136
+ percent: Math.round(percent),
137
+ used: formatSize(parts[1] || "0 GB"),
138
+ total: formatSize(parts[2] || "0 GB")
139
+ };
140
+ }
141
+ function parseGPU(raw) {
142
+ if (!raw || raw === "NOGPU" || raw === "0" || !raw.trim()) {
143
+ return;
144
+ }
145
+ var parts = raw.split(",").map(function(s) {
146
+ return s.trim();
147
+ });
148
+ if (parts.length < 3) {
149
+ console.warn("Invalid GPU output:", raw);
150
+ return;
151
+ }
152
+ return {
153
+ gpuPercent: parseFloat(parts[0]) || 0,
154
+ gpuMemoryUsed: "".concat((parseFloat(parts[1]) / 1024).toFixed(1), " GB"),
155
+ gpuMemoryTotal: "".concat((parseFloat(parts[2]) / 1024).toFixed(1), " GB")
156
+ };
157
+ }
158
+ function parseResources(raw) {
159
+ var cpu = parseCPU(raw.cpu);
160
+ var memory = parseMemory(raw.memory);
161
+ var disk = parseDisk(raw.disk);
162
+ var gpu = parseGPU(raw.gpu);
163
+ return __assign({
164
+ cpu,
165
+ memory: memory.percent,
166
+ disk: disk.percent,
167
+ gpu: raw.gpu,
168
+ network: raw.network,
169
+ loadavg: raw.loadavg,
170
+ processes: raw.processes,
171
+ connections: raw.connections,
172
+ ports: raw.ports,
173
+ cpuPercent: cpu,
174
+ memoryPercent: memory.percent,
175
+ memoryUsed: memory.used,
176
+ memoryTotal: memory.total,
177
+ diskPercent: disk.percent,
178
+ diskUsed: disk.used,
179
+ diskTotal: disk.total
180
+ }, gpu && {
181
+ gpuPercent: gpu.gpuPercent,
182
+ gpuMemoryUsed: gpu.gpuMemoryUsed,
183
+ gpuMemoryTotal: gpu.gpuMemoryTotal
184
+ });
185
+ }
186
+ });
187
+
188
+ // compile/index.ts
189
+ var exports_compile = {};
190
+ __export(exports_compile, {
191
+ getEnvRegionName: () => getEnvRegionName,
192
+ getEnvLocationLabel: () => getEnvLocationLabel,
193
+ getEnvLocation: () => getEnvLocation,
194
+ VolumeStatus: () => VolumeStatus,
195
+ LoopStatus: () => LoopStatus,
196
+ EnvironmentStatus: () => EnvironmentStatus,
197
+ ActionStatus: () => ActionStatus
198
+ });
199
+ __reExport(exports_compile, __toESM(require_terminal_websocket(), 1));
200
+ __reExport(exports_compile, __toESM(require_resources(), 1));
51
201
  var EnvironmentStatus;
52
- (function (EnvironmentStatus) {
53
- EnvironmentStatus["Running"] = "running";
54
- EnvironmentStatus["Stopped"] = "stopped";
55
- EnvironmentStatus["Creating"] = "creating";
56
- EnvironmentStatus["Deleting"] = "deleting";
57
- // Additional Hetzner server statuses (for API compatibility)
58
- EnvironmentStatus["Starting"] = "starting";
59
- EnvironmentStatus["Stopping"] = "stopping";
60
- EnvironmentStatus["Initializing"] = "initializing";
61
- })(EnvironmentStatus || (exports.EnvironmentStatus = EnvironmentStatus = {}));
62
- /**
63
- * Action status - used by HetznerAction
64
- */
202
+ ((EnvironmentStatus2) => {
203
+ EnvironmentStatus2["Running"] = "running";
204
+ EnvironmentStatus2["Stopped"] = "stopped";
205
+ EnvironmentStatus2["Creating"] = "creating";
206
+ EnvironmentStatus2["Deleting"] = "deleting";
207
+ EnvironmentStatus2["Starting"] = "starting";
208
+ EnvironmentStatus2["Stopping"] = "stopping";
209
+ EnvironmentStatus2["Initializing"] = "initializing";
210
+ })(EnvironmentStatus ||= {});
65
211
  var ActionStatus;
66
- (function (ActionStatus) {
67
- ActionStatus["Running"] = "running";
68
- ActionStatus["Success"] = "success";
69
- ActionStatus["Error"] = "error";
70
- })(ActionStatus || (exports.ActionStatus = ActionStatus = {}));
71
- /**
72
- * Volume status - used by HetznerVolume
73
- */
212
+ ((ActionStatus2) => {
213
+ ActionStatus2["Running"] = "running";
214
+ ActionStatus2["Success"] = "success";
215
+ ActionStatus2["Error"] = "error";
216
+ })(ActionStatus ||= {});
74
217
  var VolumeStatus;
75
- (function (VolumeStatus) {
76
- VolumeStatus["Creating"] = "creating";
77
- VolumeStatus["Available"] = "available";
78
- VolumeStatus["Deleting"] = "deleting";
79
- })(VolumeStatus || (exports.VolumeStatus = VolumeStatus = {}));
80
- /**
81
- * Ralph Loop status - used by RalphLoop interface
82
- */
218
+ ((VolumeStatus2) => {
219
+ VolumeStatus2["Creating"] = "creating";
220
+ VolumeStatus2["Available"] = "available";
221
+ VolumeStatus2["Deleting"] = "deleting";
222
+ })(VolumeStatus ||= {});
83
223
  var LoopStatus;
84
- (function (LoopStatus) {
85
- LoopStatus["Running"] = "running";
86
- LoopStatus["Stopped"] = "stopped";
87
- LoopStatus["Error"] = "error";
88
- LoopStatus["Completed"] = "completed";
89
- })(LoopStatus || (exports.LoopStatus = LoopStatus = {}));
90
- /**
91
- * Get the location object from an environment
92
- * @param env - The environment object
93
- * @returns The location object or null
94
- */
224
+ ((LoopStatus2) => {
225
+ LoopStatus2["Running"] = "running";
226
+ LoopStatus2["Stopped"] = "stopped";
227
+ LoopStatus2["Error"] = "error";
228
+ LoopStatus2["Completed"] = "completed";
229
+ })(LoopStatus ||= {});
95
230
  function getEnvLocation(env) {
96
- if (!env)
97
- return null;
98
- return env.location || null;
231
+ if (!env)
232
+ return null;
233
+ return env.location || null;
99
234
  }
100
- /**
101
- * Get the region name (short format like "nbg1") from an environment
102
- * @param env - The environment object
103
- * @returns The region name (e.g., "nbg1") or "Unknown"
104
- */
105
235
  function getEnvRegionName(env) {
106
- var _a;
107
- if (!env)
108
- return "Unknown";
109
- return ((_a = env.location) === null || _a === void 0 ? void 0 : _a.name) || "Unknown";
236
+ if (!env)
237
+ return "Unknown";
238
+ return env.location?.name || "Unknown";
110
239
  }
111
- /**
112
- * Get a human-readable location label with city and country
113
- * @param env - The environment object
114
- * @returns A formatted location string (e.g., "Nuremberg, DE" or "nbg1" as fallback)
115
- */
116
240
  function getEnvLocationLabel(env) {
117
- var _a, _b, _c;
118
- if (!env)
119
- return "Unknown";
120
- // Show city, country for better UX
121
- if (((_a = env.location) === null || _a === void 0 ? void 0 : _a.city) && ((_b = env.location) === null || _b === void 0 ? void 0 : _b.country)) {
122
- return "".concat(env.location.city, ", ").concat(env.location.country);
123
- }
124
- // Fallback to location name
125
- return ((_c = env.location) === null || _c === void 0 ? void 0 : _c.name) || "Unknown";
241
+ if (!env)
242
+ return "Unknown";
243
+ if (env.location?.city && env.location?.country) {
244
+ return `${env.location.city}, ${env.location.country}`;
245
+ }
246
+ return env.location?.name || "Unknown";
126
247
  }
248
+ export {
249
+ getEnvRegionName,
250
+ getEnvLocationLabel,
251
+ getEnvLocation,
252
+ VolumeStatus,
253
+ LoopStatus,
254
+ EnvironmentStatus,
255
+ ActionStatus
256
+ };
@@ -1,116 +1,97 @@
1
- "use strict";
2
- /**
3
- * Shared resource parsing utilities
4
- */
5
- var __assign = (this && this.__assign) || function () {
6
- __assign = Object.assign || function(t) {
7
- for (var s, i = 1, n = arguments.length; i < n; i++) {
8
- s = arguments[i];
9
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
10
- t[p] = s[p];
11
- }
12
- return t;
13
- };
14
- return __assign.apply(this, arguments);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.parseCPU = parseCPU;
18
- exports.parseMemory = parseMemory;
19
- exports.parseDisk = parseDisk;
20
- exports.parseGPU = parseGPU;
21
- exports.parseResources = parseResources;
22
- /**
23
- * Parse CPU usage from raw output with validation
24
- */
1
+ // @bun
2
+ // compile/resources.ts
25
3
  function parseCPU(raw) {
26
- if (!raw || typeof raw !== 'string') {
27
- return 0;
28
- }
29
- var num = parseFloat(raw);
30
- if (isNaN(num)) {
31
- console.warn('Invalid CPU value:', raw);
32
- return 0;
33
- }
34
- return Math.round(num * 10) / 10;
4
+ if (!raw || typeof raw !== "string") {
5
+ return 0;
6
+ }
7
+ const num = parseFloat(raw);
8
+ if (isNaN(num)) {
9
+ console.warn("Invalid CPU value:", raw);
10
+ return 0;
11
+ }
12
+ return Math.round(num * 10) / 10;
35
13
  }
36
- /**
37
- * Parse memory usage from raw output with validation
38
- * Returns: { percent, used, total }
39
- */
40
14
  function parseMemory(raw) {
41
- if (!raw || typeof raw !== 'string') {
42
- return { percent: 0, used: '0 GB', total: '0 GB' };
43
- }
44
- var parts = raw.split(/\s+/);
45
- if (parts.length < 3) {
46
- console.warn('Invalid memory output:', raw);
47
- return { percent: 0, used: '0 GB', total: '0 GB' };
48
- }
49
- return {
50
- percent: Math.round(parseFloat(parts[0]) * 10) / 10,
51
- used: "".concat((parseFloat(parts[1]) || 0).toFixed(1), " GB"),
52
- total: "".concat((parseFloat(parts[2]) || 0).toFixed(1), " GB"),
53
- };
15
+ if (!raw || typeof raw !== "string") {
16
+ return { percent: 0, used: "0 GB", total: "0 GB" };
17
+ }
18
+ const parts = raw.split(/\s+/);
19
+ if (parts.length < 3) {
20
+ console.warn("Invalid memory output:", raw);
21
+ return { percent: 0, used: "0 GB", total: "0 GB" };
22
+ }
23
+ return {
24
+ percent: Math.round(parseFloat(parts[0]) * 10) / 10,
25
+ used: `${(parseFloat(parts[1]) || 0).toFixed(1)} GB`,
26
+ total: `${(parseFloat(parts[2]) || 0).toFixed(1)} GB`
27
+ };
54
28
  }
55
- /**
56
- * Parse disk usage from raw output with validation
57
- * Handles formats like "4% 2.8G 75G" -> adds space before unit
58
- */
59
29
  function parseDisk(raw) {
60
- var _a;
61
- if (!raw || typeof raw !== 'string') {
62
- return { percent: 0, used: '0 GB', total: '0 GB' };
30
+ if (!raw || typeof raw !== "string") {
31
+ return { percent: 0, used: "0 GB", total: "0 GB" };
32
+ }
33
+ const parts = raw.split(/\s+/);
34
+ const percent = parseFloat(parts[0]?.replace("%", "") || "0") || 0;
35
+ const formatSize = (size) => {
36
+ if (size.endsWith("G") || size.endsWith("M") || size.endsWith("K")) {
37
+ return size.replace(/([GMK])$/, " $1B");
63
38
  }
64
- var parts = raw.split(/\s+/);
65
- var percent = parseFloat(((_a = parts[0]) === null || _a === void 0 ? void 0 : _a.replace('%', '')) || '0') || 0;
66
- // Format "2.8G" -> "2.8 GB" for consistency
67
- var formatSize = function (size) {
68
- if (size.endsWith('G') || size.endsWith('M') || size.endsWith('K')) {
69
- return size.replace(/([GMK])$/, ' $1B');
70
- }
71
- return size;
72
- };
73
- return {
74
- percent: Math.round(percent),
75
- used: formatSize(parts[1] || '0 GB'),
76
- total: formatSize(parts[2] || '0 GB'),
77
- };
39
+ return size;
40
+ };
41
+ return {
42
+ percent: Math.round(percent),
43
+ used: formatSize(parts[1] || "0 GB"),
44
+ total: formatSize(parts[2] || "0 GB")
45
+ };
78
46
  }
79
- /**
80
- * Parse GPU usage from raw output with validation
81
- * Returns undefined if no GPU present
82
- */
83
47
  function parseGPU(raw) {
84
- if (!raw || raw === 'NOGPU' || raw === '0' || !raw.trim()) {
85
- return undefined;
86
- }
87
- var parts = raw.split(',').map(function (s) { return s.trim(); });
88
- if (parts.length < 3) {
89
- console.warn('Invalid GPU output:', raw);
90
- return undefined;
91
- }
92
- // nvidia-smi returns values in MB, convert to GB
93
- return {
94
- gpuPercent: parseFloat(parts[0]) || 0,
95
- gpuMemoryUsed: "".concat((parseFloat(parts[1]) / 1024).toFixed(1), " GB"),
96
- gpuMemoryTotal: "".concat((parseFloat(parts[2]) / 1024).toFixed(1), " GB"),
97
- };
48
+ if (!raw || raw === "NOGPU" || raw === "0" || !raw.trim()) {
49
+ return;
50
+ }
51
+ const parts = raw.split(",").map((s) => s.trim());
52
+ if (parts.length < 3) {
53
+ console.warn("Invalid GPU output:", raw);
54
+ return;
55
+ }
56
+ return {
57
+ gpuPercent: parseFloat(parts[0]) || 0,
58
+ gpuMemoryUsed: `${(parseFloat(parts[1]) / 1024).toFixed(1)} GB`,
59
+ gpuMemoryTotal: `${(parseFloat(parts[2]) / 1024).toFixed(1)} GB`
60
+ };
98
61
  }
99
- /**
100
- * Parse all resources from raw command outputs
101
- */
102
62
  function parseResources(raw) {
103
- var cpu = parseCPU(raw.cpu);
104
- var memory = parseMemory(raw.memory);
105
- var disk = parseDisk(raw.disk);
106
- var gpu = parseGPU(raw.gpu);
107
- return __assign({
108
- // Raw values for metrics storage
109
- cpu: cpu, memory: memory.percent, disk: disk.percent, gpu: raw.gpu, network: raw.network, loadavg: raw.loadavg, processes: raw.processes, connections: raw.connections, ports: raw.ports,
110
- // Parsed values for API response
111
- cpuPercent: cpu, memoryPercent: memory.percent, memoryUsed: memory.used, memoryTotal: memory.total, diskPercent: disk.percent, diskUsed: disk.used, diskTotal: disk.total }, (gpu && {
112
- gpuPercent: gpu.gpuPercent,
113
- gpuMemoryUsed: gpu.gpuMemoryUsed,
114
- gpuMemoryTotal: gpu.gpuMemoryTotal,
115
- }));
63
+ const cpu = parseCPU(raw.cpu);
64
+ const memory = parseMemory(raw.memory);
65
+ const disk = parseDisk(raw.disk);
66
+ const gpu = parseGPU(raw.gpu);
67
+ return {
68
+ cpu,
69
+ memory: memory.percent,
70
+ disk: disk.percent,
71
+ gpu: raw.gpu,
72
+ network: raw.network,
73
+ loadavg: raw.loadavg,
74
+ processes: raw.processes,
75
+ connections: raw.connections,
76
+ ports: raw.ports,
77
+ cpuPercent: cpu,
78
+ memoryPercent: memory.percent,
79
+ memoryUsed: memory.used,
80
+ memoryTotal: memory.total,
81
+ diskPercent: disk.percent,
82
+ diskUsed: disk.used,
83
+ diskTotal: disk.total,
84
+ ...gpu && {
85
+ gpuPercent: gpu.gpuPercent,
86
+ gpuMemoryUsed: gpu.gpuMemoryUsed,
87
+ gpuMemoryTotal: gpu.gpuMemoryTotal
88
+ }
89
+ };
116
90
  }
91
+ export {
92
+ parseResources,
93
+ parseMemory,
94
+ parseGPU,
95
+ parseDisk,
96
+ parseCPU
97
+ };
@@ -1,40 +1,29 @@
1
- "use strict";
2
- /**
3
- * Shared WebSocket Types for Terminal
4
- * Used by both server (Bun) and client (browser)
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.WebSocketCloseCode = void 0;
8
- /**
9
- * WebSocket Close Codes
10
- * Based on RFC 6455 and custom application codes
11
- * See: https://www.iana.org/assignments/websocket/websocket.xml#close-code-number
12
- */
13
- exports.WebSocketCloseCode = {
14
- // Standard codes (1000-2999)
15
- NORMAL_CLOSURE: 1000,
16
- ENDPOINT_GOING_AWAY: 1001,
17
- PROTOCOL_ERROR: 1002,
18
- UNSUPPORTED_DATA: 1003,
19
- // 1004-1006 are reserved and should not be used
20
- NO_STATUS_RECEIVED: 1005,
21
- ABNORMAL_CLOSURE: 1006,
22
- INVALID_FRAME_PAYLOAD_DATA: 1007,
23
- POLICY_VIOLATION: 1008,
24
- MESSAGE_TOO_BIG: 1009,
25
- MISSING_MANDATORY_EXTENSION: 1010,
26
- INTERNAL_ERROR: 1011,
27
- SERVICE_RESTART: 1012,
28
- TRY_AGAIN_LATER: 1013,
29
- // Application-specific codes (3000-4999)
30
- // Terminal-specific codes (4000-4099)
31
- SESSION_NOT_FOUND: 4001,
32
- SESSION_ALREADY_CLOSED: 4002,
33
- INVALID_MESSAGE_FORMAT: 4003,
34
- AUTHENTICATION_FAILED: 4004,
35
- CONNECTION_TIMEOUT: 4005,
36
- SESSION_LIMIT_REACHED: 4006,
37
- INVALID_HOST: 4007,
38
- SSH_CONNECTION_FAILED: 4008,
39
- NETWORK_BLOCKED: 4009, // Network is blocking Hetzner/VPS IPs
1
+ // @bun
2
+ // compile/terminal-websocket.ts
3
+ var WebSocketCloseCode = {
4
+ NORMAL_CLOSURE: 1000,
5
+ ENDPOINT_GOING_AWAY: 1001,
6
+ PROTOCOL_ERROR: 1002,
7
+ UNSUPPORTED_DATA: 1003,
8
+ NO_STATUS_RECEIVED: 1005,
9
+ ABNORMAL_CLOSURE: 1006,
10
+ INVALID_FRAME_PAYLOAD_DATA: 1007,
11
+ POLICY_VIOLATION: 1008,
12
+ MESSAGE_TOO_BIG: 1009,
13
+ MISSING_MANDATORY_EXTENSION: 1010,
14
+ INTERNAL_ERROR: 1011,
15
+ SERVICE_RESTART: 1012,
16
+ TRY_AGAIN_LATER: 1013,
17
+ SESSION_NOT_FOUND: 4001,
18
+ SESSION_ALREADY_CLOSED: 4002,
19
+ INVALID_MESSAGE_FORMAT: 4003,
20
+ AUTHENTICATION_FAILED: 4004,
21
+ CONNECTION_TIMEOUT: 4005,
22
+ SESSION_LIMIT_REACHED: 4006,
23
+ INVALID_HOST: 4007,
24
+ SSH_CONNECTION_FAILED: 4008,
25
+ NETWORK_BLOCKED: 4009
26
+ };
27
+ export {
28
+ WebSocketCloseCode
40
29
  };