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.

Default onboarding login item to the chosen machine mode (#5015)

injaneity3c1f99cd49d7
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/LoginItemTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/LoginItemTests.swift
index 877d4df9f5..9b12c8b70b 100644
--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/LoginItemTests.swift
+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/LoginItemTests.swift
@@ -93,7 +93,11 @@ struct LoginItemTests {
@Test func doneAppliesTheCheckbox() async {
let ticked = FixtureLoginItem()
let a = ViewModelTests().makeModel(loginItem: ticked)
- #expect(a.onboarding.state.launchAtLogin, "ticked by default")
+ for action: AppOnboardingAction in [.start, .signinDone, .agentsDone(configured: []), .presentationDone,
+ .driveContinue, .modeChosen(mode: .host)] {
+ a.onboarding.send(action)
+ }
+ #expect(a.onboarding.view.launchAtLogin?.checked == true)
a.onboarding.finish()
#expect(ticked.calls == ["register"])
#expect(a.settings.launchAtLogin == true)
@@ -101,7 +105,7 @@ struct LoginItemTests {
let unticked = FixtureLoginItem()
let b = ViewModelTests().makeModel(loginItem: unticked)
for a: AppOnboardingAction in [.start, .signinDone, .agentsDone(configured: []), .presentationDone,
- .driveContinue, .modeChosen(mode: .client), .launchAtLoginToggled(on: false)] {
+ .driveContinue, .modeChosen(mode: .client)] {
b.onboarding.send(a)
}
#expect(b.onboarding.view.launchAtLogin?.checked == false)
diff --git a/apps/cua-spaces-web/src/bridge/__tests__/onboarding.test.tsx b/apps/cua-spaces-web/src/bridge/__tests__/onboarding.test.tsx
index 63d96fb09d..5eb356fa38 100644
--- a/apps/cua-spaces-web/src/bridge/__tests__/onboarding.test.tsx
+++ b/apps/cua-spaces-web/src/bridge/__tests__/onboarding.test.tsx
@@ -270,33 +270,36 @@ describe.skipIf(!wasmBuilt)("Done's Launch at login", () => {
beforeEach(() => onPlatform("Linux x86_64"));
const toDone = async (probe: Probe) => {
await waitFor(() => expect(probe.flow.state).toBeTruthy());
- act(() => probe.flow.send({ type: "start" }));
- act(() => probe.flow.send({ type: "signin-done" }));
- act(() => probe.flow.send({ type: "agents-done", configured: [] }));
- act(() => probe.flow.send({ type: "mode-chosen", mode: "client" }));
- await waitFor(() => expect(probe.flow.view?.step).toBe("done"));
+ act(() => probe.flow.send({ type: 'start' }));
+ act(() => probe.flow.send({ type: 'signin-done' }));
+ act(() => probe.flow.send({ type: 'agents-done', configured: [] }));
+ act(() => probe.flow.send({ type: 'presentation-done' }));
+ act(() => probe.flow.send({ type: 'mode-chosen', mode: 'client' }));
+ await waitFor(() => expect(probe.flow.view?.step).toBe('done'));
};
- it("shows where the host applies it (Electron), and finishes with the choice", async () => {
- const { probe, calls } = mount(await testCore(), "electron");
+ it('shows where the host applies it (Electron), and finishes with the choice', async () => {
+ const { probe, calls } = mount(await testCore(), 'electron');
await toDone(probe);
- expect(probe.flow.launchAtLogin).toMatchObject({ checked: true });
+ expect(probe.flow.launchAtLogin).toMatchObject({ checked: false });
expect(probe.flow.launchAtLogin?.label).toBeTruthy();
- act(() => probe.flow.send({ type: "launch-at-login-toggled", on: false }));
- await waitFor(() => expect(probe.flow.launchAtLogin?.checked).toBe(false));
await act(async () => {
await probe.flow.finish();
});
- expect(calls.filter(([op]) => op === "session.completeOnboarding")).toEqual([["session.completeOnboarding", { mode: "client", launchAtLogin: false }]]);
+ expect(calls.filter(([op]) => op === 'session.completeOnboarding')).toEqual([
+ ['session.completeOnboarding', { mode: 'client', launchAtLogin: false }],
+ ]);
});
- it("is not offered where the host does not apply it", async () => {
+ it('is not offered where the host does not apply it', async () => {
const { probe, calls } = mount(await testCore());
await toDone(probe);
expect(probe.flow.launchAtLogin).toBeNull();
await act(async () => {
await probe.flow.finish();
});
- expect(calls.filter(([op]) => op === "session.completeOnboarding")).toEqual([["session.completeOnboarding", { mode: "client" }]]);
+ expect(calls.filter(([op]) => op === 'session.completeOnboarding')).toEqual([
+ ['session.completeOnboarding', { mode: 'client' }],
+ ]);
});
});
diff --git a/libs/cua/crates/cua-spaces-app-core/parity/golden/drive-onboarding.json b/libs/cua/crates/cua-spaces-app-core/parity/golden/drive-onboarding.json
index 86cc105df7..410f7982f0 100644
--- a/libs/cua/crates/cua-spaces-app-core/parity/golden/drive-onboarding.json
+++ b/libs/cua/crates/cua-spaces-app-core/parity/golden/drive-onboarding.json
@@ -197,7 +197,7 @@
"dots": "Welcome,Sign in,AI agents,Menu bar,Cua Volume,This machine,*Done",
"drive": null,
"driveStorage": null,
- "launchAtLogin": "[x] Launch at login ~Keeps your Spaces, agents and Cua Volume available after a restart.",
+ "launchAtLogin": "[ ] Launch at login ~Keeps your Spaces, agents and Cua Volume available after a restart.",
"lede": "Cua Spaces is in your menu bar.",
"notice": null,
"noticeLink": null,
@@ -341,7 +341,7 @@
"dots": "Welcome,Sign in,AI agents,Menu bar,Cua Volume,This machine,*Done",
"drive": null,
"driveStorage": null,
- "launchAtLogin": "[x] Launch at login ~Keeps your Spaces, agents and Cua Volume available after a restart.",
+ "launchAtLogin": "[ ] Launch at login ~Keeps your Spaces, agents and Cua Volume available after a restart.",
"lede": "Cua Spaces is in your menu bar.",
"notice": null,
"noticeLink": null,
@@ -544,7 +544,7 @@
"dots": "Welcome,Sign in,AI agents,Menu bar,This machine,*Done",
"drive": null,
"driveStorage": null,
- "launchAtLogin": "[x] Launch at login ~Keeps your Spaces, agents and Cua Volume available after a restart.",
+ "launchAtLogin": "[ ] Launch at login ~Keeps your Spaces, agents and Cua Volume available after a restart.",
"lede": "Cua Spaces is in your menu bar.",
"notice": null,
"noticeLink": null,
diff --git a/libs/cua/crates/cua-spaces-app-core/parity/golden/experiments.json b/libs/cua/crates/cua-spaces-app-core/parity/golden/experiments.json
index a37238de90..d642471272 100644
--- a/libs/cua/crates/cua-spaces-app-core/parity/golden/experiments.json
+++ b/libs/cua/crates/cua-spaces-app-core/parity/golden/experiments.json
@@ -25,7 +25,7 @@
"dots": "Welcome,Sign in,AI agents,Menu bar,This machine,*Done",
"drive": null,
"driveStorage": null,
- "launchAtLogin": "[x] Launch at login ~Keeps your Spaces and agents available after a restart.",
+ "launchAtLogin": "[ ] Launch at login ~Keeps your Spaces and agents available after a restart.",
"lede": "Cua Spaces is in your menu bar.",
"notice": null,
"noticeLink": null,
@@ -132,7 +132,7 @@
"dots": "Welcome,Sign in,AI agents,Menu bar,Cua Volume,This machine,*Done",
"drive": null,
"driveStorage": null,
- "launchAtLogin": "[x] Launch at login ~Keeps your Spaces, agents and Cua Volume available after a restart.",
+ "launchAtLogin": "[ ] Launch at login ~Keeps your Spaces, agents and Cua Volume available after a restart.",
"lede": "Cua Spaces is in your menu bar.",
"notice": null,
"noticeLink": null,
@@ -258,7 +258,7 @@
"dots": "Welcome,Sign in,AI agents,Menu bar,Cua Volume,This machine,*Done",
"drive": null,
"driveStorage": null,
- "launchAtLogin": "[x] Launch at login ~Keeps your Spaces, agents and Cua Volume available after a restart.",
+ "launchAtLogin": "[ ] Launch at login ~Keeps your Spaces, agents and Cua Volume available after a restart.",
"lede": "Cua Spaces is in your menu bar.",
"notice": null,
"noticeLink": null,
@@ -389,7 +389,7 @@
"dots": "Welcome,Sign in,AI agents,Menu bar,Cua Volume,This machine,*Done",
"drive": null,
"driveStorage": null,
- "launchAtLogin": "[x] Launch at login ~Keeps your Spaces, agents and Cua Volume available after a restart.",
+ "launchAtLogin": "[ ] Launch at login ~Keeps your Spaces, agents and Cua Volume available after a restart.",
"lede": "Cua Spaces is in your menu bar.",
"notice": null,
"noticeLink": null,
@@ -521,7 +521,7 @@
"dots": "Welcome,Sign in,AI agents,Menu bar,Cua Volume,This machine,*Done",
"drive": null,
"driveStorage": null,
- "launchAtLogin": "[x] Launch at login ~Keeps your Spaces, agents and Cua Volume available after a restart.",
+ "launchAtLogin": "[ ] Launch at login ~Keeps your Spaces, agents and Cua Volume available after a restart.",
"lede": "Cua Spaces is in your menu bar.",
"notice": null,
"noticeLink": null,
@@ -639,7 +639,7 @@
"dots": "Welcome,Sign in,AI agents,Menu bar,Cua Volume,This machine,*Done",
"drive": null,
"driveStorage": null,
- "launchAtLogin": "[x] Launch at login ~Keeps your Spaces, agents and Cua Volume available after a restart.",
+ "launchAtLogin": "[ ] Launch at login ~Keeps your Spaces, agents and Cua Volume available after a restart.",
"lede": "Cua Spaces is in your menu bar.",
"notice": null,
"noticeLink": null,
@@ -756,7 +756,7 @@
"dots": "Welcome,Sign in,AI agents,Menu bar,This machine,*Done",
"drive": null,
"driveStorage": null,
- "launchAtLogin": "[x] Launch at login ~Keeps your Spaces and agents available after a restart.",
+ "launchAtLogin": "[ ] Launch at login ~Keeps your Spaces and agents available after a restart.",
"lede": "Cua Spaces is in your menu bar.",
"notice": null,
"noticeLink": null,
@@ -879,7 +879,7 @@
"dots": "Welcome,Sign in,AI agents,Menu bar,This machine,*Done",
"drive": null,
"driveStorage": null,
- "launchAtLogin": "[x] Launch at login ~Keeps your Spaces and agents available after a restart.",
+ "launchAtLogin": "[ ] Launch at login ~Keeps your Spaces and agents available after a restart.",
"lede": "Cua Spaces is in your menu bar.",
"notice": null,
"noticeLink": null,
@@ -997,7 +997,7 @@
"dots": "Welcome,Sign in,AI agents,Menu bar,This machine,*Done",
"drive": null,
"driveStorage": null,
- "launchAtLogin": "[x] Launch at login ~Keeps your Spaces and agents available after a restart.",
+ "launchAtLogin": "[ ] Launch at login ~Keeps your Spaces and agents available after a restart.",
"lede": "Cua Spaces is in your menu bar.",
"notice": null,
"noticeLink": null,
diff --git a/libs/cua/crates/cua-spaces-app-core/parity/golden/launch-at-login.json b/libs/cua/crates/cua-spaces-app-core/parity/golden/launch-at-login.json
index 6da206f593..b5ba7f76d4 100644
--- a/libs/cua/crates/cua-spaces-app-core/parity/golden/launch-at-login.json
+++ b/libs/cua/crates/cua-spaces-app-core/parity/golden/launch-at-login.json
@@ -9,7 +9,7 @@
"dots": "Welcome,Sign in,AI agents,Menu bar,This machine,*Done",
"drive": null,
"driveStorage": null,
- "launchAtLogin": "[x] Launch at login ~Keeps your Spaces and agents available after a restart.",
+ "launchAtLogin": "[ ] Launch at login ~Keeps your Spaces and agents available after a restart.",
"lede": "Cua Spaces is in your menu bar.",
"notice": null,
"noticeLink": null,
@@ -36,7 +36,7 @@
"title": "You're all set",
"usage": null
},
- "launchAtLogin": true,
+ "launchAtLogin": false,
"onboarding": "mode-chosen"
},
{
@@ -115,6 +115,82 @@
"launchAtLogin": true,
"onboarding": "launch-at-login-toggled"
},
+ {
+ "frame": {
+ "canBack": true,
+ "canSkip": false,
+ "choices": [],
+ "dots": "Welcome,Sign in,AI agents,Menu bar,This machine,*Done",
+ "drive": null,
+ "driveStorage": null,
+ "launchAtLogin": "[x] Launch at login ~Keeps your Spaces and agents available after a restart.",
+ "lede": "Cua Spaces is in your menu bar.",
+ "notice": null,
+ "noticeLink": null,
+ "presentations": [],
+ "primary": "Start using Cua Spaces",
+ "prompts": [
+ "qa my app on windows, macos and linux",
+ "use the cua sdk to build an agent app that runs codex in a space",
+ "open my app in a space and pip it",
+ "use the cua sdk to stream a space's window into my app",
+ "teleport my browser into a space and finish the checkout test",
+ "use the cua docs to set up a cua bench taskset",
+ "spin up a linux space and run the test suite there"
+ ],
+ "showMark": false,
+ "step": "done",
+ "summary": [
+ "cua command: not installed",
+ "Account: not signed in",
+ "AI agents: none",
+ "Shows in: Notch and menu bar",
+ "This machine: Set up for unattended access"
+ ],
+ "title": "You're all set",
+ "usage": null
+ },
+ "launchAtLogin": true,
+ "onboarding": "mode-chosen"
+ },
+ {
+ "frame": {
+ "canBack": true,
+ "canSkip": false,
+ "choices": [],
+ "dots": "Welcome,Sign in,AI agents,Menu bar,This machine,*Done",
+ "drive": null,
+ "driveStorage": null,
+ "launchAtLogin": "[ ] Launch at login ~Keeps your Spaces and agents available after a restart.",
+ "lede": "Cua Spaces is in your menu bar.",
+ "notice": null,
+ "noticeLink": null,
+ "presentations": [],
+ "primary": "Start using Cua Spaces",
+ "prompts": [
+ "qa my app on windows, macos and linux",
+ "use the cua sdk to build an agent app that runs codex in a space",
+ "open my app in a space and pip it",
+ "use the cua sdk to stream a space's window into my app",
+ "teleport my browser into a space and finish the checkout test",
+ "use the cua docs to set up a cua bench taskset",
+ "spin up a linux space and run the test suite there"
+ ],
+ "showMark": false,
+ "step": "done",
+ "summary": [
+ "cua command: not installed",
+ "Account: not signed in",
+ "AI agents: none",
+ "Shows in: Notch and menu bar",
+ "This machine: Set up for unattended access"
+ ],
+ "title": "You're all set",
+ "usage": null
+ },
+ "launchAtLogin": false,
+ "onboarding": "launch-at-login-toggled"
+ },
{
"general": [
"- launch-at-login toggle: Launch Cua Spaces at login {*On|Off}",
diff --git a/libs/cua/crates/cua-spaces-app-core/parity/launch-at-login.json b/libs/cua/crates/cua-spaces-app-core/parity/launch-at-login.json
index 9d4c2324d8..0daf3c8c0a 100644
--- a/libs/cua/crates/cua-spaces-app-core/parity/launch-at-login.json
+++ b/libs/cua/crates/cua-spaces-app-core/parity/launch-at-login.json
@@ -1,6 +1,6 @@
{
"name": "launch-at-login",
- "about": "Launch at login: the first run's Done page with its checkbox (ticked by default, unticked, ticked again); Settings, General's toggle for each status the system reports (enabled, not registered, waiting for approval, not found), while a change runs, after a failed change, and off on a machine that provides Spaces or runs persistent agents; and what the app does at launch.",
+ "about": "Launch at login: the first run's Done page with its checkbox (off for accessing other machines, on for unattended access, and manually toggled); Settings, General's toggle for each status the system reports (enabled, not registered, waiting for approval, not found), while a change runs, after a failed change, and off on a machine that provides Spaces or runs persistent agents; and what the app does at launch.",
"onboarding": [
{ "type": "start" },
{ "type": "signin-done" },
@@ -9,7 +9,10 @@
{ "type": "drive-continue" },
{ "type": "mode-chosen", "mode": "client" },
{ "type": "launch-at-login-toggled", "on": false },
- { "type": "launch-at-login-toggled", "on": true }
+ { "type": "launch-at-login-toggled", "on": true },
+ { "type": "back" },
+ { "type": "mode-chosen", "mode": "host" },
+ { "type": "launch-at-login-toggled", "on": false }
],
"settings": [
{ "step": "enabled", "loginItem": { "status": "enabled" } },
@@ -17,19 +20,73 @@
{ "step": "requires approval", "loginItem": { "status": "requiresApproval" } },
{ "step": "not found", "loginItem": { "status": "notFound" } },
{ "step": "turning on", "loginItem": { "status": "notRegistered", "busy": true } },
- { "step": "failed", "loginItem": { "status": "notRegistered", "error": "Operation not permitted" } },
- { "step": "off, provides Spaces", "loginItem": { "status": "notRegistered", "providesSpaces": true } },
+ {
+ "step": "failed",
+ "loginItem": { "status": "notRegistered", "error": "Operation not permitted" }
+ },
+ {
+ "step": "off, provides Spaces",
+ "loginItem": { "status": "notRegistered", "providesSpaces": true }
+ },
{ "step": "off, runs agents", "loginItem": { "status": "notRegistered", "runsAgents": true } },
- { "step": "off, both", "loginItem": { "status": "notRegistered", "providesSpaces": true, "runsAgents": true } },
- { "step": "on, both", "loginItem": { "status": "enabled", "providesSpaces": true, "runsAgents": true } }
+ {
+ "step": "off, both",
+ "loginItem": { "status": "notRegistered", "providesSpaces": true, "runsAgents": true }
+ },
+ {
+ "step": "on, both",
+ "loginItem": { "status": "enabled", "providesSpaces": true, "runsAgents": true }
+ }
],
"launches": [
- { "step": "first run not finished", "choice": null, "onboarded": false, "serves": true, "status": "notRegistered" },
- { "step": "chosen on", "choice": true, "onboarded": true, "serves": false, "status": "enabled" },
- { "step": "chosen off on a serving machine", "choice": false, "onboarded": true, "serves": true, "status": "notRegistered" },
- { "step": "unchosen, serving", "choice": null, "onboarded": true, "serves": true, "status": "notRegistered" },
- { "step": "unchosen, not serving", "choice": null, "onboarded": true, "serves": false, "status": "notRegistered" },
- { "step": "unchosen, already on", "choice": null, "onboarded": true, "serves": false, "status": "requiresApproval" },
- { "step": "unchosen, serving, not found", "choice": null, "onboarded": true, "serves": true, "status": "notFound" }
+ {
+ "step": "first run not finished",
+ "choice": null,
+ "onboarded": false,
+ "serves": true,
+ "status": "notRegistered"
+ },
+ {
+ "step": "chosen on",
+ "choice": true,
+ "onboarded": true,
+ "serves": false,
+ "status": "enabled"
+ },
+ {
+ "step": "chosen off on a serving machine",
+ "choice": false,
+ "onboarded": true,
+ "serves": true,
+ "status": "notRegistered"
+ },
+ {
+ "step": "unchosen, serving",
+ "choice": null,
+ "onboarded": true,
+ "serves": true,
+ "status": "notRegistered"
+ },
+ {
+ "step": "unchosen, not serving",
+ "choice": null,
+ "onboarded": true,
+ "serves": false,
+ "status": "notRegistered"
+ },
+ {
+ "step": "unchosen, already on",
+ "choice": null,
+ "onboarded": true,
+ "serves": false,
+ "status": "requiresApproval"
+ },
+ {
+ "step": "unchosen, serving, not found",
+ "choice": null,
+ "onboarded": true,
+ "serves": true,
+ "status": "notFound"
+ }
]
}
diff --git a/libs/cua/crates/cua-spaces-app-core/src/login_item.rs b/libs/cua/crates/cua-spaces-app-core/src/login_item.rs
index 457876fb03..c7ec4f1003 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/login_item.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/login_item.rs
@@ -15,10 +15,10 @@
//! the daemon back after a restart, and with it the Spaces this machine
//! provides, its persistent agents and Cua Volume.
//!
-//! The default: on once the first run finishes (the Done checkbox, ticked
-//! unless unticked). An install that finished its first run before this
-//! setting existed is turned on only when it provides Spaces or runs
-//! persistent agents ([`launch_plan`]). Once the user has chosen, the app
+//! The default: on for unattended access, off for accessing other machines
+//! (the Done checkbox can override either). An install that finished its
+//! first run before this setting existed is turned on only when it provides
+//! Spaces or runs persistent agents ([`launch_plan`]). Once the user has chosen, the app
//! never changes it again.
use serde::{Deserialize, Serialize};
diff --git a/libs/cua/crates/cua-spaces-app-core/src/onboarding.rs b/libs/cua/crates/cua-spaces-app-core/src/onboarding.rs
index 9cdef58f9f..6c05ada791 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/onboarding.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/onboarding.rs
@@ -440,6 +440,7 @@ pub fn reduce(s: &OnboardingState, a: &OnboardingAction) -> OnboardingState {
}
(Mode, OnboardingAction::ModeChosen { mode }) => {
n.mode = Some(*mode);
+ n.launch_at_login = *mode == OnboardingMode::Host;
n.step = Done;
}
(_, OnboardingAction::DriveChecked { os, status }) => {
@@ -1499,6 +1500,42 @@ mod tests {
}
}
+ #[test]
+ fn launch_at_login_defaults_to_the_chosen_mode() {
+ for installer_mode in [
+ None,
+ Some(OnboardingMode::Client),
+ Some(OnboardingMode::Host),
+ ] {
+ for mode in [OnboardingMode::Client, OnboardingMode::Host] {
+ let mut s = initial(installer_mode, None);
+ for action in [
+ OnboardingAction::Start,
+ OnboardingAction::SigninDone,
+ OnboardingAction::AgentsDone { configured: vec![] },
+ OnboardingAction::PresentationDone,
+ OnboardingAction::ModeChosen { mode },
+ ] {
+ s = reduce(&s, &action);
+ }
+ assert_eq!(s.step, OnboardingStep::Done);
+ let expected = mode == OnboardingMode::Host;
+ assert_eq!(s.launch_at_login, expected);
+ let checkbox = view(&s).launch_at_login.unwrap();
+ assert_eq!(checkbox.checked, expected);
+ assert_eq!(checkbox.note, crate::login_item::NOTE_WITHOUT_VOLUME);
+ s = reduce(
+ &s,
+ &OnboardingAction::LaunchAtLoginToggled { on: !expected },
+ );
+ assert_eq!(view(&s).launch_at_login.unwrap().checked, !expected);
+ s = reduce(&s, &OnboardingAction::Back);
+ s = reduce(&s, &OnboardingAction::ModeChosen { mode });
+ assert_eq!(s.launch_at_login, expected);
+ }
+ }
+ }
+
#[test]
fn done_has_launch_at_login_ticked_by_default() {
let mut s = initial(None, None);