/** * Single-instance guard for the runner. * * Two `@melaya/runner` processes for the same user fight over one server-side * session: the server routes an assistant/pipeline turn to ONE socket, so a * second runner produces connect/disconnect churn, split state, and turns that * land on the wrong host. This lock makes a second launch on the same machine * refuse up front ("can't start if another is already open") instead of quietly * competing. * * Machine-scoped by design: it prevents the common footgun (double-launching on * one box). It does NOT stop a runner on a *different* machine — that's a * legitimate multi-device case, and the server's own per-user limit + the * session reattach logic handle cross-machine arbitration. * * The lock is a small JSON file holding the owning pid. A stale lock (owner pid * no longer alive — e.g. a hard kill that skipped cleanup) is reclaimed * automatically, so a crash never permanently blocks the next start. */ export type LockResult = { ok: true; } | { ok: false; ownerPid: number; }; /** * Try to acquire the machine-wide runner lock. Returns {ok:true} and installs * process-exit cleanup on success; {ok:false, ownerPid} if a live runner * already holds it. A stale lock (dead owner) is reclaimed. */ export declare function acquireSingleInstanceLock(): LockResult;