Skip to content

A desktop coding agent with free access to frontier models.

TypeScript

fix: computer use guards the person's clipboard around agent actions

ogsamrat29aef261d7d3
diff --git a/apps/desktop/electron/computer-use-agent-browser.mjs b/apps/desktop/electron/computer-use-agent-browser.mjs
index 8d348278..076d1188 100644
--- a/apps/desktop/electron/computer-use-agent-browser.mjs
+++ b/apps/desktop/electron/computer-use-agent-browser.mjs
@@ -33,6 +33,8 @@ const BLANK = "about:blank";
const SEARCH = "https://duckduckgo.com/?q=";
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
const CLIP_BINDING = "__omnirushClip";
+/** How long after an act the person's clipboard is still watched (a click's user activation lasts about 5 s). */
+export const CLIPBOARD_GUARD_MS = 6000;
/** `promise`, or a rejection after `ms` (setup steps never hang the session). */
const withTimeout = (promise, ms) => Promise.race([promise, new Promise((_, reject) => setTimeout(() => reject(new Error("timed out")), ms))]);
const fail = (code, message) => Object.assign(new Error(message), { code });
@@ -478,11 +480,33 @@ export async function startAgentBrowser({ electron, glidePath, url = null, versi
}
}
- /** Linux: a selection in the agent's pages must not become the person's middle-click selection (PRIMARY). */
+ /**
+ * The person's clipboard (and on Linux the middle-click selection, PRIMARY) is kept as it was: snapshotted before
+ * each act and put back whenever it changes, during the act and for CLIPBOARD_GUARD_MS after it (the click's user
+ * activation, during which a page could write it from a frame the page guard has not reached).
+ */
+ const cb = electron.clipboard ?? null;
+ const linux = process.platform === "linux";
+ let guard = null;
+ const snapshot = () => ({ text: cb.readText(), html: cb.readHTML?.() ?? "", rtf: cb.readRTF?.() ?? "", image: cb.readImage?.() ?? null, primary: linux ? cb.readText("selection") : null });
+ function restoreClipboards() {
+ if (!guard) return;
+ try {
+ if (cb.readText() !== guard.saved.text || (cb.readHTML?.() ?? "") !== guard.saved.html) {
+ const { text, html, rtf, image } = guard.saved;
+ cb.write({ text, ...(html ? { html } : {}), ...(rtf ? { rtf } : {}), ...(image && !image.isEmpty?.() ? { image } : {}) });
+ }
+ if (linux && cb.readText("selection") !== guard.saved.primary) cb.writeText(guard.saved.primary ?? "", "selection");
+ } catch { /* best effort */ }
+ if (Date.now() > guard.until && !guard.acting) { clearInterval(guard.timer); guard = null; }
+ }
async function act(action) {
- const primary = process.platform === "linux" && electron.clipboard ? electron.clipboard.readText("selection") : null;
+ if (cb) {
+ if (!guard) { guard = { saved: snapshot(), until: 0, acting: 0, timer: setInterval(restoreClipboards, 150) }; guard.timer.unref?.(); }
+ guard.acting += 1;
+ }
try { return await actNow(action); } finally {
- if (primary !== null && electron.clipboard.readText("selection") !== primary) electron.clipboard.writeText(primary, "selection");
+ if (guard) { guard.acting -= 1; guard.until = Date.now() + CLIPBOARD_GUARD_MS; restoreClipboards(); }
}
}
@@ -549,6 +573,7 @@ export async function startAgentBrowser({ electron, glidePath, url = null, versi
async function close() {
if (closed) return;
+ if (guard) { guard.until = 0; guard.acting = 0; restoreClipboards(); }
await release().catch(() => undefined);
closed = true;
for (const tab of tabs.splice(0)) { try { tab.window.webContents.debugger.detach(); } catch { /* gone */ } tab.window.destroy(); }
diff --git a/apps/desktop/electron/computer-use-agent-browser.test.mjs b/apps/desktop/electron/computer-use-agent-browser.test.mjs
index 1c4a4ed9..7b819d64 100644
--- a/apps/desktop/electron/computer-use-agent-browser.test.mjs
+++ b/apps/desktop/electron/computer-use-agent-browser.test.mjs
@@ -48,7 +48,7 @@ function fakeElectron() {
async function start(options = {}) {
const fake = fakeElectron();
const delays = [];
- const backend = await startAgentBrowser({ electron: fake.electron, glidePath, url: options.url ?? null, versions: { electron: "43.2.0", chrome: "150.0" }, wait: async (ms) => { delays.push(ms); } });
+ const backend = await startAgentBrowser({ electron: options.clipboard ? { ...fake.electron, clipboard: options.clipboard } : fake.electron, glidePath, url: options.url ?? null, versions: { electron: "43.2.0", chrome: "150.0" }, wait: async (ms) => { delays.push(ms); } });
const pages = () => fake.windows.filter((w) => w.options.height !== CHROME_H && !w.destroyed);
const active = () => pages()[backend.state().active];
return { fake, backend, delays, pages, active, act: (action) => backend.worker.call("act", { action }) };
@@ -268,3 +268,24 @@ test("agent browser: every document gets the page guard (private clipboard bindi
for (const needle of ["execCommand", "writeText", "readText", "window.print = () => {}", "__omnirushClip"]) assert.ok(PAGE_GUARD_JS.includes(needle), needle);
await b.backend.close();
});
+
+test("agent browser: the person's clipboard is put back if a page writes it (a same-origin frame), during the act and for a while after", async () => {
+ const board = { text: "PERSON", html: "", selection: "SEL" };
+ const clipboard = {
+ readText: (type) => (type === "selection" ? board.selection : board.text), readHTML: () => board.html, readRTF: () => "", readImage: () => ({ isEmpty: () => true }),
+ writeText: (value, type) => { if (type === "selection") board.selection = value; else board.text = value; }, write: ({ text, html = "" }) => { board.text = text; board.html = html; },
+ };
+ const b = await start({ url: "https://a.test/", clipboard });
+ const page = b.active().webContents;
+ const send = page.debugger.sendCommand;
+ // The click's activation lets a frame's unpatched execCommand('copy') write the OS clipboard: during the act...
+ page.debugger.sendCommand = async (method, params) => { if (method === "Input.dispatchMouseEvent" && params.type === "mousePressed") { board.text = "PASTEJACK"; board.selection = "X"; } return send(method, params); };
+ await b.act({ type: "click", x: 200, y: 300 });
+ assert.equal(board.text, "PERSON");
+ assert.equal(process.platform !== "linux" || board.selection === "SEL", true);
+ // ...and a second later (still inside the activation window).
+ board.text = "LATER";
+ await new Promise((r) => setTimeout(r, 400));
+ assert.equal(board.text, "PERSON");
+ await b.backend.close();
+});
diff --git a/apps/desktop/electron/computer-use.mjs b/apps/desktop/electron/computer-use.mjs
index c6458f82..20ca7bcd 100644
--- a/apps/desktop/electron/computer-use.mjs
+++ b/apps/desktop/electron/computer-use.mjs
@@ -21,7 +21,7 @@ import { createRequire } from "node:module";
import path from "node:path";
import { fileURLToPath, pathToFileURL } from "node:url";
-import { app, BrowserWindow, clipboard, screen, session } from "electron";
+import { app, BrowserWindow, clipboard, Notification, screen, session } from "electron";
import { startAgentBrowser } from "./computer-use-agent-browser.mjs";
import { testAnswersAllowed } from "./computer-use-answers.mjs";
import { createComputerUseHost } from "./computer-use-host.mjs";
@@ -75,6 +75,7 @@ let refreshTimer = null;
let failedAt = 0; // a host that did not start is tried again after a minute
const cursors = new Map(); // session id → the agent cursor's latest move (live view)
let cursorSeq = 0;
+let realScreenNoticeShown = false;
function shippedModule(name) {
// Packaged: app.asar/server/dist; dev: apps/server/dist (OMNIRUSH_DEV_MODE prefers it).
@@ -150,7 +151,8 @@ function savedRealScreen(policy) {
/** Whether the person turned the real screen on (false until the shared rules are loaded). */
function realScreenOn() {
const policy = shared?.policyModule;
- return policy ? policy.realScreenOptIn({ env: process.env, saved: savedRealScreen(policy) }) : false;
+ // The environment can turn it on only in an app run from source (never a line slipped into a shell profile).
+ return policy ? policy.realScreenOptIn({ env: process.env, saved: savedRealScreen(policy), allowEnvOn: !app.isPackaged }) : false;
}
function hostSettings() {
@@ -212,6 +214,11 @@ async function startHost() {
preview = createComputerPreview();
preview.bind(created);
host = created;
+ // The real screen on: said once per launch (the setting is a file the agent's shell could also write).
+ if (!realScreenNoticeShown && realScreenOn() && server?.setting?.real_screen !== false) {
+ realScreenNoticeShown = true;
+ try { if (Notification.isSupported()) new Notification({ title: "Computer use can use your own screen", body: "The agent can click and type in your apps without asking. Stop it any time with Stop; turn it off in Settings > Computer use." }).show(); } catch { /* best effort */ }
+ }
listener = await created.listen(path.join(profileDir(), "computer-use"));
const relay = app.isPackaged ? path.join(process.resourcesPath, "computer-use", "relay.mjs") : path.join(__dirname, "computer-use-relay.mjs");
const command = [process.execPath, relay, listener.discoveryPath];
@@ -277,7 +284,7 @@ async function getComputerUseState() {
async function getComputerUseRealScreen() {
const { policyModule } = await sharedModules();
// forced: OMNIRUSH_COMPUTER_USE_REAL_SCREEN decides, whatever is saved.
- const forced = policyModule.realScreenOptIn({ env: process.env, saved: true }) === policyModule.realScreenOptIn({ env: process.env, saved: false });
+ const forced = policyModule.realScreenOptIn({ env: process.env, saved: true, allowEnvOn: !app.isPackaged }) === policyModule.realScreenOptIn({ env: process.env, saved: false, allowEnvOn: !app.isPackaged });
// allowed: the server lets the person's screen be used at all.
return { on: realScreenOn(), forced, allowed: server?.setting?.real_screen !== false };
}
diff --git a/apps/server/src/computer-use/shared/PARITY.sha256 b/apps/server/src/computer-use/shared/PARITY.sha256
index f9fab3b3..7b41aa30 100644
--- a/apps/server/src/computer-use/shared/PARITY.sha256
+++ b/apps/server/src/computer-use/shared/PARITY.sha256
@@ -2,8 +2,8 @@
# A change to one must be ported to the other and this list updated in both.
da1cc6c26f3bf6758d3e2ce70e87bce383f68ee0ec6c85bbdc33b1f9a6c407fa contract.mjs
30cfcead85a5b2b54005ba6a0a67a43d9950de944b4615861ce9342bf043d4a4 contract.d.mts
-0ad2f6d4827deb710251b6aeb5dd325dff9637cb4129fb8168fe1e9345186938 policy.mjs
-f3bcc7ce814a5f2a6566f8b558b53a429611e26cc4c237f43c55bd70312eb5c2 policy.d.mts
+67776fea41ee567f1fe14b41ad9869f122ede65c36d32ccc3d23d8ec5c09c2c9 policy.mjs
+7dd420982f2731199827d5467851e84172d529f905e9d85c7873ceb26327e04a policy.d.mts
da515baa8aec2b533685d20c2be7ae007acc6b116db0386f8180e6779cb80f5c image.mjs
7c1a3224b7efd215656a94c38cf3152fe7a2444f25a6162988528978acf5458d image.d.mts
e47c9ff67b9fce2ec12307737e973ce22551719c482b87f601569bd4f8a77e17 media.mjs
@@ -11,6 +11,6 @@ eabdf78c56733577d05aad490d9d7d5ece6c22e9b3ea9e6e9803d1a4a546fdd4 media.d.mts
a0bd964a5d0c7c5e26b4ce4ed8e8300f80a0a3a9da5d7f49c36f6ac2c907e934 native-worker.mjs
d7414bbbb57a2d18ab72fce26e900444106051ce03f28d468b6139388f453bbb portable-host.mjs
40cc047cb02f4c50ac98508bab9c0f4e1ee80c1d40b4b05a472a11ce01e8a153 portable-host.d.mts
-5e61fb875cd1b984c3daaaae6587d47485c90a97c4c769fecc38038166b74fcb virtual-host.mjs
+7e9b4192b5e776b808be1f55e06a7b8ae53f1a575398d066641241ce9429a0c2 virtual-host.mjs
5bee4b675171a7cc8f02f172ba4b4d57171bb8ee27631974a5bfe33ed0bf58c8 virtual-host.d.mts
fc8bb13fd77f224d5a8a03d618e7253f877d4d678c21d245cd5fe91d45df097a virtual-worker.mjs
diff --git a/apps/server/src/computer-use/shared/policy.d.mts b/apps/server/src/computer-use/shared/policy.d.mts
index 5808b5fc..d53eca8a 100644
--- a/apps/server/src/computer-use/shared/policy.d.mts
+++ b/apps/server/src/computer-use/shared/policy.d.mts
@@ -37,7 +37,7 @@ export const REAL_SCREEN_ENV: string;
export const REAL_SCREEN_OFF_MESSAGE: string;
export const REAL_SCREEN_FILE: string;
export const REAL_SCREEN_DENY_RULES: Readonly<{ bash: Readonly<Record<string, "deny">>; edit: Readonly<Record<string, "deny">> }>;
-export function realScreenOptIn(options?: { env?: Record<string, string | undefined>; saved?: unknown }): boolean;
+export function realScreenOptIn(options?: { env?: Record<string, string | undefined>; saved?: unknown; allowEnvOn?: boolean }): boolean;
export type SessionRules = { open: true; asks: false } | { open: false; asks: false; code: "virtual_unavailable" | "real_screen_unavailable" | "real_screen_off"; message: string };
export function sessionRules(options?: { display?: "virtual" | "real"; server?: { real_screen?: boolean; virtual_display?: boolean }; optIn?: boolean }): SessionRules;
diff --git a/apps/server/src/computer-use/shared/policy.mjs b/apps/server/src/computer-use/shared/policy.mjs
index 32696edf..bcc40e6c 100644
--- a/apps/server/src/computer-use/shared/policy.mjs
+++ b/apps/server/src/computer-use/shared/policy.mjs
@@ -108,7 +108,7 @@ export const REAL_SCREEN_DEFAULT = false;
/** The key both apps save the person's choice under, in <state or profile>/computer-use/real-screen.json. */
export const REAL_SCREEN_SETTING = "computerUseRealScreen";
export const REAL_SCREEN_FILE = "real-screen.json";
-/** OMNIRUSH_COMPUTER_USE_REAL_SCREEN=1/0 overrides the saved choice (support, tests). */
+/** OMNIRUSH_COMPUTER_USE_REAL_SCREEN=0 turns it off; =1 turns it on only in builds run from source (tests, support). */
export const REAL_SCREEN_ENV = "OMNIRUSH_COMPUTER_USE_REAL_SCREEN";
export const REAL_SCREEN_OFF_MESSAGE = "Computer use on the person's own screen is off. Work on your own display instead (app_id \"virtual:main\"). Only the person can change this setting; never change it yourself and never ask to.";
@@ -122,11 +122,15 @@ export const REAL_SCREEN_DENY_RULES = Object.freeze({
edit: Object.freeze({ "*computer-use/real-screen.json": "deny" }),
});
-/** Whether the person turned the real screen on: the environment first, then the saved setting, else REAL_SCREEN_DEFAULT. */
-export function realScreenOptIn({ env = process.env, saved } = {}) {
+/**
+ * Whether the person turned the real screen on: the saved setting, else REAL_SCREEN_DEFAULT. The environment can
+ * always force it OFF; it can force it ON only in builds run from source (`allowEnvOn`: the CLI's dev builds, an
+ * unpackaged desktop app), so a line an agent slips into a shell profile never turns it on in a released app.
+ */
+export function realScreenOptIn({ env = process.env, saved, allowEnvOn = false } = {}) {
const asked = String(env?.[REAL_SCREEN_ENV] ?? "").trim().toLowerCase();
- if (["1", "on", "true", "yes"].includes(asked)) return true;
if (["0", "off", "false", "no"].includes(asked)) return false;
+ if (allowEnvOn && ["1", "on", "true", "yes"].includes(asked)) return true;
return typeof saved === "boolean" ? saved : REAL_SCREEN_DEFAULT;
}
diff --git a/apps/server/src/computer-use/shared/virtual-host.mjs b/apps/server/src/computer-use/shared/virtual-host.mjs
index 35475f6c..28e46a16 100644
--- a/apps/server/src/computer-use/shared/virtual-host.mjs
+++ b/apps/server/src/computer-use/shared/virtual-host.mjs
@@ -18,7 +18,7 @@
import { spawn, spawnSync } from "node:child_process";
import { randomBytes, randomUUID } from "node:crypto";
-import { chmodSync, existsSync, mkdirSync, mkdtempSync, readdirSync, realpathSync, rmSync, writeFileSync } from "node:fs";
+import { appendFileSync, chmodSync, existsSync, mkdirSync, mkdtempSync, readdirSync, realpathSync, rmSync, writeFileSync } from "node:fs";
import os from "node:os";
import path from "node:path";
import { fileURLToPath } from "node:url";
@@ -146,12 +146,14 @@ export const OPENBOX_RC = `<?xml version="1.0" encoding="UTF-8"?>
* A watchdog for when the host dies without cleaning up (SIGKILL, a crash): a detached /bin/sh that waits for
* `hostPid` to go, then ends the process groups and removes the folders. Returns { stop() }.
*/
-export function startWatchdog({ hostPid = process.pid, groups = [], dirs = [], everyMs = 1000, spawnFn = spawn } = {}) {
+export function startWatchdog({ hostPid = process.pid, groups = [], dirs = [], listFile = null, everyMs = 1000, spawnFn = spawn } = {}) {
const ids = groups.filter((g) => Number.isSafeInteger(g) && g > 1);
// Only folders this backend made (omnirush-cu-*), never anything else.
const paths = dirs.filter((d) => typeof d === "string" && /\/omnirush-cu-[^/'"]+$/.test(d));
const quote = (s) => `'${String(s).replace(/'/g, "'\\''")}'`;
- const script = `while kill -0 ${Number(hostPid)} 2>/dev/null; do sleep ${Math.max(0.2, everyMs / 1000)}; done; ${ids.map((g) => `kill -TERM -${g} 2>/dev/null;`).join(" ")} sleep 1; ${ids.map((g) => `kill -KILL -${g} 2>/dev/null;`).join(" ")} ${paths.length ? `rm -rf ${paths.map(quote).join(" ")}` : "true"}`;
+ // listFile: lines "g <pid>" / "d <folder>" added while the display starts (read when the host is gone).
+ const fromFile = listFile ? `G=$(sed -n 's/^g \\([0-9][0-9]*\\)$/\\1/p' ${quote(listFile)} 2>/dev/null); D=$(sed -n 's/^d \\(.*\\)$/\\1/p' ${quote(listFile)} 2>/dev/null);` : "G=; D=;";
+ const script = `while kill -0 ${Number(hostPid)} 2>/dev/null; do sleep ${Math.max(0.2, everyMs / 1000)}; done; ${fromFile} for g in ${ids.join(" ")} $G; do [ "$g" -gt 1 ] 2>/dev/null && kill -TERM -$g 2>/dev/null; done; sleep 1; for g in ${ids.join(" ")} $G; do [ "$g" -gt 1 ] 2>/dev/null && kill -KILL -$g 2>/dev/null; done; for d in ${paths.map(quote).join(" ")} $D; do case "$d" in */omnirush-cu-*) case "$d" in *..*) ;; *) rm -rf -- "$d";; esac;; esac; done`;
const child = spawnFn("/bin/sh", ["-c", script], { stdio: "ignore", detached: true });
child.on?.("error", () => undefined);
child.unref?.();
@@ -178,12 +180,12 @@ export async function startXvfbBackend({ name = "main", env = process.env, nodeP
const children = [];
let profile = null, watchdog = null, closed = false;
const kill = (child) => { if (!child?.pid) return; try { process.kill(-child.pid, "SIGTERM"); } catch { try { child.kill(); } catch { /* gone */ } } };
- const removeDirs = () => { for (const dir of [profile, home]) if (dir) { try { rmSync(dir, { recursive: true, force: true }); } catch { /* best effort */ } } };
+ const removeDirs = () => { for (const dir of [profile, home, `${home}.list`]) if (dir) { try { rmSync(dir, { recursive: true, force: true }); } catch { /* best effort */ } } };
// The host exiting normally (a thrown error included) takes its display, window manager and browser with it;
// the watchdog covers a host that is killed.
const onExit = () => { for (const child of children) kill(child); removeDirs(); };
process.once("exit", onExit);
- const fail = (code, message) => { process.removeListener("exit", onExit); for (const child of [...children].reverse()) kill(child); removeDirs(); return failure(code, message); };
+ const fail = (code, message) => { process.removeListener("exit", onExit); for (const child of [...children].reverse()) kill(child); removeDirs(); watchdog?.stop(); return failure(code, message); };
// A display number from 90 up (never the usual :0-:10 of a person's desktop). The server says on fd 3 when it is
// ready; one that exits (another server took the number between the check and the start) is retried higher.
@@ -204,6 +206,11 @@ export async function startXvfbBackend({ name = "main", env = process.env, nodeP
else kill(child);
}
if (number === null || !xvfb) return fail("virtual_unavailable", "Xvfb did not start.");
+ // From here on a killed host leaves nothing: the watchdog reads what was started from this list.
+ const listFile = path.join(path.dirname(home), `${path.basename(home)}.list`);
+ const note = (line) => { try { appendFileSync(listFile, `${line}\n`, { mode: 0o600 }); } catch { /* best effort */ } };
+ note(`d ${home}`); note(`d ${listFile}`); note(`g ${xvfb.pid}`);
+ watchdog = (deps.watchdog ?? startWatchdog)({ hostPid: process.pid, listFile, dirs: [home] });
const disp = `:${number}`;
const displayEnv = agentEnv(env, { display: disp, xauthority: authFile, runtimeDir });
let wm = null;
@@ -212,7 +219,7 @@ export async function startXvfbBackend({ name = "main", env = process.env, nodeP
writeFileSync(rc, OPENBOX_RC, { mode: 0o600 });
const child = spawn("openbox", ["--sm-disable", "--config-file", rc], { stdio: "ignore", env: displayEnv, detached: true });
child.on("error", () => undefined);
- children.push(child); wm = "openbox";
+ children.push(child); wm = "openbox"; note(`g ${child.pid}`);
}
const worker = deps.worker ? deps.worker(disp) : createNativeWorker({ workerPath: VIRTUAL_WORKER_PATH, nodePath, nodeEnv: { ...nodeEnv, DISPLAY: disp, XAUTHORITY: authFile, XDG_SESSION_TYPE: "x11", WAYLAND_DISPLAY: "" }, koffiPath });
const ready = await worker.ready;
@@ -226,13 +233,17 @@ export async function startXvfbBackend({ name = "main", env = process.env, nodeP
const base = snap && env.HOME ? path.join(env.HOME, "snap", found.name.replace(/-browser$/, ""), "common") : os.tmpdir();
if (snap) mkdirSync(base, { recursive: true });
profile = mkdtempSync(path.join(base, "omnirush-cu-browser-"));
+ note(`d ${profile}`);
+ // Its own HOME too (not for a snap, which keeps its own): no person's certificates, fonts cache or dotfiles.
+ const browserEnv = snap ? displayEnv : { ...displayEnv, HOME: path.join(home, "home") };
+ if (!snap) mkdirSync(browserEnv.HOME, { mode: 0o700 });
const launch = (noSandbox) => {
- const child = spawn(found.path, browserArgs(found, { profile, url: url ?? "about:blank", width: size.width, height: size.height, root: noSandbox }), { stdio: ["ignore", "ignore", "pipe"], env: displayEnv, detached: true });
+ const child = spawn(found.path, browserArgs(found, { profile, url: url ?? "about:blank", width: size.width, height: size.height, root: noSandbox }), { stdio: ["ignore", "ignore", "pipe"], env: browserEnv, detached: true });
child.on("error", () => undefined);
let stderr = "";
child.stderr?.on("data", (d) => { if (stderr.length < 65_536) stderr += d; });
child.stderr?.resume();
- children.push(child);
+ children.push(child); note(`g ${child.pid}`);
return { child, stderr: () => stderr };
};
// Chromium's sandbox, always, except as root (where it cannot run) or when the browser itself says it cannot
@@ -248,7 +259,6 @@ export async function startXvfbBackend({ name = "main", env = process.env, nodeP
if (found.kind === "chromium" && !sandbox) warning = root ? "The agent's browser runs without Chromium's sandbox because OmniRush runs as root." : "The agent's browser runs without Chromium's sandbox: this system does not allow it (no unprivileged user namespaces). Install the browser's AppArmor profile to turn it back on.";
opened = { name: found.name, kind: found.kind, version: versionOf(found.path, ["--version"], env), profile: "fresh", ...(found.kind === "chromium" ? { sandbox } : {}) };
}
- watchdog = (deps.watchdog ?? startWatchdog)({ hostPid: process.pid, groups: children.map((c) => c.pid), dirs: [home, profile].filter(Boolean) });
const close = async () => {
if (closed) return;
closed = true;
@@ -260,7 +270,7 @@ export async function startXvfbBackend({ name = "main", env = process.env, nodeP
watchdog?.stop();
};
const packages = deps.packages ?? virtualPackages(env);
- return { ok: true, kind: "xvfb", name, display: disp, width: ready.size?.width ?? size.width, height: ready.size?.height ?? size.height, wm, packages, browser: opened, ...(warning ? { warning } : {}), worker, close, pids: children.map((c) => c.pid), dirs: [home, profile].filter(Boolean) };
+ return { ok: true, kind: "xvfb", name, display: disp, width: ready.size?.width ?? size.width, height: ready.size?.height ?? size.height, wm, packages, browser: opened, ...(warning ? { warning } : {}), worker, close, pids: children.map((c) => c.pid), dirs: [home, profile, `${home}.list`].filter(Boolean) };
}
// ------------------------------------------------------------------- host