This commit is contained in:
2026-02-08 21:47:33 +00:00
commit d8b5e8a6c0
22 changed files with 11080 additions and 0 deletions

48
ts/interfaces/api.ts Normal file
View File

@@ -0,0 +1,48 @@
/**
* Options for the SocketClient.
*/
export interface ISocketClientOptions {
/** Path to the Firecracker Unix domain socket. */
socketPath: string;
}
/**
* Standardized API response from the socket client.
*/
export interface IApiResponse<T = any> {
/** HTTP status code. */
statusCode: number;
/** Parsed response body. */
body: T;
/** Whether the request was successful (2xx). */
ok: boolean;
}
/**
* Options for spawning a Firecracker process.
*/
export interface IFirecrackerProcessOptions {
/** Path to the firecracker binary. */
binaryPath: string;
/** Path for the API Unix domain socket. */
socketPath: string;
/** Log level for Firecracker. */
logLevel?: string;
}
/**
* Custom error class for SmartVM operations.
*/
export class SmartVMError extends Error {
public code: string;
public statusCode?: number;
public details?: any;
constructor(message: string, code: string, statusCode?: number, details?: any) {
super(message);
this.name = 'SmartVMError';
this.code = code;
this.statusCode = statusCode;
this.details = details;
}
}