Machines page
The Machines page's rows: this machine, your machines and your devices, each computer once.
The Machines page's rows: this machine, your machines and your devices, each computer once.
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.
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.
| 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.
| Field | Type | Default | Description |
|---|---|---|---|
host_os / hostOs | AppSpaceOs | The system this app runs on (names the first row "This Mac"). | |
spaces | Vec<AppSpace> | The Spaces list as the shell has it (registry rows as Spaces). | |
devices | Vec<AppDeviceIn> | 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).
func appMachinesPageInputFromJson(json: String) throws -> AppMachinesPageInput| Parameter | Type | Default |
|---|---|---|
json | String | required |
Returns AppMachinesPageInput · Raises CuaError
app_machines_page_rows#The Machines page's rows: this machine, your machines, your devices of their own, each computer once.
func appMachinesPageRows(input: AppMachinesPageInput) -> [AppMachinePageRow]| Parameter | Type | Default |
|---|---|---|
input | AppMachinesPageInput | required |
Returns Vec<AppMachinePageRow>