Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
fix(spaces-macos): pause relay sharing while signed out; allow both settings off (#4570)
ddupont9206f15d4b7c
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swiftindex 21815ccdec..c7d9d8faf2 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift@@ -202,6 +202,14 @@ public final class AppModel {if case .failed = self.signIn { return false }return self.identity != nil}+ // Relay sharing follows the sign-in: whose account this Mac is+ // shared with, read from the local session (no network).+ self.host.currentAccount = { [weak self] in+ guard let self, let account = self.account, let who = account.identity() else { return nil }+ let profile = account.profile()+ let name = profile?.name.flatMap { $0.trimmingCharacters(in: .whitespaces).isEmpty ? nil : $0 }+ return AppHostAccount(id: profile?.subject, email: profile?.email, display: name ?? who)+ }// Onboarding's This machine step has its own HostModel: give it the// same inline sign-in, or a skipped sign-in fails setup with "Not// signed in" instead of opening the browser and carrying on.@@ -358,12 +366,17 @@ public final class AppModel {}static let createTickMs = 250+ /// How often the app's refresh checks relay sharing against the sign-in.+ static let accountCheckInterval: TimeInterval = 120static func nowMs() -> Int64 { Int64(Date().timeIntervalSince1970 * 1000) }/// Re-reads the registry (and the host).public func refresh() async {await host.refresh()+ // At launch, then every few minutes: a session that expired for+ // good (or a `cua auth logout`) pauses relay sharing too.+ await host.reconcileAccount(ifOlderThan: Self.accountCheckInterval)cloudConfigured = await backend.cloudAvailable()do {let rows = try await backend.rows()@@ -698,6 +711,9 @@ public final class AppModel {}onboarding.send(.signedIn(identity: identity ?? ""))signIn = .idle+ // Relay sharing paused while signed out comes back for its+ // owner (another account is asked to set it up again).+ await host.reconcileAccount()} catch {signIn = .failed(message: LiveSpacesBackend.words(error))}@@ -711,6 +727,8 @@ public final class AppModel {host.identity = nilonboarding.host.identity = nildevices.signedIn = false+ // Signed out: relay sharing stops (the setup stays to resume).+ await host.reconcileAccount()await devices.refresh()signIn = .idle}diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/HostModel.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/HostModel.swiftindex d3094a9666..3c4d750fe1 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/HostModel.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/HostModel.swift@@ -14,6 +14,12 @@ public protocol HostRunning: AnyObject, Sendable {func setupRequest(request: AppHostSetupRequest, accountToken: String?) async throws -> HostStatusfunc stopSharing() async throws -> HostStatusfunc startSharing() async throws -> HostStatus+ /// Relay sharing off while nobody is signed in: the host leaves the+ /// relay (and stays off it across restarts); its setup stays.+ func pauseSignedOut() async throws -> HostStatus+ /// Relay sharing back once `account` (id, else email) is signed in;+ /// refused for an account that does not own the machine.+ func resumeSignedIn(account: String) async throws -> HostStatusfunc remove() async throws/// Changes what this machine shares: its desktop, and Spaces for your/// other devices.@@ -35,6 +41,10 @@ public final class FixtureHost: HostRunning, @unchecked Sendable {current = status ?? FixtureHost.unconfigured}+ /// The account a fixture relay host is registered to.+ public var owner = "user-1"+ public var ownerEmail = "[email protected]"+public static let unconfigured = HostStatus(configured: false, mode: nil, relayUrl: nil, directUrl: nil, envTokenPath: nil, machineId: nil,name: nil, sharing: false, serviceInstalled: false, serviceRunning: false, serviceKind: "process",@@ -64,7 +74,8 @@ public final class FixtureHost: HostRunning, @unchecked Sendable {error: nil,shareDesktop: request.shareDesktop ?? !spare,provideSpaces: request.provideSpaces ?? spare,- maxSpaces: 4, maxMacosVms: 2)+ maxSpaces: 4, maxMacosVms: 2,+ owner: relay ? owner : nil, ownerEmail: relay ? ownerEmail : nil)return current}@@ -76,6 +87,11 @@ public final class FixtureHost: HostRunning, @unchecked Sendable {}if let d = change.shareDesktop { current.shareDesktop = d }if let p = change.provideSpaces { current.provideSpaces = p }+ // Both off: nothing to share, so sharing stops (as the host does).+ if !current.shareDesktop && !current.provideSpaces {+ current.sharing = false+ current.clients = []+ }return current}@@ -89,6 +105,33 @@ public final class FixtureHost: HostRunning, @unchecked Sendable {public func startSharing() async throws -> HostStatus {calls.append("start")current.sharing = true+ current.pausedSignedOut = false+ return current+ }++ public func pauseSignedOut() async throws -> HostStatus {+ calls.append("pause")+ guard current.configured, current.mode == "relay" else { return current }+ current.pausedSignedOut = true+ current.sharing = false+ current.online = false+ current.clients = []+ current.serviceInstalled = false+ current.serviceRunning = false+ return current+ }++ public func resumeSignedIn(account: String) async throws -> HostStatus {+ calls.append("resume:\(account)")+ guard current.pausedSignedOut else { return current }+ guard account == owner || account.caseInsensitiveCompare(ownerEmail) == .orderedSame else {+ throw CuaError.InvalidArgument(message: "this machine is shared with another Cua account")+ }+ current.pausedSignedOut = false+ current.sharing = true+ current.online = true+ current.serviceInstalled = true+ current.serviceRunning = truereturn current}@@ -131,6 +174,15 @@ public final class HostModel {/// looks valid). nil when no one is signed in; throws when it could not/// be read or refreshed (offline, the vault), which is not "signed out".public var accountToken: ((_ forceRefresh: Bool) async throws -> String?)?+ /// The signed-in account's id, email and display name, read without the+ /// network (nil: nobody, as far as the local session says).+ public var currentAccount: (() -> AppHostAccount?)?+ /// The account the page was last checked against (nil: signed out or+ /// not checked yet); the page's "Shared with" and its paused notice.+ public private(set) var account: AppHostAccount?+ /// When relay sharing last followed the sign-in.+ private var accountCheckedAt: Date?+ private var reconciling = false/// Signs in to Cua (opens the browser and waits): true once signed in./// "Set up for access" runs it inline when relay setup has no account,/// then carries on by itself.@@ -161,7 +213,9 @@ public final class HostModel {public var summaryInput: AppHostSummaryInput? { state.map { appHostSummaryInput(state: $0) } }func apply(_ status: HostStatus) {- state = appHostState(status: status)+ var next = appHostState(status: status)+ next.account = account+ state = nextmachineId = 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@@ -281,6 +335,70 @@ public final class HostModel {}}+ // MARK: - Relay sharing follows the sign-in++ /// Relay sharing needs a signed-in owner (the core's `account_step`):+ /// nobody signed in (signed out, or a session that can no longer+ /// refresh), or another account, pauses it; the owner signing in again+ /// resumes it. Not knowing (offline, the credential vault) changes+ /// nothing. Run at launch, after a sign-in or sign-out, and every+ /// `interval` from the app's refresh.+ public func reconcileAccount(ifOlderThan interval: TimeInterval = 0) async {+ guard let host, accountToken != nil, !reconciling else { return }+ if interval > 0, let at = accountCheckedAt, Date().timeIntervalSince(at) < interval { return }+ reconciling = true+ defer { reconciling = false }+ let signedIn: AppHostAccount?+ do {+ signedIn = try await readToken(forceRefresh: false) == nil ? nil+ : (currentAccount?() ?? AppHostAccount(id: nil, email: nil, display: identity))+ } catch {+ return+ }+ accountCheckedAt = Date()+ account = signedIn+ if state == nil {+ await refresh()+ } else if var s = state {+ s.account = signedIn+ state = s+ }+ guard let state else { return }+ do {+ switch appHostAccountStep(state: state, account: signedIn) {+ case .keep: break+ case .pause:+ apply(try await host.pauseSignedOut())+ actionFailure = nil+ case .resume:+ if let signedIn { apply(try await host.resumeSignedIn(account: appHostAccountKey(account: signedIn))) }+ actionFailure = nil+ }+ } catch {+ actionFailure = HostSetupFailure.presenting(LiveSpacesBackend.words(error))+ failedAction = .resumeSharing+ }+ }++ /// Sign In on the paused page, and Resume sharing while signed out:+ /// the inline sign-in, then sharing follows it. False when it did not+ /// finish.+ private func signInThenReconcile() async -> Bool {+ // Offline (the token could not be read) is not "signed out": no+ // sign-in then; the reconcile leaves sharing as it is.+ let signedOut: Bool+ do { signedOut = try await readToken(forceRefresh: false) == nil } catch { signedOut = false }+ if signedOut {+ guard let signIn else { return false }+ progress = Self.signInProgress+ let done = await signIn()+ progress = nil+ guard done else { return false }+ }+ await reconcileAccount()+ return true+ }+// MARK: - Page buttonspublic func run(_ id: AppHostActionId) async {@@ -288,6 +406,16 @@ public final class HostModel {openForm()return}+ // Sharing over the relay needs a signed-in owner: Sign In, and+ // Resume while paused or signed out, sign in first (inline).+ if id == .signIn || (id == .resumeSharing && needsSignInToShare) {+ guard !busy else { return }+ busy = true+ defer { busy = false }+ actionFailure = nil+ _ = await signInThenReconcile()+ return+ }guard let host, !busy else { return }busy = trueerror = nil@@ -306,6 +434,13 @@ public final class HostModel {}}+ /// Resume sharing must sign in first: relay sharing paused while+ /// signed out, or relay mode with nobody signed in.+ private var needsSignInToShare: Bool {+ guard accountToken != nil, let state, state.mode == "relay" else { return false }+ return state.pausedSignedOut || account == nil && accountCheckedAt != nil+ }+/// Runs the failed button again.public func retryFailedAction() async {guard let id = failedAction else { return }@@ -325,7 +460,7 @@ public final class HostModel {case .remove:try await host.remove()apply(try await host.status())- case .setUp, .shareDesktop, .hideDesktop, .provideSpaces, .stopProvidingSpaces: break+ case .setUp, .signIn, .shareDesktop, .hideDesktop, .provideSpaces, .stopProvidingSpaces: break}}}diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/ThisMachineView.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/ThisMachineView.swiftindex f575646ead..67f3378aa5 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/ThisMachineView.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/ThisMachineView.swift@@ -44,6 +44,27 @@ struct ThisMachineView: View {.accessibilityIdentifier("host-choice-\(choice.id)")}}+ } else if let notice = panel.notice {+ // Relay sharing paused (signed out, or another+ // account): one line in place of the summary, and+ // its button.+ Section {+ HStack(alignment: .firstTextBaseline, spacing: 12) {+ Text(notice)+ .fixedSize(horizontal: false, vertical: true)+ .accessibilityIdentifier("host-notice")+ Spacer(minLength: 8)+ if let action = panel.noticeAction {+ Button(action.label) { Task { await host.run(action.id) } }+ .buttonStyle(.borderedProminent)+ .disabled(host.busy || !action.enabled)+ .accessibilityIdentifier("host-notice-action")+ }+ }+ if let progress = host.progress {+ HostSetupProgressView(text: progress)+ }+ }} else {Section {Text(panel.summary)@@ -197,7 +218,8 @@ struct ThisMachineView: View {Task { await host.run(action.id) }}}- .disabled(host.busy)+ .disabled(host.busy || !action.enabled)+ .help(action.help ?? "").accessibilityIdentifier("host-action-\(index)")if index == 0 {button.buttonStyle(.borderedProminent).tint(action.destructive ? .red : .accentColor)diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/HostSetupAuthTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/HostSetupAuthTests.swiftindex ee5645ba55..f721dbf3fb 100644--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/HostSetupAuthTests.swift+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/HostSetupAuthTests.swift@@ -23,6 +23,8 @@ final class ScriptedHost: HostRunning, @unchecked Sendable {func status() async throws -> HostStatus { try await inner.status() }func stopSharing() async throws -> HostStatus { try await inner.stopSharing() }func startSharing() async throws -> HostStatus { try await inner.startSharing() }+ func pauseSignedOut() async throws -> HostStatus { try await inner.pauseSignedOut() }+ func resumeSignedIn(account: String) async throws -> HostStatus { try await inner.resumeSignedIn(account: account) }func remove() async throws { try await inner.remove() }func configure(change: HostSettingsChange) async throws -> HostStatus { try await inner.configure(change: change) }}diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/HostSetupFailureTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/HostSetupFailureTests.swiftindex a660c3471a..59c0d4b2ad 100644--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/HostSetupFailureTests.swift+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/HostSetupFailureTests.swift@@ -200,6 +200,8 @@ final class GatedHost: HostRunning, @unchecked Sendable {private let lock = NSLock()func status() async throws -> HostStatus { try await inner.status() }+ func pauseSignedOut() async throws -> HostStatus { try await inner.pauseSignedOut() }+ func resumeSignedIn(account: String) async throws -> HostStatus { try await inner.resumeSignedIn(account: account) }func setupRequest(request: AppHostSetupRequest, accountToken: String?) async throws -> HostStatus {let (shouldHold, ready) = lock.withLock { () -> (Bool, [CheckedContinuation<Void, Never>]) indiff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/HostSignInSharingTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/HostSignInSharingTests.swiftnew file mode 100644index 0000000000..e7696794d3--- /dev/null+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/HostSignInSharingTests.swift@@ -0,0 +1,155 @@+// SPDX-License-Identifier: FSL-1.1-MIT+// Copyright (c) 2026 Cua AI, Inc.++import CuaSDK+import CuaSpacesFFI+@testable import CuaSpacesMacKit+import Foundation+import Testing++/// Relay sharing follows the sign-in: signed out pauses it (the host leaves+/// the relay, its setup stays), the owner signing in again resumes it, and+/// another account is never handed the old account's registration.+@MainActor+@Suite("Relay sharing and the sign-in")+struct HostSignInSharingTests {+ static let ada = AppHostAccount(id: "user-1", email: "[email protected]", display: "Ada Lovelace")+ static let bob = AppHostAccount(id: "user-2", email: "[email protected]", display: "Bob")++ /// A relay host set up while `ada` is signed in.+ func sharing(_ host: FixtureHost = FixtureHost()) async -> (HostModel, FakeAccountTokens, Box) {+ let account = FakeAccountTokens()+ account.token = "tok-ada"+ let who = Box(Self.ada)+ let m = HostModel(host: host)+ account.wire(m)+ m.currentAccount = { who.value }+ m.openForm()+ await m.submit()+ await m.reconcileAccount()+ return (m, account, who)+ }++ final class Box: @unchecked Sendable {+ var value: AppHostAccount?+ init(_ value: AppHostAccount?) { self.value = value }+ }++ @Test func signedInAndSharingSaysWhoseAccount() async {+ let host = FixtureHost()+ let (m, _, _) = await sharing(host)+ #expect(!host.calls.contains("pause"))+ let panel = m.panel+ #expect(panel.notice == nil)+ #expect(panel.facts.first { $0.label == "Shared with" }?.value == "Your account (Ada Lovelace)")+ #expect(panel.actions.map(\.id) == [.stopSharing, .remove])+ }++ @Test func signedOutPausesSharingAndSaysSo() async {+ let host = FixtureHost()+ let (m, account, who) = await sharing(host)+ account.token = nil+ who.value = nil+ await m.reconcileAccount()+ #expect(host.calls.last == "pause")+ #expect(host.current.configured, "the setup stays")+ #expect(!host.current.serviceRunning && !host.current.sharing)+ let panel = m.panel+ #expect(panel.notice == "Sign in to share this Mac through Cua. Sharing is paused while you\u{2019}re signed out.")+ #expect(panel.noticeAction?.id == .signIn)+ #expect(panel.noticeAction?.label == "Sign In")+ #expect(!panel.facts.contains { $0.label == "Shared with" })+ #expect(panel.actions.map(\.id) == [.remove])+ #expect(m.summaryInput?.pausedSignedOut == true)+ // Checked again: already paused, nothing more.+ await m.reconcileAccount()+ #expect(host.calls.filter { $0 == "pause" }.count == 1)+ }++ @Test func signingBackInResumesSharing() async {+ let host = FixtureHost()+ let (m, account, who) = await sharing(host)+ account.token = nil+ who.value = nil+ await m.reconcileAccount()+ // Sign In on the page: the inline sign-in, then sharing resumes.+ account.signInGives = "tok-ada-2"+ who.value = Self.ada+ await m.run(.signIn)+ #expect(account.signIns == 1)+ #expect(host.calls.last == "resume:user-1")+ #expect(host.current.sharing && host.current.serviceRunning)+ #expect(m.panel.notice == nil)+ #expect(m.panel.actions.first?.id == .stopSharing)+ }++ @Test func resumeSharingWhileSignedOutSignsInFirst() async {+ let host = FixtureHost()+ let (m, account, who) = await sharing(host)+ account.token = nil+ who.value = nil+ await m.reconcileAccount()+ // A cancelled sign-in leaves it paused.+ account.signInGives = nil+ await m.run(.resumeSharing)+ #expect(account.signIns == 1)+ #expect(host.current.pausedSignedOut)+ #expect(!host.calls.contains { $0.hasPrefix("resume") || $0 == "start" })+ }++ @Test func anotherAccountIsNotHandedTheOldRegistration() async {+ let host = FixtureHost()+ let (m, account, who) = await sharing(host)+ account.token = nil+ who.value = nil+ await m.reconcileAccount()+ account.signInGives = "tok-bob"+ who.value = Self.bob+ await m.run(.signIn)+ #expect(!host.calls.contains { $0.hasPrefix("resume") })+ #expect(host.current.pausedSignedOut)+ let panel = m.panel+ #expect(panel.notice?.contains("another Cua account") == true)+ #expect(panel.noticeAction == nil)+ #expect(panel.actions.map(\.id) == [.remove])+ }++ @Test func anotherAccountSignedInWhileSharingPausesIt() async {+ let host = FixtureHost()+ let (m, account, who) = await sharing(host)+ account.token = "tok-bob"+ who.value = Self.bob+ await m.reconcileAccount()+ #expect(host.calls.last == "pause")+ }++ @Test func offlineIsNotSignedOut() async {+ let host = FixtureHost()+ let (m, account, _) = await sharing(host)+ account.failures = [CuaError.Transport(message: "offline"), CuaError.Transport(message: "offline"),+ CuaError.Transport(message: "offline")]+ await m.reconcileAccount()+ #expect(!host.calls.contains("pause"))+ #expect(m.panel.notice == nil)+ }++ /// Both settings off: sharing stops, the setup stays, and Resume+ /// sharing waits until one is on again.+ @Test func bothSettingsOffStopsSharingAndDisablesResume() async {+ let host = FixtureHost()+ let (m, _, _) = await sharing(host)+ #expect(m.panel.toggles.allSatisfy { $0.enabled })+ await m.run(.hideDesktop)+ #expect(m.panel.toggles.map(\.on) == [false, false])+ #expect(m.panel.toggles.allSatisfy { $0.enabled })+ #expect(host.current.configured && !host.current.sharing)+ let resume = m.panel.actions[0]+ #expect(resume.id == .resumeSharing)+ #expect(!resume.enabled)+ #expect(resume.help != nil)+ await m.run(.provideSpaces)+ #expect(m.panel.actions[0].enabled)+ await m.run(.resumeSharing)+ #expect(host.current.sharing)+ }+}diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/OnboardingTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/OnboardingTests.swiftindex 45bb435100..fcdfc5d7e0 100644--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/OnboardingTests.swift+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/OnboardingTests.swift@@ -29,6 +29,8 @@ final class FakeHost: HostRunning, @unchecked Sendable {func status() async throws -> HostStatus { FixtureHost.unconfigured }func stopSharing() async throws -> HostStatus { FixtureHost.unconfigured }func startSharing() async throws -> HostStatus { FixtureHost.unconfigured }+ func pauseSignedOut() async throws -> HostStatus { FixtureHost.unconfigured }+ func resumeSignedIn(account: String) async throws -> HostStatus { FixtureHost.unconfigured }func remove() async throws {}func configure(change: HostSettingsChange) async throws -> HostStatus { FixtureHost.unconfigured }}diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swiftindex 4e1718eed1..0c17684126 100644--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swift+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swift@@ -1091,6 +1091,7 @@ struct ParityTests {case .hideDesktop: "hide-desktop"case .provideSpaces: "provide-spaces"case .stopProvidingSpaces: "stop-providing-spaces"+ case .signIn: "sign-in"}}diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/SnapshotTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/SnapshotTests.swiftindex 9f413947c4..4294f5c41e 100644--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/SnapshotTests.swift+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/SnapshotTests.swift@@ -395,6 +395,36 @@ struct SnapshotTests {try assertSnapshot(ThisMachineView(host: m.host), "this-machine", size: CGSize(width: 640, height: 520))}+ /// Relay sharing and the sign-in: shared with your account; paused+ /// while signed out (one line and Sign In); both settings off (Resume+ /// sharing disabled).+ @Test func thisMachineAndTheSignIn() async throws {+ let account = FakeAccountTokens()+ account.token = "tok-ada"+ let who = HostSignInSharingTests.Box(HostSignInSharingTests.ada)+ let h = HostModel(host: FixtureHost())+ account.wire(h)+ h.currentAccount = { who.value }+ h.openForm()+ h.send(.setName(name: "Studio"))+ await h.submit()+ await h.reconcileAccount()+ try assertSnapshot(ThisMachineView(host: h), "this-machine-shared-with-account", size: CGSize(width: 640, height: 520))+ account.token = nil+ who.value = nil+ await h.reconcileAccount()+ #expect(h.panel.notice != nil)+ try assertSnapshot(ThisMachineView(host: h), "this-machine-signed-out", size: CGSize(width: 640, height: 520))++ let off = HostModel(host: FixtureHost())+ off.openForm()+ off.send(.setName(name: "Studio"))+ await off.submit()+ await off.run(.hideDesktop)+ #expect(off.panel.actions.first?.enabled == false)+ try assertSnapshot(ThisMachineView(host: off), "this-machine-nothing-shared", size: CGSize(width: 640, height: 520))+ }+@Test func settings() async throws {let m = try await model()// With Storage (the Cua Volume experiment on), as recorded.diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/this-machine-nothing-shared.png b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/this-machine-nothing-shared.pngnew file mode 100644index 0000000000..5b6f8e56cfBinary files /dev/null and b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/this-machine-nothing-shared.png differdiff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/this-machine-shared-with-account.png b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/this-machine-shared-with-account.pngnew file mode 100644index 0000000000..43f40f1213Binary files /dev/null and b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/this-machine-shared-with-account.png differdiff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/this-machine-signed-out.png b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/this-machine-signed-out.pngnew file mode 100644index 0000000000..3cd1aa8415Binary files /dev/null and b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/this-machine-signed-out.png differdiff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ViewModelTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ViewModelTests.swiftindex 5ff5be4856..4691088120 100644--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ViewModelTests.swift+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ViewModelTests.swift@@ -302,7 +302,7 @@ struct ViewModelTests {await h.submit()var panel = h.panel#expect(panel.toggles.map(\.on) == [false, true])- #expect(panel.toggles.map(\.enabled) == [true, false], "the last setting on stays on")+ #expect(panel.toggles.map(\.enabled) == [true, true], "both may be off")#expect(panel.limits?.contains("Apple\u{2019}s license allows two per Mac") == true)#expect(panel.providedEmpty == "None yet")#expect(panel.permissions.isEmpty, "no desktop, no screen permissions")diff --git a/apps/cua-spaces/src/components/ThisMachinePanel.test.tsx b/apps/cua-spaces/src/components/ThisMachinePanel.test.tsxindex 0b373d4eb0..42bcd26c68 100644--- a/apps/cua-spaces/src/components/ThisMachinePanel.test.tsx+++ b/apps/cua-spaces/src/components/ThisMachinePanel.test.tsx@@ -163,8 +163,8 @@ describe("ThisMachinePanel: a spare machine", () => {const desktop = await screen.findByRole("switch", { name: /Share this desktop/ });expect(desktop).not.toBeChecked();expect(screen.getByRole("switch", { name: /Provide Spaces/ })).toBeChecked();- // The only setting on cannot be turned off.- expect(screen.getByRole("switch", { name: /Provide Spaces/ })).toBeDisabled();+ // Both may be off (sharing then stops), so the only one on can go off.+ expect(screen.getByRole("switch", { name: /Provide Spaces/ })).not.toBeDisabled();expect(screen.getByText(/2 macOS VMs \(Apple’s license allows two per Mac\)/)).toBeInTheDocument();expect(screen.getByText("None yet")).toBeInTheDocument();// No desktop, so no screen permissions to grant.diff --git a/apps/cua-spaces/src/components/ThisMachinePanel.tsx b/apps/cua-spaces/src/components/ThisMachinePanel.tsxindex a5ffd6afb9..a4a9570ac6 100644--- a/apps/cua-spaces/src/components/ThisMachinePanel.tsx+++ b/apps/cua-spaces/src/components/ThisMachinePanel.tsx@@ -267,7 +267,8 @@ export function ThisMachinePanel({type="button"className={`${i === 0 ? "primary-button" : "secondary-button"}${a.destructive ? " danger" : ""}`}data-owns-enter- disabled={busy}+ disabled={busy || a.enabled === false}+ title={a.help ?? undefined}onClick={() => (a.confirm ? setConfirming(a) : run(a.id))}>{a.label}diff --git a/apps/cua-spaces/src/model/host.ts b/apps/cua-spaces/src/model/host.tsindex 7998e4f7db..5cb352eb39 100644--- a/apps/cua-spaces/src/model/host.ts+++ b/apps/cua-spaces/src/model/host.ts@@ -103,7 +103,8 @@ export type HostActionId =| "share-desktop"| "hide-desktop"| "provide-spaces"- | "stop-providing-spaces";+ | "stop-providing-spaces"+ | "sign-in";/** One of the two settings, drawn as a switch (`host::HostToggle`). */export interface HostToggle {@@ -171,6 +172,10 @@ export interface HostAction {label: string;destructive: boolean;confirm?: HostConfirm | null;+ /** Can be pressed now (Resume sharing is not while nothing is on to share). */+ enabled?: boolean;+ /** The tooltip, when it says more than the label. */+ help?: string | null;}export function hostPanel(status: HostStatus | null): HostPanelView {diff --git a/libs/cua/crates/cua-cli/src/host.rs b/libs/cua/crates/cua-cli/src/host.rsindex eb9b9824e5..472878d5a3 100644--- a/libs/cua/crates/cua-cli/src/host.rs+++ b/libs/cua/crates/cua-cli/src/host.rs@@ -932,6 +932,13 @@ fn render(s: &HostStatus, out: &mut dyn Write) {return;}let name = s.name.clone().unwrap_or_default();+ if s.paused_signed_out {+ line(+ out,+ "Relay sharing is paused: the Cua app on this machine is signed out. \+ Sign in to it again (or run `cua host start`) to share it.",+ );+ }match s.mode.as_deref() {Some("relay") => line(out,diff --git a/libs/cua/crates/cua-host/src/host.rs b/libs/cua/crates/cua-host/src/host.rsindex f7ceefc8ed..8578156429 100644--- a/libs/cua/crates/cua-host/src/host.rs+++ b/libs/cua/crates/cua-host/src/host.rs@@ -280,6 +280,13 @@ pub struct HostConfig {/// mode on its direct address).#[serde(default)]pub provide_spaces: bool,+ /// Relay sharing is paused because nobody is signed in to the owner's+ /// account on this machine (see [`Host::pause_signed_out`]): the+ /// service is uninstalled so it neither runs nor starts at login, and+ /// the setup (machine token, policy, this file) stays so+ /// [`Host::resume_signed_in`] can bring it back.+ #[serde(default, skip_serializing_if = "std::ops::Not::not")]+ pub paused_signed_out: bool,}/// A macOS privacy pane the user must grant the driver in.@@ -402,6 +409,16 @@ pub struct HostStatus {/// Set when the Spaces audit does not verify.#[serde(default, skip_serializing_if = "Option::is_none")]pub spaces_audit_error: Option<String>,+ /// Relay sharing is paused until the owner signs in again+ /// ([`Host::pause_signed_out`]).+ #[serde(default)]+ pub paused_signed_out: bool,+ /// The account this machine is registered to (relay mode): its id.+ #[serde(default, skip_serializing_if = "Option::is_none")]+ pub owner: Option<String>,+ /// The owner's email, when the relay gave one.+ #[serde(default, skip_serializing_if = "Option::is_none")]+ pub owner_email: Option<String>,}/// Files under `<home>/host`.@@ -1077,12 +1094,10 @@ impl Host {let desktop = change.share_desktop.unwrap_or(config.share_desktop);let provide = change.provide_spaces.unwrap_or(config.provide_spaces);let relay = config.mode == "relay";- if !desktop && !provide {- return Err(Error::InvalidArgument(- "with neither the desktop nor Spaces there is nothing to share; use `cua host stop` to pause, or turn one on"- .into(),- ));- }+ // Both off is a valid choice: there is nothing to share, so sharing+ // stops (below) and the setup stays; turning one on again and+ // Resume sharing (`cua host start`) share again.+ let nothing = !desktop && !provide;if let Some(m) = change.max_macos_vms&& m > crate::provided::MACOS_VM_LICENSE_LIMIT{@@ -1120,8 +1135,14 @@ impl Host {// A service that should run but is down (a start that failed// before) starts again too, so trying the change again repairs it.let down = config.sharing && !self.manager_for_config(&config).state().running;- let restart =- down || desktop != config.share_desktop || (!relay && provide != config.provide_spaces);+ // Paused while signed out: the service stays uninstalled (a new+ // plist would start it again at login); resuming installs it with+ // these settings.+ let restart = !config.paused_signed_out+ && !nothing+ && (down+ || desktop != config.share_desktop+ || (!relay && provide != config.provide_spaces));config.share_desktop = desktop;config.provide_spaces = provide;if let Some(mut p) = policy {@@ -1153,6 +1174,11 @@ impl Host {manager.start()?;}}+ if nothing && config.sharing {+ // Stop advertising: the relay lists it as not sharing (other+ // devices say it shares neither its desktop nor Spaces).+ return self.stop_sharing().await;+ }self.status().await}@@ -1192,11 +1218,20 @@ impl Host {if config.mode == "direct" {status.sharing = config.sharing && status.service.running;}+ if config.mode == "relay"+ && let Some(p) = policy.as_ref()+ {+ status.owner = Some(p.owner.clone()).filter(|o| !o.is_empty());+ status.owner_email = p.owner_email.clone();+ }+ status.paused_signed_out = config.paused_signed_out;if let (Some(url), Some(id)) = (&config.relay_url, &config.machine_id) {match self.relay_machine(url, id).await {Ok(m) => {status.online = Some(m.online);- status.sharing = m.sharing;+ // Paused: nobody can reach it, whatever the relay's+ // sharing switch says.+ status.sharing = m.sharing && !config.paused_signed_out;status.clients = m.clients;if !m.allow.is_empty() {status.allow = m.allow;@@ -1316,14 +1351,24 @@ impl Host {self.status().await}- /// Undoes [`Host::stop_sharing`].+ /// Undoes [`Host::stop_sharing`]. Refused while neither the desktop+ /// nor Spaces is on: there is nothing to share.pub async fn start_sharing(&self) -> Result<HostStatus> {let mut config = self.require_config()?;+ if !config.share_desktop && !config.provide_spaces {+ return Err(Error::InvalidArgument(+ "there is nothing to share: turn on the desktop or Spaces first \+ (`cua host config --desktop on` or `--provide-spaces on`)"+ .into(),+ ));+ }match (&config.relay_url, &config.machine_id) {(Some(url), Some(id)) => {let token = read_secret(&self.paths.machine_token())?;RelayClient::new(url)?.start_sharing(&token, id).await?;self.set_policy_sharing(true)?;+ // An explicit start (`cua host start`) ends a pause too.+ config.paused_signed_out = false;// The service stays up while sharing is stopped; one that// went down (a failed start) is started again here.let manager = self.manager_for_config(&config);@@ -1341,6 +1386,79 @@ impl Host {self.status().await}+ /// Pauses relay sharing because nobody is signed in to the owner's+ /// account here (signed out, or a session that can no longer refresh):+ /// the driver's policy refuses relayed clients, and the service is+ /// stopped and uninstalled, so this machine leaves the relay (offline+ /// for the account) and does not join it again at login. The setup+ /// stays (machine token, policy, config) for+ /// [`Host::resume_signed_in`]. Direct mode, and a machine that is not+ /// set up, are left alone: they do not use the account.+ pub async fn pause_signed_out(&self) -> Result<HostStatus> {+ let Some(mut config) = self.config()? else {+ return self.status().await;+ };+ if config.mode != "relay" {+ return self.status().await;+ }+ // The flag first: a settings change racing this one never installs+ // the service again.+ config.paused_signed_out = true;+ write_json(&self.paths.config(), &config)?;+ // Even if something starts the driver anyway, it refuses relayed+ // clients. `config.sharing` keeps the owner's own choice.+ self.set_policy_sharing(false)?;+ self.manager_for_config(&config).uninstall()?;+ let _ = crate::provided::audit(+ &self.paths.dir,+ "config",+ "local",+ &config.name,+ "relay sharing paused: signed out",+ );+ self.status().await+ }++ /// Undoes [`Host::pause_signed_out`] once the owner is signed in again:+ /// `account` is the signed-in account's id (or email). Another account+ /// is refused: it cannot use this registration, and sharing the old+ /// account's machine under it would be wrong; remove the host setup and+ /// set it up again for that account. Sharing comes back as the owner+ /// left it (stopped stays stopped, but online).+ pub async fn resume_signed_in(&self, account: &str) -> Result<HostStatus> {+ let mut config = self.require_config()?;+ if !config.paused_signed_out {+ return self.status().await;+ }+ let policy = self.policy()?;+ if let Some(p) = &policy+ && !owned_by(p, account)+ {+ return Err(Error::InvalidArgument(+ "this machine is shared with another Cua account; remove the host setup \+ and set it up again to share it with this one"+ .into(),+ ));+ }+ if let Some(mut p) = policy {+ p.sharing = config.sharing;+ write_json(&self.paths.policy(), &p)?;+ }+ config.paused_signed_out = false;+ write_json(&self.paths.config(), &config)?;+ let manager = self.manager_for_config(&config);+ manager.install(&self.service_spec(&config))?;+ manager.start()?;+ let _ = crate::provided::audit(+ &self.paths.dir,+ "config",+ "local",+ &config.name,+ "relay sharing resumed: signed in",+ );+ self.status().await+ }+/// Renames the machine and/or replaces its allowlist (relay mode; the/// account must own it).pub async fn update(@@ -1448,6 +1566,20 @@ impl Host {}}+/// `account` (an id, or an email) is the policy's owner. An empty+/// `account` or owner says nothing, and is taken as the owner.+pub fn owned_by(policy: &HostPolicy, account: &str) -> bool {+ let account = account.trim();+ if account.is_empty() || policy.owner.is_empty() {+ return true;+ }+ policy.owner == account+ || policy+ .owner_email+ .as_deref()+ .is_some_and(|e| e.eq_ignore_ascii_case(account))+}+#[cfg(test)]mod tests {#[test]diff --git a/libs/cua/crates/cua-host/src/tests.rs b/libs/cua/crates/cua-host/src/tests.rsindex 5035002fa8..8c99b0a574 100644--- a/libs/cua/crates/cua-host/src/tests.rs+++ b/libs/cua/crates/cua-host/src/tests.rs@@ -808,7 +808,8 @@ async fn a_spare_machine_provides_spaces_without_its_desktop() {assert!(host.policy().unwrap().unwrap().share_desktop);assert_eq!(status.spaces_audit.len(), 2);- // Apple's license caps macOS VMs at two; nothing at all is refused.+ // Apple's license caps macOS VMs at two (both settings off is allowed:+ // see `both_settings_off_stops_relay_sharing_and_one_on_can_resume`).let e = host.configure(HostSettingsChange {max_macos_vms: Some(3),@@ -817,15 +818,6 @@ async fn a_spare_machine_provides_spaces_without_its_desktop() {.await.unwrap_err();assert!(e.to_string().contains("Apple"), "{e}");- let e = host- .configure(HostSettingsChange {- share_desktop: Some(false),- provide_spaces: Some(false),- ..Default::default()- })- .await- .unwrap_err();- assert!(matches!(e, Error::InvalidArgument(_)), "{e}");}fn spec_args(f: &Fixture) -> Vec<String> {@@ -921,7 +913,8 @@ async fn a_direct_desktop_host_starts_providing_spaces() {assert!(status.provide_spaces && status.share_desktop);assert!(spec_args(&f).iter().any(|a| a == "--direct-host-policy"));assert!(host.policy().unwrap().unwrap().provide_spaces);- // The desktop off as well is a spare machine; both off is refused.+ // The desktop off as well is a spare machine; both off stops sharing+ // (the direct service stops) and keeps the setup.let status = host.configure(HostSettingsChange {share_desktop: Some(false),@@ -930,16 +923,65 @@ async fn a_direct_desktop_host_starts_providing_spaces() {.await.unwrap();assert!(!status.share_desktop && status.provide_spaces);- let e = host+ let status = host.configure(HostSettingsChange {provide_spaces: Some(false),..Default::default()}).await- .unwrap_err();+ .unwrap();+ assert!(status.configured && !status.sharing && !status.service.running);+ let e = host.start_sharing().await.unwrap_err();assert!(matches!(e, Error::InvalidArgument(_)), "{e}");}+/// Turning both settings off while sharing over the relay stops+/// advertising (the relay lists it as not sharing) and keeps the setup;+/// with one on again, Resume sharing shares again.+#[tokio::test]+async fn both_settings_off_stops_relay_sharing_and_one_on_can_resume() {+ let relay = FakeRelay::start().await;+ relay.add_account("acct-token", "user-1", None);+ let f = fixture();+ let host = f.host();+ let status = host+ .setup(f.relay_opts(&relay.url), &StaticToken("acct-token".into()))+ .await+ .unwrap();+ let id = status.machine_id.clone().unwrap();+ assert!(relay.machine(&id).unwrap().sharing);+ host.configure(HostSettingsChange {+ share_desktop: Some(false),+ provide_spaces: Some(false),+ ..Default::default()+ })+ .await+ .unwrap();+ let status = host.status().await.unwrap();+ assert!(status.configured && !status.share_desktop && !status.provide_spaces);+ assert!(!status.sharing);+ assert!(+ !relay.machine(&id).unwrap().sharing,+ "the relay says not sharing"+ );+ assert!(!host.policy().unwrap().unwrap().sharing);+ assert!(host.start_sharing().await.is_err(), "nothing to share yet");++ host.configure(HostSettingsChange {+ provide_spaces: Some(true),+ ..Default::default()+ })+ .await+ .unwrap();+ assert!(+ !host.status().await.unwrap().sharing,+ "stays stopped until resumed"+ );+ let status = host.start_sharing().await.unwrap();+ assert!(status.sharing && status.service.running);+ assert!(relay.machine(&id).unwrap().sharing);+}+/// A relay registration can name the host a Space belongs to; only an/// account that can use that host may.#[tokio::test]@@ -1438,3 +1480,100 @@ fn relay_url_for_prefers_flag_then_env_then_host_config() {env.unwrap_or_else(|| "https://host.example".into()));}++/// Signing out stops relay sharing: the service leaves the relay and is+/// uninstalled (so it does not join again at login), the driver's policy+/// refuses relayed clients, and the setup stays. The owner signing back in+/// resumes it; another account cannot.+#[tokio::test]+async fn signing_out_pauses_relay_sharing_until_the_owner_signs_in() {+ let relay = FakeRelay::start().await;+ relay.add_account("acct-token", "user-1", Some("[email protected]"));+ let f = fixture();+ let host = f.host();+ let status = host+ .setup(f.relay_opts(&relay.url), &StaticToken("acct-token".into()))+ .await+ .unwrap();+ let id = status.machine_id.clone().unwrap();+ assert_eq!(status.owner.as_deref(), Some("user-1"));+ assert_eq!(status.owner_email.as_deref(), Some("[email protected]"));+ assert!(!status.paused_signed_out);+ relay.set_online(&id, true, "0.1.0");+ let token_before = std::fs::read_to_string(host.paths().machine_token()).unwrap();++ f.manager.calls.lock().unwrap().clear();+ let paused = host.pause_signed_out().await.unwrap();+ // Relay attach stops: the join service is gone, not just stopped.+ assert_eq!(*f.manager.calls.lock().unwrap(), vec!["uninstall"]);+ assert!(!paused.service.installed && !paused.service.running);+ assert!(paused.paused_signed_out);+ assert!(!paused.sharing, "paused reads as not sharing");+ assert!(!host.policy().unwrap().unwrap().sharing);+ // The setup is kept to resume from.+ assert!(paused.configured);+ assert_eq!(paused.machine_id.as_deref(), Some(id.as_str()));+ assert_eq!(+ std::fs::read_to_string(host.paths().machine_token()).unwrap(),+ token_before+ );+ // Pausing twice is harmless.+ assert!(host.pause_signed_out().await.unwrap().paused_signed_out);++ // A settings change while paused never installs the service again.+ f.manager.calls.lock().unwrap().clear();+ host.configure(HostSettingsChange {+ provide_spaces: Some(true),+ ..Default::default()+ })+ .await+ .unwrap();+ assert!(f.manager.calls.lock().unwrap().is_empty());+ assert!(!f.manager.state().installed);++ // Another account cannot resume the old account's registration.+ let err = host.resume_signed_in("user-2").await.unwrap_err();+ assert!(err.to_string().contains("another Cua account"), "{err}");+ assert!(host.status().await.unwrap().paused_signed_out);+ assert!(!f.manager.state().running);++ // The owner can (by id or email).+ let resumed = host.resume_signed_in("[email protected]").await.unwrap();+ assert!(!resumed.paused_signed_out);+ assert!(resumed.service.installed && resumed.service.running);+ assert!(resumed.sharing);+ assert!(host.policy().unwrap().unwrap().sharing);+ let spec = f.manager.spec.lock().unwrap().clone().unwrap();+ assert!(spec.args.join(" ").starts_with("join --relay"));+}++/// Stopped sharing stays stopped across a pause, and direct mode (no+/// account involved) is never paused.+#[tokio::test]+async fn a_pause_keeps_the_owners_choice_and_skips_direct_mode() {+ let relay = FakeRelay::start().await;+ relay.add_account("acct-token", "user-1", None);+ let f = fixture();+ let host = f.host();+ host.setup(f.relay_opts(&relay.url), &StaticToken("acct-token".into()))+ .await+ .unwrap();+ host.stop_sharing().await.unwrap();+ host.pause_signed_out().await.unwrap();+ let resumed = host.resume_signed_in("user-1").await.unwrap();+ assert!(resumed.service.running, "back on the relay");+ assert!(+ !host.policy().unwrap().unwrap().sharing,+ "still not sharing"+ );++ let g = fixture();+ let direct = g.host();+ let mut o = SetupOptions::direct("10.1.2.3:3211".parse().unwrap());+ o.driver_bin = Some(g.driver.clone());+ direct.setup(o, &NoAccount).await.unwrap();+ g.manager.calls.lock().unwrap().clear();+ let s = direct.pause_signed_out().await.unwrap();+ assert!(!s.paused_signed_out);+ assert!(g.manager.calls.lock().unwrap().is_empty());+}diff --git a/libs/cua/crates/cua-sdk/src/native/host.rs b/libs/cua/crates/cua-sdk/src/native/host.rsindex a7a3f2a93f..26fcaec087 100644--- a/libs/cua/crates/cua-sdk/src/native/host.rs+++ b/libs/cua/crates/cua-sdk/src/native/host.rs@@ -342,6 +342,16 @@ pub struct HostStatus {/// Set when the Spaces audit does not verify.#[uniffi(default = None)]pub spaces_audit_error: Option<String>,+ /// Relay sharing is paused until the owner signs in again+ /// ([`Host::pause_signed_out`]).+ #[uniffi(default = false)]+ pub paused_signed_out: bool,+ /// The account this machine is registered to (relay mode): its id.+ #[uniffi(default = None)]+ pub owner: Option<String>,+ /// The owner's email, when the relay gave one.+ #[uniffi(default = None)]+ pub owner_email: Option<String>,}/// One access to this machine.@@ -426,6 +436,9 @@ impl From<cua_host::HostStatus> for HostStatus {}).collect(),spaces_audit_error: s.spaces_audit_error,+ paused_signed_out: s.paused_signed_out,+ owner: s.owner,+ owner_email: s.owner_email,}}}@@ -604,6 +617,28 @@ impl Host {run(async move { Ok(cua_host::Host::new(home).start_sharing().await?.into()) }).await}+ /// Pause relay sharing while nobody is signed in to the owner's+ /// account: the host leaves the relay and stays off it (also across a+ /// restart) with its setup kept. Direct mode is left alone.+ pub async fn pause_signed_out(&self) -> Result<HostStatus> {+ let home = self.home.clone();+ run(async move { Ok(cua_host::Host::new(home).pause_signed_out().await?.into()) }).await+ }++ /// Resume relay sharing paused by [`Host::pause_signed_out`] once+ /// `account` (the signed-in account's id or email) is signed in; refused+ /// when it is not the machine's owner.+ pub async fn resume_signed_in(&self, account: String) -> Result<HostStatus> {+ let home = self.home.clone();+ run(async move {+ Ok(cua_host::Host::new(home)+ .resume_signed_in(&account)+ .await?+ .into())+ })+ .await+ }+/// Unregister, uninstall the service and delete the host state.pub async fn remove(&self) -> Result<()> {let home = self.home.clone();diff --git a/libs/cua/crates/cua-spaces-app-core/src/host.rs b/libs/cua/crates/cua-spaces-app-core/src/host.rsindex 4690bcf686..2feb808315 100644--- a/libs/cua/crates/cua-spaces-app-core/src/host.rs+++ b/libs/cua/crates/cua-spaces-app-core/src/host.rs@@ -35,6 +35,9 @@ pub struct HostSummaryInput {/// Relay presence.#[serde(default)]pub online: Option<bool>,+ /// Relay sharing is paused while signed out.+ #[serde(default)]+ pub paused_signed_out: bool,}/// One line for the entry.@@ -45,6 +48,9 @@ pub fn host_summary(status: Option<&HostSummaryInput>) -> String {if let Some(e) = s.error.as_deref().filter(|e| !e.is_empty()) {return format!("Needs attention \u{b7} {e}");}+ if s.paused_signed_out {+ return PAUSED_SUMMARY.into();+ }if !s.service_running {return "Host service stopped".into();}@@ -65,6 +71,14 @@ pub fn host_summary(status: Option<&HostSummaryInput>) -> String {format!("Sharing \u{b7} {via}")}+/// The entry's line while relay sharing is paused for a sign-in.+pub const PAUSED_SUMMARY: &str = "Paused \u{b7} signed out";++/// The page's line while relay sharing is paused because nobody is signed+/// in.+pub const SIGNED_OUT_NOTICE: &str = "Sign in to share this Mac through Cua. \+Sharing is paused while you\u{2019}re signed out.";+/// "Sharing · N connected": the entry's detail while someone is connected.pub fn connected_detail(n: u32) -> String {format!("{CONNECTED_PREFIX}{n}{CONNECTED_SUFFIX}")@@ -434,6 +448,89 @@ pub struct HostState {/// Set when the Spaces audit does not verify.#[serde(default)]pub spaces_audit_error: Option<String>,+ /// Relay sharing is paused until the owner signs in again (the host+ /// left the relay; its setup stays).+ #[serde(default)]+ pub paused_signed_out: bool,+ /// The account this machine is registered to (relay mode): its id.+ #[serde(default)]+ pub owner: Option<String>,+ /// The owner's email, when the relay gave one.+ #[serde(default)]+ pub owner_email: Option<String>,+ /// Who is signed in to Cua in this app (`None`: nobody, or the shell+ /// does not say). The shell fills it; the host does not know.+ #[serde(default)]+ pub account: Option<HostAccount>,+}++/// The account signed in to Cua in the app, as far as "This machine"+/// needs it.+#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct HostAccount {+ /// The account id (the session's `sub`).+ #[serde(default)]+ pub id: Option<String>,+ /// Its email.+ #[serde(default)]+ pub email: Option<String>,+ /// What the app shows for it (a display name, else the email).+ #[serde(default)]+ pub display: Option<String>,+}++impl HostAccount {+ /// What `resume` passes the host to name this account (id, else email).+ pub fn key(&self) -> String {+ self.id+ .clone()+ .filter(|i| !i.is_empty())+ .or_else(|| self.email.clone())+ .unwrap_or_default()+ }+}++/// `account` owns the machine in `state`: compared by id, else by email.+/// `None` when neither side says (the shells then take it as the owner).+pub fn owned_by(state: &HostState, account: &HostAccount) -> Option<bool> {+ let nonempty = |v: &Option<String>| v.clone().filter(|v| !v.trim().is_empty());+ if let (Some(owner), Some(id)) = (nonempty(&state.owner), nonempty(&account.id)) {+ return Some(owner == id);+ }+ if let (Some(owner), Some(email)) = (nonempty(&state.owner_email), nonempty(&account.email)) {+ return Some(owner.eq_ignore_ascii_case(&email));+ }+ None+}++/// What the app does with the host when the account it is signed in to+/// changes (launch, sign-in, sign-out, an expired session).+#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]+#[serde(rename_all = "kebab-case")]+pub enum HostAccountStep {+ /// Nothing to do.+ Keep,+ /// Pause relay sharing (signed out, or signed in to another account).+ Pause,+ /// Resume the paused relay sharing (its owner is signed in again).+ Resume,+}++/// Relay sharing follows the sign-in: nobody signed in (or another+/// account) pauses it, the owner signing in again resumes it. `account` is+/// `None` only when the app knows nobody is signed in (not when it could+/// not tell, offline). Direct mode does not use the account.+pub fn account_step(state: &HostState, account: Option<&HostAccount>) -> HostAccountStep {+ if !state.configured || state.mode.as_deref() != Some("relay") {+ return HostAccountStep::Keep;+ }+ let owner = account.map(|a| owned_by(state, a).unwrap_or(true));+ match (state.paused_signed_out, owner) {+ (false, None | Some(false)) => HostAccountStep::Pause,+ (true, Some(true)) => HostAccountStep::Resume,+ _ => HostAccountStep::Keep,+ }}fn yes() -> bool {@@ -498,6 +595,7 @@ impl HostState {clients: self.clients.len() as u32,mode: self.mode.clone(),online: self.online,+ paused_signed_out: self.paused_signed_out,}}}@@ -522,6 +620,8 @@ pub enum HostActionId {ProvideSpaces,/// Stop creating Spaces for your other devices.StopProvidingSpaces,+ /// Sign in to Cua (relay sharing paused while signed out resumes).+ SignIn,}/// A settings change a host action asks for (`None` keeps a value).@@ -597,6 +697,13 @@ pub struct HostAction {/// Ask this first; the action runs only when the user confirms.#[serde(default, skip_serializing_if = "Option::is_none")]pub confirm: Option<HostConfirm>,+ /// Can be pressed now (Resume sharing is not while nothing is on to+ /// share).+ #[serde(default = "yes")]+ pub enabled: bool,+ /// The tooltip, when it says something the label does not.+ #[serde(default, skip_serializing_if = "Option::is_none")]+ pub help: Option<String>,}/// The confirmation before removing this machine's host setup.@@ -810,6 +917,13 @@ pub struct HostPanelView {pub title: String,/// One line: how it is shared, or that it is not.pub summary: String,+ /// Why relay sharing is paused, one line over the page (signed out, or+ /// signed in to another account).+ #[serde(default, skip_serializing_if = "Option::is_none")]+ pub notice: Option<String>,+ /// The notice's button ("Sign In").+ #[serde(default, skip_serializing_if = "Option::is_none")]+ pub notice_action: Option<HostAction>,/// Set up for access.pub configured: bool,/// Name, Access, Service.@@ -947,6 +1061,8 @@ pub fn panel(state: Option<&HostState>) -> HostPanelView {let mut v = HostPanelView {title: "This machine".into(),summary: "Checking\u{2026}".into(),+ notice: None,+ notice_action: None,configured: false,facts: vec![],clients_title: None,@@ -987,6 +1103,8 @@ pub fn panel(state: Option<&HostState>) -> HostPanelView {label: "Set up for access".into(),destructive: false,confirm: None,+ enabled: true,+ help: None,}];return v;}@@ -1040,6 +1158,29 @@ pub fn panel(state: Option<&HostState>) -> HostPanelView {warning: None,},];+ let relay = s.mode.as_deref() != Some("direct");+ // Whose machine this is: the signed-in owner's.+ if relay+ && !s.paused_signed_out+ && let Some(a) = &s.account+ && owned_by(s, a) != Some(false)+ && let Some(who) = a+ .display+ .clone()+ .or_else(|| a.email.clone())+ .filter(|w| !w.trim().is_empty())+ {+ v.facts.insert(+ 1,+ Fact {+ label: "Shared with".into(),+ value: format!("Your account ({who})"),+ copy: None,+ help: None,+ warning: None,+ },+ );+ }v.clients_title = Some("Connected now".into());v.clients = s.clients@@ -1063,14 +1204,14 @@ pub fn panel(state: Option<&HostState>) -> HostPanelView {.access_log_error.as_ref().map(|_| "The access log was changed outside Cua; it may be incomplete.".into());- let relay = s.mode.as_deref() != Some("direct");v.toggles = vec![HostToggle {id: "desktop".into(),label: "Share this desktop".into(),help: "Your devices can see and control this screen.".into(),on: s.share_desktop,- enabled: relay && (!s.share_desktop || s.provide_spaces),+ // Both may be off: then sharing stops (nothing to share).+ enabled: relay,action: if s.share_desktop {HostActionId::HideDesktop} else {@@ -1086,7 +1227,7 @@ pub fn panel(state: Option<&HostState>) -> HostPanelView {"Needs the relay.".into()},on: s.provide_spaces,- enabled: relay && (!s.provide_spaces || s.share_desktop),+ enabled: relay,action: if s.provide_spaces {HostActionId::StopProvidingSpaces} else {@@ -1114,6 +1255,51 @@ pub fn panel(state: Option<&HostState>) -> HostPanelView {vec![]};v.permissions_title = (!v.permissions.is_empty()).then(|| PERMISSIONS_TITLE.into());+ let remove = HostAction {+ id: HostActionId::Remove,+ label: "Remove host setup".into(),+ destructive: true,+ confirm: Some(remove_confirm()),+ enabled: true,+ help: None,+ };+ if relay && s.paused_signed_out {+ match s.account.as_ref().map(|a| owned_by(s, a)) {+ // Signed in to another account: this registration is not+ // theirs to share. Removing it, then setting up again, is.+ Some(Some(false)) => {+ v.notice = Some(OTHER_ACCOUNT_NOTICE.into());+ v.actions = vec![remove];+ }+ // The owner is signed in again (the app resumes on its own;+ // this is the button when that failed).+ Some(_) => {+ v.notice = Some("Sharing is paused.".into());+ v.notice_action = Some(HostAction {+ id: HostActionId::ResumeSharing,+ label: "Resume Sharing".into(),+ destructive: false,+ confirm: None,+ enabled: true,+ help: None,+ });+ v.actions = vec![remove];+ }+ None => {+ v.notice = Some(SIGNED_OUT_NOTICE.into());+ v.notice_action = Some(HostAction {+ id: HostActionId::SignIn,+ label: "Sign In".into(),+ destructive: false,+ confirm: None,+ enabled: true,+ help: None,+ });+ v.actions = vec![remove];+ }+ }+ return v;+ }v.actions = vec![if s.sharing {// One click, never a confirmation: stopping access must be@@ -1123,6 +1309,8 @@ pub fn panel(state: Option<&HostState>) -> HostPanelView {label: "Stop sharing".into(),destructive: true,confirm: None,+ enabled: true,+ help: None,}} else {HostAction {@@ -1130,18 +1318,26 @@ pub fn panel(state: Option<&HostState>) -> HostPanelView {label: "Resume sharing".into(),destructive: false,confirm: None,+ // Both settings off: there is nothing to share.+ enabled: s.share_desktop || s.provide_spaces,+ help: (!s.share_desktop && !s.provide_spaces).then(|| NOTHING_TO_SHARE_HELP.into()),}},- HostAction {- id: HostActionId::Remove,- label: "Remove host setup".into(),- destructive: true,- confirm: Some(remove_confirm()),- },+ remove,];v}+/// Resume sharing's tooltip while both settings are off.+pub const NOTHING_TO_SHARE_HELP: &str =+ "Turn on Share this desktop or Provide Spaces to share this machine.";++/// The page's line while another account is signed in and this machine's+/// relay sharing (registered to the account that signed out) is paused.+pub const OTHER_ACCOUNT_NOTICE: &str = "This Mac is shared with another Cua \+account, so sharing stays paused. Remove the host setup, then set it up again \+to share it with yours.";+/// "Up to 4 Spaces · 2 macOS VMs (Apple's license allows two per Mac)".pub fn limits_line(max_spaces: u32, max_macos_vms: u32) -> String {let spaces = if max_spaces == 0 {@@ -2080,15 +2276,110 @@ mod tests {}}+ fn ada() -> HostAccount {+ HostAccount {+ id: Some("user-1".into()),+ email: Some("[email protected]".into()),+ display: Some("Ada Lovelace".into()),+ }+ }++ fn owned(paused: bool, account: Option<HostAccount>) -> HostState {+ HostState {+ owner: Some("user-1".into()),+ owner_email: Some("[email protected]".into()),+ paused_signed_out: paused,+ sharing: !paused,+ service_running: !paused,+ account,+ ..host(true, false)+ }+ }++ #[test]+ fn relay_sharing_follows_the_sign_in() {+ let bob = HostAccount {+ id: Some("user-2".into()),+ email: Some("[email protected]".into()),+ display: None,+ };+ // Signed in and sharing: keep it, and say whose it is.+ let s = owned(false, Some(ada()));+ assert_eq!(account_step(&s, s.account.as_ref()), HostAccountStep::Keep);+ let v = panel(Some(&s));+ assert!(v.notice.is_none());+ let fact = v.facts.iter().find(|f| f.label == "Shared with").unwrap();+ assert_eq!(fact.value, "Your account (Ada Lovelace)");+ assert_eq!(v.actions[0].id, HostActionId::StopSharing);++ // Signed out: pause, then one line and Sign In.+ let s = owned(false, None);+ assert_eq!(account_step(&s, None), HostAccountStep::Pause);+ let s = owned(true, None);+ assert_eq!(account_step(&s, None), HostAccountStep::Keep);+ let v = panel(Some(&s));+ assert_eq!(v.notice.as_deref(), Some(SIGNED_OUT_NOTICE));+ assert_eq!(v.notice_action.as_ref().unwrap().id, HostActionId::SignIn);+ assert_eq!(v.notice_action.as_ref().unwrap().label, "Sign In");+ assert!(v.facts.iter().all(|f| f.label != "Shared with"));+ assert_eq!(v.actions.len(), 1);+ assert_eq!(v.actions[0].id, HostActionId::Remove);+ assert_eq!(v.summary, PAUSED_SUMMARY);+ assert_eq!(+ host_summary(Some(&s.summary_input())),+ "Paused \u{b7} signed out"+ );++ // The owner signs in again: resume (by id, or by email alone).+ let s = owned(true, Some(ada()));+ assert_eq!(+ account_step(&s, s.account.as_ref()),+ HostAccountStep::Resume+ );+ let by_email = HostAccount { id: None, ..ada() };+ assert_eq!(account_step(&s, Some(&by_email)), HostAccountStep::Resume);+ assert_eq!(ada().key(), "user-1");+ assert_eq!(by_email.key(), "[email protected]");+ // Its button, if resuming on its own failed.+ let v = panel(Some(&s));+ assert_eq!(+ v.notice_action.as_ref().unwrap().id,+ HostActionId::ResumeSharing+ );++ // Another account: never re-share the old one's registration.+ let s = owned(true, Some(bob.clone()));+ assert_eq!(account_step(&s, s.account.as_ref()), HostAccountStep::Keep);+ let v = panel(Some(&s));+ assert_eq!(v.notice.as_deref(), Some(OTHER_ACCOUNT_NOTICE));+ assert!(v.notice_action.is_none());+ assert_eq!(v.actions[0].id, HostActionId::Remove);+ // ...and one signed in while it shares pauses it.+ let s = owned(false, Some(bob));+ assert_eq!(account_step(&s, s.account.as_ref()), HostAccountStep::Pause);++ // Direct mode and a machine that is not set up never follow it.+ let direct = HostState {+ mode: Some("direct".into()),+ ..owned(false, None)+ };+ assert_eq!(account_step(&direct, None), HostAccountStep::Keep);+ assert!(panel(Some(&direct)).notice.is_none());+ assert_eq!(+ account_step(&HostState::default(), None),+ HostAccountStep::Keep+ );+ }+#[test]- fn the_two_settings_are_switches_and_one_stays_on() {+ fn the_two_settings_are_switches_and_both_may_be_off() {let v = panel(Some(&host(true, false)));let desktop = &v.toggles[0];assert_eq!((desktop.label.as_str(), desktop.on),("Share this desktop", true));- assert!(!desktop.enabled, "the only setting on cannot be turned off");+ assert!(desktop.enabled, "the only setting on can be turned off too");assert_eq!(v.toggles[1].action, HostActionId::ProvideSpaces);assert!(v.toggles[1].enabled);assert!(v.limits.is_none() && v.provided_title.is_none());@@ -2098,7 +2389,7 @@ mod tests {let v = panel(Some(&host(false, true)));assert_eq!(v.toggles[0].action, HostActionId::ShareDesktop);assert!(v.toggles[0].enabled);- assert!(!v.toggles[1].enabled);+ assert!(v.toggles[1].enabled);assert!(v.permissions.is_empty() && v.permissions_title.is_none());assert_eq!(v.limits.as_deref(),@@ -2109,6 +2400,25 @@ mod tests {// Both on: either can go off.let v = panel(Some(&host(true, true)));assert!(v.toggles.iter().all(|t| t.enabled));+ assert!(v.actions.iter().all(|a| a.enabled && a.help.is_none()));++ // Both off: nothing to share, so sharing stopped (the host's+ // doing) and Resume sharing waits for one to be on again.+ let off = HostState {+ sharing: false,+ ..host(false, false)+ };+ let v = panel(Some(&off));+ assert!(v.toggles.iter().all(|t| t.enabled && !t.on));+ assert_eq!(v.actions[0].id, HostActionId::ResumeSharing);+ assert!(!v.actions[0].enabled);+ assert_eq!(v.actions[0].help.as_deref(), Some(NOTHING_TO_SHARE_HELP));+ assert!(v.actions[1].enabled, "Remove stays available");+ let v = panel(Some(&HostState {+ sharing: false,+ ..host(false, true)+ }));+ assert!(v.actions[0].enabled && v.actions[0].help.is_none());// Direct mode cannot provide Spaces or hide the desktop.let direct = panel(Some(&HostState {mode: Some("direct".into()),diff --git a/libs/cua/crates/cua-spaces-ffi/src/app_core.rs b/libs/cua/crates/cua-spaces-ffi/src/app_core.rsindex bdde884dc9..0dcf0bff03 100644--- a/libs/cua/crates/cua-spaces-ffi/src/app_core.rs+++ b/libs/cua/crates/cua-spaces-ffi/src/app_core.rs@@ -399,6 +399,22 @@ pub fn app_host_panel(state: Option<AppHostState>) -> AppHostPanelView {core::host::panel(state.as_ref())}+/// What to do with the host when the signed-in account changes (`None`:+/// nobody is signed in; never pass `None` for "could not tell").+#[uniffi::export]+pub fn app_host_account_step(+ state: AppHostState,+ account: Option<AppHostAccount>,+) -> AppHostAccountStep {+ core::host::account_step(&state, account.as_ref())+}++/// The account id (else email) host resume names the signed-in account by.+#[uniffi::export]+pub fn app_host_account_key(account: AppHostAccount) -> String {+ account.key()+}+/// Permission panes still to grant, as rows.#[uniffi::export]pub fn app_host_permission_rows(permissions: Vec<AppHostPermissionInput>) -> Vec<AppPermissionRow> {@@ -510,6 +526,10 @@ pub fn app_host_state(status: cua_sdk::HostStatus) -> AppHostState {}).collect(),spaces_audit_error: status.spaces_audit_error,+ paused_signed_out: status.paused_signed_out,+ owner: status.owner,+ owner_email: status.owner_email,+ account: None,}}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.rsindex 0226a96fea..ec838c6b78 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@@ -6560,6 +6560,8 @@ pub struct AppHostSummaryInput {pub mode: Option<String>,/// Relay presence.pub online: Option<bool>,+ /// Relay sharing is paused while signed out.+ pub paused_signed_out: bool,}/// The host setup form: what both shells send to host setup.@@ -6717,6 +6719,42 @@ pub struct AppHostState {pub spaces_audit: Vec<AppHostSpacesAudit>,/// Set when the Spaces audit does not verify.pub spaces_audit_error: Option<String>,+ /// Relay sharing is paused until the owner signs in again (the host+ /// left the relay; its setup stays).+ pub paused_signed_out: bool,+ /// The account this machine is registered to (relay mode): its id.+ pub owner: Option<String>,+ /// The owner's email, when the relay gave one.+ pub owner_email: Option<String>,+ /// Who is signed in to Cua in this app (`None`: nobody, or the shell+ /// does not say). The shell fills it; the host does not know.+ pub account: Option<AppHostAccount>,+}++/// The account signed in to Cua in the app, as far as "This machine"+/// needs it.+pub type AppHostAccount = core::host::HostAccount;+#[uniffi::remote(Record)]+pub struct AppHostAccount {+ /// The account id (the session's `sub`).+ pub id: Option<String>,+ /// Its email.+ pub email: Option<String>,+ /// What the app shows for it (a display name, else the email).+ pub display: Option<String>,+}++/// What the app does with the host when the account it is signed in to+/// changes (launch, sign-in, sign-out, an expired session).+pub type AppHostAccountStep = core::host::HostAccountStep;+#[uniffi::remote(Enum)]+pub enum AppHostAccountStep {+ /// Nothing to do.+ Keep,+ /// Pause relay sharing (signed out, or signed in to another account).+ Pause,+ /// Resume the paused relay sharing (its owner is signed in again).+ Resume,}/// What a "This machine" button does.@@ -6739,6 +6777,8 @@ pub enum AppHostActionId {ProvideSpaces,/// Stop creating Spaces for your other devices.StopProvidingSpaces,+ /// Sign in to Cua (relay sharing paused while signed out resumes).+ SignIn,}/// A settings change a host action asks for (`None` keeps a value).@@ -6796,6 +6836,11 @@ pub struct AppHostAction {pub destructive: bool,/// Ask this first; the action runs only when the user confirms.pub confirm: Option<AppHostConfirm>,+ /// Can be pressed now (Resume sharing is not while nothing is on to+ /// share).+ pub enabled: bool,+ /// The tooltip, when it says something the label does not.+ pub help: Option<String>,}/// A row under "Recent access".@@ -6842,6 +6887,11 @@ pub struct AppHostPanelView {pub title: String,/// One line: how it is shared, or that it is not.pub summary: String,+ /// Why relay sharing is paused, one line over the page (signed out, or+ /// signed in to another account).+ pub notice: Option<String>,+ /// The notice's button ("Sign In").+ pub notice_action: Option<AppHostAction>,/// Set up for access.pub configured: bool,/// Name, Access, Service.diff --git a/libs/cua/kotlin/src/main/kotlin/ai/cua/sdk/cua_sdk.kt b/libs/cua/kotlin/src/main/kotlin/ai/cua/sdk/cua_sdk.ktindex a43c3c522f..ebf5a2f36b 100644--- a/libs/cua/kotlin/src/main/kotlin/ai/cua/sdk/cua_sdk.kt+++ b/libs/cua/kotlin/src/main/kotlin/ai/cua/sdk/cua_sdk.kt@@ -1035,8 +1035,12 @@ external fun uniffi_cua_sdk_checksum_method_devices_snapshot(): Shortexternal fun uniffi_cua_sdk_checksum_method_host_configure(): Short+external fun uniffi_cua_sdk_checksum_method_host_pause_signed_out(+): Shortexternal fun uniffi_cua_sdk_checksum_method_host_remove(): Short+external fun uniffi_cua_sdk_checksum_method_host_resume_signed_in(+): Shortexternal fun uniffi_cua_sdk_checksum_method_host_setup(): Shortexternal fun uniffi_cua_sdk_checksum_method_host_start_sharing(@@ -1883,8 +1887,12 @@ external fun uniffi_cua_sdk_fn_constructor_host_new(`cuaHome`: RustBuffer.ByValu): Longexternal fun uniffi_cua_sdk_fn_method_host_configure(`ptr`: Long,`change`: RustBuffer.ByValue,): Long+external fun uniffi_cua_sdk_fn_method_host_pause_signed_out(`ptr`: Long,+): Longexternal fun uniffi_cua_sdk_fn_method_host_remove(`ptr`: Long,): Long+external fun uniffi_cua_sdk_fn_method_host_resume_signed_in(`ptr`: Long,`account`: RustBuffer.ByValue,+): Longexternal fun uniffi_cua_sdk_fn_method_host_setup(`ptr`: Long,`options`: RustBuffer.ByValue,`accountToken`: RustBuffer.ByValue,): Longexternal fun uniffi_cua_sdk_fn_method_host_start_sharing(`ptr`: Long,@@ -3213,9 +3221,15 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) {if (lib.uniffi_cua_sdk_checksum_method_host_configure() != 36828.toShort()) {throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")}+ if (lib.uniffi_cua_sdk_checksum_method_host_pause_signed_out() != 3338.toShort()) {+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ }if (lib.uniffi_cua_sdk_checksum_method_host_remove() != 63746.toShort()) {throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")}+ if (lib.uniffi_cua_sdk_checksum_method_host_resume_signed_in() != 8436.toShort()) {+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ }if (lib.uniffi_cua_sdk_checksum_method_host_setup() != 765.toShort()) {throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")}@@ -10427,11 +10441,25 @@ public interface HostInterface {*/suspend fun `configure`(`change`: HostSettingsChange): HostStatus+ /**+ * Pause relay sharing while nobody is signed in to the owner's+ * account: the host leaves the relay and stays off it (also across a+ * restart) with its setup kept. Direct mode is left alone.+ */+ suspend fun `pauseSignedOut`(): HostStatus+/*** Unregister, uninstall the service and delete the host state.*/suspend fun `remove`()+ /**+ * Resume relay sharing paused by [`Host::pause_signed_out`] once+ * `account` (the signed-in account's id or email) is signed in; refused+ * when it is not the machine's owner.+ */+ suspend fun `resumeSignedIn`(`account`: kotlin.String): HostStatus+/*** Installs and starts the host service (relay mode needs* `account_token`).@@ -10593,6 +10621,32 @@ open class Host: Disposable, AutoCloseable, HostInterface}+ /**+ * Pause relay sharing while nobody is signed in to the owner's+ * account: the host leaves the relay and stays off it (also across a+ * restart) with its setup kept. Direct mode is left alone.+ */+ @Throws(CuaException::class)+ @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")+ override suspend fun `pauseSignedOut`() : HostStatus {+ return uniffiRustCallAsync(+ callWithHandle { uniffiHandle ->+ UniffiLib.uniffi_cua_sdk_fn_method_host_pause_signed_out(+ uniffiHandle,++ )+ },+ { future, callback, continuation -> UniffiLib.ffi_cua_sdk_rust_future_poll_rust_buffer(future, callback, continuation) },+ { future, continuation -> UniffiLib.ffi_cua_sdk_rust_future_complete_rust_buffer(future, continuation) },+ { future -> UniffiLib.ffi_cua_sdk_rust_future_free_rust_buffer(future) },+ // lift function+ { FfiConverterTypeHostStatus.lift(it) },+ // Error FFI converter+ CuaException.ErrorHandler,+ )+ }++/*** Unregister, uninstall the service and delete the host state.*/@@ -10618,6 +10672,32 @@ open class Host: Disposable, AutoCloseable, HostInterface}+ /**+ * Resume relay sharing paused by [`Host::pause_signed_out`] once+ * `account` (the signed-in account's id or email) is signed in; refused+ * when it is not the machine's owner.+ */+ @Throws(CuaException::class)+ @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")+ override suspend fun `resumeSignedIn`(`account`: kotlin.String) : HostStatus {+ return uniffiRustCallAsync(+ callWithHandle { uniffiHandle ->+ UniffiLib.uniffi_cua_sdk_fn_method_host_resume_signed_in(+ uniffiHandle,+ FfiConverterString.lower(`account`),+ )+ },+ { future, callback, continuation -> UniffiLib.ffi_cua_sdk_rust_future_poll_rust_buffer(future, callback, continuation) },+ { future, continuation -> UniffiLib.ffi_cua_sdk_rust_future_complete_rust_buffer(future, continuation) },+ { future -> UniffiLib.ffi_cua_sdk_rust_future_free_rust_buffer(future) },+ // lift function+ { FfiConverterTypeHostStatus.lift(it) },+ // Error FFI converter+ CuaException.ErrorHandler,+ )+ }++/*** Installs and starts the host service (relay mode needs* `account_token`).@@ -30218,6 +30298,22 @@ data class HostStatus (* Set when the Spaces audit does not verify.*/var `spacesAuditError`: kotlin.String? = null+ ,+ /**+ * Relay sharing is paused until the owner signs in again+ * ([`Host::pause_signed_out`]).+ */+ var `pausedSignedOut`: kotlin.Boolean = false+ ,+ /**+ * The account this machine is registered to (relay mode): its id.+ */+ var `owner`: kotlin.String? = null+ ,+ /**+ * The owner's email, when the relay gave one.+ */+ var `ownerEmail`: kotlin.String? = null){@@ -30259,6 +30355,9 @@ public object FfiConverterTypeHostStatus: FfiConverterRustBuffer<HostStatus> {FfiConverterSequenceTypeHostProvidedSpace.read(buf),FfiConverterSequenceTypeHostSpacesAuditRecord.read(buf),FfiConverterOptionalString.read(buf),+ FfiConverterBoolean.read(buf),+ FfiConverterOptionalString.read(buf),+ FfiConverterOptionalString.read(buf),)}@@ -30287,7 +30386,10 @@ public object FfiConverterTypeHostStatus: FfiConverterRustBuffer<HostStatus> {FfiConverterUInt.allocationSize(value.`maxMacosVms`) +FfiConverterSequenceTypeHostProvidedSpace.allocationSize(value.`providedSpaces`) +FfiConverterSequenceTypeHostSpacesAuditRecord.allocationSize(value.`spacesAudit`) +- FfiConverterOptionalString.allocationSize(value.`spacesAuditError`)+ FfiConverterOptionalString.allocationSize(value.`spacesAuditError`) ++ FfiConverterBoolean.allocationSize(value.`pausedSignedOut`) ++ FfiConverterOptionalString.allocationSize(value.`owner`) ++ FfiConverterOptionalString.allocationSize(value.`ownerEmail`))override fun write(value: HostStatus, buf: ByteBuffer) {@@ -30316,6 +30418,9 @@ public object FfiConverterTypeHostStatus: FfiConverterRustBuffer<HostStatus> {FfiConverterSequenceTypeHostProvidedSpace.write(value.`providedSpaces`, buf)FfiConverterSequenceTypeHostSpacesAuditRecord.write(value.`spacesAudit`, buf)FfiConverterOptionalString.write(value.`spacesAuditError`, buf)+ FfiConverterBoolean.write(value.`pausedSignedOut`, buf)+ FfiConverterOptionalString.write(value.`owner`, buf)+ FfiConverterOptionalString.write(value.`ownerEmail`, buf)}}diff --git a/libs/cua/python/src/cua/_native.py b/libs/cua/python/src/cua/_native.pyindex 8d0ab2bdfb..196e306dcd 100644--- a/libs/cua/python/src/cua/_native.py+++ b/libs/cua/python/src/cua/_native.py@@ -791,8 +791,12 @@ def _uniffi_check_api_checksums(lib):raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cua_sdk_checksum_method_host_configure() != 36828:raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ if lib.uniffi_cua_sdk_checksum_method_host_pause_signed_out() != 3338:+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cua_sdk_checksum_method_host_remove() != 63746:raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ if lib.uniffi_cua_sdk_checksum_method_host_resume_signed_in() != 8436:+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cua_sdk_checksum_method_host_setup() != 765:raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cua_sdk_checksum_method_host_start_sharing() != 43032:@@ -2819,10 +2823,19 @@ _UniffiLib.uniffi_cua_sdk_fn_method_host_configure.argtypes = (_UniffiRustBuffer,)_UniffiLib.uniffi_cua_sdk_fn_method_host_configure.restype = ctypes.c_uint64+_UniffiLib.uniffi_cua_sdk_fn_method_host_pause_signed_out.argtypes = (+ ctypes.c_uint64,+)+_UniffiLib.uniffi_cua_sdk_fn_method_host_pause_signed_out.restype = ctypes.c_uint64_UniffiLib.uniffi_cua_sdk_fn_method_host_remove.argtypes = (ctypes.c_uint64,)_UniffiLib.uniffi_cua_sdk_fn_method_host_remove.restype = ctypes.c_uint64+_UniffiLib.uniffi_cua_sdk_fn_method_host_resume_signed_in.argtypes = (+ ctypes.c_uint64,+ _UniffiRustBuffer,+)+_UniffiLib.uniffi_cua_sdk_fn_method_host_resume_signed_in.restype = ctypes.c_uint64_UniffiLib.uniffi_cua_sdk_fn_method_host_setup.argtypes = (ctypes.c_uint64,_UniffiRustBuffer,@@ -4789,9 +4802,15 @@ _UniffiLib.uniffi_cua_sdk_checksum_constructor_host_new.restype = ctypes.c_uint1_UniffiLib.uniffi_cua_sdk_checksum_method_host_configure.argtypes = ()_UniffiLib.uniffi_cua_sdk_checksum_method_host_configure.restype = ctypes.c_uint16+_UniffiLib.uniffi_cua_sdk_checksum_method_host_pause_signed_out.argtypes = (+)+_UniffiLib.uniffi_cua_sdk_checksum_method_host_pause_signed_out.restype = ctypes.c_uint16_UniffiLib.uniffi_cua_sdk_checksum_method_host_remove.argtypes = ()_UniffiLib.uniffi_cua_sdk_checksum_method_host_remove.restype = ctypes.c_uint16+_UniffiLib.uniffi_cua_sdk_checksum_method_host_resume_signed_in.argtypes = (+)+_UniffiLib.uniffi_cua_sdk_checksum_method_host_resume_signed_in.restype = ctypes.c_uint16_UniffiLib.uniffi_cua_sdk_checksum_method_host_setup.argtypes = ()_UniffiLib.uniffi_cua_sdk_checksum_method_host_setup.restype = ctypes.c_uint16@@ -14231,7 +14250,7 @@ class HostStatus:"""Host status."""- def __init__(self, *, configured:bool, mode:typing.Optional[str], relay_url:typing.Optional[str], direct_url:typing.Optional[str], env_token_path:typing.Optional[str], machine_id:typing.Optional[str], name:typing.Optional[str], sharing:bool, service_installed:bool, service_running:bool, service_kind:str, online:typing.Optional[bool], clients:typing.List[RelayClientInfo], allow:typing.List[str], permissions:typing.List[HostPermission], error:typing.Optional[str], recent_access:typing.List[HostAccessRecord] = _DEFAULT, access_log_error:typing.Optional[str] = _DEFAULT, share_desktop:bool = True, provide_spaces:bool = False, max_spaces:int = 0, max_macos_vms:int = 0, provided_spaces:typing.List[HostProvidedSpace] = _DEFAULT, spaces_audit:typing.List[HostSpacesAuditRecord] = _DEFAULT, spaces_audit_error:typing.Optional[str] = _DEFAULT):+ def __init__(self, *, configured:bool, mode:typing.Optional[str], relay_url:typing.Optional[str], direct_url:typing.Optional[str], env_token_path:typing.Optional[str], machine_id:typing.Optional[str], name:typing.Optional[str], sharing:bool, service_installed:bool, service_running:bool, service_kind:str, online:typing.Optional[bool], clients:typing.List[RelayClientInfo], allow:typing.List[str], permissions:typing.List[HostPermission], error:typing.Optional[str], recent_access:typing.List[HostAccessRecord] = _DEFAULT, access_log_error:typing.Optional[str] = _DEFAULT, share_desktop:bool = True, provide_spaces:bool = False, max_spaces:int = 0, max_macos_vms:int = 0, provided_spaces:typing.List[HostProvidedSpace] = _DEFAULT, spaces_audit:typing.List[HostSpacesAuditRecord] = _DEFAULT, spaces_audit_error:typing.Optional[str] = _DEFAULT, paused_signed_out:bool = False, owner:typing.Optional[str] = _DEFAULT, owner_email:typing.Optional[str] = _DEFAULT):self.configured = configuredself.mode = modeself.relay_url = relay_url@@ -14272,12 +14291,21 @@ class HostStatus:self.spaces_audit_error = Noneelse:self.spaces_audit_error = spaces_audit_error+ self.paused_signed_out = paused_signed_out+ if owner is _DEFAULT:+ self.owner = None+ else:+ self.owner = owner+ if owner_email is _DEFAULT:+ self.owner_email = None+ else:+ self.owner_email = owner_emaildef __str__(self):- return "HostStatus(configured={}, mode={}, relay_url={}, direct_url={}, env_token_path={}, machine_id={}, name={}, sharing={}, service_installed={}, service_running={}, service_kind={}, online={}, clients={}, allow={}, permissions={}, error={}, recent_access={}, access_log_error={}, share_desktop={}, provide_spaces={}, max_spaces={}, max_macos_vms={}, provided_spaces={}, spaces_audit={}, spaces_audit_error={})".format(self.configured, self.mode, self.relay_url, self.direct_url, self.env_token_path, self.machine_id, self.name, self.sharing, self.service_installed, self.service_running, self.service_kind, self.online, self.clients, self.allow, self.permissions, self.error, self.recent_access, self.access_log_error, self.share_desktop, self.provide_spaces, self.max_spaces, self.max_macos_vms, self.provided_spaces, self.spaces_audit, self.spaces_audit_error)+ return "HostStatus(configured={}, mode={}, relay_url={}, direct_url={}, env_token_path={}, machine_id={}, name={}, sharing={}, service_installed={}, service_running={}, service_kind={}, online={}, clients={}, allow={}, permissions={}, error={}, recent_access={}, access_log_error={}, share_desktop={}, provide_spaces={}, max_spaces={}, max_macos_vms={}, provided_spaces={}, spaces_audit={}, spaces_audit_error={}, paused_signed_out={}, owner={}, owner_email={})".format(self.configured, self.mode, self.relay_url, self.direct_url, self.env_token_path, self.machine_id, self.name, self.sharing, self.service_installed, self.service_running, self.service_kind, self.online, self.clients, self.allow, self.permissions, self.error, self.recent_access, self.access_log_error, self.share_desktop, self.provide_spaces, self.max_spaces, self.max_macos_vms, self.provided_spaces, self.spaces_audit, self.spaces_audit_error, self.paused_signed_out, self.owner, self.owner_email)def __eq__(self, other):if self.configured != other.configured:return False@@ -14329,6 +14357,12 @@ class HostStatus:return Falseif self.spaces_audit_error != other.spaces_audit_error:return False+ if self.paused_signed_out != other.paused_signed_out:+ return False+ if self.owner != other.owner:+ return False+ if self.owner_email != other.owner_email:+ return Falsereturn Trueclass _UniffiFfiConverterTypeHostStatus(_UniffiConverterRustBuffer):@@ -14360,6 +14394,9 @@ class _UniffiFfiConverterTypeHostStatus(_UniffiConverterRustBuffer):provided_spaces=_UniffiFfiConverterSequenceTypeHostProvidedSpace.read(buf),spaces_audit=_UniffiFfiConverterSequenceTypeHostSpacesAuditRecord.read(buf),spaces_audit_error=_UniffiFfiConverterOptionalString.read(buf),+ paused_signed_out=_UniffiFfiConverterBoolean.read(buf),+ owner=_UniffiFfiConverterOptionalString.read(buf),+ owner_email=_UniffiFfiConverterOptionalString.read(buf),)@staticmethod@@ -14389,6 +14426,9 @@ class _UniffiFfiConverterTypeHostStatus(_UniffiConverterRustBuffer):_UniffiFfiConverterSequenceTypeHostProvidedSpace.check_lower(value.provided_spaces)_UniffiFfiConverterSequenceTypeHostSpacesAuditRecord.check_lower(value.spaces_audit)_UniffiFfiConverterOptionalString.check_lower(value.spaces_audit_error)+ _UniffiFfiConverterBoolean.check_lower(value.paused_signed_out)+ _UniffiFfiConverterOptionalString.check_lower(value.owner)+ _UniffiFfiConverterOptionalString.check_lower(value.owner_email)@staticmethoddef write(value, buf):@@ -14417,6 +14457,9 @@ class _UniffiFfiConverterTypeHostStatus(_UniffiConverterRustBuffer):_UniffiFfiConverterSequenceTypeHostProvidedSpace.write(value.provided_spaces, buf)_UniffiFfiConverterSequenceTypeHostSpacesAuditRecord.write(value.spaces_audit, buf)_UniffiFfiConverterOptionalString.write(value.spaces_audit_error, buf)+ _UniffiFfiConverterBoolean.write(value.paused_signed_out, buf)+ _UniffiFfiConverterOptionalString.write(value.owner, buf)+ _UniffiFfiConverterOptionalString.write(value.owner_email, buf)@dataclassclass HttpHeader:@@ -35836,11 +35879,25 @@ class HostProtocol(typing.Protocol):Changes what this machine shares: its own desktop, and whether itcreates Spaces for your other devices (and their limits). Turningthe desktop on or off restarts the host service.+"""+ raise NotImplementedError+ async def pause_signed_out(self, ) -> HostStatus:+ """+ Pause relay sharing while nobody is signed in to the owner's+ account: the host leaves the relay and stays off it (also across a+ restart) with its setup kept. Direct mode is left alone."""raise NotImplementedErrorasync def remove(self, ) -> None:"""Unregister, uninstall the service and delete the host state.+"""+ raise NotImplementedError+ async def resume_signed_in(self, account: str) -> HostStatus:+ """+ Resume relay sharing paused by [`Host::pause_signed_out`] once+ `account` (the signed-in account's id or email) is signed in; refused+ when it is not the machine's owner."""raise NotImplementedErrorasync def setup(self, options: HostSetupOptions,account_token: typing.Optional[str]) -> HostStatus:@@ -35935,6 +35992,25 @@ class Host(HostProtocol):_uniffi_lift_return,_uniffi_error_converter,)+ async def pause_signed_out(self, ) -> HostStatus:+ """+ Pause relay sharing while nobody is signed in to the owner's+ account: the host leaves the relay and stays off it (also across a+ restart) with its setup kept. Direct mode is left alone.+"""+ _uniffi_lowered_args = (+ self._uniffi_clone_handle(),+ )+ _uniffi_lift_return = _UniffiFfiConverterTypeHostStatus.lift+ _uniffi_error_converter = _UniffiFfiConverterTypeCuaError+ return await _uniffi_rust_call_async(+ _UniffiLib.uniffi_cua_sdk_fn_method_host_pause_signed_out(*_uniffi_lowered_args),+ _UniffiLib.ffi_cua_sdk_rust_future_poll_rust_buffer,+ _UniffiLib.ffi_cua_sdk_rust_future_complete_rust_buffer,+ _UniffiLib.ffi_cua_sdk_rust_future_free_rust_buffer,+ _uniffi_lift_return,+ _uniffi_error_converter,+ )async def remove(self, ) -> None:"""Unregister, uninstall the service and delete the host state.@@ -35952,6 +36028,28 @@ class Host(HostProtocol):_uniffi_lift_return,_uniffi_error_converter,)+ async def resume_signed_in(self, account: str) -> HostStatus:+ """+ Resume relay sharing paused by [`Host::pause_signed_out`] once+ `account` (the signed-in account's id or email) is signed in; refused+ when it is not the machine's owner.+"""++ _UniffiFfiConverterString.check_lower(account)+ _uniffi_lowered_args = (+ self._uniffi_clone_handle(),+ _UniffiFfiConverterString.lower(account),+ )+ _uniffi_lift_return = _UniffiFfiConverterTypeHostStatus.lift+ _uniffi_error_converter = _UniffiFfiConverterTypeCuaError+ return await _uniffi_rust_call_async(+ _UniffiLib.uniffi_cua_sdk_fn_method_host_resume_signed_in(*_uniffi_lowered_args),+ _UniffiLib.ffi_cua_sdk_rust_future_poll_rust_buffer,+ _UniffiLib.ffi_cua_sdk_rust_future_complete_rust_buffer,+ _UniffiLib.ffi_cua_sdk_rust_future_free_rust_buffer,+ _uniffi_lift_return,+ _uniffi_error_converter,+ )async def setup(self, options: HostSetupOptions,account_token: typing.Optional[str]) -> HostStatus:"""Installs and starts the host service (relay mode needsdiff --git a/libs/cua/scripts/generate-app-core-ffi.py b/libs/cua/scripts/generate-app-core-ffi.pyindex 215df0c721..5680e93d94 100644--- a/libs/cua/scripts/generate-app-core-ffi.py+++ b/libs/cua/scripts/generate-app-core-ffi.py@@ -54,7 +54,7 @@ TYPES = [("experiments.rs", "experiments", ["Experiments"]),("settings.rs", "settings", ["SwitcherTheme", "AppSettings", "KeyCombo", "SignInPhase", "TelemetryInput", "SettingsInput", "SettingsRowKind", "SettingsOption", "SettingsRow", "SettingsSection", "SettingsPage"]),("window.rs", "window", ["ChromeInput", "MainChrome", "MenuItemId", "MenuItem", "MenuInput"]),- ("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"]),+ ("host.rs", "host", ["HostSummaryInput", "HostSetupRequest", "HostClient", "HostAccess", "HostPermissionInput", "HostProvidedSpace", "HostSpacesAudit", "HostState", "HostAccount", "HostAccountStep", "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", "MachineAccessNotice", "ThisDevice", "DevicesLabels", "DevicesView", "EnrollMethod", "EnrollPhase", "EnrollState", "EnrollAction", "EnrollOption", "EnrollView", "ApproveSheetState", "ApproveSheetAction", "ApproveRequest", "ApproveSheetView"]),diff --git a/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift b/libs/cua/swift/Sources/CuaSDK/CuaSDK.swiftindex c55b13794a..b40a94a9cb 100644--- a/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift+++ b/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift@@ -4436,11 +4436,25 @@ public protocol HostProtocol: AnyObject, Sendable {*/func configure(change: HostSettingsChange) async throws -> HostStatus+ /**+ * Pause relay sharing while nobody is signed in to the owner's+ * account: the host leaves the relay and stays off it (also across a+ * restart) with its setup kept. Direct mode is left alone.+ */+ func pauseSignedOut() async throws -> HostStatus+/*** Unregister, uninstall the service and delete the host state.*/func remove() async throws+ /**+ * Resume relay sharing paused by [`Host::pause_signed_out`] once+ * `account` (the signed-in account's id or email) is signed in; refused+ * when it is not the machine's owner.+ */+ func resumeSignedIn(account: String) async throws -> HostStatus+/*** Installs and starts the host service (relay mode needs* `account_token`).@@ -4552,6 +4566,28 @@ open func configure(change: HostSettingsChange)async throws -> HostStatus {)}+ /**+ * Pause relay sharing while nobody is signed in to the owner's+ * account: the host leaves the relay and stays off it (also across a+ * restart) with its setup kept. Direct mode is left alone.+ */+open func pauseSignedOut()async throws -> HostStatus {+ return+ try await uniffiRustCallAsync(+ rustFutureFunc: {+ uniffi_cua_sdk_fn_method_host_pause_signed_out(+ self.uniffiCloneHandle()++ )+ },+ pollFunc: ffi_cua_sdk_rust_future_poll_rust_buffer,+ completeFunc: ffi_cua_sdk_rust_future_complete_rust_buffer,+ freeFunc: ffi_cua_sdk_rust_future_free_rust_buffer,+ liftFunc: FfiConverterTypeHostStatus_lift,+ errorHandler: FfiConverterTypeCuaError_lift+ )+}+/*** Unregister, uninstall the service and delete the host state.*/@@ -4572,6 +4608,28 @@ open func remove()async throws {)}+ /**+ * Resume relay sharing paused by [`Host::pause_signed_out`] once+ * `account` (the signed-in account's id or email) is signed in; refused+ * when it is not the machine's owner.+ */+open func resumeSignedIn(account: String)async throws -> HostStatus {+ return+ try await uniffiRustCallAsync(+ rustFutureFunc: {+ uniffi_cua_sdk_fn_method_host_resume_signed_in(+ self.uniffiCloneHandle(),+ FfiConverterString.lower(account)+ )+ },+ pollFunc: ffi_cua_sdk_rust_future_poll_rust_buffer,+ completeFunc: ffi_cua_sdk_rust_future_complete_rust_buffer,+ freeFunc: ffi_cua_sdk_rust_future_free_rust_buffer,+ liftFunc: FfiConverterTypeHostStatus_lift,+ errorHandler: FfiConverterTypeCuaError_lift+ )+}+/*** Installs and starts the host service (relay mode needs* `account_token`).@@ -22926,6 +22984,19 @@ public struct HostStatus: Equatable, Hashable {* Set when the Spaces audit does not verify.*/public var spacesAuditError: String?+ /**+ * Relay sharing is paused until the owner signs in again+ * ([`Host::pause_signed_out`]).+ */+ public var pausedSignedOut: Bool+ /**+ * The account this machine is registered to (relay mode): its id.+ */+ public var owner: String?+ /**+ * The owner's email, when the relay gave one.+ */+ public var ownerEmail: String?// Default memberwise initializers are never public by default, so we// declare one manually.@@ -23005,7 +23076,17 @@ public struct HostStatus: Equatable, Hashable {*/spacesAudit: [HostSpacesAuditRecord] = [],/*** Set when the Spaces audit does not verify.- */spacesAuditError: String? = nil) {+ */spacesAuditError: String? = nil,+ /**+ * Relay sharing is paused until the owner signs in again+ * ([`Host::pause_signed_out`]).+ */pausedSignedOut: Bool = false,+ /**+ * The account this machine is registered to (relay mode): its id.+ */owner: String? = nil,+ /**+ * The owner's email, when the relay gave one.+ */ownerEmail: String? = nil) {self.configured = configuredself.mode = modeself.relayUrl = relayUrl@@ -23031,6 +23112,9 @@ public struct HostStatus: Equatable, Hashable {self.providedSpaces = providedSpacesself.spacesAudit = spacesAuditself.spacesAuditError = spacesAuditError+ self.pausedSignedOut = pausedSignedOut+ self.owner = owner+ self.ownerEmail = ownerEmail}@@ -23073,7 +23157,10 @@ public struct FfiConverterTypeHostStatus: FfiConverterRustBuffer {maxMacosVms: FfiConverterUInt32.read(from: &buf),providedSpaces: FfiConverterSequenceTypeHostProvidedSpace.read(from: &buf),spacesAudit: FfiConverterSequenceTypeHostSpacesAuditRecord.read(from: &buf),- spacesAuditError: FfiConverterOptionString.read(from: &buf)+ spacesAuditError: FfiConverterOptionString.read(from: &buf),+ pausedSignedOut: FfiConverterBool.read(from: &buf),+ owner: FfiConverterOptionString.read(from: &buf),+ ownerEmail: FfiConverterOptionString.read(from: &buf))}@@ -23103,6 +23190,9 @@ public struct FfiConverterTypeHostStatus: FfiConverterRustBuffer {FfiConverterSequenceTypeHostProvidedSpace.write(value.providedSpaces, into: &buf)FfiConverterSequenceTypeHostSpacesAuditRecord.write(value.spacesAudit, into: &buf)FfiConverterOptionString.write(value.spacesAuditError, into: &buf)+ FfiConverterBool.write(value.pausedSignedOut, into: &buf)+ FfiConverterOptionString.write(value.owner, into: &buf)+ FfiConverterOptionString.write(value.ownerEmail, into: &buf)}}@@ -40195,9 +40285,15 @@ private let initializationResult: InitializationResult = {if (uniffi_cua_sdk_checksum_method_host_configure() != 36828) {return InitializationResult.apiChecksumMismatch}+ if (uniffi_cua_sdk_checksum_method_host_pause_signed_out() != 3338) {+ return InitializationResult.apiChecksumMismatch+ }if (uniffi_cua_sdk_checksum_method_host_remove() != 63746) {return InitializationResult.apiChecksumMismatch}+ if (uniffi_cua_sdk_checksum_method_host_resume_signed_in() != 8436) {+ return InitializationResult.apiChecksumMismatch+ }if (uniffi_cua_sdk_checksum_method_host_setup() != 765) {return InitializationResult.apiChecksumMismatch}diff --git a/libs/cua/swift/Sources/cua_sdkFFI/include/cua_sdkFFI.h b/libs/cua/swift/Sources/cua_sdkFFI/include/cua_sdkFFI.hindex 80b15ae8f4..a9f42b3f8c 100644--- a/libs/cua/swift/Sources/cua_sdkFFI/include/cua_sdkFFI.h+++ b/libs/cua/swift/Sources/cua_sdkFFI/include/cua_sdkFFI.h@@ -931,11 +931,21 @@ uint64_t uniffi_cua_sdk_fn_constructor_host_new(RustBuffer cua_home, RustCallStauint64_t uniffi_cua_sdk_fn_method_host_configure(uint64_t ptr, RustBuffer change);#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_METHOD_HOST_PAUSE_SIGNED_OUT+#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_METHOD_HOST_PAUSE_SIGNED_OUT+uint64_t uniffi_cua_sdk_fn_method_host_pause_signed_out(uint64_t ptr+);+#endif#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_METHOD_HOST_REMOVE#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_METHOD_HOST_REMOVEuint64_t uniffi_cua_sdk_fn_method_host_remove(uint64_t ptr);#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_METHOD_HOST_RESUME_SIGNED_IN+#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_METHOD_HOST_RESUME_SIGNED_IN+uint64_t uniffi_cua_sdk_fn_method_host_resume_signed_in(uint64_t ptr, RustBuffer account+);+#endif#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_METHOD_HOST_SETUP#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_METHOD_HOST_SETUPuint64_t uniffi_cua_sdk_fn_method_host_setup(uint64_t ptr, RustBuffer options, RustBuffer account_token@@ -4013,12 +4023,24 @@ uint16_t uniffi_cua_sdk_checksum_method_devices_snapshot(void#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_HOST_CONFIGUREuint16_t uniffi_cua_sdk_checksum_method_host_configure(void+);+#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_HOST_PAUSE_SIGNED_OUT+#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_HOST_PAUSE_SIGNED_OUT+uint16_t uniffi_cua_sdk_checksum_method_host_pause_signed_out(void+);#endif#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_HOST_REMOVE#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_HOST_REMOVEuint16_t uniffi_cua_sdk_checksum_method_host_remove(void+);+#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_HOST_RESUME_SIGNED_IN+#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_HOST_RESUME_SIGNED_IN+uint16_t uniffi_cua_sdk_checksum_method_host_resume_signed_in(void+);#endif#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_HOST_SETUPdiff --git a/libs/cua/typescript/src/native/cua_sdk-ffi.ts b/libs/cua/typescript/src/native/cua_sdk-ffi.tsindex d6c4aa2529..9161495c7f 100644--- a/libs/cua/typescript/src/native/cua_sdk-ffi.ts+++ b/libs/cua/typescript/src/native/cua_sdk-ffi.ts@@ -1373,11 +1373,21 @@ const DEFINITIONS = {ret: FfiType.Handle,hasRustCallStatus: false,},+ "uniffi_cua_sdk_fn_method_host_pause_signed_out": {+ args: [FfiType.Handle],+ ret: FfiType.Handle,+ hasRustCallStatus: false,+ },"uniffi_cua_sdk_fn_method_host_remove": {args: [FfiType.Handle],ret: FfiType.Handle,hasRustCallStatus: false,},+ "uniffi_cua_sdk_fn_method_host_resume_signed_in": {+ args: [FfiType.Handle, FfiType.RustBuffer],+ ret: FfiType.Handle,+ hasRustCallStatus: false,+ },"uniffi_cua_sdk_fn_method_host_setup": {args: [FfiType.Handle, FfiType.RustBuffer, FfiType.RustBuffer],ret: FfiType.Handle,@@ -3573,11 +3583,21 @@ const DEFINITIONS = {ret: FfiType.UInt16,hasRustCallStatus: false,},+ "uniffi_cua_sdk_checksum_method_host_pause_signed_out": {+ args: [],+ ret: FfiType.UInt16,+ hasRustCallStatus: false,+ },"uniffi_cua_sdk_checksum_method_host_remove": {args: [],ret: FfiType.UInt16,hasRustCallStatus: false,},+ "uniffi_cua_sdk_checksum_method_host_resume_signed_in": {+ args: [],+ ret: FfiType.UInt16,+ hasRustCallStatus: false,+ },"uniffi_cua_sdk_checksum_method_host_setup": {args: [],ret: FfiType.UInt16,@@ -5371,7 +5391,9 @@ interface NativeModuleInterface {uniffi_cua_sdk_fn_method_guestdisplay_via(uniffiSelf: bigint, uniffi_out_err: UniffiRustCallStatus): Uint8Array;uniffi_cua_sdk_fn_constructor_host_new(cuaHome: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;uniffi_cua_sdk_fn_method_host_configure(uniffiSelf: bigint, change: Uint8Array): bigint;+ uniffi_cua_sdk_fn_method_host_pause_signed_out(uniffiSelf: bigint): bigint;uniffi_cua_sdk_fn_method_host_remove(uniffiSelf: bigint): bigint;+ uniffi_cua_sdk_fn_method_host_resume_signed_in(uniffiSelf: bigint, account: Uint8Array): bigint;uniffi_cua_sdk_fn_method_host_setup(uniffiSelf: bigint, options: Uint8Array, accountToken: Uint8Array): bigint;uniffi_cua_sdk_fn_method_host_start_sharing(uniffiSelf: bigint): bigint;uniffi_cua_sdk_fn_method_host_status(uniffiSelf: bigint): bigint;@@ -5811,7 +5833,9 @@ interface NativeModuleInterface {uniffi_cua_sdk_checksum_method_guestdisplay_via(): number;uniffi_cua_sdk_checksum_constructor_host_new(): number;uniffi_cua_sdk_checksum_method_host_configure(): number;+ uniffi_cua_sdk_checksum_method_host_pause_signed_out(): number;uniffi_cua_sdk_checksum_method_host_remove(): number;+ uniffi_cua_sdk_checksum_method_host_resume_signed_in(): number;uniffi_cua_sdk_checksum_method_host_setup(): number;uniffi_cua_sdk_checksum_method_host_start_sharing(): number;uniffi_cua_sdk_checksum_method_host_status(): number;diff --git a/libs/cua/typescript/src/native/cua_sdk.ts b/libs/cua/typescript/src/native/cua_sdk.tsindex 864889afc2..a15c6035e3 100644--- a/libs/cua/typescript/src/native/cua_sdk.ts+++ b/libs/cua/typescript/src/native/cua_sdk.ts@@ -9410,7 +9410,20 @@ export type HostStatus = {/*** Set when the Spaces audit does not verify.*/- spacesAuditError?: string+ spacesAuditError?: string,+ /**+ * Relay sharing is paused until the owner signs in again+ * ([`Host::pause_signed_out`]).+ */+ pausedSignedOut: boolean,+ /**+ * The account this machine is registered to (relay mode): its id.+ */+ owner?: string,+ /**+ * The owner's email, when the relay gave one.+ */+ ownerEmail?: string}/**@@ -9426,7 +9439,10 @@ export const HostStatus = (() => {maxMacosVms: 0,providedSpaces: [],spacesAudit: [],- spacesAuditError: undefined+ spacesAuditError: undefined,+ pausedSignedOut: false,+ owner: undefined,+ ownerEmail: undefined});const create = (() => {return uniffiCreateRecord<HostStatus, ReturnType<typeof defaults>>(defaults);@@ -9467,7 +9483,10 @@ const FfiConverterTypeHostStatus = (() => {maxMacosVms: FfiConverterUInt32.read(from),providedSpaces: FfiConverterSequenceTypeHostProvidedSpace.read(from),spacesAudit: FfiConverterSequenceTypeHostSpacesAuditRecord.read(from),- spacesAuditError: FfiConverterOptionalString.read(from)+ spacesAuditError: FfiConverterOptionalString.read(from),+ pausedSignedOut: FfiConverterBool.read(from),+ owner: FfiConverterOptionalString.read(from),+ ownerEmail: FfiConverterOptionalString.read(from)};}write(value: TypeName, into: RustBuffer): void {@@ -9496,6 +9515,9 @@ const FfiConverterTypeHostStatus = (() => {FfiConverterSequenceTypeHostProvidedSpace.write(value.providedSpaces, into);FfiConverterSequenceTypeHostSpacesAuditRecord.write(value.spacesAudit, into);FfiConverterOptionalString.write(value.spacesAuditError, into);+ FfiConverterBool.write(value.pausedSignedOut, into);+ FfiConverterOptionalString.write(value.owner, into);+ FfiConverterOptionalString.write(value.ownerEmail, into);}allocationSize(value: TypeName): number {return FfiConverterBool.allocationSize(value.configured) +@@ -9522,7 +9544,10 @@ const FfiConverterTypeHostStatus = (() => {FfiConverterUInt32.allocationSize(value.maxMacosVms) +FfiConverterSequenceTypeHostProvidedSpace.allocationSize(value.providedSpaces) +FfiConverterSequenceTypeHostSpacesAuditRecord.allocationSize(value.spacesAudit) +- FfiConverterOptionalString.allocationSize(value.spacesAuditError);+ FfiConverterOptionalString.allocationSize(value.spacesAuditError) ++ FfiConverterBool.allocationSize(value.pausedSignedOut) ++ FfiConverterOptionalString.allocationSize(value.owner) ++ FfiConverterOptionalString.allocationSize(value.ownerEmail);}};@@ -35531,10 +35556,22 @@ export interface HostLike {* the desktop on or off restarts the host service.*/configure(change: HostSettingsChange, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<HostStatus>;+/**+ * Pause relay sharing while nobody is signed in to the owner's+ * account: the host leaves the relay and stays off it (also across a+ * restart) with its setup kept. Direct mode is left alone.+ */+ pauseSignedOut(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<HostStatus>;/*** Unregister, uninstall the service and delete the host state.*/remove(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;+/**+ * Resume relay sharing paused by [`Host::pause_signed_out`] once+ * `account` (the signed-in account's id or email) is signed in; refused+ * when it is not the machine's owner.+ */+ resumeSignedIn(account: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<HostStatus>;/*** Installs and starts the host service (relay mode needs* `account_token`).@@ -35625,6 +35662,43 @@ export class Host extends UniffiAbstractObject implements HostLike {}}+/**+ * Pause relay sharing while nobody is signed in to the owner's+ * account: the host leaves the relay and stays off it (also across a+ * restart) with its setup kept. Direct mode is left alone.+ */+ async pauseSignedOut(asyncOpts_?: { signal: AbortSignal }): Promise<HostStatus> /*throws*/ {+ const __stack = uniffiIsDebug ? new Error().stack : undefined;+ try {+ return await uniffiRustCallAsync(+ /*rustCaller:*/ uniffiCaller,+ /*rustFutureFunc:*/ () => {+ return nativeModule().uniffi_cua_sdk_fn_method_host_pause_signed_out(+ uniffiTypeHostObjectFactory.clonePointer(this)+ );+ },+ /*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,+ /*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,+ /*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,+ /*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,+ // Async returns always go through the JS-side converter: the+ // FFI symbol returns the future handle (u64), and the user-level+ // RustBuffer comes back via the shared `rust_future_complete_*`+ // export. The bytes the runtime hands back must be deserialized+ // here using the per-callable return-type converter.+ /*liftFunc:*/ FfiConverterTypeHostStatus.lift.bind(FfiConverterTypeHostStatus),+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),+ /*asyncOpts:*/ asyncOpts_,+ /*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)+ );+ } catch (__error: any) {+ if (uniffiIsDebug && __error instanceof Error) {+ __error.stack = __stack;+ }+ throw __error;+ }+ }+/*** Unregister, uninstall the service and delete the host state.*/@@ -35655,6 +35729,43 @@ export class Host extends UniffiAbstractObject implements HostLike {}}+/**+ * Resume relay sharing paused by [`Host::pause_signed_out`] once+ * `account` (the signed-in account's id or email) is signed in; refused+ * when it is not the machine's owner.+ */+ async resumeSignedIn(account: string, asyncOpts_?: { signal: AbortSignal }): Promise<HostStatus> /*throws*/ {+ const __stack = uniffiIsDebug ? new Error().stack : undefined;+ try {+ return await uniffiRustCallAsync(+ /*rustCaller:*/ uniffiCaller,+ /*rustFutureFunc:*/ () => {+ return nativeModule().uniffi_cua_sdk_fn_method_host_resume_signed_in(+ uniffiTypeHostObjectFactory.clonePointer(this),FfiConverterString.lower(account, nativeModule().rustbuffer_alloc)+ );+ },+ /*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,+ /*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,+ /*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,+ /*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,+ // Async returns always go through the JS-side converter: the+ // FFI symbol returns the future handle (u64), and the user-level+ // RustBuffer comes back via the shared `rust_future_complete_*`+ // export. The bytes the runtime hands back must be deserialized+ // here using the per-callable return-type converter.+ /*liftFunc:*/ FfiConverterTypeHostStatus.lift.bind(FfiConverterTypeHostStatus),+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),+ /*asyncOpts:*/ asyncOpts_,+ /*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)+ );+ } catch (__error: any) {+ if (uniffiIsDebug && __error instanceof Error) {+ __error.stack = __stack;+ }+ throw __error;+ }+ }+/*** Installs and starts the host service (relay mode needs* `account_token`).@@ -37090,9 +37201,15 @@ function uniffiEnsureInitialized() {if (nativeModule().uniffi_cua_sdk_checksum_method_host_configure() !== 36828) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_host_configure");}+ if (nativeModule().uniffi_cua_sdk_checksum_method_host_pause_signed_out() !== 3338) {+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_host_pause_signed_out");+ }if (nativeModule().uniffi_cua_sdk_checksum_method_host_remove() !== 63746) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_host_remove");}+ if (nativeModule().uniffi_cua_sdk_checksum_method_host_resume_signed_in() !== 8436) {+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_host_resume_signed_in");+ }if (nativeModule().uniffi_cua_sdk_checksum_method_host_setup() !== 765) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_host_setup");}diff --git a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swiftindex 66a01bfb7e..468c42c0c6 100644--- a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift+++ b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift@@ -13536,6 +13536,82 @@ public func FfiConverterTypeAppHostAccessRow_lower(_ value: AppHostAccessRow) ->}+public struct AppHostAccount: Equatable, Hashable {+ /**+ * The account id (the session's `sub`).+ */+ public var id: String?+ /**+ * Its email.+ */+ public var email: String?+ /**+ * What the app shows for it (a display name, else the email).+ */+ public var display: String?++ // Default memberwise initializers are never public by default, so we+ // declare one manually.+ public init(+ /**+ * The account id (the session's `sub`).+ */id: String?,+ /**+ * Its email.+ */email: String?,+ /**+ * What the app shows for it (a display name, else the email).+ */display: String?) {+ self.id = id+ self.email = email+ self.display = display+ }+++++}++#if compiler(>=6)+extension AppHostAccount: Sendable {}+#endif++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public struct FfiConverterTypeAppHostAccount: FfiConverterRustBuffer {+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppHostAccount {+ return+ try AppHostAccount(+ id: FfiConverterOptionString.read(from: &buf),+ email: FfiConverterOptionString.read(from: &buf),+ display: FfiConverterOptionString.read(from: &buf)+ )+ }++ public static func write(_ value: AppHostAccount, into buf: inout [UInt8]) {+ FfiConverterOptionString.write(value.id, into: &buf)+ FfiConverterOptionString.write(value.email, into: &buf)+ FfiConverterOptionString.write(value.display, into: &buf)+ }+}+++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public func FfiConverterTypeAppHostAccount_lift(_ buf: RustBuffer) throws -> AppHostAccount {+ return try FfiConverterTypeAppHostAccount.lift(buf)+}++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public func FfiConverterTypeAppHostAccount_lower(_ value: AppHostAccount) -> RustBuffer {+ return FfiConverterTypeAppHostAccount.lower(value)+}++public struct AppHostAction: Equatable, Hashable {/*** What it does.@@ -13553,6 +13629,15 @@ public struct AppHostAction: Equatable, Hashable {* Ask this first; the action runs only when the user confirms.*/public var confirm: AppHostConfirm?+ /**+ * Can be pressed now (Resume sharing is not while nothing is on to+ * share).+ */+ public var enabled: Bool+ /**+ * The tooltip, when it says something the label does not.+ */+ public var help: String?// Default memberwise initializers are never public by default, so we// declare one manually.@@ -13568,11 +13653,20 @@ public struct AppHostAction: Equatable, Hashable {*/destructive: Bool,/*** Ask this first; the action runs only when the user confirms.- */confirm: AppHostConfirm?) {+ */confirm: AppHostConfirm?,+ /**+ * Can be pressed now (Resume sharing is not while nothing is on to+ * share).+ */enabled: Bool,+ /**+ * The tooltip, when it says something the label does not.+ */help: String?) {self.id = idself.label = labelself.destructive = destructiveself.confirm = confirm+ self.enabled = enabled+ self.help = help}@@ -13594,7 +13688,9 @@ public struct FfiConverterTypeAppHostAction: FfiConverterRustBuffer {id: FfiConverterTypeAppHostActionId.read(from: &buf),label: FfiConverterString.read(from: &buf),destructive: FfiConverterBool.read(from: &buf),- confirm: FfiConverterOptionTypeAppHostConfirm.read(from: &buf)+ confirm: FfiConverterOptionTypeAppHostConfirm.read(from: &buf),+ enabled: FfiConverterBool.read(from: &buf),+ help: FfiConverterOptionString.read(from: &buf))}@@ -13603,6 +13699,8 @@ public struct FfiConverterTypeAppHostAction: FfiConverterRustBuffer {FfiConverterString.write(value.label, into: &buf)FfiConverterBool.write(value.destructive, into: &buf)FfiConverterOptionTypeAppHostConfirm.write(value.confirm, into: &buf)+ FfiConverterBool.write(value.enabled, into: &buf)+ FfiConverterOptionString.write(value.help, into: &buf)}}@@ -14389,6 +14487,15 @@ public struct AppHostPanelView: Equatable, Hashable {* One line: how it is shared, or that it is not.*/public var summary: String+ /**+ * Why relay sharing is paused, one line over the page (signed out, or+ * signed in to another account).+ */+ public var notice: String?+ /**+ * The notice's button ("Sign In").+ */+ public var noticeAction: AppHostAction?/*** Set up for access.*/@@ -14512,6 +14619,13 @@ public struct AppHostPanelView: Equatable, Hashable {/*** One line: how it is shared, or that it is not.*/summary: String,+ /**+ * Why relay sharing is paused, one line over the page (signed out, or+ * signed in to another account).+ */notice: String?,+ /**+ * The notice's button ("Sign In").+ */noticeAction: AppHostAction?,/*** Set up for access.*/configured: Bool,@@ -14600,6 +14714,8 @@ public struct AppHostPanelView: Equatable, Hashable {*/setupChoices: [AppHostSetupChoice]) {self.title = titleself.summary = summary+ self.notice = notice+ self.noticeAction = noticeActionself.configured = configuredself.facts = factsself.clientsTitle = clientsTitle@@ -14647,6 +14763,8 @@ public struct FfiConverterTypeAppHostPanelView: FfiConverterRustBuffer {try AppHostPanelView(title: FfiConverterString.read(from: &buf),summary: FfiConverterString.read(from: &buf),+ notice: FfiConverterOptionString.read(from: &buf),+ noticeAction: FfiConverterOptionTypeAppHostAction.read(from: &buf),configured: FfiConverterBool.read(from: &buf),facts: FfiConverterSequenceTypeAppFact.read(from: &buf),clientsTitle: FfiConverterOptionString.read(from: &buf),@@ -14680,6 +14798,8 @@ public struct FfiConverterTypeAppHostPanelView: FfiConverterRustBuffer {public static func write(_ value: AppHostPanelView, into buf: inout [UInt8]) {FfiConverterString.write(value.title, into: &buf)FfiConverterString.write(value.summary, into: &buf)+ FfiConverterOptionString.write(value.notice, into: &buf)+ FfiConverterOptionTypeAppHostAction.write(value.noticeAction, into: &buf)FfiConverterBool.write(value.configured, into: &buf)FfiConverterSequenceTypeAppFact.write(value.facts, into: &buf)FfiConverterOptionString.write(value.clientsTitle, into: &buf)@@ -15404,6 +15524,24 @@ public struct AppHostState: Equatable, Hashable {* Set when the Spaces audit does not verify.*/public var spacesAuditError: String?+ /**+ * Relay sharing is paused until the owner signs in again (the host+ * left the relay; its setup stays).+ */+ public var pausedSignedOut: Bool+ /**+ * The account this machine is registered to (relay mode): its id.+ */+ public var owner: String?+ /**+ * The owner's email, when the relay gave one.+ */+ public var ownerEmail: String?+ /**+ * Who is signed in to Cua in this app (`None`: nobody, or the shell+ * does not say). The shell fills it; the host does not know.+ */+ public var account: AppHostAccount?// Default memberwise initializers are never public by default, so we// declare one manually.@@ -15474,7 +15612,21 @@ public struct AppHostState: Equatable, Hashable {*/spacesAudit: [AppHostSpacesAudit],/*** Set when the Spaces audit does not verify.- */spacesAuditError: String?) {+ */spacesAuditError: String?,+ /**+ * Relay sharing is paused until the owner signs in again (the host+ * left the relay; its setup stays).+ */pausedSignedOut: Bool,+ /**+ * The account this machine is registered to (relay mode): its id.+ */owner: String?,+ /**+ * The owner's email, when the relay gave one.+ */ownerEmail: String?,+ /**+ * Who is signed in to Cua in this app (`None`: nobody, or the shell+ * does not say). The shell fills it; the host does not know.+ */account: AppHostAccount?) {self.configured = configuredself.mode = modeself.relayUrl = relayUrl@@ -15497,6 +15649,10 @@ public struct AppHostState: Equatable, Hashable {self.providedSpaces = providedSpacesself.spacesAudit = spacesAuditself.spacesAuditError = spacesAuditError+ self.pausedSignedOut = pausedSignedOut+ self.owner = owner+ self.ownerEmail = ownerEmail+ self.account = account}@@ -15536,7 +15692,11 @@ public struct FfiConverterTypeAppHostState: FfiConverterRustBuffer {maxMacosVms: FfiConverterUInt32.read(from: &buf),providedSpaces: FfiConverterSequenceTypeAppHostProvidedSpace.read(from: &buf),spacesAudit: FfiConverterSequenceTypeAppHostSpacesAudit.read(from: &buf),- spacesAuditError: FfiConverterOptionString.read(from: &buf)+ spacesAuditError: FfiConverterOptionString.read(from: &buf),+ pausedSignedOut: FfiConverterBool.read(from: &buf),+ owner: FfiConverterOptionString.read(from: &buf),+ ownerEmail: FfiConverterOptionString.read(from: &buf),+ account: FfiConverterOptionTypeAppHostAccount.read(from: &buf))}@@ -15563,6 +15723,10 @@ public struct FfiConverterTypeAppHostState: FfiConverterRustBuffer {FfiConverterSequenceTypeAppHostProvidedSpace.write(value.providedSpaces, into: &buf)FfiConverterSequenceTypeAppHostSpacesAudit.write(value.spacesAudit, into: &buf)FfiConverterOptionString.write(value.spacesAuditError, into: &buf)+ FfiConverterBool.write(value.pausedSignedOut, into: &buf)+ FfiConverterOptionString.write(value.owner, into: &buf)+ FfiConverterOptionString.write(value.ownerEmail, into: &buf)+ FfiConverterOptionTypeAppHostAccount.write(value.account, into: &buf)}}@@ -15611,6 +15775,10 @@ public struct AppHostSummaryInput: Equatable, Hashable {* Relay presence.*/public var online: Bool?+ /**+ * Relay sharing is paused while signed out.+ */+ public var pausedSignedOut: Bool// Default memberwise initializers are never public by default, so we// declare one manually.@@ -15635,7 +15803,10 @@ public struct AppHostSummaryInput: Equatable, Hashable {*/mode: String?,/*** Relay presence.- */online: Bool?) {+ */online: Bool?,+ /**+ * Relay sharing is paused while signed out.+ */pausedSignedOut: Bool) {self.configured = configuredself.error = errorself.serviceRunning = serviceRunning@@ -15643,6 +15814,7 @@ public struct AppHostSummaryInput: Equatable, Hashable {self.clients = clientsself.mode = modeself.online = online+ self.pausedSignedOut = pausedSignedOut}@@ -15667,7 +15839,8 @@ public struct FfiConverterTypeAppHostSummaryInput: FfiConverterRustBuffer {sharing: FfiConverterBool.read(from: &buf),clients: FfiConverterUInt32.read(from: &buf),mode: FfiConverterOptionString.read(from: &buf),- online: FfiConverterOptionBool.read(from: &buf)+ online: FfiConverterOptionBool.read(from: &buf),+ pausedSignedOut: FfiConverterBool.read(from: &buf))}@@ -15679,6 +15852,7 @@ public struct FfiConverterTypeAppHostSummaryInput: FfiConverterRustBuffer {FfiConverterUInt32.write(value.clients, into: &buf)FfiConverterOptionString.write(value.mode, into: &buf)FfiConverterOptionBool.write(value.online, into: &buf)+ FfiConverterBool.write(value.pausedSignedOut, into: &buf)}}@@ -43279,6 +43453,89 @@ public func FfiConverterTypeAppEnrollmentKind_lower(_ value: AppEnrollmentKind)}+// Note that we don't yet support `indirect` for enums.+// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.++public enum AppHostAccountStep: Equatable, Hashable {++ /**+ * Nothing to do.+ */+ case keep+ /**+ * Pause relay sharing (signed out, or signed in to another account).+ */+ case pause+ /**+ * Resume the paused relay sharing (its owner is signed in again).+ */+ case resume++++++}++#if compiler(>=6)+extension AppHostAccountStep: Sendable {}+#endif++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public struct FfiConverterTypeAppHostAccountStep: FfiConverterRustBuffer {+ typealias SwiftType = AppHostAccountStep++ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppHostAccountStep {+ let variant: Int32 = try readInt(&buf)+ switch variant {++ case 1: return .keep++ case 2: return .pause++ case 3: return .resume++ default: throw UniffiInternalError.unexpectedEnumCase+ }+ }++ public static func write(_ value: AppHostAccountStep, into buf: inout [UInt8]) {+ switch value {+++ case .keep:+ writeInt(&buf, Int32(1))+++ case .pause:+ writeInt(&buf, Int32(2))+++ case .resume:+ writeInt(&buf, Int32(3))++ }+ }+}+++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public func FfiConverterTypeAppHostAccountStep_lift(_ buf: RustBuffer) throws -> AppHostAccountStep {+ return try FfiConverterTypeAppHostAccountStep.lift(buf)+}++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public func FfiConverterTypeAppHostAccountStep_lower(_ value: AppHostAccountStep) -> RustBuffer {+ return FfiConverterTypeAppHostAccountStep.lower(value)+}++// Note that we don't yet support `indirect` for enums.// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.@@ -43316,6 +43573,10 @@ public enum AppHostActionId: Equatable, Hashable {* Stop creating Spaces for your other devices.*/case stopProvidingSpaces+ /**+ * Sign in to Cua (relay sharing paused while signed out resumes).+ */+ case signIn@@ -43353,6 +43614,8 @@ public struct FfiConverterTypeAppHostActionId: FfiConverterRustBuffer {case 8: return .stopProvidingSpaces+ case 9: return .signIn+default: throw UniffiInternalError.unexpectedEnumCase}}@@ -43392,6 +43655,10 @@ public struct FfiConverterTypeAppHostActionId: FfiConverterRustBuffer {case .stopProvidingSpaces:writeInt(&buf, Int32(8))++ case .signIn:+ writeInt(&buf, Int32(9))+}}}@@ -54078,6 +54345,54 @@ fileprivate struct FfiConverterOptionTypeAppGpuRow: FfiConverterRustBuffer {}}+#if swift(>=5.8)+@_documentation(visibility: private)+#endif+fileprivate struct FfiConverterOptionTypeAppHostAccount: FfiConverterRustBuffer {+ typealias SwiftType = AppHostAccount?++ public static func write(_ value: SwiftType, into buf: inout [UInt8]) {+ guard let value = value else {+ writeInt(&buf, Int8(0))+ return+ }+ writeInt(&buf, Int8(1))+ FfiConverterTypeAppHostAccount.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 FfiConverterTypeAppHostAccount.read(from: &buf)+ default: throw UniffiInternalError.unexpectedOptionalTag+ }+ }+}++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+fileprivate struct FfiConverterOptionTypeAppHostAction: FfiConverterRustBuffer {+ typealias SwiftType = AppHostAction?++ public static func write(_ value: SwiftType, into buf: inout [UInt8]) {+ guard let value = value else {+ writeInt(&buf, Int8(0))+ return+ }+ writeInt(&buf, Int8(1))+ FfiConverterTypeAppHostAction.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 FfiConverterTypeAppHostAction.read(from: &buf)+ default: throw UniffiInternalError.unexpectedOptionalTag+ }+ }+}+#if swift(>=5.8)@_documentation(visibility: private)#endif@@ -60487,6 +60802,28 @@ public func appGroupWindowsByApp(windows: [AppRemoteWindow]) -> [AppRemoteWindow)})}+/**+ * The account id (else email) host resume names the signed-in account by.+ */+public func appHostAccountKey(account: AppHostAccount) -> String {+ return try! FfiConverterString.lift(try! rustCall() {+ uniffi_cua_spaces_ffi_fn_func_app_host_account_key(+ FfiConverterTypeAppHostAccount_lower(account),$0+ )+})+}+/**+ * What to do with the host when the signed-in account changes (`None`:+ * nobody is signed in; never pass `None` for "could not tell").+ */+public func appHostAccountStep(state: AppHostState, account: AppHostAccount?) -> AppHostAccountStep {+ return try! FfiConverterTypeAppHostAccountStep_lift(try! rustCall() {+ uniffi_cua_spaces_ffi_fn_func_app_host_account_step(+ FfiConverterTypeAppHostState_lower(state),+ FfiConverterOptionTypeAppHostAccount.lower(account),$0+ )+})+}/*** This machine's CPU architecture as the Spaces apps pass it to the core* (`arm64`, `amd64`).@@ -62805,6 +63142,12 @@ private let initializationResult: InitializationResult = {if (uniffi_cua_spaces_ffi_checksum_func_app_group_windows_by_app() != 1722) {return InitializationResult.apiChecksumMismatch}+ if (uniffi_cua_spaces_ffi_checksum_func_app_host_account_key() != 31377) {+ return InitializationResult.apiChecksumMismatch+ }+ if (uniffi_cua_spaces_ffi_checksum_func_app_host_account_step() != 15231) {+ return InitializationResult.apiChecksumMismatch+ }if (uniffi_cua_spaces_ffi_checksum_func_app_host_arch() != 62729) {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.hindex 3eb482ba75..7e6aa784a7 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@@ -1089,6 +1089,16 @@ RustBuffer uniffi_cua_spaces_ffi_fn_func_app_format_hotkey(RustBuffer combo, RusRustBuffer uniffi_cua_spaces_ffi_fn_func_app_group_windows_by_app(RustBuffer windows, RustCallStatus *_Nonnull out_status);#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_HOST_ACCOUNT_KEY+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_HOST_ACCOUNT_KEY+RustBuffer uniffi_cua_spaces_ffi_fn_func_app_host_account_key(RustBuffer account, RustCallStatus *_Nonnull out_status+);+#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_HOST_ACCOUNT_STEP+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_HOST_ACCOUNT_STEP+RustBuffer uniffi_cua_spaces_ffi_fn_func_app_host_account_step(RustBuffer state, RustBuffer account, RustCallStatus *_Nonnull out_status+);+#endif#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_HOST_ARCH#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_HOST_ARCHRustBuffer uniffi_cua_spaces_ffi_fn_func_app_host_arch(RustCallStatus *_Nonnull out_status@@ -2801,6 +2811,18 @@ uint16_t uniffi_cua_spaces_ffi_checksum_func_app_format_hotkey(void#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_GROUP_WINDOWS_BY_APPuint16_t uniffi_cua_spaces_ffi_checksum_func_app_group_windows_by_app(void+);+#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_HOST_ACCOUNT_KEY+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_HOST_ACCOUNT_KEY+uint16_t uniffi_cua_spaces_ffi_checksum_func_app_host_account_key(void++);+#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_HOST_ACCOUNT_STEP+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_HOST_ACCOUNT_STEP+uint16_t uniffi_cua_spaces_ffi_checksum_func_app_host_account_step(void+);#endif#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_HOST_ARCH