Function: discoverSessionBrowserInProfiles()
discoverSessionBrowserInProfiles(
profilesRoot?):Promise<SessionBrowser|undefined>
Defined in: packages/aiui-util/src/browser.ts:93
Find a LIVE session browser among the user-level profiles (~/.cache/aiui/userdata/<profile>) — the ONLY location aiui launches session browsers into since the browser-profiles redesign. Scans each profile dir for a DevToolsActivePort, probes the newest-written first, and returns the first endpoint that actually ANSWERS; a stale port file (the browser died) is skipped by the liveness check.
The legacy project-local .aiui-cache/chrome/** layout is deliberately NOT scanned. A session browser left running there by an OLD checkout is an orphan this session never launched, and surfacing it here made discovery latch onto the wrong browser — the source of a phantom "CDP endpoint moved" warning (2026-07-20). Discovery must only ever find browsers under the current profiles root.
Parameters
profilesRoot?
string = ...
Returns
Promise<SessionBrowser | undefined>