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.

fix(cua-spaces-macos): ask before installing cua and adding it to PATH (#5039)

injaneity80ae9a47ad99
diff --git a/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.ts b/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.ts
index 002aa84272..e42430227a 100644
--- a/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.ts
+++ b/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.ts
@@ -26690,6 +26690,10 @@ export enum AppOnboardingStep {
* Welcome.
*/
Welcome = "welcome",
+ /**
+ * Install the bundled `cua`, while its plan needs it.
+ */
+ Cli = "cli",
/**
* Sign in to Cua.
*/
@@ -26725,24 +26729,26 @@ const FfiConverterTypeAppOnboardingStep = (() => {
read(from: RustBuffer): TypeName {
switch (ordinalConverter.read(from)) {
case 1: return AppOnboardingStep.Welcome;
- case 2: return AppOnboardingStep.Signin;
- case 3: return AppOnboardingStep.Agents;
- case 4: return AppOnboardingStep.Presentation;
- case 5: return AppOnboardingStep.Drive;
- case 6: return AppOnboardingStep.Mode;
- case 7: return AppOnboardingStep.Done;
+ case 2: return AppOnboardingStep.Cli;
+ case 3: return AppOnboardingStep.Signin;
+ case 4: return AppOnboardingStep.Agents;
+ case 5: return AppOnboardingStep.Presentation;
+ case 6: return AppOnboardingStep.Drive;
+ case 7: return AppOnboardingStep.Mode;
+ case 8: return AppOnboardingStep.Done;
default: throw new UniffiInternalError.UnexpectedEnumCase();
}
}
write(value: TypeName, into: RustBuffer): void {
switch (value) {
case AppOnboardingStep.Welcome: return ordinalConverter.write(1, into);
- case AppOnboardingStep.Signin: return ordinalConverter.write(2, into);
- case AppOnboardingStep.Agents: return ordinalConverter.write(3, into);
- case AppOnboardingStep.Presentation: return ordinalConverter.write(4, into);
- case AppOnboardingStep.Drive: return ordinalConverter.write(5, into);
- case AppOnboardingStep.Mode: return ordinalConverter.write(6, into);
- case AppOnboardingStep.Done: return ordinalConverter.write(7, into);
+ case AppOnboardingStep.Cli: return ordinalConverter.write(2, into);
+ case AppOnboardingStep.Signin: return ordinalConverter.write(3, into);
+ case AppOnboardingStep.Agents: return ordinalConverter.write(4, into);
+ case AppOnboardingStep.Presentation: return ordinalConverter.write(5, into);
+ case AppOnboardingStep.Drive: return ordinalConverter.write(6, into);
+ case AppOnboardingStep.Mode: return ordinalConverter.write(7, into);
+ case AppOnboardingStep.Done: return ordinalConverter.write(8, into);
}
}
allocationSize(value: TypeName): number {
@@ -27490,9 +27496,21 @@ export type AppOnboardingState = {
*/
step: AppOnboardingStep,
/**
- * Where `cua` was installed on first launch, when it was.
+ * Where `cua` was installed, when it was.
*/
cliTarget?: string,
+ /**
+ * The bundled `cua`'s install plan, as the shell read it.
+ */
+ cliPlan?: AppCliInstallPlan,
+ /**
+ * Continue on Command line: the shell is installing.
+ */
+ cliInstalling: boolean,
+ /**
+ * Why the install failed.
+ */
+ cliError?: string,
/**
* Menu bar only (no notch). The same setting as Settings' "Spaces tab
* in the notch".
@@ -27607,6 +27625,9 @@ const FfiConverterTypeAppOnboardingState = (() => {
return {
step: FfiConverterTypeAppOnboardingStep.read(from),
cliTarget: FfiConverterOptionalString.read(from),
+ cliPlan: FfiConverterOptionalTypeAppCliInstallPlan.read(from),
+ cliInstalling: FfiConverterBool.read(from),
+ cliError: FfiConverterOptionalString.read(from),
menuBar: FfiConverterBool.read(from),
identity: FfiConverterOptionalString.read(from),
agents: FfiConverterSequenceString.read(from),
@@ -27632,6 +27653,9 @@ const FfiConverterTypeAppOnboardingState = (() => {
write(value: TypeName, into: RustBuffer): void {
FfiConverterTypeAppOnboardingStep.write(value.step, into);
FfiConverterOptionalString.write(value.cliTarget, into);
+ FfiConverterOptionalTypeAppCliInstallPlan.write(value.cliPlan, into);
+ FfiConverterBool.write(value.cliInstalling, into);
+ FfiConverterOptionalString.write(value.cliError, into);
FfiConverterBool.write(value.menuBar, into);
FfiConverterOptionalString.write(value.identity, into);
FfiConverterSequenceString.write(value.agents, into);
@@ -27656,6 +27680,9 @@ const FfiConverterTypeAppOnboardingState = (() => {
allocationSize(value: TypeName): number {
return FfiConverterTypeAppOnboardingStep.allocationSize(value.step) +
FfiConverterOptionalString.allocationSize(value.cliTarget) +
+ FfiConverterOptionalTypeAppCliInstallPlan.allocationSize(value.cliPlan) +
+ FfiConverterBool.allocationSize(value.cliInstalling) +
+ FfiConverterOptionalString.allocationSize(value.cliError) +
FfiConverterBool.allocationSize(value.menuBar) +
FfiConverterOptionalString.allocationSize(value.identity) +
FfiConverterSequenceString.allocationSize(value.agents) +
@@ -48692,6 +48719,9 @@ const FfiConverterTypeAppStorageAction = (() => {
export enum AppOnboardingAction_Tags {
Start = "Start",
CliInstalled = "CliInstalled",
+ CliPlanned = "CliPlanned",
+ CliDone = "CliDone",
+ CliInstallFailed = "CliInstallFailed",
PresentationPicked = "PresentationPicked",
PresentationDone = "PresentationDone",
SignedIn = "SignedIn",
@@ -48777,6 +48807,108 @@ inner: {target?: string }): CliInstalled_ {
}
+ type CliPlanned__interface = {
+ tag: AppOnboardingAction_Tags.CliPlanned;
+ inner:
+Readonly<{plan: AppCliInstallPlan}>
+ };
+ /**
+ * The bundled `cua`'s install plan, read or installed (any page).
+ */
+ class CliPlanned_ extends UniffiEnum implements CliPlanned__interface {
+ /**
+ * @private
+ * This field is private and should not be used, use `tag` instead.
+ */
+ readonly [uniffiTypeNameSymbol] = "AppOnboardingAction";
+ readonly tag = AppOnboardingAction_Tags.CliPlanned;
+ readonly inner:
+Readonly<{plan: AppCliInstallPlan}>;
+ constructor(
+inner: {plan: AppCliInstallPlan }) {
+ super("AppOnboardingAction", "CliPlanned");
+
+ this.inner = Object.freeze(inner);
+ }
+ static new(
+inner: {plan: AppCliInstallPlan }): CliPlanned_ {
+ return new CliPlanned_(inner);
+ }
+
+ static instanceOf(obj: any): obj is CliPlanned_ {
+ return obj.tag === AppOnboardingAction_Tags.CliPlanned;
+ }
+
+ }
+
+ type CliDone__interface = {
+ tag: AppOnboardingAction_Tags.CliDone;
+ inner:
+Readonly<{install: boolean}>
+ };
+ /**
+ * Continue (`install`) or Skip from Command line.
+ */
+ class CliDone_ extends UniffiEnum implements CliDone__interface {
+ /**
+ * @private
+ * This field is private and should not be used, use `tag` instead.
+ */
+ readonly [uniffiTypeNameSymbol] = "AppOnboardingAction";
+ readonly tag = AppOnboardingAction_Tags.CliDone;
+ readonly inner:
+Readonly<{install: boolean}>;
+ constructor(
+inner: {install: boolean }) {
+ super("AppOnboardingAction", "CliDone");
+
+ this.inner = Object.freeze(inner);
+ }
+ static new(
+inner: {install: boolean }): CliDone_ {
+ return new CliDone_(inner);
+ }
+
+ static instanceOf(obj: any): obj is CliDone_ {
+ return obj.tag === AppOnboardingAction_Tags.CliDone;
+ }
+
+ }
+
+ type CliInstallFailed__interface = {
+ tag: AppOnboardingAction_Tags.CliInstallFailed;
+ inner:
+Readonly<{error: string}>
+ };
+ /**
+ * The Command line page's install failed.
+ */
+ class CliInstallFailed_ extends UniffiEnum implements CliInstallFailed__interface {
+ /**
+ * @private
+ * This field is private and should not be used, use `tag` instead.
+ */
+ readonly [uniffiTypeNameSymbol] = "AppOnboardingAction";
+ readonly tag = AppOnboardingAction_Tags.CliInstallFailed;
+ readonly inner:
+Readonly<{error: string}>;
+ constructor(
+inner: {error: string }) {
+ super("AppOnboardingAction", "CliInstallFailed");
+
+ this.inner = Object.freeze(inner);
+ }
+ static new(
+inner: {error: string }): CliInstallFailed_ {
+ return new CliInstallFailed_(inner);
+ }
+
+ static instanceOf(obj: any): obj is CliInstallFailed_ {
+ return obj.tag === AppOnboardingAction_Tags.CliInstallFailed;
+ }
+
+ }
+
type PresentationPicked__interface = {
tag: AppOnboardingAction_Tags.PresentationPicked;
inner:
@@ -49472,6 +49604,9 @@ inner: {experiments: AppExperiments }): ExperimentsLoaded_ {
instanceOf,
Start: Start_,
CliInstalled: CliInstalled_,
+ CliPlanned: CliPlanned_,
+ CliDone: CliDone_,
+ CliInstallFailed: CliInstallFailed_,
PresentationPicked: PresentationPicked_,
PresentationDone: PresentationDone_,
SignedIn: SignedIn_,
@@ -49497,7 +49632,7 @@ inner: {experiments: AppExperiments }): ExperimentsLoaded_ {
})();
export type AppOnboardingAction = InstanceType<
- typeof AppOnboardingAction['Start' | 'CliInstalled' | 'PresentationPicked' | 'PresentationDone' | 'SignedIn' | 'SigninDone' | 'AgentsDone' | 'ModeChosen' | 'DriveChecked' | 'DriveToggled' | 'DriveContinue' | 'DriveMounted' | 'DriveFailed' | 'DriveStorageLoaded' | 'StorageChosen' | 'DriveStorage' | 'DriveStorageSaved' | 'LaunchAtLoginToggled' | 'Back' | 'TelemetryLoaded' | 'WelcomeShown' | 'UsageDataToggled' | 'ExperimentsLoaded']
+ typeof AppOnboardingAction['Start' | 'CliInstalled' | 'CliPlanned' | 'CliDone' | 'CliInstallFailed' | 'PresentationPicked' | 'PresentationDone' | 'SignedIn' | 'SigninDone' | 'AgentsDone' | 'ModeChosen' | 'DriveChecked' | 'DriveToggled' | 'DriveContinue' | 'DriveMounted' | 'DriveFailed' | 'DriveStorageLoaded' | 'StorageChosen' | 'DriveStorage' | 'DriveStorageSaved' | 'LaunchAtLoginToggled' | 'Back' | 'TelemetryLoaded' | 'WelcomeShown' | 'UsageDataToggled' | 'ExperimentsLoaded']
>;
// FfiConverter for enum AppOnboardingAction
@@ -49509,27 +49644,30 @@ const FfiConverterTypeAppOnboardingAction = (() => {
switch (ordinalConverter.read(from)) {
case 1: return new AppOnboardingAction.Start();
case 2: return new AppOnboardingAction.CliInstalled({target: FfiConverterOptionalString.read(from) });
- case 3: return new AppOnboardingAction.PresentationPicked({menuBar: FfiConverterBool.read(from) });
- case 4: return new AppOnboardingAction.PresentationDone();
- case 5: return new AppOnboardingAction.SignedIn({identity: FfiConverterString.read(from) });
- case 6: return new AppOnboardingAction.SigninDone();
- case 7: return new AppOnboardingAction.AgentsDone({configured: FfiConverterSequenceString.read(from) });
- case 8: return new AppOnboardingAction.ModeChosen({mode: FfiConverterTypeAppOnboardingMode.read(from) });
- case 9: return new AppOnboardingAction.DriveChecked({os: FfiConverterTypeAppSpaceOs.read(from), status: FfiConverterOptionalTypeAppDriveMountInput.read(from) });
- case 10: return new AppOnboardingAction.DriveToggled({on: FfiConverterBool.read(from) });
- case 11: return new AppOnboardingAction.DriveContinue();
- case 12: return new AppOnboardingAction.DriveMounted({status: FfiConverterTypeAppDriveMountInput.read(from) });
- case 13: return new AppOnboardingAction.DriveFailed({error: FfiConverterString.read(from) });
- case 14: return new AppOnboardingAction.DriveStorageLoaded({storage: FfiConverterTypeAppDriveStorageInput.read(from), home: FfiConverterOptionalString.read(from) });
- case 15: return new AppOnboardingAction.StorageChosen({choice: FfiConverterTypeAppStorageChoice.read(from) });
- case 16: return new AppOnboardingAction.DriveStorage({action: FfiConverterTypeAppStorageAction.read(from) });
- case 17: return new AppOnboardingAction.DriveStorageSaved({check: FfiConverterTypeAppDriveCheckInput.read(from) });
- case 18: return new AppOnboardingAction.LaunchAtLoginToggled({on: FfiConverterBool.read(from) });
- case 19: return new AppOnboardingAction.Back();
- case 20: return new AppOnboardingAction.TelemetryLoaded({telemetry: FfiConverterTypeAppTelemetryInput.read(from) });
- case 21: return new AppOnboardingAction.WelcomeShown();
- case 22: return new AppOnboardingAction.UsageDataToggled({on: FfiConverterBool.read(from) });
- case 23: return new AppOnboardingAction.ExperimentsLoaded({experiments: FfiConverterTypeAppExperiments.read(from) });
+ case 3: return new AppOnboardingAction.CliPlanned({plan: FfiConverterTypeAppCliInstallPlan.read(from) });
+ case 4: return new AppOnboardingAction.CliDone({install: FfiConverterBool.read(from) });
+ case 5: return new AppOnboardingAction.CliInstallFailed({error: FfiConverterString.read(from) });
+ case 6: return new AppOnboardingAction.PresentationPicked({menuBar: FfiConverterBool.read(from) });
+ case 7: return new AppOnboardingAction.PresentationDone();
+ case 8: return new AppOnboardingAction.SignedIn({identity: FfiConverterString.read(from) });
+ case 9: return new AppOnboardingAction.SigninDone();
+ case 10: return new AppOnboardingAction.AgentsDone({configured: FfiConverterSequenceString.read(from) });
+ case 11: return new AppOnboardingAction.ModeChosen({mode: FfiConverterTypeAppOnboardingMode.read(from) });
+ case 12: return new AppOnboardingAction.DriveChecked({os: FfiConverterTypeAppSpaceOs.read(from), status: FfiConverterOptionalTypeAppDriveMountInput.read(from) });
+ case 13: return new AppOnboardingAction.DriveToggled({on: FfiConverterBool.read(from) });
+ case 14: return new AppOnboardingAction.DriveContinue();
+ case 15: return new AppOnboardingAction.DriveMounted({status: FfiConverterTypeAppDriveMountInput.read(from) });
+ case 16: return new AppOnboardingAction.DriveFailed({error: FfiConverterString.read(from) });
+ case 17: return new AppOnboardingAction.DriveStorageLoaded({storage: FfiConverterTypeAppDriveStorageInput.read(from), home: FfiConverterOptionalString.read(from) });
+ case 18: return new AppOnboardingAction.StorageChosen({choice: FfiConverterTypeAppStorageChoice.read(from) });
+ case 19: return new AppOnboardingAction.DriveStorage({action: FfiConverterTypeAppStorageAction.read(from) });
+ case 20: return new AppOnboardingAction.DriveStorageSaved({check: FfiConverterTypeAppDriveCheckInput.read(from) });
+ case 21: return new AppOnboardingAction.LaunchAtLoginToggled({on: FfiConverterBool.read(from) });
+ case 22: return new AppOnboardingAction.Back();
+ case 23: return new AppOnboardingAction.TelemetryLoaded({telemetry: FfiConverterTypeAppTelemetryInput.read(from) });
+ case 24: return new AppOnboardingAction.WelcomeShown();
+ case 25: return new AppOnboardingAction.UsageDataToggled({on: FfiConverterBool.read(from) });
+ case 26: return new AppOnboardingAction.ExperimentsLoaded({experiments: FfiConverterTypeAppExperiments.read(from) });
default: throw new UniffiInternalError.UnexpectedEnumCase();
}
}
@@ -49545,120 +49683,138 @@ const FfiConverterTypeAppOnboardingAction = (() => {
FfiConverterOptionalString.write(inner.target, into);
return;
}
- case AppOnboardingAction_Tags.PresentationPicked: {
+ case AppOnboardingAction_Tags.CliPlanned: {
ordinalConverter.write(3, into);
const inner = value.inner;
+ FfiConverterTypeAppCliInstallPlan.write(inner.plan, into);
+ return;
+ }
+ case AppOnboardingAction_Tags.CliDone: {
+ ordinalConverter.write(4, into);
+ const inner = value.inner;
+ FfiConverterBool.write(inner.install, into);
+ return;
+ }
+ case AppOnboardingAction_Tags.CliInstallFailed: {
+ ordinalConverter.write(5, into);
+ const inner = value.inner;
+ FfiConverterString.write(inner.error, into);
+ return;
+ }
+ case AppOnboardingAction_Tags.PresentationPicked: {
+ ordinalConverter.write(6, into);
+ const inner = value.inner;
FfiConverterBool.write(inner.menuBar, into);
return;
}
case AppOnboardingAction_Tags.PresentationDone: {
- ordinalConverter.write(4, into);
+ ordinalConverter.write(7, into);
return;
}
case AppOnboardingAction_Tags.SignedIn: {
- ordinalConverter.write(5, into);
+ ordinalConverter.write(8, into);
const inner = value.inner;
FfiConverterString.write(inner.identity, into);
return;
}
case AppOnboardingAction_Tags.SigninDone: {
- ordinalConverter.write(6, into);
+ ordinalConverter.write(9, into);
return;
}
case AppOnboardingAction_Tags.AgentsDone: {
- ordinalConverter.write(7, into);
+ ordinalConverter.write(10, into);
const inner = value.inner;
FfiConverterSequenceString.write(inner.configured, into);
return;
}
case AppOnboardingAction_Tags.ModeChosen: {
- ordinalConverter.write(8, into);
+ ordinalConverter.write(11, into);
const inner = value.inner;
FfiConverterTypeAppOnboardingMode.write(inner.mode, into);
return;
}
case AppOnboardingAction_Tags.DriveChecked: {
- ordinalConverter.write(9, into);
+ ordinalConverter.write(12, into);
const inner = value.inner;
FfiConverterTypeAppSpaceOs.write(inner.os, into);
FfiConverterOptionalTypeAppDriveMountInput.write(inner.status, into);
return;
}
case AppOnboardingAction_Tags.DriveToggled: {
- ordinalConverter.write(10, into);
+ ordinalConverter.write(13, into);
const inner = value.inner;
FfiConverterBool.write(inner.on, into);
return;
}
case AppOnboardingAction_Tags.DriveContinue: {
- ordinalConverter.write(11, into);
+ ordinalConverter.write(14, into);
return;
}
case AppOnboardingAction_Tags.DriveMounted: {
- ordinalConverter.write(12, into);
+ ordinalConverter.write(15, into);
const inner = value.inner;
FfiConverterTypeAppDriveMountInput.write(inner.status, into);
return;
}
case AppOnboardingAction_Tags.DriveFailed: {
- ordinalConverter.write(13, into);
+ ordinalConverter.write(16, into);
const inner = value.inner;
FfiConverterString.write(inner.error, into);
return;
}
case AppOnboardingAction_Tags.DriveStorageLoaded: {
- ordinalConverter.write(14, into);
+ ordinalConverter.write(17, into);
const inner = value.inner;
FfiConverterTypeAppDriveStorageInput.write(inner.storage, into);
FfiConverterOptionalString.write(inner.home, into);
return;
}
case AppOnboardingAction_Tags.StorageChosen: {
- ordinalConverter.write(15, into);
+ ordinalConverter.write(18, into);
const inner = value.inner;
FfiConverterTypeAppStorageChoice.write(inner.choice, into);
return;
}
case AppOnboardingAction_Tags.DriveStorage: {
- ordinalConverter.write(16, into);
+ ordinalConverter.write(19, into);
const inner = value.inner;
FfiConverterTypeAppStorageAction.write(inner.action, into);
return;
}
case AppOnboardingAction_Tags.DriveStorageSaved: {
- ordinalConverter.write(17, into);
+ ordinalConverter.write(20, into);
const inner = value.inner;
FfiConverterTypeAppDriveCheckInput.write(inner.check, into);
return;
}
case AppOnboardingAction_Tags.LaunchAtLoginToggled: {
- ordinalConverter.write(18, into);
+ ordinalConverter.write(21, into);
const inner = value.inner;
FfiConverterBool.write(inner.on, into);
return;
}
case AppOnboardingAction_Tags.Back: {
- ordinalConverter.write(19, into);
+ ordinalConverter.write(22, into);
return;
}
case AppOnboardingAction_Tags.TelemetryLoaded: {
- ordinalConverter.write(20, into);
+ ordinalConverter.write(23, into);
const inner = value.inner;
FfiConverterTypeAppTelemetryInput.write(inner.telemetry, into);
return;
}
case AppOnboardingAction_Tags.WelcomeShown: {
- ordinalConverter.write(21, into);
+ ordinalConverter.write(24, into);
return;
}
case AppOnboardingAction_Tags.UsageDataToggled: {
- ordinalConverter.write(22, into);
+ ordinalConverter.write(25, into);
const inner = value.inner;
FfiConverterBool.write(inner.on, into);
return;
}
case AppOnboardingAction_Tags.ExperimentsLoaded: {
- ordinalConverter.write(23, into);
+ ordinalConverter.write(26, into);
const inner = value.inner;
FfiConverterTypeAppExperiments.write(inner.experiments, into);
return;
@@ -49679,116 +49835,134 @@ const FfiConverterTypeAppOnboardingAction = (() => {
size += FfiConverterOptionalString.allocationSize(inner.target);
return size;
}
- case AppOnboardingAction_Tags.PresentationPicked: {
+ case AppOnboardingAction_Tags.CliPlanned: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(3);
+ size += FfiConverterTypeAppCliInstallPlan.allocationSize(inner.plan);
+ return size;
+ }
+ case AppOnboardingAction_Tags.CliDone: {
+ const inner = value.inner;
+ let size = ordinalConverter.allocationSize(4);
+ size += FfiConverterBool.allocationSize(inner.install);
+ return size;
+ }
+ case AppOnboardingAction_Tags.CliInstallFailed: {
+ const inner = value.inner;
+ let size = ordinalConverter.allocationSize(5);
+ size += FfiConverterString.allocationSize(inner.error);
+ return size;
+ }
+ case AppOnboardingAction_Tags.PresentationPicked: {
+ const inner = value.inner;
+ let size = ordinalConverter.allocationSize(6);
size += FfiConverterBool.allocationSize(inner.menuBar);
return size;
}
case AppOnboardingAction_Tags.PresentationDone: {
- return ordinalConverter.allocationSize(4);
+ return ordinalConverter.allocationSize(7);
}
case AppOnboardingAction_Tags.SignedIn: {
const inner = value.inner;
- let size = ordinalConverter.allocationSize(5);
+ let size = ordinalConverter.allocationSize(8);
size += FfiConverterString.allocationSize(inner.identity);
return size;
}
case AppOnboardingAction_Tags.SigninDone: {
- return ordinalConverter.allocationSize(6);
+ return ordinalConverter.allocationSize(9);
}
case AppOnboardingAction_Tags.AgentsDone: {
const inner = value.inner;
- let size = ordinalConverter.allocationSize(7);
+ let size = ordinalConverter.allocationSize(10);
size += FfiConverterSequenceString.allocationSize(inner.configured);
return size;
}
case AppOnboardingAction_Tags.ModeChosen: {
const inner = value.inner;
- let size = ordinalConverter.allocationSize(8);
+ let size = ordinalConverter.allocationSize(11);
size += FfiConverterTypeAppOnboardingMode.allocationSize(inner.mode);
return size;
}
case AppOnboardingAction_Tags.DriveChecked: {
const inner = value.inner;
- let size = ordinalConverter.allocationSize(9);
+ let size = ordinalConverter.allocationSize(12);
size += FfiConverterTypeAppSpaceOs.allocationSize(inner.os);
size += FfiConverterOptionalTypeAppDriveMountInput.allocationSize(inner.status);
return size;
}
case AppOnboardingAction_Tags.DriveToggled: {
const inner = value.inner;
- let size = ordinalConverter.allocationSize(10);
+ let size = ordinalConverter.allocationSize(13);
size += FfiConverterBool.allocationSize(inner.on);
return size;
}
case AppOnboardingAction_Tags.DriveContinue: {
- return ordinalConverter.allocationSize(11);
+ return ordinalConverter.allocationSize(14);
}
case AppOnboardingAction_Tags.DriveMounted: {
const inner = value.inner;
- let size = ordinalConverter.allocationSize(12);
+ let size = ordinalConverter.allocationSize(15);
size += FfiConverterTypeAppDriveMountInput.allocationSize(inner.status);
return size;
}
case AppOnboardingAction_Tags.DriveFailed: {
const inner = value.inner;
- let size = ordinalConverter.allocationSize(13);
+ let size = ordinalConverter.allocationSize(16);
size += FfiConverterString.allocationSize(inner.error);
return size;
}
case AppOnboardingAction_Tags.DriveStorageLoaded: {
const inner = value.inner;
- let size = ordinalConverter.allocationSize(14);
+ let size = ordinalConverter.allocationSize(17);
size += FfiConverterTypeAppDriveStorageInput.allocationSize(inner.storage);
size += FfiConverterOptionalString.allocationSize(inner.home);
return size;
}
case AppOnboardingAction_Tags.StorageChosen: {
const inner = value.inner;
- let size = ordinalConverter.allocationSize(15);
+ let size = ordinalConverter.allocationSize(18);
size += FfiConverterTypeAppStorageChoice.allocationSize(inner.choice);
return size;
}
case AppOnboardingAction_Tags.DriveStorage: {
const inner = value.inner;
- let size = ordinalConverter.allocationSize(16);
+ let size = ordinalConverter.allocationSize(19);
size += FfiConverterTypeAppStorageAction.allocationSize(inner.action);
return size;
}
case AppOnboardingAction_Tags.DriveStorageSaved: {
const inner = value.inner;
- let size = ordinalConverter.allocationSize(17);
+ let size = ordinalConverter.allocationSize(20);
size += FfiConverterTypeAppDriveCheckInput.allocationSize(inner.check);
return size;
}
case AppOnboardingAction_Tags.LaunchAtLoginToggled: {
const inner = value.inner;
- let size = ordinalConverter.allocationSize(18);
+ let size = ordinalConverter.allocationSize(21);
size += FfiConverterBool.allocationSize(inner.on);
return size;
}
case AppOnboardingAction_Tags.Back: {
- return ordinalConverter.allocationSize(19);
+ return ordinalConverter.allocationSize(22);
}
case AppOnboardingAction_Tags.TelemetryLoaded: {
const inner = value.inner;
- let size = ordinalConverter.allocationSize(20);
+ let size = ordinalConverter.allocationSize(23);
size += FfiConverterTypeAppTelemetryInput.allocationSize(inner.telemetry);
return size;
}
case AppOnboardingAction_Tags.WelcomeShown: {
- return ordinalConverter.allocationSize(21);
+ return ordinalConverter.allocationSize(24);
}
case AppOnboardingAction_Tags.UsageDataToggled: {
const inner = value.inner;
- let size = ordinalConverter.allocationSize(22);
+ let size = ordinalConverter.allocationSize(25);
size += FfiConverterBool.allocationSize(inner.on);
return size;
}
case AppOnboardingAction_Tags.ExperimentsLoaded: {
const inner = value.inner;
- let size = ordinalConverter.allocationSize(23);
+ let size = ordinalConverter.allocationSize(26);
size += FfiConverterTypeAppExperiments.allocationSize(inner.experiments);
return size;
}
@@ -54959,8 +55133,8 @@ const FfiConverterTypeTeleportScope = (() => {
})();
/**
- * Puts the app's bundled `cua` on PATH on first launch (there is no
- * onboarding page for it). The same installer the Tauri app runs;
+ * Puts the app's bundled `cua` on PATH after the first run's Command
+ * line page (`CliPlanned`, `CliDone`). The same installer the Tauri app runs;
* [`plan`](Self::plan) reads what installing would do without writing.
*/
export interface AppCliInstallerLike {
@@ -54981,8 +55155,8 @@ export type AppCliInstallerInterface = AppCliInstallerLike;
/**
- * Puts the app's bundled `cua` on PATH on first launch (there is no
- * onboarding page for it). The same installer the Tauri app runs;
+ * Puts the app's bundled `cua` on PATH after the first run's Command
+ * line page (`CliPlanned`, `CliDone`). The same installer the Tauri app runs;
* [`plan`](Self::plan) reads what installing would do without writing.
*/
export class AppCliInstaller extends UniffiAbstractObject implements AppCliInstallerLike {
@@ -57804,6 +57978,9 @@ const FfiConverterSequenceTypeAppNotchEffect = new FfiConverterArray(FfiConverte
// FfiConverter for Array<AppSystemNote>
const FfiConverterSequenceTypeAppSystemNote = new FfiConverterArray(FfiConverterTypeAppSystemNote);
+// FfiConverter for AppCliInstallPlan | undefined
+const FfiConverterOptionalTypeAppCliInstallPlan = new FfiConverterOptional(FfiConverterTypeAppCliInstallPlan);
+
// FfiConverter for AppOnboardingMode | undefined
const FfiConverterOptionalTypeAppOnboardingMode = new FfiConverterOptional(FfiConverterTypeAppOnboardingMode);
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/OnboardingModel.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/OnboardingModel.swift
index 73a1d2f443..f9e41ad90c 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/OnboardingModel.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/OnboardingModel.swift
@@ -7,8 +7,8 @@ import CuaSpacesFFI
import Foundation
import Observation
-/// The first-launch installer of the bundled `cua`: the app core's, through
-/// the cua SDK (`AppCliInstaller`), the same one the Tauri app runs.
+/// The Command line page's installer of the bundled `cua`: the app core's,
+/// through the cua SDK (`AppCliInstaller`), the same one the Tauri app runs.
public protocol CliInstallRunning: AnyObject, Sendable {
func plan() async -> AppCliInstallPlan
func install(request: AppCliInstallRequest) async throws -> AppCliInstallPlan
@@ -17,8 +17,8 @@ public protocol CliInstallRunning: AnyObject, Sendable {
extension AppCliInstaller: CliInstallRunning {}
/// First run: the core's step order and answers, plus the writes the flow
-/// runs through the shared core: installing the bundled `cua` command on
-/// first launch (no page) and host setup.
+/// runs through the shared core: installing the bundled `cua` command after
+/// its page, and host setup.
@MainActor
@Observable
public final class OnboardingModel {
@@ -47,8 +47,6 @@ public final class OnboardingModel {
/// The fixed words.
public let copy = appOnboardingCopy()
- /// The bundled `cua` after the first-launch install (nil until checked).
- public private(set) var cliPlan: AppCliInstallPlan?
/// Where Cua Spaces shows up was picked (menu bar only or not): the app
/// saves it as the "Spaces tab in the notch" setting.
public var onPresentation: ((Bool) -> Void)?
@@ -114,29 +112,31 @@ public final class OnboardingModel {
/// Welcome's "Share anonymous usage data" switch.
public func setShareUsage(_ on: Bool) { send(.usageDataToggled(on: on)) }
- // MARK: - The cua command (no page)
-
- /// First launch: installs the bundled `cua` silently onto the core's
- /// target, adding its bin dir to the shell profile when it is not on
- /// PATH (the Tauri app does the same). A current install, or a build
- /// without the CLI, writes nothing. Done shows where it went.
- public func installCliSilently() async {
- guard let cli, cliPlan == nil else { return }
- let plan = await cli.plan()
- cliPlan = plan
- var installed: AppCliInstallPlan? = plan.upToDate ? plan : nil
- if !plan.upToDate, plan.source != nil {
- installed = try? await cli.install(request: AppCliInstallRequest(modifyPath: !plan.onPath))
- if let installed { cliPlan = installed }
+ // MARK: - The cua command
+
+ /// Reads what installing the bundled `cua` would do (writes nothing).
+ public func planCli() async {
+ guard let cli, state.cliPlan == nil else { return }
+ send(.cliPlanned(plan: await cli.plan()))
+ }
+
+ /// Continue (`install`) or Skip from Command line.
+ public func finishCli(install: Bool) async {
+ guard !state.cliInstalling else { return }
+ send(.cliDone(install: install))
+ guard state.cliInstalling, let cli, let plan = state.cliPlan else { return }
+ do {
+ send(.cliPlanned(plan: try await cli.install(request: AppCliInstallRequest(modifyPath: !plan.onPath))))
+ } catch {
+ send(.cliInstallFailed(error: LiveSpacesBackend.words(error)))
}
- if let installed { send(.cliInstalled(target: installed.target)) }
}
/// Another `cua` that comes first on PATH (an old Python cua-cli, say),
/// so typing `cua` runs it rather than the installed path Done shows:
/// Done notes it under "cua command".
public var cliShadowedBy: String? {
- guard state.cliTarget != nil, let other = cliPlan?.shadowedBy, !other.isEmpty else { return nil }
+ guard state.cliTarget != nil, let other = state.cliPlan?.shadowedBy, !other.isEmpty else { return nil }
return other
}
@@ -372,9 +372,10 @@ public final class OnboardingModel {
shownOnce = false
host.closeForm()
agentOutcomes = nil
+ let plan = state.cliPlan
state = appOnboardingInitial(installerMode: state.installerMode, identity: state.identity)
if let x = currentExperiments?() { send(.experimentsLoaded(experiments: x)) }
- if let plan = cliPlan, plan.upToDate { send(.cliInstalled(target: plan.target)) }
+ if let plan { send(.cliPlanned(plan: plan)) }
Task { await checkDrive() }
}
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/OnboardingView.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/OnboardingView.swift
index 4772032ef5..90ae568d41 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/OnboardingView.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/OnboardingView.swift
@@ -14,8 +14,8 @@ import SwiftUI
/// in the corner), page dots centred between them. Done adds the example
/// prompts under both columns, scrolling slowly. Pages, copy, cards,
/// which buttons show and the answers are the core's (`appOnboardingView`);
-/// only the placement is this view's, the same as the Tauri app's. There is
-/// no command-line page, the bundled `cua` installs on first launch.
+/// only the placement is this view's, the same as the Tauri app's. The
+/// bundled `cua` installs only from its Command line page.
public struct OnboardingView: View {
@Bindable var onboarding: OnboardingModel
var onSignIn: (() async -> String?)?
@@ -78,7 +78,7 @@ public struct OnboardingView: View {
footer(v).layoutPriority(1)
}
.frame(minWidth: 720, minHeight: 520)
- .task { await onboarding.installCliSilently() }
+ .task { await onboarding.planCli() }
.task { if !onboarding.state.driveChecked { await onboarding.checkDrive() } }
}
@@ -165,6 +165,7 @@ public struct OnboardingView: View {
private func hasCard(_ v: AppOnboardingView) -> Bool {
switch v.step {
case .signin: return onboarding.state.identity != nil || signInPhase != .idle
+ case .cli: return onboarding.state.cliError != nil
default: return true
}
}
@@ -220,6 +221,10 @@ public struct OnboardingView: View {
}
}
}
+ case .cli:
+ if let error = onboarding.state.cliError {
+ Text(error).foregroundStyle(.red).fixedSize(horizontal: false, vertical: true)
+ }
case .presentation:
VStack(spacing: 10) {
ForEach(v.presentations, id: \.id) { c in
@@ -513,6 +518,7 @@ public struct OnboardingView: View {
.buttonStyle(.borderedProminent)
.controlSize(.large)
.keyboardShortcut(.defaultAction)
+ .disabled(onboarding.state.cliInstalling)
}
}
@@ -525,6 +531,7 @@ public struct OnboardingView: View {
private func skip(_ step: AppOnboardingStep) {
switch step {
+ case .cli: Task { await onboarding.finishCli(install: false) }
case .signin: onboarding.send(.signinDone)
case .agents: onboarding.finishAgents(skipped: true)
default: advance(step)
@@ -534,6 +541,7 @@ public struct OnboardingView: View {
private func advance(_ step: AppOnboardingStep) {
switch step {
case .welcome: onboarding.send(.start)
+ case .cli: Task { await onboarding.finishCli(install: true) }
case .signin: onboarding.send(.signinDone)
case .agents: onboarding.finishAgents(skipped: true)
case .presentation: onboarding.send(.presentationDone)
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/OnboardingTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/OnboardingTests.swift
index 501fa809a2..da119a6296 100644
--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/OnboardingTests.swift
+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/OnboardingTests.swift
@@ -35,6 +35,20 @@ final class FakeHost: HostRunning, @unchecked Sendable {
func configure(change: HostSettingsChange) async throws -> HostStatus { FixtureHost.unconfigured }
}
+final class FailingCli: CliInstallRunning, @unchecked Sendable {
+ let planned: AppCliInstallPlan
+ var installs = 0
+
+ init(plan: AppCliInstallPlan) { planned = plan }
+
+ func plan() async -> AppCliInstallPlan { planned }
+
+ func install(request: AppCliInstallRequest) async throws -> AppCliInstallPlan {
+ installs += 1
+ throw CuaError.Runtime(message: "Permission denied")
+ }
+}
+
/// A temp directory with a fake bundled `cua` next to a fake app executable.
/// Nothing outside it is read or written.
struct TempInstall {
@@ -73,19 +87,25 @@ struct OnboardingTests {
return o
}
- /// A fresh first run in a temp HOME: the bundled cua is installed with
- /// no page, the shell profile puts it on PATH (a new shell resolves it),
- /// and the pages never include a command-line one.
- @Test func firstLaunchInstallsTheCliSilentlyOntoPath() async throws {
+ /// A fresh first run in a temp HOME: launching writes nothing; the
+ /// Command line page follows Welcome, and Continue installs the bundled
+ /// cua and the shell profile puts it on PATH (a new shell resolves it).
+ @Test func theCommandLinePageInstallsTheCliOntoPath() async throws {
let tmp = try TempInstall()
defer { tmp.remove() }
let o = OnboardingModel(statePath: nil, cli: tmp.installer())
- #expect(!o.view.dots.contains { $0.label == "Command line" })
- await o.installCliSilently()
+ await o.planCli()
+ #expect(!FileManager.default.fileExists(atPath: tmp.home.path), "nothing written before the page")
+ #expect(o.view.step == .welcome)
+ o.send(.start)
+ #expect(o.view.step == .cli)
+ #expect(o.view.title == "Install the cua command and add it to your PATH")
+ #expect(!FileManager.default.fileExists(atPath: tmp.home.path), "nothing written on the page")
+ await o.finishCli(install: true)
+ #expect(o.view.step == .signin)
let target = tmp.home.appendingPathComponent(".local/bin/cua").path
#expect(FileManager.default.isExecutableFile(atPath: target))
#expect(o.state.cliTarget == target)
- #expect(o.view.step == .welcome, "no page was shown for it")
// A new login shell with this HOME and the profile finds `cua`.
let profile = tmp.home.appendingPathComponent(".zshrc").path
let sh = Process()
@@ -100,8 +120,6 @@ struct OnboardingTests {
.trimmingCharacters(in: .whitespacesAndNewlines)
#expect(sh.terminationStatus == 0)
#expect(found == target)
- // Walk every page: none is about the command line; Done shows where.
- o.send(.start)
o.send(.signinDone)
o.send(.agentsDone(configured: []))
#expect(o.view.step == .presentation)
@@ -112,8 +130,42 @@ struct OnboardingTests {
#expect(o.cliShadowedBy == nil, "nothing else on PATH")
// A second launch finds it current and writes nothing new.
let again = OnboardingModel(statePath: nil, cli: tmp.installer())
- await again.installCliSilently()
- #expect(again.cliPlan?.upToDate == true && again.state.cliTarget == target)
+ await again.planCli()
+ #expect(again.state.cliPlan?.upToDate == true && again.state.cliTarget == target)
+ again.send(.start)
+ #expect(again.view.step == .signin, "no Command line page once current")
+ }
+
+ @Test func skippingTheCommandLinePageWritesNothing() async throws {
+ let tmp = try TempInstall()
+ defer { tmp.remove() }
+ let o = OnboardingModel(statePath: nil, cli: tmp.installer())
+ await o.planCli()
+ o.send(.start)
+ await o.finishCli(install: false)
+ #expect(o.view.step == .signin)
+ o.send(.back)
+ await o.finishCli(install: false)
+ #expect(o.view.step == .signin)
+ #expect(o.state.cliTarget == nil)
+ #expect(!FileManager.default.fileExists(atPath: tmp.home.path))
+ }
+
+ @Test func aFailedInstallStaysOnTheCommandLinePageAndSaysWhy() async throws {
+ let tmp = try TempInstall()
+ defer { tmp.remove() }
+ let cli = FailingCli(plan: await tmp.installer().plan())
+ let o = OnboardingModel(statePath: nil, cli: cli)
+ await o.planCli()
+ o.send(.start)
+ await o.finishCli(install: true)
+ #expect(o.view.step == .cli)
+ #expect(o.state.cliError?.contains("Permission denied") == true)
+ #expect(o.state.cliTarget == nil)
+ #expect(!o.state.cliInstalling && o.view.canSkip)
+ await o.finishCli(install: false)
+ #expect(o.view.step == .signin)
+ #expect(cli.installs == 1)
}
/// Another `cua` earlier on PATH (a stale Python cua-cli, say): Done
@@ -130,11 +182,12 @@ struct OnboardingTests {
let o = OnboardingModel(statePath: nil,
cli: tmp.installer(pathEnv: "\(stale.path):\(binDir):/usr/bin:/bin"))
#expect(o.cliShadowedBy == nil, "nothing installed yet")
- await o.installCliSilently()
+ await o.planCli()
+ o.send(.start)
+ await o.finishCli(install: true)
let target = tmp.home.appendingPathComponent(".local/bin/cua").path
#expect(o.state.cliTarget == target)
#expect(o.cliShadowedBy == other.path)
- o.send(.start)
toMode(o)
o.send(.modeChosen(mode: .client))
#expect(o.view.step == .done)
@@ -145,7 +198,9 @@ struct OnboardingTests {
let tmp = try TempInstall()
defer { tmp.remove() }
let o = OnboardingModel(statePath: nil, cli: tmp.installer(bundled: false))
- await o.installCliSilently()
+ await o.planCli()
+ o.send(.start)
+ #expect(o.view.step == .signin, "no Command line page without a bundled cua")
#expect(o.state.cliTarget == nil)
#expect(!FileManager.default.fileExists(atPath: tmp.home.path))
}
diff --git a/docs/content/docs/cua-sdk/concepts/telemetry-events.mdx b/docs/content/docs/cua-sdk/concepts/telemetry-events.mdx
index 71666c3553..91d9593311 100644
--- a/docs/content/docs/cua-sdk/concepts/telemetry-events.mdx
+++ b/docs/content/docs/cua-sdk/concepts/telemetry-events.mdx
@@ -34,8 +34,8 @@ Every event carries: `telemetry_schema_version`, `event_version`, `product`
| `cua_daemon_health` | `uptime_bucket`, `sandboxes` | Hourly aggregate health. |
| `cua_spacesd_health` | `uptime_bucket`, `imports_failed` | In-sandbox health, hourly. |
| `cua_spacesd_session_deliveries` | `delivery_grant` (`present` or `absent`), `count` | Session deliveries with and without a Keyvault grant. |
-| `cua_app_active` | `experiments_on` (the Cua Spaces experiments turned on in Settings, Experiments: `cua_volume`, `your_cloud`, `sharing` joined with `+`, or `none`) | Daily and weekly active installs and retention: at most one per install per UTC day. Also how many installs use each experiment. |
-| `cua_onboarding_page` | `page` (`welcome`, `signin`, `agents`, `presentation`, `volume`, `this_machine`, `done`), `action` (`shown`, `completed`, `skipped`, `back`), `choice` (a fixed word such as `signed_in`, `menu_bar_only`, `s3`, `host`, or `none`) | Which first-run page people leave on, and what they pick. |
+| `cua_app_active` | `experiments_on` (the Cua Spaces experiments turned on in Settings, Experiments: `cua_volume`, `your_cloud`, `sharing` joined with `+`, or `none`) | Daily and weekly active installs and retention: at most one per install per UTC day. Also installs per experiment. |
+| `cua_onboarding_page` | `page` (`welcome`, `command_line`, `signin`, `agents`, `presentation`, `volume`, `this_machine`, `done`), `action` (`shown`, `completed`, `skipped`, `back`), `choice` (a fixed word such as `installed`, `signed_in`, `menu_bar_only`, `s3`, `host`, or `none`) | Which first-run page people leave on, and what they pick. |
| `cua_space_wizard` | `action` (`opened`, `cancelled`, `submitted`) | How often a New Space is started and abandoned. |
| `cua_space_create_started` | `location`, `guest_os`, `kind`, `gpu` (GPU acceleration turned on) | Which Spaces are started, and how often with GPU acceleration. |
| `cua_space_create` | `location`, `guest_os`, `kind`, `outcome` (`ok`, `error`, or `cancelled` when Cancel was pressed while it was being created), `error_kind`, `failed_phase` (the phase it failed or was cancelled in, or `none`), `stalled`, `time_bucket` (to ready, the failure, or cancel finishing), `gpu` | Space create success, failure and cancel rates, time to ready, and which phase fails. |
@@ -43,7 +43,7 @@ Every event carries: `telemetry_schema_version`, `event_version`, `product`
| `cua_persistent_agent` | `action` (`create`, `pause`, `resume`, `routine_add`, ...), `harness`, `outcome`, `error_kind` | Persistent agents and routines adoption. |
| `cua_host_setup` | `mode` (`relay` or `direct`), `profile` (`desktop`, `spare`, `both`), `outcome`, `error_kind`, `signed_in`, `token_state` (`provided`, `expired`, `missing`, `not_needed`; never the token), `failed_stage` (`none`, `preflight`, `token`, `register`, `download`, `service`), `http_status` (the status a server answered a failure with, `0` when none) | Machines set up for access, and where a failed setup stopped. |
| `cua_host_space_provided` | `kind`, `guest_os`, `outcome`, `error_kind` | Spaces a host machine created for your other devices. |
-| `cua_keyvault_action` | `action` (`setup`, `unlock`, `lock`, `import`, `site_login`), `method` (`os_key_store`, which is Touch ID on a Mac, `passphrase`, `recovery_key`, `none`), `outcome` | Keyvault adoption and how it is unlocked. Nothing about what is stored. |
+| `cua_keyvault_action` | `action` (`setup`, `unlock`, `lock`, `import`, `site_login`), `method` (`os_key_store` (Touch ID on a Mac), `passphrase`, `recovery_key`, `none`), `outcome` | Keyvault adoption and how it is unlocked. Nothing about what is stored. |
| `cua_share` | `action` (`share`, `unshare`, `change_role`), `role` (`viewer`, `editor`, `none`), `outcome` | Sharing, and how often it is view-only. Never who. |
| `cua_presence_session` | `outcome`, `participants` (bucketed), `duration_bucket` | Multiplayer sessions, their size and length. |
| `cua_app_update` | `action` (`checked`, `found`, `not_found`, `installed`, `failed`), `channel` (`stable` or `beta`), `trigger` (`user` or `background`) | Whether people update. |
diff --git a/docs/content/docs/cua-sdk/reference/spaces/app-core/about.mdx b/docs/content/docs/cua-sdk/reference/spaces/app-core/about.mdx
index 5e0664778e..17f694e030 100644
--- a/docs/content/docs/cua-sdk/reference/spaces/app-core/about.mdx
+++ b/docs/content/docs/cua-sdk/reference/spaces/app-core/about.mdx
@@ -119,8 +119,8 @@ AppUpdateChannel::Beta
## `AppCliInstaller`
-Puts the app's bundled `cua` on PATH on first launch (there is no
-onboarding page for it). The same installer the Tauri app runs;
+Puts the app's bundled `cua` on PATH after the first run's Command
+line page (`CliPlanned`, `CliDone`). The same installer the Tauri app runs;
`plan` reads what installing would do without writing.
| Method | Description |
diff --git a/docs/content/docs/cua-sdk/reference/spaces/app-core/onboarding-settings.mdx b/docs/content/docs/cua-sdk/reference/spaces/app-core/onboarding-settings.mdx
index ed1f167d24..62820a6c1a 100644
--- a/docs/content/docs/cua-sdk/reference/spaces/app-core/onboarding-settings.mdx
+++ b/docs/content/docs/cua-sdk/reference/spaces/app-core/onboarding-settings.mdx
@@ -203,7 +203,10 @@ Returned by [`app_onboarding_initial`](#app_onboarding_initial), [`app_onboardin
| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `step` | [`AppOnboardingStep`](#apponboardingstep-enum) | | Page. |
-| `cli_target` / `cliTarget` | `Option<String>` | | Where `cua` was installed on first launch, when it was. |
+| `cli_target` / `cliTarget` | `Option<String>` | | Where `cua` was installed, when it was. |
+| `cli_plan` / `cliPlan` | [`Option<AppCliInstallPlan>`](/cua-sdk/reference/spaces/app-core/about#appcliinstallplan-record) | | The bundled `cua`'s install plan, as the shell read it. |
+| `cli_installing` / `cliInstalling` | `bool` | | Continue on Command line: the shell is installing. |
+| `cli_error` / `cliError` | `Option<String>` | | Why the install failed. |
| `menu_bar` / `menuBar` | `bool` | | Menu bar only (no notch). The same setting as Settings' "Spaces tab in the notch". |
| `identity` | `Option<String>` | | Signed-in identity. |
| `agents` | `Vec<String>` | | Agents configured. |
@@ -342,6 +345,9 @@ Returned by [`app_settings_load`](#app_settings_load).
```swift
.start
.cliInstalled(target: String?)
+.cliPlanned(plan: AppCliInstallPlan)
+.cliDone(install: Bool)
+.cliInstallFailed(error: String)
.presentationPicked(menuBar: Bool)
.presentationDone
.signedIn(identity: String)
@@ -371,6 +377,9 @@ Returned by [`app_settings_load`](#app_settings_load).
```rust
AppOnboardingAction::Start
AppOnboardingAction::CliInstalled { target: Option<String> }
+AppOnboardingAction::CliPlanned { plan: AppCliInstallPlan }
+AppOnboardingAction::CliDone { install: bool }
+AppOnboardingAction::CliInstallFailed { error: String }
AppOnboardingAction::PresentationPicked { menu_bar: bool }
AppOnboardingAction::PresentationDone
AppOnboardingAction::SignedIn { identity: String }
@@ -401,6 +410,9 @@ AppOnboardingAction::ExperimentsLoaded { experiments: AppExperiments }
| --- | --- |
| `Start` | "Get started". |
| `CliInstalled` | The app installed its bundled `cua` on first launch (any page). Fields: `target: Option<String>` |
+| `CliPlanned` | The bundled `cua`'s install plan, read or installed (any page). Fields: `plan: AppCliInstallPlan` |
+| `CliDone` | Continue (`install`) or Skip from Command line. Fields: `install: bool` |
+| `CliInstallFailed` | The Command line page's install failed. Fields: `error: String` |
| `PresentationPicked` | A presentation card was picked (it stays on the page). Fields: `menu_bar: bool` |
| `PresentationDone` | Continue from the presentation page. |
| `SignedIn` | Signed in. Fields: `identity: String` |
@@ -456,6 +468,7 @@ AppOnboardingMode::Host
```swift
.welcome
+.cli
.signin
.agents
.presentation
@@ -469,6 +482,7 @@ AppOnboardingMode::Host
```rust
AppOnboardingStep::Welcome
+AppOnboardingStep::Cli
AppOnboardingStep::Signin
AppOnboardingStep::Agents
AppOnboardingStep::Presentation
@@ -483,6 +497,7 @@ AppOnboardingStep::Done
| Variant | Description |
| --- | --- |
| `Welcome` | Welcome. |
+| `Cli` | Install the bundled `cua`, while its plan needs it. |
| `Signin` | Sign in to Cua. |
| `Agents` | Coding agents: cua skills and the cua MCP server. |
| `Presentation` | Where Cua Spaces shows up: the notch and the menu bar, or the menu bar only (the "Spaces tab in the notch" setting). |
diff --git a/libs/cua/crates/cua-spaces-app-core/src/installer.rs b/libs/cua/crates/cua-spaces-app-core/src/installer.rs
index bbc2d3afd6..7074275867 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/installer.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/installer.rs
@@ -13,7 +13,9 @@
//! fake binaries only.
use std::path::{Path, PathBuf};
+#[cfg(feature = "installer")]
use std::process::Stdio;
+#[cfg(feature = "installer")]
use std::time::Duration;
use serde::{Deserialize, Serialize};
@@ -21,6 +23,7 @@ use serde::{Deserialize, Serialize};
/// Marker line written above a PATH edit (same text as install.sh).
pub const PATH_MARKER: &str = "# Added by the cua installer";
+#[cfg(feature = "installer")]
const VERSION_TIMEOUT: Duration = Duration::from_secs(5);
/// File name of the CLI on this OS.
@@ -130,6 +133,7 @@ pub struct CliInstallRequest {
/// Installs the bundled CLI onto PATH. Paths and environment are injected.
#[derive(Clone, Debug)]
+#[cfg(feature = "installer")]
pub struct CliInstaller {
pub bundled: Option<PathBuf>,
pub bin_dir: PathBuf,
@@ -141,6 +145,7 @@ pub struct CliInstaller {
pub prefer_symlink: bool,
}
+#[cfg(feature = "installer")]
impl CliInstaller {
/// The real machine: sidecar next to `exe`, `$HOME`, `$PATH`, `$SHELL`.
pub fn from_env(exe: &Path) -> Self {
@@ -313,7 +318,7 @@ impl CliInstaller {
}
}
-#[cfg(windows)]
+#[cfg(all(windows, feature = "installer"))]
fn add_to_windows_user_path(dir: &Path) -> Result<(), String> {
// HKCU\Environment Path through .NET, which also broadcasts the change.
let script = format!(
@@ -332,7 +337,7 @@ fn add_to_windows_user_path(dir: &Path) -> Result<(), String> {
.ok_or_else(|| "could not update the user PATH".to_string())
}
-#[cfg(not(windows))]
+#[cfg(all(not(windows), feature = "installer"))]
fn add_to_windows_user_path(_dir: &Path) -> Result<(), String> {
Err("not Windows".into())
}
@@ -362,6 +367,7 @@ pub fn linux_package_location(cli: &Path) -> bool {
cli.is_absolute() && (cli.starts_with("/opt") || cli.starts_with("/usr"))
}
+#[cfg(feature = "installer")]
fn same_file(a: &Path, b: &Path) -> bool {
match (a.canonicalize(), b.canonicalize()) {
(Ok(x), Ok(y)) if x == y => true,
@@ -381,6 +387,7 @@ pub fn first_on_path(path_env: &str, name: &str) -> Option<PathBuf> {
/// Whether some *other* PATH entry with a `cua` comes before `bin_dir`
/// (or `bin_dir` is not on PATH at all).
+#[cfg(feature = "installer")]
fn on_path_before(path_env: &str, bin_dir: &Path) -> bool {
for dir in std::env::split_paths(path_env) {
if dir == bin_dir {
@@ -412,9 +419,11 @@ pub fn is_cua_cli(version_line: &str) -> bool {
}
/// `ETXTBSY` ("text file busy") on Linux and macOS.
+#[cfg(feature = "installer")]
const ETXTBSY: i32 = 26;
/// `cua --version`, first line, or `None` if it does not run.
+#[cfg(feature = "installer")]
pub async fn cli_version(cli: &Path) -> Option<String> {
// A file just written can be briefly "busy" to exec (ETXTBSY) while a
// process forked elsewhere still holds its write handle: try again.
@@ -444,7 +453,7 @@ pub async fn cli_version(cli: &Path) -> Option<String> {
.filter(|l| !l.is_empty())
}
-#[cfg(test)]
+#[cfg(all(test, feature = "installer"))]
mod tests {
use super::*;
diff --git a/libs/cua/crates/cua-spaces-app-core/src/lib.rs b/libs/cua/crates/cua-spaces-app-core/src/lib.rs
index 41fe2320bb..f1524c1818 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/lib.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/lib.rs
@@ -68,7 +68,6 @@ pub mod driver_preview;
pub mod errors;
pub mod experiments;
pub mod host;
-#[cfg(feature = "installer")]
pub mod installer;
pub mod keyvault;
pub mod login_item;
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 6c05ada791..b4b804e3fa 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/onboarding.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/onboarding.rs
@@ -1,7 +1,8 @@
// SPDX-License-Identifier: FSL-1.1-MIT
// Copyright (c) 2026 Cua AI, Inc.
-//! First run: Welcome, Sign in, AI agents, where Cua Spaces shows up, Cua
+//! First run: Welcome, Command line (only while the app's bundled `cua`
+//! needs installing), Sign in, AI agents, where Cua Spaces shows up, Cua
//! Volume (only with its experiment on, Settings, Experiments; hidden
//! where the drive cannot mount, Windows), This machine, Done. One step per
//! page with page dots; every write asks first (the shells run the writes,
@@ -15,6 +16,7 @@ use crate::drive_settings::{
storage_reduce, storage_section,
};
use crate::experiments::Experiments;
+use crate::installer::{CliInstallPlan, InstallMethod};
use crate::model::SpaceOs;
use crate::settings::{SettingsOption, SettingsRow, TelemetryInput};
@@ -24,6 +26,8 @@ use crate::settings::{SettingsOption, SettingsRow, TelemetryInput};
pub enum OnboardingStep {
/// Welcome.
Welcome,
+ /// Install the bundled `cua`, while its plan needs it.
+ Cli,
/// Sign in to Cua.
Signin,
/// Coding agents: cua skills and the cua MCP server.
@@ -41,10 +45,9 @@ pub enum OnboardingStep {
}
/// Page order.
-/// There is no command-line page: the app installs its bundled `cua` on
-/// first launch ([`OnboardingAction::CliInstalled`]).
-pub const STEPS: [OnboardingStep; 7] = [
+pub const STEPS: [OnboardingStep; 8] = [
OnboardingStep::Welcome,
+ OnboardingStep::Cli,
OnboardingStep::Signin,
OnboardingStep::Agents,
OnboardingStep::Presentation,
@@ -58,6 +61,7 @@ impl OnboardingStep {
pub fn label(self) -> &'static str {
match self {
OnboardingStep::Welcome => "Welcome",
+ OnboardingStep::Cli => "Command line",
OnboardingStep::Presentation => "Menu bar",
OnboardingStep::Signin => "Sign in",
OnboardingStep::Agents => "AI agents",
@@ -68,16 +72,24 @@ impl OnboardingStep {
}
}
-/// The pages this run shows, in order: [`STEPS`] without Cua Volume while
+/// The pages this run shows, in order: [`STEPS`] without Command line
+/// unless the bundled `cua` needs installing, and without Cua Volume while
/// its experiment is off, or where it cannot mount (Windows).
pub fn steps(s: &OnboardingState) -> Vec<OnboardingStep> {
STEPS
.iter()
.copied()
+ .filter(|st| *st != OnboardingStep::Cli || cli_shown(s))
.filter(|st| *st != OnboardingStep::Drive || drive_shown(s))
.collect()
}
+fn cli_shown(s: &OnboardingState) -> bool {
+ s.cli_plan
+ .as_ref()
+ .is_some_and(|p| p.source.is_some() && !p.up_to_date)
+}
+
/// The Cua Volume page shows: the Cua Volume experiment is on, everywhere
/// but a Windows machine the daemon cannot mount on.
fn drive_shown(s: &OnboardingState) -> bool {
@@ -132,8 +144,17 @@ pub enum OnboardingMode {
pub struct OnboardingState {
/// Page.
pub step: OnboardingStep,
- /// Where `cua` was installed on first launch, when it was.
+ /// Where `cua` was installed, when it was.
pub cli_target: Option<String>,
+ /// The bundled `cua`'s install plan, as the shell read it.
+ #[serde(default)]
+ pub cli_plan: Option<CliInstallPlan>,
+ /// Continue on Command line: the shell is installing.
+ #[serde(default)]
+ pub cli_installing: bool,
+ /// Why the install failed.
+ #[serde(default)]
+ pub cli_error: Option<String>,
/// Menu bar only (no notch). The same setting as Settings' "Spaces tab
/// in the notch".
#[serde(default)]
@@ -224,6 +245,21 @@ pub enum OnboardingAction {
/// Where.
target: Option<String>,
},
+ /// The bundled `cua`'s install plan, read or installed (any page).
+ CliPlanned {
+ /// The plan.
+ plan: CliInstallPlan,
+ },
+ /// Continue (`install`) or Skip from Command line.
+ CliDone {
+ /// Install.
+ install: bool,
+ },
+ /// The Command line page's install failed.
+ CliInstallFailed {
+ /// Why.
+ error: String,
+ },
/// A presentation card was picked (it stays on the page).
PresentationPicked {
/// Menu bar only.
@@ -338,6 +374,9 @@ pub fn initial(
OnboardingState {
step: OnboardingStep::Welcome,
cli_target: None,
+ cli_plan: None,
+ cli_installing: false,
+ cli_error: None,
menu_bar: false,
identity,
agents: vec![],
@@ -421,7 +460,7 @@ pub fn reduce(s: &OnboardingState, a: &OnboardingAction) -> OnboardingState {
let mut n = s.clone();
match (s.step, a) {
(Welcome, OnboardingAction::Start) => {
- n.step = Signin;
+ n.step = next(s, Welcome);
n.run_counted = true;
}
(Welcome, OnboardingAction::WelcomeShown) => {
@@ -430,6 +469,31 @@ pub fn reduce(s: &OnboardingState, a: &OnboardingAction) -> OnboardingState {
}
}
(_, OnboardingAction::CliInstalled { target }) => n.cli_target = target.clone(),
+ (_, OnboardingAction::CliPlanned { plan }) => {
+ n.cli_plan = Some(plan.clone());
+ if plan.up_to_date {
+ n.cli_target = Some(plan.target.clone());
+ }
+ if s.step == Cli && !cli_shown(&n) {
+ n.cli_installing = false;
+ n.step = next(s, Cli);
+ }
+ if s.step != Welcome && !cli_shown(s) && cli_shown(&n) {
+ n.step = Cli;
+ }
+ }
+ (Cli, OnboardingAction::CliDone { install }) if !s.cli_installing => {
+ n.cli_error = None;
+ if *install {
+ n.cli_installing = true;
+ } else {
+ n.step = next(s, Cli);
+ }
+ }
+ (Cli, OnboardingAction::CliInstallFailed { error }) if s.cli_installing => {
+ n.cli_installing = false;
+ n.cli_error = Some(error.clone());
+ }
(Presentation, OnboardingAction::PresentationPicked { menu_bar }) => n.menu_bar = *menu_bar,
(Presentation, OnboardingAction::PresentationDone) => n.step = next(s, Presentation),
(_, OnboardingAction::SignedIn { identity }) => n.identity = Some(identity.clone()),
@@ -572,7 +636,7 @@ pub fn reduce(s: &OnboardingState, a: &OnboardingAction) -> OnboardingState {
t.enabled = *on;
n.telemetry = Some(t);
}
- (step, OnboardingAction::Back) if step != Welcome => {
+ (step, OnboardingAction::Back) if step != Welcome && !s.cli_installing => {
let all = steps(s);
if let Some(i) = all.iter().position(|x| *x == step).filter(|i| *i > 0) {
n.step = all[i - 1];
@@ -1070,6 +1134,23 @@ pub fn installed_at_text(target: &str) -> String {
format!("Installed at {target}")
}
+fn cli_lede(plan: &CliInstallPlan) -> String {
+ let verb = match plan.method {
+ Some(InstallMethod::Symlink) => "Links",
+ _ => "Copies",
+ };
+ if plan.on_path {
+ format!("{verb} cua to {}.", plan.target)
+ } else {
+ format!(
+ "{verb} cua to {} and adds {} to PATH in {}.",
+ plan.target,
+ plan.bin_dir,
+ plan.path_profile.as_deref().unwrap_or("your shell profile")
+ )
+ }
+}
+
/// The flow as drawn, in a Mac's words.
pub fn view(s: &OnboardingState) -> OnboardingView {
view_on(s, SpaceOs::Macos)
@@ -1088,12 +1169,26 @@ pub fn done_lede(os: SpaceOs) -> &'static str {
pub fn view_on(s: &OnboardingState, os: SpaceOs) -> OnboardingView {
use crate::spaces::sidebar::Fact;
use OnboardingStep::*;
+ let cli = s.cli_plan.as_ref().map(cli_lede).unwrap_or_default();
let (title, lede, primary) = match s.step {
Welcome => (
"Welcome to Cua Spaces",
"Computers for you and your agents.",
"Get started",
),
+ Cli => (
+ if s.cli_plan.as_ref().is_some_and(|p| p.on_path) {
+ "Install the cua command"
+ } else {
+ "Install the cua command and add it to your PATH"
+ },
+ cli.as_str(),
+ if s.cli_installing {
+ "Installing\u{2026}"
+ } else {
+ "Continue"
+ },
+ ),
Presentation => (
"Where should Cua Spaces show up?",
"You can change this in Settings.",
@@ -1211,8 +1306,10 @@ pub fn view_on(s: &OnboardingState, os: SpaceOs) -> OnboardingView {
title: title.into(),
lede: lede.into(),
primary_label: primary.into(),
- can_skip: s.step == Agents || (s.step == Signin && s.identity.is_none()),
- can_back: s.step != Welcome,
+ can_skip: (s.step == Cli && !s.cli_installing)
+ || s.step == Agents
+ || (s.step == Signin && s.identity.is_none()),
+ can_back: s.step != Welcome && !s.cli_installing,
show_mark: s.step == Welcome,
preselected_mode: s.installer_mode.unwrap_or(OnboardingMode::Client),
summary,
@@ -1415,10 +1512,193 @@ mod tests {
use super::*;
+ fn plan(up_to_date: bool, on_path: bool) -> CliInstallPlan {
+ CliInstallPlan {
+ source: Some("/Applications/Cua Spaces.app/Contents/MacOS/cua".into()),
+ target: "/h/.local/bin/cua".into(),
+ bin_dir: "/h/.local/bin".into(),
+ up_to_date,
+ on_path,
+ path_profile: Some("/h/.zshrc".into()),
+ ..Default::default()
+ }
+ }
+
+ #[test]
+ fn the_command_line_page_asks_before_installing() {
+ let planned = reduce(
+ &initial(None, None),
+ &OnboardingAction::CliPlanned {
+ plan: plan(false, false),
+ },
+ );
+ assert_eq!(planned.cli_target, None, "nothing installed yet");
+ let s = reduce(&planned, &OnboardingAction::Start);
+ assert_eq!(s.step, OnboardingStep::Cli);
+ let v = view(&s);
+ assert_eq!(v.title, "Install the cua command and add it to your PATH");
+ assert_eq!(
+ v.lede,
+ "Copies cua to /h/.local/bin/cua and adds /h/.local/bin to PATH in /h/.zshrc."
+ );
+ assert_eq!(v.primary_label, "Continue");
+ assert!(v.can_skip && v.can_back);
+ assert!(
+ v.dots
+ .iter()
+ .any(|d| d.label == "Command line" && d.current)
+ );
+ let skipped = reduce(&s, &OnboardingAction::CliDone { install: false });
+ assert_eq!(skipped.step, OnboardingStep::Signin);
+ assert!(!skipped.cli_installing, "Skip installs nothing");
+ assert_eq!(
+ reduce(&skipped, &OnboardingAction::Back).step,
+ OnboardingStep::Cli
+ );
+ let went_on = reduce(
+ &reduce(&s, &OnboardingAction::CliDone { install: true }),
+ &OnboardingAction::CliPlanned {
+ plan: plan(true, true),
+ },
+ );
+ assert_eq!(went_on.step, OnboardingStep::Signin);
+ assert_eq!(went_on.cli_target.as_deref(), Some("/h/.local/bin/cua"));
+ assert!(
+ view(&went_on)
+ .dots
+ .iter()
+ .all(|d| d.label != "Command line")
+ );
+ let on_path = reduce(
+ &s,
+ &OnboardingAction::CliPlanned {
+ plan: plan(false, true),
+ },
+ );
+ assert_eq!(view(&on_path).title, "Install the cua command");
+ for p in [
+ plan(true, true),
+ CliInstallPlan {
+ source: None,
+ ..plan(false, false)
+ },
+ ] {
+ let s = reduce(
+ &reduce(
+ &initial(None, None),
+ &OnboardingAction::CliPlanned { plan: p },
+ ),
+ &OnboardingAction::Start,
+ );
+ assert_eq!(s.step, OnboardingStep::Signin, "current or not bundled");
+ }
+ let current = reduce(
+ &initial(None, None),
+ &OnboardingAction::CliPlanned {
+ plan: plan(true, true),
+ },
+ );
+ assert_eq!(current.cli_target.as_deref(), Some("/h/.local/bin/cua"));
+ let linked = reduce(
+ &s,
+ &OnboardingAction::CliPlanned {
+ plan: CliInstallPlan {
+ method: Some(InstallMethod::Symlink),
+ ..plan(false, true)
+ },
+ },
+ );
+ assert_eq!(view(&linked).lede, "Links cua to /h/.local/bin/cua.");
+ }
+
+ #[test]
+ fn continue_waits_on_the_command_line_page_until_the_install_finishes() {
+ let s = reduce(
+ &reduce(
+ &initial(None, None),
+ &OnboardingAction::CliPlanned {
+ plan: plan(false, false),
+ },
+ ),
+ &OnboardingAction::Start,
+ );
+ let installing = reduce(&s, &OnboardingAction::CliDone { install: true });
+ assert_eq!(installing.step, OnboardingStep::Cli);
+ assert!(installing.cli_installing);
+ let v = view(&installing);
+ assert_eq!(v.primary_label, "Installing\u{2026}");
+ assert!(!v.can_back && !v.can_skip);
+ for a in [
+ OnboardingAction::CliDone { install: true },
+ OnboardingAction::CliDone { install: false },
+ OnboardingAction::Back,
+ ] {
+ assert_eq!(
+ reduce(&installing, &a),
+ installing,
+ "{a:?} while installing"
+ );
+ }
+ let failed = reduce(
+ &installing,
+ &OnboardingAction::CliInstallFailed {
+ error: "Permission denied".into(),
+ },
+ );
+ assert_eq!(failed.step, OnboardingStep::Cli);
+ assert!(!failed.cli_installing);
+ assert_eq!(failed.cli_error.as_deref(), Some("Permission denied"));
+ assert_eq!(failed.cli_target, None);
+ assert!(view(&failed).can_skip && view(&failed).can_back);
+ let again = reduce(&failed, &OnboardingAction::CliDone { install: true });
+ assert!(again.cli_installing);
+ assert_eq!(again.cli_error, None);
+ let installed = reduce(
+ &again,
+ &OnboardingAction::CliPlanned {
+ plan: plan(true, true),
+ },
+ );
+ assert_eq!(installed.step, OnboardingStep::Signin);
+ assert!(!installed.cli_installing);
+ assert_eq!(installed.cli_target.as_deref(), Some("/h/.local/bin/cua"));
+ }
+
+ #[test]
+ fn a_plan_that_arrives_after_get_started_still_shows_the_command_line_page() {
+ let started = reduce(&initial(None, None), &OnboardingAction::Start);
+ assert_eq!(started.step, OnboardingStep::Signin);
+ let s = reduce(
+ &started,
+ &OnboardingAction::CliPlanned {
+ plan: plan(false, false),
+ },
+ );
+ assert_eq!(s.step, OnboardingStep::Cli);
+ assert_eq!(
+ reduce(&s, &OnboardingAction::CliDone { install: false }).step,
+ OnboardingStep::Signin
+ );
+ let again = reduce(
+ &s,
+ &OnboardingAction::CliPlanned {
+ plan: plan(false, false),
+ },
+ );
+ assert_eq!(again.step, OnboardingStep::Cli);
+ let current = reduce(
+ &started,
+ &OnboardingAction::CliPlanned {
+ plan: plan(true, true),
+ },
+ );
+ assert_eq!(current.step, OnboardingStep::Signin);
+ }
+
#[test]
- fn no_command_line_page_and_the_presentation_choice_before_this_machine() {
- assert!(!STEPS.iter().any(|s| s.label() == "Command line"));
+ fn no_command_line_page_without_a_plan_and_the_presentation_choice_before_this_machine() {
let mut s = volume_on();
+ assert!(view(&s).dots.iter().all(|d| d.label != "Command line"));
s = reduce(
&s,
&OnboardingAction::CliInstalled {
diff --git a/libs/cua/crates/cua-spaces-app-core/src/telemetry.rs b/libs/cua/crates/cua-spaces-app-core/src/telemetry.rs
index 14c0e58431..3ac6d71d90 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/telemetry.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/telemetry.rs
@@ -234,6 +234,7 @@ pub fn checklist(event: &str) -> Vec<TelemetrySignal> {
pub fn page_name(s: OnboardingStep) -> &'static str {
match s {
OnboardingStep::Welcome => "welcome",
+ OnboardingStep::Cli => "command_line",
OnboardingStep::Signin => "signin",
OnboardingStep::Agents => "agents",
OnboardingStep::Presentation => "presentation",
@@ -325,6 +326,10 @@ pub fn onboarding_finished(s: &OnboardingState) -> Vec<TelemetrySignal> {
fn leave(s: &OnboardingState, a: &OnboardingAction) -> (&'static str, &'static str) {
match s.step {
OnboardingStep::Welcome | OnboardingStep::Done => ("completed", "none"),
+ OnboardingStep::Cli => match a {
+ OnboardingAction::CliPlanned { .. } => ("completed", "installed"),
+ _ => ("skipped", "not_installed"),
+ },
OnboardingStep::Signin => {
if s.identity.as_deref().is_some_and(|i| !i.is_empty()) {
("completed", "signed_in")
@@ -1098,6 +1103,51 @@ mod tests {
);
}
+ #[test]
+ fn installing_the_command_and_skipping_it_are_told_apart() {
+ let planned = reduce(
+ &initial(None, None),
+ &OnboardingAction::CliPlanned {
+ plan: crate::installer::CliInstallPlan {
+ source: Some("/Applications/Cua Spaces.app/Contents/MacOS/cua".into()),
+ target: "/Users/alice/.local/bin/cua".into(),
+ ..Default::default()
+ },
+ },
+ );
+ let s = reduce(&planned, &OnboardingAction::Start);
+ assert_eq!(
+ pages(&onboarding(&planned, &OnboardingAction::Start))[1..],
+ ["welcome completed none", "command_line shown none"]
+ );
+ let installing = reduce(&s, &OnboardingAction::CliDone { install: true });
+ assert!(onboarding(&s, &OnboardingAction::CliDone { install: true }).is_empty());
+ let installed = OnboardingAction::CliPlanned {
+ plan: crate::installer::CliInstallPlan {
+ source: Some("/Applications/Cua Spaces.app/Contents/MacOS/cua".into()),
+ target: "/Users/alice/.local/bin/cua".into(),
+ up_to_date: true,
+ ..Default::default()
+ },
+ };
+ let done = onboarding(&installing, &installed);
+ assert_eq!(
+ pages(&done),
+ ["command_line completed installed", "signin shown none"]
+ );
+ assert!(!serde_json::to_string(&done).unwrap().contains("alice"));
+ let failed = OnboardingAction::CliInstallFailed {
+ error: "/Users/alice/.zshrc: Permission denied".into(),
+ };
+ assert!(onboarding(&installing, &failed).is_empty());
+ let skip = onboarding(&s, &OnboardingAction::CliDone { install: false });
+ assert_eq!(
+ pages(&skip),
+ ["command_line skipped not_installed", "signin shown none"]
+ );
+ assert!(!serde_json::to_string(&skip).unwrap().contains("alice"));
+ }
+
#[test]
fn no_signal_carries_caller_text() {
let s = reduce(&initial(None, None), &OnboardingAction::Start);
diff --git a/libs/cua/crates/cua-spaces-ffi/src/app_core.rs b/libs/cua/crates/cua-spaces-ffi/src/app_core.rs
index 497e421cc3..098db7b4f1 100644
--- a/libs/cua/crates/cua-spaces-ffi/src/app_core.rs
+++ b/libs/cua/crates/cua-spaces-ffi/src/app_core.rs
@@ -2247,8 +2247,8 @@ pub fn app_host_looks_like_listen(value: String) -> bool {
core::host::looks_like_listen(&value)
}
-/// Puts the app's bundled `cua` on PATH on first launch (there is no
-/// onboarding page for it). The same installer the Tauri app runs;
+/// Puts the app's bundled `cua` on PATH after the first run's Command
+/// line page (`CliPlanned`, `CliDone`). The same installer the Tauri app runs;
/// [`plan`](Self::plan) reads what installing would do without writing.
#[derive(uniffi::Object)]
pub struct AppCliInstaller {
diff --git a/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rs b/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rs
index 627f13f834..a693742c5d 100644
--- a/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rs
+++ b/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rs
@@ -5317,6 +5317,8 @@ pub type AppOnboardingStep = core::onboarding::OnboardingStep;
pub enum AppOnboardingStep {
/// Welcome.
Welcome,
+ /// Install the bundled `cua`, while its plan needs it.
+ Cli,
/// Sign in to Cua.
Signin,
/// Coding agents: cua skills and the cua MCP server.
@@ -5371,8 +5373,14 @@ pub type AppOnboardingState = core::onboarding::OnboardingState;
pub struct AppOnboardingState {
/// Page.
pub step: AppOnboardingStep,
- /// Where `cua` was installed on first launch, when it was.
+ /// Where `cua` was installed, when it was.
pub cli_target: Option<String>,
+ /// The bundled `cua`'s install plan, as the shell read it.
+ pub cli_plan: Option<AppCliInstallPlan>,
+ /// Continue on Command line: the shell is installing.
+ pub cli_installing: bool,
+ /// Why the install failed.
+ pub cli_error: Option<String>,
/// Menu bar only (no notch). The same setting as Settings' "Spaces tab
/// in the notch".
pub menu_bar: bool,
@@ -5435,6 +5443,21 @@ pub enum AppOnboardingAction {
/// Where.
target: Option<String>,
},
+ /// The bundled `cua`'s install plan, read or installed (any page).
+ CliPlanned {
+ /// The plan.
+ plan: AppCliInstallPlan,
+ },
+ /// Continue (`install`) or Skip from Command line.
+ CliDone {
+ /// Install.
+ install: bool,
+ },
+ /// The Command line page's install failed.
+ CliInstallFailed {
+ /// Why.
+ error: String,
+ },
/// A presentation card was picked (it stays on the page).
PresentationPicked {
/// Menu bar only.
diff --git a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
index eb37cc72e2..6a264a774e 100644
--- a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
+++ b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
@@ -641,8 +641,8 @@ fileprivate struct FfiConverterData: FfiConverterRustBuffer {
/**
- * Puts the app's bundled `cua` on PATH on first launch (there is no
- * onboarding page for it). The same installer the Tauri app runs;
+ * Puts the app's bundled `cua` on PATH after the first run's Command
+ * line page (`CliPlanned`, `CliDone`). The same installer the Tauri app runs;
* [`plan`](Self::plan) reads what installing would do without writing.
*/
public protocol AppCliInstallerProtocol: AnyObject, Sendable {
@@ -659,8 +659,8 @@ public protocol AppCliInstallerProtocol: AnyObject, Sendable {
}
/**
- * Puts the app's bundled `cua` on PATH on first launch (there is no
- * onboarding page for it). The same installer the Tauri app runs;
+ * Puts the app's bundled `cua` on PATH after the first run's Command
+ * line page (`CliPlanned`, `CliDone`). The same installer the Tauri app runs;
* [`plan`](Self::plan) reads what installing would do without writing.
*/
open class AppCliInstaller: AppCliInstallerProtocol, @unchecked Sendable {
@@ -21762,9 +21762,21 @@ public struct AppOnboardingState: Equatable, Hashable {
*/
public var step: AppOnboardingStep
/**
- * Where `cua` was installed on first launch, when it was.
+ * Where `cua` was installed, when it was.
*/
public var cliTarget: String?
+ /**
+ * The bundled `cua`'s install plan, as the shell read it.
+ */
+ public var cliPlan: AppCliInstallPlan?
+ /**
+ * Continue on Command line: the shell is installing.
+ */
+ public var cliInstalling: Bool
+ /**
+ * Why the install failed.
+ */
+ public var cliError: String?
/**
* Menu bar only (no notch). The same setting as Settings' "Spaces tab
* in the notch".
@@ -21862,8 +21874,17 @@ public struct AppOnboardingState: Equatable, Hashable {
* Page.
*/step: AppOnboardingStep,
/**
- * Where `cua` was installed on first launch, when it was.
+ * Where `cua` was installed, when it was.
*/cliTarget: String?,
+ /**
+ * The bundled `cua`'s install plan, as the shell read it.
+ */cliPlan: AppCliInstallPlan?,
+ /**
+ * Continue on Command line: the shell is installing.
+ */cliInstalling: Bool,
+ /**
+ * Why the install failed.
+ */cliError: String?,
/**
* Menu bar only (no notch). The same setting as Settings' "Spaces tab
* in the notch".
@@ -21935,6 +21956,9 @@ public struct AppOnboardingState: Equatable, Hashable {
*/runCounted: Bool) {
self.step = step
self.cliTarget = cliTarget
+ self.cliPlan = cliPlan
+ self.cliInstalling = cliInstalling
+ self.cliError = cliError
self.menuBar = menuBar
self.identity = identity
self.agents = agents
@@ -21975,6 +21999,9 @@ public struct FfiConverterTypeAppOnboardingState: FfiConverterRustBuffer {
try AppOnboardingState(
step: FfiConverterTypeAppOnboardingStep.read(from: &buf),
cliTarget: FfiConverterOptionString.read(from: &buf),
+ cliPlan: FfiConverterOptionTypeAppCliInstallPlan.read(from: &buf),
+ cliInstalling: FfiConverterBool.read(from: &buf),
+ cliError: FfiConverterOptionString.read(from: &buf),
menuBar: FfiConverterBool.read(from: &buf),
identity: FfiConverterOptionString.read(from: &buf),
agents: FfiConverterSequenceString.read(from: &buf),
@@ -22001,6 +22028,9 @@ public struct FfiConverterTypeAppOnboardingState: FfiConverterRustBuffer {
public static func write(_ value: AppOnboardingState, into buf: inout [UInt8]) {
FfiConverterTypeAppOnboardingStep.write(value.step, into: &buf)
FfiConverterOptionString.write(value.cliTarget, into: &buf)
+ FfiConverterOptionTypeAppCliInstallPlan.write(value.cliPlan, into: &buf)
+ FfiConverterBool.write(value.cliInstalling, into: &buf)
+ FfiConverterOptionString.write(value.cliError, into: &buf)
FfiConverterBool.write(value.menuBar, into: &buf)
FfiConverterOptionString.write(value.identity, into: &buf)
FfiConverterSequenceString.write(value.agents, into: &buf)
@@ -47103,6 +47133,30 @@ public enum AppOnboardingAction: Equatable, Hashable {
* Where.
*/target: String?
)
+ /**
+ * The bundled `cua`'s install plan, read or installed (any page).
+ */
+ case cliPlanned(
+ /**
+ * The plan.
+ */plan: AppCliInstallPlan
+ )
+ /**
+ * Continue (`install`) or Skip from Command line.
+ */
+ case cliDone(
+ /**
+ * Install.
+ */install: Bool
+ )
+ /**
+ * The Command line page's install failed.
+ */
+ case cliInstallFailed(
+ /**
+ * Why.
+ */error: String
+ )
/**
* A presentation card was picked (it stays on the page).
*/
@@ -47291,62 +47345,71 @@ public struct FfiConverterTypeAppOnboardingAction: FfiConverterRustBuffer {
case 2: return .cliInstalled(target: try FfiConverterOptionString.read(from: &buf)
)
- case 3: return .presentationPicked(menuBar: try FfiConverterBool.read(from: &buf)
+ case 3: return .cliPlanned(plan: try FfiConverterTypeAppCliInstallPlan.read(from: &buf)
)
- case 4: return .presentationDone
+ case 4: return .cliDone(install: try FfiConverterBool.read(from: &buf)
+ )
+
+ case 5: return .cliInstallFailed(error: try FfiConverterString.read(from: &buf)
+ )
- case 5: return .signedIn(identity: try FfiConverterString.read(from: &buf)
+ case 6: return .presentationPicked(menuBar: try FfiConverterBool.read(from: &buf)
)
- case 6: return .signinDone
+ case 7: return .presentationDone
- case 7: return .agentsDone(configured: try FfiConverterSequenceString.read(from: &buf)
+ case 8: return .signedIn(identity: try FfiConverterString.read(from: &buf)
)
- case 8: return .modeChosen(mode: try FfiConverterTypeAppOnboardingMode.read(from: &buf)
+ case 9: return .signinDone
+
+ case 10: return .agentsDone(configured: try FfiConverterSequenceString.read(from: &buf)
)
- case 9: return .driveChecked(os: try FfiConverterTypeAppSpaceOs.read(from: &buf), status: try FfiConverterOptionTypeAppDriveMountInput.read(from: &buf)
+ case 11: return .modeChosen(mode: try FfiConverterTypeAppOnboardingMode.read(from: &buf)
)
- case 10: return .driveToggled(on: try FfiConverterBool.read(from: &buf)
+ case 12: return .driveChecked(os: try FfiConverterTypeAppSpaceOs.read(from: &buf), status: try FfiConverterOptionTypeAppDriveMountInput.read(from: &buf)
)
- case 11: return .driveContinue
+ case 13: return .driveToggled(on: try FfiConverterBool.read(from: &buf)
+ )
+
+ case 14: return .driveContinue
- case 12: return .driveMounted(status: try FfiConverterTypeAppDriveMountInput.read(from: &buf)
+ case 15: return .driveMounted(status: try FfiConverterTypeAppDriveMountInput.read(from: &buf)
)
- case 13: return .driveFailed(error: try FfiConverterString.read(from: &buf)
+ case 16: return .driveFailed(error: try FfiConverterString.read(from: &buf)
)
- case 14: return .driveStorageLoaded(storage: try FfiConverterTypeAppDriveStorageInput.read(from: &buf), home: try FfiConverterOptionString.read(from: &buf)
+ case 17: return .driveStorageLoaded(storage: try FfiConverterTypeAppDriveStorageInput.read(from: &buf), home: try FfiConverterOptionString.read(from: &buf)
)
- case 15: return .storageChosen(choice: try FfiConverterTypeAppStorageChoice.read(from: &buf)
+ case 18: return .storageChosen(choice: try FfiConverterTypeAppStorageChoice.read(from: &buf)
)
- case 16: return .driveStorage(action: try FfiConverterTypeAppStorageAction.read(from: &buf)
+ case 19: return .driveStorage(action: try FfiConverterTypeAppStorageAction.read(from: &buf)
)
- case 17: return .driveStorageSaved(check: try FfiConverterTypeAppDriveCheckInput.read(from: &buf)
+ case 20: return .driveStorageSaved(check: try FfiConverterTypeAppDriveCheckInput.read(from: &buf)
)
- case 18: return .launchAtLoginToggled(on: try FfiConverterBool.read(from: &buf)
+ case 21: return .launchAtLoginToggled(on: try FfiConverterBool.read(from: &buf)
)
- case 19: return .back
+ case 22: return .back
- case 20: return .telemetryLoaded(telemetry: try FfiConverterTypeAppTelemetryInput.read(from: &buf)
+ case 23: return .telemetryLoaded(telemetry: try FfiConverterTypeAppTelemetryInput.read(from: &buf)
)
- case 21: return .welcomeShown
+ case 24: return .welcomeShown
- case 22: return .usageDataToggled(on: try FfiConverterBool.read(from: &buf)
+ case 25: return .usageDataToggled(on: try FfiConverterBool.read(from: &buf)
)
- case 23: return .experimentsLoaded(experiments: try FfiConverterTypeAppExperiments.read(from: &buf)
+ case 26: return .experimentsLoaded(experiments: try FfiConverterTypeAppExperiments.read(from: &buf)
)
default: throw UniffiInternalError.unexpectedEnumCase
@@ -47366,105 +47429,120 @@ public struct FfiConverterTypeAppOnboardingAction: FfiConverterRustBuffer {
FfiConverterOptionString.write(target, into: &buf)
- case let .presentationPicked(menuBar):
+ case let .cliPlanned(plan):
writeInt(&buf, Int32(3))
+ FfiConverterTypeAppCliInstallPlan.write(plan, into: &buf)
+
+
+ case let .cliDone(install):
+ writeInt(&buf, Int32(4))
+ FfiConverterBool.write(install, into: &buf)
+
+
+ case let .cliInstallFailed(error):
+ writeInt(&buf, Int32(5))
+ FfiConverterString.write(error, into: &buf)
+
+
+ case let .presentationPicked(menuBar):
+ writeInt(&buf, Int32(6))
FfiConverterBool.write(menuBar, into: &buf)
case .presentationDone:
- writeInt(&buf, Int32(4))
+ writeInt(&buf, Int32(7))
case let .signedIn(identity):
- writeInt(&buf, Int32(5))
+ writeInt(&buf, Int32(8))
FfiConverterString.write(identity, into: &buf)
case .signinDone:
- writeInt(&buf, Int32(6))
+ writeInt(&buf, Int32(9))
case let .agentsDone(configured):
- writeInt(&buf, Int32(7))
+ writeInt(&buf, Int32(10))
FfiConverterSequenceString.write(configured, into: &buf)
case let .modeChosen(mode):
- writeInt(&buf, Int32(8))
+ writeInt(&buf, Int32(11))
FfiConverterTypeAppOnboardingMode.write(mode, into: &buf)
case let .driveChecked(os,status):
- writeInt(&buf, Int32(9))
+ writeInt(&buf, Int32(12))
FfiConverterTypeAppSpaceOs.write(os, into: &buf)
FfiConverterOptionTypeAppDriveMountInput.write(status, into: &buf)
case let .driveToggled(on):
- writeInt(&buf, Int32(10))
+ writeInt(&buf, Int32(13))
FfiConverterBool.write(on, into: &buf)
case .driveContinue:
- writeInt(&buf, Int32(11))
+ writeInt(&buf, Int32(14))
case let .driveMounted(status):
- writeInt(&buf, Int32(12))
+ writeInt(&buf, Int32(15))
FfiConverterTypeAppDriveMountInput.write(status, into: &buf)
case let .driveFailed(error):
- writeInt(&buf, Int32(13))
+ writeInt(&buf, Int32(16))
FfiConverterString.write(error, into: &buf)
case let .driveStorageLoaded(storage,home):
- writeInt(&buf, Int32(14))
+ writeInt(&buf, Int32(17))
FfiConverterTypeAppDriveStorageInput.write(storage, into: &buf)
FfiConverterOptionString.write(home, into: &buf)
case let .storageChosen(choice):
- writeInt(&buf, Int32(15))
+ writeInt(&buf, Int32(18))
FfiConverterTypeAppStorageChoice.write(choice, into: &buf)
case let .driveStorage(action):
- writeInt(&buf, Int32(16))
+ writeInt(&buf, Int32(19))
FfiConverterTypeAppStorageAction.write(action, into: &buf)
case let .driveStorageSaved(check):
- writeInt(&buf, Int32(17))
+ writeInt(&buf, Int32(20))
FfiConverterTypeAppDriveCheckInput.write(check, into: &buf)
case let .launchAtLoginToggled(on):
- writeInt(&buf, Int32(18))
+ writeInt(&buf, Int32(21))
FfiConverterBool.write(on, into: &buf)
case .back:
- writeInt(&buf, Int32(19))
+ writeInt(&buf, Int32(22))
case let .telemetryLoaded(telemetry):
- writeInt(&buf, Int32(20))
+ writeInt(&buf, Int32(23))
FfiConverterTypeAppTelemetryInput.write(telemetry, into: &buf)
case .welcomeShown:
- writeInt(&buf, Int32(21))
+ writeInt(&buf, Int32(24))
case let .usageDataToggled(on):
- writeInt(&buf, Int32(22))
+ writeInt(&buf, Int32(25))
FfiConverterBool.write(on, into: &buf)
case let .experimentsLoaded(experiments):
- writeInt(&buf, Int32(23))
+ writeInt(&buf, Int32(26))
FfiConverterTypeAppExperiments.write(experiments, into: &buf)
}
@@ -47569,6 +47647,10 @@ public enum AppOnboardingStep: Equatable, Hashable {
* Welcome.
*/
case welcome
+ /**
+ * Install the bundled `cua`, while its plan needs it.
+ */
+ case cli
/**
* Sign in to Cua.
*/
@@ -47618,17 +47700,19 @@ public struct FfiConverterTypeAppOnboardingStep: FfiConverterRustBuffer {
case 1: return .welcome
- case 2: return .signin
+ case 2: return .cli
- case 3: return .agents
+ case 3: return .signin
- case 4: return .presentation
+ case 4: return .agents
- case 5: return .drive
+ case 5: return .presentation
- case 6: return .mode
+ case 6: return .drive
- case 7: return .done
+ case 7: return .mode
+
+ case 8: return .done
default: throw UniffiInternalError.unexpectedEnumCase
}
@@ -47642,29 +47726,33 @@ public struct FfiConverterTypeAppOnboardingStep: FfiConverterRustBuffer {
writeInt(&buf, Int32(1))
- case .signin:
+ case .cli:
writeInt(&buf, Int32(2))
- case .agents:
+ case .signin:
writeInt(&buf, Int32(3))
- case .presentation:
+ case .agents:
writeInt(&buf, Int32(4))
- case .drive:
+ case .presentation:
writeInt(&buf, Int32(5))
- case .mode:
+ case .drive:
writeInt(&buf, Int32(6))
- case .done:
+ case .mode:
writeInt(&buf, Int32(7))
+
+ case .done:
+ writeInt(&buf, Int32(8))
+
}
}
}
@@ -56003,6 +56091,30 @@ fileprivate struct FfiConverterOptionTypeAppCatalogEntry: FfiConverterRustBuffer
}
}
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+fileprivate struct FfiConverterOptionTypeAppCliInstallPlan: FfiConverterRustBuffer {
+ typealias SwiftType = AppCliInstallPlan?
+
+ public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
+ guard let value = value else {
+ writeInt(&buf, Int8(0))
+ return
+ }
+ writeInt(&buf, Int8(1))
+ FfiConverterTypeAppCliInstallPlan.write(value, into: &buf)
+ }
+
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
+ switch try readInt(&buf) as Int8 {
+ case 0: return nil
+ case 1: return try FfiConverterTypeAppCliInstallPlan.read(from: &buf)
+ default: throw UniffiInternalError.unexpectedOptionalTag
+ }
+ }
+}
+
#if swift(>=5.8)
@_documentation(visibility: private)
#endif