Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
fix(spaces): Linux onboarding images, skipped sign-in panel, setuid chrome-sandbox (#5143)
Francesco Bonaccib56c9b569615
diff --git a/apps/cua-spaces-desktop/packaging/linux-permissions.cjs b/apps/cua-spaces-desktop/packaging/linux-permissions.cjsindex 433e774144..315d2513ea 100644--- a/apps/cua-spaces-desktop/packaging/linux-permissions.cjs+++ b/apps/cua-spaces-desktop/packaging/linux-permissions.cjs@@ -17,16 +17,20 @@ function packedMode(mode, isDirectory) {return mode & 0o111 ? 0o755 : 0o644;}+/** The mode Chromium's setuid sandbox helper ships with. */+const SANDBOX_MODE = 0o4755;+/** Sets the packed modes under `root` (symlinks are left as they are). */function normalizeModes(root) {+ const sandbox = path.join(root, "chrome-sandbox");const visit = (p) => {const st = fs.lstatSync(p);if (st.isSymbolicLink()) return;- const mode = packedMode(st.mode, st.isDirectory());+ const mode = p === sandbox ? SANDBOX_MODE : packedMode(st.mode, st.isDirectory());if ((st.mode & 0o7777) !== mode) fs.chmodSync(p, mode);if (st.isDirectory()) for (const name of fs.readdirSync(p)) visit(path.join(p, name));};visit(root);}-module.exports = { normalizeModes, packedMode };+module.exports = { normalizeModes, packedMode, SANDBOX_MODE };diff --git a/apps/cua-spaces-desktop/test/packaging.test.ts b/apps/cua-spaces-desktop/test/packaging.test.tsindex 6b7419652d..cf8e18c939 100644--- a/apps/cua-spaces-desktop/test/packaging.test.ts+++ b/apps/cua-spaces-desktop/test/packaging.test.ts@@ -69,6 +69,22 @@ describe("the Linux install tree", () => {expect(mode(path.join(root, "resources.pak"))).toBe(0o644);});+ it("ships chrome-sandbox setuid (4755) for electron-builder's after-install to settle per host", () => {+ const root = groupWritableApp();+ writeFileSync(path.join(root, "chrome-sandbox"), "x");+ chmodSync(path.join(root, "chrome-sandbox"), 0o775);+ normalizeModes(root);+ expect(mode(path.join(root, "chrome-sandbox"))).toBe(0o4755);+ // Stable on a second pass, and nothing else gets the setuid bit.+ normalizeModes(root);+ expect(mode(path.join(root, "chrome-sandbox"))).toBe(0o4755);+ expect(mode(path.join(root, "cua-spaces"))).toBe(0o755);+ });++ it("keeps electron-builder's own after-install script (its userns-aware chrome-sandbox chmod)", () => {+ expect(config.linux.afterInstall ?? config.deb.afterInstall).toBeUndefined();+ });+it("is fixed by afterPack before the deb and the AppImage are made", async () => {const root = groupWritableApp();await config.afterPack({ electronPlatformName: "linux", appOutDir: root, packager: { appInfo: { productFilename: "Cua Spaces" } } });diff --git a/apps/cua-spaces-web/src/bridge/__tests__/onboarding.test.tsx b/apps/cua-spaces-web/src/bridge/__tests__/onboarding.test.tsxindex 5eb356fa38..f56bcfdbc0 100644--- a/apps/cua-spaces-web/src/bridge/__tests__/onboarding.test.tsx+++ b/apps/cua-spaces-web/src/bridge/__tests__/onboarding.test.tsx@@ -162,7 +162,17 @@ describe.each([{ id: "accessibility", label: "Accessibility", granted: true },]);expect(rows).toEqual([{ id: "screen-recording", title: "Screen Recording", help: "Turn it on", settingsUrl: "x-apple.systempreferences:a" }]);- expect(firstSpaceImages(core).map((i) => i.os)).toEqual(["macos", "linux", "windows"]);+ expect(firstSpaceImages(core, "macos").map((i) => i.os)).toEqual(["macos", "linux", "windows"]);+ });+});++describe("the first Space's images per host", () => {+ it.each([+ ["macos", ["macos", "linux", "windows"]],+ ["linux", ["linux", "windows"]],+ ["windows", ["linux", "windows"]],+ ] as const)("on %s", (os, expected) => {+ expect(firstSpaceImages(noCore, os).map((i) => i.os)).toEqual(expected);});});@@ -234,6 +244,18 @@ describe.skipIf(!wasmBuilt)("useOnboarding over the demo adapter", () => {expect(readSavedOnboarding().state).toBeNull();});+ it("stops the pending browser sign-in when Sign in is skipped", async () => {+ const { probe } = mount(await testCore());+ await waitFor(() => expect(probe.flow.state).toBeTruthy());+ act(() => probe.flow.send({ type: "start" }));+ await act(async () => {+ void probe.session.signIn().catch(() => {});+ });+ await waitFor(() => expect(["starting", "waiting"]).toContain(probe.session.data?.signIn.kind));+ act(() => probe.flow.send({ type: "signin-done" }));+ await waitFor(() => expect(probe.session.data?.signIn.kind).toBe("idle"));+ });+it("drops the account when signed out", async () => {const { probe } = mount(await testCore());await waitFor(() => expect(probe.flow.state).toBeTruthy());diff --git a/apps/cua-spaces-web/src/bridge/hooks.ts b/apps/cua-spaces-web/src/bridge/hooks.tsindex c5e0ae7f24..06253fd036 100644--- a/apps/cua-spaces-web/src/bridge/hooks.ts+++ b/apps/cua-spaces-web/src/bridge/hooks.ts@@ -441,6 +441,8 @@ export function useOnboarding(): OnboardingHook {const send = (action: OnboardingAction) => {const current = readSavedOnboarding().state;if (!current) return;+ // Skipping Sign in leaves the browser login behind: stop waiting for it.+ if (action.type === "signin-done") store?.cancelSignIn();const next = onboardingReduce(core, current, action, ctx);// The switch writes the setting at once, so what it shows is what the// machine does even if the flow is skipped from Welcome. (The SwiftUI@@ -469,6 +471,7 @@ export function useOnboarding(): OnboardingHook {skip: () => {const current = readSavedOnboarding().state;if (current) store?.trackOnboardingSkipped(current);+ store?.cancelSignIn();writeSavedOnboarding({ ...readSavedOnboarding(), skipped: true });},finish: async () => {diff --git a/apps/cua-spaces-web/src/bridge/onboarding.ts b/apps/cua-spaces-web/src/bridge/onboarding.tsindex 2a2f276075..587a961ff6 100644--- a/apps/cua-spaces-web/src/bridge/onboarding.ts+++ b/apps/cua-spaces-web/src/bridge/onboarding.ts@@ -174,11 +174,13 @@ export function permissionRows(core: CoreClient, hints: PermissionHint[]): Permi/*** One image per OS for the first Space: the core's picker catalog, first- * published full image of each (the New Space picker's first rows).+ * published full image of each (the New Space picker's first rows). No+ * macOS image off macOS.*/-export function firstSpaceImages(core: CoreClient): SandboxImage[] {+export function firstSpaceImages(core: CoreClient, os: HostOs = hostOs()): SandboxImage[] {const all = core.tryCall<SandboxImage[]>("wizard.pickerImages") ?? FALLBACK_IMAGES;- const order: SpaceOs[] = ["macos", "linux", "windows"];+ // macOS images run on Lume (Apple silicon): not offered on Linux or Windows.+ const order: SpaceOs[] = os === "macos" ? ["macos", "linux", "windows"] : ["linux", "windows"];return order.flatMap((os) => {const published = all.filter((i) => i.published && i.os === os && i.group === "canonical");const pick = published.find((i) => i.tier !== "slim") ?? published[0];