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-web): wait for device approval past the call timeout (#5257)
Francesco Bonaccif38cf3567aa3
diff --git a/apps/cua-spaces-web/src/bridge/__tests__/hosts.test.ts b/apps/cua-spaces-web/src/bridge/__tests__/hosts.test.tsindex eb916ab9d2..c2dbe8a093 100644--- a/apps/cua-spaces-web/src/bridge/__tests__/hosts.test.ts+++ b/apps/cua-spaces-web/src/bridge/__tests__/hosts.test.ts@@ -795,6 +795,27 @@ describe("webkit adapter", () => {}});+ it("waits for a device approval while the host asks for Touch ID or the password", async () => {+ vi.useFakeTimers();+ try {+ let answer!: (a: Answer) => void;+ const { win } = webkitHost((req) => (req.method === "devices.approve" ? new Promise<Answer>((r) => (answer = r)) : ok(null)));+ const call = createWebkitAdapter(win, { timeoutMs: 1_000 }).call("devices.approve", { code: "K7QX-M2RP", deviceId: null });+ const settled = call.then(+ (r) => ({ ok: true as const, r }),+ (e: unknown) => ({ ok: false as const, e }),+ );+ // A person typing the login password: longer than the call timeout.+ await vi.advanceTimersByTimeAsync(60_000);+ answer({ ok: false, error: { code: "not_found", message: "no device is waiting with the code K7QX-M2RP" } });+ const r = await settled;+ expect(r.ok).toBe(false);+ expect((r as { e: HostError }).e.message).toBe("no device is waiting with the code K7QX-M2RP");+ } finally {+ vi.useRealTimers();+ }+ });+it("reads the host's own settings rows and picks their options with settings.choose", async () => {const choice = (id: string, active: string) => ({ id, kind: "choice", label: "", enabled: true, options: ["auto", "builtin", "system"].map((o) => ({ id: o, label: o, active: o === active })) });const toggle = (id: string, on: boolean) => ({ id, kind: "toggle", label: "", enabled: true, options: [{ id: "on", label: "On", active: on }, { id: "off", label: "Off", active: !on }] });diff --git a/apps/cua-spaces-web/src/bridge/ops/webkit-pages.ts b/apps/cua-spaces-web/src/bridge/ops/webkit-pages.tsindex eb6fb6672d..72010aa364 100644--- a/apps/cua-spaces-web/src/bridge/ops/webkit-pages.ts+++ b/apps/cua-spaces-web/src/bridge/ops/webkit-pages.ts@@ -247,7 +247,13 @@ export function webkitPageOps(request: Request, toHostStatus: (h: WkHostState) ="devices.get": call("devices.get"),"devices.enroll": call("devices.enroll"),"devices.checkEnrolled": async () => Boolean(await request("devices.checkEnrolled")),- "devices.approve": none("devices.approve"),+ // The host asks for Touch ID or the login password first: no timeout,+ // or a slow answer reads as "the app did not answer" while the prompt+ // is still up, and the relay's own answer is lost.+ "devices.approve": async (args) => {+ await request("devices.approve", { ...args }, null);+ return null;+ },"devices.rename": none("devices.rename"),"devices.revoke": none("devices.revoke"),"devices.confirmMachine": none("devices.confirmMachine"),