import { type MachineEntry, type MachineRegistry } from '../tasks/dispatch-utils.js'; interface CommandParams { action: string; params: Record; timeout?: number; } declare function startClientManager(port: number): void; declare function stopClientManager(): void; declare function getOnlineDevices(): Array<{ device: string; platform: string; connectedAt: Date; lastHeartbeat: Date; capabilities: string[]; }>; declare function isDeviceOnline(device: string): boolean; declare function sendCommand(device: string, command: CommandParams): Promise; declare function getPid(device: string): number | undefined; declare function setPid(device: string, pid: number): void; declare function deletePid(device: string): void; declare const clientPids: { get: typeof getPid; set: typeof setPid; delete: typeof deletePid; }; declare function sshExec(host: string, command: string, timeout?: number): Promise; type SshExec = (host: string, command: string, timeout?: number) => Promise; /** * Build the shell command run over SSH to spawn cortex-client on a remote device. * * Windows note: WMI `Win32_Process.Create` does NOT perform PATH lookup, and * `cortex-client` installed by npm on Windows is a `.cmd` shim * (e.g. `C:\Users\\AppData\Roaming\npm\cortex-client.cmd`). Passing the bare * name returns ReturnValue=9 (Path Not Found) with an empty ProcessId, which * over SSH serializes to "" and the parent caller logs * `Failed to parse PID for : ""`. Wrapping with `cmd.exe /c` makes cmd * do the PATH lookup and run the .cmd shim correctly. * * Linux note: the shell handles PATH lookup; `nohup` detaches and `echo $!` * returns the child PID on stdout. */ declare function buildRemoteSpawnCommand(reg: MachineEntry, clientToken?: string): string; /** * Build the shell command run over SSH to install the client tgz on a remote device * during a dev-mode hot-reload. * * Defaults to a bare `npm install -g `. Install command is configurable per machine * (machines.json `installCommand`) for hosts where `npm` is not on the non-interactive * SSH PATH — e.g. nvm installs, where node/npm are only sourced in a login/interactive * profile, so a plain `ssh host 'npm install -g …'` fails with "command not found". * The template may contain the `{tgz}` placeholder for the remote tgz path; if the * placeholder is absent, the path is appended. Examples of an override: * "bash -lc 'source ~/.nvm/nvm.sh && npm install -g {tgz}'" * "/home/u/.nvm/versions/node/v20.19.5/bin/npm install -g" */ declare function buildRemoteInstallCommand(reg: MachineEntry, remoteTgzPath: string): string; declare function startRemoteClient(device: string): Promise; /** Start clients on all registered devices */ declare function startAllRemoteClients(): Promise; declare function _setSshExecForTesting(fn: SshExec): void; declare function _setMachineRegistryProviderForTesting(fn: () => MachineRegistry): void; declare function _getRestartTimerCount(): number; declare function _testReset(): void; export { startClientManager, stopClientManager, getOnlineDevices, isDeviceOnline, sendCommand, startRemoteClient, startAllRemoteClients, buildRemoteSpawnCommand, buildRemoteInstallCommand, clientPids, sshExec, _setSshExecForTesting, _setMachineRegistryProviderForTesting, _getRestartTimerCount, _testReset, };