mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-21 15:01:03 +00:00
* 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
48 lines
1.4 KiB
TypeScript
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)}`);
|
|
}
|
|
}
|