feat(tools): add a browser.cdpUrl setting for the default automation target
Attaching to a long-running browser (a signed-in profile, an Electron app kept open for a session) meant repeating app.cdp_url on every browser call, and any call that omitted it silently launched a fresh headless Chromium instead. browser.cdpUrl supplies that endpoint once. It is a default rather than an override: app.cdp_url and app.path still win, and an unset or blank value leaves cmux and headless resolution exactly as before.
This commit is contained in:
@@ -95,6 +95,11 @@ function resolveBrowserKind(params: BrowserParams, session: ToolSession): Browse
|
||||
const exe = resolveToCwd(app.path, session.cwd);
|
||||
return { kind: "spawned", path: exe };
|
||||
}
|
||||
// A configured endpoint is a default, not an override: explicit app options win.
|
||||
const configuredCdpUrl = (session.settings.get("browser.cdpUrl") as string | undefined)?.trim();
|
||||
if (configuredCdpUrl) {
|
||||
return { kind: "connected", cdpUrl: configuredCdpUrl.replace(/\/+$/, "") };
|
||||
}
|
||||
const cmuxKind = resolveCmuxKind({
|
||||
settingEnabled: session.settings.get("browser.cmux") as boolean | undefined,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user