From 8a490f45093c56c25b1260e2d9b7fc8282b8a194 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 25 Apr 2026 01:22:40 +0100 Subject: [PATCH] fix(browser): break doctor client import cycle --- extensions/browser/src/browser/client.ts | 37 ++++++------------- .../browser/src/browser/client.types.ts | 23 ++++++++++++ extensions/browser/src/browser/doctor.ts | 2 +- extensions/browser/src/doctor-browser.test.ts | 1 + 4 files changed, 37 insertions(+), 26 deletions(-) diff --git a/extensions/browser/src/browser/client.ts b/extensions/browser/src/browser/client.ts index d450d3d44a2..44a10ac103d 100644 --- a/extensions/browser/src/browser/client.ts +++ b/extensions/browser/src/browser/client.ts @@ -1,34 +1,21 @@ import { buildProfileQuery, withBaseUrl } from "./client-actions-url.js"; import { fetchBrowserJson } from "./client-fetch.js"; -import type { BrowserTab, BrowserTransport, SnapshotAriaNode } from "./client.types.js"; +import type { + BrowserStatus, + BrowserTab, + BrowserTransport, + SnapshotAriaNode, +} from "./client.types.js"; import type { BrowserDoctorReport } from "./doctor.js"; -export type { BrowserTab, BrowserTransport, SnapshotAriaNode } from "./client.types.js"; +export type { + BrowserStatus, + BrowserTab, + BrowserTransport, + SnapshotAriaNode, +} from "./client.types.js"; export type { BrowserDoctorCheck, BrowserDoctorReport } from "./doctor.js"; -export type BrowserStatus = { - enabled: boolean; - profile?: string; - driver?: "openclaw" | "existing-session"; - transport?: BrowserTransport; - running: boolean; - cdpReady?: boolean; - cdpHttp?: boolean; - pid: number | null; - cdpPort: number | null; - cdpUrl?: string | null; - chosenBrowser: string | null; - detectedBrowser?: string | null; - detectedExecutablePath?: string | null; - detectError?: string | null; - userDataDir: string | null; - color: string; - headless: boolean; - noSandbox?: boolean; - executablePath?: string | null; - attachOnly: boolean; -}; - export type ProfileStatus = { name: string; transport?: BrowserTransport; diff --git a/extensions/browser/src/browser/client.types.ts b/extensions/browser/src/browser/client.types.ts index dcb851b2940..f3b72f455ec 100644 --- a/extensions/browser/src/browser/client.types.ts +++ b/extensions/browser/src/browser/client.types.ts @@ -1,5 +1,28 @@ export type BrowserTransport = "cdp" | "chrome-mcp"; +export type BrowserStatus = { + enabled: boolean; + profile?: string; + driver?: "openclaw" | "existing-session"; + transport?: BrowserTransport; + running: boolean; + cdpReady?: boolean; + cdpHttp?: boolean; + pid: number | null; + cdpPort: number | null; + cdpUrl?: string | null; + chosenBrowser: string | null; + detectedBrowser?: string | null; + detectedExecutablePath?: string | null; + detectError?: string | null; + userDataDir: string | null; + color: string; + headless: boolean; + noSandbox?: boolean; + executablePath?: string | null; + attachOnly: boolean; +}; + export type BrowserTab = { /** Best handle for agents to pass back as targetId: label, then tabId, then raw targetId. */ suggestedTargetId?: string; diff --git a/extensions/browser/src/browser/doctor.ts b/extensions/browser/src/browser/doctor.ts index c815d45d953..a840e11769b 100644 --- a/extensions/browser/src/browser/doctor.ts +++ b/extensions/browser/src/browser/doctor.ts @@ -1,4 +1,4 @@ -import type { BrowserStatus, BrowserTransport } from "./client.js"; +import type { BrowserStatus, BrowserTransport } from "./client.types.js"; export type BrowserDoctorCheckStatus = "pass" | "warn" | "fail" | "info"; diff --git a/extensions/browser/src/doctor-browser.test.ts b/extensions/browser/src/doctor-browser.test.ts index 40926002185..3162134b2ed 100644 --- a/extensions/browser/src/doctor-browser.test.ts +++ b/extensions/browser/src/doctor-browser.test.ts @@ -14,6 +14,7 @@ describe("browser doctor readiness", () => { }, { noteFn, + env: { DISPLAY: ":99" }, resolveManagedExecutable: () => ({ kind: "chrome", path: "/usr/bin/google-chrome" }), }, );