Skip to content

armgit / cua

Public Imported from GitHub
0

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

feat(spaces-macos): list your machines before this Mac is enrolled, and explain machines that keep their desktop private (#4511)

ddupont379085c5e267
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift
index c51491d9da..21815ccdec 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift
@@ -239,7 +239,7 @@ public final class AppModel {
/// The Spaces that can stream now (running and reachable).
public var streamableSpaceIds: [String] {
- spaces.filter { appSpaceDetail(space: $0).canStream }.map(\.id)
+ spaces.filter { detail($0).canStream }.map(\.id)
}
/// What the Space's preview card shows over (or instead of) its live
@@ -247,14 +247,22 @@ public final class AppModel {
public func cover(_ detail: AppSpaceDetail, requested: Bool, stream: AppStreamPhase) -> AppDesktopCover {
appDesktopCover(input: AppDesktopCoverInput(
canStream: detail.canStream, previewText: detail.previewText,
- autoConnect: settings.autoConnect, connectRequested: requested, stream: stream))
+ autoConnect: settings.autoConnect, connectRequested: requested, stream: stream,
+ access: detail.access))
}
/// The detail without what Settings, Experiments hides (Share while
- /// Sharing is off).
+ /// Sharing is off), as this Mac sees it: a machine reached through the
+ /// relay has its Connect greyed out while this Mac is not enrolled, and
+ /// one that does not share its desktop shows why in its place.
public func detail(_ space: AppSpace) -> AppSpaceDetail {
- appSpaceDetailWith(space: space, usage: usage[space.id], hostArch: Self.hostArch,
- experiments: settings.experiments)
+ appSpaceDetailFor(space: space, usage: usage[space.id], hostArch: Self.hostArch,
+ experiments: settings.experiments, access: devices.accessNotice)
+ }
+
+ /// The Spaces one of your machines provides (its detail lists them).
+ public func hostedRows(_ machineId: String) -> [AppSidebarRow] {
+ appHostedRows(spaces: spaces, machineSpaceId: machineId, selectedId: sidebar.selectedId ?? "")
}
@@ -303,8 +311,10 @@ public final class AppModel {
/// the registry's Spaces.
func recompose() {
let now = Int64(Date().timeIntervalSince1970 * 1000)
- let spaces = host.host == nil ? registrySpaces
- : appWithThisMachine(spaces: registrySpaces, status: host.summaryInput, nowMs: now)
+ // This Mac's own relay entry is "This machine", not one of "My machines".
+ let listed = appWithoutThisRelayMachine(spaces: registrySpaces, thisMachineId: host.machineId)
+ let spaces = host.host == nil ? listed
+ : appWithThisMachine(spaces: listed, status: host.summaryInput, nowMs: now)
send(.syncSpaces(spaces: appCreatesCompose(spaces: spaces, state: creates)))
}
@@ -379,6 +389,13 @@ public final class AppModel {
// MARK: - New Space
+ /// New Space with "Run on" set to `on` (`host:<machine>`): a machine's
+ /// "New Space on <name>…".
+ public func openNewSpace(on: String) async {
+ await openNewSpace()
+ wizard.send(.choosePlacement(on: on))
+ }
+
public func openNewSpace() async {
async let runtimesProbe = backend.localRuntimes()
async let storageProbe = backend.localStorage()
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/DevicesModel.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/DevicesModel.swift
index 9486bd14e9..442745bcb0 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/DevicesModel.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/DevicesModel.swift
@@ -264,6 +264,14 @@ public final class DevicesModel {
return view.banner
}
+ /// Signed in, read, and this Mac cannot open the account's machines
+ /// (never enrolled, waiting for approval, expired, revoked): why, for
+ /// every machine's greyed-out Connect, and its one action.
+ public var accessNotice: AppMachineAccessNotice? {
+ guard signedIn, snapshot != nil else { return nil }
+ return appMachineAccessNotice(kind: view.thisDevice.kind, pendingCode: pendingCode)
+ }
+
public var enrollView: AppEnrollView? { enroll.map { appEnrollView(state: $0) } }
public var approvalView: AppApproveSheetView? { approval.map { appApproveView(state: $0, devices: input.devices) } }
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/HostModel.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/HostModel.swift
index 0c804f88fd..d3094a9666 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/HostModel.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/HostModel.swift
@@ -106,6 +106,10 @@ public final class HostModel {
let host: HostRunning?
/// The host's state (`nil` until it answers).
public private(set) var state: AppHostState?
+ /// This install's relay machine id, once set up in relay mode: its own
+ /// entry in the relay listing is "This machine", not one of "My
+ /// machines".
+ public private(set) var machineId: String?
/// The host setup form, while it shows.
public private(set) var form: AppHostFormState?
public private(set) var busy = false
@@ -158,6 +162,7 @@ public final class HostModel {
func apply(_ status: HostStatus) {
state = appHostState(status: status)
+ machineId = status.machineId
// Setup that provides Spaces, launch on a Mac that already does, or
// Spaces turned on: ask now, while someone is at this Mac, not when
// the first Space boots (see `LocalNetworkPermissionRequesting`).
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/SpacesBackend.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/SpacesBackend.swift
index 4f2230cdbd..e632d7b5a0 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/SpacesBackend.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/SpacesBackend.swift
@@ -197,6 +197,13 @@ public final class LiveSpacesBackend: SpacesBackend, @unchecked Sendable {
if !info.imageDigest.isEmpty { row.imageDigest = info.imageDigest }
if let kind = AppSpaceKind(word: info.kind) { row.kind = kind }
if !info.arch.isEmpty { row.arch = info.arch }
+ // What it answered with just now (a machine on the
+ // relay lists none until it is reached): one that
+ // does not share its desktop reports the desktop's
+ // features unsupported.
+ if let live = Self.supportedFeatures(capabilitiesJson: try? space.capabilitiesJson()) {
+ row.features = live
+ }
case .failure(let error):
row.error = Self.words(error)
}
@@ -209,6 +216,17 @@ public final class LiveSpacesBackend: SpacesBackend, @unchecked Sendable {
}
}
+ /// The supported feature names of a `GetCapabilities` answer (proto3
+ /// JSON); nil when it cannot be read.
+ static func supportedFeatures(capabilitiesJson json: String?) -> [String]? {
+ guard let data = json?.data(using: .utf8),
+ let caps = try? JSONSerialization.jsonObject(with: data) as? [String: Any],
+ let features = caps["features"] as? [[String: Any]] else { return nil }
+ return features.compactMap { f in
+ (f["supported"] as? Bool) == true ? f["name"] as? String : nil
+ }
+ }
+
public func create(_ args: AppCreateSpaceArgs, createId: String,
progress: @escaping @Sendable (SpaceCreateProgress) -> Void) async throws -> String {
let options = SpaceCreateOptions(
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/DesktopCover.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/DesktopCover.swift
index 98f3242e83..49fa901520 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/DesktopCover.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/DesktopCover.swift
@@ -21,6 +21,8 @@ struct DesktopCoverView: View {
var progress: UInt32?
/// Under the line while it downloads.
var progressText: String?
+ /// The action above a greyed-out Connect ("Enroll This Mac…").
+ var onAction: () -> Void = {}
var onButton: () -> Void = {}
@Environment(\.colorScheme) private var colorScheme
@@ -111,10 +113,17 @@ struct DesktopCoverView: View {
.lineLimit(1)
.accessibilityIdentifier("space-progress-text")
}
+ // This Mac is not enrolled: the one action, under its line.
+ if let action = cover.action {
+ Button(action, action: onAction)
+ .buttonStyle(.link)
+ .accessibilityIdentifier("space-access-action")
+ }
if let button = cover.button {
Button(button, action: onButton)
.buttonStyle(.borderedProminent)
.controlSize(cover.kind == .connect ? .large : .regular)
+ .disabled(cover.buttonDisabled)
.help(cover.buttonHelp ?? "")
.accessibilityIdentifier(cover.kind == .connect ? "space-connect" : "space-retry")
}
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/SpaceDetailView.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/SpaceDetailView.swift
index bdee710d2e..dfc8b04236 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/SpaceDetailView.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/SpaceDetailView.swift
@@ -39,14 +39,21 @@ struct SpaceDetailView: View {
let detail = model.detail(space)
ScrollViewReader { scroller in
Form {
- Section {
- PreviewCard(session: detail.canStream ? session : nil) { preview(detail) }
- } footer: {
- if let error = detail.powerError {
- // Turning it off or on failed: why, inline.
- Text(error)
- .foregroundStyle(.red)
- .accessibilityIdentifier("space-power-error")
+ if let note = detail.desktopNote {
+ // One of your machines that does not share its desktop:
+ // why, in place of the desktop, and what it still does.
+ DesktopNotSharedSections(model: model, machineId: space.id, note: note,
+ newSpace: detail.newSpace)
+ } else {
+ Section {
+ PreviewCard(session: detail.canStream ? session : nil) { preview(detail) }
+ } footer: {
+ if let error = detail.powerError {
+ // Turning it off or on failed: why, inline.
+ Text(error)
+ .foregroundStyle(.red)
+ .accessibilityIdentifier("space-power-error")
+ }
}
}
Section {
@@ -167,7 +174,8 @@ struct SpaceDetailView: View {
}
if cover.kind != .stream {
DesktopCoverView(cover: cover, image: model.thumbnails[space.id],
- progress: detail.progress, progressText: detail.progressText) {
+ progress: detail.progress, progressText: detail.progressText,
+ onAction: { model.devices.startEnroll(in: .main) }) {
press(cover)
}
.transition(.opacity)
@@ -368,6 +376,47 @@ struct SpaceDetailView: View {
}
}
+/// One of your machines that does not share its desktop: the core's line
+/// in place of the desktop (with "New Space on <name>…" when it provides
+/// Spaces), then the Spaces it provides. No Stream, Agents or Teleport.
+struct DesktopNotSharedSections: View {
+ let model: AppModel
+ let machineId: String
+ let note: String
+ let newSpace: AppNewSpaceOn?
+
+ var body: some View {
+ Section {
+ HStack(alignment: .firstTextBaseline, spacing: 12) {
+ Text(note)
+ .foregroundStyle(.secondary)
+ .fixedSize(horizontal: false, vertical: true)
+ .accessibilityIdentifier("machine-desktop-note")
+ Spacer(minLength: 8)
+ if let newSpace {
+ Button(newSpace.label) { Task { await model.openNewSpace(on: newSpace.on) } }
+ .accessibilityIdentifier("machine-new-space")
+ }
+ }
+ }
+ if newSpace != nil {
+ Section("Spaces") {
+ let rows = model.hostedRows(machineId)
+ if rows.isEmpty {
+ Text("No Spaces yet").foregroundStyle(.secondary)
+ }
+ ForEach(rows, id: \.id) { row in
+ Button { model.select(row.id) } label: {
+ SpaceRowView(row: row).contentShape(Rectangle())
+ }
+ .buttonStyle(.plain)
+ }
+ }
+ .accessibilityIdentifier("machine-spaces")
+ }
+ }
+}
+
/// The live desktop's card: the stream runs flush to the card's edges with
/// only the card's own corner radius (the website's Spaces window). The card
/// sizes to the stream's aspect ratio once it has a frame, else to the
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/MachineAccessTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/MachineAccessTests.swift
new file mode 100644
index 0000000000..3c58a0e586
--- /dev/null
+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/MachineAccessTests.swift
@@ -0,0 +1,290 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+import AppKit
+import CuaSDK
+import CuaSpacesFFI
+@testable import CuaSpacesMacKit
+import SwiftUI
+import Testing
+
+/// Simulated account machines and this Mac's enrollment for the machines
+/// tests (and the review previews).
+@MainActor
+enum MachinesFixture {
+ static let now = UInt64(Date().timeIntervalSince1970)
+ static let shared = ["desktop_stream", "window_stream", "host_spaces", "files"]
+
+ static func row(_ id: String, _ name: String, os: AppSpaceOs, features: [String], reachable: Bool,
+ error: String? = nil, host: String? = nil, hostName: String? = nil,
+ power: String? = nil, powerState: String? = nil) -> AppSpaceRow {
+ AppSpaceRow(id: id, name: name, provider: "relay", spacesdVersion: "0.5.0", features: features,
+ addedAt: "2026-09-28T08:00:00Z", os: os,
+ osName: os == .macos ? "macOS" : "Ubuntu",
+ osPrettyName: os == .macos ? "macOS 26.0" : "Ubuntu 24.04.3 LTS",
+ image: nil, imageDigest: nil, kind: nil, arch: "arm64", reachable: reachable,
+ error: error, host: host, hostName: hostName, power: power, powerState: powerState,
+ cloud: nil, cloudPlace: nil, cloudDelete: nil)
+ }
+
+ /// This Mac's relay machine id (its host setup).
+ static let thisMacId = "0123abcd4567"
+
+ static let notEnrolledError =
+ "this device is not enrolled for your cua.ai account: run `cua devices enroll` (or approve it from the Cua Spaces app on an enrolled device)"
+
+ /// The account's machines. `reachable` false: this Mac cannot open them
+ /// (not enrolled), so the probe failed. `includeSelf`: this Mac's own
+ /// relay entry, which the relay lists once it shares its desktop.
+ static func rows(reachable: Bool = true, includeSelf: Bool = false) -> [AppSpaceRow] {
+ let err = reachable ? nil : notEnrolledError
+ func f(_ x: [String]) -> [String] { reachable ? x : [] }
+ var out: [AppSpaceRow] = [FixtureSpacesBackend.sample[0]]
+ out.append(row("relay:m-studio", "Studio", os: .macos, features: f(shared), reachable: reachable, error: err))
+ out.append(row("relay:m-mini", "Mac mini", os: .macos, features: f(["host_spaces", "files"]),
+ reachable: reachable, error: err))
+ out.append(row("relay:s-mini-ubuntu", "Ubuntu dev", os: .linux, features: f(["desktop_stream", "window_stream"]),
+ reachable: reachable, error: err, host: "m-mini", hostName: "Mac mini",
+ power: "stop", powerState: nil))
+ out.append(row("relay:m-ci", "Build box", os: .linux, features: f(["files"]), reachable: reachable, error: err))
+ out.append(row("relay:m-dana-2", "Dana's MacBook Pro", os: .macos, features: f(shared),
+ reachable: reachable, error: err))
+ if includeSelf {
+ out.append(row("relay:\(thisMacId)", "Dana's MacBook Pro", os: .macos, features: f(shared),
+ reachable: reachable, error: err))
+ }
+ return out
+ }
+
+ enum Enrollment { case enrolled, never, pending, expired }
+
+ /// This Mac set up as a host on the relay (sharing its desktop).
+ static var relayHost: HostStatus {
+ var s = FixtureHost.unconfigured
+ s.configured = true
+ s.mode = "relay"
+ s.machineId = thisMacId
+ s.name = "Dana's MacBook Pro"
+ s.sharing = true
+ s.serviceInstalled = true
+ s.serviceRunning = true
+ s.online = true
+ return s
+ }
+
+ static func devices(_ e: Enrollment) -> DevicesSnapshot {
+ var s = FixtureDevices.sample(now: now)
+ switch e {
+ case .enrolled: break
+ case .never:
+ s.devices.removeAll { $0.id == "dev_mac" }
+ s.localDeviceId = nil
+ case .pending:
+ if let i = s.devices.firstIndex(where: { $0.id == "dev_mac" }) {
+ s.devices[i].state = "pending"
+ s.devices[i].enrolledUntil = nil
+ }
+ case .expired:
+ if let i = s.devices.firstIndex(where: { $0.id == "dev_mac" }) {
+ s.devices[i].state = "expired"
+ s.devices[i].enrolledUntil = now - 86_400
+ }
+ }
+ return s
+ }
+
+ static func model(rows: [AppSpaceRow], enrollment: Enrollment, hostSetUp: Bool = false) async -> AppModel {
+ let dir = FileManager.default.temporaryDirectory.appendingPathComponent("cua-machines-\(UUID().uuidString)")
+ let fixture = FixtureDevices(snapshot: devices(enrollment))
+ let m = AppModel(backend: FixtureSpacesBackend(rows: rows),
+ keyvault: KeyvaultModel(client: nil, clock: { fixtureNow }),
+ onboarding: OnboardingModel(statePath: dir.appendingPathComponent("o.json").path),
+ settingsPath: dir.appendingPathComponent("settings.json").path,
+ host: hostSetUp ? FixtureHost(status: relayHost) : FixtureHost(),
+ account: FixtureAccount(), telemetry: FixtureTelemetry(),
+ devices: fixture, presence: FixturePresence())
+ m.onboarding.finish()
+ await m.choose(row: "auto-connect", option: "off")
+ m.devices.signedIn = true
+ await m.devices.refresh()
+ if enrollment == .pending {
+ // This launch registered and shows its code.
+ m.devices.pollLimit = 1
+ m.devices.pollInterval = .milliseconds(1)
+ m.devices.startEnroll(in: .main)
+ await m.devices.chooseEnroll(.approve)
+ m.devices.closeEnroll()
+ }
+ await m.refresh()
+ return m
+ }
+}
+
+
+/// Your machines from this Mac: listed while it is signed in but not
+/// enrolled (Connect greyed out under why, with the one action), and a
+/// machine that does not share its desktop shows why instead of Stream,
+/// Agents and Teleport.
+@MainActor
+@Suite("Machines", .serialized)
+struct MachineAccessTests {
+ init() { _ = NSApplication.shared }
+
+ func space(_ m: AppModel, _ id: String) throws -> AppSpace {
+ try #require(m.spaces.first { $0.id == id })
+ }
+
+ // MARK: - View models
+
+ @Test func enrolledMachinesConnectAsBefore() async throws {
+ let m = await MachinesFixture.model(rows: MachinesFixture.rows(), enrollment: .enrolled)
+ #expect(m.devices.accessNotice == nil)
+ let d = m.detail(try space(m, "relay:m-studio"))
+ #expect(d.access == nil && d.desktopNote == nil)
+ #expect(d.canStream && d.sections == ["Stream", "Agents", "Teleport"])
+ let cover = m.cover(d, requested: false, stream: .noSession)
+ #expect(cover.kind == .connect && !cover.buttonDisabled && cover.action == nil)
+ }
+
+ @Test func notEnrolledPendingAndExpiredListMachinesWithConnectGreyedOut() async throws {
+ for (e, kind, status) in [
+ (MachinesFixture.Enrollment.never, AppEnrollmentKind.needsEnrollment, "Not enrolled"),
+ (.pending, .waiting, "Waiting for approval"),
+ (.expired, .due, "Re-verification due"),
+ ] {
+ let m = await MachinesFixture.model(rows: MachinesFixture.rows(reachable: false), enrollment: e)
+ let notice = try #require(m.devices.accessNotice)
+ #expect(notice.kind == kind)
+ // Every machine is still listed under My machines.
+ let mine = try #require(m.sidebar.sections.first { $0.title == "My machines" })
+ #expect(mine.rows.map(\.id).contains("relay:m-studio"))
+ #expect(mine.rows.map(\.id).contains("relay:m-mini"))
+ let d = m.detail(try space(m, "relay:m-studio"))
+ #expect(d.access == notice)
+ #expect(!d.canStream && d.sections.isEmpty)
+ #expect(d.facts.first { $0.label == "Status" }?.value == status)
+ #expect(!d.actions.contains { [.open, .teleport, .pip].contains($0.id) && $0.enabled })
+ let cover = m.cover(d, requested: true, stream: .noSession)
+ #expect(cover.kind == .connect && cover.buttonDisabled && !cover.openStream)
+ #expect(cover.text == notice.text && cover.action == notice.actionLabel)
+ // A local Space is unaffected.
+ #expect(m.detail(try space(m, "local:aurora")).access == nil)
+ if e == .pending {
+ // This launch's code, and how to approve from another device.
+ #expect(notice.text.contains("K7QX-M2RP"))
+ }
+ }
+ }
+
+ @Test func theActionOpensTheEnrollSheet() async throws {
+ let m = await MachinesFixture.model(rows: MachinesFixture.rows(reachable: false), enrollment: .never)
+ #expect(m.devices.enroll == nil)
+ m.devices.startEnroll(in: .main)
+ #expect(m.devices.enrollView?.options.isEmpty == false)
+ }
+
+ @Test func aMachineThatDoesNotShareItsDesktop() async throws {
+ let m = await MachinesFixture.model(rows: MachinesFixture.rows(), enrollment: .enrolled)
+ let mini = m.detail(try space(m, "relay:m-mini"))
+ #expect(mini.desktopNote == "Mac mini isn\u{2019}t sharing its desktop. You can still create Spaces on it.")
+ #expect(!mini.canStream && !mini.showSections && mini.sections.isEmpty)
+ #expect(!mini.actions.contains { [.open, .teleport, .pip].contains($0.id) })
+ #expect(mini.newSpace?.on == "host:m-mini")
+ #expect(m.hostedRows("relay:m-mini").map(\.id) == ["relay:s-mini-ubuntu"])
+ // Neither the desktop nor Spaces: the note alone.
+ let ci = m.detail(try space(m, "relay:m-ci"))
+ #expect(ci.desktopNote == "Build box isn\u{2019}t sharing its desktop or Spaces.")
+ #expect(ci.newSpace == nil && ci.sections.isEmpty)
+ // Shared: as before.
+ #expect(m.detail(try space(m, "relay:m-studio")).desktopNote == nil)
+ }
+
+ @Test func newSpaceOnAMachinePicksItInRunOn() async throws {
+ let m = await MachinesFixture.model(rows: MachinesFixture.rows(), enrollment: .enrolled)
+ await m.openNewSpace(on: "host:m-mini")
+ #expect(m.showingNewSpace)
+ }
+
+ /// The probe's live features: the desktop's are unsupported for a
+ /// machine that does not share it.
+ @Test func probeReadsSupportedFeatures() {
+ let json = #"{"version":"0.5.0","features":[{"name":"desktop_stream","supported":false,"limitation":"this machine does not share its desktop (it only provides Spaces)"},{"name":"host_spaces","supported":true},{"name":"files","supported":true}]}"#
+ #expect(LiveSpacesBackend.supportedFeatures(capabilitiesJson: json) == ["host_spaces", "files"])
+ #expect(LiveSpacesBackend.supportedFeatures(capabilitiesJson: nil) == nil)
+ #expect(LiveSpacesBackend.supportedFeatures(capabilitiesJson: "nope") == nil)
+ }
+
+ /// Sharing its desktop lists this Mac on the relay too: it stays
+ /// "This machine" and is not repeated under My machines, while another
+ /// Mac of the same name stays.
+ @Test func thisMacIsNotOneOfMyMachines() async throws {
+ let m = await MachinesFixture.model(rows: MachinesFixture.rows(includeSelf: true), enrollment: .enrolled,
+ hostSetUp: true)
+ #expect(m.sidebar.thisMachine != nil)
+ let mine = try #require(m.sidebar.sections.first { $0.title == "My machines" })
+ let ids = mine.rows.map(\.id)
+ #expect(!ids.contains("relay:\(MachinesFixture.thisMacId)"))
+ #expect(ids.contains("relay:m-dana-2"))
+ try SnapshotTests().assertSnapshot(Sidebar(model: m).frame(width: 260), "sidebar-without-this-mac",
+ size: CGSize(width: 260, height: 600))
+ }
+
+ // MARK: - Snapshots
+
+ func card(_ cover: AppDesktopCover) -> some View {
+ Form {
+ Section { PreviewCard(session: nil) { DesktopCoverView(cover: cover, image: nil) } }
+ }
+ .formStyle(.grouped)
+ }
+
+ /// The machine's card: Connect (enrolled), then greyed out under why
+ /// and the one action (not enrolled, waiting for approval, expired).
+ @Test func connectSnapshots() async throws {
+ let size = CGSize(width: 520, height: 360)
+ let snap = SnapshotTests()
+ let enrolled = await MachinesFixture.model(rows: MachinesFixture.rows(), enrollment: .enrolled)
+ let d = enrolled.detail(try space(enrolled, "relay:m-studio"))
+ try snap.assertSnapshot(card(enrolled.cover(d, requested: false, stream: .noSession)),
+ "machine-connect-enrolled", size: size)
+ for (e, name) in [(MachinesFixture.Enrollment.never, "machine-connect-not-enrolled"),
+ (.pending, "machine-connect-pending"), (.expired, "machine-connect-expired")] {
+ let m = await MachinesFixture.model(rows: MachinesFixture.rows(reachable: false), enrollment: e)
+ let d = m.detail(try space(m, "relay:m-studio"))
+ try snap.assertSnapshot(card(m.cover(d, requested: false, stream: .noSession)), name, size: size)
+ }
+ }
+
+ /// Desktop shared (its live card), not shared with Spaces on (the note,
+ /// New Space on it, its Spaces), and both off (the note alone).
+ @Test func desktopSnapshots() async throws {
+ let size = CGSize(width: 560, height: 440)
+ let snap = SnapshotTests()
+ let m = await MachinesFixture.model(rows: MachinesFixture.rows(), enrollment: .enrolled)
+ let studio = try space(m, "relay:m-studio")
+ let shared = m.detail(studio)
+ try snap.assertSnapshot(Form {
+ Section {
+ PreviewCard(session: nil) {
+ DesktopCoverView(cover: m.cover(shared, requested: false, stream: .noSession), image: nil)
+ }
+ }
+ Section("Stream") { Text(appSpaceDetailCopy().streamLoading).foregroundStyle(.secondary) }
+ }.formStyle(.grouped), "machine-desktop-shared", size: size)
+ for (id, name) in [("relay:m-mini", "machine-desktop-not-shared"), ("relay:m-ci", "machine-desktop-and-spaces-off")] {
+ let d = m.detail(try space(m, id))
+ let note = try #require(d.desktopNote)
+ try snap.assertSnapshot(Form {
+ DesktopNotSharedSections(model: m, machineId: id, note: note, newSpace: d.newSpace)
+ Section { FactRows(facts: d.facts, write: { _ in }, copied: false) }
+ }.formStyle(.grouped), name, size: size)
+ }
+ }
+
+ /// Signed in, not enrolled: My machines still lists every machine.
+ @Test func sidebarSnapshot() async throws {
+ let m = await MachinesFixture.model(rows: MachinesFixture.rows(reachable: false), enrollment: .never)
+ try SnapshotTests().assertSnapshot(Sidebar(model: m).frame(width: 260), "sidebar-my-machines-not-enrolled",
+ size: CGSize(width: 260, height: 560))
+ }
+}
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/SnapshotTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/SnapshotTests.swift
index 56f22cfc83..9f413947c4 100644
--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/SnapshotTests.swift
+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/SnapshotTests.swift
@@ -219,7 +219,7 @@ struct SnapshotTests {
// A Space that cannot stream: its line on the same blurred preview.
let stopped = appDesktopCover(input: AppDesktopCoverInput(
canStream: false, previewText: "Stopped", autoConnect: true, connectRequested: false,
- stream: .noSession))
+ stream: .noSession, access: nil))
try assertSnapshot(card(stopped, preview), "space-cover-stopped", size: size)
}
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/machine-connect-enrolled.png b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/machine-connect-enrolled.png
new file mode 100644
index 0000000000..e82c8dfbef
Binary files /dev/null and b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/machine-connect-enrolled.png differ
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/machine-connect-expired.png b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/machine-connect-expired.png
new file mode 100644
index 0000000000..649debd993
Binary files /dev/null and b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/machine-connect-expired.png differ
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/machine-connect-not-enrolled.png b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/machine-connect-not-enrolled.png
new file mode 100644
index 0000000000..4d7aeb28c3
Binary files /dev/null and b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/machine-connect-not-enrolled.png differ
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/machine-connect-pending.png b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/machine-connect-pending.png
new file mode 100644
index 0000000000..6b664e3549
Binary files /dev/null and b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/machine-connect-pending.png differ
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/machine-desktop-and-spaces-off.png b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/machine-desktop-and-spaces-off.png
new file mode 100644
index 0000000000..42242406a8
Binary files /dev/null and b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/machine-desktop-and-spaces-off.png differ
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/machine-desktop-not-shared.png b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/machine-desktop-not-shared.png
new file mode 100644
index 0000000000..e0304b5055
Binary files /dev/null and b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/machine-desktop-not-shared.png differ
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/machine-desktop-shared.png b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/machine-desktop-shared.png
new file mode 100644
index 0000000000..e507cf5494
Binary files /dev/null and b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/machine-desktop-shared.png differ
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/sidebar-my-machines-not-enrolled.png b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/sidebar-my-machines-not-enrolled.png
new file mode 100644
index 0000000000..8bc183bed6
Binary files /dev/null and b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/sidebar-my-machines-not-enrolled.png differ
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/sidebar-without-this-mac.png b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/sidebar-without-this-mac.png
new file mode 100644
index 0000000000..7f4e238b4b
Binary files /dev/null and b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/sidebar-without-this-mac.png differ
diff --git a/docs/content/docs/cua-sdk/reference/index.mdx b/docs/content/docs/cua-sdk/reference/index.mdx
index 0c9c7bc40e..2f4934527a 100644
--- a/docs/content/docs/cua-sdk/reference/index.mdx
+++ b/docs/content/docs/cua-sdk/reference/index.mdx
@@ -139,4 +139,4 @@ Pages marked *Cua Spaces app export* document the APIs the Cua Spaces apps are b
290 items, 379 methods. The [Types](/cua-sdk/reference/types) page lists them.
-The Cua Spaces app export adds 713 items and 38 methods.
+The Cua Spaces app export adds 719 items and 38 methods.
diff --git a/docs/content/docs/cua-sdk/reference/rust/cua-spaces.mdx b/docs/content/docs/cua-sdk/reference/rust/cua-spaces.mdx
index 2655218e45..42111b641a 100644
--- a/docs/content/docs/cua-sdk/reference/rust/cua-spaces.mdx
+++ b/docs/content/docs/cua-sdk/reference/rust/cua-spaces.mdx
@@ -1640,6 +1640,7 @@ impl Spaces {
fn fleet_namespace(&self) -> &str;
fn list(&self) -> Result<Vec<SpaceInfo>>;
async fn list_all(&self) -> Result<Vec<SpaceInfo>>;
+ fn this_relay_machine_id(&self) -> Option<String>;
fn relay_account(&self) -> Option<RelayAccount>;
fn set_site_login_broker(&self, broker: Option<Arc<dyn SiteLoginBroker>>);
fn site_login_broker(&self) -> Option<Arc<dyn SiteLoginBroker>>;
diff --git a/docs/content/docs/cua-sdk/reference/spaces/app-core/devices.mdx b/docs/content/docs/cua-sdk/reference/spaces/app-core/devices.mdx
index 0870ef7029..60ddb5f5ea 100644
--- a/docs/content/docs/cua-sdk/reference/spaces/app-core/devices.mdx
+++ b/docs/content/docs/cua-sdk/reference/spaces/app-core/devices.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_devices_view` derives the Devices page from `app_devices_input` (a `Devices.snapshot`): this device's enrollment, the account's devices with their buttons, approval prompts that ask for presence, and Recent Access in words. `app_enroll_reduce` / `app_enroll_view` drive the enroll sheet (sign in again, or a one-time code approved elsewhere); `app_approve_reduce` / `app_approve_view` drive the approval sheet, whose `request` goes to `Devices.approve` after Touch ID or the login password.
+`app_devices_view` derives the Devices page from `app_devices_input` (a `Devices.snapshot`): this device's enrollment, the account's devices with their buttons, approval prompts that ask for presence, and Recent Access in words. `app_enroll_reduce` / `app_enroll_view` drive the enroll sheet (sign in again, or a one-time code approved elsewhere); `app_approve_reduce` / `app_approve_view` drive the approval sheet, whose `request` goes to `Devices.approve` after Touch ID or the login password. `app_machine_access_notice` says why a device that is signed in but not enrolled cannot open the account's machines, for their greyed-out Connect.
## `AppAuditInput` record
@@ -143,6 +143,47 @@ AppEnrollmentKind::Revoked
| `title` | `String` | | Display name, or the id when it has none yet. |
| `confirm` | [`AppDeviceConfirm`](#appdeviceconfirm-record) | | Asked before confirming (both shells show it as a native alert). |
+## `app_machine_access_notice`
+
+Why this device cannot open the account's machines for its enrollment
+`kind` (`None` while it can). `pending_code` is the code it shows while
+it waits for approval.
+
+<Tabs items={['Swift', 'Rust']} groupId="sdk-lang" persist>
+<Tab value="Swift">
+
+```swift
+func appMachineAccessNotice(kind: AppEnrollmentKind, pendingCode: String?) -> AppMachineAccessNotice?
+```
+
+</Tab>
+<Tab value="Rust">
+
+```rust
+pub fn app_machine_access_notice(kind: AppEnrollmentKind, pending_code: Option<String>) -> Option<AppMachineAccessNotice>
+```
+
+</Tab>
+</Tabs>
+
+| Parameter | Type | Default |
+| --- | --- | --- |
+| `kind` | [`AppEnrollmentKind`](#appenrollmentkind-enum) | required |
+| `pending_code` | `Option<String>` | required |
+
+**Returns** [`Option<AppMachineAccessNotice>`](#appmachineaccessnotice-record)
+
+## `AppMachineAccessNotice` record
+
+Returned by [`app_machine_access_notice`](#app_machine_access_notice).
+
+| Field | Type | Default | Description |
+| --- | --- | --- | --- |
+| `kind` | [`AppEnrollmentKind`](#appenrollmentkind-enum) | | This device's enrollment. |
+| `status` | `String` | | The machine's Status: "Not enrolled", "Waiting for approval", ... |
+| `text` | `String` | | The line above the disabled Connect. |
+| `action_label` / `actionLabel` | `String` | | The action's label; it opens the enroll sheet. |
+
## `AppApproveRequest` record
| Field | Type | Default | Description |
diff --git a/docs/content/docs/cua-sdk/reference/spaces/app-core/index.mdx b/docs/content/docs/cua-sdk/reference/spaces/app-core/index.mdx
index 0ac895b80d..4b9f4d8291 100644
--- a/docs/content/docs/cua-sdk/reference/spaces/app-core/index.mdx
+++ b/docs/content/docs/cua-sdk/reference/spaces/app-core/index.mdx
@@ -81,15 +81,15 @@ pub fn app_menu_input_from_json(json: String) -> Result<AppMenuInput, CuaError>
## All items
-596 items, across this page and its subpages, grouped by page. Methods are listed on their object.
+602 items, across this page and its subpages, grouped by page. Methods are listed on their object.
**About, updates and launch**: [`app_about_after_launch`](/cua-sdk/reference/spaces/app-core/about#app_about_after_launch), [`app_about_allowed_channels`](/cua-sdk/reference/spaces/app-core/about#app_about_allowed_channels), [`app_about_input_from_json`](/cua-sdk/reference/spaces/app-core/about#app_about_input_from_json), [`app_about_refresh_notice`](/cua-sdk/reference/spaces/app-core/about#app_about_refresh_notice), [`app_about_restart_daemon`](/cua-sdk/reference/spaces/app-core/about#app_about_restart_daemon), [`app_about_view`](/cua-sdk/reference/spaces/app-core/about#app_about_view), [`app_daemon_check_from_json`](/cua-sdk/reference/spaces/app-core/about#app_daemon_check_from_json), [`app_launch_input_from_json`](/cua-sdk/reference/spaces/app-core/about#app_launch_input_from_json), [`app_refresh_report_from_json`](/cua-sdk/reference/spaces/app-core/about#app_refresh_report_from_json), [`AppAboutInput`](/cua-sdk/reference/spaces/app-core/about#appaboutinput-record), [`AppAboutLink`](/cua-sdk/reference/spaces/app-core/about#appaboutlink-record), [`AppAboutLinkId`](/cua-sdk/reference/spaces/app-core/about#appaboutlinkid-enum), [`AppAboutUpdates`](/cua-sdk/reference/spaces/app-core/about#appaboutupdates-record), [`AppAboutView`](/cua-sdk/reference/spaces/app-core/about#appaboutview-record), [`AppCliInstaller`](/cua-sdk/reference/spaces/app-core/about#appcliinstaller), [`AppCliInstallPlan`](/cua-sdk/reference/spaces/app-core/about#appcliinstallplan-record), [`AppCliInstallRequest`](/cua-sdk/reference/spaces/app-core/about#appcliinstallrequest-record), [`AppDaemonCheck`](/cua-sdk/reference/spaces/app-core/about#appdaemoncheck-record), [`AppInstallMethod`](/cua-sdk/reference/spaces/app-core/about#appinstallmethod-enum), [`AppLaunchInput`](/cua-sdk/reference/spaces/app-core/about#applaunchinput-record), [`AppLaunchPlan`](/cua-sdk/reference/spaces/app-core/about#applaunchplan-record), [`AppRefreshReport`](/cua-sdk/reference/spaces/app-core/about#apprefreshreport-record), [`AppUpdateChannel`](/cua-sdk/reference/spaces/app-core/about#appupdatechannel-enum)
-**Spaces**: [`app_agent_name`](/cua-sdk/reference/spaces/app-core/spaces#app_agent_name), [`app_ambient_dots`](/cua-sdk/reference/spaces/app-core/spaces#app_ambient_dots), [`app_group_windows_by_app`](/cua-sdk/reference/spaces/app-core/spaces#app_group_windows_by_app), [`app_roster_initial`](/cua-sdk/reference/spaces/app-core/spaces#app_roster_initial), [`app_roster_reduce`](/cua-sdk/reference/spaces/app-core/spaces#app_roster_reduce), [`app_rows_to_spaces`](/cua-sdk/reference/spaces/app-core/spaces#app_rows_to_spaces), [`app_sidebar`](/cua-sdk/reference/spaces/app-core/spaces#app_sidebar), [`app_space_accepts_drop`](/cua-sdk/reference/spaces/app-core/spaces#app_space_accepts_drop), [`app_space_detail`](/cua-sdk/reference/spaces/app-core/spaces#app_space_detail), [`app_space_detail_with`](/cua-sdk/reference/spaces/app-core/spaces#app_space_detail_with), [`app_space_rows_from_json`](/cua-sdk/reference/spaces/app-core/spaces#app_space_rows_from_json), [`app_spaces_from_json`](/cua-sdk/reference/spaces/app-core/spaces#app_spaces_from_json), [`app_status_line`](/cua-sdk/reference/spaces/app-core/spaces#app_status_line), [`app_this_machine_space`](/cua-sdk/reference/spaces/app-core/spaces#app_this_machine_space), [`AppAgentStatus`](/cua-sdk/reference/spaces/app-core/spaces#appagentstatus-enum), [`AppAmbientDots`](/cua-sdk/reference/spaces/app-core/spaces#appambientdots-record), [`AppFactWarning`](/cua-sdk/reference/spaces/app-core/spaces#appfactwarning-record), [`AppHostSummaryInput`](/cua-sdk/reference/spaces/app-core/spaces#apphostsummaryinput-record), [`AppNotice`](/cua-sdk/reference/spaces/app-core/spaces#appnotice-record), [`AppNoticeKind`](/cua-sdk/reference/spaces/app-core/spaces#appnoticekind-enum), [`AppOpenApp`](/cua-sdk/reference/spaces/app-core/spaces#appopenapp-record), [`AppOpenWindow`](/cua-sdk/reference/spaces/app-core/spaces#appopenwindow-record), [`AppRemoteWindow`](/cua-sdk/reference/spaces/app-core/spaces#appremotewindow-record), [`AppRemoteWindowGroup`](/cua-sdk/reference/spaces/app-core/spaces#appremotewindowgroup-record), [`AppRosterAction`](/cua-sdk/reference/spaces/app-core/spaces#approsteraction-enum), [`AppRosterState`](/cua-sdk/reference/spaces/app-core/spaces#approsterstate-record), [`AppSidebarRow`](/cua-sdk/reference/spaces/app-core/spaces#appsidebarrow-record), [`AppSidebarSection`](/cua-sdk/reference/spaces/app-core/spaces#appsidebarsection-record), [`AppSidebarView`](/cua-sdk/reference/spaces/app-core/spaces#appsidebarview-record), [`AppSpace`](/cua-sdk/reference/spaces/app-core/spaces#appspace-record), [`AppSpaceAgentRun`](/cua-sdk/reference/spaces/app-core/spaces#appspaceagentrun-record), [`AppSpaceDetail`](/cua-sdk/reference/spaces/app-core/spaces#appspacedetail-record), [`AppSpaceKind`](/cua-sdk/reference/spaces/app-core/spaces#appspacekind-enum), [`AppSpaceOs`](/cua-sdk/reference/spaces/app-core/spaces#appspaceos-enum), [`AppSpaceProgress`](/cua-sdk/reference/spaces/app-core/spaces#appspaceprogress-record), [`AppSpaceProvider`](/cua-sdk/reference/spaces/app-core/spaces#appspaceprovider-enum), [`AppSpaceRow`](/cua-sdk/reference/spaces/app-core/spaces#appspacerow-record), [`AppSpaceSdkRef`](/cua-sdk/reference/spaces/app-core/spaces#appspacesdkref-record), [`AppSpaceStatus`](/cua-sdk/reference/spaces/app-core/spaces#appspacestatus-enum), [`AppThumbnailScene`](/cua-sdk/reference/spaces/app-core/spaces#appthumbnailscene-enum), [`AppWindowMode`](/cua-sdk/reference/spaces/app-core/spaces#appwindowmode-enum)
+**Spaces**: [`app_agent_name`](/cua-sdk/reference/spaces/app-core/spaces#app_agent_name), [`app_ambient_dots`](/cua-sdk/reference/spaces/app-core/spaces#app_ambient_dots), [`app_group_windows_by_app`](/cua-sdk/reference/spaces/app-core/spaces#app_group_windows_by_app), [`app_hosted_rows`](/cua-sdk/reference/spaces/app-core/spaces#app_hosted_rows), [`app_roster_initial`](/cua-sdk/reference/spaces/app-core/spaces#app_roster_initial), [`app_roster_reduce`](/cua-sdk/reference/spaces/app-core/spaces#app_roster_reduce), [`app_rows_to_spaces`](/cua-sdk/reference/spaces/app-core/spaces#app_rows_to_spaces), [`app_sidebar`](/cua-sdk/reference/spaces/app-core/spaces#app_sidebar), [`app_space_accepts_drop`](/cua-sdk/reference/spaces/app-core/spaces#app_space_accepts_drop), [`app_space_detail`](/cua-sdk/reference/spaces/app-core/spaces#app_space_detail), [`app_space_detail_for`](/cua-sdk/reference/spaces/app-core/spaces#app_space_detail_for), [`app_space_detail_with`](/cua-sdk/reference/spaces/app-core/spaces#app_space_detail_with), [`app_space_rows_from_json`](/cua-sdk/reference/spaces/app-core/spaces#app_space_rows_from_json), [`app_spaces_from_json`](/cua-sdk/reference/spaces/app-core/spaces#app_spaces_from_json), [`app_status_line`](/cua-sdk/reference/spaces/app-core/spaces#app_status_line), [`app_this_machine_space`](/cua-sdk/reference/spaces/app-core/spaces#app_this_machine_space), [`app_without_this_relay_machine`](/cua-sdk/reference/spaces/app-core/spaces#app_without_this_relay_machine), [`AppAgentStatus`](/cua-sdk/reference/spaces/app-core/spaces#appagentstatus-enum), [`AppAmbientDots`](/cua-sdk/reference/spaces/app-core/spaces#appambientdots-record), [`AppFactWarning`](/cua-sdk/reference/spaces/app-core/spaces#appfactwarning-record), [`AppHostSummaryInput`](/cua-sdk/reference/spaces/app-core/spaces#apphostsummaryinput-record), [`AppNewSpaceOn`](/cua-sdk/reference/spaces/app-core/spaces#appnewspaceon-record), [`AppNotice`](/cua-sdk/reference/spaces/app-core/spaces#appnotice-record), [`AppNoticeKind`](/cua-sdk/reference/spaces/app-core/spaces#appnoticekind-enum), [`AppOpenApp`](/cua-sdk/reference/spaces/app-core/spaces#appopenapp-record), [`AppOpenWindow`](/cua-sdk/reference/spaces/app-core/spaces#appopenwindow-record), [`AppRemoteWindow`](/cua-sdk/reference/spaces/app-core/spaces#appremotewindow-record), [`AppRemoteWindowGroup`](/cua-sdk/reference/spaces/app-core/spaces#appremotewindowgroup-record), [`AppRosterAction`](/cua-sdk/reference/spaces/app-core/spaces#approsteraction-enum), [`AppRosterState`](/cua-sdk/reference/spaces/app-core/spaces#approsterstate-record), [`AppSidebarRow`](/cua-sdk/reference/spaces/app-core/spaces#appsidebarrow-record), [`AppSidebarSection`](/cua-sdk/reference/spaces/app-core/spaces#appsidebarsection-record), [`AppSidebarView`](/cua-sdk/reference/spaces/app-core/spaces#appsidebarview-record), [`AppSpace`](/cua-sdk/reference/spaces/app-core/spaces#appspace-record), [`AppSpaceAgentRun`](/cua-sdk/reference/spaces/app-core/spaces#appspaceagentrun-record), [`AppSpaceDetail`](/cua-sdk/reference/spaces/app-core/spaces#appspacedetail-record), [`AppSpaceKind`](/cua-sdk/reference/spaces/app-core/spaces#appspacekind-enum), [`AppSpaceOs`](/cua-sdk/reference/spaces/app-core/spaces#appspaceos-enum), [`AppSpaceProgress`](/cua-sdk/reference/spaces/app-core/spaces#appspaceprogress-record), [`AppSpaceProvider`](/cua-sdk/reference/spaces/app-core/spaces#appspaceprovider-enum), [`AppSpaceRow`](/cua-sdk/reference/spaces/app-core/spaces#appspacerow-record), [`AppSpaceSdkRef`](/cua-sdk/reference/spaces/app-core/spaces#appspacesdkref-record), [`AppSpaceStatus`](/cua-sdk/reference/spaces/app-core/spaces#appspacestatus-enum), [`AppThumbnailScene`](/cua-sdk/reference/spaces/app-core/spaces#appthumbnailscene-enum), [`AppWindowMode`](/cua-sdk/reference/spaces/app-core/spaces#appwindowmode-enum)
**Window, menu bar and Settings**: [`app_agent_settings_rows`](/cua-sdk/reference/spaces/app-core/window#app_agent_settings_rows), [`app_agent_setup_outcome`](/cua-sdk/reference/spaces/app-core/window#app_agent_setup_outcome), [`app_agent_setup_outcomes_from_json`](/cua-sdk/reference/spaces/app-core/window#app_agent_setup_outcomes_from_json), [`app_agent_setup_status`](/cua-sdk/reference/spaces/app-core/window#app_agent_setup_status), [`app_agent_setup_statuses_from_json`](/cua-sdk/reference/spaces/app-core/window#app_agent_setup_statuses_from_json), [`app_agent_setup_summary`](/cua-sdk/reference/spaces/app-core/window#app_agent_setup_summary), [`app_chrome_input_from_json`](/cua-sdk/reference/spaces/app-core/window#app_chrome_input_from_json), [`app_delete_failed_text`](/cua-sdk/reference/spaces/app-core/window#app_delete_failed_text), [`app_display_name`](/cua-sdk/reference/spaces/app-core/window#app_display_name), [`app_display_path`](/cua-sdk/reference/spaces/app-core/window#app_display_path), [`app_drop_sending_text`](/cua-sdk/reference/spaces/app-core/window#app_drop_sending_text), [`app_drop_sent_text`](/cua-sdk/reference/spaces/app-core/window#app_drop_sent_text), [`app_format_bytes`](/cua-sdk/reference/spaces/app-core/window#app_format_bytes), [`app_login_item_launch_plan`](/cua-sdk/reference/spaces/app-core/window#app_login_item_launch_plan), [`app_main_chrome`](/cua-sdk/reference/spaces/app-core/window#app_main_chrome), [`app_menu`](/cua-sdk/reference/spaces/app-core/window#app_menu), [`app_menu_bar`](/cua-sdk/reference/spaces/app-core/window#app_menu_bar), [`app_menu_bar_with_keyvault`](/cua-sdk/reference/spaces/app-core/window#app_menu_bar_with_keyvault), [`app_openable_count`](/cua-sdk/reference/spaces/app-core/window#app_openable_count), [`app_sent_file`](/cua-sdk/reference/spaces/app-core/window#app_sent_file), [`app_sent_files_from_json`](/cua-sdk/reference/spaces/app-core/window#app_sent_files_from_json), [`app_settings_input_from_json`](/cua-sdk/reference/spaces/app-core/window#app_settings_input_from_json), [`app_settings_page`](/cua-sdk/reference/spaces/app-core/window#app_settings_page), [`app_space_detail_copy`](/cua-sdk/reference/spaces/app-core/window#app_space_detail_copy), [`AppAgentSettingsRow`](/cua-sdk/reference/spaces/app-core/window#appagentsettingsrow-record), [`AppAgentSetupOutcomeInput`](/cua-sdk/reference/spaces/app-core/window#appagentsetupoutcomeinput-record), [`AppAgentSetupStatus`](/cua-sdk/reference/spaces/app-core/window#appagentsetupstatus-record), [`AppAgentSetupSummary`](/cua-sdk/reference/spaces/app-core/window#appagentsetupsummary-record), [`AppChromeInput`](/cua-sdk/reference/spaces/app-core/window#appchromeinput-record), [`AppDeleteConfirm`](/cua-sdk/reference/spaces/app-core/window#appdeleteconfirm-record), [`AppDetailAction`](/cua-sdk/reference/spaces/app-core/window#appdetailaction-record), [`AppDetailActionId`](/cua-sdk/reference/spaces/app-core/window#appdetailactionid-enum), [`AppDetailCopy`](/cua-sdk/reference/spaces/app-core/window#appdetailcopy-record), [`AppFact`](/cua-sdk/reference/spaces/app-core/window#appfact-record), [`AppFactCopy`](/cua-sdk/reference/spaces/app-core/window#appfactcopy-record), [`AppLoginItemInput`](/cua-sdk/reference/spaces/app-core/window#apploginiteminput-record), [`AppLoginItemPlan`](/cua-sdk/reference/spaces/app-core/window#apploginitemplan-record), [`AppLoginItemStatus`](/cua-sdk/reference/spaces/app-core/window#apploginitemstatus-enum), [`AppMainChrome`](/cua-sdk/reference/spaces/app-core/window#appmainchrome-record), [`AppMenuInput`](/cua-sdk/reference/spaces/app-core/window#appmenuinput-record), [`AppMenuItem`](/cua-sdk/reference/spaces/app-core/window#appmenuitem-record), [`AppMenuItemId`](/cua-sdk/reference/spaces/app-core/window#appmenuitemid-enum), [`AppSentFileInfo`](/cua-sdk/reference/spaces/app-core/window#appsentfileinfo-record), [`AppSettingsInput`](/cua-sdk/reference/spaces/app-core/window#appsettingsinput-record), [`AppSettingsOption`](/cua-sdk/reference/spaces/app-core/window#appsettingsoption-record), [`AppSettingsPage`](/cua-sdk/reference/spaces/app-core/window#appsettingspage-record), [`AppSettingsRow`](/cua-sdk/reference/spaces/app-core/window#appsettingsrow-record), [`AppSettingsRowKind`](/cua-sdk/reference/spaces/app-core/window#appsettingsrowkind-enum), [`AppSettingsSection`](/cua-sdk/reference/spaces/app-core/window#appsettingssection-record), [`AppSignInPhase`](/cua-sdk/reference/spaces/app-core/window#appsigninphase-enum), [`AppTelemetryInput`](/cua-sdk/reference/spaces/app-core/window#apptelemetryinput-record)
-**Devices**: [`app_approve_open`](/cua-sdk/reference/spaces/app-core/devices#app_approve_open), [`app_approve_reduce`](/cua-sdk/reference/spaces/app-core/devices#app_approve_reduce), [`app_approve_sheet_action_from_json`](/cua-sdk/reference/spaces/app-core/devices#app_approve_sheet_action_from_json), [`app_approve_view`](/cua-sdk/reference/spaces/app-core/devices#app_approve_view), [`app_devices_clean_name`](/cua-sdk/reference/spaces/app-core/devices#app_devices_clean_name), [`app_devices_input`](/cua-sdk/reference/spaces/app-core/devices#app_devices_input), [`app_devices_input_from_json`](/cua-sdk/reference/spaces/app-core/devices#app_devices_input_from_json), [`app_devices_view`](/cua-sdk/reference/spaces/app-core/devices#app_devices_view), [`app_enroll_action_from_json`](/cua-sdk/reference/spaces/app-core/devices#app_enroll_action_from_json), [`app_enroll_initial`](/cua-sdk/reference/spaces/app-core/devices#app_enroll_initial), [`app_enroll_reduce`](/cua-sdk/reference/spaces/app-core/devices#app_enroll_reduce), [`app_enroll_state_from_json`](/cua-sdk/reference/spaces/app-core/devices#app_enroll_state_from_json), [`app_enroll_view`](/cua-sdk/reference/spaces/app-core/devices#app_enroll_view), [`AppActivityRow`](/cua-sdk/reference/spaces/app-core/devices#appactivityrow-record), [`AppApprovalPrompt`](/cua-sdk/reference/spaces/app-core/devices#appapprovalprompt-record), [`AppApproveRequest`](/cua-sdk/reference/spaces/app-core/devices#appapproverequest-record), [`AppApproveSheetAction`](/cua-sdk/reference/spaces/app-core/devices#appapprovesheetaction-enum), [`AppApproveSheetState`](/cua-sdk/reference/spaces/app-core/devices#appapprovesheetstate-record), [`AppApproveSheetView`](/cua-sdk/reference/spaces/app-core/devices#appapprovesheetview-record), [`AppAuditInput`](/cua-sdk/reference/spaces/app-core/devices#appauditinput-record), [`AppBannerTone`](/cua-sdk/reference/spaces/app-core/devices#appbannertone-enum), [`AppDeviceAction`](/cua-sdk/reference/spaces/app-core/devices#appdeviceaction-enum), [`AppDeviceBanner`](/cua-sdk/reference/spaces/app-core/devices#appdevicebanner-record), [`AppDeviceConfirm`](/cua-sdk/reference/spaces/app-core/devices#appdeviceconfirm-record), [`AppDeviceInput`](/cua-sdk/reference/spaces/app-core/devices#appdeviceinput-record), [`AppDeviceRow`](/cua-sdk/reference/spaces/app-core/devices#appdevicerow-record), [`AppDevicesInput`](/cua-sdk/reference/spaces/app-core/devices#appdevicesinput-record), [`AppDevicesLabels`](/cua-sdk/reference/spaces/app-core/devices#appdeviceslabels-record), [`AppDevicesView`](/cua-sdk/reference/spaces/app-core/devices#appdevicesview-record), [`AppEnrollAction`](/cua-sdk/reference/spaces/app-core/devices#appenrollaction-enum), [`AppEnrollmentKind`](/cua-sdk/reference/spaces/app-core/devices#appenrollmentkind-enum), [`AppEnrollMethod`](/cua-sdk/reference/spaces/app-core/devices#appenrollmethod-enum), [`AppEnrollOption`](/cua-sdk/reference/spaces/app-core/devices#appenrolloption-record), [`AppEnrollPhase`](/cua-sdk/reference/spaces/app-core/devices#appenrollphase-enum), [`AppEnrollState`](/cua-sdk/reference/spaces/app-core/devices#appenrollstate-record), [`AppEnrollView`](/cua-sdk/reference/spaces/app-core/devices#appenrollview-record), [`AppMachineInput`](/cua-sdk/reference/spaces/app-core/devices#appmachineinput-record), [`AppThisDevice`](/cua-sdk/reference/spaces/app-core/devices#appthisdevice-record), [`AppUnconfirmedMachine`](/cua-sdk/reference/spaces/app-core/devices#appunconfirmedmachine-record)
+**Devices**: [`app_approve_open`](/cua-sdk/reference/spaces/app-core/devices#app_approve_open), [`app_approve_reduce`](/cua-sdk/reference/spaces/app-core/devices#app_approve_reduce), [`app_approve_sheet_action_from_json`](/cua-sdk/reference/spaces/app-core/devices#app_approve_sheet_action_from_json), [`app_approve_view`](/cua-sdk/reference/spaces/app-core/devices#app_approve_view), [`app_devices_clean_name`](/cua-sdk/reference/spaces/app-core/devices#app_devices_clean_name), [`app_devices_input`](/cua-sdk/reference/spaces/app-core/devices#app_devices_input), [`app_devices_input_from_json`](/cua-sdk/reference/spaces/app-core/devices#app_devices_input_from_json), [`app_devices_view`](/cua-sdk/reference/spaces/app-core/devices#app_devices_view), [`app_enroll_action_from_json`](/cua-sdk/reference/spaces/app-core/devices#app_enroll_action_from_json), [`app_enroll_initial`](/cua-sdk/reference/spaces/app-core/devices#app_enroll_initial), [`app_enroll_reduce`](/cua-sdk/reference/spaces/app-core/devices#app_enroll_reduce), [`app_enroll_state_from_json`](/cua-sdk/reference/spaces/app-core/devices#app_enroll_state_from_json), [`app_enroll_view`](/cua-sdk/reference/spaces/app-core/devices#app_enroll_view), [`app_machine_access_notice`](/cua-sdk/reference/spaces/app-core/devices#app_machine_access_notice), [`AppActivityRow`](/cua-sdk/reference/spaces/app-core/devices#appactivityrow-record), [`AppApprovalPrompt`](/cua-sdk/reference/spaces/app-core/devices#appapprovalprompt-record), [`AppApproveRequest`](/cua-sdk/reference/spaces/app-core/devices#appapproverequest-record), [`AppApproveSheetAction`](/cua-sdk/reference/spaces/app-core/devices#appapprovesheetaction-enum), [`AppApproveSheetState`](/cua-sdk/reference/spaces/app-core/devices#appapprovesheetstate-record), [`AppApproveSheetView`](/cua-sdk/reference/spaces/app-core/devices#appapprovesheetview-record), [`AppAuditInput`](/cua-sdk/reference/spaces/app-core/devices#appauditinput-record), [`AppBannerTone`](/cua-sdk/reference/spaces/app-core/devices#appbannertone-enum), [`AppDeviceAction`](/cua-sdk/reference/spaces/app-core/devices#appdeviceaction-enum), [`AppDeviceBanner`](/cua-sdk/reference/spaces/app-core/devices#appdevicebanner-record), [`AppDeviceConfirm`](/cua-sdk/reference/spaces/app-core/devices#appdeviceconfirm-record), [`AppDeviceInput`](/cua-sdk/reference/spaces/app-core/devices#appdeviceinput-record), [`AppDeviceRow`](/cua-sdk/reference/spaces/app-core/devices#appdevicerow-record), [`AppDevicesInput`](/cua-sdk/reference/spaces/app-core/devices#appdevicesinput-record), [`AppDevicesLabels`](/cua-sdk/reference/spaces/app-core/devices#appdeviceslabels-record), [`AppDevicesView`](/cua-sdk/reference/spaces/app-core/devices#appdevicesview-record), [`AppEnrollAction`](/cua-sdk/reference/spaces/app-core/devices#appenrollaction-enum), [`AppEnrollmentKind`](/cua-sdk/reference/spaces/app-core/devices#appenrollmentkind-enum), [`AppEnrollMethod`](/cua-sdk/reference/spaces/app-core/devices#appenrollmethod-enum), [`AppEnrollOption`](/cua-sdk/reference/spaces/app-core/devices#appenrolloption-record), [`AppEnrollPhase`](/cua-sdk/reference/spaces/app-core/devices#appenrollphase-enum), [`AppEnrollState`](/cua-sdk/reference/spaces/app-core/devices#appenrollstate-record), [`AppEnrollView`](/cua-sdk/reference/spaces/app-core/devices#appenrollview-record), [`AppMachineAccessNotice`](/cua-sdk/reference/spaces/app-core/devices#appmachineaccessnotice-record), [`AppMachineInput`](/cua-sdk/reference/spaces/app-core/devices#appmachineinput-record), [`AppThisDevice`](/cua-sdk/reference/spaces/app-core/devices#appthisdevice-record), [`AppUnconfirmedMachine`](/cua-sdk/reference/spaces/app-core/devices#appunconfirmedmachine-record)
**Cua Cloud billing**: [`app_billing_status`](/cua-sdk/reference/spaces/app-core/billing#app_billing_status), [`AppBillingCard`](/cua-sdk/reference/spaces/app-core/billing#appbillingcard-record), [`AppBillingCredit`](/cua-sdk/reference/spaces/app-core/billing#appbillingcredit-record), [`AppBillingStatus`](/cua-sdk/reference/spaces/app-core/billing#appbillingstatus-record), [`AppCreditNotice`](/cua-sdk/reference/spaces/app-core/billing#appcreditnotice-record)
diff --git a/docs/content/docs/cua-sdk/reference/spaces/app-core/spaces.mdx b/docs/content/docs/cua-sdk/reference/spaces/app-core/spaces.mdx
index 950fe1a71b..ecb4621115 100644
--- a/docs/content/docs/cua-sdk/reference/spaces/app-core/spaces.mdx
+++ b/docs/content/docs/cua-sdk/reference/spaces/app-core/spaces.mdx
@@ -373,6 +373,73 @@ AppNoticeKind::Create
| `Switch` | Switched Spaces. |
| `Create` | Created (or creating) Spaces. |
+## `AppNewSpaceOn` record
+
+| Field | Type | Default | Description |
+| --- | --- | --- | --- |
+| `label` | `String` | | The button's label. |
+| `on` | `String` | | The "Run on" entry it picks (`host:<machine id>`; the wizard's `ChoosePlacement`). |
+
+## `app_hosted_rows`
+
+The Spaces one of your machines provides (`machine_space_id` is its
+`relay:<id>`), as sidebar rows.
+
+<Tabs items={['Swift', 'Rust']} groupId="sdk-lang" persist>
+<Tab value="Swift">
+
+```swift
+func appHostedRows(spaces: [AppSpace], machineSpaceId: String, selectedId: String) -> [AppSidebarRow]
+```
+
+</Tab>
+<Tab value="Rust">
+
+```rust
+pub fn app_hosted_rows(spaces: Vec<AppSpace>, machine_space_id: String, selected_id: String) -> Vec<AppSidebarRow>
+```
+
+</Tab>
+</Tabs>
+
+| Parameter | Type | Default |
+| --- | --- | --- |
+| `spaces` | [`Vec<AppSpace>`](#appspace-record) | required |
+| `machine_space_id` | `String` | required |
+| `selected_id` | `String` | required |
+
+**Returns** [`Vec<AppSidebarRow>`](#appsidebarrow-record)
+
+## `app_without_this_relay_machine`
+
+The roster without this machine's own relay entry (`this_machine_id`
+is `HostStatus.machine_id`): it is "This machine", not one of "My
+machines". Matched by id, never by name.
+
+<Tabs items={['Swift', 'Rust']} groupId="sdk-lang" persist>
+<Tab value="Swift">
+
+```swift
+func appWithoutThisRelayMachine(spaces: [AppSpace], thisMachineId: String?) -> [AppSpace]
+```
+
+</Tab>
+<Tab value="Rust">
+
+```rust
+pub fn app_without_this_relay_machine(spaces: Vec<AppSpace>, this_machine_id: Option<String>) -> Vec<AppSpace>
+```
+
+</Tab>
+</Tabs>
+
+| Parameter | Type | Default |
+| --- | --- | --- |
+| `spaces` | [`Vec<AppSpace>`](#appspace-record) | required |
+| `this_machine_id` | `Option<String>` | required |
+
+**Returns** [`Vec<AppSpace>`](#appspace-record)
+
## `AppRemoteWindow` record
| Field | Type | Default | Description |
@@ -412,6 +479,8 @@ Returned by [`app_roster_initial`](#app_roster_initial), [`app_roster_reduce`](#
## `AppSidebarRow` record
+Returned by [`app_hosted_rows`](#app_hosted_rows).
+
| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `id` | `String` | | Space id. |
@@ -448,7 +517,7 @@ Returned by [`app_sidebar`](#app_sidebar).
## `AppSpace` record
-Returned by [`app_creates_compose`](/cua-sdk/reference/spaces/app-core/creates#app_creates_compose), [`app_rows_to_spaces`](#app_rows_to_spaces), [`app_spaces_from_json`](#app_spaces_from_json), [`app_this_machine_space`](#app_this_machine_space), [`app_with_this_machine`](/cua-sdk/reference/spaces/app-core/this-machine#app_with_this_machine).
+Returned by [`app_creates_compose`](/cua-sdk/reference/spaces/app-core/creates#app_creates_compose), [`app_rows_to_spaces`](#app_rows_to_spaces), [`app_spaces_from_json`](#app_spaces_from_json), [`app_this_machine_space`](#app_this_machine_space), [`app_with_this_machine`](/cua-sdk/reference/spaces/app-core/this-machine#app_with_this_machine), [`app_without_this_relay_machine`](#app_without_this_relay_machine).
| Field | Type | Default | Description |
| --- | --- | --- | --- |
@@ -496,7 +565,7 @@ Returned by [`app_agent_rows`](/cua-sdk/reference/spaces/agents-app-core#app_age
## `AppSpaceDetail` record
-Returned by [`app_space_detail`](#app_space_detail), [`app_space_detail_live`](/cua-sdk/reference/spaces/app-core/stream#app_space_detail_live), [`app_space_detail_with`](#app_space_detail_with).
+Returned by [`app_space_detail`](#app_space_detail), [`app_space_detail_for`](#app_space_detail_for), [`app_space_detail_live`](/cua-sdk/reference/spaces/app-core/stream#app_space_detail_live), [`app_space_detail_with`](#app_space_detail_with).
| Field | Type | Default | Description |
| --- | --- | --- | --- |
@@ -516,6 +585,9 @@ Returned by [`app_space_detail`](#app_space_detail), [`app_space_detail_live`](/
| `sections` | `Vec<String>` | | The sections under the facts, in order (Stream, Agents, Teleport). |
| `credit_notice` / `creditNotice` | [`Option<AppCreditNotice>`](/cua-sdk/reference/spaces/app-core/billing#appcreditnotice-record) | | A cloud Space refused for want of credit: one line and "Add credit" (the website billing page). |
| `power_error` / `powerError` | `Option<String>` | | Why turning it off or on failed, shown inline under the preview. |
+| `access` | [`Option<AppMachineAccessNotice>`](/cua-sdk/reference/spaces/app-core/devices#appmachineaccessnotice-record) | | Signed in, but this device is not enrolled: a machine reached through the relay is listed with its Connect greyed out under this line and its one action (`detail_for`). |
+| `desktop_note` / `desktopNote` | `Option<String>` | | One of your machines that does not share its desktop: the line shown in place of its desktop, Stream, Agents and Teleport (`desktop_note`). |
+| `new_space` / `newSpace` | [`Option<AppNewSpaceOn>`](#appnewspaceon-record) | | With `Self.desktop_note`, when the machine provides Spaces: "New Space on &lt;name&gt;…", which opens New Space on it. |
## `AppSpaceProgress` record
@@ -882,6 +954,41 @@ pub fn app_space_detail(space: AppSpace) -> AppSpaceDetail
**Returns** [`AppSpaceDetail`](#appspacedetail-record)
+## `app_space_detail_for`
+
+`app_space_detail_with` as this device sees it: `access` (from
+`app_machine_access_notice`) greys out Connect on every Space reached
+through the relay while this device is not enrolled; one of your
+machines that does not share its desktop shows its note in place of the
+desktop, Stream, Agents and Teleport.
+
+<Tabs items={['Swift', 'Rust']} groupId="sdk-lang" persist>
+<Tab value="Swift">
+
+```swift
+func appSpaceDetailFor(space: AppSpace, usage: AppSpaceUsage?, hostArch: String?, experiments: AppExperiments, access: AppMachineAccessNotice?) -> AppSpaceDetail
+```
+
+</Tab>
+<Tab value="Rust">
+
+```rust
+pub fn app_space_detail_for(space: AppSpace, usage: Option<AppSpaceUsage>, host_arch: Option<String>, experiments: AppExperiments, access: Option<AppMachineAccessNotice>) -> AppSpaceDetail
+```
+
+</Tab>
+</Tabs>
+
+| Parameter | Type | Default |
+| --- | --- | --- |
+| `space` | [`AppSpace`](#appspace-record) | required |
+| `usage` | [`Option<AppSpaceUsage>`](/cua-sdk/reference/spaces/app-core/stream#appspaceusage-record) | required |
+| `host_arch` | `Option<String>` | required |
+| `experiments` | [`AppExperiments`](/cua-sdk/reference/spaces/app-core/experiments#appexperiments-record) | required |
+| `access` | [`Option<AppMachineAccessNotice>`](/cua-sdk/reference/spaces/app-core/devices#appmachineaccessnotice-record) | required |
+
+**Returns** [`AppSpaceDetail`](#appspacedetail-record)
+
## `app_space_detail_with`
`app_space_detail_live` without what Settings, Experiments hides (the
diff --git a/docs/content/docs/cua-sdk/reference/spaces/app-core/stream.mdx b/docs/content/docs/cua-sdk/reference/spaces/app-core/stream.mdx
index 039e672c76..9e9752a2c7 100644
--- a/docs/content/docs/cua-sdk/reference/spaces/app-core/stream.mdx
+++ b/docs/content/docs/cua-sdk/reference/spaces/app-core/stream.mdx
@@ -180,6 +180,8 @@ Returned by [`app_desktop_cover`](#app_desktop_cover).
| `button_help` / `buttonHelp` | `Option<String>` | | Its tooltip. |
| `open_stream` / `openStream` | `bool` | | The shell opens a stream session now (none is open, and one is wanted). |
| `retry` | `bool` | | The shell starts the open session again (Try again was pressed). |
+| `button_disabled` / `buttonDisabled` | `bool` | | The button shows greyed out (Connect while this device is not enrolled). |
+| `action` | `Option<String>` | | The one action above a greyed-out Connect ("Enroll This Mac…"): the shell opens the enroll sheet. |
## `AppDesktopCoverInput` record
@@ -190,6 +192,7 @@ Returned by [`app_desktop_cover`](#app_desktop_cover).
| `auto_connect` / `autoConnect` | `bool` | | Settings: "Connect to the desktop automatically". |
| `connect_requested` / `connectRequested` | `bool` | | Connect (or Try again) was pressed for this Space. |
| `stream` | [`AppStreamPhase`](#appstreamphase-enum) | | The shell's stream session. |
+| `access` | [`Option<AppMachineAccessNotice>`](/cua-sdk/reference/spaces/app-core/devices#appmachineaccessnotice-record) | | The detail's `access`: this device is signed in but not enrolled, so Connect shows greyed out under this notice and its action. |
## `AppDesktopCoverKind` enum
diff --git a/docs/content/docs/cua-sdk/reference/types.mdx b/docs/content/docs/cua-sdk/reference/types.mdx
index 7dd2f1b5b7..06f2c8d625 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
291 items. Methods are listed on their object.
-The 713 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).
+The 719 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).
| Item | Kind | Summary |
| --- | --- | --- |
diff --git a/libs/cua-spacesd/crates/cua-relay/src/api.rs b/libs/cua-spacesd/crates/cua-relay/src/api.rs
index e8063d27ae..4a51f3f414 100644
--- a/libs/cua-spacesd/crates/cua-relay/src/api.rs
+++ b/libs/cua-spacesd/crates/cua-relay/src/api.rs
@@ -485,23 +485,75 @@ async fn list(State(relay): State<Relay>, headers: HeaderMap) -> Response {
Ok(c) => c,
Err(r) => return r,
};
- if let Err(r) = caller.require_device() {
- return r;
+ // A signed-in device that is not enrolled (never, waiting for
+ // approval, expired) and so sends no device session still sees which
+ // machines the account has, so the apps can list them with a
+ // greyed-out Connect and say how to enroll. It gets names only: no
+ // address, allowlist, viewers, version or who is connected, and every
+ // route that reaches a machine still needs an enrolled device. A
+ // session that was sent and is not valid (another account's, revoked,
+ // or forgotten by a relay restart) is refused as before, so a client
+ // opens a new one.
+ let locked =
+ matches!(&caller, Caller::Account(_, Err(_))) && session_header(&headers).is_none();
+ if !locked {
+ if let Err(r) = caller.require_device() {
+ return r;
+ }
}
let machines = match &caller {
Caller::Account(who, _) => relay
.directory
.visible_to(who)
.into_iter()
- .map(|(r, role)| view(&relay, &headers, &r, role))
+ .map(|(r, role)| {
+ if locked {
+ locked_view(&relay, &r, role)
+ } else {
+ view(&relay, &headers, &r, role)
+ }
+ })
.collect::<Vec<_>>(),
Caller::Machine(record) => vec![view(&relay, &headers, record, Role::Owner)],
};
- finish(
- &relay,
- &caller,
- Json(serde_json::json!({ "machines": machines })).into_response(),
- )
+ let mut response = Json(serde_json::json!({ "machines": machines })).into_response();
+ if locked {
+ response.headers_mut().insert(
+ crate::devices::ENROLLMENT_HEADER,
+ axum::http::HeaderValue::from_static(NOT_ENROLLED_FLAG),
+ );
+ }
+ finish(&relay, &caller, response)
+}
+
+/// `x-cua-device-enrollment` on a listing for a device that is not
+/// enrolled: the machines are listed by name only and cannot be reached.
+pub const NOT_ENROLLED_FLAG: &str = "not-enrolled";
+
+/// [`view`] for a device that is not enrolled: what the machine is called,
+/// whether it is online and what it is (a host, a Space a host provides,
+/// a Space in your cloud), nothing that reaches or describes access to it.
+fn locked_view(relay: &Relay, record: &MachineRecord, role: Role) -> MachineView {
+ let online = relay.machine(&record.id).is_some_and(
+ |m| matches!(&m.registrant, Registrant::Account(owner) if owner == &record.owner.id),
+ );
+ MachineView {
+ id: record.id.clone(),
+ name: record.name.clone(),
+ owner: record.owner.clone(),
+ role: role.as_str().into(),
+ online,
+ sharing: record.sharing,
+ version: String::new(),
+ connected_at: None,
+ url: String::new(),
+ allow: Vec::new(),
+ viewers: Vec::new(),
+ clients: Vec::new(),
+ host: record.host.clone(),
+ confirmed: record.confirmed,
+ meta: record.meta.clone(),
+ }
}
async fn get_one(
diff --git a/libs/cua-spacesd/crates/cua-relay/tests/device_enrollment.rs b/libs/cua-spacesd/crates/cua-relay/tests/device_enrollment.rs
index 3ac38f7557..9d94042dbb 100644
--- a/libs/cua-spacesd/crates/cua-relay/tests/device_enrollment.rs
+++ b/libs/cua-spacesd/crates/cua-relay/tests/device_enrollment.rs
@@ -353,13 +353,30 @@ async fn clients_need_an_enrolled_device_after_the_grace_period() {
issuer.set_auth_time("ada", now() as i64 - 3600);
let ada = issuer.token("ada", Some("[email protected]"), "cua-relay", 300);
// Hosting needs no enrolled device: a host only registers itself.
- let reg = register_machine(&base, &ada, "machine-aaaa", &[]).await;
+ let reg = register_machine(&base, &ada, "machine-aaaa", &["[email protected]"]).await;
let machine_token = reg["machine_token"].as_str().unwrap().to_owned();
- // The account token alone lists nothing and reaches nothing.
+ // The account token alone lists the machines by name only (so the apps
+ // can show them with a greyed-out Connect) and reaches nothing.
let r = get(&base, "/v1/machines", &ada, None).await;
- assert_eq!(r.status(), StatusCode::FORBIDDEN);
- assert!(r.text().await.unwrap().contains("not enrolled"));
+ assert_eq!(r.status(), StatusCode::OK);
+ assert_eq!(
+ r.headers().get("x-cua-device-enrollment").unwrap(),
+ "not-enrolled"
+ );
+ let list: Value = r.json().await.unwrap();
+ let m = &list["machines"][0];
+ assert_eq!(m["id"], "machine-aaaa");
+ assert_eq!(m["role"], "owner");
+ assert_eq!(m["url"], "", "no address for a device that is not enrolled");
+ assert!(m["allow"].as_array().unwrap().is_empty());
+ assert!(m["clients"].as_array().unwrap().is_empty());
+ assert_eq!(
+ get(&base, "/v1/machines/machine-aaaa", &ada, None)
+ .await
+ .status(),
+ StatusCode::FORBIDDEN
+ );
let r = get(&base, "/m/machine-aaaa/v1/anything", &ada, None).await;
assert_eq!(r.status(), StatusCode::FORBIDDEN);
// Re-registering (token rotation) needs the machine token or a device.
diff --git a/libs/cua-spacesd/crates/cua-spacesd-server/src/auth.rs b/libs/cua-spacesd/crates/cua-spacesd-server/src/auth.rs
index 455dd39ef3..d9b32e5c32 100644
--- a/libs/cua-spacesd/crates/cua-spacesd-server/src/auth.rs
+++ b/libs/cua-spacesd/crates/cua-spacesd-server/src/auth.rs
@@ -697,6 +697,10 @@ pub struct CallerIdentity {
pub viewer: Option<Arc<ViewerGrant>>,
/// The relay-verified account of a relayed call.
pub account: Option<RelayCaller>,
+ /// A relayed call to a machine that does not share its desktop
+ /// ([`ExternalGrant::host_only`]): `GetCapabilities` reports the
+ /// desktop's features unsupported to it.
+ pub host_only: bool,
}
/// Tower layer that authenticates gRPC (and gRPC-Web) calls.
@@ -779,6 +783,7 @@ where
asserted: true,
viewer: Some(viewer),
account: grant.account,
+ host_only: grant.host_only,
});
let mut inner = self.inner.clone();
std::mem::swap(&mut self.inner, &mut inner);
@@ -816,6 +821,7 @@ where
asserted: true,
viewer: None,
account: grant.account,
+ host_only: grant.host_only,
});
let mut inner = self.inner.clone();
std::mem::swap(&mut self.inner, &mut inner);
@@ -852,6 +858,7 @@ where
asserted: true,
viewer: Some(Arc::new(grant)),
account: None,
+ host_only: false,
});
let mut inner = self.inner.clone();
std::mem::swap(&mut self.inner, &mut inner);
@@ -925,6 +932,7 @@ where
asserted: false,
viewer: None,
account: None,
+ host_only: false,
});
let mut inner = self.inner.clone();
std::mem::swap(&mut self.inner, &mut inner);
diff --git a/libs/cua-spacesd/crates/cua-spacesd-server/src/services/system.rs b/libs/cua-spacesd/crates/cua-spacesd-server/src/services/system.rs
index 03afa54b17..06360cd773 100644
--- a/libs/cua-spacesd/crates/cua-spacesd-server/src/services/system.rs
+++ b/libs/cua-spacesd/crates/cua-spacesd-server/src/services/system.rs
@@ -552,12 +552,34 @@ fn require_root(caller: &crate::auth::CallerIdentity, what: &str) -> Result<(),
Ok(())
}
+/// Why the desktop's features are unsupported for a relayed caller of a
+/// machine that does not share its desktop (it only provides Spaces).
+pub const DESKTOP_NOT_SHARED: &str =
+ "this machine does not share its desktop (it only provides Spaces)";
+
+/// `features` with every desktop feature ([`crate::provider::DESKTOP_FEATURES`])
+/// unsupported because the desktop is not shared.
+fn desktop_not_shared(mut features: Vec<Feature>) -> Vec<Feature> {
+ for f in features
+ .iter_mut()
+ .filter(|f| crate::provider::DESKTOP_FEATURES.contains(&f.name.as_str()))
+ {
+ f.supported = false;
+ DESKTOP_NOT_SHARED.clone_into(&mut f.limitation);
+ }
+ features
+}
+
#[tonic::async_trait]
impl SystemService for SystemServiceImpl {
async fn get_capabilities(
&self,
- _request: Request<GetCapabilitiesRequest>,
+ request: Request<GetCapabilitiesRequest>,
) -> Result<Response<GetCapabilitiesResponse>, Status> {
+ // A relayed caller of a machine that does not share its desktop
+ // reaches none of it: its features say so, so apps show the
+ // machine without Stream, Agents and Teleport.
+ let host_only = crate::auth::caller(&request).host_only;
let kernel = sysinfo::System::kernel_version().unwrap_or_default();
let (runtime, runtime_detail) = match self
.ctx
@@ -604,7 +626,11 @@ impl SystemService for SystemServiceImpl {
arch: architecture() as i32,
display_server: display_server as i32,
displays,
- features: self.features(),
+ features: if host_only {
+ desktop_not_shared(self.features())
+ } else {
+ self.features()
+ },
hostname: sysinfo::System::host_name().unwrap_or_default(),
// Await-token-file mode: initialized once the file holds a token
// (Init cannot and need not install one).
diff --git a/libs/cua-spacesd/crates/cua-spacesd-server/tests/host_spaces.rs b/libs/cua-spacesd/crates/cua-spacesd-server/tests/host_spaces.rs
index 548746bd45..877884a34f 100644
--- a/libs/cua-spacesd/crates/cua-spacesd-server/tests/host_spaces.rs
+++ b/libs/cua-spacesd/crates/cua-spacesd-server/tests/host_spaces.rs
@@ -286,6 +286,31 @@ async fn a_host_provides_spaces_through_the_relay_and_keeps_its_desktop_private(
.features
.iter()
.any(|f| f.name == "host_spaces" && f.supported));
+ // The desktop is not shared: its features say so to the relayed caller
+ // (apps hide Stream, Agents and Teleport), while the local token
+ // holder keeps the plain answer.
+ let stream = caps
+ .features
+ .iter()
+ .find(|f| f.name == "desktop_stream")
+ .unwrap();
+ assert!(!stream.supported);
+ assert_eq!(
+ stream.limitation,
+ cua_spacesd_server::services::system::DESKTOP_NOT_SHARED
+ );
+ let local_caps = client(&format!("http://{addr}"), HOST_TOKEN)
+ .await
+ .system()
+ .get_capabilities(GetCapabilitiesRequest {})
+ .await
+ .unwrap()
+ .into_inner();
+ assert!(local_caps
+ .features
+ .iter()
+ .filter(|f| f.name == "desktop_stream")
+ .all(|f| f.limitation != cua_spacesd_server::services::system::DESKTOP_NOT_SHARED));
let got = owner
.host_spaces()
.get_host_spaces(GetHostSpacesRequest {})
diff --git a/libs/cua-spacesd/tests/spaces-e2e/tests/relay_devices.rs b/libs/cua-spacesd/tests/spaces-e2e/tests/relay_devices.rs
index edc1180a8b..9233399e08 100644
--- a/libs/cua-spacesd/tests/spaces-e2e/tests/relay_devices.rs
+++ b/libs/cua-spacesd/tests/spaces-e2e/tests/relay_devices.rs
@@ -125,11 +125,11 @@ async fn devices_enroll_and_reach_machines_on_the_real_relay() {
.await
.is_err()
);
- // The session alone lists nothing.
- assert!(matches!(
- client.machines(&stale).await,
- Err(cua_host::Error::PermissionDenied(_))
- ));
+ // The session alone lists the machines by name only (the apps show
+ // them with a greyed-out Connect) and reaches none of them.
+ let listed = client.machines(&stale).await.unwrap();
+ assert_eq!(listed.len(), 1);
+ assert!(listed[0].url.is_empty() && listed[0].clients.is_empty());
// The first device needs a fresh sign-in.
let laptop = device(&url, &stale, "laptop", "laptop");
diff --git a/libs/cua/crates/cua-spaces-app-core/src/devices.rs b/libs/cua/crates/cua-spaces-app-core/src/devices.rs
index 2fa048633e..2e62fb8bbc 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/devices.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/devices.rs
@@ -751,6 +751,74 @@ pub fn devices_view(input: &DevicesInput, now: u64) -> DevicesView {
}
}
+// ---- Opening a machine while this device is not enrolled --------------
+
+/// Why this device cannot open the account's machines (signed in, but not
+/// enrolled): the one line above a machine's greyed-out Connect, its
+/// status word and the one action that fixes it (the enroll sheet, which
+/// offers a fresh sign-in or an approval from an enrolled device).
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MachineAccessNotice {
+ /// This device's enrollment.
+ pub kind: EnrollmentKind,
+ /// The machine's Status: "Not enrolled", "Waiting for approval", ...
+ pub status: String,
+ /// The line above the disabled Connect.
+ pub text: String,
+ /// The action's label; it opens the enroll sheet.
+ pub action_label: String,
+}
+
+/// "Enroll This Mac…": the notice's action for a device that never
+/// enrolled, waits for approval or was revoked.
+pub const ENROLL_THIS_MAC_LABEL: &str = "Enroll This Mac\u{2026}";
+/// "Re-verify This Mac…": the notice's action once enrollment expired.
+pub const REVERIFY_THIS_MAC_LABEL: &str = "Re-verify This Mac\u{2026}";
+
+/// The notice for this device's enrollment `kind`: `None` while it may
+/// open the account's machines (enrolled, or still in the grace period).
+/// `pending_code` is the one-time code this device shows while it waits.
+pub fn machine_access_notice(
+ kind: EnrollmentKind,
+ pending_code: Option<&str>,
+) -> Option<MachineAccessNotice> {
+ let notice = |status: &str, text: String, action: &str| MachineAccessNotice {
+ kind,
+ status: status.into(),
+ text,
+ action_label: action.into(),
+ };
+ match kind {
+ EnrollmentKind::Enrolled | EnrollmentKind::Grace => None,
+ EnrollmentKind::NeedsEnrollment => Some(notice(
+ "Not enrolled",
+ "Enroll this Mac to connect to your other machines.".into(),
+ ENROLL_THIS_MAC_LABEL,
+ )),
+ EnrollmentKind::Waiting => Some(notice(
+ "Waiting for approval",
+ match pending_code.map(str::trim).filter(|c| !c.is_empty()) {
+ Some(code) => format!(
+ "Waiting for approval. On an enrolled device, approve this Mac with the code {code}."
+ ),
+ None => "Waiting for approval. Approve this Mac in Settings \u{203a} Devices on an enrolled device.".into(),
+ },
+ ENROLL_THIS_MAC_LABEL,
+ )),
+ EnrollmentKind::Due => Some(notice(
+ "Re-verification due",
+ "This Mac\u{2019}s access expired. Re-verify it to connect to your other machines.".into(),
+ REVERIFY_THIS_MAC_LABEL,
+ )),
+ EnrollmentKind::Revoked => Some(notice(
+ "Revoked",
+ "This Mac was revoked. Enroll it again to connect to your other machines.".into(),
+ ENROLL_THIS_MAC_LABEL,
+ )),
+ }
+}
+
// ---- Enroll this device ------------------------------------------------
/// How this device enrolls.
@@ -1764,4 +1832,36 @@ mod tests {
let s = failed(&expired, &one_match);
assert!(!s.code_expired);
}
+
+ /// Signed in but not enrolled: every state says why Connect is greyed
+ /// out and offers the one action; enrolled (or in the grace period)
+ /// says nothing.
+ #[test]
+ fn machine_access_notice_covers_every_enrollment_state() {
+ assert!(machine_access_notice(EnrollmentKind::Enrolled, None).is_none());
+ assert!(machine_access_notice(EnrollmentKind::Grace, None).is_none());
+ let never = machine_access_notice(EnrollmentKind::NeedsEnrollment, None).unwrap();
+ assert_eq!(never.status, "Not enrolled");
+ assert_eq!(never.action_label, ENROLL_THIS_MAC_LABEL);
+ assert!(never.text.contains("Enroll this Mac"));
+ let waiting = machine_access_notice(EnrollmentKind::Waiting, Some("K7QX-M2RP")).unwrap();
+ assert_eq!(waiting.status, "Waiting for approval");
+ assert!(waiting.text.contains("K7QX-M2RP"), "{}", waiting.text);
+ // No code this launch: how to approve from another device instead.
+ let waiting = machine_access_notice(EnrollmentKind::Waiting, Some(" ")).unwrap();
+ assert!(
+ waiting.text.contains("Settings \u{203a} Devices"),
+ "{}",
+ waiting.text
+ );
+ let expired = machine_access_notice(EnrollmentKind::Due, None).unwrap();
+ assert_eq!(expired.action_label, REVERIFY_THIS_MAC_LABEL);
+ assert!(expired.text.contains("expired"));
+ let revoked = machine_access_notice(EnrollmentKind::Revoked, None).unwrap();
+ assert_eq!(revoked.action_label, ENROLL_THIS_MAC_LABEL);
+ for n in [never, waiting, expired, revoked] {
+ assert!(!n.text.contains('\u{2014}'), "{}", n.text);
+ assert!(n.text.len() < 100, "one short line: {}", n.text);
+ }
+ }
}
diff --git a/libs/cua/crates/cua-spaces-app-core/src/spaces/cover.rs b/libs/cua/crates/cua-spaces-app-core/src/spaces/cover.rs
index 4b5981ab85..9711ec6ed4 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/spaces/cover.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/spaces/cover.rs
@@ -27,6 +27,8 @@ pub const CONNECTING_TEXT: &str = "Connecting\u{2026}";
pub const CONNECT_BUTTON: &str = "Connect";
/// Its tooltip.
pub const CONNECT_HELP: &str = "Show the live desktop";
+/// Its tooltip while this device is not enrolled.
+pub const CONNECT_DISABLED_HELP: &str = "Enroll this Mac to connect";
/// The line when the stream could not open.
pub const FAILED_TEXT: &str = "Could not connect to the desktop";
/// The retry button.
@@ -64,6 +66,10 @@ pub struct DesktopCoverInput {
pub connect_requested: bool,
/// The shell's stream session.
pub stream: StreamPhase,
+ /// The detail's `access`: this device is signed in but not enrolled,
+ /// so Connect shows greyed out under this notice and its action.
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub access: Option<crate::devices::MachineAccessNotice>,
}
/// How the cover draws.
@@ -98,6 +104,14 @@ pub struct DesktopCover {
pub open_stream: bool,
/// The shell starts the open session again (Try again was pressed).
pub retry: bool,
+ /// The button shows greyed out (Connect while this device is not
+ /// enrolled).
+ #[serde(default, skip_serializing_if = "std::ops::Not::not")]
+ pub button_disabled: bool,
+ /// The one action above a greyed-out Connect ("Enroll This Mac…"): the
+ /// shell opens the enroll sheet.
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub action: Option<String>,
}
/// The cover for `input`.
@@ -109,7 +123,22 @@ pub fn desktop_cover(input: &DesktopCoverInput) -> DesktopCover {
button_help: help.map(str::to_string),
open_stream: false,
retry: false,
+ button_disabled: false,
+ action: None,
};
+ // Signed in, not enrolled: why, its one action, and Connect greyed out.
+ if let Some(access) = &input.access {
+ return DesktopCover {
+ button_disabled: true,
+ action: Some(access.action_label.clone()),
+ ..cover(
+ DesktopCoverKind::Connect,
+ Some(&access.text),
+ Some(CONNECT_BUTTON),
+ Some(CONNECT_DISABLED_HELP),
+ )
+ };
+ }
if !input.can_stream {
return cover(
DesktopCoverKind::Status,
@@ -193,9 +222,42 @@ mod tests {
auto_connect: true,
connect_requested: false,
stream,
+ access: None,
}
}
+ /// Signed in, not enrolled: Connect greyed out under the notice and its
+ /// one action, whatever the setting or the stream says.
+ #[test]
+ fn an_unenrolled_device_sees_connect_greyed_out_with_its_action() {
+ for kind in [
+ crate::devices::EnrollmentKind::NeedsEnrollment,
+ crate::devices::EnrollmentKind::Waiting,
+ crate::devices::EnrollmentKind::Due,
+ ] {
+ let notice = crate::devices::machine_access_notice(kind, None).unwrap();
+ for auto_connect in [true, false] {
+ let c = desktop_cover(&DesktopCoverInput {
+ can_stream: false,
+ auto_connect,
+ access: Some(notice.clone()),
+ ..input(StreamPhase::NoSession)
+ });
+ assert_eq!(c.kind, DesktopCoverKind::Connect);
+ assert_eq!(c.button.as_deref(), Some(CONNECT_BUTTON));
+ assert!(c.button_disabled && !c.open_stream && !c.retry);
+ assert_eq!(c.text.as_deref(), Some(notice.text.as_str()));
+ assert_eq!(c.action.as_deref(), Some(notice.action_label.as_str()));
+ }
+ }
+ // Enrolled: Connect works as before.
+ let c = desktop_cover(&DesktopCoverInput {
+ auto_connect: false,
+ ..input(StreamPhase::NoSession)
+ });
+ assert!(!c.button_disabled && c.action.is_none());
+ }
+
#[test]
fn auto_connect_opens_the_stream_and_says_connecting() {
let c = desktop_cover(&input(StreamPhase::NoSession));
diff --git a/libs/cua/crates/cua-spaces-app-core/src/spaces/sidebar.rs b/libs/cua/crates/cua-spaces-app-core/src/spaces/sidebar.rs
index 9e20f530b6..def848b1c1 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/spaces/sidebar.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/spaces/sidebar.rs
@@ -454,6 +454,99 @@ pub struct SpaceDetail {
/// Why turning it off or on failed, shown inline under the preview.
#[serde(default)]
pub power_error: Option<String>,
+ /// Signed in, but this device is not enrolled: a machine reached
+ /// through the relay is listed with its Connect greyed out under this
+ /// line and its one action ([`detail_for`]).
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub access: Option<crate::devices::MachineAccessNotice>,
+ /// One of your machines that does not share its desktop: the line
+ /// shown in place of its desktop, Stream, Agents and Teleport
+ /// ([`desktop_note`]).
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub desktop_note: Option<String>,
+ /// With [`Self::desktop_note`], when the machine provides Spaces:
+ /// "New Space on <name>…", which opens New Space on it.
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub new_space: Option<NewSpaceOn>,
+}
+
+/// "New Space on <machine>…": New Space with "Run on" set to that machine.
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct NewSpaceOn {
+ /// The button's label.
+ pub label: String,
+ /// The "Run on" entry it picks (`host:<machine id>`; the wizard's
+ /// `ChoosePlacement`).
+ pub on: String,
+}
+
+/// spacesd's feature for a machine that provides Spaces.
+pub const HOST_SPACES_FEATURE: &str = "host_spaces";
+
+/// One of your machines itself, reached through the relay: not a Space it
+/// provides and not a Space in your cloud.
+pub fn is_your_machine(space: &Space) -> bool {
+ space.id.starts_with("relay:")
+ && space.host.as_deref().is_none_or(str::is_empty)
+ && !in_your_cloud(space)
+}
+
+/// Whether one of your machines shares its own desktop, when it said so:
+/// it answered with its features, and a machine that does not share its
+/// desktop reports the desktop's features unsupported to you (cua-spacesd
+/// with `share_desktop` off). `None` when it is not one of your machines
+/// or has not answered (an older cua-spacesd always reports them, so it
+/// counts as sharing, as before).
+pub fn shares_desktop(space: &Space) -> Option<bool> {
+ let sdk = space.sdk.as_ref()?;
+ if !is_your_machine(space) || !sdk.reachable || sdk.features.is_empty() {
+ return None;
+ }
+ Some(super::has_feature(space, super::feature::DESKTOP_STREAM))
+}
+
+/// The line in place of a machine's desktop when it does not share it:
+/// that you can still create Spaces on it, or that it shares neither.
+pub fn desktop_note(space: &Space) -> Option<String> {
+ if shares_desktop(space)? {
+ return None;
+ }
+ let name = &space.name;
+ Some(if super::has_feature(space, HOST_SPACES_FEATURE) {
+ format!("{name} isn\u{2019}t sharing its desktop. You can still create Spaces on it.")
+ } else {
+ format!("{name} isn\u{2019}t sharing its desktop or Spaces.")
+ })
+}
+
+/// The roster without this machine's own relay entry
+/// (`relay:<this_machine_id>`, listed once it shares its desktop or
+/// provides Spaces): this machine has its own place ("This machine"), not
+/// one under "My machines". Matched by this install's relay machine id,
+/// never by name, so another machine of the same name stays; the Spaces it
+/// provides stay too.
+pub fn without_this_relay_machine(spaces: &[Space], this_machine_id: Option<&str>) -> Vec<Space> {
+ let Some(own) = this_machine_id
+ .filter(|id| !id.is_empty())
+ .map(|id| format!("relay:{id}"))
+ else {
+ return spaces.to_vec();
+ };
+ spaces.iter().filter(|s| s.id != own).cloned().collect()
+}
+
+/// The Spaces one of your machines provides, as sidebar rows (its detail
+/// lists them under New Space).
+pub fn hosted_rows(spaces: &[Space], machine_space_id: &str, selected_id: &str) -> Vec<SidebarRow> {
+ let Some(machine) = machine_space_id.strip_prefix("relay:") else {
+ return vec![];
+ };
+ spaces
+ .iter()
+ .filter(|s| s.host.as_deref() == Some(machine))
+ .map(|s| row(s, Some(selected_id)))
+ .collect()
}
/// What a toolbar button does.
@@ -950,6 +1043,9 @@ pub fn detail_live(
delete_label: delete_label.into(),
remove_only,
power_error: power_error(space),
+ access: None,
+ desktop_note: None,
+ new_space: None,
actions,
confirm: delete_confirm(space, remove_only, delete_label),
sections: if show_sections {
@@ -979,6 +1075,62 @@ pub fn detail_with(
d
}
+/// [`detail_with`] as this device sees it. `access` is why this device
+/// cannot open the account's machines (signed in, not enrolled;
+/// [`crate::devices::machine_access_notice`]): every Space reached through
+/// the relay then shows its Connect greyed out under that line, says why
+/// in its Status, and nothing that needs a connection is offered. One of
+/// your machines that does not share its desktop shows [`desktop_note`] in
+/// place of its desktop, Stream, Agents and Teleport, and New Space on it
+/// when it provides Spaces.
+pub fn detail_for(
+ space: &Space,
+ usage: Option<&SpaceUsage>,
+ host_arch: Option<&str>,
+ experiments: &crate::experiments::Experiments,
+ access: Option<&crate::devices::MachineAccessNotice>,
+) -> SpaceDetail {
+ let mut d = detail_with(space, usage, host_arch, experiments);
+ let connection = [
+ DetailActionId::Teleport,
+ DetailActionId::Pip,
+ DetailActionId::Share,
+ DetailActionId::Open,
+ ];
+ if let Some(access) = access.filter(|_| space.id.starts_with("relay:")) {
+ d.can_stream = false;
+ d.show_sections = false;
+ d.sections.clear();
+ d.preview_text = access.text.clone();
+ if let Some(status) = d.facts.iter_mut().find(|f| f.label == "Status") {
+ status.value = access.status.clone();
+ }
+ for a in d.actions.iter_mut().filter(|a| connection.contains(&a.id)) {
+ a.enabled = false;
+ }
+ d.access = Some(access.clone());
+ return d;
+ }
+ if let Some(note) = desktop_note(space) {
+ d.can_stream = false;
+ d.show_sections = false;
+ d.sections.clear();
+ d.preview_text = note.clone();
+ d.actions.retain(|a| {
+ !matches!(
+ a.id,
+ DetailActionId::Teleport | DetailActionId::Pip | DetailActionId::Open
+ )
+ });
+ d.new_space = super::has_feature(space, HOST_SPACES_FEATURE).then(|| NewSpaceOn {
+ label: format!("New Space on {}\u{2026}", space.name),
+ on: format!("host:{}", space.id.trim_start_matches("relay:")),
+ });
+ d.desktop_note = Some(note);
+ }
+ d
+}
+
#[cfg(test)]
mod tests {
use super::*;
@@ -1036,6 +1188,166 @@ mod tests {
d.facts.iter().find(|f| f.label == label)
}
+ /// One of your machines on the relay, as the app's probe saw it.
+ fn machine(features: &[&str], reachable: bool) -> Space {
+ let row: SpaceRow = serde_json::from_value(serde_json::json!({
+ "id": "relay:m1",
+ "name": "Studio",
+ "provider": "relay",
+ "os": "macos",
+ "reachable": reachable,
+ "features": features,
+ }))
+ .unwrap();
+ super::super::row_to_space(&row, 0)
+ }
+
+ fn ids(d: &SpaceDetail) -> Vec<DetailActionId> {
+ d.actions.iter().map(|a| a.id).collect()
+ }
+
+ const SHARED: &[&str] = &["desktop_stream", "window_stream", "host_spaces"];
+
+ /// Enrolled: nothing changes. Not enrolled, waiting or expired: the
+ /// machine is listed, Connect is greyed out under the notice, Status
+ /// says why and nothing that needs a connection is offered.
+ #[test]
+ fn a_machine_seen_from_a_device_that_is_not_enrolled() {
+ use crate::devices::{EnrollmentKind, machine_access_notice};
+ let x = crate::experiments::Experiments::default();
+ let m = machine(SHARED, true);
+ let enrolled = detail_for(&m, None, None, &x, None);
+ assert_eq!(enrolled, detail_with(&m, None, None, &x));
+ assert!(enrolled.can_stream && enrolled.access.is_none());
+ for (kind, status) in [
+ (EnrollmentKind::NeedsEnrollment, "Not enrolled"),
+ (EnrollmentKind::Waiting, "Waiting for approval"),
+ (EnrollmentKind::Due, "Re-verification due"),
+ ] {
+ let notice = machine_access_notice(kind, Some("K7QX-M2RP")).unwrap();
+ // Unreachable (the relay refuses it): still listed, still explained.
+ for reachable in [false, true] {
+ let d = detail_for(&machine(&[], reachable), None, None, &x, Some(&notice));
+ assert_eq!(d.access.as_ref(), Some(&notice));
+ assert!(!d.can_stream && !d.show_sections && d.sections.is_empty());
+ assert_eq!(fact_of(&d, "Status").unwrap().value, status);
+ assert!(
+ d.actions
+ .iter()
+ .filter(|a| matches!(
+ a.id,
+ DetailActionId::Open | DetailActionId::Teleport | DetailActionId::Pip
+ ))
+ .all(|a| !a.enabled)
+ );
+ assert!(d.desktop_note.is_none());
+ }
+ }
+ // A Space that is not reached through the relay is not affected.
+ let local = super::super::row_to_space(&local_row("local:a", None, None, None), 0);
+ let notice = machine_access_notice(EnrollmentKind::NeedsEnrollment, None).unwrap();
+ assert!(
+ detail_for(&local, None, None, &x, Some(&notice))
+ .access
+ .is_none()
+ );
+ }
+
+ /// Desktop shared: Stream, Agents and Teleport as before. Not shared
+ /// (Spaces still provided): the note, no desktop actions, New Space on
+ /// it. Neither: the note alone. A machine that has not answered, or an
+ /// older one that does not say, counts as sharing.
+ #[test]
+ fn a_machine_that_does_not_share_its_desktop() {
+ let x = crate::experiments::Experiments::default();
+ let shared = detail_for(&machine(SHARED, true), None, None, &x, None);
+ assert_eq!(shared.sections, ["Stream", "Agents", "Teleport"]);
+ assert!(shared.desktop_note.is_none() && shared.new_space.is_none());
+ assert_eq!(shares_desktop(&machine(SHARED, true)), Some(true));
+
+ let spaces_only = machine(&["host_spaces", "files"], true);
+ assert_eq!(shares_desktop(&spaces_only), Some(false));
+ let d = detail_for(&spaces_only, None, None, &x, None);
+ assert_eq!(
+ d.desktop_note.as_deref(),
+ Some("Studio isn\u{2019}t sharing its desktop. You can still create Spaces on it.")
+ );
+ assert!(!d.can_stream && !d.show_sections && d.sections.is_empty());
+ assert!(ids(&d).iter().all(|a| !matches!(
+ a,
+ DetailActionId::Teleport | DetailActionId::Pip | DetailActionId::Open
+ )));
+ assert_eq!(
+ d.new_space,
+ Some(NewSpaceOn {
+ label: "New Space on Studio\u{2026}".into(),
+ on: "host:m1".into()
+ })
+ );
+
+ let neither = detail_for(&machine(&["files"], true), None, None, &x, None);
+ assert_eq!(
+ neither.desktop_note.as_deref(),
+ Some("Studio isn\u{2019}t sharing its desktop or Spaces.")
+ );
+ assert!(neither.new_space.is_none() && neither.sections.is_empty());
+
+ // Unknown: offline, or no features reported.
+ assert_eq!(shares_desktop(&machine(&["host_spaces"], false)), None);
+ assert_eq!(shares_desktop(&machine(&[], true)), None);
+ assert!(
+ detail_for(&machine(&[], true), None, None, &x, None)
+ .desktop_note
+ .is_none()
+ );
+ // Only your machines: a Space added by address without a desktop is
+ // not "not sharing".
+ let direct =
+ super::super::row_to_space(&local_row("direct:10.0.0.5:3211", None, None, None), 0);
+ assert_eq!(shares_desktop(&direct), None);
+ }
+
+ /// This machine's own relay entry is dropped by id; another machine
+ /// of the same name and the Spaces this machine provides stay.
+ #[test]
+ fn this_machine_is_not_one_of_your_machines() {
+ let mut own = machine(SHARED, true);
+ own.id = "relay:aaaa01".into();
+ own.name = "Dana's MacBook Pro".into();
+ let mut twin = own.clone();
+ twin.id = "relay:bbbb02".into();
+ let mut provided = machine(SHARED, true);
+ provided.id = "relay:s1".into();
+ provided.host = Some("aaaa01".into());
+ let spaces = vec![own, twin, provided];
+ let ids = |v: Vec<Space>| v.into_iter().map(|s| s.id).collect::<Vec<_>>();
+ assert_eq!(
+ ids(without_this_relay_machine(&spaces, Some("aaaa01"))),
+ ["relay:bbbb02", "relay:s1"]
+ );
+ assert_eq!(ids(without_this_relay_machine(&spaces, None)).len(), 3);
+ assert_eq!(ids(without_this_relay_machine(&spaces, Some(""))).len(), 3);
+ }
+
+ /// The Spaces a machine provides, for its detail.
+ #[test]
+ fn hosted_rows_are_the_spaces_a_machine_provides() {
+ let mut child = machine(SHARED, true);
+ child.id = "relay:s1".into();
+ child.name = "Linux".into();
+ child.host = Some("m1".into());
+ let mut other = child.clone();
+ other.id = "relay:s2".into();
+ other.host = Some("m9".into());
+ let spaces = vec![machine(SHARED, true), child, other];
+ let rows = hosted_rows(&spaces, "relay:m1", "");
+ assert_eq!(
+ rows.iter().map(|r| r.id.as_str()).collect::<Vec<_>>(),
+ ["relay:s1"]
+ );
+ assert!(hosted_rows(&spaces, "local:a", "").is_empty());
+ }
+
#[test]
fn kind_and_architecture_facts_warn_about_emulation_on_this_mac_only() {
let omarchy = super::super::row_to_space(
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 9279ef304b..bdde884dc9 100644
--- a/libs/cua/crates/cua-spaces-ffi/src/app_core.rs
+++ b/libs/cua/crates/cua-spaces-ffi/src/app_core.rs
@@ -128,6 +128,61 @@ pub fn app_space_detail_with(
core::spaces::sidebar::detail_with(&space, usage.as_ref(), host_arch.as_deref(), &experiments)
}
+/// [`app_space_detail_with`] as this device sees it: `access` (from
+/// [`app_machine_access_notice`]) greys out Connect on every Space reached
+/// through the relay while this device is not enrolled; one of your
+/// machines that does not share its desktop shows its note in place of the
+/// desktop, Stream, Agents and Teleport.
+#[uniffi::export]
+pub fn app_space_detail_for(
+ space: AppSpace,
+ usage: Option<AppSpaceUsage>,
+ host_arch: Option<String>,
+ experiments: AppExperiments,
+ access: Option<AppMachineAccessNotice>,
+) -> AppSpaceDetail {
+ core::spaces::sidebar::detail_for(
+ &space,
+ usage.as_ref(),
+ host_arch.as_deref(),
+ &experiments,
+ access.as_ref(),
+ )
+}
+
+/// Why this device cannot open the account's machines for its enrollment
+/// `kind` (`None` while it can). `pending_code` is the code it shows while
+/// it waits for approval.
+#[uniffi::export]
+pub fn app_machine_access_notice(
+ kind: AppEnrollmentKind,
+ pending_code: Option<String>,
+) -> Option<AppMachineAccessNotice> {
+ core::devices::machine_access_notice(kind, pending_code.as_deref())
+}
+
+/// The roster without this machine's own relay entry (`this_machine_id`
+/// is `HostStatus.machine_id`): it is "This machine", not one of "My
+/// machines". Matched by id, never by name.
+#[uniffi::export]
+pub fn app_without_this_relay_machine(
+ spaces: Vec<AppSpace>,
+ this_machine_id: Option<String>,
+) -> Vec<AppSpace> {
+ core::spaces::sidebar::without_this_relay_machine(&spaces, this_machine_id.as_deref())
+}
+
+/// The Spaces one of your machines provides (`machine_space_id` is its
+/// `relay:<id>`), as sidebar rows.
+#[uniffi::export]
+pub fn app_hosted_rows(
+ spaces: Vec<AppSpace>,
+ machine_space_id: String,
+ selected_id: String,
+) -> Vec<AppSidebarRow> {
+ core::spaces::sidebar::hosted_rows(&spaces, &machine_space_id, &selected_id)
+}
+
/// This machine's CPU architecture as the Spaces apps pass it to the core
/// (`arm64`, `amd64`).
#[uniffi::export]
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 3538190fc6..0a2f595423 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
@@ -880,6 +880,17 @@ pub struct AppSpaceUsage {
pub disk_limited: bool,
}
+/// "New Space on <machine>…": New Space with "Run on" set to that machine.
+pub type AppNewSpaceOn = core::spaces::sidebar::NewSpaceOn;
+#[uniffi::remote(Record)]
+pub struct AppNewSpaceOn {
+ /// The button's label.
+ pub label: String,
+ /// The "Run on" entry it picks (`host:<machine id>`; the wizard's
+ /// `ChoosePlacement`).
+ pub on: String,
+}
+
/// The selected Space's detail.
pub type AppSpaceDetail = core::spaces::sidebar::SpaceDetail;
#[uniffi::remote(Record)]
@@ -919,6 +930,17 @@ pub struct AppSpaceDetail {
pub credit_notice: Option<AppCreditNotice>,
/// Why turning it off or on failed, shown inline under the preview.
pub power_error: Option<String>,
+ /// Signed in, but this device is not enrolled: a machine reached
+ /// through the relay is listed with its Connect greyed out under this
+ /// line and its one action ([`detail_for`]).
+ pub access: Option<AppMachineAccessNotice>,
+ /// One of your machines that does not share its desktop: the line
+ /// shown in place of its desktop, Stream, Agents and Teleport
+ /// ([`desktop_note`]).
+ pub desktop_note: Option<String>,
+ /// With [`Self::desktop_note`], when the machine provides Spaces:
+ /// "New Space on <name>…", which opens New Space on it.
+ pub new_space: Option<AppNewSpaceOn>,
}
/// Where the shell's stream session stands.
@@ -953,6 +975,9 @@ pub struct AppDesktopCoverInput {
pub connect_requested: bool,
/// The shell's stream session.
pub stream: AppStreamPhase,
+ /// The detail's `access`: this device is signed in but not enrolled,
+ /// so Connect shows greyed out under this notice and its action.
+ pub access: Option<AppMachineAccessNotice>,
}
/// How the cover draws.
@@ -987,6 +1012,12 @@ pub struct AppDesktopCover {
pub open_stream: bool,
/// The shell starts the open session again (Try again was pressed).
pub retry: bool,
+ /// The button shows greyed out (Connect while this device is not
+ /// enrolled).
+ pub button_disabled: bool,
+ /// The one action above a greyed-out Connect ("Enroll This Mac…"): the
+ /// shell opens the enroll sheet.
+ pub action: Option<String>,
}
/// How fresh the shells keep each Space's thumbnail (the notch tiles and
@@ -7371,6 +7402,23 @@ pub enum AppEnrollmentKind {
Revoked,
}
+/// Why this device cannot open the account's machines (signed in, but not
+/// enrolled): the one line above a machine's greyed-out Connect, its
+/// status word and the one action that fixes it (the enroll sheet, which
+/// offers a fresh sign-in or an approval from an enrolled device).
+pub type AppMachineAccessNotice = core::devices::MachineAccessNotice;
+#[uniffi::remote(Record)]
+pub struct AppMachineAccessNotice {
+ /// This device's enrollment.
+ pub kind: AppEnrollmentKind,
+ /// The machine's Status: "Not enrolled", "Waiting for approval", ...
+ pub status: String,
+ /// The line above the disabled Connect.
+ pub text: String,
+ /// The action's label; it opens the enroll sheet.
+ pub action_label: String,
+}
+
/// Settings → Devices' first section: this device.
pub type AppThisDevice = core::devices::ThisDevice;
#[uniffi::remote(Record)]
diff --git a/libs/cua/crates/cua-spaces/src/host_spaces.rs b/libs/cua/crates/cua-spaces/src/host_spaces.rs
index 709a0e0a10..dd3c795a48 100644
--- a/libs/cua/crates/cua-spaces/src/host_spaces.rs
+++ b/libs/cua/crates/cua-spaces/src/host_spaces.rs
@@ -1555,11 +1555,7 @@ impl Spaces {
relay.iter().filter_map(|m| m.host.clone()).collect();
let known = &known;
// This machine is "This Mac" in the menu, not one of the hosts.
- let this_machine = Host::new(self.home_dir())
- .config()
- .ok()
- .flatten()
- .and_then(|c| c.machine_id);
+ let this_machine = self.this_relay_machine_id();
let relay_offers = futures_util::future::join_all(
relay
.iter()
diff --git a/libs/cua/crates/cua-spaces/src/spaces.rs b/libs/cua/crates/cua-spaces/src/spaces.rs
index d1beb43609..b36fc89486 100644
--- a/libs/cua/crates/cua-spaces/src/spaces.rs
+++ b/libs/cua/crates/cua-spaces/src/spaces.rs
@@ -765,6 +765,18 @@ impl Spaces {
// --------------------------------------------------------------- relay
+ /// This install's relay machine id (`cua host setup` in relay mode),
+ /// when it has one: the relay listing's entry for this machine itself
+ /// (apps show it in its own place, not among "your machines").
+ pub fn this_relay_machine_id(&self) -> Option<String> {
+ cua_host::Host::new(self.home_dir())
+ .config()
+ .ok()
+ .flatten()
+ .and_then(|c| c.machine_id)
+ .filter(|id| !id.is_empty())
+ }
+
/// The relay account, when configured.
pub fn relay_account(&self) -> Option<crate::relay::RelayAccount> {
self.inner.relay.read().expect("relay").clone()
diff --git a/libs/cua/crates/cua-spaces/tests/relay.rs b/libs/cua/crates/cua-spaces/tests/relay.rs
index bef22a685a..9928412384 100644
--- a/libs/cua/crates/cua-spaces/tests/relay.rs
+++ b/libs/cua/crates/cua-spaces/tests/relay.rs
@@ -26,6 +26,62 @@ impl AccountTokens for Counting {
}
}
+/// This install's relay machine id comes from its host setup, so apps can
+/// tell this machine's own relay entry from another machine of the same
+/// name. The listing itself still has both (`cua spaces ls` on the host).
+#[tokio::test]
+async fn this_relay_machine_id_names_this_install() {
+ let relay = FakeRelay::start().await;
+ relay.add_account("owner-token", "user-1", Some("[email protected]"));
+ let client = cua_host::RelayClient::new(&relay.url).unwrap();
+ for id in ["aaaa000000000001", "bbbb000000000002"] {
+ client
+ .register(
+ "owner-token",
+ &cua_host::relay::RegisterRequest {
+ id: id.into(),
+ name: "Dana's MacBook Pro".into(),
+ allow: vec![],
+ host: None,
+ meta: Default::default(),
+ },
+ )
+ .await
+ .unwrap();
+ }
+ let home = tempfile::tempdir().unwrap();
+ let spaces = || {
+ Spaces::builder()
+ .home(home.path())
+ .relay(RelayAccount::new(
+ &relay.url,
+ Arc::new(StaticToken("owner-token".into())),
+ ))
+ .build()
+ };
+ assert_eq!(spaces().this_relay_machine_id(), None);
+ // `cua host setup` in relay mode wrote this install's machine id.
+ std::fs::create_dir_all(home.path().join("host")).unwrap();
+ std::fs::write(
+ home.path().join("host/config.json"),
+ serde_json::json!({
+ "mode": "relay",
+ "name": "This machine",
+ "machine_id": "aaaa000000000001",
+ "runner": "process",
+ "driver_bin": "/nonexistent/cua-spacesd",
+ })
+ .to_string(),
+ )
+ .unwrap();
+ let spaces = spaces();
+ assert_eq!(
+ spaces.this_relay_machine_id().as_deref(),
+ Some("aaaa000000000001")
+ );
+ assert_eq!(spaces.list_all().await.unwrap().len(), 2);
+}
+
#[tokio::test]
async fn lists_owned_and_shared_relay_machines_as_spaces() {
let relay = FakeRelay::start().await;
diff --git a/libs/cua/scripts/generate-app-core-ffi.py b/libs/cua/scripts/generate-app-core-ffi.py
index 4627836fae..215df0c721 100644
--- a/libs/cua/scripts/generate-app-core-ffi.py
+++ b/libs/cua/scripts/generate-app-core-ffi.py
@@ -23,7 +23,7 @@ TYPES = [
("spaces/mod.rs", "spaces", ["AmbientDots"]),
("spaces/roster.rs", "spaces::roster", ["NoticeKind", "Notice", "RosterState", "RosterAction"]),
("spaces/creating.rs", "spaces::creating", ["PendingCreate", "PendingDelete", "PendingPower", "CreatesState", "CreateAction"]),
- ("spaces/sidebar.rs", "spaces::sidebar", ["PowerButton", "SidebarRow", "SidebarSection", "SidebarView", "FactCopy", "FactWarning", "Fact", "DetailActionId", "DetailAction", "DeleteConfirm", "DetailCopy", "SpaceUsage", "SpaceDetail"]),
+ ("spaces/sidebar.rs", "spaces::sidebar", ["PowerButton", "SidebarRow", "SidebarSection", "SidebarView", "FactCopy", "FactWarning", "Fact", "DetailActionId", "DetailAction", "DeleteConfirm", "DetailCopy", "SpaceUsage", "NewSpaceOn", "SpaceDetail"]),
("spaces/cover.rs", "spaces::cover", ["StreamPhase", "DesktopCoverInput", "DesktopCoverKind", "DesktopCover", "ThumbnailPolicy"]),
("spaces/stream.rs", "spaces::stream", ["StreamDisplay", "StreamSectionInput", "StreamRowKind", "StreamRowIcon", "StreamRowActionId", "StreamRowAction", "StreamRow", "StreamSection", "PipEvent", "PipCommand"]),
("notch/geometry.rs", "notch::geometry", ["WindowMode", "LogicalRect"]),
@@ -57,7 +57,7 @@ TYPES = [
("host.rs", "host", ["HostSummaryInput", "HostSetupRequest", "HostClient", "HostAccess", "HostPermissionInput", "HostProvidedSpace", "HostSpacesAudit", "HostState", "HostActionId", "HostSettingChange", "HostToggle", "HostConfirm", "HostAction", "HostAccessRow", "PermissionRow", "HostSetupChoice", "HostPanelView", "HostFormState", "HostFormAction", "HostFormChoice", "HostFormField", "HostFormView"]),
("installer.rs", "installer", ["InstallMethod", "CliInstallPlan", "CliInstallRequest"]),
("agents.rs", "agents", ["AgentStatus", "SpaceAgentRun", "AgentSetupStatus", "AgentSettingsRow", "AgentSetupOutcomeInput", "AgentSetupSummary"]),
- ("devices.rs", "devices", ["DeviceInput", "MachineInput", "AuditInput", "DevicesInput", "BannerTone", "DeviceAction", "DeviceBanner", "DeviceConfirm", "UnconfirmedMachine", "DeviceRow", "ApprovalPrompt", "ActivityRow", "EnrollmentKind", "ThisDevice", "DevicesLabels", "DevicesView", "EnrollMethod", "EnrollPhase", "EnrollState", "EnrollAction", "EnrollOption", "EnrollView", "ApproveSheetState", "ApproveSheetAction", "ApproveRequest", "ApproveSheetView"]),
+ ("devices.rs", "devices", ["DeviceInput", "MachineInput", "AuditInput", "DevicesInput", "BannerTone", "DeviceAction", "DeviceBanner", "DeviceConfirm", "UnconfirmedMachine", "DeviceRow", "ApprovalPrompt", "ActivityRow", "EnrollmentKind", "MachineAccessNotice", "ThisDevice", "DevicesLabels", "DevicesView", "EnrollMethod", "EnrollPhase", "EnrollState", "EnrollAction", "EnrollOption", "EnrollView", "ApproveSheetState", "ApproveSheetAction", "ApproveRequest", "ApproveSheetView"]),
("cloud_connect.rs", "cloud_connect", ["CloudProviderInput", "CloudConnectInput", "CloudCheckInput", "CloudConnectPhase", "CloudConnectState", "CloudConnectAction", "CloudTargetArgs", "CloudConnectRequest", "CloudProviderRow", "CloudField", "CloudCheckRow", "CloudConnectView"]),
("share.rs", "share", ["ShareEntryInput", "ShareInput", "ShareRequest", "ShareSheetState", "ShareSheetAction", "RoleOption", "ShareRowView", "ShareSheetView"]),
("persistent.rs", "persistent", ["PersistentAgentInput", "DriveEntryInput", "FileVersionInput", "OpenFileInput", "RoutineInput", "ComputerGrantInput", "AccessAuditInput", "AgentsInput", "AgentTab", "RoutineScheduleKind", "RoutineForm", "AgentsRequest", "AgentsState", "AgentsAction", "AgentRowView", "LineView", "TabView", "FileView", "AgentDetailView", "AgentsView"]),
diff --git a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
index 520044dc38..4d997feaef 100644
--- a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
+++ b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
@@ -8356,6 +8356,16 @@ public struct AppDesktopCover: Equatable, Hashable {
* The shell starts the open session again (Try again was pressed).
*/
public var retry: Bool
+ /**
+ * The button shows greyed out (Connect while this device is not
+ * enrolled).
+ */
+ public var buttonDisabled: Bool
+ /**
+ * The one action above a greyed-out Connect ("Enroll This Mac…"): the
+ * shell opens the enroll sheet.
+ */
+ public var action: String?
// Default memberwise initializers are never public by default, so we
// declare one manually.
@@ -8378,13 +8388,23 @@ public struct AppDesktopCover: Equatable, Hashable {
*/openStream: Bool,
/**
* The shell starts the open session again (Try again was pressed).
- */retry: Bool) {
+ */retry: Bool,
+ /**
+ * The button shows greyed out (Connect while this device is not
+ * enrolled).
+ */buttonDisabled: Bool,
+ /**
+ * The one action above a greyed-out Connect ("Enroll This Mac…"): the
+ * shell opens the enroll sheet.
+ */action: String?) {
self.kind = kind
self.text = text
self.button = button
self.buttonHelp = buttonHelp
self.openStream = openStream
self.retry = retry
+ self.buttonDisabled = buttonDisabled
+ self.action = action
}
@@ -8408,7 +8428,9 @@ public struct FfiConverterTypeAppDesktopCover: FfiConverterRustBuffer {
button: FfiConverterOptionString.read(from: &buf),
buttonHelp: FfiConverterOptionString.read(from: &buf),
openStream: FfiConverterBool.read(from: &buf),
- retry: FfiConverterBool.read(from: &buf)
+ retry: FfiConverterBool.read(from: &buf),
+ buttonDisabled: FfiConverterBool.read(from: &buf),
+ action: FfiConverterOptionString.read(from: &buf)
)
}
@@ -8419,6 +8441,8 @@ public struct FfiConverterTypeAppDesktopCover: FfiConverterRustBuffer {
FfiConverterOptionString.write(value.buttonHelp, into: &buf)
FfiConverterBool.write(value.openStream, into: &buf)
FfiConverterBool.write(value.retry, into: &buf)
+ FfiConverterBool.write(value.buttonDisabled, into: &buf)
+ FfiConverterOptionString.write(value.action, into: &buf)
}
}
@@ -8459,6 +8483,11 @@ public struct AppDesktopCoverInput: Equatable, Hashable {
* The shell's stream session.
*/
public var stream: AppStreamPhase
+ /**
+ * The detail's `access`: this device is signed in but not enrolled,
+ * so Connect shows greyed out under this notice and its action.
+ */
+ public var access: AppMachineAccessNotice?
// Default memberwise initializers are never public by default, so we
// declare one manually.
@@ -8477,12 +8506,17 @@ public struct AppDesktopCoverInput: Equatable, Hashable {
*/connectRequested: Bool,
/**
* The shell's stream session.
- */stream: AppStreamPhase) {
+ */stream: AppStreamPhase,
+ /**
+ * The detail's `access`: this device is signed in but not enrolled,
+ * so Connect shows greyed out under this notice and its action.
+ */access: AppMachineAccessNotice?) {
self.canStream = canStream
self.previewText = previewText
self.autoConnect = autoConnect
self.connectRequested = connectRequested
self.stream = stream
+ self.access = access
}
@@ -8505,7 +8539,8 @@ public struct FfiConverterTypeAppDesktopCoverInput: FfiConverterRustBuffer {
previewText: FfiConverterString.read(from: &buf),
autoConnect: FfiConverterBool.read(from: &buf),
connectRequested: FfiConverterBool.read(from: &buf),
- stream: FfiConverterTypeAppStreamPhase.read(from: &buf)
+ stream: FfiConverterTypeAppStreamPhase.read(from: &buf),
+ access: FfiConverterOptionTypeAppMachineAccessNotice.read(from: &buf)
)
}
@@ -8515,6 +8550,7 @@ public struct FfiConverterTypeAppDesktopCoverInput: FfiConverterRustBuffer {
FfiConverterBool.write(value.autoConnect, into: &buf)
FfiConverterBool.write(value.connectRequested, into: &buf)
FfiConverterTypeAppStreamPhase.write(value.stream, into: &buf)
+ FfiConverterOptionTypeAppMachineAccessNotice.write(value.access, into: &buf)
}
}
@@ -16922,6 +16958,92 @@ public func FfiConverterTypeAppLoginItemPlan_lower(_ value: AppLoginItemPlan) ->
}
+public struct AppMachineAccessNotice: Equatable, Hashable {
+ /**
+ * This device's enrollment.
+ */
+ public var kind: AppEnrollmentKind
+ /**
+ * The machine's Status: "Not enrolled", "Waiting for approval", ...
+ */
+ public var status: String
+ /**
+ * The line above the disabled Connect.
+ */
+ public var text: String
+ /**
+ * The action's label; it opens the enroll sheet.
+ */
+ public var actionLabel: String
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ /**
+ * This device's enrollment.
+ */kind: AppEnrollmentKind,
+ /**
+ * The machine's Status: "Not enrolled", "Waiting for approval", ...
+ */status: String,
+ /**
+ * The line above the disabled Connect.
+ */text: String,
+ /**
+ * The action's label; it opens the enroll sheet.
+ */actionLabel: String) {
+ self.kind = kind
+ self.status = status
+ self.text = text
+ self.actionLabel = actionLabel
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension AppMachineAccessNotice: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeAppMachineAccessNotice: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppMachineAccessNotice {
+ return
+ try AppMachineAccessNotice(
+ kind: FfiConverterTypeAppEnrollmentKind.read(from: &buf),
+ status: FfiConverterString.read(from: &buf),
+ text: FfiConverterString.read(from: &buf),
+ actionLabel: FfiConverterString.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: AppMachineAccessNotice, into buf: inout [UInt8]) {
+ FfiConverterTypeAppEnrollmentKind.write(value.kind, into: &buf)
+ FfiConverterString.write(value.status, into: &buf)
+ FfiConverterString.write(value.text, into: &buf)
+ FfiConverterString.write(value.actionLabel, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachineAccessNotice_lift(_ buf: RustBuffer) throws -> AppMachineAccessNotice {
+ return try FfiConverterTypeAppMachineAccessNotice.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMachineAccessNotice_lower(_ value: AppMachineAccessNotice) -> RustBuffer {
+ return FfiConverterTypeAppMachineAccessNotice.lower(value)
+}
+
+
public struct AppMachineInput: Equatable, Hashable {
/**
* Machine id.
@@ -17714,6 +17836,74 @@ public func FfiConverterTypeAppModeChoice_lower(_ value: AppModeChoice) -> RustB
}
+public struct AppNewSpaceOn: Equatable, Hashable {
+ /**
+ * The button's label.
+ */
+ public var label: String
+ /**
+ * The "Run on" entry it picks (`host:<machine id>`; the wizard's
+ * `ChoosePlacement`).
+ */
+ public var on: String
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ /**
+ * The button's label.
+ */label: String,
+ /**
+ * The "Run on" entry it picks (`host:<machine id>`; the wizard's
+ * `ChoosePlacement`).
+ */on: String) {
+ self.label = label
+ self.on = on
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension AppNewSpaceOn: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeAppNewSpaceOn: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppNewSpaceOn {
+ return
+ try AppNewSpaceOn(
+ label: FfiConverterString.read(from: &buf),
+ on: FfiConverterString.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: AppNewSpaceOn, into buf: inout [UInt8]) {
+ FfiConverterString.write(value.label, into: &buf)
+ FfiConverterString.write(value.on, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppNewSpaceOn_lift(_ buf: RustBuffer) throws -> AppNewSpaceOn {
+ return try FfiConverterTypeAppNewSpaceOn.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppNewSpaceOn_lower(_ value: AppNewSpaceOn) -> RustBuffer {
+ return FfiConverterTypeAppNewSpaceOn.lower(value)
+}
+
+
public struct AppNotchAccess: Equatable, Hashable {
/**
* "Keyvault sign-ins live in dev-1" (opens the Access page).
@@ -27432,6 +27622,23 @@ public struct AppSpaceDetail: Equatable, Hashable {
* Why turning it off or on failed, shown inline under the preview.
*/
public var powerError: String?
+ /**
+ * Signed in, but this device is not enrolled: a machine reached
+ * through the relay is listed with its Connect greyed out under this
+ * line and its one action ([`detail_for`]).
+ */
+ public var access: AppMachineAccessNotice?
+ /**
+ * One of your machines that does not share its desktop: the line
+ * shown in place of its desktop, Stream, Agents and Teleport
+ * ([`desktop_note`]).
+ */
+ public var desktopNote: String?
+ /**
+ * With [`Self::desktop_note`], when the machine provides Spaces:
+ * "New Space on <name>…", which opens New Space on it.
+ */
+ public var newSpace: AppNewSpaceOn?
// Default memberwise initializers are never public by default, so we
// declare one manually.
@@ -27486,7 +27693,21 @@ public struct AppSpaceDetail: Equatable, Hashable {
*/creditNotice: AppCreditNotice?,
/**
* Why turning it off or on failed, shown inline under the preview.
- */powerError: String?) {
+ */powerError: String?,
+ /**
+ * Signed in, but this device is not enrolled: a machine reached
+ * through the relay is listed with its Connect greyed out under this
+ * line and its one action ([`detail_for`]).
+ */access: AppMachineAccessNotice?,
+ /**
+ * One of your machines that does not share its desktop: the line
+ * shown in place of its desktop, Stream, Agents and Teleport
+ * ([`desktop_note`]).
+ */desktopNote: String?,
+ /**
+ * With [`Self::desktop_note`], when the machine provides Spaces:
+ * "New Space on <name>…", which opens New Space on it.
+ */newSpace: AppNewSpaceOn?) {
self.id = id
self.title = title
self.facts = facts
@@ -27503,6 +27724,9 @@ public struct AppSpaceDetail: Equatable, Hashable {
self.sections = sections
self.creditNotice = creditNotice
self.powerError = powerError
+ self.access = access
+ self.desktopNote = desktopNote
+ self.newSpace = newSpace
}
@@ -27536,7 +27760,10 @@ public struct FfiConverterTypeAppSpaceDetail: FfiConverterRustBuffer {
confirm: FfiConverterTypeAppDeleteConfirm.read(from: &buf),
sections: FfiConverterSequenceString.read(from: &buf),
creditNotice: FfiConverterOptionTypeAppCreditNotice.read(from: &buf),
- powerError: FfiConverterOptionString.read(from: &buf)
+ powerError: FfiConverterOptionString.read(from: &buf),
+ access: FfiConverterOptionTypeAppMachineAccessNotice.read(from: &buf),
+ desktopNote: FfiConverterOptionString.read(from: &buf),
+ newSpace: FfiConverterOptionTypeAppNewSpaceOn.read(from: &buf)
)
}
@@ -27557,6 +27784,9 @@ public struct FfiConverterTypeAppSpaceDetail: FfiConverterRustBuffer {
FfiConverterSequenceString.write(value.sections, into: &buf)
FfiConverterOptionTypeAppCreditNotice.write(value.creditNotice, into: &buf)
FfiConverterOptionString.write(value.powerError, into: &buf)
+ FfiConverterOptionTypeAppMachineAccessNotice.write(value.access, into: &buf)
+ FfiConverterOptionString.write(value.desktopNote, into: &buf)
+ FfiConverterOptionTypeAppNewSpaceOn.write(value.newSpace, into: &buf)
}
}
@@ -54054,6 +54284,30 @@ fileprivate struct FfiConverterOptionTypeAppLoginItemInput: FfiConverterRustBuff
}
}
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+fileprivate struct FfiConverterOptionTypeAppMachineAccessNotice: FfiConverterRustBuffer {
+ typealias SwiftType = AppMachineAccessNotice?
+
+ public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
+ guard let value = value else {
+ writeInt(&buf, Int8(0))
+ return
+ }
+ writeInt(&buf, Int8(1))
+ FfiConverterTypeAppMachineAccessNotice.write(value, into: &buf)
+ }
+
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
+ switch try readInt(&buf) as Int8 {
+ case 0: return nil
+ case 1: return try FfiConverterTypeAppMachineAccessNotice.read(from: &buf)
+ default: throw UniffiInternalError.unexpectedOptionalTag
+ }
+ }
+}
+
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
@@ -54078,6 +54332,30 @@ fileprivate struct FfiConverterOptionTypeAppMenuPreview: FfiConverterRustBuffer
}
}
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+fileprivate struct FfiConverterOptionTypeAppNewSpaceOn: FfiConverterRustBuffer {
+ typealias SwiftType = AppNewSpaceOn?
+
+ public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
+ guard let value = value else {
+ writeInt(&buf, Int8(0))
+ return
+ }
+ writeInt(&buf, Int8(1))
+ FfiConverterTypeAppNewSpaceOn.write(value, into: &buf)
+ }
+
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
+ switch try readInt(&buf) as Int8 {
+ case 0: return nil
+ case 1: return try FfiConverterTypeAppNewSpaceOn.read(from: &buf)
+ default: throw UniffiInternalError.unexpectedOptionalTag
+ }
+ }
+}
+
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
@@ -60313,6 +60591,19 @@ public func appHostValidateSetup(request: AppHostSetupRequest)throws -> AppHost
)
})
}
+/**
+ * The Spaces one of your machines provides (`machine_space_id` is its
+ * `relay:<id>`), as sidebar rows.
+ */
+public func appHostedRows(spaces: [AppSpace], machineSpaceId: String, selectedId: String) -> [AppSidebarRow] {
+ return try! FfiConverterSequenceTypeAppSidebarRow.lift(try! rustCall() {
+ uniffi_cua_spaces_ffi_fn_func_app_hosted_rows(
+ FfiConverterSequenceTypeAppSpace.lower(spaces),
+ FfiConverterString.lower(machineSpaceId),
+ FfiConverterString.lower(selectedId),$0
+ )
+})
+}
/**
* Whether a `default.on` value names one of the user's clouds.
*/
@@ -60348,6 +60639,19 @@ public func appLoginItemLaunchPlan(choice: Bool?, onboarded: Bool, serves: Bool,
)
})
}
+/**
+ * Why this device cannot open the account's machines for its enrollment
+ * `kind` (`None` while it can). `pending_code` is the code it shows while
+ * it waits for approval.
+ */
+public func appMachineAccessNotice(kind: AppEnrollmentKind, pendingCode: String?) -> AppMachineAccessNotice? {
+ return try! FfiConverterOptionTypeAppMachineAccessNotice.lift(try! rustCall() {
+ uniffi_cua_spaces_ffi_fn_func_app_machine_access_notice(
+ FfiConverterTypeAppEnrollmentKind_lower(kind),
+ FfiConverterOptionString.lower(pendingCode),$0
+ )
+})
+}
/**
* The main window's chrome (account line, New Space, empty state).
*/
@@ -61162,6 +61466,24 @@ public func appSpaceDetailCopy() -> AppDetailCopy {
)
})
}
+/**
+ * [`app_space_detail_with`] as this device sees it: `access` (from
+ * [`app_machine_access_notice`]) greys out Connect on every Space reached
+ * through the relay while this device is not enrolled; one of your
+ * machines that does not share its desktop shows its note in place of the
+ * desktop, Stream, Agents and Teleport.
+ */
+public func appSpaceDetailFor(space: AppSpace, usage: AppSpaceUsage?, hostArch: String?, experiments: AppExperiments, access: AppMachineAccessNotice?) -> AppSpaceDetail {
+ return try! FfiConverterTypeAppSpaceDetail_lift(try! rustCall() {
+ uniffi_cua_spaces_ffi_fn_func_app_space_detail_for(
+ FfiConverterTypeAppSpace_lower(space),
+ FfiConverterOptionTypeAppSpaceUsage.lower(usage),
+ FfiConverterOptionString.lower(hostArch),
+ FfiConverterTypeAppExperiments_lower(experiments),
+ FfiConverterOptionTypeAppMachineAccessNotice.lower(access),$0
+ )
+})
+}
/**
* The selected Space's detail with its memory and storage use (the SDK's
* `Space.usage`, refreshed every `app_usage_refresh_ms`). `host_arch` is
@@ -61639,6 +61961,19 @@ public func appWithThisMachine(spaces: [AppSpace], status: AppHostSummaryInput?,
)
})
}
+/**
+ * The roster without this machine's own relay entry (`this_machine_id`
+ * is `HostStatus.machine_id`): it is "This machine", not one of "My
+ * machines". Matched by id, never by name.
+ */
+public func appWithoutThisRelayMachine(spaces: [AppSpace], thisMachineId: String?) -> [AppSpace] {
+ return try! FfiConverterSequenceTypeAppSpace.lift(try! rustCall() {
+ uniffi_cua_spaces_ffi_fn_func_app_without_this_relay_machine(
+ FfiConverterSequenceTypeAppSpace.lower(spaces),
+ FfiConverterOptionString.lower(thisMachineId),$0
+ )
+})
+}
/**
* A wizard action from JSON (fixtures, parity).
*/
@@ -62457,6 +62792,9 @@ private let initializationResult: InitializationResult = {
if (uniffi_cua_spaces_ffi_checksum_func_app_host_validate_setup() != 11018) {
return InitializationResult.apiChecksumMismatch
}
+ if (uniffi_cua_spaces_ffi_checksum_func_app_hosted_rows() != 169) {
+ return InitializationResult.apiChecksumMismatch
+ }
if (uniffi_cua_spaces_ffi_checksum_func_app_is_cloud_word() != 38584) {
return InitializationResult.apiChecksumMismatch
}
@@ -62466,6 +62804,9 @@ private let initializationResult: InitializationResult = {
if (uniffi_cua_spaces_ffi_checksum_func_app_login_item_launch_plan() != 57994) {
return InitializationResult.apiChecksumMismatch
}
+ if (uniffi_cua_spaces_ffi_checksum_func_app_machine_access_notice() != 55788) {
+ return InitializationResult.apiChecksumMismatch
+ }
if (uniffi_cua_spaces_ffi_checksum_func_app_main_chrome() != 29313) {
return InitializationResult.apiChecksumMismatch
}
@@ -62694,6 +63035,9 @@ private let initializationResult: InitializationResult = {
if (uniffi_cua_spaces_ffi_checksum_func_app_space_detail_copy() != 55740) {
return InitializationResult.apiChecksumMismatch
}
+ if (uniffi_cua_spaces_ffi_checksum_func_app_space_detail_for() != 46982) {
+ return InitializationResult.apiChecksumMismatch
+ }
if (uniffi_cua_spaces_ffi_checksum_func_app_space_detail_live() != 55583) {
return InitializationResult.apiChecksumMismatch
}
@@ -62826,6 +63170,9 @@ private let initializationResult: InitializationResult = {
if (uniffi_cua_spaces_ffi_checksum_func_app_with_this_machine() != 39840) {
return InitializationResult.apiChecksumMismatch
}
+ if (uniffi_cua_spaces_ffi_checksum_func_app_without_this_relay_machine() != 34054) {
+ return InitializationResult.apiChecksumMismatch
+ }
if (uniffi_cua_spaces_ffi_checksum_func_app_wizard_action_from_json() != 28909) {
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 e8bfb12f07..3eb482ba75 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
@@ -1166,6 +1166,11 @@ RustBuffer uniffi_cua_spaces_ffi_fn_func_app_host_summary_input(RustBuffer state
RustBuffer uniffi_cua_spaces_ffi_fn_func_app_host_validate_setup(RustBuffer request, RustCallStatus *_Nonnull out_status
);
#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_HOSTED_ROWS
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_HOSTED_ROWS
+RustBuffer uniffi_cua_spaces_ffi_fn_func_app_hosted_rows(RustBuffer spaces, RustBuffer machine_space_id, RustBuffer selected_id, RustCallStatus *_Nonnull out_status
+);
+#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_IS_CLOUD_WORD
#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_IS_CLOUD_WORD
int8_t uniffi_cua_spaces_ffi_fn_func_app_is_cloud_word(RustBuffer on, RustCallStatus *_Nonnull out_status
@@ -1181,6 +1186,11 @@ RustBuffer uniffi_cua_spaces_ffi_fn_func_app_launch_input_from_json(RustBuffer j
RustBuffer uniffi_cua_spaces_ffi_fn_func_app_login_item_launch_plan(RustBuffer choice, int8_t onboarded, int8_t serves, RustBuffer status, RustCallStatus *_Nonnull out_status
);
#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_MACHINE_ACCESS_NOTICE
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_MACHINE_ACCESS_NOTICE
+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_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
@@ -1565,6 +1575,11 @@ RustBuffer uniffi_cua_spaces_ffi_fn_func_app_space_detail(RustBuffer space, Rust
#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_SPACE_DETAIL_COPY
RustBuffer uniffi_cua_spaces_ffi_fn_func_app_space_detail_copy(RustCallStatus *_Nonnull out_status
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_SPACE_DETAIL_FOR
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_SPACE_DETAIL_FOR
+RustBuffer uniffi_cua_spaces_ffi_fn_func_app_space_detail_for(RustBuffer space, RustBuffer usage, RustBuffer host_arch, RustBuffer experiments, RustBuffer access, RustCallStatus *_Nonnull out_status
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_SPACE_DETAIL_LIVE
@@ -1792,6 +1807,11 @@ uint64_t uniffi_cua_spaces_ffi_fn_func_app_usage_refresh_ms(RustCallStatus *_Non
RustBuffer uniffi_cua_spaces_ffi_fn_func_app_with_this_machine(RustBuffer spaces, RustBuffer status, int64_t now_ms, RustCallStatus *_Nonnull out_status
);
#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_WITHOUT_THIS_RELAY_MACHINE
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_WITHOUT_THIS_RELAY_MACHINE
+RustBuffer uniffi_cua_spaces_ffi_fn_func_app_without_this_relay_machine(RustBuffer spaces, RustBuffer this_machine_id, RustCallStatus *_Nonnull out_status
+);
+#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_WIZARD_ACTION_FROM_JSON
#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_WIZARD_ACTION_FROM_JSON
RustBuffer uniffi_cua_spaces_ffi_fn_func_app_wizard_action_from_json(RustBuffer json, RustCallStatus *_Nonnull out_status
@@ -2871,6 +2891,12 @@ uint16_t uniffi_cua_spaces_ffi_checksum_func_app_host_summary_input(void
#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_HOST_VALIDATE_SETUP
uint16_t uniffi_cua_spaces_ffi_checksum_func_app_host_validate_setup(void
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_HOSTED_ROWS
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_HOSTED_ROWS
+uint16_t uniffi_cua_spaces_ffi_checksum_func_app_hosted_rows(void
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_IS_CLOUD_WORD
@@ -2889,6 +2915,12 @@ uint16_t uniffi_cua_spaces_ffi_checksum_func_app_launch_input_from_json(void
#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_LOGIN_ITEM_LAUNCH_PLAN
uint16_t uniffi_cua_spaces_ffi_checksum_func_app_login_item_launch_plan(void
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_MACHINE_ACCESS_NOTICE
+#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_MAIN_CHROME
@@ -3345,6 +3377,12 @@ uint16_t uniffi_cua_spaces_ffi_checksum_func_app_space_detail(void
#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_SPACE_DETAIL_COPY
uint16_t uniffi_cua_spaces_ffi_checksum_func_app_space_detail_copy(void
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_SPACE_DETAIL_FOR
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_SPACE_DETAIL_FOR
+uint16_t uniffi_cua_spaces_ffi_checksum_func_app_space_detail_for(void
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_SPACE_DETAIL_LIVE
@@ -3609,6 +3647,12 @@ uint16_t uniffi_cua_spaces_ffi_checksum_func_app_usage_refresh_ms(void
#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_WITH_THIS_MACHINE
uint16_t uniffi_cua_spaces_ffi_checksum_func_app_with_this_machine(void
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_WITHOUT_THIS_RELAY_MACHINE
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_WITHOUT_THIS_RELAY_MACHINE
+uint16_t uniffi_cua_spaces_ffi_checksum_func_app_without_this_relay_machine(void
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_WIZARD_ACTION_FROM_JSON
diff --git a/scripts/docs-generators/cua-sdk.ts b/scripts/docs-generators/cua-sdk.ts
index 4b5012f1d1..693e650ac9 100644
--- a/scripts/docs-generators/cua-sdk.ts
+++ b/scripts/docs-generators/cua-sdk.ts
@@ -752,6 +752,9 @@ export const PAGES: PageSpec[] = [
'AppWindowMode',
'AppNotice',
'AppNoticeKind',
+ 'AppNewSpaceOn',
+ 'app_hosted_rows',
+ 'app_without_this_relay_machine',
],
prefixes: ['AppRoster', 'app_roster_', 'AppSidebar', 'app_sidebar', 'AppSpace', 'app_space', 'AppRemoteWindow'],
spaces: true,
@@ -1066,8 +1069,8 @@ export const PAGES: PageSpec[] = [
title: 'Devices',
description: 'Settings > Devices: this device\'s enrollment, the account\'s devices, Recent Access, and the enroll and approval sheets.',
intro:
- '`app_devices_view` derives the Devices page from `app_devices_input` (a `Devices.snapshot`): this device\'s enrollment, the account\'s devices with their buttons, approval prompts that ask for presence, and Recent Access in words. `app_enroll_reduce` / `app_enroll_view` drive the enroll sheet (sign in again, or a one-time code approved elsewhere); `app_approve_reduce` / `app_approve_view` drive the approval sheet, whose `request` goes to `Devices.approve` after Touch ID or the login password.',
- items: ['AppAuditInput', 'AppActivityRow', 'AppBannerTone', 'AppThisDevice', 'AppEnrollmentKind', 'AppApprovalPrompt', 'AppMachineInput', 'AppUnconfirmedMachine'],
+ '`app_devices_view` derives the Devices page from `app_devices_input` (a `Devices.snapshot`): this device\'s enrollment, the account\'s devices with their buttons, approval prompts that ask for presence, and Recent Access in words. `app_enroll_reduce` / `app_enroll_view` drive the enroll sheet (sign in again, or a one-time code approved elsewhere); `app_approve_reduce` / `app_approve_view` drive the approval sheet, whose `request` goes to `Devices.approve` after Touch ID or the login password. `app_machine_access_notice` says why a device that is signed in but not enrolled cannot open the account\'s machines, for their greyed-out Connect.',
+ items: ['AppAuditInput', 'AppActivityRow', 'AppBannerTone', 'AppThisDevice', 'AppEnrollmentKind', 'AppApprovalPrompt', 'AppMachineInput', 'AppUnconfirmedMachine', 'app_machine_access_notice', 'AppMachineAccessNotice'],
prefixes: ['AppDevice', 'app_devices_', 'AppEnroll', 'app_enroll_', 'AppApprove', 'app_approve_'],
spaces: true,
},