/** 9222 belongs to the auto-answer browser; the debug pool never uses it. */ export declare const AUTO_ANSWER_PORT = 9222; /** Normalize an explicit session name, or null when it carries nothing. */ export declare function normalizeSessionKey(raw: unknown): string | null; /** * The session key a command runs against. * * Explicit name > the caller's identity (`agent:`), so two agents on one * PC never collide and a later action without a sessionId still lands on the * browser its own `browser_open` created. */ export declare function deriveSessionKey(explicit: unknown, agentUserId: string | null | undefined): string; /** Filesystem-safe, collision-resistant slug for a session's profile dir. */ export declare function sessionSlug(key: string): string; /** * The first free debug port at or above `preferred`. * * Returns null when the whole span is taken (a machine running that many * browsers needs a human, not a guess). */ export declare function pickDebugPort(preferred: number, used: Iterable, span?: number): number | null; export interface ProfileChoice { dir: string; /** True when this session got the shared debug profile. */ shared: boolean; /** Set when a NAMED profile is already owned by another live session. */ conflict?: string; } /** * Pick a user-data-dir for a session. * * `baseDir` is the shared debug profile (`~/.teamshare/chrome-profile-debug`). * The FIRST live session keeps it (so logins persist exactly as before); any * additional concurrent session gets `…-sessions/`, because Chrome cannot * run two processes on one user-data-dir. A caller-supplied named profile is * exclusive: a second session asking for the same name is refused rather than * silently given different cookies. */ export declare function pickDebugProfileDir(opts: { baseDir: string; sessionKey: string; usedDirs: Iterable; namedDir?: string; /** Force an isolated per-session profile, never the shared one (2026-11). */ forceIsolated?: boolean; }): ProfileChoice; /** Normalize a test-account label for comparison (2026-11). */ export declare function normalizeActor(raw: unknown): string | null; /** * Resolve the session a no-sessionId command runs against (2026-11). * * Explicit > the caller's remembered names > the derived identity default. * Only the CALLER's windows count: another agent's Chrome on the same machine * must never make my action ambiguous. With two or more of MY live windows * and no name, the command is AMBIGUOUS — acting on "whichever was touched * last" would drive the wrong Chrome. */ export declare function resolveSessionForCommand(input: { explicit?: string | null; remembered: string[]; derived: string; live: Array<{ id: string; actor?: string | null; }>; }): { sessionId: string; } | { ambiguous: Array<{ id: string; actor?: string | null; }>; }; /** * Actor gate for tagged windows (2026-11). A window never changes hands: * a login in the Admin window can only be the Admin. */ export declare function assertActorForLogin(input: { sessionActor?: string | null; callActor?: string | null; }): null | { code: 'ACTOR_REQUIRED' | 'WRONG_SESSION_ACTOR'; message: string; };