import { BrowserSessionManager, type CloseAllResult } from './browser-session-manager.js'; import { type WebOp, type WebOpResponse } from './web-protocol.js'; /** Loopback only: the bearer token is the second lock, not the only one. */ export declare const DAEMON_HOST = "127.0.0.1"; export interface WebDaemonConfig { readonly projectRoot: string; readonly sessionId: string; /** `peaks-loop` version written into `daemon.json`. */ readonly version: string; } export interface RunningWebDaemon { readonly port: number; readonly token: string; /** * Close every context, persist each dispatch's `storageState.json`, close the * browser process, stop listening and remove `daemon.json`. * * Returns the teardown result rather than swallowing it: a `storageState.json` * that could not be written is silent data loss for S4's login profile (R1). */ readonly close: () => Promise; } /** * Start the daemon. Resolves once the server is listening and `daemon.json` * exists, so the caller (and every poller in `ensureDaemon`) can treat the * resolution as "reachable". */ export declare function startWebDaemon(config: WebDaemonConfig): Promise; /** * Serve one op. Exported separately from the server so every verb's payload * shape and failure code are unit-testable without a socket. * * The manager arrives as a PROVIDER, not a value: acquiring it is what launches * chromium, so it must happen only for ops that actually need a page. An op the * daemon does not serve (`install`, `login`, a typo) must answer without * starting a browser at all. */ export declare function routeOp(op: WebOp, args: Readonly>, managerFor: () => Promise): Promise;