UNPKG

@fly/sprites

Version:

JavaScript/TypeScript SDK for Sprites - remote command execution

61 lines 1.35 kB
/** * WebSocket communication layer for command execution */ import { EventEmitter } from 'node:events'; import { Writable } from 'node:stream'; /** * WebSocket command execution handler */ export declare class WSCommand extends EventEmitter { private url; private headers; private ws; private exitCode; private tty; private started; private done; readonly stdout: Writable; readonly stderr: Writable; constructor(url: string, headers: Record<string, string>, tty?: boolean); /** * Start the WebSocket connection */ start(): Promise<void>; /** * Handle incoming WebSocket messages */ private handleMessage; /** * Handle WebSocket close */ private handleClose; /** * Write data to stdin */ writeStdin(data: Buffer): void; /** * Send stdin EOF */ sendStdinEOF(): void; /** * Send resize control message (TTY only) */ resize(cols: number, rows: number): void; /** * Get the exit code */ getExitCode(): number; /** * Check if the command is done */ isDone(): boolean; /** * Close the WebSocket connection */ close(): void; /** * Wait for the command to complete */ wait(): Promise<number>; } //# sourceMappingURL=websocket.d.ts.map