vmsan 0.1.0-alpha.2 → 0.1.0-alpha.21

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/dist/index.d.mts CHANGED
@@ -1,3 +1,5 @@
1
+ import { Hookable } from "hookable";
2
+ import { ChildProcess } from "node:child_process";
1
3
  import { ErrorOptions, EvlogError, RequestLogger } from "evlog";
2
4
  import { ConsolaInstance } from "consola";
3
5
 
@@ -18,6 +20,502 @@ interface VmsanPaths {
18
20
  }
19
21
  declare function vmsanPaths(baseDir?: string): VmsanPaths;
20
22
  //#endregion
23
+ //#region src/lib/vm-state.d.ts
24
+ interface VmNetwork {
25
+ tapDevice: string;
26
+ hostIp: string;
27
+ guestIp: string;
28
+ subnetMask: string;
29
+ macAddress: string;
30
+ networkPolicy: string;
31
+ allowedDomains: string[];
32
+ allowedCidrs: string[];
33
+ deniedCidrs: string[];
34
+ publishedPorts: number[];
35
+ tunnelHostname: string | null;
36
+ tunnelHostnames?: string[];
37
+ bandwidthMbit?: number;
38
+ netnsName?: string;
39
+ }
40
+ interface VmState {
41
+ id: string;
42
+ project: string;
43
+ runtime: string;
44
+ diskSizeGb?: number;
45
+ status: "creating" | "running" | "stopped" | "error";
46
+ pid: number | null;
47
+ apiSocket: string;
48
+ chrootDir: string;
49
+ kernel: string;
50
+ rootfs: string;
51
+ vcpuCount: number;
52
+ memSizeMib: number;
53
+ network: VmNetwork;
54
+ snapshot: string | null;
55
+ timeoutMs: number | null;
56
+ timeoutAt: string | null;
57
+ createdAt: string;
58
+ error: string | null;
59
+ agentToken: string | null;
60
+ agentPort: number;
61
+ }
62
+ interface VmStateStore {
63
+ save(state: VmState): void;
64
+ load(id: string): VmState | null;
65
+ list(): VmState[];
66
+ update(id: string, updates: Partial<VmState>): void;
67
+ delete(id: string): void;
68
+ allocateNetworkSlot(): number;
69
+ }
70
+ declare function findFreeNetworkSlot(states: VmState[]): number;
71
+ declare class FileVmStateStore implements VmStateStore {
72
+ private readonly dir;
73
+ constructor(dir: string);
74
+ private ensureDir;
75
+ save(state: VmState): void;
76
+ load(id: string): VmState | null;
77
+ list(): VmState[];
78
+ update(id: string, updates: Partial<VmState>): void;
79
+ delete(id: string): void;
80
+ allocateNetworkSlot(): number;
81
+ }
82
+ declare function getActiveTapSlots(): Set<number>;
83
+ //#endregion
84
+ //#region src/lib/network.d.ts
85
+ interface NetworkConfig {
86
+ slot: number;
87
+ tapDevice: string;
88
+ hostIp: string;
89
+ guestIp: string;
90
+ subnetMask: string;
91
+ macAddress: string;
92
+ networkPolicy: string;
93
+ allowedDomains: string[];
94
+ allowedCidrs: string[];
95
+ deniedCidrs: string[];
96
+ publishedPorts: number[];
97
+ bandwidthMbit?: number;
98
+ netnsName?: string;
99
+ }
100
+ declare class NetworkManager {
101
+ config: NetworkConfig;
102
+ constructor(slot: number, networkPolicy: string, allowedDomains: string[], allowedCidrs: string[], deniedCidrs: string[], publishedPorts: number[], bandwidthMbit?: number, netnsName?: string);
103
+ static bootArgs(slot: number): string;
104
+ static fromConfig(config: NetworkConfig): NetworkManager;
105
+ static fromVmNetwork(network: VmNetwork): NetworkManager;
106
+ private nsRun;
107
+ setupNamespace(): void;
108
+ teardownNamespace(): void;
109
+ setupDevice(): void;
110
+ setupRules(): void;
111
+ setupThrottle(): void;
112
+ teardownThrottle(): void;
113
+ teardownRules(): void;
114
+ teardownDevice(): void;
115
+ setup(): Promise<void>;
116
+ teardown(): void;
117
+ updatePolicy(newPolicy: string, newDomains: string[], newAllowedCidrs: string[], newDeniedCidrs: string[]): void;
118
+ }
119
+ //#endregion
120
+ //#region src/commands/create/types.d.ts
121
+ declare const VALID_RUNTIMES: readonly ["base", "node22", "node22-demo", "python3.13"];
122
+ type Runtime = (typeof VALID_RUNTIMES)[number];
123
+ declare const VALID_NETWORK_POLICIES: readonly ["allow-all", "deny-all", "custom"];
124
+ type NetworkPolicy = (typeof VALID_NETWORK_POLICIES)[number];
125
+ interface CreateLifecycleState {
126
+ networkConfig: NetworkConfig | undefined;
127
+ vmId: string | undefined;
128
+ chrootDir: string | undefined;
129
+ }
130
+ interface ParsedCreateInput {
131
+ vcpus: number;
132
+ memMib: number;
133
+ runtime: Runtime;
134
+ networkPolicy: NetworkPolicy;
135
+ ports: number[];
136
+ domains: string[];
137
+ allowedCidrs: string[];
138
+ deniedCidrs: string[];
139
+ timeoutMs: number | null;
140
+ snapshotId: string | null;
141
+ diskSizeGb: number;
142
+ }
143
+ interface CreateSummaryInput {
144
+ vmId: string;
145
+ pid: number | null;
146
+ vcpus: number;
147
+ memMib: number;
148
+ runtime: Runtime;
149
+ diskSizeGb: number;
150
+ project: string;
151
+ networkPolicy: NetworkPolicy;
152
+ domains: string[];
153
+ allowedCidrs: string[];
154
+ deniedCidrs: string[];
155
+ ports: number[];
156
+ kernelPath: string;
157
+ rootfsPath: string;
158
+ snapshotId: string | null;
159
+ timeout: string | undefined;
160
+ socketPath: string;
161
+ chrootDir: string;
162
+ tapDevice: string;
163
+ hostIp: string;
164
+ guestIp: string;
165
+ macAddress: string;
166
+ stateFilePath: string;
167
+ }
168
+ interface InitialVmStateInput {
169
+ vmId: string;
170
+ project: string;
171
+ runtime: Runtime;
172
+ diskSizeGb: number;
173
+ kernelPath: string;
174
+ rootfsPath: string;
175
+ vcpus: number;
176
+ memMib: number;
177
+ networkPolicy: NetworkPolicy;
178
+ domains: string[];
179
+ allowedCidrs: string[];
180
+ deniedCidrs: string[];
181
+ ports: number[];
182
+ tapDevice: string;
183
+ hostIp: string;
184
+ guestIp: string;
185
+ subnetMask: string;
186
+ macAddress: string;
187
+ snapshotId: string | null;
188
+ timeoutMs: number | null;
189
+ agentToken: string | null;
190
+ agentPort: number;
191
+ bandwidthMbit?: number;
192
+ netnsName?: string;
193
+ }
194
+ //#endregion
195
+ //#region src/commands/create/validation.d.ts
196
+ declare function parseVcpuCount(value: string | undefined): number;
197
+ declare function parseMemoryMib(value: string | undefined): number;
198
+ declare function parseRuntime(value: string | undefined): Runtime;
199
+ declare function parseNetworkPolicy(value: string | undefined): NetworkPolicy;
200
+ declare function parsePublishedPorts(value: string | undefined): number[];
201
+ declare function parseDomains(value: string | undefined): string[];
202
+ declare function parseCidrList(value: string | undefined): string[];
203
+ declare function validateCidr(cidr: string): void;
204
+ declare function validatePublishedPortsAvailable(ports: number[], paths: VmsanPaths): void;
205
+ interface ImageReference {
206
+ full: string;
207
+ name: string;
208
+ tag: string;
209
+ cacheKey: string;
210
+ }
211
+ declare function parseImageReference(ref: string): ImageReference;
212
+ declare function parseBandwidth(value: string | undefined): number | undefined;
213
+ declare function parseDiskSizeGb(value: string | undefined): number;
214
+ //#endregion
215
+ //#region src/errors/codes.d.ts
216
+ type ValidationErrorCode = "ERR_VALIDATION_INTEGER" | "ERR_VALIDATION_RUNTIME" | "ERR_VALIDATION_NETWORK_POLICY" | "ERR_VALIDATION_PORT" | "ERR_VALIDATION_PORT_CONFLICT" | "ERR_VALIDATION_DOMAIN" | "ERR_VALIDATION_CIDR" | "ERR_VALIDATION_IMAGE_REF" | "ERR_VALIDATION_DISK_SIZE" | "ERR_VALIDATION_DURATION" | "ERR_VALIDATION_FLAGS" | "ERR_VALIDATION_POLICY_CONFLICT";
217
+ type VmErrorCode = "ERR_VM_NOT_FOUND" | "ERR_VM_STATE_NOT_FOUND" | "ERR_VM_NOT_STOPPED" | "ERR_VM_NOT_RUNNING" | "ERR_VM_NO_AGENT_TOKEN" | "ERR_VM_CHROOT_NOT_FOUND" | "ERR_VM_NETWORK_SLOTS_EXHAUSTED" | "ERR_VM_SNAPSHOT_NOT_FOUND";
218
+ type FirecrackerErrorCode = "ERR_FIRECRACKER_API";
219
+ type NetworkErrorCode = "ERR_NETWORK_DEFAULT_INTERFACE";
220
+ type TimeoutErrorCode = "ERR_TIMEOUT_SOCKET" | "ERR_TIMEOUT_LOCK" | "ERR_TIMEOUT_AGENT";
221
+ type SetupErrorCode = "ERR_SETUP_MISSING_BINARY" | "ERR_SETUP_NO_KERNEL_DIR" | "ERR_SETUP_NO_KERNEL" | "ERR_SETUP_NO_ROOTFS_DIR" | "ERR_SETUP_NO_EXT4_ROOTFS";
222
+ type VmsanErrorCode = ValidationErrorCode | VmErrorCode | FirecrackerErrorCode | NetworkErrorCode | TimeoutErrorCode | SetupErrorCode;
223
+ //#endregion
224
+ //#region src/errors/base.d.ts
225
+ declare class VmsanError extends EvlogError {
226
+ readonly code: VmsanErrorCode;
227
+ constructor(code: VmsanErrorCode, options: ErrorOptions);
228
+ toJSON(): Record<string, unknown>;
229
+ }
230
+ //#endregion
231
+ //#region src/errors/validation.d.ts
232
+ declare class ValidationError extends VmsanError {
233
+ readonly flag?: string;
234
+ constructor(code: ValidationErrorCode, options: ErrorOptions & {
235
+ flag?: string;
236
+ });
237
+ toJSON(): Record<string, unknown>;
238
+ }
239
+ declare const invalidIntegerFlagError: (flag: string, value: string, min: number, max: number, unitSuffix?: string) => ValidationError;
240
+ declare const invalidRuntimeError: (runtime: string, validRuntimes: readonly string[]) => ValidationError;
241
+ declare const invalidNetworkPolicyError: (policy: string, validPolicies: readonly string[]) => ValidationError;
242
+ declare const invalidPortError: (port: string) => ValidationError;
243
+ declare const portConflictError: (conflictSummary: string) => ValidationError;
244
+ declare const invalidDomainError: (domain: string) => ValidationError;
245
+ declare const invalidDomainPatternError: (domain: string, detail?: string) => ValidationError;
246
+ declare const invalidCidrFormatError: (cidr: string) => ValidationError;
247
+ declare const invalidCidrPrefixError: (cidr: string) => ValidationError;
248
+ declare const invalidCidrOctetError: (cidr: string) => ValidationError;
249
+ declare const invalidImageRefEmptyError: () => ValidationError;
250
+ declare const invalidImageRefTagError: (ref: string) => ValidationError;
251
+ declare const invalidDiskSizeFormatError: (value: string) => ValidationError;
252
+ declare const invalidDiskSizeRangeError: (value: string) => ValidationError;
253
+ declare const invalidDurationError: (input: string) => ValidationError;
254
+ declare const mutuallyExclusiveFlagsError: (flagA: string, flagB: string) => ValidationError;
255
+ declare const policyConflictError: () => ValidationError;
256
+ //#endregion
257
+ //#region src/errors/vm.d.ts
258
+ declare class VmError extends VmsanError {
259
+ readonly vmId?: string;
260
+ constructor(code: VmErrorCode, options: ErrorOptions & {
261
+ vmId?: string;
262
+ });
263
+ toJSON(): Record<string, unknown>;
264
+ }
265
+ declare const vmNotFoundError: (vmId: string) => VmError;
266
+ declare const vmStateNotFoundError: (vmId: string) => VmError;
267
+ declare const vmNotStoppedError: (vmId: string, currentStatus: string) => VmError;
268
+ declare const chrootNotFoundError: (vmId: string) => VmError;
269
+ declare const networkSlotsExhaustedError: () => VmError;
270
+ declare const vmNotRunningError: (vmId: string, currentStatus?: string) => VmError;
271
+ declare const vmNoAgentTokenError: (vmId: string) => VmError;
272
+ declare const snapshotNotFoundError: (snapshotId: string) => VmError;
273
+ //#endregion
274
+ //#region src/errors/firecracker.d.ts
275
+ declare class FirecrackerApiError extends VmsanError {
276
+ readonly method: string;
277
+ readonly path: string;
278
+ readonly httpStatus: number;
279
+ constructor(code: FirecrackerErrorCode, options: ErrorOptions & {
280
+ method: string;
281
+ path: string;
282
+ httpStatus: number;
283
+ });
284
+ toJSON(): Record<string, unknown>;
285
+ }
286
+ declare const firecrackerApiError: (method: string, path: string, httpStatus: number, body: string) => FirecrackerApiError;
287
+ //#endregion
288
+ //#region src/errors/network.d.ts
289
+ declare class NetworkError extends VmsanError {
290
+ constructor(code: NetworkErrorCode, options: {
291
+ message: string;
292
+ fix?: string;
293
+ });
294
+ }
295
+ declare const defaultInterfaceNotFoundError: () => NetworkError;
296
+ //#endregion
297
+ //#region src/errors/timeout.d.ts
298
+ declare class TimeoutError extends VmsanError {
299
+ readonly target?: string;
300
+ readonly timeoutMs?: number;
301
+ constructor(code: TimeoutErrorCode, options: ErrorOptions & {
302
+ target?: string;
303
+ timeoutMs?: number;
304
+ });
305
+ toJSON(): Record<string, unknown>;
306
+ }
307
+ declare const socketTimeoutError: (socketPath: string) => TimeoutError;
308
+ declare const lockTimeoutError: (lockName: string) => TimeoutError;
309
+ declare const agentTimeoutError: (guestIp: string, timeoutMs: number) => TimeoutError;
310
+ //#endregion
311
+ //#region src/errors/setup.d.ts
312
+ declare class SetupError extends VmsanError {
313
+ constructor(code: SetupErrorCode, options: {
314
+ message: string;
315
+ fix?: string;
316
+ });
317
+ }
318
+ declare const missingBinaryError: (binary: string, path: string) => SetupError;
319
+ declare const noKernelDirError: () => SetupError;
320
+ declare const noKernelError: () => SetupError;
321
+ declare const noRootfsDirError: () => SetupError;
322
+ declare const noExt4RootfsError: () => SetupError;
323
+ //#endregion
324
+ //#region src/lib/logger/index.d.ts
325
+ type OutputMode = "normal" | "json" | "verbose" | "silent";
326
+ /**
327
+ * Initialize both consola and evlog for the given output mode.
328
+ * Call once per CLI invocation, before any command runs.
329
+ *
330
+ * consola = human-facing CLI output (icons, colors, boxes, progress)
331
+ * evlog = machine-readable structured events (--json output)
332
+ */
333
+ declare function initVmsanLogger(mode: OutputMode): void;
334
+ declare function getOutputMode(): OutputMode;
335
+ interface CommandLogger {
336
+ /** Add structured context to the wide event */
337
+ set: RequestLogger["set"];
338
+ /** Record an error in the wide event */
339
+ error: RequestLogger["error"];
340
+ /** Emit the wide event (only produces output in json/verbose modes) */
341
+ emit: () => void;
342
+ }
343
+ /**
344
+ * Create a command-scoped logger backed by an evlog RequestLogger.
345
+ * The wide event is emitted only in json/verbose modes.
346
+ */
347
+ declare function createCommandLogger(command: string): CommandLogger;
348
+ /**
349
+ * Create a scoped consola instance with a tag prefix.
350
+ * Output shows as `[tag] message`.
351
+ */
352
+ declare function createScopedLogger(tag: string): ConsolaInstance;
353
+ //#endregion
354
+ //#region src/errors/display.d.ts
355
+ declare function handleCommandError(error: unknown, cmdLog: CommandLogger): void;
356
+ //#endregion
357
+ //#region src/services/vm.d.ts
358
+ interface CreateVmOptions {
359
+ vcpus?: number;
360
+ memMib?: number;
361
+ diskSizeGb?: number;
362
+ kernelPath?: string;
363
+ rootfsPath?: string;
364
+ fromImage?: ImageReference;
365
+ project?: string;
366
+ runtime?: Runtime;
367
+ networkPolicy?: NetworkPolicy;
368
+ domains?: string[];
369
+ allowedCidrs?: string[];
370
+ deniedCidrs?: string[];
371
+ ports?: number[];
372
+ bandwidthMbit?: number;
373
+ disableNetns?: boolean;
374
+ disableSeccomp?: boolean;
375
+ disablePidNs?: boolean;
376
+ disableCgroup?: boolean;
377
+ timeoutMs?: number;
378
+ snapshotId?: string;
379
+ }
380
+ interface CreateVmResult {
381
+ vmId: string;
382
+ pid: number | null;
383
+ state: VmState;
384
+ }
385
+ interface StartVmResult {
386
+ vmId: string;
387
+ pid: number | null;
388
+ state: VmState | null;
389
+ success: boolean;
390
+ error?: VmsanError;
391
+ }
392
+ interface StopResult {
393
+ vmId: string;
394
+ success: boolean;
395
+ error?: VmsanError;
396
+ alreadyStopped?: boolean;
397
+ }
398
+ interface UpdatePolicyResult {
399
+ vmId: string;
400
+ success: boolean;
401
+ previousPolicy: NetworkPolicy;
402
+ newPolicy: NetworkPolicy;
403
+ error?: VmsanError;
404
+ }
405
+ declare class VMService {
406
+ readonly paths: VmsanContext["paths"];
407
+ readonly store: VmStateStore;
408
+ readonly hooks: VmsanContext["hooks"];
409
+ readonly logger: VmsanContext["logger"];
410
+ constructor(ctx: VmsanContext);
411
+ list(): VmState[];
412
+ get(vmId: string): VmState | null;
413
+ create(opts: CreateVmOptions): Promise<CreateVmResult>;
414
+ start(vmId: string): Promise<StartVmResult>;
415
+ stop(vmId: string): Promise<StopResult>;
416
+ updateNetworkPolicy(vmId: string, policy: NetworkPolicy, domains: string[], allowedCidrs: string[], deniedCidrs: string[]): Promise<UpdatePolicyResult>;
417
+ remove(vmId: string, opts?: {
418
+ force?: boolean;
419
+ }): Promise<StopResult>;
420
+ private buildCgroupConfig;
421
+ private bootVm;
422
+ private markAsError;
423
+ }
424
+ //#endregion
425
+ //#region src/hooks.d.ts
426
+ type VmPhase = "create" | "start" | "stop" | "remove";
427
+ interface VmsanHooks {
428
+ "vm:beforeCreate": (params: {
429
+ vmId: string;
430
+ options: CreateVmOptions;
431
+ }) => void | Promise<void>;
432
+ "vm:afterCreate": (state: VmState) => void | Promise<void>;
433
+ "vm:beforeStart": (params: {
434
+ vmId: string;
435
+ state: VmState;
436
+ }) => void | Promise<void>;
437
+ "vm:afterStart": (state: VmState) => void | Promise<void>;
438
+ "vm:beforeStop": (params: {
439
+ vmId: string;
440
+ state: VmState;
441
+ }) => void | Promise<void>;
442
+ "vm:afterStop": (params: {
443
+ vmId: string;
444
+ previousStatus: VmState["status"];
445
+ }) => void | Promise<void>;
446
+ "vm:beforeRemove": (params: {
447
+ vmId: string;
448
+ state: VmState;
449
+ force: boolean;
450
+ }) => void | Promise<void>;
451
+ "vm:afterRemove": (params: {
452
+ vmId: string;
453
+ }) => void | Promise<void>;
454
+ "vm:error": (params: {
455
+ vmId: string;
456
+ error: Error;
457
+ phase: VmPhase;
458
+ }) => void | Promise<void>;
459
+ "network:afterSetup": (params: {
460
+ vmId: string;
461
+ slot: number;
462
+ networkConfig: NetworkConfig;
463
+ domains: string[];
464
+ networkPolicy: NetworkPolicy;
465
+ }) => void | Promise<void>;
466
+ "network:afterTeardown": (params: {
467
+ vmId: string;
468
+ networkConfig: NetworkConfig;
469
+ }) => void | Promise<void>;
470
+ "network:policyChange": (params: {
471
+ vmId: string;
472
+ previousPolicy: NetworkPolicy;
473
+ newPolicy: NetworkPolicy;
474
+ }) => void | Promise<void>;
475
+ "state:change": (params: {
476
+ vmId: string;
477
+ field: string;
478
+ oldValue: unknown;
479
+ newValue: unknown;
480
+ }) => void | Promise<void>;
481
+ }
482
+ //#endregion
483
+ //#region src/plugin.d.ts
484
+ interface VmsanPlugin {
485
+ name: string;
486
+ setup: (ctx: VmsanContext) => void | Promise<void>;
487
+ }
488
+ declare function definePlugin(plugin: VmsanPlugin): VmsanPlugin;
489
+ //#endregion
490
+ //#region src/vmsan-logger.d.ts
491
+ interface VmsanLogger {
492
+ debug: (...args: unknown[]) => void;
493
+ info: (...args: unknown[]) => void;
494
+ success: (...args: unknown[]) => void;
495
+ warn: (...args: unknown[]) => void;
496
+ error: (...args: unknown[]) => void;
497
+ start: (...args: unknown[]) => void;
498
+ box: (message: string) => void;
499
+ withTag: (tag: string) => VmsanLogger;
500
+ }
501
+ declare function createDefaultLogger(): VmsanLogger;
502
+ declare function createSilentLogger(): VmsanLogger;
503
+ //#endregion
504
+ //#region src/context.d.ts
505
+ interface VmsanOptions {
506
+ paths?: string | VmsanPaths;
507
+ store?: VmStateStore;
508
+ logger?: VmsanLogger;
509
+ plugins?: VmsanPlugin[];
510
+ }
511
+ interface VmsanContext {
512
+ readonly paths: VmsanPaths;
513
+ readonly store: VmStateStore;
514
+ readonly hooks: Hookable<VmsanHooks>;
515
+ readonly logger: VmsanLogger;
516
+ }
517
+ declare function createVmsan(options?: VmsanOptions): Promise<VMService>;
518
+ //#endregion
21
519
  //#region src/generated/firecracker-api.d.ts
