/** * Socket.IO connection to the Melaya cloud server. * * Handles: * - Authenticated connection via runner token * - Reporting detected local models * - Receiving run commands (runner:run) * - Spawning Python subprocess with correct env vars * - Relaying events back via the local HTTP relay * - Heartbeat to keep the connection alive * - Graceful disconnect on Ctrl+C */ import { type DetectedModel } from "./detect.js"; interface ConnectOpts { token: string; serverUrl: string; /** The interpreter, or a promise of it: the socket connects before Python is * resolved (cli.ts). null = no usable Python (the CLI then exits). */ pythonPath: string | Promise; /** Initial list (last good from disk, or empty); fresh discovery arrives via publishModels. */ models: DetectedModel[]; verbose: boolean; } /** What cli.ts uses after connect(): publish fresh discovery, print around the spinner. */ export interface RunnerConnection { /** Replace the model list and push it through `runner:models` when it changed. */ publishModels(models: DetectedModel[]): void; /** * Forced rescan now (desktop app "rescan_models"): scanProviders({ force: true }), * then publish like the periodic rescan. Coalesced: requests share a scan in * flight, at most one forced scan per 5 s (modelRescan.ts). Resolves with the list. */ rescanModels(): Promise; /** console.log that keeps the connect spinner intact. */ print(line: string): void; } export declare function connect(opts: ConnectOpts): Promise; export declare function verifySignature(content: string, signature: string, runnerToken: string): boolean; export {};