Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

test(desktop): bring the app-core bridge tests up to date (#6129)

ddupontdf2af4f410aa
diff --git a/apps/cua-spaces-desktop/test/agents-fixtures.ts b/apps/cua-spaces-desktop/test/agents-fixtures.ts
index 1e223467d5..77cc373d90 100644
--- a/apps/cua-spaces-desktop/test/agents-fixtures.ts
+++ b/apps/cua-spaces-desktop/test/agents-fixtures.ts
@@ -231,5 +231,5 @@ export const AGENT_METHODS = [
"agents.detail", "agents.readFile", "agents.restoreFile", "agents.addRoutine", "agents.setRoutine", "agents.removeRoutine",
"agents.allowComputer", "agents.revokeComputer",
"agents.status", "agents.connect", "agents.disconnect", "agents.signInStart", "agents.signInWait",
- "agentKeys.list", "agentKeys.set", "agentKeys.remove", "agentKeys.shell", "agentKeys.fromShell",
+ "agentKeys.list", "agentKeys.check", "agentKeys.set", "agentKeys.remove", "agentKeys.shell", "agentKeys.fromShell",
];
diff --git a/apps/cua-spaces-desktop/test/agents.test.ts b/apps/cua-spaces-desktop/test/agents.test.ts
index 1bb6096e94..2a76a8d969 100644
--- a/apps/cua-spaces-desktop/test/agents.test.ts
+++ b/apps/cua-spaces-desktop/test/agents.test.ts
@@ -445,7 +445,7 @@ describe.skipIf(!built)("agents", () => {
expect(model.agents.keys.view.notice).toContain("keeps credentials in a file");
const none = makeBridge({ tools: null }).model.agents.keys;
expect(none.view.notice).toContain("need the cua daemon");
- expect(agentKeysInput({ keys: [{ provider: "x", env: "", last4: "1234", added_ms: 1 }], available: false }, null)).toMatchObject({ keys: [], unavailable: "this computer can't keep keys" });
+ expect(agentKeysInput({ keys: [{ provider: "x", env: "", last4: "1234", added_ms: 1 }], available: false }, null)).toMatchObject({ keys: [], unavailable: "this machine can't keep keys" });
});
it("routes agentKeys.* to the daemon, with answers that never carry a key", async () => {
diff --git a/apps/cua-spaces-desktop/test/host-bridge.test.ts b/apps/cua-spaces-desktop/test/host-bridge.test.ts
index 80330d2cac..856df758bd 100644
--- a/apps/cua-spaces-desktop/test/host-bridge.test.ts
+++ b/apps/cua-spaces-desktop/test/host-bridge.test.ts
@@ -203,6 +203,7 @@ describe.skipIf(!built)("This machine, Devices and Settings on the app core", ()
["notifications.markAllRead", {}],
["host.setUp", { request: { mode: "direct", direct: "0.0.0.0:3211" } }],
["host.action", { action: "provide-spaces" }],
+ ["host.limits", { maxSpaces: 2 }],
["host.openSettings", { url: "x-apple.systempreferences:com.apple.preference.security?Privacy_ScreenCapture" }],
["settings.get", {}],
["settings.choose", { row: "telemetry", option: "off" }],
@@ -240,6 +241,7 @@ describe.skipIf(!built)("This machine, Devices and Settings on the app core", ()
"storage.run": { request: { kind: "clear-cache" } } as never,
"host.setUp": { request: { mode: "direct", direct: "0.0.0.0:3211" } } as never,
"host.action": { action: "provide-spaces" } as never,
+ "host.limits": { maxSpaces: 2 },
"host.openSettings": { url: "x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility" },
"settings.set": { key: "telemetry", value: false },
"settings.choose": { row: "auto-connect", option: "off" },
@@ -277,6 +279,15 @@ describe.skipIf(!built)("This machine, Devices and Settings on the app core", ()
expect(await code("host.setUp", { request: {} })).toBe("bad_args");
});
+ it("changes the limits on the Spaces other machines create, and refuses a bad count", async () => {
+ await call("host.setUp", { request: { mode: "direct", direct: "0.0.0.0:3211" } });
+ const r = (await call("host.limits", { maxSpaces: 2 })) as Record<string, unknown>;
+ expect(r).toMatchObject({ configured: true });
+ expect(host.calls.at(-1)).toBe("configure:-:-");
+ expect(await code("host.limits", { maxSpaces: -1 })).toBe("bad_args");
+ expect(await code("host.limits", { maxDiskGb: "lots" })).toBe("bad_args");
+ });
+
it("carries the whole state, the owner and the progress", async () => {
await call("host.setUp", { request: { mode: "relay", name: "Studio" } });
const s = (await call("host.status")) as Record<string, unknown>;
diff --git a/apps/cua-spaces-desktop/test/host-fixtures.ts b/apps/cua-spaces-desktop/test/host-fixtures.ts
index fd7c715c8a..799a244722 100644
--- a/apps/cua-spaces-desktop/test/host-fixtures.ts
+++ b/apps/cua-spaces-desktop/test/host-fixtures.ts
@@ -336,7 +336,7 @@ export const HOST_METHODS = [
"devices.get", "devices.enroll", "devices.checkEnrolled", "devices.approve", "devices.rename", "devices.revoke", "devices.confirmMachine",
"devices.createPairingCode", "devices.pairingCodes", "devices.revokePairingCode", "teams.list",
"storage.get", "storage.run", "notifications.list", "notifications.markAllRead", "notifications.markRead",
- "host.setUp", "host.joinWithCode", "host.action", "host.openSettings", "settings.get", "settings.choose", "settings.update",
+ "host.setUp", "host.joinWithCode", "host.action", "host.limits", "host.openSettings", "settings.get", "settings.choose", "settings.update",
"onboarding.get", "onboarding.complete",
];
@@ -348,5 +348,5 @@ export const HOST_OPS = [
"devices.get", "devices.enroll", "devices.checkEnrolled", "devices.approve", "devices.rename", "devices.revoke", "devices.confirmMachine",
"devices.createPairingCode", "devices.pairingCodes", "devices.revokePairingCode", "teams.list",
"storage.get", "storage.run", "notifications.list", "notifications.markAllRead", "notifications.markRead",
- "host.setUp", "host.joinWithCode", "host.action", "host.openSettings", "settings.get", "settings.set", "settings.choose", "experiments.set", "session.completeOnboarding",
+ "host.setUp", "host.joinWithCode", "host.action", "host.limits", "host.openSettings", "settings.get", "settings.set", "settings.choose", "experiments.set", "session.completeOnboarding",
];