22
520
  /* eslint-disable */
23
521
  /* prettier-ignore */
@@ -2281,6 +2779,76 @@ declare class FirecrackerClient {
2281
2779
  static getVersion(baseDir: string): Promise<string | undefined>;
2282
2780
  }
2283
2781
  //#endregion
2782
+ //#region src/lib/command.d.ts
2783
+ interface LogEntry {
2784
+ stream: "stdout" | "stderr";
2785
+ data: string;
2786
+ }
2787
+ interface CommandInit {
2788
+ agent: AgentClient;
2789
+ cmdId: string;
2790
+ startedAt: Date;
2791
+ stream: AsyncIterable<RunEvent>;
2792
+ signal?: AbortSignal;
2793
+ onStdout?: (line: string) => void;
2794
+ onStderr?: (line: string) => void;
2795
+ }
2796
+ declare class CommandFinished {
2797
+ readonly cmdId: string;
2798
+ readonly exitCode: number;
2799
+ readonly stdout: string;
2800
+ readonly stderr: string;
2801
+ readonly output: string;
2802
+ readonly timedOut: boolean;
2803
+ readonly startedAt: Date;
2804
+ constructor(opts: {
2805
+ cmdId: string;
2806
+ exitCode: number;
2807
+ stdout: string;
2808
+ stderr: string;
2809
+ output: string;
2810
+ timedOut: boolean;
2811
+ startedAt: Date;
2812
+ });
2813
+ get ok(): boolean;
2814
+ }
2815
+ declare class Command {
2816
+ readonly cmdId: string;
2817
+ private _startedAt;
2818
+ private _exitCode;
2819
+ private _timedOut;
2820
+ private _logEntries;
2821
+ private _logTruncated;
2822
+ private _eventQueue;
2823
+ private _completion;
2824
+ private _stdoutPromise;
2825
+ private _stderrPromise;
2826
+ private _outputPromise;
2827
+ private _agent;
2828
+ constructor(init: CommandInit);
2829
+ get startedAt(): Date;
2830
+ get exitCode(): number | null;
2831
+ logs(opts?: {
2832
+ signal?: AbortSignal;
2833
+ }): AsyncGenerator<LogEntry>;
2834
+ stdout(opts?: {
2835
+ signal?: AbortSignal;
2836
+ }): Promise<string>;
2837
+ stderr(opts?: {
2838
+ signal?: AbortSignal;
2839
+ }): Promise<string>;
2840
+ output(stream?: "stdout" | "stderr" | "both", opts?: {
2841
+ signal?: AbortSignal;
2842
+ }): Promise<string>;
2843
+ wait(opts?: {
2844
+ signal?: AbortSignal;
2845
+ }): Promise<CommandFinished>;
2846
+ kill(signal?: string, opts?: {
2847
+ abortSignal?: AbortSignal;
2848
+ }): Promise<void>;
2849
+ private _withSignal;
2850
+ }
2851
+ //#endregion
2284
2852
  //#region src/services/agent.d.ts
