mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-02 02:30:22 +00:00
refactor: finish browser compat untangle
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
export { startBrowserBridgeServer, stopBrowserBridgeServer } from "./browser/bridge-server.js";
|
||||
export type { BrowserBridge } from "./browser/bridge-server.js";
|
||||
export {
|
||||
browserAct,
|
||||
browserArmDialog,
|
||||
@@ -32,8 +34,20 @@ export type {
|
||||
ProfileStatus,
|
||||
SnapshotResult,
|
||||
} from "./browser/client.js";
|
||||
export type { BrowserExecutable } from "./browser/chrome.executables.js";
|
||||
export type { ResolvedBrowserConfig, ResolvedBrowserProfile } from "./browser/config.js";
|
||||
export { resolveBrowserConfig, resolveProfile } from "./browser/config.js";
|
||||
export { DEFAULT_AI_SNAPSHOT_MAX_CHARS } from "./browser/constants.js";
|
||||
export {
|
||||
DEFAULT_AI_SNAPSHOT_MAX_CHARS,
|
||||
DEFAULT_BROWSER_EVALUATE_ENABLED,
|
||||
DEFAULT_OPENCLAW_BROWSER_COLOR,
|
||||
DEFAULT_OPENCLAW_BROWSER_PROFILE_NAME,
|
||||
} from "./browser/constants.js";
|
||||
export {
|
||||
parseBrowserMajorVersion,
|
||||
readBrowserVersion,
|
||||
resolveGoogleChromeExecutableForPlatform,
|
||||
} from "./browser/chrome.executables.js";
|
||||
export { redactCdpUrl } from "./browser/cdp.helpers.js";
|
||||
export { DEFAULT_UPLOAD_DIR, resolveExistingPathsWithinRoot } from "./browser/paths.js";
|
||||
export { getBrowserProfileCapabilities } from "./browser/profile-capabilities.js";
|
||||
@@ -44,10 +58,12 @@ export {
|
||||
resolveRequestedBrowserProfile,
|
||||
} from "./browser/request-policy.js";
|
||||
export {
|
||||
closeTrackedBrowserTabsForSessions,
|
||||
trackSessionBrowserTab,
|
||||
untrackSessionBrowserTab,
|
||||
} from "./browser/session-tab-registry.js";
|
||||
export { ensureBrowserControlAuth, resolveBrowserControlAuth } from "./browser/control-auth.js";
|
||||
export { movePathToTrash } from "./browser/trash.js";
|
||||
export {
|
||||
createBrowserControlContext,
|
||||
getBrowserControlState,
|
||||
|
||||
@@ -94,7 +94,6 @@ export {
|
||||
selectDefaultNodeFromList,
|
||||
safeParseJson,
|
||||
shortenHomePath,
|
||||
startBrowserControlServerIfEnabled,
|
||||
stringEnum,
|
||||
theme,
|
||||
withTimeout,
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import {
|
||||
startBrowserControlServerIfEnabled,
|
||||
startLazyPluginServiceModule,
|
||||
type LazyPluginServiceHandle,
|
||||
type OpenClawPluginService,
|
||||
} from "openclaw/plugin-sdk/browser-support";
|
||||
|
||||
type BrowserControlHandle = Awaited<ReturnType<typeof startBrowserControlServerIfEnabled>>;
|
||||
type BrowserControlHandle = LazyPluginServiceHandle | null;
|
||||
|
||||
export function createBrowserPluginService(): OpenClawPluginService {
|
||||
let handle: BrowserControlHandle = null;
|
||||
@@ -14,7 +15,17 @@ export function createBrowserPluginService(): OpenClawPluginService {
|
||||
if (handle) {
|
||||
return;
|
||||
}
|
||||
handle = await startBrowserControlServerIfEnabled();
|
||||
handle = await startLazyPluginServiceModule({
|
||||
skipEnvVar: "OPENCLAW_SKIP_BROWSER_CONTROL_SERVER",
|
||||
overrideEnvVar: "OPENCLAW_BROWSER_CONTROL_MODULE",
|
||||
// Keep the default module import static so compiled builds still bundle it.
|
||||
loadDefaultModule: async () => await import("./server.js"),
|
||||
startExportNames: [
|
||||
"startBrowserControlServiceFromConfig",
|
||||
"startBrowserControlServerFromConfig",
|
||||
],
|
||||
stopExportNames: ["stopBrowserControlService", "stopBrowserControlServer"],
|
||||
});
|
||||
},
|
||||
stop: async () => {
|
||||
const current = handle;
|
||||
|
||||
Reference in New Issue
Block a user