/** * Raw (pre-realpath) isolated workspace directory for a botmux session. * * `BOTMUX_MOJO_WORKSPACE_ROOT` overrides the whole root. Its primary consumer * is the test setup (test/unit-setup.ts), which fences it into a temp dir the * same way SESSION_DATA_DIR is fenced — without it, every unit test that * drives a real MojoBackend turn mints directories under the developer's real * ~/.botmux/mojo-workspaces (observed live). Operators may also point it at a * faster/bigger volume; spawn and close read the same value, so the pairing * stays consistent within one daemon process. */ export declare function mojoIsolatedWorkspacePath(sessionId: string, home?: string): string; /** * Create (idempotently) and resolve the isolated workspace for a session. * Returns the REALPATH — the exact string mojo's daemon will record as its * workspace (macOS `/var` → `/private/var` style symlinks make the raw path and * the recorded workspace differ, so every consumer must use this value). */ export declare function ensureMojoIsolatedWorkspace(sessionId: string, home?: string): string; /** mojo's workspace-hash (reverse-engineered, byte-verified against the live * registry): h = h*31 + charCode | 0 over the string, unsigned, base36. */ export declare function mojoWorkspaceHash(workspace: string): string; export type MojoDaemonReapResult = { outcome: 'killed'; daemonId: string; pid: number; forced: boolean; } | { outcome: 'not-found'; reason: string; } | { outcome: 'mismatch'; daemonId: string; pid: number; reason: string; }; export interface MojoDaemonReapDeps { daemonsDir: string; readdir: (dir: string) => string[]; readFile: (path: string) => string; /** Sends a signal; must throw ESRCH-like on a missing pid (process.kill semantics). */ kill: (pid: number, signal: NodeJS.Signals | 0) => void; /** Resolve the command line of a pid, or null when it does not exist. */ pidCommand: (pid: number) => string | null; unlink: (path: string) => void; sleep: (ms: number) => Promise; } export declare const defaultMojoDaemonReapDeps: MojoDaemonReapDeps; /** * Reap the daemon bound to `workspaceRealpath` (SIGTERM → bounded wait → * SIGKILL) and remove its registry file. Never throws: a reaping failure is an * availability loss (a leaked idle daemon), never a reason to fail a close — * the caller only logs the structured outcome. * * pid-reuse guard: the pid is signalled only when its live command line * contains `mojo` — a recycled pid belonging to something else is reported as * `mismatch` and left alone. */ export declare function reapMojoIsolatedDaemon(workspaceRealpath: string, deps?: MojoDaemonReapDeps): Promise; /** * Full close-time cleanup for one botmux session: reap its daemon (when the * isolated dir ever existed) and remove the directory. Shared by * MojoBackend.destroySession() and the daemon's workerless close path. */ export declare function cleanupMojoIsolatedWorkspace(sessionId: string, opts?: { home?: string; deps?: MojoDaemonReapDeps; }): Promise; //# sourceMappingURL=mojo-isolated-workspace.d.ts.map