/** * Named sessions - per-session bridge isolation. * * Setting `CHROME_DEVTOOLS_AXI_SESSION` to a non-default name binds the * bridge's port and on-disk state (PID file, snapshot-generation counter, * selected-page-id) to that name, so multiple bridges can run concurrently - * one per agent session, worktree, or test worker - without sharing a single * bridge or stepping on each other's stale-ref tracking. * * CHROME_DEVTOOLS_AXI_SESSION=worker-1 chrome-devtools-axi open ... * CHROME_DEVTOOLS_AXI_SESSION=worker-2 chrome-devtools-axi open ... * * Session identity does not choose a transport or browser profile. See README * Configuration for local browser and shared MCP service setup. * * Precedence: * port - CHROME_DEVTOOLS_AXI_PORT > deterministic hash of the session name * state dir - always derived from the session name * * The default session name is "default", which preserves prior behavior: port * 9224 and the legacy `~/.chrome-devtools-axi/` state paths. */ export declare const DEFAULT_SESSION_NAME = "default"; export declare const DEFAULT_BASE_PORT = 9224; /** * Resolve the active session name from `CHROME_DEVTOOLS_AXI_SESSION`. Returns * DEFAULT_SESSION_NAME when unset, empty, or whitespace. * * A configured-but-unsafe name throws (via `validateSessionName`). This is the * single chokepoint through which every command obtains the active session, so * validating here guarantees that no entry point - `ensureBridge`, `stopBridge`, * `getSessionSnapshotIfRunning`, the generation counter, the selected-page * id, or the bridge itself - * can resolve an invalid name into a filesystem path that collapses onto the * default session's directory. */ export declare function resolveSessionName(): string; /** * Throw if a non-default session name is unsafe for a filesystem path. Allows * 1-64 chars from `[A-Za-z0-9._-]`; rejects path traversal, separators, shell * metacharacters, overlong names, and names made only of dots (`.` / `..` / * `...`), which `resolveSessionStateDir` would otherwise collapse onto the * default session's directory. */ export declare function validateSessionName(name: string): void; /** * Deterministic port for a session name: an FNV-1a hash mapped into * [DEFAULT_BASE_PORT+1, DEFAULT_BASE_PORT+SESSION_PORT_RANGE]. The default * session keeps DEFAULT_BASE_PORT. Two distinct names can hash to the same * port - a concurrency limit, not a correctness bug; set * CHROME_DEVTOOLS_AXI_PORT to break a collision. */ export declare function defaultPortForSession(name: string): number; /** * Resolve the bridge port for a session: explicit `CHROME_DEVTOOLS_AXI_PORT` * wins, otherwise the session-derived default. */ export declare function resolveSessionPort(name?: string): number; /** * State directory for a session. The default session keeps the legacy * `~/.chrome-devtools-axi/` path so existing tools and older versions stay * compatible; named sessions live under a per-name subdirectory. */ export declare function resolveSessionStateDir(name?: string): string; /** PID file path for a session, under its state directory. */ export declare function resolveSessionPidFile(name?: string): string;