Files
openclaw/src/browser/server-lifecycle.ts
Vincent Koc 476d948732 !refactor(browser): remove Chrome extension path and add MCP doctor migration (#47893)
* Browser: replace extension path with Chrome MCP

* Browser: clarify relay stub and doctor checks

* Docs: mark browser MCP migration as breaking

* Browser: reject unsupported profile drivers

* Browser: accept clawd alias on profile create

* Doctor: narrow legacy browser driver migration
2026-03-15 23:56:08 -07:00

48 lines
1.4 KiB
TypeScript

import { stopOpenClawChrome } from "./chrome.js";
import type { ResolvedBrowserConfig } from "./config.js";
import {
type BrowserServerState,
createBrowserRouteContext,
listKnownProfileNames,
} from "./server-context.js";
export async function ensureExtensionRelayForProfiles(_params: {
resolved: ResolvedBrowserConfig;
onWarn: (message: string) => void;
}) {
// Intentional no-op: the Chrome extension relay path has been removed.
// runtime-lifecycle still calls this helper, so keep the stub until the next
// breaking cleanup rather than changing the call graph in a patch release.
}
export async function stopKnownBrowserProfiles(params: {
getState: () => BrowserServerState | null;
onWarn: (message: string) => void;
}) {
const current = params.getState();
if (!current) {
return;
}
const ctx = createBrowserRouteContext({
getState: params.getState,
refreshConfigFromDisk: true,
});
try {
for (const name of listKnownProfileNames(current)) {
try {
const runtime = current.profiles.get(name);
if (runtime?.running) {
await stopOpenClawChrome(runtime.running);
runtime.running = null;
continue;
}
await ctx.forProfile(name).stopRunningBrowser();
} catch {
// ignore
}
}
} catch (err) {
params.onWarn(`openclaw browser stop failed: ${String(err)}`);
}
}