/** * Live harness probe. * * Reports what is already running for a working tree: the host session, a * live daemon pid, ruflo MCP servers whose cwd is inside the tree, processes * holding the memory databases open, and teams that are still active. * * The probe is observe-only. It never writes to disk, never starts anything, * and never touches the network. It spawns at most one `ps` and two `lsof` * calls, all under one overall deadline, and says "unavailable" instead of * guessing when those tools are missing (Windows, minimal Linux). * * All OS access goes through `HarnessSys` so the probe can be tested without * real processes. */ export type ProbeState = 'ok' | 'unavailable' | 'timeout'; export interface RunResult { stdout: string; state: ProbeState; status: number | null; } export interface HarnessSys { platform: NodeJS.Platform; env: NodeJS.ProcessEnv; pid: number; ppid: number; cwd(): string; now(): number; run(cmd: string, args: string[], timeoutMs: number): RunResult; signal0(pid: number): 'alive' | 'dead' | 'eperm'; exists(path: string): boolean; readFile(path: string): string; readDir(path: string): Array<{ name: string; isDir: boolean; }>; mtimeMs(path: string): number | undefined; realpath(path: string): string; readlink(path: string): string | undefined; } export interface ProcRow { pid: number; ppid: number; argv: string[]; } export interface LiveHarness { root: string; host: string; parent: { pid: number; name: string; }; session: Record; daemon: { state: 'live' | 'down' | 'stale'; pid?: number; verified?: boolean; reason?: string; }; mcp: { count: number | null; servers: Array<{ pid: number; command: string; }>; }; memory: { files: string[]; openPids: number[] | null; }; teams: Array<{ name: string; status: string; members: number; lastActivity?: string; }>; staleTeams: string[]; probes: { ps: ProbeState; lsof: ProbeState; }; status: 'live' | 'idle' | 'unknown'; elapsedMs: number; line: string; } export interface CollectOptions { root?: string; budgetMs?: number; teamTtlMs?: number; } export declare const realSys: HarnessSys; /** The host's project dir if it says so, else the nearest `.git` above cwd, else cwd. */ export declare function findWorkspaceRoot(sys: HarnessSys): string; /** True when `path` is one of `roots` or lies inside one on a path boundary. */ export declare function insideRoot(path: string, roots: string[]): boolean; export declare function parsePs(stdout: string): ProcRow[]; /** Name a process by its program, looking past node/bun to the script. */ export declare function programName(argv: string[]): string; /** A ruflo MCP server: a launcher, a ruflo identity token, then `mcp [start]`. */ export declare function isRufloMcp(argv: string[]): boolean; /** Program name and subcommand words only; every argument is dropped and counted. */ export declare function redactCommand(argv: string[]): string; export declare function detectHost(sys: HarnessSys, table: Map | null): { host: string; parent: { pid: number; name: string; }; }; export declare function collectLiveHarness(sys?: HarnessSys, opts?: CollectOptions): LiveHarness; //# sourceMappingURL=live-harness.d.ts.map