import type { UpdateFrame } from './protocol.js'; /** Managed install root: DATA_DIR/client/{current,previous,next}/ — fixed paths, no symlinks. */ export declare const CLIENT_INSTALL_DIR: string; /** The complete update artifact, hashed in this exact order on both ends. * `cortex-run-watcher.mjs` is a compatibility stub since cortex-run was removed: a client * installed before the removal rejects any package missing that name (validateUpdate below), * so dropping it would strand every deployed client on its current version. Remove it from * both ends together once no pre-removal client is left. */ export declare const BUNDLE_FILES: readonly ['client.mjs', 'cortex-run-watcher.mjs']; export interface UpdateIo { sendResult: (ok: boolean, error?: string) => void; closeWs: () => void; respawn: (entryPath: string) => void; exit: (code: number) => void; } /** sha256 over the artifact set in a directory, or null if any file is missing. */ export declare function hashBundleFiles(dir: string): string | null; /** * Identity reported in hello. A managed install hashes the artifact set beside its * own entry file; anything else (repo dist, npm install) falls back to hashing the * entry file alone — which can never equal an artifact hash, so unmanaged clients * are adopted into the managed layout on their first hello. */ export declare function computeSelfBundleHash(entryPath?: string): string; export declare function defaultRespawn(entryPath: string): void; /** * Install an update pushed by the server: write to next/, verify the hash, rotate * current→previous, report the result, then close the socket (frees the device * name server-side), spawn the successor from current/ and exit. Any failure * leaves the running version in place — the device never goes offline over a * failed update. */ export declare function handleUpdateMessage(msg: UpdateFrame, io: UpdateIo): void;