2285
2853
  interface RunParams {
2286
2854
  cmd: string;
@@ -2289,6 +2857,7 @@ interface RunParams {
2289
2857
  env?: Record<string, string>;
2290
2858
  timeoutMs?: number;
2291
2859
  detached?: boolean;
2860
+ user?: string;
2292
2861
  }
2293
2862
  type RunEventType = "started" | "stdout" | "stderr" | "exit" | "timeout" | "error";
2294
2863
  interface RunEvent {
@@ -2305,289 +2874,109 @@ interface WriteFileEntry {
2305
2874
  content: Buffer;
2306
2875
  }
2307
2876
  interface SessionInfo {
2308
- sessionId: string;
2309
- shell: string;
2310
- createdAt: string;
2311
- subscriberCount: number;
2312
- }
2313
- declare class AgentClient {
2314
- private baseUrl;
2315
- private token;
2316
- constructor(baseUrl: string, token: string);
2317
- health(): Promise<{
2318
- status: string;
2319
- version: string;
2320
- }>;
2321
- run(params: RunParams): AsyncGenerator<RunEvent>;
2322
- killCommand(cmdId: string, signal?: string): Promise<void>;
2323
- writeFiles(files: WriteFileEntry[], extractDir?: string): Promise<void>;
2324
- listShellSessions(): Promise<SessionInfo[]>;
2325
- killShellSession(sessionId: string): Promise<void>;
2326
- readFile(path: string): Promise<Buffer | null>;
2327
- }
2328
- //#endregion
2329
- //#region src/lib/vm-state.d.ts
2330
- interface VmNetwork {
2331
- tapDevice: string;
2332
- hostIp: string;
2333
- guestIp: string;
2334
- subnetMask: string;
2335
- macAddress: string;
2336
- networkPolicy: string;
2337
- allowedDomains: string[];
2338
- allowedCidrs: string[];
2339
- deniedCidrs: string[];
2340
- publishedPorts: number[];
2341
- tunnelHostname: string | null;
2342
- tunnelHostnames?: string[];
2343
- bandwidthMbit?: number;
2344
- netnsName?: string;
2345
- }
2346
- interface VmState {
2347
- id: string;
2348
- project: string;
2349
- runtime: string;
2350
- diskSizeGb?: number;
2351
- status: "creating" | "running" | "stopped" | "error";
2352
- pid: number | null;
2353
- apiSocket: string;
2354
- chrootDir: string;
2355
- kernel: string;
2356
- rootfs: string;
2357
- vcpuCount: number;
2358
- memSizeMib: number;
2359
- network: VmNetwork;
2360
- snapshot: string | null;
2361
- timeoutMs: number | null;
2362
- timeoutAt: string | null;
2363
- createdAt: string;
2364
- error: string | null;
2365
- agentToken: string | null;
2366
- agentPort: number;
2367
- }
2368
- interface VmStateStore {
2369
- save(state: VmState): void;
2370
- load(id: string): VmState | null;
2371
- list(): VmState[];
2372
- update(id: string, updates: Partial<VmState>): void;
2373
- delete(id: string): void;
2374
- allocateNetworkSlot(): number;
2375
- }
2376
- declare class FileVmStateStore implements VmStateStore {
2377
- private readonly dir;
2378
- constructor(dir: string);
2379
- private ensureDir;
2380
- save(state: VmState): void;
2381
- load(id: string): VmState | null;
2382
- list(): VmState[];
2383
- update(id: string, updates: Partial<VmState>): void;
2384
- delete(id: string): void;
2385
- allocateNetworkSlot(): number;
2386
- private static getActiveTapSlots;
2387
- }
2388
- //#endregion
2389
- //#region src/errors/codes.d.ts
2390
- type ValidationErrorCode = "ERR_VALIDATION_INTEGER" | "ERR_VALIDATION_RUNTIME" | "ERR_VALIDATION_NETWORK_POLICY" | "ERR_VALIDATION_PORT" | "ERR_VALIDATION_PORT_CONFLICT" | "ERR_VALIDATION_DOMAIN" | "ERR_VALIDATION_CIDR" | "ERR_VALIDATION_IMAGE_REF" | "ERR_VALIDATION_DISK_SIZE" | "ERR_VALIDATION_DURATION" | "ERR_VALIDATION_FLAGS" | "ERR_VALIDATION_POLICY_CONFLICT";
2391
- type VmErrorCode = "ERR_VM_NOT_FOUND" | "ERR_VM_STATE_NOT_FOUND" | "ERR_VM_NOT_STOPPED" | "ERR_VM_NOT_RUNNING" | "ERR_VM_CHROOT_NOT_FOUND" | "ERR_VM_NETWORK_SLOTS_EXHAUSTED" | "ERR_VM_SNAPSHOT_NOT_FOUND";
2392
- type FirecrackerErrorCode = "ERR_FIRECRACKER_API";
2393
- type NetworkErrorCode = "ERR_NETWORK_DEFAULT_INTERFACE";
2394
- type TimeoutErrorCode = "ERR_TIMEOUT_SOCKET" | "ERR_TIMEOUT_LOCK" | "ERR_TIMEOUT_AGENT";
2395
- type SetupErrorCode = "ERR_SETUP_MISSING_BINARY" | "ERR_SETUP_NO_KERNEL_DIR" | "ERR_SETUP_NO_KERNEL" | "ERR_SETUP_NO_ROOTFS_DIR" | "ERR_SETUP_NO_EXT4_ROOTFS";
2396
- type VmsanErrorCode = ValidationErrorCode | VmErrorCode | FirecrackerErrorCode | NetworkErrorCode | TimeoutErrorCode | SetupErrorCode;
2397
- //#endregion
2398
- //#region src/errors/base.d.ts
2399
- declare class VmsanError extends EvlogError {
2400
- readonly code: VmsanErrorCode;
2401
- constructor(code: VmsanErrorCode, options: ErrorOptions);
2402
- toJSON(): Record<string, unknown>;
2403
- }
2404
- //#endregion
2405
- //#region src/errors/validation.d.ts
2406
- declare class ValidationError extends VmsanError {
2407
- readonly flag?: string;
2408
- constructor(code: ValidationErrorCode, options: ErrorOptions & {
2409
- flag?: string;
2410
- });
2411
- toJSON(): Record<string, unknown>;
2412
- }
2413
- declare const invalidIntegerFlagError: (flag: string, value: string, min: number, max: number, unitSuffix?: string) => ValidationError;
2414
- declare const invalidRuntimeError: (runtime: string, validRuntimes: readonly string[]) => ValidationError;
2415
- declare const invalidNetworkPolicyError: (policy: string, validPolicies: readonly string[]) => ValidationError;
2416
- declare const invalidPortError: (port: string) => ValidationError;
2417
- declare const portConflictError: (conflictSummary: string) => ValidationError;
2418
- declare const invalidDomainError: (domain: string) => ValidationError;
2419
- declare const invalidDomainPatternError: (domain: string, detail?: string) => ValidationError;
2420
- declare const invalidCidrFormatError: (cidr: string) => ValidationError;
2421
- declare const invalidCidrPrefixError: (cidr: string) => ValidationError;
2422
- declare const invalidCidrOctetError: (cidr: string) => ValidationError;
2423
- declare const invalidImageRefEmptyError: () => ValidationError;
2424
- declare const invalidImageRefTagError: (ref: string) => ValidationError;
2425
- declare const invalidDiskSizeFormatError: (value: string) => ValidationError;
2426
- declare const invalidDiskSizeRangeError: (value: string) => ValidationError;
2427
- declare const invalidDurationError: (input: string) => ValidationError;
2428
- declare const mutuallyExclusiveFlagsError: (flagA: string, flagB: string) => ValidationError;
2429
- declare const policyConflictError: () => ValidationError;
2430
- //#endregion
2431
- //#region src/errors/vm.d.ts
2432
- declare class VmError extends VmsanError {
2433
- readonly vmId?: string;
2434
- constructor(code: VmErrorCode, options: ErrorOptions & {
2435
- vmId?: string;
2436
- });
2437
- toJSON(): Record<string, unknown>;
2877
+ sessionId: string;
2878
+ shell: string;
2879
+ createdAt: string;
2880
+ subscriberCount: number;
2438
2881
  }
2439
- declare const vmNotFoundError: (vmId: string) => VmError;
2440
- declare const vmStateNotFoundError: (vmId: string) => VmError;
2441
- declare const vmNotStoppedError: (vmId: string, currentStatus: string) => VmError;
2442
- declare const chrootNotFoundError: (vmId: string) => VmError;
2443
- declare const networkSlotsExhaustedError: () => VmError;
2444
- declare const vmNotRunningError: (vmId: string) => VmError;
2445
- declare const snapshotNotFoundError: (snapshotId: string) => VmError;
2446
- //#endregion
2447
- //#region src/errors/firecracker.d.ts
2448
- declare class FirecrackerApiError extends VmsanError {
2449
- readonly method: string;
2450
- readonly path: string;
2451
- readonly httpStatus: number;
2452
- constructor(code: FirecrackerErrorCode, options: ErrorOptions & {
2453
- method: string;
2454
- path: string;
2455
- httpStatus: number;
2456
- });
2457
- toJSON(): Record<string, unknown>;
2882
+ interface RunCommandParams extends RunParams {
2883
+ signal?: AbortSignal;
2884
+ onStdout?: (line: string) => void;
2885
+ onStderr?: (line: string) => void;
2458
2886
  }
2459
- declare const firecrackerApiError: (method: string, path: string, httpStatus: number, body: string) => FirecrackerApiError;
2460
- //#endregion
2461
- //#region src/errors/network.d.ts
2462
- declare class NetworkError extends VmsanError {
2463
- constructor(code: NetworkErrorCode, options: {
2464
- message: string;
2465
- fix?: string;
2466
- });
2887
+ declare class AgentClient {
2888
+ private baseUrl;
2889
+ private token;
2890
+ constructor(baseUrl: string, token: string);
2891
+ health(): Promise<{
2892
+ status: string;
2893
+ version: string;
2894
+ }>;
2895
+ run(params: RunParams, signal?: AbortSignal): AsyncGenerator<RunEvent>;
2896
+ killCommand(cmdId: string, signal?: string, abortSignal?: AbortSignal): Promise<void>;
2897
+ writeFiles(files: WriteFileEntry[], extractDir?: string): Promise<void>;
2898
+ listShellSessions(): Promise<SessionInfo[]>;
2899
+ killShellSession(sessionId: string): Promise<void>;
2900
+ exec(params: RunParams, opts?: {
2901
+ signal?: AbortSignal;
2902
+ onStdout?: (line: string) => void;
2903
+ onStderr?: (line: string) => void;
2904
+ }): Promise<Command>;
2905
+ runCommand(cmd: string, args?: string[], opts?: {
2906
+ signal?: AbortSignal;
2907
+ }): Promise<CommandFinished>;
2908
+ runCommand(params: RunCommandParams & {
2909
+ detached: true;
2910
+ }): Promise<Command>;
2911
+ runCommand(params: RunCommandParams): Promise<CommandFinished>;
2912
+ readFile(path: string): Promise<Buffer | null>;
2467
2913
  }
2468
- declare const defaultInterfaceNotFoundError: () => NetworkError;
2469
2914
  //#endregion
2470
- //#region src/errors/timeout.d.ts
2471
- declare class TimeoutError extends VmsanError {
2472
- readonly target?: string;
2473
- readonly timeoutMs?: number;
2474
- constructor(code: TimeoutErrorCode, options: ErrorOptions & {
2475
- target?: string;
2476
- timeoutMs?: number;
2477
- });
2478
- toJSON(): Record<string, unknown>;
2915
+ //#region src/lib/timeout-extender.d.ts
2916
+ interface TimeoutExtenderOptions {
2917
+ vmId: string;
2918
+ store: VmStateStore;
2919
+ paths: VmsanPaths;
2920
+ intervalMs?: number;
2921
+ signal?: AbortSignal;
2479
2922
  }
2480
- declare const socketTimeoutError: (socketPath: string) => TimeoutError;
2481
- declare const lockTimeoutError: (lockName: string) => TimeoutError;
2482
- declare const agentTimeoutError: (guestIp: string, timeoutMs: number) => TimeoutError;
2483
- //#endregion
2484
- //#region src/errors/setup.d.ts
2485
- declare class SetupError extends VmsanError {
2486
- constructor(code: SetupErrorCode, options: {
2487
- message: string;
2488
- fix?: string;
2489
- });
2923
+ declare class TimeoutExtender {
2924
+ private _timer;
2925
+ private _previousKillerPid;
2926
+ private readonly _vmId;
2927
+ private readonly _store;
2928
+ private readonly _paths;
2929
+ private readonly _intervalMs;
2930
+ private readonly _signal?;
2931
+ constructor(opts: TimeoutExtenderOptions);
2932
+ start(): void;
2933
+ stop(): void;
2934
+ private _extendSafe;
2935
+ private _extend;
2490
2936
  }
2491
- declare const missingBinaryError: (binary: string, path: string) => SetupError;
2492
- declare const noKernelDirError: () => SetupError;
2493
- declare const noKernelError: () => SetupError;
2494
- declare const noRootfsDirError: () => SetupError;
2495
- declare const noExt4RootfsError: () => SetupError;
2496
2937
  //#endregion
2497
- //#region src/lib/logger/index.d.ts
2498
- type OutputMode = "normal" | "json" | "verbose" | "silent";
2938
+ //#region src/lib/timeout-killer.d.ts
2939
+ interface SpawnTimeoutKillerOpts {
2940
+ vmId: string;
2941
+ pid: number;
2942
+ timeoutMs: number;
2943
+ stateFile: string;
2944
+ }
2499
2945
  /**
2500
- * Initialize both consola and evlog for the given output mode.
2501
- * Call once per CLI invocation, before any command runs.
2502
- *
2503
- * consola = human-facing CLI output (icons, colors, boxes, progress)
2504
- * evlog = machine-readable structured events (--json output)
2946
+ * Spawn a detached bash process that kills the VM after timeout.
2947
+ * The process sleeps for the timeout duration, then verifies the VM
2948
+ * is still running with the expected PID before sending SIGTERM.
2505
2949
  */
2506
- declare function initVmsanLogger(mode: OutputMode): void;
2507
- declare function getOutputMode(): OutputMode;
2508
- interface CommandLogger {
2509
- /** Add structured context to the wide event */
2510
- set: RequestLogger["set"];
2511
- /** Record an error in the wide event */
2512
- error: RequestLogger["error"];
2513
- /** Emit the wide event (only produces output in json/verbose modes) */
2514
- emit: () => void;
2950
+ declare function spawnTimeoutKiller(opts: SpawnTimeoutKillerOpts): ChildProcess;
2951
+ //#endregion
2952
+ //#region src/lib/vm-context.d.ts
2953
+ interface RunningVmContext {
2954
+ state: VmState & {
2955
+ agentToken: string;
2956
+ };
2957
+ guestIp: string;
2958
+ port: number;
2959
+ store: FileVmStateStore;
2515
2960
  }
2516
2961
  /**
2517
- * Create a command-scoped logger backed by an evlog RequestLogger.
2518
- * The wide event is emitted only in json/verbose modes.
2962
+ * Load VM state and validate it's running with an agent token.
2963
+ * Throws VmError on failure (handled by handleCommandError in the caller).
2519
2964
  */
2520
- declare function createCommandLogger(command: string): CommandLogger;
2965
+ declare function resolveVmState(vmId: string, paths: VmsanPaths): RunningVmContext;
2521
2966
  /**
2522
- * Create a scoped consola instance with a tag prefix.
2523
- * Output shows as `[tag] message`.
2967
+ * Poll the agent health endpoint until it responds OK.
2524
2968
  */
2525
- declare function createScopedLogger(tag: string): ConsolaInstance;
2526
- //#endregion
2527
- //#region src/errors/display.d.ts
2528
- declare function handleCommandError(error: unknown, cmdLog: CommandLogger): void;
2969
+ declare function waitForAgent(guestIp: string, port: number, timeoutMs?: number): Promise<void>;
2529
2970
  //#endregion
2530
- //#region src/services/vm.d.ts
2531
- interface StopResult {
2532
- vmId: string;
2533
- success: boolean;
2534
- error?: VmsanError;
2535
- alreadyStopped?: boolean;
2536
- }
2537
- interface UpdatePolicyResult {
2538
- vmId: string;
2539
- success: boolean;
2540
- previousPolicy: string;
2541
- newPolicy: string;
2542
- error?: VmsanError;
2543
- }
2544
- declare class VMService {
2545
- protected readonly paths: VmsanPaths;
2546
- protected store: FileVmStateStore;
2547
- constructor(paths: VmsanPaths);
2971
+ //#region src/stores/memory.d.ts
2972
+ declare class MemoryVmStateStore implements VmStateStore {
2973
+ private states;
2974
+ save(state: VmState): void;
2975
+ load(id: string): VmState | null;
2548
2976
  list(): VmState[];
2549
- get(vmId: string): VmState | null;
2550
- stop(vmId: string): Promise<StopResult>;
2551
- updateNetworkPolicy(vmId: string, policy: string, domains: string[], allowedCidrs: string[], deniedCidrs: string[]): Promise<UpdatePolicyResult>;
2552
- remove(vmId: string, opts?: {
2553
- force?: boolean;
2554
- }): Promise<StopResult>;
2555
- }
2556
- //#endregion
2557
- //#region src/lib/network.d.ts
2558
- interface NetworkConfig {
2559
- slot: number;
2560
- tapDevice: string;
2561
- hostIp: string;
2562
- guestIp: string;
2563
- subnetMask: string;
2564
- macAddress: string;
2565
- networkPolicy: string;
2566
- allowedDomains: string[];
2567
- allowedCidrs: string[];
2568
- deniedCidrs: string[];
2569
- publishedPorts: number[];
2570
- bandwidthMbit?: number;
2571
- netnsName?: string;
2572
- }
2573
- declare class NetworkManager {
2574
- config: NetworkConfig;
2575
- constructor(slot: number, networkPolicy: string, allowedDomains: string[], allowedCidrs: string[], deniedCidrs: string[], publishedPorts: number[], bandwidthMbit?: number, netnsName?: string);
2576
- static bootArgs(slot: number): string;
2577
- static fromConfig(config: NetworkConfig): NetworkManager;
2578
- static fromVmNetwork(network: VmNetwork): NetworkManager;
2579
- private nsRun;
2580
- setupNamespace(): void;
2581
- teardownNamespace(): void;
2582
- setupDevice(): void;
2583
- setupRules(): void;
2584
- setupThrottle(): void;
2585
- teardownThrottle(): void;
2586
- teardownRules(): void;
2587
- teardownDevice(): void;
2588
- setup(): Promise<void>;
2589
- teardown(): void;
2590
- updatePolicy(newPolicy: string, newDomains: string[], newAllowedCidrs: string[], newDeniedCidrs: string[]): void;
2977
+ update(id: string, updates: Partial<VmState>): void;
2978
+ delete(id: string): void;
2979
+ allocateNetworkSlot(): number;
2591
2980
  }
2592
2981
  //#endregion
2593
2982
  //#region src/lib/jailer.d.ts
@@ -2654,6 +3043,8 @@ interface ShellSessionOptions {
2654
3043
  token: string;
2655
3044
  shell?: string;
2656
3045
  sessionId?: string;
3046
+ initialCommand?: string;
3047
+ user?: string;
2657
3048
  }
2658
3049
  interface ShellCloseInfo {
2659
3050
  /** true when the shell process exited (e.g. user typed `exit`) */
@@ -2706,6 +3097,7 @@ declare class PidFile {
2706
3097
  }
2707
3098
  //#endregion
2708
3099
  //#region src/lib/utils.d.ts
3100
+ declare function toError(err: unknown): Error;
2709
3101
  /**
2710
3102
  * Send a signal to a process. Returns true if delivered, false if
2711
3103
  * the process is already dead (ESRCH). Falls back to sudo for
@@ -2732,81 +3124,6 @@ declare function table<T>(opts: {
2732
3124
  }>;
2733
3125
  }): string;
2734
3126
  //#endregion
2735
- //#region src/commands/create/types.d.ts
2736
- declare const VALID_RUNTIMES: readonly ["base", "node22", "node22-demo", "python3.13"];
2737
- type Runtime = (typeof VALID_RUNTIMES)[number];
2738
- declare const VALID_NETWORK_POLICIES: readonly ["allow-all", "deny-all", "custom"];
2739
- type NetworkPolicy = (typeof VALID_NETWORK_POLICIES)[number];
2740
- interface CreateLifecycleState {
2741
- networkConfig: NetworkConfig | undefined;
2742
- vmId: string | undefined;
2743
- chrootDir: string | undefined;
2744
- }
2745
- interface ParsedCreateInput {
2746
- vcpus: number;
2747
- memMib: number;
2748
- runtime: Runtime;
2749
- networkPolicy: NetworkPolicy;
2750
- ports: number[];
2751
- domains: string[];
2752
- allowedCidrs: string[];
2753
- deniedCidrs: string[];
2754
- timeoutMs: number | null;
2755
- snapshotId: string | null;
2756
- diskSizeGb: number;
2757
- }
2758
- interface CreateSummaryInput {
2759
- vmId: string;
2760
- pid: number | null;
2761
- vcpus: number;
2762
- memMib: number;
2763
- runtime: Runtime;
2764
- diskSizeGb: number;
2765
- project: string;
2766
- networkPolicy: NetworkPolicy;
2767
- domains: string[];
2768
- allowedCidrs: string[];
2769
- deniedCidrs: string[];
2770
- ports: number[];
2771
- kernelPath: string;
2772
- rootfsPath: string;
2773
- snapshotId: string | null;
2774
- timeout: string | undefined;
2775
- socketPath: string;
2776
- chrootDir: string;
2777
- tapDevice: string;
2778
- hostIp: string;
2779
- guestIp: string;
2780
- macAddress: string;
2781
- stateFilePath: string;
2782
- }
2783
- interface InitialVmStateInput {
2784
- vmId: string;
2785
- project: string;
2786
- runtime: Runtime;
2787
- diskSizeGb: number;
2788
- kernelPath: string;
2789
- rootfsPath: string;
2790
- vcpus: number;
2791
- memMib: number;
2792
- networkPolicy: NetworkPolicy;
2793
- domains: string[];
2794
- allowedCidrs: string[];
2795
- deniedCidrs: string[];
2796
- ports: number[];
2797
- tapDevice: string;
2798
- hostIp: string;
2799
- guestIp: string;
2800
- subnetMask: string;
2801
- macAddress: string;
2802
- snapshotId: string | null;
2803
- timeoutMs: number | null;
2804
- agentToken: string | null;
2805
- agentPort: number;
2806
- bandwidthMbit?: number;
2807
- netnsName?: string;
2808
- }
2809
- //#endregion
2810
3127
  //#region src/commands/create/input.d.ts
2811
3128
  interface CreateCommandRuntimeArgs {
2812
3129
  vcpus?: string;
@@ -2837,35 +3154,12 @@ declare function waitForSocket(socketPath: string, timeoutMs?: number): Promise<
2837
3154
  declare function getVmPid(vmId: string): number | null;
2838
3155
  declare function getVmJailerPid(vmId: string): number | null;
2839
3156
  //#endregion
2840
- //#region src/commands/create/connect.d.ts
2841
- declare function waitForAgent(guestIp: string, port: number, timeoutMs?: number): Promise<void>;
2842
- //#endregion
2843
3157
  //#region src/commands/create/cleanup.d.ts
2844
3158
  declare function killOrphanVmProcess(vmId: string): void;
2845
3159
  declare function markVmAsError(vmId: string, error: unknown, paths: VmsanPaths): void;
2846
3160
  declare function cleanupNetwork(networkConfig: NetworkConfig | undefined): void;
2847
3161
  declare function cleanupChroot(chrootDir: string | undefined): void;
2848
3162
  //#endregion
2849
- //#region src/commands/create/validation.d.ts
2850
- declare function parseVcpuCount(value: string | undefined): number;
2851
- declare function parseMemoryMib(value: string | undefined): number;
2852
- declare function parseRuntime(value: string | undefined): Runtime;
2853
- declare function parseNetworkPolicy(value: string | undefined): NetworkPolicy;
2854
- declare function parsePublishedPorts(value: string | undefined): number[];
2855
- declare function parseDomains(value: string | undefined): string[];
2856
- declare function parseCidrList(value: string | undefined): string[];
2857
- declare function validateCidr(cidr: string): void;
2858
- declare function validatePublishedPortsAvailable(ports: number[], paths: VmsanPaths): void;
2859
- interface ImageReference {
2860
- full: string;
2861
- name: string;
2862
- tag: string;
2863
- cacheKey: string;
2864
- }
2865
- declare function parseImageReference(ref: string): ImageReference;
2866
- declare function parseBandwidth(value: string | undefined): number | undefined;
2867
- declare function parseDiskSizeGb(value: string | undefined): number;
2868
- //#endregion
2869
3163
  //#region src/lib/seccomp.d.ts
2870
3164
  /**
2871
3165
  * Compile a Firecracker seccomp JSON filter to BPF using seccompiler-bin.
@@ -2889,4 +3183,4 @@ declare function resolveImageRootfs(imageRef: ImageReference, registryDir: strin
2889
3183
  //#region src/index.d.ts
2890
3184
  declare function getFirecrackerVersion(dir?: string): Promise<string | undefined>;
2891
3185
  //#endregion
2892
- export { AgentClient, type CgroupConfig, type CommandLogger, type CreateCommandRuntimeArgs, type CreateLifecycleState, type CreateSummaryInput, FileLock, FileVmStateStore, FirecrackerApiError, FirecrackerClient, type components as FirecrackerComponents, type FirecrackerErrorCode, type paths as FirecrackerPaths, type ImageReference, type InitialVmStateInput, Jailer, type JailerPaths, type NetworkConfig, NetworkError, type NetworkErrorCode, NetworkManager, type NetworkPolicy, type OutputMode, type ParsedCreateInput, PidFile, type PrepareChrootConfig, type RunEvent, type RunParams, type Runtime, type SessionInfo, SetupError, type SetupErrorCode, ShellSession, type ShellSessionOptions, type SpawnJailerConfig, type StopResult, TimeoutError, type TimeoutErrorCode, type UpdatePolicyResult, type VALID_NETWORK_POLICIES, type VALID_RUNTIMES, VMService, ValidationError, type ValidationErrorCode, VmError, type VmErrorCode, type VmNetwork, type VmState, type VmStateStore, VmsanError, type VmsanErrorCode, type VmsanPaths, type WriteFileEntry, agentTimeoutError, buildCreateSummaryLines, buildInitialVmState, chrootNotFoundError, cleanupChroot, cleanupNetwork, compileSeccompFilter, connectShell, createCommandLogger, createScopedLogger, defaultInterfaceNotFoundError, detectCgroupVersion, ensureSeccompFilter, findKernel, findRootfs, firecrackerApiError, firecrackerFetch, generateVmId, getFirecrackerVersion, getOutputMode, getVmJailerPid, getVmPid, handleCommandError, initVmsanLogger, invalidCidrFormatError, invalidCidrOctetError, invalidCidrPrefixError, invalidDiskSizeFormatError, invalidDiskSizeRangeError, invalidDomainError, invalidDomainPatternError, invalidDurationError, invalidImageRefEmptyError, invalidImageRefTagError, invalidIntegerFlagError, invalidNetworkPolicyError, invalidPortError, invalidRuntimeError, isProcessAlive, killOrphanVmProcess, lockTimeoutError, markVmAsError, missingBinaryError, mkdirSecure, mutuallyExclusiveFlagsError, networkSlotsExhaustedError, noExt4RootfsError, noKernelDirError, noKernelError, noRootfsDirError, parseBandwidth, parseCidrList, parseCreateInput, parseDiskSizeGb, parseDomains, parseDuration, parseImageReference, parseMemoryMib, parseNetworkPolicy, parsePublishedPorts, parseRuntime, parseVcpuCount, policyConflictError, portConflictError, resolveImageRootfs, safeKill, snapshotNotFoundError, socketTimeoutError, table, timeAgo, timeRemaining, validateCidr, validateEnvironment, validatePublishedPortsAvailable, vmNotFoundError, vmNotRunningError, vmNotStoppedError, vmStateNotFoundError, vmsanPaths, waitForAgent, waitForSocket, writeSecure };
3186
+ export { AgentClient, type CgroupConfig, type CommandLogger, type CreateCommandRuntimeArgs, type CreateLifecycleState, type CreateSummaryInput, type CreateVmOptions, type CreateVmResult, FileLock, FileVmStateStore, FirecrackerApiError, FirecrackerClient, type components as FirecrackerComponents, type FirecrackerErrorCode, type paths as FirecrackerPaths, type ImageReference, type InitialVmStateInput, Jailer, type JailerPaths, MemoryVmStateStore, type NetworkConfig, NetworkError, type NetworkErrorCode, NetworkManager, type NetworkPolicy, type OutputMode, type ParsedCreateInput, PidFile, type PrepareChrootConfig, type RunEvent, type RunParams, type RunningVmContext, type Runtime, type SessionInfo, SetupError, type SetupErrorCode, ShellSession, type ShellSessionOptions, type SpawnJailerConfig, type SpawnTimeoutKillerOpts, type StartVmResult, type StopResult, TimeoutError, type TimeoutErrorCode, TimeoutExtender, type TimeoutExtenderOptions, type UpdatePolicyResult, type VALID_NETWORK_POLICIES, type VALID_RUNTIMES, VMService, ValidationError, type ValidationErrorCode, VmError, type VmErrorCode, type VmNetwork, type VmPhase, type VmState, type VmStateStore, type VmsanContext, VmsanError, type VmsanErrorCode, type VmsanHooks, type VmsanLogger, type VmsanOptions, type VmsanPaths, type VmsanPlugin, type WriteFileEntry, agentTimeoutError, buildCreateSummaryLines, buildInitialVmState, chrootNotFoundError, cleanupChroot, cleanupNetwork, compileSeccompFilter, connectShell, createCommandLogger, createDefaultLogger, createScopedLogger, createSilentLogger, createVmsan, defaultInterfaceNotFoundError, definePlugin, detectCgroupVersion, ensureSeccompFilter, findFreeNetworkSlot, findKernel, findRootfs, firecrackerApiError, firecrackerFetch, generateVmId, getActiveTapSlots, getFirecrackerVersion, getOutputMode, getVmJailerPid, getVmPid, handleCommandError, initVmsanLogger, invalidCidrFormatError, invalidCidrOctetError, invalidCidrPrefixError, invalidDiskSizeFormatError, invalidDiskSizeRangeError, invalidDomainError, invalidDomainPatternError, invalidDurationError, invalidImageRefEmptyError, invalidImageRefTagError, invalidIntegerFlagError, invalidNetworkPolicyError, invalidPortError, invalidRuntimeError, isProcessAlive, killOrphanVmProcess, lockTimeoutError, markVmAsError, missingBinaryError, mkdirSecure, mutuallyExclusiveFlagsError, networkSlotsExhaustedError, noExt4RootfsError, noKernelDirError, noKernelError, noRootfsDirError, parseBandwidth, parseCidrList, parseCreateInput, parseDiskSizeGb, parseDomains, parseDuration, parseImageReference, parseMemoryMib, parseNetworkPolicy, parsePublishedPorts, parseRuntime, parseVcpuCount, policyConflictError, portConflictError, resolveImageRootfs, resolveVmState, safeKill, snapshotNotFoundError, socketTimeoutError, spawnTimeoutKiller, table, timeAgo, timeRemaining, toError, validateCidr, validateEnvironment, validatePublishedPortsAvailable, vmNoAgentTokenError, vmNotFoundError, vmNotRunningError, vmNotStoppedError, vmStateNotFoundError, vmsanPaths, waitForAgent, waitForSocket, writeSecure };