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.

feat(spaces): each computer's issues on the Machines page from its own health checks, cua doctor --machine (CUA-1820) (#5379)

ddupont904436adc454
diff --git a/apps/cua-spaces-desktop/src/bridge/machines.ts b/apps/cua-spaces-desktop/src/bridge/machines.ts
index 60d6b37383..fbf9cf0d23 100644
--- a/apps/cua-spaces-desktop/src/bridge/machines.ts
+++ b/apps/cua-spaces-desktop/src/bridge/machines.ts
@@ -6,9 +6,12 @@
// machine row and sections, the account's devices, who the relay sees
// connected, and the host's state with its relay machine id.
import type { AppModel } from "../model/app-model";
+import { computerName, DevicesUnavailable } from "../model/devices";
+import { words } from "../model/errors";
+import { withTimeout } from "../model/time";
+import { optionalString, string } from "./args";
import type { BridgeContext } from "./context";
-import type { Handlers } from "./host";
-import { computerName } from "../model/devices";
+import { Failure, type Handlers } from "./host";
import { encode } from "./value";
/** This machine as a host (the core's flattened `HostStatus`), plus its relay machine id and setup progress; null until it answered. */
@@ -46,9 +49,62 @@ export function machinesState(model: AppModel) {
// The page's rows as the core lists them (`machines::page_rows`), the
// same the SwiftUI Machines page shows.
rows: encode(model.machinePageRows),
+ // The page as the core draws it (`machines_view::view`), the same the
+ // SwiftUI Machines page draws.
+ view: encode(model.machinesView),
};
}
+/** The relay's calls need the session's `Devices`; its refusals in the bridge's words. */
+async function relayCall<T>(model: AppModel, call: () => Promise<T>): Promise<T> {
+ if (!model.devices.devices()) throw Failure.unsupported("Machines need a signed-in Cua account");
+ try {
+ return await call();
+ } catch (error) {
+ if (error instanceof DevicesUnavailable) throw Failure.unsupported(error.message);
+ if (error instanceof RangeError) throw Failure.badArgs(error.message);
+ throw error;
+ }
+}
+
+/** How long one machine may take to answer its health check. */
+const HEALTH_SECONDS = 35;
+/** Machines asked at once. */
+const HEALTH_AT_ONCE = 3;
+
+/**
+ * `machines.checkHealth`: asks each machine the core's view names a
+ * `healthTarget` for (This Mac through its daemon, another of yours over
+ * the relay or mesh) and keeps the answers for the view. A machine that is
+ * no longer a target (offline, removed) loses its old answer, so no stale
+ * check shows as current.
+ */
+export async function checkMachinesHealth(model: AppModel): Promise<void> {
+ const targets = model.machinesView.machines.filter((m) => m.healthTarget !== undefined && m.healthTarget !== null);
+ const wanted = new Set(targets.map((m) => m.id));
+ for (const id of [...model.machineHealth.keys()]) if (!wanted.has(id)) model.machineHealth.delete(id);
+ const queue = [...targets];
+ const worker = async () => {
+ for (let m = queue.shift(); m; m = queue.shift()) {
+ const target = m.healthTarget ? m.healthTarget : null;
+ const o = await withTimeout(HEALTH_SECONDS, () => model.backend.machineHealth(target));
+ model.machineHealth.set(
+ m.id,
+ o.ok
+ ? {
+ id: m.id,
+ cuaVersion: o.value.cuaVersion,
+ checks: o.value.checks.map((c) => ({ id: c.id, status: c.status, message: c.message, remediation: c.remediation, facts: c.facts })),
+ error: undefined,
+ }
+ : { id: m.id, cuaVersion: "", checks: [], error: words(o.error) },
+ );
+ }
+ };
+ await Promise.all(Array.from({ length: Math.min(HEALTH_AT_ONCE, queue.length) }, worker));
+ model.changed("machines");
+}
+
export function machinesMethods({ model }: BridgeContext): Handlers {
return {
"machines.list": async () => {
@@ -57,6 +113,33 @@ export function machinesMethods({ model }: BridgeContext): Handlers {
if (model.servicesIn) await model.devices.refreshIfStale();
return machinesState(model);
},
+ // Renames one of your machines on the relay; `this-mac` is this
+ // machine's own registration (its host setup takes the name too).
+ "machines.rename": async (args) => {
+ const id = string(args, "id");
+ const name = string(args, "name");
+ const machineId = id === "this-mac" ? model.host.machineId : id;
+ if (!machineId) throw Failure.badArgs("this machine is not on the relay");
+ await relayCall(model, () => model.devices.renameMachine(machineId, name));
+ if (id === "this-mac") await model.host.refresh();
+ return null;
+ },
+ // Remove from account: the machine leaves the relay directory, then
+ // the device on it is revoked; the Spaces and machines are read again.
+ "machines.remove": async (args) => {
+ const machine = optionalString(args, "machine");
+ const device = optionalString(args, "device");
+ if (!machine && !device) throw Failure.badArgs("machine or device");
+ if (machine) await relayCall(model, () => model.backend.relayUnregister(machine));
+ if (device) await relayCall(model, () => model.devices.revoke(device));
+ else await model.devices.refresh();
+ await model.refresh();
+ return null;
+ },
+ "machines.checkHealth": async () => {
+ if (model.servicesIn) await checkMachinesHealth(model);
+ return null;
+ },
"host.status": async () => {
if (model.host.state === null && model.servicesIn) await model.host.refresh();
return hostStatus(model);
diff --git a/apps/cua-spaces-desktop/src/bridge/methods.ts b/apps/cua-spaces-desktop/src/bridge/methods.ts
index 120504e171..cfcc9ec0da 100644
--- a/apps/cua-spaces-desktop/src/bridge/methods.ts
+++ b/apps/cua-spaces-desktop/src/bridge/methods.ts
@@ -47,6 +47,7 @@ export const METHODS = [
"relay.usage",
"nudges.pending", "nudges.answer",
"resources.get",
+ "machines.rename", "machines.remove", "machines.checkHealth",
"checklist.get", "checklist.send",
] as const;
diff --git a/apps/cua-spaces-desktop/src/model/app-model.ts b/apps/cua-spaces-desktop/src/model/app-model.ts
index 1b3a9c70ba..483164ebb0 100644
--- a/apps/cua-spaces-desktop/src/model/app-model.ts
+++ b/apps/cua-spaces-desktop/src/model/app-model.ts
@@ -17,6 +17,10 @@ import type {
AppCloudPricing,
AppLocalStorage,
AppMachinePageRow,
+ AppMachinesPageInput,
+ AppMachinesView,
+ AppMachinesViewAbout,
+ AppMachinesViewHealth,
AppMainChrome,
AppRosterAction,
AppRosterState,
@@ -84,6 +88,8 @@ export interface AppModelDeps {
windowsRuntime?: WindowsRuntime | null;
/** Linux: restarts the app under the docker group when a new install needs it (null elsewhere). */
linuxRuntime?: LinuxRuntime | null;
+ /** This computer's name, the app's version and the system's (This machine's Details on the Machines page). */
+ about?: () => AppMachinesViewAbout;
}
/** The create the daemon never took. */
@@ -116,6 +122,8 @@ export class AppModel {
readonly checklist: ChecklistModel;
/** Agent runs seen in any Space (the page's Agents page): "Run an agent". */
agentRunsSeen = 0;
+ /** This computer, for This machine's Details (`AppModelDeps.about`). */
+ readonly about: (() => AppMachinesViewAbout) | undefined;
readonly hostOs: AppSpaceOs;
readonly settingsPath: string;
settings: AppSettings;
@@ -219,6 +227,7 @@ export class AppModel {
};
this.keyvault = d.keyvault ?? new KeyvaultModel(d.native, null);
this.hostOs = d.hostOs ?? d.native.AppSpaceOs.Macos;
+ this.about = d.about;
this.checklist = new ChecklistModel(d.native, d.checklistPath ?? null, d.checklistSeedPath ?? null);
this.checklist.telemetry = d.telemetry;
this.checklist.onChange = () => this.changed("checklist");
@@ -296,8 +305,8 @@ export class AppModel {
return out;
}
- /** The Machines page's rows (the core's `machines::page_rows`, as the SwiftUI app lists them). */
- get machinePageRows(): AppMachinePageRow[] {
+ /** What the Machines page is listed from (`machines::MachinesPageInput`), the same for its rows and its view. */
+ get machinesPageInput(): AppMachinesPageInput {
const devices = this.devices.snapshot === null ? [] : this.devices.input.devices.map((d) => ({
id: d.id,
name: d.name,
@@ -306,13 +315,46 @@ export class AppModel {
current: d.current,
state: d.state,
}));
- return this.native.appMachinesPageRows({
+ return {
hostOs: this.hostOs,
spaces: this.spaces,
devices,
hostnames: new Map(Object.entries(this.relayHostnames)),
presence: new Map(Object.entries(this.devices.relayOnline)),
now: BigInt(Math.floor(Date.now() / 1000)),
+ };
+ }
+
+ /** The Machines page's rows (the core's `machines::page_rows`, as the SwiftUI app lists them). */
+ get machinePageRows(): AppMachinePageRow[] {
+ return this.native.appMachinesPageRows(this.machinesPageInput);
+ }
+
+ /**
+ * The Machines page as every UI draws it (the core's `machines_view::view`,
+ * as the SwiftUI page draws it): the rows in groups with one line each,
+ * and each machine's page, from the rows, what the relay says of each
+ * machine (whose it is, its team, whether it provides Spaces), This
+ * machine's host state and this computer.
+ */
+ /** What each machine's daemon last said of its health, by row id (`machines.checkHealth`). */
+ readonly machineHealth = new Map<string, AppMachinesViewHealth>();
+
+ get machinesView(): AppMachinesView {
+ const relay = (this.devices.snapshot?.machines ?? []).map((m) => ({
+ id: m.id,
+ role: m.role,
+ team: m.team,
+ ownerEmail: m.ownerEmail,
+ providesSpaces: m.providesSpaces,
+ }));
+ return this.native.appMachinesView({
+ page: this.machinesPageInput,
+ relay,
+ host: this.host.state ?? undefined,
+ about: this.about?.() ?? { computerName: "", appVersion: "", osVersion: "" },
+ rows: undefined,
+ health: [...this.machineHealth.values()],
});
}
diff --git a/apps/cua-spaces-desktop/src/model/backend.ts b/apps/cua-spaces-desktop/src/model/backend.ts
index 1cbf9db293..101d50b712 100644
--- a/apps/cua-spaces-desktop/src/model/backend.ts
+++ b/apps/cua-spaces-desktop/src/model/backend.ts
@@ -54,6 +54,10 @@ export interface SpacesBackend {
reportedHostname(id: string): string | null;
add(url: string, token: string | null, name: string | null): Promise<void>;
remove(id: string, removeOnly: boolean): Promise<void>;
+ /** Takes one of your machines off the relay directory (`relay:<machine>`), refused while it is online. */
+ relayUnregister(machineId: string): Promise<void>;
+ /** A machine's health as its own cua daemon checks it (the SDK's `Spaces.machine_health`): null for this one, else another of yours by id. */
+ machineHealth(machine: string | null): Promise<MachineHealthReport>;
setPower(id: string, on: boolean): Promise<void>;
localRuntimes(): Promise<LocalRuntimes | null>;
lumeSource(): Promise<string | null>;
@@ -93,6 +97,12 @@ export interface SpacesBackend {
appIcons(id: string, requests: SpaceAppIconRequest[]): Promise<(Uint8Array | null)[]>;
}
+/** A machine's health as its daemon reported it (the SDK's `MachineHealth`, the parts the Machines page reads). */
+export interface MachineHealthReport {
+ cuaVersion: string;
+ checks: { id: string; status: string; message: string; remediation: string; facts: Map<string, string> }[];
+}
+
/** A Space's thumbnail as the SDK returns it: the encoded image (PNG or JPEG), its size and when it was captured. */
export interface SpaceThumbnailData {
image: Uint8Array;
@@ -331,6 +341,18 @@ export class LiveSpacesBackend implements SpacesBackend {
else await this.cua.spaces().delete_(id);
}
+ async relayUnregister(machineId: string): Promise<void> {
+ await this.cua.spaces().relayUnregister(`relay:${machineId}`);
+ }
+
+ async machineHealth(machine: string | null): Promise<MachineHealthReport> {
+ const h = await this.cua.spaces().machineHealth(machine ?? undefined);
+ return {
+ cuaVersion: h.cuaVersion,
+ checks: h.checks.map((c) => ({ id: c.id, status: c.status, message: c.message, remediation: c.remediation, facts: new Map(c.facts) })),
+ };
+ }
+
async setPower(id: string, on: boolean): Promise<void> {
if (on) await this.cua.spaces().start(id);
else await this.cua.spaces().stop(id);
diff --git a/apps/cua-spaces-desktop/src/model/devices.ts b/apps/cua-spaces-desktop/src/model/devices.ts
index acce1ec511..17e6fdc734 100644
--- a/apps/cua-spaces-desktop/src/model/devices.ts
+++ b/apps/cua-spaces-desktop/src/model/devices.ts
@@ -169,6 +169,14 @@ export class DevicesModel {
await this.refresh();
}
+ /** Renames one of your machines on the relay (this machine's host setup takes the name too). */
+ async renameMachine(machineId: string, name: string): Promise<void> {
+ const clean = this.native.appDevicesCleanName(name);
+ if (!clean) throw new RangeError("name");
+ await this.relay().renameMachine(machineId, clean);
+ await this.refresh();
+ }
+
async revoke(id: string): Promise<void> {
await this.relay().revoke(id);
await this.refresh();
diff --git a/apps/cua-spaces-desktop/src/model/environment.ts b/apps/cua-spaces-desktop/src/model/environment.ts
index b52d3f26ea..4ebdd6c695 100644
--- a/apps/cua-spaces-desktop/src/model/environment.ts
+++ b/apps/cua-spaces-desktop/src/model/environment.ts
@@ -14,7 +14,7 @@ import * as path from "node:path";
import type { Native } from "../native/load";
import { appCoreStatePaths, swiftSupportDir } from "../migrate-swift";
import { nativeFiles } from "../native/location";
-import type { CuaLike } from "../native/generated/index";
+import type { AppMachinesViewAbout, CuaLike } from "../native/generated/index";
import { PendingAgentSetup, LiveAgentSetup } from "./agents";
import { AppModel } from "./app-model";
import { LiveSpacesBackend } from "./backend";
@@ -31,6 +31,7 @@ import { BundledCuaKeychain, StartupModel } from "./startup";
import { withTimeout } from "./time";
import { LinuxRuntime, nodeLinuxSystem, type RelaunchSpec } from "./linux-runtime";
import { WindowsRuntime, nodeWindowsSystem } from "./windows-runtime";
+import { osLine } from "./updates";
/** Whether the first run finished (`onboarding.json`'s `completed`); null when unknown. */
export function readOnboardingCompleted(file: string): boolean | null {
@@ -133,6 +134,7 @@ export function makeModel(o: EnvironmentOptions): Environment {
hostOs: platform === "win32" ? native.AppSpaceOs.Windows : platform === "linux" ? native.AppSpaceOs.Linux : native.AppSpaceOs.Macos,
windowsRuntime: platform === "win32" ? new WindowsRuntime(nodeWindowsSystem(), path.join(os.tmpdir(), "cua-spaces")) : null,
linuxRuntime: platform === "linux" && o.relaunch ? new LinuxRuntime(nodeLinuxSystem(o.relaunch, env), env) : null,
+ about: thisComputer(o.version, platform),
});
// Signed out is null (setup signs in first); anything else is the error itself.
@@ -306,3 +308,18 @@ export async function installCliSilently(native: Native, cua: string, platform:
console.warn(`[cua-spaces] could not install the cua command: ${words(error)}`);
}
}
+
+/** This computer as the Machines page's Details names it: its name, the
+ * app's version and its system ("macOS 26.5.2"), read once. */
+export function thisComputer(version: string, platform: NodeJS.Platform = process.platform): () => AppMachinesViewAbout {
+ let about: AppMachinesViewAbout | null = null;
+ return () => {
+ about ??= {
+ computerName: computerName(platform),
+ appVersion: version,
+ // Electron's own read of the system version (`26.5.2`); the Darwin release otherwise.
+ osVersion: osLine(platform, os.release(), process.arch, (process as { getSystemVersion?: () => string }).getSystemVersion?.()).replace(/ \([^)]*\)$/, ""),
+ };
+ return about;
+ };
+}
diff --git a/apps/cua-spaces-desktop/src/model/pending.ts b/apps/cua-spaces-desktop/src/model/pending.ts
index 44a7cdd4d4..22cbb8d8ac 100644
--- a/apps/cua-spaces-desktop/src/model/pending.ts
+++ b/apps/cua-spaces-desktop/src/model/pending.ts
@@ -99,6 +99,8 @@ export class PendingSpacesBackend implements SpacesBackend {
reportedHostname = (id: string) => this.current?.reportedHostname(id) ?? null;
add = async (url: string, token: string | null, name: string | null) => (await this.b()).add(url, token, name);
remove = async (id: string, removeOnly: boolean) => (await this.b()).remove(id, removeOnly);
+ relayUnregister = async (machineId: string) => (await this.b()).relayUnregister(machineId);
+ machineHealth = async (machine: string | null) => (await this.b()).machineHealth(machine);
setPower = async (id: string, on: boolean) => (await this.b()).setPower(id, on);
localRuntimes = async () => (await this.b()).localRuntimes();
lumeSource = async () => (await this.b()).lumeSource();
diff --git a/apps/cua-spaces-desktop/src/native/generated/cua_sdk-ffi.ts b/apps/cua-spaces-desktop/src/native/generated/cua_sdk-ffi.ts
index 7678602066..9f81e0a46c 100644
--- a/apps/cua-spaces-desktop/src/native/generated/cua_sdk-ffi.ts
+++ b/apps/cua-spaces-desktop/src/native/generated/cua_sdk-ffi.ts
@@ -1174,6 +1174,11 @@ const DEFINITIONS = {
ret: FfiType.Handle,
hasRustCallStatus: false,
},
+ "uniffi_cua_sdk_fn_method_devices_rename_machine": {
+ args: [FfiType.Handle, FfiType.RustBuffer, FfiType.RustBuffer],
+ ret: FfiType.Handle,
+ hasRustCallStatus: false,
+ },
"uniffi_cua_sdk_fn_method_devices_revoke": {
args: [FfiType.Handle, FfiType.RustBuffer],
ret: FfiType.Handle,
@@ -2179,6 +2184,11 @@ const DEFINITIONS = {
ret: FfiType.Handle,
hasRustCallStatus: false,
},
+ "uniffi_cua_sdk_fn_method_spaces_machine_health": {
+ args: [FfiType.Handle, FfiType.RustBuffer],
+ ret: FfiType.Handle,
+ hasRustCallStatus: false,
+ },
"uniffi_cua_sdk_fn_method_spaces_notifications": {
args: [FfiType.Handle, FfiType.Int8, FfiType.RustBuffer],
ret: FfiType.Handle,
@@ -3254,6 +3264,11 @@ const DEFINITIONS = {
ret: FfiType.UInt16,
hasRustCallStatus: false,
},
+ "uniffi_cua_sdk_checksum_method_devices_rename_machine": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
"uniffi_cua_sdk_checksum_method_devices_revoke": {
args: [],
ret: FfiType.UInt16,
@@ -4259,6 +4274,11 @@ const DEFINITIONS = {
ret: FfiType.UInt16,
hasRustCallStatus: false,
},
+ "uniffi_cua_sdk_checksum_method_spaces_machine_health": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
"uniffi_cua_sdk_checksum_method_spaces_notifications": {
args: [],
ret: FfiType.UInt16,
@@ -5122,6 +5142,7 @@ interface NativeModuleInterface {
uniffi_cua_sdk_fn_method_devices_pairing_codes(uniffiSelf: bigint): bigint;
uniffi_cua_sdk_fn_method_devices_relay_url(uniffiSelf: bigint, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
uniffi_cua_sdk_fn_method_devices_rename(uniffiSelf: bigint, id: Uint8Array, name: Uint8Array): bigint;
+ uniffi_cua_sdk_fn_method_devices_rename_machine(uniffiSelf: bigint, machineId: Uint8Array, name: Uint8Array): bigint;
uniffi_cua_sdk_fn_method_devices_revoke(uniffiSelf: bigint, id: Uint8Array): bigint;
uniffi_cua_sdk_fn_method_devices_revoke_pairing_code(uniffiSelf: bigint, id: Uint8Array): bigint;
uniffi_cua_sdk_fn_method_devices_snapshot(uniffiSelf: bigint, auditLimit: number): bigint;
@@ -5323,6 +5344,7 @@ interface NativeModuleInterface {
uniffi_cua_sdk_fn_method_spaces_hosts(uniffiSelf: bigint): bigint;
uniffi_cua_sdk_fn_method_spaces_list(uniffiSelf: bigint): bigint;
uniffi_cua_sdk_fn_method_spaces_list_tools_json(uniffiSelf: bigint): bigint;
+ uniffi_cua_sdk_fn_method_spaces_machine_health(uniffiSelf: bigint, machine: Uint8Array): bigint;
uniffi_cua_sdk_fn_method_spaces_notifications(uniffiSelf: bigint, unreadOnly: number, sinceMs: Uint8Array): bigint;
uniffi_cua_sdk_fn_method_spaces_notifications_ack(uniffiSelf: bigint, ids: Uint8Array): bigint;
uniffi_cua_sdk_fn_method_spaces_notify_user(uniffiSelf: bigint, title: Uint8Array, body: Uint8Array, agent: Uint8Array): bigint;
@@ -5538,6 +5560,7 @@ interface NativeModuleInterface {
uniffi_cua_sdk_checksum_method_devices_pairing_codes(): number;
uniffi_cua_sdk_checksum_method_devices_relay_url(): number;
uniffi_cua_sdk_checksum_method_devices_rename(): number;
+ uniffi_cua_sdk_checksum_method_devices_rename_machine(): number;
uniffi_cua_sdk_checksum_method_devices_revoke(): number;
uniffi_cua_sdk_checksum_method_devices_revoke_pairing_code(): number;
uniffi_cua_sdk_checksum_method_devices_snapshot(): number;
@@ -5739,6 +5762,7 @@ interface NativeModuleInterface {
uniffi_cua_sdk_checksum_method_spaces_hosts(): number;
uniffi_cua_sdk_checksum_method_spaces_list(): number;
uniffi_cua_sdk_checksum_method_spaces_list_tools_json(): number;
+ uniffi_cua_sdk_checksum_method_spaces_machine_health(): number;
uniffi_cua_sdk_checksum_method_spaces_notifications(): number;
uniffi_cua_sdk_checksum_method_spaces_notifications_ack(): number;
uniffi_cua_sdk_checksum_method_spaces_notify_user(): number;
diff --git a/apps/cua-spaces-desktop/src/native/generated/cua_sdk.ts b/apps/cua-spaces-desktop/src/native/generated/cua_sdk.ts
index 34b343c869..fd931ab981 100644
--- a/apps/cua-spaces-desktop/src/native/generated/cua_sdk.ts
+++ b/apps/cua-spaces-desktop/src/native/generated/cua_sdk.ts
@@ -5059,7 +5059,17 @@ export type RelayMachine = {
* check existed. `false` shows the machine as "new" until an enrolled
* device confirms it ([`Devices::confirm_machine`]) (S5).
*/
- confirmed: boolean
+ confirmed: boolean,
+ /**
+ * The team you reach it through, for a team machine not shared with
+ * you directly.
+ */
+ team?: string,
+ /**
+ * It creates Spaces for its owner's devices, when it said so at
+ * registration (`None` from a host or relay that predates it).
+ */
+ providesSpaces?: boolean
}
/**
@@ -5095,7 +5105,9 @@ const FfiConverterTypeRelayMachine = (() => {
url: FfiConverterString.read(from),
allow: FfiConverterSequenceString.read(from),
clients: FfiConverterSequenceTypeRelayClientInfo.read(from),
- confirmed: FfiConverterBool.read(from)
+ confirmed: FfiConverterBool.read(from),
+ team: FfiConverterOptionalString.read(from),
+ providesSpaces: FfiConverterOptionalBoolean.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
@@ -5112,6 +5124,8 @@ const FfiConverterTypeRelayMachine = (() => {
FfiConverterSequenceString.write(value.allow, into);
FfiConverterSequenceTypeRelayClientInfo.write(value.clients, into);
FfiConverterBool.write(value.confirmed, into);
+ FfiConverterOptionalString.write(value.team, into);
+ FfiConverterOptionalBoolean.write(value.providesSpaces, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.id) +
@@ -5126,7 +5140,9 @@ const FfiConverterTypeRelayMachine = (() => {
FfiConverterString.allocationSize(value.url) +
FfiConverterSequenceString.allocationSize(value.allow) +
FfiConverterSequenceTypeRelayClientInfo.allocationSize(value.clients) +
- FfiConverterBool.allocationSize(value.confirmed);
+ FfiConverterBool.allocationSize(value.confirmed) +
+ FfiConverterOptionalString.allocationSize(value.team) +
+ FfiConverterOptionalBoolean.allocationSize(value.providesSpaces);
}
};
@@ -9056,6 +9072,147 @@ const FfiConverterTypeLocationInfo = (() => {
return new FFIConverter();
})();
+/**
+ * One check of a machine's health ([`Spaces::machine_health`]).
+ */
+export type MachineHealthCheck = {
+ /**
+ * `machine.local_network`, `machine.disk`, `machine.virtualization`,
+ * `machine.memory`, `machine.permissions.<id>`.
+ */
+ id: string,
+ /**
+ * `pass`, `warn`, `fail` or `skip`.
+ */
+ status: string,
+ /**
+ * What it found, in one line.
+ */
+ message: string,
+ /**
+ * What to do about a warning or failure.
+ */
+ remediation: string,
+ /**
+ * What a UI needs to word it and offer its fix (`app`, `settings_url`,
+ * `free_gb`, ...).
+ */
+ facts: Map<string, string>
+}
+
+/**
+ * Generated factory for {@link MachineHealthCheck} record objects.
+ */
+export const MachineHealthCheck = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<MachineHealthCheck, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<MachineHealthCheck>,
+ });
+})();
+
+const FfiConverterTypeMachineHealthCheck = (() => {
+ type TypeName = MachineHealthCheck;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ id: FfiConverterString.read(from),
+ status: FfiConverterString.read(from),
+ message: FfiConverterString.read(from),
+ remediation: FfiConverterString.read(from),
+ facts: FfiConverterMapStringString.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.id, into);
+ FfiConverterString.write(value.status, into);
+ FfiConverterString.write(value.message, into);
+ FfiConverterString.write(value.remediation, into);
+ FfiConverterMapStringString.write(value.facts, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterString.allocationSize(value.id) +
+ FfiConverterString.allocationSize(value.status) +
+ FfiConverterString.allocationSize(value.message) +
+ FfiConverterString.allocationSize(value.remediation) +
+ FfiConverterMapStringString.allocationSize(value.facts);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+/**
+ * A machine's health as its own cua daemon checks it.
+ */
+export type MachineHealth = {
+ /**
+ * The Cua version of the daemon that checked.
+ */
+ cuaVersion: string,
+ /**
+ * `macos`, `linux`, `windows`.
+ */
+ os: string,
+ /**
+ * Every check, in order.
+ */
+ checks: Array<MachineHealthCheck>,
+ /**
+ * The whole report as JSON (the schema `cua doctor --json` writes).
+ */
+ reportJson: string
+}
+
+/**
+ * Generated factory for {@link MachineHealth} record objects.
+ */
+export const MachineHealth = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<MachineHealth, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<MachineHealth>,
+ });
+})();
+
+const FfiConverterTypeMachineHealth = (() => {
+ type TypeName = MachineHealth;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ cuaVersion: FfiConverterString.read(from),
+ os: FfiConverterString.read(from),
+ checks: FfiConverterSequenceTypeMachineHealthCheck.read(from),
+ reportJson: FfiConverterString.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.cuaVersion, into);
+ FfiConverterString.write(value.os, into);
+ FfiConverterSequenceTypeMachineHealthCheck.write(value.checks, into);
+ FfiConverterString.write(value.reportJson, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterString.allocationSize(value.cuaVersion) +
+ FfiConverterString.allocationSize(value.os) +
+ FfiConverterSequenceTypeMachineHealthCheck.allocationSize(value.checks) +
+ FfiConverterString.allocationSize(value.reportJson);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
/**
* Where an MCP endpoint is and what every request needs. Hand it to any
* MCP client (Claude Code, Cursor, the Python or TypeScript SDKs). A
@@ -20258,6 +20415,12 @@ export interface DevicesLike {
* Renames a device (from this enrolled device).
*/
rename(id: string, name: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<RelayDevice>;
+/**
+ * Renames `machine_id`, a machine the account owns, on the relay (from
+ * this enrolled device). When it is this machine's own registration,
+ * its host setup takes the new name too.
+ */
+ renameMachine(machineId: string, name: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<RelayMachine>;
/**
* Revokes a device (from this enrolled device). Revoking this device
* also deletes its key.
@@ -20597,6 +20760,43 @@ private constructor(pointer: UniffiHandle) {
}
}
+/**
+ * Renames `machine_id`, a machine the account owns, on the relay (from
+ * this enrolled device). When it is this machine's own registration,
+ * its host setup takes the new name too.
+ */
+ async renameMachine(machineId: string, name: string, asyncOpts_?: { signal: AbortSignal }): Promise<RelayMachine> /*throws*/ {
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
+ try {
+ return await uniffiRustCallAsync(
+ /*rustCaller:*/ uniffiCaller,
+ /*rustFutureFunc:*/ () => {
+ return nativeModule().uniffi_cua_sdk_fn_method_devices_rename_machine(
+ uniffiTypeDevicesObjectFactory.clonePointer(this),FfiConverterString.lower(machineId, nativeModule().rustbuffer_alloc),FfiConverterString.lower(name, nativeModule().rustbuffer_alloc)
+ );
+ },
+ /*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
+ /*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
+ /*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
+ /*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
+ // Async returns always go through the JS-side converter: the
+ // FFI symbol returns the future handle (u64), and the user-level
+ // RustBuffer comes back via the shared `rust_future_complete_*`
+ // export. The bytes the runtime hands back must be deserialized
+ // here using the per-callable return-type converter.
+ /*liftFunc:*/ FfiConverterTypeRelayMachine.lift.bind(FfiConverterTypeRelayMachine),
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ /*asyncOpts:*/ asyncOpts_,
+ /*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
+ );
+ } catch (__error: any) {
+ if (uniffiIsDebug && __error instanceof Error) {
+ __error.stack = __stack;
+ }
+ throw __error;
+ }
+ }
+
/**
* Revokes a device (from this enrolled device). Revoking this device
* also deletes its key.
@@ -30780,6 +30980,16 @@ export interface SpacesLike {
* The Spaces MCP `tools/list` result as JSON (the contract).
*/
listToolsJson(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
+/**
+ * A machine's health as its own cua daemon checks it: Local Network
+ * access (and which app macOS holds responsible), free disk,
+ * virtualization, memory left by running Spaces, the permissions
+ * sharing its desktop needs. `machine`: another of your machines, by
+ * id or name (asked over the relay, the mesh or its direct address);
+ * `None` for this one. Read-only; fails plainly when that machine is
+ * offline, not yours, or runs a Cua that predates the check.
+ */
+ machineHealth(machine: string | undefined, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<MachineHealth>;
/**
* The notifications feed, newest first.
*/
@@ -31825,6 +32035,47 @@ private constructor(pointer: UniffiHandle) {
}
}
+/**
+ * A machine's health as its own cua daemon checks it: Local Network
+ * access (and which app macOS holds responsible), free disk,
+ * virtualization, memory left by running Spaces, the permissions
+ * sharing its desktop needs. `machine`: another of your machines, by
+ * id or name (asked over the relay, the mesh or its direct address);
+ * `None` for this one. Read-only; fails plainly when that machine is
+ * offline, not yours, or runs a Cua that predates the check.
+ */
+ async machineHealth(machine: string | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<MachineHealth> /*throws*/ {
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
+ try {
+ return await uniffiRustCallAsync(
+ /*rustCaller:*/ uniffiCaller,
+ /*rustFutureFunc:*/ () => {
+ return nativeModule().uniffi_cua_sdk_fn_method_spaces_machine_health(
+ uniffiTypeSpacesObjectFactory.clonePointer(this),FfiConverterOptionalString.lower(machine, nativeModule().rustbuffer_alloc)
+ );
+ },
+ /*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
+ /*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
+ /*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
+ /*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
+ // Async returns always go through the JS-side converter: the
+ // FFI symbol returns the future handle (u64), and the user-level
+ // RustBuffer comes back via the shared `rust_future_complete_*`
+ // export. The bytes the runtime hands back must be deserialized
+ // here using the per-callable return-type converter.
+ /*liftFunc:*/ FfiConverterTypeMachineHealth.lift.bind(FfiConverterTypeMachineHealth),
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ /*asyncOpts:*/ asyncOpts_,
+ /*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
+ );
+ } catch (__error: any) {
+ if (uniffiIsDebug && __error instanceof Error) {
+ __error.stack = __stack;
+ }
+ throw __error;
+ }
+ }
+
/**
* The notifications feed, newest first.
*/
@@ -34840,6 +35091,9 @@ const FfiConverterOptionalTypeStorageVolume = new FfiConverterOptional(FfiConver
// FfiConverter for Map<string, Array<string>>
const FfiConverterMapStringSequenceString = new FfiConverterMap(FfiConverterString, FfiConverterSequenceString);
+// FfiConverter for Array<MachineHealthCheck>
+const FfiConverterSequenceTypeMachineHealthCheck = new FfiConverterArray(FfiConverterTypeMachineHealthCheck);
+
// FfiConverter for PresenceParticipant | undefined
const FfiConverterOptionalTypePresenceParticipant = new FfiConverterOptional(FfiConverterTypePresenceParticipant);
@@ -35435,6 +35689,9 @@ function uniffiEnsureInitialized() {
if (nativeModule().uniffi_cua_sdk_checksum_method_devices_rename() !== 59535) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_devices_rename");
}
+ if (nativeModule().uniffi_cua_sdk_checksum_method_devices_rename_machine() !== 63088) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_devices_rename_machine");
+ }
if (nativeModule().uniffi_cua_sdk_checksum_method_devices_revoke() !== 27802) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_devices_revoke");
}
@@ -36038,6 +36295,9 @@ function uniffiEnsureInitialized() {
if (nativeModule().uniffi_cua_sdk_checksum_method_spaces_list_tools_json() !== 19259) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spaces_list_tools_json");
}
+ if (nativeModule().uniffi_cua_sdk_checksum_method_spaces_machine_health() !== 35352) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spaces_machine_health");
+ }
if (nativeModule().uniffi_cua_sdk_checksum_method_spaces_notifications() !== 10964) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spaces_notifications");
}
@@ -36461,6 +36721,8 @@ export default Object.freeze({
FfiConverterTypeLocationInfo,
FfiConverterTypeLoginAttempt,
FfiConverterTypeLoginMethod,
+ FfiConverterTypeMachineHealth,
+ FfiConverterTypeMachineHealthCheck,
FfiConverterTypeMcpClient,
FfiConverterTypeMcpConfig,
FfiConverterTypeMediaBridge,
diff --git a/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi-ffi.ts b/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi-ffi.ts
index 0590a693db..bb760be45f 100644
--- a/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi-ffi.ts
+++ b/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi-ffi.ts
@@ -987,6 +987,16 @@ const DEFINITIONS = {
ret: FfiType.RustBuffer,
hasRustCallStatus: true,
},
+ "uniffi_cua_spaces_ffi_fn_func_app_machines_view": {
+ args: [FfiType.RustBuffer],
+ ret: FfiType.RustBuffer,
+ hasRustCallStatus: true,
+ },
+ "uniffi_cua_spaces_ffi_fn_func_app_machines_view_input_from_json": {
+ args: [FfiType.RustBuffer],
+ ret: FfiType.RustBuffer,
+ hasRustCallStatus: true,
+ },
"uniffi_cua_spaces_ffi_fn_func_app_main_chrome": {
args: [FfiType.RustBuffer],
ret: FfiType.RustBuffer,
@@ -2732,6 +2742,16 @@ const DEFINITIONS = {
ret: FfiType.UInt16,
hasRustCallStatus: false,
},
+ "uniffi_cua_spaces_ffi_checksum_func_app_machines_view": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
+ "uniffi_cua_spaces_ffi_checksum_func_app_machines_view_input_from_json": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
"uniffi_cua_spaces_ffi_checksum_func_app_main_chrome": {
args: [],
ret: FfiType.UInt16,
@@ -4193,6 +4213,8 @@ interface NativeModuleInterface {
uniffi_cua_spaces_ffi_fn_func_app_machine_access_notice(kind: Uint8Array, pendingCode: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
uniffi_cua_spaces_ffi_fn_func_app_machines_page_input_from_json(json: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
uniffi_cua_spaces_ffi_fn_func_app_machines_page_rows(input: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
+ uniffi_cua_spaces_ffi_fn_func_app_machines_view(input: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
+ uniffi_cua_spaces_ffi_fn_func_app_machines_view_input_from_json(json: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
uniffi_cua_spaces_ffi_fn_func_app_main_chrome(input: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
uniffi_cua_spaces_ffi_fn_func_app_menu(input: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
uniffi_cua_spaces_ffi_fn_func_app_menu_bar(spaces: number, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
@@ -4542,6 +4564,8 @@ interface NativeModuleInterface {
uniffi_cua_spaces_ffi_checksum_func_app_machine_access_notice(): number;
uniffi_cua_spaces_ffi_checksum_func_app_machines_page_input_from_json(): number;
uniffi_cua_spaces_ffi_checksum_func_app_machines_page_rows(): number;
+ uniffi_cua_spaces_ffi_checksum_func_app_machines_view(): number;
+ uniffi_cua_spaces_ffi_checksum_func_app_machines_view_input_from_json(): number;
uniffi_cua_spaces_ffi_checksum_func_app_main_chrome(): number;
uniffi_cua_spaces_ffi_checksum_func_app_menu(): number;
uniffi_cua_spaces_ffi_checksum_func_app_menu_bar(): number;
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 c2e4803da5..13dde05469 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
@@ -2536,6 +2536,48 @@ export function appMachinesPageRows(input: AppMachinesPageInput): Array<AppMachi
));
}
+/**
+ * The Machines page as every UI draws it: the list in groups, one line
+ * per row, and each machine's page.
+ */
+export function appMachinesView(input: AppMachinesViewInput): AppMachinesView {
+ return ((__rb: Uint8Array) => {
+ try {
+ return FfiConverterTypeAppMachinesView.lift(__rb);
+ } finally {
+ nativeModule().rustbuffer_free(__rb);
+ }
+ })(uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cua_spaces_ffi_fn_func_app_machines_view(
+ FfiConverterTypeAppMachinesViewInput.lower(input, nativeModule().rustbuffer_alloc),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
+/**
+ * Machines view input from JSON (fixtures, parity flows).
+ */
+export function appMachinesViewInputFromJson(json: string): AppMachinesViewInput /*throws*/ {
+ return ((__rb: Uint8Array) => {
+ try {
+ return FfiConverterTypeAppMachinesViewInput.lift(__rb);
+ } finally {
+ nativeModule().rustbuffer_free(__rb);
+ }
+ })(uniffiCaller.rustCallWithError(
+ /*liftError:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError),
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cua_spaces_ffi_fn_func_app_machines_view_input_from_json(
+ FfiConverterString.lower(json, nativeModule().rustbuffer_alloc),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
/**
* The main window's chrome (account line, New Space, empty state).
*/
@@ -25284,6 +25326,1289 @@ const FfiConverterTypeAppMachinesPageInput = (() => {
return new FFIConverter();
})();
+export type AppMachinesViewRemove = {
+ /**
+ * "Remove from account".
+ */
+ label: string,
+ /**
+ * Can be pressed now.
+ */
+ enabled: boolean,
+ /**
+ * Why not, when it cannot.
+ */
+ help?: string,
+ /**
+ * This machine: its host setup is removed (the host's `remove`).
+ */
+ host: boolean,
+ /**
+ * Another machine: it leaves the relay directory (`relay:<id>`).
+ */
+ machine?: string,
+ /**
+ * The device on it, revoked too.
+ */
+ device?: string,
+ /**
+ * Asked first.
+ */
+ confirm: AppHostConfirm
+}
+
+/**
+ * Generated factory for {@link AppMachinesViewRemove} record objects.
+ */
+export const AppMachinesViewRemove = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<AppMachinesViewRemove, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<AppMachinesViewRemove>,
+ });
+})();
+
+const FfiConverterTypeAppMachinesViewRemove = (() => {
+ type TypeName = AppMachinesViewRemove;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ label: FfiConverterString.read(from),
+ enabled: FfiConverterBool.read(from),
+ help: FfiConverterOptionalString.read(from),
+ host: FfiConverterBool.read(from),
+ machine: FfiConverterOptionalString.read(from),
+ device: FfiConverterOptionalString.read(from),
+ confirm: FfiConverterTypeAppHostConfirm.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.label, into);
+ FfiConverterBool.write(value.enabled, into);
+ FfiConverterOptionalString.write(value.help, into);
+ FfiConverterBool.write(value.host, into);
+ FfiConverterOptionalString.write(value.machine, into);
+ FfiConverterOptionalString.write(value.device, into);
+ FfiConverterTypeAppHostConfirm.write(value.confirm, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterString.allocationSize(value.label) +
+ FfiConverterBool.allocationSize(value.enabled) +
+ FfiConverterOptionalString.allocationSize(value.help) +
+ FfiConverterBool.allocationSize(value.host) +
+ FfiConverterOptionalString.allocationSize(value.machine) +
+ FfiConverterOptionalString.allocationSize(value.device) +
+ FfiConverterTypeAppHostConfirm.allocationSize(value.confirm);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+export type AppMachinesViewRemoveAll = {
+ /**
+ * "Remove old machines".
+ */
+ label: string,
+ /**
+ * Asked first.
+ */
+ confirm: AppHostConfirm,
+ /**
+ * What each removal does.
+ */
+ removes: Array<AppMachinesViewRemove>
+}
+
+/**
+ * Generated factory for {@link AppMachinesViewRemoveAll} record objects.
+ */
+export const AppMachinesViewRemoveAll = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<AppMachinesViewRemoveAll, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<AppMachinesViewRemoveAll>,
+ });
+})();
+
+const FfiConverterTypeAppMachinesViewRemoveAll = (() => {
+ type TypeName = AppMachinesViewRemoveAll;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ label: FfiConverterString.read(from),
+ confirm: FfiConverterTypeAppHostConfirm.read(from),
+ removes: FfiConverterSequenceTypeAppMachinesViewRemove.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.label, into);
+ FfiConverterTypeAppHostConfirm.write(value.confirm, into);
+ FfiConverterSequenceTypeAppMachinesViewRemove.write(value.removes, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterString.allocationSize(value.label) +
+ FfiConverterTypeAppHostConfirm.allocationSize(value.confirm) +
+ FfiConverterSequenceTypeAppMachinesViewRemove.allocationSize(value.removes);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+export type AppMachinesViewGroup = {
+ /**
+ * `yours`, `old` or `team`.
+ */
+ id: string,
+ /**
+ * "Your machines", "Offline for 30+ days (2)", "Team machines".
+ */
+ title: string,
+ /**
+ * Collapsed until opened (the old machines).
+ */
+ collapsed: boolean,
+ /**
+ * Its machines' ids, in order.
+ */
+ ids: Array<string>,
+ /**
+ * Remove old machines.
+ */
+ removeAll?: AppMachinesViewRemoveAll
+}
+
+/**
+ * Generated factory for {@link AppMachinesViewGroup} record objects.
+ */
+export const AppMachinesViewGroup = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<AppMachinesViewGroup, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<AppMachinesViewGroup>,
+ });
+})();
+
+const FfiConverterTypeAppMachinesViewGroup = (() => {
+ type TypeName = AppMachinesViewGroup;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ id: FfiConverterString.read(from),
+ title: FfiConverterString.read(from),
+ collapsed: FfiConverterBool.read(from),
+ ids: FfiConverterSequenceString.read(from),
+ removeAll: FfiConverterOptionalTypeAppMachinesViewRemoveAll.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.id, into);
+ FfiConverterString.write(value.title, into);
+ FfiConverterBool.write(value.collapsed, into);
+ FfiConverterSequenceString.write(value.ids, into);
+ FfiConverterOptionalTypeAppMachinesViewRemoveAll.write(value.removeAll, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterString.allocationSize(value.id) +
+ FfiConverterString.allocationSize(value.title) +
+ FfiConverterBool.allocationSize(value.collapsed) +
+ FfiConverterSequenceString.allocationSize(value.ids) +
+ FfiConverterOptionalTypeAppMachinesViewRemoveAll.allocationSize(value.removeAll);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+export type AppMachinesViewRename = {
+ /**
+ * `host` (This machine's host setup), `machine` (another machine of
+ * yours on the relay) or `device` (one of your devices).
+ */
+ target: string,
+ /**
+ * The id it is saved under (the relay machine's or the device's).
+ */
+ id: string,
+ /**
+ * The dialog's title.
+ */
+ title: string,
+ /**
+ * Its confirming button.
+ */
+ confirmLabel: string
+}
+
+/**
+ * Generated factory for {@link AppMachinesViewRename} record objects.
+ */
+export const AppMachinesViewRename = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<AppMachinesViewRename, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<AppMachinesViewRename>,
+ });
+})();
+
+const FfiConverterTypeAppMachinesViewRename = (() => {
+ type TypeName = AppMachinesViewRename;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ target: FfiConverterString.read(from),
+ id: FfiConverterString.read(from),
+ title: FfiConverterString.read(from),
+ confirmLabel: FfiConverterString.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.target, into);
+ FfiConverterString.write(value.id, into);
+ FfiConverterString.write(value.title, into);
+ FfiConverterString.write(value.confirmLabel, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterString.allocationSize(value.target) +
+ FfiConverterString.allocationSize(value.id) +
+ FfiConverterString.allocationSize(value.title) +
+ FfiConverterString.allocationSize(value.confirmLabel);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+export type AppMachinesViewIssueAction = {
+ /**
+ * "Open Local Network settings", "Free disk space", "Restart service".
+ */
+ label: string,
+ /**
+ * A System Settings pane to open (`host.openSettings`).
+ */
+ url?: string,
+ /**
+ * A host action to run (`host.action`).
+ */
+ hostAction?: AppHostActionId
+}
+
+/**
+ * Generated factory for {@link AppMachinesViewIssueAction} record objects.
+ */
+export const AppMachinesViewIssueAction = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<AppMachinesViewIssueAction, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<AppMachinesViewIssueAction>,
+ });
+})();
+
+const FfiConverterTypeAppMachinesViewIssueAction = (() => {
+ type TypeName = AppMachinesViewIssueAction;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ label: FfiConverterString.read(from),
+ url: FfiConverterOptionalString.read(from),
+ hostAction: FfiConverterOptionalTypeAppHostActionId.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.label, into);
+ FfiConverterOptionalString.write(value.url, into);
+ FfiConverterOptionalTypeAppHostActionId.write(value.hostAction, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterString.allocationSize(value.label) +
+ FfiConverterOptionalString.allocationSize(value.url) +
+ FfiConverterOptionalTypeAppHostActionId.allocationSize(value.hostAction);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+export type AppMachinesViewIssue = {
+ /**
+ * The check it comes from (`machine.disk`, `service`, `version`).
+ */
+ id: string,
+ /**
+ * `warn` or `fail`.
+ */
+ level: string,
+ /**
+ * One plain sentence.
+ */
+ text: string,
+ /**
+ * Its fix, when there is one here.
+ */
+ action?: AppMachinesViewIssueAction
+}
+
+/**
+ * Generated factory for {@link AppMachinesViewIssue} record objects.
+ */
+export const AppMachinesViewIssue = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<AppMachinesViewIssue, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<AppMachinesViewIssue>,
+ });
+})();
+
+const FfiConverterTypeAppMachinesViewIssue = (() => {
+ type TypeName = AppMachinesViewIssue;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ id: FfiConverterString.read(from),
+ level: FfiConverterString.read(from),
+ text: FfiConverterString.read(from),
+ action: FfiConverterOptionalTypeAppMachinesViewIssueAction.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.id, into);
+ FfiConverterString.write(value.level, into);
+ FfiConverterString.write(value.text, into);
+ FfiConverterOptionalTypeAppMachinesViewIssueAction.write(value.action, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterString.allocationSize(value.id) +
+ FfiConverterString.allocationSize(value.level) +
+ FfiConverterString.allocationSize(value.text) +
+ FfiConverterOptionalTypeAppMachinesViewIssueAction.allocationSize(value.action);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+export type AppMachinesViewToggle = {
+ /**
+ * `spaces` or `desktop`.
+ */
+ id: string,
+ /**
+ * "Provide Spaces", "Share this desktop".
+ */
+ label: string,
+ /**
+ * One line under it.
+ */
+ help: string,
+ /**
+ * On now.
+ */
+ on: boolean,
+ /**
+ * Changed here (This machine); another machine's are read-only.
+ */
+ editable: boolean,
+ /**
+ * Can be flipped now.
+ */
+ enabled: boolean,
+ /**
+ * What flipping it runs, in order (the host's actions).
+ */
+ actions: Array<AppHostActionId>,
+ /**
+ * Before This machine is set up: flipping it opens the setup form
+ * with this profile (`desktop` or `spare`).
+ */
+ setup?: string
+}
+
+/**
+ * Generated factory for {@link AppMachinesViewToggle} record objects.
+ */
+export const AppMachinesViewToggle = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<AppMachinesViewToggle, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<AppMachinesViewToggle>,
+ });
+})();
+
+const FfiConverterTypeAppMachinesViewToggle = (() => {
+ type TypeName = AppMachinesViewToggle;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ id: FfiConverterString.read(from),
+ label: FfiConverterString.read(from),
+ help: FfiConverterString.read(from),
+ on: FfiConverterBool.read(from),
+ editable: FfiConverterBool.read(from),
+ enabled: FfiConverterBool.read(from),
+ actions: FfiConverterSequenceTypeAppHostActionId.read(from),
+ setup: FfiConverterOptionalString.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.id, into);
+ FfiConverterString.write(value.label, into);
+ FfiConverterString.write(value.help, into);
+ FfiConverterBool.write(value.on, into);
+ FfiConverterBool.write(value.editable, into);
+ FfiConverterBool.write(value.enabled, into);
+ FfiConverterSequenceTypeAppHostActionId.write(value.actions, into);
+ FfiConverterOptionalString.write(value.setup, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterString.allocationSize(value.id) +
+ FfiConverterString.allocationSize(value.label) +
+ FfiConverterString.allocationSize(value.help) +
+ FfiConverterBool.allocationSize(value.on) +
+ FfiConverterBool.allocationSize(value.editable) +
+ FfiConverterBool.allocationSize(value.enabled) +
+ FfiConverterSequenceTypeAppHostActionId.allocationSize(value.actions) +
+ FfiConverterOptionalString.allocationSize(value.setup);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+export type AppMachinesViewSpace = {
+ /**
+ * The Space's id (its page).
+ */
+ id: string,
+ /**
+ * Its name.
+ */
+ name: string,
+ /**
+ * Its system ("Ubuntu 24.04.5 LTS", "macOS").
+ */
+ os: string,
+ /**
+ * Its status word ("Running", "Stopped").
+ */
+ status: string,
+ /**
+ * Running (the green dot).
+ */
+ running: boolean
+}
+
+/**
+ * Generated factory for {@link AppMachinesViewSpace} record objects.
+ */
+export const AppMachinesViewSpace = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<AppMachinesViewSpace, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<AppMachinesViewSpace>,
+ });
+})();
+
+const FfiConverterTypeAppMachinesViewSpace = (() => {
+ type TypeName = AppMachinesViewSpace;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ id: FfiConverterString.read(from),
+ name: FfiConverterString.read(from),
+ os: FfiConverterString.read(from),
+ status: FfiConverterString.read(from),
+ running: FfiConverterBool.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.id, into);
+ FfiConverterString.write(value.name, into);
+ FfiConverterString.write(value.os, into);
+ FfiConverterString.write(value.status, into);
+ FfiConverterBool.write(value.running, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterString.allocationSize(value.id) +
+ FfiConverterString.allocationSize(value.name) +
+ FfiConverterString.allocationSize(value.os) +
+ FfiConverterString.allocationSize(value.status) +
+ FfiConverterBool.allocationSize(value.running);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+export type AppMachinesViewNewSpace = {
+ /**
+ * "New Space here".
+ */
+ label: string,
+ /**
+ * The wizard's placement (`local`, `host:<id>`).
+ */
+ on: string,
+ /**
+ * Can be pressed now.
+ */
+ enabled: boolean,
+ /**
+ * Why not, when it cannot.
+ */
+ help?: string
+}
+
+/**
+ * Generated factory for {@link AppMachinesViewNewSpace} record objects.
+ */
+export const AppMachinesViewNewSpace = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<AppMachinesViewNewSpace, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<AppMachinesViewNewSpace>,
+ });
+})();
+
+const FfiConverterTypeAppMachinesViewNewSpace = (() => {
+ type TypeName = AppMachinesViewNewSpace;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ label: FfiConverterString.read(from),
+ on: FfiConverterString.read(from),
+ enabled: FfiConverterBool.read(from),
+ help: FfiConverterOptionalString.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.label, into);
+ FfiConverterString.write(value.on, into);
+ FfiConverterBool.write(value.enabled, into);
+ FfiConverterOptionalString.write(value.help, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterString.allocationSize(value.label) +
+ FfiConverterString.allocationSize(value.on) +
+ FfiConverterBool.allocationSize(value.enabled) +
+ FfiConverterOptionalString.allocationSize(value.help);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+export type AppMachinesViewFact = {
+ /**
+ * "OS", "App", "Connection", "Service".
+ */
+ label: string,
+ /**
+ * Its value.
+ */
+ value: string
+}
+
+/**
+ * Generated factory for {@link AppMachinesViewFact} record objects.
+ */
+export const AppMachinesViewFact = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<AppMachinesViewFact, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<AppMachinesViewFact>,
+ });
+})();
+
+const FfiConverterTypeAppMachinesViewFact = (() => {
+ type TypeName = AppMachinesViewFact;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ label: FfiConverterString.read(from),
+ value: FfiConverterString.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.label, into);
+ FfiConverterString.write(value.value, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterString.allocationSize(value.label) +
+ FfiConverterString.allocationSize(value.value);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+export type AppMachinesViewMachine = {
+ /**
+ * The row's id ([`MachinePageRow::id`]).
+ */
+ id: string,
+ /**
+ * Its name.
+ */
+ name: string,
+ /**
+ * "This Mac" on the machine this app runs on.
+ */
+ badge?: string,
+ /**
+ * The row's one muted line ("2 Spaces running", "Ready for Spaces",
+ * "Offline · last seen 9 days ago").
+ */
+ line: string,
+ /**
+ * Usable now (the green dot): online and sharing.
+ */
+ online: boolean,
+ /**
+ * The dot's tint for its issues: `warn`, `fail`, or empty.
+ */
+ health: string,
+ /**
+ * What the shell passes to `Spaces.machine_health` to check it: empty
+ * for This Mac, its id for another of your machines; `None` when it
+ * can't be checked from here (offline, not yours).
+ */
+ healthTarget?: string,
+ /**
+ * `macos`, `linux`, `windows`, or empty.
+ */
+ os: string,
+ /**
+ * The machine this app runs on.
+ */
+ current: boolean,
+ /**
+ * Someone shares it with you (a team machine).
+ */
+ team: boolean,
+ /**
+ * The page's status line ("Online", "Offline · last seen 9 days ago").
+ */
+ status: string,
+ /**
+ * After the status: who shares it ("Shared by your team").
+ */
+ sharedBy?: string,
+ /**
+ * Rename, when it can be renamed from here.
+ */
+ rename?: AppMachinesViewRename,
+ /**
+ * "Issues".
+ */
+ issuesTitle: string,
+ /**
+ * What is wrong, one sentence each with its fix; empty when healthy
+ * (the section is hidden then) or offline.
+ */
+ issues: Array<AppMachinesViewIssue>,
+ /**
+ * One line over the switches (offline, signed out).
+ */
+ notice?: string,
+ /**
+ * The notice's button (Sign In).
+ */
+ noticeAction?: AppHostAction,
+ /**
+ * Provide Spaces, then Share this desktop.
+ */
+ toggles: Array<AppMachinesViewToggle>,
+ /**
+ * Under read-only switches: where they change.
+ */
+ togglesNote?: string,
+ /**
+ * "Spaces on this machine".
+ */
+ spacesTitle: string,
+ /**
+ * The Spaces on it.
+ */
+ spaces: Array<AppMachinesViewSpace>,
+ /**
+ * When it has none.
+ */
+ spacesEmpty?: string,
+ /**
+ * New Space here.
+ */
+ newSpace: AppMachinesViewNewSpace,
+ /**
+ * "Details" (collapsed).
+ */
+ detailsTitle: string,
+ /**
+ * OS, App, Connection, Service.
+ */
+ details: Array<AppMachinesViewFact>,
+ /**
+ * Remove from account (none for a team machine).
+ */
+ remove?: AppMachinesViewRemove
+}
+
+/**
+ * Generated factory for {@link AppMachinesViewMachine} record objects.
+ */
+export const AppMachinesViewMachine = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<AppMachinesViewMachine, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<AppMachinesViewMachine>,
+ });
+})();
+
+const FfiConverterTypeAppMachinesViewMachine = (() => {
+ type TypeName = AppMachinesViewMachine;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ id: FfiConverterString.read(from),
+ name: FfiConverterString.read(from),
+ badge: FfiConverterOptionalString.read(from),
+ line: FfiConverterString.read(from),
+ online: FfiConverterBool.read(from),
+ health: FfiConverterString.read(from),
+ healthTarget: FfiConverterOptionalString.read(from),
+ os: FfiConverterString.read(from),
+ current: FfiConverterBool.read(from),
+ team: FfiConverterBool.read(from),
+ status: FfiConverterString.read(from),
+ sharedBy: FfiConverterOptionalString.read(from),
+ rename: FfiConverterOptionalTypeAppMachinesViewRename.read(from),
+ issuesTitle: FfiConverterString.read(from),
+ issues: FfiConverterSequenceTypeAppMachinesViewIssue.read(from),
+ notice: FfiConverterOptionalString.read(from),
+ noticeAction: FfiConverterOptionalTypeAppHostAction.read(from),
+ toggles: FfiConverterSequenceTypeAppMachinesViewToggle.read(from),
+ togglesNote: FfiConverterOptionalString.read(from),
+ spacesTitle: FfiConverterString.read(from),
+ spaces: FfiConverterSequenceTypeAppMachinesViewSpace.read(from),
+ spacesEmpty: FfiConverterOptionalString.read(from),
+ newSpace: FfiConverterTypeAppMachinesViewNewSpace.read(from),
+ detailsTitle: FfiConverterString.read(from),
+ details: FfiConverterSequenceTypeAppMachinesViewFact.read(from),
+ remove: FfiConverterOptionalTypeAppMachinesViewRemove.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.id, into);
+ FfiConverterString.write(value.name, into);
+ FfiConverterOptionalString.write(value.badge, into);
+ FfiConverterString.write(value.line, into);
+ FfiConverterBool.write(value.online, into);
+ FfiConverterString.write(value.health, into);
+ FfiConverterOptionalString.write(value.healthTarget, into);
+ FfiConverterString.write(value.os, into);
+ FfiConverterBool.write(value.current, into);
+ FfiConverterBool.write(value.team, into);
+ FfiConverterString.write(value.status, into);
+ FfiConverterOptionalString.write(value.sharedBy, into);
+ FfiConverterOptionalTypeAppMachinesViewRename.write(value.rename, into);
+ FfiConverterString.write(value.issuesTitle, into);
+ FfiConverterSequenceTypeAppMachinesViewIssue.write(value.issues, into);
+ FfiConverterOptionalString.write(value.notice, into);
+ FfiConverterOptionalTypeAppHostAction.write(value.noticeAction, into);
+ FfiConverterSequenceTypeAppMachinesViewToggle.write(value.toggles, into);
+ FfiConverterOptionalString.write(value.togglesNote, into);
+ FfiConverterString.write(value.spacesTitle, into);
+ FfiConverterSequenceTypeAppMachinesViewSpace.write(value.spaces, into);
+ FfiConverterOptionalString.write(value.spacesEmpty, into);
+ FfiConverterTypeAppMachinesViewNewSpace.write(value.newSpace, into);
+ FfiConverterString.write(value.detailsTitle, into);
+ FfiConverterSequenceTypeAppMachinesViewFact.write(value.details, into);
+ FfiConverterOptionalTypeAppMachinesViewRemove.write(value.remove, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterString.allocationSize(value.id) +
+ FfiConverterString.allocationSize(value.name) +
+ FfiConverterOptionalString.allocationSize(value.badge) +
+ FfiConverterString.allocationSize(value.line) +
+ FfiConverterBool.allocationSize(value.online) +
+ FfiConverterString.allocationSize(value.health) +
+ FfiConverterOptionalString.allocationSize(value.healthTarget) +
+ FfiConverterString.allocationSize(value.os) +
+ FfiConverterBool.allocationSize(value.current) +
+ FfiConverterBool.allocationSize(value.team) +
+ FfiConverterString.allocationSize(value.status) +
+ FfiConverterOptionalString.allocationSize(value.sharedBy) +
+ FfiConverterOptionalTypeAppMachinesViewRename.allocationSize(value.rename) +
+ FfiConverterString.allocationSize(value.issuesTitle) +
+ FfiConverterSequenceTypeAppMachinesViewIssue.allocationSize(value.issues) +
+ FfiConverterOptionalString.allocationSize(value.notice) +
+ FfiConverterOptionalTypeAppHostAction.allocationSize(value.noticeAction) +
+ FfiConverterSequenceTypeAppMachinesViewToggle.allocationSize(value.toggles) +
+ FfiConverterOptionalString.allocationSize(value.togglesNote) +
+ FfiConverterString.allocationSize(value.spacesTitle) +
+ FfiConverterSequenceTypeAppMachinesViewSpace.allocationSize(value.spaces) +
+ FfiConverterOptionalString.allocationSize(value.spacesEmpty) +
+ FfiConverterTypeAppMachinesViewNewSpace.allocationSize(value.newSpace) +
+ FfiConverterString.allocationSize(value.detailsTitle) +
+ FfiConverterSequenceTypeAppMachinesViewFact.allocationSize(value.details) +
+ FfiConverterOptionalTypeAppMachinesViewRemove.allocationSize(value.remove);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+export type AppMachinesView = {
+ /**
+ * "3 machines, 2 online".
+ */
+ summary: string,
+ /**
+ * The list's groups (only those with machines).
+ */
+ groups: Array<AppMachinesViewGroup>,
+ /**
+ * Every machine, in list order.
+ */
+ machines: Array<AppMachinesViewMachine>
+}
+
+/**
+ * Generated factory for {@link AppMachinesView} record objects.
+ */
+export const AppMachinesView = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<AppMachinesView, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<AppMachinesView>,
+ });
+})();
+
+const FfiConverterTypeAppMachinesView = (() => {
+ type TypeName = AppMachinesView;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ summary: FfiConverterString.read(from),
+ groups: FfiConverterSequenceTypeAppMachinesViewGroup.read(from),
+ machines: FfiConverterSequenceTypeAppMachinesViewMachine.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.summary, into);
+ FfiConverterSequenceTypeAppMachinesViewGroup.write(value.groups, into);
+ FfiConverterSequenceTypeAppMachinesViewMachine.write(value.machines, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterString.allocationSize(value.summary) +
+ FfiConverterSequenceTypeAppMachinesViewGroup.allocationSize(value.groups) +
+ FfiConverterSequenceTypeAppMachinesViewMachine.allocationSize(value.machines);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+export type AppMachinesViewAbout = {
+ /**
+ * Its name ("Ada's MacBook Pro").
+ */
+ computerName: string,
+ /**
+ * The app's version ("0.9.1").
+ */
+ appVersion: string,
+ /**
+ * Its system and version ("macOS 26.5.2").
+ */
+ osVersion: string
+}
+
+/**
+ * Generated factory for {@link AppMachinesViewAbout} record objects.
+ */
+export const AppMachinesViewAbout = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<AppMachinesViewAbout, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<AppMachinesViewAbout>,
+ });
+})();
+
+const FfiConverterTypeAppMachinesViewAbout = (() => {
+ type TypeName = AppMachinesViewAbout;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ computerName: FfiConverterString.read(from),
+ appVersion: FfiConverterString.read(from),
+ osVersion: FfiConverterString.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.computerName, into);
+ FfiConverterString.write(value.appVersion, into);
+ FfiConverterString.write(value.osVersion, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterString.allocationSize(value.computerName) +
+ FfiConverterString.allocationSize(value.appVersion) +
+ FfiConverterString.allocationSize(value.osVersion);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+export type AppMachinesViewCheck = {
+ /**
+ * `machine.local_network`, `machine.disk`, ...
+ */
+ id: string,
+ /**
+ * `pass`, `warn`, `fail`, `skip`.
+ */
+ status: string,
+ /**
+ * What it found.
+ */
+ message: string,
+ /**
+ * What to do.
+ */
+ remediation: string,
+ /**
+ * `app`, `settings_url`, `free_gb`, ...
+ */
+ facts: Map<string, string>
+}
+
+/**
+ * Generated factory for {@link AppMachinesViewCheck} record objects.
+ */
+export const AppMachinesViewCheck = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<AppMachinesViewCheck, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<AppMachinesViewCheck>,
+ });
+})();
+
+const FfiConverterTypeAppMachinesViewCheck = (() => {
+ type TypeName = AppMachinesViewCheck;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ id: FfiConverterString.read(from),
+ status: FfiConverterString.read(from),
+ message: FfiConverterString.read(from),
+ remediation: FfiConverterString.read(from),
+ facts: FfiConverterMapStringString.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.id, into);
+ FfiConverterString.write(value.status, into);
+ FfiConverterString.write(value.message, into);
+ FfiConverterString.write(value.remediation, into);
+ FfiConverterMapStringString.write(value.facts, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterString.allocationSize(value.id) +
+ FfiConverterString.allocationSize(value.status) +
+ FfiConverterString.allocationSize(value.message) +
+ FfiConverterString.allocationSize(value.remediation) +
+ FfiConverterMapStringString.allocationSize(value.facts);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+export type AppMachinesViewHealth = {
+ /**
+ * The machine's row id (`this-mac`, a relay machine id).
+ */
+ id: string,
+ /**
+ * Its checks.
+ */
+ checks: Array<AppMachinesViewCheck>,
+ /**
+ * The Cua version of the daemon that checked.
+ */
+ cuaVersion: string,
+ /**
+ * Why it could not be checked, when it could not.
+ */
+ error?: string
+}
+
+/**
+ * Generated factory for {@link AppMachinesViewHealth} record objects.
+ */
+export const AppMachinesViewHealth = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<AppMachinesViewHealth, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<AppMachinesViewHealth>,
+ });
+})();
+
+const FfiConverterTypeAppMachinesViewHealth = (() => {
+ type TypeName = AppMachinesViewHealth;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ id: FfiConverterString.read(from),
+ checks: FfiConverterSequenceTypeAppMachinesViewCheck.read(from),
+ cuaVersion: FfiConverterString.read(from),
+ error: FfiConverterOptionalString.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.id, into);
+ FfiConverterSequenceTypeAppMachinesViewCheck.write(value.checks, into);
+ FfiConverterString.write(value.cuaVersion, into);
+ FfiConverterOptionalString.write(value.error, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterString.allocationSize(value.id) +
+ FfiConverterSequenceTypeAppMachinesViewCheck.allocationSize(value.checks) +
+ FfiConverterString.allocationSize(value.cuaVersion) +
+ FfiConverterOptionalString.allocationSize(value.error);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+export type AppMachinesViewRelay = {
+ /**
+ * Machine id.
+ */
+ id: string,
+ /**
+ * `owner`, or `shared` for a machine someone shares with you.
+ */
+ role: string,
+ /**
+ * The team you reach it through, for a team machine.
+ */
+ team?: string,
+ /**
+ * Its owner's email, when the relay says.
+ */
+ ownerEmail?: string,
+ /**
+ * It creates Spaces for your devices (`None`: it did not say).
+ */
+ providesSpaces?: boolean
+}
+
+/**
+ * Generated factory for {@link AppMachinesViewRelay} record objects.
+ */
+export const AppMachinesViewRelay = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<AppMachinesViewRelay, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<AppMachinesViewRelay>,
+ });
+})();
+
+const FfiConverterTypeAppMachinesViewRelay = (() => {
+ type TypeName = AppMachinesViewRelay;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ id: FfiConverterString.read(from),
+ role: FfiConverterString.read(from),
+ team: FfiConverterOptionalString.read(from),
+ ownerEmail: FfiConverterOptionalString.read(from),
+ providesSpaces: FfiConverterOptionalBoolean.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.id, into);
+ FfiConverterString.write(value.role, into);
+ FfiConverterOptionalString.write(value.team, into);
+ FfiConverterOptionalString.write(value.ownerEmail, into);
+ FfiConverterOptionalBoolean.write(value.providesSpaces, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterString.allocationSize(value.id) +
+ FfiConverterString.allocationSize(value.role) +
+ FfiConverterOptionalString.allocationSize(value.team) +
+ FfiConverterOptionalString.allocationSize(value.ownerEmail) +
+ FfiConverterOptionalBoolean.allocationSize(value.providesSpaces);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+export type AppMachinesViewInput = {
+ /**
+ * What the rows are listed from ([`machines::page_rows`]).
+ */
+ page: AppMachinesPageInput,
+ /**
+ * The account's relay machines (none while signed out).
+ */
+ relay: Array<AppMachinesViewRelay>,
+ /**
+ * This machine's host state (`None` while it loads).
+ */
+ host?: AppHostState,
+ /**
+ * This computer.
+ */
+ about: AppMachinesViewAbout,
+ /**
+ * The rows when the shell already listed them (an older host's rows,
+ * merged by the web UI); `None`: [`machines::page_rows`] of `page`.
+ */
+ rows?: Array<AppMachinePageRow>,
+ /**
+ * What each machine's daemon reported of its health, by row id, for
+ * the machines whose `health_target` the shell checked
+ * ([`crate::machines_health`]).
+ */
+ health: Array<AppMachinesViewHealth>
+}
+
+/**
+ * Generated factory for {@link AppMachinesViewInput} record objects.
+ */
+export const AppMachinesViewInput = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<AppMachinesViewInput, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<AppMachinesViewInput>,
+ });
+})();
+
+const FfiConverterTypeAppMachinesViewInput = (() => {
+ type TypeName = AppMachinesViewInput;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ page: FfiConverterTypeAppMachinesPageInput.read(from),
+ relay: FfiConverterSequenceTypeAppMachinesViewRelay.read(from),
+ host: FfiConverterOptionalTypeAppHostState.read(from),
+ about: FfiConverterTypeAppMachinesViewAbout.read(from),
+ rows: FfiConverterOptionalSequenceTypeAppMachinePageRow.read(from),
+ health: FfiConverterSequenceTypeAppMachinesViewHealth.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterTypeAppMachinesPageInput.write(value.page, into);
+ FfiConverterSequenceTypeAppMachinesViewRelay.write(value.relay, into);
+ FfiConverterOptionalTypeAppHostState.write(value.host, into);
+ FfiConverterTypeAppMachinesViewAbout.write(value.about, into);
+ FfiConverterOptionalSequenceTypeAppMachinePageRow.write(value.rows, into);
+ FfiConverterSequenceTypeAppMachinesViewHealth.write(value.health, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterTypeAppMachinesPageInput.allocationSize(value.page) +
+ FfiConverterSequenceTypeAppMachinesViewRelay.allocationSize(value.relay) +
+ FfiConverterOptionalTypeAppHostState.allocationSize(value.host) +
+ FfiConverterTypeAppMachinesViewAbout.allocationSize(value.about) +
+ FfiConverterOptionalSequenceTypeAppMachinePageRow.allocationSize(value.rows) +
+ FfiConverterSequenceTypeAppMachinesViewHealth.allocationSize(value.health);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
export type AppMainChrome = {
/**
* Window title when nothing is selected.
@@ -61785,6 +63110,60 @@ const FfiConverterSequenceTypeAppDeviceIn = new FfiConverterArray(FfiConverterTy
// FfiConverter for Map<string, boolean>
const FfiConverterMapStringBoolean = new FfiConverterMap(FfiConverterString, FfiConverterBool);
+// FfiConverter for Array<AppMachinesViewRemove>
+const FfiConverterSequenceTypeAppMachinesViewRemove = new FfiConverterArray(FfiConverterTypeAppMachinesViewRemove);
+
+// FfiConverter for AppMachinesViewRemoveAll | undefined
+const FfiConverterOptionalTypeAppMachinesViewRemoveAll = new FfiConverterOptional(FfiConverterTypeAppMachinesViewRemoveAll);
+
+// FfiConverter for Array<AppMachinesViewGroup>
+const FfiConverterSequenceTypeAppMachinesViewGroup = new FfiConverterArray(FfiConverterTypeAppMachinesViewGroup);
+
+// FfiConverter for AppMachinesViewRename | undefined
+const FfiConverterOptionalTypeAppMachinesViewRename = new FfiConverterOptional(FfiConverterTypeAppMachinesViewRename);
+
+// FfiConverter for AppHostActionId | undefined
+const FfiConverterOptionalTypeAppHostActionId = new FfiConverterOptional(FfiConverterTypeAppHostActionId);
+
+// FfiConverter for AppMachinesViewIssueAction | undefined
+const FfiConverterOptionalTypeAppMachinesViewIssueAction = new FfiConverterOptional(FfiConverterTypeAppMachinesViewIssueAction);
+
+// FfiConverter for Array<AppMachinesViewIssue>
+const FfiConverterSequenceTypeAppMachinesViewIssue = new FfiConverterArray(FfiConverterTypeAppMachinesViewIssue);
+
+// FfiConverter for Array<AppHostActionId>
+const FfiConverterSequenceTypeAppHostActionId = new FfiConverterArray(FfiConverterTypeAppHostActionId);
+
+// FfiConverter for Array<AppMachinesViewToggle>
+const FfiConverterSequenceTypeAppMachinesViewToggle = new FfiConverterArray(FfiConverterTypeAppMachinesViewToggle);
+
+// FfiConverter for Array<AppMachinesViewSpace>
+const FfiConverterSequenceTypeAppMachinesViewSpace = new FfiConverterArray(FfiConverterTypeAppMachinesViewSpace);
+
+// FfiConverter for Array<AppMachinesViewFact>
+const FfiConverterSequenceTypeAppMachinesViewFact = new FfiConverterArray(FfiConverterTypeAppMachinesViewFact);
+
+// FfiConverter for AppMachinesViewRemove | undefined
+const FfiConverterOptionalTypeAppMachinesViewRemove = new FfiConverterOptional(FfiConverterTypeAppMachinesViewRemove);
+
+// FfiConverter for Array<AppMachinesViewMachine>
+const FfiConverterSequenceTypeAppMachinesViewMachine = new FfiConverterArray(FfiConverterTypeAppMachinesViewMachine);
+
+// FfiConverter for Array<AppMachinesViewCheck>
+const FfiConverterSequenceTypeAppMachinesViewCheck = new FfiConverterArray(FfiConverterTypeAppMachinesViewCheck);
+
+// FfiConverter for Array<AppMachinesViewRelay>
+const FfiConverterSequenceTypeAppMachinesViewRelay = new FfiConverterArray(FfiConverterTypeAppMachinesViewRelay);
+
+// FfiConverter for AppHostState | undefined
+const FfiConverterOptionalTypeAppHostState = new FfiConverterOptional(FfiConverterTypeAppHostState);
+
+// FfiConverter for Array<AppMachinePageRow> | undefined
+const FfiConverterOptionalSequenceTypeAppMachinePageRow = new FfiConverterOptional(FfiConverterSequenceTypeAppMachinePageRow);
+
+// FfiConverter for Array<AppMachinesViewHealth>
+const FfiConverterSequenceTypeAppMachinesViewHealth = new FfiConverterArray(FfiConverterTypeAppMachinesViewHealth);
+
// FfiConverter for Array<AppMenuPreviewRow>
const FfiConverterSequenceTypeAppMenuPreviewRow = new FfiConverterArray(FfiConverterTypeAppMenuPreviewRow);
@@ -62220,9 +63599,6 @@ const FfiConverterSequenceTypeAppSentFileInfo = new FfiConverterArray(FfiConvert
// FfiConverter for Array<AppRemoteWindowGroup>
const FfiConverterSequenceTypeAppRemoteWindowGroup = new FfiConverterArray(FfiConverterTypeAppRemoteWindowGroup);
-// FfiConverter for AppHostState | undefined
-const FfiConverterOptionalTypeAppHostState = new FfiConverterOptional(FfiConverterTypeAppHostState);
-
// FfiConverter for AppHostSettingChange | undefined
const FfiConverterOptionalTypeAppHostSettingChange = new FfiConverterOptional(FfiConverterTypeAppHostSettingChange);
@@ -62683,6 +64059,12 @@ function uniffiEnsureInitialized() {
if (nativeModule().uniffi_cua_spaces_ffi_checksum_func_app_machines_page_rows() !== 50072) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_spaces_ffi_checksum_func_app_machines_page_rows");
}
+ if (nativeModule().uniffi_cua_spaces_ffi_checksum_func_app_machines_view() !== 7497) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_spaces_ffi_checksum_func_app_machines_view");
+ }
+ if (nativeModule().uniffi_cua_spaces_ffi_checksum_func_app_machines_view_input_from_json() !== 47089) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_spaces_ffi_checksum_func_app_machines_view_input_from_json");
+ }
if (nativeModule().uniffi_cua_spaces_ffi_checksum_func_app_main_chrome() !== 29313) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_spaces_ffi_checksum_func_app_main_chrome");
}
@@ -63574,6 +64956,23 @@ export default Object.freeze({
FfiConverterTypeAppMachineInput,
FfiConverterTypeAppMachinePageRow,
FfiConverterTypeAppMachinesPageInput,
+ FfiConverterTypeAppMachinesView,
+ FfiConverterTypeAppMachinesViewAbout,
+ FfiConverterTypeAppMachinesViewCheck,
+ FfiConverterTypeAppMachinesViewFact,
+ FfiConverterTypeAppMachinesViewGroup,
+ FfiConverterTypeAppMachinesViewHealth,
+ FfiConverterTypeAppMachinesViewInput,
+ FfiConverterTypeAppMachinesViewIssue,
+ FfiConverterTypeAppMachinesViewIssueAction,
+ FfiConverterTypeAppMachinesViewMachine,
+ FfiConverterTypeAppMachinesViewNewSpace,
+ FfiConverterTypeAppMachinesViewRelay,
+ FfiConverterTypeAppMachinesViewRemove,
+ FfiConverterTypeAppMachinesViewRemoveAll,
+ FfiConverterTypeAppMachinesViewRename,
+ FfiConverterTypeAppMachinesViewSpace,
+ FfiConverterTypeAppMachinesViewToggle,
FfiConverterTypeAppMainChrome,
FfiConverterTypeAppMenuInput,
FfiConverterTypeAppMenuItem,
diff --git a/apps/cua-spaces-desktop/test/bridge-native.test.ts b/apps/cua-spaces-desktop/test/bridge-native.test.ts
index 1c7a36febd..239552a4ca 100644
--- a/apps/cua-spaces-desktop/test/bridge-native.test.ts
+++ b/apps/cua-spaces-desktop/test/bridge-native.test.ts
@@ -178,8 +178,8 @@ describe.skipIf(!built)("the bridge on the app core", () => {
for (const [method, args] of cases) problems.push(...shapeProblems(method, await call(method, args)));
expect(problems).toEqual([]);
// Every ported method has its case (or is checked below).
- // (Teleport and the Keyvault: vault-native.test.ts; This machine, Devices, Settings and the rest: host-bridge.test.ts; the relay allowance: relay-usage.test.ts; resource numbers: resources.test.ts; presence: presence-bridge.test.ts; the Windows runtime fix: below.)
- const elsewhere = new Set(["session.signIn", "spaces.create", "spaces.delete", "spaces.openStream", "relay.usage", "sharing.removals", "sharing.ackRemovals", "resources.get", "presence.join", "presence.publish", "presence.leave", "spaces.fixRuntime", ...AGENT_METHODS, ...VAULT_METHODS, ...HOST_METHODS]);
+ // (Teleport and the Keyvault: vault-native.test.ts; This machine, Devices, Settings and the rest: host-bridge.test.ts; the relay allowance: relay-usage.test.ts; resource numbers: resources.test.ts; presence: presence-bridge.test.ts; the Machines page's rename, remove and health checks: machines-view.test.ts; the Windows runtime fix: below.)
+ const elsewhere = new Set(["session.signIn", "spaces.create", "spaces.delete", "spaces.openStream", "relay.usage", "sharing.removals", "sharing.ackRemovals", "resources.get", "machines.rename", "machines.remove", "machines.checkHealth", "presence.join", "presence.publish", "presence.leave", "spaces.fixRuntime", ...AGENT_METHODS, ...VAULT_METHODS, ...HOST_METHODS]);
const ported = bridge.registry.methods.filter((m) => !NOT_YET.includes(m) && !elsewhere.has(m));
expect(ported.filter((m) => !cases.some(([c]) => c === m))).toEqual([]);
});
@@ -562,8 +562,8 @@ describe.skipIf(!built)("the bridge on the app core", () => {
"clouds.connect": { target: { provider: "aws", region: "us-west-2" }, makeDefault: false },
"checklist.send": { action: { type: "done", step: "teleport" } },
};
- // This machine, Devices, Settings and the rest: host-bridge.test.ts reads them with their arguments.
- const skip = new Set<OpName>(["spaces.create", "spaces.delete", "session.signIn", "session.signOut", "session.openExternal", "spaces.openStream", "relay.usage", "sharing.removals", "sharing.ackRemovals", "resources.get", "presence.join", "presence.publish", "presence.leave", "spaces.fixRuntime", ...VAULT_OPS, ...(HOST_OPS as OpName[])]);
+ // This machine, Devices, Settings and the rest: host-bridge.test.ts reads them with their arguments (the Machines page's rename and remove: machines-view.test.ts).
+ const skip = new Set<OpName>(["spaces.create", "spaces.delete", "session.signIn", "session.signOut", "session.openExternal", "spaces.openStream", "relay.usage", "sharing.removals", "sharing.ackRemovals", "resources.get", "machines.rename", "machines.remove", "machines.checkHealth", "presence.join", "presence.publish", "presence.leave", "spaces.fixRuntime", ...VAULT_OPS, ...(HOST_OPS as OpName[])]);
const problems: string[] = [];
const checked: string[] = [];
for (const op of OPERATIONS) {
diff --git a/apps/cua-spaces-desktop/test/fixtures.ts b/apps/cua-spaces-desktop/test/fixtures.ts
index 0acce146e9..2297d13b7b 100644
--- a/apps/cua-spaces-desktop/test/fixtures.ts
+++ b/apps/cua-spaces-desktop/test/fixtures.ts
@@ -21,7 +21,7 @@ import type {
SpacePresenceLike,
TeleportLike,
} from "../src/native/generated/index";
-import type { LocalRuntimes, SpaceThumbnailData, SpacesBackend } from "../src/model/backend";
+import type { LocalRuntimes, MachineHealthReport, SpaceThumbnailData, SpacesBackend } from "../src/model/backend";
import type { StreamWindow } from "../src/model/streams";
import type { AccountProfile, AccountRunning, LinkNoticeView, SignInAttempt, TelemetryRunning } from "../src/model/services";
@@ -135,6 +135,20 @@ export class FixtureSpacesBackend implements SpacesBackend {
this.removed.push({ id, removeOnly });
this.rowsNow = this.rowsNow.filter((r) => r.id !== id);
}
+ /** What `machineHealth` answers, by machine (`this` for this one); a string is the error it throws. */
+ health = new Map<string, MachineHealthReport | string>();
+ readonly healthAsked: (string | null)[] = [];
+ async machineHealth(machine: string | null): Promise<MachineHealthReport> {
+ this.healthAsked.push(machine);
+ const h = this.health.get(machine ?? "this");
+ if (typeof h === "string") throw new Error(h);
+ return h ?? { cuaVersion: "0.4.1", checks: [] };
+ }
+ readonly unregistered: string[] = [];
+ async relayUnregister(machineId: string) {
+ this.unregistered.push(machineId);
+ this.rowsNow = this.rowsNow.filter((r) => r.id !== `relay:${machineId}`);
+ }
async setPower(id: string, on: boolean) {
this.power.push({ id, on });
this.rowsNow = this.rowsNow.map((r) => (r.id === id ? { ...r, powerState: on ? "running" : r.power === "stop" ? "stopped" : "suspended", reachable: on } : r));
diff --git a/apps/cua-spaces-desktop/test/host-fixtures.ts b/apps/cua-spaces-desktop/test/host-fixtures.ts
index a3c1857df0..f965de75ef 100644
--- a/apps/cua-spaces-desktop/test/host-fixtures.ts
+++ b/apps/cua-spaces-desktop/test/host-fixtures.ts
@@ -222,6 +222,12 @@ export class FixtureDevices {
return this.current.devices.find((d) => d.id === id)!;
}
+ async renameMachine(id: string, name: string) {
+ this.calls.push(`rename-machine:${id}:${name}`);
+ this.current = { ...this.current, machines: this.current.machines.map((m) => (m.id === id ? { ...m, name } : m)) };
+ return this.current.machines.find((m) => m.id === id)!;
+ }
+
async revoke(id: string) {
this.calls.push(`revoke:${id}`);
this.current = { ...this.current, devices: this.current.devices.map((d) => (d.id === id ? { ...d, state: "revoked" } : d)) };
diff --git a/apps/cua-spaces-desktop/test/machines-view.test.ts b/apps/cua-spaces-desktop/test/machines-view.test.ts
new file mode 100644
index 0000000000..0a18ed7894
--- /dev/null
+++ b/apps/cua-spaces-desktop/test/machines-view.test.ts
@@ -0,0 +1,193 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+// The Machines page (CUA-1673) on the real app core (`pnpm native`): the
+// view the page draws (`machines_view::view`) is the core's, the same the
+// SwiftUI page draws, from what this app has; `machines.list` carries it in
+// the shape the web contract reads; and the page's own actions, rename and
+// Remove from account, reach the relay and the Spaces. Skipped when this
+// machine's native directory was not built.
+import { existsSync, mkdtempSync, readFileSync, rmSync } from "node:fs";
+import { tmpdir } from "node:os";
+import * as path from "node:path";
+import { afterAll, beforeAll, beforeEach, describe, expect, it } from "vitest";
+import { validate } from "../../cua-spaces-web/src/bridge/contracts/schema";
+import { SHAPE_DEFS, WEBKIT_SHAPES } from "../../cua-spaces-web/src/bridge/contracts/shapes";
+import { createBridge, type Bridge } from "../src/bridge";
+import { encode } from "../src/bridge/value";
+import { AppModel } from "../src/model/app-model";
+import { CloudModel } from "../src/model/cloud";
+import { DevicesModel } from "../src/model/devices";
+import { HostModel } from "../src/model/host";
+import { StartupModel } from "../src/model/startup";
+import { devDirName, nativeFiles } from "../src/native/location";
+import { loadNative, type Native } from "../src/native/load";
+import { FixtureAccount, FixtureSpacesBackend, FixtureTelemetry, fixtureHost } from "./fixtures";
+import { FixtureDevices } from "./host-fixtures";
+
+const dir = path.resolve(__dirname, "../native", devDirName(process.platform, process.arch));
+const built = existsSync(nativeFiles(dir, process.platform).library);
+const PARITY = path.resolve(__dirname, "../../../libs/cua/crates/cua-spaces-app-core/parity");
+
+describe.skipIf(!built)("the Machines page on the app core", () => {
+ let home: string;
+ let native: Native;
+ const saved = { ...process.env };
+ let model: AppModel;
+ let bridge: Bridge;
+ let backend: FixtureSpacesBackend;
+ let devices: FixtureDevices;
+
+ beforeAll(async () => {
+ home = mkdtempSync(path.join(tmpdir(), "cua-machines-"));
+ Object.assign(process.env, { HOME: home, USERPROFILE: home, CUA_HOME: path.join(home, ".cua"), CUA_TELEMETRY: "0", DO_NOT_TRACK: "1", CUA_KEYCHAIN_NONINTERACTIVE: "1" });
+ native = await loadNative(dir);
+ });
+
+ afterAll(() => {
+ process.env = saved;
+ rmSync(home, { recursive: true, force: true });
+ });
+
+ beforeEach(() => {
+ const appDir = mkdtempSync(path.join(home, "app-"));
+ backend = new FixtureSpacesBackend(native);
+ devices = new FixtureDevices();
+ model = new AppModel({
+ native,
+ backend,
+ startup: new StartupModel({ kind: "ready" }),
+ settingsPath: path.join(appDir, "app-settings.json"),
+ host: new HostModel(native, fixtureHost()),
+ devices: new DevicesModel(native, () => devices.like),
+ cloud: new CloudModel(native, () => backend),
+ account: new FixtureAccount("[email protected]"),
+ telemetry: new FixtureTelemetry(),
+ servicesIn: () => true,
+ cpus: 8,
+ checklistPath: null,
+ about: () => ({ computerName: "Ada's MacBook Pro", appVersion: "0.9.1", osVersion: "macOS 26.5.2" }),
+ });
+ model.devices.signedIn = true;
+ bridge = createBridge({ model, supervisor: null, version: "1.2.3", platform: "darwin", env: {}, ui: { openSpace: () => {}, setBackground: () => {}, activate: () => {} } } as never);
+ });
+
+ const call = (method: string, args: Record<string, unknown> = {}) => bridge.registry.handle(method, args, { window: "win-1" });
+
+ it("draws the approved mockup as the core's golden has it", () => {
+ const fixture = JSON.parse(readFileSync(path.join(PARITY, "machines.json"), "utf8")) as { views: { input: unknown }[] };
+ const golden = JSON.parse(readFileSync(path.join(PARITY, "golden/machines.json"), "utf8")) as {
+ frames: { view?: string; summary?: string; groups?: { group: string; rows: string[] }[] }[];
+ };
+ const expected = golden.frames.find((f) => f.view)!;
+ const view = native.appMachinesView(native.appMachinesViewInputFromJson(JSON.stringify(fixture.views[0]!.input)));
+ expect(view.summary).toBe(expected.summary);
+ const byId = new Map(view.machines.map((m) => [m.id, m] as const));
+ const rows = view.groups.map((g) =>
+ g.ids.map((id) => {
+ const m = byId.get(id)!;
+ return `${m.online ? "●" : "○"} ${m.name}${m.badge ? ` [${m.badge}]` : ""} — ${m.line}`;
+ }),
+ );
+ expect(rows).toEqual(expected.groups!.map((g) => g.rows));
+ });
+
+ it("draws the mockup with issues as the core's golden has it: tinted rows and each machine's issues", () => {
+ const fixture = JSON.parse(readFileSync(path.join(PARITY, "machines.json"), "utf8")) as { views: { name: string; input: unknown }[] };
+ const golden = JSON.parse(readFileSync(path.join(PARITY, "golden/machines.json"), "utf8")) as {
+ frames: { view?: string; summary?: string; groups?: { group: string; rows: string[] }[]; pages?: string[][] }[];
+ };
+ const v = fixture.views.find((x) => x.name.startsWith("the mockup with issues"))!;
+ const expected = golden.frames.find((f) => f.view === v.name)!;
+ const view = native.appMachinesView(native.appMachinesViewInputFromJson(JSON.stringify(v.input)));
+ const byId = new Map(view.machines.map((m) => [m.id, m] as const));
+ const rows = view.groups.map((g) =>
+ g.ids.map((id) => {
+ const m = byId.get(id)!;
+ return `${m.online ? "●" : "○"} ${m.name}${m.badge ? ` [${m.badge}]` : ""} — ${m.line}${m.health ? ` [${m.health}]` : ""}`;
+ }),
+ );
+ expect(rows).toEqual(expected.groups!.map((g) => g.rows));
+ // Each page's issue lines, as parity.rs's view_frame writes them.
+ const issueLines = view.machines.map((m) =>
+ m.issues.map((i) => `${m.issuesTitle.toLowerCase()} ${i.level}: ${i.text}${i.action ? ` [${i.action.label}]` : ""}`),
+ );
+ expect(issueLines).toEqual(expected.pages!.map((p) => p.filter((l) => l.startsWith("issues "))));
+ expect(issueLines.flat().length).toBeGreaterThan(0);
+ });
+
+ it("checks the machines that can be checked, keeps their answers for the view, and drops what is no longer current", async () => {
+ await model.refresh();
+ await model.devices.refresh();
+ const url = "x-apple.systempreferences:com.apple.preference.security?Privacy_LocalNetwork";
+ backend.health.set("this", {
+ cuaVersion: "0.4.1",
+ checks: [{ id: "machine.local_network", status: "fail", message: "blocked", remediation: "", facts: new Map([["app", "Cua Spaces"], ["settings_url", url]]) }],
+ });
+ const targets = model.machinesView.machines.filter((m) => m.healthTarget !== undefined && m.healthTarget !== null);
+ expect(targets.some((m) => m.current)).toBe(true);
+ await expect(call("machines.checkHealth")).resolves.toBeNull();
+ // This machine through its own daemon (no machine), the others by id; never an offline one.
+ expect(backend.healthAsked).toContain(null);
+ const offline = model.machinesView.machines.filter((m) => !m.current && !m.online).map((m) => m.id);
+ for (const asked of backend.healthAsked) expect(offline).not.toContain(asked);
+ expect(backend.healthAsked.length).toBe(targets.length);
+ const me = model.machinesView.machines.find((m) => m.current)!;
+ expect(me.health).toBe("fail");
+ expect(me.issues.map((i) => [i.id, i.action?.label, i.action?.url])).toEqual([["machine.local_network", "Open Local Network settings", url]]);
+ // The list carries them in the web contract's shape.
+ const answer = (await call("machines.list")) as unknown;
+ expect(validate(WEBKIT_SHAPES["machines.list"]!, answer, SHAPE_DEFS)).toEqual([]);
+
+ // An answer for a machine that is no longer a target is dropped.
+ model.machineHealth.set("gone", { id: "gone", cuaVersion: "0.4.1", checks: [], error: undefined });
+ backend.health.set("this", "the daemon is not running");
+ await call("machines.checkHealth");
+ expect(model.machineHealth.has("gone")).toBe(false);
+ const again = model.machinesView.machines.find((m) => m.current)!;
+ expect(again.issues[0]?.id).toBe("unchecked");
+ expect(again.issues[0]?.text).toContain("the daemon is not running");
+ });
+
+ it("lists the view from this app's rows, with whose each machine is, and sends it in the web contract's shape", async () => {
+ await model.refresh();
+ await model.devices.refresh();
+ const view = model.machinesView;
+ // The same machines as the rows, This machine first, named after this computer.
+ expect(view.machines.map((m) => m.id).sort()).toEqual(model.machinePageRows.map((r) => r.id).sort());
+ const me = view.machines.find((m) => m.current)!;
+ expect(me.name).not.toBe("");
+ expect(me.details.find((d) => d.label === "App")?.value).toBe("0.9.1");
+ expect(me.newSpace.on).toBe("local");
+ const answer = (await call("machines.list")) as { view: { machines: { id: string; toggles: { actions: string[] }[] }[] } };
+ expect(answer.view).toEqual(encode(view));
+ expect(validate(WEBKIT_SHAPES["machines.list"]!, answer, SHAPE_DEFS)).toEqual([]);
+ // Enums as the SwiftUI host's BridgeValue names them (the case name;
+ // the web adapter turns them into the bridge's words).
+ const actions = answer.view.machines.flatMap((m) => m.toggles.flatMap((t) => t.actions));
+ for (const a of actions) expect(a).toMatch(/^[a-z]+[A-Za-z]*$/);
+ });
+
+ it("renames a machine on the relay; this machine by its own relay id", async () => {
+ await model.refresh();
+ await expect(call("machines.rename", { id: "m2", name: " Build box " })).resolves.toBeNull();
+ expect(devices.calls).toContain("rename-machine:m2:Build box");
+ model.host.machineId = "self-id";
+ await call("machines.rename", { id: "this-mac", name: "Ada's Mac" });
+ expect(devices.calls).toContain("rename-machine:self-id:Ada's Mac");
+ await expect(call("machines.rename", { id: "m2", name: " " })).rejects.toMatchObject({ code: "bad_args" });
+ });
+
+ it("removes a machine from the account: off the relay, then its device revoked", async () => {
+ await model.refresh();
+ await expect(call("machines.remove", { machine: "m2", device: "dev_old" })).resolves.toBeNull();
+ expect(backend.unregistered).toEqual(["m2"]);
+ expect(devices.calls).toContain("revoke:dev_old");
+ await expect(call("machines.remove", {})).rejects.toMatchObject({ code: "bad_args" });
+ // Signed out: no relay to ask.
+ model.devices.signedIn = false;
+ const signedOut = new DevicesModel(native, () => null);
+ Object.assign(model, { devices: signedOut });
+ await expect(call("machines.remove", { machine: "m2" })).rejects.toMatchObject({ code: "unsupported" });
+ });
+});
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift
index cbe33dce10..610d37f358 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift
@@ -355,14 +355,139 @@ public final class AppModel {
/// the web UI lists too): This machine, the machines the Spaces list
/// shows (one sharing its desktop, one that provides Spaces), then
/// the account's devices that are none of them; each computer once.
- public var machinePageRows: [AppMachinePageRow] {
+ public var machinePageRows: [AppMachinePageRow] { appMachinesPageRows(input: machinesPageInput) }
+
+ /// What the Machines page is listed from: the Spaces list, the
+ /// account's devices, the hostnames and who the relay sees connected.
+ var machinesPageInput: AppMachinesPageInput {
let devices = self.devices.snapshot == nil ? [] : self.devices.input.devices.map {
AppDeviceIn(id: $0.id, name: $0.name, platform: $0.platform ?? "", lastSeen: $0.lastSeen,
current: $0.current, state: $0.state)
}
- return appMachinesPageRows(input: AppMachinesPageInput(
+ return AppMachinesPageInput(
hostOs: .macos, spaces: spaces, devices: devices, hostnames: relayHostnames,
- presence: self.devices.relayOnline, now: self.devices.nowSecs))
+ presence: self.devices.relayOnline, now: self.devices.nowSecs)
+ }
+
+ /// The Machines page as every UI draws it (the core's
+ /// `machines_view::view`, which the New UI draws too): the list in
+ /// groups with one line each, and each machine's page.
+ public var machinesView: AppMachinesView {
+ let relay = (devices.snapshot?.machines ?? []).map {
+ AppMachinesViewRelay(id: $0.id, role: $0.role, team: $0.team, ownerEmail: $0.ownerEmail,
+ providesSpaces: $0.providesSpaces)
+ }
+ return appMachinesView(input: AppMachinesViewInput(
+ page: machinesPageInput, relay: relay, host: host.state, about: Self.machinesAbout, rows: nil,
+ health: machineHealth.keys.sorted().compactMap { machineHealth[$0] }))
+ }
+
+ /// What each machine's own daemon last reported of its health, by
+ /// Machines page row id (`checkMachineHealth`): the view's issues.
+ public var machineHealth: [String: AppMachinesViewHealth] = [:]
+ @ObservationIgnored private var healthCheck: Task<Void, Never>?
+
+ /// At most this many machines are checked at once.
+ static let healthConcurrency = 3
+ /// One machine's check may take this long.
+ static let healthTimeout: Double = 35
+
+ /// Checks the health of every machine the Machines page can check
+ /// (`healthTarget`: This Mac through its daemon, another of your
+ /// machines that is online through its own daemon over the relay or
+ /// mesh), a few at once, and keeps what each said. A machine that is
+ /// no longer checkable (offline, removed) loses its old result, so no
+ /// stale issue shows. One check at a time; a call during one waits for
+ /// it.
+ public func checkMachineHealth() async {
+ if let running = healthCheck {
+ await running.value
+ return
+ }
+ let task = Task { await self.runHealthChecks() }
+ healthCheck = task
+ await task.value
+ healthCheck = nil
+ }
+
+ private func runHealthChecks() async {
+ let targets = machinesView.machines.compactMap { m in m.healthTarget.map { (id: m.id, target: $0) } }
+ let wanted = Set(targets.map(\.id))
+ machineHealth = machineHealth.filter { wanted.contains($0.key) }
+ let backend = self.backend
+ var pending = targets[...]
+ while !pending.isEmpty {
+ let batch = pending.prefix(Self.healthConcurrency)
+ pending = pending.dropFirst(batch.count)
+ let results = await withTaskGroup(of: (String, AppMachinesViewHealth).self) { group in
+ for t in batch {
+ group.addTask {
+ let machine = t.target.isEmpty ? nil : t.target
+ let r = await withTimeout(seconds: Self.healthTimeout) {
+ try await backend.machineHealth(machine: machine)
+ }
+ switch r {
+ case .success(var h):
+ h.id = t.id
+ return (t.id, h)
+ case .failure(let error):
+ let why = (error as? TimeoutError) != nil
+ ? "it didn\u{2019}t answer within \(Int(Self.healthTimeout)) s"
+ : LiveSpacesBackend.words(error)
+ return (t.id, AppMachinesViewHealth(id: t.id, checks: [], cuaVersion: "", error: why))
+ }
+ }
+ }
+ var out: [(String, AppMachinesViewHealth)] = []
+ for await r in group { out.append(r) }
+ return out
+ }
+ for (id, h) in results where wanted.contains(id) { machineHealth[id] = h }
+ }
+ }
+
+ /// This Mac as the Machines page names it: its name, the app's
+ /// version and macOS's.
+ static let machinesAbout: AppMachinesViewAbout = {
+ let info = Bundle.main.infoDictionary ?? [:]
+ let v = ProcessInfo.processInfo.operatingSystemVersion
+ let os = v.patchVersion == 0 ? "macOS \(v.majorVersion).\(v.minorVersion)"
+ : "macOS \(v.majorVersion).\(v.minorVersion).\(v.patchVersion)"
+ return AppMachinesViewAbout(
+ computerName: Foundation.Host.current().localizedName ?? "",
+ appVersion: info["CuaVersion"] as? String ?? info["CFBundleShortVersionString"] as? String ?? "",
+ osVersion: os)
+ }()
+
+ /// Renames a machine from the Machines page: `this-mac` is this Mac's
+ /// own relay registration (its host setup takes the name too).
+ public func renameMachine(id: String, name: String) async throws {
+ guard let clean = appDevicesCleanName(name: name) else {
+ throw CuaError.InvalidArgument(message: "A machine needs a name")
+ }
+ let machine = id == "this-mac" ? host.machineId : id
+ guard let machine, let relay = devices.devices else {
+ throw CuaError.InvalidArgument(message: "Renaming a machine needs a signed-in, enrolled Mac")
+ }
+ try await relay.renameMachine(id: machine, name: clean)
+ await host.refresh()
+ await devices.refresh()
+ await refresh()
+ }
+
+ /// Remove from account: `machine` leaves the relay directory, then
+ /// `device` is revoked. This Mac's own host setup is the host's
+ /// `remove` instead.
+ public func removeMachine(machine: String?, device: String?) async throws {
+ if let machine { try await backend.relayUnregister(id: "relay:\(machine)") }
+ if let device {
+ guard let relay = devices.devices else {
+ throw CuaError.InvalidArgument(message: "Revoking a device needs a signed-in Cua account")
+ }
+ try await relay.revoke(id: device)
+ }
+ await devices.refresh()
+ await refresh()
}
/// What each machine sharing its desktop (`relay:<machine>`) reported
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppStartup.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppStartup.swift
index f529e7034b..0b9f9f5110 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppStartup.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppStartup.swift
@@ -631,6 +631,12 @@ public final class PendingSpacesBackend: SpacesBackend, AgentsToolRunning, Cloud
public func localStorage() async -> LocalStorage? { await b().localStorage() }
public func cloudAvailable() async -> Bool { await b().cloudAvailable() }
public func runningMacosVms() async -> Int? { await b().runningMacosVms() }
+ // The Machines page: Remove from account and each computer's health
+ // checks (the protocol's defaults would refuse them).
+ public func relayUnregister(id: String) async throws { try await b().relayUnregister(id: id) }
+ public func machineHealth(machine: String?) async throws -> AppMachinesViewHealth {
+ try await b().machineHealth(machine: machine)
+ }
public func cloudPricing() async -> AppCloudPricing? { await b().cloudPricing() }
public func teleportContext(id: String) async throws -> (CuaSpacesFFI.Teleport, CuaSDK.Space)? {
try await b().teleportContext(id: id)
@@ -738,6 +744,7 @@ public final class PendingDevices: DevicesRunning, @unchecked Sendable {
public func rename(id: String, name: String) async throws { try await d().rename(id: id, name: name) }
public func revoke(id: String) async throws { try await d().revoke(id: id) }
public func confirmMachine(id: String) async throws { try await d().confirmMachine(id: id) }
+ public func renameMachine(id: String, name: String) async throws { try await d().renameMachine(id: id, name: name) }
public func createPairingCode(team: String?) async throws -> PairingCode {
try await d().createPairingCode(team: team)
}
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/DevicesModel.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/DevicesModel.swift
index 0d06210513..73ff1cd4d2 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/DevicesModel.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/DevicesModel.swift
@@ -21,6 +21,9 @@ public protocol DevicesRunning: AnyObject, Sendable {
/// Vouches for a machine that registered without an enrolled device's
/// proof (S5), from this enrolled device.
func confirmMachine(id: String) async throws
+ /// Renames a relay machine the account owns, from this enrolled device;
+ /// this Mac's host setup takes the name when it is this Mac.
+ func renameMachine(id: String, name: String) async throws
/// A one-time link, QR code and install commands that add another
/// computer to the account (or to `team`), from this enrolled device.
func createPairingCode(team: String?) async throws -> PairingCode
@@ -72,6 +75,9 @@ public final class LiveDevices: DevicesRunning, @unchecked Sendable {
public func rename(id: String, name: String) async throws { _ = try await inner.rename(id: id, name: name) }
public func revoke(id: String) async throws { _ = try await inner.revoke(id: id) }
public func confirmMachine(id: String) async throws { _ = try await inner.confirmMachine(machineId: id) }
+ public func renameMachine(id: String, name: String) async throws {
+ _ = try await inner.renameMachine(machineId: id, name: name)
+ }
public func createPairingCode(team: String?) async throws -> PairingCode {
try await inner.createPairingCode(team: team, ttlSecs: nil)
}
@@ -136,10 +142,10 @@ public final class FixtureDevices: DevicesRunning, @unchecked Sendable {
machines: [
RelayMachine(id: "m1", spaceId: "relay:m1", name: "studio-mac", ownerId: "me",
ownerEmail: nil, role: "owner", online: true, sharing: true, version: "0.5.0",
- url: "", allow: [], clients: [], confirmed: true),
+ url: "", allow: [], clients: [], confirmed: true, team: nil, providesSpaces: true),
RelayMachine(id: "m2", spaceId: "relay:m2", name: "build-box", ownerId: "me",
ownerEmail: nil, role: "owner", online: false, sharing: true, version: "0.5.0",
- url: "", allow: [], clients: [], confirmed: false),
+ url: "", allow: [], clients: [], confirmed: false, team: nil, providesSpaces: nil),
])
}
@@ -181,6 +187,11 @@ public final class FixtureDevices: DevicesRunning, @unchecked Sendable {
for i in current.devices.indices where current.devices[i].id == id { current.devices[i].state = "revoked" }
}
+ public func renameMachine(id: String, name: String) async throws {
+ calls.append("rename-machine:\(id):\(name)")
+ for i in current.machines.indices where current.machines[i].id == id { current.machines[i].name = name }
+ }
+
public func confirmMachine(id: String) async throws {
calls.append("confirm-machine:\(id)")
for i in current.machines.indices where current.machines[i].id == id { current.machines[i].confirmed = true }
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/SpacesBackend.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/SpacesBackend.swift
index 91d50a91c6..00e0e18b81 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/SpacesBackend.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/SpacesBackend.swift
@@ -37,6 +37,15 @@ public protocol SpacesBackend: AnyObject, Sendable {
func add(url: String, token: String?, name: String?) async throws
/// Deletes a created Space, or forgets one added by address.
func remove(id: String, removeOnly: Bool) async throws
+ /// Takes one of your machines (`relay:<machine>`) off the relay
+ /// directory (`Spaces.relay_unregister`): Remove from account on the
+ /// Machines page. The relay refuses one that is online.
+ func relayUnregister(id: String) async throws
+ /// A machine's health as its own cua daemon checks it
+ /// (`Spaces.machine_health`): `nil` for this Mac, else another of your
+ /// machines by id, asked over the relay or mesh. The Machines page
+ /// shows its warnings and failures as the machine's issues.
+ func machineHealth(machine: String?) async throws -> AppMachinesViewHealth
/// Turns a Space off (`on` false: suspended or stopped, as its provider
/// can) or back on (`stop_space` / `start_space`).
func setPower(id: String, on: Bool) async throws
@@ -120,6 +129,12 @@ public extension SpacesBackend {
throw FixtureError(message: "This Space's runs can't be read here")
}
func lumeSource() async -> String? { nil }
+ func relayUnregister(id: String) async throws {
+ throw FixtureError(message: "Machines can't be removed here")
+ }
+ func machineHealth(machine: String?) async throws -> AppMachinesViewHealth {
+ throw FixtureError(message: "Machines can't be checked here")
+ }
func runningMacosVms() async -> Int? { nil }
func setLumeSource(_ value: String) async throws {}
func linuxSource() async -> String? { nil }
@@ -303,6 +318,21 @@ public final class LiveSpacesBackend: SpacesBackend, @unchecked Sendable {
_ = try await cua.spaces().add(url: url, token: token, name: name)
}
+ public func relayUnregister(id: String) async throws {
+ _ = try await cua.spaces().relayUnregister(space: id)
+ }
+
+ public func machineHealth(machine: String?) async throws -> AppMachinesViewHealth {
+ let h = try await cua.spaces().machineHealth(machine: machine)
+ return AppMachinesViewHealth(
+ id: "",
+ checks: h.checks.map {
+ AppMachinesViewCheck(id: $0.id, status: $0.status, message: $0.message,
+ remediation: $0.remediation, facts: $0.facts)
+ },
+ cuaVersion: h.cuaVersion, error: nil)
+ }
+
public func remove(id: String, removeOnly: Bool) async throws {
if removeOnly {
try await cua.spaces().remove(space: id)
@@ -652,6 +682,29 @@ public final class FixtureSpacesBackend: SpacesBackend, @unchecked Sendable {
public private(set) var removed: [String] = []
/// The ids of those that were only forgotten (Remove from List).
public private(set) var forgotten: [String] = []
+ /// The machines taken off the relay (Remove from account).
+ public private(set) var unregistered: [String] = []
+
+ public func relayUnregister(id: String) async throws {
+ await MainActor.run {
+ unregistered.append(id)
+ fixtureRows.removeAll { $0.id == id }
+ }
+ }
+
+ /// What `machineHealth` answers, by machine (`""` for this Mac); a
+ /// machine without an entry has no issues.
+ public var fixtureHealth: [String: AppMachinesViewHealth] = [:]
+ /// The machines `machineHealth` was asked about (`""` for this Mac).
+ public private(set) var healthChecked: [String] = []
+
+ public func machineHealth(machine: String?) async throws -> AppMachinesViewHealth {
+ let key = machine ?? ""
+ return await MainActor.run {
+ healthChecked.append(key)
+ return fixtureHealth[key] ?? AppMachinesViewHealth(id: "", checks: [], cuaVersion: "", error: nil)
+ }
+ }
/// The fixture cloud is connected (`cloud_connect` ran).
public var fixtureCloudConnected = false
/// The cloud tools called, in order.
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/MachinesViews.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/MachinesViews.swift
index 04ebbf29a6..42e8d74e86 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/MachinesViews.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/MachinesViews.swift
@@ -4,194 +4,589 @@
import CuaSpacesFFI
import SwiftUI
-/// Machines: This machine, your other machines and your devices, each
-/// computer once; the selected one's page beside them (This machine's own
-/// page, a machine's detail with the Spaces it provides, or a device's
-/// page). The rows are the core's (`AppModel.machinePageRows`,
-/// `machines::page_rows`), the same the New UI lists.
+/// Machines: the hardware. The list in groups (your machines, those
+/// offline for 30+ days, team machines) with one line each, and the
+/// selected machine's page: its two switches, the Spaces on it as links,
+/// New Space here, Details and Remove from account. Everything shown is
+/// the core's `machines_view::view` (`AppModel.machinesView`), the same the
+/// New UI draws. A Space's own actions (open, start, stop, teleport, drop
+/// files) stay on the Space.
struct MachinesPageView: View {
@Bindable var model: AppModel
@State private var selectedId: String?
+ /// `selected`: the machine whose page shows first (default: the first).
+ init(model: AppModel, selected: String? = nil) {
+ self.model = model
+ _selectedId = State(initialValue: selected)
+ }
+ @State private var query = ""
+ @State private var oldOpen = false
+ @State private var removingOld: AppMachinesViewRemoveAll?
+ @State private var failure: String?
+
var body: some View {
- let rows = model.machinePageRows
- let selected = rows.first { $0.id == selectedId } ?? rows.first
+ let view = model.machinesView
+ let selected = view.machines.first { $0.id == selectedId } ?? view.machines.first
HStack(spacing: 0) {
VStack(alignment: .leading, spacing: 0) {
+ searchField
List(selection: $selectedId) {
- ForEach(rows, id: \.id) { row in
- MachineRowView(row: row, status: status(row))
- .tag(row.id)
+ ForEach(view.groups, id: \.id) { group in
+ groupSection(group, view: view)
}
}
- .listStyle(.inset)
+ .listStyle(.sidebar)
.accessibilityIdentifier("machines-list")
- if rows.count <= 1 {
- Text("Only this computer so far. Add another to run Spaces on it from here.")
- .font(.callout)
- .foregroundStyle(.secondary)
- .padding(12)
- }
}
.frame(width: 300)
Divider()
Group {
- if let row = selected {
- if row.current {
- ThisMachineView(host: model.host)
- } else if let id = row.spaceId, let space = model.spaces.first(where: { $0.id == id }) {
- SpaceDetailView(model: model, space: space)
- .id(space.id)
- } else {
- MachineInfoView(model: model, row: row, status: status(row))
- .id(row.id)
- }
+ if let machine = selected {
+ MachinePage(model: model, machine: machine, onError: { failure = $0 })
+ .id(machine.id)
} else {
ContentUnavailableView {
Label("No computers yet", systemImage: "server.rack")
} description: {
- Text("Set up a Mac, Linux or Windows computer for access and it shows here, ready to run Spaces.")
+ Text("Set up a Mac, Linux or Windows computer and it shows here, ready to run Spaces.")
}
}
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
.navigationTitle("Computers")
+ .navigationSubtitle(view.machines.isEmpty ? "" : view.summary)
+ // Each machine's own daemon checks its health while the page shows
+ // (This Mac, and your other machines that are online).
+ .task {
+ while !Task.isCancelled {
+ await model.checkMachineHealth()
+ try? await Task.sleep(for: .seconds(60))
+ }
+ }
.toolbar {
ToolbarItem(placement: .primaryAction) {
Button {
Task { await model.openAddMachine() }
} label: {
- Label("Add a computer", systemImage: "plus.rectangle.on.rectangle")
+ Label("Add a computer", systemImage: "plus")
}
.help("Add a computer")
.accessibilityIdentifier("machines-add")
}
}
+ .alert(removingOld?.confirm.title ?? "", isPresented: Binding(
+ get: { removingOld != nil }, set: { if !$0 { removingOld = nil } })) {
+ if let all = removingOld {
+ Button(all.confirm.confirmLabel, role: .destructive) {
+ removingOld = nil
+ Task {
+ for r in all.removes {
+ do {
+ try await model.removeMachine(machine: r.machine, device: r.device)
+ } catch {
+ failure = LiveSpacesBackend.words(error)
+ return
+ }
+ }
+ }
+ }
+ Button(all.confirm.cancelLabel, role: .cancel) { removingOld = nil }
+ }
+ } message: {
+ Text(removingOld?.confirm.message ?? "")
+ }
+ .alert("Couldn\u{2019}t change the machine", isPresented: Binding(
+ get: { failure != nil }, set: { if !$0 { failure = nil } })) {
+ Button("OK") { failure = nil }
+ } message: {
+ Text(failure ?? "")
+ }
+ }
+
+ private var searchField: some View {
+ HStack(spacing: 6) {
+ Image(systemName: "magnifyingglass").foregroundStyle(.secondary)
+ TextField("Search machines", text: $query)
+ .textFieldStyle(.plain)
+ .accessibilityIdentifier("machines-search")
+ }
+ .padding(.horizontal, 8)
+ .frame(height: 28)
+ .background(.background, in: .rect(cornerRadius: 7))
+ .overlay(RoundedRectangle(cornerRadius: 7).strokeBorder(.separator))
+ .padding(.horizontal, 12)
+ .padding(.top, 12)
+ .padding(.bottom, 4)
}
- /// The row's second line: the device's platform, state and last
- /// session for a device of its own, else the core's status word
- /// (`machines::status_word`: "Online", "Not sharing", "Offline"), the
- /// same the New UI shows. Never a Space's word ("Suspended").
- private func status(_ row: AppMachinePageRow) -> String {
- if row.deviceOnly, let d = model.devices.view.rows.first(where: { $0.id == row.device }) {
- return model.devices.rowDetail(d)
+ private func matches(_ m: AppMachinesViewMachine) -> Bool {
+ let q = query.trimmingCharacters(in: .whitespaces).lowercased()
+ return q.isEmpty || "\(m.name) \(m.line)".lowercased().contains(q)
+ }
+
+ @ViewBuilder
+ private func groupSection(_ group: AppMachinesViewGroup, view: AppMachinesView) -> some View {
+ let rows = group.ids.compactMap { id in view.machines.first { $0.id == id } }.filter(matches)
+ if !rows.isEmpty {
+ let open = !group.collapsed || oldOpen || !query.isEmpty
+ Section {
+ if open {
+ ForEach(rows, id: \.id) { m in
+ MachineRowView(machine: m).tag(m.id)
+ }
+ }
+ } header: {
+ if group.collapsed {
+ HStack {
+ Button {
+ oldOpen.toggle()
+ } label: {
+ Label(group.title, systemImage: open ? "chevron.down" : "chevron.right")
+ }
+ .buttonStyle(.plain)
+ .accessibilityIdentifier("machines-group-\(group.id)")
+ Spacer()
+ if let all = group.removeAll {
+ Button(all.label) { removingOld = all }
+ .buttonStyle(.link)
+ .font(.caption)
+ .accessibilityIdentifier("machines-remove-old")
+ }
+ }
+ } else {
+ Text(group.title).accessibilityIdentifier("machines-group-\(group.id)")
+ }
+ }
}
- return row.status
}
}
-/// The OS mark for a page row's system (`os-macos`, ..., `computer`).
+/// The OS mark for a machine's system (`os-macos`, ..., `computer`).
private func osIcon(_ os: String) -> String { os.isEmpty ? "computer" : "os-\(os)" }
-/// One machine: its OS mark, name, status line and how many Spaces it runs
-/// (the core's `spacesLabel`, none for a device of its own).
+/// The green dot of a machine that can be used now, grey otherwise;
+/// orange or red while it has issues (`health` `warn`, `fail`).
+private struct StatusDot: View {
+ let online: Bool
+ var health: String = ""
+ var size: CGFloat = 8
+ var body: some View {
+ Circle().fill(color).frame(width: size, height: size)
+ }
+
+ private var color: Color {
+ switch health {
+ case "fail": .red
+ case "warn": .orange
+ default: online ? .green : .secondary.opacity(0.5)
+ }
+ }
+}
+
+/// One machine: its dot, name ("This Mac" beside this one), its one line,
+/// and its system's mark.
struct MachineRowView: View {
- let row: AppMachinePageRow
- let status: String
+ let machine: AppMachinesViewMachine
var body: some View {
HStack(spacing: 10) {
- OsIconImage(id: osIcon(row.os), size: 16)
- .foregroundStyle(.secondary)
- .frame(width: 30, height: 30)
- .background(.fill.tertiary, in: .rect(cornerRadius: 7))
- VStack(alignment: .leading, spacing: 2) {
- HStack(spacing: 4) {
- Text(row.name).lineLimit(1)
- if row.current {
- Text("(this computer)").foregroundStyle(.secondary)
+ StatusDot(online: machine.online, health: machine.health)
+ VStack(alignment: .leading, spacing: 1) {
+ HStack(spacing: 6) {
+ Text(machine.name).fontWeight(.medium).lineLimit(1)
+ if let badge = machine.badge {
+ Text(badge)
+ .font(.caption2.weight(.medium))
+ .foregroundStyle(.secondary)
+ .padding(.horizontal, 5)
+ .padding(.vertical, 1)
+ .background(.fill.tertiary, in: .rect(cornerRadius: 4))
}
}
- Text(status)
+ Text(machine.line)
.font(.callout)
.foregroundStyle(.secondary)
.lineLimit(1)
+ .accessibilityIdentifier("machine-line")
}
Spacer(minLength: 4)
- if !row.spacesLabel.isEmpty {
- Text(row.spacesLabel)
- .font(.callout.monospacedDigit())
- .foregroundStyle(.secondary)
- }
+ OsIconImage(id: osIcon(machine.os), size: 14).foregroundStyle(.tertiary)
}
- .padding(.vertical, 3)
- .opacity(row.online ? 1 : 0.6)
+ .padding(.vertical, 2)
+ .accessibilityElement(children: .combine)
.accessibilityIdentifier("machine-row")
}
}
-/// A machine without a desktop row here: one of your devices that is not
-/// set up for access, or a machine known only by the Spaces it provides.
-/// Its name, whether it is online, its last session, the Spaces it
-/// provides, and Revoke for a device.
-struct MachineInfoView: View {
+/// A machine's page: name and rename, status, the two switches, the Spaces
+/// on it, New Space here, Details and Remove from account.
+struct MachinePage: View {
@Bindable var model: AppModel
- let row: AppMachinePageRow
- let status: String
- @State private var revoking: AppDeviceRow?
+ let machine: AppMachinesViewMachine
+ let onError: (String) -> Void
+ @State private var renaming = false
+ @State private var newName = ""
+ @State private var removing: AppMachinesViewRemove?
+ @State private var detailsOpen = false
+ @State private var fullLog: HostLog?
+
+ private var host: HostModel { model.host }
var body: some View {
- let device = model.devices.view.rows.first { $0.id == row.device }
- let hosted = row.deviceOnly ? [] : model.hostedRows("relay:\(row.id)")
- Form {
- Section {
- LabeledContent("Status", value: row.status)
- if !row.os.isEmpty {
- LabeledContent("System", value: device?.platform.isEmpty == false ? device!.platform : row.os)
+ if machine.current, host.form != nil {
+ // This Mac's setup form takes the page while it shows.
+ HostFormView(host: host)
+ } else {
+ page
+ }
+ }
+
+ private var page: some View {
+ let m = machine
+ let panel = host.panel
+ return ScrollView {
+ VStack(alignment: .leading, spacing: 0) {
+ HStack(spacing: 6) {
+ Text(m.name).font(.title2.weight(.semibold)).lineLimit(1).textSelection(.enabled)
+ if let r = m.rename {
+ Button {
+ newName = m.name
+ renaming = true
+ } label: {
+ Image(systemName: "pencil")
+ }
+ .buttonStyle(.borderless)
+ .help(r.title)
+ .accessibilityLabel(r.title)
+ .accessibilityIdentifier("machine-rename")
+ }
}
- if let seen = row.lastSeen {
- LabeledContent("Last seen", value: model.devices.relativeText(seen))
+ HStack(spacing: 6) {
+ StatusDot(online: m.online, size: 7)
+ Text(m.status)
+ if let by = m.sharedBy {
+ Text("\u{b7}").foregroundStyle(.tertiary)
+ Text(by)
+ }
}
- if row.deviceOnly {
- LabeledContent("Access", value: "Not set up for access")
+ .foregroundStyle(.secondary)
+ .padding(.top, 4)
+ .accessibilityIdentifier("machine-status")
+
+ if !m.issues.isEmpty {
+ Text(m.issuesTitle)
+ .font(.callout.weight(.semibold))
+ .foregroundStyle(.secondary)
+ .padding(.top, 22)
+ .padding(.bottom, 8)
+ card {
+ ForEach(Array(m.issues.enumerated()), id: \.element.id) { i, issue in
+ if i > 0 { Divider() }
+ issueRow(issue)
+ }
+ }
+ .accessibilityIdentifier("machine-issues")
}
- } header: {
- HStack(spacing: 10) {
- OsIconImage(id: osIcon(row.os), size: 18)
+
+ card {
+ if let notice = m.notice {
+ HStack(spacing: 8) {
+ Image(systemName: "info.circle")
+ Text(notice).fixedSize(horizontal: false, vertical: true)
+ Spacer(minLength: 8)
+ if m.current, let action = m.noticeAction {
+ Button(action.label) { Task { await host.run(action.id) } }
+ .disabled(host.busy || !action.enabled)
+ }
+ }
+ .font(.callout)
.foregroundStyle(.secondary)
- VStack(alignment: .leading, spacing: 2) {
- Text(row.name).font(.title3.weight(.semibold))
- Text(status).font(.callout).foregroundStyle(.secondary)
+ .padding(.horizontal, 16)
+ .padding(.vertical, 10)
+ .accessibilityIdentifier("machine-notice")
+ Divider()
+ }
+ ForEach(Array(m.toggles.enumerated()), id: \.element.id) { i, t in
+ if i > 0 { Divider() }
+ toggleRow(t, dimmed: !t.editable && m.togglesNote == nil)
+ }
+ if let note = m.togglesNote {
+ Divider()
+ Label(note, systemImage: m.team ? "person.2" : "lock")
+ .font(.callout)
+ .foregroundStyle(.secondary)
+ .padding(.horizontal, 16)
+ .padding(.vertical, 9)
+ .accessibilityIdentifier("machine-toggles-note")
}
}
- .padding(.bottom, 6)
- }
- if !hosted.isEmpty {
- Section("Spaces") {
- ForEach(hosted, id: \.id) { s in
- LabeledContent(s.name, value: s.statusText)
+ .padding(.top, 22)
+
+ if m.current {
+ // What needs the owner now: permissions to grant, a
+ // switch that failed.
+ if panel.permissionsTitle != nil || host.actionFailure != nil {
+ VStack(alignment: .leading, spacing: 8) {
+ if let title = panel.permissionsTitle {
+ Text(title).font(.callout.weight(.semibold)).foregroundStyle(.secondary)
+ card {
+ PermissionRows(rows: panel.permissions, openLabel: panel.openSettingsLabel)
+ .padding(.horizontal, 16).padding(.vertical, 8)
+ }
+ }
+ if let failure = host.actionFailure {
+ HostSetupFailureView(failure: failure, retrying: host.busy) {
+ Task { await host.retryFailedAction() }
+ }
+ }
+ }
+ .padding(.top, 20)
+ }
+ if let progress = host.progress {
+ HostSetupProgressView(text: progress).padding(.top, 12)
+ }
+ }
+
+ Text(m.spacesTitle)
+ .font(.callout.weight(.semibold))
+ .foregroundStyle(.secondary)
+ .padding(.top, 28)
+ .padding(.bottom, 8)
+ card {
+ ForEach(Array(m.spaces.enumerated()), id: \.element.id) { i, s in
+ if i > 0 { Divider() }
+ Button {
+ model.select(s.id)
+ } label: {
+ HStack(spacing: 8) {
+ Text(s.name).font(.system(.callout, design: .monospaced)).lineLimit(1)
+ if !s.os.isEmpty {
+ Text("\u{b7}").foregroundStyle(.tertiary)
+ Text(s.os).foregroundStyle(.secondary).lineLimit(1)
+ }
+ Spacer(minLength: 8)
+ StatusDot(online: s.running, size: 7)
+ Text(s.status).font(.callout).foregroundStyle(.secondary)
+ Image(systemName: "chevron.right").font(.caption).foregroundStyle(.tertiary)
+ }
+ .contentShape(Rectangle())
+ .padding(.horizontal, 16)
+ .padding(.vertical, 10)
+ }
+ .buttonStyle(.plain)
+ .help("Open \(s.name)")
+ .accessibilityIdentifier("machine-space-\(s.id)")
+ }
+ if let empty = m.spacesEmpty {
+ Text(empty).font(.callout).foregroundStyle(.secondary)
+ .padding(.horizontal, 16).padding(.vertical, 12)
}
+ Divider()
+ HStack {
+ Button {
+ Task { await model.openNewSpace(on: m.newSpace.on) }
+ } label: {
+ Label(m.newSpace.label, systemImage: "plus")
+ }
+ .disabled(!m.newSpace.enabled)
+ .help(m.newSpace.help ?? "")
+ .accessibilityIdentifier("machine-new-space")
+ Spacer()
+ }
+ .padding(.horizontal, 12)
+ .padding(.vertical, 10)
+ }
+
+ DisclosureGroup(isExpanded: $detailsOpen) {
+ VStack(alignment: .leading, spacing: 16) {
+ card {
+ ForEach(Array(m.details.enumerated()), id: \.element.label) { i, f in
+ if i > 0 { Divider() }
+ HStack(alignment: .firstTextBaseline) {
+ Text(f.label).foregroundStyle(.secondary).frame(width: 140, alignment: .leading)
+ Text(f.value).textSelection(.enabled)
+ Spacer()
+ }
+ .padding(.horizontal, 16)
+ .padding(.vertical, 9)
+ }
+ }
+ if m.current { logs(panel) }
+ }
+ .padding(.top, 8)
+ } label: {
+ Text(m.detailsTitle).font(.callout.weight(.semibold)).foregroundStyle(.secondary)
+ }
+ .padding(.top, 24)
+ .accessibilityIdentifier("machine-details")
+
+ if let r = m.remove {
+ Button(r.label, role: .destructive) { removing = r }
+ .buttonStyle(.borderless)
+ .foregroundStyle(.red)
+ .disabled(!r.enabled)
+ .help(r.help ?? "")
+ .padding(.top, 28)
+ .accessibilityIdentifier("machine-remove")
}
}
- if row.deviceOnly {
- Section {
- Text("To run Spaces or share its desktop, run `cua host setup` on it.")
- .foregroundStyle(.secondary)
+ .frame(maxWidth: 620, alignment: .leading)
+ .padding(.horizontal, 36)
+ .padding(.vertical, 28)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ }
+ .alert(m.rename?.title ?? "", isPresented: $renaming) {
+ TextField("Name", text: $newName)
+ Button(m.rename?.confirmLabel ?? "Rename") { rename() }
+ Button("Cancel", role: .cancel) {}
+ }
+ .alert(removing?.confirm.title ?? "", isPresented: Binding(
+ get: { removing != nil }, set: { if !$0 { removing = nil } })) {
+ if let r = removing {
+ Button(r.confirm.confirmLabel, role: .destructive) {
+ removing = nil
+ remove(r)
}
+ Button(r.confirm.cancelLabel, role: .cancel) { removing = nil }
}
- if let device, device.actions.contains(.revoke) {
- Section {
- Button(model.devices.view.labels.revoke, role: .destructive) { revoking = device }
- .disabled(model.devices.busy)
- .accessibilityIdentifier("machine-revoke")
+ } message: {
+ Text(removing?.confirm.message ?? "")
+ }
+ .sheet(item: $fullLog) { log in
+ switch log {
+ case .access:
+ HostLogSheet(title: panel.recentTitle ?? "", rows: panel.recentAll,
+ backgroundRows: panel.recentWithBackground) { fullLog = nil }
+ case .activity:
+ HostLogSheet(title: panel.activityTitle ?? "", rows: panel.activityAll,
+ backgroundRows: nil) { fullLog = nil }
+ }
+ }
+ .accessibilityIdentifier("machine-page")
+ }
+
+ /// A rounded card, as the page's groups are drawn.
+ private func card<Content: View>(@ViewBuilder _ content: () -> Content) -> some View {
+ VStack(alignment: .leading, spacing: 0, content: content)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .background(.background.secondary, in: .rect(cornerRadius: 10))
+ .overlay(RoundedRectangle(cornerRadius: 10).strokeBorder(.separator))
+ }
+
+ private func toggleRow(_ t: AppMachinesViewToggle, dimmed: Bool) -> some View {
+ HStack(spacing: 20) {
+ VStack(alignment: .leading, spacing: 1) {
+ Text(t.label).fontWeight(.medium)
+ Text(t.help).font(.callout).foregroundStyle(.secondary)
+ }
+ .opacity(dimmed ? 0.5 : 1)
+ Spacer()
+ Toggle(t.label, isOn: Binding(get: { t.on }, set: { _ in flip(t) }))
+ .labelsHidden()
+ .toggleStyle(.switch)
+ .disabled(!t.editable || !t.enabled || host.busy)
+ }
+ .padding(.horizontal, 16)
+ .padding(.vertical, 14)
+ .accessibilityIdentifier("machine-toggle-\(t.id)")
+ }
+
+ /// One issue: its mark, one sentence, and its fix when there is one
+ /// here (a System Settings pane, or This Mac's host action).
+ private func issueRow(_ issue: AppMachinesViewIssue) -> some View {
+ HStack(alignment: .firstTextBaseline, spacing: 10) {
+ Image(systemName: issue.level == "fail" ? "xmark.octagon.fill" : "exclamationmark.triangle.fill")
+ .foregroundStyle(issue.level == "fail" ? Color.red : Color.orange)
+ .accessibilityLabel(issue.level == "fail" ? "Problem" : "Warning")
+ Text(issue.text).fixedSize(horizontal: false, vertical: true)
+ Spacer(minLength: 12)
+ if let action = issue.action {
+ Button(action.label) { fix(action) }
+ .buttonStyle(.bordered)
+ .controlSize(.small)
+ .disabled(action.hostAction != nil && (!machine.current || host.busy))
+ .accessibilityIdentifier("machine-issue-fix-\(issue.id)")
+ }
+ }
+ .padding(.horizontal, 16)
+ .padding(.vertical, 10)
+ .accessibilityIdentifier("machine-issue-\(issue.id)")
+ }
+
+ private func fix(_ action: AppMachinesViewIssueAction) {
+ if let url = action.url {
+ PermissionRows.open(url)
+ } else if let id = action.hostAction, machine.current {
+ Task {
+ await host.run(id)
+ await model.checkMachineHealth()
+ }
+ }
+ }
+
+ /// This Mac's switch: its actions in order, or the setup form.
+ private func flip(_ t: AppMachinesViewToggle) {
+ if let profile = t.setup {
+ host.openForm()
+ host.send(.setProfile(profile: profile))
+ return
+ }
+ Task { for a in t.actions { await host.run(a) } }
+ }
+
+ @ViewBuilder
+ private func logs(_ panel: AppHostPanelView) -> some View {
+ if let title = panel.recentTitle, !panel.recent.isEmpty {
+ VStack(alignment: .leading, spacing: 6) {
+ Text(title).font(.callout.weight(.semibold)).foregroundStyle(.secondary)
+ card {
+ TimedRows(rows: panel.recent).padding(.horizontal, 16).padding(.vertical, 6)
}
+ if let more = panel.recentMore { ShowAllButton(label: more) { fullLog = .access } }
}
}
- .formStyle(.grouped)
- .accessibilityIdentifier("machine-info")
- .alert(revoking?.revokeConfirm?.title ?? "", isPresented: Binding(get: { revoking?.revokeConfirm != nil },
- set: { if !$0 { revoking = nil } })) {
- if let r = revoking, let c = r.revokeConfirm {
- Button(c.confirmLabel, role: .destructive) {
- revoking = nil
- Task { await model.devices.revoke(id: r.id) }
+ if let title = panel.activityTitle, !panel.activity.isEmpty {
+ VStack(alignment: .leading, spacing: 6) {
+ Text(title).font(.callout.weight(.semibold)).foregroundStyle(.secondary)
+ card {
+ TimedRows(rows: panel.activity).padding(.horizontal, 16).padding(.vertical, 6)
}
- Button(c.cancelLabel, role: .cancel) { revoking = nil }
+ if let more = panel.activityMore { ShowAllButton(label: more) { fullLog = .activity } }
+ }
+ }
+ }
+
+ private func rename() {
+ guard let r = machine.rename else { return }
+ let name = newName.trimmingCharacters(in: .whitespacesAndNewlines)
+ guard !name.isEmpty, name != machine.name else { return }
+ Task {
+ if r.target == "device" {
+ await model.devices.rename(id: r.id, to: name)
+ await model.refresh()
+ return
+ }
+ do {
+ try await model.renameMachine(id: r.id, name: name)
+ } catch {
+ onError(LiveSpacesBackend.words(error))
+ }
+ }
+ }
+
+ private func remove(_ r: AppMachinesViewRemove) {
+ Task {
+ if r.host {
+ await host.run(.remove)
+ return
+ }
+ do {
+ try await model.removeMachine(machine: r.machine, device: r.device)
+ } catch {
+ onError(LiveSpacesBackend.words(error))
}
- } message: {
- Text(revoking?.revokeConfirm?.message ?? "")
}
}
}
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge+Pages.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge+Pages.swift
index 93cb949610..6356d2fe70 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge+Pages.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge+Pages.swift
@@ -153,6 +153,22 @@ extension WebUIBridge {
// daemon's per-Space numbers join them once it serves `resources`.
case "resources.get":
return HostResourceSampler.shared.sample().snapshot()
+ // The Machines page: rename a machine, Remove from account (what
+ // each does to which machine is the core's `machines_view`).
+ case "machines.rename":
+ try await model.renameMachine(id: try string(args, "id"), name: try string(args, "name"))
+ return NSNull()
+ case "machines.remove":
+ let machine = (args["machine"] as? String).flatMap { $0.isEmpty ? nil : $0 }
+ let device = (args["device"] as? String).flatMap { $0.isEmpty ? nil : $0 }
+ guard machine != nil || device != nil else { throw Failure.badArgs("machine or device") }
+ try await model.removeMachine(machine: machine, device: device)
+ return NSNull()
+ // Each machine's own daemon checks its health; the next
+ // `machines.list` view carries the issues.
+ case "machines.checkHealth":
+ await model.checkMachineHealth()
+ return NSNull()
// Settings, Storage
case "storage.get":
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swift
index 0150ea2604..71a77afd08 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swift
@@ -116,6 +116,9 @@ final class WebUIBridge: NSObject, WKScriptMessageHandlerWithReply {
"nudges.pending", "nudges.answer",
// Processor, memory and disk (WebUIBridge+Pages.swift).
"resources.get",
+ // The Machines page's rename, Remove from account and each machine's
+ // health checks (WebUIBridge+Pages.swift).
+ "machines.rename", "machines.remove", "machines.checkHealth",
// The getting-started checklist: the app's one copy (`ChecklistModel`).
"checklist.get", "checklist.send",
]
@@ -483,6 +486,9 @@ final class WebUIBridge: NSObject, WKScriptMessageHandlerWithReply {
// The page's rows as the core lists them (`machines::page_rows`,
// what the native Machines page shows).
"rows": BridgeValue.encode(model.machinePageRows),
+ // The page as the core draws it (`machines_view::view`, what the
+ // native Machines page shows).
+ "view": BridgeValue.encode(model.machinesView),
]
}
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/BridgeContractTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/BridgeContractTests.swift
index cfda904d46..873f027f2e 100644
--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/BridgeContractTests.swift
+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/BridgeContractTests.swift
@@ -285,6 +285,9 @@ struct BridgeContractTests {
"volume.reveal": "opens Finder", "loginItem.openSettings": "opens System Settings",
"devices.approve": "asks for presence", "devices.rename": "changes the fixture account",
"devices.revoke": "changes the fixture account", "devices.confirmMachine": "changes the fixture account",
+ "machines.rename": "changes the fixture account; MachinesViewTests covers it",
+ "machines.remove": "changes the fixture account; MachinesViewTests covers it",
+ "machines.checkHealth": "asks each machine's daemon; MachinesViewTests covers it",
"stream.pip": "opens a picture-in-picture window",
"keyvault.delete": "asks in an alert; TeleportBridgeTests answers it",
"keyvault.unlock": "asks for Touch ID", "keyvault.unlockVault": "asks for Touch ID or a passphrase in a sheet",
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/DevicesTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/DevicesTests.swift
index 4c3bbfc980..8700f5092b 100644
--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/DevicesTests.swift
+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/DevicesTests.swift
@@ -228,6 +228,7 @@ final class RelayAnswering: DevicesRunning, @unchecked Sendable {
func rename(id: String, name: String) async throws { try await fixture.rename(id: id, name: name) }
func revoke(id: String) async throws { try await fixture.revoke(id: id) }
func confirmMachine(id: String) async throws { try await fixture.confirmMachine(id: id) }
+ func renameMachine(id: String, name: String) async throws { try await fixture.renameMachine(id: id, name: name) }
func createPairingCode(team: String?) async throws -> PairingCode { try await fixture.createPairingCode(team: team) }
func pairingCodes() async throws -> [PairingCode] { try await fixture.pairingCodes() }
func revokePairingCode(id: String) async throws { try await fixture.revokePairingCode(id: id) }
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/MachinesViewTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/MachinesViewTests.swift
new file mode 100644
index 0000000000..6be2588b65
--- /dev/null
+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/MachinesViewTests.swift
@@ -0,0 +1,198 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+import CuaSDK
+import CuaSpacesFFI
+@testable import CuaSpacesMacKit
+import Foundation
+import Testing
+
+/// The Machines page (CUA-1673): the core's `machines_view::view`, which
+/// the classic page and the New UI both draw. Its parity frames replayed
+/// through the Swift binding, the app's own view, and the bridge's rename
+/// and Remove from account.
+extension ParityTests {
+ /// The `views` of `parity/machines.json` drawn here equal the golden's
+ /// view frames (`parity.rs`'s `view_frame`), word for word.
+ @Test("machines views") func machinesViews() throws {
+ let flow = try json(Self.dir.appendingPathComponent("machines.json"))
+ let golden = try json(Self.dir.appendingPathComponent("golden/machines.json"))
+ let want = ((golden["frames"] as? [[String: Any]]) ?? []).filter { $0["view"] != nil }
+ let views = flow["views"] as! [[String: Any]]
+ #expect(want.count == views.count && !views.isEmpty)
+ for (v, w) in zip(views, want) {
+ let view = appMachinesView(input: try appMachinesViewInputFromJson(json: text(v["input"])))
+ let got = Self.viewFrame(v["name"] as! String, view)
+ #expect(canonical(got) == canonical(w), "\(v["name"] as! String)")
+ }
+ }
+
+ /// A host action as the core's JSON names it (`provide-spaces`).
+ static func wire(_ a: AppHostActionId) -> String {
+ String(describing: a).map { $0.isUppercase ? "-\($0.lowercased())" : String($0) }.joined()
+ }
+
+ static func viewFrame(_ name: String, _ v: AppMachinesView) -> [String: Any] {
+ let byId = Dictionary(uniqueKeysWithValues: v.machines.map { ($0.id, $0) })
+ let groups: [[String: Any]] = v.groups.map { g in
+ var title = g.title
+ if g.collapsed { title += " (collapsed)" }
+ if let all = g.removeAll { title += " \u{b7} \(all.label)" }
+ let rows = g.ids.compactMap { byId[$0] }.map { m in
+ "\(m.online ? "\u{25cf}" : "\u{25cb}") \(m.name)\(m.badge.map { " [\($0)]" } ?? "") \u{2014} \(m.line)"
+ + (m.health.isEmpty ? "" : " [\(m.health)]")
+ }
+ return ["group": title, "rows": rows]
+ }
+ let pages: [[String]] = v.machines.map { m in
+ var lines: [String] = []
+ var head = "\(m.name) \u{2014} \(m.status)"
+ if let by = m.sharedBy { head += " \u{b7} \(by)" }
+ if let r = m.rename { head += " (rename: \(r.target))" }
+ lines.append(head)
+ for i in m.issues {
+ lines.append("\(m.issuesTitle.lowercased()) \(i.level): \(i.text)\(i.action.map { " [\($0.label)]" } ?? "")")
+ }
+ if let n = m.notice { lines.append("notice: \(n)\(m.noticeAction.map { " [\($0.label)]" } ?? "")") }
+ for t in m.toggles {
+ let how = !t.editable ? "read-only" : !t.enabled ? "disabled"
+ : t.setup.map { "sets up: \($0)" } ?? "runs: \(t.actions.map(wire).joined(separator: ", "))"
+ lines.append("\(t.label): \(t.on ? "on" : "off") (\(how))")
+ }
+ if let note = m.togglesNote { lines.append("note: \(note)") }
+ for s in m.spaces { lines.append("space \(s.name) \u{b7} \(s.os) \u{b7} \(s.status) -> \(s.id)") }
+ if let e = m.spacesEmpty { lines.append("spaces: \(e)") }
+ let ns = m.newSpace
+ lines.append("\(ns.label) on \(ns.on)\(ns.enabled ? "" : " (disabled: \(ns.help ?? ""))")")
+ lines.append("details: " + m.details.map { "\($0.label): \($0.value)" }.joined(separator: "; "))
+ if let r = m.remove {
+ let what = r.host ? "host setup" : [r.machine, r.device].compactMap { $0 }.joined(separator: " + ")
+ let state = !r.enabled ? r.help.map { " (disabled: \($0))" } ?? "" : ""
+ lines.append("\(r.label) -> \(what)\(state)")
+ }
+ return lines
+ }
+ return ["view": name, "summary": v.summary, "groups": groups, "pages": pages]
+ }
+}
+
+@MainActor
+@Suite("Machines page")
+struct MachinesViewTests {
+ /// A model signed in, with the fixture account's devices and machines read.
+ private func signedInModel(backend: FixtureSpacesBackend = FixtureSpacesBackend(),
+ devices: FixtureDevices = FixtureDevices()) async -> AppModel {
+ let dir = FileManager.default.temporaryDirectory.appendingPathComponent("cua-machines-\(UUID().uuidString)")
+ let m = AppModel(backend: backend, keyvault: KeyvaultModel(client: nil),
+ onboarding: OnboardingModel(statePath: dir.appendingPathComponent("onboarding.json").path),
+ settingsPath: dir.appendingPathComponent("settings.json").path,
+ telemetry: FixtureTelemetry(), devices: devices)
+ await m.refresh()
+ m.devices.signedIn = true
+ await m.devices.refresh()
+ return m
+ }
+
+ /// The classic page and the New UI draw one view: the same machines,
+ /// This Mac first with its switches, a device of its own removable.
+ @Test func bothUIsDrawTheCoresView() async {
+ let m = await signedInModel()
+ let view = m.machinesView
+ #expect(view.machines.map(\.id) == m.machinePageRows.map(\.id).filter { id in
+ view.groups.flatMap(\.ids).contains(id)
+ })
+ let me = view.machines.first { $0.current }
+ #expect(me?.toggles.map(\.label) == ["Provide Spaces", "Share this desktop"])
+ #expect(me?.toggles.allSatisfy(\.editable) == true)
+ #expect(view.summary.contains("online"))
+ // Another machine's switches are read-only.
+ #expect(view.machines.filter { !$0.current }.allSatisfy { $0.toggles.allSatisfy { !$0.editable } })
+ // A device of its own leaves the account by revoking it.
+ let work = view.machines.first { $0.name == "Work laptop" }
+ #expect(work?.remove?.device == "dev_work")
+ #expect(work?.remove?.label == "Remove from account")
+ // No Space actions on a machine: its Spaces only lead to the Space.
+ #expect(view.machines.allSatisfy { $0.newSpace.label == "New Space here" })
+
+ let bridge = WebUIBridge(model: m, allowedOrigins: [])
+ let answer = bridge.machines()["view"] as? [String: Any]
+ #expect(answer?["summary"] as? String == view.summary)
+ let ids = (answer?["machines"] as? [[String: Any]])?.map { $0["id"] as? String }
+ #expect(ids == view.machines.map(\.id))
+ }
+
+ /// `machines.rename` renames the relay machine from this enrolled
+ /// device; `machines.remove` takes a machine off the relay and revokes
+ /// the device on it.
+ @Test func renameAndRemoveFromAccount() async throws {
+ let backend = FixtureSpacesBackend()
+ let devices = FixtureDevices()
+ let m = await signedInModel(backend: backend, devices: devices)
+ let bridge = WebUIBridge(model: m, allowedOrigins: [])
+ #expect(WebUIBridge.methods.contains("machines.rename"))
+ #expect(WebUIBridge.methods.contains("machines.remove"))
+
+ _ = try await bridge.handle("machines.rename", ["id": "m1", "name": " Studio "])
+ #expect(devices.calls.contains("rename-machine:m1:Studio"))
+
+ _ = try await bridge.handle("machines.remove", ["machine": "m2", "device": "dev_old"])
+ #expect(backend.unregistered == ["relay:m2"])
+ #expect(devices.calls.contains("revoke:dev_old"))
+
+ // Nothing to remove is refused.
+ await #expect(throws: (any Error).self) { _ = try await bridge.handle("machines.remove", [:]) }
+ }
+
+ /// `checkMachineHealth` asks only the machines the view says can be
+ /// checked: This Mac (through its daemon) and your machines that are
+ /// online; never an offline or a team machine.
+ @Test func healthIsCheckedOnlyWhereItCanBe() async {
+ let backend = FixtureSpacesBackend()
+ let m = await signedInModel(backend: backend)
+ let view = m.machinesView
+ let me = view.machines.first { $0.current }
+ #expect(me?.healthTarget == "")
+ #expect(view.machines.filter { !$0.current && !$0.online }.allSatisfy { $0.healthTarget == nil })
+ #expect(view.machines.filter(\.team).allSatisfy { $0.healthTarget == nil })
+ await m.checkMachineHealth()
+ #expect(Set(backend.healthChecked) == Set(view.machines.compactMap(\.healthTarget)))
+ #expect(backend.healthChecked.contains(""))
+ // Healthy: nothing extra on any machine.
+ #expect(m.machinesView.machines.allSatisfy { $0.issues.isEmpty && $0.health.isEmpty })
+ }
+
+ /// What This Mac's daemon reports shows as its issues, with the fix,
+ /// on the classic page and through the bridge (the New UI).
+ @Test func issuesShowWithTheirFix() async throws {
+ let backend = FixtureSpacesBackend()
+ let url = "x-apple.systempreferences:com.apple.preference.security?Privacy_LocalNetwork"
+ backend.fixtureHealth[""] = AppMachinesViewHealth(
+ id: "", checks: [
+ AppMachinesViewCheck(id: "machine.local_network", status: "fail", message: "blocked",
+ remediation: "", facts: ["app": "Cua Spaces", "settings_url": url]),
+ AppMachinesViewCheck(id: "machine.disk", status: "pass", message: "200 GB free",
+ remediation: "", facts: [:]),
+ ], cuaVersion: "0.4.1", error: nil)
+ let m = await signedInModel(backend: backend)
+ let bridge = WebUIBridge(model: m, allowedOrigins: [])
+ #expect(WebUIBridge.methods.contains("machines.checkHealth"))
+ #expect(try await bridge.handle("machines.checkHealth", [:]) is NSNull)
+ let me = try #require(m.machinesView.machines.first { $0.current })
+ #expect(me.health == "fail")
+ #expect(me.issuesTitle == "Issues")
+ #expect(me.issues.map(\.text) == [
+ "Cua can\u{2019}t reach this Mac\u{2019}s macOS Spaces: Local Network access is off for Cua Spaces.",
+ ])
+ #expect(me.issues.first?.action?.label == "Open Local Network settings")
+ #expect(me.issues.first?.action?.url == url)
+ // The New UI reads the same issues in `machines.list`'s view.
+ let answer = bridge.machines()["view"] as? [String: Any]
+ let mine = (answer?["machines"] as? [[String: Any]])?.first { $0["current"] as? Bool == true }
+ #expect((mine?["issues"] as? [[String: Any]])?.count == 1)
+ #expect(mine?["health"] as? String == "fail")
+ // Once fixed, the issue goes.
+ backend.fixtureHealth[""] = nil
+ await m.checkMachineHealth()
+ #expect(m.machinesView.machines.first { $0.current }?.issues.isEmpty == true)
+ }
+}
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/StartupTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/StartupTests.swift
index 8d66d38c6a..ed4493b6d3 100644
--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/StartupTests.swift
+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/StartupTests.swift
@@ -259,6 +259,25 @@ import Testing
#expect(account.identity() == "[email protected]")
}
+ /// The app runs on the pending backend: the Machines page's health
+ /// checks and Remove from account reach the live one, not the
+ /// protocol's defaults ("can't be checked here").
+ @Test func pendingBackendForwardsMachineHealthAndRemove() async throws {
+ let gate = LiveGate<LiveServices>()
+ let live = FixtureSpacesBackend()
+ live.fixtureHealth[""] = AppMachinesViewHealth(
+ id: "", checks: [AppMachinesViewCheck(id: "machine.disk", status: "fail", message: "only 8 GB free",
+ remediation: "", facts: ["free_gb": "8"])],
+ cuaVersion: "0.5.0", error: nil)
+ gate.resolve(LiveServices(backend: live, account: FixtureAccount(identity: "[email protected]")))
+ let backend = PendingSpacesBackend(gate: gate)
+ let health = try await backend.machineHealth(machine: nil)
+ #expect(health.checks.map(\.id) == ["machine.disk"])
+ #expect(live.healthChecked == [""])
+ try await backend.relayUnregister(id: "relay:studio")
+ #expect(live.unregistered == ["relay:studio"])
+ }
+
@Test func aStartThatFailedSaysWhyInsteadOfWaiting() async {
let gate = LiveGate<LiveServices>()
gate.resolve(LiveServices(backend: FixtureSpacesBackend(rows: []), startError: "no SDK"))
diff --git a/apps/cua-spaces-web/e2e/host-log-layout.spec.ts b/apps/cua-spaces-web/e2e/host-log-layout.spec.ts
index 2ce3dcc56b..e9aff00b0b 100644
--- a/apps/cua-spaces-web/e2e/host-log-layout.spec.ts
+++ b/apps/cua-spaces-web/e2e/host-log-layout.spec.ts
@@ -2,7 +2,7 @@
// Copyright (c) 2026 Cua AI, Inc.
/**
- * This machine's logs at a real window width (1100 px, as on a Mac): a long row gives way in the middle, so what happened ("Screen and
+ * This machine's logs (under Details on the Machines page) at a real window width (1100 px, as on a Mac): a long row gives way in the middle, so what happened ("Screen and
* input refused (desktop not shared) ×12") stays whole, on the page and in
* Show All; the Spaces activity keeps its action and Space whole instead.
*/
@@ -50,8 +50,11 @@ for (const [name, css] of [
await page.goto("/machines?bridge=demo&parity");
await page.waitForFunction(() => window.__cuaParity !== undefined);
if (css) await page.addStyleTag({ content: css });
- await page.locator("[data-host-panel]").waitFor();
+ await page.locator('[data-machine-detail="this-mac"]').waitFor();
await page.evaluate((s) => window.__cuaParity!.showHost(s), state);
+ // The logs are under This machine's Details (collapsed until opened).
+ await page.locator("[data-machine-details-toggle]").click();
+ await page.locator("[data-host-panel]").waitFor();
const tails = page.locator("[data-host-log-row] [data-host-log-tail]");
await expect(tails.first()).toHaveText("Screen and input refused (desktop not shared) ×12");
diff --git a/apps/cua-spaces-web/e2e/parity.spec.ts b/apps/cua-spaces-web/e2e/parity.spec.ts
index a8948359e0..b736f738ca 100644
--- a/apps/cua-spaces-web/e2e/parity.spec.ts
+++ b/apps/cua-spaces-web/e2e/parity.spec.ts
@@ -64,7 +64,7 @@ async function open(page: Page, screen: ParityScreen): Promise<void> {
// Let the host's first answer land, so it can't overwrite a checkpoint.
if (PATHS[screen] === "/spaces") await page.locator("[data-space-id]").first().waitFor();
if (screen === "onboarding") await page.locator("[data-step]").first().waitFor();
- if (screen === "machines") await page.locator("[data-host-panel]").waitFor();
+ if (screen === "machines") await page.locator('[data-machine-detail="this-mac"]').waitFor();
if (screen === "agents") await page.locator("[data-agent-row]").first().waitFor();
}
@@ -250,26 +250,27 @@ const texts = (page: Page, selector: string) => page.locator(selector).evaluateA
const attrs = (page: Page, selector: string, name: string) =>
page.locator(selector).evaluateAll((els, n) => els.map((el) => el.getAttribute(n) ?? ""), name);
+/** This machine on the Machines page for the core's host state: its two
+ * switches (on or off, and whether they change here), the notice over them,
+ * the permissions still to grant and Remove from account, as the core's
+ * `machines.view` draws This machine (the SwiftUI page draws the same). */
async function checkHostPanel(page: Page, cp: Of<"host-panel">): Promise<void> {
const p = cp.panel;
+ const m = cp.machine!;
await page.evaluate((state) => window.__cuaParity!.showHost(state), cp.state);
- // Relay sharing paused: the notice (and its button) in place of the summary.
- const notice = p.notice && !p.intro ? p.notice : null;
- if (notice) await expect(page.locator("[data-host-notice]")).toHaveText(notice);
- else await expect(page.locator("[data-host-summary]")).toHaveText(p.summary);
- await expect.poll(() => texts(page, "[data-host-notice-action]")).toEqual(notice && p.noticeAction ? [p.noticeAction.label] : []);
- await expect.poll(() => attrs(page, "[data-host-fact]", "data-host-fact")).toEqual(p.facts.map((f) => f.label));
- await expect.poll(() => texts(page, "[data-host-fact] > div:last-child")).toEqual(p.facts.map((f) => f.value));
- if (p.clientsTitle && p.clientsEmpty) await expect(page.locator("[data-host-clients-empty]")).toHaveText(p.clientsEmpty);
- await expect.poll(() => texts(page, "[data-host-client]")).toEqual(p.clientsTitle && !p.clientsEmpty ? p.clients : []);
+ const detail = page.locator('[data-machine-detail="this-mac"]');
+ if (m.notice) await expect(detail.locator("[data-machine-notice]")).toContainText(m.notice);
+ else await expect(detail.locator("[data-machine-notice]")).toHaveCount(0);
+ // The notice's button (Sign In, Resume Sharing), when it has one.
+ await expect.poll(() => texts(page, "[data-machine-notice] button")).toEqual(m.notice && m.noticeAction ? [m.noticeAction.label] : []);
+ await expect.poll(() => attrs(page, "[data-machine-toggle]", "data-machine-toggle")).toEqual(m.toggles.map((t) => t.id));
+ await expect
+ .poll(() => attrs(page, "[data-machine-toggle] [role=switch]", "aria-checked"))
+ .toEqual(m.toggles.map((t) => String(t.on)));
await expect
.poll(() => attrs(page, "[data-host-permission]", "data-host-permission"))
.toEqual(p.permissionsTitle ? p.permissions.map((x) => x.id) : []);
- // As the SwiftUI page: setup choices before setup, the buttons after.
- const choices = p.setupChoices ?? [];
- await expect.poll(() => attrs(page, "[data-host-choice]", "data-host-choice")).toEqual(choices.map((c) => c.id));
- const actions = choices.length ? [] : p.actions;
- await expect.poll(() => texts(page, "[data-host-action]")).toEqual(actions.map((a) => a.label));
+ await expect(detail.locator("[data-machine-remove]")).toHaveCount(m.remove ? 1 : 0);
}
const readForm = (page: Page) =>
diff --git a/apps/cua-spaces-web/src/__tests__/app-harness.tsx b/apps/cua-spaces-web/src/__tests__/app-harness.tsx
index 1a30793094..52c09ac60a 100644
--- a/apps/cua-spaces-web/src/__tests__/app-harness.tsx
+++ b/apps/cua-spaces-web/src/__tests__/app-harness.tsx
@@ -10,6 +10,7 @@ import { createMemoryHistory, createRouter, RouterProvider } from "@tanstack/rea
import { render } from "@testing-library/react";
import { afterEach, beforeEach } from "vitest";
import type { DataAdapter } from "@/bridge/adapter";
+import type { MachinesView } from "@/bridge/contracts/host";
import type { HostEvent } from "@/bridge/protocol";
import { createDemoAdapter } from "@/bridge/adapters/demo";
import { BridgeProvider, useBridge, useMachines, useSpaces, type SpacesHook } from "@/bridge";
@@ -47,6 +48,8 @@ export interface TestHost {
answer?: (op: string, out: unknown) => unknown;
/** Answers `op` itself instead of the demo host (undefined: the demo's). */
intercept?: (op: string, args: unknown) => unknown;
+ /** The Machines page as the host's core drew it (`machinesView`). */
+ machinesView?: () => MachinesView | null;
}
/** The routers mounted by the running test: a navigation the app started (a
@@ -67,6 +70,7 @@ export async function mountApp(path: string, host: TestHost = { failsCreates: tr
const listeners = new Set<(event: HostEvent) => void>();
const adapter: DataAdapter = {
mode: demo.mode,
+ ...(host.machinesView ? { machinesView: host.machinesView } : {}),
subscribe: (l) => {
listeners.add(l);
const off = demo.subscribe(l);
diff --git a/apps/cua-spaces-web/src/__tests__/machines-page.test.tsx b/apps/cua-spaces-web/src/__tests__/machines-page.test.tsx
new file mode 100644
index 0000000000..3634c0784a
--- /dev/null
+++ b/apps/cua-spaces-web/src/__tests__/machines-page.test.tsx
@@ -0,0 +1,264 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+// The Machines page (CUA-1673) on the real routes and the wasm core: the
+// list in groups with one line each, This Mac's switches editable and
+// another machine's read-only, Space rows that lead to the Space's page,
+// New Space here with the machine chosen, rename, Details, and Remove from
+// account (asked first). No Space actions on a machine.
+
+import { act, cleanup, fireEvent, screen, waitFor, within } from "@testing-library/react";
+import { readFileSync } from "node:fs";
+import { resolve } from "node:path";
+import { afterEach, describe, expect, it } from "vitest";
+import { testCore, wasmBuilt } from "@/bridge/__tests__/testCore";
+import type { MachineRow, MachinesView } from "@/bridge/contracts/host";
+import { readNewSpaceSession, resetNewSpaceSession } from "@/bridge/new-space";
+import { withNotSharing } from "@/bridge/sharing";
+import { mountApp, stubBrowserApis, type TestHost } from "./app-harness";
+
+afterEach(cleanup);
+// New Space is one session for the whole page: a test that opens it must not leave it open for the next.
+afterEach(resetNewSpaceSession);
+stubBrowserApis();
+
+const LINE = "Studio stopped sharing: ask its owner to Resume sharing (or run `cua host start` there)";
+
+/** The demo host with one more machine whose owner stopped sharing it. */
+function stopped(calls: [string, unknown][]): TestHost {
+ return {
+ failsCreates: false,
+ listsGhost: false,
+ answer: (op, out) => {
+ if (op === "spaces.list") {
+ return [...(out as unknown[]), { id: "relay:studio", name: "Studio", provider: "relay", spacesdVersion: "0.6.0", features: [], reachable: false, error: LINE }];
+ }
+ if (op === "machines.list") {
+ return [...(out as MachineRow[]), { id: "studio", name: "Studio", via: "relay", online: true, os: "macos", detail: LINE, limits: withNotSharing([], LINE) }];
+ }
+ return out;
+ },
+ intercept: (op, args) => {
+ if (op === "machines.remove" || op === "machines.rename") {
+ calls.push([op, args]);
+ return null;
+ }
+ return undefined;
+ },
+ };
+}
+
+/** The approved mockup, drawn by the core as the Mac app's host draws it
+ * (`parity/machines.json`, its first view). */
+async function mockupView(): Promise<MachinesView> {
+ const fixture = JSON.parse(readFileSync(resolve(process.cwd(), "../../libs/cua/crates/cua-spaces-app-core/parity/machines.json"), "utf8"));
+ const core = await testCore();
+ return core.call<MachinesView>("machines.view", { input: fixture.views[0].input });
+}
+
+/** The mockup with each machine's health as its daemon reported it
+ * (`parity/machines.json`, the view "the mockup with issues"). */
+async function issuesView(): Promise<MachinesView> {
+ const fixture = JSON.parse(readFileSync(resolve(process.cwd(), "../../libs/cua/crates/cua-spaces-app-core/parity/machines.json"), "utf8"));
+ const v = (fixture.views as { name: string; input: object }[]).find((x) => x.name.startsWith("the mockup with issues"))!;
+ const core = await testCore();
+ return core.call<MachinesView>("machines.view", { input: v.input });
+}
+
+function hostDrawn(view: MachinesView, calls: [string, unknown][]): TestHost {
+ const rows: MachineRow[] = view.machines.map((m) => ({ id: m.id, name: m.name, via: m.current ? "local" : "relay", online: m.online, os: m.os, current: m.current || undefined, limits: [] }));
+ return {
+ failsCreates: false,
+ listsGhost: false,
+ answer: (op, out) => (op === "machines.list" ? rows : out),
+ intercept: (op, args) => {
+ if (op === "machines.remove" || op === "machines.rename" || op === "machines.checkHealth" || op === "host.openSettings" || op === "host.action") {
+ calls.push([op, args]);
+ return null;
+ }
+ return undefined;
+ },
+ machinesView: () => view,
+ };
+}
+
+const detailOf = (name: string) => screen.findByRole("region", { name: `${name} details` });
+const select = (id: string) => act(() => (document.querySelector(`[data-machine-id="${id}"]`) as HTMLElement).click());
+
+describe.skipIf(!wasmBuilt)("the Machines page (real routes, wasm core)", () => {
+ it("draws the core's page for the rows listed here, a machine that stopped sharing included", async () => {
+ const calls: [string, unknown][] = [];
+ const { router, hooks } = await mountApp("/machines", stopped(calls));
+ await router.load();
+ await waitFor(() => expect(hooks.machines.view?.machines.some((m) => m.id === "studio")).toBe(true));
+ await screen.findByText(hooks.machines.view!.summary);
+
+ const row = document.querySelector('[data-machine-id="studio"]') as HTMLElement;
+ expect(row.querySelector("[data-machine-line]")?.textContent).toBe("Not sharing · No Spaces");
+ // No subtitle of OS and connection, and no "Not set up for access".
+ expect(document.body.textContent).not.toMatch(/Not set up for access|macOS · Cua relay/);
+ select("studio");
+ const detail = await detailOf("Studio");
+ expect(detail.querySelector("[data-machine-status]")?.textContent).toContain("Not sharing");
+ // Online, so the relay would only take it back: Remove says where.
+ const remove = detail.querySelector<HTMLButtonElement>('[data-machine-remove="studio"]')!;
+ expect(remove.disabled).toBe(true);
+ expect(remove.parentElement?.getAttribute("title")).toMatch(/Remove it on that Mac/);
+ expect(detail.querySelector<HTMLButtonElement>("[data-machine-new-space]")!.disabled).toBe(true);
+ });
+
+ it("matches the approved mockup: groups, switches, Space links, New Space here, rename, Details and Remove", async () => {
+ const view = await mockupView();
+ const calls: [string, unknown][] = [];
+ const { router } = await mountApp("/machines", hostDrawn(view, calls));
+ await router.load();
+ await screen.findByText(view.summary);
+
+ // Groups, with the old machines collapsed.
+ const groups = [...document.querySelectorAll("[data-machine-group]")].map((g) => g.getAttribute("data-machine-group"));
+ expect(groups).toEqual(["yours", "old", "team"]);
+ const old = document.querySelector<HTMLElement>('[data-machine-id="old1"]')!;
+ expect(old.hidden).toBe(true);
+ fireEvent.click(screen.getByRole("button", { name: /Offline for 30\+ days/ }));
+ expect(old.hidden).toBe(false);
+ expect(screen.getByText("Remove old machines")).toBeTruthy();
+ expect(document.querySelector('[data-machine-id="this-mac"]')?.textContent).toContain("This Mac");
+
+ // This Mac: its switches change here.
+ let detail = await detailOf("Ada's MacBook Pro");
+ const switches = () => [...detail.querySelectorAll<HTMLElement>("[data-machine-toggle] [role=switch]")];
+ expect(switches().map((s) => s.getAttribute("aria-disabled") === "true" || s.hasAttribute("data-disabled"))).toEqual([false, false]);
+
+ // Another Mac: read-only, and where to change it.
+ select("studio");
+ detail = await detailOf("cua's Mac Studio");
+ expect(switches().every((s) => s.hasAttribute("data-disabled"))).toBe(true);
+ expect(detail.querySelector("[data-machine-toggles-note]")?.textContent).toBe("Change this on that Mac.");
+ // No Space actions on a machine.
+ expect(within(detail).queryByRole("button", { name: /^(Open|Start|Stop|Teleport)/ })).toBeNull();
+
+ // Details, collapsed until opened.
+ expect(detail.querySelector("[data-machine-details]")).toBeNull();
+ fireEvent.click(detail.querySelector("[data-machine-details-toggle]")!);
+ expect(detail.querySelector("[data-machine-details]")?.textContent).toMatch(/OS.*macOS 26\.5\.2.*Connection.*via Cua relay.*Service.*Running/);
+
+ // Rename saves on the relay machine.
+ fireEvent.click(detail.querySelector("[data-machine-rename]")!);
+ const input = await waitFor(() => document.querySelector<HTMLInputElement>("[data-machine-rename-input]")!);
+ fireEvent.change(input, { target: { value: "Studio" } });
+ fireEvent.submit(input.closest("form")!);
+ await waitFor(() => expect(calls).toContainEqual(["machines.rename", { id: "studio", name: "Studio" }]));
+
+ // New Space here: the wizard, with this machine chosen.
+ fireEvent.click(detail.querySelector('[data-machine-new-space="host:studio"]')!);
+ await waitFor(() => expect(readNewSpaceSession().open).toBe(true));
+ // Chosen as soon as the wizard offers it, or waiting for it to be.
+ await waitFor(() => {
+ const s = readNewSpaceSession();
+ expect(s.placeOn === "host:studio" || (s.state as { host?: string } | null)?.host === "studio").toBe(true);
+ });
+ act(() => router.history.back());
+
+ // A Space row leads to the Space's own page.
+ select("studio");
+ detail = await detailOf("cua's Mac Studio");
+ fireEvent.click(detail.querySelector('[data-space-row="relay:studio/xm"]')!);
+ await waitFor(() => expect(router.state.location.pathname).toBe(`/spaces/${encodeURIComponent("relay:studio/xm")}`));
+ });
+
+ it("asks before removing a machine from the account; Cancel removes nothing", async () => {
+ const view = await mockupView();
+ const calls: [string, unknown][] = [];
+ const { router } = await mountApp("/machines", hostDrawn(view, calls));
+ await router.load();
+ await screen.findByText(view.summary);
+ select("byoc");
+ const detail = await detailOf("Cua BYOC tests");
+ expect(detail.querySelector("[data-machine-notice]")?.textContent).toMatch(/offline/);
+ const remove = detail.querySelector<HTMLButtonElement>('[data-machine-remove="byoc"]')!;
+ expect(remove.textContent).toBe("Remove from account");
+ fireEvent.click(remove);
+ let dialog = await screen.findByRole("alertdialog");
+ expect(dialog.textContent).toContain("Remove “Cua BYOC tests” from your account?");
+ fireEvent.click(within(dialog).getByRole("button", { name: "Cancel" }));
+ await waitFor(() => expect(screen.queryByRole("alertdialog")).toBeNull());
+ const changes = () => calls.filter(([op]) => op !== "machines.checkHealth");
+ expect(changes()).toEqual([]);
+
+ fireEvent.click(remove);
+ dialog = await screen.findByRole("alertdialog");
+ fireEvent.click(within(dialog).getByRole("button", { name: "Remove" }));
+ await waitFor(() => expect(changes()).toEqual([["machines.remove", { machine: "byoc", device: "dev_byoc" }]]));
+ });
+
+ it("a team machine has no Remove and says its owner changes it", async () => {
+ const view = await mockupView();
+ const { router } = await mountApp("/machines", hostDrawn(view, []));
+ await router.load();
+ await screen.findByText(view.summary);
+ select("team");
+ const detail = await detailOf("build-mini-01");
+ expect(detail.querySelector("[data-machine-status]")?.textContent).toContain("Shared by your team");
+ expect(detail.querySelector("[data-machine-toggles-note]")?.textContent).toBe("Its owner changes this on that Mac.");
+ expect(detail.querySelector("[data-machine-remove]")).toBeNull();
+ expect(detail.querySelector("[data-machine-rename]")).toBeNull();
+ });
+
+ it("shows a machine's issues with their fixes, tints its dot, and shows nothing for a healthy or offline machine", async () => {
+ const view = await issuesView();
+ const calls: [string, unknown][] = [];
+ const { router } = await mountApp("/machines", hostDrawn(view, calls));
+ await router.load();
+ await screen.findByText(view.summary);
+ // The page asks the machines for their health once it opens.
+ await waitFor(() => expect(calls.some(([op]) => op === "machines.checkHealth")).toBe(true));
+
+ // The dots: red for This Mac, amber for the Mac Studio, none on the rest.
+ const tint = (id: string) => document.querySelector(`[data-machine-id="${id}"] [data-machine-health]`)?.getAttribute("data-machine-health") ?? null;
+ expect([tint("this-mac"), tint("studio"), tint("byoc"), tint("old1")]).toEqual(["fail", "warn", null, null]);
+
+ // This Mac: Local Network (fail) and disk (warn), each with its fix.
+ let detail = await detailOf("Ada's MacBook Pro");
+ const issues = () => [...detail.querySelectorAll<HTMLElement>("[data-machine-issue]")];
+ expect(issues().map((i) => [i.dataset.machineIssue, i.dataset.level])).toEqual([
+ ["machine.local_network", "fail"],
+ ["machine.disk", "warn"],
+ ]);
+ expect(issues()[0]!.textContent).toContain("Local Network access is off for Cua Spaces.");
+ fireEvent.click(within(issues()[0]!).getByRole("button", { name: "Open Local Network settings" }));
+ await waitFor(() =>
+ expect(calls).toContainEqual(["host.openSettings", { url: "x-apple.systempreferences:com.apple.preference.security?Privacy_LocalNetwork" }]),
+ );
+ expect(within(issues()[1]!).getByRole("button", { name: "Free disk space" })).toBeTruthy();
+
+ // The Mac Studio: said there, with no buttons (its settings are on it).
+ select("studio");
+ detail = await detailOf("cua's Mac Studio");
+ expect(issues().map((i) => i.textContent)).toEqual([
+ "Running Spaces use 28 of 32 GB of memory on that Mac, so another may not start.",
+ "It runs Cua 0.3.9, older than this Mac’s 0.4.1. Update Cua on it.",
+ ]);
+ expect(detail.querySelector("[data-machine-issue-action]")).toBeNull();
+
+ // Healthy (the team machine) and offline (old checks not shown): no section.
+ for (const [id, name] of [["team", "build-mini-01"], ["byoc", "Cua BYOC tests"]] as const) {
+ select(id);
+ detail = await detailOf(name);
+ expect(detail.querySelector("[data-machine-issues]")).toBeNull();
+ expect(detail.textContent).not.toContain("Issues");
+ }
+ });
+
+ it("a Restart service fix runs the host action", async () => {
+ const view = await issuesView();
+ const mac = view.machines.find((m) => m.current)!;
+ mac.issues = [{ id: "service", level: "fail", text: "The Cua service isn’t running.", action: { label: "Restart service", hostAction: "resume-sharing" } }];
+ mac.health = "fail";
+ const calls: [string, unknown][] = [];
+ const { router } = await mountApp("/machines", hostDrawn(view, calls));
+ await router.load();
+ const detail = await detailOf("Ada's MacBook Pro");
+ fireEvent.click(within(detail).getByRole("button", { name: "Restart service" }));
+ await waitFor(() => expect(calls.some(([op, a]) => op === "host.action" && JSON.stringify(a).includes("resume-sharing"))).toBe(true));
+ });
+});
diff --git a/apps/cua-spaces-web/src/__tests__/machines-reach.test.tsx b/apps/cua-spaces-web/src/__tests__/machines-reach.test.tsx
deleted file mode 100644
index 1f4beca508..0000000000
--- a/apps/cua-spaces-web/src/__tests__/machines-reach.test.tsx
+++ /dev/null
@@ -1,73 +0,0 @@
-// SPDX-License-Identifier: FSL-1.1-MIT
-// Copyright (c) 2026 Cua AI, Inc.
-
-// A machine its owner stopped sharing is not counted
-// online and reads "Not sharing" (the core's word, `machines::NOT_SHARING`,
-// as the SwiftUI Machines list shows it), its Status line wraps instead of being cut, and it can be
-// removed with the core's Delete action, as the SwiftUI toolbar has it.
-
-import { act, cleanup, fireEvent, screen, waitFor, within } from "@testing-library/react";
-import { afterEach, describe, expect, it } from "vitest";
-import { wasmBuilt } from "@/bridge/__tests__/testCore";
-import type { MachineRow } from "@/bridge/contracts/host";
-import { withNotSharing } from "@/bridge/sharing";
-import { mountApp, stubBrowserApis, type TestHost } from "./app-harness";
-
-afterEach(cleanup);
-stubBrowserApis();
-
-const LINE = "Studio stopped sharing: ask its owner to Resume sharing (or run `cua host start` there)";
-
-function host(removed: string[]): TestHost {
- return {
- failsCreates: false,
- listsGhost: false,
- answer: (op, out) => {
- if (op === "spaces.list") {
- if (removed.includes("relay:studio")) return out;
- return [...(out as unknown[]), { id: "relay:studio", name: "Studio", provider: "relay", spacesdVersion: "0.6.0", features: [], reachable: false, error: LINE }];
- }
- if (op === "machines.list") {
- if (removed.includes("relay:studio")) return out;
- const rows = out as MachineRow[];
- return [...rows, { id: "studio", name: "Studio", via: "relay", online: true, os: "", detail: LINE, limits: withNotSharing([], LINE) }];
- }
- return out;
- },
- intercept: (op, args) => {
- if (op !== "spaces.delete") return undefined;
- removed.push((args as { spaceId: string }).spaceId);
- return "";
- },
- };
-}
-
-describe.skipIf(!wasmBuilt)("a machine its owner stopped sharing (real routes, wasm core)", () => {
- it("is not counted online, reads Not sharing, shows its whole Status line, and can be removed", async () => {
- const removed: string[] = [];
- const { router, hooks } = await mountApp("/machines", host(removed));
- await router.load();
- await waitFor(() => expect(hooks.machines.data?.some((m) => m.id === "studio")).toBe(true));
- const total = hooks.machines.data!.length;
- const online = hooks.machines.data!.filter((m) => m.online && !m.notSharing).length;
- await screen.findByText(`${total} computers, ${online} online`);
-
- const row = document.querySelector('[data-machine-id="studio"]') as HTMLElement;
- expect(within(row).getByText("Not sharing")).toBeTruthy();
- act(() => row.click());
- const detail = await screen.findByRole("region", { name: "Studio details" });
- expect(within(detail).queryByText(/Online, not sharing/)).toBeNull();
- expect(within(detail).getAllByText("Not sharing").length).toBeGreaterThan(0);
- const status = within(detail).getByText("Status").closest("div")!.parentElement!.parentElement!;
- const value = status.querySelector("[data-fact-value]")!;
- expect(value.textContent).toContain("cua host start");
- expect(value.className).not.toContain("truncate");
-
- const remove = detail.querySelector('[data-machine-remove="studio"]') as HTMLButtonElement;
- expect(remove).not.toBeNull();
- fireEvent.click(remove);
- const dialog = await screen.findByRole("alertdialog");
- fireEvent.click(within(dialog).getAllByRole("button").at(-1)!);
- await waitFor(() => expect(removed).toEqual(["relay:studio"]));
- });
-});
diff --git a/apps/cua-spaces-web/src/bridge/__tests__/contract-args.ts b/apps/cua-spaces-web/src/bridge/__tests__/contract-args.ts
index 022ad2e2cf..7083287d04 100644
--- a/apps/cua-spaces-web/src/bridge/__tests__/contract-args.ts
+++ b/apps/cua-spaces-web/src/bridge/__tests__/contract-args.ts
@@ -100,6 +100,9 @@ export const DEMO_ARGS: { [K in OpName]: OpArgs<K> } = {
"nudges.pending": {},
"nudges.answer": { id: "risky-1-1", choice: "here" },
"resources.get": { visible: true },
+ "machines.rename": { id: "m-studio", name: "Studio" },
+ "machines.remove": { machine: "m-old", device: "dev_old" },
+ "machines.checkHealth": {},
"checklist.get": {},
"checklist.send": { action: { type: "done", step: "teleport" } },
"presence.join": { spaceId: SPACE },
diff --git a/apps/cua-spaces-web/src/bridge/__tests__/coverage.test.ts b/apps/cua-spaces-web/src/bridge/__tests__/coverage.test.ts
index ed08d5001d..379ef3c32a 100644
--- a/apps/cua-spaces-web/src/bridge/__tests__/coverage.test.ts
+++ b/apps/cua-spaces-web/src/bridge/__tests__/coverage.test.ts
@@ -17,6 +17,7 @@ import { STREAM_ARGS } from "../ops/stream";
import { RELAY_USAGE_ARGS } from "../ops/relay-usage";
import { NUDGES_ARGS } from "../ops/nudges";
import { RESOURCES_ARGS } from "../ops/resources";
+import { MACHINES_ARGS } from "../ops/machines";
import { CHECKLIST_ARGS } from "../ops/checklist";
import { PRESENCE_ARGS } from "../ops/presence";
import { RUNTIME_FIX_ARGS } from "../ops/runtime-fix";
@@ -135,6 +136,7 @@ const ARGS: { [K in OpName]: OpArgs<K> } = {
...RELAY_USAGE_ARGS,
...NUDGES_ARGS,
...RESOURCES_ARGS,
+ ...MACHINES_ARGS,
...CHECKLIST_ARGS,
...PRESENCE_ARGS,
...RUNTIME_FIX_ARGS,
diff --git a/apps/cua-spaces-web/src/bridge/adapter.ts b/apps/cua-spaces-web/src/bridge/adapter.ts
index 408020ffec..f310fa90ae 100644
--- a/apps/cua-spaces-web/src/bridge/adapter.ts
+++ b/apps/cua-spaces-web/src/bridge/adapter.ts
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: FSL-1.1-MIT
// Copyright (c) 2026 Cua AI, Inc.
+import type { MachinesView } from "./contracts/host";
import type { HostEvent, OpArgs, OpName, OpResult } from "./protocol";
export type BridgeMode = "tauri" | "electron" | "webkit" | "demo";
@@ -38,6 +39,13 @@ export interface DataAdapter {
* and this app uses it). Undefined: the host has none.
*/
hostNotice?(): string | null;
+ /**
+ * The Machines page as the host's core drew it, read with
+ * `machines.list` (`machines_view::view`, what the SwiftUI page shows).
+ * Null: the host did not send one (the store draws it with the core from
+ * the rows). Undefined: the host never does.
+ */
+ machinesView?(): MachinesView | null;
/** Releases timers and listeners. */
dispose?(): void;
}
diff --git a/apps/cua-spaces-web/src/bridge/adapters/demo.ts b/apps/cua-spaces-web/src/bridge/adapters/demo.ts
index 432d1c138d..045e1c6e40 100644
--- a/apps/cua-spaces-web/src/bridge/adapters/demo.ts
+++ b/apps/cua-spaces-web/src/bridge/adapters/demo.ts
@@ -168,6 +168,8 @@ export function createDemoAdapter(options: DemoOptions = {}): DataAdapter & { re
agentSetup: demoAgentSetup(),
platform: options.platform ?? MAC_DEMO_PLATFORM,
paired: [],
+ renamed: {},
+ removed: [],
hostSettings: options.macHost ? DEMO_MAC_HOST_SETTINGS : undefined,
volume: demoVolumeState(now(), options.onboarded !== false, options.platform),
...demoTelemetryState(),
@@ -348,7 +350,25 @@ export function createDemoAdapter(options: DemoOptions = {}): DataAdapter & { re
return null;
},
- "machines.list": () => [...demoMachineRows(now(), state.host, state.platform), ...state.paired.map((m) => ({ ...m, limits: [...m.limits] }))],
+ "machines.list": () =>
+ [...demoMachineRows(now(), state.host, state.platform), ...state.paired.map((m) => ({ ...m, limits: [...m.limits] }))]
+ .filter((m) => !state.removed.includes(m.id))
+ .map((m) => (state.renamed[m.id] ? { ...m, name: state.renamed[m.id]! } : m)),
+ "machines.rename": async ({ id, name }) => {
+ await wait(step / 2);
+ state.renamed = { ...state.renamed, [id]: name };
+ emit({ type: "machines.changed" });
+ return null;
+ },
+ // The demo machines are drawn by the core from their rows, with no
+ // daemon to ask: nothing to check.
+ "machines.checkHealth": () => null,
+ "machines.remove": async ({ machine, device }) => {
+ await wait(step / 2);
+ state.removed = [...state.removed, ...[machine, device].filter((x): x is string => Boolean(x))];
+ emit({ type: "machines.changed" });
+ return null;
+ },
"host.status": () => ({ ...state.host }),
"settings.get": () => settingsSnapshot(),
@@ -577,6 +597,10 @@ export interface DemoState extends DemoTelemetryState, DemoRelayUsageState, Demo
platform: DemoPlatform;
/** Machines added with a pairing code ("Add a machine"). */
paired: MachineRow[];
+ /** Machines renamed on the Machines page (`machines.rename`), by id. */
+ renamed: Record<string, string>;
+ /** Machines removed from the account (`machines.remove`). */
+ removed: string[];
/** `?demo=mac-host`: the Keyvault's switches the SwiftUI host lays out in Settings. */
hostSettings?: HostSettings;
}
diff --git a/apps/cua-spaces-web/src/bridge/adapters/tauri.ts b/apps/cua-spaces-web/src/bridge/adapters/tauri.ts
index a708482a93..30755b55a4 100644
--- a/apps/cua-spaces-web/src/bridge/adapters/tauri.ts
+++ b/apps/cua-spaces-web/src/bridge/adapters/tauri.ts
@@ -59,6 +59,7 @@ import { STREAM_OPERATIONS } from "../ops/stream";
import { RELAY_USAGE_OPERATIONS } from "../ops/relay-usage";
import { NUDGES_OPERATIONS } from "../ops/nudges";
import { RESOURCES_OPERATIONS } from "../ops/resources";
+import { MACHINES_OPERATIONS } from "../ops/machines";
import { CHECKLIST_OPERATIONS } from "../ops/checklist";
import { PRESENCE_OPERATIONS } from "../ops/presence";
import { RUNTIME_FIX_OPERATIONS } from "../ops/runtime-fix";
@@ -96,6 +97,7 @@ export const TAURI_UNSUPPORTED: readonly OpName[] = [
...RELAY_USAGE_OPERATIONS,
...NUDGES_OPERATIONS,
...RESOURCES_OPERATIONS,
+ ...MACHINES_OPERATIONS,
...CHECKLIST_OPERATIONS,
...PRESENCE_OPERATIONS,
...RUNTIME_FIX_OPERATIONS,
diff --git a/apps/cua-spaces-web/src/bridge/adapters/webkit.ts b/apps/cua-spaces-web/src/bridge/adapters/webkit.ts
index ef2c2d72a3..4fed2d1e08 100644
--- a/apps/cua-spaces-web/src/bridge/adapters/webkit.ts
+++ b/apps/cua-spaces-web/src/bridge/adapters/webkit.ts
@@ -31,7 +31,7 @@ import { Emitter, HostError, type DataAdapter } from "../adapter";
import { hostOs, THIS_MACHINE, type HostOs } from "../host-os";
import { electronTransport, webkitTransport, type HostTransport } from "../transport";
import type { AgentEventsPage, AgentSetupRow, PersistentAgent, SpaceAgentRun } from "../contracts/agents";
-import type { CancelOutcome, DefaultLocation, HostStatus, MachinePageRow, MachineRow, SpacePowerReport } from "../contracts/host";
+import type { CancelOutcome, DefaultLocation, HostActionId, HostStatus, MachinePageRow, MachineRow, MachinesView, SpacePowerReport } from "../contracts/host";
import type { HostWindow } from "../detect";
import {
DEFAULT_SETTINGS,
@@ -201,6 +201,24 @@ export function toMachineRows(spaces: WkSpaces, machines: WkMachines | null, os:
return rows;
}
+/** A host action as the bridge names it: the hosts encode the core's enum
+ * by its case (`provideSpaces`), the bridge by its wire word
+ * (`provide-spaces`). */
+const actionId = (a: string): HostActionId => a.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`) as HostActionId;
+
+/** The host's Machines view with its switches' actions as the bridge names them. */
+export function fromHostView(v: MachinesView): MachinesView {
+ return {
+ ...v,
+ machines: v.machines.map((m) => ({
+ ...m,
+ toggles: m.toggles.map((t) => ({ ...t, actions: t.actions.map(actionId) })),
+ noticeAction: m.noticeAction ? { ...m.noticeAction, id: actionId(m.noticeAction.id) } : m.noticeAction,
+ issues: m.issues?.map((i) => (i.action?.hostAction ? { ...i, action: { ...i.action, hostAction: actionId(i.action.hostAction) } } : i)),
+ })),
+ };
+}
+
/** The host's rows from the core (`machines.pageRows`, as the SwiftUI
* Machines page lists them), with what the page draws beside them: this
* machine's host status and summary, a device's state and detail, and why
@@ -506,6 +524,8 @@ export function createWebkitAdapter(
let rosterError: string | null = null;
// The host's standing notice (`hostNotice`).
let daemonNotice: string | null = null;
+ // The Machines page the host's core drew (`machinesView`).
+ let machinesView: MachinesView | null = null;
const listSpaces = async () => {
const answer = await request<WkSpaces>("spaces.list");
rosterError = answer.rosterError ?? null;
@@ -536,6 +556,7 @@ export function createWebkitAdapter(
},
"machines.list": async () => {
const [spaces, machines] = await Promise.all([listSpaces(), request<WkMachines>("machines.list").catch(() => null)]);
+ machinesView = machines?.view ? fromHostView(machines.view) : null;
return toMachineRows(spaces, machines, os);
},
"host.status": async () => {
@@ -650,6 +671,18 @@ export function createWebkitAdapter(
"nudges.pending": () => request<RiskyRequest[]>("nudges.pending"),
"nudges.answer": ({ id, choice }) => request<null>("nudges.answer", { id, choice }),
"resources.get": ({ visible }) => request<ResourcesSnapshot | null>("resources.get", { visible }),
+ "machines.rename": async ({ id, name }) => {
+ await request("machines.rename", { id, name });
+ return null;
+ },
+ "machines.checkHealth": async () => {
+ await request("machines.checkHealth");
+ return null;
+ },
+ "machines.remove": async ({ machine, device }) => {
+ await request("machines.remove", { machine: machine ?? null, device: device ?? null });
+ return null;
+ },
"checklist.get": () => request<{ state: HostChecklistState }>("checklist.get"),
"checklist.send": ({ action }) => request<{ state: HostChecklistState }>("checklist.send", { action }),
// Presence over the page's own video: the Mac app draws it natively.
@@ -724,6 +757,7 @@ export function createWebkitAdapter(
subscribe: (l) => events.subscribe(l),
listNotice: () => rosterError,
hostNotice: () => daemonNotice,
+ machinesView: () => machinesView,
dispose() {
for (const fail of [...pending]) fail(new HostError("the bridge was closed", "closed"));
events.clear();
diff --git a/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json b/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json
index afebb643ea..c096f84ef1 100644
--- a/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json
+++ b/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json
@@ -1778,6 +1778,476 @@
"limits"
]
},
+ "MachinesView": {
+ "type": "object",
+ "properties": {
+ "summary": {
+ "type": "string"
+ },
+ "groups": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ },
+ "title": {
+ "type": "string"
+ },
+ "collapsed": {
+ "type": "boolean"
+ },
+ "ids": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "removeAll": {
+ "type": [
+ "object",
+ "null"
+ ],
+ "properties": {
+ "label": {
+ "type": "string"
+ },
+ "confirm": {
+ "type": "object",
+ "properties": {
+ "title": {
+ "type": "string"
+ },
+ "message": {
+ "type": "string"
+ },
+ "confirmLabel": {
+ "type": "string"
+ },
+ "cancelLabel": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "title",
+ "message",
+ "confirmLabel",
+ "cancelLabel"
+ ]
+ },
+ "removes": {
+ "type": "array",
+ "items": {
+ "$ref": "#/$defs/MachinesViewRemove"
+ }
+ }
+ },
+ "required": [
+ "label",
+ "confirm",
+ "removes"
+ ]
+ }
+ },
+ "required": [
+ "id",
+ "title",
+ "collapsed",
+ "ids"
+ ]
+ }
+ },
+ "machines": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ },
+ "name": {
+ "type": "string"
+ },
+ "badge": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "line": {
+ "type": "string"
+ },
+ "online": {
+ "type": "boolean"
+ },
+ "health": {
+ "type": "string"
+ },
+ "healthTarget": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "issuesTitle": {
+ "type": "string"
+ },
+ "issues": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ },
+ "level": {
+ "type": "string"
+ },
+ "text": {
+ "type": "string"
+ },
+ "action": {
+ "type": [
+ "object",
+ "null"
+ ],
+ "properties": {
+ "label": {
+ "type": "string"
+ },
+ "url": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "hostAction": {
+ "type": [
+ "string",
+ "null"
+ ]
+ }
+ },
+ "required": [
+ "label"
+ ]
+ }
+ },
+ "required": [
+ "id",
+ "level",
+ "text"
+ ]
+ }
+ },
+ "os": {
+ "type": "string"
+ },
+ "current": {
+ "type": "boolean"
+ },
+ "team": {
+ "type": "boolean"
+ },
+ "status": {
+ "type": "string"
+ },
+ "sharedBy": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "rename": {
+ "type": [
+ "object",
+ "null"
+ ],
+ "properties": {
+ "target": {
+ "type": "string"
+ },
+ "id": {
+ "type": "string"
+ },
+ "title": {
+ "type": "string"
+ },
+ "confirmLabel": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "target",
+ "id",
+ "title",
+ "confirmLabel"
+ ]
+ },
+ "notice": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "noticeAction": {
+ "type": [
+ "object",
+ "null"
+ ],
+ "properties": {
+ "id": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "destructive": {
+ "type": "boolean"
+ }
+ },
+ "required": [
+ "id",
+ "label",
+ "destructive"
+ ]
+ },
+ "toggles": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "help": {
+ "type": "string"
+ },
+ "on": {
+ "type": "boolean"
+ },
+ "editable": {
+ "type": "boolean"
+ },
+ "enabled": {
+ "type": "boolean"
+ },
+ "actions": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "setup": {
+ "type": [
+ "string",
+ "null"
+ ]
+ }
+ },
+ "required": [
+ "id",
+ "label",
+ "help",
+ "on",
+ "editable",
+ "enabled",
+ "actions"
+ ]
+ }
+ },
+ "togglesNote": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "spacesTitle": {
+ "type": "string"
+ },
+ "spaces": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ },
+ "name": {
+ "type": "string"
+ },
+ "os": {
+ "type": "string"
+ },
+ "status": {
+ "type": "string"
+ },
+ "running": {
+ "type": "boolean"
+ }
+ },
+ "required": [
+ "id",
+ "name",
+ "os",
+ "status",
+ "running"
+ ]
+ }
+ },
+ "spacesEmpty": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "newSpace": {
+ "type": "object",
+ "properties": {
+ "label": {
+ "type": "string"
+ },
+ "on": {
+ "type": "string"
+ },
+ "enabled": {
+ "type": "boolean"
+ },
+ "help": {
+ "type": [
+ "string",
+ "null"
+ ]
+ }
+ },
+ "required": [
+ "label",
+ "on",
+ "enabled"
+ ]
+ },
+ "detailsTitle": {
+ "type": "string"
+ },
+ "details": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "label": {
+ "type": "string"
+ },
+ "value": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "label",
+ "value"
+ ]
+ }
+ },
+ "remove": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/MachinesViewRemove"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": [
+ "id",
+ "name",
+ "line",
+ "online",
+ "os",
+ "current",
+ "team",
+ "status",
+ "toggles",
+ "spacesTitle",
+ "spaces",
+ "newSpace",
+ "detailsTitle",
+ "details"
+ ]
+ }
+ }
+ },
+ "required": [
+ "summary",
+ "groups",
+ "machines"
+ ]
+ },
+ "MachinesViewRemove": {
+ "type": "object",
+ "properties": {
+ "label": {
+ "type": "string"
+ },
+ "enabled": {
+ "type": "boolean"
+ },
+ "help": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "host": {
+ "type": "boolean"
+ },
+ "machine": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "device": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "confirm": {
+ "type": "object",
+ "properties": {
+ "title": {
+ "type": "string"
+ },
+ "message": {
+ "type": "string"
+ },
+ "confirmLabel": {
+ "type": "string"
+ },
+ "cancelLabel": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "title",
+ "message",
+ "confirmLabel",
+ "cancelLabel"
+ ]
+ }
+ },
+ "required": [
+ "label",
+ "enabled",
+ "host",
+ "confirm"
+ ]
+ },
"NewSpaceOptions": {
"type": "object",
"properties": {
@@ -3905,6 +4375,16 @@
"items": {
"$ref": "#/$defs/MachinePageRow"
}
+ },
+ "view": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/MachinesView"
+ },
+ {
+ "type": "null"
+ }
+ ]
}
},
"required": [
@@ -4881,12 +5361,21 @@
"loginItem.set": {
"$ref": "#/$defs/LoginItemReport"
},
+ "machines.checkHealth": {
+ "type": "null"
+ },
"machines.list": {
"type": "array",
"items": {
"$ref": "#/$defs/MachineRow"
}
},
+ "machines.remove": {
+ "type": "null"
+ },
+ "machines.rename": {
+ "type": "null"
+ },
"notifications.list": {
"type": "array",
"items": {
@@ -6514,9 +7003,18 @@
"loginItem.set": {
"$ref": "#/$defs/LoginItemReport"
},
+ "machines.checkHealth": {
+ "type": "null"
+ },
"machines.list": {
"$ref": "#/$defs/WkMachines"
},
+ "machines.remove": {
+ "type": "null"
+ },
+ "machines.rename": {
+ "type": "null"
+ },
"notifications.list": {
"type": "array",
"items": {
diff --git a/apps/cua-spaces-web/src/bridge/contracts/host.ts b/apps/cua-spaces-web/src/bridge/contracts/host.ts
index 7dc2e10515..b3215ad69b 100644
--- a/apps/cua-spaces-web/src/bridge/contracts/host.ts
+++ b/apps/cua-spaces-web/src/bridge/contracts/host.ts
@@ -185,6 +185,146 @@ export interface MachinePageRow {
spacesLabel?: string;
}
+/** A confirmation (`host::HostConfirm`). */
+export interface HostConfirm {
+ title: string;
+ message: string;
+ confirmLabel: string;
+ cancelLabel: string;
+}
+
+/** One of a machine's two switches (`machines_view::MachinesViewToggle`). */
+export interface MachinesViewToggle {
+ /** `spaces` or `desktop`. */
+ id: string;
+ label: string;
+ help: string;
+ on: boolean;
+ /** Changed here (This machine); another machine's are read-only. */
+ editable: boolean;
+ enabled: boolean;
+ /** What flipping it runs, in order (`host.action` ids). */
+ actions: HostActionId[];
+ /** Before setup: flipping it opens the setup form with this profile. */
+ setup?: string | null;
+}
+
+/** A Space on a machine: a link to its page (`machines_view::MachinesViewSpace`). */
+export interface MachinesViewSpace {
+ id: string;
+ name: string;
+ os: string;
+ status: string;
+ running: boolean;
+}
+
+/** New Space here (`machines_view::MachinesViewNewSpace`). */
+export interface MachinesViewNewSpace {
+ label: string;
+ /** The wizard's placement (`local`, `host:<id>`). */
+ on: string;
+ enabled: boolean;
+ help?: string | null;
+}
+
+/** Rename (`machines_view::MachinesViewRename`). */
+export interface MachinesViewRename {
+ /** `host`, `machine` or `device`. */
+ target: string;
+ id: string;
+ title: string;
+ confirmLabel: string;
+}
+
+/** Remove from account (`machines_view::MachinesViewRemove`). */
+export interface MachinesViewRemove {
+ label: string;
+ enabled: boolean;
+ help?: string | null;
+ /** This machine: its host setup is removed (`host.action` `remove`). */
+ host: boolean;
+ /** Another machine: it leaves the relay directory. */
+ machine?: string | null;
+ /** The device on it, revoked too. */
+ device?: string | null;
+ confirm: HostConfirm;
+}
+
+/** What fixes an issue (`machines_health::MachinesViewIssueAction`). */
+export interface MachinesViewIssueAction {
+ /** "Open Local Network settings", "Free disk space", "Restart service". */
+ label: string;
+ /** A System Settings pane to open (`host.openSettings`). */
+ url?: string | null;
+ /** A host action to run (`host.action`). */
+ hostAction?: HostActionId | null;
+}
+
+/** One issue on a machine's page (`machines_health::MachinesViewIssue`). */
+export interface MachinesViewIssue {
+ /** The check it comes from (`machine.disk`, `service`, `version`). */
+ id: string;
+ /** `warn` or `fail`. */
+ level: string;
+ /** One plain sentence. */
+ text: string;
+ action?: MachinesViewIssueAction | null;
+}
+
+/** One machine's row and page (`machines_view::MachinesViewMachine`). */
+export interface MachinesViewMachine {
+ id: string;
+ name: string;
+ badge?: string | null;
+ /** The row's one muted line. */
+ line: string;
+ /** Usable now (the green dot). */
+ online: boolean;
+ /** The dot's tint for its issues: `warn`, `fail`, or empty. */
+ health?: string;
+ /** What the host passes to `Spaces.machine_health` (empty: This Mac); null when it can't be checked from here. */
+ healthTarget?: string | null;
+ /** "Issues". */
+ issuesTitle?: string;
+ /** What is wrong, one sentence each; empty when healthy or offline. */
+ issues?: MachinesViewIssue[];
+ os: string;
+ current: boolean;
+ team: boolean;
+ /** The page's status line. */
+ status: string;
+ sharedBy?: string | null;
+ rename?: MachinesViewRename | null;
+ notice?: string | null;
+ noticeAction?: HostAction | null;
+ toggles: MachinesViewToggle[];
+ togglesNote?: string | null;
+ spacesTitle: string;
+ spaces: MachinesViewSpace[];
+ spacesEmpty?: string | null;
+ newSpace: MachinesViewNewSpace;
+ detailsTitle: string;
+ details: { label: string; value: string }[];
+ remove?: MachinesViewRemove | null;
+}
+
+/** A group of the list (`machines_view::MachinesViewGroup`). */
+export interface MachinesViewGroup {
+ /** `yours`, `old` or `team`. */
+ id: string;
+ title: string;
+ collapsed: boolean;
+ ids: string[];
+ removeAll?: { label: string; confirm: HostConfirm; removes: MachinesViewRemove[] } | null;
+}
+
+/** The Machines page as every UI draws it (`machines_view::MachinesView`). */
+export interface MachinesView {
+ summary: string;
+ groups: MachinesViewGroup[];
+ machines: MachinesViewMachine[];
+}
+
export interface ServiceState {
installed: boolean;
running: boolean;
diff --git a/apps/cua-spaces-web/src/bridge/contracts/shapes.ts b/apps/cua-spaces-web/src/bridge/contracts/shapes.ts
index 046d097782..27e0ce8b68 100644
--- a/apps/cua-spaces-web/src/bridge/contracts/shapes.ts
+++ b/apps/cua-spaces-web/src/bridge/contracts/shapes.ts
@@ -718,6 +718,91 @@ const MachinePageRowShape = ref(
}),
);
+const HostConfirmShape = object({ title: str, message: str, confirmLabel: str, cancelLabel: str });
+
+/** A machine's remove (`machines_view::MachinesViewRemove`). */
+const MachinesViewRemoveShape = ref(
+ "MachinesViewRemove",
+ object({
+ label: str,
+ enabled: bool,
+ help: optNull(str),
+ host: bool,
+ machine: optNull(str),
+ device: optNull(str),
+ confirm: HostConfirmShape,
+ }),
+);
+
+/** The Machines page as the core draws it (`machines_view::MachinesView`). */
+const MachinesViewShape = ref(
+ "MachinesView",
+ object({
+ summary: str,
+ groups: list(
+ object({
+ id: str,
+ title: str,
+ collapsed: bool,
+ ids: strings,
+ removeAll: optNull(object({ label: str, confirm: HostConfirmShape, removes: list(MachinesViewRemoveShape) })),
+ }),
+ ),
+ machines: list(
+ object({
+ id: str,
+ name: str,
+ badge: optNull(str),
+ line: str,
+ online: bool,
+ // The machine's issues (`machines_health`): a host that predates
+ // them sends none.
+ health: opt(str),
+ healthTarget: optNull(str),
+ issuesTitle: opt(str),
+ issues: opt(
+ list(
+ object({
+ id: str,
+ level: str,
+ text: str,
+ action: optNull(object({ label: str, url: optNull(str), hostAction: optNull(str) })),
+ }),
+ ),
+ ),
+ os: str,
+ current: bool,
+ team: bool,
+ status: str,
+ sharedBy: optNull(str),
+ rename: optNull(object({ target: str, id: str, title: str, confirmLabel: str })),
+ notice: optNull(str),
+ noticeAction: optNull(object({ id: str, label: str, destructive: bool })),
+ toggles: list(
+ object({
+ id: str,
+ label: str,
+ help: str,
+ on: bool,
+ editable: bool,
+ enabled: bool,
+ actions: strings,
+ setup: optNull(str),
+ }),
+ ),
+ togglesNote: optNull(str),
+ spacesTitle: str,
+ spaces: list(object({ id: str, name: str, os: str, status: str, running: bool })),
+ spacesEmpty: optNull(str),
+ newSpace: object({ label: str, on: str, enabled: bool, help: optNull(str) }),
+ detailsTitle: str,
+ details: list(object({ label: str, value: str })),
+ remove: optNull(MachinesViewRemoveShape),
+ }),
+ ),
+ }),
+);
+
export const OP_SHAPES: Record<OpName, Schema> = {
"spaces.list": list(SpaceRowShape),
"spaces.create": SpaceRowShape,
@@ -870,6 +955,9 @@ export const OP_SHAPES: Record<OpName, Schema> = {
"volume.reveal": nul,
"agents.setupDriver": list(obj<AgentSetupOutcome>()({ agents: strings, target: str, item: str, change: str, detail: str })),
+ "machines.rename": nul,
+ "machines.remove": nul,
+ "machines.checkHealth": nul,
"spaces.openStream": obj<StreamTicket>()({ wsUrl: str, expiresAt: nullable(str) }),
"nudges.pending": list(obj<RiskyRequest>()({ id: str, agent: str, action: str, atMs: num, expiresMs: num })),
"nudges.answer": nul,
@@ -1119,6 +1207,7 @@ const WkMachinesShape = ref(
deviceStates: optNull(dict(str)),
accessNotice: optNull(MachineAccessNoticeShape),
rows: opt(list(MachinePageRowShape)),
+ view: optNull(MachinesViewShape),
}),
);
@@ -1318,6 +1407,9 @@ export const WEBKIT_SHAPES: Partial<Record<WebkitMethod, Schema>> = {
"nudges.pending": OP_SHAPES["nudges.pending"],
"nudges.answer": nul,
"resources.get": OP_SHAPES["resources.get"],
+ "machines.rename": nul,
+ "machines.remove": nul,
+ "machines.checkHealth": nul,
"checklist.get": OP_SHAPES["checklist.get"],
"checklist.send": OP_SHAPES["checklist.send"],
};
diff --git a/apps/cua-spaces-web/src/bridge/coverage.ts b/apps/cua-spaces-web/src/bridge/coverage.ts
index 822cc9ef51..553af64845 100644
--- a/apps/cua-spaces-web/src/bridge/coverage.ts
+++ b/apps/cua-spaces-web/src/bridge/coverage.ts
@@ -42,6 +42,7 @@ import { STREAM_COVERAGE } from "./ops/stream";
import { RELAY_USAGE_COVERAGE } from "./ops/relay-usage";
import { NUDGES_COVERAGE } from "./ops/nudges";
import { RESOURCES_COVERAGE } from "./ops/resources";
+import { MACHINES_COVERAGE } from "./ops/machines";
import { CHECKLIST_COVERAGE } from "./ops/checklist";
import { PRESENCE_COVERAGE } from "./ops/presence";
import { RUNTIME_FIX_COVERAGE } from "./ops/runtime-fix";
@@ -168,6 +169,7 @@ export const HOST_COVERAGE = {
...RELAY_USAGE_COVERAGE,
...NUDGES_COVERAGE,
...RESOURCES_COVERAGE,
+ ...MACHINES_COVERAGE,
...CHECKLIST_COVERAGE,
...PRESENCE_COVERAGE,
...RUNTIME_FIX_COVERAGE,
diff --git a/apps/cua-spaces-web/src/bridge/derive.ts b/apps/cua-spaces-web/src/bridge/derive.ts
index 3e4c745e07..993563ce97 100644
--- a/apps/cua-spaces-web/src/bridge/derive.ts
+++ b/apps/cua-spaces-web/src/bridge/derive.ts
@@ -17,7 +17,9 @@ import type {
HostPanelView,
HostSetupChoice,
HostStatus,
+ MachinePageRow,
MachineRow,
+ MachinesView,
SettingsInput,
SettingsPage,
} from "./contracts/host";
@@ -341,6 +343,53 @@ export interface Machine {
accessNotice?: MachineAccessNotice;
}
+/** One Machines row as the core lists it, from the page's own machine
+ * (an older host's rows, merged here): the core draws the page from it. */
+function pageRowOf(m: Machine, spaces: readonly Space[]): MachinePageRow {
+ const own = m.current ? spaces.find((s) => s.id === "this-mac") : spaces.find((s) => s.id === `relay:${m.id}`);
+ // The Spaces on it, never its own desktop (`machines::page_rows`).
+ const n = spaces.filter((s) => (m.current ? s.provider === "local" && s.id !== "this-mac" : s.host === m.id)).length;
+ return {
+ id: m.id,
+ name: m.name,
+ online: m.online,
+ os: m.os,
+ via: m.current ? "local" : "relay",
+ current: m.current,
+ device: m.device ? m.id : null,
+ deviceOnly: Boolean(m.device),
+ spaceId: own?.id ?? null,
+ stoppedSharing: Boolean(m.online && m.notSharing),
+ lastSeen: m.lastSeen ?? null,
+ status: m.status ?? (!m.online ? "Offline" : m.notSharing ? "Not sharing" : "Online"),
+ spaces: n,
+ spacesLabel: m.spacesLabel ?? (m.device ? "" : n === 0 ? "No Spaces" : `${n} Space${n === 1 ? "" : "s"}`),
+ };
+}
+
+/**
+ * The Machines page as every UI draws it (`machines.view`): the host's own
+ * when it sent one (what the SwiftUI page shows), else the core's from the
+ * rows listed here. Null without the core.
+ */
+export function machinesView(
+ core: CoreClient | undefined,
+ input: { hostView: MachinesView | null; machines: readonly Machine[]; spaces: readonly Space[]; host: object | null; nowSecs?: number },
+): MachinesView | null {
+ if (input.hostView) return input.hostView;
+ const current = input.machines.find((m) => m.current);
+ const hostOs = current && ["macos", "linux", "windows"].includes(current.os) ? current.os : "macos";
+ return (
+ core?.tryCall<MachinesView>("machines.view", {
+ input: {
+ page: { hostOs, spaces: input.spaces, now: input.nowSecs ?? Math.floor(Date.now() / 1000) },
+ rows: input.machines.map((m) => pageRowOf(m, input.spaces)),
+ host: input.host,
+ },
+ }) ?? null
+ );
+}
+
/** Which machine a Space runs on: its relay host, the machine itself for
* its own desktop (`relay:<machine>`), or this machine for a local Space;
* undefined for cloud Spaces. */
diff --git a/apps/cua-spaces-web/src/bridge/hooks.ts b/apps/cua-spaces-web/src/bridge/hooks.ts
index 0ad51a05e2..394e615a7e 100644
--- a/apps/cua-spaces-web/src/bridge/hooks.ts
+++ b/apps/cua-spaces-web/src/bridge/hooks.ts
@@ -6,7 +6,7 @@ import type { BridgeMode, DataAdapter } from "./adapter";
import { BridgeContext, type BridgeContextValue } from "./BridgeProvider";
import type { CoreClient } from "./core";
import type { AgentSetupRow } from "./contracts/agents";
-import type { OnboardingMode, PermissionHint, SignInStart } from "./contracts/host";
+import type { MachinesView, OnboardingMode, PermissionHint, SignInStart } from "./contracts/host";
import type {
OnboardingAction,
OnboardingCheckbox,
@@ -163,6 +163,16 @@ export function useSpaces(): SpacesHook {
export interface MachinesHook extends Resource<Machine[]> {
refresh(): Promise<void>;
+ /** The Machines page as every UI draws it (`machines_view::view`). */
+ view: MachinesView | null;
+ /** Renames a machine (`machines.rename`). */
+ rename(id: string, name: string): Promise<void>;
+ /** Removes a machine from the account (`machines.remove`). */
+ remove(machine: string | null, device: string | null): Promise<void>;
+ /** Asks the machines for their health (`machines.checkHealth`); their
+ * issues show in the next view. Never throws: a check that fails shows
+ * on that machine. */
+ checkHealth(): Promise<void>;
/** How another machine is set up for access, in the core's words (the
* "Add a machine" explainer). Setup itself runs on that machine. */
setupGuide: HostSetupGuide;
@@ -170,9 +180,20 @@ export interface MachinesHook extends Resource<Machine[]> {
/** Your machines (this one first), each with the Spaces it runs. */
export function useMachines(): MachinesHook {
- const { core } = useBridgeContext();
- const setupGuide = useMemo(() => hostSetupGuide(core), [core]);
- return { ...useResource<Machine[]>("machines"), setupGuide };
+ const ctx = useBridgeContext();
+ const setupGuide = useMemo(() => hostSetupGuide(ctx.core), [ctx.core]);
+ const run = useAction();
+ const r = useResource<Machine[]>("machines");
+ return {
+ ...r,
+ setupGuide,
+ view: ctx.store?.machinesView ?? null,
+ rename: (id, name) => run((s) => s.renameMachine(id, name)),
+ remove: (machine, device) => run((s) => s.removeMachine(machine, device)),
+ checkHealth: async () => {
+ await ctx.store?.checkMachinesHealth().catch(() => undefined);
+ },
+ };
}
export interface SettingsHook extends Resource<SettingsData> {
diff --git a/apps/cua-spaces-web/src/bridge/ops/machines.ts b/apps/cua-spaces-web/src/bridge/ops/machines.ts
new file mode 100644
index 0000000000..b70bec4d0a
--- /dev/null
+++ b/apps/cua-spaces-web/src/bridge/ops/machines.ts
@@ -0,0 +1,68 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+/**
+ * The Machines page's own actions: rename a machine, and remove one from
+ * the account. What each one does to which machine is the app core's
+ * (`machines_view::MachinesViewRename`, `MachinesViewRemove`); the page
+ * passes it on.
+ *
+ * | Operation | Electron | SwiftUI | Tauri |
+ * |---|---|---|---|
+ * | `machines.rename` | the host method `machines.rename` | the host method `machines.rename` | unsupported |
+ * | `machines.remove` | the host method `machines.remove` | the host method `machines.remove` | unsupported |
+ * | `machines.checkHealth` | the host method `machines.checkHealth` | the host method `machines.checkHealth` | unsupported |
+ *
+ * `machines.rename {id, name}`: `id` is a relay machine of yours, or
+ * `this-mac` for this machine (the host renames its own registration).
+ * Both hosts call the SDK's `Devices.rename_machine` from this enrolled
+ * device; this machine's host setup takes the new name too. A device of its
+ * own is renamed with `devices.rename`.
+ *
+ * `machines.remove {machine, device}`: `machine` leaves the relay directory
+ * (`Spaces.relay_unregister("relay:<machine>")`, refused while it is
+ * online), then `device` is revoked. This machine's own host setup is
+ * removed with `host.action {action: "remove"}`.
+ *
+ * `machines.checkHealth {}`: the host asks each machine the view names a
+ * `healthTarget` for (This Mac through its own daemon, another of yours
+ * through its daemon over the relay or mesh; the SDK's
+ * `Spaces.machine_health`) and keeps what came back, so the next
+ * `machines.list` view carries each machine's `issues` and `health`. The
+ * page calls it while it is open.
+ */
+
+import type { OpCoverage } from "../coverage";
+
+export interface MachinesOps {
+ "machines.rename": { args: { id: string; name: string }; result: null };
+ "machines.remove": { args: { machine?: string | null; device?: string | null }; result: null };
+ "machines.checkHealth": { args: Record<string, never>; result: null };
+}
+
+export const MACHINES_OPERATIONS = ["machines.rename", "machines.remove", "machines.checkHealth"] as const satisfies readonly (keyof MachinesOps)[];
+
+export const MACHINES_COVERAGE = {
+ "machines.rename": {
+ webkit: { methods: ["machines.rename"] },
+ tauri: [],
+ unsupported: { tauri: "the Tauri app has no Machines page actions" },
+ },
+ "machines.remove": {
+ webkit: { methods: ["machines.remove"] },
+ tauri: [],
+ unsupported: { tauri: "the Tauri app has no Machines page actions" },
+ },
+ "machines.checkHealth": {
+ webkit: { methods: ["machines.checkHealth"] },
+ tauri: [],
+ unsupported: { tauri: "the Tauri app has no machine health checks" },
+ },
+} as const satisfies Record<keyof MachinesOps, OpCoverage>;
+
+/** Arguments that take each down its usual path (coverage tests). */
+export const MACHINES_ARGS = {
+ "machines.rename": { id: "m-studio", name: "Studio" },
+ "machines.remove": { machine: "m-old", device: "dev_old" },
+ "machines.checkHealth": {},
+};
diff --git a/apps/cua-spaces-web/src/bridge/parity.ts b/apps/cua-spaces-web/src/bridge/parity.ts
index c941dcef08..d77cecac8f 100644
--- a/apps/cua-spaces-web/src/bridge/parity.ts
+++ b/apps/cua-spaces-web/src/bridge/parity.ts
@@ -17,7 +17,7 @@
import type { CoreClient } from "./core";
import type { PersistentAgent } from "./contracts/agents";
-import type { HostPanelView, MachineRow } from "./contracts/host";
+import type { HostPanelView, MachineRow, MachinesView, MachinesViewMachine } from "./contracts/host";
import type { KeyvaultOverview, KvPage, VaultState, VaultView } from "./contracts/keyvault";
import type { CreatesState, Space, SpaceRow } from "./contracts/spaces";
import {
@@ -81,7 +81,7 @@ export type ParityCheckpoint =
/** A Stream section for this input. */
| { kind: "stream"; input: StreamSectionInput; section: StreamSection }
/** This machine for the core's host state (null: not reported yet). */
- | { kind: "host-panel"; state: object | null; panel: HostPanelView }
+ | { kind: "host-panel"; state: object | null; panel: HostPanelView; machine: MachinesViewMachine | null }
/** The host setup form for this state and signed-in identity. */
| { kind: "host-form"; state: HostFormState; identity: string | null; view: HostFormView }
/** The Agents page's rows for these agents. */
@@ -156,7 +156,16 @@ function bridgeMethods(core: CoreClient, record: (c: ParityCheckpoint) => void):
// This machine and its setup form (derive.ts, this-machine.ts).
"host.panel": (a) => {
const panel = hostPanelFromState(core, a.state);
- record({ kind: "host-panel", state: a.state, panel });
+ // What the Machines page draws for This machine with this state
+ // (`machines.view`): its switches, notice and Remove.
+ const view = core.tryCall<MachinesView>("machines.view", {
+ input: {
+ page: { hostOs: "macos", spaces: [], now: 0 },
+ rows: [{ id: "this-mac", name: "This Mac", online: true, os: "macos", via: "local", current: true, device: null, deviceOnly: false, spaceId: null, stoppedSharing: false, lastSeen: null }],
+ host: a.state,
+ },
+ });
+ record({ kind: "host-panel", state: a.state, panel, machine: view?.machines[0] ?? null });
return panel;
},
"host.formInitial": () => hostFormInitial(core),
@@ -288,6 +297,8 @@ export interface ParityHandle extends NewSpaceParityHandle, TeleportParityHandle
showHostForm(state: HostFormState, identity: string | null): void;
/** These machine and device rows on the Machines page, at `now` (Unix seconds). */
showMachines(rows: MachineRow[], now: number): void;
+ /** The Machines page the core draws for this `MachinesViewInput` (its machines' health included). */
+ showMachinesView(input: object): void;
/** These persistent agents on the Agents page. */
showAgents(agents: PersistentAgent[], nowMs: number): void;
/** Sends usage events through the bridge; resolves once sent or dropped. */
@@ -351,6 +362,7 @@ export function installParityHandle(store: BridgeStore): () => void {
showHost: (state) => store.showHost(state),
showHostForm: (state, identity) => store.thisMachine.show(state, identity),
showMachines: (rows, now) => store.showMachines(rows, now),
+ showMachinesView: (input) => store.showMachinesView(input),
showAgents: (agents, nowMs) => store.showAgents(agents, nowMs),
track: async (signals) => {
await store.telemetry.track(signals);
diff --git a/apps/cua-spaces-web/src/bridge/protocol.ts b/apps/cua-spaces-web/src/bridge/protocol.ts
index b5572ed797..9e2105bb68 100644
--- a/apps/cua-spaces-web/src/bridge/protocol.ts
+++ b/apps/cua-spaces-web/src/bridge/protocol.ts
@@ -47,6 +47,7 @@ import { STREAM_OPERATIONS, type StreamOps } from "./ops/stream";
import { RELAY_USAGE_OPERATIONS, type RelayUsageOps } from "./ops/relay-usage";
import { NUDGES_OPERATIONS, type NudgesOps } from "./ops/nudges";
import { RESOURCES_OPERATIONS, type ResourcesOps } from "./ops/resources";
+import { MACHINES_OPERATIONS, type MachinesOps } from "./ops/machines";
import { CHECKLIST_OPERATIONS, type ChecklistOps } from "./ops/checklist";
import { PRESENCE_OPERATIONS, type PresenceOps } from "./ops/presence";
import { RUNTIME_FIX_OPERATIONS, type RuntimeFixOps } from "./ops/runtime-fix";
@@ -190,6 +191,7 @@ export interface HostOperations
RelayUsageOps,
NudgesOps,
ResourcesOps,
+ MachinesOps,
ChecklistOps,
PresenceOps,
RuntimeFixOps {
@@ -296,6 +298,7 @@ export const OPERATIONS = [
...RELAY_USAGE_OPERATIONS,
...NUDGES_OPERATIONS,
...RESOURCES_OPERATIONS,
+ ...MACHINES_OPERATIONS,
...CHECKLIST_OPERATIONS,
...PRESENCE_OPERATIONS,
...RUNTIME_FIX_OPERATIONS,
diff --git a/apps/cua-spaces-web/src/bridge/store.ts b/apps/cua-spaces-web/src/bridge/store.ts
index 2fca149893..2ebf99f0ab 100644
--- a/apps/cua-spaces-web/src/bridge/store.ts
+++ b/apps/cua-spaces-web/src/bridge/store.ts
@@ -18,7 +18,7 @@ import { withCreateContext } from "./create-context";
import { createReport, reportMailto, type CreateReport, type ReportSend } from "./diagnostic-report";
import type { AboutInput } from "./contracts/settings";
import { passedSteps } from "./onboarding";
-import type { MachineRow, OnboardingMode, SettingsPage, SignInPhase, SignInStart, SpaceCreateConfig, TelemetryView } from "./contracts/host";
+import type { MachineRow, MachinesView, OnboardingMode, SettingsPage, SignInPhase, SignInStart, SpaceCreateConfig, TelemetryView } from "./contracts/host";
import type { OnboardingAction, OnboardingFlowState } from "./contracts/onboarding";
import type { KeyvaultOverview, KvGrant, KvListView, KvSelection, VaultAction, VaultState } from "./contracts/keyvault";
import type { KvAccessCommand } from "./ops/keyvault-manage";
@@ -33,6 +33,8 @@ import {
keyvaultPane,
groupByApp,
hostPanelFromState,
+ hostState,
+ machinesView,
keyvaultViews,
reduceCreates,
rowsToSpaces,
@@ -265,8 +267,14 @@ export class BridgeStore {
private seenApps = new Set<string>();
/** Parity harness: this machine's host state as the core takes it. */
private hostOverride: { state: object | null } | undefined;
+ /** A Machines page the core drew from a parity input (`showMachinesView`). */
+ private viewOverride: MachinesView | null = null;
+ /** Parity: the rows were drawn by `showMachines*`; a later listing (the page's health check) must not replace them. */
+ private machinesPinned = false;
/** The clock `showMachines` lists its rows at (parity); else now. */
private machinesNow: number | undefined;
+ /** The Machines page as drawn (`machinesView`). */
+ private machinesViewSnap: MachinesView | null = null;
private inflight = new Map<ResourceName, Promise<void>>();
private timelines = new Map<string, TimelineEntry>();
private unsubscribe: (() => void) | undefined;
@@ -349,6 +357,33 @@ export class BridgeStore {
return this.resources[name] as Resource<T>;
}
+ /** The Machines page as every UI draws it (null: no core). */
+ get machinesView(): MachinesView | null {
+ return this.machinesViewSnap;
+ }
+
+ /** Renames a machine (`machines.rename`), then lists the machines again. */
+ async renameMachine(id: string, name: string): Promise<void> {
+ await this.adapter.call("machines.rename", { id, name });
+ await this.refresh("machines");
+ }
+
+ /** Asks each machine that can be checked for its health
+ * (`machines.checkHealth`), then lists the machines again, with their
+ * issues. */
+ async checkMachinesHealth(): Promise<void> {
+ await this.adapter.call("machines.checkHealth", {});
+ await this.refresh("machines");
+ }
+
+ /** Removes a machine from the account (`machines.remove`), then lists
+ * the Spaces and machines again. */
+ async removeMachine(machine: string | null, device: string | null): Promise<void> {
+ await this.adapter.call("machines.remove", { machine, device });
+ await this.refresh("spaces");
+ await this.refresh("machines");
+ }
+
/** Why the listed Spaces may be out of date (null: the host's last read worked). */
get listNotice(): string | null {
return this.listNoticeText;
@@ -402,7 +437,7 @@ export class BridgeStore {
break;
}
case "machines": {
- this.machineRows = await this.adapter.call("machines.list", {});
+ if (!this.machinesPinned) this.machineRows = await this.adapter.call("machines.list", {});
this.publishMachines();
break;
}
@@ -697,6 +732,15 @@ export class BridgeStore {
if (override) {
machines = machines.map((m) => (m.current ? { ...m, panel: hostPanelFromState(this.core, override.state) } : m));
}
+ const here = this.machineRows.find((m) => m.current && !m.device)?.host;
+ this.machinesViewSnap = machinesView(this.core, {
+ // The host's own drawing, unless a parity run drew This machine itself.
+ hostView: this.viewOverride ?? (override ? null : (this.adapter.machinesView?.() ?? null)),
+ machines,
+ spaces,
+ host: override ? override.state : here ? hostState(here) : null,
+ nowSecs: this.machinesNow,
+ });
this.set("machines", { data: machines, isLoading: false, error: null });
}
@@ -971,6 +1015,22 @@ export class BridgeStore {
this.machineRows = rows;
this.machinesNow = nowSecs;
this.hostOverride = undefined;
+ this.viewOverride = null;
+ this.machinesPinned = true;
+ this.publishMachines();
+ }
+
+ /** Draws the Machines page the core draws for `input`
+ * (`machines_view::MachinesViewInput`, as a host would send it, its
+ * machines' health included): parity and previews. */
+ showMachinesView(input: object): void {
+ const view = this.core.tryCall<MachinesView>("machines.view", { input });
+ if (!view) return;
+ this.ensured.add("machines");
+ this.machineRows = view.machines.map((m) => ({ id: m.id, name: m.name, via: m.current ? "local" : "relay", online: m.online, os: m.os, current: m.current || undefined, limits: [] }));
+ this.hostOverride = undefined;
+ this.viewOverride = view;
+ this.machinesPinned = true;
this.publishMachines();
}
@@ -981,6 +1041,7 @@ export class BridgeStore {
this.machineRows = [{ id: "this-mac", name: "This Mac", via: "local", online: true, os: "macos", current: true, limits: [] }, ...this.machineRows];
}
this.hostOverride = { state };
+ this.viewOverride = null;
this.publishMachines();
}
diff --git a/apps/cua-spaces-web/src/bridge/webkit-protocol.ts b/apps/cua-spaces-web/src/bridge/webkit-protocol.ts
index 71b2cf9d5a..4e65eaf1d2 100644
--- a/apps/cua-spaces-web/src/bridge/webkit-protocol.ts
+++ b/apps/cua-spaces-web/src/bridge/webkit-protocol.ts
@@ -30,7 +30,7 @@
*/
import type { MachineAccessNotice } from "./contracts/devices";
-import type { MachinePageRow } from "./contracts/host";
+import type { MachinePageRow, MachinesView } from "./contracts/host";
import { AGENT_DETAIL_WEBKIT_METHODS } from "./ops/agent-detail";
import { AGENT_KEYS_WEBKIT_METHODS } from "./ops/agent-keys";
import { KEYVAULT_MANAGE_WEBKIT_METHODS } from "./ops/keyvault-manage";
@@ -161,6 +161,9 @@ export const WEBKIT_METHODS = [
"nudges.pending",
"nudges.answer",
"resources.get",
+ "machines.rename",
+ "machines.remove",
+ "machines.checkHealth",
"checklist.get",
"checklist.send",
] as const;
@@ -293,6 +296,9 @@ export interface WkMachines {
/** The page's rows as the core lists them (`machines::page_rows`, what
* the SwiftUI Machines page shows); absent from an older host. */
rows?: MachinePageRow[] | null;
+ /** The Machines page as the core draws it (`machines_view::view`, what
+ * the SwiftUI Machines page shows); absent from an older host. */
+ view?: MachinesView | null;
}
/** `session.get`, `session.signIn`, `session.signOut`. */
diff --git a/apps/cua-spaces-web/src/components/__tests__/this-machine.test.tsx b/apps/cua-spaces-web/src/components/__tests__/this-machine.test.tsx
index 912fc5c97c..055f33c2df 100644
--- a/apps/cua-spaces-web/src/components/__tests__/this-machine.test.tsx
+++ b/apps/cua-spaces-web/src/components/__tests__/this-machine.test.tsx
@@ -4,12 +4,12 @@
import { act, cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react";
import { afterEach, describe, expect, it, vi } from "vitest";
-import { BridgeProvider, type HostAccessRow, type HostPanelView, type HostSetupFormView } from "@/bridge";
+import { BridgeProvider, useThisMachine, type HostAccessRow, type HostPanelView, type HostSetupFormView } from "@/bridge";
import { HostError, type DataAdapter } from "@/bridge/adapter";
import { createDemoAdapter } from "@/bridge/adapters/demo";
import { unavailableCore, type CoreClient } from "@/bridge/core";
import { ThisMachineStore, type HostFormState } from "@/bridge/this-machine";
-import { HostSetupForm, logLineParts, ThisMachine } from "@/components/this-machine";
+import { HostSetupForm, logLineParts, ThisMachineExtras } from "@/components/this-machine";
afterEach(cleanup);
@@ -75,11 +75,24 @@ function host(fail?: () => Error) {
return { adapter, actions };
}
-/** Renders the panel once the bridge's store is up (its buttons need it). */
+/** A switch on the Machines page: runs one host action, as the page's
+ * switches do (`machines_view` gives each switch its actions). */
+function Press({ action }: { action: "stop-sharing" }) {
+ const host = useThisMachine(null);
+ return (
+ <button type="button" data-press={action} onClick={() => void host.run(action).catch(() => {})}>
+ {action}
+ </button>
+ );
+}
+
+/** Renders This machine's alerts and logs once the bridge's store is up. */
async function mount(panel: HostPanelView, adapter: DataAdapter, progress?: string) {
render(
<BridgeProvider adapter={adapter} core={unavailableCore("test: no core")}>
- <ThisMachine panel={panel} progress={progress} />
+ <Press action="stop-sharing" />
+ <ThisMachineExtras panel={panel} progress={progress} part="alerts" />
+ <ThisMachineExtras panel={panel} part="logs" />
</BridgeProvider>,
);
await act(() => new Promise((r) => setTimeout(r, 10)));
@@ -116,31 +129,12 @@ describe("This machine's logs", () => {
expect(activity.querySelector("[data-host-log-background]")).toBeNull();
});
- it("keeps Stop Sharing and Remove in a bar under the page", async () => {
- await mount(sharing, host().adapter);
- const bar = document.querySelector("[data-host-actions]")!;
- expect(bar.className).toContain("sticky");
- expect([...bar.querySelectorAll("[data-host-action]")].map((b) => b.textContent)).toEqual(["Stop Sharing", "Remove host setup"]);
- });
});
-describe("relay sharing paused while signed out", () => {
- it("says so in place of the summary, with Sign In, and what the sign-in waits for", async () => {
- const { adapter, actions } = host();
- await mount(paused, adapter, "Sign in to Cua in your browser to continue. Setup finishes on its own after that.");
- expect(document.querySelector("[data-host-summary]")).toBeNull();
- expect(document.querySelector("[data-host-notice]")?.textContent).toBe(paused.notice);
+describe("what a running setup or Sign In waits for", () => {
+ it("shows over the logs while it runs", async () => {
+ await mount(paused, host().adapter, "Sign in to Cua in your browser to continue. Setup finishes on its own after that.");
expect(document.querySelector("[data-host-progress]")?.textContent).toMatch(/Sign in to Cua in your browser/);
- fireEvent.click(document.querySelector('[data-host-notice-action="sign-in"]')!);
- await waitFor(() => expect(actions).toEqual(["sign-in"]));
- });
-
- it("draws a button the core turned off as disabled, with its help as the tooltip", async () => {
- await mount(paused, host().adapter);
- const resume = document.querySelector<HTMLButtonElement>('[data-host-action="resume-sharing"]')!;
- expect(resume.disabled).toBe(true);
- expect(resume.parentElement?.getAttribute("title")).toBe("Turn on a setting to share first");
- expect(document.querySelector<HTMLButtonElement>('[data-host-action="remove"]')!.disabled).toBe(false);
});
});
@@ -159,7 +153,7 @@ describe("a failed This machine button", () => {
const writeText = vi.fn(async () => {});
Object.defineProperty(navigator, "clipboard", { value: { writeText }, configurable: true });
await mount(sharing, adapter);
- fireEvent.click(document.querySelector('[data-host-action="stop-sharing"]')!);
+ fireEvent.click(document.querySelector('[data-press="stop-sharing"]')!);
const failure = await waitFor(() => {
const f = document.querySelector<HTMLElement>("[data-host-failure]");
if (!f) throw new Error("no failure");
diff --git a/apps/cua-spaces-web/src/components/this-machine.tsx b/apps/cua-spaces-web/src/components/this-machine.tsx
index d851ba5a78..dcfdc06970 100644
--- a/apps/cua-spaces-web/src/components/this-machine.tsx
+++ b/apps/cua-spaces-web/src/components/this-machine.tsx
@@ -8,15 +8,11 @@ import {
useSession,
useThisMachine,
type HostAccessRow,
- type HostAction,
type HostFailure,
type HostFormView,
type HostPanelView,
type HostSetupFormView,
} from "@/bridge";
-import { limitsFor } from "@/bridge/friendly-errors";
-import { hostOs } from "@/bridge/host-os";
-import { ConfirmDialog } from "@/components/ui/alert-dialog";
import { Button } from "@/components/ui/button";
import { Checkbox } from "@/components/ui/checkbox";
import { Dialog, DialogPopup, DialogTitle } from "@/components/ui/dialog";
@@ -30,152 +26,81 @@ import { cn, relativeTime } from "@/lib/utils";
type HostLog = "access" | "activity";
/**
- * This machine: how it is shared, who is connected, the permissions left
- * to grant and its buttons; or the host setup form. Everything shown is the
- * core's `host.panel` / `host.formView`, laid out as the SwiftUI app's
- * `ThisMachineView`. `progress` is what a running setup or Sign In waits
- * for (the host's `HostModel.progress`).
+ * This machine's parts of the Machines page that are not the core's
+ * machine view: the setup form while it is open (no `part`), what needs
+ * the owner now (`alerts`: a running setup's progress, permissions to
+ * grant, a failed action, a log that does not verify) and the access and
+ * Spaces logs (`logs`, under Details). The switches, Spaces, Details and
+ * Remove are `machines_view::view`'s, drawn by the page.
*/
-export function ThisMachine({ panel, progress }: { panel: HostPanelView; progress?: string }) {
+export function ThisMachineExtras({ panel, progress, part }: { panel: HostPanelView | null; progress?: string; part?: "alerts" | "logs" }) {
const { data: session } = useSession();
const host = useThisMachine(session?.identity ?? null);
- const [confirming, setConfirming] = useState<HostAction | null>(null);
const [fullLog, setFullLog] = useState<HostLog | null>(null);
const now = Date.now();
- if (host.formView) {
- return <HostSetupForm view={host.formView} host={host} failure={host.setupError} progress={progress} onRetry={() => void host.retrySetUp()} />;
+ if (!part) {
+ return host.formView ? (
+ <HostSetupForm view={host.formView} host={host} failure={host.setupError} progress={progress} onRetry={() => void host.retrySetUp()} />
+ ) : null;
}
-
- const choices = panel.setupChoices ?? [];
- const press = (a: HostAction) => (a.confirm ? setConfirming(a) : void host.run(a.id));
+ if (!panel) return null;
const openSettings = (url: string) =>
host.openSettings(url).catch((e: unknown) => toast("Couldn't open System Settings", { description: e instanceof Error ? e.message : String(e), type: "error" }));
- const notice = panel.notice && !panel.intro ? panel.notice : null;
- const noticeAction = notice ? panel.noticeAction : null;
-
- return (
- <div data-host-panel={panel.configured ? "configured" : "not-configured"}>
- <Group title={panel.title}>
- <div className="px-4 py-3">
- {notice ? (
- // Relay sharing paused (signed out, or another account): one
- // line in place of the summary, and its button.
- <div className="flex items-center justify-between gap-3">
- <p data-host-notice className="text-[13px]">
- {notice}
- </p>
- {noticeAction ? (
- <ActionButton action={noticeAction} primary disabled={host.busy} onPress={() => void host.run(noticeAction.id)} data-host-notice-action={noticeAction.id} />
- ) : null}
- </div>
- ) : (
- <p data-host-summary className="text-[13px]">
- {panel.summary}
- </p>
- )}
- {panel.intro ? <p className="mt-1 text-xs text-muted-foreground">{panel.intro}</p> : null}
- {progress ? <Progress text={progress} /> : null}
- </div>
- {choices.map((c) => (
- <Row key={c.id} label={c.label} data-host-choice={c.id}>
- <Button size="sm" variant="outline" disabled={host.busy} onClick={() => host.openForm(c.id)}>
- {c.buttonLabel}
- </Button>
- </Row>
- ))}
- </Group>
-
- {panel.facts.length ? (
- <Group>
- {panel.facts.map((f) => (
- <Row key={f.label} label={f.label} data-host-fact={f.label}>
- <span className="truncate select-text">{f.value}</span>
- </Row>
- ))}
- </Group>
- ) : null}
-
- {panel.toggles?.length ? (
- <Group>
- {panel.toggles.map((t) => (
- <Row key={t.id} label={t.label} hint={t.help} data-host-toggle={t.id}>
- <Switch checked={t.on} disabled={host.busy || !t.enabled} aria-label={t.label} onCheckedChange={() => void host.run(t.action)} />
- </Row>
- ))}
- {panel.limits ? <p className="px-4 py-2.5 text-xs text-muted-foreground">{limitsFor(panel.limits, hostOs() === "macos")}</p> : null}
- </Group>
- ) : null}
- {panel.providedTitle ? (
- <Group title={panel.providedTitle}>
- {panel.providedEmpty ? <p className="px-4 py-2.5 text-[13px] text-muted-foreground">{panel.providedEmpty}</p> : null}
- <TimedRows rows={panel.provided ?? []} now={now} />
- </Group>
- ) : null}
-
- {panel.accessWarning ? <Warning>{panel.accessWarning}</Warning> : null}
- {panel.clientsTitle ? (
- <Group title={panel.clientsTitle}>
- {panel.clientsEmpty ? (
- <p data-host-clients-empty className="px-4 py-2.5 text-[13px] text-muted-foreground">
- {panel.clientsEmpty}
- </p>
- ) : null}
- {panel.clients.map((c) => (
- <p key={c} data-host-client className="truncate px-4 py-2.5 text-[13px]">
- {c}
- </p>
- ))}
- </Group>
- ) : null}
+ if (part === "alerts") {
+ const any = progress || panel.permissionsTitle || host.error || panel.accessWarning || panel.activityWarning;
+ if (!any) return null;
+ return (
+ <div className="mt-6" data-host-alerts>
+ {progress ? (
+ <div className="mb-6 rounded-xl border bg-card px-4 py-3">
+ <Progress text={progress} />
+ </div>
+ ) : null}
+ {panel.permissionsTitle ? (
+ <Group title={panel.permissionsTitle}>
+ {panel.permissions.map((p) => (
+ <Row key={p.id} label={p.title} hint={p.help} data-host-permission={p.id}>
+ {p.settingsUrl ? (
+ <Button size="sm" variant="outline" onClick={() => void openSettings(p.settingsUrl!)}>
+ {panel.openSettingsLabel}
+ </Button>
+ ) : null}
+ </Row>
+ ))}
+ </Group>
+ ) : null}
+ {host.error ? (
+ // A switch that failed: what happened in plain words, Retry, and
+ // the raw error under Details.
+ <div className="mb-6 rounded-xl border bg-card px-4 py-3 shadow-xs">
+ <FailureView failure={host.error} retrying={host.busy} onRetry={() => void host.retry()} />
+ </div>
+ ) : null}
+ {panel.accessWarning ? <Warning>{panel.accessWarning}</Warning> : null}
+ {panel.activityWarning ? <Warning>{panel.activityWarning}</Warning> : null}
+ </div>
+ );
+ }
- {panel.recentTitle && panel.recent?.length ? (
+ const access = panel.recentTitle && panel.recent?.length;
+ const activity = panel.activityTitle && panel.activity?.length;
+ if (!access && !activity) return null;
+ return (
+ <div className="mt-6" data-host-panel={panel.configured ? "configured" : "not-configured"}>
+ {access ? (
// The newest few (repeats collapsed); the rest in a sheet, so the
// page never grows with the log.
- <Group title={panel.recentTitle} more={panel.recentMore ? <ShowAll label={panel.recentMore} data-host-more="access" onClick={() => setFullLog("access")} /> : null}>
- <TimedRows rows={panel.recent} now={now} />
+ <Group title={panel.recentTitle!} more={panel.recentMore ? <ShowAll label={panel.recentMore} data-host-more="access" onClick={() => setFullLog("access")} /> : null}>
+ <TimedRows rows={panel.recent!} now={now} />
</Group>
) : null}
- {panel.activityWarning ? <Warning>{panel.activityWarning}</Warning> : null}
- {panel.activityTitle && panel.activity?.length ? (
- <Group title={panel.activityTitle} more={panel.activityMore ? <ShowAll label={panel.activityMore} data-host-more="activity" onClick={() => setFullLog("activity")} /> : null}>
- <TimedRows rows={panel.activity} now={now} keep="head" />
+ {activity ? (
+ <Group title={panel.activityTitle!} more={panel.activityMore ? <ShowAll label={panel.activityMore} data-host-more="activity" onClick={() => setFullLog("activity")} /> : null}>
+ <TimedRows rows={panel.activity!} now={now} keep="head" />
</Group>
) : null}
-
- {panel.permissionsTitle ? (
- <Group title={panel.permissionsTitle}>
- {panel.permissions.map((p) => (
- <Row key={p.id} label={p.title} hint={p.help} data-host-permission={p.id}>
- {p.settingsUrl ? (
- <Button size="sm" variant="outline" onClick={() => void openSettings(p.settingsUrl!)}>
- {panel.openSettingsLabel}
- </Button>
- ) : null}
- </Row>
- ))}
- </Group>
- ) : null}
-
- {host.error ? (
- // A button that failed: what happened in plain words, Retry, and
- // the raw error under Details.
- <div className="mb-6 rounded-xl border bg-card px-4 py-3 shadow-xs">
- <FailureView failure={host.error} retrying={host.busy} onRetry={() => void host.retry()} />
- </div>
- ) : null}
-
- {choices.length === 0 && panel.actions.length ? (
- // Pinned under the page: Stop sharing and Remove stay in view
- // however long the logs get.
- <div data-host-actions className="sticky bottom-0 z-10 -mx-1 mb-2 flex gap-2 border-t bg-background/90 px-1 py-3 backdrop-blur">
- {panel.actions.map((a, i) => (
- <ActionButton key={a.id} action={a} primary={i === 0} disabled={host.busy} onPress={() => press(a)} data-host-action={a.id} />
- ))}
- </div>
- ) : null}
-
<HostLogDialog
open={fullLog !== null}
onOpenChange={(o) => !o && setFullLog(null)}
@@ -185,17 +110,6 @@ export function ThisMachine({ panel, progress }: { panel: HostPanelView; progres
keep={fullLog === "activity" ? "head" : "tail"}
now={now}
/>
-
- <ConfirmDialog
- open={confirming !== null}
- onOpenChange={(o) => !o && setConfirming(null)}
- title={confirming?.confirm?.title ?? ""}
- description={confirming?.confirm?.message ?? ""}
- confirmLabel={confirming?.confirm?.confirmLabel ?? ""}
- cancelLabel={confirming?.confirm?.cancelLabel}
- destructive
- onConfirm={() => confirming && void host.run(confirming.id)}
- />
</div>
);
}
@@ -204,30 +118,6 @@ export function ThisMachine({ panel, progress }: { panel: HostPanelView; progres
type FormHost = Pick<ReturnType<typeof useThisMachine>, "send" | "submit" | "closeForm">;
-/** A host action button: the core's label, disabled when it says so, with its help as the tooltip. */
-function ActionButton({
- action: a,
- primary,
- disabled,
- onPress,
- ...data
-}: { action: HostAction; primary: boolean; disabled: boolean; onPress: () => void } & Record<`data-${string}`, string>) {
- return (
- <span title={a.help ?? undefined} className="inline-flex">
- <Button
- {...data}
- size="sm"
- variant={primary ? (a.destructive ? "destructive" : "default") : "outline"}
- className={cn(!primary && a.destructive && "text-destructive")}
- disabled={disabled || a.enabled === false}
- onClick={onPress}
- >
- {a.label}
- </Button>
- </span>
- );
-}
-
const TEXT_ACTION: Record<string, (text: string) => Parameters<FormHost["send"]>[0]> = {
allow: (allow) => ({ type: "set-allow", allow }),
listen: (listen) => ({ type: "set-listen", listen }),
diff --git a/apps/cua-spaces-web/src/routes/machines/index.tsx b/apps/cua-spaces-web/src/routes/machines/index.tsx
index aa8dcf3651..e057690ecb 100644
--- a/apps/cua-spaces-web/src/routes/machines/index.tsx
+++ b/apps/cua-spaces-web/src/routes/machines/index.tsx
@@ -1,29 +1,42 @@
// SPDX-License-Identifier: FSL-1.1-MIT
// Copyright (c) 2026 Cua AI, Inc.
-import { createFileRoute } from "@tanstack/react-router";
-import { LaptopIcon, PlusIcon, ServerIcon, Trash2Icon } from "lucide-react";
-import { useEffect, useState, type ReactNode } from "react";
+import { Link, createFileRoute } from "@tanstack/react-router";
+import { ChevronRightIcon, CircleAlertIcon, InfoIcon, LockIcon, PencilIcon, PlusIcon, SearchIcon, ServerIcon, TriangleAlertIcon, UsersIcon } from "lucide-react";
+import { useEffect, useMemo, useState } from "react";
-import { useBridge, useExperiments, useMachines, useSpaces, type Machine, type Space, type SpaceDetailView } from "@/bridge";
-import { spaceDetail } from "@/bridge/space-detail";
-import { UpsellPrompt } from "@/components/upsell-prompt";
+import {
+ useDevices,
+ useMachines,
+ useNewSpaceWizard,
+ useSession,
+ useThisMachine,
+ type Machine,
+ type MachinesView,
+ type MachinesViewIssue,
+ type MachinesViewMachine,
+ type MachinesViewRemove,
+ type MachinesViewToggle,
+} from "@/bridge";
import { AddMachineDialog } from "@/components/add-machine-dialog";
import { JoinWithCodeDialog } from "@/components/join-with-code-dialog";
-import { ThisMachine } from "@/components/this-machine";
+import { UpsellPrompt } from "@/components/upsell-prompt";
import { OsIcon } from "@/components/os-icon";
import { EmptyState, Page, PageHeader } from "@/components/page";
-import { StateLabel } from "@/components/state-dot";
+import { ThisMachineExtras } from "@/components/this-machine";
import { ConfirmDialog } from "@/components/ui/alert-dialog";
import { Button } from "@/components/ui/button";
+import { Dialog, DialogPopup, DialogTitle } from "@/components/ui/dialog";
+import { Input } from "@/components/ui/input";
+import { Switch } from "@/components/ui/switch";
import { toast } from "@/components/ui/toast";
-import { connectionLabel, machineOs, machinesSummary, machineSubtitle, osName, presenceLabel, presenceWord, reachable, selectedMachine, spacesLabel } from "@/lib/machines";
-import { osLabel, realSpaces, spaceState } from "@/lib/spaces";
-import { cn, relativeTime } from "@/lib/utils";
+import { useNewSpace } from "@/hooks/use-new-space";
+import { machineOs, selectedMachine } from "@/lib/machines";
+import { cn } from "@/lib/utils";
export const Route = createFileRoute("/machines/")({
component: MachinesPage,
- // `?add=1` opens "Add a machine" (the getting-started checklist links here).
+ // `?add=1` opens "Add a computer" (the getting-started checklist links here).
// `?join=<code>` opens "Join with a code" with the code filled in (a `cua://add/<code>` link
// opened on this computer); `relay` names a relay other than the production one.
validateSearch: (s: Record<string, unknown>): { add?: true; join?: string; relay?: string } => ({
@@ -33,13 +46,31 @@ export const Route = createFileRoute("/machines/")({
}),
});
+const errorText = (e: unknown) => (e instanceof Error ? e.message : String(e));
+
+/** How often the page asks the machines for their health while it is open. */
+const HEALTH_EVERY_MS = 60_000;
+
+/**
+ * Machines: the hardware. The list in groups (your machines, the ones
+ * offline for 30+ days, team machines) with one line each, and the
+ * selected machine's page: its two switches, the Spaces on it as links,
+ * New Space here, Details and Remove from account. Everything shown is the
+ * core's `machines_view::view`, as the SwiftUI page draws it. A Space's own
+ * actions (open, start, stop, teleport, drop files) stay on the Space.
+ */
function MachinesPage() {
- const { data: machines = [], isLoading, error, setupGuide } = useMachines();
- const { data: spaces = [] } = useSpaces();
- const { core } = useBridge();
- const exp = useExperiments();
- const experiments = exp.unsupported ? undefined : (exp.data?.experiments ?? {});
+ const { data: machines = [], isLoading, error, setupGuide, view, checkHealth } = useMachines();
+ // Each machine's issues come from its own daemon: asked on opening the
+ // page and every minute while it stays open.
+ useEffect(() => {
+ void checkHealth();
+ const timer = setInterval(() => void checkHealth(), HEALTH_EVERY_MS);
+ return () => clearInterval(timer);
+ // Once per visit: the hook's functions are new on every render.
+ }, []);
const [selectedId, setSelectedId] = useState<string | null>(null);
+ const [query, setQuery] = useState("");
const { add, join, relay } = Route.useSearch();
const navigate = Route.useNavigate();
const [adding, setAddingState] = useState(add === true);
@@ -58,31 +89,21 @@ function MachinesPage() {
useEffect(() => {
if (join) setJoiningState(true);
}, [join]);
- const selected = selectedMachine(machines, selectedId);
- // Reachable from here: a machine whose owner stopped sharing it is not.
- const online = machines.filter(reachable).length;
- // Another machine's own Space (`relay:<id>`), drawn by the core as the
- // SwiftUI detail draws it: its Remove action.
- const access = machines.find((m) => m.current)?.accessNotice ?? null;
- const detailOf = (m: Machine): { space: Space; detail: SpaceDetailView } | null => {
- if (m.current) return null;
- const space = spaces.find((s) => s.id === `relay:${m.id}`);
- return space ? { space, detail: spaceDetail(core, space, null, null, experiments, access) } : null;
- };
+ const shown = view?.machines ?? [];
+ const selected = selectedMachine(shown, selectedId);
+ const row = (id: string) => machines.find((m) => m.id === id);
return (
- <Page>
+ <Page className="max-w-6xl">
<PageHeader
title="Computers"
- description={
- isLoading ? "Loading computers…" : machines.length ? machinesSummary(machines.length, online) : "Computers that can run your Spaces."
- }
+ description={isLoading ? "Loading computers…" : view?.machines.length ? view.summary : "Computers that can run your Spaces."}
actions={
<div className="flex items-center gap-2">
<Button variant="ghost" onClick={() => setJoining(true)} data-join-with-code-open>
Join with a code
</Button>
- <Button variant="outline" onClick={() => setAdding(true)}>
+ <Button onClick={() => setAdding(true)} data-machines-add>
<PlusIcon /> Add a computer
</Button>
</div>
@@ -92,9 +113,9 @@ function MachinesPage() {
<EmptyState icon={<ServerIcon />} title="Couldn't load computers">
{error.message}
</EmptyState>
- ) : isLoading ? (
+ ) : isLoading || (!view && machines.length > 0) ? (
<LoadingState />
- ) : machines.length === 0 ? (
+ ) : !view || view.machines.length === 0 ? (
<EmptyState
icon={<ServerIcon />}
title="No computers yet"
@@ -104,39 +125,15 @@ function MachinesPage() {
</Button>
}
>
- Set up a Mac, Linux or Windows computer for access and it shows here, ready to run Spaces.
+ Set up a Mac, Linux or Windows computer and it shows here, ready to run Spaces.
</EmptyState>
) : (
- <div className="grid grid-cols-[minmax(0,340px)_minmax(0,1fr)] items-start gap-6">
+ <div className="grid grid-cols-[minmax(0,320px)_minmax(0,1fr)] items-start gap-8">
<div>
- <ul aria-label="Computers" className="divide-y overflow-hidden rounded-xl border bg-card shadow-xs">
- {machines.map((m) => (
- <li key={m.id}>
- <MachineRow
- machine={m}
- spaces={realSpaces(spaces).filter((s) => m.spaceIds.includes(s.id)).length}
- selected={m.id === selected?.id}
- onSelect={() => setSelectedId(m.id)}
- />
- </li>
- ))}
- </ul>
- {machines.length === 1 ? (
- <p className="mt-3 px-1 text-xs text-muted-foreground">
- Only this computer so far. Add another to run Spaces on it from here.
- </p>
- ) : null}
+ <MachineList view={view} rows={machines} query={query} onQuery={setQuery} selectedId={selected?.id ?? null} onSelect={setSelectedId} />
<UpsellPrompt surface="machine" active={machines.length >= 2 && machines.some((m) => m.via === "relay")} className="mt-3" />
</div>
- {selected ? (
- <MachineDetail
- key={selected.id}
- machine={selected}
- own={detailOf(selected)}
- spaces={realSpaces(spaces).filter((s) => selected.spaceIds.includes(s.id))}
- onRemoved={() => setSelectedId(null)}
- />
- ) : null}
+ {selected ? <MachineDetail key={selected.id} machine={selected} row={row(selected.id)} onRemoved={() => setSelectedId(null)} /> : null}
</div>
)}
<AddMachineDialog open={adding} onOpenChange={setAdding} guide={setupGuide} />
@@ -145,203 +142,509 @@ function MachinesPage() {
);
}
-function MachineIcon({ machine, className }: { machine: Machine; className?: string }) {
- const os = machineOs(machine);
- if (os) return <OsIcon os={os} className={className} />;
- const Icon = machine.current ? LaptopIcon : ServerIcon;
- return <Icon className={className} strokeWidth={1.75} />;
+/* ---- The list ---------------------------------------------------------------- */
+
+function MachineList({
+ view,
+ rows,
+ query,
+ onQuery,
+ selectedId,
+ onSelect,
+}: {
+ view: MachinesView;
+ rows: Machine[];
+ query: string;
+ onQuery: (q: string) => void;
+ selectedId: string | null;
+ onSelect: (id: string) => void;
+}) {
+ const { remove } = useMachines();
+ const [openOld, setOpenOld] = useState(false);
+ const [removingOld, setRemovingOld] = useState(false);
+ const byId = useMemo(() => new Map(view.machines.map((m) => [m.id, m] as const)), [view]);
+ const q = query.trim().toLowerCase();
+ const matches = (m: MachinesViewMachine) => !q || `${m.name} ${m.line}`.toLowerCase().includes(q);
+ const removeOld = view.groups.find((g) => g.removeAll)?.removeAll ?? null;
+ const ids = view.machines.map((m) => m.id);
+ const step = (from: string, by: number) => {
+ const visible = ids.filter((id) => matches(byId.get(id)!) && (openOld || !view.groups.find((g) => g.collapsed)?.ids.includes(id)));
+ const i = visible.indexOf(from);
+ const next = visible[Math.max(0, Math.min(visible.length - 1, i + by))];
+ if (next) {
+ onSelect(next);
+ document.querySelector<HTMLElement>(`[data-machine-id="${CSS.escape(next)}"]`)?.focus();
+ }
+ };
+
+ return (
+ <section aria-label="Machine list" className="min-w-0">
+ <label className="mb-1 flex h-[30px] items-center gap-2 rounded-lg border bg-card px-2.5 text-muted-foreground focus-within:border-brand focus-within:ring-[3px] focus-within:ring-brand/15">
+ <SearchIcon className="size-3.5 shrink-0" />
+ <input
+ type="search"
+ value={query}
+ onChange={(e) => onQuery(e.currentTarget.value)}
+ placeholder="Search machines"
+ aria-label="Search machines"
+ className="min-w-0 flex-1 bg-transparent text-[13px] text-foreground outline-none placeholder:text-muted-foreground/70"
+ />
+ </label>
+ <div role="listbox" aria-label="Computers">
+ {view.groups.map((g) => {
+ const members = g.ids.map((id) => byId.get(id)).filter((m): m is MachinesViewMachine => Boolean(m));
+ const visible = members.filter(matches);
+ if (!visible.length && q) return null;
+ const open = !g.collapsed || openOld || Boolean(q);
+ return (
+ <div key={g.id} data-machine-group={g.id}>
+ {g.collapsed ? (
+ <div className="mt-1 flex items-center justify-between">
+ <button
+ type="button"
+ aria-expanded={open}
+ onClick={() => setOpenOld((o) => !o)}
+ className="flex flex-1 cursor-default items-center gap-1.5 rounded-md px-2 py-1.5 text-left text-xs text-muted-foreground hover:bg-accent/60"
+ >
+ <ChevronRightIcon className={cn("size-3 transition-transform", open && "rotate-90")} />
+ {g.title}
+ </button>
+ {g.removeAll ? (
+ <button
+ type="button"
+ onClick={() => setRemovingOld(true)}
+ className="shrink-0 cursor-default px-1 text-xs text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground"
+ data-machines-remove-old
+ >
+ {g.removeAll.label}
+ </button>
+ ) : null}
+ </div>
+ ) : (
+ <div className="px-2 pt-3.5 pb-1 text-[11px] font-semibold tracking-[0.02em] text-muted-foreground">{g.title}</div>
+ )}
+ {visible.map((m) => (
+ <MachineRow
+ key={m.id}
+ machine={m}
+ row={rows.find((r) => r.id === m.id)}
+ hidden={!open}
+ selected={m.id === selectedId}
+ onSelect={() => onSelect(m.id)}
+ onStep={(by) => step(m.id, by)}
+ />
+ ))}
+ </div>
+ );
+ })}
+ </div>
+ {removeOld ? (
+ <ConfirmDialog
+ open={removingOld}
+ onOpenChange={setRemovingOld}
+ title={removeOld.confirm.title}
+ description={removeOld.confirm.message}
+ confirmLabel={removeOld.confirm.confirmLabel}
+ cancelLabel={removeOld.confirm.cancelLabel}
+ destructive
+ onConfirm={() => {
+ void (async () => {
+ for (const r of removeOld.removes) {
+ try {
+ await remove(r.machine ?? null, r.device ?? null);
+ } catch (e) {
+ toast("Couldn't remove a machine", { description: errorText(e), type: "error" });
+ return;
+ }
+ }
+ toast(removeOld.removes.length === 1 ? "Removed 1 old machine" : `Removed ${removeOld.removes.length} old machines`, { type: "success" });
+ })();
+ }}
+ />
+ ) : null}
+ </section>
+ );
}
-function PresenceDot({ online, notSharing }: { online: boolean; notSharing?: boolean }) {
- // Not reachable (its owner stopped sharing it): the quiet dot, as the
- // SwiftUI sidebar draws it.
- const tone = !online || notSharing ? "bg-muted-foreground/40" : "bg-success";
- return <span className={cn("size-1.5 shrink-0 rounded-full", tone)} aria-hidden />;
+/** Green when usable, grey when not; amber or red when the machine has
+ * issues (`health`). */
+function StatusDot({ online, health, className }: { online: boolean; health?: string; className?: string }) {
+ const tint = health === "fail" ? "bg-destructive" : health === "warn" ? "bg-warning" : online ? "bg-success" : "bg-muted-foreground/45";
+ return <span aria-hidden data-machine-health={health || undefined} className={cn("size-2 shrink-0 rounded-full", tint, className)} />;
}
-function MachineRow({ machine: m, spaces, selected, onSelect }: { machine: Machine; spaces: number; selected: boolean; onSelect: () => void }) {
- const count = spacesLabel(m, spaces);
+function MachineRow({
+ machine: m,
+ row,
+ hidden,
+ selected,
+ onSelect,
+ onStep,
+}: {
+ machine: MachinesViewMachine;
+ row: Machine | undefined;
+ hidden: boolean;
+ selected: boolean;
+ onSelect: () => void;
+ onStep: (by: number) => void;
+}) {
+ const os = machineOs(m);
return (
<button
type="button"
+ role="option"
+ hidden={hidden}
+ aria-selected={selected}
data-machine-id={m.id}
- data-online={m.online ? "true" : "false"}
- data-not-sharing={m.notSharing ? "true" : undefined}
- aria-current={selected ? "true" : undefined}
+ data-online={(row?.online ?? m.online) ? "true" : "false"}
+ data-not-sharing={row?.notSharing ? "true" : undefined}
onClick={onSelect}
+ onKeyDown={(e) => {
+ if (e.key === "ArrowDown" || e.key === "ArrowUp") {
+ e.preventDefault();
+ onStep(e.key === "ArrowDown" ? 1 : -1);
+ }
+ }}
className={cn(
- "flex w-full cursor-default items-center gap-3 px-3.5 py-3 text-left outline-none transition-colors focus-visible:bg-accent",
- selected ? "bg-accent" : "hover:bg-accent/60",
+ "flex w-full cursor-default items-center gap-2.5 rounded-lg px-2 py-[7px] text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring/60",
+ selected ? "bg-brand/15" : "hover:bg-accent/60",
)}
>
- <div className="flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground">
- <MachineIcon machine={m} className="size-4" />
- </div>
- <div className="min-w-0 flex-1">
- <div className="flex items-center gap-1.5">
+ <StatusDot online={m.online} health={m.health} />
+ <span className="min-w-0 flex-1">
+ <span className="flex items-center gap-1.5">
<span className="truncate text-[13px] font-medium">{m.name}</span>
- {m.current ? <span className="shrink-0 text-xs text-muted-foreground">(this computer)</span> : null}
- </div>
- <div className="truncate text-xs text-muted-foreground">{machineSubtitle(m)}</div>
- </div>
- <div className="flex shrink-0 flex-col items-end gap-1">
- <span className="inline-flex items-center gap-1.5 text-xs text-muted-foreground">
- <PresenceDot online={m.online} notSharing={Boolean(m.notSharing)} />
- {presenceWord(m)}
+ {m.badge ? <span className="shrink-0 rounded border bg-muted px-1.5 text-[10px] font-medium text-muted-foreground">{m.badge}</span> : null}
</span>
- {count ? <span className="text-xs text-muted-foreground tabular-nums">{count}</span> : null}
- </div>
+ <span className="block truncate text-xs text-muted-foreground" data-machine-line>
+ {m.line}
+ </span>
+ </span>
+ {os ? <OsIcon os={os} className="size-3.5 shrink-0 text-muted-foreground/70" /> : null}
</button>
);
}
-function MachineDetail({
- machine: m,
- own,
- spaces,
- onRemoved,
-}: {
- machine: Machine;
- own: { space: Space; detail: SpaceDetailView } | null;
- spaces: Space[];
- onRemoved: () => void;
-}) {
- const now = Date.now();
- const { deleteSpace } = useSpaces();
- const [confirming, setConfirming] = useState(false);
- // Remove: the core's Delete action for the machine's own Space, as the
- // SwiftUI detail's toolbar has it.
- const remove = own?.detail.actions.find((a) => a.id === "delete") ?? null;
- const run = (removeOnly: boolean) => {
- if (!own) return;
+/* ---- A machine's page --------------------------------------------------------------- */
+
+function MachineDetail({ machine: m, row, onRemoved }: { machine: MachinesViewMachine; row: Machine | undefined; onRemoved: () => void }) {
+ const { data: session } = useSession();
+ const host = useThisMachine(session?.identity ?? null);
+ const { remove } = useMachines();
+ const [detailsOpen, setDetailsOpen] = useState(false);
+ const [renaming, setRenaming] = useState(false);
+ const [removing, setRemoving] = useState<MachinesViewRemove | null>(null);
+ const [busy, setBusy] = useState(false);
+ const fail = (what: string) => (e: unknown) => toast(what, { description: errorText(e), type: "error" });
+
+ const flip = (t: MachinesViewToggle) => {
+ if (t.setup) return host.openForm(t.setup);
+ setBusy(true);
+ void (async () => {
+ try {
+ for (const a of t.actions) await host.run(a);
+ } catch (e) {
+ fail(`Couldn't change ${t.label}`)(e);
+ } finally {
+ setBusy(false);
+ }
+ })();
+ };
+ const runRemove = (r: MachinesViewRemove) => {
onRemoved();
- deleteSpace(own.space.id, removeOnly || own.detail.removeOnly).then(
- () => toast(`Removed ${m.name}`, { type: "success" }),
- (e: unknown) => toast(`Couldn't remove ${m.name}`, { description: e instanceof Error ? e.message : String(e), type: "error" }),
- );
+ const done = r.host ? host.run("remove") : remove(r.machine ?? null, r.device ?? null);
+ void done.then(() => toast(`Removed ${m.name}`, { type: "success" }), fail(`Couldn't remove ${m.name}`));
};
+ // A switch is read-only on another machine: dimmed when it can't be
+ // reached at all (offline), plain with a note when it is.
+ const dim = (t: MachinesViewToggle) => !t.editable && !m.togglesNote;
+
+ // This machine's setup form takes the page while it is open.
+ if (m.current && host.formView) {
+ return (
+ <section aria-label={`${m.name} details`} className="min-w-0">
+ <ThisMachineExtras panel={row?.panel ?? null} progress={row?.hostProgress} />
+ </section>
+ );
+ }
+
return (
- <section aria-label={`${m.name} details`} className="min-w-0">
- <div className="mb-5 flex items-center gap-3">
- <div className="flex size-10 shrink-0 items-center justify-center rounded-xl bg-muted text-muted-foreground">
- <MachineIcon machine={m} className="size-5" />
- </div>
- <div className="min-w-0">
- <h2 className="truncate text-[15px] font-semibold">{m.name}</h2>
- <p className="flex items-center gap-1.5 text-xs text-muted-foreground">
- <PresenceDot online={m.online} notSharing={Boolean(m.notSharing)} />
- {presenceLabel(m, now)}
- </p>
- </div>
- {remove ? (
- <Button
- variant="outline"
- size="sm"
- className="ml-auto shrink-0"
- disabled={!remove.enabled}
- title={remove.help}
- onClick={() => setConfirming(true)}
- data-machine-remove={m.id}
+ <section aria-label={`${m.name} details`} className="min-w-0 max-w-[620px]" data-machine-detail={m.id}>
+ <div className="flex items-center gap-2">
+ <h2 className="truncate text-[22px] font-semibold tracking-[-0.015em]">{m.name}</h2>
+ {m.rename ? (
+ <button
+ type="button"
+ aria-label={m.rename.title}
+ title={m.rename.title}
+ onClick={() => setRenaming(true)}
+ className="grid size-[26px] shrink-0 cursor-default place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground"
+ data-machine-rename
>
- <Trash2Icon className="text-destructive" /> {remove.label}
- </Button>
+ <PencilIcon className="size-3.5" />
+ </button>
) : null}
</div>
- {own ? (
- <ConfirmDialog
- open={confirming}
- onOpenChange={setConfirming}
- title={own.detail.confirm.title}
- description={own.detail.confirm.message}
- confirmLabel={own.detail.confirm.confirmLabel}
- cancelLabel={own.detail.confirm.cancelLabel}
- disabledReason={own.detail.confirm.confirmEnabled ? null : (own.detail.confirm.disabledReason ?? null)}
- destructive
- onConfirm={() => run(false)}
- alternative={own.detail.confirm.removeLabel ? { label: own.detail.confirm.removeLabel, onClick: () => run(true) } : null}
- />
- ) : null}
+ <p className="mt-1 flex items-center gap-1.5 text-[13px] text-muted-foreground" data-machine-status>
+ <StatusDot online={m.online} className="size-[7px]" />
+ {m.status}
+ {m.sharedBy ? (
+ <>
+ <span className="text-muted-foreground/50">·</span> {m.sharedBy}
+ </>
+ ) : null}
+ </p>
- <Group title="Overview">
- <Fact label="Operating system">{osName(m)}</Fact>
- {m.model ? <Fact label="Model">{m.model}</Fact> : null}
- <Fact label="Connection">{connectionLabel(m)}</Fact>
- {m.detail && !m.panel?.configured ? <Fact label="Status">{m.detail}</Fact> : null}
- {!m.online && m.lastSeen ? <Fact label="Last seen">{relativeTime(m.lastSeen * 1000, now)}</Fact> : null}
- {m.limits.map((l) => (
- <Fact key={l.resource} label="Limit" hint={l.reason}>
- {l.used} of {l.limit} in use
- </Fact>
- ))}
- </Group>
+ <MachineIssues machine={m} hidePermissions={Boolean(m.current && row?.panel?.permissionsTitle)} onFail={fail} />
- <Group title="Spaces">
- {spaces.length === 0 ? (
- <p className="px-4 py-3 text-[13px] text-muted-foreground">
- {m.online ? "No Spaces on this computer." : "No Spaces listed. Spaces show again when the computer is back online."}
- </p>
- ) : (
- spaces.map((s) => (
- <div key={s.id} className="flex items-center gap-3 px-4 py-2.5">
- <OsIcon os={s.os} className="size-3.5 shrink-0 text-muted-foreground" />
- <div className="min-w-0 flex-1">
- <div className="truncate text-[13px]">{s.name}</div>
- <div className="truncate text-xs text-muted-foreground">{osLabel(s)}</div>
+ <div className="mt-[22px] overflow-hidden rounded-xl border bg-card" data-machine-toggles>
+ {m.notice ? (
+ <div className="flex items-center gap-2 border-b px-4 py-2.5 text-xs text-muted-foreground" data-machine-notice>
+ <InfoIcon className="size-3.5 shrink-0" />
+ <span className="flex-1">{m.notice}</span>
+ {m.noticeAction && m.current ? (
+ <Button size="sm" variant="outline" disabled={host.busy} onClick={() => void host.run(m.noticeAction!.id).catch(fail(m.noticeAction!.label))}>
+ {m.noticeAction.label}
+ </Button>
+ ) : null}
+ </div>
+ ) : null}
+ {m.toggles.map((t, i) => (
+ <div key={t.id} className={cn("flex items-center justify-between gap-5 px-4 py-3.5", i > 0 && "border-t")} data-machine-toggle={t.id}>
+ <div className={cn(dim(t) && "opacity-50")}>
+ <div className="text-[13px] font-medium" id={`toggle-${t.id}`}>
+ {t.label}
</div>
- <StateLabel state={spaceState(s)} space={s} className="shrink-0" />
+ <div className="mt-px text-xs text-muted-foreground">{t.help}</div>
</div>
- ))
- )}
- </Group>
+ <Switch
+ checked={t.on}
+ disabled={!t.editable || !t.enabled || busy || host.busy}
+ aria-labelledby={`toggle-${t.id}`}
+ aria-readonly={!t.editable || undefined}
+ className={cn(!t.editable && !dim(t) && "data-disabled:opacity-60")}
+ onCheckedChange={() => flip(t)}
+ />
+ </div>
+ ))}
+ {m.togglesNote ? (
+ <div className="flex items-center gap-2 border-t px-4 py-2.5 text-xs text-muted-foreground" data-machine-toggles-note>
+ {m.team ? <UsersIcon className="size-3.5" /> : <LockIcon className="size-3.5" />}
+ {m.togglesNote}
+ </div>
+ ) : null}
+ </div>
+
+ {m.current ? <ThisMachineExtras panel={row?.panel ?? null} progress={row?.hostProgress} part="alerts" /> : null}
+
+ <h3 className="mt-7 mb-2 text-xs font-semibold text-muted-foreground">{m.spacesTitle}</h3>
+ <div className="overflow-hidden rounded-xl border bg-card" data-machine-spaces>
+ {m.spaces.map((s, i) => (
+ <Link
+ key={s.id}
+ to="/spaces/$spaceId"
+ params={{ spaceId: s.id }}
+ title={`Open ${s.name}`}
+ data-space-row={s.id}
+ className={cn("flex items-center gap-2.5 px-4 py-2.5 text-[13px] outline-none hover:bg-accent/50 focus-visible:bg-accent/60", i > 0 && "border-t")}
+ >
+ <span className="truncate font-mono text-xs">{s.name}</span>
+ {s.os ? (
+ <>
+ <span className="text-muted-foreground/50">·</span>
+ <span className="truncate text-muted-foreground">{s.os}</span>
+ </>
+ ) : null}
+ <span className="ml-auto flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground">
+ <StatusDot online={s.running} className="size-[7px]" />
+ {s.status}
+ </span>
+ <ChevronRightIcon className="size-3.5 shrink-0 text-muted-foreground/60" />
+ </Link>
+ ))}
+ {m.spacesEmpty ? <p className="px-4 py-3.5 text-xs text-muted-foreground">{m.spacesEmpty}</p> : null}
+ <div className="border-t px-3 py-2.5">
+ <NewSpaceHere machine={m} />
+ </div>
+ </div>
+
+ <div className="mt-6">
+ <button
+ type="button"
+ aria-expanded={detailsOpen}
+ onClick={() => setDetailsOpen((o) => !o)}
+ className="flex cursor-default items-center gap-1.5 py-1 text-xs font-semibold text-muted-foreground hover:text-foreground"
+ data-machine-details-toggle
+ >
+ <ChevronRightIcon className={cn("size-3 transition-transform", detailsOpen && "rotate-90")} />
+ {m.detailsTitle}
+ </button>
+ {detailsOpen ? (
+ <div className="mt-2" data-machine-details>
+ <dl className="overflow-hidden rounded-xl border bg-card">
+ {m.details.map((f, i) => (
+ <div key={f.label} className={cn("grid grid-cols-[140px_1fr] px-4 py-2.5 text-[13px]", i > 0 && "border-t")}>
+ <dt className="text-muted-foreground">{f.label}</dt>
+ <dd className="select-text">{f.value}</dd>
+ </div>
+ ))}
+ </dl>
+ {m.current ? <ThisMachineExtras panel={row?.panel ?? null} part="logs" /> : null}
+ </div>
+ ) : null}
+ </div>
+
+ {m.remove ? (
+ <span title={m.remove.help ?? undefined} className="mt-7 inline-flex">
+ <button
+ type="button"
+ disabled={!m.remove.enabled}
+ onClick={() => setRemoving(m.remove!)}
+ className="cursor-default py-1 text-[13px] text-destructive hover:underline hover:underline-offset-2 disabled:opacity-50 disabled:hover:no-underline"
+ data-machine-remove={m.id}
+ >
+ {m.remove.label}
+ </button>
+ </span>
+ ) : null}
- {m.panel ? <ThisMachine panel={m.panel} progress={m.hostProgress} /> : null}
+ {removing ? (
+ <ConfirmDialog
+ open
+ onOpenChange={(o) => !o && setRemoving(null)}
+ title={removing.confirm.title}
+ description={removing.confirm.message}
+ confirmLabel={removing.confirm.confirmLabel}
+ cancelLabel={removing.confirm.cancelLabel}
+ destructive
+ onConfirm={() => runRemove(removing)}
+ />
+ ) : null}
+ {m.rename ? <RenameDialog open={renaming} machine={m} onClose={() => setRenaming(false)} /> : null}
</section>
);
}
-function Group({ title, children }: { title: string; children: ReactNode }) {
+/** New Space here: the wizard with this machine chosen. */
+/**
+ * What is wrong with the machine, from its own daemon: one sentence each,
+ * with its fix where there is one here. Nothing at all when it is healthy.
+ * `hidePermissions`: This Mac lists the permissions it needs already.
+ */
+function MachineIssues({ machine: m, hidePermissions, onFail }: { machine: MachinesViewMachine; hidePermissions: boolean; onFail: (what: string) => (e: unknown) => void }) {
+ const { data: session } = useSession();
+ const host = useThisMachine(session?.identity ?? null);
+ const issues = (m.issues ?? []).filter((i) => !(hidePermissions && i.id.startsWith("machine.permissions.")));
+ if (!issues.length) return null;
+ const act = (i: MachinesViewIssue) => {
+ const a = i.action!;
+ const done = a.url ? host.openSettings(a.url) : a.hostAction ? host.run(a.hostAction) : Promise.resolve();
+ void Promise.resolve(done).catch(onFail(`Couldn't ${a.label.charAt(0).toLowerCase()}${a.label.slice(1)}`));
+ };
return (
- <section className="mb-6">
- <h3 className="mb-2 px-1 text-xs font-semibold text-muted-foreground">{title}</h3>
- <div className="divide-y overflow-hidden rounded-xl border bg-card shadow-xs">{children}</div>
- </section>
+ <>
+ <h3 className="mt-[22px] mb-2 text-xs font-semibold text-muted-foreground">{m.issuesTitle || "Issues"}</h3>
+ <div className="overflow-hidden rounded-xl border bg-card" data-machine-issues>
+ {issues.map((i, n) => (
+ <div key={i.id} className={cn("flex items-center gap-2.5 px-4 py-2.5", n > 0 && "border-t")} data-machine-issue={i.id} data-level={i.level}>
+ {i.level === "fail" ? (
+ <CircleAlertIcon aria-label="Problem" className="size-3.5 shrink-0 text-destructive" />
+ ) : (
+ <TriangleAlertIcon aria-label="Warning" className="size-3.5 shrink-0 text-warning" />
+ )}
+ <span className="min-w-0 flex-1 text-[13px]">{i.text}</span>
+ {i.action ? (
+ <Button size="sm" variant="outline" className="shrink-0" disabled={host.busy} onClick={() => act(i)} data-machine-issue-action={i.id}>
+ {i.action.label}
+ </Button>
+ ) : null}
+ </div>
+ ))}
+ </div>
+ </>
);
}
-/** A label and its value. The label never shrinks; a long value (a
- * machine's status line) wraps instead of being cut. */
-function Fact({ label, hint, children }: { label: string; hint?: string; children: ReactNode }) {
+function NewSpaceHere({ machine: m }: { machine: MachinesViewMachine }) {
+ const wizard = useNewSpaceWizard();
+ const newSpace = useNewSpace();
+ const ns = m.newSpace;
+ // Without the wizard, only this machine can be chosen (the host's own create).
+ const enabled = ns.enabled && (wizard.offered || ns.on === "local");
return (
- <div className="flex min-h-10 items-start justify-between gap-6 px-4 py-2.5">
- <div className="max-w-[50%] shrink-0">
- <div className="text-[13px] whitespace-nowrap">{label}</div>
- {hint ? <div className="mt-0.5 text-xs text-muted-foreground">{hint}</div> : null}
- </div>
- <div data-fact-value="" className="min-w-0 text-right text-[13px] break-words text-muted-foreground select-text">
- {children}
- </div>
- </div>
+ <span title={ns.help ?? undefined} className="inline-flex">
+ <Button variant="outline" size="sm" disabled={!enabled} onClick={() => (wizard.offered ? wizard.show(ns.on) : newSpace())} data-machine-new-space={ns.on}>
+ <PlusIcon /> {ns.label}
+ </Button>
+ </span>
+ );
+}
+
+function RenameDialog({ open, machine: m, onClose }: { open: boolean; machine: MachinesViewMachine; onClose: () => void }) {
+ const { rename, refresh } = useMachines();
+ const devices = useDevices();
+ const [name, setName] = useState(m.name);
+ useEffect(() => {
+ if (open) setName(m.name);
+ }, [open, m.name]);
+ const r = m.rename!;
+ const save = () => {
+ const clean = name.trim();
+ if (!clean || clean === m.name) return onClose();
+ onClose();
+ const done = r.target === "device" ? devices.rename(r.id, clean).then(refresh) : rename(r.id, clean);
+ void done.then(
+ () => toast(`Renamed to ${clean}`, { type: "success" }),
+ (e: unknown) => toast("Couldn't rename the machine", { description: errorText(e), type: "error" }),
+ );
+ };
+ return (
+ <Dialog open={open} onOpenChange={(o) => !o && onClose()}>
+ <DialogPopup className="w-[min(380px,calc(100vw-2rem))]">
+ <form
+ onSubmit={(e) => {
+ e.preventDefault();
+ save();
+ }}
+ >
+ <div className="px-5 pt-5 pb-4">
+ <DialogTitle className="text-[15px] font-semibold">{r.title}</DialogTitle>
+ <Input className="mt-3" aria-label={r.title} value={name} autoFocus maxLength={64} onChange={(e) => setName(e.currentTarget.value)} data-machine-rename-input />
+ </div>
+ <div className="flex justify-end gap-2 border-t bg-muted/60 px-5 py-3">
+ <Button type="button" variant="outline" onClick={onClose}>
+ Cancel
+ </Button>
+ <Button type="submit" disabled={!name.trim()}>
+ {r.confirmLabel}
+ </Button>
+ </div>
+ </form>
+ </DialogPopup>
+ </Dialog>
);
}
function LoadingState() {
return (
- <div aria-busy="true" aria-label="Loading computers" className="grid grid-cols-[minmax(0,340px)_minmax(0,1fr)] items-start gap-6">
- <div className="divide-y overflow-hidden rounded-xl border bg-card shadow-xs">
+ <div aria-busy="true" aria-label="Loading computers" className="grid grid-cols-[minmax(0,320px)_minmax(0,1fr)] items-start gap-8">
+ <div className="space-y-1">
+ <div className="mb-3 h-[30px] animate-pulse rounded-lg bg-muted" />
{[0, 1, 2].map((i) => (
- <div key={i} className="flex items-center gap-3 px-3.5 py-3">
- <div className="size-8 animate-pulse rounded-lg bg-muted" />
+ <div key={i} className="flex items-center gap-2.5 px-2 py-2">
+ <div className="size-2 animate-pulse rounded-full bg-muted" />
<div className="flex-1 space-y-1.5">
- <div className="h-3 w-28 animate-pulse rounded bg-muted" />
- <div className="h-2.5 w-40 animate-pulse rounded bg-muted" />
+ <div className="h-3 w-32 animate-pulse rounded bg-muted" />
+ <div className="h-2.5 w-24 animate-pulse rounded bg-muted" />
</div>
</div>
))}
</div>
<div className="space-y-3">
- <div className="h-10 w-48 animate-pulse rounded-lg bg-muted" />
- <div className="h-40 animate-pulse rounded-xl bg-muted" />
+ <div className="h-7 w-56 animate-pulse rounded-lg bg-muted" />
+ <div className="h-28 animate-pulse rounded-xl bg-muted" />
</div>
</div>
);
}
+
diff --git a/docs/content/docs/cua-cli/reference/cli/account-and-setup.mdx b/docs/content/docs/cua-cli/reference/cli/account-and-setup.mdx
index b7d0f46d83..dde038fec1 100644
--- a/docs/content/docs/cua-cli/reference/cli/account-and-setup.mdx
+++ b/docs/content/docs/cua-cli/reference/cli/account-and-setup.mdx
@@ -407,6 +407,7 @@ cua doctor [OPTIONS] [TARGET]
| <span id="cua-doctor--expect-manifest"></span>`--expect-manifest` | path | | | The image's claims (manifest JSON), for the shim or to override the guest's own. |
| <span id="cua-doctor--out"></span>`--out` | path | | | Also write the JSON report here. |
| <span id="cua-doctor--junit"></span>`--junit` | path | | | Also write JUnit XML here. |
+| <span id="cua-doctor--machine"></span>`--machine` | string | | | Check a machine's health instead, as its own cua daemon sees it (the checks the Machines page shows): another of your machines by name or id, over the relay, the mesh or its direct address, or `this`. |
| <span id="cua-doctor--expect"></span>`--expect` | string | | | Fail unless the build running in the guest is the expected one: COMPONENT=WANT with WANT `sha256:<hex>` (the executable), `git:<sha>` or a version (repeatable). Components: cua-spacesd, cua-driver, or an overlay name. `cua sb create --overlay` prints the sha256 to pass. |
| <span id="cua-doctor--strict"></span>`--strict` | boolean | `false` | | Fail on warnings and on required checks that were skipped. |
| <span id="cua-doctor--no-host"></span>`--no-host` | boolean | `false` | | Skip the host checks. |
diff --git a/docs/content/docs/cua-sdk/reference/index.mdx b/docs/content/docs/cua-sdk/reference/index.mdx
index 188b853a6d..8f3b4d3cfa 100644
--- a/docs/content/docs/cua-sdk/reference/index.mdx
+++ b/docs/content/docs/cua-sdk/reference/index.mdx
@@ -81,4 +81,4 @@ The Cua SDK in Python, TypeScript, Swift, Kotlin and Rust, all generated from th
| --- | --- |
| [Protocol](/cua-sdk/reference/protocol) | The gRPC contracts of cua-spacesd (`cua.env.v1`) and the cua daemon (`cua.daemon.v1`). |
-283 items, 355 methods. The [Types](/cua-sdk/reference/types) page lists them.
+285 items, 357 methods. The [Types](/cua-sdk/reference/types) page lists them.
diff --git a/docs/content/docs/cua-sdk/reference/protocol/env-stream.mdx b/docs/content/docs/cua-sdk/reference/protocol/env-stream.mdx
index 6b7614a29b..2c9e6375ab 100644
--- a/docs/content/docs/cua-sdk/reference/protocol/env-stream.mdx
+++ b/docs/content/docs/cua-sdk/reference/protocol/env-stream.mdx
@@ -330,6 +330,7 @@ attached to the relay: the host forwards a TCP port on its own address
| [`CancelHostSpace`](#hostspacesservicecancelhostspace) | [`CancelHostSpaceRequest`](#cancelhostspacerequest) | [`CancelHostSpaceResponse`](#cancelhostspaceresponse) | unary |
| [`SetHostSpacePower`](#hostspacesservicesethostspacepower) | [`SetHostSpacePowerRequest`](#sethostspacepowerrequest) | [`SetHostSpacePowerResponse`](#sethostspacepowerresponse) | unary |
| [`DeleteCloudSpace`](#hostspacesservicedeletecloudspace) | [`DeleteCloudSpaceRequest`](#deletecloudspacerequest) | [`DeleteCloudSpaceResponse`](#deletecloudspaceresponse) | unary |
+| [`DiagnoseHost`](#hostspacesservicediagnosehost) | [`DiagnoseHostRequest`](#diagnosehostrequest) | [`DiagnoseHostResponse`](#diagnosehostresponse) | unary |
### HostSpacesService.GetHostSpaces
@@ -384,6 +385,18 @@ relay machine. Only the owner. Lets another of the owner's devices
delete it permanently without the cloud's credentials. Works whether or
not this machine provides Spaces.
+### HostSpacesService.DiagnoseHost
+
+`/cua.env.v1.HostSpacesService/DiagnoseHost`, unary: [`DiagnoseHostRequest`](#diagnosehostrequest) to [`DiagnoseHostResponse`](#diagnosehostresponse).
+
+This machine's health as a place to run Spaces, checked by its cua
+daemon (the process that runs them): Local Network access and the app
+macOS holds responsible for it, free disk, virtualization, memory, and
+the permissions sharing its desktop needs. Read-only and bounded (a
+few seconds). Only the owner. Works whether or not this machine
+provides Spaces. The Machines page shows the warnings and failures as
+the machine's issues; `cua doctor --machine` prints them.
+
## Types in `cua/env/v1/stream.proto`
### MediaTarget
@@ -1346,6 +1359,24 @@ State of the guest mount.
## Types in `cua/env/v1/host.proto`
+### DiagnoseHostRequest
+
+Request for `HostSpacesService.DiagnoseHost`.
+
+| Field | # | Type | Description |
+| --- | --- | --- | --- |
+| `machine` | 1 | `string` | Another of the owner's machines to check instead, by id or name: the cua daemon asks that machine's own `DiagnoseHost` over the relay (or the mesh, or its direct address). Only for a call made on this machine itself; a host's cua-spacesd clears it on calls it forwards. Empty: this machine. |
+
+### DiagnoseHostResponse
+
+Response for `HostSpacesService.DiagnoseHost`.
+
+| Field | # | Type | Description |
+| --- | --- | --- | --- |
+| `report` | 1 | [`DiagnoseReport`](/cua-sdk/reference/protocol/env-system#diagnosereport) | The checks (ids `machine.*`), in the report schema `cua doctor` uses. |
+| `cua_version` | 2 | `string` | The Cua version of the daemon that ran them. |
+| `os` | 3 | `string` | The machine's operating system (`macos`, `linux`, `windows`). |
+
### HostSpacesSettings
The host's two independent settings and its limits.
diff --git a/docs/content/docs/cua-sdk/reference/protocol/index.mdx b/docs/content/docs/cua-sdk/reference/protocol/index.mdx
index 2eb2f552ec..1ef753f268 100644
--- a/docs/content/docs/cua-sdk/reference/protocol/index.mdx
+++ b/docs/content/docs/cua-sdk/reference/protocol/index.mdx
@@ -50,7 +50,7 @@ Tickets go in `?ticket=` or the WebSocket subprotocol `cua.ticket.<ticket>`. Tic
| [`TeleportService`](/cua-sdk/reference/protocol/env-stream#teleportservice) | `cua.env.v1` | [Streams, teleport, tunnels and host Spaces](/cua-sdk/reference/protocol/env-stream) | 7 |
| [`TunnelService`](/cua-sdk/reference/protocol/env-stream#tunnelservice) | `cua.env.v1` | [Streams, teleport, tunnels and host Spaces](/cua-sdk/reference/protocol/env-stream) | 6 |
| [`VolumeService`](/cua-sdk/reference/protocol/env-stream#volumeservice) | `cua.env.v1` | [Streams, teleport, tunnels and host Spaces](/cua-sdk/reference/protocol/env-stream) | 3 |
-| [`HostSpacesService`](/cua-sdk/reference/protocol/env-stream#hostspacesservice) | `cua.env.v1` | [Streams, teleport, tunnels and host Spaces](/cua-sdk/reference/protocol/env-stream) | 6 |
+| [`HostSpacesService`](/cua-sdk/reference/protocol/env-stream#hostspacesservice) | `cua.env.v1` | [Streams, teleport, tunnels and host Spaces](/cua-sdk/reference/protocol/env-stream) | 7 |
| [`SandboxService`](/cua-sdk/reference/protocol/daemon#sandboxservice) | `cua.daemon.v1` | [Cua daemon](/cua-sdk/reference/protocol/daemon) | 20 |
| [`RuntimeService`](/cua-sdk/reference/protocol/daemon#runtimeservice) | `cua.daemon.v1` | [Cua daemon](/cua-sdk/reference/protocol/daemon) | 5 |
| [`SpaceService`](/cua-sdk/reference/protocol/daemon#spaceservice) | `cua.daemon.v1` | [Cua daemon](/cua-sdk/reference/protocol/daemon) | 18 |
diff --git a/docs/content/docs/cua-sdk/reference/rust/cua-sdk.mdx b/docs/content/docs/cua-sdk/reference/rust/cua-sdk.mdx
index 17d555ed6e..989e4cd5da 100644
--- a/docs/content/docs/cua-sdk/reference/rust/cua-sdk.mdx
+++ b/docs/content/docs/cua-sdk/reference/rust/cua-sdk.mdx
@@ -18,7 +18,7 @@ The cua SDK: the only `#[uniffi::export]` crate of `libs/cua`.
These are the objects, records, enums and functions the language bindings export, documented once in the [Cua SDK reference](/cua-sdk/reference), whose Rust tabs show each signature. Objects are `Arc<T>` handles whose methods are `async fn` returning `Result<_, CuaError>`, records are structs with public fields, and names are snake_case.
-[`agent_event_category`](/cua-sdk/reference/agents#agent_event_category), [`agent_harnesses`](/cua-sdk/reference/agents#agent_harnesses), [`AgentActionReport`](/cua-sdk/reference/spaces#agentactionreport-record), [`AgentArtifact`](/cua-sdk/reference/agents#agentartifact-record), [`AgentDelivery`](/cua-sdk/reference/spaces/persistent-agents#agentdelivery-record), [`AgentEvent`](/cua-sdk/reference/agents#agentevent-record), [`AgentEventPage`](/cua-sdk/reference/agents#agenteventpage-record), [`AgentFile`](/cua-sdk/reference/agents#agentfile-record), [`AgentInfo`](/cua-sdk/reference/agents#agentinfo-record), [`AgentMcpServer`](/cua-sdk/reference/agents#agentmcpserver-record), [`AgentPauseReport`](/cua-sdk/reference/spaces/persistent-agents#agentpausereport-record), [`AgentResumeReport`](/cua-sdk/reference/spaces/persistent-agents#agentresumereport-record), [`AgentRun`](/cua-sdk/reference/agents#agentrun), [`AgentRunInfo`](/cua-sdk/reference/agents#agentruninfo-record), [`AgentRunMcpServer`](/cua-sdk/reference/agents#agentrunmcpserver-record), [`AgentRunOptions`](/cua-sdk/reference/agents#agentrunoptions-record), [`AgentRunResult`](/cua-sdk/reference/agents#agentrunresult-record), [`AgentRunStatus`](/cua-sdk/reference/spaces#agentrunstatus-record), [`Agents`](/cua-sdk/reference/agents#agents), [`AgentSetup`](/cua-sdk/reference/agents#agentsetup), [`AgentSetupChange`](/cua-sdk/reference/agents#agentsetupchange-enum), [`AgentSetupOutcome`](/cua-sdk/reference/agents#agentsetupoutcome-record), [`AgentSetupTarget`](/cua-sdk/reference/agents#agentsetuptarget-enum), [`AgentStartReport`](/cua-sdk/reference/spaces#agentstartreport-record), [`AgentTranscript`](/cua-sdk/reference/agents#agenttranscript), [`AgentTranscriptItem`](/cua-sdk/reference/agents#agenttranscriptitem-record), [`ambiguous_sandbox_candidates`](/cua-sdk/reference/sandbox#ambiguous_sandbox_candidates), [`AudioPacket`](/cua-sdk/reference/spacesd/computer#audiopacket-record), [`AudioSink`](/cua-sdk/reference/spacesd/computer#audiosink), [`Auth`](/cua-sdk/reference/auth#auth), [`AuthIdentity`](/cua-sdk/reference/auth#authidentity-record), [`AuthStatus`](/cua-sdk/reference/auth#authstatus-record), [`BuildFile`](/cua-sdk/reference/image#buildfile-record), [`BundledSkill`](/cua-sdk/reference/agents#bundledskill-record), [`canonical_image`](/cua-sdk/reference/image#canonical_image), [`canonical_image_tier`](/cua-sdk/reference/image#canonical_image_tier), [`check_placement`](/cua-sdk/reference/cua#check_placement), [`CloudCheck`](/cua-sdk/reference/spaces/persistent-agents#cloudcheck-record), [`CloudConnected`](/cua-sdk/reference/spaces/persistent-agents#cloudconnected-record), [`CloudCredentials`](/cua-sdk/reference/spaces/persistent-agents#cloudcredentials-record), [`CloudDisconnected`](/cua-sdk/reference/spaces/persistent-agents#clouddisconnected-record), [`CloudKind`](/cua-sdk/reference/spaces/persistent-agents#cloudkind-record), [`CloudProvider`](/cua-sdk/reference/spaces/persistent-agents#cloudprovider-record), [`CloudResource`](/cua-sdk/reference/spaces/persistent-agents#cloudresource-record), [`CloudStatus`](/cua-sdk/reference/spaces/persistent-agents#cloudstatus-record), [`CloudSweepItem`](/cua-sdk/reference/spaces/persistent-agents#cloudsweepitem-record), [`CloudSweepReport`](/cua-sdk/reference/spaces/persistent-agents#cloudsweepreport-record), [`CloudTarget`](/cua-sdk/reference/spaces/persistent-agents#cloudtarget-record), [`CloudTestReport`](/cua-sdk/reference/spaces/persistent-agents#cloudtestreport-record), [`ComputerGrant`](/cua-sdk/reference/spaces/persistent-agents#computergrant-record), [`ComputerResources`](/cua-sdk/reference/spaces/resources#computerresources-record), [`config_get`](/cua-sdk/reference/cua#config_get), [`config_list`](/cua-sdk/reference/cua#config_list), [`config_path`](/cua-sdk/reference/cua#config_path), [`config_set`](/cua-sdk/reference/cua#config_set), [`config_unset`](/cua-sdk/reference/cua#config_unset), [`ConfigEntry`](/cua-sdk/reference/cua#configentry-record), [`Container`](/cua-sdk/reference/image#container-record), [`contrib_providers_built`](/cua-sdk/reference/sandbox#contrib_providers_built), [`Cua`](/cua-sdk/reference/cua#cua), [`CuaConfig`](/cua-sdk/reference/cua#cuaconfig-record), [`CuaInfo`](/cua-sdk/reference/cua#cuainfo-record), [`CuaMode`](/cua-sdk/reference/cua#cuamode-enum), [`CursorArt`](/cua-sdk/reference/spaces/streams#cursorart-record), [`DeviceEnrollment`](/cua-sdk/reference/spaces/host#deviceenrollment-record), [`Devices`](/cua-sdk/reference/spaces/host#devices), [`DevicesSnapshot`](/cua-sdk/reference/spaces/host#devicessnapshot-record), [`DiskLevel`](/cua-sdk/reference/spaces/resources#disklevel-enum), [`DiskOnHost`](/cua-sdk/reference/spaces/resources#diskonhost-record), [`DiskWarning`](/cua-sdk/reference/spaces/resources#diskwarning-record), [`DoctorReport`](/cua-sdk/reference/cua#doctorreport-record), [`DriveAccessRequest`](/cua-sdk/reference/spaces/volume#driveaccessrequest-record), [`DriveAudit`](/cua-sdk/reference/spaces/volume#driveaudit-record), [`DriveAuditEvent`](/cua-sdk/reference/spaces/volume#driveauditevent-record), [`DriveCacheStats`](/cua-sdk/reference/spaces/volume#drivecachestats-record), [`DriveConflict`](/cua-sdk/reference/spaces/volume#driveconflict-record), [`DriveDevice`](/cua-sdk/reference/spaces/volume#drivedevice-record), [`DriveEntry`](/cua-sdk/reference/spaces/volume#driveentry-record), [`DriveFile`](/cua-sdk/reference/spaces/volume#drivefile-record), [`DriveFileSync`](/cua-sdk/reference/spaces/volume#drivefilesync-record), [`DriveGrant`](/cua-sdk/reference/spaces/volume#drivegrant-record), [`DriveListing`](/cua-sdk/reference/spaces/volume#drivelisting-record), [`DriveMountStatus`](/cua-sdk/reference/spaces/volume#drivemountstatus-record), [`DriveObject`](/cua-sdk/reference/spaces/volume#driveobject-record), [`DrivePendingUpload`](/cua-sdk/reference/spaces/volume#drivependingupload-record), [`DriveS3Settings`](/cua-sdk/reference/spaces/volume#drives3settings-record), [`DriveSpaceVolume`](/cua-sdk/reference/spaces/volume#drivespacevolume-record), [`DriveStorage`](/cua-sdk/reference/spaces/volume#drivestorage-record), [`DriveStorageCheck`](/cua-sdk/reference/spaces/volume#drivestoragecheck-record), [`DriveStorageUpdate`](/cua-sdk/reference/spaces/volume#drivestorageupdate-record), [`DriveSyncEvent`](/cua-sdk/reference/spaces/volume#drivesyncevent-record), [`DriveSyncEvents`](/cua-sdk/reference/spaces/volume#drivesyncevents-record), [`DriveSyncStatus`](/cua-sdk/reference/spaces/volume#drivesyncstatus-record), [`DriveVersion`](/cua-sdk/reference/spaces/volume#driveversion-record), [`DriveView`](/cua-sdk/reference/spaces/volume#driveview-record), [`FrameSink`](/cua-sdk/reference/spacesd/computer#framesink), [`GpuOption`](/cua-sdk/reference/spaces#gpuoption-record), [`GpuSupport`](/cua-sdk/reference/spaces#gpusupport-record), [`GuestDisplay`](/cua-sdk/reference/spacesd#guestdisplay), [`GuestUsage`](/cua-sdk/reference/spaces/resources#guestusage-record), [`HomeTransfer`](/cua-sdk/reference/spaces/persistent-agents#hometransfer-record), [`Host`](/cua-sdk/reference/spaces/host#host), [`HostAccessRecord`](/cua-sdk/reference/spaces/host#hostaccessrecord-record), [`HostPermission`](/cua-sdk/reference/spaces/host#hostpermission-record), [`HostProvidedSpace`](/cua-sdk/reference/spaces/host#hostprovidedspace-record), [`HostSettingsChange`](/cua-sdk/reference/spaces/host#hostsettingschange-record), [`HostSetupOptions`](/cua-sdk/reference/spaces/host#hostsetupoptions-record), [`HostSpacesAuditRecord`](/cua-sdk/reference/spaces/host#hostspacesauditrecord-record), [`HostStatus`](/cua-sdk/reference/spaces/host#hoststatus-record), [`HttpHeader`](/cua-sdk/reference/services#httpheader-record), [`HttpResponse`](/cua-sdk/reference/services#httpresponse-record), [`image_alias`](/cua-sdk/reference/image#image_alias), [`ImageBuild`](/cua-sdk/reference/image#imagebuild-record), [`ImageInfo`](/cua-sdk/reference/image#imageinfo-record), [`ImageLayer`](/cua-sdk/reference/image#imagelayer-enum), [`Local`](/cua-sdk/reference/cua#local), [`LocalImage`](/cua-sdk/reference/cua#localimage-record), [`LocalStorage`](/cua-sdk/reference/cua#localstorage-record), [`LocationInfo`](/cua-sdk/reference/cua#locationinfo-record), [`locations`](/cua-sdk/reference/cua#locations), [`LoginAttempt`](/cua-sdk/reference/auth#loginattempt), [`LoginMethod`](/cua-sdk/reference/auth#loginmethod-enum), [`may_have_session`](/cua-sdk/reference/auth#may_have_session), [`mcp_connect`](/cua-sdk/reference/services#mcp_connect), [`mcp_connect_url`](/cua-sdk/reference/services#mcp_connect_url), [`McpClient`](/cua-sdk/reference/services#mcpclient), [`McpConfig`](/cua-sdk/reference/services#mcpconfig-record), [`MediaBridge`](/cua-sdk/reference/spacesd/computer#mediabridge-record), [`MediaEvent`](/cua-sdk/reference/spacesd/computer#mediaevent-record), [`MediaSession`](/cua-sdk/reference/spacesd/computer#mediasession), [`MediaStats`](/cua-sdk/reference/spacesd/computer#mediastats-record), [`normalize_image`](/cua-sdk/reference/image#normalize_image), [`NotificationInfo`](/cua-sdk/reference/spaces/persistent-agents#notificationinfo-record), [`omarchy_image`](/cua-sdk/reference/image#omarchy_image), [`Overlay`](/cua-sdk/reference/sandbox#overlay-record), [`OverlayResult`](/cua-sdk/reference/sandbox#overlayresult-record), [`PairingCode`](/cua-sdk/reference/spaces/host#pairingcode-record), [`parse_sandbox_ref`](/cua-sdk/reference/sandbox#parse_sandbox_ref), [`PersistentAgentInfo`](/cua-sdk/reference/spaces/persistent-agents#persistentagentinfo-record), [`PersistentAgentOptions`](/cua-sdk/reference/spaces/persistent-agents#persistentagentoptions-record), [`PortForward`](/cua-sdk/reference/services#portforward), [`presence_color`](/cua-sdk/reference/spaces/streams#presence_color), [`presence_conformance_json`](/cua-sdk/reference/spaces/streams#presence_conformance_json), [`presence_cursor_art`](/cua-sdk/reference/spaces/streams#presence_cursor_art), [`presence_cursor_art_all`](/cua-sdk/reference/spaces/streams#presence_cursor_art_all), [`presence_cursor_art_svg`](/cua-sdk/reference/spaces/streams#presence_cursor_art_svg), [`presence_now_ms`](/cua-sdk/reference/spaces/streams#presence_now_ms), [`presence_text_color`](/cua-sdk/reference/spaces/streams#presence_text_color), [`PresenceCursor`](/cua-sdk/reference/spaces/streams#presencecursor-record), [`PresenceDrawable`](/cua-sdk/reference/spaces/streams#presencedrawable-record), [`PresenceEvent`](/cua-sdk/reference/spaces/streams#presenceevent-record), [`PresenceIdentity`](/cua-sdk/reference/spaces/streams#presenceidentity-record), [`PresenceMember`](/cua-sdk/reference/spaces/streams#presencemember-record), [`PresenceParticipant`](/cua-sdk/reference/spaces/streams#presenceparticipant-record), [`PresencePoint`](/cua-sdk/reference/spaces/streams#presencepoint-record), [`PresenceView`](/cua-sdk/reference/spaces/streams#presenceview), [`PublicUrl`](/cua-sdk/reference/services#publicurl-record), [`qualify_sandbox_ref`](/cua-sdk/reference/sandbox#qualify_sandbox_ref), [`ReadinessProbe`](/cua-sdk/reference/image#readinessprobe-record), [`RegistrySecret`](/cua-sdk/reference/image#registrysecret-enum), [`Relay`](/cua-sdk/reference/spaces/host#relay), [`RelayAuditEvent`](/cua-sdk/reference/spaces/host#relayauditevent-record), [`RelayClientInfo`](/cua-sdk/reference/spaces/host#relayclientinfo-record), [`RelayDevice`](/cua-sdk/reference/spaces/host#relaydevice-record), [`RelayMachine`](/cua-sdk/reference/spaces/host#relaymachine-record), [`ReplayMode`](/cua-sdk/reference/spacesd#replaymode-enum), [`resolve_image`](/cua-sdk/reference/image#resolve_image), [`resolve_image_with_secret`](/cua-sdk/reference/image#resolve_image_with_secret), [`ResolvedImage`](/cua-sdk/reference/image#resolvedimage-record), [`ResourcesEvent`](/cua-sdk/reference/spaces/resources#resourcesevent-enum), [`ResourcesListener`](/cua-sdk/reference/spaces/resources#resourceslistener), [`ResourcesSnapshot`](/cua-sdk/reference/spaces/resources#resourcessnapshot-record), [`ResourcesUpdate`](/cua-sdk/reference/spaces/resources#resourcesupdate-record), [`ResourcesWatch`](/cua-sdk/reference/spaces/resources#resourceswatch), [`RoutineInfo`](/cua-sdk/reference/spaces/persistent-agents#routineinfo-record), [`RuntimeCheck`](/cua-sdk/reference/cua#runtimecheck-record), [`RuntimeCheckStatus`](/cua-sdk/reference/cua#runtimecheckstatus-enum), [`Sandbox`](/cua-sdk/reference/sandbox#sandbox), [`sandbox_locations`](/cua-sdk/reference/sandbox#sandbox_locations), [`SandboxCreateOptions`](/cua-sdk/reference/image#sandboxcreateoptions-record), [`Sandboxes`](/cua-sdk/reference/sandbox#sandboxes), [`SandboxInfo`](/cua-sdk/reference/sandbox#sandboxinfo-record), [`SandboxListing`](/cua-sdk/reference/sandbox#sandboxlisting-record), [`SandboxPhase`](/cua-sdk/reference/sandbox#sandboxphase-enum), [`SandboxRefParts`](/cua-sdk/reference/sandbox#sandboxrefparts-record), [`SandboxStatus`](/cua-sdk/reference/sandbox#sandboxstatus-enum), [`Service`](/cua-sdk/reference/services#service), [`ServiceEndpoint`](/cua-sdk/reference/services#serviceendpoint-record), [`SetupStep`](/cua-sdk/reference/cua#setupstep-record), [`SiteLoginOptions`](/cua-sdk/reference/spaces/space#siteloginoptions-record), [`SiteLoginReport`](/cua-sdk/reference/spaces/space#siteloginreport-record), [`Space`](/cua-sdk/reference/spaces/space#space), [`SpaceAgentOptions`](/cua-sdk/reference/spaces#spaceagentoptions-record), [`SpaceAppIcon`](/cua-sdk/reference/spaces/space#spaceappicon-record), [`SpaceAppIconRequest`](/cua-sdk/reference/spaces/space#spaceappiconrequest-record), [`SpaceBashResult`](/cua-sdk/reference/spaces/space#spacebashresult-record), [`SpaceCancelOutcome`](/cua-sdk/reference/spaces#spacecanceloutcome-record), [`SpaceCreateListener`](/cua-sdk/reference/spaces#spacecreatelistener), [`SpaceCreateOptions`](/cua-sdk/reference/spaces#spacecreateoptions-record), [`SpaceCreateProgress`](/cua-sdk/reference/spaces#spacecreateprogress-record), [`SpaceCreateResult`](/cua-sdk/reference/spaces#spacecreateresult-record), [`SpaceDisplay`](/cua-sdk/reference/spaces/space#spacedisplay-record), [`SpaceHotspotStatus`](/cua-sdk/reference/spaces/space#spacehotspotstatus-record), [`SpaceInfo`](/cua-sdk/reference/spaces#spaceinfo-record), [`SpacePowerReport`](/cua-sdk/reference/spaces#spacepowerreport-record), [`SpacePresence`](/cua-sdk/reference/spaces/streams#spacepresence), [`SpaceRelayRegistration`](/cua-sdk/reference/spaces/space#spacerelayregistration-record), [`SpaceResources`](/cua-sdk/reference/spaces/resources#spaceresources-record), [`Spaces`](/cua-sdk/reference/spaces#spaces), [`spaces_tool_methods`](/cua-sdk/reference/spaces#spaces_tool_methods), [`SpacesdClient`](/cua-sdk/reference/spacesd#spacesdclient), [`SpacesdHttpHeader`](/cua-sdk/reference/spacesd#spacesdhttpheader-record), [`SpacesdHttpRequest`](/cua-sdk/reference/spacesd#spacesdhttprequest-record), [`SpacesdHttpResponse`](/cua-sdk/reference/spacesd#spacesdhttpresponse-record), [`SpacesdProcess`](/cua-sdk/reference/spacesd#spacesdprocess), [`SpaceSendFileOptions`](/cua-sdk/reference/spaces/space#spacesendfileoptions-record), [`SpaceSendFileReport`](/cua-sdk/reference/spaces/space#spacesendfilereport-record), [`SpaceSentFile`](/cua-sdk/reference/spaces/space#spacesentfile-record), [`SpaceShareEntry`](/cua-sdk/reference/spaces/space#spaceshareentry-record), [`SpaceShares`](/cua-sdk/reference/spaces/space#spaceshares-record), [`SpacesHost`](/cua-sdk/reference/spaces/space#spaceshost-record), [`SpacesHostLimit`](/cua-sdk/reference/spaces/space#spaceshostlimit-record), [`SpacesToolMethod`](/cua-sdk/reference/spaces#spacestoolmethod-record), [`SpaceStreamOptions`](/cua-sdk/reference/spaces/streams#spacestreamoptions-record), [`SpaceStreamSession`](/cua-sdk/reference/spaces/streams#spacestreamsession), [`SpaceStreamStats`](/cua-sdk/reference/spaces/streams#spacestreamstats-record), [`SpaceStreamTicket`](/cua-sdk/reference/spaces/streams#spacestreamticket-record), [`SpaceToolInfo`](/cua-sdk/reference/spaces/space#spacetoolinfo-record), [`SpaceToolResult`](/cua-sdk/reference/spaces/space#spacetoolresult-record), [`SpaceTransferReport`](/cua-sdk/reference/spaces/space#spacetransferreport-record), [`SpaceUsage`](/cua-sdk/reference/spaces/space#spaceusage-record), [`SpaceWindow`](/cua-sdk/reference/spaces/space#spacewindow-record), [`SpaceWriteReport`](/cua-sdk/reference/spaces/space#spacewritereport-record), [`StorageVolume`](/cua-sdk/reference/cua#storagevolume-record), [`StreamStatsReport`](/cua-sdk/reference/auth#streamstatsreport-record), [`telemetry_acknowledge_link_notice`](/cua-sdk/reference/auth#telemetry_acknowledge_link_notice), [`telemetry_acknowledge_notice`](/cua-sdk/reference/auth#telemetry_acknowledge_notice), [`telemetry_flush`](/cua-sdk/reference/auth#telemetry_flush), [`telemetry_link_notice`](/cua-sdk/reference/auth#telemetry_link_notice), [`telemetry_link_notice_due`](/cua-sdk/reference/auth#telemetry_link_notice_due), [`telemetry_link_state`](/cua-sdk/reference/auth#telemetry_link_state), [`telemetry_notice_text`](/cua-sdk/reference/auth#telemetry_notice_text), [`telemetry_record_bench_run`](/cua-sdk/reference/auth#telemetry_record_bench_run), [`telemetry_record_feature`](/cua-sdk/reference/auth#telemetry_record_feature), [`telemetry_record_onboarding_step`](/cua-sdk/reference/auth#telemetry_record_onboarding_step), [`telemetry_record_stream_stats`](/cua-sdk/reference/auth#telemetry_record_stream_stats), [`telemetry_reset_id`](/cua-sdk/reference/auth#telemetry_reset_id), [`telemetry_schema_json`](/cua-sdk/reference/auth#telemetry_schema_json), [`telemetry_set_enabled`](/cua-sdk/reference/auth#telemetry_set_enabled), [`telemetry_set_surface`](/cua-sdk/reference/auth#telemetry_set_surface), [`telemetry_show_last`](/cua-sdk/reference/auth#telemetry_show_last), [`telemetry_status`](/cua-sdk/reference/auth#telemetry_status), [`telemetry_sync_account`](/cua-sdk/reference/auth#telemetry_sync_account), [`telemetry_use_app_notice`](/cua-sdk/reference/auth#telemetry_use_app_notice), [`TelemetryLinkNotice`](/cua-sdk/reference/auth#telemetrylinknotice-record), [`TelemetryStatus`](/cua-sdk/reference/auth#telemetrystatus-record), [`TeleportApprover`](/cua-sdk/reference/spaces/space#teleportapprover), [`TeleportDecision`](/cua-sdk/reference/spaces/space#teleportdecision-record), [`TeleportItem`](/cua-sdk/reference/spaces/space#teleportitem-record), [`TeleportManifest`](/cua-sdk/reference/spaces/space#teleportmanifest-record), [`TeleportReceipt`](/cua-sdk/reference/spaces/space#teleportreceipt-record), [`VideoFrame`](/cua-sdk/reference/spacesd/computer#videoframe-record), [`ViewerLink`](/cua-sdk/reference/sandbox#viewerlink-record), [`ViewerOptions`](/cua-sdk/reference/sandbox#vieweroptions-record).
+[`agent_event_category`](/cua-sdk/reference/agents#agent_event_category), [`agent_harnesses`](/cua-sdk/reference/agents#agent_harnesses), [`AgentActionReport`](/cua-sdk/reference/spaces#agentactionreport-record), [`AgentArtifact`](/cua-sdk/reference/agents#agentartifact-record), [`AgentDelivery`](/cua-sdk/reference/spaces/persistent-agents#agentdelivery-record), [`AgentEvent`](/cua-sdk/reference/agents#agentevent-record), [`AgentEventPage`](/cua-sdk/reference/agents#agenteventpage-record), [`AgentFile`](/cua-sdk/reference/agents#agentfile-record), [`AgentInfo`](/cua-sdk/reference/agents#agentinfo-record), [`AgentMcpServer`](/cua-sdk/reference/agents#agentmcpserver-record), [`AgentPauseReport`](/cua-sdk/reference/spaces/persistent-agents#agentpausereport-record), [`AgentResumeReport`](/cua-sdk/reference/spaces/persistent-agents#agentresumereport-record), [`AgentRun`](/cua-sdk/reference/agents#agentrun), [`AgentRunInfo`](/cua-sdk/reference/agents#agentruninfo-record), [`AgentRunMcpServer`](/cua-sdk/reference/agents#agentrunmcpserver-record), [`AgentRunOptions`](/cua-sdk/reference/agents#agentrunoptions-record), [`AgentRunResult`](/cua-sdk/reference/agents#agentrunresult-record), [`AgentRunStatus`](/cua-sdk/reference/spaces#agentrunstatus-record), [`Agents`](/cua-sdk/reference/agents#agents), [`AgentSetup`](/cua-sdk/reference/agents#agentsetup), [`AgentSetupChange`](/cua-sdk/reference/agents#agentsetupchange-enum), [`AgentSetupOutcome`](/cua-sdk/reference/agents#agentsetupoutcome-record), [`AgentSetupTarget`](/cua-sdk/reference/agents#agentsetuptarget-enum), [`AgentStartReport`](/cua-sdk/reference/spaces#agentstartreport-record), [`AgentTranscript`](/cua-sdk/reference/agents#agenttranscript), [`AgentTranscriptItem`](/cua-sdk/reference/agents#agenttranscriptitem-record), [`ambiguous_sandbox_candidates`](/cua-sdk/reference/sandbox#ambiguous_sandbox_candidates), [`AudioPacket`](/cua-sdk/reference/spacesd/computer#audiopacket-record), [`AudioSink`](/cua-sdk/reference/spacesd/computer#audiosink), [`Auth`](/cua-sdk/reference/auth#auth), [`AuthIdentity`](/cua-sdk/reference/auth#authidentity-record), [`AuthStatus`](/cua-sdk/reference/auth#authstatus-record), [`BuildFile`](/cua-sdk/reference/image#buildfile-record), [`BundledSkill`](/cua-sdk/reference/agents#bundledskill-record), [`canonical_image`](/cua-sdk/reference/image#canonical_image), [`canonical_image_tier`](/cua-sdk/reference/image#canonical_image_tier), [`check_placement`](/cua-sdk/reference/cua#check_placement), [`CloudCheck`](/cua-sdk/reference/spaces/persistent-agents#cloudcheck-record), [`CloudConnected`](/cua-sdk/reference/spaces/persistent-agents#cloudconnected-record), [`CloudCredentials`](/cua-sdk/reference/spaces/persistent-agents#cloudcredentials-record), [`CloudDisconnected`](/cua-sdk/reference/spaces/persistent-agents#clouddisconnected-record), [`CloudKind`](/cua-sdk/reference/spaces/persistent-agents#cloudkind-record), [`CloudProvider`](/cua-sdk/reference/spaces/persistent-agents#cloudprovider-record), [`CloudResource`](/cua-sdk/reference/spaces/persistent-agents#cloudresource-record), [`CloudStatus`](/cua-sdk/reference/spaces/persistent-agents#cloudstatus-record), [`CloudSweepItem`](/cua-sdk/reference/spaces/persistent-agents#cloudsweepitem-record), [`CloudSweepReport`](/cua-sdk/reference/spaces/persistent-agents#cloudsweepreport-record), [`CloudTarget`](/cua-sdk/reference/spaces/persistent-agents#cloudtarget-record), [`CloudTestReport`](/cua-sdk/reference/spaces/persistent-agents#cloudtestreport-record), [`ComputerGrant`](/cua-sdk/reference/spaces/persistent-agents#computergrant-record), [`ComputerResources`](/cua-sdk/reference/spaces/resources#computerresources-record), [`config_get`](/cua-sdk/reference/cua#config_get), [`config_list`](/cua-sdk/reference/cua#config_list), [`config_path`](/cua-sdk/reference/cua#config_path), [`config_set`](/cua-sdk/reference/cua#config_set), [`config_unset`](/cua-sdk/reference/cua#config_unset), [`ConfigEntry`](/cua-sdk/reference/cua#configentry-record), [`Container`](/cua-sdk/reference/image#container-record), [`contrib_providers_built`](/cua-sdk/reference/sandbox#contrib_providers_built), [`Cua`](/cua-sdk/reference/cua#cua), [`CuaConfig`](/cua-sdk/reference/cua#cuaconfig-record), [`CuaInfo`](/cua-sdk/reference/cua#cuainfo-record), [`CuaMode`](/cua-sdk/reference/cua#cuamode-enum), [`CursorArt`](/cua-sdk/reference/spaces/streams#cursorart-record), [`DeviceEnrollment`](/cua-sdk/reference/spaces/host#deviceenrollment-record), [`Devices`](/cua-sdk/reference/spaces/host#devices), [`DevicesSnapshot`](/cua-sdk/reference/spaces/host#devicessnapshot-record), [`DiskLevel`](/cua-sdk/reference/spaces/resources#disklevel-enum), [`DiskOnHost`](/cua-sdk/reference/spaces/resources#diskonhost-record), [`DiskWarning`](/cua-sdk/reference/spaces/resources#diskwarning-record), [`DoctorReport`](/cua-sdk/reference/cua#doctorreport-record), [`DriveAccessRequest`](/cua-sdk/reference/spaces/volume#driveaccessrequest-record), [`DriveAudit`](/cua-sdk/reference/spaces/volume#driveaudit-record), [`DriveAuditEvent`](/cua-sdk/reference/spaces/volume#driveauditevent-record), [`DriveCacheStats`](/cua-sdk/reference/spaces/volume#drivecachestats-record), [`DriveConflict`](/cua-sdk/reference/spaces/volume#driveconflict-record), [`DriveDevice`](/cua-sdk/reference/spaces/volume#drivedevice-record), [`DriveEntry`](/cua-sdk/reference/spaces/volume#driveentry-record), [`DriveFile`](/cua-sdk/reference/spaces/volume#drivefile-record), [`DriveFileSync`](/cua-sdk/reference/spaces/volume#drivefilesync-record), [`DriveGrant`](/cua-sdk/reference/spaces/volume#drivegrant-record), [`DriveListing`](/cua-sdk/reference/spaces/volume#drivelisting-record), [`DriveMountStatus`](/cua-sdk/reference/spaces/volume#drivemountstatus-record), [`DriveObject`](/cua-sdk/reference/spaces/volume#driveobject-record), [`DrivePendingUpload`](/cua-sdk/reference/spaces/volume#drivependingupload-record), [`DriveS3Settings`](/cua-sdk/reference/spaces/volume#drives3settings-record), [`DriveSpaceVolume`](/cua-sdk/reference/spaces/volume#drivespacevolume-record), [`DriveStorage`](/cua-sdk/reference/spaces/volume#drivestorage-record), [`DriveStorageCheck`](/cua-sdk/reference/spaces/volume#drivestoragecheck-record), [`DriveStorageUpdate`](/cua-sdk/reference/spaces/volume#drivestorageupdate-record), [`DriveSyncEvent`](/cua-sdk/reference/spaces/volume#drivesyncevent-record), [`DriveSyncEvents`](/cua-sdk/reference/spaces/volume#drivesyncevents-record), [`DriveSyncStatus`](/cua-sdk/reference/spaces/volume#drivesyncstatus-record), [`DriveVersion`](/cua-sdk/reference/spaces/volume#driveversion-record), [`DriveView`](/cua-sdk/reference/spaces/volume#driveview-record), [`FrameSink`](/cua-sdk/reference/spacesd/computer#framesink), [`GpuOption`](/cua-sdk/reference/spaces#gpuoption-record), [`GpuSupport`](/cua-sdk/reference/spaces#gpusupport-record), [`GuestDisplay`](/cua-sdk/reference/spacesd#guestdisplay), [`GuestUsage`](/cua-sdk/reference/spaces/resources#guestusage-record), [`HomeTransfer`](/cua-sdk/reference/spaces/persistent-agents#hometransfer-record), [`Host`](/cua-sdk/reference/spaces/host#host), [`HostAccessRecord`](/cua-sdk/reference/spaces/host#hostaccessrecord-record), [`HostPermission`](/cua-sdk/reference/spaces/host#hostpermission-record), [`HostProvidedSpace`](/cua-sdk/reference/spaces/host#hostprovidedspace-record), [`HostSettingsChange`](/cua-sdk/reference/spaces/host#hostsettingschange-record), [`HostSetupOptions`](/cua-sdk/reference/spaces/host#hostsetupoptions-record), [`HostSpacesAuditRecord`](/cua-sdk/reference/spaces/host#hostspacesauditrecord-record), [`HostStatus`](/cua-sdk/reference/spaces/host#hoststatus-record), [`HttpHeader`](/cua-sdk/reference/services#httpheader-record), [`HttpResponse`](/cua-sdk/reference/services#httpresponse-record), [`image_alias`](/cua-sdk/reference/image#image_alias), [`ImageBuild`](/cua-sdk/reference/image#imagebuild-record), [`ImageInfo`](/cua-sdk/reference/image#imageinfo-record), [`ImageLayer`](/cua-sdk/reference/image#imagelayer-enum), [`Local`](/cua-sdk/reference/cua#local), [`LocalImage`](/cua-sdk/reference/cua#localimage-record), [`LocalStorage`](/cua-sdk/reference/cua#localstorage-record), [`LocationInfo`](/cua-sdk/reference/cua#locationinfo-record), [`locations`](/cua-sdk/reference/cua#locations), [`LoginAttempt`](/cua-sdk/reference/auth#loginattempt), [`LoginMethod`](/cua-sdk/reference/auth#loginmethod-enum), [`MachineHealth`](/cua-sdk/reference/spaces/host#machinehealth-record), [`MachineHealthCheck`](/cua-sdk/reference/spaces/host#machinehealthcheck-record), [`may_have_session`](/cua-sdk/reference/auth#may_have_session), [`mcp_connect`](/cua-sdk/reference/services#mcp_connect), [`mcp_connect_url`](/cua-sdk/reference/services#mcp_connect_url), [`McpClient`](/cua-sdk/reference/services#mcpclient), [`McpConfig`](/cua-sdk/reference/services#mcpconfig-record), [`MediaBridge`](/cua-sdk/reference/spacesd/computer#mediabridge-record), [`MediaEvent`](/cua-sdk/reference/spacesd/computer#mediaevent-record), [`MediaSession`](/cua-sdk/reference/spacesd/computer#mediasession), [`MediaStats`](/cua-sdk/reference/spacesd/computer#mediastats-record), [`normalize_image`](/cua-sdk/reference/image#normalize_image), [`NotificationInfo`](/cua-sdk/reference/spaces/persistent-agents#notificationinfo-record), [`omarchy_image`](/cua-sdk/reference/image#omarchy_image), [`Overlay`](/cua-sdk/reference/sandbox#overlay-record), [`OverlayResult`](/cua-sdk/reference/sandbox#overlayresult-record), [`PairingCode`](/cua-sdk/reference/spaces/host#pairingcode-record), [`parse_sandbox_ref`](/cua-sdk/reference/sandbox#parse_sandbox_ref), [`PersistentAgentInfo`](/cua-sdk/reference/spaces/persistent-agents#persistentagentinfo-record), [`PersistentAgentOptions`](/cua-sdk/reference/spaces/persistent-agents#persistentagentoptions-record), [`PortForward`](/cua-sdk/reference/services#portforward), [`presence_color`](/cua-sdk/reference/spaces/streams#presence_color), [`presence_conformance_json`](/cua-sdk/reference/spaces/streams#presence_conformance_json), [`presence_cursor_art`](/cua-sdk/reference/spaces/streams#presence_cursor_art), [`presence_cursor_art_all`](/cua-sdk/reference/spaces/streams#presence_cursor_art_all), [`presence_cursor_art_svg`](/cua-sdk/reference/spaces/streams#presence_cursor_art_svg), [`presence_now_ms`](/cua-sdk/reference/spaces/streams#presence_now_ms), [`presence_text_color`](/cua-sdk/reference/spaces/streams#presence_text_color), [`PresenceCursor`](/cua-sdk/reference/spaces/streams#presencecursor-record), [`PresenceDrawable`](/cua-sdk/reference/spaces/streams#presencedrawable-record), [`PresenceEvent`](/cua-sdk/reference/spaces/streams#presenceevent-record), [`PresenceIdentity`](/cua-sdk/reference/spaces/streams#presenceidentity-record), [`PresenceMember`](/cua-sdk/reference/spaces/streams#presencemember-record), [`PresenceParticipant`](/cua-sdk/reference/spaces/streams#presenceparticipant-record), [`PresencePoint`](/cua-sdk/reference/spaces/streams#presencepoint-record), [`PresenceView`](/cua-sdk/reference/spaces/streams#presenceview), [`PublicUrl`](/cua-sdk/reference/services#publicurl-record), [`qualify_sandbox_ref`](/cua-sdk/reference/sandbox#qualify_sandbox_ref), [`ReadinessProbe`](/cua-sdk/reference/image#readinessprobe-record), [`RegistrySecret`](/cua-sdk/reference/image#registrysecret-enum), [`Relay`](/cua-sdk/reference/spaces/host#relay), [`RelayAuditEvent`](/cua-sdk/reference/spaces/host#relayauditevent-record), [`RelayClientInfo`](/cua-sdk/reference/spaces/host#relayclientinfo-record), [`RelayDevice`](/cua-sdk/reference/spaces/host#relaydevice-record), [`RelayMachine`](/cua-sdk/reference/spaces/host#relaymachine-record), [`ReplayMode`](/cua-sdk/reference/spacesd#replaymode-enum), [`resolve_image`](/cua-sdk/reference/image#resolve_image), [`resolve_image_with_secret`](/cua-sdk/reference/image#resolve_image_with_secret), [`ResolvedImage`](/cua-sdk/reference/image#resolvedimage-record), [`ResourcesEvent`](/cua-sdk/reference/spaces/resources#resourcesevent-enum), [`ResourcesListener`](/cua-sdk/reference/spaces/resources#resourceslistener), [`ResourcesSnapshot`](/cua-sdk/reference/spaces/resources#resourcessnapshot-record), [`ResourcesUpdate`](/cua-sdk/reference/spaces/resources#resourcesupdate-record), [`ResourcesWatch`](/cua-sdk/reference/spaces/resources#resourceswatch), [`RoutineInfo`](/cua-sdk/reference/spaces/persistent-agents#routineinfo-record), [`RuntimeCheck`](/cua-sdk/reference/cua#runtimecheck-record), [`RuntimeCheckStatus`](/cua-sdk/reference/cua#runtimecheckstatus-enum), [`Sandbox`](/cua-sdk/reference/sandbox#sandbox), [`sandbox_locations`](/cua-sdk/reference/sandbox#sandbox_locations), [`SandboxCreateOptions`](/cua-sdk/reference/image#sandboxcreateoptions-record), [`Sandboxes`](/cua-sdk/reference/sandbox#sandboxes), [`SandboxInfo`](/cua-sdk/reference/sandbox#sandboxinfo-record), [`SandboxListing`](/cua-sdk/reference/sandbox#sandboxlisting-record), [`SandboxPhase`](/cua-sdk/reference/sandbox#sandboxphase-enum), [`SandboxRefParts`](/cua-sdk/reference/sandbox#sandboxrefparts-record), [`SandboxStatus`](/cua-sdk/reference/sandbox#sandboxstatus-enum), [`Service`](/cua-sdk/reference/services#service), [`ServiceEndpoint`](/cua-sdk/reference/services#serviceendpoint-record), [`SetupStep`](/cua-sdk/reference/cua#setupstep-record), [`SiteLoginOptions`](/cua-sdk/reference/spaces/space#siteloginoptions-record), [`SiteLoginReport`](/cua-sdk/reference/spaces/space#siteloginreport-record), [`Space`](/cua-sdk/reference/spaces/space#space), [`SpaceAgentOptions`](/cua-sdk/reference/spaces#spaceagentoptions-record), [`SpaceAppIcon`](/cua-sdk/reference/spaces/space#spaceappicon-record), [`SpaceAppIconRequest`](/cua-sdk/reference/spaces/space#spaceappiconrequest-record), [`SpaceBashResult`](/cua-sdk/reference/spaces/space#spacebashresult-record), [`SpaceCancelOutcome`](/cua-sdk/reference/spaces#spacecanceloutcome-record), [`SpaceCreateListener`](/cua-sdk/reference/spaces#spacecreatelistener), [`SpaceCreateOptions`](/cua-sdk/reference/spaces#spacecreateoptions-record), [`SpaceCreateProgress`](/cua-sdk/reference/spaces#spacecreateprogress-record), [`SpaceCreateResult`](/cua-sdk/reference/spaces#spacecreateresult-record), [`SpaceDisplay`](/cua-sdk/reference/spaces/space#spacedisplay-record), [`SpaceHotspotStatus`](/cua-sdk/reference/spaces/space#spacehotspotstatus-record), [`SpaceInfo`](/cua-sdk/reference/spaces#spaceinfo-record), [`SpacePowerReport`](/cua-sdk/reference/spaces#spacepowerreport-record), [`SpacePresence`](/cua-sdk/reference/spaces/streams#spacepresence), [`SpaceRelayRegistration`](/cua-sdk/reference/spaces/space#spacerelayregistration-record), [`SpaceResources`](/cua-sdk/reference/spaces/resources#spaceresources-record), [`Spaces`](/cua-sdk/reference/spaces#spaces), [`spaces_tool_methods`](/cua-sdk/reference/spaces#spaces_tool_methods), [`SpacesdClient`](/cua-sdk/reference/spacesd#spacesdclient), [`SpacesdHttpHeader`](/cua-sdk/reference/spacesd#spacesdhttpheader-record), [`SpacesdHttpRequest`](/cua-sdk/reference/spacesd#spacesdhttprequest-record), [`SpacesdHttpResponse`](/cua-sdk/reference/spacesd#spacesdhttpresponse-record), [`SpacesdProcess`](/cua-sdk/reference/spacesd#spacesdprocess), [`SpaceSendFileOptions`](/cua-sdk/reference/spaces/space#spacesendfileoptions-record), [`SpaceSendFileReport`](/cua-sdk/reference/spaces/space#spacesendfilereport-record), [`SpaceSentFile`](/cua-sdk/reference/spaces/space#spacesentfile-record), [`SpaceShareEntry`](/cua-sdk/reference/spaces/space#spaceshareentry-record), [`SpaceShares`](/cua-sdk/reference/spaces/space#spaceshares-record), [`SpacesHost`](/cua-sdk/reference/spaces/space#spaceshost-record), [`SpacesHostLimit`](/cua-sdk/reference/spaces/space#spaceshostlimit-record), [`SpacesToolMethod`](/cua-sdk/reference/spaces#spacestoolmethod-record), [`SpaceStreamOptions`](/cua-sdk/reference/spaces/streams#spacestreamoptions-record), [`SpaceStreamSession`](/cua-sdk/reference/spaces/streams#spacestreamsession), [`SpaceStreamStats`](/cua-sdk/reference/spaces/streams#spacestreamstats-record), [`SpaceStreamTicket`](/cua-sdk/reference/spaces/streams#spacestreamticket-record), [`SpaceToolInfo`](/cua-sdk/reference/spaces/space#spacetoolinfo-record), [`SpaceToolResult`](/cua-sdk/reference/spaces/space#spacetoolresult-record), [`SpaceTransferReport`](/cua-sdk/reference/spaces/space#spacetransferreport-record), [`SpaceUsage`](/cua-sdk/reference/spaces/space#spaceusage-record), [`SpaceWindow`](/cua-sdk/reference/spaces/space#spacewindow-record), [`SpaceWriteReport`](/cua-sdk/reference/spaces/space#spacewritereport-record), [`StorageVolume`](/cua-sdk/reference/cua#storagevolume-record), [`StreamStatsReport`](/cua-sdk/reference/auth#streamstatsreport-record), [`telemetry_acknowledge_link_notice`](/cua-sdk/reference/auth#telemetry_acknowledge_link_notice), [`telemetry_acknowledge_notice`](/cua-sdk/reference/auth#telemetry_acknowledge_notice), [`telemetry_flush`](/cua-sdk/reference/auth#telemetry_flush), [`telemetry_link_notice`](/cua-sdk/reference/auth#telemetry_link_notice), [`telemetry_link_notice_due`](/cua-sdk/reference/auth#telemetry_link_notice_due), [`telemetry_link_state`](/cua-sdk/reference/auth#telemetry_link_state), [`telemetry_notice_text`](/cua-sdk/reference/auth#telemetry_notice_text), [`telemetry_record_bench_run`](/cua-sdk/reference/auth#telemetry_record_bench_run), [`telemetry_record_feature`](/cua-sdk/reference/auth#telemetry_record_feature), [`telemetry_record_onboarding_step`](/cua-sdk/reference/auth#telemetry_record_onboarding_step), [`telemetry_record_stream_stats`](/cua-sdk/reference/auth#telemetry_record_stream_stats), [`telemetry_reset_id`](/cua-sdk/reference/auth#telemetry_reset_id), [`telemetry_schema_json`](/cua-sdk/reference/auth#telemetry_schema_json), [`telemetry_set_enabled`](/cua-sdk/reference/auth#telemetry_set_enabled), [`telemetry_set_surface`](/cua-sdk/reference/auth#telemetry_set_surface), [`telemetry_show_last`](/cua-sdk/reference/auth#telemetry_show_last), [`telemetry_status`](/cua-sdk/reference/auth#telemetry_status), [`telemetry_sync_account`](/cua-sdk/reference/auth#telemetry_sync_account), [`telemetry_use_app_notice`](/cua-sdk/reference/auth#telemetry_use_app_notice), [`TelemetryLinkNotice`](/cua-sdk/reference/auth#telemetrylinknotice-record), [`TelemetryStatus`](/cua-sdk/reference/auth#telemetrystatus-record), [`TeleportApprover`](/cua-sdk/reference/spaces/space#teleportapprover), [`TeleportDecision`](/cua-sdk/reference/spaces/space#teleportdecision-record), [`TeleportItem`](/cua-sdk/reference/spaces/space#teleportitem-record), [`TeleportManifest`](/cua-sdk/reference/spaces/space#teleportmanifest-record), [`TeleportReceipt`](/cua-sdk/reference/spaces/space#teleportreceipt-record), [`VideoFrame`](/cua-sdk/reference/spacesd/computer#videoframe-record), [`ViewerLink`](/cua-sdk/reference/sandbox#viewerlink-record), [`ViewerOptions`](/cua-sdk/reference/sandbox#vieweroptions-record).
## Types
diff --git a/docs/content/docs/cua-sdk/reference/spaces/host.mdx b/docs/content/docs/cua-sdk/reference/spaces/host.mdx
index bdba7fc3e7..821d8fed83 100644
--- a/docs/content/docs/cua-sdk/reference/spaces/host.mdx
+++ b/docs/content/docs/cua-sdk/reference/spaces/host.mdx
@@ -921,7 +921,7 @@ Somebody connected to a machine through the relay.
A machine of the account's relay directory (`relay:<id>`).
-Returned by [`Devices.confirm_machine`](#devicesconfirm_machine), [`Relay.machine`](#relaymachine), [`Relay.machines`](#relaymachines), [`Relay.start_sharing`](#relaystart_sharing), [`Relay.stop_sharing`](#relaystop_sharing).
+Returned by [`Devices.confirm_machine`](#devicesconfirm_machine), [`Devices.rename_machine`](#devicesrename_machine), [`Relay.machine`](#relaymachine), [`Relay.machines`](#relaymachines), [`Relay.start_sharing`](#relaystart_sharing), [`Relay.stop_sharing`](#relaystop_sharing).
| Field | Type | Default | Description |
| --- | --- | --- | --- |
@@ -938,6 +938,8 @@ Returned by [`Devices.confirm_machine`](#devicesconfirm_machine), [`Relay.machin
| `allow` | `Vec<String>` | | Allowlist (owner view only). |
| `clients` | [`Vec<RelayClientInfo>`](#relayclientinfo-record) | | Connected clients. |
| `confirmed` | `bool` | | Registered with an enrolled device's signature or MFA, or confirmed since from one; `true` for anything a relay registered before this check existed. `false` shows the machine as "new" until an enrolled device confirms it (`Devices.confirm_machine`) (S5). |
+| `team` | `Option<String>` | | The team you reach it through, for a team machine not shared with you directly. |
+| `provides_spaces` / `providesSpaces` | `Option<bool>` | | It creates Spaces for its owner's devices, when it said so at registration (`None` from a host or relay that predates it). |
## This device on the relay
@@ -962,6 +964,7 @@ Returned by [`Auth.devices`](/cua-sdk/reference/auth#authdevices).
| [`enroll`](#devicesenroll) | Registers this device (creating its key on first use). |
| [`pairing_codes`](#devicespairing_codes) | The account's pairing codes, newest first (without the codes). |
| [`rename`](#devicesrename) | Renames a device (from this enrolled device). |
+| [`rename_machine`](#devicesrename_machine) | Renames `machine_id`, a machine the account owns, on the relay (from this enrolled device). |
| [`revoke`](#devicesrevoke) | Revokes a device (from this enrolled device). |
| [`revoke_pairing_code`](#devicesrevoke_pairing_code) | Revokes an unused pairing code (`pc_…`). |
| [`snapshot`](#devicessnapshot) | The account's devices, the grace period, the newest `audit_limit` audit events and the machines' names. |
@@ -1358,6 +1361,58 @@ pub async fn rename(&self, id: String, name: String) -> Result<RelayDevice, CuaE
**Returns** [`RelayDevice`](#relaydevice-record) · **Async** · **Raises** [`CuaError`](/cua-sdk/reference/errors)
+### `Devices.rename_machine`
+
+Renames `machine_id`, a machine the account owns, on the relay (from
+this enrolled device). When it is this machine's own registration,
+its host setup takes the new name too.
+
+<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>
+<Tab value="Python">
+
+```python
+async def rename_machine(self, machine_id: str, name: str) -> RelayMachine
+```
+
+</Tab>
+<Tab value="TypeScript">
+
+```ts
+renameMachine(machineId: string, name: string, asyncOpts_?: { signal: AbortSignal }): Promise<RelayMachine>
+```
+
+</Tab>
+<Tab value="Swift">
+
+```swift
+func renameMachine(machineId: String, name: String) async throws -> RelayMachine
+```
+
+</Tab>
+<Tab value="Kotlin">
+
+```kotlin
+@Throws(CuaException::class)
+suspend fun renameMachine(machineId: String, name: String): RelayMachine
+```
+
+</Tab>
+<Tab value="Rust">
+
+```rust
+pub async fn rename_machine(&self, machine_id: String, name: String) -> Result<RelayMachine, CuaError>
+```
+
+</Tab>
+</Tabs>
+
+| Parameter | Type | Default |
+| --- | --- | --- |
+| `machine_id` | `String` | required |
+| `name` | `String` | required |
+
+**Returns** [`RelayMachine`](#relaymachine-record) · **Async** · **Raises** [`CuaError`](/cua-sdk/reference/errors)
+
### `Devices.revoke`
Revokes a device (from this enrolled device). Revoking this device
@@ -1564,3 +1619,91 @@ Returned by [`Devices.enroll`](#devicesenroll).
| `device` | [`RelayDevice`](#relaydevice-record) | | This device. |
| `enrolled` | `bool` | | Enrolled now (right after a fresh sign-in). |
| `code` | `Option<String>` | | The one-time code to approve from an enrolled device otherwise. |
+
+## Computer health
+
+`Spaces.machine_health` asks a computer's cua daemon to check it (this computer with `None`, another of yours by id or name over the relay, the mesh or its direct address). The Computers page shows the warnings and failures as the computer's issues; `cua doctor --machine` prints them.
+
+## Check a computer
+
+Methods of [`Spaces`](/cua-sdk/reference/spaces#spaces).
+
+### `Spaces.machine_health`
+
+A machine's health as its own cua daemon checks it: Local Network
+access (and which app macOS holds responsible), free disk,
+virtualization, memory left by running Spaces, the permissions
+sharing its desktop needs. `machine`: another of your machines, by
+id or name (asked over the relay, the mesh or its direct address);
+`None` for this one. Read-only; fails plainly when that machine is
+offline, not yours, or runs a Cua that predates the check.
+
+<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>
+<Tab value="Python">
+
+```python
+async def machine_health(self, machine: Optional[str]) -> MachineHealth
+```
+
+</Tab>
+<Tab value="TypeScript">
+
+```ts
+machineHealth(machine: string | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<MachineHealth>
+```
+
+</Tab>
+<Tab value="Swift">
+
+```swift
+func machineHealth(machine: String?) async throws -> MachineHealth
+```
+
+</Tab>
+<Tab value="Kotlin">
+
+```kotlin
+@Throws(CuaException::class)
+suspend fun machineHealth(machine: String?): MachineHealth
+```
+
+</Tab>
+<Tab value="Rust">
+
+```rust
+pub async fn machine_health(&self, machine: Option<String>) -> Result<MachineHealth, CuaError>
+```
+
+</Tab>
+</Tabs>
+
+| Parameter | Type | Default |
+| --- | --- | --- |
+| `machine` | `Option<String>` | required |
+
+**Returns** [`MachineHealth`](#machinehealth-record) · **Async** · **Raises** [`CuaError`](/cua-sdk/reference/errors)
+
+## `MachineHealth` record
+
+A machine's health as its own cua daemon checks it.
+
+Returned by [`Spaces.machine_health`](#spacesmachine_health).
+
+| Field | Type | Default | Description |
+| --- | --- | --- | --- |
+| `cua_version` / `cuaVersion` | `String` | | The Cua version of the daemon that checked. |
+| `os` | `String` | | `macos`, `linux`, `windows`. |
+| `checks` | [`Vec<MachineHealthCheck>`](#machinehealthcheck-record) | | Every check, in order. |
+| `report_json` / `reportJson` | `String` | | The whole report as JSON (the schema `cua doctor --json` writes). |
+
+## `MachineHealthCheck` record
+
+One check of a machine's health (`Spaces.machine_health`).
+
+| Field | Type | Default | Description |
+| --- | --- | --- | --- |
+| `id` | `String` | | `machine.local_network`, `machine.disk`, `machine.virtualization`, `machine.memory`, `machine.permissions.<id>`. |
+| `status` | `String` | | `pass`, `warn`, `fail` or `skip`. |
+| `message` | `String` | | What it found, in one line. |
+| `remediation` | `String` | | What to do about a warning or failure. |
+| `facts` | `HashMap<String, String>` | | What a UI needs to word it and offer its fix (`app`, `settings_url`, `free_gb`, ...). |
diff --git a/docs/content/docs/cua-sdk/reference/spaces/index.mdx b/docs/content/docs/cua-sdk/reference/spaces/index.mdx
index 4cb01395ed..048d0d801c 100644
--- a/docs/content/docs/cua-sdk/reference/spaces/index.mdx
+++ b/docs/content/docs/cua-sdk/reference/spaces/index.mdx
@@ -53,6 +53,7 @@ Returned by [`Cua.spaces`](/cua-sdk/reference/cua#cua).
| [`computer_access`](/cua-sdk/reference/spaces/persistent-agents#spacescomputer_access) | Per-agent computer grants (of one agent, or all). |
| [`computer_access_grant`](/cua-sdk/reference/spaces/persistent-agents#spacescomputer_access_grant) | Lets one persistent agent use one of the user's computers (asks for presence). |
| [`computer_access_revoke`](/cua-sdk/reference/spaces/persistent-agents#spacescomputer_access_revoke) | Takes a persistent agent's computer access back (every machine when `machine` is empty). |
+| [`machine_health`](/cua-sdk/reference/spaces/host#spacesmachine_health) | A machine's health as its own cua daemon checks it: Local Network access (and which app macOS holds responsible), free disk, virtualization, memory left by running Spaces, the permissions sharing its desktop needs. |
| [`notifications`](/cua-sdk/reference/spaces/persistent-agents#spacesnotifications) | The notifications feed, newest first. |
| [`notifications_ack`](/cua-sdk/reference/spaces/persistent-agents#spacesnotifications_ack) | Marks notifications read (every one when `ids` is empty). |
| [`notify_user`](/cua-sdk/reference/spaces/persistent-agents#spacesnotify_user) | Posts a notification to the Cua app. |
diff --git a/docs/content/docs/cua-sdk/reference/types.mdx b/docs/content/docs/cua-sdk/reference/types.mdx
index 9b829193cf..5e7d9388aa 100644
--- a/docs/content/docs/cua-sdk/reference/types.mdx
+++ b/docs/content/docs/cua-sdk/reference/types.mdx
@@ -48,7 +48,7 @@ Renamed members: in Kotlin, objects implement `AutoCloseable`, whose `close()` f
## All items
-273 items. Methods are listed on their object.
+275 items. Methods are listed on their object.
The 11 items of Processor, memory and disk are listed on [its page](/cua-sdk/reference/spaces/resources#all-items).
@@ -177,6 +177,8 @@ The 11 items of Processor, memory and disk are listed on [its page](/cua-sdk/ref
| [`locations`](/cua-sdk/reference/cua#locations) | function | Every location with the kinds and runtimes it offers (for pickers and help text). |
| [`LoginAttempt`](/cua-sdk/reference/auth#loginattempt) | object | A started sign-in. |
| [`LoginMethod`](/cua-sdk/reference/auth#loginmethod-enum) | enum | How a sign-in proceeds. |
+| [`MachineHealth`](/cua-sdk/reference/spaces/host#machinehealth-record) | record | A machine's health as its own cua daemon checks it. |
+| [`MachineHealthCheck`](/cua-sdk/reference/spaces/host#machinehealthcheck-record) | record | One check of a machine's health (`Spaces.machine_health`). |
| [`may_have_session`](/cua-sdk/reference/auth#may_have_session) | function | Whether a `cua auth login` session may be stored, decided without reading the OS credential vault (the non-secret session marker, or the file store's file). |
| [`mcp_connect`](/cua-sdk/reference/services#mcp_connect) | function | Connects an MCP client to `config` (from `Sandbox.mcp_config`). |
| [`mcp_connect_url`](/cua-sdk/reference/services#mcp_connect_url) | function | Connects an MCP client to an endpoint URL (`http://host:8765/mcp`; a bare origin means `/mcp`) with `headers` on every request. |
diff --git a/libs/cua-spacesd/crates/cua-spacesd-server/src/auth.rs b/libs/cua-spacesd/crates/cua-spacesd-server/src/auth.rs
index 275bea30d0..347e31aa53 100644
--- a/libs/cua-spacesd/crates/cua-spacesd-server/src/auth.rs
+++ b/libs/cua-spacesd/crates/cua-spacesd-server/src/auth.rs
@@ -227,6 +227,7 @@ pub const HOST_ONLY_GRPC_METHODS: &[&str] = &[
"/cua.env.v1.HostSpacesService/CancelHostSpace",
"/cua.env.v1.HostSpacesService/SetHostSpacePower",
"/cua.env.v1.HostSpacesService/DeleteCloudSpace",
+ "/cua.env.v1.HostSpacesService/DiagnoseHost",
];
impl ExternalGrant {
diff --git a/libs/cua-spacesd/crates/cua-spacesd-server/src/host_spaces.rs b/libs/cua-spacesd/crates/cua-spacesd-server/src/host_spaces.rs
index 7c405e22de..a610306448 100644
--- a/libs/cua-spacesd/crates/cua-spacesd-server/src/host_spaces.rs
+++ b/libs/cua-spacesd/crates/cua-spacesd-server/src/host_spaces.rs
@@ -427,6 +427,21 @@ impl HostSpacesService for HostSpacesImpl {
.await
}
+ async fn diagnose_host(
+ &self,
+ request: Request<DiagnoseHostRequest>,
+ ) -> Result<Response<DiagnoseHostResponse>, Status> {
+ // Whether or not this machine provides Spaces: its health is the
+ // owner's to see either way (the daemon checks the caller).
+ let (mut client, who) = self.forward(&request, false).await?;
+ // This machine's own health only: never a hop to another machine.
+ let mut message = request.into_inner();
+ message.machine.clear();
+ client
+ .diagnose_host(with_caller(message, &who, Some(Duration::from_secs(30)))?)
+ .await
+ }
+
async fn delete_host_space(
&self,
request: Request<DeleteHostSpaceRequest>,
diff --git a/libs/cua-spacesd/crates/cua-spacesd-server/tests/host_spaces.rs b/libs/cua-spacesd/crates/cua-spacesd-server/tests/host_spaces.rs
index 877884a34f..d7469e3561 100644
--- a/libs/cua-spacesd/crates/cua-spacesd-server/tests/host_spaces.rs
+++ b/libs/cua-spacesd/crates/cua-spacesd-server/tests/host_spaces.rs
@@ -118,6 +118,26 @@ impl HostSpacesService for FakeDaemon {
message: format!("Cancelled {}", req.into_inner().space),
}))
}
+
+ async fn diagnose_host(
+ &self,
+ req: tonic::Request<DiagnoseHostRequest>,
+ ) -> Result<tonic::Response<DiagnoseHostResponse>, tonic::Status> {
+ let who = req
+ .metadata()
+ .get(CALLER_METADATA)
+ .and_then(|v| v.to_str().ok())
+ .unwrap_or("")
+ .to_string();
+ self.callers.lock().unwrap().push(who);
+ // A forwarded call never names another machine to hop to.
+ let hop = !req.into_inner().machine.is_empty();
+ Ok(tonic::Response::new(DiagnoseHostResponse {
+ report: None,
+ cua_version: if hop { "hop".into() } else { "9.9.9".into() },
+ os: "macos".into(),
+ }))
+ }
}
async fn serve_daemon(socket: &Path, daemon: FakeDaemon) {
@@ -469,6 +489,20 @@ async fn a_host_provides_spaces_through_the_relay_and_keeps_its_desktop_private(
(who["account"].as_str(), who["role"].as_str()),
(Some("ada"), Some("owner"))
);
+ // The machine's health, for its Machines page: forwarded whether or
+ // not it provides Spaces, with the verified caller.
+ let health = owner
+ .host_spaces()
+ .diagnose_host(DiagnoseHostRequest {
+ machine: "another-machine".into(),
+ })
+ .await
+ .unwrap()
+ .into_inner();
+ assert_eq!(health.cua_version, "9.9.9");
+ let who: serde_json::Value =
+ serde_json::from_str(daemon.callers.lock().unwrap().last().unwrap()).unwrap();
+ assert_eq!(who["account"].as_str(), Some("ada"));
// Sharing the desktop again lets the owner in (the policy reloads).
write_policy(&policy, "ada", true, true, &socket);
diff --git a/libs/cua/crates/cua-cli/src/doctor/mod.rs b/libs/cua/crates/cua-cli/src/doctor/mod.rs
index 94bd251918..bab3b9c9f7 100644
--- a/libs/cua/crates/cua-cli/src/doctor/mod.rs
+++ b/libs/cua/crates/cua-cli/src/doctor/mod.rs
@@ -100,6 +100,11 @@ pub struct DoctorArgs {
/// Skip the host checks.
#[arg(long)]
pub no_host: bool,
+ /// Check a machine's health instead, as its own cua daemon sees it (the
+ /// checks the Machines page shows): another of your machines by name
+ /// or id, over the relay, the mesh or its direct address, or `this`.
+ #[arg(long, value_name = "MACHINE", conflicts_with_all = ["target", "shim", "image"])]
+ pub machine: Option<String>,
/// Fail unless the build running in the guest is the expected one:
/// COMPONENT=WANT with WANT `sha256:<hex>` (the executable), `git:<sha>`
/// or a version (repeatable). Components: cua-spacesd, cua-driver, or
@@ -326,6 +331,9 @@ pub async fn run(
json: bool,
out: &mut dyn std::io::Write,
) -> Result<i32, CuaError> {
+ if let Some(machine) = args.machine.clone() {
+ return machine_run(cua, &machine, &args, json, out).await;
+ }
let started = Instant::now();
let expectations =
cua_spacesd_client::expect::parse_all(&args.expect).map_err(CuaError::InvalidArgument)?;
@@ -428,6 +436,54 @@ pub async fn run(
Ok(report.exit_code())
}
+/// `cua doctor --machine <name|this>`: the machine's own daemon runs its
+/// checks (`HostSpacesService.DiagnoseHost`); this prints the report.
+async fn machine_run(
+ cua: &Arc<Cua>,
+ machine: &str,
+ args: &DoctorArgs,
+ json: bool,
+ out: &mut dyn std::io::Write,
+) -> Result<i32, CuaError> {
+ let target = (!target_is_this(machine)).then(|| machine.trim().to_string());
+ let started = Instant::now();
+ let health = cua.spaces().machine_health(target).await?;
+ let mut report = Report::from_json(&health.report_json)
+ .map_err(|e| CuaError::InvalidArgument(format!("the machine's report: {e}")))?;
+ report.producer = format!(
+ "cua doctor --machine ({} on {}, Cua {})",
+ machine, health.os, health.cua_version
+ );
+ report.finalize(args.strict, started.elapsed());
+ let format = if json { Format::Json } else { args.format };
+ let text = match format {
+ // The report's own first line is about an image; a machine has none.
+ Format::Human => {
+ let human = report.to_human();
+ let body = human.split_once('\n').map_or("", |(_, rest)| rest);
+ let who = if target_is_this(machine) {
+ "this machine"
+ } else {
+ machine
+ };
+ format!("{who} ({}, Cua {})\n{body}", health.os, health.cua_version)
+ }
+ Format::Json => report.to_json() + "\n",
+ Format::Junit => report.to_junit(),
+ };
+ if let Some(path) = &args.out {
+ std::fs::write(path, report.to_json())
+ .map_err(|e| CuaError::InvalidArgument(format!("{}: {e}", path.display())))?;
+ }
+ let _ = out.write_all(text.as_bytes());
+ Ok(report.exit_code())
+}
+
+/// `--machine this` (or `local`, or empty): this machine.
+fn target_is_this(machine: &str) -> bool {
+ matches!(machine.trim(), "" | "this" | "local")
+}
+
/// `pass` / `fail`.
pub fn verdict(ok: bool) -> Status {
if ok { Status::Pass } else { Status::Fail }
diff --git a/libs/cua/crates/cua-daemon/src/client.rs b/libs/cua/crates/cua-daemon/src/client.rs
index ce22c7918f..c134128e70 100644
--- a/libs/cua/crates/cua-daemon/src/client.rs
+++ b/libs/cua/crates/cua-daemon/src/client.rs
@@ -239,6 +239,21 @@ impl DaemonClient {
.into_inner())
}
+ /// `HostSpacesService.DiagnoseHost`: this machine's health as its
+ /// daemon checks it, or with `machine` set, another of the owner's
+ /// machines' (asked over the relay by this daemon).
+ pub async fn diagnose_host(
+ &self,
+ machine: String,
+ ) -> Result<cua_proto::env::v1::DiagnoseHostResponse> {
+ use cua_proto::env::v1::host_spaces_service_client::HostSpacesServiceClient;
+ Ok(HostSpacesServiceClient::new(self.channel.clone())
+ .diagnose_host(cua_proto::env::v1::DiagnoseHostRequest { machine })
+ .await
+ .map_err(Self::map)?
+ .into_inner())
+ }
+
/// `Doctor`.
pub async fn doctor(&self) -> Result<pb::DoctorResponse> {
Ok(self
diff --git a/libs/cua/crates/cua-daemon/src/host_svc.rs b/libs/cua/crates/cua-daemon/src/host_svc.rs
index ec467263ac..9852790a56 100644
--- a/libs/cua/crates/cua-daemon/src/host_svc.rs
+++ b/libs/cua/crates/cua-daemon/src/host_svc.rs
@@ -99,4 +99,37 @@ impl HostSpacesService for HostSvc {
.map(tonic::Response::new)
.map_err(|e| to_status(&e))
}
+
+ async fn diagnose_host(
+ &self,
+ req: tonic::Request<pb::DiagnoseHostRequest>,
+ ) -> Result<tonic::Response<pb::DiagnoseHostResponse>, tonic::Status> {
+ // The owner's own diagnostics: paths, app names, free space.
+ let who = caller(&req)?;
+ if !who.is_owner() {
+ return Err(tonic::Status::permission_denied(
+ "only this machine's owner can check its health",
+ ));
+ }
+ let machine = req.into_inner().machine;
+ if machine.trim().is_empty() {
+ return Ok(tonic::Response::new(
+ crate::machine_doctor::response().await,
+ ));
+ }
+ // Another machine: asked from this one (the app or `cua doctor
+ // --machine`), never on behalf of a relayed caller.
+ if who.account != "local" {
+ return Err(tonic::Status::permission_denied(
+ "a machine's health is checked on that machine",
+ ));
+ }
+ self.0
+ .runtime
+ .spaces()
+ .machine_health(&machine)
+ .await
+ .map(tonic::Response::new)
+ .map_err(|e| to_status(&e))
+ }
}
diff --git a/libs/cua/crates/cua-daemon/src/lib.rs b/libs/cua/crates/cua-daemon/src/lib.rs
index 15038554dd..a035864274 100644
--- a/libs/cua/crates/cua-daemon/src/lib.rs
+++ b/libs/cua/crates/cua-daemon/src/lib.rs
@@ -38,6 +38,8 @@ pub mod fixtures;
mod host_svc;
pub mod identity;
pub mod local;
+#[cfg(feature = "spaces")]
+pub mod machine_doctor;
pub mod maintenance;
#[cfg(feature = "server")]
mod passthrough;
diff --git a/libs/cua/crates/cua-daemon/src/machine_doctor.rs b/libs/cua/crates/cua-daemon/src/machine_doctor.rs
new file mode 100644
index 0000000000..d0441218a7
--- /dev/null
+++ b/libs/cua/crates/cua-daemon/src/machine_doctor.rs
@@ -0,0 +1,504 @@
+//! `HostSpacesService.DiagnoseHost`: this machine's health as a place to
+//! run Spaces, checked here in the daemon, the process that runs them.
+//!
+//! Every check is read-only and bounded (a few seconds in all). The ids are
+//! `machine.*`; the Machines page shows the warnings and failures as the
+//! machine's issues (the app core's `machines_view`), and `cua doctor
+//! --machine` prints the report. Facts carry what a UI needs to word an
+//! issue and offer its fix (`app`, `settings_url`, `free_gb`, ...).
+//!
+//! - `machine.local_network`: whether this process reaches this Mac's
+//! macOS VMs, and the app macOS holds responsible for it
+//! ([`cua_vmm::local_network`]), whose Local Network access decides it.
+//! - `machine.disk`: free space where Spaces are written.
+//! - `machine.virtualization`: whether this machine can run its Spaces at
+//! all (Lume on a Mac, a VM or container runtime elsewhere).
+//! - `machine.memory`: memory the running macOS VMs leave for another.
+//! - `machine.permissions.*`: what sharing this desktop needs (Screen
+//! Recording, Accessibility for cua-driver).
+
+use std::time::{Duration, Instant, SystemTime};
+
+use cua_proto::env::v1 as pb;
+use cua_spacesd_client::diagnose::{Check, Report, Severity, Status};
+use cua_vmm::local_network;
+
+/// Below this much free space a Space can't be created.
+pub const DISK_FAIL_GB: f64 = 10.0;
+/// Below this a macOS Space (its image and disk) may not fit.
+pub const DISK_WARN_GB: f64 = 30.0;
+/// The memory a new macOS VM and macOS itself want left over.
+pub const MEMORY_HEADROOM_GB: f64 = 8.0;
+
+const GIB: f64 = 1024.0 * 1024.0 * 1024.0;
+const LOCAL_NETWORK_URL: &str =
+ "x-apple.systempreferences:com.apple.preference.security?Privacy_LocalNetwork";
+const STORAGE_URL: &str = "x-apple.systempreferences:com.apple.settings.Storage";
+
+/// What the checks read, gathered by [`gather`] (so [`checks`] is pure).
+#[derive(Debug, Clone, Default)]
+pub struct Facts {
+ /// `macos`, `linux`, `windows`.
+ pub os: String,
+ /// Host settings, when this machine is set up as a host.
+ pub provide_spaces: bool,
+ pub share_desktop: bool,
+ /// Lume: this Mac can run it, and it is serving.
+ pub lume_supported: bool,
+ pub lume_serving: bool,
+ /// Runtimes ready now, and why the others are not (`backend: detail`).
+ pub runtimes_ready: Vec<String>,
+ pub runtimes_missing: Vec<String>,
+ /// The daemon's own Local Network probe (macOS).
+ pub local_network: Option<local_network::Report>,
+ /// Where Spaces are written: (`name`, available bytes).
+ pub disk: Option<(String, u64)>,
+ /// Physical memory, and what running macOS VMs were given (bytes).
+ pub memory_total: Option<u64>,
+ pub memory_vms: u64,
+ pub running_vms: usize,
+ /// cua-driver's own (Screen Recording, Accessibility), when sharing the
+ /// desktop and known.
+ pub permissions: Option<(bool, bool)>,
+}
+
+fn gb(bytes: u64) -> f64 {
+ bytes as f64 / GIB
+}
+
+/// A failure stays a failure (a check of severity `info` would report it
+/// as a warning): this machine can't do what the check is about.
+fn info(mut c: Check) -> Check {
+ c.severity = if c.status == Status::Fail {
+ Severity::Required
+ } else {
+ Severity::Info
+ };
+ c
+}
+
+/// The checks for `f` (pure).
+pub fn checks(f: &Facts) -> Vec<Check> {
+ let mut out = Vec::new();
+ let mac = f.os == "macos";
+ let runs_macos_vms = mac && (f.provide_spaces || f.lume_serving);
+
+ // Local Network access (macOS VMs only).
+ if runs_macos_vms && let Some(r) = &f.local_network {
+ let app = r.app.as_ref();
+ let name = app
+ .filter(|a| a.bundle)
+ .map(|a| a.name.clone())
+ .unwrap_or_else(|| "the app that started the cua daemon".into());
+ let mut c = match &r.probe {
+ local_network::Probe::Blocked { vm, ip } => Check::new(
+ "machine.local_network",
+ Status::Fail,
+ format!(
+ "Cua can't reach this Mac's macOS VMs ({vm} at {ip}, No route to host): \
+ Local Network access is off for {name}"
+ ),
+ )
+ .fix(format!(
+ "open System Settings > Privacy & Security > Local Network and turn on {name}"
+ ))
+ .fact("settings_url", LOCAL_NETWORK_URL),
+ local_network::Probe::Reached { vm, .. } => Check::new(
+ "machine.local_network",
+ Status::Pass,
+ format!("reached the macOS VM {vm}: Local Network access is on for {name}"),
+ ),
+ local_network::Probe::NoRunningVm => Check::new(
+ "machine.local_network",
+ Status::Skip,
+ "no macOS VM is running to test Local Network access with",
+ )
+ .skip_reason("no_running_vm"),
+ local_network::Probe::NoList { why } => Check::new(
+ "machine.local_network",
+ Status::Skip,
+ format!("couldn't list this Mac's VMs ({why})"),
+ )
+ .skip_reason("no_vm_list"),
+ local_network::Probe::Unclear { vm, why, .. } => Check::new(
+ "machine.local_network",
+ Status::Skip,
+ format!("couldn't tell whether the macOS VM {vm} is reachable ({why})"),
+ )
+ .skip_reason("inconclusive"),
+ };
+ c = c.fact("app", &name);
+ if let Some(a) = app {
+ c = c.fact("app_path", a.path.display());
+ }
+ out.push(info(c));
+ }
+
+ // Free disk.
+ if let Some((volume, available)) = &f.disk {
+ let free = gb(*available);
+ let (status, message) = if free < DISK_FAIL_GB {
+ (
+ Status::Fail,
+ format!("only {free:.0} GB free on {volume}: new Spaces can't be created"),
+ )
+ } else if free < DISK_WARN_GB {
+ (
+ Status::Warn,
+ format!("only {free:.0} GB free on {volume}; a macOS Space needs about 30 GB"),
+ )
+ } else {
+ (Status::Pass, format!("{free:.0} GB free on {volume}"))
+ };
+ let mut c = Check::new("machine.disk", status, message)
+ .fix("free up space, or run `cua cache prune`")
+ .fact("free_gb", format!("{free:.0}"))
+ .fact("volume", volume);
+ if mac {
+ c = c.fact("settings_url", STORAGE_URL);
+ }
+ out.push(info(c));
+ }
+
+ // Can this machine run Spaces at all.
+ if mac && !f.lume_supported {
+ out.push(info(Check::new(
+ "machine.virtualization",
+ if f.provide_spaces {
+ Status::Fail
+ } else {
+ Status::Skip
+ },
+ "this Mac can't run macOS VMs (they need Apple silicon)",
+ )));
+ } else if f.provide_spaces && f.runtimes_ready.is_empty() {
+ out.push(info(
+ Check::new(
+ "machine.virtualization",
+ Status::Warn,
+ format!(
+ "no Space runtime is ready on this machine yet ({})",
+ f.runtimes_missing.join("; ")
+ ),
+ )
+ .fix("run `cua runtime setup`, or create a Space here to set one up"),
+ ));
+ } else if !f.runtimes_ready.is_empty() {
+ out.push(info(Check::new(
+ "machine.virtualization",
+ Status::Pass,
+ format!("ready: {}", f.runtimes_ready.join(", ")),
+ )));
+ }
+
+ // Memory the running macOS VMs leave.
+ if let Some(total) = f.memory_total
+ && f.running_vms > 0
+ {
+ let left = gb(total.saturating_sub(f.memory_vms));
+ let status = if left < MEMORY_HEADROOM_GB {
+ Status::Warn
+ } else {
+ Status::Pass
+ };
+ out.push(info(
+ Check::new(
+ "machine.memory",
+ status,
+ format!(
+ "running Spaces use {:.0} of {:.0} GB of memory{}",
+ gb(f.memory_vms),
+ gb(total),
+ if status == Status::Warn {
+ "; another may not start"
+ } else {
+ ""
+ }
+ ),
+ )
+ .fix("turn off a Space you're not using")
+ .fact("used_gb", format!("{:.0}", gb(f.memory_vms)))
+ .fact("total_gb", format!("{:.0}", gb(total))),
+ ));
+ }
+
+ // What sharing the desktop needs.
+ if mac
+ && f.share_desktop
+ && let Some((screen, access)) = f.permissions
+ {
+ for (id, title, granted, pane) in [
+ (
+ "screen-recording",
+ "Screen Recording",
+ screen,
+ "Privacy_ScreenCapture",
+ ),
+ (
+ "accessibility",
+ "Accessibility",
+ access,
+ "Privacy_Accessibility",
+ ),
+ ] {
+ out.push(info(
+ Check::new(
+ format!("machine.permissions.{id}"),
+ if granted { Status::Pass } else { Status::Warn },
+ if granted {
+ format!("cua-driver has {title}")
+ } else {
+ format!("sharing this desktop needs {title} for cua-driver")
+ },
+ )
+ .fix(format!(
+ "open System Settings > Privacy & Security > {title} and turn on cua-driver"
+ ))
+ .fact("permission", title)
+ .fact(
+ "settings_url",
+ format!("x-apple.systempreferences:com.apple.preference.security?{pane}"),
+ ),
+ ));
+ }
+ }
+ out
+}
+
+/// Gathers [`Facts`] on this machine. Bounded: each probe has its own
+/// limit, the slowest about 3.5 s.
+pub async fn gather() -> Facts {
+ let os = std::env::consts::OS.to_string();
+ let doctor = crate::local::doctor_report().await;
+ let mut f = Facts {
+ os: os.clone(),
+ lume_supported: doctor.lume.supported_host,
+ lume_serving: doctor.lume.serving,
+ ..Facts::default()
+ };
+ for b in &doctor.backends {
+ if b.ready {
+ f.runtimes_ready.push(b.backend.as_str().to_string());
+ } else if !b.detail.is_empty() {
+ f.runtimes_missing
+ .push(format!("{}: {}", b.backend.as_str(), b.detail));
+ }
+ }
+ if let Ok(Some(config)) = cua_host::Host::new(crate::cua_home()).config() {
+ f.provide_spaces = config.provide_spaces;
+ f.share_desktop = config.share_desktop;
+ if os == "macos" && config.share_desktop {
+ let driver = config.driver_bin.clone();
+ f.permissions = tokio::task::spawn_blocking(move || {
+ use cua_host::preflight::SessionProbe as _;
+ cua_host::preflight::SystemProbe.permission_status(&driver)
+ })
+ .await
+ .ok()
+ .flatten();
+ }
+ }
+ let storage = crate::storage::storage_report().await;
+ f.disk = storage
+ .lume
+ .filter(|_| os == "macos")
+ .or(storage.qemu)
+ .or(storage.container)
+ .map(|v| (v.name, v.available));
+ if os == "macos" && (f.provide_spaces || f.lume_serving) {
+ let base = local_network::lume_base();
+ f.local_network = Some(local_network::report(&base).await);
+ let client = cua_vmm::lume::LumeClient::new(&base);
+ if let Ok(Ok(vms)) = tokio::time::timeout(Duration::from_secs(2), client.list()).await {
+ for vm in vms.iter().filter(|v| v.status == "running") {
+ f.running_vms += 1;
+ f.memory_vms += vm.memory_size;
+ }
+ }
+ f.memory_total = physical_memory();
+ }
+ f
+}
+
+/// The RPC's answer.
+pub async fn response() -> pb::DiagnoseHostResponse {
+ let started = Instant::now();
+ let facts = gather().await;
+ let mut report = Report {
+ schema_version: cua_spacesd_client::diagnose::SCHEMA_VERSION,
+ producer: format!("cua daemon {}", crate::VERSION),
+ checks: checks(&facts),
+ ..Report::default()
+ };
+ let now = SystemTime::now()
+ .duration_since(SystemTime::UNIX_EPOCH)
+ .unwrap_or_default();
+ report.started_at = Some(pbjson_types::Timestamp {
+ seconds: now.as_secs() as i64,
+ nanos: 0,
+ });
+ report.finalize(false, started.elapsed());
+ pb::DiagnoseHostResponse {
+ report: Some(report.to_pb()),
+ cua_version: crate::VERSION.to_string(),
+ os: facts.os,
+ }
+}
+
+#[cfg(target_os = "macos")]
+fn physical_memory() -> Option<u64> {
+ let mut size: u64 = 0;
+ let mut len = std::mem::size_of::<u64>();
+ let name = c"hw.memsize";
+ // SAFETY: `size` is a u64 and `len` its size; sysctlbyname writes at
+ // most `len` bytes.
+ let rc = unsafe {
+ libc::sysctlbyname(
+ name.as_ptr(),
+ (&mut size as *mut u64).cast(),
+ &mut len,
+ std::ptr::null_mut(),
+ 0,
+ )
+ };
+ (rc == 0 && size > 0).then_some(size)
+}
+
+#[cfg(not(target_os = "macos"))]
+fn physical_memory() -> Option<u64> {
+ None
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use std::path::PathBuf;
+
+ fn mac() -> Facts {
+ Facts {
+ os: "macos".into(),
+ provide_spaces: true,
+ lume_supported: true,
+ lume_serving: true,
+ runtimes_ready: vec!["lume".into()],
+ disk: Some(("Macintosh HD".into(), 200 * GIB as u64)),
+ ..Facts::default()
+ }
+ }
+
+ fn by_id<'a>(cs: &'a [Check], id: &str) -> &'a Check {
+ cs.iter()
+ .find(|c| c.id == id)
+ .unwrap_or_else(|| panic!("{id}"))
+ }
+
+ fn not_ok(cs: &[Check]) -> Vec<&str> {
+ cs.iter()
+ .filter(|c| matches!(c.status, Status::Warn | Status::Fail))
+ .map(|c| c.id.as_str())
+ .collect()
+ }
+
+ #[test]
+ fn a_healthy_mac_has_no_warnings() {
+ let mut f = mac();
+ f.local_network = Some(local_network::Report {
+ probe: local_network::Probe::Reached {
+ vm: "m".into(),
+ ip: "192.168.64.2".into(),
+ },
+ app: None,
+ pid: 1,
+ });
+ assert!(not_ok(&checks(&f)).is_empty(), "{:?}", checks(&f));
+ }
+
+ /// CUA-1807: the daemon is blocked; the check fails and names its app.
+ #[test]
+ fn a_blocked_daemon_fails_local_network_and_names_the_app() {
+ let mut f = mac();
+ f.local_network = Some(local_network::Report {
+ probe: local_network::Probe::Blocked {
+ vm: "m".into(),
+ ip: "192.168.64.2".into(),
+ },
+ app: Some(local_network::ResponsibleApp {
+ name: "Cua Spaces".into(),
+ path: PathBuf::from("/Applications/Cua Spaces.app"),
+ bundle: true,
+ }),
+ pid: 1,
+ });
+ let cs = checks(&f);
+ let c = by_id(&cs, "machine.local_network");
+ assert_eq!(c.status, Status::Fail);
+ // Still a failure once the report is finalized.
+ let mut report = Report {
+ checks: cs.clone(),
+ ..Report::default()
+ };
+ report.finalize(false, Duration::ZERO);
+ let c = by_id(&report.checks, "machine.local_network");
+ assert_eq!(c.status, Status::Fail);
+ assert!(c.message.contains("off for Cua Spaces"), "{}", c.message);
+ assert_eq!(c.facts["app"], "Cua Spaces");
+ assert!(c.facts["settings_url"].contains("Privacy_LocalNetwork"));
+ }
+
+ #[test]
+ fn low_disk_warns_then_fails() {
+ let mut f = mac();
+ f.disk = Some(("Macintosh HD".into(), 20 * GIB as u64));
+ let cs = checks(&f);
+ assert_eq!(by_id(&cs, "machine.disk").status, Status::Warn);
+ assert_eq!(by_id(&cs, "machine.disk").facts["free_gb"], "20");
+ f.disk = Some(("Macintosh HD".into(), 4 * GIB as u64));
+ assert_eq!(by_id(&checks(&f), "machine.disk").status, Status::Fail);
+ }
+
+ #[test]
+ fn running_vms_that_leave_little_memory_warn() {
+ let mut f = mac();
+ f.memory_total = Some(16 * GIB as u64);
+ f.running_vms = 2;
+ f.memory_vms = 12 * GIB as u64;
+ let cs = checks(&f);
+ let c = by_id(&cs, "machine.memory");
+ assert_eq!(c.status, Status::Warn);
+ assert!(c.message.contains("12 of 16 GB"), "{}", c.message);
+ f.memory_vms = 4 * GIB as u64;
+ assert_eq!(by_id(&checks(&f), "machine.memory").status, Status::Pass);
+ }
+
+ #[test]
+ fn an_intel_mac_providing_spaces_fails_and_missing_permissions_warn() {
+ let mut f = mac();
+ f.lume_supported = false;
+ assert_eq!(
+ by_id(&checks(&f), "machine.virtualization").status,
+ Status::Fail
+ );
+ let mut f = mac();
+ f.share_desktop = true;
+ f.permissions = Some((false, true));
+ let cs = checks(&f);
+ assert_eq!(not_ok(&cs), ["machine.permissions.screen-recording"]);
+ assert!(
+ by_id(&cs, "machine.permissions.screen-recording").facts["settings_url"]
+ .contains("Privacy_ScreenCapture")
+ );
+ }
+
+ #[test]
+ fn a_machine_that_runs_no_spaces_is_not_asked_about_them() {
+ let f = Facts {
+ os: "macos".into(),
+ lume_supported: true,
+ disk: Some(("Macintosh HD".into(), 200 * GIB as u64)),
+ ..Facts::default()
+ };
+ let cs = checks(&f);
+ assert!(cs.iter().all(|c| c.id != "machine.local_network"));
+ assert!(not_ok(&cs).is_empty());
+ }
+}
diff --git a/libs/cua/crates/cua-host/src/host.rs b/libs/cua/crates/cua-host/src/host.rs
index 87bdb0767a..6c752099c3 100644
--- a/libs/cua/crates/cua-host/src/host.rs
+++ b/libs/cua/crates/cua-host/src/host.rs
@@ -1405,6 +1405,22 @@ impl Host {
RelayClient::new(url)?.machine(&token, id).await
}
+ /// Takes `name` as this machine's display name when `machine_id` is
+ /// this machine's relay registration (after the owner renamed it on
+ /// the relay from an enrolled device). Returns whether it did: another
+ /// machine, or a machine not set up, is left alone.
+ pub fn adopt_name(&self, machine_id: &str, name: &str) -> Result<bool> {
+ let Some(mut config) = self.config()? else {
+ return Ok(false);
+ };
+ if config.machine_id.as_deref() != Some(machine_id) || name.trim().is_empty() {
+ return Ok(false);
+ }
+ config.name = name.trim().to_string();
+ write_json(&self.paths.config(), &config)?;
+ Ok(true)
+ }
+
fn require_config(&self) -> Result<HostConfig> {
self.config()?.ok_or_else(|| {
Error::NotFound("this computer is not set up for access (run `cua host setup`)".into())
diff --git a/libs/cua/crates/cua-host/src/tests.rs b/libs/cua/crates/cua-host/src/tests.rs
index 8a2f73d391..2c82fe1138 100644
--- a/libs/cua/crates/cua-host/src/tests.rs
+++ b/libs/cua/crates/cua-host/src/tests.rs
@@ -1706,3 +1706,29 @@ fn the_service_gets_cua_mesh_only_when_setup_was_given_it() {
serde_json::from_str(&serde_json::to_string(&config).unwrap()).unwrap();
assert_eq!(back.mesh.as_deref(), Some("prefer"));
}
+
+/// A machine renamed on the relay from an enrolled device: this machine's
+/// host setup takes the name when it is this machine, and only then.
+#[tokio::test]
+async fn a_rename_on_the_relay_is_adopted_only_by_that_machine() {
+ let relay = FakeRelay::start().await;
+ relay.add_account("acct-token", "user-1", Some("[email protected]"));
+ let f = fixture();
+ let host = f.host();
+ let status = host
+ .setup(f.relay_opts(&relay.url), &StaticToken("acct-token".into()))
+ .await
+ .unwrap();
+ let id = status.machine_id.clone().unwrap();
+ assert!(!host.adopt_name("some-other-machine", "Studio").unwrap());
+ assert!(!host.adopt_name(&id, " ").unwrap());
+ assert_eq!(host.status().await.unwrap().name.as_deref(), Some("mini"));
+ assert!(host.adopt_name(&id, " Ada's Studio ").unwrap());
+ assert_eq!(
+ host.status().await.unwrap().name.as_deref(),
+ Some("Ada's Studio")
+ );
+ // Not set up: nothing to take the name.
+ let other = fixture();
+ assert!(!other.host().adopt_name(&id, "x").unwrap());
+}
diff --git a/libs/cua/crates/cua-sdk/src/json.rs b/libs/cua/crates/cua-sdk/src/json.rs
index e54052b515..5f4ab17112 100644
--- a/libs/cua/crates/cua-sdk/src/json.rs
+++ b/libs/cua/crates/cua-sdk/src/json.rs
@@ -79,6 +79,7 @@ pub const JSON_UNARY_METHODS: &[&str] = &[
"/cua.env.v1.HostSpacesService/CancelHostSpace",
"/cua.env.v1.HostSpacesService/SetHostSpacePower",
"/cua.env.v1.HostSpacesService/DeleteCloudSpace",
+ "/cua.env.v1.HostSpacesService/DiagnoseHost",
"/cua.env.v1.VolumeService/AttachVolume",
"/cua.env.v1.VolumeService/DetachVolume",
"/cua.env.v1.VolumeService/GetVolumeStatus",
@@ -484,6 +485,14 @@ pub(crate) async fn call_unary<C: Channel>(ch: C, path: &str, json: &str) -> Res
)
.await
}
+ "/cua.env.v1.HostSpacesService/DiagnoseHost" => {
+ unary::<C, pb::DiagnoseHostRequest, pb::DiagnoseHostResponse>(
+ ch,
+ "/cua.env.v1.HostSpacesService/DiagnoseHost",
+ json,
+ )
+ .await
+ }
"/cua.env.v1.VolumeService/AttachVolume" => {
unary::<C, pb::AttachVolumeRequest, pb::AttachVolumeResponse>(
ch,
diff --git a/libs/cua/crates/cua-sdk/src/native/host.rs b/libs/cua/crates/cua-sdk/src/native/host.rs
index 1becb63a47..e9ee3af897 100644
--- a/libs/cua/crates/cua-sdk/src/native/host.rs
+++ b/libs/cua/crates/cua-sdk/src/native/host.rs
@@ -92,6 +92,12 @@ pub struct RelayMachine {
/// check existed. `false` shows the machine as "new" until an enrolled
/// device confirms it ([`Devices::confirm_machine`]) (S5).
pub confirmed: bool,
+ /// The team you reach it through, for a team machine not shared with
+ /// you directly.
+ pub team: Option<String>,
+ /// It creates Spaces for its owner's devices, when it said so at
+ /// registration (`None` from a host or relay that predates it).
+ pub provides_spaces: Option<bool>,
}
impl From<cua_host::Machine> for RelayMachine {
@@ -110,6 +116,11 @@ impl From<cua_host::Machine> for RelayMachine {
allow: m.allow,
clients: m.clients.into_iter().map(Into::into).collect(),
confirmed: m.confirmed,
+ provides_spaces: m
+ .meta
+ .get(cua_host::META_PROVIDES_SPACES)
+ .map(|v| v == "on"),
+ team: m.team.filter(|t| !t.trim().is_empty()),
}
}
}
@@ -1053,6 +1064,39 @@ impl Devices {
.await
}
+ /// Renames `machine_id`, a machine the account owns, on the relay (from
+ /// this enrolled device). When it is this machine's own registration,
+ /// its host setup takes the new name too.
+ pub async fn rename_machine(&self, machine_id: String, name: String) -> Result<RelayMachine> {
+ let auth = self.auth.clone();
+ let tokens = self.tokens.clone();
+ run(async move {
+ let name = name.trim().to_string();
+ if name.is_empty() {
+ return Err(
+ cua_host::Error::InvalidArgument("a machine needs a name".into()).into(),
+ );
+ }
+ let session = auth.session().await?;
+ let token = cua_host::AccountTokens::access_token(tokens.as_ref()).await?;
+ let m: RelayMachine = cua_host::RelayClient::new(auth.relay_url())?
+ .with_device_session(Some(session))
+ .patch(
+ &token,
+ &machine_id,
+ &cua_host::MachinePatch {
+ name: Some(name.clone()),
+ ..Default::default()
+ },
+ )
+ .await?
+ .into();
+ cua_host::Host::new(cua_daemon::cua_home()).adopt_name(&machine_id, &name)?;
+ Ok(m)
+ })
+ .await
+ }
+
/// Vouches for `machine_id`, a machine that registered without an
/// enrolled device's signature or MFA (from this enrolled device) (S5).
/// Clears [`RelayMachine::confirmed`]'s "new" flag for every account
@@ -1077,6 +1121,30 @@ impl Devices {
mod tests {
use super::*;
+ /// The Machines page groups team machines and says whether a machine
+ /// provides Spaces from what the relay recorded at registration.
+ #[test]
+ fn a_relay_machine_carries_its_team_and_whether_it_provides_spaces() {
+ let mut m = cua_host::Machine {
+ id: "m1".into(),
+ role: "shared".into(),
+ team: Some("team-1".into()),
+ ..Default::default()
+ };
+ m.meta
+ .insert(cua_host::META_PROVIDES_SPACES.into(), "on".into());
+ let r = RelayMachine::from(m.clone());
+ assert_eq!(r.team.as_deref(), Some("team-1"));
+ assert_eq!(r.provides_spaces, Some(true));
+ m.meta
+ .insert(cua_host::META_PROVIDES_SPACES.into(), "off".into());
+ m.team = Some(" ".into());
+ let r = RelayMachine::from(m.clone());
+ assert_eq!((r.team, r.provides_spaces), (None, Some(false)));
+ m.meta.clear();
+ assert_eq!(RelayMachine::from(m).provides_spaces, None);
+ }
+
#[test]
fn setup_reports_whether_it_had_a_token_never_the_token() {
use base64::Engine;
diff --git a/libs/cua/crates/cua-sdk/src/native/spaces.rs b/libs/cua/crates/cua-sdk/src/native/spaces.rs
index e819e7add0..b9d8c8ae4d 100644
--- a/libs/cua/crates/cua-sdk/src/native/spaces.rs
+++ b/libs/cua/crates/cua-sdk/src/native/spaces.rs
@@ -2217,6 +2217,60 @@ impl SpacesToolCaller {
}
}
+// ------------------------------------------------------------ Machine health
+
+/// One check of a machine's health ([`Spaces::machine_health`]).
+#[derive(Debug, Clone, PartialEq, Eq, uniffi::Record)]
+pub struct MachineHealthCheck {
+ /// `machine.local_network`, `machine.disk`, `machine.virtualization`,
+ /// `machine.memory`, `machine.permissions.<id>`.
+ pub id: String,
+ /// `pass`, `warn`, `fail` or `skip`.
+ pub status: String,
+ /// What it found, in one line.
+ pub message: String,
+ /// What to do about a warning or failure.
+ pub remediation: String,
+ /// What a UI needs to word it and offer its fix (`app`, `settings_url`,
+ /// `free_gb`, ...).
+ pub facts: std::collections::HashMap<String, String>,
+}
+
+/// A machine's health as its own cua daemon checks it.
+#[derive(Debug, Clone, PartialEq, Eq, uniffi::Record)]
+pub struct MachineHealth {
+ /// The Cua version of the daemon that checked.
+ pub cua_version: String,
+ /// `macos`, `linux`, `windows`.
+ pub os: String,
+ /// Every check, in order.
+ pub checks: Vec<MachineHealthCheck>,
+ /// The whole report as JSON (the schema `cua doctor --json` writes).
+ pub report_json: String,
+}
+
+impl From<cua_proto::env::v1::DiagnoseHostResponse> for MachineHealth {
+ fn from(r: cua_proto::env::v1::DiagnoseHostResponse) -> Self {
+ let report = cua_spacesd_client::diagnose::Report::from_pb(r.report.unwrap_or_default());
+ Self {
+ cua_version: r.cua_version,
+ os: r.os,
+ checks: report
+ .checks
+ .iter()
+ .map(|c| MachineHealthCheck {
+ id: c.id.clone(),
+ status: c.status.as_str().to_string(),
+ message: c.message.clone(),
+ remediation: c.remediation.clone(),
+ facts: c.facts.clone().into_iter().collect(),
+ })
+ .collect(),
+ report_json: report.to_json(),
+ }
+ }
+}
+
// ------------------------------------------------------------ Spaces
/// The Spaces registry: add a machine by URL, provision a local one, and get
@@ -2678,6 +2732,27 @@ impl Spaces {
.await
}
+ /// A machine's health as its own cua daemon checks it: Local Network
+ /// access (and which app macOS holds responsible), free disk,
+ /// virtualization, memory left by running Spaces, the permissions
+ /// sharing its desktop needs. `machine`: another of your machines, by
+ /// id or name (asked over the relay, the mesh or its direct address);
+ /// `None` for this one. Read-only; fails plainly when that machine is
+ /// offline, not yours, or runs a Cua that predates the check.
+ pub async fn machine_health(&self, machine: Option<String>) -> Result<MachineHealth> {
+ let host = self.host.clone();
+ run(async move {
+ let machine = machine.filter(|m| !m.trim().is_empty());
+ let r = match (&host, machine) {
+ (Host::Embedded(_), None) => cua_daemon::machine_doctor::response().await,
+ (Host::Embedded(s), Some(m)) => s.machine_health(&m).await?,
+ (Host::Daemon(d), m) => d.diagnose_host(m.unwrap_or_default()).await?,
+ };
+ Ok(r.into())
+ })
+ .await
+ }
+
/// Deletes a Space's sandbox and forgets it (a Space added by address
/// is only forgotten). Returns what happened.
pub async fn delete(&self, space: String) -> Result<String> {
diff --git a/libs/cua/crates/cua-spaces-app-core/parity/golden/machines.json b/libs/cua/crates/cua-spaces-app-core/parity/golden/machines.json
index c9485d4e3a..899bcf996f 100644
--- a/libs/cua/crates/cua-spaces-app-core/parity/golden/machines.json
+++ b/libs/cua/crates/cua-spaces-app-core/parity/golden/machines.json
@@ -60,6 +60,290 @@
"Spare Mac mini [m-mini] relay macos online desktop relay:m-mini \"Online\" \"No Spaces\"",
"Build box [m-box] relay ? online \"Online\" \"2 Spaces\""
]
+ },
+ {
+ "groups": [
+ {
+ "group": "Your machines",
+ "rows": [
+ "● Ada's MacBook Pro [This Mac] — 1 Space running",
+ "● cua's Mac Studio — 1 Space running · Provides Spaces",
+ "○ Cua BYOC tests — Offline · last seen 9 days ago",
+ "○ Adas-MacBook-Pro-2.local — Not sharing · No Spaces",
+ "● Ana's laptop — Online"
+ ]
+ },
+ {
+ "group": "Offline for 30+ days (1) (collapsed) · Remove old machines",
+ "rows": [
+ "○ mac-mini-staging — Offline · last seen 41 days ago"
+ ]
+ },
+ {
+ "group": "Team machines",
+ "rows": [
+ "● build-mini-01 — Ready for Spaces"
+ ]
+ }
+ ],
+ "pages": [
+ [
+ "Ada's MacBook Pro — Online (rename: host)",
+ "Provide Spaces: off (runs: provide-spaces)",
+ "Share this desktop: on (runs: hide-desktop)",
+ "space space-cdf71481c4 · macOS 26.5.2 · Running -> local:space-cdf71481c4",
+ "space space-1cef393ac1 · Linux · Suspended -> local:space-1cef393ac1",
+ "New Space here on local",
+ "details: OS: macOS 26.5.2; App: 0.9.1; Connection: via Cua relay; Service: Running",
+ "Remove from account -> host setup"
+ ],
+ [
+ "cua's Mac Studio — Online (rename: machine)",
+ "Provide Spaces: on (read-only)",
+ "Share this desktop: on (read-only)",
+ "note: Change this on that Mac.",
+ "space xm-before-linux · Ubuntu 24.04.5 LTS · Running -> relay:studio/xm",
+ "New Space here on host:studio",
+ "details: OS: macOS 26.5.2; Connection: via Cua relay; Service: Running",
+ "Remove from account -> studio (disabled: It’s online. Remove it on that Mac, or here once it’s offline.)"
+ ],
+ [
+ "Cua BYOC tests — Offline · last seen 9 days ago (rename: machine)",
+ "notice: This machine is offline. Open Cua Spaces on it to use it.",
+ "Provide Spaces: on (read-only)",
+ "Share this desktop: on (read-only)",
+ "spaces: No Spaces. The machine is offline.",
+ "New Space here on host:byoc (disabled: It’s offline.)",
+ "details: OS: macOS; Connection: via Cua relay; Service: Not reachable",
+ "Remove from account -> byoc + dev_byoc"
+ ],
+ [
+ "Adas-MacBook-Pro-2.local — Not sharing (rename: machine)",
+ "notice: Sharing is off on that Mac. Turn it on there to use it.",
+ "Provide Spaces: off (read-only)",
+ "Share this desktop: on (read-only)",
+ "spaces: No Spaces yet.",
+ "New Space here on host:b695 (disabled: It isn’t sharing.)",
+ "details: OS: macOS; Connection: via Cua relay; Service: Not sharing",
+ "Remove from account -> b695 (disabled: It’s online. Remove it on that Mac, or here once it’s offline.)"
+ ],
+ [
+ "Ana's laptop — Online (rename: device)",
+ "Provide Spaces: off (read-only)",
+ "Share this desktop: off (read-only)",
+ "note: Change this on that PC.",
+ "spaces: No Spaces yet.",
+ "New Space here on host:dev_lap (disabled: It doesn’t provide Spaces. Turn on Provide Spaces on that PC.)",
+ "details: OS: Windows",
+ "Remove from account -> dev_lap"
+ ],
+ [
+ "mac-mini-staging — Offline · last seen 41 days ago (rename: machine)",
+ "notice: This machine is offline. Open Cua Spaces on it to use it.",
+ "Provide Spaces: off (read-only)",
+ "Share this desktop: on (read-only)",
+ "spaces: No Spaces. The machine is offline.",
+ "New Space here on host:old1 (disabled: It’s offline.)",
+ "details: OS: macOS; Connection: via Cua relay; Service: Not reachable",
+ "Remove from account -> old1 + dev_old1"
+ ],
+ [
+ "build-mini-01 — Online · Shared by your team",
+ "Provide Spaces: on (read-only)",
+ "note: Its owner changes this on that Mac.",
+ "spaces: No Spaces yet.",
+ "New Space here on host:team",
+ "details: OS: macOS; Connection: via Cua relay; Service: Running"
+ ]
+ ],
+ "summary": "7 machines, 4 online",
+ "view": "the approved mockup: This Mac, a Mac Studio providing a Space, an offline Mac, an old Mac, a team machine, a Mac that stopped sharing and a laptop"
+ },
+ {
+ "groups": [
+ {
+ "group": "Your machines",
+ "rows": [
+ "● Ada's MacBook Pro [This Mac] — 1 Space running",
+ "○ Cua BYOC tests — Offline · last seen 9 days ago",
+ "● Ana's laptop — Online"
+ ]
+ },
+ {
+ "group": "Offline for 30+ days (1) (collapsed) · Remove old machines",
+ "rows": [
+ "○ mac-mini-staging — Offline · last seen 41 days ago"
+ ]
+ }
+ ],
+ "pages": [
+ [
+ "Ada's MacBook Pro — Online (rename: host)",
+ "Provide Spaces: off (runs: hide-desktop, resume-sharing)",
+ "Share this desktop: off (runs: stop-providing-spaces, resume-sharing)",
+ "space space-cdf71481c4 · macOS 26.5.2 · Running -> local:space-cdf71481c4",
+ "space space-1cef393ac1 · Linux · Suspended -> local:space-1cef393ac1",
+ "New Space here on local",
+ "details: OS: macOS 26.5.2; App: 0.9.1; Connection: via Cua relay; Service: Running",
+ "Remove from account -> host setup"
+ ],
+ [
+ "Cua BYOC tests — Offline · last seen 9 days ago (rename: device)",
+ "notice: This machine is offline. Open Cua Spaces on it to use it.",
+ "Provide Spaces: off (read-only)",
+ "Share this desktop: off (read-only)",
+ "spaces: No Spaces. The machine is offline.",
+ "New Space here on host:dev_byoc (disabled: It’s offline.)",
+ "details: OS: macOS",
+ "Remove from account -> dev_byoc"
+ ],
+ [
+ "Ana's laptop — Online (rename: device)",
+ "Provide Spaces: off (read-only)",
+ "Share this desktop: off (read-only)",
+ "note: Change this on that PC.",
+ "spaces: No Spaces yet.",
+ "New Space here on host:dev_lap (disabled: It doesn’t provide Spaces. Turn on Provide Spaces on that PC.)",
+ "details: OS: Windows",
+ "Remove from account -> dev_lap"
+ ],
+ [
+ "mac-mini-staging — Offline · last seen 41 days ago (rename: device)",
+ "notice: This machine is offline. Open Cua Spaces on it to use it.",
+ "Provide Spaces: off (read-only)",
+ "Share this desktop: off (read-only)",
+ "spaces: No Spaces. The machine is offline.",
+ "New Space here on host:dev_old1 (disabled: It’s offline.)",
+ "details: OS: macOS",
+ "Remove from account -> dev_old1"
+ ]
+ ],
+ "summary": "4 machines, 2 online",
+ "view": "This Mac stopped sharing: both switches off, turning one on resumes"
+ },
+ {
+ "groups": [
+ {
+ "group": "Your machines",
+ "rows": [
+ "● Ada's MacBook Pro [This Mac] — No Spaces"
+ ]
+ }
+ ],
+ "pages": [
+ [
+ "Ada's MacBook Pro — Online",
+ "Provide Spaces: off (sets up: spare)",
+ "Share this desktop: off (sets up: desktop)",
+ "spaces: No Spaces yet.",
+ "New Space here on local",
+ "details: OS: macOS 26.5.2; App: 0.9.1; Connection: Not shared"
+ ]
+ ],
+ "summary": "1 machine, 1 online",
+ "view": "This Mac before setup: a switch opens the setup form"
+ },
+ {
+ "groups": [
+ {
+ "group": "Your machines",
+ "rows": [
+ "● Ada's MacBook Pro [This Mac] — 1 Space running [fail]",
+ "● cua's Mac Studio — 1 Space running · Provides Spaces [warn]",
+ "○ Cua BYOC tests — Offline · last seen 9 days ago",
+ "○ Adas-MacBook-Pro-2.local — Not sharing · No Spaces",
+ "● Ana's laptop — Online"
+ ]
+ },
+ {
+ "group": "Offline for 30+ days (1) (collapsed) · Remove old machines",
+ "rows": [
+ "○ mac-mini-staging — Offline · last seen 41 days ago"
+ ]
+ },
+ {
+ "group": "Team machines",
+ "rows": [
+ "● build-mini-01 — Ready for Spaces"
+ ]
+ }
+ ],
+ "pages": [
+ [
+ "Ada's MacBook Pro — Online (rename: host)",
+ "issues fail: Cua can’t reach this Mac’s macOS Spaces: Local Network access is off for Cua Spaces. [Open Local Network settings]",
+ "issues warn: Only 21 GB free. A macOS Space needs about 30 GB. [Free disk space]",
+ "Provide Spaces: off (runs: provide-spaces)",
+ "Share this desktop: on (runs: hide-desktop)",
+ "space space-cdf71481c4 · macOS 26.5.2 · Running -> local:space-cdf71481c4",
+ "space space-1cef393ac1 · Linux · Suspended -> local:space-1cef393ac1",
+ "New Space here on local",
+ "details: OS: macOS 26.5.2; App: 0.9.1; Connection: via Cua relay; Service: Running",
+ "Remove from account -> host setup"
+ ],
+ [
+ "cua's Mac Studio — Online (rename: machine)",
+ "issues warn: Running Spaces use 28 of 32 GB of memory on that Mac, so another may not start.",
+ "issues warn: It runs Cua 0.3.9, older than this Mac’s 0.4.1. Update Cua on it.",
+ "Provide Spaces: on (read-only)",
+ "Share this desktop: on (read-only)",
+ "note: Change this on that Mac.",
+ "space xm-before-linux · Ubuntu 24.04.5 LTS · Running -> relay:studio/xm",
+ "New Space here on host:studio",
+ "details: OS: macOS 26.5.2; Connection: via Cua relay; Service: Running",
+ "Remove from account -> studio (disabled: It’s online. Remove it on that Mac, or here once it’s offline.)"
+ ],
+ [
+ "Cua BYOC tests — Offline · last seen 9 days ago (rename: machine)",
+ "notice: This machine is offline. Open Cua Spaces on it to use it.",
+ "Provide Spaces: on (read-only)",
+ "Share this desktop: on (read-only)",
+ "spaces: No Spaces. The machine is offline.",
+ "New Space here on host:byoc (disabled: It’s offline.)",
+ "details: OS: macOS; Connection: via Cua relay; Service: Not reachable",
+ "Remove from account -> byoc + dev_byoc"
+ ],
+ [
+ "Adas-MacBook-Pro-2.local — Not sharing (rename: machine)",
+ "notice: Sharing is off on that Mac. Turn it on there to use it.",
+ "Provide Spaces: off (read-only)",
+ "Share this desktop: on (read-only)",
+ "spaces: No Spaces yet.",
+ "New Space here on host:b695 (disabled: It isn’t sharing.)",
+ "details: OS: macOS; Connection: via Cua relay; Service: Not sharing",
+ "Remove from account -> b695 (disabled: It’s online. Remove it on that Mac, or here once it’s offline.)"
+ ],
+ [
+ "Ana's laptop — Online (rename: device)",
+ "Provide Spaces: off (read-only)",
+ "Share this desktop: off (read-only)",
+ "note: Change this on that PC.",
+ "spaces: No Spaces yet.",
+ "New Space here on host:dev_lap (disabled: It doesn’t provide Spaces. Turn on Provide Spaces on that PC.)",
+ "details: OS: Windows",
+ "Remove from account -> dev_lap"
+ ],
+ [
+ "mac-mini-staging — Offline · last seen 41 days ago (rename: machine)",
+ "notice: This machine is offline. Open Cua Spaces on it to use it.",
+ "Provide Spaces: off (read-only)",
+ "Share this desktop: on (read-only)",
+ "spaces: No Spaces. The machine is offline.",
+ "New Space here on host:old1 (disabled: It’s offline.)",
+ "details: OS: macOS; Connection: via Cua relay; Service: Not reachable",
+ "Remove from account -> old1 + dev_old1"
+ ],
+ [
+ "build-mini-01 — Online · Shared by your team",
+ "Provide Spaces: on (read-only)",
+ "note: Its owner changes this on that Mac.",
+ "spaces: No Spaces yet.",
+ "New Space here on host:team",
+ "details: OS: macOS; Connection: via Cua relay; Service: Running"
+ ]
+ ],
+ "summary": "7 machines, 4 online",
+ "view": "the mockup with issues: This Mac's daemon blocked from the Local Network and low on disk, the Mac Studio on an older Cua and short of memory, the offline Mac's old checks hidden"
}
]
}
diff --git a/libs/cua/crates/cua-spaces-app-core/parity/machines.json b/libs/cua/crates/cua-spaces-app-core/parity/machines.json
index 021a6209f9..9c66219d86 100644
--- a/libs/cua/crates/cua-spaces-app-core/parity/machines.json
+++ b/libs/cua/crates/cua-spaces-app-core/parity/machines.json
@@ -100,5 +100,556 @@
"presence": { "m-box": true}
}
}
+ ],
+ "views": [
+ {
+ "name": "the approved mockup: This Mac, a Mac Studio providing a Space, an offline Mac, an old Mac, a team machine, a Mac that stopped sharing and a laptop",
+ "input": {
+ "page": {
+ "hostOs": "macos",
+ "now": 1800000000,
+ "spaces": [
+ {
+ "name": "This Mac",
+ "os": "macos",
+ "status": "local",
+ "detail": "",
+ "lastUsedAt": 0,
+ "scene": "linux-terminal",
+ "id": "this-mac"
+ },
+ {
+ "name": "space-cdf71481c4",
+ "os": "macos",
+ "status": "running",
+ "detail": "",
+ "lastUsedAt": 0,
+ "scene": "linux-terminal",
+ "id": "local:space-cdf71481c4",
+ "osPrettyName": "macOS 26.5.2",
+ "provider": "local"
+ },
+ {
+ "name": "space-1cef393ac1",
+ "os": "linux",
+ "status": "suspended",
+ "detail": "",
+ "lastUsedAt": 0,
+ "scene": "linux-terminal",
+ "id": "local:space-1cef393ac1",
+ "provider": "local"
+ },
+ {
+ "name": "cua's Mac Studio",
+ "os": "macos",
+ "status": "running",
+ "detail": "",
+ "lastUsedAt": 0,
+ "scene": "linux-terminal",
+ "id": "relay:studio",
+ "osPrettyName": "macOS 26.5.2",
+ "provider": "relay"
+ },
+ {
+ "name": "xm-before-linux",
+ "os": "linux",
+ "status": "running",
+ "detail": "",
+ "lastUsedAt": 0,
+ "scene": "linux-terminal",
+ "id": "relay:studio/xm",
+ "osPrettyName": "Ubuntu 24.04.5 LTS",
+ "provider": "relay",
+ "host": "studio",
+ "hostName": "cua's Mac Studio"
+ },
+ {
+ "name": "Cua BYOC tests",
+ "os": "macos",
+ "status": "suspended",
+ "detail": "",
+ "lastUsedAt": 0,
+ "scene": "linux-terminal",
+ "id": "relay:byoc",
+ "provider": "relay"
+ },
+ {
+ "name": "mac-mini-staging",
+ "os": "macos",
+ "status": "suspended",
+ "detail": "",
+ "lastUsedAt": 0,
+ "scene": "linux-terminal",
+ "id": "relay:old1",
+ "provider": "relay"
+ },
+ {
+ "name": "build-mini-01",
+ "os": "macos",
+ "status": "running",
+ "detail": "",
+ "lastUsedAt": 0,
+ "scene": "linux-terminal",
+ "id": "relay:team",
+ "provider": "relay"
+ },
+ {
+ "name": "Adas-MacBook-Pro-2.local",
+ "os": "macos",
+ "status": "suspended",
+ "detail": "",
+ "lastUsedAt": 0,
+ "scene": "linux-terminal",
+ "id": "relay:b695",
+ "provider": "relay",
+ "sdk": {
+ "features": [],
+ "spacesdVersion": "",
+ "reachable": false,
+ "error": "unauthenticated: Adas-MacBook-Pro-2.local stopped sharing: ask its owner to Resume sharing (or run `cua host start` there)"
+ }
+ }
+ ],
+ "devices": [
+ {
+ "id": "dev_byoc",
+ "name": "Cua BYOC tests",
+ "platform": "macos",
+ "lastSeen": 1799222400,
+ "state": "enrolled"
+ },
+ {
+ "id": "dev_old1",
+ "name": "mac-mini-staging",
+ "platform": "macos",
+ "lastSeen": 1796457600,
+ "state": "enrolled"
+ },
+ {
+ "id": "dev_lap",
+ "name": "Ana's laptop",
+ "platform": "windows",
+ "lastSeen": 1799999880,
+ "state": "enrolled"
+ }
+ ],
+ "hostnames": {},
+ "presence": {}
+ },
+ "relay": [
+ {
+ "id": "studio",
+ "role": "owner",
+ "providesSpaces": true
+ },
+ {
+ "id": "byoc",
+ "role": "owner",
+ "providesSpaces": true
+ },
+ {
+ "id": "old1",
+ "role": "owner",
+ "providesSpaces": false
+ },
+ {
+ "id": "team",
+ "role": "shared",
+ "team": "team-1",
+ "providesSpaces": true
+ },
+ {
+ "id": "b695",
+ "role": "owner",
+ "providesSpaces": false
+ }
+ ],
+ "host": {
+ "configured": true,
+ "mode": "relay",
+ "name": "Ada's MacBook Pro",
+ "sharing": true,
+ "serviceInstalled": true,
+ "serviceRunning": true,
+ "serviceKind": "launchd",
+ "shareDesktop": true,
+ "provideSpaces": false
+ },
+ "about": {
+ "computerName": "Ada's MacBook Pro",
+ "appVersion": "0.9.1",
+ "osVersion": "macOS 26.5.2"
+ }
+ }
+ },
+ {
+ "name": "This Mac stopped sharing: both switches off, turning one on resumes",
+ "input": {
+ "page": {
+ "hostOs": "macos",
+ "now": 1800000000,
+ "spaces": [
+ {
+ "name": "This Mac",
+ "os": "macos",
+ "status": "local",
+ "detail": "",
+ "lastUsedAt": 0,
+ "scene": "linux-terminal",
+ "id": "this-mac"
+ },
+ {
+ "name": "space-cdf71481c4",
+ "os": "macos",
+ "status": "running",
+ "detail": "",
+ "lastUsedAt": 0,
+ "scene": "linux-terminal",
+ "id": "local:space-cdf71481c4",
+ "osPrettyName": "macOS 26.5.2",
+ "provider": "local"
+ },
+ {
+ "name": "space-1cef393ac1",
+ "os": "linux",
+ "status": "suspended",
+ "detail": "",
+ "lastUsedAt": 0,
+ "scene": "linux-terminal",
+ "id": "local:space-1cef393ac1",
+ "provider": "local"
+ }
+ ],
+ "devices": [
+ {
+ "id": "dev_byoc",
+ "name": "Cua BYOC tests",
+ "platform": "macos",
+ "lastSeen": 1799222400,
+ "state": "enrolled"
+ },
+ {
+ "id": "dev_old1",
+ "name": "mac-mini-staging",
+ "platform": "macos",
+ "lastSeen": 1796457600,
+ "state": "enrolled"
+ },
+ {
+ "id": "dev_lap",
+ "name": "Ana's laptop",
+ "platform": "windows",
+ "lastSeen": 1799999880,
+ "state": "enrolled"
+ }
+ ],
+ "hostnames": {},
+ "presence": {}
+ },
+ "relay": [],
+ "host": {
+ "configured": true,
+ "mode": "relay",
+ "name": "Ada's MacBook Pro",
+ "sharing": false,
+ "serviceInstalled": true,
+ "serviceRunning": true,
+ "serviceKind": "launchd",
+ "shareDesktop": true,
+ "provideSpaces": true
+ },
+ "about": {
+ "computerName": "Ada's MacBook Pro",
+ "appVersion": "0.9.1",
+ "osVersion": "macOS 26.5.2"
+ }
+ }
+ },
+ {
+ "name": "This Mac before setup: a switch opens the setup form",
+ "input": {
+ "page": {
+ "hostOs": "macos",
+ "now": 1800000000,
+ "spaces": [
+ {
+ "name": "This Mac",
+ "os": "macos",
+ "status": "local",
+ "detail": "",
+ "lastUsedAt": 0,
+ "scene": "linux-terminal",
+ "id": "this-mac"
+ }
+ ],
+ "devices": [],
+ "hostnames": {},
+ "presence": {}
+ },
+ "relay": [],
+ "host": {
+ "configured": false,
+ "sharing": false,
+ "serviceInstalled": false,
+ "serviceRunning": false,
+ "serviceKind": "launchd"
+ },
+ "about": {
+ "computerName": "Ada's MacBook Pro",
+ "appVersion": "0.9.1",
+ "osVersion": "macOS 26.5.2"
+ }
+ }
+ },
+ {
+ "name": "the mockup with issues: This Mac's daemon blocked from the Local Network and low on disk, the Mac Studio on an older Cua and short of memory, the offline Mac's old checks hidden",
+ "input": {
+ "page": {
+ "hostOs": "macos",
+ "now": 1800000000,
+ "spaces": [
+ {
+ "name": "This Mac",
+ "os": "macos",
+ "status": "local",
+ "detail": "",
+ "lastUsedAt": 0,
+ "scene": "linux-terminal",
+ "id": "this-mac"
+ },
+ {
+ "name": "space-cdf71481c4",
+ "os": "macos",
+ "status": "running",
+ "detail": "",
+ "lastUsedAt": 0,
+ "scene": "linux-terminal",
+ "id": "local:space-cdf71481c4",
+ "osPrettyName": "macOS 26.5.2",
+ "provider": "local"
+ },
+ {
+ "name": "space-1cef393ac1",
+ "os": "linux",
+ "status": "suspended",
+ "detail": "",
+ "lastUsedAt": 0,
+ "scene": "linux-terminal",
+ "id": "local:space-1cef393ac1",
+ "provider": "local"
+ },
+ {
+ "name": "cua's Mac Studio",
+ "os": "macos",
+ "status": "running",
+ "detail": "",
+ "lastUsedAt": 0,
+ "scene": "linux-terminal",
+ "id": "relay:studio",
+ "osPrettyName": "macOS 26.5.2",
+ "provider": "relay"
+ },
+ {
+ "name": "xm-before-linux",
+ "os": "linux",
+ "status": "running",
+ "detail": "",
+ "lastUsedAt": 0,
+ "scene": "linux-terminal",
+ "id": "relay:studio/xm",
+ "osPrettyName": "Ubuntu 24.04.5 LTS",
+ "provider": "relay",
+ "host": "studio",
+ "hostName": "cua's Mac Studio"
+ },
+ {
+ "name": "Cua BYOC tests",
+ "os": "macos",
+ "status": "suspended",
+ "detail": "",
+ "lastUsedAt": 0,
+ "scene": "linux-terminal",
+ "id": "relay:byoc",
+ "provider": "relay"
+ },
+ {
+ "name": "mac-mini-staging",
+ "os": "macos",
+ "status": "suspended",
+ "detail": "",
+ "lastUsedAt": 0,
+ "scene": "linux-terminal",
+ "id": "relay:old1",
+ "provider": "relay"
+ },
+ {
+ "name": "build-mini-01",
+ "os": "macos",
+ "status": "running",
+ "detail": "",
+ "lastUsedAt": 0,
+ "scene": "linux-terminal",
+ "id": "relay:team",
+ "provider": "relay"
+ },
+ {
+ "name": "Adas-MacBook-Pro-2.local",
+ "os": "macos",
+ "status": "suspended",
+ "detail": "",
+ "lastUsedAt": 0,
+ "scene": "linux-terminal",
+ "id": "relay:b695",
+ "provider": "relay",
+ "sdk": {
+ "features": [],
+ "spacesdVersion": "",
+ "reachable": false,
+ "error": "unauthenticated: Adas-MacBook-Pro-2.local stopped sharing: ask its owner to Resume sharing (or run `cua host start` there)"
+ }
+ }
+ ],
+ "devices": [
+ {
+ "id": "dev_byoc",
+ "name": "Cua BYOC tests",
+ "platform": "macos",
+ "lastSeen": 1799222400,
+ "state": "enrolled"
+ },
+ {
+ "id": "dev_old1",
+ "name": "mac-mini-staging",
+ "platform": "macos",
+ "lastSeen": 1796457600,
+ "state": "enrolled"
+ },
+ {
+ "id": "dev_lap",
+ "name": "Ana's laptop",
+ "platform": "windows",
+ "lastSeen": 1799999880,
+ "state": "enrolled"
+ }
+ ],
+ "hostnames": {},
+ "presence": {}
+ },
+ "relay": [
+ {
+ "id": "studio",
+ "role": "owner",
+ "providesSpaces": true
+ },
+ {
+ "id": "byoc",
+ "role": "owner",
+ "providesSpaces": true
+ },
+ {
+ "id": "old1",
+ "role": "owner",
+ "providesSpaces": false
+ },
+ {
+ "id": "team",
+ "role": "shared",
+ "team": "team-1",
+ "providesSpaces": true
+ },
+ {
+ "id": "b695",
+ "role": "owner",
+ "providesSpaces": false
+ }
+ ],
+ "host": {
+ "configured": true,
+ "mode": "relay",
+ "name": "Ada's MacBook Pro",
+ "sharing": true,
+ "serviceInstalled": true,
+ "serviceRunning": true,
+ "serviceKind": "launchd",
+ "shareDesktop": true,
+ "provideSpaces": false
+ },
+ "about": {
+ "computerName": "Ada's MacBook Pro",
+ "appVersion": "0.9.1",
+ "osVersion": "macOS 26.5.2"
+ },
+ "health": [
+ {
+ "id": "this-mac",
+ "cuaVersion": "0.4.1",
+ "checks": [
+ {
+ "id": "machine.local_network",
+ "status": "fail",
+ "message": "Cua can't reach this Mac's macOS VMs (space-cdf71481c4 at 192.168.64.4, No route to host): Local Network access is off for Cua Spaces",
+ "facts": {
+ "app": "Cua Spaces",
+ "app_path": "/Applications/Cua Spaces.app",
+ "settings_url": "x-apple.systempreferences:com.apple.preference.security?Privacy_LocalNetwork"
+ }
+ },
+ {
+ "id": "machine.disk",
+ "status": "warn",
+ "message": "only 21 GB free on Macintosh HD; a macOS Space needs about 30 GB",
+ "facts": {
+ "free_gb": "21",
+ "volume": "Macintosh HD",
+ "settings_url": "x-apple.systempreferences:com.apple.settings.Storage"
+ }
+ },
+ {
+ "id": "machine.virtualization",
+ "status": "pass",
+ "message": "ready: lume, container"
+ }
+ ]
+ },
+ {
+ "id": "studio",
+ "cuaVersion": "0.3.9",
+ "checks": [
+ {
+ "id": "machine.memory",
+ "status": "warn",
+ "message": "running Spaces use 28 of 32 GB of memory; another may not start",
+ "facts": {
+ "used_gb": "28",
+ "total_gb": "32"
+ }
+ },
+ {
+ "id": "machine.disk",
+ "status": "pass",
+ "message": "412 GB free on Macintosh HD",
+ "facts": {
+ "free_gb": "412"
+ }
+ }
+ ]
+ },
+ {
+ "id": "old1",
+ "cuaVersion": "0.4.1",
+ "checks": [
+ {
+ "id": "machine.disk",
+ "status": "fail",
+ "message": "only 3 GB free",
+ "facts": {
+ "free_gb": "3"
+ }
+ }
+ ]
+ }
+ ]
+ }
+ }
]
}
diff --git a/libs/cua/crates/cua-spaces-app-core/src/dispatch.rs b/libs/cua/crates/cua-spaces-app-core/src/dispatch.rs
index 69a578f169..cbb452920c 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/dispatch.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/dispatch.rs
@@ -232,6 +232,7 @@ pub const METHODS: &[&str] = &[
"devices.view",
"machines.merge",
"machines.pageRows",
+ "machines.view",
"devices.activityText",
"devices.labels",
"devices.platformName",
@@ -938,6 +939,10 @@ pub fn call_value(method: &str, args: Value) -> Result<Value, CoreError> {
&a.get::<Option<machines::MachinesPageInput>>("input")?
.unwrap_or_default(),
)),
+ "machines.view" => out(crate::machines_view::view(
+ &a.get::<Option<crate::machines_view::MachinesViewInput>>("input")?
+ .unwrap_or_default(),
+ )),
"devices.view" => out(devices::devices_view(
&a.get::<Option<devices::DevicesInput>>("input")?
.unwrap_or_default(),
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 6d155d7aa9..f8648145c0 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/lib.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/lib.rs
@@ -75,6 +75,8 @@ pub mod installer;
pub mod keyvault;
pub mod login_item;
pub mod machines;
+pub mod machines_health;
+pub mod machines_view;
pub mod message;
pub mod model;
pub mod notch;
diff --git a/libs/cua/crates/cua-spaces-app-core/src/machines_health.rs b/libs/cua/crates/cua-spaces-app-core/src/machines_health.rs
new file mode 100644
index 0000000000..e38ad57061
--- /dev/null
+++ b/libs/cua/crates/cua-spaces-app-core/src/machines_health.rs
@@ -0,0 +1,532 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+//! A machine's issues on the Machines page: what its own cua daemon found
+//! (`cua doctor --machine`'s checks, the SDK's `Spaces.machine_health`),
+//! plus what this app knows of This Mac's service, in one plain sentence
+//! each, with the fix where there is one.
+//!
+//! Only warnings and failures become issues; a healthy machine shows
+//! nothing. A machine that is offline shows none either: its last checks
+//! are not current, and the page already says it is offline.
+//!
+//! Shells fetch the health of the machines [`health_target`] names (This
+//! Mac through its daemon, another of your machines through its daemon over
+//! the relay or mesh), pass what came back in
+//! [`crate::machines_view::MachinesViewInput::health`], and draw the
+//! view's `issues` and `health`.
+
+use serde::{Deserialize, Serialize};
+
+use crate::host::{HostActionId, HostState};
+
+/// The page's section title.
+pub const ISSUES_TITLE: &str = "Issues";
+
+/// One check as the machine's daemon reported it (the SDK's
+/// `MachineHealthCheck`).
+#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MachinesViewCheck {
+ /// `machine.local_network`, `machine.disk`, ...
+ pub id: String,
+ /// `pass`, `warn`, `fail`, `skip`.
+ pub status: String,
+ /// What it found.
+ #[serde(default)]
+ pub message: String,
+ /// What to do.
+ #[serde(default)]
+ pub remediation: String,
+ /// `app`, `settings_url`, `free_gb`, ...
+ #[serde(default)]
+ pub facts: std::collections::HashMap<String, String>,
+}
+
+/// What the shell got for one machine's health.
+#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MachinesViewHealth {
+ /// The machine's row id (`this-mac`, a relay machine id).
+ pub id: String,
+ /// Its checks.
+ #[serde(default)]
+ pub checks: Vec<MachinesViewCheck>,
+ /// The Cua version of the daemon that checked.
+ #[serde(default)]
+ pub cua_version: String,
+ /// Why it could not be checked, when it could not.
+ #[serde(default)]
+ pub error: Option<String>,
+}
+
+/// What fixes an issue.
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MachinesViewIssueAction {
+ /// "Open Local Network settings", "Free disk space", "Restart service".
+ pub label: String,
+ /// A System Settings pane to open (`host.openSettings`).
+ #[serde(default)]
+ pub url: Option<String>,
+ /// A host action to run (`host.action`).
+ #[serde(default)]
+ pub host_action: Option<HostActionId>,
+}
+
+/// One issue on a machine's page.
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MachinesViewIssue {
+ /// The check it comes from (`machine.disk`, `service`, `version`).
+ pub id: String,
+ /// `warn` or `fail`.
+ pub level: String,
+ /// One plain sentence.
+ pub text: String,
+ /// Its fix, when there is one here.
+ #[serde(default)]
+ pub action: Option<MachinesViewIssueAction>,
+}
+
+/// What a shell passes to `Spaces.machine_health` for a row: `Some("")`
+/// for This Mac, `Some(id)` for another of your machines that is online
+/// and sharing, `None` when it can't be checked from here (offline, not
+/// yours, a device that is not a machine).
+pub fn health_target(
+ current: bool,
+ online: bool,
+ stopped_sharing: bool,
+ device_only: bool,
+ owner: bool,
+ id: &str,
+) -> Option<String> {
+ if current {
+ Some(String::new())
+ } else if online && !stopped_sharing && !device_only && owner {
+ Some(id.to_string())
+ } else {
+ None
+ }
+}
+
+/// What the issues are about.
+pub struct Subject<'a> {
+ /// This Mac.
+ pub current: bool,
+ /// Usable now (online and sharing); always for This Mac.
+ pub live: bool,
+ /// `macos`, `linux`, `windows`.
+ pub os: &'a str,
+ /// The Cua version This Mac's daemon reported, for the version check.
+ pub local_version: Option<&'a str>,
+}
+
+/// The issues for one machine (pure). `host` is This Mac's host state,
+/// read only for This Mac.
+pub fn issues(
+ subject: &Subject<'_>,
+ health: Option<&MachinesViewHealth>,
+ host: Option<&HostState>,
+) -> Vec<MachinesViewIssue> {
+ if !subject.current && !subject.live {
+ return vec![];
+ }
+ let mut out = vec![];
+ if subject.current
+ && let Some(h) = host
+ && h.configured
+ {
+ if h.service_installed && !h.service_running {
+ out.push(issue(
+ "service",
+ "fail",
+ "The Cua service isn\u{2019}t running, so your other devices can\u{2019}t reach \
+ this Mac."
+ .into(),
+ Some(MachinesViewIssueAction {
+ label: "Restart service".into(),
+ url: None,
+ host_action: Some(HostActionId::ResumeSharing),
+ }),
+ ));
+ } else if h.service_running && h.sharing && h.online == Some(false) {
+ out.push(issue(
+ "relay",
+ "warn",
+ "This Mac can\u{2019}t reach the Cua relay, so your other devices can\u{2019}t \
+ reach it. Check its internet connection."
+ .into(),
+ None,
+ ));
+ }
+ }
+ let Some(health) = health else {
+ return out;
+ };
+ if let Some(error) = health.error.as_deref().filter(|e| !e.trim().is_empty()) {
+ out.push(issue(
+ "unchecked",
+ "warn",
+ sentence(&format!("Couldn\u{2019}t check it: {}", trim_dot(error))),
+ None,
+ ));
+ return out;
+ }
+ let there = if subject.current {
+ String::new()
+ } else {
+ format!(" on {}", crate::machines_view::that_machine(subject.os))
+ };
+ for c in &health.checks {
+ let level = match c.status.as_str() {
+ "warn" => "warn",
+ "fail" => "fail",
+ _ => continue,
+ };
+ let fact = |k: &str| c.facts.get(k).map(String::as_str).unwrap_or("");
+ let settings = |label: &str| {
+ subject
+ .current
+ .then(|| fact("settings_url"))
+ .filter(|u| u.starts_with("x-apple.systempreferences:"))
+ .map(|u| MachinesViewIssueAction {
+ label: label.into(),
+ url: Some(u.into()),
+ host_action: None,
+ })
+ };
+ // This Mac's page already lists its permissions, each with its
+ // own button (the host panel): not twice.
+ if subject.current && c.id.starts_with("machine.permissions.") {
+ continue;
+ }
+ let (text, action) = match c.id.as_str() {
+ "machine.local_network" => {
+ let app = Some(fact("app"))
+ .filter(|a| !a.is_empty())
+ .unwrap_or("Cua Spaces");
+ (
+ if subject.current {
+ format!(
+ "Cua can\u{2019}t reach this Mac\u{2019}s macOS Spaces: Local Network \
+ access is off for {app}."
+ )
+ } else {
+ format!(
+ "Cua can\u{2019}t reach the macOS Spaces{there}: Local Network access \
+ is off for {app} there."
+ )
+ },
+ settings("Open Local Network settings"),
+ )
+ }
+ "machine.disk" => {
+ let free = fact("free_gb");
+ (
+ if level == "fail" {
+ format!("Only {free} GB free{there}, too little for a new Space.")
+ } else {
+ format!("Only {free} GB free{there}. A macOS Space needs about 30 GB.")
+ },
+ settings("Free disk space"),
+ )
+ }
+ "machine.memory" => (
+ format!(
+ "Running Spaces use {} of {} GB of memory{there}, so another may not start.",
+ fact("used_gb"),
+ fact("total_gb")
+ ),
+ None,
+ ),
+ id if id.starts_with("machine.permissions.") => {
+ let p = Some(fact("permission"))
+ .filter(|p| !p.is_empty())
+ .unwrap_or("a permission");
+ (
+ format!("Sharing the desktop{there} needs {p} for cua-driver."),
+ settings(&format!("Open {p} settings")),
+ )
+ }
+ _ => (sentence(&c.message), None),
+ };
+ out.push(issue(&c.id, level, text, action));
+ }
+ // Daemons a minor version or more apart (the relay and host calls
+ // change between them).
+ if !subject.current
+ && let (Some(local), theirs) = (subject.local_version, health.cua_version.as_str())
+ && let (Some(a), Some(b)) = (minor(local), minor(theirs))
+ && a != b
+ {
+ out.push(issue(
+ "version",
+ "warn",
+ if b < a {
+ format!(
+ "It runs Cua {theirs}, older than this Mac\u{2019}s {local}. Update Cua on it."
+ )
+ } else {
+ format!(
+ "It runs Cua {theirs}, newer than this Mac\u{2019}s {local}. Update Cua here."
+ )
+ },
+ None,
+ ));
+ }
+ out
+}
+
+/// `fail` when any issue fails, `warn` when any warns, else empty: the
+/// tint of the row's dot.
+pub fn health_level(issues: &[MachinesViewIssue]) -> String {
+ if issues.iter().any(|i| i.level == "fail") {
+ "fail".into()
+ } else if issues.is_empty() {
+ String::new()
+ } else {
+ "warn".into()
+ }
+}
+
+fn issue(
+ id: &str,
+ level: &str,
+ text: String,
+ action: Option<MachinesViewIssueAction>,
+) -> MachinesViewIssue {
+ MachinesViewIssue {
+ id: id.into(),
+ level: level.into(),
+ text,
+ action,
+ }
+}
+
+fn trim_dot(s: &str) -> &str {
+ s.trim().trim_end_matches('.')
+}
+
+/// Capitalized, one trailing period.
+fn sentence(s: &str) -> String {
+ let s = trim_dot(s);
+ let mut c = s.chars();
+ match c.next() {
+ Some(f) => format!("{}{}.", f.to_uppercase(), c.as_str()),
+ None => String::new(),
+ }
+}
+
+/// `(major, minor)` of a version like `0.4.1` or `v0.5.0-rc.1`.
+fn minor(v: &str) -> Option<(u64, u64)> {
+ let mut parts = v.trim().trim_start_matches('v').split(['.', '-', '+']);
+ Some((parts.next()?.parse().ok()?, parts.next()?.parse().ok()?))
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ fn check(id: &str, status: &str, facts: &[(&str, &str)]) -> MachinesViewCheck {
+ MachinesViewCheck {
+ id: id.into(),
+ status: status.into(),
+ message: format!("{id} message"),
+ remediation: String::new(),
+ facts: facts
+ .iter()
+ .map(|(k, v)| (k.to_string(), v.to_string()))
+ .collect(),
+ }
+ }
+
+ fn health(checks: Vec<MachinesViewCheck>, version: &str) -> MachinesViewHealth {
+ MachinesViewHealth {
+ id: "m".into(),
+ checks,
+ cua_version: version.into(),
+ error: None,
+ }
+ }
+
+ const THIS: Subject<'static> = Subject {
+ current: true,
+ live: true,
+ os: "macos",
+ local_version: Some("0.4.1"),
+ };
+ const OTHER: Subject<'static> = Subject {
+ current: false,
+ live: true,
+ os: "macos",
+ local_version: Some("0.4.1"),
+ };
+
+ #[test]
+ fn a_healthy_machine_has_no_issues() {
+ let h = health(
+ vec![
+ check("machine.disk", "pass", &[]),
+ check("machine.memory", "skip", &[]),
+ ],
+ "0.4.1",
+ );
+ assert!(issues(&THIS, Some(&h), None).is_empty());
+ assert!(issues(&OTHER, Some(&h), None).is_empty());
+ assert_eq!(health_level(&[]), "");
+ }
+
+ #[test]
+ fn local_network_on_this_mac_names_the_app_and_opens_settings() {
+ let url = "x-apple.systempreferences:com.apple.preference.security?Privacy_LocalNetwork";
+ let h = health(
+ vec![check(
+ "machine.local_network",
+ "fail",
+ &[("app", "Cua Spaces"), ("settings_url", url)],
+ )],
+ "0.4.1",
+ );
+ let i = issues(&THIS, Some(&h), None);
+ assert_eq!(i.len(), 1);
+ assert_eq!(
+ i[0].text,
+ "Cua can\u{2019}t reach this Mac\u{2019}s macOS Spaces: Local Network access is off for Cua Spaces."
+ );
+ let a = i[0].action.as_ref().unwrap();
+ assert_eq!(a.label, "Open Local Network settings");
+ assert_eq!(a.url.as_deref(), Some(url));
+ assert_eq!(health_level(&i), "fail");
+ // On another Mac: said there, with no button (its settings are there).
+ let i = issues(&OTHER, Some(&h), None);
+ assert!(i[0].text.contains("on that Mac"), "{}", i[0].text);
+ assert!(i[0].action.is_none());
+ }
+
+ #[test]
+ fn disk_memory_and_permissions_read_plainly() {
+ let h = health(
+ vec![
+ check(
+ "machine.disk",
+ "warn",
+ &[
+ ("free_gb", "21"),
+ (
+ "settings_url",
+ "x-apple.systempreferences:com.apple.settings.Storage",
+ ),
+ ],
+ ),
+ check(
+ "machine.memory",
+ "warn",
+ &[("used_gb", "12"), ("total_gb", "16")],
+ ),
+ check(
+ "machine.permissions.screen-recording",
+ "warn",
+ &[
+ ("permission", "Screen Recording"),
+ ("settings_url", "x-apple.systempreferences:x"),
+ ],
+ ),
+ ],
+ "0.4.1",
+ );
+ let i = issues(&THIS, Some(&h), None);
+ let texts: Vec<&str> = i.iter().map(|i| i.text.as_str()).collect();
+ // This Mac's permissions are listed on its page already.
+ assert_eq!(
+ texts,
+ [
+ "Only 21 GB free. A macOS Space needs about 30 GB.",
+ "Running Spaces use 12 of 16 GB of memory, so another may not start.",
+ ]
+ );
+ assert_eq!(i[0].action.as_ref().unwrap().label, "Free disk space");
+ assert!(i[1].action.is_none());
+ // Another Mac's: said there, without a button (its settings are there).
+ let i = issues(&OTHER, Some(&h), None);
+ assert_eq!(
+ i[2].text,
+ "Sharing the desktop on that Mac needs Screen Recording for cua-driver."
+ );
+ assert!(i[2].action.is_none());
+ assert_eq!(health_level(&i), "warn");
+ }
+
+ #[test]
+ fn an_offline_machine_shows_no_stale_issues() {
+ let h = health(
+ vec![check("machine.disk", "fail", &[("free_gb", "3")])],
+ "0.4.1",
+ );
+ let offline = Subject {
+ live: false,
+ ..OTHER
+ };
+ assert!(issues(&offline, Some(&h), None).is_empty());
+ }
+
+ #[test]
+ fn this_macs_stopped_service_offers_a_restart() {
+ let host = HostState {
+ configured: true,
+ service_installed: true,
+ service_running: false,
+ ..HostState::default()
+ };
+ let i = issues(&THIS, None, Some(&host));
+ assert_eq!(i[0].id, "service");
+ let a = i[0].action.as_ref().unwrap();
+ assert_eq!(
+ (a.label.as_str(), a.host_action),
+ ("Restart service", Some(HostActionId::ResumeSharing))
+ );
+ let host = HostState {
+ configured: true,
+ service_installed: true,
+ service_running: true,
+ sharing: true,
+ online: Some(false),
+ ..HostState::default()
+ };
+ assert_eq!(issues(&THIS, None, Some(&host))[0].id, "relay");
+ }
+
+ #[test]
+ fn version_skew_and_an_unchecked_machine_say_so() {
+ let i = issues(&OTHER, Some(&health(vec![], "0.3.9")), None);
+ assert_eq!(
+ i[0].text,
+ "It runs Cua 0.3.9, older than this Mac\u{2019}s 0.4.1. Update Cua on it."
+ );
+ assert!(issues(&OTHER, Some(&health(vec![], "0.4.7")), None).is_empty());
+ let h = MachinesViewHealth {
+ error: Some("Studio runs an older Cua that can't be checked; update Cua on it".into()),
+ ..MachinesViewHealth::default()
+ };
+ assert_eq!(
+ issues(&OTHER, Some(&h), None)[0].text,
+ "Couldn\u{2019}t check it: Studio runs an older Cua that can't be checked; update Cua on it."
+ );
+ }
+
+ #[test]
+ fn only_online_owned_machines_are_checked() {
+ assert_eq!(
+ health_target(true, false, false, false, false, "this-mac"),
+ Some(String::new())
+ );
+ assert_eq!(
+ health_target(false, true, false, false, true, "m1"),
+ Some("m1".into())
+ );
+ assert_eq!(health_target(false, false, false, false, true, "m1"), None);
+ assert_eq!(health_target(false, true, true, false, true, "m1"), None);
+ assert_eq!(health_target(false, true, false, true, true, "d1"), None);
+ assert_eq!(health_target(false, true, false, false, false, "t1"), None);
+ }
+}
diff --git a/libs/cua/crates/cua-spaces-app-core/src/machines_view.rs b/libs/cua/crates/cua-spaces-app-core/src/machines_view.rs
new file mode 100644
index 0000000000..5224f508af
--- /dev/null
+++ b/libs/cua/crates/cua-spaces-app-core/src/machines_view.rs
@@ -0,0 +1,1408 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+//! The Machines page as every UI draws it: the list in groups ("Your
+//! machines", a collapsed "Offline for 30+ days", "Team machines"), one
+//! muted line per row, and each machine's page (its name and rename, the
+//! Provide Spaces and Share this desktop switches, the Spaces on it as
+//! links, New Space here, Details, and Remove from account).
+//!
+//! The page is about the hardware. Opening, starting, stopping, teleporting
+//! to or dropping files on a Space belong to the Space, so a machine's
+//! Space rows only lead to the Space's own page.
+//!
+//! [`view`] reads the rows [`crate::machines::page_rows`] lists, what the
+//! relay says of each machine, This machine's host state and a few facts
+//! the shell knows about the computer it runs on. The SwiftUI app, the web
+//! UI in the Mac app and in Electron all draw this one view.
+
+use serde::{Deserialize, Serialize};
+
+use crate::host::{HostActionId, HostConfirm, HostState};
+use crate::machines::{self, MachinePageRow, MachinesPageInput};
+pub use crate::machines_health::{
+ ISSUES_TITLE, MachinesViewCheck, MachinesViewHealth, MachinesViewIssue, MachinesViewIssueAction,
+};
+use crate::model::{Space, SpaceOs, SpaceProvider, SpaceStatus};
+
+/// A machine offline for this long goes under "Offline for 30+ days".
+pub const OLD_AFTER_SECS: u64 = 30 * 24 * 60 * 60;
+
+/// What the relay says of one of the account's machines (the SDK's
+/// `RelayMachine`, the fields the page reads).
+#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MachinesViewRelay {
+ /// Machine id.
+ pub id: String,
+ /// `owner`, or `shared` for a machine someone shares with you.
+ #[serde(default)]
+ pub role: String,
+ /// The team you reach it through, for a team machine.
+ #[serde(default)]
+ pub team: Option<String>,
+ /// Its owner's email, when the relay says.
+ #[serde(default)]
+ pub owner_email: Option<String>,
+ /// It creates Spaces for your devices (`None`: it did not say).
+ #[serde(default)]
+ pub provides_spaces: Option<bool>,
+}
+
+/// What the shell knows about the computer it runs on.
+#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MachinesViewAbout {
+ /// Its name ("Ada's MacBook Pro").
+ #[serde(default)]
+ pub computer_name: String,
+ /// The app's version ("0.9.1").
+ #[serde(default)]
+ pub app_version: String,
+ /// Its system and version ("macOS 26.5.2").
+ #[serde(default)]
+ pub os_version: String,
+}
+
+/// What [`view`] reads.
+#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MachinesViewInput {
+ /// What the rows are listed from ([`machines::page_rows`]).
+ #[serde(default)]
+ pub page: MachinesPageInput,
+ /// The account's relay machines (none while signed out).
+ #[serde(default)]
+ pub relay: Vec<MachinesViewRelay>,
+ /// This machine's host state (`None` while it loads).
+ #[serde(default)]
+ pub host: Option<HostState>,
+ /// This computer.
+ #[serde(default)]
+ pub about: MachinesViewAbout,
+ /// The rows when the shell already listed them (an older host's rows,
+ /// merged by the web UI); `None`: [`machines::page_rows`] of `page`.
+ #[serde(default)]
+ pub rows: Option<Vec<MachinePageRow>>,
+ /// What each machine's daemon reported of its health, by row id, for
+ /// the machines whose `health_target` the shell checked
+ /// ([`crate::machines_health`]).
+ #[serde(default)]
+ pub health: Vec<MachinesViewHealth>,
+}
+
+/// One of the two switches on a machine's page.
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MachinesViewToggle {
+ /// `spaces` or `desktop`.
+ pub id: String,
+ /// "Provide Spaces", "Share this desktop".
+ pub label: String,
+ /// One line under it.
+ pub help: String,
+ /// On now.
+ pub on: bool,
+ /// Changed here (This machine); another machine's are read-only.
+ pub editable: bool,
+ /// Can be flipped now.
+ pub enabled: bool,
+ /// What flipping it runs, in order (the host's actions).
+ #[serde(default)]
+ pub actions: Vec<HostActionId>,
+ /// Before This machine is set up: flipping it opens the setup form
+ /// with this profile (`desktop` or `spare`).
+ #[serde(default)]
+ pub setup: Option<String>,
+}
+
+/// A Space on a machine: a link to the Space's own page.
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MachinesViewSpace {
+ /// The Space's id (its page).
+ pub id: String,
+ /// Its name.
+ pub name: String,
+ /// Its system ("Ubuntu 24.04.5 LTS", "macOS").
+ pub os: String,
+ /// Its status word ("Running", "Stopped").
+ pub status: String,
+ /// Running (the green dot).
+ pub running: bool,
+}
+
+/// New Space here: the wizard with this machine chosen.
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MachinesViewNewSpace {
+ /// "New Space here".
+ pub label: String,
+ /// The wizard's placement (`local`, `host:<id>`).
+ pub on: String,
+ /// Can be pressed now.
+ pub enabled: bool,
+ /// Why not, when it cannot.
+ #[serde(default)]
+ pub help: Option<String>,
+}
+
+/// Rename: what the new name is saved on.
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MachinesViewRename {
+ /// `host` (This machine's host setup), `machine` (another machine of
+ /// yours on the relay) or `device` (one of your devices).
+ pub target: String,
+ /// The id it is saved under (the relay machine's or the device's).
+ pub id: String,
+ /// The dialog's title.
+ pub title: String,
+ /// Its confirming button.
+ pub confirm_label: String,
+}
+
+/// Remove from account.
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MachinesViewRemove {
+ /// "Remove from account".
+ pub label: String,
+ /// Can be pressed now.
+ pub enabled: bool,
+ /// Why not, when it cannot.
+ #[serde(default)]
+ pub help: Option<String>,
+ /// This machine: its host setup is removed (the host's `remove`).
+ pub host: bool,
+ /// Another machine: it leaves the relay directory (`relay:<id>`).
+ #[serde(default)]
+ pub machine: Option<String>,
+ /// The device on it, revoked too.
+ #[serde(default)]
+ pub device: Option<String>,
+ /// Asked first.
+ pub confirm: HostConfirm,
+}
+
+/// A label and its value under Details.
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MachinesViewFact {
+ /// "OS", "App", "Connection", "Service".
+ pub label: String,
+ /// Its value.
+ pub value: String,
+}
+
+/// One machine: its list row and its page.
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MachinesViewMachine {
+ /// The row's id ([`MachinePageRow::id`]).
+ pub id: String,
+ /// Its name.
+ pub name: String,
+ /// "This Mac" on the machine this app runs on.
+ #[serde(default)]
+ pub badge: Option<String>,
+ /// The row's one muted line ("2 Spaces running", "Ready for Spaces",
+ /// "Offline · last seen 9 days ago").
+ pub line: String,
+ /// Usable now (the green dot): online and sharing.
+ pub online: bool,
+ /// The dot's tint for its issues: `warn`, `fail`, or empty.
+ #[serde(default)]
+ pub health: String,
+ /// What the shell passes to `Spaces.machine_health` to check it: empty
+ /// for This Mac, its id for another of your machines; `None` when it
+ /// can't be checked from here (offline, not yours).
+ #[serde(default)]
+ pub health_target: Option<String>,
+ /// `macos`, `linux`, `windows`, or empty.
+ pub os: String,
+ /// The machine this app runs on.
+ pub current: bool,
+ /// Someone shares it with you (a team machine).
+ pub team: bool,
+ /// The page's status line ("Online", "Offline · last seen 9 days ago").
+ pub status: String,
+ /// After the status: who shares it ("Shared by your team").
+ #[serde(default)]
+ pub shared_by: Option<String>,
+ /// Rename, when it can be renamed from here.
+ #[serde(default)]
+ pub rename: Option<MachinesViewRename>,
+ /// "Issues".
+ #[serde(default)]
+ pub issues_title: String,
+ /// What is wrong, one sentence each with its fix; empty when healthy
+ /// (the section is hidden then) or offline.
+ #[serde(default)]
+ pub issues: Vec<MachinesViewIssue>,
+ /// One line over the switches (offline, signed out).
+ #[serde(default)]
+ pub notice: Option<String>,
+ /// The notice's button (Sign In).
+ #[serde(default)]
+ pub notice_action: Option<crate::host::HostAction>,
+ /// Provide Spaces, then Share this desktop.
+ pub toggles: Vec<MachinesViewToggle>,
+ /// Under read-only switches: where they change.
+ #[serde(default)]
+ pub toggles_note: Option<String>,
+ /// "Spaces on this machine".
+ pub spaces_title: String,
+ /// The Spaces on it.
+ pub spaces: Vec<MachinesViewSpace>,
+ /// When it has none.
+ #[serde(default)]
+ pub spaces_empty: Option<String>,
+ /// New Space here.
+ pub new_space: MachinesViewNewSpace,
+ /// "Details" (collapsed).
+ pub details_title: String,
+ /// OS, App, Connection, Service.
+ pub details: Vec<MachinesViewFact>,
+ /// Remove from account (none for a team machine).
+ #[serde(default)]
+ pub remove: Option<MachinesViewRemove>,
+}
+
+/// "Remove old machines": every machine of the group that can go.
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MachinesViewRemoveAll {
+ /// "Remove old machines".
+ pub label: String,
+ /// Asked first.
+ pub confirm: HostConfirm,
+ /// What each removal does.
+ pub removes: Vec<MachinesViewRemove>,
+}
+
+/// A group of the list.
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MachinesViewGroup {
+ /// `yours`, `old` or `team`.
+ pub id: String,
+ /// "Your machines", "Offline for 30+ days (2)", "Team machines".
+ pub title: String,
+ /// Collapsed until opened (the old machines).
+ pub collapsed: bool,
+ /// Its machines' ids, in order.
+ pub ids: Vec<String>,
+ /// Remove old machines.
+ #[serde(default)]
+ pub remove_all: Option<MachinesViewRemoveAll>,
+}
+
+/// The Machines page.
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MachinesView {
+ /// "3 machines, 2 online".
+ pub summary: String,
+ /// The list's groups (only those with machines).
+ pub groups: Vec<MachinesViewGroup>,
+ /// Every machine, in list order.
+ pub machines: Vec<MachinesViewMachine>,
+}
+
+/// "Your machines".
+pub const YOURS_TITLE: &str = "Your machines";
+/// "Team machines".
+pub const TEAM_TITLE: &str = "Team machines";
+/// The button that removes a machine.
+pub const REMOVE_LABEL: &str = "Remove from account";
+/// The button that opens New Space with the machine chosen.
+pub const NEW_SPACE_LABEL: &str = "New Space here";
+/// Under another machine's switches.
+pub const OFFLINE_NOTICE: &str = "This machine is offline. Open Cua Spaces on it to use it.";
+
+/// "just now", "5 minutes ago", "1 day ago", "9 days ago".
+pub fn ago(then_secs: u64, now_secs: u64) -> String {
+ let s = now_secs.saturating_sub(then_secs);
+ let (n, unit) = match s {
+ 0..=59 => return "just now".into(),
+ 60..=3599 => (s / 60, "minute"),
+ 3600..=86_399 => (s / 3600, "hour"),
+ _ => (s / 86_400, "day"),
+ };
+ format!("{n} {unit}{} ago", if n == 1 { "" } else { "s" })
+}
+
+/// "1 Space", "3 Spaces".
+fn spaces_n(n: usize) -> String {
+ format!("{n} Space{}", if n == 1 { "" } else { "s" })
+}
+
+/// "that Mac", "that PC", "that computer".
+pub(crate) fn that_machine(os: &str) -> &'static str {
+ match os {
+ "macos" => "that Mac",
+ "windows" => "that PC",
+ _ => "that computer",
+ }
+}
+
+/// The Spaces on a machine: this machine's local Spaces, or the ones
+/// another machine provides. Never a machine's own desktop.
+fn spaces_on<'a>(spaces: &'a [Space], row: &MachinePageRow) -> Vec<&'a Space> {
+ if row.device_only {
+ return vec![];
+ }
+ spaces
+ .iter()
+ .filter(|s| {
+ if row.current {
+ s.provider == Some(SpaceProvider::Local) && s.id != crate::host::THIS_MACHINE_ID
+ } else {
+ s.host.as_deref() == Some(row.id.as_str())
+ }
+ })
+ .collect()
+}
+
+fn running(s: &Space) -> bool {
+ matches!(s.status, SpaceStatus::Running)
+}
+
+fn space_os(s: &Space) -> String {
+ s.os_pretty_name
+ .clone()
+ .filter(|n| !n.trim().is_empty())
+ .unwrap_or_else(|| match s.os {
+ SpaceOs::Unknown => String::new(),
+ os => os.label().into(),
+ })
+}
+
+fn os_label(os: &str) -> String {
+ SpaceOs::parse(os).map_or_else(String::new, |o| o.label().to_string())
+}
+
+/// The offline line: "Offline · last seen 9 days ago", or "Offline".
+fn offline_line(last_seen: Option<u64>, now: u64) -> String {
+ match last_seen {
+ Some(t) if t > 0 => format!("{} \u{b7} last seen {}", machines::OFFLINE, ago(t, now)),
+ _ => machines::OFFLINE.into(),
+ }
+}
+
+/// What a machine's switches show and do.
+struct Switches {
+ provide: bool,
+ share: bool,
+}
+
+/// This machine's switches, from its host state.
+fn host_toggles(s: Option<&HostState>) -> Vec<MachinesViewToggle> {
+ let provide_help = "Your devices can create Spaces here.";
+ let share_help = "Your devices can see and control this screen.";
+ let Some(s) = s.filter(|s| s.configured) else {
+ // Before setup: either switch opens the setup form.
+ let loading = s.is_none();
+ return vec![
+ MachinesViewToggle {
+ id: "spaces".into(),
+ label: "Provide Spaces".into(),
+ help: provide_help.into(),
+ on: false,
+ editable: true,
+ enabled: !loading,
+ actions: vec![],
+ setup: Some("spare".into()),
+ },
+ MachinesViewToggle {
+ id: "desktop".into(),
+ label: "Share this desktop".into(),
+ help: share_help.into(),
+ on: false,
+ editable: true,
+ enabled: !loading,
+ actions: vec![],
+ setup: Some("desktop".into()),
+ },
+ ];
+ };
+ let relay = s.mode.as_deref() != Some("direct");
+ // Stopped sharing reads as both switches off: the switches are the one
+ // control, so there is no separate "Not sharing" card to reconcile.
+ let live = s.sharing || s.paused_signed_out;
+ let provide_on = s.provide_spaces && live;
+ let share_on = s.share_desktop && live;
+ let flip = |on: bool,
+ setting: bool,
+ turn_on: HostActionId,
+ turn_off: HostActionId,
+ other_setting: bool,
+ other_off: HostActionId| {
+ if on {
+ return vec![turn_off];
+ }
+ let mut a = vec![];
+ if !setting {
+ a.push(turn_on);
+ }
+ if !s.sharing && !s.paused_signed_out {
+ // Resuming turns on every setting that is on: keep the other
+ // one off, as its switch shows it.
+ if other_setting {
+ a.push(other_off);
+ }
+ a.push(HostActionId::ResumeSharing);
+ }
+ a
+ };
+ let enabled = relay && !s.paused_signed_out;
+ let provide_help = if relay {
+ provide_help
+ } else {
+ "Needs the relay."
+ };
+ vec![
+ MachinesViewToggle {
+ id: "spaces".into(),
+ label: "Provide Spaces".into(),
+ help: provide_help.into(),
+ on: provide_on,
+ editable: true,
+ enabled,
+ actions: flip(
+ provide_on,
+ s.provide_spaces,
+ HostActionId::ProvideSpaces,
+ HostActionId::StopProvidingSpaces,
+ s.share_desktop,
+ HostActionId::HideDesktop,
+ ),
+ setup: None,
+ },
+ MachinesViewToggle {
+ id: "desktop".into(),
+ label: "Share this desktop".into(),
+ help: share_help.into(),
+ on: share_on,
+ editable: true,
+ enabled,
+ actions: flip(
+ share_on,
+ s.share_desktop,
+ HostActionId::ShareDesktop,
+ HostActionId::HideDesktop,
+ s.provide_spaces,
+ HostActionId::StopProvidingSpaces,
+ ),
+ setup: None,
+ },
+ ]
+}
+
+/// Another machine's switches: read-only, showing what it does.
+fn remote_toggles(sw: &Switches, team: bool) -> Vec<MachinesViewToggle> {
+ let t = |id: &str, label: &str, help: &str, on: bool| MachinesViewToggle {
+ id: id.into(),
+ label: label.into(),
+ help: help.into(),
+ on,
+ editable: false,
+ enabled: false,
+ actions: vec![],
+ setup: None,
+ };
+ let mut out = vec![t(
+ "spaces",
+ "Provide Spaces",
+ "Your devices can create Spaces here.",
+ sw.provide,
+ )];
+ if !team {
+ out.push(t(
+ "desktop",
+ "Share this desktop",
+ "Your devices can see and control this screen.",
+ sw.share,
+ ));
+ }
+ out
+}
+
+/// The confirmation before a machine leaves the account.
+fn remove_confirm(name: &str, current: bool, device_only: bool) -> HostConfirm {
+ let message = if current {
+ "Everyone connected is disconnected, the host service is uninstalled and \
+ this machine leaves your machines. Turning a switch on again sets it up again."
+ .to_string()
+ } else if device_only {
+ format!("{name} will no longer list or reach your machines. Sign in on it again to use it.")
+ } else {
+ format!(
+ "{name} leaves your machines, and its Spaces are no longer listed here. \
+ Setting it up again on it adds it back."
+ )
+ };
+ HostConfirm {
+ title: format!("Remove \u{201c}{name}\u{201d} from your account?"),
+ message,
+ confirm_label: "Remove".into(),
+ cancel_label: "Cancel".into(),
+ }
+}
+
+/// The Machines page.
+pub fn view(input: &MachinesViewInput) -> MachinesView {
+ let rows = input
+ .rows
+ .clone()
+ .unwrap_or_else(|| machines::page_rows(&input.page));
+ let now = input.page.now;
+ let spaces = &input.page.spaces;
+ let host = input.host.as_ref();
+ let mut list = Vec::with_capacity(rows.len());
+ let mut yours = vec![];
+ let mut old = vec![];
+ let mut team_ids = vec![];
+ let mut old_removes = vec![];
+ let local_version = rows
+ .iter()
+ .find(|r| r.current)
+ .and_then(|r| input.health.iter().find(|h| h.id == r.id))
+ .map(|h| h.cua_version.as_str())
+ .filter(|v| !v.is_empty());
+ for row in &rows {
+ let relay = input.relay.iter().find(|r| r.id == row.id);
+ let team = !row.current && relay.is_some_and(|r| !r.role.is_empty() && r.role != "owner");
+ let on = spaces_on(spaces, row);
+ let n_running = on.iter().filter(|s| running(s)).count();
+ let own_space = row
+ .space_id
+ .as_deref()
+ .and_then(|id| spaces.iter().find(|s| s.id == id));
+ let sw = if row.current {
+ // As its switches show them: stopped sharing is both off.
+ let live = |s: &HostState| s.configured && (s.sharing || s.paused_signed_out);
+ Switches {
+ provide: host.is_some_and(|s| live(s) && s.provide_spaces),
+ share: host.is_some_and(|s| live(s) && s.share_desktop),
+ }
+ } else {
+ Switches {
+ provide: !row.device_only
+ && relay
+ .and_then(|r| r.provides_spaces)
+ .unwrap_or(!on.is_empty()),
+ share: own_space
+ .is_some_and(|s| crate::spaces::sidebar::shares_desktop(s) != Some(false)),
+ }
+ };
+ let live = row.online && !row.stopped_sharing;
+ let name = if row.current {
+ host.and_then(|s| s.name.clone())
+ .filter(|n| s_nonempty(n))
+ .or_else(|| Some(input.about.computer_name.clone()).filter(|n| s_nonempty(n)))
+ .unwrap_or_else(|| row.name.clone())
+ } else {
+ row.name.clone()
+ };
+
+ // The row's one line.
+ let line = if !row.online {
+ offline_line(row.last_seen, now)
+ } else if row.stopped_sharing {
+ format!("{} \u{b7} {}", machines::NOT_SHARING, row.spaces_label)
+ } else if row.device_only {
+ machines::ONLINE.into()
+ } else {
+ let mut parts = vec![];
+ if n_running > 0 {
+ parts.push(format!("{} running", spaces_n(n_running)));
+ } else if !on.is_empty() {
+ parts.push(spaces_n(on.len()));
+ }
+ if sw.provide {
+ if parts.is_empty() {
+ parts.push("Ready for Spaces".into());
+ } else {
+ parts.push("Provides Spaces".into());
+ }
+ }
+ if parts.is_empty() {
+ parts.push(machines::spaces_label(0));
+ }
+ parts.join(" \u{b7} ")
+ };
+
+ let status = if !row.online {
+ offline_line(row.last_seen, now)
+ } else if row.stopped_sharing {
+ machines::NOT_SHARING.into()
+ } else {
+ machines::ONLINE.into()
+ };
+ let shared_by = team.then(|| {
+ let r = relay.expect("a team machine has a relay row");
+ if r.team.as_deref().is_some_and(s_nonempty) {
+ "Shared by your team".to_string()
+ } else {
+ match r.owner_email.as_deref().filter(|e| s_nonempty(e)) {
+ Some(e) => format!("Shared by {e}"),
+ None => "Shared with you".into(),
+ }
+ }
+ });
+
+ let rename = if row.current {
+ host.filter(|s| {
+ s.configured && s.mode.as_deref() != Some("direct") && !s.paused_signed_out
+ })
+ .map(|_| ("host", row.id.clone()))
+ } else if row.device_only {
+ row.device.clone().map(|d| ("device", d))
+ } else if relay.is_some_and(|r| r.role == "owner") {
+ Some(("machine", row.id.clone()))
+ } else {
+ None
+ }
+ .map(|(target, id)| MachinesViewRename {
+ target: target.into(),
+ id,
+ title: "Rename Machine".into(),
+ confirm_label: "Rename".into(),
+ });
+
+ let (notice, notice_action) = if row.current {
+ let p = crate::host::panel(host);
+ (p.notice, p.notice_action)
+ } else if !row.online {
+ (Some(OFFLINE_NOTICE.into()), None)
+ } else if row.stopped_sharing {
+ (
+ Some(format!(
+ "Sharing is off on {}. Turn it on there to use it.",
+ that_machine(&row.os)
+ )),
+ None,
+ )
+ } else {
+ (None, None)
+ };
+
+ let toggles = if row.current {
+ host_toggles(host)
+ } else {
+ remote_toggles(&sw, team)
+ };
+ let toggles_note = if row.current {
+ None
+ } else if team {
+ Some(format!(
+ "Its owner changes this on {}.",
+ that_machine(&row.os)
+ ))
+ } else if live {
+ Some(format!("Change this on {}.", that_machine(&row.os)))
+ } else {
+ None
+ };
+
+ let new_space = MachinesViewNewSpace {
+ label: NEW_SPACE_LABEL.into(),
+ on: if row.current {
+ "local".into()
+ } else {
+ format!("host:{}", row.id)
+ },
+ enabled: row.current || (live && sw.provide),
+ help: if row.current {
+ None
+ } else if !row.online {
+ Some("It\u{2019}s offline.".into())
+ } else if row.stopped_sharing {
+ Some("It isn\u{2019}t sharing.".into())
+ } else if !sw.provide {
+ Some(format!(
+ "It doesn\u{2019}t provide Spaces. Turn on Provide Spaces on {}.",
+ that_machine(&row.os)
+ ))
+ } else {
+ None
+ },
+ };
+
+ let mut details = vec![];
+ let mut fact = |label: &str, value: String| {
+ if !value.trim().is_empty() {
+ details.push(MachinesViewFact {
+ label: label.into(),
+ value,
+ });
+ }
+ };
+ if row.current {
+ fact(
+ "OS",
+ if s_nonempty(&input.about.os_version) {
+ input.about.os_version.clone()
+ } else {
+ os_label(&row.os)
+ },
+ );
+ fact("App", input.about.app_version.clone());
+ match host {
+ Some(s) if s.configured => {
+ fact(
+ "Connection",
+ if s.mode.as_deref() == Some("direct") {
+ "Direct".into()
+ } else {
+ "via Cua relay".into()
+ },
+ );
+ fact(
+ "Service",
+ if s.service_running {
+ "Running"
+ } else if s.service_installed {
+ "Stopped"
+ } else {
+ "Not installed"
+ }
+ .into(),
+ );
+ }
+ Some(_) => fact("Connection", "Not shared".into()),
+ None => {}
+ }
+ } else {
+ fact(
+ "OS",
+ own_space
+ .and_then(|s| s.os_pretty_name.clone())
+ .filter(|n| s_nonempty(n))
+ .unwrap_or_else(|| os_label(&row.os)),
+ );
+ if !row.device_only {
+ fact(
+ "Connection",
+ if row.via == "direct" {
+ "Direct".into()
+ } else {
+ "via Cua relay".into()
+ },
+ );
+ fact(
+ "Service",
+ if !row.online {
+ "Not reachable"
+ } else if row.stopped_sharing {
+ machines::NOT_SHARING
+ } else {
+ "Running"
+ }
+ .into(),
+ );
+ }
+ }
+
+ let remove = if team {
+ None
+ } else if row.current {
+ host.filter(|s| s.configured).map(|_| MachinesViewRemove {
+ label: REMOVE_LABEL.into(),
+ enabled: true,
+ help: None,
+ host: true,
+ machine: None,
+ device: None,
+ confirm: remove_confirm(&name, true, false),
+ })
+ } else if row.device_only {
+ Some(MachinesViewRemove {
+ label: REMOVE_LABEL.into(),
+ enabled: true,
+ help: None,
+ host: false,
+ machine: None,
+ device: row.device.clone(),
+ confirm: remove_confirm(&name, false, true),
+ })
+ } else {
+ // The relay takes a machine off only while it is not
+ // connected: one that is online would register again.
+ Some(MachinesViewRemove {
+ label: REMOVE_LABEL.into(),
+ enabled: !row.online,
+ help: row.online.then(|| {
+ format!(
+ "It\u{2019}s online. Remove it on {}, or here once it\u{2019}s offline.",
+ that_machine(&row.os)
+ )
+ }),
+ host: false,
+ machine: Some(row.id.clone()),
+ device: row.device.clone(),
+ confirm: remove_confirm(&name, false, false),
+ })
+ };
+
+ let is_old = !row.current
+ && !team
+ && !row.online
+ && row
+ .last_seen
+ .is_some_and(|t| t > 0 && now.saturating_sub(t) >= OLD_AFTER_SECS);
+ if team {
+ team_ids.push(row.id.clone());
+ } else if is_old {
+ old.push(row.id.clone());
+ if let Some(r) = remove.clone().filter(|r| r.enabled) {
+ old_removes.push(r);
+ }
+ } else {
+ yours.push(row.id.clone());
+ }
+
+ // "This Mac" beside its own name; not twice when that is its name.
+ let badge = row
+ .current
+ .then(|| input.page.host_os.this_machine().to_string())
+ .filter(|b| *b != name);
+ let issues = crate::machines_health::issues(
+ &crate::machines_health::Subject {
+ current: row.current,
+ live: row.current || live,
+ os: &row.os,
+ local_version,
+ },
+ input.health.iter().find(|h| h.id == row.id),
+ host.filter(|_| row.current),
+ );
+ list.push(MachinesViewMachine {
+ id: row.id.clone(),
+ name,
+ badge,
+ line,
+ online: live,
+ health: crate::machines_health::health_level(&issues),
+ health_target: crate::machines_health::health_target(
+ row.current,
+ row.online,
+ row.stopped_sharing,
+ row.device_only,
+ relay.is_some_and(|r| r.role == "owner" || r.role.is_empty()),
+ &row.id,
+ ),
+ issues_title: ISSUES_TITLE.into(),
+ issues,
+ os: row.os.clone(),
+ current: row.current,
+ team,
+ status,
+ shared_by,
+ rename,
+ notice,
+ notice_action,
+ toggles,
+ toggles_note,
+ spaces_title: "Spaces on this machine".into(),
+ spaces_empty: on.is_empty().then(|| {
+ if row.online {
+ "No Spaces yet.".into()
+ } else {
+ "No Spaces. The machine is offline.".into()
+ }
+ }),
+ spaces: on
+ .iter()
+ .map(|s| MachinesViewSpace {
+ id: s.id.clone(),
+ name: s.name.clone(),
+ os: space_os(s),
+ status: crate::spaces::sidebar::status_text(s),
+ running: running(s),
+ })
+ .collect(),
+ new_space,
+ details_title: "Details".into(),
+ details,
+ remove,
+ });
+ }
+
+ let mut groups = vec![];
+ if !yours.is_empty() {
+ groups.push(MachinesViewGroup {
+ id: "yours".into(),
+ title: YOURS_TITLE.into(),
+ collapsed: false,
+ ids: yours,
+ remove_all: None,
+ });
+ }
+ if !old.is_empty() {
+ let n = old_removes.len();
+ groups.push(MachinesViewGroup {
+ id: "old".into(),
+ title: format!("Offline for 30+ days ({})", old.len()),
+ collapsed: true,
+ ids: old,
+ remove_all: (n > 0).then(|| MachinesViewRemoveAll {
+ label: "Remove old machines".into(),
+ confirm: HostConfirm {
+ title: if n == 1 {
+ "Remove 1 old machine?".into()
+ } else {
+ format!("Remove {n} old machines?")
+ },
+ message: "They have been offline for 30 days or more. They leave your \
+ account; setting one up again adds it back."
+ .into(),
+ confirm_label: "Remove".into(),
+ cancel_label: "Cancel".into(),
+ },
+ removes: old_removes,
+ }),
+ });
+ }
+ if !team_ids.is_empty() {
+ groups.push(MachinesViewGroup {
+ id: "team".into(),
+ title: TEAM_TITLE.into(),
+ collapsed: false,
+ ids: team_ids,
+ remove_all: None,
+ });
+ }
+ // List order follows the groups.
+ let order: Vec<&String> = groups.iter().flat_map(|g| g.ids.iter()).collect();
+ list.sort_by_key(|m| {
+ order
+ .iter()
+ .position(|id| **id == m.id)
+ .unwrap_or(usize::MAX)
+ });
+ let total = list.len();
+ let online = list.iter().filter(|m| m.online).count();
+ MachinesView {
+ summary: format!(
+ "{total} machine{}, {online} online",
+ if total == 1 { "" } else { "s" }
+ ),
+ groups,
+ machines: list,
+ }
+}
+
+fn s_nonempty(s: &str) -> bool {
+ !s.trim().is_empty()
+}
+
+/// A new name as saved: trimmed, at most 64 characters (the relay's
+/// limit); `None` when nothing is left.
+pub fn clean_name(name: &str) -> Option<String> {
+ crate::devices::clean_name(name)
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use crate::machines::DeviceIn;
+
+ const NOW: u64 = 1_800_000_000;
+ const DAY: u64 = 86_400;
+
+ fn space(v: serde_json::Value) -> Space {
+ let mut base = serde_json::json!({
+ "name": "", "os": "linux", "status": "running", "detail": "",
+ "lastUsedAt": 0, "scene": "linux-terminal"
+ });
+ for (k, val) in v.as_object().unwrap() {
+ base[k] = val.clone();
+ }
+ serde_json::from_value(base).unwrap()
+ }
+
+ fn host(provide: bool, share: bool) -> HostState {
+ HostState {
+ configured: true,
+ mode: Some("relay".into()),
+ name: Some("Ada's MacBook Pro".into()),
+ sharing: true,
+ service_installed: true,
+ service_running: true,
+ service_kind: "launchd".into(),
+ share_desktop: share,
+ provide_spaces: provide,
+ ..Default::default()
+ }
+ }
+
+ fn device(id: &str, name: &str, seen: u64) -> DeviceIn {
+ DeviceIn {
+ id: id.into(),
+ name: name.into(),
+ platform: "macos".into(),
+ last_seen: Some(seen),
+ state: "enrolled".into(),
+ ..Default::default()
+ }
+ }
+
+ fn relay(id: &str, role: &str, provides: Option<bool>) -> MachinesViewRelay {
+ MachinesViewRelay {
+ id: id.into(),
+ role: role.into(),
+ provides_spaces: provides,
+ ..Default::default()
+ }
+ }
+
+ /// The approved mockup: This Mac with two Spaces, a Mac Studio that
+ /// provides one, an offline Mac, two machines offline for weeks and a
+ /// team machine.
+ fn mockup() -> MachinesViewInput {
+ MachinesViewInput {
+ health: vec![],
+ page: MachinesPageInput {
+ spaces: vec![
+ space(
+ serde_json::json!({"id": "this-mac", "name": "This Mac", "os": "macos", "status": "local"}),
+ ),
+ space(
+ serde_json::json!({"id": "local:space-cdf71481c4", "name": "space-cdf71481c4", "os": "macos", "osPrettyName": "macOS 26.5.2", "provider": "local"}),
+ ),
+ space(
+ serde_json::json!({"id": "local:space-1cef393ac1", "name": "space-1cef393ac1", "provider": "local"}),
+ ),
+ space(serde_json::json!({
+ "id": "relay:studio", "name": "cua's Mac Studio", "os": "macos",
+ "osPrettyName": "macOS 26.5.2", "status": "running", "provider": "relay"
+ })),
+ space(serde_json::json!({
+ "id": "relay:studio/xm", "name": "xm-before-linux", "osPrettyName": "Ubuntu 24.04.5 LTS",
+ "provider": "relay", "host": "studio", "hostName": "cua's Mac Studio"
+ })),
+ space(
+ serde_json::json!({"id": "relay:byoc", "name": "Cua BYOC tests", "os": "macos", "status": "suspended", "provider": "relay"}),
+ ),
+ space(
+ serde_json::json!({"id": "relay:old1", "name": "mac-mini-staging", "os": "macos", "status": "suspended", "provider": "relay"}),
+ ),
+ space(
+ serde_json::json!({"id": "relay:team", "name": "build-mini-01", "os": "macos", "status": "running", "provider": "relay"}),
+ ),
+ ],
+ devices: vec![
+ device("dev_byoc", "Cua BYOC tests", NOW - 9 * DAY),
+ device("dev_old1", "mac-mini-staging", NOW - 41 * DAY),
+ ],
+ now: NOW,
+ ..Default::default()
+ },
+ relay: vec![
+ relay("studio", "owner", Some(true)),
+ relay("byoc", "owner", Some(true)),
+ relay("old1", "owner", Some(false)),
+ MachinesViewRelay {
+ team: Some("team-1".into()),
+ ..relay("team", "shared", Some(true))
+ },
+ ],
+ host: Some(host(false, true)),
+ about: MachinesViewAbout {
+ computer_name: "Ada's MacBook Pro".into(),
+ app_version: "0.9.1".into(),
+ os_version: "macOS 26.5.2".into(),
+ },
+ rows: None,
+ }
+ }
+
+ /// Rows an older host listed (merged by the web UI) draw the same page.
+ #[test]
+ fn rows_the_shell_listed_draw_the_same_page() {
+ let input = mockup();
+ let rows = machines::page_rows(&input.page);
+ let given = view(&MachinesViewInput {
+ health: vec![],
+ rows: Some(rows),
+ ..input.clone()
+ });
+ assert_eq!(given, view(&input));
+ }
+
+ fn by_id<'a>(v: &'a MachinesView, id: &str) -> &'a MachinesViewMachine {
+ v.machines.iter().find(|m| m.id == id).unwrap()
+ }
+
+ #[test]
+ fn the_list_groups_machines_with_one_line_each() {
+ let v = view(&mockup());
+ let groups: Vec<(&str, &str, bool, Vec<&str>)> = v
+ .groups
+ .iter()
+ .map(|g| {
+ (
+ g.id.as_str(),
+ g.title.as_str(),
+ g.collapsed,
+ g.ids.iter().map(String::as_str).collect(),
+ )
+ })
+ .collect();
+ assert_eq!(
+ groups,
+ [
+ (
+ "yours",
+ "Your machines",
+ false,
+ vec!["this-mac", "studio", "byoc"]
+ ),
+ ("old", "Offline for 30+ days (1)", true, vec!["old1"]),
+ ("team", "Team machines", false, vec!["team"]),
+ ]
+ );
+ let lines: Vec<(&str, &str, Option<&str>)> = v
+ .machines
+ .iter()
+ .map(|m| (m.name.as_str(), m.line.as_str(), m.badge.as_deref()))
+ .collect();
+ assert_eq!(
+ lines,
+ [
+ ("Ada's MacBook Pro", "2 Spaces running", Some("This Mac")),
+ (
+ "cua's Mac Studio",
+ "1 Space running \u{b7} Provides Spaces",
+ None
+ ),
+ (
+ "Cua BYOC tests",
+ "Offline \u{b7} last seen 9 days ago",
+ None
+ ),
+ (
+ "mac-mini-staging",
+ "Offline \u{b7} last seen 41 days ago",
+ None
+ ),
+ ("build-mini-01", "Ready for Spaces", None),
+ ]
+ );
+ assert_eq!(v.summary, "5 machines, 3 online");
+ let all = v.groups[1].remove_all.as_ref().unwrap();
+ assert_eq!(all.label, "Remove old machines");
+ assert_eq!(all.removes[0].machine.as_deref(), Some("old1"));
+ assert_eq!(all.removes[0].device.as_deref(), Some("dev_old1"));
+ }
+
+ #[test]
+ fn only_this_machine_s_switches_change_here() {
+ let v = view(&mockup());
+ let me = by_id(&v, "this-mac");
+ let t: Vec<(&str, bool, bool)> = me
+ .toggles
+ .iter()
+ .map(|t| (t.label.as_str(), t.on, t.editable && t.enabled))
+ .collect();
+ assert_eq!(
+ t,
+ [
+ ("Provide Spaces", false, true),
+ ("Share this desktop", true, true)
+ ]
+ );
+ assert_eq!(me.toggles[0].actions, [HostActionId::ProvideSpaces]);
+ assert_eq!(me.toggles[1].actions, [HostActionId::HideDesktop]);
+ assert_eq!(me.toggles_note, None);
+
+ let studio = by_id(&v, "studio");
+ assert!(studio.toggles.iter().all(|t| !t.editable && !t.enabled));
+ assert_eq!(
+ studio.toggles.iter().map(|t| t.on).collect::<Vec<_>>(),
+ [true, true]
+ );
+ assert_eq!(
+ studio.toggles_note.as_deref(),
+ Some("Change this on that Mac.")
+ );
+
+ let team = by_id(&v, "team");
+ assert_eq!(team.toggles.len(), 1);
+ assert_eq!(
+ team.toggles_note.as_deref(),
+ Some("Its owner changes this on that Mac.")
+ );
+ assert_eq!(team.shared_by.as_deref(), Some("Shared by your team"));
+ assert!(team.remove.is_none() && team.rename.is_none());
+
+ let byoc = by_id(&v, "byoc");
+ assert_eq!(byoc.notice.as_deref(), Some(OFFLINE_NOTICE));
+ assert_eq!(byoc.toggles_note, None);
+ assert_eq!(byoc.status, "Offline \u{b7} last seen 9 days ago");
+ }
+
+ #[test]
+ fn stopped_sharing_reads_as_switches_off_and_turning_one_on_resumes() {
+ let mut input = mockup();
+ input.host = Some(HostState {
+ sharing: false,
+ ..host(true, true)
+ });
+ let v = view(&input);
+ let me = by_id(&v, "this-mac");
+ assert!(me.toggles.iter().all(|t| !t.on && t.enabled));
+ // Turning Provide Spaces on resumes sharing, keeping the desktop off
+ // as its switch shows.
+ assert_eq!(
+ me.toggles[0].actions,
+ [HostActionId::HideDesktop, HostActionId::ResumeSharing]
+ );
+ // No "Not sharing" card: the switches are the one control.
+ assert_eq!(me.notice, None);
+ }
+
+ #[test]
+ fn before_setup_a_switch_opens_the_setup_form() {
+ let mut input = mockup();
+ input.host = Some(HostState::default());
+ let v = view(&input);
+ let me = by_id(&v, "this-mac");
+ assert_eq!(
+ me.toggles
+ .iter()
+ .map(|t| t.setup.as_deref())
+ .collect::<Vec<_>>(),
+ [Some("spare"), Some("desktop")]
+ );
+ assert!(me.remove.is_none() && me.rename.is_none());
+ assert_eq!(me.name, "Ada's MacBook Pro");
+ }
+
+ #[test]
+ fn space_rows_link_to_the_space_and_new_space_here_chooses_the_machine() {
+ let v = view(&mockup());
+ let me = by_id(&v, "this-mac");
+ assert_eq!(
+ me.spaces
+ .iter()
+ .map(|s| (s.id.as_str(), s.os.as_str(), s.status.as_str()))
+ .collect::<Vec<_>>(),
+ [
+ ("local:space-cdf71481c4", "macOS 26.5.2", "Running"),
+ ("local:space-1cef393ac1", "Linux", "Running"),
+ ]
+ );
+ assert_eq!(me.new_space.on, "local");
+ assert!(me.new_space.enabled);
+ let studio = by_id(&v, "studio");
+ assert_eq!(studio.spaces[0].id, "relay:studio/xm");
+ assert_eq!(studio.spaces[0].os, "Ubuntu 24.04.5 LTS");
+ assert_eq!(studio.new_space.on, "host:studio");
+ assert!(studio.new_space.enabled);
+ let byoc = by_id(&v, "byoc");
+ assert!(!byoc.new_space.enabled);
+ assert_eq!(
+ byoc.spaces_empty.as_deref(),
+ Some("No Spaces. The machine is offline.")
+ );
+ assert!(by_id(&v, "team").new_space.enabled);
+ }
+
+ #[test]
+ fn details_and_remove_from_account() {
+ let v = view(&mockup());
+ let facts = |id: &str| -> Vec<(String, String)> {
+ by_id(&v, id)
+ .details
+ .iter()
+ .map(|f| (f.label.clone(), f.value.clone()))
+ .collect()
+ };
+ let pair = |a: &str, b: &str| (a.to_string(), b.to_string());
+ assert_eq!(
+ facts("this-mac"),
+ [
+ pair("OS", "macOS 26.5.2"),
+ pair("App", "0.9.1"),
+ pair("Connection", "via Cua relay"),
+ pair("Service", "Running"),
+ ]
+ );
+ assert_eq!(
+ facts("byoc"),
+ [
+ pair("OS", "macOS"),
+ pair("Connection", "via Cua relay"),
+ pair("Service", "Not reachable"),
+ ]
+ );
+ let me = by_id(&v, "this-mac").remove.clone().unwrap();
+ assert!(me.host && me.enabled);
+ assert_eq!(me.label, "Remove from account");
+ assert_eq!(
+ me.confirm.title,
+ "Remove \u{201c}Ada's MacBook Pro\u{201d} from your account?"
+ );
+ // Another machine leaves the relay while it is offline; online, it
+ // says where to remove it.
+ let byoc = by_id(&v, "byoc").remove.clone().unwrap();
+ assert!(byoc.enabled && !byoc.host);
+ assert_eq!(byoc.machine.as_deref(), Some("byoc"));
+ assert_eq!(byoc.device.as_deref(), Some("dev_byoc"));
+ let studio = by_id(&v, "studio").remove.clone().unwrap();
+ assert!(!studio.enabled);
+ assert!(studio.help.unwrap().contains("that Mac"));
+ // Rename saves on the host, the relay machine or the device.
+ assert_eq!(
+ by_id(&v, "this-mac")
+ .rename
+ .as_ref()
+ .map(|r| r.target.as_str()),
+ Some("host")
+ );
+ assert_eq!(
+ by_id(&v, "studio")
+ .rename
+ .as_ref()
+ .map(|r| r.target.as_str()),
+ Some("machine")
+ );
+ }
+
+ /// CUA-1617's machine: online, its owner stopped sharing it.
+ #[test]
+ fn a_machine_that_stopped_sharing_reads_not_sharing_no_spaces() {
+ let input = MachinesViewInput {
+ health: vec![],
+ page: MachinesPageInput {
+ spaces: vec![space(serde_json::json!({
+ "id": "relay:b695", "name": "Adas-MacBook-Pro-2.local", "os": "macos",
+ "status": "suspended", "provider": "relay",
+ "sdk": {"features": [], "spacesdVersion": "", "reachable": false,
+ "error": "unauthenticated: Adas-MacBook-Pro-2.local stopped sharing: ask its owner"}
+ }))],
+ now: NOW,
+ ..Default::default()
+ },
+ ..Default::default()
+ };
+ let v = view(&input);
+ let m = by_id(&v, "b695");
+ assert_eq!(m.line, "Not sharing \u{b7} No Spaces");
+ assert_eq!(m.status, "Not sharing");
+ assert!(!m.online);
+ assert!(!m.new_space.enabled);
+ }
+
+ #[test]
+ fn ago_reads_plainly() {
+ assert_eq!(ago(NOW - 30, NOW), "just now");
+ assert_eq!(ago(NOW - 60, NOW), "1 minute ago");
+ assert_eq!(ago(NOW - 2 * 3600, NOW), "2 hours ago");
+ assert_eq!(ago(NOW - DAY, NOW), "1 day ago");
+ }
+}
diff --git a/libs/cua/crates/cua-spaces-app-core/src/parity.rs b/libs/cua/crates/cua-spaces-app-core/src/parity.rs
index 9cb982fb67..460763de40 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/parity.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/parity.rs
@@ -3005,9 +3005,172 @@ fn run_machines(f: &Value, h: &dyn Host) -> Result<Value, String> {
let rows = c(h, "machines.pageRows", json!({ "input": page["input"] }))?;
frames.push(json!({ "page": page["name"], "rows": page_lines(&rows) }));
}
+ for v in f["views"].as_array().into_iter().flatten() {
+ let view = c(h, "machines.view", json!({ "input": v["input"] }))?;
+ frames.push(view_frame(&v["name"], &view));
+ }
Ok(json!({ "flow": "machines", "frames": frames }))
}
+/// The Machines page as drawn (`machines.view`): the header, each group
+/// with its rows' one line, and each machine's page in words (status,
+/// switches, Spaces, New Space here, Details, Remove from account).
+fn view_frame(name: &Value, v: &Value) -> Value {
+ let machines = v["machines"].as_array().cloned().unwrap_or_default();
+ let by_id = |id: &str| machines.iter().find(|m| str_of(&m["id"]) == id);
+ let groups: Vec<Value> = v["groups"]
+ .as_array()
+ .into_iter()
+ .flatten()
+ .map(|g| {
+ let rows: Vec<String> = g["ids"]
+ .as_array()
+ .into_iter()
+ .flatten()
+ .filter_map(|id| by_id(str_of(id)))
+ .map(|m| {
+ let dot = if m["online"].as_bool() == Some(true) {
+ "\u{25cf}"
+ } else {
+ "\u{25cb}"
+ };
+ let badge = m["badge"]
+ .as_str()
+ .map(|b| format!(" [{b}]"))
+ .unwrap_or_default();
+ // The dot's tint for the machine's issues.
+ let health = m["health"]
+ .as_str()
+ .filter(|h| !h.is_empty())
+ .map(|h| format!(" [{h}]"))
+ .unwrap_or_default();
+ format!(
+ "{dot} {}{badge} \u{2014} {}{health}",
+ str_of(&m["name"]),
+ str_of(&m["line"])
+ )
+ })
+ .collect();
+ let mut title = str_of(&g["title"]).to_string();
+ if g["collapsed"].as_bool() == Some(true) {
+ title.push_str(" (collapsed)");
+ }
+ if let Some(all) = g["removeAll"].as_object() {
+ title.push_str(&format!(" \u{b7} {}", str_of(&all["label"])));
+ }
+ json!({ "group": title, "rows": rows })
+ })
+ .collect();
+ let pages: Vec<Value> = machines
+ .iter()
+ .map(|m| {
+ let mut lines = vec![];
+ let mut head = format!("{} \u{2014} {}", str_of(&m["name"]), str_of(&m["status"]));
+ if let Some(by) = m["sharedBy"].as_str() {
+ head.push_str(&format!(" \u{b7} {by}"));
+ }
+ if let Some(r) = m["rename"].as_object() {
+ head.push_str(&format!(" (rename: {})", str_of(&r["target"])));
+ }
+ lines.push(head);
+ for i in m["issues"].as_array().into_iter().flatten() {
+ let action = i["action"]["label"]
+ .as_str()
+ .map(|l| format!(" [{l}]"))
+ .unwrap_or_default();
+ lines.push(format!(
+ "{} {}: {}{action}",
+ str_of(&m["issuesTitle"]).to_lowercase(),
+ str_of(&i["level"]),
+ str_of(&i["text"])
+ ));
+ }
+ if let Some(n) = m["notice"].as_str() {
+ let action = m["noticeAction"]["label"]
+ .as_str()
+ .map(|l| format!(" [{l}]"))
+ .unwrap_or_default();
+ lines.push(format!("notice: {n}{action}"));
+ }
+ for t in m["toggles"].as_array().into_iter().flatten() {
+ let on = if t["on"].as_bool() == Some(true) {
+ "on"
+ } else {
+ "off"
+ };
+ let how = if t["editable"].as_bool() != Some(true) {
+ "read-only".to_string()
+ } else if t["enabled"].as_bool() != Some(true) {
+ "disabled".to_string()
+ } else if let Some(p) = t["setup"].as_str() {
+ format!("sets up: {p}")
+ } else {
+ let a: Vec<&str> = t["actions"]
+ .as_array()
+ .into_iter()
+ .flatten()
+ .map(str_of)
+ .collect();
+ format!("runs: {}", a.join(", "))
+ };
+ lines.push(format!("{}: {on} ({how})", str_of(&t["label"])));
+ }
+ if let Some(n) = m["togglesNote"].as_str() {
+ lines.push(format!("note: {n}"));
+ }
+ for s in m["spaces"].as_array().into_iter().flatten() {
+ lines.push(format!(
+ "space {} \u{b7} {} \u{b7} {} -> {}",
+ str_of(&s["name"]),
+ str_of(&s["os"]),
+ str_of(&s["status"]),
+ str_of(&s["id"])
+ ));
+ }
+ if let Some(e) = m["spacesEmpty"].as_str() {
+ lines.push(format!("spaces: {e}"));
+ }
+ let ns = &m["newSpace"];
+ lines.push(format!(
+ "{} on {}{}",
+ str_of(&ns["label"]),
+ str_of(&ns["on"]),
+ if ns["enabled"].as_bool() == Some(true) {
+ String::new()
+ } else {
+ format!(" (disabled: {})", str_of(&ns["help"]))
+ }
+ ));
+ let facts: Vec<String> = m["details"]
+ .as_array()
+ .into_iter()
+ .flatten()
+ .map(|f| format!("{}: {}", str_of(&f["label"]), str_of(&f["value"])))
+ .collect();
+ lines.push(format!("details: {}", facts.join("; ")));
+ if let Some(r) = m["remove"].as_object() {
+ let what = if r["host"].as_bool() == Some(true) {
+ "host setup".to_string()
+ } else {
+ [r.get("machine"), r.get("device")]
+ .into_iter()
+ .flatten()
+ .filter_map(|x| x.as_str())
+ .collect::<Vec<_>>()
+ .join(" + ")
+ };
+ let state = match r.get("help").and_then(|h| h.as_str()) {
+ Some(h) if r["enabled"].as_bool() != Some(true) => format!(" (disabled: {h})"),
+ _ => String::new(),
+ };
+ lines.push(format!("{} -> {what}{state}", str_of(&r["label"])));
+ }
+ json!(lines)
+ })
+ .collect();
+ json!({ "view": name, "summary": v["summary"], "groups": groups, "pages": pages })
+}
+
/// The Machines page's rows (`machines.pageRows`), one line each: name,
/// id, how it is reached, its system, online, the device in it or a
/// device of its own, its desktop's Space, whether it stopped sharing, and
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 8485f3afc3..b656cade7d 100644
--- a/libs/cua/crates/cua-spaces-ffi/src/app_core.rs
+++ b/libs/cua/crates/cua-spaces-ffi/src/app_core.rs
@@ -2691,6 +2691,19 @@ pub fn app_machines_page_rows(input: AppMachinesPageInput) -> Vec<AppMachinePage
core::machines::page_rows(&input)
}
+/// The Machines page as every UI draws it: the list in groups, one line
+/// per row, and each machine's page.
+#[uniffi::export]
+pub fn app_machines_view(input: AppMachinesViewInput) -> AppMachinesView {
+ core::machines_view::view(&input)
+}
+
+/// Machines view input from JSON (fixtures, parity flows).
+#[uniffi::export]
+pub fn app_machines_view_input_from_json(json: String) -> Result<AppMachinesViewInput> {
+ from_json("machines view input", &json)
+}
+
/// Machines page input from JSON (fixtures, parity flows).
#[uniffi::export]
pub fn app_machines_page_input_from_json(json: String) -> Result<AppMachinesPageInput> {
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 86377ba006..8f40b74af9 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
@@ -9433,6 +9433,313 @@ pub struct AppMachinePageRow {
pub spaces_label: String,
}
+/// One check as the machine's daemon reported it (the SDK's
+/// `MachineHealthCheck`).
+pub type AppMachinesViewCheck = core::machines_health::MachinesViewCheck;
+#[uniffi::remote(Record)]
+pub struct AppMachinesViewCheck {
+ /// `machine.local_network`, `machine.disk`, ...
+ pub id: String,
+ /// `pass`, `warn`, `fail`, `skip`.
+ pub status: String,
+ /// What it found.
+ pub message: String,
+ /// What to do.
+ pub remediation: String,
+ /// `app`, `settings_url`, `free_gb`, ...
+ pub facts: std::collections::HashMap<String, String>,
+}
+
+/// What the shell got for one machine's health.
+pub type AppMachinesViewHealth = core::machines_health::MachinesViewHealth;
+#[uniffi::remote(Record)]
+pub struct AppMachinesViewHealth {
+ /// The machine's row id (`this-mac`, a relay machine id).
+ pub id: String,
+ /// Its checks.
+ pub checks: Vec<AppMachinesViewCheck>,
+ /// The Cua version of the daemon that checked.
+ pub cua_version: String,
+ /// Why it could not be checked, when it could not.
+ pub error: Option<String>,
+}
+
+/// What fixes an issue.
+pub type AppMachinesViewIssueAction = core::machines_health::MachinesViewIssueAction;
+#[uniffi::remote(Record)]
+pub struct AppMachinesViewIssueAction {
+ /// "Open Local Network settings", "Free disk space", "Restart service".
+ pub label: String,
+ /// A System Settings pane to open (`host.openSettings`).
+ pub url: Option<String>,
+ /// A host action to run (`host.action`).
+ pub host_action: Option<AppHostActionId>,
+}
+
+/// One issue on a machine's page.
+pub type AppMachinesViewIssue = core::machines_health::MachinesViewIssue;
+#[uniffi::remote(Record)]
+pub struct AppMachinesViewIssue {
+ /// The check it comes from (`machine.disk`, `service`, `version`).
+ pub id: String,
+ /// `warn` or `fail`.
+ pub level: String,
+ /// One plain sentence.
+ pub text: String,
+ /// Its fix, when there is one here.
+ pub action: Option<AppMachinesViewIssueAction>,
+}
+
+/// What the relay says of one of the account's machines (the SDK's
+/// `RelayMachine`, the fields the page reads).
+pub type AppMachinesViewRelay = core::machines_view::MachinesViewRelay;
+#[uniffi::remote(Record)]
+pub struct AppMachinesViewRelay {
+ /// Machine id.
+ pub id: String,
+ /// `owner`, or `shared` for a machine someone shares with you.
+ pub role: String,
+ /// The team you reach it through, for a team machine.
+ pub team: Option<String>,
+ /// Its owner's email, when the relay says.
+ pub owner_email: Option<String>,
+ /// It creates Spaces for your devices (`None`: it did not say).
+ pub provides_spaces: Option<bool>,
+}
+
+/// What the shell knows about the computer it runs on.
+pub type AppMachinesViewAbout = core::machines_view::MachinesViewAbout;
+#[uniffi::remote(Record)]
+pub struct AppMachinesViewAbout {
+ /// Its name ("Ada's MacBook Pro").
+ pub computer_name: String,
+ /// The app's version ("0.9.1").
+ pub app_version: String,
+ /// Its system and version ("macOS 26.5.2").
+ pub os_version: String,
+}
+
+/// What [`view`] reads.
+pub type AppMachinesViewInput = core::machines_view::MachinesViewInput;
+#[uniffi::remote(Record)]
+pub struct AppMachinesViewInput {
+ /// What the rows are listed from ([`machines::page_rows`]).
+ pub page: AppMachinesPageInput,
+ /// The account's relay machines (none while signed out).
+ pub relay: Vec<AppMachinesViewRelay>,
+ /// This machine's host state (`None` while it loads).
+ pub host: Option<AppHostState>,
+ /// This computer.
+ pub about: AppMachinesViewAbout,
+ /// The rows when the shell already listed them (an older host's rows,
+ /// merged by the web UI); `None`: [`machines::page_rows`] of `page`.
+ pub rows: Option<Vec<AppMachinePageRow>>,
+ /// What each machine's daemon reported of its health, by row id, for
+ /// the machines whose `health_target` the shell checked
+ /// ([`crate::machines_health`]).
+ pub health: Vec<AppMachinesViewHealth>,
+}
+
+/// One of the two switches on a machine's page.
+pub type AppMachinesViewToggle = core::machines_view::MachinesViewToggle;
+#[uniffi::remote(Record)]
+pub struct AppMachinesViewToggle {
+ /// `spaces` or `desktop`.
+ pub id: String,
+ /// "Provide Spaces", "Share this desktop".
+ pub label: String,
+ /// One line under it.
+ pub help: String,
+ /// On now.
+ pub on: bool,
+ /// Changed here (This machine); another machine's are read-only.
+ pub editable: bool,
+ /// Can be flipped now.
+ pub enabled: bool,
+ /// What flipping it runs, in order (the host's actions).
+ pub actions: Vec<AppHostActionId>,
+ /// Before This machine is set up: flipping it opens the setup form
+ /// with this profile (`desktop` or `spare`).
+ pub setup: Option<String>,
+}
+
+/// A Space on a machine: a link to the Space's own page.
+pub type AppMachinesViewSpace = core::machines_view::MachinesViewSpace;
+#[uniffi::remote(Record)]
+pub struct AppMachinesViewSpace {
+ /// The Space's id (its page).
+ pub id: String,
+ /// Its name.
+ pub name: String,
+ /// Its system ("Ubuntu 24.04.5 LTS", "macOS").
+ pub os: String,
+ /// Its status word ("Running", "Stopped").
+ pub status: String,
+ /// Running (the green dot).
+ pub running: bool,
+}
+
+/// New Space here: the wizard with this machine chosen.
+pub type AppMachinesViewNewSpace = core::machines_view::MachinesViewNewSpace;
+#[uniffi::remote(Record)]
+pub struct AppMachinesViewNewSpace {
+ /// "New Space here".
+ pub label: String,
+ /// The wizard's placement (`local`, `host:<id>`).
+ pub on: String,
+ /// Can be pressed now.
+ pub enabled: bool,
+ /// Why not, when it cannot.
+ pub help: Option<String>,
+}
+
+/// Rename: what the new name is saved on.
+pub type AppMachinesViewRename = core::machines_view::MachinesViewRename;
+#[uniffi::remote(Record)]
+pub struct AppMachinesViewRename {
+ /// `host` (This machine's host setup), `machine` (another machine of
+ /// yours on the relay) or `device` (one of your devices).
+ pub target: String,
+ /// The id it is saved under (the relay machine's or the device's).
+ pub id: String,
+ /// The dialog's title.
+ pub title: String,
+ /// Its confirming button.
+ pub confirm_label: String,
+}
+
+/// Remove from account.
+pub type AppMachinesViewRemove = core::machines_view::MachinesViewRemove;
+#[uniffi::remote(Record)]
+pub struct AppMachinesViewRemove {
+ /// "Remove from account".
+ pub label: String,
+ /// Can be pressed now.
+ pub enabled: bool,
+ /// Why not, when it cannot.
+ pub help: Option<String>,
+ /// This machine: its host setup is removed (the host's `remove`).
+ pub host: bool,
+ /// Another machine: it leaves the relay directory (`relay:<id>`).
+ pub machine: Option<String>,
+ /// The device on it, revoked too.
+ pub device: Option<String>,
+ /// Asked first.
+ pub confirm: AppHostConfirm,
+}
+
+/// A label and its value under Details.
+pub type AppMachinesViewFact = core::machines_view::MachinesViewFact;
+#[uniffi::remote(Record)]
+pub struct AppMachinesViewFact {
+ /// "OS", "App", "Connection", "Service".
+ pub label: String,
+ /// Its value.
+ pub value: String,
+}
+
+/// One machine: its list row and its page.
+pub type AppMachinesViewMachine = core::machines_view::MachinesViewMachine;
+#[uniffi::remote(Record)]
+pub struct AppMachinesViewMachine {
+ /// The row's id ([`MachinePageRow::id`]).
+ pub id: String,
+ /// Its name.
+ pub name: String,
+ /// "This Mac" on the machine this app runs on.
+ pub badge: Option<String>,
+ /// The row's one muted line ("2 Spaces running", "Ready for Spaces",
+ /// "Offline · last seen 9 days ago").
+ pub line: String,
+ /// Usable now (the green dot): online and sharing.
+ pub online: bool,
+ /// The dot's tint for its issues: `warn`, `fail`, or empty.
+ pub health: String,
+ /// What the shell passes to `Spaces.machine_health` to check it: empty
+ /// for This Mac, its id for another of your machines; `None` when it
+ /// can't be checked from here (offline, not yours).
+ pub health_target: Option<String>,
+ /// `macos`, `linux`, `windows`, or empty.
+ pub os: String,
+ /// The machine this app runs on.
+ pub current: bool,
+ /// Someone shares it with you (a team machine).
+ pub team: bool,
+ /// The page's status line ("Online", "Offline · last seen 9 days ago").
+ pub status: String,
+ /// After the status: who shares it ("Shared by your team").
+ pub shared_by: Option<String>,
+ /// Rename, when it can be renamed from here.
+ pub rename: Option<AppMachinesViewRename>,
+ /// "Issues".
+ pub issues_title: String,
+ /// What is wrong, one sentence each with its fix; empty when healthy
+ /// (the section is hidden then) or offline.
+ pub issues: Vec<AppMachinesViewIssue>,
+ /// One line over the switches (offline, signed out).
+ pub notice: Option<String>,
+ /// The notice's button (Sign In).
+ pub notice_action: Option<AppHostAction>,
+ /// Provide Spaces, then Share this desktop.
+ pub toggles: Vec<AppMachinesViewToggle>,
+ /// Under read-only switches: where they change.
+ pub toggles_note: Option<String>,
+ /// "Spaces on this machine".
+ pub spaces_title: String,
+ /// The Spaces on it.
+ pub spaces: Vec<AppMachinesViewSpace>,
+ /// When it has none.
+ pub spaces_empty: Option<String>,
+ /// New Space here.
+ pub new_space: AppMachinesViewNewSpace,
+ /// "Details" (collapsed).
+ pub details_title: String,
+ /// OS, App, Connection, Service.
+ pub details: Vec<AppMachinesViewFact>,
+ /// Remove from account (none for a team machine).
+ pub remove: Option<AppMachinesViewRemove>,
+}
+
+/// "Remove old machines": every machine of the group that can go.
+pub type AppMachinesViewRemoveAll = core::machines_view::MachinesViewRemoveAll;
+#[uniffi::remote(Record)]
+pub struct AppMachinesViewRemoveAll {
+ /// "Remove old machines".
+ pub label: String,
+ /// Asked first.
+ pub confirm: AppHostConfirm,
+ /// What each removal does.
+ pub removes: Vec<AppMachinesViewRemove>,
+}
+
+/// A group of the list.
+pub type AppMachinesViewGroup = core::machines_view::MachinesViewGroup;
+#[uniffi::remote(Record)]
+pub struct AppMachinesViewGroup {
+ /// `yours`, `old` or `team`.
+ pub id: String,
+ /// "Your machines", "Offline for 30+ days (2)", "Team machines".
+ pub title: String,
+ /// Collapsed until opened (the old machines).
+ pub collapsed: bool,
+ /// Its machines' ids, in order.
+ pub ids: Vec<String>,
+ /// Remove old machines.
+ pub remove_all: Option<AppMachinesViewRemoveAll>,
+}
+
+/// The Machines page.
+pub type AppMachinesView = core::machines_view::MachinesView;
+#[uniffi::remote(Record)]
+pub struct AppMachinesView {
+ /// "3 machines, 2 online".
+ pub summary: String,
+ /// The list's groups (only those with machines).
+ pub groups: Vec<AppMachinesViewGroup>,
+ /// Every machine, in list order.
+ pub machines: Vec<AppMachinesViewMachine>,
+}
+
/// One step, in the order the checklist lists them
/// ([`telemetry::CHECKLIST_STEPS`]).
pub type AppChecklistStep = core::checklist::ChecklistStep;
diff --git a/libs/cua/crates/cua-spaces/src/host_spaces.rs b/libs/cua/crates/cua-spaces/src/host_spaces.rs
index 22a2a8cc23..707a039913 100644
--- a/libs/cua/crates/cua-spaces/src/host_spaces.rs
+++ b/libs/cua/crates/cua-spaces/src/host_spaces.rs
@@ -2098,6 +2098,54 @@ impl Spaces {
.map_err(|e| from_host(cua_spacesd_client::Error::from(e)))
}
+ /// Another of your machines' health as its own cua daemon checks it
+ /// (`HostSpacesService.DiagnoseHost`): Local Network access, disk,
+ /// virtualization, memory, permissions. `machine` is an id or a name,
+ /// as [`Spaces::resolve_host`] takes it; reached over the relay (or the
+ /// mesh), or at its direct address. Fails plainly when it is offline,
+ /// not yours, or runs a Cua that predates the check. Bounded (30 s).
+ pub async fn machine_health(&self, machine: &str) -> Result<pb::DiagnoseHostResponse> {
+ let (space, name) = match self.resolve_host(machine).await? {
+ ResolvedHost::Relay(m) => {
+ let name = if m.name.is_empty() {
+ m.id.clone()
+ } else {
+ m.name.clone()
+ };
+ if !m.online {
+ return Err(Error::host(
+ "machine health",
+ format!("{name} is offline, so it can't be checked now"),
+ ));
+ }
+ if m.role != "owner" {
+ return Err(Error::Relay(cua_host::Error::PermissionDenied(format!(
+ "{name} is not yours: only its owner can check its health"
+ ))));
+ }
+ (self.space(&format!("relay:{}", m.id)).await?, name)
+ }
+ ResolvedHost::Direct(h) => {
+ let name = h.name.clone();
+ (self.direct_host_space(&h).await?, name)
+ }
+ };
+ let mut client = space.spacesd()?.host_spaces();
+ let call = client.diagnose_host(pb::DiagnoseHostRequest::default());
+ match tokio::time::timeout(Duration::from_secs(30), call).await {
+ Ok(Ok(r)) => Ok(r.into_inner()),
+ Ok(Err(status)) if status.code() == tonic::Code::Unimplemented => Err(Error::host(
+ "machine health",
+ format!("{name} runs an older Cua that can't be checked; update Cua on it"),
+ )),
+ Ok(Err(status)) => Err(from_host(cua_spacesd_client::Error::from(status))),
+ Err(_) => Err(Error::host(
+ "machine health",
+ format!("{name} did not answer within 30 s"),
+ )),
+ }
+ }
+
async fn host_space(&self, m: &crate::relay::RelayMachine) -> Result<crate::Space> {
if !m.online {
return Err(Error::host(
diff --git a/libs/cua/crates/cua-spaces/tests/host_spaces.rs b/libs/cua/crates/cua-spaces/tests/host_spaces.rs
index 7e6ef8864a..c89dd9570b 100644
--- a/libs/cua/crates/cua-spaces/tests/host_spaces.rs
+++ b/libs/cua/crates/cua-spaces/tests/host_spaces.rs
@@ -1085,6 +1085,17 @@ impl pb::host_spaces_service_server::HostSpacesService for HostSvc {
r.map(|message| tonic::Response::new(pb::DeleteCloudSpaceResponse { message }))
.map_err(|e| to_status(&e))
}
+
+ async fn diagnose_host(
+ &self,
+ _req: tonic::Request<pb::DiagnoseHostRequest>,
+ ) -> Result<tonic::Response<pb::DiagnoseHostResponse>, tonic::Status> {
+ Ok(tonic::Response::new(pb::DiagnoseHostResponse {
+ report: None,
+ cua_version: "0.0.0-test".into(),
+ os: "macos".into(),
+ }))
+ }
}
/// The client half: the spare host is online on the fake relay (its driver
diff --git a/libs/cua/crates/cua-spacesd-html5/web/src/gen/cua/env/v1/host_pb.ts b/libs/cua/crates/cua-spacesd-html5/web/src/gen/cua/env/v1/host_pb.ts
index 5788efc056..3ae76664cf 100644
--- a/libs/cua/crates/cua-spacesd-html5/web/src/gen/cua/env/v1/host_pb.ts
+++ b/libs/cua/crates/cua-spacesd-html5/web/src/gen/cua/env/v1/host_pb.ts
@@ -4,6 +4,8 @@
import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2";
+import type { DiagnoseReport } from "./diagnose_pb";
+import { file_cua_env_v1_diagnose } from "./diagnose_pb";
import type { AttachRelayRequest } from "./system_pb";
import { file_cua_env_v1_system } from "./system_pb";
import type { Message } from "@bufbuild/protobuf";
@@ -12,7 +14,67 @@ import type { Message } from "@bufbuild/protobuf";
* Describes the file cua/env/v1/host.proto.
*/
export const file_cua_env_v1_host: GenFile = /*@__PURE__*/
- fileDesc("ChVjdWEvZW52L3YxL2hvc3QucHJvdG8SCmN1YS5lbnYudjEibgoSSG9zdFNwYWNlc1NldHRpbmdzEhUKDXNoYXJlX2Rlc2t0b3AYASABKAgSFgoOcHJvdmlkZV9zcGFjZXMYAiABKAgSEgoKbWF4X3NwYWNlcxgDIAEoDRIVCg1tYXhfbWFjb3Nfdm1zGAQgASgNIlMKEkhvc3RTcGFjZXNDYXBhY2l0eRIQCghyZXNvdXJjZRgBIAEoCRIMCgR1c2VkGAIgASgNEg0KBWxpbWl0GAMgASgNEg4KBnJlYXNvbhgEIAEoCSLVAQoJSG9zdFNwYWNlEhUKDXJlbGF5X21hY2hpbmUYASABKAkSEwoLbG9jYWxfc3BhY2UYAiABKAkSDAoEbmFtZRgDIAEoCRINCgVpbWFnZRgEIAEoCRIKCgJvcxgFIAEoCRIMCgRraW5kGAYgASgJEg8KB3J1bnRpbWUYByABKAkSEgoKY3JlYXRlZF9ieRgIIAEoCRIVCg1jcmVhdGVkX2F0X21zGAkgASgDEhMKC2RpcmVjdF9wb3J0GAogASgNEhQKDGRpcmVjdF90b2tlbhgLIAEoCSJhChRIb3N0U3BhY2VzQXVkaXRFdmVudBINCgV0c19tcxgBIAEoAxIOCgZhY3Rpb24YAiABKAkSCwoDd2hvGAMgASgJEg0KBXNwYWNlGAQgASgJEg4KBmRldGFpbBgFIAEoCSIWChRHZXRIb3N0U3BhY2VzUmVxdWVzdCKuAgoVR2V0SG9zdFNwYWNlc1Jlc3BvbnNlEgwKBG5hbWUYASABKAkSCgoCb3MYAiABKAkSMAoIc2V0dGluZ3MYAyABKAsyHi5jdWEuZW52LnYxLkhvc3RTcGFjZXNTZXR0aW5ncxIwCghjYXBhY2l0eRgEIAMoCzIeLmN1YS5lbnYudjEuSG9zdFNwYWNlc0NhcGFjaXR5EiUKBnNwYWNlcxgFIAMoCzIVLmN1YS5lbnYudjEuSG9zdFNwYWNlEi8KBWF1ZGl0GAYgAygLMiAuY3VhLmVudi52MS5Ib3N0U3BhY2VzQXVkaXRFdmVudBIOCgZpbWFnZXMYByADKAkSLwoIY3JlYXRpbmcYCCADKAsyHS5jdWEuZW52LnYxLkhvc3RTcGFjZUNyZWF0aW5nIukBChFIb3N0U3BhY2VDcmVhdGluZxILCgNrZXkYASABKAkSDQoFcGhhc2UYAiABKAkSFQoIZnJhY3Rpb24YAyABKAFIAIgBARIOCgZkZXRhaWwYBCABKAkSFwoKYnl0ZXNfZG9uZRgFIAEoBEgBiAEBEhgKC2J5dGVzX3RvdGFsGAYgASgESAKIAQESHQoQYnl0ZXNfcGVyX3NlY29uZBgHIAEoAUgDiAEBQgsKCV9mcmFjdGlvbkINCgtfYnl0ZXNfZG9uZUIOCgxfYnl0ZXNfdG90YWxCEwoRX2J5dGVzX3Blcl9zZWNvbmQi2gEKFkNyZWF0ZUhvc3RTcGFjZVJlcXVlc3QSDQoFaW1hZ2UYASABKAkSDAoEa2luZBgCIAEoCRIPCgdydW50aW1lGAMgASgJEgwKBG5hbWUYBCABKAkSDAoEY3B1cxgFIAEoDRIRCgltZW1vcnlfbWIYBiABKAQSDwoHZGlza19nYhgHIAEoDRIuCgZhdHRhY2gYCCABKAsyHi5jdWEuZW52LnYxLkF0dGFjaFJlbGF5UmVxdWVzdBIOCgZkaXJlY3QYCSABKAgSEgoKY3JlYXRlX2tleRgKIAEoCSI/ChdDcmVhdGVIb3N0U3BhY2VSZXNwb25zZRIkCgVzcGFjZRgBIAEoCzIVLmN1YS5lbnYudjEuSG9zdFNwYWNlIicKFkRlbGV0ZUhvc3RTcGFjZVJlcXVlc3QSDQoFc3BhY2UYASABKAkiKgoXRGVsZXRlSG9zdFNwYWNlUmVzcG9uc2USDwoHbWVzc2FnZRgBIAEoCSIoChdEZWxldGVDbG91ZFNwYWNlUmVxdWVzdBINCgVzcGFjZRgBIAEoCSIrChhEZWxldGVDbG91ZFNwYWNlUmVzcG9uc2USDwoHbWVzc2FnZRgBIAEoCSInChZDYW5jZWxIb3N0U3BhY2VSZXF1ZXN0Eg0KBXNwYWNlGAEgASgJIioKF0NhbmNlbEhvc3RTcGFjZVJlc3BvbnNlEg8KB21lc3NhZ2UYASABKAkiNQoYU2V0SG9zdFNwYWNlUG93ZXJSZXF1ZXN0Eg0KBXNwYWNlGAEgASgJEgoKAm9uGAIgASgIIkoKGVNldEhvc3RTcGFjZVBvd2VyUmVzcG9uc2USDQoFc3RhdGUYASABKAkSDQoFcG93ZXIYAiABKAkSDwoHbWVzc2FnZRgDIAEoCTK+BAoRSG9zdFNwYWNlc1NlcnZpY2USVAoNR2V0SG9zdFNwYWNlcxIgLmN1YS5lbnYudjEuR2V0SG9zdFNwYWNlc1JlcXVlc3QaIS5jdWEuZW52LnYxLkdldEhvc3RTcGFjZXNSZXNwb25zZRJaCg9DcmVhdGVIb3N0U3BhY2USIi5jdWEuZW52LnYxLkNyZWF0ZUhvc3RTcGFjZVJlcXVlc3QaIy5jdWEuZW52LnYxLkNyZWF0ZUhvc3RTcGFjZVJlc3BvbnNlEloKD0RlbGV0ZUhvc3RTcGFjZRIiLmN1YS5lbnYudjEuRGVsZXRlSG9zdFNwYWNlUmVxdWVzdBojLmN1YS5lbnYudjEuRGVsZXRlSG9zdFNwYWNlUmVzcG9uc2USWgoPQ2FuY2VsSG9zdFNwYWNlEiIuY3VhLmVudi52MS5DYW5jZWxIb3N0U3BhY2VSZXF1ZXN0GiMuY3VhLmVudi52MS5DYW5jZWxIb3N0U3BhY2VSZXNwb25zZRJgChFTZXRIb3N0U3BhY2VQb3dlchIkLmN1YS5lbnYudjEuU2V0SG9zdFNwYWNlUG93ZXJSZXF1ZXN0GiUuY3VhLmVudi52MS5TZXRIb3N0U3BhY2VQb3dlclJlc3BvbnNlEl0KEERlbGV0ZUNsb3VkU3BhY2USIy5jdWEuZW52LnYxLkRlbGV0ZUNsb3VkU3BhY2VSZXF1ZXN0GiQuY3VhLmVudi52MS5EZWxldGVDbG91ZFNwYWNlUmVzcG9uc2ViBnByb3RvMw", [file_cua_env_v1_system]);
+ fileDesc("ChVjdWEvZW52L3YxL2hvc3QucHJvdG8SCmN1YS5lbnYudjEiJgoTRGlhZ25vc2VIb3N0UmVxdWVzdBIPCgdtYWNoaW5lGAEgASgJImMKFERpYWdub3NlSG9zdFJlc3BvbnNlEioKBnJlcG9ydBgBIAEoCzIaLmN1YS5lbnYudjEuRGlhZ25vc2VSZXBvcnQSEwoLY3VhX3ZlcnNpb24YAiABKAkSCgoCb3MYAyABKAkibgoSSG9zdFNwYWNlc1NldHRpbmdzEhUKDXNoYXJlX2Rlc2t0b3AYASABKAgSFgoOcHJvdmlkZV9zcGFjZXMYAiABKAgSEgoKbWF4X3NwYWNlcxgDIAEoDRIVCg1tYXhfbWFjb3Nfdm1zGAQgASgNIlMKEkhvc3RTcGFjZXNDYXBhY2l0eRIQCghyZXNvdXJjZRgBIAEoCRIMCgR1c2VkGAIgASgNEg0KBWxpbWl0GAMgASgNEg4KBnJlYXNvbhgEIAEoCSLVAQoJSG9zdFNwYWNlEhUKDXJlbGF5X21hY2hpbmUYASABKAkSEwoLbG9jYWxfc3BhY2UYAiABKAkSDAoEbmFtZRgDIAEoCRINCgVpbWFnZRgEIAEoCRIKCgJvcxgFIAEoCRIMCgRraW5kGAYgASgJEg8KB3J1bnRpbWUYByABKAkSEgoKY3JlYXRlZF9ieRgIIAEoCRIVCg1jcmVhdGVkX2F0X21zGAkgASgDEhMKC2RpcmVjdF9wb3J0GAogASgNEhQKDGRpcmVjdF90b2tlbhgLIAEoCSJhChRIb3N0U3BhY2VzQXVkaXRFdmVudBINCgV0c19tcxgBIAEoAxIOCgZhY3Rpb24YAiABKAkSCwoDd2hvGAMgASgJEg0KBXNwYWNlGAQgASgJEg4KBmRldGFpbBgFIAEoCSIWChRHZXRIb3N0U3BhY2VzUmVxdWVzdCKuAgoVR2V0SG9zdFNwYWNlc1Jlc3BvbnNlEgwKBG5hbWUYASABKAkSCgoCb3MYAiABKAkSMAoIc2V0dGluZ3MYAyABKAsyHi5jdWEuZW52LnYxLkhvc3RTcGFjZXNTZXR0aW5ncxIwCghjYXBhY2l0eRgEIAMoCzIeLmN1YS5lbnYudjEuSG9zdFNwYWNlc0NhcGFjaXR5EiUKBnNwYWNlcxgFIAMoCzIVLmN1YS5lbnYudjEuSG9zdFNwYWNlEi8KBWF1ZGl0GAYgAygLMiAuY3VhLmVudi52MS5Ib3N0U3BhY2VzQXVkaXRFdmVudBIOCgZpbWFnZXMYByADKAkSLwoIY3JlYXRpbmcYCCADKAsyHS5jdWEuZW52LnYxLkhvc3RTcGFjZUNyZWF0aW5nIukBChFIb3N0U3BhY2VDcmVhdGluZxILCgNrZXkYASABKAkSDQoFcGhhc2UYAiABKAkSFQoIZnJhY3Rpb24YAyABKAFIAIgBARIOCgZkZXRhaWwYBCABKAkSFwoKYnl0ZXNfZG9uZRgFIAEoBEgBiAEBEhgKC2J5dGVzX3RvdGFsGAYgASgESAKIAQESHQoQYnl0ZXNfcGVyX3NlY29uZBgHIAEoAUgDiAEBQgsKCV9mcmFjdGlvbkINCgtfYnl0ZXNfZG9uZUIOCgxfYnl0ZXNfdG90YWxCEwoRX2J5dGVzX3Blcl9zZWNvbmQi2gEKFkNyZWF0ZUhvc3RTcGFjZVJlcXVlc3QSDQoFaW1hZ2UYASABKAkSDAoEa2luZBgCIAEoCRIPCgdydW50aW1lGAMgASgJEgwKBG5hbWUYBCABKAkSDAoEY3B1cxgFIAEoDRIRCgltZW1vcnlfbWIYBiABKAQSDwoHZGlza19nYhgHIAEoDRIuCgZhdHRhY2gYCCABKAsyHi5jdWEuZW52LnYxLkF0dGFjaFJlbGF5UmVxdWVzdBIOCgZkaXJlY3QYCSABKAgSEgoKY3JlYXRlX2tleRgKIAEoCSI/ChdDcmVhdGVIb3N0U3BhY2VSZXNwb25zZRIkCgVzcGFjZRgBIAEoCzIVLmN1YS5lbnYudjEuSG9zdFNwYWNlIicKFkRlbGV0ZUhvc3RTcGFjZVJlcXVlc3QSDQoFc3BhY2UYASABKAkiKgoXRGVsZXRlSG9zdFNwYWNlUmVzcG9uc2USDwoHbWVzc2FnZRgBIAEoCSIoChdEZWxldGVDbG91ZFNwYWNlUmVxdWVzdBINCgVzcGFjZRgBIAEoCSIrChhEZWxldGVDbG91ZFNwYWNlUmVzcG9uc2USDwoHbWVzc2FnZRgBIAEoCSInChZDYW5jZWxIb3N0U3BhY2VSZXF1ZXN0Eg0KBXNwYWNlGAEgASgJIioKF0NhbmNlbEhvc3RTcGFjZVJlc3BvbnNlEg8KB21lc3NhZ2UYASABKAkiNQoYU2V0SG9zdFNwYWNlUG93ZXJSZXF1ZXN0Eg0KBXNwYWNlGAEgASgJEgoKAm9uGAIgASgIIkoKGVNldEhvc3RTcGFjZVBvd2VyUmVzcG9uc2USDQoFc3RhdGUYASABKAkSDQoFcG93ZXIYAiABKAkSDwoHbWVzc2FnZRgDIAEoCTKRBQoRSG9zdFNwYWNlc1NlcnZpY2USVAoNR2V0SG9zdFNwYWNlcxIgLmN1YS5lbnYudjEuR2V0SG9zdFNwYWNlc1JlcXVlc3QaIS5jdWEuZW52LnYxLkdldEhvc3RTcGFjZXNSZXNwb25zZRJaCg9DcmVhdGVIb3N0U3BhY2USIi5jdWEuZW52LnYxLkNyZWF0ZUhvc3RTcGFjZVJlcXVlc3QaIy5jdWEuZW52LnYxLkNyZWF0ZUhvc3RTcGFjZVJlc3BvbnNlEloKD0RlbGV0ZUhvc3RTcGFjZRIiLmN1YS5lbnYudjEuRGVsZXRlSG9zdFNwYWNlUmVxdWVzdBojLmN1YS5lbnYudjEuRGVsZXRlSG9zdFNwYWNlUmVzcG9uc2USWgoPQ2FuY2VsSG9zdFNwYWNlEiIuY3VhLmVudi52MS5DYW5jZWxIb3N0U3BhY2VSZXF1ZXN0GiMuY3VhLmVudi52MS5DYW5jZWxIb3N0U3BhY2VSZXNwb25zZRJgChFTZXRIb3N0U3BhY2VQb3dlchIkLmN1YS5lbnYudjEuU2V0SG9zdFNwYWNlUG93ZXJSZXF1ZXN0GiUuY3VhLmVudi52MS5TZXRIb3N0U3BhY2VQb3dlclJlc3BvbnNlEl0KEERlbGV0ZUNsb3VkU3BhY2USIy5jdWEuZW52LnYxLkRlbGV0ZUNsb3VkU3BhY2VSZXF1ZXN0GiQuY3VhLmVudi52MS5EZWxldGVDbG91ZFNwYWNlUmVzcG9uc2USUQoMRGlhZ25vc2VIb3N0Eh8uY3VhLmVudi52MS5EaWFnbm9zZUhvc3RSZXF1ZXN0GiAuY3VhLmVudi52MS5EaWFnbm9zZUhvc3RSZXNwb25zZWIGcHJvdG8z", [file_cua_env_v1_diagnose, file_cua_env_v1_system]);
+
+/**
+ * Request for `HostSpacesService.DiagnoseHost`.
+ *
+ * @generated from message cua.env.v1.DiagnoseHostRequest
+ */
+export type DiagnoseHostRequest = Message<"cua.env.v1.DiagnoseHostRequest"> & {
+ /**
+ * Another of the owner's machines to check instead, by id or name: the
+ * cua daemon asks that machine's own `DiagnoseHost` over the relay (or
+ * the mesh, or its direct address). Only for a call made on this machine
+ * itself; a host's cua-spacesd clears it on calls it forwards. Empty:
+ * this machine.
+ *
+ * @generated from field: string machine = 1;
+ */
+ machine: string;
+};
+
+/**
+ * Describes the message cua.env.v1.DiagnoseHostRequest.
+ * Use `create(DiagnoseHostRequestSchema)` to create a new message.
+ */
+export const DiagnoseHostRequestSchema: GenMessage<DiagnoseHostRequest> = /*@__PURE__*/
+ messageDesc(file_cua_env_v1_host, 0);
+
+/**
+ * Response for `HostSpacesService.DiagnoseHost`.
+ *
+ * @generated from message cua.env.v1.DiagnoseHostResponse
+ */
+export type DiagnoseHostResponse = Message<"cua.env.v1.DiagnoseHostResponse"> & {
+ /**
+ * The checks (ids `machine.*`), in the report schema `cua doctor` uses.
+ *
+ * @generated from field: cua.env.v1.DiagnoseReport report = 1;
+ */
+ report?: DiagnoseReport | undefined;
+
+ /**
+ * The Cua version of the daemon that ran them.
+ *
+ * @generated from field: string cua_version = 2;
+ */
+ cuaVersion: string;
+
+ /**
+ * The machine's operating system (`macos`, `linux`, `windows`).
+ *
+ * @generated from field: string os = 3;
+ */
+ os: string;
+};
+
+/**
+ * Describes the message cua.env.v1.DiagnoseHostResponse.
+ * Use `create(DiagnoseHostResponseSchema)` to create a new message.
+ */
+export const DiagnoseHostResponseSchema: GenMessage<DiagnoseHostResponse> = /*@__PURE__*/
+ messageDesc(file_cua_env_v1_host, 1);
/**
* The host's two independent settings and its limits.
@@ -56,7 +118,7 @@ export type HostSpacesSettings = Message<"cua.env.v1.HostSpacesSettings"> & {
* Use `create(HostSpacesSettingsSchema)` to create a new message.
*/
export const HostSpacesSettingsSchema: GenMessage<HostSpacesSettings> = /*@__PURE__*/
- messageDesc(file_cua_env_v1_host, 0);
+ messageDesc(file_cua_env_v1_host, 2);
/**
* How much of one limit is in use.
@@ -100,7 +162,7 @@ export type HostSpacesCapacity = Message<"cua.env.v1.HostSpacesCapacity"> & {
* Use `create(HostSpacesCapacitySchema)` to create a new message.
*/
export const HostSpacesCapacitySchema: GenMessage<HostSpacesCapacity> = /*@__PURE__*/
- messageDesc(file_cua_env_v1_host, 1);
+ messageDesc(file_cua_env_v1_host, 3);
/**
* A Space this host provides.
@@ -196,7 +258,7 @@ export type HostSpace = Message<"cua.env.v1.HostSpace"> & {
* Use `create(HostSpaceSchema)` to create a new message.
*/
export const HostSpaceSchema: GenMessage<HostSpace> = /*@__PURE__*/
- messageDesc(file_cua_env_v1_host, 2);
+ messageDesc(file_cua_env_v1_host, 4);
/**
* One line of the host's Spaces audit log.
@@ -245,7 +307,7 @@ export type HostSpacesAuditEvent = Message<"cua.env.v1.HostSpacesAuditEvent"> &
* Use `create(HostSpacesAuditEventSchema)` to create a new message.
*/
export const HostSpacesAuditEventSchema: GenMessage<HostSpacesAuditEvent> = /*@__PURE__*/
- messageDesc(file_cua_env_v1_host, 3);
+ messageDesc(file_cua_env_v1_host, 5);
/**
* Request for `HostSpacesService.GetHostSpaces`.
@@ -260,7 +322,7 @@ export type GetHostSpacesRequest = Message<"cua.env.v1.GetHostSpacesRequest"> &
* Use `create(GetHostSpacesRequestSchema)` to create a new message.
*/
export const GetHostSpacesRequestSchema: GenMessage<GetHostSpacesRequest> = /*@__PURE__*/
- messageDesc(file_cua_env_v1_host, 4);
+ messageDesc(file_cua_env_v1_host, 6);
/**
* Response for `HostSpacesService.GetHostSpaces`.
@@ -336,7 +398,7 @@ export type GetHostSpacesResponse = Message<"cua.env.v1.GetHostSpacesResponse">
* Use `create(GetHostSpacesResponseSchema)` to create a new message.
*/
export const GetHostSpacesResponseSchema: GenMessage<GetHostSpacesResponse> = /*@__PURE__*/
- messageDesc(file_cua_env_v1_host, 5);
+ messageDesc(file_cua_env_v1_host, 7);
/**
* A create a host is running, and what it is doing now. The progress
@@ -403,7 +465,7 @@ export type HostSpaceCreating = Message<"cua.env.v1.HostSpaceCreating"> & {
* Use `create(HostSpaceCreatingSchema)` to create a new message.
*/
export const HostSpaceCreatingSchema: GenMessage<HostSpaceCreating> = /*@__PURE__*/
- messageDesc(file_cua_env_v1_host, 6);
+ messageDesc(file_cua_env_v1_host, 8);
/**
* Request for `HostSpacesService.CreateHostSpace`.
@@ -496,7 +558,7 @@ export type CreateHostSpaceRequest = Message<"cua.env.v1.CreateHostSpaceRequest"
* Use `create(CreateHostSpaceRequestSchema)` to create a new message.
*/
export const CreateHostSpaceRequestSchema: GenMessage<CreateHostSpaceRequest> = /*@__PURE__*/
- messageDesc(file_cua_env_v1_host, 7);
+ messageDesc(file_cua_env_v1_host, 9);
/**
* Response for `HostSpacesService.CreateHostSpace`.
@@ -517,7 +579,7 @@ export type CreateHostSpaceResponse = Message<"cua.env.v1.CreateHostSpaceRespons
* Use `create(CreateHostSpaceResponseSchema)` to create a new message.
*/
export const CreateHostSpaceResponseSchema: GenMessage<CreateHostSpaceResponse> = /*@__PURE__*/
- messageDesc(file_cua_env_v1_host, 8);
+ messageDesc(file_cua_env_v1_host, 10);
/**
* Request for `HostSpacesService.DeleteHostSpace`.
@@ -538,7 +600,7 @@ export type DeleteHostSpaceRequest = Message<"cua.env.v1.DeleteHostSpaceRequest"
* Use `create(DeleteHostSpaceRequestSchema)` to create a new message.
*/
export const DeleteHostSpaceRequestSchema: GenMessage<DeleteHostSpaceRequest> = /*@__PURE__*/
- messageDesc(file_cua_env_v1_host, 9);
+ messageDesc(file_cua_env_v1_host, 11);
/**
* Response for `HostSpacesService.DeleteHostSpace`.
@@ -559,7 +621,7 @@ export type DeleteHostSpaceResponse = Message<"cua.env.v1.DeleteHostSpaceRespons
* Use `create(DeleteHostSpaceResponseSchema)` to create a new message.
*/
export const DeleteHostSpaceResponseSchema: GenMessage<DeleteHostSpaceResponse> = /*@__PURE__*/
- messageDesc(file_cua_env_v1_host, 10);
+ messageDesc(file_cua_env_v1_host, 12);
/**
* Request for `HostSpacesService.DeleteCloudSpace`.
@@ -580,7 +642,7 @@ export type DeleteCloudSpaceRequest = Message<"cua.env.v1.DeleteCloudSpaceReques
* Use `create(DeleteCloudSpaceRequestSchema)` to create a new message.
*/
export const DeleteCloudSpaceRequestSchema: GenMessage<DeleteCloudSpaceRequest> = /*@__PURE__*/
- messageDesc(file_cua_env_v1_host, 11);
+ messageDesc(file_cua_env_v1_host, 13);
/**
* Response for `HostSpacesService.DeleteCloudSpace`.
@@ -601,7 +663,7 @@ export type DeleteCloudSpaceResponse = Message<"cua.env.v1.DeleteCloudSpaceRespo
* Use `create(DeleteCloudSpaceResponseSchema)` to create a new message.
*/
export const DeleteCloudSpaceResponseSchema: GenMessage<DeleteCloudSpaceResponse> = /*@__PURE__*/
- messageDesc(file_cua_env_v1_host, 12);
+ messageDesc(file_cua_env_v1_host, 14);
/**
* Request for `HostSpacesService.CancelHostSpace`.
@@ -622,7 +684,7 @@ export type CancelHostSpaceRequest = Message<"cua.env.v1.CancelHostSpaceRequest"
* Use `create(CancelHostSpaceRequestSchema)` to create a new message.
*/
export const CancelHostSpaceRequestSchema: GenMessage<CancelHostSpaceRequest> = /*@__PURE__*/
- messageDesc(file_cua_env_v1_host, 13);
+ messageDesc(file_cua_env_v1_host, 15);
/**
* Response for `HostSpacesService.CancelHostSpace`.
@@ -643,7 +705,7 @@ export type CancelHostSpaceResponse = Message<"cua.env.v1.CancelHostSpaceRespons
* Use `create(CancelHostSpaceResponseSchema)` to create a new message.
*/
export const CancelHostSpaceResponseSchema: GenMessage<CancelHostSpaceResponse> = /*@__PURE__*/
- messageDesc(file_cua_env_v1_host, 14);
+ messageDesc(file_cua_env_v1_host, 16);
/**
* Request for `HostSpacesService.SetHostSpacePower`.
@@ -671,7 +733,7 @@ export type SetHostSpacePowerRequest = Message<"cua.env.v1.SetHostSpacePowerRequ
* Use `create(SetHostSpacePowerRequestSchema)` to create a new message.
*/
export const SetHostSpacePowerRequestSchema: GenMessage<SetHostSpacePowerRequest> = /*@__PURE__*/
- messageDesc(file_cua_env_v1_host, 15);
+ messageDesc(file_cua_env_v1_host, 17);
/**
* Response for `HostSpacesService.SetHostSpacePower`.
@@ -706,7 +768,7 @@ export type SetHostSpacePowerResponse = Message<"cua.env.v1.SetHostSpacePowerRes
* Use `create(SetHostSpacePowerResponseSchema)` to create a new message.
*/
export const SetHostSpacePowerResponseSchema: GenMessage<SetHostSpacePowerResponse> = /*@__PURE__*/
- messageDesc(file_cua_env_v1_host, 16);
+ messageDesc(file_cua_env_v1_host, 18);
/**
* Spaces a host provides: a machine set up with `cua host setup
@@ -814,6 +876,22 @@ export const HostSpacesService: GenService<{
input: typeof DeleteCloudSpaceRequestSchema;
output: typeof DeleteCloudSpaceResponseSchema;
},
+ /**
+ * This machine's health as a place to run Spaces, checked by its cua
+ * daemon (the process that runs them): Local Network access and the app
+ * macOS holds responsible for it, free disk, virtualization, memory, and
+ * the permissions sharing its desktop needs. Read-only and bounded (a
+ * few seconds). Only the owner. Works whether or not this machine
+ * provides Spaces. The Machines page shows the warnings and failures as
+ * the machine's issues; `cua doctor --machine` prints them.
+ *
+ * @generated from rpc cua.env.v1.HostSpacesService.DiagnoseHost
+ */
+ diagnoseHost: {
+ methodKind: "unary";
+ input: typeof DiagnoseHostRequestSchema;
+ output: typeof DiagnoseHostResponseSchema;
+ },
}> = /*@__PURE__*/
serviceDesc(file_cua_env_v1_host, 0);
diff --git a/libs/cua/kotlin/src/main/kotlin/ai/cua/sdk/cua_sdk.kt b/libs/cua/kotlin/src/main/kotlin/ai/cua/sdk/cua_sdk.kt
index 96542bf1a4..a26509d7f4 100644
--- a/libs/cua/kotlin/src/main/kotlin/ai/cua/sdk/cua_sdk.kt
+++ b/libs/cua/kotlin/src/main/kotlin/ai/cua/sdk/cua_sdk.kt
@@ -987,6 +987,8 @@ external fun uniffi_cua_sdk_checksum_method_devices_relay_url(
): Short
external fun uniffi_cua_sdk_checksum_method_devices_rename(
): Short
+external fun uniffi_cua_sdk_checksum_method_devices_rename_machine(
+): Short
external fun uniffi_cua_sdk_checksum_method_devices_revoke(
): Short
external fun uniffi_cua_sdk_checksum_method_devices_revoke_pairing_code(
@@ -1399,6 +1401,8 @@ external fun uniffi_cua_sdk_checksum_method_spaces_list(
): Short
external fun uniffi_cua_sdk_checksum_method_spaces_list_tools_json(
): Short
+external fun uniffi_cua_sdk_checksum_method_spaces_machine_health(
+): Short
external fun uniffi_cua_sdk_checksum_method_spaces_relay_register(
): Short
external fun uniffi_cua_sdk_checksum_method_spaces_relay_unregister(
@@ -1774,6 +1778,8 @@ external fun uniffi_cua_sdk_fn_method_devices_relay_url(`ptr`: Long,uniffi_out_e
): RustBuffer.ByValue
external fun uniffi_cua_sdk_fn_method_devices_rename(`ptr`: Long,`id`: RustBuffer.ByValue,`name`: RustBuffer.ByValue,
): Long
+external fun uniffi_cua_sdk_fn_method_devices_rename_machine(`ptr`: Long,`machineId`: RustBuffer.ByValue,`name`: RustBuffer.ByValue,
+): Long
external fun uniffi_cua_sdk_fn_method_devices_revoke(`ptr`: Long,`id`: RustBuffer.ByValue,
): Long
external fun uniffi_cua_sdk_fn_method_devices_revoke_pairing_code(`ptr`: Long,`id`: RustBuffer.ByValue,
@@ -2280,6 +2286,8 @@ external fun uniffi_cua_sdk_fn_method_spaces_list(`ptr`: Long,
): Long
external fun uniffi_cua_sdk_fn_method_spaces_list_tools_json(`ptr`: Long,
): Long
+external fun uniffi_cua_sdk_fn_method_spaces_machine_health(`ptr`: Long,`machine`: RustBuffer.ByValue,
+): Long
external fun uniffi_cua_sdk_fn_method_spaces_relay_register(`ptr`: Long,`space`: RustBuffer.ByValue,
): Long
external fun uniffi_cua_sdk_fn_method_spaces_relay_unregister(`ptr`: Long,`space`: RustBuffer.ByValue,
@@ -3037,6 +3045,9 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) {
if (lib.uniffi_cua_sdk_checksum_method_devices_rename() != 59535.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
+ if (lib.uniffi_cua_sdk_checksum_method_devices_rename_machine() != 63088.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
if (lib.uniffi_cua_sdk_checksum_method_devices_revoke() != 27802.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
@@ -3655,6 +3666,9 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) {
if (lib.uniffi_cua_sdk_checksum_method_spaces_list_tools_json() != 19259.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
+ if (lib.uniffi_cua_sdk_checksum_method_spaces_machine_health() != 35352.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
if (lib.uniffi_cua_sdk_checksum_method_spaces_relay_register() != 31691.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
@@ -7646,6 +7660,13 @@ public interface DevicesInterface {
*/
suspend fun `rename`(`id`: kotlin.String, `name`: kotlin.String): RelayDevice
+ /**
+ * Renames `machine_id`, a machine the account owns, on the relay (from
+ * this enrolled device). When it is this machine's own registration,
+ * its host setup takes the new name too.
+ */
+ suspend fun `renameMachine`(`machineId`: kotlin.String, `name`: kotlin.String): RelayMachine
+
/**
* Revokes a device (from this enrolled device). Revoking this device
* also deletes its key.
@@ -7980,6 +8001,32 @@ open class Devices: Disposable, AutoCloseable, DevicesInterface
}
+ /**
+ * Renames `machine_id`, a machine the account owns, on the relay (from
+ * this enrolled device). When it is this machine's own registration,
+ * its host setup takes the new name too.
+ */
+ @Throws(CuaException::class)
+ @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
+ override suspend fun `renameMachine`(`machineId`: kotlin.String, `name`: kotlin.String) : RelayMachine {
+ return uniffiRustCallAsync(
+ callWithHandle { uniffiHandle ->
+ UniffiLib.uniffi_cua_sdk_fn_method_devices_rename_machine(
+ uniffiHandle,
+ FfiConverterString.lower(`machineId`),FfiConverterString.lower(`name`),
+ )
+ },
+ { future, callback, continuation -> UniffiLib.ffi_cua_sdk_rust_future_poll_rust_buffer(future, callback, continuation) },
+ { future, continuation -> UniffiLib.ffi_cua_sdk_rust_future_complete_rust_buffer(future, continuation) },
+ { future -> UniffiLib.ffi_cua_sdk_rust_future_free_rust_buffer(future) },
+ // lift function
+ { FfiConverterTypeRelayMachine.lift(it) },
+ // Error FFI converter
+ CuaException.ErrorHandler,
+ )
+ }
+
+
/**
* Revokes a device (from this enrolled device). Revoking this device
* also deletes its key.
@@ -18131,6 +18178,17 @@ public interface SpacesInterface {
*/
suspend fun `listToolsJson`(): kotlin.String
+ /**
+ * A machine's health as its own cua daemon checks it: Local Network
+ * access (and which app macOS holds responsible), free disk,
+ * virtualization, memory left by running Spaces, the permissions
+ * sharing its desktop needs. `machine`: another of your machines, by
+ * id or name (asked over the relay, the mesh or its direct address);
+ * `None` for this one. Read-only; fails plainly when that machine is
+ * offline, not yours, or runs a Cua that predates the check.
+ */
+ suspend fun `machineHealth`(`machine`: kotlin.String?): MachineHealth
+
/**
* Publishes `space` on the cua.ai relay as a machine of the signed-in
* account, the way `cua host setup` publishes this computer: the
@@ -19287,6 +19345,36 @@ open class Spaces: Disposable, AutoCloseable, SpacesInterface
}
+ /**
+ * A machine's health as its own cua daemon checks it: Local Network
+ * access (and which app macOS holds responsible), free disk,
+ * virtualization, memory left by running Spaces, the permissions
+ * sharing its desktop needs. `machine`: another of your machines, by
+ * id or name (asked over the relay, the mesh or its direct address);
+ * `None` for this one. Read-only; fails plainly when that machine is
+ * offline, not yours, or runs a Cua that predates the check.
+ */
+ @Throws(CuaException::class)
+ @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
+ override suspend fun `machineHealth`(`machine`: kotlin.String?) : MachineHealth {
+ return uniffiRustCallAsync(
+ callWithHandle { uniffiHandle ->
+ UniffiLib.uniffi_cua_sdk_fn_method_spaces_machine_health(
+ uniffiHandle,
+ FfiConverterOptionalString.lower(`machine`),
+ )
+ },
+ { future, callback, continuation -> UniffiLib.ffi_cua_sdk_rust_future_poll_rust_buffer(future, callback, continuation) },
+ { future, continuation -> UniffiLib.ffi_cua_sdk_rust_future_complete_rust_buffer(future, continuation) },
+ { future -> UniffiLib.ffi_cua_sdk_rust_future_free_rust_buffer(future) },
+ // lift function
+ { FfiConverterTypeMachineHealth.lift(it) },
+ // Error FFI converter
+ CuaException.ErrorHandler,
+ )
+ }
+
+
/**
* Publishes `space` on the cua.ai relay as a machine of the signed-in
* account, the way `cua host setup` publishes this computer: the
@@ -29248,6 +29336,142 @@ public object FfiConverterTypeLocationInfo: FfiConverterRustBuffer<LocationInfo>
+/**
+ * A machine's health as its own cua daemon checks it.
+ */
+data class MachineHealth (
+ /**
+ * The Cua version of the daemon that checked.
+ */
+ var `cuaVersion`: kotlin.String
+ ,
+ /**
+ * `macos`, `linux`, `windows`.
+ */
+ var `os`: kotlin.String
+ ,
+ /**
+ * Every check, in order.
+ */
+ var `checks`: List<MachineHealthCheck>
+ ,
+ /**
+ * The whole report as JSON (the schema `cua doctor --json` writes).
+ */
+ var `reportJson`: kotlin.String
+
+){
+
+
+
+
+
+ companion object
+}
+
+/**
+ * @suppress
+ */
+public object FfiConverterTypeMachineHealth: FfiConverterRustBuffer<MachineHealth> {
+ override fun read(buf: ByteBuffer): MachineHealth {
+ return MachineHealth(
+ FfiConverterString.read(buf),
+ FfiConverterString.read(buf),
+ FfiConverterSequenceTypeMachineHealthCheck.read(buf),
+ FfiConverterString.read(buf),
+ )
+ }
+
+ override fun allocationSize(value: MachineHealth) = (
+ FfiConverterString.allocationSize(value.`cuaVersion`) +
+ FfiConverterString.allocationSize(value.`os`) +
+ FfiConverterSequenceTypeMachineHealthCheck.allocationSize(value.`checks`) +
+ FfiConverterString.allocationSize(value.`reportJson`)
+ )
+
+ override fun write(value: MachineHealth, buf: ByteBuffer) {
+ FfiConverterString.write(value.`cuaVersion`, buf)
+ FfiConverterString.write(value.`os`, buf)
+ FfiConverterSequenceTypeMachineHealthCheck.write(value.`checks`, buf)
+ FfiConverterString.write(value.`reportJson`, buf)
+ }
+}
+
+
+
+/**
+ * One check of a machine's health ([`Spaces::machine_health`]).
+ */
+data class MachineHealthCheck (
+ /**
+ * `machine.local_network`, `machine.disk`, `machine.virtualization`,
+ * `machine.memory`, `machine.permissions.<id>`.
+ */
+ var `id`: kotlin.String
+ ,
+ /**
+ * `pass`, `warn`, `fail` or `skip`.
+ */
+ var `status`: kotlin.String
+ ,
+ /**
+ * What it found, in one line.
+ */
+ var `message`: kotlin.String
+ ,
+ /**
+ * What to do about a warning or failure.
+ */
+ var `remediation`: kotlin.String
+ ,
+ /**
+ * What a UI needs to word it and offer its fix (`app`, `settings_url`,
+ * `free_gb`, ...).
+ */
+ var `facts`: Map<kotlin.String, kotlin.String>
+
+){
+
+
+
+
+
+ companion object
+}
+
+/**
+ * @suppress
+ */
+public object FfiConverterTypeMachineHealthCheck: FfiConverterRustBuffer<MachineHealthCheck> {
+ override fun read(buf: ByteBuffer): MachineHealthCheck {
+ return MachineHealthCheck(
+ FfiConverterString.read(buf),
+ FfiConverterString.read(buf),
+ FfiConverterString.read(buf),
+ FfiConverterString.read(buf),
+ FfiConverterMapStringString.read(buf),
+ )
+ }
+
+ override fun allocationSize(value: MachineHealthCheck) = (
+ FfiConverterString.allocationSize(value.`id`) +
+ FfiConverterString.allocationSize(value.`status`) +
+ FfiConverterString.allocationSize(value.`message`) +
+ FfiConverterString.allocationSize(value.`remediation`) +
+ FfiConverterMapStringString.allocationSize(value.`facts`)
+ )
+
+ override fun write(value: MachineHealthCheck, buf: ByteBuffer) {
+ FfiConverterString.write(value.`id`, buf)
+ FfiConverterString.write(value.`status`, buf)
+ FfiConverterString.write(value.`message`, buf)
+ FfiConverterString.write(value.`remediation`, buf)
+ FfiConverterMapStringString.write(value.`facts`, buf)
+ }
+}
+
+
+
/**
* Where an MCP endpoint is and what every request needs. Hand it to any
* MCP client (Claude Code, Cursor, the Python or TypeScript SDKs). A
@@ -31319,6 +31543,18 @@ data class RelayMachine (
* device confirms it ([`Devices::confirm_machine`]) (S5).
*/
var `confirmed`: kotlin.Boolean
+ ,
+ /**
+ * The team you reach it through, for a team machine not shared with
+ * you directly.
+ */
+ var `team`: kotlin.String?
+ ,
+ /**
+ * It creates Spaces for its owner's devices, when it said so at
+ * registration (`None` from a host or relay that predates it).
+ */
+ var `providesSpaces`: kotlin.Boolean?
){
@@ -31348,6 +31584,8 @@ public object FfiConverterTypeRelayMachine: FfiConverterRustBuffer<RelayMachine>
FfiConverterSequenceString.read(buf),
FfiConverterSequenceTypeRelayClientInfo.read(buf),
FfiConverterBoolean.read(buf),
+ FfiConverterOptionalString.read(buf),
+ FfiConverterOptionalBoolean.read(buf),
)
}
@@ -31364,7 +31602,9 @@ public object FfiConverterTypeRelayMachine: FfiConverterRustBuffer<RelayMachine>
FfiConverterString.allocationSize(value.`url`) +
FfiConverterSequenceString.allocationSize(value.`allow`) +
FfiConverterSequenceTypeRelayClientInfo.allocationSize(value.`clients`) +
- FfiConverterBoolean.allocationSize(value.`confirmed`)
+ FfiConverterBoolean.allocationSize(value.`confirmed`) +
+ FfiConverterOptionalString.allocationSize(value.`team`) +
+ FfiConverterOptionalBoolean.allocationSize(value.`providesSpaces`)
)
override fun write(value: RelayMachine, buf: ByteBuffer) {
@@ -31381,6 +31621,8 @@ public object FfiConverterTypeRelayMachine: FfiConverterRustBuffer<RelayMachine>
FfiConverterSequenceString.write(value.`allow`, buf)
FfiConverterSequenceTypeRelayClientInfo.write(value.`clients`, buf)
FfiConverterBoolean.write(value.`confirmed`, buf)
+ FfiConverterOptionalString.write(value.`team`, buf)
+ FfiConverterOptionalBoolean.write(value.`providesSpaces`, buf)
}
}
@@ -41104,6 +41346,34 @@ public object FfiConverterSequenceTypeLocationInfo: FfiConverterRustBuffer<List<
+/**
+ * @suppress
+ */
+public object FfiConverterSequenceTypeMachineHealthCheck: FfiConverterRustBuffer<List<MachineHealthCheck>> {
+ override fun read(buf: ByteBuffer): List<MachineHealthCheck> {
+ val len = buf.getInt()
+ return List<MachineHealthCheck>(len) {
+ FfiConverterTypeMachineHealthCheck.read(buf)
+ }
+ }
+
+ override fun allocationSize(value: List<MachineHealthCheck>): ULong {
+ val sizeForLength = 4UL
+ val sizeForItems = value.map { FfiConverterTypeMachineHealthCheck.allocationSize(it) }.sum()
+ return sizeForLength + sizeForItems
+ }
+
+ override fun write(value: List<MachineHealthCheck>, buf: ByteBuffer) {
+ buf.putInt(value.size)
+ value.iterator().forEach {
+ FfiConverterTypeMachineHealthCheck.write(it, buf)
+ }
+ }
+}
+
+
+
+
/**
* @suppress
*/
diff --git a/libs/cua/proto/cua/env/v1/host.proto b/libs/cua/proto/cua/env/v1/host.proto
index 82f6fc6c25..015247c6f6 100644
--- a/libs/cua/proto/cua/env/v1/host.proto
+++ b/libs/cua/proto/cua/env/v1/host.proto
@@ -2,6 +2,7 @@ syntax = "proto3";
package cua.env.v1;
+import "cua/env/v1/diagnose.proto";
import "cua/env/v1/system.proto";
// Spaces a host provides: a machine set up with `cua host setup
@@ -58,6 +59,34 @@ service HostSpacesService {
// delete it permanently without the cloud's credentials. Works whether or
// not this machine provides Spaces.
rpc DeleteCloudSpace(DeleteCloudSpaceRequest) returns (DeleteCloudSpaceResponse);
+ // This machine's health as a place to run Spaces, checked by its cua
+ // daemon (the process that runs them): Local Network access and the app
+ // macOS holds responsible for it, free disk, virtualization, memory, and
+ // the permissions sharing its desktop needs. Read-only and bounded (a
+ // few seconds). Only the owner. Works whether or not this machine
+ // provides Spaces. The Machines page shows the warnings and failures as
+ // the machine's issues; `cua doctor --machine` prints them.
+ rpc DiagnoseHost(DiagnoseHostRequest) returns (DiagnoseHostResponse);
+}
+
+// Request for `HostSpacesService.DiagnoseHost`.
+message DiagnoseHostRequest {
+ // Another of the owner's machines to check instead, by id or name: the
+ // cua daemon asks that machine's own `DiagnoseHost` over the relay (or
+ // the mesh, or its direct address). Only for a call made on this machine
+ // itself; a host's cua-spacesd clears it on calls it forwards. Empty:
+ // this machine.
+ string machine = 1;
+}
+
+// Response for `HostSpacesService.DiagnoseHost`.
+message DiagnoseHostResponse {
+ // The checks (ids `machine.*`), in the report schema `cua doctor` uses.
+ DiagnoseReport report = 1;
+ // The Cua version of the daemon that ran them.
+ string cua_version = 2;
+ // The machine's operating system (`macos`, `linux`, `windows`).
+ string os = 3;
}
// The host's two independent settings and its limits.
diff --git a/libs/cua/python/src/cua/_native.py b/libs/cua/python/src/cua/_native.py
index e26fe2b02e..8c32765ecc 100644
--- a/libs/cua/python/src/cua/_native.py
+++ b/libs/cua/python/src/cua/_native.py
@@ -707,6 +707,8 @@ def _uniffi_check_api_checksums(lib):
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cua_sdk_checksum_method_devices_rename() != 59535:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cua_sdk_checksum_method_devices_rename_machine() != 63088:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cua_sdk_checksum_method_devices_revoke() != 27802:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cua_sdk_checksum_method_devices_revoke_pairing_code() != 3143:
@@ -1109,6 +1111,8 @@ def _uniffi_check_api_checksums(lib):
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cua_sdk_checksum_method_spaces_list_tools_json() != 19259:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cua_sdk_checksum_method_spaces_machine_health() != 35352:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cua_sdk_checksum_method_spaces_notifications() != 10964:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cua_sdk_checksum_method_spaces_notifications_ack() != 64477:
@@ -2547,6 +2551,12 @@ _UniffiLib.uniffi_cua_sdk_fn_method_devices_rename.argtypes = (
_UniffiRustBuffer,
)
_UniffiLib.uniffi_cua_sdk_fn_method_devices_rename.restype = ctypes.c_uint64
+_UniffiLib.uniffi_cua_sdk_fn_method_devices_rename_machine.argtypes = (
+ ctypes.c_uint64,
+ _UniffiRustBuffer,
+ _UniffiRustBuffer,
+)
+_UniffiLib.uniffi_cua_sdk_fn_method_devices_rename_machine.restype = ctypes.c_uint64
_UniffiLib.uniffi_cua_sdk_fn_method_devices_revoke.argtypes = (
ctypes.c_uint64,
_UniffiRustBuffer,
@@ -3597,6 +3607,11 @@ _UniffiLib.uniffi_cua_sdk_fn_method_spaces_list_tools_json.argtypes = (
ctypes.c_uint64,
)
_UniffiLib.uniffi_cua_sdk_fn_method_spaces_list_tools_json.restype = ctypes.c_uint64
+_UniffiLib.uniffi_cua_sdk_fn_method_spaces_machine_health.argtypes = (
+ ctypes.c_uint64,
+ _UniffiRustBuffer,
+)
+_UniffiLib.uniffi_cua_sdk_fn_method_spaces_machine_health.restype = ctypes.c_uint64
_UniffiLib.uniffi_cua_sdk_fn_method_spaces_notifications.argtypes = (
ctypes.c_uint64,
ctypes.c_int8,
@@ -4486,6 +4501,9 @@ _UniffiLib.uniffi_cua_sdk_checksum_method_devices_relay_url.restype = ctypes.c_u
_UniffiLib.uniffi_cua_sdk_checksum_method_devices_rename.argtypes = (
)
_UniffiLib.uniffi_cua_sdk_checksum_method_devices_rename.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cua_sdk_checksum_method_devices_rename_machine.argtypes = (
+)
+_UniffiLib.uniffi_cua_sdk_checksum_method_devices_rename_machine.restype = ctypes.c_uint16
_UniffiLib.uniffi_cua_sdk_checksum_method_devices_revoke.argtypes = (
)
_UniffiLib.uniffi_cua_sdk_checksum_method_devices_revoke.restype = ctypes.c_uint16
@@ -5089,6 +5107,9 @@ _UniffiLib.uniffi_cua_sdk_checksum_method_spaces_list.restype = ctypes.c_uint16
_UniffiLib.uniffi_cua_sdk_checksum_method_spaces_list_tools_json.argtypes = (
)
_UniffiLib.uniffi_cua_sdk_checksum_method_spaces_list_tools_json.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cua_sdk_checksum_method_spaces_machine_health.argtypes = (
+)
+_UniffiLib.uniffi_cua_sdk_checksum_method_spaces_machine_health.restype = ctypes.c_uint16
_UniffiLib.uniffi_cua_sdk_checksum_method_spaces_notifications.argtypes = (
)
_UniffiLib.uniffi_cua_sdk_checksum_method_spaces_notifications.restype = ctypes.c_uint16
@@ -9542,7 +9563,7 @@ class RelayMachine:
"""
A machine of the account's relay directory (`relay:<id>`).
"""
- def __init__(self, *, id:str, space_id:str, name:str, owner_id:str, owner_email:typing.Optional[str], role:str, online:bool, sharing:bool, version:str, url:str, allow:typing.List[str], clients:typing.List[RelayClientInfo], confirmed:bool):
+ def __init__(self, *, id:str, space_id:str, name:str, owner_id:str, owner_email:typing.Optional[str], role:str, online:bool, sharing:bool, version:str, url:str, allow:typing.List[str], clients:typing.List[RelayClientInfo], confirmed:bool, team:typing.Optional[str], provides_spaces:typing.Optional[bool]):
self.id = id
self.space_id = space_id
self.name = name
@@ -9556,12 +9577,14 @@ class RelayMachine:
self.allow = allow
self.clients = clients
self.confirmed = confirmed
+ self.team = team
+ self.provides_spaces = provides_spaces
def __str__(self):
- return "RelayMachine(id={}, space_id={}, name={}, owner_id={}, owner_email={}, role={}, online={}, sharing={}, version={}, url={}, allow={}, clients={}, confirmed={})".format(self.id, self.space_id, self.name, self.owner_id, self.owner_email, self.role, self.online, self.sharing, self.version, self.url, self.allow, self.clients, self.confirmed)
+ return "RelayMachine(id={}, space_id={}, name={}, owner_id={}, owner_email={}, role={}, online={}, sharing={}, version={}, url={}, allow={}, clients={}, confirmed={}, team={}, provides_spaces={})".format(self.id, self.space_id, self.name, self.owner_id, self.owner_email, self.role, self.online, self.sharing, self.version, self.url, self.allow, self.clients, self.confirmed, self.team, self.provides_spaces)
def __eq__(self, other):
if self.id != other.id:
return False
@@ -9589,6 +9612,10 @@ class RelayMachine:
return False
if self.confirmed != other.confirmed:
return False
+ if self.team != other.team:
+ return False
+ if self.provides_spaces != other.provides_spaces:
+ return False
return True
class _UniffiFfiConverterTypeRelayMachine(_UniffiConverterRustBuffer):
@@ -9608,6 +9635,8 @@ class _UniffiFfiConverterTypeRelayMachine(_UniffiConverterRustBuffer):
allow=_UniffiFfiConverterSequenceString.read(buf),
clients=_UniffiFfiConverterSequenceTypeRelayClientInfo.read(buf),
confirmed=_UniffiFfiConverterBoolean.read(buf),
+ team=_UniffiFfiConverterOptionalString.read(buf),
+ provides_spaces=_UniffiFfiConverterOptionalBoolean.read(buf),
)
@staticmethod
@@ -9625,6 +9654,8 @@ class _UniffiFfiConverterTypeRelayMachine(_UniffiConverterRustBuffer):
_UniffiFfiConverterSequenceString.check_lower(value.allow)
_UniffiFfiConverterSequenceTypeRelayClientInfo.check_lower(value.clients)
_UniffiFfiConverterBoolean.check_lower(value.confirmed)
+ _UniffiFfiConverterOptionalString.check_lower(value.team)
+ _UniffiFfiConverterOptionalBoolean.check_lower(value.provides_spaces)
@staticmethod
def write(value, buf):
@@ -9641,6 +9672,8 @@ class _UniffiFfiConverterTypeRelayMachine(_UniffiConverterRustBuffer):
_UniffiFfiConverterSequenceString.write(value.allow, buf)
_UniffiFfiConverterSequenceTypeRelayClientInfo.write(value.clients, buf)
_UniffiFfiConverterBoolean.write(value.confirmed, buf)
+ _UniffiFfiConverterOptionalString.write(value.team, buf)
+ _UniffiFfiConverterOptionalBoolean.write(value.provides_spaces, buf)
class _UniffiFfiConverterSequenceTypeRelayMachine(_UniffiConverterRustBuffer):
@classmethod
@@ -13667,6 +13700,137 @@ class _UniffiFfiConverterTypeLocationInfo(_UniffiConverterRustBuffer):
_UniffiFfiConverterSequenceString.write(value.kinds, buf)
_UniffiFfiConverterMapStringSequenceString.write(value.runtimes, buf)
+@dataclass
+class MachineHealthCheck:
+ """
+ One check of a machine's health ([`Spaces::machine_health`]).
+"""
+ def __init__(self, *, id:str, status:str, message:str, remediation:str, facts:dict[str, str]):
+ self.id = id
+ self.status = status
+ self.message = message
+ self.remediation = remediation
+ self.facts = facts
+
+
+
+
+ def __str__(self):
+ return "MachineHealthCheck(id={}, status={}, message={}, remediation={}, facts={})".format(self.id, self.status, self.message, self.remediation, self.facts)
+ def __eq__(self, other):
+ if self.id != other.id:
+ return False
+ if self.status != other.status:
+ return False
+ if self.message != other.message:
+ return False
+ if self.remediation != other.remediation:
+ return False
+ if self.facts != other.facts:
+ return False
+ return True
+
+class _UniffiFfiConverterTypeMachineHealthCheck(_UniffiConverterRustBuffer):
+ @staticmethod
+ def read(buf):
+ return MachineHealthCheck(
+ id=_UniffiFfiConverterString.read(buf),
+ status=_UniffiFfiConverterString.read(buf),
+ message=_UniffiFfiConverterString.read(buf),
+ remediation=_UniffiFfiConverterString.read(buf),
+ facts=_UniffiFfiConverterMapStringString.read(buf),
+ )
+
+ @staticmethod
+ def check_lower(value):
+ _UniffiFfiConverterString.check_lower(value.id)
+ _UniffiFfiConverterString.check_lower(value.status)
+ _UniffiFfiConverterString.check_lower(value.message)
+ _UniffiFfiConverterString.check_lower(value.remediation)
+ _UniffiFfiConverterMapStringString.check_lower(value.facts)
+
+ @staticmethod
+ def write(value, buf):
+ _UniffiFfiConverterString.write(value.id, buf)
+ _UniffiFfiConverterString.write(value.status, buf)
+ _UniffiFfiConverterString.write(value.message, buf)
+ _UniffiFfiConverterString.write(value.remediation, buf)
+ _UniffiFfiConverterMapStringString.write(value.facts, buf)
+
+class _UniffiFfiConverterSequenceTypeMachineHealthCheck(_UniffiConverterRustBuffer):
+ @classmethod
+ def check_lower(cls, value):
+ for item in value:
+ _UniffiFfiConverterTypeMachineHealthCheck.check_lower(item)
+
+ @classmethod
+ def write(cls, value, buf):
+ items = len(value)
+ buf.write_i32(items)
+ for item in value:
+ _UniffiFfiConverterTypeMachineHealthCheck.write(item, buf)
+
+ @classmethod
+ def read(cls, buf):
+ count = buf.read_i32()
+ if count < 0:
+ raise InternalError("Unexpected negative sequence length")
+
+ return [
+ _UniffiFfiConverterTypeMachineHealthCheck.read(buf) for i in range(count)
+ ]
+
+@dataclass
+class MachineHealth:
+ """
+ A machine's health as its own cua daemon checks it.
+"""
+ def __init__(self, *, cua_version:str, os:str, checks:typing.List[MachineHealthCheck], report_json:str):
+ self.cua_version = cua_version
+ self.os = os
+ self.checks = checks
+ self.report_json = report_json
+
+
+
+
+ def __str__(self):
+ return "MachineHealth(cua_version={}, os={}, checks={}, report_json={})".format(self.cua_version, self.os, self.checks, self.report_json)
+ def __eq__(self, other):
+ if self.cua_version != other.cua_version:
+ return False
+ if self.os != other.os:
+ return False
+ if self.checks != other.checks:
+ return False
+ if self.report_json != other.report_json:
+ return False
+ return True
+
+class _UniffiFfiConverterTypeMachineHealth(_UniffiConverterRustBuffer):
+ @staticmethod
+ def read(buf):
+ return MachineHealth(
+ cua_version=_UniffiFfiConverterString.read(buf),
+ os=_UniffiFfiConverterString.read(buf),
+ checks=_UniffiFfiConverterSequenceTypeMachineHealthCheck.read(buf),
+ report_json=_UniffiFfiConverterString.read(buf),
+ )
+
+ @staticmethod
+ def check_lower(value):
+ _UniffiFfiConverterString.check_lower(value.cua_version)
+ _UniffiFfiConverterString.check_lower(value.os)
+ _UniffiFfiConverterSequenceTypeMachineHealthCheck.check_lower(value.checks)
+ _UniffiFfiConverterString.check_lower(value.report_json)
+
+ @staticmethod
+ def write(value, buf):
+ _UniffiFfiConverterString.write(value.cua_version, buf)
+ _UniffiFfiConverterString.write(value.os, buf)
+ _UniffiFfiConverterSequenceTypeMachineHealthCheck.write(value.checks, buf)
+ _UniffiFfiConverterString.write(value.report_json, buf)
+
@dataclass
class McpConfig:
"""
@@ -23520,6 +23684,13 @@ class DevicesProtocol(typing.Protocol):
async def rename(self, id: str,name: str) -> RelayDevice:
"""
Renames a device (from this enrolled device).
+"""
+ raise NotImplementedError
+ async def rename_machine(self, machine_id: str,name: str) -> RelayMachine:
+ """
+ Renames `machine_id`, a machine the account owns, on the relay (from
+ this enrolled device). When it is this machine's own registration,
+ its host setup takes the new name too.
"""
raise NotImplementedError
async def revoke(self, id: str) -> RelayDevice:
@@ -23758,6 +23929,31 @@ class Devices(DevicesProtocol):
_uniffi_lift_return,
_uniffi_error_converter,
)
+ async def rename_machine(self, machine_id: str,name: str) -> RelayMachine:
+ """
+ Renames `machine_id`, a machine the account owns, on the relay (from
+ this enrolled device). When it is this machine's own registration,
+ its host setup takes the new name too.
+"""
+
+ _UniffiFfiConverterString.check_lower(machine_id)
+
+ _UniffiFfiConverterString.check_lower(name)
+ _uniffi_lowered_args = (
+ self._uniffi_clone_handle(),
+ _UniffiFfiConverterString.lower(machine_id),
+ _UniffiFfiConverterString.lower(name),
+ )
+ _uniffi_lift_return = _UniffiFfiConverterTypeRelayMachine.lift
+ _uniffi_error_converter = _UniffiFfiConverterTypeCuaError
+ return await _uniffi_rust_call_async(
+ _UniffiLib.uniffi_cua_sdk_fn_method_devices_rename_machine(*_uniffi_lowered_args),
+ _UniffiLib.ffi_cua_sdk_rust_future_poll_rust_buffer,
+ _UniffiLib.ffi_cua_sdk_rust_future_complete_rust_buffer,
+ _UniffiLib.ffi_cua_sdk_rust_future_free_rust_buffer,
+ _uniffi_lift_return,
+ _uniffi_error_converter,
+ )
async def revoke(self, id: str) -> RelayDevice:
"""
Revokes a device (from this enrolled device). Revoking this device
@@ -32168,6 +32364,17 @@ class SpacesProtocol(typing.Protocol):
async def list_tools_json(self, ) -> str:
"""
The Spaces MCP `tools/list` result as JSON (the contract).
+"""
+ raise NotImplementedError
+ async def machine_health(self, machine: typing.Optional[str]) -> MachineHealth:
+ """
+ A machine's health as its own cua daemon checks it: Local Network
+ access (and which app macOS holds responsible), free disk,
+ virtualization, memory left by running Spaces, the permissions
+ sharing its desktop needs. `machine`: another of your machines, by
+ id or name (asked over the relay, the mesh or its direct address);
+ `None` for this one. Read-only; fails plainly when that machine is
+ offline, not yours, or runs a Cua that predates the check.
"""
raise NotImplementedError
async def notifications(self, unread_only: bool,since_ms: typing.Optional[int]) -> typing.List[NotificationInfo]:
@@ -32974,6 +33181,32 @@ class Spaces(SpacesProtocol):
_uniffi_lift_return,
_uniffi_error_converter,
)
+ async def machine_health(self, machine: typing.Optional[str]) -> MachineHealth:
+ """
+ A machine's health as its own cua daemon checks it: Local Network
+ access (and which app macOS holds responsible), free disk,
+ virtualization, memory left by running Spaces, the permissions
+ sharing its desktop needs. `machine`: another of your machines, by
+ id or name (asked over the relay, the mesh or its direct address);
+ `None` for this one. Read-only; fails plainly when that machine is
+ offline, not yours, or runs a Cua that predates the check.
+"""
+
+ _UniffiFfiConverterOptionalString.check_lower(machine)
+ _uniffi_lowered_args = (
+ self._uniffi_clone_handle(),
+ _UniffiFfiConverterOptionalString.lower(machine),
+ )
+ _uniffi_lift_return = _UniffiFfiConverterTypeMachineHealth.lift
+ _uniffi_error_converter = _UniffiFfiConverterTypeCuaError
+ return await _uniffi_rust_call_async(
+ _UniffiLib.uniffi_cua_sdk_fn_method_spaces_machine_health(*_uniffi_lowered_args),
+ _UniffiLib.ffi_cua_sdk_rust_future_poll_rust_buffer,
+ _UniffiLib.ffi_cua_sdk_rust_future_complete_rust_buffer,
+ _UniffiLib.ffi_cua_sdk_rust_future_free_rust_buffer,
+ _uniffi_lift_return,
+ _uniffi_error_converter,
+ )
async def notifications(self, unread_only: bool,since_ms: typing.Optional[int]) -> typing.List[NotificationInfo]:
"""
The notifications feed, newest first.
@@ -36090,6 +36323,8 @@ __all__ = [
"StorageVolume",
"LocalStorage",
"LocationInfo",
+ "MachineHealthCheck",
+ "MachineHealth",
"McpConfig",
"MediaBridge",
"MediaEvent",
diff --git a/libs/cua/scripts/generate-app-core-ffi.py b/libs/cua/scripts/generate-app-core-ffi.py
index 43b73194c3..b0588cd623 100644
--- a/libs/cua/scripts/generate-app-core-ffi.py
+++ b/libs/cua/scripts/generate-app-core-ffi.py
@@ -67,6 +67,8 @@ TYPES = [
("notifications.rs", "notifications", ["NotificationInput", "SystemNote", "NotificationsPlan", "NotificationsView"]),
("telemetry.rs", "telemetry", ["TelemetrySignal"]),
("machines.rs", "machines", ["DeviceIn", "MachinesPageInput", "MachinePageRow"]),
+ ("machines_health.rs", "machines_health", ["MachinesViewCheck", "MachinesViewHealth", "MachinesViewIssueAction", "MachinesViewIssue"]),
+ ("machines_view.rs", "machines_view", ["MachinesViewRelay", "MachinesViewAbout", "MachinesViewInput", "MachinesViewToggle", "MachinesViewSpace", "MachinesViewNewSpace", "MachinesViewRename", "MachinesViewRemove", "MachinesViewFact", "MachinesViewMachine", "MachinesViewRemoveAll", "MachinesViewGroup", "MachinesView"]),
("checklist.rs", "checklist", ["ChecklistStep", "ChecklistState", "ChecklistAction", "ChecklistSeen", "ChecklistTransition", "ChecklistRow", "ChecklistView"]),
("palette.rs", "palette", ["Keybinding", "PaletteEntry"]),
("teams.rs", "teams", ["TeamPersonInput", "TeamInput", "TeamsState", "TeamsInput"]),
diff --git a/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift b/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift
index 4c2eae2b08..beac67998e 100644
--- a/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift
+++ b/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift
@@ -2629,6 +2629,13 @@ public protocol DevicesProtocol: AnyObject, Sendable {
*/
func rename(id: String, name: String) async throws -> RelayDevice
+ /**
+ * Renames `machine_id`, a machine the account owns, on the relay (from
+ * this enrolled device). When it is this machine's own registration,
+ * its host setup takes the new name too.
+ */
+ func renameMachine(machineId: String, name: String) async throws -> RelayMachine
+
/**
* Revokes a device (from this enrolled device). Revoking this device
* also deletes its key.
@@ -2880,6 +2887,28 @@ open func rename(id: String, name: String)async throws -> RelayDevice {
)
}
+ /**
+ * Renames `machine_id`, a machine the account owns, on the relay (from
+ * this enrolled device). When it is this machine's own registration,
+ * its host setup takes the new name too.
+ */
+open func renameMachine(machineId: String, name: String)async throws -> RelayMachine {
+ return
+ try await uniffiRustCallAsync(
+ rustFutureFunc: {
+ uniffi_cua_sdk_fn_method_devices_rename_machine(
+ self.uniffiCloneHandle(),
+ FfiConverterString.lower(machineId),FfiConverterString.lower(name)
+ )
+ },
+ pollFunc: ffi_cua_sdk_rust_future_poll_rust_buffer,
+ completeFunc: ffi_cua_sdk_rust_future_complete_rust_buffer,
+ freeFunc: ffi_cua_sdk_rust_future_free_rust_buffer,
+ liftFunc: FfiConverterTypeRelayMachine_lift,
+ errorHandler: FfiConverterTypeCuaError_lift
+ )
+}
+
/**
* Revokes a device (from this enrolled device). Revoking this device
* also deletes its key.
@@ -9781,6 +9810,17 @@ public protocol SpacesProtocol: AnyObject, Sendable {
*/
func listToolsJson() async throws -> String
+ /**
+ * A machine's health as its own cua daemon checks it: Local Network
+ * access (and which app macOS holds responsible), free disk,
+ * virtualization, memory left by running Spaces, the permissions
+ * sharing its desktop needs. `machine`: another of your machines, by
+ * id or name (asked over the relay, the mesh or its direct address);
+ * `None` for this one. Read-only; fails plainly when that machine is
+ * offline, not yours, or runs a Cua that predates the check.
+ */
+ func machineHealth(machine: String?) async throws -> MachineHealth
+
/**
* Publishes `space` on the cua.ai relay as a machine of the signed-in
* account, the way `cua host setup` publishes this computer: the
@@ -10754,6 +10794,32 @@ open func listToolsJson()async throws -> String {
)
}
+ /**
+ * A machine's health as its own cua daemon checks it: Local Network
+ * access (and which app macOS holds responsible), free disk,
+ * virtualization, memory left by running Spaces, the permissions
+ * sharing its desktop needs. `machine`: another of your machines, by
+ * id or name (asked over the relay, the mesh or its direct address);
+ * `None` for this one. Read-only; fails plainly when that machine is
+ * offline, not yours, or runs a Cua that predates the check.
+ */
+open func machineHealth(machine: String?)async throws -> MachineHealth {
+ return
+ try await uniffiRustCallAsync(
+ rustFutureFunc: {
+ uniffi_cua_sdk_fn_method_spaces_machine_health(
+ self.uniffiCloneHandle(),
+ FfiConverterOptionString.lower(machine)
+ )
+ },
+ pollFunc: ffi_cua_sdk_rust_future_poll_rust_buffer,
+ completeFunc: ffi_cua_sdk_rust_future_complete_rust_buffer,
+ freeFunc: ffi_cua_sdk_rust_future_free_rust_buffer,
+ liftFunc: FfiConverterTypeMachineHealth_lift,
+ errorHandler: FfiConverterTypeCuaError_lift
+ )
+}
+
/**
* Publishes `space` on the cua.ai relay as a machine of the signed-in
* account, the way `cua host setup` publishes this computer: the
@@ -22191,6 +22257,198 @@ public func FfiConverterTypeLocationInfo_lower(_ value: LocationInfo) -> RustBuf
}
+/**
+ * A machine's health as its own cua daemon checks it.
+ */
+public struct MachineHealth: Equatable, Hashable {
+ /**
+ * The Cua version of the daemon that checked.
+ */
+ public var cuaVersion: String
+ /**
+ * `macos`, `linux`, `windows`.
+ */
+ public var os: String
+ /**
+ * Every check, in order.
+ */
+ public var checks: [MachineHealthCheck]
+ /**
+ * The whole report as JSON (the schema `cua doctor --json` writes).
+ */
+ public var reportJson: String
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ /**
+ * The Cua version of the daemon that checked.
+ */cuaVersion: String,
+ /**
+ * `macos`, `linux`, `windows`.
+ */os: String,
+ /**
+ * Every check, in order.
+ */checks: [MachineHealthCheck],
+ /**
+ * The whole report as JSON (the schema `cua doctor --json` writes).
+ */reportJson: String) {
+ self.cuaVersion = cuaVersion
+ self.os = os
+ self.checks = checks
+ self.reportJson = reportJson
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension MachineHealth: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeMachineHealth: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MachineHealth {
+ return
+ try MachineHealth(
+ cuaVersion: FfiConverterString.read(from: &buf),
+ os: FfiConverterString.read(from: &buf),
+ checks: FfiConverterSequenceTypeMachineHealthCheck.read(from: &buf),
+ reportJson: FfiConverterString.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: MachineHealth, into buf: inout [UInt8]) {
+ FfiConverterString.write(value.cuaVersion, into: &buf)
+ FfiConverterString.write(value.os, into: &buf)
+ FfiConverterSequenceTypeMachineHealthCheck.write(value.checks, into: &buf)
+ FfiConverterString.write(value.reportJson, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeMachineHealth_lift(_ buf: RustBuffer) throws -> MachineHealth {
+ return try FfiConverterTypeMachineHealth.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeMachineHealth_lower(_ value: MachineHealth) -> RustBuffer {
+ return FfiConverterTypeMachineHealth.lower(value)
+}
+
+
+/**
+ * One check of a machine's health ([`Spaces::machine_health`]).
+ */
+public struct MachineHealthCheck: Equatable, Hashable {
+ /**
+ * `machine.local_network`, `machine.disk`, `machine.virtualization`,
+ * `machine.memory`, `machine.permissions.<id>`.
+ */
+ public var id: String
+ /**
+ * `pass`, `warn`, `fail` or `skip`.
+ */
+ public var status: String
+ /**
+ * What it found, in one line.
+ */
+ public var message: String
+ /**
+ * What to do about a warning or failure.
+ */
+ public var remediation: String
+ /**
+ * What a UI needs to word it and offer its fix (`app`, `settings_url`,
+ * `free_gb`, ...).
+ */
+ public var facts: [String: String]
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ /**
+ * `machine.local_network`, `machine.disk`, `machine.virtualization`,
+ * `machine.memory`, `machine.permissions.<id>`.
+ */id: String,
+ /**
+ * `pass`, `warn`, `fail` or `skip`.
+ */status: String,
+ /**
+ * What it found, in one line.
+ */message: String,
+ /**
+ * What to do about a warning or failure.
+ */remediation: String,
+ /**
+ * What a UI needs to word it and offer its fix (`app`, `settings_url`,
+ * `free_gb`, ...).
+ */facts: [String: String]) {
+ self.id = id
+ self.status = status
+ self.message = message
+ self.remediation = remediation
+ self.facts = facts
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension MachineHealthCheck: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeMachineHealthCheck: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MachineHealthCheck {
+ return
+ try MachineHealthCheck(
+ id: FfiConverterString.read(from: &buf),
+ status: FfiConverterString.read(from: &buf),
+ message: FfiConverterString.read(from: &buf),
+ remediation: FfiConverterString.read(from: &buf),
+ facts: FfiConverterDictionaryStringString.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: MachineHealthCheck, into buf: inout [UInt8]) {
+ FfiConverterString.write(value.id, into: &buf)
+ FfiConverterString.write(value.status, into: &buf)
+ FfiConverterString.write(value.message, into: &buf)
+ FfiConverterString.write(value.remediation, into: &buf)
+ FfiConverterDictionaryStringString.write(value.facts, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeMachineHealthCheck_lift(_ buf: RustBuffer) throws -> MachineHealthCheck {
+ return try FfiConverterTypeMachineHealthCheck.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeMachineHealthCheck_lower(_ value: MachineHealthCheck) -> RustBuffer {
+ return FfiConverterTypeMachineHealthCheck.lower(value)
+}
+
+
/**
* Where an MCP endpoint is and what every request needs. Hand it to any
* MCP client (Claude Code, Cursor, the Python or TypeScript SDKs). A
@@ -25001,6 +25259,16 @@ public struct RelayMachine: Equatable, Hashable {
* device confirms it ([`Devices::confirm_machine`]) (S5).
*/
public var confirmed: Bool
+ /**
+ * The team you reach it through, for a team machine not shared with
+ * you directly.
+ */
+ public var team: String?
+ /**
+ * It creates Spaces for its owner's devices, when it said so at
+ * registration (`None` from a host or relay that predates it).
+ */
+ public var providesSpaces: Bool?
// Default memberwise initializers are never public by default, so we
// declare one manually.
@@ -25046,7 +25314,15 @@ public struct RelayMachine: Equatable, Hashable {
* since from one; `true` for anything a relay registered before this
* check existed. `false` shows the machine as "new" until an enrolled
* device confirms it ([`Devices::confirm_machine`]) (S5).
- */confirmed: Bool) {
+ */confirmed: Bool,
+ /**
+ * The team you reach it through, for a team machine not shared with
+ * you directly.
+ */team: String?,
+ /**
+ * It creates Spaces for its owner's devices, when it said so at
+ * registration (`None` from a host or relay that predates it).
+ */providesSpaces: Bool?) {
self.id = id
self.spaceId = spaceId
self.name = name
@@ -25060,6 +25336,8 @@ public struct RelayMachine: Equatable, Hashable {
self.allow = allow
self.clients = clients
self.confirmed = confirmed
+ self.team = team
+ self.providesSpaces = providesSpaces
}
@@ -25090,7 +25368,9 @@ public struct FfiConverterTypeRelayMachine: FfiConverterRustBuffer {
url: FfiConverterString.read(from: &buf),
allow: FfiConverterSequenceString.read(from: &buf),
clients: FfiConverterSequenceTypeRelayClientInfo.read(from: &buf),
- confirmed: FfiConverterBool.read(from: &buf)
+ confirmed: FfiConverterBool.read(from: &buf),
+ team: FfiConverterOptionString.read(from: &buf),
+ providesSpaces: FfiConverterOptionBool.read(from: &buf)
)
}
@@ -25108,6 +25388,8 @@ public struct FfiConverterTypeRelayMachine: FfiConverterRustBuffer {
FfiConverterSequenceString.write(value.allow, into: &buf)
FfiConverterSequenceTypeRelayClientInfo.write(value.clients, into: &buf)
FfiConverterBool.write(value.confirmed, into: &buf)
+ FfiConverterOptionString.write(value.team, into: &buf)
+ FfiConverterOptionBool.write(value.providesSpaces, into: &buf)
}
}
@@ -36805,6 +37087,31 @@ fileprivate struct FfiConverterSequenceTypeLocationInfo: FfiConverterRustBuffer
}
}
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+fileprivate struct FfiConverterSequenceTypeMachineHealthCheck: FfiConverterRustBuffer {
+ typealias SwiftType = [MachineHealthCheck]
+
+ public static func write(_ value: [MachineHealthCheck], into buf: inout [UInt8]) {
+ let len = Int32(value.count)
+ writeInt(&buf, len)
+ for item in value {
+ FfiConverterTypeMachineHealthCheck.write(item, into: &buf)
+ }
+ }
+
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [MachineHealthCheck] {
+ let len: Int32 = try readInt(&buf)
+ var seq = [MachineHealthCheck]()
+ seq.reserveCapacity(Int(len))
+ for _ in 0 ..< len {
+ seq.append(try FfiConverterTypeMachineHealthCheck.read(from: &buf))
+ }
+ return seq
+ }
+}
+
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
@@ -38734,6 +39041,9 @@ private let initializationResult: InitializationResult = {
if (uniffi_cua_sdk_checksum_method_devices_rename() != 59535) {
return InitializationResult.apiChecksumMismatch
}
+ if (uniffi_cua_sdk_checksum_method_devices_rename_machine() != 63088) {
+ return InitializationResult.apiChecksumMismatch
+ }
if (uniffi_cua_sdk_checksum_method_devices_revoke() != 27802) {
return InitializationResult.apiChecksumMismatch
}
@@ -39352,6 +39662,9 @@ private let initializationResult: InitializationResult = {
if (uniffi_cua_sdk_checksum_method_spaces_list_tools_json() != 19259) {
return InitializationResult.apiChecksumMismatch
}
+ if (uniffi_cua_sdk_checksum_method_spaces_machine_health() != 35352) {
+ return InitializationResult.apiChecksumMismatch
+ }
if (uniffi_cua_sdk_checksum_method_spaces_relay_register() != 31691) {
return InitializationResult.apiChecksumMismatch
}
diff --git a/libs/cua/swift/Sources/cua_sdkFFI/include/cua_sdkFFI.h b/libs/cua/swift/Sources/cua_sdkFFI/include/cua_sdkFFI.h
index 09a805d368..e1bbf8b903 100644
--- a/libs/cua/swift/Sources/cua_sdkFFI/include/cua_sdkFFI.h
+++ b/libs/cua/swift/Sources/cua_sdkFFI/include/cua_sdkFFI.h
@@ -737,6 +737,11 @@ RustBuffer uniffi_cua_sdk_fn_method_devices_relay_url(uint64_t ptr, RustCallStat
uint64_t uniffi_cua_sdk_fn_method_devices_rename(uint64_t ptr, RustBuffer id, RustBuffer name
);
#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_METHOD_DEVICES_RENAME_MACHINE
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_METHOD_DEVICES_RENAME_MACHINE
+uint64_t uniffi_cua_sdk_fn_method_devices_rename_machine(uint64_t ptr, RustBuffer machine_id, RustBuffer name
+);
+#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_METHOD_DEVICES_REVOKE
#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_METHOD_DEVICES_REVOKE
uint64_t uniffi_cua_sdk_fn_method_devices_revoke(uint64_t ptr, RustBuffer id
@@ -2002,6 +2007,11 @@ uint64_t uniffi_cua_sdk_fn_method_spaces_list(uint64_t ptr
uint64_t uniffi_cua_sdk_fn_method_spaces_list_tools_json(uint64_t ptr
);
#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_METHOD_SPACES_MACHINE_HEALTH
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_METHOD_SPACES_MACHINE_HEALTH
+uint64_t uniffi_cua_sdk_fn_method_spaces_machine_health(uint64_t ptr, RustBuffer machine
+);
+#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_METHOD_SPACES_RELAY_REGISTER
#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_METHOD_SPACES_RELAY_REGISTER
uint64_t uniffi_cua_sdk_fn_method_spaces_relay_register(uint64_t ptr, RustBuffer space
@@ -3707,6 +3717,12 @@ uint16_t uniffi_cua_sdk_checksum_method_devices_relay_url(void
#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_DEVICES_RENAME
uint16_t uniffi_cua_sdk_checksum_method_devices_rename(void
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_DEVICES_RENAME_MACHINE
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_DEVICES_RENAME_MACHINE
+uint16_t uniffi_cua_sdk_checksum_method_devices_rename_machine(void
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_DEVICES_REVOKE
@@ -4943,6 +4959,12 @@ uint16_t uniffi_cua_sdk_checksum_method_spaces_list(void
#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_SPACES_LIST_TOOLS_JSON
uint16_t uniffi_cua_sdk_checksum_method_spaces_list_tools_json(void
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_SPACES_MACHINE_HEALTH
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_SPACES_MACHINE_HEALTH
+uint16_t uniffi_cua_sdk_checksum_method_spaces_machine_health(void
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_SPACES_RELAY_REGISTER
diff --git a/libs/cua/typescript/src/native/cua_sdk-ffi.ts b/libs/cua/typescript/src/native/cua_sdk-ffi.ts
index 7d03e46476..21bada6569 100644
--- a/libs/cua/typescript/src/native/cua_sdk-ffi.ts
+++ b/libs/cua/typescript/src/native/cua_sdk-ffi.ts
@@ -1168,6 +1168,11 @@ const DEFINITIONS = {
ret: FfiType.Handle,
hasRustCallStatus: false,
},
+ "uniffi_cua_sdk_fn_method_devices_rename_machine": {
+ args: [FfiType.Handle, FfiType.RustBuffer, FfiType.RustBuffer],
+ ret: FfiType.Handle,
+ hasRustCallStatus: false,
+ },
"uniffi_cua_sdk_fn_method_devices_revoke": {
args: [FfiType.Handle, FfiType.RustBuffer],
ret: FfiType.Handle,
@@ -2173,6 +2178,11 @@ const DEFINITIONS = {
ret: FfiType.Handle,
hasRustCallStatus: false,
},
+ "uniffi_cua_sdk_fn_method_spaces_machine_health": {
+ args: [FfiType.Handle, FfiType.RustBuffer],
+ ret: FfiType.Handle,
+ hasRustCallStatus: false,
+ },
"uniffi_cua_sdk_fn_method_spaces_notifications": {
args: [FfiType.Handle, FfiType.Int8, FfiType.RustBuffer],
ret: FfiType.Handle,
@@ -3248,6 +3258,11 @@ const DEFINITIONS = {
ret: FfiType.UInt16,
hasRustCallStatus: false,
},
+ "uniffi_cua_sdk_checksum_method_devices_rename_machine": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
"uniffi_cua_sdk_checksum_method_devices_revoke": {
args: [],
ret: FfiType.UInt16,
@@ -4253,6 +4268,11 @@ const DEFINITIONS = {
ret: FfiType.UInt16,
hasRustCallStatus: false,
},
+ "uniffi_cua_sdk_checksum_method_spaces_machine_health": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
"uniffi_cua_sdk_checksum_method_spaces_notifications": {
args: [],
ret: FfiType.UInt16,
@@ -5116,6 +5136,7 @@ interface NativeModuleInterface {
uniffi_cua_sdk_fn_method_devices_pairing_codes(uniffiSelf: bigint): bigint;
uniffi_cua_sdk_fn_method_devices_relay_url(uniffiSelf: bigint, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
uniffi_cua_sdk_fn_method_devices_rename(uniffiSelf: bigint, id: Uint8Array, name: Uint8Array): bigint;
+ uniffi_cua_sdk_fn_method_devices_rename_machine(uniffiSelf: bigint, machineId: Uint8Array, name: Uint8Array): bigint;
uniffi_cua_sdk_fn_method_devices_revoke(uniffiSelf: bigint, id: Uint8Array): bigint;
uniffi_cua_sdk_fn_method_devices_revoke_pairing_code(uniffiSelf: bigint, id: Uint8Array): bigint;
uniffi_cua_sdk_fn_method_devices_snapshot(uniffiSelf: bigint, auditLimit: number): bigint;
@@ -5317,6 +5338,7 @@ interface NativeModuleInterface {
uniffi_cua_sdk_fn_method_spaces_hosts(uniffiSelf: bigint): bigint;
uniffi_cua_sdk_fn_method_spaces_list(uniffiSelf: bigint): bigint;
uniffi_cua_sdk_fn_method_spaces_list_tools_json(uniffiSelf: bigint): bigint;
+ uniffi_cua_sdk_fn_method_spaces_machine_health(uniffiSelf: bigint, machine: Uint8Array): bigint;
uniffi_cua_sdk_fn_method_spaces_notifications(uniffiSelf: bigint, unreadOnly: number, sinceMs: Uint8Array): bigint;
uniffi_cua_sdk_fn_method_spaces_notifications_ack(uniffiSelf: bigint, ids: Uint8Array): bigint;
uniffi_cua_sdk_fn_method_spaces_notify_user(uniffiSelf: bigint, title: Uint8Array, body: Uint8Array, agent: Uint8Array): bigint;
@@ -5532,6 +5554,7 @@ interface NativeModuleInterface {
uniffi_cua_sdk_checksum_method_devices_pairing_codes(): number;
uniffi_cua_sdk_checksum_method_devices_relay_url(): number;
uniffi_cua_sdk_checksum_method_devices_rename(): number;
+ uniffi_cua_sdk_checksum_method_devices_rename_machine(): number;
uniffi_cua_sdk_checksum_method_devices_revoke(): number;
uniffi_cua_sdk_checksum_method_devices_revoke_pairing_code(): number;
uniffi_cua_sdk_checksum_method_devices_snapshot(): number;
@@ -5733,6 +5756,7 @@ interface NativeModuleInterface {
uniffi_cua_sdk_checksum_method_spaces_hosts(): number;
uniffi_cua_sdk_checksum_method_spaces_list(): number;
uniffi_cua_sdk_checksum_method_spaces_list_tools_json(): number;
+ uniffi_cua_sdk_checksum_method_spaces_machine_health(): number;
uniffi_cua_sdk_checksum_method_spaces_notifications(): number;
uniffi_cua_sdk_checksum_method_spaces_notifications_ack(): number;
uniffi_cua_sdk_checksum_method_spaces_notify_user(): number;
diff --git a/libs/cua/typescript/src/native/cua_sdk.ts b/libs/cua/typescript/src/native/cua_sdk.ts
index 4d651da2cf..b7c5df1c34 100644
--- a/libs/cua/typescript/src/native/cua_sdk.ts
+++ b/libs/cua/typescript/src/native/cua_sdk.ts
@@ -5053,7 +5053,17 @@ export type RelayMachine = {
* check existed. `false` shows the machine as "new" until an enrolled
* device confirms it ([`Devices::confirm_machine`]) (S5).
*/
- confirmed: boolean
+ confirmed: boolean,
+ /**
+ * The team you reach it through, for a team machine not shared with
+ * you directly.
+ */
+ team?: string,
+ /**
+ * It creates Spaces for its owner's devices, when it said so at
+ * registration (`None` from a host or relay that predates it).
+ */
+ providesSpaces?: boolean
}
/**
@@ -5089,7 +5099,9 @@ const FfiConverterTypeRelayMachine = (() => {
url: FfiConverterString.read(from),
allow: FfiConverterSequenceString.read(from),
clients: FfiConverterSequenceTypeRelayClientInfo.read(from),
- confirmed: FfiConverterBool.read(from)
+ confirmed: FfiConverterBool.read(from),
+ team: FfiConverterOptionalString.read(from),
+ providesSpaces: FfiConverterOptionalBoolean.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
@@ -5106,6 +5118,8 @@ const FfiConverterTypeRelayMachine = (() => {
FfiConverterSequenceString.write(value.allow, into);
FfiConverterSequenceTypeRelayClientInfo.write(value.clients, into);
FfiConverterBool.write(value.confirmed, into);
+ FfiConverterOptionalString.write(value.team, into);
+ FfiConverterOptionalBoolean.write(value.providesSpaces, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.id) +
@@ -5120,7 +5134,9 @@ const FfiConverterTypeRelayMachine = (() => {
FfiConverterString.allocationSize(value.url) +
FfiConverterSequenceString.allocationSize(value.allow) +
FfiConverterSequenceTypeRelayClientInfo.allocationSize(value.clients) +
- FfiConverterBool.allocationSize(value.confirmed);
+ FfiConverterBool.allocationSize(value.confirmed) +
+ FfiConverterOptionalString.allocationSize(value.team) +
+ FfiConverterOptionalBoolean.allocationSize(value.providesSpaces);
}
};
@@ -9050,6 +9066,147 @@ const FfiConverterTypeLocationInfo = (() => {
return new FFIConverter();
})();
+/**
+ * One check of a machine's health ([`Spaces::machine_health`]).
+ */
+export type MachineHealthCheck = {
+ /**
+ * `machine.local_network`, `machine.disk`, `machine.virtualization`,
+ * `machine.memory`, `machine.permissions.<id>`.
+ */
+ id: string,
+ /**
+ * `pass`, `warn`, `fail` or `skip`.
+ */
+ status: string,
+ /**
+ * What it found, in one line.
+ */
+ message: string,
+ /**
+ * What to do about a warning or failure.
+ */
+ remediation: string,
+ /**
+ * What a UI needs to word it and offer its fix (`app`, `settings_url`,
+ * `free_gb`, ...).
+ */
+ facts: Map<string, string>
+}
+
+/**
+ * Generated factory for {@link MachineHealthCheck} record objects.
+ */
+export const MachineHealthCheck = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<MachineHealthCheck, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<MachineHealthCheck>,
+ });
+})();
+
+const FfiConverterTypeMachineHealthCheck = (() => {
+ type TypeName = MachineHealthCheck;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ id: FfiConverterString.read(from),
+ status: FfiConverterString.read(from),
+ message: FfiConverterString.read(from),
+ remediation: FfiConverterString.read(from),
+ facts: FfiConverterMapStringString.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.id, into);
+ FfiConverterString.write(value.status, into);
+ FfiConverterString.write(value.message, into);
+ FfiConverterString.write(value.remediation, into);
+ FfiConverterMapStringString.write(value.facts, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterString.allocationSize(value.id) +
+ FfiConverterString.allocationSize(value.status) +
+ FfiConverterString.allocationSize(value.message) +
+ FfiConverterString.allocationSize(value.remediation) +
+ FfiConverterMapStringString.allocationSize(value.facts);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+/**
+ * A machine's health as its own cua daemon checks it.
+ */
+export type MachineHealth = {
+ /**
+ * The Cua version of the daemon that checked.
+ */
+ cuaVersion: string,
+ /**
+ * `macos`, `linux`, `windows`.
+ */
+ os: string,
+ /**
+ * Every check, in order.
+ */
+ checks: Array<MachineHealthCheck>,
+ /**
+ * The whole report as JSON (the schema `cua doctor --json` writes).
+ */
+ reportJson: string
+}
+
+/**
+ * Generated factory for {@link MachineHealth} record objects.
+ */
+export const MachineHealth = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<MachineHealth, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<MachineHealth>,
+ });
+})();
+
+const FfiConverterTypeMachineHealth = (() => {
+ type TypeName = MachineHealth;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ cuaVersion: FfiConverterString.read(from),
+ os: FfiConverterString.read(from),
+ checks: FfiConverterSequenceTypeMachineHealthCheck.read(from),
+ reportJson: FfiConverterString.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.cuaVersion, into);
+ FfiConverterString.write(value.os, into);
+ FfiConverterSequenceTypeMachineHealthCheck.write(value.checks, into);
+ FfiConverterString.write(value.reportJson, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterString.allocationSize(value.cuaVersion) +
+ FfiConverterString.allocationSize(value.os) +
+ FfiConverterSequenceTypeMachineHealthCheck.allocationSize(value.checks) +
+ FfiConverterString.allocationSize(value.reportJson);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
/**
* Where an MCP endpoint is and what every request needs. Hand it to any
* MCP client (Claude Code, Cursor, the Python or TypeScript SDKs). A
@@ -20252,6 +20409,12 @@ export interface DevicesLike {
* Renames a device (from this enrolled device).
*/
rename(id: string, name: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<RelayDevice>;
+/**
+ * Renames `machine_id`, a machine the account owns, on the relay (from
+ * this enrolled device). When it is this machine's own registration,
+ * its host setup takes the new name too.
+ */
+ renameMachine(machineId: string, name: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<RelayMachine>;
/**
* Revokes a device (from this enrolled device). Revoking this device
* also deletes its key.
@@ -20591,6 +20754,43 @@ private constructor(pointer: UniffiHandle) {
}
}
+/**
+ * Renames `machine_id`, a machine the account owns, on the relay (from
+ * this enrolled device). When it is this machine's own registration,
+ * its host setup takes the new name too.
+ */
+ async renameMachine(machineId: string, name: string, asyncOpts_?: { signal: AbortSignal }): Promise<RelayMachine> /*throws*/ {
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
+ try {
+ return await uniffiRustCallAsync(
+ /*rustCaller:*/ uniffiCaller,
+ /*rustFutureFunc:*/ () => {
+ return nativeModule().uniffi_cua_sdk_fn_method_devices_rename_machine(
+ uniffiTypeDevicesObjectFactory.clonePointer(this),FfiConverterString.lower(machineId, nativeModule().rustbuffer_alloc),FfiConverterString.lower(name, nativeModule().rustbuffer_alloc)
+ );
+ },
+ /*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
+ /*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
+ /*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
+ /*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
+ // Async returns always go through the JS-side converter: the
+ // FFI symbol returns the future handle (u64), and the user-level
+ // RustBuffer comes back via the shared `rust_future_complete_*`
+ // export. The bytes the runtime hands back must be deserialized
+ // here using the per-callable return-type converter.
+ /*liftFunc:*/ FfiConverterTypeRelayMachine.lift.bind(FfiConverterTypeRelayMachine),
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ /*asyncOpts:*/ asyncOpts_,
+ /*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
+ );
+ } catch (__error: any) {
+ if (uniffiIsDebug && __error instanceof Error) {
+ __error.stack = __stack;
+ }
+ throw __error;
+ }
+ }
+
/**
* Revokes a device (from this enrolled device). Revoking this device
* also deletes its key.
@@ -30774,6 +30974,16 @@ export interface SpacesLike {
* The Spaces MCP `tools/list` result as JSON (the contract).
*/
listToolsJson(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
+/**
+ * A machine's health as its own cua daemon checks it: Local Network
+ * access (and which app macOS holds responsible), free disk,
+ * virtualization, memory left by running Spaces, the permissions
+ * sharing its desktop needs. `machine`: another of your machines, by
+ * id or name (asked over the relay, the mesh or its direct address);
+ * `None` for this one. Read-only; fails plainly when that machine is
+ * offline, not yours, or runs a Cua that predates the check.
+ */
+ machineHealth(machine: string | undefined, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<MachineHealth>;
/**
* The notifications feed, newest first.
*/
@@ -31819,6 +32029,47 @@ private constructor(pointer: UniffiHandle) {
}
}
+/**
+ * A machine's health as its own cua daemon checks it: Local Network
+ * access (and which app macOS holds responsible), free disk,
+ * virtualization, memory left by running Spaces, the permissions
+ * sharing its desktop needs. `machine`: another of your machines, by
+ * id or name (asked over the relay, the mesh or its direct address);
+ * `None` for this one. Read-only; fails plainly when that machine is
+ * offline, not yours, or runs a Cua that predates the check.
+ */
+ async machineHealth(machine: string | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<MachineHealth> /*throws*/ {
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
+ try {
+ return await uniffiRustCallAsync(
+ /*rustCaller:*/ uniffiCaller,
+ /*rustFutureFunc:*/ () => {
+ return nativeModule().uniffi_cua_sdk_fn_method_spaces_machine_health(
+ uniffiTypeSpacesObjectFactory.clonePointer(this),FfiConverterOptionalString.lower(machine, nativeModule().rustbuffer_alloc)
+ );
+ },
+ /*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
+ /*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
+ /*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
+ /*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
+ // Async returns always go through the JS-side converter: the
+ // FFI symbol returns the future handle (u64), and the user-level
+ // RustBuffer comes back via the shared `rust_future_complete_*`
+ // export. The bytes the runtime hands back must be deserialized
+ // here using the per-callable return-type converter.
+ /*liftFunc:*/ FfiConverterTypeMachineHealth.lift.bind(FfiConverterTypeMachineHealth),
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ /*asyncOpts:*/ asyncOpts_,
+ /*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
+ );
+ } catch (__error: any) {
+ if (uniffiIsDebug && __error instanceof Error) {
+ __error.stack = __stack;
+ }
+ throw __error;
+ }
+ }
+
/**
* The notifications feed, newest first.
*/
@@ -34834,6 +35085,9 @@ const FfiConverterOptionalTypeStorageVolume = new FfiConverterOptional(FfiConver
// FfiConverter for Map<string, Array<string>>
const FfiConverterMapStringSequenceString = new FfiConverterMap(FfiConverterString, FfiConverterSequenceString);
+// FfiConverter for Array<MachineHealthCheck>
+const FfiConverterSequenceTypeMachineHealthCheck = new FfiConverterArray(FfiConverterTypeMachineHealthCheck);
+
// FfiConverter for PresenceParticipant | undefined
const FfiConverterOptionalTypePresenceParticipant = new FfiConverterOptional(FfiConverterTypePresenceParticipant);
@@ -35429,6 +35683,9 @@ function uniffiEnsureInitialized() {
if (nativeModule().uniffi_cua_sdk_checksum_method_devices_rename() !== 59535) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_devices_rename");
}
+ if (nativeModule().uniffi_cua_sdk_checksum_method_devices_rename_machine() !== 63088) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_devices_rename_machine");
+ }
if (nativeModule().uniffi_cua_sdk_checksum_method_devices_revoke() !== 27802) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_devices_revoke");
}
@@ -36032,6 +36289,9 @@ function uniffiEnsureInitialized() {
if (nativeModule().uniffi_cua_sdk_checksum_method_spaces_list_tools_json() !== 19259) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spaces_list_tools_json");
}
+ if (nativeModule().uniffi_cua_sdk_checksum_method_spaces_machine_health() !== 35352) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spaces_machine_health");
+ }
if (nativeModule().uniffi_cua_sdk_checksum_method_spaces_notifications() !== 10964) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spaces_notifications");
}
@@ -36455,6 +36715,8 @@ export default Object.freeze({
FfiConverterTypeLocationInfo,
FfiConverterTypeLoginAttempt,
FfiConverterTypeLoginMethod,
+ FfiConverterTypeMachineHealth,
+ FfiConverterTypeMachineHealthCheck,
FfiConverterTypeMcpClient,
FfiConverterTypeMcpConfig,
FfiConverterTypeMediaBridge,
diff --git a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
index e0ff9072e4..e86665c269 100644
--- a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
+++ b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
@@ -19642,6 +19642,1776 @@ public func FfiConverterTypeAppMachinesPageInput_lower(_ value: AppMachinesPageI
}
+public struct AppMachinesView: Equatable, Hashable {
+ /**
+ * "3 machines, 2 online".
+ */
+ public var summary: String
+ /**
+ * The list's groups (only those with machines).
+ */
+ public var groups: [AppMachinesViewGroup]
+ /**
+ * Every machine, in list order.
+ */
+ public var machines: [AppMachinesViewMachine]
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ /**
+ * "3 machines, 2 online".
+ */summary: String,
+ /**
+ * The list's groups (only those with machines).
+ */groups: [AppMachinesViewGroup],
+ /**
+ * Every machine, in list order.
+ */machines: [AppMachinesViewMachine]) {
+ self.summary = summary
+ self.groups = groups
+ self.machines = machines
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension AppMachinesView: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeAppMachinesView: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppMachinesView {
+ return
+ try AppMachinesView(
+ summary: FfiConverterString.read(from: &buf),
+ groups: FfiConverterSequenceTypeAppMachinesViewGroup.read(from: &buf),
+ machines: FfiConverterSequenceTypeAppMachinesViewMachine.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: AppMachinesView, into buf: inout [UInt8]) {
+ FfiConverterString.write(value.summary, into: &buf)
+ FfiConverterSequenceTypeAppMachinesViewGroup.write(value.groups, into: &buf)
+ FfiConverterSequenceTypeAppMachinesViewMachine.write(value.machines, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesView_lift(_ buf: RustBuffer) throws -> AppMachinesView {
+ return try FfiConverterTypeAppMachinesView.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesView_lower(_ value: AppMachinesView) -> RustBuffer {
+ return FfiConverterTypeAppMachinesView.lower(value)
+}
+
+
+public struct AppMachinesViewAbout: Equatable, Hashable {
+ /**
+ * Its name ("Ada's MacBook Pro").
+ */
+ public var computerName: String
+ /**
+ * The app's version ("0.9.1").
+ */
+ public var appVersion: String
+ /**
+ * Its system and version ("macOS 26.5.2").
+ */
+ public var osVersion: String
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ /**
+ * Its name ("Ada's MacBook Pro").
+ */computerName: String,
+ /**
+ * The app's version ("0.9.1").
+ */appVersion: String,
+ /**
+ * Its system and version ("macOS 26.5.2").
+ */osVersion: String) {
+ self.computerName = computerName
+ self.appVersion = appVersion
+ self.osVersion = osVersion
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension AppMachinesViewAbout: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeAppMachinesViewAbout: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppMachinesViewAbout {
+ return
+ try AppMachinesViewAbout(
+ computerName: FfiConverterString.read(from: &buf),
+ appVersion: FfiConverterString.read(from: &buf),
+ osVersion: FfiConverterString.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: AppMachinesViewAbout, into buf: inout [UInt8]) {
+ FfiConverterString.write(value.computerName, into: &buf)
+ FfiConverterString.write(value.appVersion, into: &buf)
+ FfiConverterString.write(value.osVersion, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesViewAbout_lift(_ buf: RustBuffer) throws -> AppMachinesViewAbout {
+ return try FfiConverterTypeAppMachinesViewAbout.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesViewAbout_lower(_ value: AppMachinesViewAbout) -> RustBuffer {
+ return FfiConverterTypeAppMachinesViewAbout.lower(value)
+}
+
+
+public struct AppMachinesViewCheck: Equatable, Hashable {
+ /**
+ * `machine.local_network`, `machine.disk`, ...
+ */
+ public var id: String
+ /**
+ * `pass`, `warn`, `fail`, `skip`.
+ */
+ public var status: String
+ /**
+ * What it found.
+ */
+ public var message: String
+ /**
+ * What to do.
+ */
+ public var remediation: String
+ /**
+ * `app`, `settings_url`, `free_gb`, ...
+ */
+ public var facts: [String: String]
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ /**
+ * `machine.local_network`, `machine.disk`, ...
+ */id: String,
+ /**
+ * `pass`, `warn`, `fail`, `skip`.
+ */status: String,
+ /**
+ * What it found.
+ */message: String,
+ /**
+ * What to do.
+ */remediation: String,
+ /**
+ * `app`, `settings_url`, `free_gb`, ...
+ */facts: [String: String]) {
+ self.id = id
+ self.status = status
+ self.message = message
+ self.remediation = remediation
+ self.facts = facts
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension AppMachinesViewCheck: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeAppMachinesViewCheck: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppMachinesViewCheck {
+ return
+ try AppMachinesViewCheck(
+ id: FfiConverterString.read(from: &buf),
+ status: FfiConverterString.read(from: &buf),
+ message: FfiConverterString.read(from: &buf),
+ remediation: FfiConverterString.read(from: &buf),
+ facts: FfiConverterDictionaryStringString.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: AppMachinesViewCheck, into buf: inout [UInt8]) {
+ FfiConverterString.write(value.id, into: &buf)
+ FfiConverterString.write(value.status, into: &buf)
+ FfiConverterString.write(value.message, into: &buf)
+ FfiConverterString.write(value.remediation, into: &buf)
+ FfiConverterDictionaryStringString.write(value.facts, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesViewCheck_lift(_ buf: RustBuffer) throws -> AppMachinesViewCheck {
+ return try FfiConverterTypeAppMachinesViewCheck.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesViewCheck_lower(_ value: AppMachinesViewCheck) -> RustBuffer {
+ return FfiConverterTypeAppMachinesViewCheck.lower(value)
+}
+
+
+public struct AppMachinesViewFact: Equatable, Hashable {
+ /**
+ * "OS", "App", "Connection", "Service".
+ */
+ public var label: String
+ /**
+ * Its value.
+ */
+ public var value: String
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ /**
+ * "OS", "App", "Connection", "Service".
+ */label: String,
+ /**
+ * Its value.
+ */value: String) {
+ self.label = label
+ self.value = value
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension AppMachinesViewFact: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeAppMachinesViewFact: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppMachinesViewFact {
+ return
+ try AppMachinesViewFact(
+ label: FfiConverterString.read(from: &buf),
+ value: FfiConverterString.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: AppMachinesViewFact, into buf: inout [UInt8]) {
+ FfiConverterString.write(value.label, into: &buf)
+ FfiConverterString.write(value.value, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesViewFact_lift(_ buf: RustBuffer) throws -> AppMachinesViewFact {
+ return try FfiConverterTypeAppMachinesViewFact.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesViewFact_lower(_ value: AppMachinesViewFact) -> RustBuffer {
+ return FfiConverterTypeAppMachinesViewFact.lower(value)
+}
+
+
+public struct AppMachinesViewGroup: Equatable, Hashable {
+ /**
+ * `yours`, `old` or `team`.
+ */
+ public var id: String
+ /**
+ * "Your machines", "Offline for 30+ days (2)", "Team machines".
+ */
+ public var title: String
+ /**
+ * Collapsed until opened (the old machines).
+ */
+ public var collapsed: Bool
+ /**
+ * Its machines' ids, in order.
+ */
+ public var ids: [String]
+ /**
+ * Remove old machines.
+ */
+ public var removeAll: AppMachinesViewRemoveAll?
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ /**
+ * `yours`, `old` or `team`.
+ */id: String,
+ /**
+ * "Your machines", "Offline for 30+ days (2)", "Team machines".
+ */title: String,
+ /**
+ * Collapsed until opened (the old machines).
+ */collapsed: Bool,
+ /**
+ * Its machines' ids, in order.
+ */ids: [String],
+ /**
+ * Remove old machines.
+ */removeAll: AppMachinesViewRemoveAll?) {
+ self.id = id
+ self.title = title
+ self.collapsed = collapsed
+ self.ids = ids
+ self.removeAll = removeAll
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension AppMachinesViewGroup: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeAppMachinesViewGroup: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppMachinesViewGroup {
+ return
+ try AppMachinesViewGroup(
+ id: FfiConverterString.read(from: &buf),
+ title: FfiConverterString.read(from: &buf),
+ collapsed: FfiConverterBool.read(from: &buf),
+ ids: FfiConverterSequenceString.read(from: &buf),
+ removeAll: FfiConverterOptionTypeAppMachinesViewRemoveAll.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: AppMachinesViewGroup, into buf: inout [UInt8]) {
+ FfiConverterString.write(value.id, into: &buf)
+ FfiConverterString.write(value.title, into: &buf)
+ FfiConverterBool.write(value.collapsed, into: &buf)
+ FfiConverterSequenceString.write(value.ids, into: &buf)
+ FfiConverterOptionTypeAppMachinesViewRemoveAll.write(value.removeAll, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesViewGroup_lift(_ buf: RustBuffer) throws -> AppMachinesViewGroup {
+ return try FfiConverterTypeAppMachinesViewGroup.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesViewGroup_lower(_ value: AppMachinesViewGroup) -> RustBuffer {
+ return FfiConverterTypeAppMachinesViewGroup.lower(value)
+}
+
+
+public struct AppMachinesViewHealth: Equatable, Hashable {
+ /**
+ * The machine's row id (`this-mac`, a relay machine id).
+ */
+ public var id: String
+ /**
+ * Its checks.
+ */
+ public var checks: [AppMachinesViewCheck]
+ /**
+ * The Cua version of the daemon that checked.
+ */
+ public var cuaVersion: String
+ /**
+ * Why it could not be checked, when it could not.
+ */
+ public var error: String?
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ /**
+ * The machine's row id (`this-mac`, a relay machine id).
+ */id: String,
+ /**
+ * Its checks.
+ */checks: [AppMachinesViewCheck],
+ /**
+ * The Cua version of the daemon that checked.
+ */cuaVersion: String,
+ /**
+ * Why it could not be checked, when it could not.
+ */error: String?) {
+ self.id = id
+ self.checks = checks
+ self.cuaVersion = cuaVersion
+ self.error = error
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension AppMachinesViewHealth: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeAppMachinesViewHealth: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppMachinesViewHealth {
+ return
+ try AppMachinesViewHealth(
+ id: FfiConverterString.read(from: &buf),
+ checks: FfiConverterSequenceTypeAppMachinesViewCheck.read(from: &buf),
+ cuaVersion: FfiConverterString.read(from: &buf),
+ error: FfiConverterOptionString.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: AppMachinesViewHealth, into buf: inout [UInt8]) {
+ FfiConverterString.write(value.id, into: &buf)
+ FfiConverterSequenceTypeAppMachinesViewCheck.write(value.checks, into: &buf)
+ FfiConverterString.write(value.cuaVersion, into: &buf)
+ FfiConverterOptionString.write(value.error, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesViewHealth_lift(_ buf: RustBuffer) throws -> AppMachinesViewHealth {
+ return try FfiConverterTypeAppMachinesViewHealth.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesViewHealth_lower(_ value: AppMachinesViewHealth) -> RustBuffer {
+ return FfiConverterTypeAppMachinesViewHealth.lower(value)
+}
+
+
+public struct AppMachinesViewInput: Equatable, Hashable {
+ /**
+ * What the rows are listed from ([`machines::page_rows`]).
+ */
+ public var page: AppMachinesPageInput
+ /**
+ * The account's relay machines (none while signed out).
+ */
+ public var relay: [AppMachinesViewRelay]
+ /**
+ * This machine's host state (`None` while it loads).
+ */
+ public var host: AppHostState?
+ /**
+ * This computer.
+ */
+ public var about: AppMachinesViewAbout
+ /**
+ * The rows when the shell already listed them (an older host's rows,
+ * merged by the web UI); `None`: [`machines::page_rows`] of `page`.
+ */
+ public var rows: [AppMachinePageRow]?
+ /**
+ * What each machine's daemon reported of its health, by row id, for
+ * the machines whose `health_target` the shell checked
+ * ([`crate::machines_health`]).
+ */
+ public var health: [AppMachinesViewHealth]
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ /**
+ * What the rows are listed from ([`machines::page_rows`]).
+ */page: AppMachinesPageInput,
+ /**
+ * The account's relay machines (none while signed out).
+ */relay: [AppMachinesViewRelay],
+ /**
+ * This machine's host state (`None` while it loads).
+ */host: AppHostState?,
+ /**
+ * This computer.
+ */about: AppMachinesViewAbout,
+ /**
+ * The rows when the shell already listed them (an older host's rows,
+ * merged by the web UI); `None`: [`machines::page_rows`] of `page`.
+ */rows: [AppMachinePageRow]?,
+ /**
+ * What each machine's daemon reported of its health, by row id, for
+ * the machines whose `health_target` the shell checked
+ * ([`crate::machines_health`]).
+ */health: [AppMachinesViewHealth]) {
+ self.page = page
+ self.relay = relay
+ self.host = host
+ self.about = about
+ self.rows = rows
+ self.health = health
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension AppMachinesViewInput: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeAppMachinesViewInput: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppMachinesViewInput {
+ return
+ try AppMachinesViewInput(
+ page: FfiConverterTypeAppMachinesPageInput.read(from: &buf),
+ relay: FfiConverterSequenceTypeAppMachinesViewRelay.read(from: &buf),
+ host: FfiConverterOptionTypeAppHostState.read(from: &buf),
+ about: FfiConverterTypeAppMachinesViewAbout.read(from: &buf),
+ rows: FfiConverterOptionSequenceTypeAppMachinePageRow.read(from: &buf),
+ health: FfiConverterSequenceTypeAppMachinesViewHealth.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: AppMachinesViewInput, into buf: inout [UInt8]) {
+ FfiConverterTypeAppMachinesPageInput.write(value.page, into: &buf)
+ FfiConverterSequenceTypeAppMachinesViewRelay.write(value.relay, into: &buf)
+ FfiConverterOptionTypeAppHostState.write(value.host, into: &buf)
+ FfiConverterTypeAppMachinesViewAbout.write(value.about, into: &buf)
+ FfiConverterOptionSequenceTypeAppMachinePageRow.write(value.rows, into: &buf)
+ FfiConverterSequenceTypeAppMachinesViewHealth.write(value.health, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesViewInput_lift(_ buf: RustBuffer) throws -> AppMachinesViewInput {
+ return try FfiConverterTypeAppMachinesViewInput.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesViewInput_lower(_ value: AppMachinesViewInput) -> RustBuffer {
+ return FfiConverterTypeAppMachinesViewInput.lower(value)
+}
+
+
+public struct AppMachinesViewIssue: Equatable, Hashable {
+ /**
+ * The check it comes from (`machine.disk`, `service`, `version`).
+ */
+ public var id: String
+ /**
+ * `warn` or `fail`.
+ */
+ public var level: String
+ /**
+ * One plain sentence.
+ */
+ public var text: String
+ /**
+ * Its fix, when there is one here.
+ */
+ public var action: AppMachinesViewIssueAction?
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ /**
+ * The check it comes from (`machine.disk`, `service`, `version`).
+ */id: String,
+ /**
+ * `warn` or `fail`.
+ */level: String,
+ /**
+ * One plain sentence.
+ */text: String,
+ /**
+ * Its fix, when there is one here.
+ */action: AppMachinesViewIssueAction?) {
+ self.id = id
+ self.level = level
+ self.text = text
+ self.action = action
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension AppMachinesViewIssue: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeAppMachinesViewIssue: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppMachinesViewIssue {
+ return
+ try AppMachinesViewIssue(
+ id: FfiConverterString.read(from: &buf),
+ level: FfiConverterString.read(from: &buf),
+ text: FfiConverterString.read(from: &buf),
+ action: FfiConverterOptionTypeAppMachinesViewIssueAction.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: AppMachinesViewIssue, into buf: inout [UInt8]) {
+ FfiConverterString.write(value.id, into: &buf)
+ FfiConverterString.write(value.level, into: &buf)
+ FfiConverterString.write(value.text, into: &buf)
+ FfiConverterOptionTypeAppMachinesViewIssueAction.write(value.action, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesViewIssue_lift(_ buf: RustBuffer) throws -> AppMachinesViewIssue {
+ return try FfiConverterTypeAppMachinesViewIssue.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesViewIssue_lower(_ value: AppMachinesViewIssue) -> RustBuffer {
+ return FfiConverterTypeAppMachinesViewIssue.lower(value)
+}
+
+
+public struct AppMachinesViewIssueAction: Equatable, Hashable {
+ /**
+ * "Open Local Network settings", "Free disk space", "Restart service".
+ */
+ public var label: String
+ /**
+ * A System Settings pane to open (`host.openSettings`).
+ */
+ public var url: String?
+ /**
+ * A host action to run (`host.action`).
+ */
+ public var hostAction: AppHostActionId?
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ /**
+ * "Open Local Network settings", "Free disk space", "Restart service".
+ */label: String,
+ /**
+ * A System Settings pane to open (`host.openSettings`).
+ */url: String?,
+ /**
+ * A host action to run (`host.action`).
+ */hostAction: AppHostActionId?) {
+ self.label = label
+ self.url = url
+ self.hostAction = hostAction
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension AppMachinesViewIssueAction: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeAppMachinesViewIssueAction: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppMachinesViewIssueAction {
+ return
+ try AppMachinesViewIssueAction(
+ label: FfiConverterString.read(from: &buf),
+ url: FfiConverterOptionString.read(from: &buf),
+ hostAction: FfiConverterOptionTypeAppHostActionId.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: AppMachinesViewIssueAction, into buf: inout [UInt8]) {
+ FfiConverterString.write(value.label, into: &buf)
+ FfiConverterOptionString.write(value.url, into: &buf)
+ FfiConverterOptionTypeAppHostActionId.write(value.hostAction, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesViewIssueAction_lift(_ buf: RustBuffer) throws -> AppMachinesViewIssueAction {
+ return try FfiConverterTypeAppMachinesViewIssueAction.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesViewIssueAction_lower(_ value: AppMachinesViewIssueAction) -> RustBuffer {
+ return FfiConverterTypeAppMachinesViewIssueAction.lower(value)
+}
+
+
+public struct AppMachinesViewMachine: Equatable, Hashable {
+ /**
+ * The row's id ([`MachinePageRow::id`]).
+ */
+ public var id: String
+ /**
+ * Its name.
+ */
+ public var name: String
+ /**
+ * "This Mac" on the machine this app runs on.
+ */
+ public var badge: String?
+ /**
+ * The row's one muted line ("2 Spaces running", "Ready for Spaces",
+ * "Offline · last seen 9 days ago").
+ */
+ public var line: String
+ /**
+ * Usable now (the green dot): online and sharing.
+ */
+ public var online: Bool
+ /**
+ * The dot's tint for its issues: `warn`, `fail`, or empty.
+ */
+ public var health: String
+ /**
+ * What the shell passes to `Spaces.machine_health` to check it: empty
+ * for This Mac, its id for another of your machines; `None` when it
+ * can't be checked from here (offline, not yours).
+ */
+ public var healthTarget: String?
+ /**
+ * `macos`, `linux`, `windows`, or empty.
+ */
+ public var os: String
+ /**
+ * The machine this app runs on.
+ */
+ public var current: Bool
+ /**
+ * Someone shares it with you (a team machine).
+ */
+ public var team: Bool
+ /**
+ * The page's status line ("Online", "Offline · last seen 9 days ago").
+ */
+ public var status: String
+ /**
+ * After the status: who shares it ("Shared by your team").
+ */
+ public var sharedBy: String?
+ /**
+ * Rename, when it can be renamed from here.
+ */
+ public var rename: AppMachinesViewRename?
+ /**
+ * "Issues".
+ */
+ public var issuesTitle: String
+ /**
+ * What is wrong, one sentence each with its fix; empty when healthy
+ * (the section is hidden then) or offline.
+ */
+ public var issues: [AppMachinesViewIssue]
+ /**
+ * One line over the switches (offline, signed out).
+ */
+ public var notice: String?
+ /**
+ * The notice's button (Sign In).
+ */
+ public var noticeAction: AppHostAction?
+ /**
+ * Provide Spaces, then Share this desktop.
+ */
+ public var toggles: [AppMachinesViewToggle]
+ /**
+ * Under read-only switches: where they change.
+ */
+ public var togglesNote: String?
+ /**
+ * "Spaces on this machine".
+ */
+ public var spacesTitle: String
+ /**
+ * The Spaces on it.
+ */
+ public var spaces: [AppMachinesViewSpace]
+ /**
+ * When it has none.
+ */
+ public var spacesEmpty: String?
+ /**
+ * New Space here.
+ */
+ public var newSpace: AppMachinesViewNewSpace
+ /**
+ * "Details" (collapsed).
+ */
+ public var detailsTitle: String
+ /**
+ * OS, App, Connection, Service.
+ */
+ public var details: [AppMachinesViewFact]
+ /**
+ * Remove from account (none for a team machine).
+ */
+ public var remove: AppMachinesViewRemove?
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ /**
+ * The row's id ([`MachinePageRow::id`]).
+ */id: String,
+ /**
+ * Its name.
+ */name: String,
+ /**
+ * "This Mac" on the machine this app runs on.
+ */badge: String?,
+ /**
+ * The row's one muted line ("2 Spaces running", "Ready for Spaces",
+ * "Offline · last seen 9 days ago").
+ */line: String,
+ /**
+ * Usable now (the green dot): online and sharing.
+ */online: Bool,
+ /**
+ * The dot's tint for its issues: `warn`, `fail`, or empty.
+ */health: String,
+ /**
+ * What the shell passes to `Spaces.machine_health` to check it: empty
+ * for This Mac, its id for another of your machines; `None` when it
+ * can't be checked from here (offline, not yours).
+ */healthTarget: String?,
+ /**
+ * `macos`, `linux`, `windows`, or empty.
+ */os: String,
+ /**
+ * The machine this app runs on.
+ */current: Bool,
+ /**
+ * Someone shares it with you (a team machine).
+ */team: Bool,
+ /**
+ * The page's status line ("Online", "Offline · last seen 9 days ago").
+ */status: String,
+ /**
+ * After the status: who shares it ("Shared by your team").
+ */sharedBy: String?,
+ /**
+ * Rename, when it can be renamed from here.
+ */rename: AppMachinesViewRename?,
+ /**
+ * "Issues".
+ */issuesTitle: String,
+ /**
+ * What is wrong, one sentence each with its fix; empty when healthy
+ * (the section is hidden then) or offline.
+ */issues: [AppMachinesViewIssue],
+ /**
+ * One line over the switches (offline, signed out).
+ */notice: String?,
+ /**
+ * The notice's button (Sign In).
+ */noticeAction: AppHostAction?,
+ /**
+ * Provide Spaces, then Share this desktop.
+ */toggles: [AppMachinesViewToggle],
+ /**
+ * Under read-only switches: where they change.
+ */togglesNote: String?,
+ /**
+ * "Spaces on this machine".
+ */spacesTitle: String,
+ /**
+ * The Spaces on it.
+ */spaces: [AppMachinesViewSpace],
+ /**
+ * When it has none.
+ */spacesEmpty: String?,
+ /**
+ * New Space here.
+ */newSpace: AppMachinesViewNewSpace,
+ /**
+ * "Details" (collapsed).
+ */detailsTitle: String,
+ /**
+ * OS, App, Connection, Service.
+ */details: [AppMachinesViewFact],
+ /**
+ * Remove from account (none for a team machine).
+ */remove: AppMachinesViewRemove?) {
+ self.id = id
+ self.name = name
+ self.badge = badge
+ self.line = line
+ self.online = online
+ self.health = health
+ self.healthTarget = healthTarget
+ self.os = os
+ self.current = current
+ self.team = team
+ self.status = status
+ self.sharedBy = sharedBy
+ self.rename = rename
+ self.issuesTitle = issuesTitle
+ self.issues = issues
+ self.notice = notice
+ self.noticeAction = noticeAction
+ self.toggles = toggles
+ self.togglesNote = togglesNote
+ self.spacesTitle = spacesTitle
+ self.spaces = spaces
+ self.spacesEmpty = spacesEmpty
+ self.newSpace = newSpace
+ self.detailsTitle = detailsTitle
+ self.details = details
+ self.remove = remove
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension AppMachinesViewMachine: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeAppMachinesViewMachine: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppMachinesViewMachine {
+ return
+ try AppMachinesViewMachine(
+ id: FfiConverterString.read(from: &buf),
+ name: FfiConverterString.read(from: &buf),
+ badge: FfiConverterOptionString.read(from: &buf),
+ line: FfiConverterString.read(from: &buf),
+ online: FfiConverterBool.read(from: &buf),
+ health: FfiConverterString.read(from: &buf),
+ healthTarget: FfiConverterOptionString.read(from: &buf),
+ os: FfiConverterString.read(from: &buf),
+ current: FfiConverterBool.read(from: &buf),
+ team: FfiConverterBool.read(from: &buf),
+ status: FfiConverterString.read(from: &buf),
+ sharedBy: FfiConverterOptionString.read(from: &buf),
+ rename: FfiConverterOptionTypeAppMachinesViewRename.read(from: &buf),
+ issuesTitle: FfiConverterString.read(from: &buf),
+ issues: FfiConverterSequenceTypeAppMachinesViewIssue.read(from: &buf),
+ notice: FfiConverterOptionString.read(from: &buf),
+ noticeAction: FfiConverterOptionTypeAppHostAction.read(from: &buf),
+ toggles: FfiConverterSequenceTypeAppMachinesViewToggle.read(from: &buf),
+ togglesNote: FfiConverterOptionString.read(from: &buf),
+ spacesTitle: FfiConverterString.read(from: &buf),
+ spaces: FfiConverterSequenceTypeAppMachinesViewSpace.read(from: &buf),
+ spacesEmpty: FfiConverterOptionString.read(from: &buf),
+ newSpace: FfiConverterTypeAppMachinesViewNewSpace.read(from: &buf),
+ detailsTitle: FfiConverterString.read(from: &buf),
+ details: FfiConverterSequenceTypeAppMachinesViewFact.read(from: &buf),
+ remove: FfiConverterOptionTypeAppMachinesViewRemove.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: AppMachinesViewMachine, into buf: inout [UInt8]) {
+ FfiConverterString.write(value.id, into: &buf)
+ FfiConverterString.write(value.name, into: &buf)
+ FfiConverterOptionString.write(value.badge, into: &buf)
+ FfiConverterString.write(value.line, into: &buf)
+ FfiConverterBool.write(value.online, into: &buf)
+ FfiConverterString.write(value.health, into: &buf)
+ FfiConverterOptionString.write(value.healthTarget, into: &buf)
+ FfiConverterString.write(value.os, into: &buf)
+ FfiConverterBool.write(value.current, into: &buf)
+ FfiConverterBool.write(value.team, into: &buf)
+ FfiConverterString.write(value.status, into: &buf)
+ FfiConverterOptionString.write(value.sharedBy, into: &buf)
+ FfiConverterOptionTypeAppMachinesViewRename.write(value.rename, into: &buf)
+ FfiConverterString.write(value.issuesTitle, into: &buf)
+ FfiConverterSequenceTypeAppMachinesViewIssue.write(value.issues, into: &buf)
+ FfiConverterOptionString.write(value.notice, into: &buf)
+ FfiConverterOptionTypeAppHostAction.write(value.noticeAction, into: &buf)
+ FfiConverterSequenceTypeAppMachinesViewToggle.write(value.toggles, into: &buf)
+ FfiConverterOptionString.write(value.togglesNote, into: &buf)
+ FfiConverterString.write(value.spacesTitle, into: &buf)
+ FfiConverterSequenceTypeAppMachinesViewSpace.write(value.spaces, into: &buf)
+ FfiConverterOptionString.write(value.spacesEmpty, into: &buf)
+ FfiConverterTypeAppMachinesViewNewSpace.write(value.newSpace, into: &buf)
+ FfiConverterString.write(value.detailsTitle, into: &buf)
+ FfiConverterSequenceTypeAppMachinesViewFact.write(value.details, into: &buf)
+ FfiConverterOptionTypeAppMachinesViewRemove.write(value.remove, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesViewMachine_lift(_ buf: RustBuffer) throws -> AppMachinesViewMachine {
+ return try FfiConverterTypeAppMachinesViewMachine.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesViewMachine_lower(_ value: AppMachinesViewMachine) -> RustBuffer {
+ return FfiConverterTypeAppMachinesViewMachine.lower(value)
+}
+
+
+public struct AppMachinesViewNewSpace: Equatable, Hashable {
+ /**
+ * "New Space here".
+ */
+ public var label: String
+ /**
+ * The wizard's placement (`local`, `host:<id>`).
+ */
+ public var on: String
+ /**
+ * Can be pressed now.
+ */
+ public var enabled: Bool
+ /**
+ * Why not, when it cannot.
+ */
+ public var help: String?
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ /**
+ * "New Space here".
+ */label: String,
+ /**
+ * The wizard's placement (`local`, `host:<id>`).
+ */on: String,
+ /**
+ * Can be pressed now.
+ */enabled: Bool,
+ /**
+ * Why not, when it cannot.
+ */help: String?) {
+ self.label = label
+ self.on = on
+ self.enabled = enabled
+ self.help = help
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension AppMachinesViewNewSpace: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeAppMachinesViewNewSpace: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppMachinesViewNewSpace {
+ return
+ try AppMachinesViewNewSpace(
+ label: FfiConverterString.read(from: &buf),
+ on: FfiConverterString.read(from: &buf),
+ enabled: FfiConverterBool.read(from: &buf),
+ help: FfiConverterOptionString.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: AppMachinesViewNewSpace, into buf: inout [UInt8]) {
+ FfiConverterString.write(value.label, into: &buf)
+ FfiConverterString.write(value.on, into: &buf)
+ FfiConverterBool.write(value.enabled, into: &buf)
+ FfiConverterOptionString.write(value.help, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesViewNewSpace_lift(_ buf: RustBuffer) throws -> AppMachinesViewNewSpace {
+ return try FfiConverterTypeAppMachinesViewNewSpace.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesViewNewSpace_lower(_ value: AppMachinesViewNewSpace) -> RustBuffer {
+ return FfiConverterTypeAppMachinesViewNewSpace.lower(value)
+}
+
+
+public struct AppMachinesViewRelay: Equatable, Hashable {
+ /**
+ * Machine id.
+ */
+ public var id: String
+ /**
+ * `owner`, or `shared` for a machine someone shares with you.
+ */
+ public var role: String
+ /**
+ * The team you reach it through, for a team machine.
+ */
+ public var team: String?
+ /**
+ * Its owner's email, when the relay says.
+ */
+ public var ownerEmail: String?
+ /**
+ * It creates Spaces for your devices (`None`: it did not say).
+ */
+ public var providesSpaces: Bool?
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ /**
+ * Machine id.
+ */id: String,
+ /**
+ * `owner`, or `shared` for a machine someone shares with you.
+ */role: String,
+ /**
+ * The team you reach it through, for a team machine.
+ */team: String?,
+ /**
+ * Its owner's email, when the relay says.
+ */ownerEmail: String?,
+ /**
+ * It creates Spaces for your devices (`None`: it did not say).
+ */providesSpaces: Bool?) {
+ self.id = id
+ self.role = role
+ self.team = team
+ self.ownerEmail = ownerEmail
+ self.providesSpaces = providesSpaces
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension AppMachinesViewRelay: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeAppMachinesViewRelay: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppMachinesViewRelay {
+ return
+ try AppMachinesViewRelay(
+ id: FfiConverterString.read(from: &buf),
+ role: FfiConverterString.read(from: &buf),
+ team: FfiConverterOptionString.read(from: &buf),
+ ownerEmail: FfiConverterOptionString.read(from: &buf),
+ providesSpaces: FfiConverterOptionBool.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: AppMachinesViewRelay, into buf: inout [UInt8]) {
+ FfiConverterString.write(value.id, into: &buf)
+ FfiConverterString.write(value.role, into: &buf)
+ FfiConverterOptionString.write(value.team, into: &buf)
+ FfiConverterOptionString.write(value.ownerEmail, into: &buf)
+ FfiConverterOptionBool.write(value.providesSpaces, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesViewRelay_lift(_ buf: RustBuffer) throws -> AppMachinesViewRelay {
+ return try FfiConverterTypeAppMachinesViewRelay.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesViewRelay_lower(_ value: AppMachinesViewRelay) -> RustBuffer {
+ return FfiConverterTypeAppMachinesViewRelay.lower(value)
+}
+
+
+public struct AppMachinesViewRemove: Equatable, Hashable {
+ /**
+ * "Remove from account".
+ */
+ public var label: String
+ /**
+ * Can be pressed now.
+ */
+ public var enabled: Bool
+ /**
+ * Why not, when it cannot.
+ */
+ public var help: String?
+ /**
+ * This machine: its host setup is removed (the host's `remove`).
+ */
+ public var host: Bool
+ /**
+ * Another machine: it leaves the relay directory (`relay:<id>`).
+ */
+ public var machine: String?
+ /**
+ * The device on it, revoked too.
+ */
+ public var device: String?
+ /**
+ * Asked first.
+ */
+ public var confirm: AppHostConfirm
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ /**
+ * "Remove from account".
+ */label: String,
+ /**
+ * Can be pressed now.
+ */enabled: Bool,
+ /**
+ * Why not, when it cannot.
+ */help: String?,
+ /**
+ * This machine: its host setup is removed (the host's `remove`).
+ */host: Bool,
+ /**
+ * Another machine: it leaves the relay directory (`relay:<id>`).
+ */machine: String?,
+ /**
+ * The device on it, revoked too.
+ */device: String?,
+ /**
+ * Asked first.
+ */confirm: AppHostConfirm) {
+ self.label = label
+ self.enabled = enabled
+ self.help = help
+ self.host = host
+ self.machine = machine
+ self.device = device
+ self.confirm = confirm
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension AppMachinesViewRemove: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeAppMachinesViewRemove: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppMachinesViewRemove {
+ return
+ try AppMachinesViewRemove(
+ label: FfiConverterString.read(from: &buf),
+ enabled: FfiConverterBool.read(from: &buf),
+ help: FfiConverterOptionString.read(from: &buf),
+ host: FfiConverterBool.read(from: &buf),
+ machine: FfiConverterOptionString.read(from: &buf),
+ device: FfiConverterOptionString.read(from: &buf),
+ confirm: FfiConverterTypeAppHostConfirm.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: AppMachinesViewRemove, into buf: inout [UInt8]) {
+ FfiConverterString.write(value.label, into: &buf)
+ FfiConverterBool.write(value.enabled, into: &buf)
+ FfiConverterOptionString.write(value.help, into: &buf)
+ FfiConverterBool.write(value.host, into: &buf)
+ FfiConverterOptionString.write(value.machine, into: &buf)
+ FfiConverterOptionString.write(value.device, into: &buf)
+ FfiConverterTypeAppHostConfirm.write(value.confirm, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesViewRemove_lift(_ buf: RustBuffer) throws -> AppMachinesViewRemove {
+ return try FfiConverterTypeAppMachinesViewRemove.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesViewRemove_lower(_ value: AppMachinesViewRemove) -> RustBuffer {
+ return FfiConverterTypeAppMachinesViewRemove.lower(value)
+}
+
+
+public struct AppMachinesViewRemoveAll: Equatable, Hashable {
+ /**
+ * "Remove old machines".
+ */
+ public var label: String
+ /**
+ * Asked first.
+ */
+ public var confirm: AppHostConfirm
+ /**
+ * What each removal does.
+ */
+ public var removes: [AppMachinesViewRemove]
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ /**
+ * "Remove old machines".
+ */label: String,
+ /**
+ * Asked first.
+ */confirm: AppHostConfirm,
+ /**
+ * What each removal does.
+ */removes: [AppMachinesViewRemove]) {
+ self.label = label
+ self.confirm = confirm
+ self.removes = removes
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension AppMachinesViewRemoveAll: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeAppMachinesViewRemoveAll: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppMachinesViewRemoveAll {
+ return
+ try AppMachinesViewRemoveAll(
+ label: FfiConverterString.read(from: &buf),
+ confirm: FfiConverterTypeAppHostConfirm.read(from: &buf),
+ removes: FfiConverterSequenceTypeAppMachinesViewRemove.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: AppMachinesViewRemoveAll, into buf: inout [UInt8]) {
+ FfiConverterString.write(value.label, into: &buf)
+ FfiConverterTypeAppHostConfirm.write(value.confirm, into: &buf)
+ FfiConverterSequenceTypeAppMachinesViewRemove.write(value.removes, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesViewRemoveAll_lift(_ buf: RustBuffer) throws -> AppMachinesViewRemoveAll {
+ return try FfiConverterTypeAppMachinesViewRemoveAll.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesViewRemoveAll_lower(_ value: AppMachinesViewRemoveAll) -> RustBuffer {
+ return FfiConverterTypeAppMachinesViewRemoveAll.lower(value)
+}
+
+
+public struct AppMachinesViewRename: Equatable, Hashable {
+ /**
+ * `host` (This machine's host setup), `machine` (another machine of
+ * yours on the relay) or `device` (one of your devices).
+ */
+ public var target: String
+ /**
+ * The id it is saved under (the relay machine's or the device's).
+ */
+ public var id: String
+ /**
+ * The dialog's title.
+ */
+ public var title: String
+ /**
+ * Its confirming button.
+ */
+ public var confirmLabel: String
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ /**
+ * `host` (This machine's host setup), `machine` (another machine of
+ * yours on the relay) or `device` (one of your devices).
+ */target: String,
+ /**
+ * The id it is saved under (the relay machine's or the device's).
+ */id: String,
+ /**
+ * The dialog's title.
+ */title: String,
+ /**
+ * Its confirming button.
+ */confirmLabel: String) {
+ self.target = target
+ self.id = id
+ self.title = title
+ self.confirmLabel = confirmLabel
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension AppMachinesViewRename: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeAppMachinesViewRename: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppMachinesViewRename {
+ return
+ try AppMachinesViewRename(
+ target: FfiConverterString.read(from: &buf),
+ id: FfiConverterString.read(from: &buf),
+ title: FfiConverterString.read(from: &buf),
+ confirmLabel: FfiConverterString.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: AppMachinesViewRename, into buf: inout [UInt8]) {
+ FfiConverterString.write(value.target, into: &buf)
+ FfiConverterString.write(value.id, into: &buf)
+ FfiConverterString.write(value.title, into: &buf)
+ FfiConverterString.write(value.confirmLabel, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesViewRename_lift(_ buf: RustBuffer) throws -> AppMachinesViewRename {
+ return try FfiConverterTypeAppMachinesViewRename.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesViewRename_lower(_ value: AppMachinesViewRename) -> RustBuffer {
+ return FfiConverterTypeAppMachinesViewRename.lower(value)
+}
+
+
+public struct AppMachinesViewSpace: Equatable, Hashable {
+ /**
+ * The Space's id (its page).
+ */
+ public var id: String
+ /**
+ * Its name.
+ */
+ public var name: String
+ /**
+ * Its system ("Ubuntu 24.04.5 LTS", "macOS").
+ */
+ public var os: String
+ /**
+ * Its status word ("Running", "Stopped").
+ */
+ public var status: String
+ /**
+ * Running (the green dot).
+ */
+ public var running: Bool
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ /**
+ * The Space's id (its page).
+ */id: String,
+ /**
+ * Its name.
+ */name: String,
+ /**
+ * Its system ("Ubuntu 24.04.5 LTS", "macOS").
+ */os: String,
+ /**
+ * Its status word ("Running", "Stopped").
+ */status: String,
+ /**
+ * Running (the green dot).
+ */running: Bool) {
+ self.id = id
+ self.name = name
+ self.os = os
+ self.status = status
+ self.running = running
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension AppMachinesViewSpace: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeAppMachinesViewSpace: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppMachinesViewSpace {
+ return
+ try AppMachinesViewSpace(
+ id: FfiConverterString.read(from: &buf),
+ name: FfiConverterString.read(from: &buf),
+ os: FfiConverterString.read(from: &buf),
+ status: FfiConverterString.read(from: &buf),
+ running: FfiConverterBool.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: AppMachinesViewSpace, into buf: inout [UInt8]) {
+ FfiConverterString.write(value.id, into: &buf)
+ FfiConverterString.write(value.name, into: &buf)
+ FfiConverterString.write(value.os, into: &buf)
+ FfiConverterString.write(value.status, into: &buf)
+ FfiConverterBool.write(value.running, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesViewSpace_lift(_ buf: RustBuffer) throws -> AppMachinesViewSpace {
+ return try FfiConverterTypeAppMachinesViewSpace.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesViewSpace_lower(_ value: AppMachinesViewSpace) -> RustBuffer {
+ return FfiConverterTypeAppMachinesViewSpace.lower(value)
+}
+
+
+public struct AppMachinesViewToggle: Equatable, Hashable {
+ /**
+ * `spaces` or `desktop`.
+ */
+ public var id: String
+ /**
+ * "Provide Spaces", "Share this desktop".
+ */
+ public var label: String
+ /**
+ * One line under it.
+ */
+ public var help: String
+ /**
+ * On now.
+ */
+ public var on: Bool
+ /**
+ * Changed here (This machine); another machine's are read-only.
+ */
+ public var editable: Bool
+ /**
+ * Can be flipped now.
+ */
+ public var enabled: Bool
+ /**
+ * What flipping it runs, in order (the host's actions).
+ */
+ public var actions: [AppHostActionId]
+ /**
+ * Before This machine is set up: flipping it opens the setup form
+ * with this profile (`desktop` or `spare`).
+ */
+ public var setup: String?
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ /**
+ * `spaces` or `desktop`.
+ */id: String,
+ /**
+ * "Provide Spaces", "Share this desktop".
+ */label: String,
+ /**
+ * One line under it.
+ */help: String,
+ /**
+ * On now.
+ */on: Bool,
+ /**
+ * Changed here (This machine); another machine's are read-only.
+ */editable: Bool,
+ /**
+ * Can be flipped now.
+ */enabled: Bool,
+ /**
+ * What flipping it runs, in order (the host's actions).
+ */actions: [AppHostActionId],
+ /**
+ * Before This machine is set up: flipping it opens the setup form
+ * with this profile (`desktop` or `spare`).
+ */setup: String?) {
+ self.id = id
+ self.label = label
+ self.help = help
+ self.on = on
+ self.editable = editable
+ self.enabled = enabled
+ self.actions = actions
+ self.setup = setup
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension AppMachinesViewToggle: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeAppMachinesViewToggle: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppMachinesViewToggle {
+ return
+ try AppMachinesViewToggle(
+ id: FfiConverterString.read(from: &buf),
+ label: FfiConverterString.read(from: &buf),
+ help: FfiConverterString.read(from: &buf),
+ on: FfiConverterBool.read(from: &buf),
+ editable: FfiConverterBool.read(from: &buf),
+ enabled: FfiConverterBool.read(from: &buf),
+ actions: FfiConverterSequenceTypeAppHostActionId.read(from: &buf),
+ setup: FfiConverterOptionString.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: AppMachinesViewToggle, into buf: inout [UInt8]) {
+ FfiConverterString.write(value.id, into: &buf)
+ FfiConverterString.write(value.label, into: &buf)
+ FfiConverterString.write(value.help, into: &buf)
+ FfiConverterBool.write(value.on, into: &buf)
+ FfiConverterBool.write(value.editable, into: &buf)
+ FfiConverterBool.write(value.enabled, into: &buf)
+ FfiConverterSequenceTypeAppHostActionId.write(value.actions, into: &buf)
+ FfiConverterOptionString.write(value.setup, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesViewToggle_lift(_ buf: RustBuffer) throws -> AppMachinesViewToggle {
+ return try FfiConverterTypeAppMachinesViewToggle.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesViewToggle_lower(_ value: AppMachinesViewToggle) -> RustBuffer {
+ return FfiConverterTypeAppMachinesViewToggle.lower(value)
+}
+
+
public struct AppMainChrome: Equatable, Hashable {
/**
* Window title when nothing is selected.
@@ -60928,6 +62698,102 @@ fileprivate struct FfiConverterOptionTypeAppMachineAccessNotice: FfiConverterRus
}
}
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+fileprivate struct FfiConverterOptionTypeAppMachinesViewIssueAction: FfiConverterRustBuffer {
+ typealias SwiftType = AppMachinesViewIssueAction?
+
+ public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
+ guard let value = value else {
+ writeInt(&buf, Int8(0))
+ return
+ }
+ writeInt(&buf, Int8(1))
+ FfiConverterTypeAppMachinesViewIssueAction.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 FfiConverterTypeAppMachinesViewIssueAction.read(from: &buf)
+ default: throw UniffiInternalError.unexpectedOptionalTag
+ }
+ }
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+fileprivate struct FfiConverterOptionTypeAppMachinesViewRemove: FfiConverterRustBuffer {
+ typealias SwiftType = AppMachinesViewRemove?
+
+ public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
+ guard let value = value else {
+ writeInt(&buf, Int8(0))
+ return
+ }
+ writeInt(&buf, Int8(1))
+ FfiConverterTypeAppMachinesViewRemove.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 FfiConverterTypeAppMachinesViewRemove.read(from: &buf)
+ default: throw UniffiInternalError.unexpectedOptionalTag
+ }
+ }
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+fileprivate struct FfiConverterOptionTypeAppMachinesViewRemoveAll: FfiConverterRustBuffer {
+ typealias SwiftType = AppMachinesViewRemoveAll?
+
+ public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
+ guard let value = value else {
+ writeInt(&buf, Int8(0))
+ return
+ }
+ writeInt(&buf, Int8(1))
+ FfiConverterTypeAppMachinesViewRemoveAll.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 FfiConverterTypeAppMachinesViewRemoveAll.read(from: &buf)
+ default: throw UniffiInternalError.unexpectedOptionalTag
+ }
+ }
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+fileprivate struct FfiConverterOptionTypeAppMachinesViewRename: FfiConverterRustBuffer {
+ typealias SwiftType = AppMachinesViewRename?
+
+ public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
+ guard let value = value else {
+ writeInt(&buf, Int8(0))
+ return
+ }
+ writeInt(&buf, Int8(1))
+ FfiConverterTypeAppMachinesViewRename.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 FfiConverterTypeAppMachinesViewRename.read(from: &buf)
+ default: throw UniffiInternalError.unexpectedOptionalTag
+ }
+ }
+}
+
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
@@ -62248,6 +64114,30 @@ fileprivate struct FfiConverterOptionTypeAppEnrollMethod: FfiConverterRustBuffer
}
}
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+fileprivate struct FfiConverterOptionTypeAppHostActionId: FfiConverterRustBuffer {
+ typealias SwiftType = AppHostActionId?
+
+ public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
+ guard let value = value else {
+ writeInt(&buf, Int8(0))
+ return
+ }
+ writeInt(&buf, Int8(1))
+ FfiConverterTypeAppHostActionId.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 FfiConverterTypeAppHostActionId.read(from: &buf)
+ default: throw UniffiInternalError.unexpectedOptionalTag
+ }
+ }
+}
+
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
@@ -62680,6 +64570,30 @@ fileprivate struct FfiConverterOptionSequenceTypeAppGpuChoice: FfiConverterRustB
}
}
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+fileprivate struct FfiConverterOptionSequenceTypeAppMachinePageRow: FfiConverterRustBuffer {
+ typealias SwiftType = [AppMachinePageRow]?
+
+ public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
+ guard let value = value else {
+ writeInt(&buf, Int8(0))
+ return
+ }
+ writeInt(&buf, Int8(1))
+ FfiConverterSequenceTypeAppMachinePageRow.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 FfiConverterSequenceTypeAppMachinePageRow.read(from: &buf)
+ default: throw UniffiInternalError.unexpectedOptionalTag
+ }
+ }
+}
+
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
@@ -64303,6 +66217,256 @@ fileprivate struct FfiConverterSequenceTypeAppMachinePageRow: FfiConverterRustBu
}
}
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+fileprivate struct FfiConverterSequenceTypeAppMachinesViewCheck: FfiConverterRustBuffer {
+ typealias SwiftType = [AppMachinesViewCheck]
+
+ public static func write(_ value: [AppMachinesViewCheck], into buf: inout [UInt8]) {
+ let len = Int32(value.count)
+ writeInt(&buf, len)
+ for item in value {
+ FfiConverterTypeAppMachinesViewCheck.write(item, into: &buf)
+ }
+ }
+
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [AppMachinesViewCheck] {
+ let len: Int32 = try readInt(&buf)
+ var seq = [AppMachinesViewCheck]()
+ seq.reserveCapacity(Int(len))
+ for _ in 0 ..< len {
+ seq.append(try FfiConverterTypeAppMachinesViewCheck.read(from: &buf))
+ }
+ return seq
+ }
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+fileprivate struct FfiConverterSequenceTypeAppMachinesViewFact: FfiConverterRustBuffer {
+ typealias SwiftType = [AppMachinesViewFact]
+
+ public static func write(_ value: [AppMachinesViewFact], into buf: inout [UInt8]) {
+ let len = Int32(value.count)
+ writeInt(&buf, len)
+ for item in value {
+ FfiConverterTypeAppMachinesViewFact.write(item, into: &buf)
+ }
+ }
+
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [AppMachinesViewFact] {
+ let len: Int32 = try readInt(&buf)
+ var seq = [AppMachinesViewFact]()
+ seq.reserveCapacity(Int(len))
+ for _ in 0 ..< len {
+ seq.append(try FfiConverterTypeAppMachinesViewFact.read(from: &buf))
+ }
+ return seq
+ }
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+fileprivate struct FfiConverterSequenceTypeAppMachinesViewGroup: FfiConverterRustBuffer {
+ typealias SwiftType = [AppMachinesViewGroup]
+
+ public static func write(_ value: [AppMachinesViewGroup], into buf: inout [UInt8]) {
+ let len = Int32(value.count)
+ writeInt(&buf, len)
+ for item in value {
+ FfiConverterTypeAppMachinesViewGroup.write(item, into: &buf)
+ }
+ }
+
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [AppMachinesViewGroup] {
+ let len: Int32 = try readInt(&buf)
+ var seq = [AppMachinesViewGroup]()
+ seq.reserveCapacity(Int(len))
+ for _ in 0 ..< len {
+ seq.append(try FfiConverterTypeAppMachinesViewGroup.read(from: &buf))
+ }
+ return seq
+ }
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+fileprivate struct FfiConverterSequenceTypeAppMachinesViewHealth: FfiConverterRustBuffer {
+ typealias SwiftType = [AppMachinesViewHealth]
+
+ public static func write(_ value: [AppMachinesViewHealth], into buf: inout [UInt8]) {
+ let len = Int32(value.count)
+ writeInt(&buf, len)
+ for item in value {
+ FfiConverterTypeAppMachinesViewHealth.write(item, into: &buf)
+ }
+ }
+
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [AppMachinesViewHealth] {
+ let len: Int32 = try readInt(&buf)
+ var seq = [AppMachinesViewHealth]()
+ seq.reserveCapacity(Int(len))
+ for _ in 0 ..< len {
+ seq.append(try FfiConverterTypeAppMachinesViewHealth.read(from: &buf))
+ }
+ return seq
+ }
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+fileprivate struct FfiConverterSequenceTypeAppMachinesViewIssue: FfiConverterRustBuffer {
+ typealias SwiftType = [AppMachinesViewIssue]
+
+ public static func write(_ value: [AppMachinesViewIssue], into buf: inout [UInt8]) {
+ let len = Int32(value.count)
+ writeInt(&buf, len)
+ for item in value {
+ FfiConverterTypeAppMachinesViewIssue.write(item, into: &buf)
+ }
+ }
+
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [AppMachinesViewIssue] {
+ let len: Int32 = try readInt(&buf)
+ var seq = [AppMachinesViewIssue]()
+ seq.reserveCapacity(Int(len))
+ for _ in 0 ..< len {
+ seq.append(try FfiConverterTypeAppMachinesViewIssue.read(from: &buf))
+ }
+ return seq
+ }
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+fileprivate struct FfiConverterSequenceTypeAppMachinesViewMachine: FfiConverterRustBuffer {
+ typealias SwiftType = [AppMachinesViewMachine]
+
+ public static func write(_ value: [AppMachinesViewMachine], into buf: inout [UInt8]) {
+ let len = Int32(value.count)
+ writeInt(&buf, len)
+ for item in value {
+ FfiConverterTypeAppMachinesViewMachine.write(item, into: &buf)
+ }
+ }
+
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [AppMachinesViewMachine] {
+ let len: Int32 = try readInt(&buf)
+ var seq = [AppMachinesViewMachine]()
+ seq.reserveCapacity(Int(len))
+ for _ in 0 ..< len {
+ seq.append(try FfiConverterTypeAppMachinesViewMachine.read(from: &buf))
+ }
+ return seq
+ }
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+fileprivate struct FfiConverterSequenceTypeAppMachinesViewRelay: FfiConverterRustBuffer {
+ typealias SwiftType = [AppMachinesViewRelay]
+
+ public static func write(_ value: [AppMachinesViewRelay], into buf: inout [UInt8]) {
+ let len = Int32(value.count)
+ writeInt(&buf, len)
+ for item in value {
+ FfiConverterTypeAppMachinesViewRelay.write(item, into: &buf)
+ }
+ }
+
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [AppMachinesViewRelay] {
+ let len: Int32 = try readInt(&buf)
+ var seq = [AppMachinesViewRelay]()
+ seq.reserveCapacity(Int(len))
+ for _ in 0 ..< len {
+ seq.append(try FfiConverterTypeAppMachinesViewRelay.read(from: &buf))
+ }
+ return seq
+ }
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+fileprivate struct FfiConverterSequenceTypeAppMachinesViewRemove: FfiConverterRustBuffer {
+ typealias SwiftType = [AppMachinesViewRemove]
+
+ public static func write(_ value: [AppMachinesViewRemove], into buf: inout [UInt8]) {
+ let len = Int32(value.count)
+ writeInt(&buf, len)
+ for item in value {
+ FfiConverterTypeAppMachinesViewRemove.write(item, into: &buf)
+ }
+ }
+
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [AppMachinesViewRemove] {
+ let len: Int32 = try readInt(&buf)
+ var seq = [AppMachinesViewRemove]()
+ seq.reserveCapacity(Int(len))
+ for _ in 0 ..< len {
+ seq.append(try FfiConverterTypeAppMachinesViewRemove.read(from: &buf))
+ }
+ return seq
+ }
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+fileprivate struct FfiConverterSequenceTypeAppMachinesViewSpace: FfiConverterRustBuffer {
+ typealias SwiftType = [AppMachinesViewSpace]
+
+ public static func write(_ value: [AppMachinesViewSpace], into buf: inout [UInt8]) {
+ let len = Int32(value.count)
+ writeInt(&buf, len)
+ for item in value {
+ FfiConverterTypeAppMachinesViewSpace.write(item, into: &buf)
+ }
+ }
+
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [AppMachinesViewSpace] {
+ let len: Int32 = try readInt(&buf)
+ var seq = [AppMachinesViewSpace]()
+ seq.reserveCapacity(Int(len))
+ for _ in 0 ..< len {
+ seq.append(try FfiConverterTypeAppMachinesViewSpace.read(from: &buf))
+ }
+ return seq
+ }
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+fileprivate struct FfiConverterSequenceTypeAppMachinesViewToggle: FfiConverterRustBuffer {
+ typealias SwiftType = [AppMachinesViewToggle]
+
+ public static func write(_ value: [AppMachinesViewToggle], into buf: inout [UInt8]) {
+ let len = Int32(value.count)
+ writeInt(&buf, len)
+ for item in value {
+ FfiConverterTypeAppMachinesViewToggle.write(item, into: &buf)
+ }
+ }
+
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [AppMachinesViewToggle] {
+ let len: Int32 = try readInt(&buf)
+ var seq = [AppMachinesViewToggle]()
+ seq.reserveCapacity(Int(len))
+ for _ in 0 ..< len {
+ seq.append(try FfiConverterTypeAppMachinesViewToggle.read(from: &buf))
+ }
+ return seq
+ }
+}
+
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
@@ -66678,6 +68842,31 @@ fileprivate struct FfiConverterSequenceTypeAppDragOverlayEvent: FfiConverterRust
}
}
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+fileprivate struct FfiConverterSequenceTypeAppHostActionId: FfiConverterRustBuffer {
+ typealias SwiftType = [AppHostActionId]
+
+ public static func write(_ value: [AppHostActionId], into buf: inout [UInt8]) {
+ let len = Int32(value.count)
+ writeInt(&buf, len)
+ for item in value {
+ FfiConverterTypeAppHostActionId.write(item, into: &buf)
+ }
+ }
+
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [AppHostActionId] {
+ let len: Int32 = try readInt(&buf)
+ var seq = [AppHostActionId]()
+ seq.reserveCapacity(Int(len))
+ for _ in 0 ..< len {
+ seq.append(try FfiConverterTypeAppHostActionId.read(from: &buf))
+ }
+ return seq
+ }
+}
+
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
@@ -68235,6 +70424,27 @@ public func appMachinesPageRows(input: AppMachinesPageInput) -> [AppMachinePageR
)
})
}
+/**
+ * The Machines page as every UI draws it: the list in groups, one line
+ * per row, and each machine's page.
+ */
+public func appMachinesView(input: AppMachinesViewInput) -> AppMachinesView {
+ return try! FfiConverterTypeAppMachinesView_lift(try! rustCall() {
+ uniffi_cua_spaces_ffi_fn_func_app_machines_view(
+ FfiConverterTypeAppMachinesViewInput_lower(input),$0
+ )
+})
+}
+/**
+ * Machines view input from JSON (fixtures, parity flows).
+ */
+public func appMachinesViewInputFromJson(json: String)throws -> AppMachinesViewInput {
+ return try FfiConverterTypeAppMachinesViewInput_lift(try rustCallWithError(FfiConverterTypeCuaError_lift) {
+ uniffi_cua_spaces_ffi_fn_func_app_machines_view_input_from_json(
+ FfiConverterString.lower(json),$0
+ )
+})
+}
/**
* The main window's chrome (account line, New Space, empty state).
*/
@@ -70712,6 +72922,12 @@ private let initializationResult: InitializationResult = {
if (uniffi_cua_spaces_ffi_checksum_func_app_machines_page_rows() != 50072) {
return InitializationResult.apiChecksumMismatch
}
+ if (uniffi_cua_spaces_ffi_checksum_func_app_machines_view() != 7497) {
+ return InitializationResult.apiChecksumMismatch
+ }
+ if (uniffi_cua_spaces_ffi_checksum_func_app_machines_view_input_from_json() != 47089) {
+ return InitializationResult.apiChecksumMismatch
+ }
if (uniffi_cua_spaces_ffi_checksum_func_app_main_chrome() != 29313) {
return InitializationResult.apiChecksumMismatch
}
diff --git a/libs/spaces-app-swift/Sources/cua_spaces_ffiFFI/include/cua_spaces_ffiFFI.h b/libs/spaces-app-swift/Sources/cua_spaces_ffiFFI/include/cua_spaces_ffiFFI.h
index 7d3979b0d9..07bf0ad5c2 100644
--- a/libs/spaces-app-swift/Sources/cua_spaces_ffiFFI/include/cua_spaces_ffiFFI.h
+++ b/libs/spaces-app-swift/Sources/cua_spaces_ffiFFI/include/cua_spaces_ffiFFI.h
@@ -1273,6 +1273,16 @@ RustBuffer uniffi_cua_spaces_ffi_fn_func_app_machines_page_input_from_json(RustB
RustBuffer uniffi_cua_spaces_ffi_fn_func_app_machines_page_rows(RustBuffer input, RustCallStatus *_Nonnull out_status
);
#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_MACHINES_VIEW
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_MACHINES_VIEW
+RustBuffer uniffi_cua_spaces_ffi_fn_func_app_machines_view(RustBuffer input, RustCallStatus *_Nonnull out_status
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_MACHINES_VIEW_INPUT_FROM_JSON
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_MACHINES_VIEW_INPUT_FROM_JSON
+RustBuffer uniffi_cua_spaces_ffi_fn_func_app_machines_view_input_from_json(RustBuffer json, RustCallStatus *_Nonnull out_status
+);
+#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_MAIN_CHROME
#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_MAIN_CHROME
RustBuffer uniffi_cua_spaces_ffi_fn_func_app_main_chrome(RustBuffer input, RustCallStatus *_Nonnull out_status
@@ -3198,6 +3208,18 @@ uint16_t uniffi_cua_spaces_ffi_checksum_func_app_machines_page_input_from_json(v
#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_MACHINES_PAGE_ROWS
uint16_t uniffi_cua_spaces_ffi_checksum_func_app_machines_page_rows(void
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_MACHINES_VIEW
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_MACHINES_VIEW
+uint16_t uniffi_cua_spaces_ffi_checksum_func_app_machines_view(void
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_MACHINES_VIEW_INPUT_FROM_JSON
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_MACHINES_VIEW_INPUT_FROM_JSON
+uint16_t uniffi_cua_spaces_ffi_checksum_func_app_machines_view_input_from_json(void
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_MAIN_CHROME
diff --git a/scripts/docs-generators/cli-specs/cua.json b/scripts/docs-generators/cli-specs/cua.json
index ccfc112ee6..0cd5f8089b 100644
--- a/scripts/docs-generators/cli-specs/cua.json
+++ b/scripts/docs-generators/cli-specs/cua.json
@@ -8821,6 +8821,22 @@
"type": "path",
"value_name": "FILE"
},
+ {
+ "aliases": [],
+ "default_value": null,
+ "env": null,
+ "help": "Check a machine's health instead, as its own cua daemon sees it (the checks the Machines page shows): another of your machines by name or id, over the relay, the mesh or its direct address, or `this`",
+ "hidden": false,
+ "is_optional": true,
+ "multiple_values": false,
+ "name": "machine",
+ "possible_values": [],
+ "repeatable": false,
+ "short_name": null,
+ "takes_value": true,
+ "type": "string",
+ "value_name": "MACHINE"
+ },
{
"aliases": [],
"default_value": null,
diff --git a/scripts/docs-generators/cua-sdk.ts b/scripts/docs-generators/cua-sdk.ts
index 10ebc8b573..935fd6fa4e 100644
--- a/scripts/docs-generators/cua-sdk.ts
+++ b/scripts/docs-generators/cua-sdk.ts
@@ -688,6 +688,15 @@ export const PAGES: PageSpec[] = [
'`auth.devices(relay_url, name)` returns this device on the relay, its key in the session\'s credential store (shared with the `cua` CLI and daemon). A device lists and reaches the account\'s machines once enrolled: right after a fresh sign-in (a sign-in through `Auth.begin_login` re-registers a device that already has a key), or by a one-time code approved from an enrolled device (`cua devices approve`). A new key of the same machine replaces its old record. Enrollment lasts 30 days, then one approval or a fresh sign-in re-verifies it. Nothing here prompts; gate `approve` behind presence in your UI.',
items: ['Devices', 'DevicesSnapshot', 'RelayDevice', 'RelayAuditEvent', 'DeviceEnrollment'],
},
+ {
+ slug: 'spaces/machine-health',
+ title: 'Computer health',
+ description: "A computer's health as its own cua daemon checks it: Local Network access, disk, virtualization, memory and permissions.",
+ intro:
+ '`Spaces.machine_health` asks a computer\'s cua daemon to check it (this computer with `None`, another of yours by id or name over the relay, the mesh or its direct address). The Computers page shows the warnings and failures as the computer\'s issues; `cua doctor --machine` prints them.',
+ members: [{ object: 'Spaces', title: 'Check a computer', methods: ['machine_health'] }],
+ items: ['MachineHealth', 'MachineHealthCheck'],
+ },
{
slug: 'spaces/host',
title: 'Host, relay and devices',
@@ -755,6 +764,7 @@ export const MERGED: Record<string, string> = {
'spaces/cloud': 'spaces/persistent-agents',
'spaces/volume-sync': 'spaces/volume',
'spaces/devices': 'spaces/host',
+ 'spaces/machine-health': 'spaces/host',
'agent-setup': 'agents',
telemetry: 'auth',
};