Skip to content

armgit / cua

Public Imported from GitHub
0

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

fix(spaces): same checklist count and every machine in every UI (#5106)

ddupontff6079bef5b6
diff --git a/apps/cua-spaces-desktop/src/bridge/agents.ts b/apps/cua-spaces-desktop/src/bridge/agents.ts
index 40d0b099b7..1329a3ab48 100644
--- a/apps/cua-spaces-desktop/src/bridge/agents.ts
+++ b/apps/cua-spaces-desktop/src/bridge/agents.ts
@@ -50,6 +50,7 @@ export function agentsMethods({ model }: BridgeContext): Handlers {
"agents.runs": async (args) => {
const runs = model.agents.runs(string(args, "spaceId"));
await runs.refresh();
+ if (runs.load.kind === "ready") model.sawAgentRuns(runs.load.rows.length);
switch (runs.load.kind) {
case "ready":
return encode(runs.load.rows);
diff --git a/apps/cua-spaces-desktop/src/bridge/checklist.ts b/apps/cua-spaces-desktop/src/bridge/checklist.ts
new file mode 100644
index 0000000000..edffe56b0f
--- /dev/null
+++ b/apps/cua-spaces-desktop/src/bridge/checklist.ts
@@ -0,0 +1,51 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+// The getting-started checklist's one copy (`checklist.get`,
+// `checklist.send`; the SwiftUI host's WebUIBridge), kept by the app
+// (`model/checklist.ts`). The page sends a step done, shown, dismiss,
+// reopen, or merge (what it kept itself before, merged once); the app
+// ticks steps off from what it shows itself, so `observe` is refused.
+import type { AppChecklistAction } from "../native/generated/index";
+import type { AppModel } from "../model/app-model";
+import type { StoredChecklist } from "../model/checklist";
+import type { BridgeContext } from "./context";
+import { Failure, type Handlers } from "./host";
+
+/** A page's checklist action as the core's. */
+export function checklistAction(model: AppModel, raw: unknown): AppChecklistAction {
+ const a = raw && typeof raw === "object" && !Array.isArray(raw) ? (raw as Record<string, unknown>) : null;
+ if (!a || typeof a.type !== "string") throw Failure.badArgs("action: {type}");
+ const A = model.native.AppChecklistAction;
+ const c = model.checklist;
+ switch (a.type) {
+ case "done": {
+ const step = c.fromStored({ done: [String(a.step)] }).done[0];
+ if (step === undefined) throw Failure.badArgs("step: one of the checklist's steps");
+ return new A.Done({ step });
+ }
+ case "shown":
+ return new A.Shown();
+ case "dismiss":
+ return new A.Dismiss();
+ case "reopen":
+ return new A.Reopen();
+ case "merge": {
+ const s = a.state;
+ if (!s || typeof s !== "object" || Array.isArray(s)) throw Failure.badArgs("state: {done, dismissed, shown}");
+ return new A.Merge({ state: c.fromStored(s as Partial<StoredChecklist>) });
+ }
+ default:
+ throw Failure.badArgs("action: done, shown, dismiss, reopen or merge");
+ }
+}
+
+export function checklistMethods({ model }: BridgeContext): Handlers {
+ return {
+ "checklist.get": () => ({ state: model.checklist.stored }),
+ "checklist.send": (args) => {
+ model.checklist.send(checklistAction(model, args.action));
+ return { state: model.checklist.stored };
+ },
+ };
+}
diff --git a/apps/cua-spaces-desktop/src/bridge/index.ts b/apps/cua-spaces-desktop/src/bridge/index.ts
index 7cc76fd0bb..c20e9fcfed 100644
--- a/apps/cua-spaces-desktop/src/bridge/index.ts
+++ b/apps/cua-spaces-desktop/src/bridge/index.ts
@@ -6,12 +6,13 @@
// SwiftUI host's names (`methods.ts`); this puts them in one table and tells
// the page when what it shows changed (`cua:event`: `spaces.changed`,
// `machines.changed`, `keyvault.changed`, `session.changed`, `settings.changed`,
-// `startup.changed`, `spaces.createProgress`). `ipc.ts` carries it over
+// `checklist.changed`, `startup.changed`, `spaces.createProgress`). `ipc.ts` carries it over
// Electron's IPC.
import { aboutMethods } from "./about";
import { agentKeysMethods } from "./agent-keys";
import { agentsMethods, agentsSignature } from "./agents";
import { appMethods } from "./app";
+import { checklistMethods } from "./checklist";
import { cloudsMethods } from "./clouds";
import type { BridgeContext } from "./context";
import { devicesMethods } from "./devices";
@@ -65,6 +66,7 @@ export const AREAS = [
streamMethods,
onboardingMethods,
relayUsageMethods,
+ checklistMethods,
presenceMethods,
];
@@ -109,6 +111,7 @@ function followModel(ctx: BridgeContext): () => void {
"agents.changed": () => agentsSignature(model),
// The broker's overview, whether an action is running, and the copies dismissed from the notch.
"keyvault.changed": () => [encode(model.keyvault.overview), model.keyvault.busy, model.keyvault.dismissed],
+ "checklist.changed": () => model.checklist.stored,
};
const byChange: Record<string, string> = {
spaces: "spaces.changed",
@@ -117,6 +120,7 @@ function followModel(ctx: BridgeContext): () => void {
machines: "machines.changed",
agents: "agents.changed",
keyvault: "keyvault.changed",
+ checklist: "checklist.changed",
};
const last = new Map<string, string>(Object.entries(read).map(([e, f]) => [e, signature(f())]));
const due = new Set<string>();
diff --git a/apps/cua-spaces-desktop/src/bridge/machines.ts b/apps/cua-spaces-desktop/src/bridge/machines.ts
index 295c3987b8..d085e0172a 100644
--- a/apps/cua-spaces-desktop/src/bridge/machines.ts
+++ b/apps/cua-spaces-desktop/src/bridge/machines.ts
@@ -19,13 +19,7 @@ export function hostStatus(model: AppModel): unknown {
/** `relay:<machine>` rows' reported hostnames, by machine id. */
export function relayHostnames(model: AppModel): Record<string, string> {
- const out: Record<string, string> = {};
- for (const space of model.spaces) {
- if (!space.id.startsWith("relay:") || space.host) continue;
- const name = model.backend.reportedHostname(space.id);
- if (name) out[space.id.slice(6)] = name;
- }
- return out;
+ return model.relayHostnames;
}
export function machinesState(model: AppModel) {
@@ -44,6 +38,9 @@ export function machinesState(model: AppModel) {
// Who the relay sees connected now.
presence: devices.relayOnline,
deviceStates: devices.deviceStates,
+ // The page's rows as the core lists them (`machines::page_rows`), the
+ // same the SwiftUI Machines page shows.
+ rows: encode(model.machinePageRows),
};
}
diff --git a/apps/cua-spaces-desktop/src/bridge/methods.ts b/apps/cua-spaces-desktop/src/bridge/methods.ts
index eb0dbc0000..a6d449a018 100644
--- a/apps/cua-spaces-desktop/src/bridge/methods.ts
+++ b/apps/cua-spaces-desktop/src/bridge/methods.ts
@@ -43,6 +43,7 @@ export const METHODS = [
"window.setBackgroundColor", "window.setDragRegions", "window.setDropTargets",
"startup.get", "startup.act",
"relay.usage",
+ "checklist.get", "checklist.send",
] as const;
/** A live desktop's media ticket for the page's WebCodecs player, the
diff --git a/apps/cua-spaces-desktop/src/model/app-model.ts b/apps/cua-spaces-desktop/src/model/app-model.ts
index 96d18b681c..cd1cb92d02 100644
--- a/apps/cua-spaces-desktop/src/model/app-model.ts
+++ b/apps/cua-spaces-desktop/src/model/app-model.ts
@@ -16,6 +16,7 @@ import type {
AppGpuChoice,
AppCloudPricing,
AppLocalStorage,
+ AppMachinePageRow,
AppMainChrome,
AppRosterAction,
AppRosterState,
@@ -33,6 +34,7 @@ import type {
} from "../native/generated/index";
import type { LocalRuntimes, SpacesBackend } from "./backend";
import { AgentsModel, type AgentSetupRunning, type ToolRunner } from "./agents";
+import { ChecklistModel } from "./checklist";
import type { CloudModel } from "./cloud";
import type { DevicesModel } from "./devices";
import { NotchActivity } from "./activity";
@@ -46,7 +48,7 @@ import { noLocalRuntimeReason } from "./local-runtime";
import { TimeoutError, sleep, withTimeout } from "./time";
/** What changed, for the page's events. */
-export type ModelChange = "spaces" | "session" | "settings" | "machines" | "agents" | "keyvault";
+export type ModelChange = "spaces" | "session" | "settings" | "machines" | "agents" | "keyvault" | "checklist";
export interface AppModelDeps {
native: Native;
@@ -68,6 +70,12 @@ export interface AppModelDeps {
servicesIn: () => boolean;
/** CPUs this machine has (the wizard's limit). */
cpus: number;
+ /** Where the getting-started checklist is kept (null: in memory). */
+ checklistPath?: string | null;
+ /** A checklist to start from when there is none yet (the SwiftUI app's, on macOS). */
+ checklistSeedPath?: string | null;
+ /** The system this app runs on (names This machine on the Machines page). */
+ hostOs?: AppSpaceOs;
}
/** The create the daemon never took. */
@@ -94,6 +102,11 @@ export class AppModel {
/** Agents: the persistent agents, a Space's runs, the provider keys and the coding agents. */
readonly agents: AgentsModel;
readonly keyvault: KeyvaultModel;
+ /** The getting-started checklist: the app's one copy. */
+ readonly checklist: ChecklistModel;
+ /** Agent runs seen in any Space (the page's Agents page): "Run an agent". */
+ agentRunsSeen = 0;
+ readonly hostOs: AppSpaceOs;
readonly settingsPath: string;
settings: AppSettings;
roster: AppRosterState;
@@ -161,6 +174,8 @@ export class AppModel {
private hostInFlight: Promise<void> | null = null;
private createTicker: NodeJS.Timeout | null = null;
private readonly listeners = new Set<(change: ModelChange) => void>();
+ /** The persistent agents were read for the checklist. */
+ private checklistReadAgents = false;
constructor(d: AppModelDeps) {
this.native = d.native;
@@ -183,6 +198,10 @@ export class AppModel {
return id?.startsWith("relay:") ? id : null;
};
this.keyvault = d.keyvault ?? new KeyvaultModel(d.native, null);
+ this.hostOs = d.hostOs ?? d.native.AppSpaceOs.Macos;
+ this.checklist = new ChecklistModel(d.native, d.checklistPath ?? null, d.checklistSeedPath ?? null);
+ this.checklist.telemetry = d.telemetry;
+ this.checklist.onChange = () => this.changed("checklist");
this.settingsPath = d.settingsPath;
this.servicesInNow = d.servicesIn;
this.maxCpus = Math.max(2, Math.min(16, d.cpus));
@@ -229,6 +248,59 @@ export class AppModel {
changed(change: ModelChange): void {
for (const l of [...this.listeners]) l(change);
+ // The checklist ticks off what the app shows, whichever page is open.
+ if (change === "spaces" || change === "machines" || change === "agents") this.observeChecklist();
+ }
+
+ // MARK: Machines and getting started
+
+ /** What each machine sharing its desktop (`relay:<machine>`) reported as its hostname, by machine id. */
+ get relayHostnames(): Record<string, string> {
+ const out: Record<string, string> = {};
+ for (const space of this.spaces) {
+ if (!space.id.startsWith("relay:") || space.host) continue;
+ const name = this.backend.reportedHostname(space.id);
+ if (name) out[space.id.slice(6)] = name;
+ }
+ return out;
+ }
+
+ /** The Machines page's rows (the core's `machines::page_rows`, as the SwiftUI app lists them). */
+ get machinePageRows(): AppMachinePageRow[] {
+ const devices = this.devices.snapshot === null ? [] : this.devices.input.devices.map((d) => ({
+ id: d.id,
+ name: d.name,
+ platform: d.platform ?? "",
+ lastSeen: d.lastSeen,
+ current: d.current,
+ state: d.state,
+ }));
+ return this.native.appMachinesPageRows({
+ 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)),
+ });
+ }
+
+ /** A Space's agent runs were read: `count` of them. */
+ sawAgentRuns(count: number): void {
+ if (count <= this.agentRunsSeen) return;
+ this.agentRunsSeen = count;
+ this.observeChecklist();
+ }
+
+ /** Ticks the checklist off from what the app shows (the core's one reading). */
+ observeChecklist(): void {
+ const seen = this.native.appChecklistObserveFrom({
+ machines: this.machinePageRows,
+ spaces: this.spaces,
+ agents: this.agents.persistent.count,
+ runs: this.agentRunsSeen,
+ });
+ this.checklist.send(seen);
}
get servicesIn(): boolean {
@@ -415,6 +487,13 @@ export class AppModel {
if (first) this.selectedSpaceId = first;
}
this.changed("spaces");
+ // The checklist's "Run an agent": read the persistent agents once
+ // (the Agents page reads them again when it opens).
+ const runAgent = this.native.AppChecklistStep.RunAgent;
+ if (!this.checklistReadAgents && this.servicesIn && !this.checklist.state.done.includes(runAgent)) {
+ this.checklistReadAgents = true;
+ void this.agents.persistent.load();
+ }
// A preview for every running Space from the daemon's cache (it
// survives restarts), before one is opened.
void this.thumbnails.warm(this.streamableSpaceIds);
diff --git a/apps/cua-spaces-desktop/src/model/checklist.ts b/apps/cua-spaces-desktop/src/model/checklist.ts
new file mode 100644
index 0000000000..953c5f9abf
--- /dev/null
+++ b/apps/cua-spaces-desktop/src/model/checklist.ts
@@ -0,0 +1,108 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+// The getting-started checklist (the SwiftUI app's ChecklistModel.swift):
+// the core's `appChecklistReduce`, kept in `checklist.json` beside the app
+// core's settings. The one copy: the page reads and changes it through the
+// bridge (`checklist.get`, `checklist.send`), and the app ticks steps off
+// from what it shows (`appChecklistObserveFrom`, AppModel). On macOS, a
+// first launch with no file of its own starts from the SwiftUI app's
+// (`~/Library/Application Support/com.trycua.spaces.macos/checklist.json`),
+// so nobody loses ticked steps moving between the two apps.
+import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
+import * as path from "node:path";
+import type { AppChecklistAction, AppChecklistState, AppChecklistStep, AppTelemetrySignal } from "../native/generated/index";
+import type { Native } from "../native/load";
+
+/** The state as the file and the page keep it: steps as their words. */
+export interface StoredChecklist {
+ done: string[];
+ dismissed: boolean;
+ shown: boolean;
+}
+
+/** Each step and its word (`checklist::ChecklistStep::word`), in checklist order. */
+export function checklistWords(native: Native): [AppChecklistStep, string][] {
+ const S = native.AppChecklistStep;
+ return [
+ [S.AddMachine, "add_machine"],
+ [S.CreateSpace, "create_space"],
+ [S.Teleport, "teleport"],
+ [S.Share, "share"],
+ [S.RunAgent, "run_agent"],
+ ];
+}
+
+export class ChecklistModel {
+ state: AppChecklistState;
+ /** Where usage events go (`checklist_<step>`, `checklist_completed`, ...). */
+ telemetry: { record(signals: AppTelemetrySignal[]): void } | null = null;
+ /** The state changed (the page's `checklist.changed`). */
+ onChange: () => void = () => {};
+ private readonly words: [AppChecklistStep, string][];
+
+ /** `file`: where it is kept (null: in memory); `seed`: a file to start from when `file` has none. */
+ constructor(
+ private readonly native: Native,
+ private readonly file: string | null,
+ seed: string | null = null,
+ ) {
+ this.words = checklistWords(native);
+ const read = (f: string | null) => (f ? this.read(f) : null);
+ this.state = read(file) ?? read(seed) ?? { done: [], dismissed: false, shown: false };
+ }
+
+ /** The state with steps as words. */
+ get stored(): StoredChecklist {
+ return {
+ done: this.state.done.map((s) => this.words.find(([step]) => step === s)?.[1]).filter((w): w is string => Boolean(w)),
+ dismissed: this.state.dismissed,
+ shown: this.state.shown,
+ };
+ }
+
+ /** The core's state from steps as words (unknown words are dropped). */
+ fromStored(s: Partial<StoredChecklist>): AppChecklistState {
+ const done = Array.isArray(s.done) ? s.done : [];
+ return {
+ done: this.words.filter(([, w]) => done.includes(w)).map(([step]) => step),
+ dismissed: s.dismissed === true,
+ shown: s.shown === true,
+ };
+ }
+
+ send(action: AppChecklistAction): void {
+ const t = this.native.appChecklistReduce(this.state, action);
+ const before = JSON.stringify(this.stored);
+ this.state = t.state;
+ // A merge changes the state without events (they were recorded where
+ // the steps were ticked).
+ if (JSON.stringify(this.stored) !== before) {
+ this.save();
+ this.onChange();
+ }
+ if (t.signals.length) this.telemetry?.record(t.signals);
+ }
+
+ private read(file: string): AppChecklistState | null {
+ if (!existsSync(file)) return null;
+ try {
+ const raw = JSON.parse(readFileSync(file, "utf8")) as Partial<StoredChecklist> | null;
+ return raw && typeof raw === "object" ? this.fromStored(raw) : null;
+ } catch {
+ return null;
+ }
+ }
+
+ private save(): void {
+ if (!this.file) return;
+ try {
+ mkdirSync(path.dirname(this.file), { recursive: true });
+ const tmp = `${this.file}.tmp`;
+ writeFileSync(tmp, JSON.stringify(this.stored));
+ renameSync(tmp, this.file);
+ } catch {
+ // A full disk or a read-only folder: it still works until the app quits.
+ }
+ }
+}
diff --git a/apps/cua-spaces-desktop/src/model/environment.ts b/apps/cua-spaces-desktop/src/model/environment.ts
index 7cbbc21dde..f5daa1f3b2 100644
--- a/apps/cua-spaces-desktop/src/model/environment.ts
+++ b/apps/cua-spaces-desktop/src/model/environment.ts
@@ -12,7 +12,7 @@ import { existsSync, readFileSync } from "node:fs";
import * as os from "node:os";
import * as path from "node:path";
import type { Native } from "../native/load";
-import { appCoreStatePaths } from "../migrate-swift";
+import { appCoreStatePaths, swiftSupportDir } from "../migrate-swift";
import { nativeFiles } from "../native/location";
import type { CuaLike } from "../native/generated/index";
import { PendingAgentSetup, LiveAgentSetup } from "./agents";
@@ -119,6 +119,11 @@ export function makeModel(o: EnvironmentOptions): Environment {
keyvault,
servicesIn: () => gate.current !== null,
cpus: os.availableParallelism?.() ?? os.cpus().length,
+ // The checklist beside the app core's settings; on macOS, the SwiftUI
+ // app's ticks are where a first launch starts from.
+ checklistPath: path.join(path.dirname(settingsPath), "checklist.json"),
+ checklistSeedPath: platform === "darwin" ? path.join(swiftSupportDir(env.HOME || os.homedir()), "checklist.json") : null,
+ hostOs: platform === "win32" ? native.AppSpaceOs.Windows : platform === "linux" ? native.AppSpaceOs.Linux : native.AppSpaceOs.Macos,
});
// Signed out is null (setup signs in first); anything else is the error itself.
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 8f88c16034..e476cc9db0 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
@@ -557,11 +557,21 @@ const DEFINITIONS = {
ret: FfiType.RustBuffer,
hasRustCallStatus: true,
},
+ "uniffi_cua_spaces_ffi_fn_func_app_checklist_observe_from": {
+ args: [FfiType.RustBuffer],
+ ret: FfiType.RustBuffer,
+ hasRustCallStatus: true,
+ },
"uniffi_cua_spaces_ffi_fn_func_app_checklist_reduce": {
args: [FfiType.RustBuffer, FfiType.RustBuffer],
ret: FfiType.RustBuffer,
hasRustCallStatus: true,
},
+ "uniffi_cua_spaces_ffi_fn_func_app_checklist_state_from_json": {
+ args: [FfiType.RustBuffer],
+ ret: FfiType.RustBuffer,
+ hasRustCallStatus: true,
+ },
"uniffi_cua_spaces_ffi_fn_func_app_checklist_view": {
args: [FfiType.RustBuffer],
ret: FfiType.RustBuffer,
@@ -962,6 +972,16 @@ const DEFINITIONS = {
ret: FfiType.RustBuffer,
hasRustCallStatus: true,
},
+ "uniffi_cua_spaces_ffi_fn_func_app_machines_page_input_from_json": {
+ args: [FfiType.RustBuffer],
+ ret: FfiType.RustBuffer,
+ hasRustCallStatus: true,
+ },
+ "uniffi_cua_spaces_ffi_fn_func_app_machines_page_rows": {
+ args: [FfiType.RustBuffer],
+ ret: FfiType.RustBuffer,
+ hasRustCallStatus: true,
+ },
"uniffi_cua_spaces_ffi_fn_func_app_main_chrome": {
args: [FfiType.RustBuffer],
ret: FfiType.RustBuffer,
@@ -2217,11 +2237,21 @@ const DEFINITIONS = {
ret: FfiType.UInt16,
hasRustCallStatus: false,
},
+ "uniffi_cua_spaces_ffi_checksum_func_app_checklist_observe_from": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
"uniffi_cua_spaces_ffi_checksum_func_app_checklist_reduce": {
args: [],
ret: FfiType.UInt16,
hasRustCallStatus: false,
},
+ "uniffi_cua_spaces_ffi_checksum_func_app_checklist_state_from_json": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
"uniffi_cua_spaces_ffi_checksum_func_app_checklist_view": {
args: [],
ret: FfiType.UInt16,
@@ -2622,6 +2652,16 @@ const DEFINITIONS = {
ret: FfiType.UInt16,
hasRustCallStatus: false,
},
+ "uniffi_cua_spaces_ffi_checksum_func_app_machines_page_input_from_json": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
+ "uniffi_cua_spaces_ffi_checksum_func_app_machines_page_rows": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
"uniffi_cua_spaces_ffi_checksum_func_app_main_chrome": {
args: [],
ret: FfiType.UInt16,
@@ -3937,7 +3977,9 @@ interface NativeModuleInterface {
uniffi_cua_spaces_ffi_fn_func_app_billing_status(status: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
uniffi_cua_spaces_ffi_fn_func_app_catalog_entries_from_json(json: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
uniffi_cua_spaces_ffi_fn_func_app_catalog_entry(entry: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
+ uniffi_cua_spaces_ffi_fn_func_app_checklist_observe_from(seen: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
uniffi_cua_spaces_ffi_fn_func_app_checklist_reduce(state: Uint8Array, action: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
+ uniffi_cua_spaces_ffi_fn_func_app_checklist_state_from_json(json: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
uniffi_cua_spaces_ffi_fn_func_app_checklist_view(state: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
uniffi_cua_spaces_ffi_fn_func_app_chrome_input_from_json(json: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
uniffi_cua_spaces_ffi_fn_func_app_cloud_connect_action_from_json(json: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
@@ -4018,6 +4060,8 @@ interface NativeModuleInterface {
uniffi_cua_spaces_ffi_fn_func_app_launch_input_from_json(json: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
uniffi_cua_spaces_ffi_fn_func_app_login_item_launch_plan(choice: Uint8Array, onboarded: number, serves: number, status: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
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_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;
@@ -4269,7 +4313,9 @@ interface NativeModuleInterface {
uniffi_cua_spaces_ffi_checksum_func_app_billing_status(): number;
uniffi_cua_spaces_ffi_checksum_func_app_catalog_entries_from_json(): number;
uniffi_cua_spaces_ffi_checksum_func_app_catalog_entry(): number;
+ uniffi_cua_spaces_ffi_checksum_func_app_checklist_observe_from(): number;
uniffi_cua_spaces_ffi_checksum_func_app_checklist_reduce(): number;
+ uniffi_cua_spaces_ffi_checksum_func_app_checklist_state_from_json(): number;
uniffi_cua_spaces_ffi_checksum_func_app_checklist_view(): number;
uniffi_cua_spaces_ffi_checksum_func_app_chrome_input_from_json(): number;
uniffi_cua_spaces_ffi_checksum_func_app_cloud_connect_action_from_json(): number;
@@ -4350,6 +4396,8 @@ interface NativeModuleInterface {
uniffi_cua_spaces_ffi_checksum_func_app_launch_input_from_json(): number;
uniffi_cua_spaces_ffi_checksum_func_app_login_item_launch_plan(): number;
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_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 2409c16199..5df36adf77 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
@@ -747,6 +747,26 @@ export function appCatalogEntry(entry: TeleportCatalogEntry): AppCatalogEntry {
));
}
+/**
+ * What the app shows as the checklist's `Observe` (every UI the same).
+ */
+export function appChecklistObserveFrom(seen: AppChecklistSeen): AppChecklistAction {
+ return ((__rb: Uint8Array) => {
+ try {
+ return FfiConverterTypeAppChecklistAction.lift(__rb);
+ } finally {
+ nativeModule().rustbuffer_free(__rb);
+ }
+ })(uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cua_spaces_ffi_fn_func_app_checklist_observe_from(
+ FfiConverterTypeAppChecklistSeen.lower(seen, nativeModule().rustbuffer_alloc),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
/**
* The getting-started checklist after `action`, and its usage events.
*/
@@ -768,6 +788,27 @@ export function appChecklistReduce(state: AppChecklistState, action: AppChecklis
));
}
+/**
+ * Checklist state from JSON, steps as words (fixtures, parity flows).
+ */
+export function appChecklistStateFromJson(json: string): AppChecklistState /*throws*/ {
+ return ((__rb: Uint8Array) => {
+ try {
+ return FfiConverterTypeAppChecklistState.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_checklist_state_from_json(
+ FfiConverterString.lower(json, nativeModule().rustbuffer_alloc),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
/**
* The getting-started checklist as drawn.
*/
@@ -2423,6 +2464,48 @@ export function appMachineAccessNotice(kind: AppEnrollmentKind, pendingCode: str
));
}
+/**
+ * Machines page input from JSON (fixtures, parity flows).
+ */
+export function appMachinesPageInputFromJson(json: string): AppMachinesPageInput /*throws*/ {
+ return ((__rb: Uint8Array) => {
+ try {
+ return FfiConverterTypeAppMachinesPageInput.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_page_input_from_json(
+ FfiConverterString.lower(json, nativeModule().rustbuffer_alloc),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
+/**
+ * The Machines page's rows: this machine, your machines, your devices of
+ * their own, each computer once.
+ */
+export function appMachinesPageRows(input: AppMachinesPageInput): Array<AppMachinePageRow> {
+ return ((__rb: Uint8Array) => {
+ try {
+ return FfiConverterSequenceTypeAppMachinePageRow.lift(__rb);
+ } finally {
+ nativeModule().rustbuffer_free(__rb);
+ }
+ })(uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cua_spaces_ffi_fn_func_app_machines_page_rows(
+ FfiConverterTypeAppMachinesPageInput.lower(input, nativeModule().rustbuffer_alloc),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
/**
* The main window's chrome (account line, New Space, empty state).
*/
@@ -10332,299 +10415,1207 @@ const FfiConverterTypeAppChecklistRow = (() => {
return new FFIConverter();
})();
-export type AppChecklistState = {
+export type AppMachinePageRow = {
/**
- * Steps done, each once, in checklist order.
+ * The machine's id (`this-mac`, a relay machine id), or the device's
+ * id for a device of its own.
*/
- done: Array<AppChecklistStep>,
+ id: string,
/**
- * Closed with ×; Getting Started opens it again.
+ * What the page calls it.
*/
- dismissed: boolean,
+ name: string,
/**
- * It was on screen once (`checklist_shown` was recorded).
+ * Reached, connected to the relay, or (a device of its own) in a
+ * session in the last [`DEVICE_ONLINE_SECS`].
*/
- shown: boolean
+ online: boolean,
+ /**
+ * `macos`, `linux`, `windows`, or empty when unknown.
+ */
+ os: string,
+ /**
+ * `local` (this machine) or `relay`.
+ */
+ via: string,
+ /**
+ * The machine this app runs on.
+ */
+ current: boolean,
+ /**
+ * The device listed in this row, if any.
+ */
+ device?: string,
+ /**
+ * A device that is none of the machines: listed, never a "Run on"
+ * choice, and it has no Spaces or desktop of its own here.
+ */
+ deviceOnly: boolean,
+ /**
+ * The Spaces list's row that is this machine's own desktop
+ * (`this-mac`, `relay:<machine>`), when there is one: the classic
+ * UI's detail for it.
+ */
+ spaceId?: string,
+ /**
+ * Online, but its owner stopped sharing it.
+ */
+ stoppedSharing: boolean,
+ /**
+ * The device's last session (Unix seconds), when it has a device.
+ */
+ lastSeen?: bigint
}
/**
- * Generated factory for {@link AppChecklistState} record objects.
+ * Generated factory for {@link AppMachinePageRow} record objects.
*/
-export const AppChecklistState = (() => {
+export const AppMachinePageRow = (() => {
const defaults = () => ({
});
const create = (() => {
- return uniffiCreateRecord<AppChecklistState, ReturnType<typeof defaults>>(defaults);
+ return uniffiCreateRecord<AppMachinePageRow, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
- defaults: () => Object.freeze(defaults()) as Partial<AppChecklistState>,
+ defaults: () => Object.freeze(defaults()) as Partial<AppMachinePageRow>,
});
})();
-const FfiConverterTypeAppChecklistState = (() => {
- type TypeName = AppChecklistState;
+const FfiConverterTypeAppMachinePageRow = (() => {
+ type TypeName = AppMachinePageRow;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
- done: FfiConverterSequenceTypeAppChecklistStep.read(from),
- dismissed: FfiConverterBool.read(from),
- shown: FfiConverterBool.read(from)
+ id: FfiConverterString.read(from),
+ name: FfiConverterString.read(from),
+ online: FfiConverterBool.read(from),
+ os: FfiConverterString.read(from),
+ via: FfiConverterString.read(from),
+ current: FfiConverterBool.read(from),
+ device: FfiConverterOptionalString.read(from),
+ deviceOnly: FfiConverterBool.read(from),
+ spaceId: FfiConverterOptionalString.read(from),
+ stoppedSharing: FfiConverterBool.read(from),
+ lastSeen: FfiConverterOptionalUInt64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
- FfiConverterSequenceTypeAppChecklistStep.write(value.done, into);
- FfiConverterBool.write(value.dismissed, into);
- FfiConverterBool.write(value.shown, into);
+ FfiConverterString.write(value.id, into);
+ FfiConverterString.write(value.name, into);
+ FfiConverterBool.write(value.online, into);
+ FfiConverterString.write(value.os, into);
+ FfiConverterString.write(value.via, into);
+ FfiConverterBool.write(value.current, into);
+ FfiConverterOptionalString.write(value.device, into);
+ FfiConverterBool.write(value.deviceOnly, into);
+ FfiConverterOptionalString.write(value.spaceId, into);
+ FfiConverterBool.write(value.stoppedSharing, into);
+ FfiConverterOptionalUInt64.write(value.lastSeen, into);
}
allocationSize(value: TypeName): number {
- return FfiConverterSequenceTypeAppChecklistStep.allocationSize(value.done) +
- FfiConverterBool.allocationSize(value.dismissed) +
- FfiConverterBool.allocationSize(value.shown);
+ return FfiConverterString.allocationSize(value.id) +
+ FfiConverterString.allocationSize(value.name) +
+ FfiConverterBool.allocationSize(value.online) +
+ FfiConverterString.allocationSize(value.os) +
+ FfiConverterString.allocationSize(value.via) +
+ FfiConverterBool.allocationSize(value.current) +
+ FfiConverterOptionalString.allocationSize(value.device) +
+ FfiConverterBool.allocationSize(value.deviceOnly) +
+ FfiConverterOptionalString.allocationSize(value.spaceId) +
+ FfiConverterBool.allocationSize(value.stoppedSharing) +
+ FfiConverterOptionalUInt64.allocationSize(value.lastSeen);
}
};
return new FFIConverter();
})();
-
-// Enum: AppTelemetrySignal
-export enum AppTelemetrySignal_Tags {
- Feature = "Feature",
- Step = "Step",
- Launched = "Launched",
- SignInFailed = "SignInFailed",
- OnboardingPage = "OnboardingPage",
- SpaceWizard = "SpaceWizard",
- SpaceCreate = "SpaceCreate",
- SpaceCreateStarted = "SpaceCreateStarted",
- VolumeSetup = "VolumeSetup",
- Share = "Share",
- AppUpdate = "AppUpdate",
- DeviceEnroll = "DeviceEnroll",
- Experiment = "Experiment",
- ExperimentsOn = "ExperimentsOn"
-}
-export const AppTelemetrySignal = (() => {
-
- type Feature__interface = {
- tag: AppTelemetrySignal_Tags.Feature;
- inner:
-Readonly<{feature: string}>
- };
+export enum AppSpaceOs {
/**
- * A Spaces app feature was used (`cua_spaces_feature_used`).
+ * macOS.
*/
- class Feature_ extends UniffiEnum implements Feature__interface {
- /**
- * @private
- * This field is private and should not be used, use `tag` instead.
- */
- readonly [uniffiTypeNameSymbol] = "AppTelemetrySignal";
- readonly tag = AppTelemetrySignal_Tags.Feature;
- readonly inner:
-Readonly<{feature: string}>;
- constructor(
-inner: {feature: string }) {
- super("AppTelemetrySignal", "Feature");
-
- this.inner = Object.freeze(inner);
- }
- static new(
-inner: {feature: string }): Feature_ {
- return new Feature_(inner);
- }
-
- static instanceOf(obj: any): obj is Feature_ {
- return obj.tag === AppTelemetrySignal_Tags.Feature;
- }
-
- }
-
- type Step__interface = {
- tag: AppTelemetrySignal_Tags.Step;
- inner:
-Readonly<{step: string; ok: boolean}>
- };
+ Macos = "macos",
/**
- * An install or activation funnel step (`cua_onboarding_step`;
- * `first_*` steps count once per install).
+ * Windows.
*/
- class Step_ extends UniffiEnum implements Step__interface {
- /**
- * @private
- * This field is private and should not be used, use `tag` instead.
- */
- readonly [uniffiTypeNameSymbol] = "AppTelemetrySignal";
- readonly tag = AppTelemetrySignal_Tags.Step;
- readonly inner:
-Readonly<{step: string; ok: boolean}>;
- constructor(
-inner: {step: string; ok: boolean }) {
- super("AppTelemetrySignal", "Step");
-
- this.inner = Object.freeze(inner);
- }
- static new(
-inner: {step: string; ok: boolean }): Step_ {
- return new Step_(inner);
- }
-
- static instanceOf(obj: any): obj is Step_ {
- return obj.tag === AppTelemetrySignal_Tags.Step;
- }
-
- }
-
- type Launched__interface = {
- tag: AppTelemetrySignal_Tags.Launched;
- inner:
-Readonly<{onboardingEligible?: boolean}>
- };
+ Windows = "windows",
/**
- * The app started (`cua_onboarding_step`, step `app_launched`).
+ * Linux.
*/
- class Launched_ extends UniffiEnum implements Launched__interface {
- /**
- * @private
- * This field is private and should not be used, use `tag` instead.
- */
- readonly [uniffiTypeNameSymbol] = "AppTelemetrySignal";
- readonly tag = AppTelemetrySignal_Tags.Launched;
- readonly inner:
-Readonly<{onboardingEligible?: boolean}>;
- constructor(
-inner: {onboardingEligible?: boolean }) {
- super("AppTelemetrySignal", "Launched");
+ Linux = "linux",
+ /**
+ * The host has not reported a recognized operating system.
+ */
+ Unknown = "unknown"
+}
- this.inner = Object.freeze(inner);
+const FfiConverterTypeAppSpaceOs = (() => {
+ const ordinalConverter = FfiConverterInt32;
+ type TypeName = AppSpaceOs;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ switch (ordinalConverter.read(from)) {
+ case 1: return AppSpaceOs.Macos;
+ case 2: return AppSpaceOs.Windows;
+ case 3: return AppSpaceOs.Linux;
+ case 4: return AppSpaceOs.Unknown;
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
+ }
}
- static new(
-inner: {onboardingEligible?: boolean }): Launched_ {
- return new Launched_(inner);
+ write(value: TypeName, into: RustBuffer): void {
+ switch (value) {
+ case AppSpaceOs.Macos: return ordinalConverter.write(1, into);
+ case AppSpaceOs.Windows: return ordinalConverter.write(2, into);
+ case AppSpaceOs.Linux: return ordinalConverter.write(3, into);
+ case AppSpaceOs.Unknown: return ordinalConverter.write(4, into);
+ }
}
-
- static instanceOf(obj: any): obj is Launched_ {
- return obj.tag === AppTelemetrySignal_Tags.Launched;
+ allocationSize(value: TypeName): number {
+ return ordinalConverter.allocationSize(0);
}
-
}
+ return new FFIConverter();
+})();
- type SignInFailed__interface = {
- tag: AppTelemetrySignal_Tags.SignInFailed;
- inner:
-Readonly<{errorKind: string}>
- };
+export enum AppSpaceStatus {
/**
- * A sign-in failed, timed out or was cancelled (`cua_onboarding_step`,
- * step `signed_in`, outcome `error`).
+ * The host machine itself.
*/
- class SignInFailed_ extends UniffiEnum implements SignInFailed__interface {
- /**
- * @private
- * This field is private and should not be used, use `tag` instead.
- */
- readonly [uniffiTypeNameSymbol] = "AppTelemetrySignal";
- readonly tag = AppTelemetrySignal_Tags.SignInFailed;
- readonly inner:
-Readonly<{errorKind: string}>;
- constructor(
-inner: {errorKind: string }) {
- super("AppTelemetrySignal", "SignInFailed");
+ Local = "local",
+ /**
+ * Reachable, session active.
+ */
+ Running = "running",
+ /**
+ * An agent waits for approval.
+ */
+ Approval = "approval",
+ /**
+ * Unreachable or suspended.
+ */
+ Suspended = "suspended",
+ /**
+ * Being created.
+ */
+ Provisioning = "provisioning",
+ /**
+ * Being deleted (the user confirmed; the SDK is removing it).
+ */
+ Deleting = "deleting"
+}
- this.inner = Object.freeze(inner);
+const FfiConverterTypeAppSpaceStatus = (() => {
+ const ordinalConverter = FfiConverterInt32;
+ type TypeName = AppSpaceStatus;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ switch (ordinalConverter.read(from)) {
+ case 1: return AppSpaceStatus.Local;
+ case 2: return AppSpaceStatus.Running;
+ case 3: return AppSpaceStatus.Approval;
+ case 4: return AppSpaceStatus.Suspended;
+ case 5: return AppSpaceStatus.Provisioning;
+ case 6: return AppSpaceStatus.Deleting;
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
+ }
}
- static new(
-inner: {errorKind: string }): SignInFailed_ {
- return new SignInFailed_(inner);
+ write(value: TypeName, into: RustBuffer): void {
+ switch (value) {
+ case AppSpaceStatus.Local: return ordinalConverter.write(1, into);
+ case AppSpaceStatus.Running: return ordinalConverter.write(2, into);
+ case AppSpaceStatus.Approval: return ordinalConverter.write(3, into);
+ case AppSpaceStatus.Suspended: return ordinalConverter.write(4, into);
+ case AppSpaceStatus.Provisioning: return ordinalConverter.write(5, into);
+ case AppSpaceStatus.Deleting: return ordinalConverter.write(6, into);
+ }
}
-
- static instanceOf(obj: any): obj is SignInFailed_ {
- return obj.tag === AppTelemetrySignal_Tags.SignInFailed;
+ allocationSize(value: TypeName): number {
+ return ordinalConverter.allocationSize(0);
}
-
}
+ return new FFIConverter();
+})();
- type OnboardingPage__interface = {
- tag: AppTelemetrySignal_Tags.OnboardingPage;
- inner:
-Readonly<{page: string; action: string; choice: string}>
- };
+export enum AppThumbnailScene {
/**
- * A first-run page was shown or left (`cua_onboarding_page`).
+ * A macOS desktop.
*/
- class OnboardingPage_ extends UniffiEnum implements OnboardingPage__interface {
- /**
- * @private
- * This field is private and should not be used, use `tag` instead.
- */
- readonly [uniffiTypeNameSymbol] = "AppTelemetrySignal";
- readonly tag = AppTelemetrySignal_Tags.OnboardingPage;
- readonly inner:
-Readonly<{page: string; action: string; choice: string}>;
- constructor(
-inner: {page: string; action: string; choice: string }) {
- super("AppTelemetrySignal", "OnboardingPage");
+ MacDesktop = "macDesktop",
+ /**
+ * A Windows desktop.
+ */
+ WindowsDesktop = "windowsDesktop",
+ /**
+ * A Linux terminal.
+ */
+ LinuxTerminal = "linuxTerminal",
+ /**
+ * A notes app.
+ */
+ Notes = "notes",
+ /**
+ * A browser.
+ */
+ Browser = "browser",
+ /**
+ * Nothing.
+ */
+ Blank = "blank"
+}
- this.inner = Object.freeze(inner);
+const FfiConverterTypeAppThumbnailScene = (() => {
+ const ordinalConverter = FfiConverterInt32;
+ type TypeName = AppThumbnailScene;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ switch (ordinalConverter.read(from)) {
+ case 1: return AppThumbnailScene.MacDesktop;
+ case 2: return AppThumbnailScene.WindowsDesktop;
+ case 3: return AppThumbnailScene.LinuxTerminal;
+ case 4: return AppThumbnailScene.Notes;
+ case 5: return AppThumbnailScene.Browser;
+ case 6: return AppThumbnailScene.Blank;
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
+ }
}
- static new(
-inner: {page: string; action: string; choice: string }): OnboardingPage_ {
- return new OnboardingPage_(inner);
+ write(value: TypeName, into: RustBuffer): void {
+ switch (value) {
+ case AppThumbnailScene.MacDesktop: return ordinalConverter.write(1, into);
+ case AppThumbnailScene.WindowsDesktop: return ordinalConverter.write(2, into);
+ case AppThumbnailScene.LinuxTerminal: return ordinalConverter.write(3, into);
+ case AppThumbnailScene.Notes: return ordinalConverter.write(4, into);
+ case AppThumbnailScene.Browser: return ordinalConverter.write(5, into);
+ case AppThumbnailScene.Blank: return ordinalConverter.write(6, into);
+ }
}
-
- static instanceOf(obj: any): obj is OnboardingPage_ {
- return obj.tag === AppTelemetrySignal_Tags.OnboardingPage;
+ allocationSize(value: TypeName): number {
+ return ordinalConverter.allocationSize(0);
}
-
}
+ return new FFIConverter();
+})();
- type SpaceWizard__interface = {
- tag: AppTelemetrySignal_Tags.SpaceWizard;
- inner:
-Readonly<{action: string}>
- };
+export enum AppSpaceProvider {
/**
- * The New Space panel (`cua_space_wizard`).
+ * Cua Cloud.
*/
- class SpaceWizard_ extends UniffiEnum implements SpaceWizard__interface {
- /**
- * @private
- * This field is private and should not be used, use `tag` instead.
- */
- readonly [uniffiTypeNameSymbol] = "AppTelemetrySignal";
- readonly tag = AppTelemetrySignal_Tags.SpaceWizard;
- readonly inner:
-Readonly<{action: string}>;
- constructor(
-inner: {action: string }) {
- super("AppTelemetrySignal", "SpaceWizard");
+ Cloud = "cloud",
+ /**
+ * This Mac.
+ */
+ Local = "local",
+ /**
+ * A machine added by address.
+ */
+ Direct = "direct",
+ /**
+ * A machine of the signed-in account through the relay.
+ */
+ Relay = "relay"
+}
- this.inner = Object.freeze(inner);
+const FfiConverterTypeAppSpaceProvider = (() => {
+ const ordinalConverter = FfiConverterInt32;
+ type TypeName = AppSpaceProvider;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ switch (ordinalConverter.read(from)) {
+ case 1: return AppSpaceProvider.Cloud;
+ case 2: return AppSpaceProvider.Local;
+ case 3: return AppSpaceProvider.Direct;
+ case 4: return AppSpaceProvider.Relay;
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
+ }
}
- static new(
-inner: {action: string }): SpaceWizard_ {
- return new SpaceWizard_(inner);
+ write(value: TypeName, into: RustBuffer): void {
+ switch (value) {
+ case AppSpaceProvider.Cloud: return ordinalConverter.write(1, into);
+ case AppSpaceProvider.Local: return ordinalConverter.write(2, into);
+ case AppSpaceProvider.Direct: return ordinalConverter.write(3, into);
+ case AppSpaceProvider.Relay: return ordinalConverter.write(4, into);
+ }
}
-
- static instanceOf(obj: any): obj is SpaceWizard_ {
- return obj.tag === AppTelemetrySignal_Tags.SpaceWizard;
+ allocationSize(value: TypeName): number {
+ return ordinalConverter.allocationSize(0);
}
-
}
+ return new FFIConverter();
+})();
- type SpaceCreate__interface = {
- tag: AppTelemetrySignal_Tags.SpaceCreate;
- inner:
-Readonly<{location: string; guestOs: string; kind: string; outcome: string; failedPhase: string; stalled: boolean; elapsedMs: bigint; gpu: boolean; errorVariant: string}>
- };
+export type AppSpaceSdkRef = {
/**
- * A Space create reached ready or failed (`cua_space_create`).
+ * spacesd feature names.
*/
- class SpaceCreate_ extends UniffiEnum implements SpaceCreate__interface {
- /**
- * @private
+ features: Array<string>,
+ /**
+ * spacesd version at the last handshake.
+ */
+ spacesdVersion: string,
+ /**
+ * Answered the last bounded connect.
+ */
+ reachable: boolean,
+ /**
+ * Why not.
+ */
+ error?: string
+}
+
+/**
+ * Generated factory for {@link AppSpaceSdkRef} record objects.
+ */
+export const AppSpaceSdkRef = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<AppSpaceSdkRef, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<AppSpaceSdkRef>,
+ });
+})();
+
+const FfiConverterTypeAppSpaceSdkRef = (() => {
+ type TypeName = AppSpaceSdkRef;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ features: FfiConverterSequenceString.read(from),
+ spacesdVersion: FfiConverterString.read(from),
+ reachable: FfiConverterBool.read(from),
+ error: FfiConverterOptionalString.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterSequenceString.write(value.features, into);
+ FfiConverterString.write(value.spacesdVersion, into);
+ FfiConverterBool.write(value.reachable, into);
+ FfiConverterOptionalString.write(value.error, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterSequenceString.allocationSize(value.features) +
+ FfiConverterString.allocationSize(value.spacesdVersion) +
+ FfiConverterBool.allocationSize(value.reachable) +
+ FfiConverterOptionalString.allocationSize(value.error);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+export type AppSpaceProgress = {
+ /**
+ * The SDK's phase word (`preparing`, `pulling`, `booting`, ...).
+ */
+ phase: string,
+ /**
+ * Overall progress in thousandths.
+ */
+ permille: number,
+ /**
+ * The phase in words ("Starting…", "Downloading image…"), or "Failed".
+ */
+ label: string,
+ /**
+ * Why the create failed.
+ */
+ error?: string,
+ /**
+ * It failed because the account is out of Cua Cloud credit: the
+ * website billing page "Add credit" opens.
+ */
+ creditUrl?: string,
+ /**
+ * While it downloads: "4.2 of 22.1 GB · 85 MB/s · about 4 min"
+ * ([`crate::spaces::creating::transfer_text`]).
+ */
+ transfer?: string,
+ /**
+ * Cancel can stop it now.
+ */
+ cancellable: boolean,
+ /**
+ * Cancel was pressed and the create is being cleaned up.
+ */
+ cancelling: boolean
+}
+
+/**
+ * Generated factory for {@link AppSpaceProgress} record objects.
+ */
+export const AppSpaceProgress = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<AppSpaceProgress, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<AppSpaceProgress>,
+ });
+})();
+
+const FfiConverterTypeAppSpaceProgress = (() => {
+ type TypeName = AppSpaceProgress;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ phase: FfiConverterString.read(from),
+ permille: FfiConverterUInt32.read(from),
+ label: FfiConverterString.read(from),
+ error: FfiConverterOptionalString.read(from),
+ creditUrl: FfiConverterOptionalString.read(from),
+ transfer: FfiConverterOptionalString.read(from),
+ cancellable: FfiConverterBool.read(from),
+ cancelling: FfiConverterBool.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.phase, into);
+ FfiConverterUInt32.write(value.permille, into);
+ FfiConverterString.write(value.label, into);
+ FfiConverterOptionalString.write(value.error, into);
+ FfiConverterOptionalString.write(value.creditUrl, into);
+ FfiConverterOptionalString.write(value.transfer, into);
+ FfiConverterBool.write(value.cancellable, into);
+ FfiConverterBool.write(value.cancelling, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterString.allocationSize(value.phase) +
+ FfiConverterUInt32.allocationSize(value.permille) +
+ FfiConverterString.allocationSize(value.label) +
+ FfiConverterOptionalString.allocationSize(value.error) +
+ FfiConverterOptionalString.allocationSize(value.creditUrl) +
+ FfiConverterOptionalString.allocationSize(value.transfer) +
+ FfiConverterBool.allocationSize(value.cancellable) +
+ FfiConverterBool.allocationSize(value.cancelling);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+export enum AppSpaceKind {
+ /**
+ * A container.
+ */
+ Container = "container",
+ /**
+ * A virtual machine.
+ */
+ Vm = "vm"
+}
+
+const FfiConverterTypeAppSpaceKind = (() => {
+ const ordinalConverter = FfiConverterInt32;
+ type TypeName = AppSpaceKind;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ switch (ordinalConverter.read(from)) {
+ case 1: return AppSpaceKind.Container;
+ case 2: return AppSpaceKind.Vm;
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
+ }
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ switch (value) {
+ case AppSpaceKind.Container: return ordinalConverter.write(1, into);
+ case AppSpaceKind.Vm: return ordinalConverter.write(2, into);
+ }
+ }
+ allocationSize(value: TypeName): number {
+ return ordinalConverter.allocationSize(0);
+ }
+ }
+ return new FFIConverter();
+})();
+
+export enum AppPowerControl {
+ /**
+ * Suspended in memory; it resumes where it was.
+ */
+ Suspend = "suspend",
+ /**
+ * Stopped with its disk kept; it boots again.
+ */
+ Stop = "stop"
+}
+
+const FfiConverterTypeAppPowerControl = (() => {
+ const ordinalConverter = FfiConverterInt32;
+ type TypeName = AppPowerControl;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ switch (ordinalConverter.read(from)) {
+ case 1: return AppPowerControl.Suspend;
+ case 2: return AppPowerControl.Stop;
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
+ }
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ switch (value) {
+ case AppPowerControl.Suspend: return ordinalConverter.write(1, into);
+ case AppPowerControl.Stop: return ordinalConverter.write(2, into);
+ }
+ }
+ allocationSize(value: TypeName): number {
+ return ordinalConverter.allocationSize(0);
+ }
+ }
+ return new FFIConverter();
+})();
+
+export type AppSpacePower = {
+ /**
+ * How it turns off.
+ */
+ control: AppPowerControl,
+ /**
+ * It is off: suspended or stopped as the SDK recorded it, or not
+ * answering with no recorded state (a Space one of your machines
+ * provides).
+ */
+ off: boolean,
+ /**
+ * Being turned on (`true`) or off (`false`) now.
+ */
+ turningOn?: boolean,
+ /**
+ * Why the last power action failed, until the next one.
+ */
+ error?: string
+}
+
+/**
+ * Generated factory for {@link AppSpacePower} record objects.
+ */
+export const AppSpacePower = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<AppSpacePower, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<AppSpacePower>,
+ });
+})();
+
+const FfiConverterTypeAppSpacePower = (() => {
+ type TypeName = AppSpacePower;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ control: FfiConverterTypeAppPowerControl.read(from),
+ off: FfiConverterBool.read(from),
+ turningOn: FfiConverterOptionalBoolean.read(from),
+ error: FfiConverterOptionalString.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterTypeAppPowerControl.write(value.control, into);
+ FfiConverterBool.write(value.off, into);
+ FfiConverterOptionalBoolean.write(value.turningOn, into);
+ FfiConverterOptionalString.write(value.error, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterTypeAppPowerControl.allocationSize(value.control) +
+ FfiConverterBool.allocationSize(value.off) +
+ FfiConverterOptionalBoolean.allocationSize(value.turningOn) +
+ FfiConverterOptionalString.allocationSize(value.error);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+export type AppSpace = {
+ /**
+ * Sandbox ref (`cloud:<name>`, `local:<name>`, `direct:<host:port>`, ...).
+ */
+ id: string,
+ /**
+ * Display name.
+ */
+ name: string,
+ /**
+ * Operating system.
+ */
+ os: AppSpaceOs,
+ /**
+ * Status.
+ */
+ status: AppSpaceStatus,
+ /**
+ * One short status detail.
+ */
+ detail: string,
+ /**
+ * Epoch ms of the last focus.
+ */
+ lastUsedAt: bigint,
+ /**
+ * Epoch ms it was created.
+ */
+ startedAt?: bigint,
+ /**
+ * Placeholder scene.
+ */
+ scene: AppThumbnailScene,
+ /**
+ * Group (cloud namespace or location word).
+ */
+ fleetId?: string,
+ /**
+ * Fixture machine size.
+ */
+ size?: string,
+ /**
+ * Fixture region.
+ */
+ region?: string,
+ /**
+ * Where it runs (cloud when omitted).
+ */
+ provider?: AppSpaceProvider,
+ /**
+ * SDK facts, for Spaces from the live registry.
+ */
+ sdk?: AppSpaceSdkRef,
+ /**
+ * The guest OS product or distribution ("Ubuntu", "macOS"), when the
+ * Space reported one: it picks the OS icon ([`crate::notch::os_icon`]).
+ */
+ osName?: string,
+ /**
+ * The guest's full OS string ("Ubuntu 24.04.3 LTS"), when the Space
+ * reported one.
+ */
+ osPrettyName?: string,
+ /**
+ * The image it runs ("ghcr.io/trycua/linux:24.04"), when known.
+ */
+ image?: string,
+ /**
+ * The digest of the variant that runs, when known.
+ */
+ imageDigest?: string,
+ /**
+ * While it is being created: how far along, from the SDK's create
+ * progress ([`crate::spaces::creating`]).
+ */
+ progress?: AppSpaceProgress,
+ /**
+ * Container or virtual machine, when known.
+ */
+ kind?: AppSpaceKind,
+ /**
+ * The guest's CPU architecture (`arm64`, `amd64`), when known.
+ */
+ arch?: string,
+ /**
+ * For a Space one of your machines provides: that machine's relay id
+ * (the sidebar nests it under the machine).
+ */
+ host?: string,
+ /**
+ * That machine's name, when known.
+ */
+ hostName?: string,
+ /**
+ * Whether and how it turns off and on (the SDK's `power`), with a
+ * power action in flight ([`crate::spaces::creating::compose`]).
+ * `None`: it cannot (a cloud Space, one added by address).
+ */
+ power?: AppSpacePower,
+ /**
+ * For a Space in your cloud: the provider word (`aws`, `gcp`,
+ * `modal`).
+ */
+ cloud?: string,
+ /**
+ * Its account and region in words ("AWS · us-west-2").
+ */
+ cloudPlace?: string,
+ /**
+ * Where Delete permanently can delete it: `here`, `host:<machine>`
+ * (that machine created it) or `elsewhere` (another device did).
+ */
+ cloudDelete?: string
+}
+
+/**
+ * Generated factory for {@link AppSpace} record objects.
+ */
+export const AppSpace = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<AppSpace, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<AppSpace>,
+ });
+})();
+
+const FfiConverterTypeAppSpace = (() => {
+ type TypeName = AppSpace;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ id: FfiConverterString.read(from),
+ name: FfiConverterString.read(from),
+ os: FfiConverterTypeAppSpaceOs.read(from),
+ status: FfiConverterTypeAppSpaceStatus.read(from),
+ detail: FfiConverterString.read(from),
+ lastUsedAt: FfiConverterInt64.read(from),
+ startedAt: FfiConverterOptionalInt64.read(from),
+ scene: FfiConverterTypeAppThumbnailScene.read(from),
+ fleetId: FfiConverterOptionalString.read(from),
+ size: FfiConverterOptionalString.read(from),
+ region: FfiConverterOptionalString.read(from),
+ provider: FfiConverterOptionalTypeAppSpaceProvider.read(from),
+ sdk: FfiConverterOptionalTypeAppSpaceSdkRef.read(from),
+ osName: FfiConverterOptionalString.read(from),
+ osPrettyName: FfiConverterOptionalString.read(from),
+ image: FfiConverterOptionalString.read(from),
+ imageDigest: FfiConverterOptionalString.read(from),
+ progress: FfiConverterOptionalTypeAppSpaceProgress.read(from),
+ kind: FfiConverterOptionalTypeAppSpaceKind.read(from),
+ arch: FfiConverterOptionalString.read(from),
+ host: FfiConverterOptionalString.read(from),
+ hostName: FfiConverterOptionalString.read(from),
+ power: FfiConverterOptionalTypeAppSpacePower.read(from),
+ cloud: FfiConverterOptionalString.read(from),
+ cloudPlace: FfiConverterOptionalString.read(from),
+ cloudDelete: FfiConverterOptionalString.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.id, into);
+ FfiConverterString.write(value.name, into);
+ FfiConverterTypeAppSpaceOs.write(value.os, into);
+ FfiConverterTypeAppSpaceStatus.write(value.status, into);
+ FfiConverterString.write(value.detail, into);
+ FfiConverterInt64.write(value.lastUsedAt, into);
+ FfiConverterOptionalInt64.write(value.startedAt, into);
+ FfiConverterTypeAppThumbnailScene.write(value.scene, into);
+ FfiConverterOptionalString.write(value.fleetId, into);
+ FfiConverterOptionalString.write(value.size, into);
+ FfiConverterOptionalString.write(value.region, into);
+ FfiConverterOptionalTypeAppSpaceProvider.write(value.provider, into);
+ FfiConverterOptionalTypeAppSpaceSdkRef.write(value.sdk, into);
+ FfiConverterOptionalString.write(value.osName, into);
+ FfiConverterOptionalString.write(value.osPrettyName, into);
+ FfiConverterOptionalString.write(value.image, into);
+ FfiConverterOptionalString.write(value.imageDigest, into);
+ FfiConverterOptionalTypeAppSpaceProgress.write(value.progress, into);
+ FfiConverterOptionalTypeAppSpaceKind.write(value.kind, into);
+ FfiConverterOptionalString.write(value.arch, into);
+ FfiConverterOptionalString.write(value.host, into);
+ FfiConverterOptionalString.write(value.hostName, into);
+ FfiConverterOptionalTypeAppSpacePower.write(value.power, into);
+ FfiConverterOptionalString.write(value.cloud, into);
+ FfiConverterOptionalString.write(value.cloudPlace, into);
+ FfiConverterOptionalString.write(value.cloudDelete, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterString.allocationSize(value.id) +
+ FfiConverterString.allocationSize(value.name) +
+ FfiConverterTypeAppSpaceOs.allocationSize(value.os) +
+ FfiConverterTypeAppSpaceStatus.allocationSize(value.status) +
+ FfiConverterString.allocationSize(value.detail) +
+ FfiConverterInt64.allocationSize(value.lastUsedAt) +
+ FfiConverterOptionalInt64.allocationSize(value.startedAt) +
+ FfiConverterTypeAppThumbnailScene.allocationSize(value.scene) +
+ FfiConverterOptionalString.allocationSize(value.fleetId) +
+ FfiConverterOptionalString.allocationSize(value.size) +
+ FfiConverterOptionalString.allocationSize(value.region) +
+ FfiConverterOptionalTypeAppSpaceProvider.allocationSize(value.provider) +
+ FfiConverterOptionalTypeAppSpaceSdkRef.allocationSize(value.sdk) +
+ FfiConverterOptionalString.allocationSize(value.osName) +
+ FfiConverterOptionalString.allocationSize(value.osPrettyName) +
+ FfiConverterOptionalString.allocationSize(value.image) +
+ FfiConverterOptionalString.allocationSize(value.imageDigest) +
+ FfiConverterOptionalTypeAppSpaceProgress.allocationSize(value.progress) +
+ FfiConverterOptionalTypeAppSpaceKind.allocationSize(value.kind) +
+ FfiConverterOptionalString.allocationSize(value.arch) +
+ FfiConverterOptionalString.allocationSize(value.host) +
+ FfiConverterOptionalString.allocationSize(value.hostName) +
+ FfiConverterOptionalTypeAppSpacePower.allocationSize(value.power) +
+ FfiConverterOptionalString.allocationSize(value.cloud) +
+ FfiConverterOptionalString.allocationSize(value.cloudPlace) +
+ FfiConverterOptionalString.allocationSize(value.cloudDelete);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+export type AppChecklistSeen = {
+ /**
+ * The Machines page's rows ([`crate::machines::page_rows`]).
+ */
+ machines: Array<AppMachinePageRow>,
+ /**
+ * The Spaces list.
+ */
+ spaces: Array<AppSpace>,
+ /**
+ * Persistent agents listed.
+ */
+ agents: number,
+ /**
+ * Agent runs listed in any Space.
+ */
+ runs: number
+}
+
+/**
+ * Generated factory for {@link AppChecklistSeen} record objects.
+ */
+export const AppChecklistSeen = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<AppChecklistSeen, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<AppChecklistSeen>,
+ });
+})();
+
+const FfiConverterTypeAppChecklistSeen = (() => {
+ type TypeName = AppChecklistSeen;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ machines: FfiConverterSequenceTypeAppMachinePageRow.read(from),
+ spaces: FfiConverterSequenceTypeAppSpace.read(from),
+ agents: FfiConverterUInt32.read(from),
+ runs: FfiConverterUInt32.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterSequenceTypeAppMachinePageRow.write(value.machines, into);
+ FfiConverterSequenceTypeAppSpace.write(value.spaces, into);
+ FfiConverterUInt32.write(value.agents, into);
+ FfiConverterUInt32.write(value.runs, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterSequenceTypeAppMachinePageRow.allocationSize(value.machines) +
+ FfiConverterSequenceTypeAppSpace.allocationSize(value.spaces) +
+ FfiConverterUInt32.allocationSize(value.agents) +
+ FfiConverterUInt32.allocationSize(value.runs);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+export type AppChecklistState = {
+ /**
+ * Steps done, each once, in checklist order.
+ */
+ done: Array<AppChecklistStep>,
+ /**
+ * Closed with ×; Getting Started opens it again.
+ */
+ dismissed: boolean,
+ /**
+ * It was on screen once (`checklist_shown` was recorded).
+ */
+ shown: boolean
+}
+
+/**
+ * Generated factory for {@link AppChecklistState} record objects.
+ */
+export const AppChecklistState = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<AppChecklistState, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<AppChecklistState>,
+ });
+})();
+
+const FfiConverterTypeAppChecklistState = (() => {
+ type TypeName = AppChecklistState;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ done: FfiConverterSequenceTypeAppChecklistStep.read(from),
+ dismissed: FfiConverterBool.read(from),
+ shown: FfiConverterBool.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterSequenceTypeAppChecklistStep.write(value.done, into);
+ FfiConverterBool.write(value.dismissed, into);
+ FfiConverterBool.write(value.shown, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterSequenceTypeAppChecklistStep.allocationSize(value.done) +
+ FfiConverterBool.allocationSize(value.dismissed) +
+ FfiConverterBool.allocationSize(value.shown);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+
+// Enum: AppTelemetrySignal
+export enum AppTelemetrySignal_Tags {
+ Feature = "Feature",
+ Step = "Step",
+ Launched = "Launched",
+ SignInFailed = "SignInFailed",
+ OnboardingPage = "OnboardingPage",
+ SpaceWizard = "SpaceWizard",
+ SpaceCreate = "SpaceCreate",
+ SpaceCreateStarted = "SpaceCreateStarted",
+ VolumeSetup = "VolumeSetup",
+ Share = "Share",
+ AppUpdate = "AppUpdate",
+ DeviceEnroll = "DeviceEnroll",
+ Experiment = "Experiment",
+ ExperimentsOn = "ExperimentsOn"
+}
+export const AppTelemetrySignal = (() => {
+
+ type Feature__interface = {
+ tag: AppTelemetrySignal_Tags.Feature;
+ inner:
+Readonly<{feature: string}>
+ };
+ /**
+ * A Spaces app feature was used (`cua_spaces_feature_used`).
+ */
+ class Feature_ extends UniffiEnum implements Feature__interface {
+ /**
+ * @private
+ * This field is private and should not be used, use `tag` instead.
+ */
+ readonly [uniffiTypeNameSymbol] = "AppTelemetrySignal";
+ readonly tag = AppTelemetrySignal_Tags.Feature;
+ readonly inner:
+Readonly<{feature: string}>;
+ constructor(
+inner: {feature: string }) {
+ super("AppTelemetrySignal", "Feature");
+
+ this.inner = Object.freeze(inner);
+ }
+ static new(
+inner: {feature: string }): Feature_ {
+ return new Feature_(inner);
+ }
+
+ static instanceOf(obj: any): obj is Feature_ {
+ return obj.tag === AppTelemetrySignal_Tags.Feature;
+ }
+
+ }
+
+ type Step__interface = {
+ tag: AppTelemetrySignal_Tags.Step;
+ inner:
+Readonly<{step: string; ok: boolean}>
+ };
+ /**
+ * An install or activation funnel step (`cua_onboarding_step`;
+ * `first_*` steps count once per install).
+ */
+ class Step_ extends UniffiEnum implements Step__interface {
+ /**
+ * @private
+ * This field is private and should not be used, use `tag` instead.
+ */
+ readonly [uniffiTypeNameSymbol] = "AppTelemetrySignal";
+ readonly tag = AppTelemetrySignal_Tags.Step;
+ readonly inner:
+Readonly<{step: string; ok: boolean}>;
+ constructor(
+inner: {step: string; ok: boolean }) {
+ super("AppTelemetrySignal", "Step");
+
+ this.inner = Object.freeze(inner);
+ }
+ static new(
+inner: {step: string; ok: boolean }): Step_ {
+ return new Step_(inner);
+ }
+
+ static instanceOf(obj: any): obj is Step_ {
+ return obj.tag === AppTelemetrySignal_Tags.Step;
+ }
+
+ }
+
+ type Launched__interface = {
+ tag: AppTelemetrySignal_Tags.Launched;
+ inner:
+Readonly<{onboardingEligible?: boolean}>
+ };
+ /**
+ * The app started (`cua_onboarding_step`, step `app_launched`).
+ */
+ class Launched_ extends UniffiEnum implements Launched__interface {
+ /**
+ * @private
+ * This field is private and should not be used, use `tag` instead.
+ */
+ readonly [uniffiTypeNameSymbol] = "AppTelemetrySignal";
+ readonly tag = AppTelemetrySignal_Tags.Launched;
+ readonly inner:
+Readonly<{onboardingEligible?: boolean}>;
+ constructor(
+inner: {onboardingEligible?: boolean }) {
+ super("AppTelemetrySignal", "Launched");
+
+ this.inner = Object.freeze(inner);
+ }
+ static new(
+inner: {onboardingEligible?: boolean }): Launched_ {
+ return new Launched_(inner);
+ }
+
+ static instanceOf(obj: any): obj is Launched_ {
+ return obj.tag === AppTelemetrySignal_Tags.Launched;
+ }
+
+ }
+
+ type SignInFailed__interface = {
+ tag: AppTelemetrySignal_Tags.SignInFailed;
+ inner:
+Readonly<{errorKind: string}>
+ };
+ /**
+ * A sign-in failed, timed out or was cancelled (`cua_onboarding_step`,
+ * step `signed_in`, outcome `error`).
+ */
+ class SignInFailed_ extends UniffiEnum implements SignInFailed__interface {
+ /**
+ * @private
+ * This field is private and should not be used, use `tag` instead.
+ */
+ readonly [uniffiTypeNameSymbol] = "AppTelemetrySignal";
+ readonly tag = AppTelemetrySignal_Tags.SignInFailed;
+ readonly inner:
+Readonly<{errorKind: string}>;
+ constructor(
+inner: {errorKind: string }) {
+ super("AppTelemetrySignal", "SignInFailed");
+
+ this.inner = Object.freeze(inner);
+ }
+ static new(
+inner: {errorKind: string }): SignInFailed_ {
+ return new SignInFailed_(inner);
+ }
+
+ static instanceOf(obj: any): obj is SignInFailed_ {
+ return obj.tag === AppTelemetrySignal_Tags.SignInFailed;
+ }
+
+ }
+
+ type OnboardingPage__interface = {
+ tag: AppTelemetrySignal_Tags.OnboardingPage;
+ inner:
+Readonly<{page: string; action: string; choice: string}>
+ };
+ /**
+ * A first-run page was shown or left (`cua_onboarding_page`).
+ */
+ class OnboardingPage_ extends UniffiEnum implements OnboardingPage__interface {
+ /**
+ * @private
+ * This field is private and should not be used, use `tag` instead.
+ */
+ readonly [uniffiTypeNameSymbol] = "AppTelemetrySignal";
+ readonly tag = AppTelemetrySignal_Tags.OnboardingPage;
+ readonly inner:
+Readonly<{page: string; action: string; choice: string}>;
+ constructor(
+inner: {page: string; action: string; choice: string }) {
+ super("AppTelemetrySignal", "OnboardingPage");
+
+ this.inner = Object.freeze(inner);
+ }
+ static new(
+inner: {page: string; action: string; choice: string }): OnboardingPage_ {
+ return new OnboardingPage_(inner);
+ }
+
+ static instanceOf(obj: any): obj is OnboardingPage_ {
+ return obj.tag === AppTelemetrySignal_Tags.OnboardingPage;
+ }
+
+ }
+
+ type SpaceWizard__interface = {
+ tag: AppTelemetrySignal_Tags.SpaceWizard;
+ inner:
+Readonly<{action: string}>
+ };
+ /**
+ * The New Space panel (`cua_space_wizard`).
+ */
+ class SpaceWizard_ extends UniffiEnum implements SpaceWizard__interface {
+ /**
+ * @private
+ * This field is private and should not be used, use `tag` instead.
+ */
+ readonly [uniffiTypeNameSymbol] = "AppTelemetrySignal";
+ readonly tag = AppTelemetrySignal_Tags.SpaceWizard;
+ readonly inner:
+Readonly<{action: string}>;
+ constructor(
+inner: {action: string }) {
+ super("AppTelemetrySignal", "SpaceWizard");
+
+ this.inner = Object.freeze(inner);
+ }
+ static new(
+inner: {action: string }): SpaceWizard_ {
+ return new SpaceWizard_(inner);
+ }
+
+ static instanceOf(obj: any): obj is SpaceWizard_ {
+ return obj.tag === AppTelemetrySignal_Tags.SpaceWizard;
+ }
+
+ }
+
+ type SpaceCreate__interface = {
+ tag: AppTelemetrySignal_Tags.SpaceCreate;
+ inner:
+Readonly<{location: string; guestOs: string; kind: string; outcome: string; failedPhase: string; stalled: boolean; elapsedMs: bigint; gpu: boolean; errorVariant: string}>
+ };
+ /**
+ * A Space create reached ready or failed (`cua_space_create`).
+ */
+ class SpaceCreate_ extends UniffiEnum implements SpaceCreate__interface {
+ /**
+ * @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "AppTelemetrySignal";
@@ -13228,88 +14219,6 @@ const FfiConverterTypeAppLocation = (() => {
return new FFIConverter();
})();
-export enum AppSpaceOs {
- /**
- * macOS.
- */
- Macos = "macos",
- /**
- * Windows.
- */
- Windows = "windows",
- /**
- * Linux.
- */
- Linux = "linux",
- /**
- * The host has not reported a recognized operating system.
- */
- Unknown = "unknown"
-}
-
-const FfiConverterTypeAppSpaceOs = (() => {
- const ordinalConverter = FfiConverterInt32;
- type TypeName = AppSpaceOs;
- class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
- read(from: RustBuffer): TypeName {
- switch (ordinalConverter.read(from)) {
- case 1: return AppSpaceOs.Macos;
- case 2: return AppSpaceOs.Windows;
- case 3: return AppSpaceOs.Linux;
- case 4: return AppSpaceOs.Unknown;
- default: throw new UniffiInternalError.UnexpectedEnumCase();
- }
- }
- write(value: TypeName, into: RustBuffer): void {
- switch (value) {
- case AppSpaceOs.Macos: return ordinalConverter.write(1, into);
- case AppSpaceOs.Windows: return ordinalConverter.write(2, into);
- case AppSpaceOs.Linux: return ordinalConverter.write(3, into);
- case AppSpaceOs.Unknown: return ordinalConverter.write(4, into);
- }
- }
- allocationSize(value: TypeName): number {
- return ordinalConverter.allocationSize(0);
- }
- }
- return new FFIConverter();
-})();
-
-export enum AppSpaceKind {
- /**
- * A container.
- */
- Container = "container",
- /**
- * A virtual machine.
- */
- Vm = "vm"
-}
-
-const FfiConverterTypeAppSpaceKind = (() => {
- const ordinalConverter = FfiConverterInt32;
- type TypeName = AppSpaceKind;
- class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
- read(from: RustBuffer): TypeName {
- switch (ordinalConverter.read(from)) {
- case 1: return AppSpaceKind.Container;
- case 2: return AppSpaceKind.Vm;
- default: throw new UniffiInternalError.UnexpectedEnumCase();
- }
- }
- write(value: TypeName, into: RustBuffer): void {
- switch (value) {
- case AppSpaceKind.Container: return ordinalConverter.write(1, into);
- case AppSpaceKind.Vm: return ordinalConverter.write(2, into);
- }
- }
- allocationSize(value: TypeName): number {
- return ordinalConverter.allocationSize(0);
- }
- }
- return new FFIConverter();
-})();
-
export enum AppLocalEngine {
/**
* A container (gVisor when installed, else runc).
@@ -14022,53 +14931,6 @@ const FfiConverterTypeAppCreateSpaceArgs = (() => {
return new FFIConverter();
})();
-export enum AppSpaceProvider {
- /**
- * Cua Cloud.
- */
- Cloud = "cloud",
- /**
- * This Mac.
- */
- Local = "local",
- /**
- * A machine added by address.
- */
- Direct = "direct",
- /**
- * A machine of the signed-in account through the relay.
- */
- Relay = "relay"
-}
-
-const FfiConverterTypeAppSpaceProvider = (() => {
- const ordinalConverter = FfiConverterInt32;
- type TypeName = AppSpaceProvider;
- class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
- read(from: RustBuffer): TypeName {
- switch (ordinalConverter.read(from)) {
- case 1: return AppSpaceProvider.Cloud;
- case 2: return AppSpaceProvider.Local;
- case 3: return AppSpaceProvider.Direct;
- case 4: return AppSpaceProvider.Relay;
- default: throw new UniffiInternalError.UnexpectedEnumCase();
- }
- }
- write(value: TypeName, into: RustBuffer): void {
- switch (value) {
- case AppSpaceProvider.Cloud: return ordinalConverter.write(1, into);
- case AppSpaceProvider.Local: return ordinalConverter.write(2, into);
- case AppSpaceProvider.Direct: return ordinalConverter.write(3, into);
- case AppSpaceProvider.Relay: return ordinalConverter.write(4, into);
- }
- }
- allocationSize(value: TypeName): number {
- return ordinalConverter.allocationSize(0);
- }
- }
- return new FFIConverter();
-})();
-
export type AppPendingCreate = {
/**
* `pending:<token>`.
@@ -15558,6 +16420,83 @@ const FfiConverterTypeAppDeviceConfirm = (() => {
return new FFIConverter();
})();
+export type AppDeviceIn = {
+ /**
+ * `dev_…`.
+ */
+ id: string,
+ /**
+ * Its name (by default its hostname).
+ */
+ name: string,
+ /**
+ * `macos`, `windows`, `linux` (any case), or empty.
+ */
+ platform: string,
+ /**
+ * Last session (Unix seconds).
+ */
+ lastSeen?: bigint,
+ /**
+ * This device.
+ */
+ current: boolean,
+ /**
+ * `pending`, `enrolled`, `expired`, `revoked`, or empty.
+ */
+ state: string
+}
+
+/**
+ * Generated factory for {@link AppDeviceIn} record objects.
+ */
+export const AppDeviceIn = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<AppDeviceIn, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<AppDeviceIn>,
+ });
+})();
+
+const FfiConverterTypeAppDeviceIn = (() => {
+ type TypeName = AppDeviceIn;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ id: FfiConverterString.read(from),
+ name: FfiConverterString.read(from),
+ platform: FfiConverterString.read(from),
+ lastSeen: FfiConverterOptionalUInt64.read(from),
+ current: FfiConverterBool.read(from),
+ state: FfiConverterString.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.id, into);
+ FfiConverterString.write(value.name, into);
+ FfiConverterString.write(value.platform, into);
+ FfiConverterOptionalUInt64.write(value.lastSeen, into);
+ FfiConverterBool.write(value.current, into);
+ FfiConverterString.write(value.state, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterString.allocationSize(value.id) +
+ FfiConverterString.allocationSize(value.name) +
+ FfiConverterString.allocationSize(value.platform) +
+ FfiConverterOptionalUInt64.allocationSize(value.lastSeen) +
+ FfiConverterBool.allocationSize(value.current) +
+ FfiConverterString.allocationSize(value.state);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
export type AppDeviceInput = {
/**
* `dev_…`.
@@ -23120,856 +24059,334 @@ export type AppLoginItemInput = {
/**
* Why the last change failed.
*/
- error?: string,
- /**
- * This machine provides Spaces to your other devices (host setup's
- * "A spare machine for Spaces").
- */
- providesSpaces: boolean,
- /**
- * This machine runs persistent agents.
- */
- runsAgents: boolean
-}
-
-/**
- * Generated factory for {@link AppLoginItemInput} record objects.
- */
-export const AppLoginItemInput = (() => {
- const defaults = () => ({
- });
- const create = (() => {
- return uniffiCreateRecord<AppLoginItemInput, ReturnType<typeof defaults>>(defaults);
- })();
- return Object.freeze({
- create,
- new: create,
- defaults: () => Object.freeze(defaults()) as Partial<AppLoginItemInput>,
- });
-})();
-
-const FfiConverterTypeAppLoginItemInput = (() => {
- type TypeName = AppLoginItemInput;
- class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
- read(from: RustBuffer): TypeName {
- return {
- status: FfiConverterTypeAppLoginItemStatus.read(from),
- busy: FfiConverterBool.read(from),
- error: FfiConverterOptionalString.read(from),
- providesSpaces: FfiConverterBool.read(from),
- runsAgents: FfiConverterBool.read(from)
- };
- }
- write(value: TypeName, into: RustBuffer): void {
- FfiConverterTypeAppLoginItemStatus.write(value.status, into);
- FfiConverterBool.write(value.busy, into);
- FfiConverterOptionalString.write(value.error, into);
- FfiConverterBool.write(value.providesSpaces, into);
- FfiConverterBool.write(value.runsAgents, into);
- }
- allocationSize(value: TypeName): number {
- return FfiConverterTypeAppLoginItemStatus.allocationSize(value.status) +
- FfiConverterBool.allocationSize(value.busy) +
- FfiConverterOptionalString.allocationSize(value.error) +
- FfiConverterBool.allocationSize(value.providesSpaces) +
- FfiConverterBool.allocationSize(value.runsAgents);
-
- }
- };
- return new FFIConverter();
-})();
-
-export type AppLoginItemPlan = {
- /**
- * Register the app as a login item now.
- */
- register: boolean,
- /**
- * Save this as the user's choice (`AppSettings::launch_at_login`).
- */
- record?: boolean
-}
-
-/**
- * Generated factory for {@link AppLoginItemPlan} record objects.
- */
-export const AppLoginItemPlan = (() => {
- const defaults = () => ({
- });
- const create = (() => {
- return uniffiCreateRecord<AppLoginItemPlan, ReturnType<typeof defaults>>(defaults);
- })();
- return Object.freeze({
- create,
- new: create,
- defaults: () => Object.freeze(defaults()) as Partial<AppLoginItemPlan>,
- });
-})();
-
-const FfiConverterTypeAppLoginItemPlan = (() => {
- type TypeName = AppLoginItemPlan;
- class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
- read(from: RustBuffer): TypeName {
- return {
- register: FfiConverterBool.read(from),
- record: FfiConverterOptionalBoolean.read(from)
- };
- }
- write(value: TypeName, into: RustBuffer): void {
- FfiConverterBool.write(value.register, into);
- FfiConverterOptionalBoolean.write(value.record, into);
- }
- allocationSize(value: TypeName): number {
- return FfiConverterBool.allocationSize(value.register) +
- FfiConverterOptionalBoolean.allocationSize(value.record);
-
- }
- };
- return new FFIConverter();
-})();
-
-export type AppMainChrome = {
- /**
- * Window title when nothing is selected.
- */
- title: string,
- /**
- * "New Space".
- */
- newSpaceLabel: string,
- /**
- * "⌘N".
- */
- newSpaceShortcut: string,
- /**
- * The sidebar search's placeholder.
- */
- searchPlaceholder: string,
- /**
- * The Keyvault section's title.
- */
- keyvaultTitle: string,
- /**
- * The account line: the identity, "API key" or "Not signed in".
- */
- account: string,
- /**
- * "Sign in", when signing in is offered.
- */
- signInLabel?: string,
- /**
- * "Settings".
- */
- settingsLabel: string,
- /**
- * "⌘,".
- */
- settingsShortcut: string,
- /**
- * With no Spaces: the heading.
- */
- emptyTitle: string,
- /**
- * With no Spaces: the default Linux Space's tile.
- */
- emptyAction: string,
- /**
- * Under it: the time and disk.
- */
- emptyLinuxDetail: string,
- /**
- * With no Spaces: the line under the heading.
- */
- emptyDetail: string,
- /**
- * With no Spaces: the default macOS Space's tile.
- */
- emptyMacosAction: string,
- /**
- * Under it: the download size.
- */
- emptyMacosDetail: string,
- /**
- * The sidebar's Volume page entry ("Volume"); none while the Cua Volume
- * experiment is off (the page and its route are hidden; a mounted
- * volume stays mounted).
- */
- volumeLabel?: string
-}
-
-/**
- * Generated factory for {@link AppMainChrome} record objects.
- */
-export const AppMainChrome = (() => {
- const defaults = () => ({
- });
- const create = (() => {
- return uniffiCreateRecord<AppMainChrome, ReturnType<typeof defaults>>(defaults);
- })();
- return Object.freeze({
- create,
- new: create,
- defaults: () => Object.freeze(defaults()) as Partial<AppMainChrome>,
- });
-})();
-
-const FfiConverterTypeAppMainChrome = (() => {
- type TypeName = AppMainChrome;
- class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
- read(from: RustBuffer): TypeName {
- return {
- title: FfiConverterString.read(from),
- newSpaceLabel: FfiConverterString.read(from),
- newSpaceShortcut: FfiConverterString.read(from),
- searchPlaceholder: FfiConverterString.read(from),
- keyvaultTitle: FfiConverterString.read(from),
- account: FfiConverterString.read(from),
- signInLabel: FfiConverterOptionalString.read(from),
- settingsLabel: FfiConverterString.read(from),
- settingsShortcut: FfiConverterString.read(from),
- emptyTitle: FfiConverterString.read(from),
- emptyAction: FfiConverterString.read(from),
- emptyLinuxDetail: FfiConverterString.read(from),
- emptyDetail: FfiConverterString.read(from),
- emptyMacosAction: FfiConverterString.read(from),
- emptyMacosDetail: FfiConverterString.read(from),
- volumeLabel: FfiConverterOptionalString.read(from)
- };
- }
- write(value: TypeName, into: RustBuffer): void {
- FfiConverterString.write(value.title, into);
- FfiConverterString.write(value.newSpaceLabel, into);
- FfiConverterString.write(value.newSpaceShortcut, into);
- FfiConverterString.write(value.searchPlaceholder, into);
- FfiConverterString.write(value.keyvaultTitle, into);
- FfiConverterString.write(value.account, into);
- FfiConverterOptionalString.write(value.signInLabel, into);
- FfiConverterString.write(value.settingsLabel, into);
- FfiConverterString.write(value.settingsShortcut, into);
- FfiConverterString.write(value.emptyTitle, into);
- FfiConverterString.write(value.emptyAction, into);
- FfiConverterString.write(value.emptyLinuxDetail, into);
- FfiConverterString.write(value.emptyDetail, into);
- FfiConverterString.write(value.emptyMacosAction, into);
- FfiConverterString.write(value.emptyMacosDetail, into);
- FfiConverterOptionalString.write(value.volumeLabel, into);
- }
- allocationSize(value: TypeName): number {
- return FfiConverterString.allocationSize(value.title) +
- FfiConverterString.allocationSize(value.newSpaceLabel) +
- FfiConverterString.allocationSize(value.newSpaceShortcut) +
- FfiConverterString.allocationSize(value.searchPlaceholder) +
- FfiConverterString.allocationSize(value.keyvaultTitle) +
- FfiConverterString.allocationSize(value.account) +
- FfiConverterOptionalString.allocationSize(value.signInLabel) +
- FfiConverterString.allocationSize(value.settingsLabel) +
- FfiConverterString.allocationSize(value.settingsShortcut) +
- FfiConverterString.allocationSize(value.emptyTitle) +
- FfiConverterString.allocationSize(value.emptyAction) +
- FfiConverterString.allocationSize(value.emptyLinuxDetail) +
- FfiConverterString.allocationSize(value.emptyDetail) +
- FfiConverterString.allocationSize(value.emptyMacosAction) +
- FfiConverterString.allocationSize(value.emptyMacosDetail) +
- FfiConverterOptionalString.allocationSize(value.volumeLabel);
-
- }
- };
- return new FFIConverter();
-})();
-
-export enum AppSpaceStatus {
- /**
- * The host machine itself.
- */
- Local = "local",
- /**
- * Reachable, session active.
- */
- Running = "running",
- /**
- * An agent waits for approval.
- */
- Approval = "approval",
- /**
- * Unreachable or suspended.
- */
- Suspended = "suspended",
- /**
- * Being created.
- */
- Provisioning = "provisioning",
- /**
- * Being deleted (the user confirmed; the SDK is removing it).
- */
- Deleting = "deleting"
-}
-
-const FfiConverterTypeAppSpaceStatus = (() => {
- const ordinalConverter = FfiConverterInt32;
- type TypeName = AppSpaceStatus;
- class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
- read(from: RustBuffer): TypeName {
- switch (ordinalConverter.read(from)) {
- case 1: return AppSpaceStatus.Local;
- case 2: return AppSpaceStatus.Running;
- case 3: return AppSpaceStatus.Approval;
- case 4: return AppSpaceStatus.Suspended;
- case 5: return AppSpaceStatus.Provisioning;
- case 6: return AppSpaceStatus.Deleting;
- default: throw new UniffiInternalError.UnexpectedEnumCase();
- }
- }
- write(value: TypeName, into: RustBuffer): void {
- switch (value) {
- case AppSpaceStatus.Local: return ordinalConverter.write(1, into);
- case AppSpaceStatus.Running: return ordinalConverter.write(2, into);
- case AppSpaceStatus.Approval: return ordinalConverter.write(3, into);
- case AppSpaceStatus.Suspended: return ordinalConverter.write(4, into);
- case AppSpaceStatus.Provisioning: return ordinalConverter.write(5, into);
- case AppSpaceStatus.Deleting: return ordinalConverter.write(6, into);
- }
- }
- allocationSize(value: TypeName): number {
- return ordinalConverter.allocationSize(0);
- }
- }
- return new FFIConverter();
-})();
-
-export enum AppThumbnailScene {
- /**
- * A macOS desktop.
- */
- MacDesktop = "macDesktop",
- /**
- * A Windows desktop.
- */
- WindowsDesktop = "windowsDesktop",
- /**
- * A Linux terminal.
- */
- LinuxTerminal = "linuxTerminal",
- /**
- * A notes app.
- */
- Notes = "notes",
- /**
- * A browser.
- */
- Browser = "browser",
- /**
- * Nothing.
- */
- Blank = "blank"
-}
-
-const FfiConverterTypeAppThumbnailScene = (() => {
- const ordinalConverter = FfiConverterInt32;
- type TypeName = AppThumbnailScene;
- class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
- read(from: RustBuffer): TypeName {
- switch (ordinalConverter.read(from)) {
- case 1: return AppThumbnailScene.MacDesktop;
- case 2: return AppThumbnailScene.WindowsDesktop;
- case 3: return AppThumbnailScene.LinuxTerminal;
- case 4: return AppThumbnailScene.Notes;
- case 5: return AppThumbnailScene.Browser;
- case 6: return AppThumbnailScene.Blank;
- default: throw new UniffiInternalError.UnexpectedEnumCase();
- }
- }
- write(value: TypeName, into: RustBuffer): void {
- switch (value) {
- case AppThumbnailScene.MacDesktop: return ordinalConverter.write(1, into);
- case AppThumbnailScene.WindowsDesktop: return ordinalConverter.write(2, into);
- case AppThumbnailScene.LinuxTerminal: return ordinalConverter.write(3, into);
- case AppThumbnailScene.Notes: return ordinalConverter.write(4, into);
- case AppThumbnailScene.Browser: return ordinalConverter.write(5, into);
- case AppThumbnailScene.Blank: return ordinalConverter.write(6, into);
- }
- }
- allocationSize(value: TypeName): number {
- return ordinalConverter.allocationSize(0);
- }
- }
- return new FFIConverter();
-})();
-
-export type AppSpaceSdkRef = {
- /**
- * spacesd feature names.
- */
- features: Array<string>,
- /**
- * spacesd version at the last handshake.
- */
- spacesdVersion: string,
+ error?: string,
/**
- * Answered the last bounded connect.
+ * This machine provides Spaces to your other devices (host setup's
+ * "A spare machine for Spaces").
*/
- reachable: boolean,
+ providesSpaces: boolean,
/**
- * Why not.
+ * This machine runs persistent agents.
*/
- error?: string
+ runsAgents: boolean
}
/**
- * Generated factory for {@link AppSpaceSdkRef} record objects.
+ * Generated factory for {@link AppLoginItemInput} record objects.
*/
-export const AppSpaceSdkRef = (() => {
+export const AppLoginItemInput = (() => {
const defaults = () => ({
});
const create = (() => {
- return uniffiCreateRecord<AppSpaceSdkRef, ReturnType<typeof defaults>>(defaults);
+ return uniffiCreateRecord<AppLoginItemInput, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
- defaults: () => Object.freeze(defaults()) as Partial<AppSpaceSdkRef>,
+ defaults: () => Object.freeze(defaults()) as Partial<AppLoginItemInput>,
});
})();
-const FfiConverterTypeAppSpaceSdkRef = (() => {
- type TypeName = AppSpaceSdkRef;
+const FfiConverterTypeAppLoginItemInput = (() => {
+ type TypeName = AppLoginItemInput;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
- features: FfiConverterSequenceString.read(from),
- spacesdVersion: FfiConverterString.read(from),
- reachable: FfiConverterBool.read(from),
- error: FfiConverterOptionalString.read(from)
+ status: FfiConverterTypeAppLoginItemStatus.read(from),
+ busy: FfiConverterBool.read(from),
+ error: FfiConverterOptionalString.read(from),
+ providesSpaces: FfiConverterBool.read(from),
+ runsAgents: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
- FfiConverterSequenceString.write(value.features, into);
- FfiConverterString.write(value.spacesdVersion, into);
- FfiConverterBool.write(value.reachable, into);
+ FfiConverterTypeAppLoginItemStatus.write(value.status, into);
+ FfiConverterBool.write(value.busy, into);
FfiConverterOptionalString.write(value.error, into);
+ FfiConverterBool.write(value.providesSpaces, into);
+ FfiConverterBool.write(value.runsAgents, into);
}
allocationSize(value: TypeName): number {
- return FfiConverterSequenceString.allocationSize(value.features) +
- FfiConverterString.allocationSize(value.spacesdVersion) +
- FfiConverterBool.allocationSize(value.reachable) +
- FfiConverterOptionalString.allocationSize(value.error);
+ return FfiConverterTypeAppLoginItemStatus.allocationSize(value.status) +
+ FfiConverterBool.allocationSize(value.busy) +
+ FfiConverterOptionalString.allocationSize(value.error) +
+ FfiConverterBool.allocationSize(value.providesSpaces) +
+ FfiConverterBool.allocationSize(value.runsAgents);
}
};
return new FFIConverter();
})();
-export type AppSpaceProgress = {
- /**
- * The SDK's phase word (`preparing`, `pulling`, `booting`, ...).
- */
- phase: string,
- /**
- * Overall progress in thousandths.
- */
- permille: number,
- /**
- * The phase in words ("Starting…", "Downloading image…"), or "Failed".
- */
- label: string,
- /**
- * Why the create failed.
- */
- error?: string,
- /**
- * It failed because the account is out of Cua Cloud credit: the
- * website billing page "Add credit" opens.
- */
- creditUrl?: string,
- /**
- * While it downloads: "4.2 of 22.1 GB · 85 MB/s · about 4 min"
- * ([`crate::spaces::creating::transfer_text`]).
- */
- transfer?: string,
+export type AppLoginItemPlan = {
/**
- * Cancel can stop it now.
+ * Register the app as a login item now.
*/
- cancellable: boolean,
+ register: boolean,
/**
- * Cancel was pressed and the create is being cleaned up.
+ * Save this as the user's choice (`AppSettings::launch_at_login`).
*/
- cancelling: boolean
+ record?: boolean
}
/**
- * Generated factory for {@link AppSpaceProgress} record objects.
+ * Generated factory for {@link AppLoginItemPlan} record objects.
*/
-export const AppSpaceProgress = (() => {
+export const AppLoginItemPlan = (() => {
const defaults = () => ({
});
const create = (() => {
- return uniffiCreateRecord<AppSpaceProgress, ReturnType<typeof defaults>>(defaults);
+ return uniffiCreateRecord<AppLoginItemPlan, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
- defaults: () => Object.freeze(defaults()) as Partial<AppSpaceProgress>,
+ defaults: () => Object.freeze(defaults()) as Partial<AppLoginItemPlan>,
});
})();
-const FfiConverterTypeAppSpaceProgress = (() => {
- type TypeName = AppSpaceProgress;
+const FfiConverterTypeAppLoginItemPlan = (() => {
+ type TypeName = AppLoginItemPlan;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
- phase: FfiConverterString.read(from),
- permille: FfiConverterUInt32.read(from),
- label: FfiConverterString.read(from),
- error: FfiConverterOptionalString.read(from),
- creditUrl: FfiConverterOptionalString.read(from),
- transfer: FfiConverterOptionalString.read(from),
- cancellable: FfiConverterBool.read(from),
- cancelling: FfiConverterBool.read(from)
+ register: FfiConverterBool.read(from),
+ record: FfiConverterOptionalBoolean.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
- FfiConverterString.write(value.phase, into);
- FfiConverterUInt32.write(value.permille, into);
- FfiConverterString.write(value.label, into);
- FfiConverterOptionalString.write(value.error, into);
- FfiConverterOptionalString.write(value.creditUrl, into);
- FfiConverterOptionalString.write(value.transfer, into);
- FfiConverterBool.write(value.cancellable, into);
- FfiConverterBool.write(value.cancelling, into);
+ FfiConverterBool.write(value.register, into);
+ FfiConverterOptionalBoolean.write(value.record, into);
}
allocationSize(value: TypeName): number {
- return FfiConverterString.allocationSize(value.phase) +
- FfiConverterUInt32.allocationSize(value.permille) +
- FfiConverterString.allocationSize(value.label) +
- FfiConverterOptionalString.allocationSize(value.error) +
- FfiConverterOptionalString.allocationSize(value.creditUrl) +
- FfiConverterOptionalString.allocationSize(value.transfer) +
- FfiConverterBool.allocationSize(value.cancellable) +
- FfiConverterBool.allocationSize(value.cancelling);
+ return FfiConverterBool.allocationSize(value.register) +
+ FfiConverterOptionalBoolean.allocationSize(value.record);
}
};
return new FFIConverter();
})();
-export enum AppPowerControl {
+export type AppMachinesPageInput = {
/**
- * Suspended in memory; it resumes where it was.
+ * The system this app runs on (names the first row "This Mac").
*/
- Suspend = "suspend",
+ hostOs: AppSpaceOs,
/**
- * Stopped with its disk kept; it boots again.
+ * The Spaces list as the shell has it (registry rows as Spaces).
*/
- Stop = "stop"
-}
-
-const FfiConverterTypeAppPowerControl = (() => {
- const ordinalConverter = FfiConverterInt32;
- type TypeName = AppPowerControl;
- class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
- read(from: RustBuffer): TypeName {
- switch (ordinalConverter.read(from)) {
- case 1: return AppPowerControl.Suspend;
- case 2: return AppPowerControl.Stop;
- default: throw new UniffiInternalError.UnexpectedEnumCase();
- }
- }
- write(value: TypeName, into: RustBuffer): void {
- switch (value) {
- case AppPowerControl.Suspend: return ordinalConverter.write(1, into);
- case AppPowerControl.Stop: return ordinalConverter.write(2, into);
- }
- }
- allocationSize(value: TypeName): number {
- return ordinalConverter.allocationSize(0);
- }
- }
- return new FFIConverter();
-})();
-
-export type AppSpacePower = {
+ spaces: Array<AppSpace>,
/**
- * How it turns off.
+ * The account's devices (none while signed out).
*/
- control: AppPowerControl,
+ devices: Array<AppDeviceIn>,
/**
- * It is off: suspended or stopped as the SDK recorded it, or not
- * answering with no recorded state (a Space one of your machines
- * provides).
+ * The hostname each machine's cua-spacesd reported, by machine id.
*/
- off: boolean,
+ hostnames: Map<string, string>,
/**
- * Being turned on (`true`) or off (`false`) now.
+ * Whether the relay sees each machine connected now, by machine id.
*/
- turningOn?: boolean,
+ presence: Map<string, boolean>,
/**
- * Why the last power action failed, until the next one.
+ * Unix seconds.
*/
- error?: string
+ now: bigint
}
/**
- * Generated factory for {@link AppSpacePower} record objects.
+ * Generated factory for {@link AppMachinesPageInput} record objects.
*/
-export const AppSpacePower = (() => {
+export const AppMachinesPageInput = (() => {
const defaults = () => ({
});
const create = (() => {
- return uniffiCreateRecord<AppSpacePower, ReturnType<typeof defaults>>(defaults);
+ return uniffiCreateRecord<AppMachinesPageInput, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
- defaults: () => Object.freeze(defaults()) as Partial<AppSpacePower>,
+ defaults: () => Object.freeze(defaults()) as Partial<AppMachinesPageInput>,
});
})();
-const FfiConverterTypeAppSpacePower = (() => {
- type TypeName = AppSpacePower;
+const FfiConverterTypeAppMachinesPageInput = (() => {
+ type TypeName = AppMachinesPageInput;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
- control: FfiConverterTypeAppPowerControl.read(from),
- off: FfiConverterBool.read(from),
- turningOn: FfiConverterOptionalBoolean.read(from),
- error: FfiConverterOptionalString.read(from)
+ hostOs: FfiConverterTypeAppSpaceOs.read(from),
+ spaces: FfiConverterSequenceTypeAppSpace.read(from),
+ devices: FfiConverterSequenceTypeAppDeviceIn.read(from),
+ hostnames: FfiConverterMapStringString.read(from),
+ presence: FfiConverterMapStringBoolean.read(from),
+ now: FfiConverterUInt64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
- FfiConverterTypeAppPowerControl.write(value.control, into);
- FfiConverterBool.write(value.off, into);
- FfiConverterOptionalBoolean.write(value.turningOn, into);
- FfiConverterOptionalString.write(value.error, into);
+ FfiConverterTypeAppSpaceOs.write(value.hostOs, into);
+ FfiConverterSequenceTypeAppSpace.write(value.spaces, into);
+ FfiConverterSequenceTypeAppDeviceIn.write(value.devices, into);
+ FfiConverterMapStringString.write(value.hostnames, into);
+ FfiConverterMapStringBoolean.write(value.presence, into);
+ FfiConverterUInt64.write(value.now, into);
}
allocationSize(value: TypeName): number {
- return FfiConverterTypeAppPowerControl.allocationSize(value.control) +
- FfiConverterBool.allocationSize(value.off) +
- FfiConverterOptionalBoolean.allocationSize(value.turningOn) +
- FfiConverterOptionalString.allocationSize(value.error);
+ return FfiConverterTypeAppSpaceOs.allocationSize(value.hostOs) +
+ FfiConverterSequenceTypeAppSpace.allocationSize(value.spaces) +
+ FfiConverterSequenceTypeAppDeviceIn.allocationSize(value.devices) +
+ FfiConverterMapStringString.allocationSize(value.hostnames) +
+ FfiConverterMapStringBoolean.allocationSize(value.presence) +
+ FfiConverterUInt64.allocationSize(value.now);
}
};
return new FFIConverter();
})();
-export type AppSpace = {
- /**
- * Sandbox ref (`cloud:<name>`, `local:<name>`, `direct:<host:port>`, ...).
- */
- id: string,
- /**
- * Display name.
- */
- name: string,
- /**
- * Operating system.
- */
- os: AppSpaceOs,
- /**
- * Status.
- */
- status: AppSpaceStatus,
- /**
- * One short status detail.
- */
- detail: string,
- /**
- * Epoch ms of the last focus.
- */
- lastUsedAt: bigint,
- /**
- * Epoch ms it was created.
- */
- startedAt?: bigint,
- /**
- * Placeholder scene.
- */
- scene: AppThumbnailScene,
- /**
- * Group (cloud namespace or location word).
- */
- fleetId?: string,
- /**
- * Fixture machine size.
- */
- size?: string,
+export type AppMainChrome = {
/**
- * Fixture region.
+ * Window title when nothing is selected.
*/
- region?: string,
+ title: string,
/**
- * Where it runs (cloud when omitted).
+ * "New Space".
*/
- provider?: AppSpaceProvider,
+ newSpaceLabel: string,
/**
- * SDK facts, for Spaces from the live registry.
+ * "⌘N".
*/
- sdk?: AppSpaceSdkRef,
+ newSpaceShortcut: string,
/**
- * The guest OS product or distribution ("Ubuntu", "macOS"), when the
- * Space reported one: it picks the OS icon ([`crate::notch::os_icon`]).
+ * The sidebar search's placeholder.
*/
- osName?: string,
+ searchPlaceholder: string,
/**
- * The guest's full OS string ("Ubuntu 24.04.3 LTS"), when the Space
- * reported one.
+ * The Keyvault section's title.
*/
- osPrettyName?: string,
+ keyvaultTitle: string,
/**
- * The image it runs ("ghcr.io/trycua/linux:24.04"), when known.
+ * The account line: the identity, "API key" or "Not signed in".
*/
- image?: string,
+ account: string,
/**
- * The digest of the variant that runs, when known.
+ * "Sign in", when signing in is offered.
*/
- imageDigest?: string,
+ signInLabel?: string,
/**
- * While it is being created: how far along, from the SDK's create
- * progress ([`crate::spaces::creating`]).
+ * "Settings".
*/
- progress?: AppSpaceProgress,
+ settingsLabel: string,
/**
- * Container or virtual machine, when known.
+ * "⌘,".
*/
- kind?: AppSpaceKind,
+ settingsShortcut: string,
/**
- * The guest's CPU architecture (`arm64`, `amd64`), when known.
+ * With no Spaces: the heading.
*/
- arch?: string,
+ emptyTitle: string,
/**
- * For a Space one of your machines provides: that machine's relay id
- * (the sidebar nests it under the machine).
+ * With no Spaces: the default Linux Space's tile.
*/
- host?: string,
+ emptyAction: string,
/**
- * That machine's name, when known.
+ * Under it: the time and disk.
*/
- hostName?: string,
+ emptyLinuxDetail: string,
/**
- * Whether and how it turns off and on (the SDK's `power`), with a
- * power action in flight ([`crate::spaces::creating::compose`]).
- * `None`: it cannot (a cloud Space, one added by address).
+ * With no Spaces: the line under the heading.
*/
- power?: AppSpacePower,
+ emptyDetail: string,
/**
- * For a Space in your cloud: the provider word (`aws`, `gcp`,
- * `modal`).
+ * With no Spaces: the default macOS Space's tile.
*/
- cloud?: string,
+ emptyMacosAction: string,
/**
- * Its account and region in words ("AWS · us-west-2").
+ * Under it: the download size.
*/
- cloudPlace?: string,
+ emptyMacosDetail: string,
/**
- * Where Delete permanently can delete it: `here`, `host:<machine>`
- * (that machine created it) or `elsewhere` (another device did).
+ * The sidebar's Volume page entry ("Volume"); none while the Cua Volume
+ * experiment is off (the page and its route are hidden; a mounted
+ * volume stays mounted).
*/
- cloudDelete?: string
+ volumeLabel?: string
}
/**
- * Generated factory for {@link AppSpace} record objects.
+ * Generated factory for {@link AppMainChrome} record objects.
*/
-export const AppSpace = (() => {
+export const AppMainChrome = (() => {
const defaults = () => ({
});
const create = (() => {
- return uniffiCreateRecord<AppSpace, ReturnType<typeof defaults>>(defaults);
+ return uniffiCreateRecord<AppMainChrome, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
- defaults: () => Object.freeze(defaults()) as Partial<AppSpace>,
+ defaults: () => Object.freeze(defaults()) as Partial<AppMainChrome>,
});
})();
-const FfiConverterTypeAppSpace = (() => {
- type TypeName = AppSpace;
+const FfiConverterTypeAppMainChrome = (() => {
+ type TypeName = AppMainChrome;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
- id: FfiConverterString.read(from),
- name: FfiConverterString.read(from),
- os: FfiConverterTypeAppSpaceOs.read(from),
- status: FfiConverterTypeAppSpaceStatus.read(from),
- detail: FfiConverterString.read(from),
- lastUsedAt: FfiConverterInt64.read(from),
- startedAt: FfiConverterOptionalInt64.read(from),
- scene: FfiConverterTypeAppThumbnailScene.read(from),
- fleetId: FfiConverterOptionalString.read(from),
- size: FfiConverterOptionalString.read(from),
- region: FfiConverterOptionalString.read(from),
- provider: FfiConverterOptionalTypeAppSpaceProvider.read(from),
- sdk: FfiConverterOptionalTypeAppSpaceSdkRef.read(from),
- osName: FfiConverterOptionalString.read(from),
- osPrettyName: FfiConverterOptionalString.read(from),
- image: FfiConverterOptionalString.read(from),
- imageDigest: FfiConverterOptionalString.read(from),
- progress: FfiConverterOptionalTypeAppSpaceProgress.read(from),
- kind: FfiConverterOptionalTypeAppSpaceKind.read(from),
- arch: FfiConverterOptionalString.read(from),
- host: FfiConverterOptionalString.read(from),
- hostName: FfiConverterOptionalString.read(from),
- power: FfiConverterOptionalTypeAppSpacePower.read(from),
- cloud: FfiConverterOptionalString.read(from),
- cloudPlace: FfiConverterOptionalString.read(from),
- cloudDelete: FfiConverterOptionalString.read(from)
+ title: FfiConverterString.read(from),
+ newSpaceLabel: FfiConverterString.read(from),
+ newSpaceShortcut: FfiConverterString.read(from),
+ searchPlaceholder: FfiConverterString.read(from),
+ keyvaultTitle: FfiConverterString.read(from),
+ account: FfiConverterString.read(from),
+ signInLabel: FfiConverterOptionalString.read(from),
+ settingsLabel: FfiConverterString.read(from),
+ settingsShortcut: FfiConverterString.read(from),
+ emptyTitle: FfiConverterString.read(from),
+ emptyAction: FfiConverterString.read(from),
+ emptyLinuxDetail: FfiConverterString.read(from),
+ emptyDetail: FfiConverterString.read(from),
+ emptyMacosAction: FfiConverterString.read(from),
+ emptyMacosDetail: FfiConverterString.read(from),
+ volumeLabel: FfiConverterOptionalString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
- FfiConverterString.write(value.id, into);
- FfiConverterString.write(value.name, into);
- FfiConverterTypeAppSpaceOs.write(value.os, into);
- FfiConverterTypeAppSpaceStatus.write(value.status, into);
- FfiConverterString.write(value.detail, into);
- FfiConverterInt64.write(value.lastUsedAt, into);
- FfiConverterOptionalInt64.write(value.startedAt, into);
- FfiConverterTypeAppThumbnailScene.write(value.scene, into);
- FfiConverterOptionalString.write(value.fleetId, into);
- FfiConverterOptionalString.write(value.size, into);
- FfiConverterOptionalString.write(value.region, into);
- FfiConverterOptionalTypeAppSpaceProvider.write(value.provider, into);
- FfiConverterOptionalTypeAppSpaceSdkRef.write(value.sdk, into);
- FfiConverterOptionalString.write(value.osName, into);
- FfiConverterOptionalString.write(value.osPrettyName, into);
- FfiConverterOptionalString.write(value.image, into);
- FfiConverterOptionalString.write(value.imageDigest, into);
- FfiConverterOptionalTypeAppSpaceProgress.write(value.progress, into);
- FfiConverterOptionalTypeAppSpaceKind.write(value.kind, into);
- FfiConverterOptionalString.write(value.arch, into);
- FfiConverterOptionalString.write(value.host, into);
- FfiConverterOptionalString.write(value.hostName, into);
- FfiConverterOptionalTypeAppSpacePower.write(value.power, into);
- FfiConverterOptionalString.write(value.cloud, into);
- FfiConverterOptionalString.write(value.cloudPlace, into);
- FfiConverterOptionalString.write(value.cloudDelete, into);
+ FfiConverterString.write(value.title, into);
+ FfiConverterString.write(value.newSpaceLabel, into);
+ FfiConverterString.write(value.newSpaceShortcut, into);
+ FfiConverterString.write(value.searchPlaceholder, into);
+ FfiConverterString.write(value.keyvaultTitle, into);
+ FfiConverterString.write(value.account, into);
+ FfiConverterOptionalString.write(value.signInLabel, into);
+ FfiConverterString.write(value.settingsLabel, into);
+ FfiConverterString.write(value.settingsShortcut, into);
+ FfiConverterString.write(value.emptyTitle, into);
+ FfiConverterString.write(value.emptyAction, into);
+ FfiConverterString.write(value.emptyLinuxDetail, into);
+ FfiConverterString.write(value.emptyDetail, into);
+ FfiConverterString.write(value.emptyMacosAction, into);
+ FfiConverterString.write(value.emptyMacosDetail, into);
+ FfiConverterOptionalString.write(value.volumeLabel, into);
}
allocationSize(value: TypeName): number {
- return FfiConverterString.allocationSize(value.id) +
- FfiConverterString.allocationSize(value.name) +
- FfiConverterTypeAppSpaceOs.allocationSize(value.os) +
- FfiConverterTypeAppSpaceStatus.allocationSize(value.status) +
- FfiConverterString.allocationSize(value.detail) +
- FfiConverterInt64.allocationSize(value.lastUsedAt) +
- FfiConverterOptionalInt64.allocationSize(value.startedAt) +
- FfiConverterTypeAppThumbnailScene.allocationSize(value.scene) +
- FfiConverterOptionalString.allocationSize(value.fleetId) +
- FfiConverterOptionalString.allocationSize(value.size) +
- FfiConverterOptionalString.allocationSize(value.region) +
- FfiConverterOptionalTypeAppSpaceProvider.allocationSize(value.provider) +
- FfiConverterOptionalTypeAppSpaceSdkRef.allocationSize(value.sdk) +
- FfiConverterOptionalString.allocationSize(value.osName) +
- FfiConverterOptionalString.allocationSize(value.osPrettyName) +
- FfiConverterOptionalString.allocationSize(value.image) +
- FfiConverterOptionalString.allocationSize(value.imageDigest) +
- FfiConverterOptionalTypeAppSpaceProgress.allocationSize(value.progress) +
- FfiConverterOptionalTypeAppSpaceKind.allocationSize(value.kind) +
- FfiConverterOptionalString.allocationSize(value.arch) +
- FfiConverterOptionalString.allocationSize(value.host) +
- FfiConverterOptionalString.allocationSize(value.hostName) +
- FfiConverterOptionalTypeAppSpacePower.allocationSize(value.power) +
- FfiConverterOptionalString.allocationSize(value.cloud) +
- FfiConverterOptionalString.allocationSize(value.cloudPlace) +
- FfiConverterOptionalString.allocationSize(value.cloudDelete);
+ return FfiConverterString.allocationSize(value.title) +
+ FfiConverterString.allocationSize(value.newSpaceLabel) +
+ FfiConverterString.allocationSize(value.newSpaceShortcut) +
+ FfiConverterString.allocationSize(value.searchPlaceholder) +
+ FfiConverterString.allocationSize(value.keyvaultTitle) +
+ FfiConverterString.allocationSize(value.account) +
+ FfiConverterOptionalString.allocationSize(value.signInLabel) +
+ FfiConverterString.allocationSize(value.settingsLabel) +
+ FfiConverterString.allocationSize(value.settingsShortcut) +
+ FfiConverterString.allocationSize(value.emptyTitle) +
+ FfiConverterString.allocationSize(value.emptyAction) +
+ FfiConverterString.allocationSize(value.emptyLinuxDetail) +
+ FfiConverterString.allocationSize(value.emptyDetail) +
+ FfiConverterString.allocationSize(value.emptyMacosAction) +
+ FfiConverterString.allocationSize(value.emptyMacosDetail) +
+ FfiConverterOptionalString.allocationSize(value.volumeLabel);
}
};
@@ -44172,7 +44589,8 @@ export enum AppChecklistAction_Tags {
Shown = "Shown",
Dismiss = "Dismiss",
Reopen = "Reopen",
- Observe = "Observe"
+ Observe = "Observe",
+ Merge = "Merge"
}
export const AppChecklistAction = (() => {
@@ -44325,6 +44743,43 @@ inner: {otherMachine: boolean; hasSpace: boolean; agentRan: boolean }): Observe_
}
+ type Merge__interface = {
+ tag: AppChecklistAction_Tags.Merge;
+ inner:
+Readonly<{state: AppChecklistState}>
+ };
+ /**
+ * Progress kept elsewhere before (the web UI's own storage, another
+ * copy of the file): its steps are ticked, and it stays closed or
+ * shown if it was. Its events were recorded where it was ticked, so
+ * none are recorded again.
+ */
+ class Merge_ extends UniffiEnum implements Merge__interface {
+ /**
+ * @private
+ * This field is private and should not be used, use `tag` instead.
+ */
+ readonly [uniffiTypeNameSymbol] = "AppChecklistAction";
+ readonly tag = AppChecklistAction_Tags.Merge;
+ readonly inner:
+Readonly<{state: AppChecklistState}>;
+ constructor(
+inner: {state: AppChecklistState }) {
+ super("AppChecklistAction", "Merge");
+
+ this.inner = Object.freeze(inner);
+ }
+ static new(
+inner: {state: AppChecklistState }): Merge_ {
+ return new Merge_(inner);
+ }
+
+ static instanceOf(obj: any): obj is Merge_ {
+ return obj.tag === AppChecklistAction_Tags.Merge;
+ }
+
+ }
+
function instanceOf(obj: any): obj is AppChecklistAction {
return obj[uniffiTypeNameSymbol] === "AppChecklistAction";
}
@@ -44335,12 +44790,13 @@ inner: {otherMachine: boolean; hasSpace: boolean; agentRan: boolean }): Observe_
Shown: Shown_,
Dismiss: Dismiss_,
Reopen: Reopen_,
- Observe: Observe_
+ Observe: Observe_,
+ Merge: Merge_
});
})();
export type AppChecklistAction = InstanceType<
- typeof AppChecklistAction['Done' | 'Shown' | 'Dismiss' | 'Reopen' | 'Observe']
+ typeof AppChecklistAction['Done' | 'Shown' | 'Dismiss' | 'Reopen' | 'Observe' | 'Merge']
>;
// FfiConverter for enum AppChecklistAction
@@ -44355,6 +44811,7 @@ const FfiConverterTypeAppChecklistAction = (() => {
case 3: return new AppChecklistAction.Dismiss();
case 4: return new AppChecklistAction.Reopen();
case 5: return new AppChecklistAction.Observe({otherMachine: FfiConverterBool.read(from), hasSpace: FfiConverterBool.read(from), agentRan: FfiConverterBool.read(from) });
+ case 6: return new AppChecklistAction.Merge({state: FfiConverterTypeAppChecklistState.read(from) });
default: throw new UniffiInternalError.UnexpectedEnumCase();
}
}
@@ -44386,6 +44843,12 @@ const FfiConverterTypeAppChecklistAction = (() => {
FfiConverterBool.write(inner.agentRan, into);
return;
}
+ case AppChecklistAction_Tags.Merge: {
+ ordinalConverter.write(6, into);
+ const inner = value.inner;
+ FfiConverterTypeAppChecklistState.write(inner.state, into);
+ return;
+ }
default:
// Throwing from here means that AppChecklistAction_Tags hasn't matched an ordinal.
throw new UniffiInternalError.UnexpectedEnumCase();
@@ -44416,6 +44879,12 @@ const FfiConverterTypeAppChecklistAction = (() => {
size += FfiConverterBool.allocationSize(inner.agentRan);
return size;
}
+ case AppChecklistAction_Tags.Merge: {
+ const inner = value.inner;
+ let size = ordinalConverter.allocationSize(6);
+ size += FfiConverterTypeAppChecklistState.allocationSize(inner.state);
+ return size;
+ }
default: throw new UniffiInternalError.UnexpectedEnumCase();
}
}
@@ -57769,6 +58238,27 @@ const FfiConverterSequenceTypeAppSensitiveGroup = new FfiConverterArray(FfiConve
// FfiConverter for bigint | undefined
const FfiConverterOptionalInt64 = new FfiConverterOptional(FfiConverterInt64);
+// FfiConverter for Array<AppMachinePageRow>
+const FfiConverterSequenceTypeAppMachinePageRow = new FfiConverterArray(FfiConverterTypeAppMachinePageRow);
+
+// FfiConverter for AppSpaceProvider | undefined
+const FfiConverterOptionalTypeAppSpaceProvider = new FfiConverterOptional(FfiConverterTypeAppSpaceProvider);
+
+// FfiConverter for AppSpaceSdkRef | undefined
+const FfiConverterOptionalTypeAppSpaceSdkRef = new FfiConverterOptional(FfiConverterTypeAppSpaceSdkRef);
+
+// FfiConverter for AppSpaceProgress | undefined
+const FfiConverterOptionalTypeAppSpaceProgress = new FfiConverterOptional(FfiConverterTypeAppSpaceProgress);
+
+// FfiConverter for AppSpaceKind | undefined
+const FfiConverterOptionalTypeAppSpaceKind = new FfiConverterOptional(FfiConverterTypeAppSpaceKind);
+
+// FfiConverter for AppSpacePower | undefined
+const FfiConverterOptionalTypeAppSpacePower = new FfiConverterOptional(FfiConverterTypeAppSpacePower);
+
+// FfiConverter for Array<AppSpace>
+const FfiConverterSequenceTypeAppSpace = new FfiConverterArray(FfiConverterTypeAppSpace);
+
// FfiConverter for Array<AppChecklistStep>
const FfiConverterSequenceTypeAppChecklistStep = new FfiConverterArray(FfiConverterTypeAppChecklistStep);
@@ -57826,9 +58316,6 @@ const FfiConverterOptionalTypeAppImageSizes = new FfiConverterOptional(FfiConver
// FfiConverter for number | undefined
const FfiConverterOptionalFloat64 = new FfiConverterOptional(FfiConverterFloat64);
-// FfiConverter for AppSpaceKind | undefined
-const FfiConverterOptionalTypeAppSpaceKind = new FfiConverterOptional(FfiConverterTypeAppSpaceKind);
-
// FfiConverter for Array<AppPendingCreate>
const FfiConverterSequenceTypeAppPendingCreate = new FfiConverterArray(FfiConverterTypeAppPendingCreate);
@@ -58015,20 +58502,11 @@ const FfiConverterSequenceTypeAppSandboxImage = new FfiConverterArray(FfiConvert
// FfiConverter for AppStorageVolume | undefined
const FfiConverterOptionalTypeAppStorageVolume = new FfiConverterOptional(FfiConverterTypeAppStorageVolume);
-// FfiConverter for AppSpaceProvider | undefined
-const FfiConverterOptionalTypeAppSpaceProvider = new FfiConverterOptional(FfiConverterTypeAppSpaceProvider);
-
-// FfiConverter for AppSpaceSdkRef | undefined
-const FfiConverterOptionalTypeAppSpaceSdkRef = new FfiConverterOptional(FfiConverterTypeAppSpaceSdkRef);
-
-// FfiConverter for AppSpaceProgress | undefined
-const FfiConverterOptionalTypeAppSpaceProgress = new FfiConverterOptional(FfiConverterTypeAppSpaceProgress);
-
-// FfiConverter for AppSpacePower | undefined
-const FfiConverterOptionalTypeAppSpacePower = new FfiConverterOptional(FfiConverterTypeAppSpacePower);
+// FfiConverter for Array<AppDeviceIn>
+const FfiConverterSequenceTypeAppDeviceIn = new FfiConverterArray(FfiConverterTypeAppDeviceIn);
-// FfiConverter for Array<AppSpace>
-const FfiConverterSequenceTypeAppSpace = new FfiConverterArray(FfiConverterTypeAppSpace);
+// FfiConverter for Map<string, boolean>
+const FfiConverterMapStringBoolean = new FfiConverterMap(FfiConverterString, FfiConverterBool);
// FfiConverter for Array<AppMenuPreviewRow>
const FfiConverterSequenceTypeAppMenuPreviewRow = new FfiConverterArray(FfiConverterTypeAppMenuPreviewRow);
@@ -58616,9 +59094,15 @@ function uniffiEnsureInitialized() {
if (nativeModule().uniffi_cua_spaces_ffi_checksum_func_app_catalog_entry() !== 56759) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_spaces_ffi_checksum_func_app_catalog_entry");
}
+ if (nativeModule().uniffi_cua_spaces_ffi_checksum_func_app_checklist_observe_from() !== 5363) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_spaces_ffi_checksum_func_app_checklist_observe_from");
+ }
if (nativeModule().uniffi_cua_spaces_ffi_checksum_func_app_checklist_reduce() !== 46431) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_spaces_ffi_checksum_func_app_checklist_reduce");
}
+ if (nativeModule().uniffi_cua_spaces_ffi_checksum_func_app_checklist_state_from_json() !== 52352) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_spaces_ffi_checksum_func_app_checklist_state_from_json");
+ }
if (nativeModule().uniffi_cua_spaces_ffi_checksum_func_app_checklist_view() !== 58453) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_spaces_ffi_checksum_func_app_checklist_view");
}
@@ -58859,6 +59343,12 @@ function uniffiEnsureInitialized() {
if (nativeModule().uniffi_cua_spaces_ffi_checksum_func_app_machine_access_notice() !== 55788) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_spaces_ffi_checksum_func_app_machine_access_notice");
}
+ if (nativeModule().uniffi_cua_spaces_ffi_checksum_func_app_machines_page_input_from_json() !== 21812) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_spaces_ffi_checksum_func_app_machines_page_input_from_json");
+ }
+ 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_main_chrome() !== 29313) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_spaces_ffi_checksum_func_app_main_chrome");
}
@@ -59559,6 +60049,7 @@ export default Object.freeze({
FfiConverterTypeAppCatalogEntry,
FfiConverterTypeAppChecklistAction,
FfiConverterTypeAppChecklistRow,
+ FfiConverterTypeAppChecklistSeen,
FfiConverterTypeAppChecklistState,
FfiConverterTypeAppChecklistStep,
FfiConverterTypeAppChecklistTransition,
@@ -59603,6 +60094,7 @@ export default Object.freeze({
FfiConverterTypeAppDeviceAction,
FfiConverterTypeAppDeviceBanner,
FfiConverterTypeAppDeviceConfirm,
+ FfiConverterTypeAppDeviceIn,
FfiConverterTypeAppDeviceInput,
FfiConverterTypeAppDeviceRow,
FfiConverterTypeAppDevicesInput,
@@ -59704,6 +60196,8 @@ export default Object.freeze({
FfiConverterTypeAppLoginItemStatus,
FfiConverterTypeAppMachineAccessNotice,
FfiConverterTypeAppMachineInput,
+ FfiConverterTypeAppMachinePageRow,
+ FfiConverterTypeAppMachinesPageInput,
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 799e171cf0..0cc5038d2c 100644
--- a/apps/cua-spaces-desktop/test/bridge-native.test.ts
+++ b/apps/cua-spaces-desktop/test/bridge-native.test.ts
@@ -168,6 +168,8 @@ describe.skipIf(!built)("the bridge on the app core", () => {
["clouds.status", {}],
["clouds.test", { target: { provider: "aws", region: "us-west-2" } }],
["clouds.connect", { target: { provider: "aws", region: "us-west-2" }, makeDefault: false }],
+ ["checklist.get", {}],
+ ["checklist.send", { action: { type: "done", step: "teleport" } }],
["session.signOut", {}],
];
const problems: string[] = [];
@@ -486,6 +488,7 @@ describe.skipIf(!built)("the bridge on the app core", () => {
"spaces.add": { url: "http://studio.local:7400", token: null, name: "studio" },
"clouds.test": { target: { provider: "aws", region: "us-west-2" } },
"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", "presence.join", "presence.publish", "presence.leave", ...VAULT_OPS, ...(HOST_OPS as OpName[])]);
diff --git a/apps/cua-spaces-desktop/test/checklist-machines.test.ts b/apps/cua-spaces-desktop/test/checklist-machines.test.ts
new file mode 100644
index 0000000000..9a7a9d7f79
--- /dev/null
+++ b/apps/cua-spaces-desktop/test/checklist-machines.test.ts
@@ -0,0 +1,123 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+// The getting-started checklist's one copy and the Machines page's rows on
+// the real app core (`pnpm native`), as the SwiftUI app's
+// ChecklistPaletteTests check them: the app ticks steps off from what it
+// shows, the page reads and changes the same copy, progress the page kept
+// before is merged once, and the Machines rows are the core's
+// (`machines::page_rows`), devices of their own included. Skipped when
+// this machine's native directory was not built.
+import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
+import { tmpdir } from "node:os";
+import * as path from "node:path";
+import { afterAll, beforeAll, beforeEach, describe, expect, it } from "vitest";
+import { createBridge, type Bridge } from "../src/bridge";
+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, fixtureDevices, fixtureHost } from "./fixtures";
+
+const dir = path.resolve(__dirname, "../native", devDirName(process.platform, process.arch));
+const built = existsSync(nativeFiles(dir, process.platform).library);
+
+describe.skipIf(!built)("the checklist and the Machines rows on the app core", () => {
+ let home: string;
+ let native: Native;
+ const saved = { ...process.env };
+ let telemetry: FixtureTelemetry;
+ let model: AppModel;
+ let bridge: Bridge;
+ let appDir: string;
+
+ beforeAll(async () => {
+ home = mkdtempSync(path.join(tmpdir(), "cua-checklist-"));
+ 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 });
+ });
+
+ const make = (seed: string | null = null) => {
+ const backend = new FixtureSpacesBackend(native);
+ telemetry = new FixtureTelemetry();
+ 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, () => fixtureDevices()),
+ cloud: new CloudModel(native, () => backend),
+ account: new FixtureAccount("[email protected]"),
+ telemetry,
+ servicesIn: () => true,
+ cpus: 8,
+ checklistPath: path.join(appDir, "checklist.json"),
+ checklistSeedPath: seed,
+ });
+ bridge = createBridge({ model, supervisor: null, version: "1.2.3", platform: "darwin", env: {}, ui: { openSpace: () => {}, setBackground: () => {}, activate: () => {} } } as never);
+ };
+
+ beforeEach(() => {
+ appDir = mkdtempSync(path.join(home, "app-"));
+ });
+
+ const call = (method: string, args: Record<string, unknown> = {}) => bridge.registry.handle(method, args, { window: "win-1" });
+
+ it("lists the core's rows: this machine and its device as one, the devices of their own", async () => {
+ make();
+ await model.refresh();
+ await model.devices.refresh();
+ const rows = model.machinePageRows;
+ expect(rows[0]).toMatchObject({ id: "this-mac", current: true, device: "dev_mac" });
+ expect(rows.filter((r) => r.deviceOnly).map((r) => r.name)).toEqual(["Work laptop"]);
+ // The page gets the same rows.
+ const answer = (await call("machines.list")) as { rows: { id: string }[] };
+ expect(answer.rows.map((r) => r.id)).toEqual(rows.map((r) => r.id));
+ });
+
+ it("ticks steps off from what the app shows, and the page changes the same copy", async () => {
+ make();
+ await model.refresh();
+ await model.devices.refresh();
+ model.changed("machines");
+ const done = () => ((call("checklist.get") as unknown as Promise<{ state: { done: string[] } }>).then((r) => r.state.done));
+ expect(await done()).toEqual(expect.arrayContaining(["add_machine", "create_space"]));
+ await call("checklist.send", { action: { type: "done", step: "teleport" } });
+ expect(await done()).toContain("teleport");
+ // Kept between launches.
+ expect(JSON.parse(readFileSync(path.join(appDir, "checklist.json"), "utf8")).done).toContain("teleport");
+ // The page never sends what the app shows.
+ await expect(call("checklist.send", { action: { type: "observe", otherMachine: true } })).rejects.toMatchObject({ code: "bad_args" });
+ // A run in a Space ticks "Run an agent".
+ model.sawAgentRuns(1);
+ expect(await done()).toContain("run_agent");
+ });
+
+ it("merges what the page kept before without its events again", async () => {
+ make();
+ const before = telemetry.recorded.length;
+ const r = (await call("checklist.send", { action: { type: "merge", state: { done: ["share", "nope"], dismissed: true, shown: true } } })) as {
+ state: { done: string[]; dismissed: boolean };
+ };
+ expect(r.state.done).toEqual(["share"]);
+ expect(r.state.dismissed).toBe(true);
+ expect(telemetry.recorded.length).toBe(before);
+ });
+
+ it("starts from the SwiftUI app's checklist when it has none of its own", () => {
+ const swift = path.join(home, "swift");
+ mkdirSync(swift, { recursive: true });
+ writeFileSync(path.join(swift, "checklist.json"), JSON.stringify({ done: ["add_machine", "teleport"], dismissed: false, shown: true }));
+ make(path.join(swift, "checklist.json"));
+ expect(model.checklist.stored).toEqual({ done: ["add_machine", "teleport"], dismissed: false, shown: true });
+ });
+});
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AgentRunsModel.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AgentRunsModel.swift
index 71f0024a12..540d8acc6c 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AgentRunsModel.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AgentRunsModel.swift
@@ -21,6 +21,8 @@ public final class AgentRunsModel {
public private(set) var load: Load = .loading
let backend: SpacesBackend
let spaceId: String
+ /// Told how many runs each read found (the checklist's "Run an agent").
+ var onRead: ((Int) -> Void)?
public init(backend: SpacesBackend, spaceId: String) {
self.backend = backend
@@ -30,7 +32,9 @@ public final class AgentRunsModel {
/// Re-reads the runs.
public func refresh() async {
do {
- load = .ready(try await backend.agentRuns(id: spaceId))
+ let runs = try await backend.agentRuns(id: spaceId)
+ load = .ready(runs)
+ onRead?(runs.count)
} catch {
load = .failed(LiveSpacesBackend.words(error))
}
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift
index f5e199f93e..3baeb7e08b 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift
@@ -214,6 +214,7 @@ public final class AppModel {
self.saveSettings()
}
self.host.onChange = { [weak self] in self?.recompose() }
+ followChecklist()
// The first run's "Where should Cua Spaces show up?" is this setting.
onboarding.onPresentation = { [weak self] menuBar in
guard let self else { return }
@@ -359,13 +360,29 @@ public final class AppModel {
// MARK: - Machines and getting started
- /// The Machines page's rows, whatever the search: This machine, then
- /// your other machines (the core's `relay:<machine>` rows; the Spaces
- /// they provide are nested under them and listed in their detail).
- public var machineRows: [AppSidebarRow] {
- let all = appSidebar(spaces: spaces, query: "", selectedId: "")
- let others = all.sections.flatMap(\.rows).filter { !$0.nested && $0.id.hasPrefix("relay:") }
- return (all.thisMachine.map { [$0] } ?? []) + others
+ /// The Machines page's rows (the core's `machines::page_rows`, which
+ /// 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] {
+ 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(
+ hostOs: .macos, spaces: spaces, devices: devices, hostnames: relayHostnames,
+ presence: self.devices.relayOnline, now: self.devices.nowSecs))
+ }
+
+ /// What each machine sharing its desktop (`relay:<machine>`) reported
+ /// as its hostname, by machine id: the page lists it and the device on
+ /// it once.
+ var relayHostnames: [String: String] {
+ var out: [String: String] = [:]
+ for space in spaces where space.id.hasPrefix("relay:") && space.host == nil {
+ if let name = backend.reportedHostname(id: space.id) { out[String(space.id.dropFirst(6))] = name }
+ }
+ return out
}
/// Your Spaces: neither This machine nor one of your machines.
@@ -373,11 +390,33 @@ public final class AppModel {
spaces.filter { !$0.id.hasPrefix("relay:") && !detail($0).isHost }
}
- /// What the checklist ticks off from what the app shows.
+ /// Agent runs seen in any Space (a Space's detail, the web UI's
+ /// Agents page): the checklist's "Run an agent".
+ public private(set) var agentRunsSeen = 0
+
+ /// A Space's agent runs were read: `count` of them.
+ public func sawAgentRuns(_ count: Int) {
+ if count > agentRunsSeen { agentRunsSeen = count }
+ }
+
+ /// Whether the persistent agents were read for the checklist.
+ private var checklistReadAgents = false
+
+ /// What the checklist ticks off from what the app shows: the core's
+ /// one reading (`checklist::observe_from`), whichever UI is open.
var checklistSeen: AppChecklistAction {
- .observe(otherMachine: machineRows.contains { $0.id.hasPrefix("relay:") },
- hasSpace: realSpaces.contains { $0.status == .running || $0.status == .suspended },
- agentRan: persistent.agentCount > 0)
+ appChecklistObserveFrom(seen: AppChecklistSeen(
+ machines: machinePageRows, spaces: spaces,
+ agents: UInt32(persistent.agentCount), runs: UInt32(agentRunsSeen)))
+ }
+
+ /// Ticks the checklist off from what the app shows now, and again each
+ /// time that changes, whichever UI is open (or none).
+ func followChecklist() {
+ let seen = withObservationTracking { checklistSeen } onChange: { [weak self] in
+ DispatchQueue.main.async { self?.followChecklist() }
+ }
+ checklist.send(seen)
}
/// "Add a machine": New Space's "Connect by address".
@@ -647,6 +686,12 @@ public final class AppModel {
recompose()
loaded = true
rosterError = nil
+ // The checklist's "Run an agent": read the persistent agents
+ // once (the Agents page reads them again when it opens).
+ if !checklistReadAgents, servicesIn, !checklist.state.done.contains(.runAgent) {
+ checklistReadAgents = true
+ Task { await persistent.loadAgents() }
+ }
if selection == nil, let first = sidebar.selectedId { selection = .space(first) }
// A preview for every running Space from the daemon's cache
// (it survives restarts), before one is opened.
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/ChecklistModel.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/ChecklistModel.swift
index 3fdd322156..68734be1d8 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/ChecklistModel.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/ChecklistModel.swift
@@ -6,8 +6,9 @@ import Foundation
import Observation
/// The getting-started checklist: the core's `appChecklistReduce` and
-/// `appChecklistView` (the React UI makes the same calls), kept in
-/// `checklist.json` beside the settings file.
+/// `appChecklistView`, kept in `checklist.json` beside the settings file.
+/// The one copy: the New UI reads and changes it through the bridge
+/// (`checklist.get`, `checklist.send`), so both UIs count the same.
@MainActor @Observable
public final class ChecklistModel {
public private(set) var state: AppChecklistState
@@ -25,11 +26,13 @@ public final class ChecklistModel {
public func send(_ action: AppChecklistAction) {
let t = appChecklistReduce(state: state, action: action)
- // Every change records an event; no event, nothing changed.
- guard !t.signals.isEmpty else { return }
- state = t.state
- save()
- telemetry?.record(t.signals)
+ // A merge changes the state without events (they were recorded
+ // where the steps were ticked).
+ if t.state != state {
+ state = t.state
+ save()
+ }
+ if !t.signals.isEmpty { telemetry?.record(t.signals) }
}
public func done(_ step: AppChecklistStep) { send(.done(step: step)) }
@@ -43,7 +46,7 @@ public final class ChecklistModel {
var shown: Bool
}
- private static let words: [(AppChecklistStep, String)] = [
+ static let words: [(AppChecklistStep, String)] = [
(.addMachine, "add_machine"), (.createSpace, "create_space"), (.teleport, "teleport"),
(.share, "share"), (.runAgent, "run_agent"),
]
@@ -51,8 +54,18 @@ public final class ChecklistModel {
private static func read(_ path: String) -> AppChecklistState? {
guard let data = FileManager.default.contents(atPath: path),
let s = try? JSONDecoder().decode(Stored.self, from: data) else { return nil }
- let done = words.filter { s.done.contains($0.1) }.map(\.0)
- return AppChecklistState(done: done, dismissed: s.dismissed, shown: s.shown)
+ return state(done: s.done, dismissed: s.dismissed, shown: s.shown)
+ }
+
+ /// The core's state from steps as words (unknown words are dropped).
+ static func state(done: [String], dismissed: Bool, shown: Bool) -> AppChecklistState {
+ AppChecklistState(done: words.filter { done.contains($0.1) }.map(\.0), dismissed: dismissed, shown: shown)
+ }
+
+ /// The state as the file and the web UI keep it (steps as words).
+ var stored: [String: Any] {
+ ["done": state.done.compactMap { step in Self.words.first { $0.0 == step }?.1 },
+ "dismissed": state.dismissed, "shown": state.shown]
}
private func save() {
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/MachinesViews.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/MachinesViews.swift
index b603a53f8c..85d4ba9676 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/MachinesViews.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/MachinesViews.swift
@@ -4,23 +4,23 @@
import CuaSpacesFFI
import SwiftUI
-/// Machines: This machine and your other machines, each with its Spaces;
-/// the selected one's page beside them (This machine's own page, or the
-/// machine's detail with the Spaces it provides and Remove). The rows are
-/// the core's sidebar rows (`AppModel.machineRows`).
+/// 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.
struct MachinesPageView: View {
@Bindable var model: AppModel
@State private var selectedId: String?
var body: some View {
- let rows = model.machineRows
+ let rows = model.machinePageRows
let selected = rows.first { $0.id == selectedId } ?? rows.first
HStack(spacing: 0) {
VStack(alignment: .leading, spacing: 0) {
List(selection: $selectedId) {
ForEach(rows, id: \.id) { row in
- MachineRowView(row: row, isThisMachine: isThisMachine(row),
- spaces: isThisMachine(row) ? nil : model.hostedRows(row.id).count)
+ MachineRowView(row: row, status: status(row), spaces: spacesCount(row))
.tag(row.id)
}
}
@@ -36,12 +36,15 @@ struct MachinesPageView: View {
.frame(width: 300)
Divider()
Group {
- if let row = selected, let space = model.spaces.first(where: { $0.id == row.id }) {
- if isThisMachine(row) {
+ if let row = selected {
+ if row.current {
ThisMachineView(host: model.host)
- } else {
+ } 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)
}
} else {
ContentUnavailableView {
@@ -67,32 +70,51 @@ struct MachinesPageView: View {
}
}
- private func isThisMachine(_ row: AppSidebarRow) -> Bool {
- model.spaces.first { $0.id == row.id }.map { model.detail($0).isHost } ?? false
+ /// The row's second line: the sidebar's status for a machine with a
+ /// desktop row, the device's platform, state and last session for a
+ /// device of its own, else whether it is online.
+ private func status(_ row: AppMachinePageRow) -> String {
+ if let id = row.spaceId,
+ let s = model.sidebar.sections.flatMap(\.rows).first(where: { $0.id == id }) ?? model.sidebar.thisMachine.flatMap({ $0.id == id ? $0 : nil }) {
+ return s.statusText
+ }
+ if row.deviceOnly, let d = model.devices.view.rows.first(where: { $0.id == row.device }) {
+ return model.devices.rowDetail(d)
+ }
+ return row.online ? "Online" : "Offline"
+ }
+
+ /// The Spaces a machine provides (none for this machine or a device).
+ private func spacesCount(_ row: AppMachinePageRow) -> Int? {
+ guard !row.current, !row.deviceOnly else { return nil }
+ return model.hostedRows(row.spaceId ?? "relay:\(row.id)").count
}
}
-/// One machine: its OS mark, name, status word and how many Spaces it runs.
+/// The OS mark for a page row'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.
struct MachineRowView: View {
- let row: AppSidebarRow
- let isThisMachine: Bool
- /// Spaces it provides (nil for This machine).
+ let row: AppMachinePageRow
+ let status: String
+ /// Spaces it provides (nil for This machine and a device).
let spaces: Int?
var body: some View {
HStack(spacing: 10) {
- OsIconImage(id: row.osIcon, size: 16)
+ 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 isThisMachine {
+ if row.current {
Text("(this machine)").foregroundStyle(.secondary)
}
}
- Text(row.statusText)
+ Text(status)
.font(.callout)
.foregroundStyle(.secondary)
.lineLimit(1)
@@ -105,8 +127,81 @@ struct MachineRowView: View {
}
}
.padding(.vertical, 3)
- .opacity(row.dim ? 0.6 : 1)
- .help(row.detail)
+ .opacity(row.online ? 1 : 0.6)
.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 {
+ @Bindable var model: AppModel
+ let row: AppMachinePageRow
+ let status: String
+ @State private var revoking: AppDeviceRow?
+
+ 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.online ? "Online" : "Offline")
+ if !row.os.isEmpty {
+ LabeledContent("System", value: device?.platform.isEmpty == false ? device!.platform : row.os)
+ }
+ if let seen = row.lastSeen {
+ LabeledContent("Last seen", value: model.devices.relativeText(seen))
+ }
+ if row.deviceOnly {
+ LabeledContent("Access", value: "Not set up for access")
+ }
+ } header: {
+ HStack(spacing: 10) {
+ OsIconImage(id: osIcon(row.os), size: 18)
+ .foregroundStyle(.secondary)
+ VStack(alignment: .leading, spacing: 2) {
+ Text(row.name).font(.title3.weight(.semibold))
+ Text(status).font(.callout).foregroundStyle(.secondary)
+ }
+ }
+ .padding(.bottom, 6)
+ }
+ if !hosted.isEmpty {
+ Section("Spaces") {
+ ForEach(hosted, id: \.id) { s in
+ LabeledContent(s.name, value: s.statusText)
+ }
+ }
+ }
+ if row.deviceOnly {
+ Section {
+ Text("To run Spaces or share its desktop, run `cua host setup` on it.")
+ .foregroundStyle(.secondary)
+ }
+ }
+ 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")
+ }
+ }
+ }
+ .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) }
+ }
+ Button(c.cancelLabel, role: .cancel) { revoking = nil }
+ }
+ } message: {
+ Text(revoking?.revokeConfirm?.message ?? "")
+ }
+ }
+}
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/MainWindow.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/MainWindow.swift
index 847f7465a5..93ea418d40 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/MainWindow.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/MainWindow.swift
@@ -75,8 +75,6 @@ public struct MainWindow: View {
await model.refresh()
await model.keyvault.refresh()
}
- // The checklist ticks off what the app already shows.
- .onChange(of: model.checklistSeen, initial: true) { _, seen in model.checklist.send(seen) }
// The relay allowance: at once (and on every sign-in or out), every
// 5 minutes, and when the app comes to the front.
.task(id: model.devices.signedIn) {
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/SpaceDetailView.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/SpaceDetailView.swift
index f0b79129bc..1e03631762 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/SpaceDetailView.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/SpaceDetailView.swift
@@ -113,6 +113,7 @@ struct SpaceDetailView: View {
.task(id: live) {
guard detail.showSections else { return }
let model = AgentRunsModel(backend: self.model.backend, spaceId: space.id)
+ model.onRead = { [weak app = self.model] in app?.sawAgentRuns($0) }
agents = model
await model.poll()
}
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swift
index a45918bd65..d08de4c100 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swift
@@ -108,6 +108,8 @@ final class WebUIBridge: NSObject, WKScriptMessageHandlerWithReply {
"startup.get", "startup.act",
// The relay allowance this month (WebUIBridge+Pages.swift).
"relay.usage",
+ // The getting-started checklist: the app's one copy (`ChecklistModel`).
+ "checklist.get", "checklist.send",
]
let model: AppModel
@@ -278,6 +280,11 @@ final class WebUIBridge: NSObject, WKScriptMessageHandlerWithReply {
case "agents.list", "agents.runs", "agents.events", "agents.pause", "agents.resume",
"agents.setup", "agents.configure":
return try await agents(method, args)
+
+ case "checklist.get": return ["state": model.checklist.stored]
+ case "checklist.send":
+ model.checklist.send(try checklistAction(args["action"]))
+ return ["state": model.checklist.stored]
case "agents.detail", "agents.readFile", "agents.restoreFile", "agents.addRoutine", "agents.setRoutine",
"agents.removeRoutine", "agents.allowComputer", "agents.revokeComputer":
return try await agentDetail(method, args)
@@ -438,17 +445,14 @@ final class WebUIBridge: NSObject, WKScriptMessageHandlerWithReply {
// connect probe can time out on a host the relay reaches.
"presence": model.devices.relayOnline,
"deviceStates": model.devices.deviceStates,
+ // The page's rows as the core lists them (`machines::page_rows`,
+ // what the native Machines page shows).
+ "rows": BridgeValue.encode(model.machinePageRows),
]
}
/// `relay:<machine>` rows' reported hostnames, by machine id.
- func relayHostnames() -> [String: String] {
- var out: [String: String] = [:]
- for space in model.spaces where space.id.hasPrefix("relay:") && space.host == nil {
- if let name = model.backend.reportedHostname(id: space.id) { out[String(space.id.dropFirst(6))] = name }
- }
- return out
- }
+ func relayHostnames() -> [String: String] { model.relayHostnames }
func settings() -> [String: Any] {
[
@@ -612,6 +616,7 @@ final class WebUIBridge: NSObject, WKScriptMessageHandlerWithReply {
return try await persistent.listAgents()
case "agents.runs":
let runs = AgentRunsModel(backend: model.backend, spaceId: try string(args, "spaceId"))
+ runs.onRead = { [weak model] in model?.sawAgentRuns($0) }
await runs.refresh()
switch runs.load {
case .ready(let rows): return BridgeValue.encode(rows)
@@ -900,6 +905,34 @@ final class WebUIBridge: NSObject, WKScriptMessageHandlerWithReply {
return CGRect(x: x, y: y, width: w, height: h)
}
+ // MARK: - The checklist
+
+ /// A page's checklist action: a step done, shown, closed, opened again,
+ /// or progress the page kept itself before (merged once). What the app
+ /// shows ticks steps off here, not in the page (`AppModel.followChecklist`).
+ func checklistAction(_ raw: Any?) throws -> AppChecklistAction {
+ guard let a = raw as? [String: Any], let type = a["type"] as? String else {
+ throw Failure.badArgs("action: {type}")
+ }
+ switch type {
+ case "done":
+ guard let word = a["step"] as? String,
+ let step = ChecklistModel.words.first(where: { $0.1 == word })?.0
+ else { throw Failure.badArgs("step: one of the checklist's steps") }
+ return .done(step: step)
+ case "shown": return .shown
+ case "dismiss": return .dismiss
+ case "reopen": return .reopen
+ case "merge":
+ guard let s = a["state"] as? [String: Any] else { throw Failure.badArgs("state: {done, dismissed, shown}") }
+ return .merge(state: ChecklistModel.state(done: s["done"] as? [String] ?? [],
+ dismissed: s["dismissed"] as? Bool ?? false,
+ shown: s["shown"] as? Bool ?? false))
+ default:
+ throw Failure.badArgs("action: done, shown, dismiss, reopen or merge")
+ }
+ }
+
// MARK: - Events
/// Tells the page when what it shows changed (it asks again).
@@ -918,6 +951,7 @@ final class WebUIBridge: NSObject, WKScriptMessageHandlerWithReply {
guard let self else { return "" }
return Self.signature([self.hostStatus(), BridgeValue.encode(self.model.devices.view)])
}
+ followChanges("checklist.changed") { [model] in Self.signature(model.checklist.stored) }
followChanges("agents.changed") { [model] in
Self.signature([model.persistent.agentsInput["agents"] ?? NSNull(),
BridgeValue.encode(model.agentRows), model.agentsPending])
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/BridgeContractTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/BridgeContractTests.swift
index fb0255d1e7..9f966424ee 100644
--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/BridgeContractTests.swift
+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/BridgeContractTests.swift
@@ -201,6 +201,7 @@ struct BridgeContractTests {
[
// The relay allowance before the sign-out below (signed out, it is null).
("app.info", [:]), ("session.get", [:]), ("relay.usage", [:]), ("session.signOut", [:]),
+ ("checklist.get", [:]), ("checklist.send", ["action": ["type": "done", "step": "teleport"]]),
("spaces.list", [:]),
("spaces.createOptions", [:]), ("spaces.cancelCreate", ["pendingId": "pending:none"]),
("spaces.setPower", ["id": space, "on": true]),
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ChecklistPaletteTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ChecklistPaletteTests.swift
index d1d0b1e75a..43764d22ca 100644
--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ChecklistPaletteTests.swift
+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ChecklistPaletteTests.swift
@@ -68,10 +68,94 @@ struct ChecklistPaletteTests {
@Test func machinesListThisMachineAndNoSpaces() async {
let m = ViewModelTests().makeModel()
await m.refresh()
- let ids = m.machineRows.map(\.id)
+ let rows = m.machinePageRows
+ #expect(rows.first?.current == true)
+ #expect(rows.first?.id == "this-mac")
+ let ids = rows.map(\.id)
#expect(!ids.contains("local:aurora"))
#expect(!ids.contains("direct:10.0.0.5:3211"))
- #expect(ids.allSatisfy { id in id.hasPrefix("relay:") || m.spaces.first { $0.id == id }.map { m.detail($0).isHost } == true })
+ #expect(Set(ids).count == ids.count, "each computer once")
+ }
+
+ /// A model signed in, with the fixture account's devices read.
+ private func signedInModel() async -> AppModel {
+ let dir = FileManager.default.temporaryDirectory.appendingPathComponent("cua-machines-\(UUID().uuidString)")
+ let m = AppModel(backend: FixtureSpacesBackend(), keyvault: KeyvaultModel(client: nil),
+ onboarding: OnboardingModel(statePath: dir.appendingPathComponent("onboarding.json").path),
+ settingsPath: dir.appendingPathComponent("settings.json").path,
+ telemetry: FixtureTelemetry(), devices: FixtureDevices())
+ await m.refresh()
+ m.devices.signedIn = true
+ await m.devices.refresh()
+ return m
+ }
+
+ /// CUA-1510: the classic Machines page lists the devices that are only
+ /// in the device list too (the New UI's rows: the core's page rows).
+ @Test func machinesListDevicesThatAreOnlyInTheDeviceList() async {
+ let m = await signedInModel()
+ let rows = m.machinePageRows
+ #expect(rows.first?.current == true)
+ #expect(rows.first?.device == "dev_mac", "this Mac and its device are one row")
+ let own = rows.filter(\.deviceOnly).map(\.name)
+ #expect(own.contains("Work laptop"))
+ #expect(own.contains("Old laptop"))
+ #expect(rows.filter(\.deviceOnly).allSatisfy { $0.spaceId == nil && !$0.current })
+ // The New UI gets the same rows from the bridge.
+ let bridge = WebUIBridge(model: m, allowedOrigins: [])
+ let answer = bridge.machines()["rows"] as? [[String: Any]]
+ #expect(answer?.map { $0["id"] as? String } == rows.map(\.id))
+ // And a device of your own is another machine for the checklist.
+ if case let .observe(otherMachine, _, _) = m.checklistSeen {
+ #expect(otherMachine)
+ } else {
+ Issue.record("not an observation")
+ }
+ }
+
+ /// CUA-1509: the app ticks the checklist off itself, whichever UI is
+ /// open, and the New UI reads and changes the same copy.
+ @Test func bothUIsShareOneChecklist() async throws {
+ let m = await signedInModel()
+ // No view asked: the model followed what it shows.
+ for _ in 0..<20 where !m.checklist.state.done.contains(.addMachine) {
+ try await Task.sleep(for: .milliseconds(10))
+ }
+ #expect(m.checklist.state.done.contains(.addMachine))
+ #expect(m.checklist.state.done.contains(.createSpace))
+ let bridge = WebUIBridge(model: m, allowedOrigins: [])
+ let got = try await bridge.handle("checklist.get", [:]) as? [String: Any]
+ let words = ((got?["state"] as? [String: Any])?["done"] as? [String]) ?? []
+ #expect(words.contains("add_machine") && words.contains("create_space"))
+ #expect(m.checklist.view.progress == "\(words.count) of 5")
+ // The New UI ticks a step: the classic UI's copy has it.
+ _ = try await bridge.handle("checklist.send", ["action": ["type": "done", "step": "teleport"]])
+ #expect(m.checklist.state.done.contains(.teleport))
+ #expect(m.checklist.view.progress == "\(words.count + 1) of 5")
+ // What the page kept itself before is merged once, without events.
+ let telemetry = FixtureTelemetry()
+ m.checklist.telemetry = telemetry
+ let merged = try await bridge.handle("checklist.send", ["action": [
+ "type": "merge", "state": ["done": ["share", "nope"], "dismissed": false, "shown": true],
+ ]]) as? [String: Any]
+ let after = ((merged?["state"] as? [String: Any])?["done"] as? [String]) ?? []
+ #expect(after.contains("share") && !after.contains("nope"))
+ #expect(m.checklist.state.shown)
+ #expect(telemetry.recorded.isEmpty)
+ // The page never sends what the app shows.
+ await #expect(throws: WebUIBridge.Failure.self) {
+ _ = try await bridge.handle("checklist.send", ["action": ["type": "observe", "otherMachine": true]])
+ }
+ }
+
+ /// A Space's agent runs, read anywhere, tick "Run an agent".
+ @Test func agentRunsSeenTickRunAnAgent() async throws {
+ let m = await signedInModel()
+ m.sawAgentRuns(1)
+ for _ in 0..<20 where !m.checklist.state.done.contains(.runAgent) {
+ try await Task.sleep(for: .milliseconds(10))
+ }
+ #expect(m.checklist.state.done.contains(.runAgent))
}
@Test func checklistButtonsGoWhereTheStepIsDone() async {
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swift
index c708e7bdef..7d5e4bc480 100644
--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swift
+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swift
@@ -52,6 +52,7 @@ struct ParityTests {
@Test("telemetry-funnel") func telemetryFunnel() throws { try check("telemetry-funnel", runTelemetry) }
@Test("experiments") func experiments() throws { try check("experiments", runExperiments) }
@Test("placement-picker") func placementPicker() throws { try check("placement-picker", runPlacementPicker) }
+ @Test("checklist") func checklist() throws { try check("checklist", runChecklist) }
/// The app's own first run records exactly the golden's events: the
/// `OnboardingModel` the window drives, on a recording telemetry.
@@ -1251,6 +1252,40 @@ struct ParityTests {
}
/// The notch and the menu count the same Spaces (`run_menu_count`).
+ /// The checklist: the Machines page from each case's input
+ /// (`appMachinesPageRows`), the core's reading of it, its Spaces and
+ /// agents (`appChecklistObserveFrom`), the count after it, and after
+ /// merging progress kept elsewhere before.
+ func runChecklist(_ f: [String: Any]) throws -> [Any] {
+ var frames: [Any] = []
+ for c in f["cases"] as! [[String: Any]] {
+ let page = try appMachinesPageInputFromJson(json: text(c["page"]))
+ let rows = appMachinesPageRows(input: page)
+ let action = appChecklistObserveFrom(seen: AppChecklistSeen(
+ machines: rows, spaces: page.spaces,
+ agents: UInt32(c["agents"] as! Int), runs: UInt32(c["runs"] as! Int)))
+ guard case let .observe(otherMachine, hasSpace, agentRan) = action else {
+ Issue.record("not an observation")
+ return frames
+ }
+ let t = appChecklistReduce(state: try appChecklistStateFromJson(json: text(c["state"])), action: action)
+ var frame: [String: Any] = [
+ "case": c["name"] as! String,
+ "observe": ["otherMachine": otherMachine, "hasSpace": hasSpace, "agentRan": agentRan],
+ "progress": appChecklistView(state: t.state).progress,
+ "events": t.signals.compactMap { if case let .step(step, _) = $0 { return step } else { return nil } },
+ ]
+ if let earlier = c["earlier"], !(earlier is NSNull) {
+ let merged = appChecklistReduce(state: t.state,
+ action: .merge(state: try appChecklistStateFromJson(json: text(earlier))))
+ let view = appChecklistView(state: merged.state)
+ frame["merged"] = ["progress": view.progress, "visible": view.visible, "events": merged.signals.count]
+ }
+ frames.append(frame)
+ }
+ return frames
+ }
+
func runMenuCount(_ f: [String: Any]) throws -> [Any] {
let now = Int64(f["now"] as! Int)
var frames: [Any] = []
diff --git a/apps/cua-spaces-web/e2e/flows.ts b/apps/cua-spaces-web/e2e/flows.ts
index 6dc3f8e1df..94db90d164 100644
--- a/apps/cua-spaces-web/e2e/flows.ts
+++ b/apps/cua-spaces-web/e2e/flows.ts
@@ -77,4 +77,8 @@ export const FLOW_PLAN: Record<string, FlowPlan> = {
experiments: { status: "run", screen: "settings/experiments" },
"placement-picker": { status: "run", screen: "new-space" },
machines: { status: "run", screen: "machines" },
+ checklist: {
+ status: "skip",
+ reason: "The host app keeps the checklist and reads what it shows (checklist.observeFrom); the page only draws checklist.view of the host's copy (bridge/__tests__/checklist.test.ts)",
+ },
};
diff --git a/apps/cua-spaces-web/src/bridge/__tests__/checklist.test.ts b/apps/cua-spaces-web/src/bridge/__tests__/checklist.test.ts
index c8d3d44a38..483b5324c2 100644
--- a/apps/cua-spaces-web/src/bridge/__tests__/checklist.test.ts
+++ b/apps/cua-spaces-web/src/bridge/__tests__/checklist.test.ts
@@ -4,6 +4,8 @@
import { beforeEach, describe, expect, it } from "vitest";
import { CHECKLIST_STEPS, checklistDone, checklistView, readChecklist, resetChecklistCache } from "../checklist";
+import type { DataAdapter } from "../adapter";
+import type { HostEvent } from "../protocol";
import type { BridgeStore } from "../store";
import { sanitizeSignals, type TelemetrySignal } from "../ops/telemetry";
import { noCore, testCore, wasmBuilt } from "./testCore";
@@ -80,3 +82,70 @@ describe("the getting-started checklist", () => {
expect(checklistView(noCore, readChecklist())).toBeNull();
});
});
+
+/** A native host that keeps the checklist: answers `checklist.get` and
+ * `checklist.send` from its own copy and says `checklist.changed`. */
+function hostAdapter(initial: { done: string[]; dismissed: boolean; shown: boolean }) {
+ let state = { ...initial, done: [...initial.done] };
+ const sent: unknown[] = [];
+ const listeners = new Set<(e: HostEvent) => void>();
+ const order = CHECKLIST_STEPS as readonly string[];
+ const adapter = {
+ mode: "webkit",
+ async call(op: string, args: { action?: { type: string; step?: string; state?: typeof state } }) {
+ if (op === "checklist.get") return { state };
+ if (op !== "checklist.send") throw new Error(`unexpected ${op}`);
+ const a = args.action!;
+ sent.push(a);
+ if (a.type === "done") state = { ...state, done: order.filter((s) => s === a.step || state.done.includes(s)) };
+ if (a.type === "merge") {
+ const o = a.state!;
+ state = { done: order.filter((s) => state.done.includes(s) || o.done.includes(s)), dismissed: state.dismissed || o.dismissed, shown: state.shown || o.shown };
+ }
+ return { state };
+ },
+ subscribe(l: (e: HostEvent) => void) {
+ listeners.add(l);
+ return () => listeners.delete(l);
+ },
+ } as unknown as DataAdapter;
+ return {
+ adapter,
+ sent,
+ change(next: typeof state) {
+ state = next;
+ for (const l of listeners) l({ type: "checklist.changed" });
+ },
+ };
+}
+
+const settle = () => new Promise((r) => setTimeout(r, 0));
+
+describe("the host's copy (the Mac app and Electron)", () => {
+ it("merges what this page kept before into the host's copy once, then forgets it", async () => {
+ localStorage.setItem(KEY, JSON.stringify({ done: { teleport: true, add_machine: true }, dismissed: false, shown: true }));
+ const host = hostAdapter({ done: ["add_machine", "create_space"], dismissed: false, shown: false });
+ const { store, sent } = await fakeStore(noCore);
+ (store as { adapter: DataAdapter }).adapter = host.adapter;
+ // A step done goes to the host, which records its events.
+ checklistDone(store, "share");
+ await settle();
+ await settle();
+ expect(host.sent).toHaveLength(2);
+ expect(host.sent).toContainEqual({ type: "merge", state: { done: ["add_machine", "teleport"], dismissed: false, shown: true } });
+ expect(host.sent).toContainEqual({ type: "done", step: "share" });
+ expect(localStorage.getItem(KEY)).toBeNull();
+ expect(sent).toEqual([]);
+ });
+
+ it("reads the host's copy again when it changed", async () => {
+ const host = hostAdapter({ done: [], dismissed: false, shown: false });
+ const { store } = await fakeStore(noCore);
+ (store as { adapter: DataAdapter }).adapter = host.adapter;
+ checklistDone(store, "teleport");
+ await settle();
+ host.change({ done: ["add_machine", "teleport"], dismissed: true, shown: true });
+ await settle();
+ expect(host.sent).toEqual([{ type: "done", step: "teleport" }]);
+ });
+});
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 002555e275..650de99f4f 100644
--- a/apps/cua-spaces-web/src/bridge/__tests__/contract-args.ts
+++ b/apps/cua-spaces-web/src/bridge/__tests__/contract-args.ts
@@ -95,6 +95,8 @@ export const DEMO_ARGS: { [K in OpName]: OpArgs<K> } = {
"agents.setupDriver": { agents: ["codex"] },
"spaces.openStream": { spaceId: SPACE, tier: "tile" },
"relay.usage": {},
+ "checklist.get": {},
+ "checklist.send": { action: { type: "done", step: "teleport" } },
"presence.join": { spaceId: SPACE },
"presence.publish": { handle: "p1", x: 0.5, y: 0.5, visible: true },
"presence.leave": { handle: "p1" },
@@ -141,4 +143,6 @@ export const DEMO_REFUSES: Partial<Record<OpName, string>> = {
"presence.join": "the demo host has no video to draw cursors over",
"presence.publish": "the demo host has no video to draw cursors over",
"presence.leave": "the demo host has no video to draw cursors over",
+ "checklist.get": "the demo host keeps no checklist; the page keeps its own",
+ "checklist.send": "the demo host keeps no checklist; the page keeps its own",
};
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 98b83f54b5..592b9fe45a 100644
--- a/apps/cua-spaces-web/src/bridge/__tests__/coverage.test.ts
+++ b/apps/cua-spaces-web/src/bridge/__tests__/coverage.test.ts
@@ -15,6 +15,7 @@ import { KEYVAULT_MANAGE_ARGS } from "../ops/keyvault-manage";
import { KEYVAULT_SETUP_ARGS } from "../ops/keyvault-setup";
import { STREAM_ARGS } from "../ops/stream";
import { RELAY_USAGE_ARGS } from "../ops/relay-usage";
+import { CHECKLIST_ARGS } from "../ops/checklist";
import { PRESENCE_ARGS } from "../ops/presence";
import type { HostWindow } from "../detect";
import { ELECTRON_BRIDGE_CHANNEL } from "../electron-channels";
@@ -120,6 +121,7 @@ const ARGS: { [K in OpName]: OpArgs<K> } = {
"startup.act": { action: "allowAccess" },
...STREAM_ARGS,
...RELAY_USAGE_ARGS,
+ ...CHECKLIST_ARGS,
...PRESENCE_ARGS,
};
diff --git a/apps/cua-spaces-web/src/bridge/__tests__/detail.test.ts b/apps/cua-spaces-web/src/bridge/__tests__/detail.test.ts
index 4bd5b5b4d1..4cd27f12d0 100644
--- a/apps/cua-spaces-web/src/bridge/__tests__/detail.test.ts
+++ b/apps/cua-spaces-web/src/bridge/__tests__/detail.test.ts
@@ -209,3 +209,33 @@ describe.skipIf(!wasmBuilt)("a Space's Agents rows (wasm core)", () => {
expect(row!.line).toMatch(/^Claude Code · /);
});
});
+
+describe("the Machines page's rows from the host (machines.pageRows)", () => {
+ it("lists the host's core rows as they are: devices of their own, a machine that stopped sharing", () => {
+ const rows = toMachineRows(
+ { spaces: [{ space: { id: "relay:b695", detail: "Not reachable" } }] } as never,
+ {
+ devices: { rows: [{ id: "dev_l1", name: "Laptop", platform: "macOS", current: false, detail: "macOS · Enrolled" }] },
+ signedIn: true,
+ thisMachine: { status: "local", statusText: "Sharing", detail: "Sharing · Relay" },
+ deviceStates: { dev_l1: "enrolled" },
+ rows: [
+ { id: "this-mac", name: "This Mac", online: true, os: "macos", via: "local", current: true, device: "dev_me", deviceOnly: false, spaceId: "this-mac", stoppedSharing: false, lastSeen: 1799999990 },
+ { id: "b695", name: "studio-2.local", online: true, os: "macos", via: "relay", current: false, device: "dev_s", deviceOnly: false, spaceId: "relay:b695", stoppedSharing: true, lastSeen: null },
+ { id: "dev_l1", name: "Laptop", online: false, os: "macos", via: "relay", current: false, device: "dev_l1", deviceOnly: true, spaceId: null, stoppedSharing: false, lastSeen: 1797000000 },
+ ],
+ },
+ );
+ expect(rows.map((r) => [r.id, r.name, r.online, Boolean(r.device), r.detail])).toEqual([
+ ["this-mac", "This Mac", true, false, "Sharing · Relay"],
+ ["b695", "studio-2.local", true, false, "Not reachable"],
+ ["dev_l1", "Laptop", false, true, "macOS · Enrolled"],
+ ]);
+ expect(rows[1]!.limits).not.toEqual([]);
+ expect(rows[2]!.deviceState).toBe("enrolled");
+ // Already each computer once: the store lists them as they are.
+ const machines = toMachines(rows, []);
+ expect(machines.map((m) => m.id)).toEqual(["this-mac", "b695", "dev_l1"]);
+ expect(machines[2]!.device).toBe(true);
+ });
+});
diff --git a/apps/cua-spaces-web/src/bridge/adapters/demo.ts b/apps/cua-spaces-web/src/bridge/adapters/demo.ts
index a7141de9b3..0fa95a9b41 100644
--- a/apps/cua-spaces-web/src/bridge/adapters/demo.ts
+++ b/apps/cua-spaces-web/src/bridge/adapters/demo.ts
@@ -40,6 +40,7 @@ import { demoKeyvaultManageHandlers, demoKeyvaultManageState, withDemoCopies, ty
import { demoKeyvaultSetupHandlers, demoKeyvaultSetupState, demoNoVaultOverview, type DemoKeyvaultSetupState } from "./demo/keyvault-setup";
import { unsupportedStreamOps } from "../ops/stream";
import { unsupportedPresenceOps } from "../ops/presence";
+import { unsupportedChecklistOps } from "../ops/checklist";
import { demoTeleportHandlers } from "./demo/teleport";
import { createDemoSettings } from "./demo/settings";
import { demoAgentSetup, demoPersistentAgents, demoRunRecords, runAt, writtenEvents, type DemoRunRecord } from "./demo-agents";
@@ -475,6 +476,7 @@ export function createDemoAdapter(options: DemoOptions = {}): DataAdapter & { re
...demoKeyvaultManageHandlers(ctx, overview),
...demoStartupHandlers(ctx),
...unsupportedStreamOps("demo"),
+ ...unsupportedChecklistOps("demo"),
...unsupportedPresenceOps("demo"),
};
diff --git a/apps/cua-spaces-web/src/bridge/adapters/tauri.ts b/apps/cua-spaces-web/src/bridge/adapters/tauri.ts
index a733574955..4979b67320 100644
--- a/apps/cua-spaces-web/src/bridge/adapters/tauri.ts
+++ b/apps/cua-spaces-web/src/bridge/adapters/tauri.ts
@@ -57,6 +57,7 @@ import { tauriHostSetupOps } from "../ops/host-setup";
import { TAURI_SPACE_DETAIL_UNSUPPORTED, tauriSpaceDetailOps } from "../ops/space-detail";
import { STREAM_OPERATIONS } from "../ops/stream";
import { RELAY_USAGE_OPERATIONS } from "../ops/relay-usage";
+import { CHECKLIST_OPERATIONS } from "../ops/checklist";
import { PRESENCE_OPERATIONS } from "../ops/presence";
import { tauriTelemetryOps } from "../ops/telemetry";
import { tauriStartupOps } from "../ops/startup";
@@ -89,6 +90,7 @@ export const TAURI_UNSUPPORTED: readonly OpName[] = [
...TAURI_SPACE_DETAIL_UNSUPPORTED,
...STREAM_OPERATIONS,
...RELAY_USAGE_OPERATIONS,
+ ...CHECKLIST_OPERATIONS,
...PRESENCE_OPERATIONS,
];
diff --git a/apps/cua-spaces-web/src/bridge/adapters/webkit.ts b/apps/cua-spaces-web/src/bridge/adapters/webkit.ts
index 2f8ddc635b..8fa120794a 100644
--- a/apps/cua-spaces-web/src/bridge/adapters/webkit.ts
+++ b/apps/cua-spaces-web/src/bridge/adapters/webkit.ts
@@ -32,7 +32,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, MachineRow, SpacePowerReport } from "../contracts/host";
+import type { CancelOutcome, DefaultLocation, HostStatus, MachinePageRow, MachineRow, SpacePowerReport } from "../contracts/host";
import type { HostWindow } from "../detect";
import {
DEFAULT_SETTINGS,
@@ -59,6 +59,7 @@ import { webkitSettingsOps } from "../ops/settings";
import { startupFromHost, webkitStartupOps } from "../ops/startup";
import { unsupportedStreamOps, type StreamTicket } from "../ops/stream";
import type { RelayUsage } from "../ops/relay-usage";
+import type { HostChecklistState } from "../ops/checklist";
import { unsupportedPresenceOps, type PresenceJoinInfo } from "../ops/presence";
import type { SpaceRow } from "../contracts/spaces";
import {
@@ -134,6 +135,7 @@ export function spaceToRow(s: WkSpace): SpaceRow {
* the store lists a machine and the device on it once
* (`mergeMachineRows`). */
export function toMachineRows(spaces: WkSpaces, machines: WkMachines | null, os: HostOs = "macos"): MachineRow[] {
+ if (machines?.rows?.length) return fromPageRows(spaces, machines, machines.rows);
const self: MachineRow = { id: "this-mac", name: THIS_MACHINE[os], via: "local", online: true, os, current: true, limits: [] };
if (machines?.thisMachine?.detail) self.detail = machines.thisMachine.detail;
if (machines?.host) self.host = toHostStatus(machines.host);
@@ -187,6 +189,42 @@ export function toMachineRows(spaces: WkSpaces, machines: WkMachines | null, os:
return rows;
}
+/** 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
+ * a machine that stopped sharing is not reachable. */
+function fromPageRows(spaces: WkSpaces, machines: WkMachines, rows: MachinePageRow[]): MachineRow[] {
+ const devices = new Map((machines.devices?.rows ?? []).map((d) => [d.id, d] as const));
+ const spaceById = new Map(spaces.spaces.map(({ space }) => [space.id, space] as const));
+ return rows.map((r): MachineRow => {
+ const dev = r.device ? devices.get(r.device) : undefined;
+ const own = r.spaceId ? spaceById.get(r.spaceId) : undefined;
+ const row: MachineRow = {
+ id: r.id,
+ name: r.name,
+ via: r.via,
+ online: r.online,
+ os: r.os,
+ limits: r.stoppedSharing ? withNotSharing([], stoppedSharingLine(r.name)) : [],
+ merged: true,
+ };
+ const detail = r.current ? machines.thisMachine?.detail : r.deviceOnly ? dev?.detail : own?.detail || dev?.detail;
+ if (detail) row.detail = detail;
+ if (r.lastSeen != null) row.lastSeen = r.lastSeen;
+ if (r.current) {
+ row.current = true;
+ if (machines.host) row.host = toHostStatus(machines.host);
+ if (machines.accessNotice) row.accessNotice = machines.accessNotice;
+ }
+ if (r.deviceOnly) {
+ row.device = true;
+ const state = machines.deviceStates?.[r.id];
+ if (state) row.deviceState = state;
+ }
+ return row;
+ });
+}
+
const rowsById = (s: WkSettings) => new Map(s.page.sections.flatMap((sec) => sec.rows).map((r) => [r.id, r] as const));
const active = (r: WkSettingsRow | undefined) => r?.options.find((o) => o.active)?.id;
const lockedBy = (r: WkSettingsRow | undefined) => (r && !r.enabled && r.help?.startsWith("Set by ") ? r.help.slice(7) : undefined);
@@ -366,6 +404,7 @@ const EVENTS: Record<string, HostEvent[]> = {
"spaces.changed": [{ type: "spaces.changed" }, { type: "machines.changed" }],
"machines.changed": [{ type: "machines.changed" }],
"agents.changed": [{ type: "agents.changed" }],
+ "checklist.changed": [{ type: "checklist.changed" }],
"keyvault.changed": [{ type: "keyvault.changed" }],
"settings.changed": [{ type: "settings.changed" }],
"session.changed": [{ type: "session.changed" }],
@@ -589,6 +628,8 @@ export function createWebkitAdapter(
? { "spaces.openStream": (target: OpArgs<"spaces.openStream">) => request<StreamTicket>("spaces.openStream", { ...target }) }
: unsupportedStreamOps("webkit")),
"relay.usage": () => request<RelayUsage | null>("relay.usage"),
+ "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.
...(electron
? {
diff --git a/apps/cua-spaces-web/src/bridge/checklist.ts b/apps/cua-spaces-web/src/bridge/checklist.ts
index 73337e879b..bb3d4d9808 100644
--- a/apps/cua-spaces-web/src/bridge/checklist.ts
+++ b/apps/cua-spaces-web/src/bridge/checklist.ts
@@ -3,21 +3,30 @@
/**
* The getting-started checklist: the first things worth doing in Cua
- * Spaces, ticked off as they happen and kept between launches (this
- * page's storage, like the first run's progress).
+ * Spaces, ticked off as they happen and kept between launches.
*
- * What each event does to it, its words and its usage events are the
- * core's (`checklist.reduce`, `checklist.view`), the same calls the SwiftUI
- * app makes. Usage events: `cua_onboarding_step` with step
- * `checklist_shown`, `checklist_<step>` (once per step),
- * `checklist_completed`, `checklist_dismissed` or `checklist_reopened`.
- * Without the core the checklist is not shown and nothing changes.
+ * In the Mac app and the Electron app the host keeps the one copy
+ * (`ops/checklist.ts`: `checklist.get`, `checklist.send`), runs the core's
+ * reducer, records the usage events and ticks steps off from what it
+ * shows (`checklist::observe_from`), so the classic Mac UI, the New UI and
+ * Electron count the same. Progress this page kept itself before (its
+ * storage) is merged into the host's copy once, then forgotten here.
+ *
+ * Elsewhere (the demo, Tauri, an older host) the page keeps its own copy
+ * in its storage. What each event does to it, its words and its usage
+ * events are the core's (`checklist.reduce`, `checklist.view`). Usage
+ * events: `cua_onboarding_step` with step `checklist_shown`,
+ * `checklist_<step>` (once per step), `checklist_completed`,
+ * `checklist_dismissed` or `checklist_reopened`. Without the core the
+ * checklist is not shown and nothing changes.
*/
import { useContext, useEffect, useSyncExternalStore } from "react";
+import { isNativeHost, type DataAdapter } from "./adapter";
import { BridgeContext } from "./BridgeProvider";
import type { CoreClient } from "./core";
+import type { HostChecklistAction, HostChecklistState } from "./ops/checklist";
import type { TelemetrySignal } from "./ops/telemetry";
import type { BridgeStore } from "./store";
@@ -78,10 +87,10 @@ const toCore = (s: ChecklistState): CoreChecklistState => ({
shown: s.shown,
});
-function fromCore(c: CoreChecklistState): ChecklistState {
+function fromCore(c: CoreChecklistState | HostChecklistState): ChecklistState {
const done: ChecklistState["done"] = {};
- for (const step of c.done) done[step] = true;
- return { done, dismissed: c.dismissed, shown: c.shown };
+ for (const step of c.done) if ((CHECKLIST_STEPS as readonly string[]).includes(step)) done[step as ChecklistStep] = true;
+ return { done, dismissed: c.dismissed === true, shown: c.shown === true };
}
const STORAGE_KEY = "cua-spaces:checklist";
@@ -147,6 +156,93 @@ export function subscribeChecklist(listener: () => void): () => void {
};
}
+/* ---- The host's copy ------------------------------------------------------ */
+
+/** The host's copy of the checklist (Mac app, Electron). `state` is
+ * undefined until the host answered; `failed`: it never did (an older
+ * host), and the page keeps its own copy. */
+class HostChecklist {
+ state: ChecklistState | undefined;
+ failed = false;
+ private started = false;
+ private unsubscribe?: () => void;
+
+ constructor(readonly adapter: DataAdapter) {}
+
+ start(): void {
+ if (this.started) return;
+ this.started = true;
+ this.unsubscribe = this.adapter.subscribe((e) => {
+ if (e.type === "checklist.changed") void this.load(false);
+ });
+ void this.load(true);
+ }
+
+ stop(): void {
+ this.unsubscribe?.();
+ }
+
+ private set(next: HostChecklistState): void {
+ this.state = fromCore(next);
+ for (const l of [...listeners]) l();
+ }
+
+ private async load(first: boolean): Promise<void> {
+ try {
+ this.set((await this.adapter.call("checklist.get", {})).state);
+ } catch {
+ if (this.state === undefined) {
+ this.failed = true;
+ for (const l of [...listeners]) l();
+ }
+ return;
+ }
+ if (first) await this.migrate();
+ }
+
+ /** Progress this page kept itself (its storage), merged into the
+ * host's copy once and then forgotten here. */
+ private async migrate(): Promise<void> {
+ let kept: ChecklistState;
+ try {
+ kept = parse(storage()?.getItem(STORAGE_KEY));
+ } catch {
+ return;
+ }
+ if (!kept.dismissed && !kept.shown && Object.keys(kept.done).length === 0) return;
+ try {
+ await this.send({ type: "merge", state: toCore(kept) });
+ storage()?.removeItem(STORAGE_KEY);
+ saved = undefined;
+ } catch {
+ // Kept for the next launch.
+ }
+ }
+
+ async send(action: HostChecklistAction): Promise<void> {
+ this.set((await this.adapter.call("checklist.send", { action })).state);
+ }
+}
+
+let host: HostChecklist | undefined;
+
+/** The host's copy when the host keeps one; undefined: the page keeps its own. */
+function hostChecklist(adapter: DataAdapter | null | undefined): HostChecklist | undefined {
+ if (!adapter || !isNativeHost(adapter.mode)) return undefined;
+ if (host?.adapter !== adapter) {
+ host?.stop();
+ host = new HostChecklist(adapter);
+ }
+ return host.failed ? undefined : host;
+}
+
+/** What the host takes: everything but `observe` (it observes itself). */
+function forHost(action: ChecklistAction): HostChecklistAction | null {
+ return action.type === "observe" ? null : action;
+}
+
+const LOADING: ChecklistState = { done: {}, dismissed: true, shown: true };
+
/** The checklist as drawn, or null without the core. */
export function checklistView(core: CoreClient, state: ChecklistState): ChecklistView | null {
return core.tryCall<ChecklistView>("checklist.view", { state: toCore(state) }) ?? null;
@@ -170,6 +266,12 @@ const pending: TelemetrySignal[] = [];
/** Ticks off `step` (once): records it, and `completed` with the last one. */
export function checklistDone(store: BridgeStore | null, step: ChecklistStep): void {
if (!store) return;
+ const h = hostChecklist(store.adapter);
+ if (h) {
+ h.start();
+ void h.send({ type: "done", step }).catch(() => {});
+ return;
+ }
const signals = apply(store.core, { type: "done", step });
if (signals.length) void store.telemetry.track(signals);
}
@@ -189,14 +291,23 @@ export interface ChecklistHook {
export function useChecklist(): ChecklistHook {
const ctx = useContext(BridgeContext);
if (!ctx) throw new Error("useChecklist needs a <BridgeProvider> above it");
- const state = useSyncExternalStore(subscribeChecklist, readChecklist, readChecklist);
const { core, store } = ctx;
+ const h = hostChecklist(ctx.adapter ?? store?.adapter);
+ useEffect(() => h?.start(), [h]);
+ const read = () => (h ? (h.failed ? readChecklist() : (h.state ?? LOADING)) : readChecklist());
+ const state = useSyncExternalStore(subscribeChecklist, read, read);
+ const loading = Boolean(h && !h.failed && h.state === undefined);
// Events from before the store exists wait for it (the first `ready`
// promise can be replaced before it resolves).
useEffect(() => {
if (store && pending.length) void store.telemetry.track(pending.splice(0));
}, [store]);
const send = (action: ChecklistAction) => {
+ if (h && !h.failed) {
+ const a = forHost(action);
+ if (a) void h.send(a).catch(() => {});
+ return;
+ }
const signals = apply(core, action);
if (!signals.length) return;
if (store) void store.telemetry.track(signals);
@@ -204,7 +315,8 @@ export function useChecklist(): ChecklistHook {
};
return {
state,
- view: checklistView(core, state),
+ // Hidden until the host answered (no flash of an empty checklist).
+ view: loading ? null : checklistView(core, state),
send,
done: (step) => send({ type: "done", step }),
shown: () => send({ type: "shown" }),
@@ -217,4 +329,6 @@ export function useChecklist(): ChecklistHook {
export function resetChecklistCache(): void {
saved = undefined;
pending.length = 0;
+ host?.stop();
+ host = undefined;
}
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 e1dafa5948..116b0e01e9 100644
--- a/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json
+++ b/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json
@@ -1470,6 +1470,66 @@
"actionLabel"
]
},
+ "MachinePageRow": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ },
+ "name": {
+ "type": "string"
+ },
+ "online": {
+ "type": "boolean"
+ },
+ "os": {
+ "type": "string"
+ },
+ "via": {
+ "type": "string"
+ },
+ "current": {
+ "type": "boolean"
+ },
+ "device": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "deviceOnly": {
+ "type": "boolean"
+ },
+ "spaceId": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "stoppedSharing": {
+ "type": "boolean"
+ },
+ "lastSeen": {
+ "type": [
+ "number",
+ "null"
+ ]
+ }
+ },
+ "required": [
+ "id",
+ "name",
+ "online",
+ "os",
+ "via",
+ "current",
+ "device",
+ "deviceOnly",
+ "spaceId",
+ "stoppedSharing",
+ "lastSeen"
+ ]
+ },
"MachineRow": {
"type": "object",
"properties": {
@@ -1566,6 +1626,9 @@
"type": "null"
}
]
+ },
+ "merged": {
+ "type": "boolean"
}
},
"required": [
@@ -3390,6 +3453,12 @@
"type": "null"
}
]
+ },
+ "rows": {
+ "type": "array",
+ "items": {
+ "$ref": "#/$defs/MachinePageRow"
+ }
}
},
"required": [
@@ -4083,6 +4152,66 @@
]
}
},
+ "checklist.get": {
+ "type": "object",
+ "properties": {
+ "state": {
+ "type": "object",
+ "properties": {
+ "done": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "dismissed": {
+ "type": "boolean"
+ },
+ "shown": {
+ "type": "boolean"
+ }
+ },
+ "required": [
+ "done",
+ "dismissed",
+ "shown"
+ ]
+ }
+ },
+ "required": [
+ "state"
+ ]
+ },
+ "checklist.send": {
+ "type": "object",
+ "properties": {
+ "state": {
+ "type": "object",
+ "properties": {
+ "done": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "dismissed": {
+ "type": "boolean"
+ },
+ "shown": {
+ "type": "boolean"
+ }
+ },
+ "required": [
+ "done",
+ "dismissed",
+ "shown"
+ ]
+ }
+ },
+ "required": [
+ "state"
+ ]
+ },
"clouds.connect": {
"$ref": "#/$defs/CloudProviderWire"
},
@@ -5513,6 +5642,66 @@
"methods"
]
},
+ "checklist.get": {
+ "type": "object",
+ "properties": {
+ "state": {
+ "type": "object",
+ "properties": {
+ "done": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "dismissed": {
+ "type": "boolean"
+ },
+ "shown": {
+ "type": "boolean"
+ }
+ },
+ "required": [
+ "done",
+ "dismissed",
+ "shown"
+ ]
+ }
+ },
+ "required": [
+ "state"
+ ]
+ },
+ "checklist.send": {
+ "type": "object",
+ "properties": {
+ "state": {
+ "type": "object",
+ "properties": {
+ "done": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "dismissed": {
+ "type": "boolean"
+ },
+ "shown": {
+ "type": "boolean"
+ }
+ },
+ "required": [
+ "done",
+ "dismissed",
+ "shown"
+ ]
+ }
+ },
+ "required": [
+ "state"
+ ]
+ },
"clouds.connect": {
"$ref": "#/$defs/CloudProviderWire"
},
diff --git a/apps/cua-spaces-web/src/bridge/contracts/host.ts b/apps/cua-spaces-web/src/bridge/contracts/host.ts
index 289621a5c8..a040668b63 100644
--- a/apps/cua-spaces-web/src/bridge/contracts/host.ts
+++ b/apps/cua-spaces-web/src/bridge/contracts/host.ts
@@ -148,6 +148,31 @@ export interface MachineRow extends SpaceHost {
/** This machine only: why it cannot open the account's machines (signed
* in, not enrolled), as the host's devices model says it. */
accessNotice?: MachineAccessNotice | null;
+ /** The host listed the rows with the core (`machines.pageRows`): each
+ * computer is already once, so the store does not merge them again. */
+ merged?: boolean;
+}
+
+/** One Machines row as the core lists it (`machines::MachinePageRow`),
+ * the same rows the SwiftUI app's Machines page shows. */
+export interface MachinePageRow {
+ id: string;
+ name: string;
+ online: boolean;
+ /** `macos`, `linux`, `windows`, or empty when unknown. */
+ os: string;
+ via: "local" | "relay";
+ current: boolean;
+ /** The device listed in this row. */
+ device: string | null;
+ /** A device that is none of the machines. */
+ deviceOnly: boolean;
+ /** The Spaces list's row that is this machine's own desktop. */
+ spaceId: string | null;
+ /** Online, but its owner stopped sharing it. */
+ stoppedSharing: boolean;
+ /** The device's last session (Unix seconds). */
+ lastSeen: number | null;
}
export interface ServiceState {
diff --git a/apps/cua-spaces-web/src/bridge/contracts/shapes.ts b/apps/cua-spaces-web/src/bridge/contracts/shapes.ts
index 78cefa421b..e5d574c8b2 100644
--- a/apps/cua-spaces-web/src/bridge/contracts/shapes.ts
+++ b/apps/cua-spaces-web/src/bridge/contracts/shapes.ts
@@ -59,6 +59,7 @@ import type { AgentSetupOutcome, DriveGrantInput, DriveMountInput, DriveRequestI
import type { AgentKeysReport } from "../ops/agent-keys";
import type { SentFileInfo, SpaceThumbnail, SpaceUsage, SpaceWindows } from "../ops/space-detail";
import type { RelayUsage } from "../ops/relay-usage";
+import type { HostChecklistState } from "../ops/checklist";
import type { PresenceCursorWire, PresenceJoinInfo, PresenceParticipantWire } from "../ops/presence";
import type { StartupState } from "../ops/startup";
import type { StreamTicket } from "../ops/stream";
@@ -170,6 +171,7 @@ const MachineRowShape = ref(
hostname: opt(str),
presence: optNull(bool),
accessNotice: optNull(MachineAccessNoticeShape),
+ merged: opt(bool),
}),
);
@@ -610,6 +612,29 @@ const PresenceCursorShape = ref(
}),
);
+/** The host's copy of the checklist (`ops/checklist.ts`). */
+const ChecklistAnswerShape = object({
+ state: obj<HostChecklistState>()({ done: strings, dismissed: bool, shown: bool }),
+});
+
+/** One Machines row as the core lists it (`machines::MachinePageRow`). */
+const MachinePageRowShape = ref(
+ "MachinePageRow",
+ object({
+ id: str,
+ name: str,
+ online: bool,
+ os: str,
+ via: str,
+ current: bool,
+ device: nullable(str),
+ deviceOnly: bool,
+ spaceId: nullable(str),
+ stoppedSharing: bool,
+ lastSeen: nullable(num),
+ }),
+);
+
export const OP_SHAPES: Record<OpName, Schema> = {
"spaces.list": list(SpaceRowShape),
"spaces.create": SpaceRowShape,
@@ -777,6 +802,8 @@ export const OP_SHAPES: Record<OpName, Schema> = {
upgradeUrl: nullable(str),
}),
),
+ "checklist.get": ChecklistAnswerShape,
+ "checklist.send": ChecklistAnswerShape,
"presence.join": obj<PresenceJoinInfo>()({
handle: str,
me: PresenceParticipantShape,
@@ -960,6 +987,7 @@ const WkMachinesShape = ref(
presence: optNull(dict(bool)),
deviceStates: optNull(dict(str)),
accessNotice: optNull(MachineAccessNoticeShape),
+ rows: opt(list(MachinePageRowShape)),
}),
);
@@ -1144,6 +1172,8 @@ export const WEBKIT_SHAPES: Partial<Record<WebkitMethod, Schema>> = {
"startup.get": StartupShape,
"startup.act": StartupShape,
"relay.usage": OP_SHAPES["relay.usage"],
+ "checklist.get": OP_SHAPES["checklist.get"],
+ "checklist.send": OP_SHAPES["checklist.send"],
};
/** Methods whose answer has no shape here, and why (none today: keep the
diff --git a/apps/cua-spaces-web/src/bridge/coverage.ts b/apps/cua-spaces-web/src/bridge/coverage.ts
index b4a3cda997..3c7c22273a 100644
--- a/apps/cua-spaces-web/src/bridge/coverage.ts
+++ b/apps/cua-spaces-web/src/bridge/coverage.ts
@@ -40,6 +40,7 @@ import { HOST_SETUP_COVERAGE } from "./ops/host-setup";
import { SPACE_DETAIL_COVERAGE } from "./ops/space-detail";
import { STREAM_COVERAGE } from "./ops/stream";
import { RELAY_USAGE_COVERAGE } from "./ops/relay-usage";
+import { CHECKLIST_COVERAGE } from "./ops/checklist";
import { PRESENCE_COVERAGE } from "./ops/presence";
import { TELEMETRY_COVERAGE } from "./ops/telemetry";
import { STARTUP_COVERAGE } from "./ops/startup";
@@ -160,6 +161,7 @@ export const HOST_COVERAGE = {
...STARTUP_COVERAGE,
...STREAM_COVERAGE,
...RELAY_USAGE_COVERAGE,
+ ...CHECKLIST_COVERAGE,
...PRESENCE_COVERAGE,
} as const satisfies Record<OpName, OpCoverage>;
diff --git a/apps/cua-spaces-web/src/bridge/derive.ts b/apps/cua-spaces-web/src/bridge/derive.ts
index 47682768e3..05e86b31b1 100644
--- a/apps/cua-spaces-web/src/bridge/derive.ts
+++ b/apps/cua-spaces-web/src/bridge/derive.ts
@@ -359,6 +359,7 @@ export function machinesInput(rows: MachineRow[], now: number): MachinesInput {
* (`mergeMachines`). The device adds its detail and last session; a
* device that is none of the machines stays a row of its own. */
export function mergeMachineRows(rows: MachineRow[], core?: CoreClient, nowSecs = Math.floor(Date.now() / 1000)): MachineRow[] {
+ if (rows.some((r) => r.merged)) return rows;
if (!rows.some((r) => r.device || r.presence != null)) return rows;
const byId = new Map(rows.filter((r) => !r.device).map((r) => [r.id, r] as const));
const devices = new Map(rows.filter((r) => r.device).map((r) => [r.id, r] as const));
diff --git a/apps/cua-spaces-web/src/bridge/ops/checklist.ts b/apps/cua-spaces-web/src/bridge/ops/checklist.ts
new file mode 100644
index 0000000000..f8b759256f
--- /dev/null
+++ b/apps/cua-spaces-web/src/bridge/ops/checklist.ts
@@ -0,0 +1,71 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+/**
+ * The getting-started checklist's one copy, kept by the host app
+ * (`checklist.json` beside its settings), so the classic Mac UI, the New
+ * UI and the Electron app count the same.
+ *
+ * | Operation | Electron | SwiftUI | Tauri |
+ * |---|---|---|---|
+ * | `checklist.get` | the host method `checklist.get` | the host method `checklist.get` | unsupported |
+ * | `checklist.send` | the host method `checklist.send` | the host method `checklist.send` | unsupported |
+ *
+ * `checklist.send` takes a step done, `shown`, `dismiss`, `reopen`, or
+ * `merge` (progress this page kept itself before, merged once). The host
+ * runs the core's `checklist.reduce`, saves it and records its usage
+ * events; it ticks steps off from what it shows itself
+ * (`checklist::observe_from`), so the page never sends `observe` there.
+ * The host says `checklist.changed` when the copy changed. Where
+ * unsupported, the page keeps its own copy (`bridge/checklist.ts`).
+ */
+
+import { UnsupportedOperationError, type BridgeMode } from "../adapter";
+import type { OpCoverage } from "../coverage";
+
+/** `checklist::ChecklistState`, steps as words. */
+export interface HostChecklistState {
+ done: string[];
+ dismissed: boolean;
+ shown: boolean;
+}
+
+/** What `checklist.send` takes (`checklist::ChecklistAction`, without `observe`). */
+export type HostChecklistAction =
+ | { type: "done"; step: string }
+ | { type: "shown" }
+ | { type: "dismiss" }
+ | { type: "reopen" }
+ | { type: "merge"; state: HostChecklistState };
+
+export interface ChecklistOps {
+ "checklist.get": { args: Record<string, never>; result: { state: HostChecklistState } };
+ "checklist.send": { args: { action: HostChecklistAction }; result: { state: HostChecklistState } };
+}
+
+export const CHECKLIST_OPERATIONS = ["checklist.get", "checklist.send"] as const satisfies readonly (keyof ChecklistOps)[];
+
+export const CHECKLIST_COVERAGE = {
+ "checklist.get": {
+ webkit: { methods: ["checklist.get"] },
+ tauri: [],
+ unsupported: { tauri: "the Tauri app keeps the checklist in the page" },
+ },
+ "checklist.send": {
+ webkit: { methods: ["checklist.send"] },
+ tauri: [],
+ unsupported: { tauri: "the Tauri app keeps the checklist in the page" },
+ },
+} as const satisfies Record<keyof ChecklistOps, OpCoverage>;
+
+/** A host without the host's copy (the demo): the page keeps its own. */
+export function unsupportedChecklistOps(mode: BridgeMode) {
+ const no = (op: keyof ChecklistOps) => (): Promise<{ state: HostChecklistState }> => Promise.reject(new UnsupportedOperationError(mode, op));
+ return { "checklist.get": no("checklist.get"), "checklist.send": no("checklist.send") };
+}
+
+/** Arguments that take it down its usual path (coverage tests). */
+export const CHECKLIST_ARGS = {
+ "checklist.get": {},
+ "checklist.send": { action: { type: "done" as const, step: "teleport" } },
+};
diff --git a/apps/cua-spaces-web/src/bridge/protocol.ts b/apps/cua-spaces-web/src/bridge/protocol.ts
index 6332db9377..7f77b354aa 100644
--- a/apps/cua-spaces-web/src/bridge/protocol.ts
+++ b/apps/cua-spaces-web/src/bridge/protocol.ts
@@ -45,6 +45,7 @@ import type { HostSetupOps } from "./ops/host-setup";
import type { SpaceDetailOps } from "./ops/space-detail";
import { STREAM_OPERATIONS, type StreamOps } from "./ops/stream";
import { RELAY_USAGE_OPERATIONS, type RelayUsageOps } from "./ops/relay-usage";
+import { CHECKLIST_OPERATIONS, type ChecklistOps } from "./ops/checklist";
import { PRESENCE_OPERATIONS, type PresenceOps } from "./ops/presence";
import type { TelemetryOps } from "./ops/telemetry";
import { STARTUP_EVENTS, STARTUP_OPERATIONS, type StartupHostEvent, type StartupOps } from "./ops/startup";
@@ -181,6 +182,7 @@ export interface HostOperations
StartupOps,
StreamOps,
RelayUsageOps,
+ ChecklistOps,
PresenceOps {
"spaces.list": { args: Record<string, never>; result: SpaceRow[] };
/** `os`: the plan's OS, for a host that draws its own pending row (the SwiftUI app's notch). */
@@ -283,6 +285,7 @@ export const OPERATIONS = [
...VOLUME_OPERATIONS,
...STREAM_OPERATIONS,
...RELAY_USAGE_OPERATIONS,
+ ...CHECKLIST_OPERATIONS,
...PRESENCE_OPERATIONS,
...SETTINGS_OPERATIONS,
...NOTIFICATIONS_OPERATIONS,
@@ -320,6 +323,8 @@ export type HostEvent =
| { type: "session.changed" }
/** A persistent agent or a run changed (paused, resumed, a turn ended): refetch. */
| { type: "agents.changed" }
+ /** The host's copy of the getting-started checklist changed (`ops/checklist.ts`): refetch. */
+ | { type: "checklist.changed" }
| TeleportHostEvent
/** The native app moved on while starting (the startup screen; payload: the new state). */
| StartupHostEvent;
@@ -337,6 +342,7 @@ export const HOST_EVENTS = [
"session.signedOut",
"session.changed",
"agents.changed",
+ "checklist.changed",
...TELEPORT_EVENTS,
...STARTUP_EVENTS,
] as const satisfies readonly HostEventType[];
diff --git a/apps/cua-spaces-web/src/bridge/webkit-protocol.ts b/apps/cua-spaces-web/src/bridge/webkit-protocol.ts
index c6e9df261f..4d1cb4d6f2 100644
--- a/apps/cua-spaces-web/src/bridge/webkit-protocol.ts
+++ b/apps/cua-spaces-web/src/bridge/webkit-protocol.ts
@@ -30,6 +30,7 @@
*/
import type { MachineAccessNotice } from "./contracts/devices";
+import type { MachinePageRow } 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";
@@ -146,6 +147,8 @@ export const WEBKIT_METHODS = [
"startup.get",
"startup.act",
"relay.usage",
+ "checklist.get",
+ "checklist.send",
] as const;
export type WebkitMethod = (typeof WEBKIT_METHODS)[number];
@@ -273,6 +276,9 @@ export interface WkMachines {
/** Signed in, but this Mac cannot open the account's machines (never
* enrolled, waiting, expired, revoked): `DevicesModel.accessNotice`. */
accessNotice?: MachineAccessNotice | null;
+ /** 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;
}
/** `session.get`, `session.signIn`, `session.signOut`. */
diff --git a/apps/cua-spaces-web/src/components/getting-started.tsx b/apps/cua-spaces-web/src/components/getting-started.tsx
index e51c4f0fe8..ec8495eada 100644
--- a/apps/cua-spaces-web/src/components/getting-started.tsx
+++ b/apps/cua-spaces-web/src/components/getting-started.tsx
@@ -156,7 +156,9 @@ export function GettingStarted() {
/**
* Tells the checklist what the app already shows (another machine, a
* Space, an agent; the core ticks those steps off) and answers Help >
- * Getting Started. Teleport and Share tick themselves off where they
+ * Getting Started. In the Mac app and Electron the host ticks those steps
+ * off itself (`checklist::observe_from`) and this page's observations are
+ * not sent; they count only where the page keeps its own copy (the demo). Teleport and Share tick themselves off where they
* finish (`bridge/teleport.ts`, `bridge/share.ts`). Mounted once, under
* the main layout.
*/
diff --git a/apps/cua-spaces/src/model/parity.test.ts b/apps/cua-spaces/src/model/parity.test.ts
index 59efa872bb..04343fb68e 100644
--- a/apps/cua-spaces/src/model/parity.test.ts
+++ b/apps/cua-spaces/src/model/parity.test.ts
@@ -249,6 +249,7 @@ describe('app core parity flows (webview)', () => {
'experiments',
'placement-picker',
'machines',
+ 'checklist',
]);
});
diff --git a/docs/content/docs/cua-sdk/reference/index.mdx b/docs/content/docs/cua-sdk/reference/index.mdx
index 44cdbea335..0690381a39 100644
--- a/docs/content/docs/cua-sdk/reference/index.mdx
+++ b/docs/content/docs/cua-sdk/reference/index.mdx
@@ -106,6 +106,7 @@ Pages marked *Cua Spaces app export* document the APIs the Cua Spaces apps are b
| [Devices](/cua-sdk/reference/spaces/app-core/devices) | Settings &gt; Devices: this device's enrollment, the account's devices, Recent Access, and the enroll and approval sheets. *Cua Spaces app export.* |
| [Settings, Agents](/cua-sdk/reference/spaces/app-core/agent-keys) | Settings &gt; Agents: the coding agents' rows, the provider keys saved in the keychain, and the add or replace sheet. *Cua Spaces app export.* |
| [Share sheet](/cua-sdk/reference/spaces/app-core/share) | The Share sheet: who a Space is shared with (viewer or editor) and the share request to run. *Cua Spaces app export.* |
+| [Machines page](/cua-sdk/reference/spaces/machines-app-core) | The Machines page's rows: this machine, your machines and your devices, each computer once. *Cua Spaces app export.* |
| [Getting started and the command palette](/cua-sdk/reference/spaces/app-checklist-palette) | The getting-started checklist, the command palette's ranking and the shared keyboard shortcuts. *Cua Spaces app export.* |
| [Usage telemetry](/cua-sdk/reference/spaces/app-core/telemetry) | Which anonymous usage events a Spaces app step means, and sending them. *Cua Spaces app export.* |
| [Devices](/cua-sdk/reference/spaces/devices) | This device as a client of the account on the relay: enroll, approve, rename, revoke and the audit log. |
@@ -142,4 +143,4 @@ Pages marked *Cua Spaces app export* document the APIs the Cua Spaces apps are b
291 items, 385 methods. The [Types](/cua-sdk/reference/types) page lists them.
-The Cua Spaces app export adds 759 items and 38 methods.
+The Cua Spaces app export adds 767 items and 38 methods.
diff --git a/docs/content/docs/cua-sdk/reference/spaces/app-checklist-palette.mdx b/docs/content/docs/cua-sdk/reference/spaces/app-checklist-palette.mdx
index 9e33957f2e..6fb6a37bdc 100644
--- a/docs/content/docs/cua-sdk/reference/spaces/app-checklist-palette.mdx
+++ b/docs/content/docs/cua-sdk/reference/spaces/app-checklist-palette.mdx
@@ -17,7 +17,7 @@ import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
These APIs are part of the Cua Spaces app export for building Spaces UIs. They are source-available under FSL-1.1-MIT and ship for Swift only (`import CuaSpacesFFI`); the Rust tab shows the `cua-spaces-ffi` crate they come from. The open source SDK packages for Python, TypeScript and Kotlin do not include them.
</Callout>
-App core functions beside the [Spaces app core](/cua-sdk/reference/spaces/app-core) screens. `app_checklist_reduce` applies a checklist action (a step done, shown, closed, opened again, or what the app shows now) and returns the new `AppChecklistState` with the usage events it means; `app_checklist_view` derives the rows, title and progress. `app_palette_rank` orders the command palette's entries for a query, and `app_keybindings` lists the default keyboard shortcuts the apps share.
+App core functions beside the [Spaces app core](/cua-sdk/reference/spaces/app-core) screens. The host app keeps the one `AppChecklistState`. `app_checklist_observe_from` reads what the app shows (the [Machines page](/cua-sdk/reference/spaces/machines-app-core) rows, the Spaces, the agents) as the same `Observe` action in every UI. `app_checklist_reduce` applies a checklist action (a step done, shown, closed, opened again, what the app shows now, or progress merged from another copy) and returns the new state with the usage events it means; `app_checklist_view` derives the rows, title and progress. `app_palette_rank` orders the command palette's entries for a query, and `app_keybindings` lists the default keyboard shortcuts the apps share.
## `AppChecklistRow` record
@@ -29,8 +29,19 @@ App core functions beside the [Spaces app core](/cua-sdk/reference/spaces/app-co
| `action` | `String` | | The button that does it; hidden once done. |
| `done` | `bool` | | Done (ticked, struck through). |
+## `AppChecklistSeen` record
+
+| Field | Type | Default | Description |
+| --- | --- | --- | --- |
+| `machines` | [`Vec<AppMachinePageRow>`](/cua-sdk/reference/spaces/machines-app-core#appmachinepagerow-record) | | The Machines page's rows (`crate.machines.page_rows`). |
+| `spaces` | [`Vec<AppSpace>`](/cua-sdk/reference/spaces/app-core/spaces#appspace-record) | | The Spaces list. |
+| `agents` | `u32` | | Persistent agents listed. |
+| `runs` | `u32` | | Agent runs listed in any Space. |
+
## `AppChecklistState` record
+Returned by [`app_checklist_state_from_json`](#app_checklist_state_from_json).
+
| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `done` | [`Vec<AppChecklistStep>`](#appcheckliststep-enum) | | Steps done, each once, in checklist order. |
@@ -89,6 +100,7 @@ Returned by [`app_keybindings`](#app_keybindings).
.dismiss
.reopen
.observe(otherMachine: Bool, hasSpace: Bool, agentRan: Bool)
+.merge(state: AppChecklistState)
```
</Tab>
@@ -100,6 +112,7 @@ AppChecklistAction::Shown
AppChecklistAction::Dismiss
AppChecklistAction::Reopen
AppChecklistAction::Observe { other_machine: bool, has_space: bool, agent_ran: bool }
+AppChecklistAction::Merge { state: AppChecklistState }
```
</Tab>
@@ -112,6 +125,7 @@ AppChecklistAction::Observe { other_machine: bool, has_space: bool, agent_ran: b
| `Dismiss` | Closed with ×. |
| `Reopen` | Getting Started (the palette, the Help menu): open it again. |
| `Observe` | What the app shows now: each `true` ticks its step off. Fields: `other_machine: bool`, `has_space: bool`, `agent_ran: bool` |
+| `Merge` | Progress kept elsewhere before (the web UI's own storage, another copy of the file): its steps are ticked, and it stays closed or shown if it was. Its events were recorded where it was ticked, so none are recorded again. Fields: `state: AppChecklistState` |
## `AppChecklistStep` enum
@@ -148,6 +162,33 @@ AppChecklistStep::RunAgent
| `Share` | Share a Space with someone. |
| `RunAgent` | Run an agent. |
+## `app_checklist_observe_from`
+
+What the app shows as the checklist's `Observe` (every UI the same).
+
+<Tabs items={['Swift', 'Rust']} groupId="sdk-lang" persist>
+<Tab value="Swift">
+
+```swift
+func appChecklistObserveFrom(seen: AppChecklistSeen) -> AppChecklistAction
+```
+
+</Tab>
+<Tab value="Rust">
+
+```rust
+pub fn app_checklist_observe_from(seen: AppChecklistSeen) -> AppChecklistAction
+```
+
+</Tab>
+</Tabs>
+
+| Parameter | Type | Default |
+| --- | --- | --- |
+| `seen` | [`AppChecklistSeen`](#appchecklistseen-record) | required |
+
+**Returns** [`AppChecklistAction`](#appchecklistaction-enum)
+
## `app_checklist_reduce`
The getting-started checklist after `action`, and its usage events.
@@ -176,6 +217,33 @@ pub fn app_checklist_reduce(state: AppChecklistState, action: AppChecklistAction
**Returns** [`AppChecklistTransition`](#appchecklisttransition-record)
+## `app_checklist_state_from_json`
+
+Checklist state from JSON, steps as words (fixtures, parity flows).
+
+<Tabs items={['Swift', 'Rust']} groupId="sdk-lang" persist>
+<Tab value="Swift">
+
+```swift
+func appChecklistStateFromJson(json: String) throws -> AppChecklistState
+```
+
+</Tab>
+<Tab value="Rust">
+
+```rust
+pub fn app_checklist_state_from_json(json: String) -> Result<AppChecklistState, CuaError>
+```
+
+</Tab>
+</Tabs>
+
+| Parameter | Type | Default |
+| --- | --- | --- |
+| `json` | `String` | required |
+
+**Returns** [`AppChecklistState`](#appcheckliststate-record) · **Raises** [`CuaError`](/cua-sdk/reference/errors)
+
## `app_checklist_view`
The getting-started checklist as drawn.
diff --git a/docs/content/docs/cua-sdk/reference/spaces/machines-app-core.mdx b/docs/content/docs/cua-sdk/reference/spaces/machines-app-core.mdx
new file mode 100644
index 0000000000..b0d9ede2ca
--- /dev/null
+++ b/docs/content/docs/cua-sdk/reference/spaces/machines-app-core.mdx
@@ -0,0 +1,117 @@
+---
+title: "Machines page"
+description: "The Machines page's rows: this machine, your machines and your devices, each computer once."
+---
+
+{/*
+ AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
+ Generated by: pnpm --dir docs docs:generate:cua-sdk
+ Source: cua-bindgen docs --namespace cua_spaces_ffi (UniFFI metadata of libcua_spaces_ffi)
+ Version: 0.4.1
+*/}
+
+import { Callout } from 'fumadocs-ui/components/callout';
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+<Callout title="Cua Spaces app export">
+These APIs are part of the Cua Spaces app export for building Spaces UIs. They are source-available under FSL-1.1-MIT and ship for Swift only (`import CuaSpacesFFI`); the Rust tab shows the `cua-spaces-ffi` crate they come from. The open source SDK packages for Python, TypeScript and Kotlin do not include them.
+</Callout>
+
+`app_machines_page_rows` builds the Machines page from what an app has: the Spaces list (a machine sharing its own desktop, one that provides Spaces), what the relay says of each machine, and the account's devices (`AppDeviceIn`). A machine and the device on it are one row; a device that is none of the machines is listed on its own (`device_only`) and is never a Run on choice. Every Spaces UI lists these rows.
+
+## `AppDeviceIn` record
+
+| Field | Type | Default | Description |
+| --- | --- | --- | --- |
+| `id` | `String` | | `dev_…`. |
+| `name` | `String` | | Its name (by default its hostname). |
+| `platform` | `String` | | `macos`, `windows`, `linux` (any case), or empty. |
+| `last_seen` / `lastSeen` | `Option<u64>` | | Last session (Unix seconds). |
+| `current` | `bool` | | This device. |
+| `state` | `String` | | `pending`, `enrolled`, `expired`, `revoked`, or empty. |
+
+## `AppMachinePageRow` record
+
+Returned by [`app_machines_page_rows`](#app_machines_page_rows).
+
+| Field | Type | Default | Description |
+| --- | --- | --- | --- |
+| `id` | `String` | | The machine's id (`this-mac`, a relay machine id), or the device's id for a device of its own. |
+| `name` | `String` | | What the page calls it. |
+| `online` | `bool` | | Reached, connected to the relay, or (a device of its own) in a session in the last `DEVICE_ONLINE_SECS`. |
+| `os` | `String` | | `macos`, `linux`, `windows`, or empty when unknown. |
+| `via` | `String` | | `local` (this machine) or `relay`. |
+| `current` | `bool` | | The machine this app runs on. |
+| `device` | `Option<String>` | | The device listed in this row, if any. |
+| `device_only` / `deviceOnly` | `bool` | | A device that is none of the machines: listed, never a "Run on" choice, and it has no Spaces or desktop of its own here. |
+| `space_id` / `spaceId` | `Option<String>` | | The Spaces list's row that is this machine's own desktop (`this-mac`, `relay:<machine>`), when there is one: the classic UI's detail for it. |
+| `stopped_sharing` / `stoppedSharing` | `bool` | | Online, but its owner stopped sharing it. |
+| `last_seen` / `lastSeen` | `Option<u64>` | | The device's last session (Unix seconds), when it has a device. |
+
+## `AppMachinesPageInput` record
+
+Returned by [`app_machines_page_input_from_json`](#app_machines_page_input_from_json).
+
+| Field | Type | Default | Description |
+| --- | --- | --- | --- |
+| `host_os` / `hostOs` | [`AppSpaceOs`](/cua-sdk/reference/spaces/app-core/spaces#appspaceos-enum) | | The system this app runs on (names the first row "This Mac"). |
+| `spaces` | [`Vec<AppSpace>`](/cua-sdk/reference/spaces/app-core/spaces#appspace-record) | | The Spaces list as the shell has it (registry rows as Spaces). |
+| `devices` | [`Vec<AppDeviceIn>`](#appdevicein-record) | | The account's devices (none while signed out). |
+| `hostnames` | `HashMap<String, String>` | | The hostname each machine's cua-spacesd reported, by machine id. |
+| `presence` | `HashMap<String, bool>` | | Whether the relay sees each machine connected now, by machine id. |
+| `now` | `u64` | | Unix seconds. |
+
+## `app_machines_page_input_from_json`
+
+Machines page input from JSON (fixtures, parity flows).
+
+<Tabs items={['Swift', 'Rust']} groupId="sdk-lang" persist>
+<Tab value="Swift">
+
+```swift
+func appMachinesPageInputFromJson(json: String) throws -> AppMachinesPageInput
+```
+
+</Tab>
+<Tab value="Rust">
+
+```rust
+pub fn app_machines_page_input_from_json(json: String) -> Result<AppMachinesPageInput, CuaError>
+```
+
+</Tab>
+</Tabs>
+
+| Parameter | Type | Default |
+| --- | --- | --- |
+| `json` | `String` | required |
+
+**Returns** [`AppMachinesPageInput`](#appmachinespageinput-record) · **Raises** [`CuaError`](/cua-sdk/reference/errors)
+
+## `app_machines_page_rows`
+
+The Machines page's rows: this machine, your machines, your devices of
+their own, each computer once.
+
+<Tabs items={['Swift', 'Rust']} groupId="sdk-lang" persist>
+<Tab value="Swift">
+
+```swift
+func appMachinesPageRows(input: AppMachinesPageInput) -> [AppMachinePageRow]
+```
+
+</Tab>
+<Tab value="Rust">
+
+```rust
+pub fn app_machines_page_rows(input: AppMachinesPageInput) -> Vec<AppMachinePageRow>
+```
+
+</Tab>
+</Tabs>
+
+| Parameter | Type | Default |
+| --- | --- | --- |
+| `input` | [`AppMachinesPageInput`](#appmachinespageinput-record) | required |
+
+**Returns** [`Vec<AppMachinePageRow>`](#appmachinepagerow-record)
diff --git a/docs/content/docs/cua-sdk/reference/spaces/meta.json b/docs/content/docs/cua-sdk/reference/spaces/meta.json
index 2952572ca8..9065b3f025 100644
--- a/docs/content/docs/cua-sdk/reference/spaces/meta.json
+++ b/docs/content/docs/cua-sdk/reference/spaces/meta.json
@@ -17,6 +17,7 @@
"app-core",
"volume-app-core",
"agents-app-core",
+ "machines-app-core",
"app-checklist-palette",
"devices",
"host"
diff --git a/docs/content/docs/cua-sdk/reference/types.mdx b/docs/content/docs/cua-sdk/reference/types.mdx
index 4eff2b3df7..f6b271fa16 100644
--- a/docs/content/docs/cua-sdk/reference/types.mdx
+++ b/docs/content/docs/cua-sdk/reference/types.mdx
@@ -50,7 +50,7 @@ Renamed members: in Kotlin, objects implement `AutoCloseable`, whose `close()` f
292 items. Methods are listed on their object.
-The 759 items of the Cua Spaces app export (source-available, FSL-1.1-MIT, Swift only) are listed on their pages: [Decoded media](/cua-sdk/reference/spaces/decoded-media), [Host teleport](/cua-sdk/reference/spaces/teleport-host), [Teleport an app](/cua-sdk/reference/spaces/teleport-apps), [Spaces app core](/cua-sdk/reference/spaces/app-core#all-items), [App core: Cua Volume storage, mount and sync](/cua-sdk/reference/spaces/volume-app-core#all-items), [App core: agents, drive, notifications](/cua-sdk/reference/spaces/agents-app-core#all-items), [Getting started and the command palette](/cua-sdk/reference/spaces/app-checklist-palette).
+The 767 items of the Cua Spaces app export (source-available, FSL-1.1-MIT, Swift only) are listed on their pages: [Decoded media](/cua-sdk/reference/spaces/decoded-media), [Host teleport](/cua-sdk/reference/spaces/teleport-host), [Teleport an app](/cua-sdk/reference/spaces/teleport-apps), [Spaces app core](/cua-sdk/reference/spaces/app-core#all-items), [App core: Cua Volume storage, mount and sync](/cua-sdk/reference/spaces/volume-app-core#all-items), [App core: agents, drive, notifications](/cua-sdk/reference/spaces/agents-app-core#all-items), [Machines page](/cua-sdk/reference/spaces/machines-app-core), [Getting started and the command palette](/cua-sdk/reference/spaces/app-checklist-palette).
| Item | Kind | Summary |
| --- | --- | --- |
diff --git a/libs/cua/crates/cua-spaces-app-core/parity/checklist.json b/libs/cua/crates/cua-spaces-app-core/parity/checklist.json
new file mode 100644
index 0000000000..74e35d398f
--- /dev/null
+++ b/libs/cua/crates/cua-spaces-app-core/parity/checklist.json
@@ -0,0 +1,241 @@
+{
+ "name": "checklist",
+ "about": "The getting-started checklist counts the same in every UI and app: the host keeps one copy of its progress, and every UI ticks steps off from the same reading of what the app shows (checklist.observeFrom over the Machines page's rows, the Spaces list and the agents). Another machine is any Machines row but this one, a device of your own included; a Space is one you made that is there now (running, waiting, or stopped), not a machine's own desktop or one being created, deleted or whose create failed; an agent is a persistent agent or a run in any Space. Progress kept before in the web UI's own storage is merged in once, without its usage events again.",
+ "cases": [
+ {
+ "name": "a spare Mac: its Space is stopped, its devices are only in the device list, no agents",
+ "page": {
+ "hostOs": "macos",
+ "now": 1800000000,
+ "spaces": [
+ {
+ "name": "This Mac",
+ "os": "macos",
+ "status": "local",
+ "detail": "",
+ "lastUsedAt": 0,
+ "scene": "linux-terminal",
+ "id": "this-mac"
+ },
+ {
+ "name": "fbd1",
+ "os": "linux",
+ "status": "suspended",
+ "detail": "",
+ "lastUsedAt": 0,
+ "scene": "linux-terminal",
+ "id": "local:fbd1",
+ "provider": "local"
+ },
+ {
+ "name": "studio-2.local",
+ "os": "unknown",
+ "status": "suspended",
+ "detail": "",
+ "lastUsedAt": 0,
+ "scene": "linux-terminal",
+ "id": "relay:b6953d14ff94b10fcbb38bdd13c47824",
+ "provider": "relay",
+ "sdk": {
+ "features": [],
+ "spacesdVersion": "",
+ "reachable": false,
+ "error": "unauthenticated: studio-2.local stopped sharing: ask its owner to Resume sharing (or run `cua host start` there)"
+ }
+ }
+ ],
+ "devices": [
+ {
+ "id": "dev_me",
+ "name": "Mac.localdomain",
+ "platform": "macos",
+ "lastSeen": 1799999990,
+ "current": true,
+ "state": "enrolled"
+ },
+ {
+ "id": "dev_s",
+ "name": "studio-2.local",
+ "platform": "macos",
+ "lastSeen": 1799000000,
+ "state": "enrolled"
+ },
+ {
+ "id": "dev_byoc",
+ "name": "BYOC tests",
+ "platform": "macos",
+ "lastSeen": 1797000000,
+ "state": "enrolled"
+ },
+ {
+ "id": "dev_l1",
+ "name": "Ana's MacBook Pro",
+ "platform": "macos",
+ "lastSeen": 1799999500,
+ "state": "enrolled"
+ },
+ {
+ "id": "dev_l2",
+ "name": "Ana's MacBook Pro",
+ "platform": "macos",
+ "lastSeen": 1796000000,
+ "state": "expired"
+ },
+ {
+ "id": "dev_x",
+ "name": "Lost phone",
+ "platform": "ios",
+ "state": "revoked"
+ }
+ ],
+ "hostnames": {},
+ "presence": {
+ "b6953d14ff94b10fcbb38bdd13c47824": false
+ }
+ },
+ "agents": 0,
+ "runs": 0,
+ "state": {
+ "done": [
+ "add_machine",
+ "create_space"
+ ],
+ "dismissed": false,
+ "shown": true
+ },
+ "earlier": {
+ "done": [
+ "add_machine",
+ "create_space",
+ "teleport"
+ ],
+ "dismissed": false,
+ "shown": true
+ }
+ },
+ {
+ "name": "only this machine, a Space still being created and one whose create failed",
+ "page": {
+ "hostOs": "macos",
+ "now": 1800000000,
+ "spaces": [
+ {
+ "name": "This Mac",
+ "os": "macos",
+ "status": "local",
+ "detail": "",
+ "lastUsedAt": 0,
+ "scene": "linux-terminal",
+ "id": "this-mac"
+ },
+ {
+ "name": "new",
+ "os": "linux",
+ "status": "provisioning",
+ "detail": "",
+ "lastUsedAt": 0,
+ "scene": "linux-terminal",
+ "id": "pending:7"
+ },
+ {
+ "name": "bad",
+ "os": "linux",
+ "status": "suspended",
+ "detail": "",
+ "lastUsedAt": 0,
+ "scene": "linux-terminal",
+ "id": "local:bad",
+ "progress": {
+ "phase": "pull",
+ "permille": 0,
+ "label": "",
+ "error": "no disk",
+ "cancellable": false
+ }
+ }
+ ],
+ "devices": [
+ {
+ "id": "dev_me",
+ "name": "Mac.localdomain",
+ "platform": "macos",
+ "current": true,
+ "state": "enrolled"
+ }
+ ]
+ },
+ "agents": 0,
+ "runs": 0,
+ "state": {
+ "done": [],
+ "dismissed": false,
+ "shown": false
+ },
+ "earlier": null
+ },
+ {
+ "name": "a Space another machine provides, and an agent run in it",
+ "page": {
+ "hostOs": "linux",
+ "now": 1800000000,
+ "spaces": [
+ {
+ "name": "Spare Mac mini",
+ "os": "macos",
+ "status": "running",
+ "detail": "",
+ "lastUsedAt": 0,
+ "scene": "linux-terminal",
+ "id": "relay:m-mini",
+ "provider": "relay"
+ },
+ {
+ "name": "dev box",
+ "os": "linux",
+ "status": "running",
+ "detail": "",
+ "lastUsedAt": 0,
+ "scene": "linux-terminal",
+ "id": "relay:m-box/space-1",
+ "provider": "relay",
+ "host": "m-box",
+ "hostName": "Build box"
+ },
+ {
+ "name": "ci",
+ "os": "linux",
+ "status": "suspended",
+ "detail": "",
+ "lastUsedAt": 0,
+ "scene": "linux-terminal",
+ "id": "relay:m-box/space-2",
+ "provider": "relay",
+ "host": "m-box",
+ "hostName": "Build box"
+ }
+ ],
+ "devices": [],
+ "hostnames": {
+ "m-mini": "mini.lan"
+ },
+ "presence": {
+ "m-box": true
+ }
+ },
+ "agents": 0,
+ "runs": 1,
+ "state": {
+ "done": [],
+ "dismissed": false,
+ "shown": false
+ },
+ "earlier": {
+ "done": [
+ "share"
+ ],
+ "dismissed": true,
+ "shown": true
+ }
+ }
+ ]
+}
diff --git a/libs/cua/crates/cua-spaces-app-core/parity/golden/checklist.json b/libs/cua/crates/cua-spaces-app-core/parity/golden/checklist.json
new file mode 100644
index 0000000000..6f5389cc62
--- /dev/null
+++ b/libs/cua/crates/cua-spaces-app-core/parity/golden/checklist.json
@@ -0,0 +1,49 @@
+{
+ "flow": "checklist",
+ "frames": [
+ {
+ "case": "a spare Mac: its Space is stopped, its devices are only in the device list, no agents",
+ "events": [],
+ "merged": {
+ "events": 0,
+ "progress": "3 of 5",
+ "visible": true
+ },
+ "observe": {
+ "agentRan": false,
+ "hasSpace": true,
+ "otherMachine": true
+ },
+ "progress": "2 of 5"
+ },
+ {
+ "case": "only this machine, a Space still being created and one whose create failed",
+ "events": [],
+ "observe": {
+ "agentRan": false,
+ "hasSpace": false,
+ "otherMachine": false
+ },
+ "progress": "0 of 5"
+ },
+ {
+ "case": "a Space another machine provides, and an agent run in it",
+ "events": [
+ "checklist_add_machine",
+ "checklist_create_space",
+ "checklist_run_agent"
+ ],
+ "merged": {
+ "events": 0,
+ "progress": "4 of 5",
+ "visible": false
+ },
+ "observe": {
+ "agentRan": true,
+ "hasSpace": true,
+ "otherMachine": true
+ },
+ "progress": "3 of 5"
+ }
+ ]
+}
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 cdb4204697..4a1306d5e0 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
@@ -42,6 +42,24 @@
"Old laptop [dev_o] offline (a device)"
],
"runOn": []
+ },
+ {
+ "page": "a spare Mac with one Space, a machine that stopped sharing and devices only in the device list",
+ "rows": [
+ "This Mac [this-mac] local macos online (this machine) + dev_me desktop this-mac",
+ "studio-2.local [b6953d14ff94b10fcbb38bdd13c47824] relay macos online + dev_s desktop relay:b6953d14ff94b10fcbb38bdd13c47824 (stopped sharing)",
+ "BYOC tests [dev_byoc] relay macos offline (a device)",
+ "Ana's MacBook Pro [dev_l1] relay macos online (a device)",
+ "Ana's MacBook Pro [dev_l2] relay macos offline (a device)"
+ ]
+ },
+ {
+ "page": "a machine that provides Spaces and one sharing its desktop, signed out",
+ "rows": [
+ "This computer [this-mac] local linux online (this machine)",
+ "Spare Mac mini [m-mini] relay macos online desktop relay:m-mini",
+ "Build box [m-box] relay ? online"
+ ]
}
]
}
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 33ec60e944..021a6209f9 100644
--- a/libs/cua/crates/cua-spaces-app-core/parity/machines.json
+++ b/libs/cua/crates/cua-spaces-app-core/parity/machines.json
@@ -1,6 +1,6 @@
{
"name": "machines",
- "about": "The Machines page lists each computer once: a Mac on the relay and the enrolled device on it (named after its hostname) are one row, with the machine's id and friendlier name, online when the app reached it or the relay sees it connected. Two Macs that share a name are never merged. A device that is none of the machines is listed on its own (online after a session in the last 15 minutes), and is never a Run on choice.",
+ "about": "The Machines page lists each computer once: a Mac on the relay and the enrolled device on it (named after its hostname) are one row, with the machine's id and friendlier name, online when the app reached it or the relay sees it connected. Two Macs that share a name are never merged. A device that is none of the machines is listed on its own (online after a session in the last 15 minutes), and is never a Run on choice. The page itself (machines.pageRows) is built the same way in every UI from what the shell has: This machine first, then the machines its Spaces list shows (a machine sharing its own desktop, one that provides Spaces), then the devices of their own; a machine whose system is unknown still merges with its device.",
"now": 1800000000,
"cases": [
{
@@ -46,5 +46,59 @@
{ "id": "dev_x", "name": "Lost phone", "platform": "ios", "state": "revoked" }
]
}
+ ],
+ "pages": [
+ {
+ "name": "a spare Mac with one Space, a machine that stopped sharing and devices only in the device list",
+ "input": {
+ "hostOs": "macos",
+ "now": 1800000000,
+ "spaces": [
+ { "name": "This Mac", "os": "macos", "status": "local", "detail": "", "lastUsedAt": 0, "scene": "linux-terminal", "id": "this-mac" },
+ { "name": "fbd1", "os": "linux", "status": "suspended", "detail": "", "lastUsedAt": 0, "scene": "linux-terminal", "id": "local:fbd1", "provider": "local" },
+ {
+ "name": "studio-2.local",
+ "os": "unknown",
+ "status": "suspended",
+ "detail": "",
+ "lastUsedAt": 0,
+ "scene": "linux-terminal",
+ "id": "relay:b6953d14ff94b10fcbb38bdd13c47824",
+ "provider": "relay",
+ "sdk": {
+ "features": [],
+ "spacesdVersion": "",
+ "reachable": false,
+ "error": "unauthenticated: studio-2.local stopped sharing: ask its owner to Resume sharing (or run `cua host start` there)"
+ }
+ }
+ ],
+ "devices": [
+ { "id": "dev_me", "name": "Mac.localdomain", "platform": "macos", "lastSeen": 1799999990, "current": true, "state": "enrolled" },
+ { "id": "dev_s", "name": "studio-2.local", "platform": "macos", "lastSeen": 1799000000, "state": "enrolled" },
+ { "id": "dev_byoc", "name": "BYOC tests", "platform": "macos", "lastSeen": 1797000000, "state": "enrolled" },
+ { "id": "dev_l1", "name": "Ana's MacBook Pro", "platform": "macos", "lastSeen": 1799999500, "state": "enrolled" },
+ { "id": "dev_l2", "name": "Ana's MacBook Pro", "platform": "macos", "lastSeen": 1796000000, "state": "expired" },
+ { "id": "dev_x", "name": "Lost phone", "platform": "ios", "state": "revoked" }
+ ],
+ "hostnames": {},
+ "presence": { "b6953d14ff94b10fcbb38bdd13c47824": false}
+ }
+ },
+ {
+ "name": "a machine that provides Spaces and one sharing its desktop, signed out",
+ "input": {
+ "hostOs": "linux",
+ "now": 1800000000,
+ "spaces": [
+ { "name": "Spare Mac mini", "os": "macos", "status": "running", "detail": "", "lastUsedAt": 0, "scene": "linux-terminal", "id": "relay:m-mini", "provider": "relay" },
+ { "name": "dev box", "os": "linux", "status": "running", "detail": "", "lastUsedAt": 0, "scene": "linux-terminal", "id": "relay:m-box/space-1", "provider": "relay", "host": "m-box", "hostName": "Build box" },
+ { "name": "ci", "os": "linux", "status": "suspended", "detail": "", "lastUsedAt": 0, "scene": "linux-terminal", "id": "relay:m-box/space-2", "provider": "relay", "host": "m-box", "hostName": "Build box" }
+ ],
+ "devices": [],
+ "hostnames": { "m-mini": "mini.lan" },
+ "presence": { "m-box": true}
+ }
+ }
]
}
diff --git a/libs/cua/crates/cua-spaces-app-core/src/checklist.rs b/libs/cua/crates/cua-spaces-app-core/src/checklist.rs
index 809582a0ca..4cfc4dd9f7 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/checklist.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/checklist.rs
@@ -5,16 +5,22 @@
//! Spaces, ticked off as they happen, closable, and opened again from the
//! command palette or Help, Getting Started.
//!
-//! The shell keeps the [`ChecklistState`] (the React UI in the page's
-//! storage, the SwiftUI app in its support folder), sends a
-//! [`ChecklistAction`] for each thing that happens and records the usage
-//! events the [`ChecklistTransition`] carries. [`ChecklistAction::Observe`]
-//! ticks steps off from what the app already shows (another machine, a
-//! Space, an agent); Teleport and Share tick themselves off where they
-//! finish.
+//! The host app keeps the [`ChecklistState`] in one place
+//! (`checklist.json` beside its settings; the web UI asks the host for it
+//! with `checklist.get` and `checklist.send`), sends a [`ChecklistAction`]
+//! for each thing that happens and records the usage events the
+//! [`ChecklistTransition`] carries. [`observe_from`] turns what the app
+//! knows (its machines, its Spaces, its agents) into the
+//! [`ChecklistAction::Observe`] that ticks steps off, the same for every
+//! UI; Teleport and Share tick themselves off where they finish.
+//! [`ChecklistAction::Merge`] takes in progress kept elsewhere before (the
+//! web UI's own storage) without recording its events again.
use serde::{Deserialize, Serialize};
+use crate::machines::MachinePageRow;
+use crate::model::{Space, SpaceStatus};
+use crate::spaces::{creating, is_machine_desktop};
use crate::telemetry::{self, TelemetrySignal};
/// One step, in the order the checklist lists them
@@ -129,6 +135,56 @@ pub enum ChecklistAction {
/// An agent exists or has run.
agent_ran: bool,
},
+ /// Progress kept elsewhere before (the web UI's own storage, another
+ /// copy of the file): its steps are ticked, and it stays closed or
+ /// shown if it was. Its events were recorded where it was ticked, so
+ /// none are recorded again.
+ Merge {
+ /// The other copy.
+ state: ChecklistState,
+ },
+}
+
+/// What the app knows, for [`observe_from`].
+#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ChecklistSeen {
+ /// The Machines page's rows ([`crate::machines::page_rows`]).
+ #[serde(default)]
+ pub machines: Vec<MachinePageRow>,
+ /// The Spaces list.
+ #[serde(default)]
+ pub spaces: Vec<Space>,
+ /// Persistent agents listed.
+ #[serde(default)]
+ pub agents: u32,
+ /// Agent runs listed in any Space.
+ #[serde(default)]
+ pub runs: u32,
+}
+
+/// What the app shows as the checklist's [`ChecklistAction::Observe`]:
+///
+/// - another machine: any row of the Machines page but this one (a
+/// machine on the relay, one that provides Spaces, a device of your own);
+/// - a Space: one you made (not a machine's own desktop), there now:
+/// running, waiting for approval, or stopped; not one being created,
+/// deleted, or whose create failed;
+/// - an agent: a persistent agent, or a run in any Space.
+pub fn observe_from(seen: &ChecklistSeen) -> ChecklistAction {
+ ChecklistAction::Observe {
+ other_machine: seen.machines.iter().any(|m| !m.current),
+ has_space: seen.spaces.iter().any(|s| {
+ !is_machine_desktop(s)
+ && !creating::is_pending(&s.id)
+ && matches!(
+ s.status,
+ SpaceStatus::Running | SpaceStatus::Approval | SpaceStatus::Suspended
+ )
+ && s.progress.as_ref().is_none_or(|p| p.error.is_none())
+ }),
+ agent_ran: seen.agents + seen.runs > 0,
+ }
}
/// The state after an action and the usage events it means.
@@ -246,6 +302,18 @@ pub fn reduce(state: &ChecklistState, action: &ChecklistAction) -> ChecklistTran
.collect();
tick(state, &seen)
}
+ ChecklistAction::Merge { state: other } => ChecklistTransition {
+ state: ChecklistState {
+ done: STEPS
+ .iter()
+ .copied()
+ .filter(|s| is_done(state, *s) || is_done(other, *s))
+ .collect(),
+ dismissed: state.dismissed || other.dismissed,
+ shown: state.shown || other.shown,
+ },
+ signals: vec![],
+ },
ChecklistAction::Shown if !state.shown => ChecklistTransition {
state: ChecklistState {
shown: true,
@@ -442,6 +510,122 @@ mod tests {
);
}
+ #[test]
+ fn merging_another_copy_ticks_its_steps_without_events() {
+ let here = ChecklistState {
+ done: vec![ChecklistStep::CreateSpace, ChecklistStep::AddMachine],
+ ..Default::default()
+ };
+ let there = ChecklistState {
+ done: vec![ChecklistStep::Teleport, ChecklistStep::AddMachine],
+ shown: true,
+ ..Default::default()
+ };
+ let t = reduce(&here, &ChecklistAction::Merge { state: there });
+ assert!(t.signals.is_empty(), "recorded where they were ticked");
+ assert_eq!(
+ t.state.done,
+ [
+ ChecklistStep::AddMachine,
+ ChecklistStep::CreateSpace,
+ ChecklistStep::Teleport
+ ]
+ );
+ assert!(t.state.shown && !t.state.dismissed);
+ assert_eq!(view(&t.state).progress, "3 of 5");
+ // Merging again changes nothing.
+ let again = reduce(&t.state, &ChecklistAction::Merge { state: here });
+ assert_eq!(again.state, t.state);
+ }
+
+ fn space(id: &str, status: &str, extra: serde_json::Value) -> Space {
+ let mut v = serde_json::json!({
+ "id": id, "name": id, "os": "linux", "status": status, "detail": "",
+ "lastUsedAt": 0, "scene": "linux-terminal"
+ });
+ for (k, val) in extra.as_object().unwrap() {
+ v[k] = val.clone();
+ }
+ serde_json::from_value(v).unwrap()
+ }
+
+ fn row(id: &str, current: bool, device_only: bool) -> MachinePageRow {
+ MachinePageRow {
+ id: id.into(),
+ name: id.into(),
+ online: true,
+ os: "macos".into(),
+ via: if current { "local" } else { "relay" }.into(),
+ current,
+ device: None,
+ device_only,
+ space_id: None,
+ stopped_sharing: false,
+ last_seen: None,
+ }
+ }
+
+ fn seen(t: &ChecklistAction) -> (bool, bool, bool) {
+ match t {
+ ChecklistAction::Observe {
+ other_machine,
+ has_space,
+ agent_ran,
+ } => (*other_machine, *has_space, *agent_ran),
+ other => panic!("unexpected {other:?}"),
+ }
+ }
+
+ #[test]
+ fn observe_from_reads_machines_spaces_and_agents_alike_for_every_ui() {
+ // Only this machine, its own desktop, a machine's desktop and
+ // Spaces that are not there yet: nothing.
+ let none = ChecklistSeen {
+ machines: vec![row("this-mac", true, false)],
+ spaces: vec![
+ space("this-mac", "local", serde_json::json!({})),
+ space(
+ "relay:b695",
+ "suspended",
+ serde_json::json!({"provider": "relay"}),
+ ),
+ space("pending:1", "provisioning", serde_json::json!({})),
+ space("local:gone", "deleting", serde_json::json!({})),
+ space(
+ "local:failed",
+ "suspended",
+ serde_json::json!({
+ "progress": {"phase": "pull", "permille": 0, "label": "", "error": "no disk",
+ "cancellable": false}
+ }),
+ ),
+ ],
+ agents: 0,
+ runs: 0,
+ };
+ assert_eq!(seen(&observe_from(&none)), (false, false, false));
+ // A device of your own counts as another machine; a stopped Space
+ // counts; a run in a Space counts as an agent.
+ let some = ChecklistSeen {
+ machines: vec![row("this-mac", true, false), row("dev_lap", false, true)],
+ spaces: vec![space("local:fbd1", "suspended", serde_json::json!({}))],
+ agents: 0,
+ runs: 1,
+ };
+ assert_eq!(seen(&observe_from(&some)), (true, true, true));
+ // A Space a machine provides counts too.
+ let hosted = ChecklistSeen {
+ spaces: vec![space(
+ "relay:m-mini/space-1",
+ "running",
+ serde_json::json!({"provider": "relay", "host": "m-mini"}),
+ )],
+ agents: 2,
+ ..Default::default()
+ };
+ assert_eq!(seen(&observe_from(&hosted)), (false, true, true));
+ }
+
#[test]
fn reads_the_stored_shape() {
let s: ChecklistState =
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 659dff6692..7698fa4893 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/dispatch.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/dispatch.rs
@@ -227,6 +227,7 @@ pub const METHODS: &[&str] = &[
"paths.displayPaths",
"devices.view",
"machines.merge",
+ "machines.pageRows",
"devices.activityText",
"devices.labels",
"devices.platformName",
@@ -275,6 +276,7 @@ pub const METHODS: &[&str] = &[
"telemetry.checklist",
"checklist.reduce",
"checklist.view",
+ "checklist.observeFrom",
"palette.keybindings",
"palette.rank",
"telemetry.experimentsChanged",
@@ -837,6 +839,10 @@ pub fn call_value(method: &str, args: Value) -> Result<Value, CoreError> {
&a.get::<Option<machines::MachinesInput>>("input")?
.unwrap_or_default(),
)),
+ "machines.pageRows" => out(machines::page_rows(
+ &a.get::<Option<machines::MachinesPageInput>>("input")?
+ .unwrap_or_default(),
+ )),
"devices.view" => out(devices::devices_view(
&a.get::<Option<devices::DevicesInput>>("input")?
.unwrap_or_default(),
@@ -1054,6 +1060,10 @@ pub fn call_value(method: &str, args: Value) -> Result<Value, CoreError> {
"checklist.view" => out(checklist::view(
&a.get::<checklist::ChecklistState>("state")?,
)),
+ "checklist.observeFrom" => out(checklist::observe_from(
+ &a.get::<Option<checklist::ChecklistSeen>>("seen")?
+ .unwrap_or_default(),
+ )),
"palette.keybindings" => out(palette::keybindings()),
"palette.rank" => out(palette::rank(
&a.get::<Vec<palette::PaletteEntry>>("entries")?,
diff --git a/libs/cua/crates/cua-spaces-app-core/src/machines.rs b/libs/cua/crates/cua-spaces-app-core/src/machines.rs
index dbdbeb31a9..a842360e95 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/machines.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/machines.rs
@@ -25,9 +25,21 @@
//! relay sees it connected. A device that matches no machine is listed on
//! its own, marked `device_only`: it is not a host, so New Space's "Run
//! on" never offers it.
+//!
+//! [`page_rows`] is the whole Machines page from what a shell has: this
+//! machine, the machines its Spaces list shows (a machine sharing its own
+//! desktop, `relay:<machine>`, and a machine that provides Spaces), what
+//! the relay says of each, and the account's devices, merged. Every UI
+//! (the SwiftUI app, the web UI in the Mac app and in Electron) lists
+//! these rows.
+
+use std::collections::HashMap;
use serde::{Deserialize, Serialize};
+use crate::host::THIS_MACHINE_ID;
+use crate::model::{Space, SpaceOs, SpaceProvider, SpaceStatus};
+
/// A device whose last session is this recent counts as online.
pub const DEVICE_ONLINE_SECS: u64 = 15 * 60;
@@ -290,6 +302,247 @@ pub fn run_on_ids(rows: &[MachineOut]) -> Vec<String> {
.collect()
}
+/// What [`page_rows`] reads: what a shell knows of its machines.
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MachinesPageInput {
+ /// The system this app runs on (names the first row "This Mac").
+ #[serde(default = "this_host_os")]
+ pub host_os: SpaceOs,
+ /// The Spaces list as the shell has it (registry rows as Spaces).
+ #[serde(default)]
+ pub spaces: Vec<Space>,
+ /// The account's devices (none while signed out).
+ #[serde(default)]
+ pub devices: Vec<DeviceIn>,
+ /// The hostname each machine's cua-spacesd reported, by machine id.
+ #[serde(default)]
+ pub hostnames: std::collections::HashMap<String, String>,
+ /// Whether the relay sees each machine connected now, by machine id.
+ #[serde(default)]
+ pub presence: std::collections::HashMap<String, bool>,
+ /// Unix seconds.
+ #[serde(default)]
+ pub now: u64,
+}
+
+fn this_host_os() -> SpaceOs {
+ SpaceOs::Macos
+}
+
+impl Default for MachinesPageInput {
+ fn default() -> Self {
+ Self {
+ host_os: this_host_os(),
+ spaces: vec![],
+ devices: vec![],
+ hostnames: HashMap::new(),
+ presence: HashMap::new(),
+ now: 0,
+ }
+ }
+}
+
+/// One row of the Machines page.
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MachinePageRow {
+ /// The machine's id (`this-mac`, a relay machine id), or the device's
+ /// id for a device of its own.
+ pub id: String,
+ /// What the page calls it.
+ pub name: String,
+ /// Reached, connected to the relay, or (a device of its own) in a
+ /// session in the last [`DEVICE_ONLINE_SECS`].
+ pub online: bool,
+ /// `macos`, `linux`, `windows`, or empty when unknown.
+ pub os: String,
+ /// `local` (this machine) or `relay`.
+ pub via: String,
+ /// The machine this app runs on.
+ pub current: bool,
+ /// The device listed in this row, if any.
+ pub device: Option<String>,
+ /// A device that is none of the machines: listed, never a "Run on"
+ /// choice, and it has no Spaces or desktop of its own here.
+ pub device_only: bool,
+ /// The Spaces list's row that is this machine's own desktop
+ /// (`this-mac`, `relay:<machine>`), when there is one: the classic
+ /// UI's detail for it.
+ pub space_id: Option<String>,
+ /// Online, but its owner stopped sharing it.
+ pub stopped_sharing: bool,
+ /// The device's last session (Unix seconds), when it has a device.
+ pub last_seen: Option<u64>,
+}
+
+/// A Space's error says its machine refused because its owner stopped
+/// sharing it (the web UI's `STOPPED_SHARING_ERROR`).
+fn says_stopped_sharing(space: &Space) -> bool {
+ space
+ .sdk
+ .as_ref()
+ .and_then(|s| s.error.as_deref())
+ .is_some_and(|e| e.to_lowercase().contains("stopped sharing"))
+}
+
+/// The machine whose own desktop `space` is (`relay:<machine>`, no host
+/// above it), if it is one.
+fn own_desktop(space: &Space) -> Option<&str> {
+ if space.provider != Some(SpaceProvider::Relay) || space.host.is_some() {
+ return None;
+ }
+ space
+ .id
+ .strip_prefix("relay:")
+ .filter(|own| !own.is_empty() && !own.contains('/') && !own.starts_with("space-"))
+}
+
+/// A Space's system as a machine's `os`: empty when unknown, so it never
+/// keeps a machine and its device apart.
+fn os_word(os: SpaceOs) -> String {
+ match os {
+ SpaceOs::Unknown => String::new(),
+ os => os.as_str().into(),
+ }
+}
+
+/// The Machines page: this machine first, then the machines the Spaces
+/// list shows (in its order), then the account's devices that are none
+/// of them; each computer once ([`merge`]).
+pub fn page_rows(input: &MachinesPageInput) -> Vec<MachinePageRow> {
+ struct Extra {
+ via: &'static str,
+ space_id: Option<String>,
+ stopped_sharing: bool,
+ }
+ let mut machines = vec![MachineIn {
+ id: THIS_MACHINE_ID.into(),
+ name: input.host_os.this_machine().into(),
+ online: true,
+ os: os_word(input.host_os),
+ current: true,
+ ..Default::default()
+ }];
+ let mut extra = vec![Extra {
+ via: "local",
+ space_id: input
+ .spaces
+ .iter()
+ .find(|s| s.id == THIS_MACHINE_ID)
+ .map(|s| s.id.clone()),
+ stopped_sharing: false,
+ }];
+ for space in &input.spaces {
+ if let Some(own) = own_desktop(space) {
+ // A machine that refused because its owner stopped sharing it
+ // is connected (that is how it refused), not offline.
+ let stopped = says_stopped_sharing(space);
+ let online =
+ matches!(space.status, SpaceStatus::Running | SpaceStatus::Local) || stopped;
+ let row = MachineIn {
+ id: own.into(),
+ name: space.name.clone(),
+ online,
+ os: os_word(space.os),
+ ..Default::default()
+ };
+ let e = Extra {
+ via: "relay",
+ space_id: Some(space.id.clone()),
+ stopped_sharing: stopped,
+ };
+ match machines.iter().position(|m| m.id == own) {
+ Some(i) if !machines[i].current => {
+ machines[i] = row;
+ extra[i] = e;
+ }
+ Some(_) => {}
+ None => {
+ machines.push(row);
+ extra.push(e);
+ }
+ }
+ continue;
+ }
+ let Some(host) = space.host.as_deref().filter(|h| !h.is_empty()) else {
+ continue;
+ };
+ if machines.iter().any(|m| m.id == host) {
+ continue;
+ }
+ machines.push(MachineIn {
+ id: host.into(),
+ name: space.host_name.clone().unwrap_or_else(|| host.into()),
+ online: true,
+ ..Default::default()
+ });
+ extra.push(Extra {
+ via: "relay",
+ space_id: None,
+ stopped_sharing: false,
+ });
+ }
+ for m in machines.iter_mut() {
+ if let Some(h) = input.hostnames.get(&m.id).filter(|h| !h.is_empty()) {
+ m.hostname = Some(h.clone());
+ }
+ if !m.current {
+ m.presence = input.presence.get(&m.id).copied();
+ }
+ }
+ let merged = merge(&MachinesInput {
+ machines: machines.clone(),
+ devices: input.devices.clone(),
+ now: input.now,
+ });
+ merged
+ .into_iter()
+ .map(|r| {
+ let device = r
+ .device
+ .as_deref()
+ .and_then(|d| input.devices.iter().find(|x| x.id == d));
+ let last_seen = device.and_then(|d| d.last_seen);
+ if r.device_only {
+ return MachinePageRow {
+ os: device.map(|d| platform_os(&d.platform)).unwrap_or_default(),
+ via: "relay".into(),
+ space_id: None,
+ stopped_sharing: false,
+ last_seen,
+ id: r.id,
+ name: r.name,
+ online: r.online,
+ current: false,
+ device: r.device,
+ device_only: true,
+ };
+ }
+ let i = machines.iter().position(|m| m.id == r.id).unwrap_or(0);
+ let m = &machines[i];
+ let os = if m.os.is_empty() {
+ device.map(|d| platform_os(&d.platform)).unwrap_or_default()
+ } else {
+ m.os.clone()
+ };
+ MachinePageRow {
+ os,
+ via: extra[i].via.into(),
+ space_id: extra[i].space_id.clone(),
+ stopped_sharing: extra[i].stopped_sharing,
+ last_seen,
+ id: r.id,
+ name: r.name,
+ online: r.online,
+ current: r.current,
+ device: r.device,
+ device_only: false,
+ }
+ })
+ .collect()
+}
+
#[cfg(test)]
mod tests {
use super::*;
@@ -469,6 +722,89 @@ mod tests {
assert_eq!(run_on_ids(&rows), ["m1"]);
}
+ 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()
+ }
+
+ #[test]
+ fn the_page_lists_this_machine_its_machines_and_devices_of_their_own() {
+ let mut current = device("dev_me", "juno-2.example.com");
+ current.current = true;
+ let rows = page_rows(&MachinesPageInput {
+ spaces: vec![
+ space(
+ serde_json::json!({"id": "this-mac", "name": "This Mac", "os": "macos", "status": "local"}),
+ ),
+ space(
+ serde_json::json!({"id": "local:fbd1", "name": "fbd1", "status": "suspended", "provider": "local"}),
+ ),
+ // A machine sharing its desktop; its system unknown.
+ space(serde_json::json!({
+ "id": "relay:b695", "name": "studio.local", "os": "unknown",
+ "status": "suspended", "provider": "relay",
+ "sdk": {"features": [], "spacesdVersion": "", "reachable": false,
+ "error": "unauthenticated: studio.local stopped sharing: ask its owner"}
+ })),
+ // A Space a machine provides, with no row of its own.
+ space(serde_json::json!({
+ "id": "relay:m-mini/space-1", "name": "dev box", "status": "running",
+ "provider": "relay", "host": "m-mini", "hostName": "Spare mini"
+ })),
+ ],
+ devices: vec![
+ current,
+ device("dev_s", "studio.local"),
+ device("dev_lap", "Laptop"),
+ ],
+ presence: [("m-mini".to_string(), false)].into(),
+ now: NOW,
+ ..Default::default()
+ });
+ let lines: Vec<String> = rows
+ .iter()
+ .map(|r| {
+ format!(
+ "{} {} {} {} {:?} {:?} {}",
+ r.name, r.via, r.os, r.online, r.device, r.space_id, r.device_only
+ )
+ })
+ .collect();
+ assert_eq!(
+ lines,
+ [
+ "This Mac local macos true Some(\"dev_me\") Some(\"this-mac\") false",
+ // Unknown system, same name: one computer; online, since it
+ // refused because its owner stopped sharing.
+ "studio.local relay macos true Some(\"dev_s\") Some(\"relay:b695\") false",
+ "Spare mini relay true None None false",
+ "Laptop relay macos false Some(\"dev_lap\") None true",
+ ]
+ );
+ assert!(rows[1].stopped_sharing);
+ assert_eq!(rows[3].last_seen, Some(NOW - 3_600));
+ assert_eq!(run_on_ids(&merge_rows(&rows)), ["b695", "m-mini"]);
+ }
+
+ fn merge_rows(rows: &[MachinePageRow]) -> Vec<MachineOut> {
+ rows.iter()
+ .map(|r| MachineOut {
+ id: r.id.clone(),
+ name: r.name.clone(),
+ online: r.online,
+ device: r.device.clone(),
+ device_only: r.device_only,
+ current: r.current,
+ })
+ .collect()
+ }
+
/// Every "Run on" choice the page makes from the merged rows is a
/// machine `on="host:<id>"` resolves (a relay machine's id), never a
/// device's.
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 5e80d2ce2e..fe295b8340 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/parity.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/parity.rs
@@ -202,6 +202,11 @@ pub const FLOWS: &[(&str, &str, &str)] = &[
include_str!("../parity/machines.json"),
include_str!("../parity/golden/machines.json"),
),
+ (
+ "checklist",
+ include_str!("../parity/checklist.json"),
+ include_str!("../parity/golden/checklist.json"),
+ ),
];
/// The core calls a flow makes, over JSON. A host implements it with its
@@ -1902,6 +1907,7 @@ pub fn run(name: &str, flow_json: &str, h: &dyn Host) -> Result<Value, String> {
"experiments" => run_experiments(&flow, h),
"placement-picker" => run_placement_picker(&flow, h),
"machines" => run_machines(&flow, h),
+ "checklist" => run_checklist(&flow, h),
other => Err(format!("unknown flow {other}")),
}
}
@@ -2950,9 +2956,111 @@ fn run_machines(f: &Value, h: &dyn Host) -> Result<Value, String> {
.collect();
frames.push(json!({ "case": case["name"], "rows": lines, "runOn": run_on }));
}
+ for page in f["pages"].as_array().into_iter().flatten() {
+ let rows = c(h, "machines.pageRows", json!({ "input": page["input"] }))?;
+ frames.push(json!({ "page": page["name"], "rows": page_lines(&rows) }));
+ }
Ok(json!({ "flow": "machines", "frames": frames }))
}
+/// 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, and whether it stopped sharing.
+fn page_lines(rows: &Value) -> Vec<String> {
+ rows.as_array()
+ .into_iter()
+ .flatten()
+ .map(|r| {
+ let state = if r["online"].as_bool() == Some(true) {
+ "online"
+ } else {
+ "offline"
+ };
+ let mut line = format!(
+ "{} [{}] {} {} {state}",
+ str_of(&r["name"]),
+ str_of(&r["id"]),
+ str_of(&r["via"]),
+ if str_of(&r["os"]).is_empty() {
+ "?"
+ } else {
+ str_of(&r["os"])
+ },
+ );
+ if r["current"].as_bool() == Some(true) {
+ line.push_str(" (this machine)");
+ }
+ match (r["deviceOnly"].as_bool(), r["device"].as_str()) {
+ (Some(true), _) => line.push_str(" (a device)"),
+ (_, Some(d)) => line.push_str(&format!(" + {d}")),
+ _ => {}
+ }
+ if let Some(s) = r["spaceId"].as_str() {
+ line.push_str(&format!(" desktop {s}"));
+ }
+ if r["stoppedSharing"].as_bool() == Some(true) {
+ line.push_str(" (stopped sharing)");
+ }
+ line
+ })
+ .collect()
+}
+
+/// The checklist for each case: the Machines page from the case's page
+/// input, what `checklist.observeFrom` reads from it and the case's Spaces
+/// and agents, the count after that observation on the stored progress,
+/// and after merging progress kept elsewhere before.
+fn run_checklist(f: &Value, h: &dyn Host) -> Result<Value, String> {
+ let mut frames = Vec::new();
+ for case in f["cases"].as_array().into_iter().flatten() {
+ let rows = c(h, "machines.pageRows", json!({ "input": case["page"] }))?;
+ let seen = json!({
+ "machines": rows,
+ "spaces": case["page"]["spaces"],
+ "agents": case["agents"],
+ "runs": case["runs"],
+ });
+ let action = c(h, "checklist.observeFrom", json!({ "seen": seen }))?;
+ let t = c(
+ h,
+ "checklist.reduce",
+ json!({ "state": case["state"], "action": action }),
+ )?;
+ let view = c(h, "checklist.view", json!({ "state": t["state"] }))?;
+ let events: Vec<&str> = t["signals"]
+ .as_array()
+ .into_iter()
+ .flatten()
+ .map(|s| str_of(&s["step"]))
+ .collect();
+ let mut frame = json!({
+ "case": case["name"],
+ "observe": {
+ "otherMachine": action["otherMachine"],
+ "hasSpace": action["hasSpace"],
+ "agentRan": action["agentRan"],
+ },
+ "progress": view["progress"],
+ "events": events,
+ });
+ if !case["earlier"].is_null() {
+ let merged = c(
+ h,
+ "checklist.reduce",
+ json!({ "state": t["state"], "action": { "type": "merge", "state": case["earlier"] } }),
+ )?;
+ let view = c(h, "checklist.view", json!({ "state": merged["state"] }))?;
+ frame["merged"] = json!({
+ "progress": view["progress"],
+ "visible": view["visible"],
+ "events": merged["signals"].as_array().map_or(0, |s| s.len()),
+ });
+ }
+ frames.push(frame);
+ }
+ Ok(json!({ "flow": "checklist", "frames": frames }))
+}
+
fn run_space_facts(f: &Value, h: &dyn Host) -> Result<Value, String> {
let mut frames = Vec::new();
for case in f["cases"].as_array().into_iter().flatten() {
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 8ace26fa18..bd0debaa07 100644
--- a/libs/cua/crates/cua-spaces-ffi/src/app_core.rs
+++ b/libs/cua/crates/cua-spaces-ffi/src/app_core.rs
@@ -2497,6 +2497,31 @@ pub fn app_checklist_reduce(
core::checklist::reduce(&state, &action)
}
+/// What the app shows as the checklist's `Observe` (every UI the same).
+#[uniffi::export]
+pub fn app_checklist_observe_from(seen: AppChecklistSeen) -> AppChecklistAction {
+ core::checklist::observe_from(&seen)
+}
+
+/// The Machines page's rows: this machine, your machines, your devices of
+/// their own, each computer once.
+#[uniffi::export]
+pub fn app_machines_page_rows(input: AppMachinesPageInput) -> Vec<AppMachinePageRow> {
+ core::machines::page_rows(&input)
+}
+
+/// Machines page input from JSON (fixtures, parity flows).
+#[uniffi::export]
+pub fn app_machines_page_input_from_json(json: String) -> Result<AppMachinesPageInput> {
+ from_json("machines page input", &json)
+}
+
+/// Checklist state from JSON, steps as words (fixtures, parity flows).
+#[uniffi::export]
+pub fn app_checklist_state_from_json(json: String) -> Result<AppChecklistState> {
+ from_json("checklist state", &json)
+}
+
/// The getting-started checklist as drawn.
#[uniffi::export]
pub fn app_checklist_view(state: AppChecklistState) -> AppChecklistView {
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 5deecc6544..fc8c800851 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
@@ -9055,6 +9055,75 @@ pub enum AppTelemetrySignal {
},
}
+/// One of the account's devices.
+pub type AppDeviceIn = core::machines::DeviceIn;
+#[uniffi::remote(Record)]
+pub struct AppDeviceIn {
+ /// `dev_…`.
+ pub id: String,
+ /// Its name (by default its hostname).
+ pub name: String,
+ /// `macos`, `windows`, `linux` (any case), or empty.
+ pub platform: String,
+ /// Last session (Unix seconds).
+ pub last_seen: Option<u64>,
+ /// This device.
+ pub current: bool,
+ /// `pending`, `enrolled`, `expired`, `revoked`, or empty.
+ pub state: String,
+}
+
+/// What [`page_rows`] reads: what a shell knows of its machines.
+pub type AppMachinesPageInput = core::machines::MachinesPageInput;
+#[uniffi::remote(Record)]
+pub struct AppMachinesPageInput {
+ /// The system this app runs on (names the first row "This Mac").
+ pub host_os: AppSpaceOs,
+ /// The Spaces list as the shell has it (registry rows as Spaces).
+ pub spaces: Vec<AppSpace>,
+ /// The account's devices (none while signed out).
+ pub devices: Vec<AppDeviceIn>,
+ /// The hostname each machine's cua-spacesd reported, by machine id.
+ pub hostnames: std::collections::HashMap<String, String>,
+ /// Whether the relay sees each machine connected now, by machine id.
+ pub presence: std::collections::HashMap<String, bool>,
+ /// Unix seconds.
+ pub now: u64,
+}
+
+/// One row of the Machines page.
+pub type AppMachinePageRow = core::machines::MachinePageRow;
+#[uniffi::remote(Record)]
+pub struct AppMachinePageRow {
+ /// The machine's id (`this-mac`, a relay machine id), or the device's
+ /// id for a device of its own.
+ pub id: String,
+ /// What the page calls it.
+ pub name: String,
+ /// Reached, connected to the relay, or (a device of its own) in a
+ /// session in the last [`DEVICE_ONLINE_SECS`].
+ pub online: bool,
+ /// `macos`, `linux`, `windows`, or empty when unknown.
+ pub os: String,
+ /// `local` (this machine) or `relay`.
+ pub via: String,
+ /// The machine this app runs on.
+ pub current: bool,
+ /// The device listed in this row, if any.
+ pub device: Option<String>,
+ /// A device that is none of the machines: listed, never a "Run on"
+ /// choice, and it has no Spaces or desktop of its own here.
+ pub device_only: bool,
+ /// The Spaces list's row that is this machine's own desktop
+ /// (`this-mac`, `relay:<machine>`), when there is one: the classic
+ /// UI's detail for it.
+ pub space_id: Option<String>,
+ /// Online, but its owner stopped sharing it.
+ pub stopped_sharing: bool,
+ /// The device's last session (Unix seconds), when it has a device.
+ pub last_seen: Option<u64>,
+}
+
/// One step, in the order the checklist lists them
/// ([`telemetry::CHECKLIST_STEPS`]).
pub type AppChecklistStep = core::checklist::ChecklistStep;
@@ -9108,6 +9177,28 @@ pub enum AppChecklistAction {
/// An agent exists or has run.
agent_ran: bool,
},
+ /// Progress kept elsewhere before (the web UI's own storage, another
+ /// copy of the file): its steps are ticked, and it stays closed or
+ /// shown if it was. Its events were recorded where it was ticked, so
+ /// none are recorded again.
+ Merge {
+ /// The other copy.
+ state: AppChecklistState,
+ },
+}
+
+/// What the app knows, for [`observe_from`].
+pub type AppChecklistSeen = core::checklist::ChecklistSeen;
+#[uniffi::remote(Record)]
+pub struct AppChecklistSeen {
+ /// The Machines page's rows ([`crate::machines::page_rows`]).
+ pub machines: Vec<AppMachinePageRow>,
+ /// The Spaces list.
+ pub spaces: Vec<AppSpace>,
+ /// Persistent agents listed.
+ pub agents: u32,
+ /// Agent runs listed in any Space.
+ pub runs: u32,
}
/// The state after an action and the usage events it means.
diff --git a/libs/cua/scripts/generate-app-core-ffi.py b/libs/cua/scripts/generate-app-core-ffi.py
index 30474a9c72..29ddbfaa48 100644
--- a/libs/cua/scripts/generate-app-core-ffi.py
+++ b/libs/cua/scripts/generate-app-core-ffi.py
@@ -65,7 +65,8 @@ TYPES = [
("drive_page.rs", "drive_page", ["DriveRequestInput", "DriveGrantInput", "DriveDeviceInput", "DriveConflictInput", "DriveSyncInput", "DriveInput", "DriveRequest", "DriveState", "DriveAction", "ConflictView", "DriveView"]),
("notifications.rs", "notifications", ["NotificationInput", "SystemNote", "NotificationsPlan", "NotificationsView"]),
("telemetry.rs", "telemetry", ["TelemetrySignal"]),
- ("checklist.rs", "checklist", ["ChecklistStep", "ChecklistState", "ChecklistAction", "ChecklistTransition", "ChecklistRow", "ChecklistView"]),
+ ("machines.rs", "machines", ["DeviceIn", "MachinesPageInput", "MachinePageRow"]),
+ ("checklist.rs", "checklist", ["ChecklistStep", "ChecklistState", "ChecklistAction", "ChecklistSeen", "ChecklistTransition", "ChecklistRow", "ChecklistView"]),
("palette.rs", "palette", ["Keybinding", "PaletteEntry"]),
("relay_usage.rs", "relay_usage", ["RelayUsageTeam", "RelayUsage", "RelayAllowanceNotice", "RelayUsageView"]),
]
diff --git a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
index dd7c984335..3cbc7558d5 100644
--- a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
+++ b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
@@ -6652,6 +6652,92 @@ public func FfiConverterTypeAppChecklistRow_lower(_ value: AppChecklistRow) -> R
}
+public struct AppChecklistSeen: Equatable, Hashable {
+ /**
+ * The Machines page's rows ([`crate::machines::page_rows`]).
+ */
+ public var machines: [AppMachinePageRow]
+ /**
+ * The Spaces list.
+ */
+ public var spaces: [AppSpace]
+ /**
+ * Persistent agents listed.
+ */
+ public var agents: UInt32
+ /**
+ * Agent runs listed in any Space.
+ */
+ public var runs: UInt32
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ /**
+ * The Machines page's rows ([`crate::machines::page_rows`]).
+ */machines: [AppMachinePageRow],
+ /**
+ * The Spaces list.
+ */spaces: [AppSpace],
+ /**
+ * Persistent agents listed.
+ */agents: UInt32,
+ /**
+ * Agent runs listed in any Space.
+ */runs: UInt32) {
+ self.machines = machines
+ self.spaces = spaces
+ self.agents = agents
+ self.runs = runs
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension AppChecklistSeen: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeAppChecklistSeen: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppChecklistSeen {
+ return
+ try AppChecklistSeen(
+ machines: FfiConverterSequenceTypeAppMachinePageRow.read(from: &buf),
+ spaces: FfiConverterSequenceTypeAppSpace.read(from: &buf),
+ agents: FfiConverterUInt32.read(from: &buf),
+ runs: FfiConverterUInt32.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: AppChecklistSeen, into buf: inout [UInt8]) {
+ FfiConverterSequenceTypeAppMachinePageRow.write(value.machines, into: &buf)
+ FfiConverterSequenceTypeAppSpace.write(value.spaces, into: &buf)
+ FfiConverterUInt32.write(value.agents, into: &buf)
+ FfiConverterUInt32.write(value.runs, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppChecklistSeen_lift(_ buf: RustBuffer) throws -> AppChecklistSeen {
+ return try FfiConverterTypeAppChecklistSeen.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppChecklistSeen_lower(_ value: AppChecklistSeen) -> RustBuffer {
+ return FfiConverterTypeAppChecklistSeen.lower(value)
+}
+
+
public struct AppChecklistState: Equatable, Hashable {
/**
* Steps done, each once, in checklist order.
@@ -10080,6 +10166,112 @@ public func FfiConverterTypeAppDeviceConfirm_lower(_ value: AppDeviceConfirm) ->
}
+public struct AppDeviceIn: Equatable, Hashable {
+ /**
+ * `dev_…`.
+ */
+ public var id: String
+ /**
+ * Its name (by default its hostname).
+ */
+ public var name: String
+ /**
+ * `macos`, `windows`, `linux` (any case), or empty.
+ */
+ public var platform: String
+ /**
+ * Last session (Unix seconds).
+ */
+ public var lastSeen: UInt64?
+ /**
+ * This device.
+ */
+ public var current: Bool
+ /**
+ * `pending`, `enrolled`, `expired`, `revoked`, or empty.
+ */
+ public var state: String
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ /**
+ * `dev_…`.
+ */id: String,
+ /**
+ * Its name (by default its hostname).
+ */name: String,
+ /**
+ * `macos`, `windows`, `linux` (any case), or empty.
+ */platform: String,
+ /**
+ * Last session (Unix seconds).
+ */lastSeen: UInt64?,
+ /**
+ * This device.
+ */current: Bool,
+ /**
+ * `pending`, `enrolled`, `expired`, `revoked`, or empty.
+ */state: String) {
+ self.id = id
+ self.name = name
+ self.platform = platform
+ self.lastSeen = lastSeen
+ self.current = current
+ self.state = state
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension AppDeviceIn: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeAppDeviceIn: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppDeviceIn {
+ return
+ try AppDeviceIn(
+ id: FfiConverterString.read(from: &buf),
+ name: FfiConverterString.read(from: &buf),
+ platform: FfiConverterString.read(from: &buf),
+ lastSeen: FfiConverterOptionUInt64.read(from: &buf),
+ current: FfiConverterBool.read(from: &buf),
+ state: FfiConverterString.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: AppDeviceIn, into buf: inout [UInt8]) {
+ FfiConverterString.write(value.id, into: &buf)
+ FfiConverterString.write(value.name, into: &buf)
+ FfiConverterString.write(value.platform, into: &buf)
+ FfiConverterOptionUInt64.write(value.lastSeen, into: &buf)
+ FfiConverterBool.write(value.current, into: &buf)
+ FfiConverterString.write(value.state, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppDeviceIn_lift(_ buf: RustBuffer) throws -> AppDeviceIn {
+ return try FfiConverterTypeAppDeviceIn.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppDeviceIn_lower(_ value: AppDeviceIn) -> RustBuffer {
+ return FfiConverterTypeAppDeviceIn.lower(value)
+}
+
+
public struct AppDeviceInput: Equatable, Hashable {
/**
* `dev_…`.
@@ -18474,6 +18666,278 @@ public func FfiConverterTypeAppMachineInput_lower(_ value: AppMachineInput) -> R
}
+public struct AppMachinePageRow: Equatable, Hashable {
+ /**
+ * The machine's id (`this-mac`, a relay machine id), or the device's
+ * id for a device of its own.
+ */
+ public var id: String
+ /**
+ * What the page calls it.
+ */
+ public var name: String
+ /**
+ * Reached, connected to the relay, or (a device of its own) in a
+ * session in the last [`DEVICE_ONLINE_SECS`].
+ */
+ public var online: Bool
+ /**
+ * `macos`, `linux`, `windows`, or empty when unknown.
+ */
+ public var os: String
+ /**
+ * `local` (this machine) or `relay`.
+ */
+ public var via: String
+ /**
+ * The machine this app runs on.
+ */
+ public var current: Bool
+ /**
+ * The device listed in this row, if any.
+ */
+ public var device: String?
+ /**
+ * A device that is none of the machines: listed, never a "Run on"
+ * choice, and it has no Spaces or desktop of its own here.
+ */
+ public var deviceOnly: Bool
+ /**
+ * The Spaces list's row that is this machine's own desktop
+ * (`this-mac`, `relay:<machine>`), when there is one: the classic
+ * UI's detail for it.
+ */
+ public var spaceId: String?
+ /**
+ * Online, but its owner stopped sharing it.
+ */
+ public var stoppedSharing: Bool
+ /**
+ * The device's last session (Unix seconds), when it has a device.
+ */
+ public var lastSeen: UInt64?
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ /**
+ * The machine's id (`this-mac`, a relay machine id), or the device's
+ * id for a device of its own.
+ */id: String,
+ /**
+ * What the page calls it.
+ */name: String,
+ /**
+ * Reached, connected to the relay, or (a device of its own) in a
+ * session in the last [`DEVICE_ONLINE_SECS`].
+ */online: Bool,
+ /**
+ * `macos`, `linux`, `windows`, or empty when unknown.
+ */os: String,
+ /**
+ * `local` (this machine) or `relay`.
+ */via: String,
+ /**
+ * The machine this app runs on.
+ */current: Bool,
+ /**
+ * The device listed in this row, if any.
+ */device: String?,
+ /**
+ * A device that is none of the machines: listed, never a "Run on"
+ * choice, and it has no Spaces or desktop of its own here.
+ */deviceOnly: Bool,
+ /**
+ * The Spaces list's row that is this machine's own desktop
+ * (`this-mac`, `relay:<machine>`), when there is one: the classic
+ * UI's detail for it.
+ */spaceId: String?,
+ /**
+ * Online, but its owner stopped sharing it.
+ */stoppedSharing: Bool,
+ /**
+ * The device's last session (Unix seconds), when it has a device.
+ */lastSeen: UInt64?) {
+ self.id = id
+ self.name = name
+ self.online = online
+ self.os = os
+ self.via = via
+ self.current = current
+ self.device = device
+ self.deviceOnly = deviceOnly
+ self.spaceId = spaceId
+ self.stoppedSharing = stoppedSharing
+ self.lastSeen = lastSeen
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension AppMachinePageRow: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeAppMachinePageRow: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppMachinePageRow {
+ return
+ try AppMachinePageRow(
+ id: FfiConverterString.read(from: &buf),
+ name: FfiConverterString.read(from: &buf),
+ online: FfiConverterBool.read(from: &buf),
+ os: FfiConverterString.read(from: &buf),
+ via: FfiConverterString.read(from: &buf),
+ current: FfiConverterBool.read(from: &buf),
+ device: FfiConverterOptionString.read(from: &buf),
+ deviceOnly: FfiConverterBool.read(from: &buf),
+ spaceId: FfiConverterOptionString.read(from: &buf),
+ stoppedSharing: FfiConverterBool.read(from: &buf),
+ lastSeen: FfiConverterOptionUInt64.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: AppMachinePageRow, into buf: inout [UInt8]) {
+ FfiConverterString.write(value.id, into: &buf)
+ FfiConverterString.write(value.name, into: &buf)
+ FfiConverterBool.write(value.online, into: &buf)
+ FfiConverterString.write(value.os, into: &buf)
+ FfiConverterString.write(value.via, into: &buf)
+ FfiConverterBool.write(value.current, into: &buf)
+ FfiConverterOptionString.write(value.device, into: &buf)
+ FfiConverterBool.write(value.deviceOnly, into: &buf)
+ FfiConverterOptionString.write(value.spaceId, into: &buf)
+ FfiConverterBool.write(value.stoppedSharing, into: &buf)
+ FfiConverterOptionUInt64.write(value.lastSeen, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinePageRow_lift(_ buf: RustBuffer) throws -> AppMachinePageRow {
+ return try FfiConverterTypeAppMachinePageRow.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinePageRow_lower(_ value: AppMachinePageRow) -> RustBuffer {
+ return FfiConverterTypeAppMachinePageRow.lower(value)
+}
+
+
+public struct AppMachinesPageInput: Equatable, Hashable {
+ /**
+ * The system this app runs on (names the first row "This Mac").
+ */
+ public var hostOs: AppSpaceOs
+ /**
+ * The Spaces list as the shell has it (registry rows as Spaces).
+ */
+ public var spaces: [AppSpace]
+ /**
+ * The account's devices (none while signed out).
+ */
+ public var devices: [AppDeviceIn]
+ /**
+ * The hostname each machine's cua-spacesd reported, by machine id.
+ */
+ public var hostnames: [String: String]
+ /**
+ * Whether the relay sees each machine connected now, by machine id.
+ */
+ public var presence: [String: Bool]
+ /**
+ * Unix seconds.
+ */
+ public var now: UInt64
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ /**
+ * The system this app runs on (names the first row "This Mac").
+ */hostOs: AppSpaceOs,
+ /**
+ * The Spaces list as the shell has it (registry rows as Spaces).
+ */spaces: [AppSpace],
+ /**
+ * The account's devices (none while signed out).
+ */devices: [AppDeviceIn],
+ /**
+ * The hostname each machine's cua-spacesd reported, by machine id.
+ */hostnames: [String: String],
+ /**
+ * Whether the relay sees each machine connected now, by machine id.
+ */presence: [String: Bool],
+ /**
+ * Unix seconds.
+ */now: UInt64) {
+ self.hostOs = hostOs
+ self.spaces = spaces
+ self.devices = devices
+ self.hostnames = hostnames
+ self.presence = presence
+ self.now = now
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension AppMachinesPageInput: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeAppMachinesPageInput: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppMachinesPageInput {
+ return
+ try AppMachinesPageInput(
+ hostOs: FfiConverterTypeAppSpaceOs.read(from: &buf),
+ spaces: FfiConverterSequenceTypeAppSpace.read(from: &buf),
+ devices: FfiConverterSequenceTypeAppDeviceIn.read(from: &buf),
+ hostnames: FfiConverterDictionaryStringString.read(from: &buf),
+ presence: FfiConverterDictionaryStringBool.read(from: &buf),
+ now: FfiConverterUInt64.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: AppMachinesPageInput, into buf: inout [UInt8]) {
+ FfiConverterTypeAppSpaceOs.write(value.hostOs, into: &buf)
+ FfiConverterSequenceTypeAppSpace.write(value.spaces, into: &buf)
+ FfiConverterSequenceTypeAppDeviceIn.write(value.devices, into: &buf)
+ FfiConverterDictionaryStringString.write(value.hostnames, into: &buf)
+ FfiConverterDictionaryStringBool.write(value.presence, into: &buf)
+ FfiConverterUInt64.write(value.now, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesPageInput_lift(_ buf: RustBuffer) throws -> AppMachinesPageInput {
+ return try FfiConverterTypeAppMachinesPageInput.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachinesPageInput_lower(_ value: AppMachinesPageInput) -> RustBuffer {
+ return FfiConverterTypeAppMachinesPageInput.lower(value)
+}
+
+
public struct AppMainChrome: Equatable, Hashable {
/**
* Window title when nothing is selected.
@@ -42602,6 +43066,17 @@ public enum AppChecklistAction: Equatable, Hashable {
* An agent exists or has run.
*/agentRan: Bool
)
+ /**
+ * Progress kept elsewhere before (the web UI's own storage, another
+ * copy of the file): its steps are ticked, and it stays closed or
+ * shown if it was. Its events were recorded where it was ticked, so
+ * none are recorded again.
+ */
+ case merge(
+ /**
+ * The other copy.
+ */state: AppChecklistState
+ )
@@ -42635,6 +43110,9 @@ public struct FfiConverterTypeAppChecklistAction: FfiConverterRustBuffer {
case 5: return .observe(otherMachine: try FfiConverterBool.read(from: &buf), hasSpace: try FfiConverterBool.read(from: &buf), agentRan: try FfiConverterBool.read(from: &buf)
)
+ case 6: return .merge(state: try FfiConverterTypeAppChecklistState.read(from: &buf)
+ )
+
default: throw UniffiInternalError.unexpectedEnumCase
}
}
@@ -42666,6 +43144,11 @@ public struct FfiConverterTypeAppChecklistAction: FfiConverterRustBuffer {
FfiConverterBool.write(hasSpace, into: &buf)
FfiConverterBool.write(agentRan, into: &buf)
+
+ case let .merge(state):
+ writeInt(&buf, Int32(6))
+ FfiConverterTypeAppChecklistState.write(state, into: &buf)
+
}
}
}
@@ -59215,6 +59698,31 @@ fileprivate struct FfiConverterSequenceTypeAppDetailAction: FfiConverterRustBuff
}
}
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+fileprivate struct FfiConverterSequenceTypeAppDeviceIn: FfiConverterRustBuffer {
+ typealias SwiftType = [AppDeviceIn]
+
+ public static func write(_ value: [AppDeviceIn], into buf: inout [UInt8]) {
+ let len = Int32(value.count)
+ writeInt(&buf, len)
+ for item in value {
+ FfiConverterTypeAppDeviceIn.write(item, into: &buf)
+ }
+ }
+
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [AppDeviceIn] {
+ let len: Int32 = try readInt(&buf)
+ var seq = [AppDeviceIn]()
+ seq.reserveCapacity(Int(len))
+ for _ in 0 ..< len {
+ seq.append(try FfiConverterTypeAppDeviceIn.read(from: &buf))
+ }
+ return seq
+ }
+}
+
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
@@ -59990,6 +60498,31 @@ fileprivate struct FfiConverterSequenceTypeAppMachineInput: FfiConverterRustBuff
}
}
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+fileprivate struct FfiConverterSequenceTypeAppMachinePageRow: FfiConverterRustBuffer {
+ typealias SwiftType = [AppMachinePageRow]
+
+ public static func write(_ value: [AppMachinePageRow], into buf: inout [UInt8]) {
+ let len = Int32(value.count)
+ writeInt(&buf, len)
+ for item in value {
+ FfiConverterTypeAppMachinePageRow.write(item, into: &buf)
+ }
+ }
+
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [AppMachinePageRow] {
+ let len: Int32 = try readInt(&buf)
+ var seq = [AppMachinePageRow]()
+ seq.reserveCapacity(Int(len))
+ for _ in 0 ..< len {
+ seq.append(try FfiConverterTypeAppMachinePageRow.read(from: &buf))
+ }
+ return seq
+ }
+}
+
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
@@ -62315,6 +62848,32 @@ fileprivate struct FfiConverterSequenceTypeTeleportSensitiveGroup: FfiConverterR
}
}
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+fileprivate struct FfiConverterDictionaryStringBool: FfiConverterRustBuffer {
+ public static func write(_ value: [String: Bool], into buf: inout [UInt8]) {
+ let len = Int32(value.count)
+ writeInt(&buf, len)
+ for (key, value) in value {
+ FfiConverterString.write(key, into: &buf)
+ FfiConverterBool.write(value, into: &buf)
+ }
+ }
+
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [String: Bool] {
+ let len: Int32 = try readInt(&buf)
+ var dict = [String: Bool]()
+ dict.reserveCapacity(Int(len))
+ for _ in 0..<len {
+ let key = try FfiConverterString.read(from: &buf)
+ let value = try FfiConverterBool.read(from: &buf)
+ dict[key] = value
+ }
+ return dict
+ }
+}
+
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
@@ -62766,6 +63325,16 @@ public func appCatalogEntry(entry: TeleportCatalogEntry) -> AppCatalogEntry {
)
})
}
+/**
+ * What the app shows as the checklist's `Observe` (every UI the same).
+ */
+public func appChecklistObserveFrom(seen: AppChecklistSeen) -> AppChecklistAction {
+ return try! FfiConverterTypeAppChecklistAction_lift(try! rustCall() {
+ uniffi_cua_spaces_ffi_fn_func_app_checklist_observe_from(
+ FfiConverterTypeAppChecklistSeen_lower(seen),$0
+ )
+})
+}
/**
* The getting-started checklist after `action`, and its usage events.
*/
@@ -62777,6 +63346,16 @@ public func appChecklistReduce(state: AppChecklistState, action: AppChecklistAct
)
})
}
+/**
+ * Checklist state from JSON, steps as words (fixtures, parity flows).
+ */
+public func appChecklistStateFromJson(json: String)throws -> AppChecklistState {
+ return try FfiConverterTypeAppChecklistState_lift(try rustCallWithError(FfiConverterTypeCuaError_lift) {
+ uniffi_cua_spaces_ffi_fn_func_app_checklist_state_from_json(
+ FfiConverterString.lower(json),$0
+ )
+})
+}
/**
* The getting-started checklist as drawn.
*/
@@ -63612,6 +64191,27 @@ public func appMachineAccessNotice(kind: AppEnrollmentKind, pendingCode: String?
)
})
}
+/**
+ * Machines page input from JSON (fixtures, parity flows).
+ */
+public func appMachinesPageInputFromJson(json: String)throws -> AppMachinesPageInput {
+ return try FfiConverterTypeAppMachinesPageInput_lift(try rustCallWithError(FfiConverterTypeCuaError_lift) {
+ uniffi_cua_spaces_ffi_fn_func_app_machines_page_input_from_json(
+ FfiConverterString.lower(json),$0
+ )
+})
+}
+/**
+ * The Machines page's rows: this machine, your machines, your devices of
+ * their own, each computer once.
+ */
+public func appMachinesPageRows(input: AppMachinesPageInput) -> [AppMachinePageRow] {
+ return try! FfiConverterSequenceTypeAppMachinePageRow.lift(try! rustCall() {
+ uniffi_cua_spaces_ffi_fn_func_app_machines_page_rows(
+ FfiConverterTypeAppMachinesPageInput_lower(input),$0
+ )
+})
+}
/**
* The main window's chrome (account line, New Space, empty state).
*/
@@ -65677,9 +66277,15 @@ private let initializationResult: InitializationResult = {
if (uniffi_cua_spaces_ffi_checksum_func_app_catalog_entry() != 56759) {
return InitializationResult.apiChecksumMismatch
}
+ if (uniffi_cua_spaces_ffi_checksum_func_app_checklist_observe_from() != 5363) {
+ return InitializationResult.apiChecksumMismatch
+ }
if (uniffi_cua_spaces_ffi_checksum_func_app_checklist_reduce() != 46431) {
return InitializationResult.apiChecksumMismatch
}
+ if (uniffi_cua_spaces_ffi_checksum_func_app_checklist_state_from_json() != 52352) {
+ return InitializationResult.apiChecksumMismatch
+ }
if (uniffi_cua_spaces_ffi_checksum_func_app_checklist_view() != 58453) {
return InitializationResult.apiChecksumMismatch
}
@@ -65917,6 +66523,12 @@ private let initializationResult: InitializationResult = {
if (uniffi_cua_spaces_ffi_checksum_func_app_machine_access_notice() != 55788) {
return InitializationResult.apiChecksumMismatch
}
+ if (uniffi_cua_spaces_ffi_checksum_func_app_machines_page_input_from_json() != 21812) {
+ return InitializationResult.apiChecksumMismatch
+ }
+ if (uniffi_cua_spaces_ffi_checksum_func_app_machines_page_rows() != 50072) {
+ 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 677c877e63..4d7b4ad10f 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
@@ -836,11 +836,21 @@ RustBuffer uniffi_cua_spaces_ffi_fn_func_app_catalog_entries_from_json(RustBuffe
RustBuffer uniffi_cua_spaces_ffi_fn_func_app_catalog_entry(RustBuffer entry, RustCallStatus *_Nonnull out_status
);
#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_CHECKLIST_OBSERVE_FROM
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_CHECKLIST_OBSERVE_FROM
+RustBuffer uniffi_cua_spaces_ffi_fn_func_app_checklist_observe_from(RustBuffer seen, RustCallStatus *_Nonnull out_status
+);
+#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_CHECKLIST_REDUCE
#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_CHECKLIST_REDUCE
RustBuffer uniffi_cua_spaces_ffi_fn_func_app_checklist_reduce(RustBuffer state, RustBuffer action, RustCallStatus *_Nonnull out_status
);
#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_CHECKLIST_STATE_FROM_JSON
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_CHECKLIST_STATE_FROM_JSON
+RustBuffer uniffi_cua_spaces_ffi_fn_func_app_checklist_state_from_json(RustBuffer json, RustCallStatus *_Nonnull out_status
+);
+#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_CHECKLIST_VIEW
#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_CHECKLIST_VIEW
RustBuffer uniffi_cua_spaces_ffi_fn_func_app_checklist_view(RustBuffer state, RustCallStatus *_Nonnull out_status
@@ -1247,6 +1257,16 @@ RustBuffer uniffi_cua_spaces_ffi_fn_func_app_login_item_launch_plan(RustBuffer c
RustBuffer uniffi_cua_spaces_ffi_fn_func_app_machine_access_notice(RustBuffer kind, RustBuffer pending_code, RustCallStatus *_Nonnull out_status
);
#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_MACHINES_PAGE_INPUT_FROM_JSON
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_MACHINES_PAGE_INPUT_FROM_JSON
+RustBuffer uniffi_cua_spaces_ffi_fn_func_app_machines_page_input_from_json(RustBuffer json, RustCallStatus *_Nonnull out_status
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_MACHINES_PAGE_ROWS
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_MACHINES_PAGE_ROWS
+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_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
@@ -2602,12 +2622,24 @@ uint16_t uniffi_cua_spaces_ffi_checksum_func_app_catalog_entries_from_json(void
#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_CATALOG_ENTRY
uint16_t uniffi_cua_spaces_ffi_checksum_func_app_catalog_entry(void
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_CHECKLIST_OBSERVE_FROM
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_CHECKLIST_OBSERVE_FROM
+uint16_t uniffi_cua_spaces_ffi_checksum_func_app_checklist_observe_from(void
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_CHECKLIST_REDUCE
#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_CHECKLIST_REDUCE
uint16_t uniffi_cua_spaces_ffi_checksum_func_app_checklist_reduce(void
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_CHECKLIST_STATE_FROM_JSON
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_CHECKLIST_STATE_FROM_JSON
+uint16_t uniffi_cua_spaces_ffi_checksum_func_app_checklist_state_from_json(void
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_CHECKLIST_VIEW
@@ -3082,6 +3114,18 @@ uint16_t uniffi_cua_spaces_ffi_checksum_func_app_login_item_launch_plan(void
#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_MACHINE_ACCESS_NOTICE
uint16_t uniffi_cua_spaces_ffi_checksum_func_app_machine_access_notice(void
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_MACHINES_PAGE_INPUT_FROM_JSON
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_MACHINES_PAGE_INPUT_FROM_JSON
+uint16_t uniffi_cua_spaces_ffi_checksum_func_app_machines_page_input_from_json(void
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_MACHINES_PAGE_ROWS
+#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_MAIN_CHROME
diff --git a/scripts/docs-generators/cua-sdk.ts b/scripts/docs-generators/cua-sdk.ts
index 156bbf5afb..d9ca50bcce 100644
--- a/scripts/docs-generators/cua-sdk.ts
+++ b/scripts/docs-generators/cua-sdk.ts
@@ -1104,12 +1104,22 @@ export const PAGES: PageSpec[] = [
prefixes: ['AppShare', 'app_share_', 'AppRoleOption'],
spaces: true,
},
+ {
+ slug: 'spaces/machines-app-core',
+ title: 'Machines page',
+ description: 'The Machines page\'s rows: this machine, your machines and your devices, each computer once.',
+ intro:
+ '`app_machines_page_rows` builds the Machines page from what an app has: the Spaces list (a machine sharing its own desktop, one that provides Spaces), what the relay says of each machine, and the account\'s devices (`AppDeviceIn`). A machine and the device on it are one row; a device that is none of the machines is listed on its own (`device_only`) and is never a Run on choice. Every Spaces UI lists these rows.',
+ items: ['AppDeviceIn'],
+ prefixes: ['AppMachinePageRow', 'AppMachinesPageInput', 'app_machines_'],
+ spaces: true,
+ },
{
slug: 'spaces/app-checklist-palette',
title: 'Getting started and the command palette',
description: 'The getting-started checklist, the command palette\'s ranking and the shared keyboard shortcuts.',
intro:
- 'App core functions beside the [Spaces app core](/cua-sdk/reference/spaces/app-core) screens. `app_checklist_reduce` applies a checklist action (a step done, shown, closed, opened again, or what the app shows now) and returns the new `AppChecklistState` with the usage events it means; `app_checklist_view` derives the rows, title and progress. `app_palette_rank` orders the command palette\'s entries for a query, and `app_keybindings` lists the default keyboard shortcuts the apps share.',
+ 'App core functions beside the [Spaces app core](/cua-sdk/reference/spaces/app-core) screens. The host app keeps the one `AppChecklistState`. `app_checklist_observe_from` reads what the app shows (the [Machines page](/cua-sdk/reference/spaces/machines-app-core) rows, the Spaces, the agents) as the same `Observe` action in every UI. `app_checklist_reduce` applies a checklist action (a step done, shown, closed, opened again, what the app shows now, or progress merged from another copy) and returns the new state with the usage events it means; `app_checklist_view` derives the rows, title and progress. `app_palette_rank` orders the command palette\'s entries for a query, and `app_keybindings` lists the default keyboard shortcuts the apps share.',
items: [],
prefixes: ['AppChecklist', 'app_checklist_', 'AppKeybinding', 'app_keybindings', 'AppPaletteEntry', 'app_palette_'],
spaces: true,