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
Agents join Spaces faster, Check for Updates in the Mac menus, limits for Spaces other machines create, chat on This Mac's desktop (#6106)
ddupont5aa06dbfd622
diff --git a/apps/cua-spaces-desktop/src/bridge/host-setup.ts b/apps/cua-spaces-desktop/src/bridge/host-setup.tsindex 75622179c4..66e2fe969c 100644--- a/apps/cua-spaces-desktop/src/bridge/host-setup.ts+++ b/apps/cua-spaces-desktop/src/bridge/host-setup.ts@@ -1,7 +1,7 @@// SPDX-License-Identifier: FSL-1.1-MIT// Copyright (c) 2026 Cua AI, Inc.-// This machine's setup and buttons (`host.setUp`, `host.action`,+// This machine's setup and buttons (`host.setUp`, `host.action`, `host.limits`,// `host.openSettings`), over `model/host.ts` (the SwiftUI host's// WebUIBridge+Pages "This machine"). A failure is worded for people (the// title, the plain message, the raw error as details, and Retry or Sign In):@@ -82,6 +82,18 @@ export function hostSetupMethods({ model, platform, system }: BridgeContext): Haif (model.host.actionFailure) throw hostFailure(model.host.actionFailure);return hostStatus(model);},+ "host.limits": async (args) => {+ if (!model.host.host) throw unavailable();+ const count = (k: string) => {+ const v = args[k];+ if (v === undefined || v === null) return undefined;+ if (typeof v !== "number" || !Number.isInteger(v) || v < 0 || v > 1_000_000) throw Failure.badArgs(`${k}: a whole number, 0 or more`);+ return v;+ };+ await model.host.setLimits({ maxSpaces: count("maxSpaces"), maxMemoryGb: count("maxMemoryGb"), maxDiskGb: count("maxDiskGb"), maxRunMinutes: count("maxRunMinutes") });+ if (model.host.actionFailure) throw hostFailure(model.host.actionFailure);+ return hostStatus(model);+ },"host.openSettings": async (args) => {const url = settingsPaneUrl(string(args, "url"), platform);if (!system) throw Failure.unsupported("Opening settings is not available in this build");diff --git a/apps/cua-spaces-desktop/src/bridge/methods.ts b/apps/cua-spaces-desktop/src/bridge/methods.tsindex ab13ee0c8a..8262f808d8 100644--- a/apps/cua-spaces-desktop/src/bridge/methods.ts+++ b/apps/cua-spaces-desktop/src/bridge/methods.ts@@ -37,7 +37,7 @@ export const METHODS = ["telemetry.track", "telemetry.linkNotice", "telemetry.acknowledgeLinkNotice", "crashReporting.config", "spaces.usage", "spaces.windows", "stream.pip","spaces.thumbnail","spaces.chooseFiles", "spaces.droppedFiles", "spaces.sendFiles",- "host.setUp", "host.joinWithCode", "host.action", "host.openSettings",+ "host.setUp", "host.joinWithCode", "host.action", "host.limits", "host.openSettings","settings.get", "settings.choose", "settings.update","runtimes.check", "runtimes.browse","keyvault.get", "keyvault.lock", "keyvault.unlock",diff --git a/apps/cua-spaces-desktop/src/model/host.ts b/apps/cua-spaces-desktop/src/model/host.tsindex 6d8856beb3..92dee2e5ee 100644--- a/apps/cua-spaces-desktop/src/model/host.ts+++ b/apps/cua-spaces-desktop/src/model/host.ts@@ -241,6 +241,23 @@ export class HostModel {}}+ /** Changes the limits on the Spaces other machines create here (0: no limit); a missing field keeps its value. */+ async setLimits(limits: { maxSpaces?: number; maxMemoryGb?: number; maxDiskGb?: number; maxRunMinutes?: number }): Promise<void> {+ const host = this.host;+ if (!host || this.busy) return;+ this.busy = true;+ this.error = null;+ try {+ this.apply(await host.configure({ shareDesktop: undefined, provideSpaces: undefined, maxMacosVms: undefined, maxSpaces: limits.maxSpaces, maxMemoryGb: limits.maxMemoryGb, maxDiskGb: limits.maxDiskGb, maxRunMinutes: limits.maxRunMinutes }));+ this.actionFailure = null;+ } catch (error) {+ this.actionFailure = presentHostFailure(words(error), this.platform);+ await this.refresh();+ } finally {+ this.busy = false;+ }+ }+/** Runs the failed button again. */async retryFailedAction(): Promise<void> {if (this.failedAction !== null) await this.run(this.failedAction);@@ -258,7 +275,7 @@ export class HostModel {// The two settings: the core says what each switch changes.const change = this.native.appHostSettingChange(id);if (change) {- this.apply(await host.configure({ shareDesktop: change.shareDesktop, provideSpaces: change.provideSpaces, maxSpaces: undefined, maxMacosVms: undefined }));+ this.apply(await host.configure({ shareDesktop: change.shareDesktop, provideSpaces: change.provideSpaces, maxSpaces: undefined, maxMacosVms: undefined, maxMemoryGb: undefined, maxDiskGb: undefined, maxRunMinutes: undefined }));return;}switch (id) {diff --git a/apps/cua-spaces-desktop/src/native/generated/cua_sdk.ts b/apps/cua-spaces-desktop/src/native/generated/cua_sdk.tsindex d3582d211f..aebdaf6fdd 100644--- a/apps/cua-spaces-desktop/src/native/generated/cua_sdk.ts+++ b/apps/cua-spaces-desktop/src/native/generated/cua_sdk.ts@@ -11895,7 +11895,19 @@ export type HostSettingsChange = {/*** macOS VMs at once (0 to 2, Apple's license).*/- maxMacosVms?: number+ maxMacosVms?: number,+ /**+ * Memory the provided Spaces may use in total, in GB (0: no limit).+ */+ maxMemoryGb?: number,+ /**+ * Disk the provided Spaces may use in total, in GB (0: no limit).+ */+ maxDiskGb?: number,+ /**+ * How long a provided Space may run, in minutes (0: no limit).+ */+ maxRunMinutes?: number}/**@@ -11906,7 +11918,10 @@ export const HostSettingsChange = (() => {shareDesktop: undefined,provideSpaces: undefined,maxSpaces: undefined,- maxMacosVms: undefined+ maxMacosVms: undefined,+ maxMemoryGb: undefined,+ maxDiskGb: undefined,+ maxRunMinutes: undefined});const create = (() => {return uniffiCreateRecord<HostSettingsChange, ReturnType<typeof defaults>>(defaults);@@ -11926,7 +11941,10 @@ const FfiConverterTypeHostSettingsChange = (() => {shareDesktop: FfiConverterOptionalBoolean.read(from),provideSpaces: FfiConverterOptionalBoolean.read(from),maxSpaces: FfiConverterOptionalUInt32.read(from),- maxMacosVms: FfiConverterOptionalUInt32.read(from)+ maxMacosVms: FfiConverterOptionalUInt32.read(from),+ maxMemoryGb: FfiConverterOptionalUInt32.read(from),+ maxDiskGb: FfiConverterOptionalUInt32.read(from),+ maxRunMinutes: FfiConverterOptionalUInt32.read(from)};}write(value: TypeName, into: RustBuffer): void {@@ -11934,12 +11952,18 @@ const FfiConverterTypeHostSettingsChange = (() => {FfiConverterOptionalBoolean.write(value.provideSpaces, into);FfiConverterOptionalUInt32.write(value.maxSpaces, into);FfiConverterOptionalUInt32.write(value.maxMacosVms, into);+ FfiConverterOptionalUInt32.write(value.maxMemoryGb, into);+ FfiConverterOptionalUInt32.write(value.maxDiskGb, into);+ FfiConverterOptionalUInt32.write(value.maxRunMinutes, into);}allocationSize(value: TypeName): number {return FfiConverterOptionalBoolean.allocationSize(value.shareDesktop) +FfiConverterOptionalBoolean.allocationSize(value.provideSpaces) +FfiConverterOptionalUInt32.allocationSize(value.maxSpaces) +- FfiConverterOptionalUInt32.allocationSize(value.maxMacosVms);+ FfiConverterOptionalUInt32.allocationSize(value.maxMacosVms) ++ FfiConverterOptionalUInt32.allocationSize(value.maxMemoryGb) ++ FfiConverterOptionalUInt32.allocationSize(value.maxDiskGb) ++ FfiConverterOptionalUInt32.allocationSize(value.maxRunMinutes);}};@@ -12228,6 +12252,28 @@ export type HostStatus = {* macOS VMs at once (at most two).*/maxMacosVms: number,+ /**+ * Memory the provided Spaces may use in total, in GB (0: no limit).+ */+ maxMemoryGb: number,+ /**+ * Disk the provided Spaces may use in total, in GB (0: no limit).+ */+ maxDiskGb: number,+ /**+ * How long a provided Space may run, in minutes (0: no limit).+ */+ maxRunMinutes: number,+ /**+ * What the provided Spaces were given now, in GB.+ */+ usedMemoryGb: number,+ usedDiskGb: number,+ /**+ * This machine's own memory and disk, in GB (0: not known).+ */+ totalMemoryGb: number,+ totalDiskGb: number,/*** The Spaces this machine provides now.*/@@ -12275,6 +12321,13 @@ export const HostStatus = (() => {provideSpaces: false,maxSpaces: 0,maxMacosVms: 0,+ maxMemoryGb: 0,+ maxDiskGb: 0,+ maxRunMinutes: 0,+ usedMemoryGb: 0,+ usedDiskGb: 0,+ totalMemoryGb: 0,+ totalDiskGb: 0,providedSpaces: [],spacesAudit: [],spacesAuditError: undefined,@@ -12321,6 +12374,13 @@ const FfiConverterTypeHostStatus = (() => {provideSpaces: FfiConverterBool.read(from),maxSpaces: FfiConverterUInt32.read(from),maxMacosVms: FfiConverterUInt32.read(from),+ maxMemoryGb: FfiConverterUInt32.read(from),+ maxDiskGb: FfiConverterUInt32.read(from),+ maxRunMinutes: FfiConverterUInt32.read(from),+ usedMemoryGb: FfiConverterUInt32.read(from),+ usedDiskGb: FfiConverterUInt32.read(from),+ totalMemoryGb: FfiConverterUInt32.read(from),+ totalDiskGb: FfiConverterUInt32.read(from),providedSpaces: FfiConverterSequenceTypeHostProvidedSpace.read(from),spacesAudit: FfiConverterSequenceTypeHostSpacesAuditRecord.read(from),spacesAuditError: FfiConverterOptionalString.read(from),@@ -12354,6 +12414,13 @@ const FfiConverterTypeHostStatus = (() => {FfiConverterBool.write(value.provideSpaces, into);FfiConverterUInt32.write(value.maxSpaces, into);FfiConverterUInt32.write(value.maxMacosVms, into);+ FfiConverterUInt32.write(value.maxMemoryGb, into);+ FfiConverterUInt32.write(value.maxDiskGb, into);+ FfiConverterUInt32.write(value.maxRunMinutes, into);+ FfiConverterUInt32.write(value.usedMemoryGb, into);+ FfiConverterUInt32.write(value.usedDiskGb, into);+ FfiConverterUInt32.write(value.totalMemoryGb, into);+ FfiConverterUInt32.write(value.totalDiskGb, into);FfiConverterSequenceTypeHostProvidedSpace.write(value.providedSpaces, into);FfiConverterSequenceTypeHostSpacesAuditRecord.write(value.spacesAudit, into);FfiConverterOptionalString.write(value.spacesAuditError, into);@@ -12386,6 +12453,13 @@ const FfiConverterTypeHostStatus = (() => {FfiConverterBool.allocationSize(value.provideSpaces) +FfiConverterUInt32.allocationSize(value.maxSpaces) +FfiConverterUInt32.allocationSize(value.maxMacosVms) ++ FfiConverterUInt32.allocationSize(value.maxMemoryGb) ++ FfiConverterUInt32.allocationSize(value.maxDiskGb) ++ FfiConverterUInt32.allocationSize(value.maxRunMinutes) ++ FfiConverterUInt32.allocationSize(value.usedMemoryGb) ++ FfiConverterUInt32.allocationSize(value.usedDiskGb) ++ FfiConverterUInt32.allocationSize(value.totalMemoryGb) ++ FfiConverterUInt32.allocationSize(value.totalDiskGb) +FfiConverterSequenceTypeHostProvidedSpace.allocationSize(value.providedSpaces) +FfiConverterSequenceTypeHostSpacesAuditRecord.allocationSize(value.spacesAudit) +FfiConverterOptionalString.allocationSize(value.spacesAuditError) +diff --git a/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.ts b/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.tsindex 8ee01dea9c..48dda1f51f 100644--- a/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.ts+++ b/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.ts@@ -27129,6 +27129,107 @@ const FfiConverterTypeAppHostLimit = (() => {return new FFIConverter();})();+export type AppHostLimitRow = {+ /**+ * `max-spaces`, `max-memory`, `max-disk` or `max-run`.+ */+ id: string,+ /**+ * "Most Spaces at once".+ */+ label: string,+ /**+ * One line under it.+ */+ help: string,+ /**+ * The limit (0: no limit).+ */+ value: number,+ /**+ * What the number counts: `Spaces`, `GB` or `minutes`.+ */+ unit: string,+ /**+ * What is in use now ("2 of 4 Spaces", "12 of 32 GB"; "2 Spaces" with+ * no limit); none for a limit that is about time.+ */+ useText?: string,+ /**+ * This machine's own total in `unit` (memory and disk), 0 when not+ * known.+ */+ total: number,+ /**+ * Use is above the limit (it was lowered below what runs): nothing+ * is stopped, new Spaces are refused.+ */+ over: boolean,+ /**+ * "Over limit" while `over`.+ */+ overText?: string+}++/**+ * Generated factory for {@link AppHostLimitRow} record objects.+ */+export const AppHostLimitRow = (() => {+ const defaults = () => ({+ });+ const create = (() => {+ return uniffiCreateRecord<AppHostLimitRow, ReturnType<typeof defaults>>(defaults);+ })();+ return Object.freeze({+ create,+ new: create,+ defaults: () => Object.freeze(defaults()) as Partial<AppHostLimitRow>,+ });+})();++const FfiConverterTypeAppHostLimitRow = (() => {+ type TypeName = AppHostLimitRow;+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {+ read(from: RustBuffer): TypeName {+ return {+ id: FfiConverterString.read(from),+ label: FfiConverterString.read(from),+ help: FfiConverterString.read(from),+ value: FfiConverterUInt32.read(from),+ unit: FfiConverterString.read(from),+ useText: FfiConverterOptionalString.read(from),+ total: FfiConverterUInt32.read(from),+ over: FfiConverterBool.read(from),+ overText: FfiConverterOptionalString.read(from)+ };+ }+ write(value: TypeName, into: RustBuffer): void {+ FfiConverterString.write(value.id, into);+ FfiConverterString.write(value.label, into);+ FfiConverterString.write(value.help, into);+ FfiConverterUInt32.write(value.value, into);+ FfiConverterString.write(value.unit, into);+ FfiConverterOptionalString.write(value.useText, into);+ FfiConverterUInt32.write(value.total, into);+ FfiConverterBool.write(value.over, into);+ FfiConverterOptionalString.write(value.overText, into);+ }+ allocationSize(value: TypeName): number {+ return FfiConverterString.allocationSize(value.id) ++ FfiConverterString.allocationSize(value.label) ++ FfiConverterString.allocationSize(value.help) ++ FfiConverterUInt32.allocationSize(value.value) ++ FfiConverterString.allocationSize(value.unit) ++ FfiConverterOptionalString.allocationSize(value.useText) ++ FfiConverterUInt32.allocationSize(value.total) ++ FfiConverterBool.allocationSize(value.over) ++ FfiConverterOptionalString.allocationSize(value.overText);++ }+ };+ return new FFIConverter();+})();+export type AppHostLoad = {/*** CPU it offers, in thousandths.@@ -27485,6 +27586,11 @@ export type AppHostPanelView = {* providing Spaces.*/limits?: string,+ /**+ * The limits as number rows (Settings, Sharing), while providing+ * Spaces: most Spaces, memory and disk in total, longest running time.+ */+ limitRows: Array<AppHostLimitRow>,/*** "Spaces for your devices", while providing Spaces.*/@@ -27582,6 +27688,7 @@ const FfiConverterTypeAppHostPanelView = (() => {accessWarning: FfiConverterOptionalString.read(from),toggles: FfiConverterSequenceTypeAppHostToggle.read(from),limits: FfiConverterOptionalString.read(from),+ limitRows: FfiConverterSequenceTypeAppHostLimitRow.read(from),providedTitle: FfiConverterOptionalString.read(from),provided: FfiConverterSequenceTypeAppHostAccessRow.read(from),providedEmpty: FfiConverterOptionalString.read(from),@@ -27616,6 +27723,7 @@ const FfiConverterTypeAppHostPanelView = (() => {FfiConverterOptionalString.write(value.accessWarning, into);FfiConverterSequenceTypeAppHostToggle.write(value.toggles, into);FfiConverterOptionalString.write(value.limits, into);+ FfiConverterSequenceTypeAppHostLimitRow.write(value.limitRows, into);FfiConverterOptionalString.write(value.providedTitle, into);FfiConverterSequenceTypeAppHostAccessRow.write(value.provided, into);FfiConverterOptionalString.write(value.providedEmpty, into);@@ -27649,6 +27757,7 @@ const FfiConverterTypeAppHostPanelView = (() => {FfiConverterOptionalString.allocationSize(value.accessWarning) +FfiConverterSequenceTypeAppHostToggle.allocationSize(value.toggles) +FfiConverterOptionalString.allocationSize(value.limits) ++ FfiConverterSequenceTypeAppHostLimitRow.allocationSize(value.limitRows) +FfiConverterOptionalString.allocationSize(value.providedTitle) +FfiConverterSequenceTypeAppHostAccessRow.allocationSize(value.provided) +FfiConverterOptionalString.allocationSize(value.providedEmpty) +@@ -28026,6 +28135,31 @@ export type AppHostState = {* macOS VMs at once (at most two; 0 off a Mac).*/maxMacosVms: number,+ /**+ * Memory the Spaces other machines create here may use in total, in GB+ * (0: no limit).+ */+ maxMemoryGb: number,+ /**+ * Disk the Spaces other machines create here may use in total, in GB+ * (0: no limit).+ */+ maxDiskGb: number,+ /**+ * How long a Space created here by another machine may run, in minutes+ * (0: no limit).+ */+ maxRunMinutes: number,+ /**+ * What those Spaces were given now, in GB.+ */+ usedMemoryGb: number,+ usedDiskGb: number,+ /**+ * This machine's own memory and disk in GB (0: not known).+ */+ totalMemoryGb: number,+ totalDiskGb: number,/*** The Spaces this machine provides now.*/@@ -28099,6 +28233,13 @@ const FfiConverterTypeAppHostState = (() => {provideSpaces: FfiConverterBool.read(from),maxSpaces: FfiConverterUInt32.read(from),maxMacosVms: FfiConverterUInt32.read(from),+ maxMemoryGb: FfiConverterUInt32.read(from),+ maxDiskGb: FfiConverterUInt32.read(from),+ maxRunMinutes: FfiConverterUInt32.read(from),+ usedMemoryGb: FfiConverterUInt32.read(from),+ usedDiskGb: FfiConverterUInt32.read(from),+ totalMemoryGb: FfiConverterUInt32.read(from),+ totalDiskGb: FfiConverterUInt32.read(from),providedSpaces: FfiConverterSequenceTypeAppHostProvidedSpace.read(from),spacesAudit: FfiConverterSequenceTypeAppHostSpacesAudit.read(from),spacesAuditError: FfiConverterOptionalString.read(from),@@ -28128,6 +28269,13 @@ const FfiConverterTypeAppHostState = (() => {FfiConverterBool.write(value.provideSpaces, into);FfiConverterUInt32.write(value.maxSpaces, into);FfiConverterUInt32.write(value.maxMacosVms, into);+ FfiConverterUInt32.write(value.maxMemoryGb, into);+ FfiConverterUInt32.write(value.maxDiskGb, into);+ FfiConverterUInt32.write(value.maxRunMinutes, into);+ FfiConverterUInt32.write(value.usedMemoryGb, into);+ FfiConverterUInt32.write(value.usedDiskGb, into);+ FfiConverterUInt32.write(value.totalMemoryGb, into);+ FfiConverterUInt32.write(value.totalDiskGb, into);FfiConverterSequenceTypeAppHostProvidedSpace.write(value.providedSpaces, into);FfiConverterSequenceTypeAppHostSpacesAudit.write(value.spacesAudit, into);FfiConverterOptionalString.write(value.spacesAuditError, into);@@ -28156,6 +28304,13 @@ const FfiConverterTypeAppHostState = (() => {FfiConverterBool.allocationSize(value.provideSpaces) +FfiConverterUInt32.allocationSize(value.maxSpaces) +FfiConverterUInt32.allocationSize(value.maxMacosVms) ++ FfiConverterUInt32.allocationSize(value.maxMemoryGb) ++ FfiConverterUInt32.allocationSize(value.maxDiskGb) ++ FfiConverterUInt32.allocationSize(value.maxRunMinutes) ++ FfiConverterUInt32.allocationSize(value.usedMemoryGb) ++ FfiConverterUInt32.allocationSize(value.usedDiskGb) ++ FfiConverterUInt32.allocationSize(value.totalMemoryGb) ++ FfiConverterUInt32.allocationSize(value.totalDiskGb) +FfiConverterSequenceTypeAppHostProvidedSpace.allocationSize(value.providedSpaces) +FfiConverterSequenceTypeAppHostSpacesAudit.allocationSize(value.spacesAudit) +FfiConverterOptionalString.allocationSize(value.spacesAuditError) +@@ -69828,6 +69983,9 @@ const FfiConverterSequenceTypeAppHostAccessRow = new FfiConverterArray(FfiConver// FfiConverter for Array<AppHostToggle>const FfiConverterSequenceTypeAppHostToggle = new FfiConverterArray(FfiConverterTypeAppHostToggle);+// FfiConverter for Array<AppHostLimitRow>+const FfiConverterSequenceTypeAppHostLimitRow = new FfiConverterArray(FfiConverterTypeAppHostLimitRow);+// FfiConverter for Array<AppPermissionRow>const FfiConverterSequenceTypeAppPermissionRow = new FfiConverterArray(FfiConverterTypeAppPermissionRow);@@ -71870,6 +72028,7 @@ export default Object.freeze({FfiConverterTypeAppHostFormState,FfiConverterTypeAppHostFormView,FfiConverterTypeAppHostLimit,+ FfiConverterTypeAppHostLimitRow,FfiConverterTypeAppHostLoad,FfiConverterTypeAppHostPanelView,FfiConverterTypeAppHostPermissionInput,diff --git a/apps/cua-spaces-desktop/test/fixtures.ts b/apps/cua-spaces-desktop/test/fixtures.tsindex 1e731c6993..427ba2b8a7 100644--- a/apps/cua-spaces-desktop/test/fixtures.ts+++ b/apps/cua-spaces-desktop/test/fixtures.ts@@ -382,6 +382,13 @@ export function unconfiguredHost(): HostStatus {provideSpaces: false,maxSpaces: 4,maxMacosVms: 2,+ maxMemoryGb: 0,+ maxDiskGb: 0,+ maxRunMinutes: 0,+ usedMemoryGb: 0,+ usedDiskGb: 0,+ totalMemoryGb: 0,+ totalDiskGb: 0,providedSpaces: [],spacesAudit: [],spacesAuditError: undefined,diff --git a/apps/cua-spaces-macos/README.md b/apps/cua-spaces-macos/README.mdindex 4ce8366ce7..786e098051 100644--- a/apps/cua-spaces-macos/README.md+++ b/apps/cua-spaces-macos/README.md@@ -531,8 +531,11 @@ reads the state with `update.get` (`{status, currentVersion, version,percent, notesUrl, message}`; status is `idle`, `checking`, `available`,`downloading`, `downloaded` or `error`) and refetches on the `update.changed`event. Check Now (Settings, About) is quiet too: nothing found ends silently,-and only an error from a check the user started shows a small "Update Error!"-alert; background errors are logged. Usage telemetry records `found`,+an error is logged and kept in the state (a plain line in the menus; no dialog).+"Check for Updates…" is in the app menu and the menu bar menu too; both menus,+the menu bar icon's up-arrow badge and Settings read the one `UpdatesModel`+(`UpdateMenuItem`): a found update reads "Version X available" with "Click to+install" or "Restart to update" under it. Usage telemetry records `found`,`not_found`, `downloaded`, `installed` and `failed`.Channels: an `X.Y.Z-suffix` release is a `beta` item, which only apps set todiff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMac/main.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMac/main.swiftindex a519161031..d16ecd9614 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMac/main.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMac/main.swift@@ -67,6 +67,10 @@ if launchArgs.first == "preflight-permissions" {// `CUA_ENV=staging`: this process and the daemon use the staging home (a// Local build already settled its three variables above).TargetEnvironment.pin()+// Where the browser's sign-in page says to go back to (the SDK reads it). Set+// here, once, before any other thread runs: changing the environment later+// races the threads that read it (CUA-2705).+setenv("CUA_AUTH_RETURN_TO", "Cua Spaces", 0)// Teleport, the Cua Volume, persistent agents and the Keyvault for every// runtime the SDK builds in this process (the Cua Spaces extensions).diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppServices.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppServices.swiftindex 8ed419c9ae..34c8caa96c 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppServices.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppServices.swift@@ -434,8 +434,9 @@ public final class LiveAccount: AccountRunning, @unchecked Sendable {public func beginSignIn() async throws -> SignInAttempt { try await beginSignIn(code: false) }public func beginSignIn(code: Bool) async throws -> SignInAttempt {- // The browser's sign-in page says where to go back to (the SDK reads it).- setenv("CUA_AUTH_RETURN_TO", "Cua Spaces", 0)+ // The browser's sign-in page says where to go back to: the SDK reads+ // CUA_AUTH_RETURN_TO, which `TargetEnvironment.pin()` sets once at launch+ // (changing the environment from here races other threads reading it).var attempt = try await auth.beginLogin(flow: code ? "device" : nil)var opened = await Self.open(attempt.url())// No browser opened: the loopback redirect would never come back,diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/HostModel.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/HostModel.swiftindex 20cfa86250..9b4ea0af53 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/HostModel.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/HostModel.swift@@ -106,6 +106,10 @@ public final class FixtureHost: HostRunning, @unchecked Sendable {}if let d = change.shareDesktop { current.shareDesktop = d }if let p = change.provideSpaces { current.provideSpaces = p }+ if let n = change.maxSpaces { current.maxSpaces = n }+ if let n = change.maxMemoryGb { current.maxMemoryGb = n }+ if let n = change.maxDiskGb { current.maxDiskGb = n }+ if let n = change.maxRunMinutes { current.maxRunMinutes = n }// Both off: nothing to share, so sharing stops (as the host does).if !current.shareDesktop && !current.provideSpaces {current.sharing = false@@ -637,6 +641,24 @@ public final class HostModel {}}+ /// Changes the limits on the Spaces other machines create here (0 is no+ /// limit; nil keeps a value). A failure stays in `actionFailure`.+ public func setLimits(maxSpaces: UInt32?, maxMemoryGb: UInt32?, maxDiskGb: UInt32?, maxRunMinutes: UInt32?) async {+ guard let host, !busy else { return }+ busy = true+ error = nil+ defer { busy = false }+ do {+ apply(try await host.configure(change: HostSettingsChange(+ shareDesktop: nil, provideSpaces: nil, maxSpaces: maxSpaces, maxMacosVms: nil,+ maxMemoryGb: maxMemoryGb, maxDiskGb: maxDiskGb, maxRunMinutes: maxRunMinutes)))+ actionFailure = nil+ } catch {+ actionFailure = HostSetupFailure.presenting(LiveSpacesBackend.words(error))+ await refresh()+ }+ }+/// Resume sharing must sign in first: relay sharing paused while/// signed out, or relay mode with nobody signed in.private var needsSignInToShare: Bool {diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/LocalNetworkPermission.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/LocalNetworkPermission.swiftindex ff28b241f8..3be955e9b4 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/LocalNetworkPermission.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/LocalNetworkPermission.swift@@ -236,7 +236,9 @@ public enum LiveLocalNetworkPermission {for cursor in sequence(first: first, next: { $0.pointee.ifa_next }) {let ifa = cursor.pointeelet flags = Int32(ifa.ifa_flags)- let name = String(cString: ifa.ifa_name)+ // An interface with no name cannot be one of ours: skip it.+ guard let cname = ifa.ifa_name else { continue }+ let name = String(cString: cname)guard flags & IFF_UP != 0, flags & IFF_RUNNING != 0, flags & IFF_LOOPBACK == 0,!isTunnelOrBridge(name),let addr = ifa.ifa_addr, addr.pointee.sa_family == sa_family_t(AF_INET),diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/UpdateDriver.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/UpdateDriver.swiftindex e7fe886114..2bc799ddf1 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/UpdateDriver.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/UpdateDriver.swift@@ -153,9 +153,6 @@ public final class UpdateUserDriver: NSObject, SPUUserDriver {public var onChange: (() -> Void)?/// `downloaded` when the update is ready to install.public var onEvent: ((String) -> Void)?- /// Shows an error to the person who started the check.- var presentError: (String) -> Void = UpdateUserDriver.alertError-/// Sparkle's held "ready to install" reply.private var heldReply: ((SPUUserUpdateChoice) -> Void)?/// The silent path's immediate install (`willInstallUpdateOnQuit`).@@ -263,12 +260,11 @@ public final class UpdateUserDriver: NSObject, SPUUserDriver {acknowledgement()}- /// A background error is logged only; the check's user sees an alert.+ /// An error is logged and kept in the state: the menus and Settings show+ /// a plain line for it (no dialog, so nothing loops).func handleError(_ message: String) {- let shown = flow.userCheckNSLog("Cua Spaces: the updater failed: %@", message)changed { $0.failed(message) }- if shown { presentError(message) }}public func showDownloadInitiated(cancellation: @escaping () -> Void) { changed { $0.downloadStarted() } }@@ -303,13 +299,4 @@ public final class UpdateUserDriver: NSObject, SPUUserDriver {told = falsechanged { $0.dismissed() }}-- private static func alertError(_ message: String) {- let alert = NSAlert()- alert.messageText = "Update Error!"- alert.informativeText = message- alert.addButton(withTitle: "OK")- NSApp.activate()- alert.runModal()- }}diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/UpdateMenu.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/UpdateMenu.swiftnew file mode 100644index 0000000000..04426c5c97--- /dev/null+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/UpdateMenu.swift@@ -0,0 +1,62 @@+// SPDX-License-Identifier: FSL-1.1-MIT+// Copyright (c) 2026 Cua AI, Inc.++import Foundation++/// The update entry of the app menu and the menu bar menu, and whether the+/// menu bar icon carries the up-arrow badge. One value from the one model+/// (`UpdatesModel.menuItem`), so both menus and Settings agree.+public struct UpdateMenuItem: Equatable, Sendable {+ public enum Action: Equatable, Sendable {+ /// Check for updates now.+ case check+ /// Install the found update: restart into it, or as soon as it is downloaded.+ case install+ /// Nothing to do (a check or a download is running).+ case none+ }++ /// The item's first line.+ public var title: String+ /// The second line, when there is one.+ public var detail: String?+ public var action: Action+ /// The menu bar icon's up-arrow: an update was found and is not installed.+ public var badge: Bool++ public var enabled: Bool { action != .none }++ /// The entry in `Localizable.xcstrings`; the English here is what a build+ /// that did not compile the catalog (`swift test`) shows.+ private static func text(_ code: String, _ english: String, vars: [String: String] = [:]) -> String {+ var out = (ModuleResources.bundle ?? .main).localizedString(forKey: code, value: english, table: nil)+ for (name, value) in vars { out = out.replacingOccurrences(of: "{\(name)}", with: value) }+ return out+ }++ public static func make(_ state: UpdateState) -> UpdateMenuItem {+ let check = Self.text("menu.update.check", "Check for Updates\u{2026}")+ let found = state.version.map { Self.text("menu.update.available", "Version {version} available", vars: ["version": $0]) } ?? check+ switch state.status {+ case .idle:+ return UpdateMenuItem(title: check, action: .check, badge: false)+ case .checking:+ return UpdateMenuItem(title: Self.text("menu.update.checking", "Checking for Updates\u{2026}"), action: .none, badge: false)+ case .available:+ return UpdateMenuItem(title: found, detail: Self.text("menu.update.click_to_install", "Click to install"),+ action: .install, badge: true)+ case .downloading:+ return UpdateMenuItem(+ title: found,+ detail: Self.text("menu.update.downloading", "Downloading {percent}%", vars: ["percent": String(state.percent ?? 0)]),+ action: .none, badge: true)+ case .downloaded:+ return UpdateMenuItem(title: found, detail: Self.text("menu.update.restart", "Restart to update"),+ action: .install, badge: true)+ case .error:+ // A failed check is a plain line; the item still checks again.+ return UpdateMenuItem(title: check, detail: Self.text("menu.update.failed", "Could not check for updates"),+ action: .check, badge: false)+ }+ }+}diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/UpdatesModel.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/UpdatesModel.swiftindex 0ba87f16ee..081cec4c49 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/UpdatesModel.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/UpdatesModel.swift@@ -399,7 +399,10 @@ public final class UpdatesModel {self.info = infoself.channel = channelupdater?.channels = appAboutAllowedChannels(channel: channel)- updater?.onChange = { [weak self] in self?.revision += 1 }+ updater?.onChange = { [weak self] in+ self?.revision += 1+ self?.installWhenReady()+ }// Do people update: what each check found, and installs (the Tauri// app records the same words).updater?.onUpdateEvent = { [weak self] event in self?.record(event) }@@ -443,6 +446,36 @@ public final class UpdatesModel {/// "Restart to update": installs the downloaded update and restarts.public func installUpdate() { updater?.installNow() }+ /// The update entry of both menus and the menu bar badge, from the one state.+ /// Nil in a build with no updater (a development build).+ public var menuItem: UpdateMenuItem? {+ updater == nil ? nil : UpdateMenuItem.make(updateState)+ }++ /// An install asked for before the download finished.+ private var installQueued = false++ /// What a click on the menu entry does: check, or install (now when the+ /// update is downloaded, else as soon as it is).+ public func perform(_ action: UpdateMenuItem.Action) {+ switch action {+ case .check: checkNow()+ case .install:+ if updateState.status == .downloaded { installUpdate() } else { installQueued = true }+ case .none: break+ }+ }++ private func installWhenReady() {+ switch updater?.state.status {+ case .downloaded where installQueued:+ installQueued = false+ updater?.installNow()+ case .idle, .error: installQueued = false+ default: break+ }+ }+static func dateText(_ date: Date) -> String {date.formatted(date: .abbreviated, time: .shortened)}diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Resources/Localizable.xcstrings b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Resources/Localizable.xcstringsindex aa856db1fe..79775eea2d 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Resources/Localizable.xcstrings+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Resources/Localizable.xcstrings@@ -363,6 +363,83 @@}}}+ },+ "menu.update.check": {+ "extractionState": "manual",+ "localizations": {+ "en": {+ "stringUnit": {+ "state": "translated",+ "value": "Check for Updates…"+ }+ }+ }+ },+ "menu.update.checking": {+ "extractionState": "manual",+ "localizations": {+ "en": {+ "stringUnit": {+ "state": "translated",+ "value": "Checking for Updates…"+ }+ }+ }+ },+ "menu.update.available": {+ "extractionState": "manual",+ "localizations": {+ "en": {+ "stringUnit": {+ "state": "translated",+ "value": "Version {version} available"+ }+ }+ }+ },+ "menu.update.click_to_install": {+ "extractionState": "manual",+ "localizations": {+ "en": {+ "stringUnit": {+ "state": "translated",+ "value": "Click to install"+ }+ }+ }+ },+ "menu.update.downloading": {+ "extractionState": "manual",+ "localizations": {+ "en": {+ "stringUnit": {+ "state": "translated",+ "value": "Downloading {percent}%"+ }+ }+ }+ },+ "menu.update.restart": {+ "extractionState": "manual",+ "localizations": {+ "en": {+ "stringUnit": {+ "state": "translated",+ "value": "Restart to update"+ }+ }+ }+ },+ "menu.update.failed": {+ "extractionState": "manual",+ "localizations": {+ "en": {+ "stringUnit": {+ "state": "translated",+ "value": "Could not check for updates"+ }+ }+ }}},"version": "1.0"diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/CuaSpacesMacApp.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/CuaSpacesMacApp.swiftindex 88438daaae..769a1932ae 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/CuaSpacesMacApp.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/CuaSpacesMacApp.swift@@ -48,6 +48,11 @@ public struct CuaSpacesMacApp: App {Button(model.chrome.newSpaceLabel) { Task { await model.openNewSpace() } }.keyboardShortcut("n")}+ // "Check for Updates…" under About (the macOS convention); the same+ // entry as the menu bar menu's, from the one `UpdatesModel`.+ CommandGroup(after: .appInfo) {+ UpdateMenuButton(updates: model.updates)+ }// The app menu's "Settings…" (⌘,): the page's Settings, the one// Settings there is (no `Settings` scene).CommandGroup(replacing: .appSettings) {@@ -82,7 +87,7 @@ struct MenuBarLabel: View {var body: some View {Group {- if let icon = MenuBarIcon.image {+ if let icon = MenuBarIcon.image(badged: model.updates.menuItem?.badge ?? false) {Image(nsImage: icon)} else {Text("Cua")@@ -143,7 +148,15 @@ struct MenuBarContent: View {}Divider()}- ForEach(Array(model.menuBar.enumerated()), id: \.offset) { _, item in+ let items = Array(model.menuBar.enumerated())+ // The update entry goes last before Quit's separator.+ let updateAt = items.firstIndex { $0.element.id == .quit }.map {+ $0 > 0 && items[$0 - 1].element.id == .separator ? $0 - 1 : $0+ }+ ForEach(items, id: \.offset) { index, item in+ if index == updateAt {+ UpdateMenuButton(updates: model.updates)+ }switch item.id {case .status: Text(item.label)case .separator: Divider()@@ -178,6 +191,23 @@ struct MenuBarContent: View {}}+/// "Check for Updates…", or the found update ("Version X available" over+/// "Click to install" or "Restart to update"): the entry of the app menu and+/// the menu bar menu. Nothing in a build with no updater.+struct UpdateMenuButton: View {+ let updates: UpdatesModel++ var body: some View {+ if let item = updates.menuItem {+ // A menu item has one line: the second line is the grey line+ // under it (as the Spaces status line above is).+ Button(item.title) { updates.perform(item.action) }+ .disabled(!item.enabled)+ if let detail = item.detail { Text(detail) }+ }+ }+}+/// The Cua key at menu item size, for the low-disk warning.enum MenuBarKey {static let image: NSImage? = {@@ -190,13 +220,46 @@ enum MenuBarKey {/// The Cua mark as a template image (from apps/cua-spaces/src-tauri/icons,/// copied into the bundle by scripts/build-app.sh).enum MenuBarIcon {- static let image: NSImage? = {+ static let plain: NSImage? = {guard let url = Bundle.main.url(forResource: "tray-template", withExtension: "png"),let image = NSImage(contentsOf: url) else { return nil }image.isTemplate = trueimage.size = NSSize(width: 18, height: 18)return image}()++ /// The icon with a small up-arrow in its lower right corner (an update+ /// was found), still a template so the menu bar tints it.+ static let badged: NSImage? = plain.map(badge(_:))++ static func image(badged on: Bool) -> NSImage? { on ? badged : plain }++ static func badge(_ icon: NSImage) -> NSImage {+ let size = icon.size+ let image = NSImage(size: size, flipped: false) { rect in+ icon.draw(in: rect)+ // Cut a clear disc out of the mark, then draw the arrow in it.+ let disc = NSRect(x: size.width - 9.5, y: 0, width: 9.5, height: 9.5)+ NSGraphicsContext.current?.compositingOperation = .clear+ NSBezierPath(ovalIn: disc.insetBy(dx: -1, dy: -1)).fill()+ NSGraphicsContext.current?.compositingOperation = .sourceOver+ NSColor.black.setFill()+ let c = NSPoint(x: disc.midX, y: disc.midY)+ let arrow = NSBezierPath()+ arrow.move(to: NSPoint(x: c.x, y: c.y + 3.6))+ arrow.line(to: NSPoint(x: c.x + 3.4, y: c.y - 0.2))+ arrow.line(to: NSPoint(x: c.x + 1.2, y: c.y - 0.2))+ arrow.line(to: NSPoint(x: c.x + 1.2, y: c.y - 3.6))+ arrow.line(to: NSPoint(x: c.x - 1.2, y: c.y - 3.6))+ arrow.line(to: NSPoint(x: c.x - 1.2, y: c.y - 0.2))+ arrow.line(to: NSPoint(x: c.x - 3.4, y: c.y - 0.2))+ arrow.close()+ arrow.fill()+ return true+ }+ image.isTemplate = true+ return image+ }}/// Starts the notch and wires it to the model.diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge+Pages.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge+Pages.swiftindex d7685df97c..42fc50fc88 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge+Pages.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge+Pages.swift@@ -334,6 +334,19 @@ extension WebUIBridge {await model.host.run(id)if let failure = model.host.actionFailure { throw Self.hostFailure(failure) }return hostStatus()+ case "host.limits":+ guard model.host.host != nil else { throw Failure.unsupported("This Mac can't be set up for access in this build") }+ func count(_ key: String) throws -> UInt32? {+ guard let v = args[key], !(v is NSNull) else { return nil }+ guard let n = (v as? NSNumber)?.doubleValue, n >= 0, n <= 1_000_000, n == n.rounded() else {+ throw Failure.badArgs("\(key): a whole number, 0 or more")+ }+ return UInt32(n)+ }+ await model.host.setLimits(maxSpaces: try count("maxSpaces"), maxMemoryGb: try count("maxMemoryGb"),+ maxDiskGb: try count("maxDiskGb"), maxRunMinutes: try count("maxRunMinutes"))+ if let failure = model.host.actionFailure { throw Self.hostFailure(failure) }+ return hostStatus()case "host.openSettings":let url = try string(args, "url")guard url.hasPrefix("x-apple.systempreferences:"), let u = URL(string: url) else {diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swiftindex 9f91a2517c..56722979c1 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swift@@ -102,7 +102,7 @@ final class WebUIBridge: NSObject, WKScriptMessageHandlerWithReply {"spaces.thumbnail",// A Space's drop well: Send file… and dropped files (WebUIBridge+Files.swift)."spaces.chooseFiles", "spaces.droppedFiles", "spaces.sendFiles",- "host.setUp", "host.joinWithCode", "host.action", "host.openSettings",+ "host.setUp", "host.joinWithCode", "host.action", "host.limits", "host.openSettings","settings.get", "settings.choose", "settings.update",// Settings, Advanced's runtime rows (WebUIBridge+Runtimes.swift)."runtimes.check", "runtimes.browse",diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/BridgeContractTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/BridgeContractTests.swiftindex 7994b41711..b4fea65950 100644--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/BridgeContractTests.swift+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/BridgeContractTests.swift@@ -303,7 +303,7 @@ struct BridgeContractTests {"spaces.deleteMany": "removes fixture Spaces the later cases use; BulkDeleteTests covers it","spaces.leave": "changes the fixture list the later cases use; BulkDeleteTests covers it","spaces.add": "needs a running cua-spacesd at the address",- "host.setUp": "installs the host service", "host.action": "changes the host service",+ "host.setUp": "installs the host service", "host.action": "changes the host service", "host.limits": "changes the host settings (HostBridgeTests covers hostLimitsChangeThroughTheHostModel)","host.openSettings": "opens System Settings","host.joinWithCode": "runs the bundled cua; JoinWithCodeTests covers the arguments and bad args","agents.events": "needs the daemon's agent_events; WebUIHostTests checks it is unsupported without it",diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/UpdatesTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/UpdatesTests.swiftindex 70e19ebb5b..0f76f5c9c1 100644--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/UpdatesTests.swift+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/UpdatesTests.swift@@ -4,6 +4,7 @@import CuaSDKimport CuaSpacesFFI@testable import CuaSpacesMacKit+import AppKitimport Foundationimport Sparkleimport Testing@@ -221,26 +222,23 @@ struct UpdatesTests {@Test func nothingFoundAndBackgroundErrorsStayQuiet() {let driver = UpdateUserDriver(currentVersion: "0.9.2")- var alerts: [String] = []- driver.presentError = { alerts.append($0) }var acks = 0driver.showUpdateNotFoundWithError(NSError(domain: "t", code: 1)) { acks += 1 }#expect(acks == 1 && driver.state.status == .idle)driver.showUpdaterError(NSError(domain: "t", code: 2, userInfo: [NSLocalizedDescriptionKey: "offline"])) { acks += 1 }- #expect(acks == 2 && alerts.isEmpty)+ #expect(acks == 2)#expect(driver.state.status == .error && driver.state.message == "offline")driver.dismissUpdateInstallation()#expect(driver.state.status == .error)}- @Test func aUserCheckErrorShowsAnAlert() {+ /// A failed check is a plain line in the menus and Settings, never a dialog.+ @Test func aUserCheckErrorStaysInTheState() {let driver = UpdateUserDriver(currentVersion: "0.9.2")- var alerts: [String] = []- driver.presentError = { alerts.append($0) }driver.beginUserCheck()#expect(driver.state.status == .checking)driver.showUpdaterError(NSError(domain: "t", code: 2, userInfo: [NSLocalizedDescriptionKey: "offline"])) {}- #expect(alerts == ["offline"])+ #expect(driver.state.status == .error && driver.state.message == "offline")}@Test func aUserCheckThatFindsNothingEndsQuietly() {@@ -417,3 +415,105 @@ struct LaunchedBundleTests {#expect(launched.replacement() == LaunchedBundle.Replacement(version: nil))}}++/// "Check for Updates…" in the app menu and the menu bar menu, and the+/// up-arrow badge: all from the one `UpdatesModel`.+@Suite("Update menu")+@MainActor+struct UpdateMenuTests {+ static let info = AboutBundleInfo(version: "0.2.0-staging.5", build: "0.2.0.105", os: "macOS 26.0 (arm64)")++ func made() -> (UpdatesModel, FixtureUpdater) {+ let updater = FixtureUpdater()+ updater.state = .idle(currentVersion: Self.info.version)+ return (UpdatesModel(updater: updater, channel: .stable, info: Self.info), updater)+ }++ @Test func upToDateOffersACheckAndNoBadge() throws {+ let (model, _) = made()+ let item = try #require(model.menuItem)+ #expect(item.title == "Check for Updates\u{2026}" && item.detail == nil)+ #expect(item.action == .check && item.enabled && !item.badge)+ #expect(!item.title.contains("\u{00B7}"))+ }++ @Test func aFoundUpdateShowsTheBadgeAndTheVersionLine() throws {+ let (model, updater) = made()+ updater.simulateFound(version: "0.17.0-beta.11")+ var item = try #require(model.menuItem)+ #expect(item.title == "Version 0.17.0-beta.11 available" && item.detail == "Click to install")+ #expect(item.badge && item.action == .install)+ updater.simulateProgress(percent: 40)+ item = try #require(model.menuItem)+ #expect(item.detail == "Downloading 40%" && item.badge && !item.enabled)+ updater.simulateDownloaded()+ item = try #require(model.menuItem)+ #expect(item.title == "Version 0.17.0-beta.11 available" && item.detail == "Restart to update")+ #expect(item.badge && item.action == .install)+ }++ @Test func installingClearsTheBadge() throws {+ let (model, updater) = made()+ updater.simulateFound(version: "1.0.0")+ updater.simulateDownloaded()+ model.perform(try #require(model.menuItem).action)+ #expect(updater.installs == 1)+ let item = try #require(model.menuItem)+ #expect(!item.badge && item.title == "Check for Updates\u{2026}")+ }++ @Test func aClickBeforeTheDownloadEndsInstallsWhenItEnds() throws {+ let (model, updater) = made()+ updater.simulateFound(version: "1.0.0")+ model.perform(.install)+ #expect(updater.installs == 0)+ updater.simulateDownloaded()+ #expect(updater.installs == 1)+ }++ @Test func aFailedCheckIsAPlainLineWithNoBadge() throws {+ let (model, updater) = made()+ updater.simulateError("offline")+ let item = try #require(model.menuItem)+ #expect(item.title == "Check for Updates\u{2026}" && item.detail == "Could not check for updates")+ #expect(!item.badge && item.action == .check)+ }++ @Test func aCheckInProgressIsNotClickable() throws {+ let (model, updater) = made()+ updater.state = UpdateState(status: .checking, currentVersion: Self.info.version)+ let item = try #require(model.menuItem)+ #expect(item.title == "Checking for Updates\u{2026}" && !item.enabled && !item.badge)+ }++ @Test func theMenuCheckIsTheSettingsCheck() throws {+ let (model, updater) = made()+ model.perform(try #require(model.menuItem).action)+ #expect(updater.checks == 1)+ model.checkNow()+ #expect(updater.checks == 2)+ }++ @Test func noUpdaterNoMenuItem() {+ #expect(UpdatesModel(updater: nil, info: Self.info).menuItem == nil)+ }++ /// Both menus and Settings read the AppModel's one `UpdatesModel`: the+ /// state the menus show is the page's `update.get`.+ @Test func bothMenusAndSettingsShareTheOneModel() throws {+ let (model, updater) = made()+ updater.simulateFound(version: "1.2.3")+ updater.simulateDownloaded()+ let menuBar = UpdateMenuButton(updates: model)+ let appMenu = UpdateMenuButton(updates: model)+ #expect(menuBar.updates === appMenu.updates)+ #expect(menuBar.updates.menuItem == appMenu.updates.menuItem)+ #expect(model.updateState.status == .downloaded && model.updateState.version == "1.2.3")+ #expect(model.menuItem?.badge == true)+ }++ @Test func theBadgedIconStaysATemplate() throws {+ let base = NSImage(size: NSSize(width: 18, height: 18), flipped: false) { _ in true }+ #expect(MenuBarIcon.badge(base).isTemplate)+ }+}diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/WebUIHostTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/WebUIHostTests.swiftindex 90d75c37d1..8a8a445193 100644--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/WebUIHostTests.swift+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/WebUIHostTests.swift@@ -441,7 +441,7 @@ struct WebUIHostTests {for m in ["spaces.add", "clouds.status", "teleport.catalog", "teleport.run", "sharing.share", "volume.overview","agents.setupDriver", "about.set", "update.get", "update.install", "loginItem.set", "devices.approve", "storage.run","notifications.list", "telemetry.track", "telemetry.linkNotice", "telemetry.acknowledgeLinkNotice", "spaces.windows", "stream.pip", "spaces.thumbnail", "spaces.sendFiles", "host.setUp", "host.action",- "host.openSettings"] {+ "host.limits", "host.openSettings"] {#expect(WebUIBridge.methods.contains(m), "\(m)")}#expect(!WebUIBridge.methods.contains("spaces.new"))@@ -560,6 +560,25 @@ struct WebUIHostTests {#expect(await failure(bridge, "host.action", ["action": "set-up"]) == "bad_args")}+ /// The limits on the Spaces other machines create here: changed through the+ /// host (0 is no limit, a missing one keeps its value), a bad number refused.+ @Test func hostLimitsChangeThroughTheHostModel() async throws {+ let host = FixtureHost()+ let (bridge, _) = bridge(host: host)+ _ = try await bridge.handle("host.setUp", ["request": ["mode": "relay", "name": "Studio"]])+ let s = try await bridge.handle("host.limits", ["maxSpaces": 6, "maxMemoryGb": 32]) as? [String: Any]+ #expect(s?["maxSpaces"] as? Int == 6)+ #expect(s?["maxMemoryGb"] as? Int == 32)+ #expect(s?["maxDiskGb"] as? Int == 0)+ let kept = try await bridge.handle("host.limits", ["maxDiskGb": 200]) as? [String: Any]+ #expect(kept?["maxSpaces"] as? Int == 6, "a limit not given keeps its value")+ #expect(kept?["maxDiskGb"] as? Int == 200)+ let none = try await bridge.handle("host.limits", ["maxSpaces": 0]) as? [String: Any]+ #expect(none?["maxSpaces"] as? Int == 0, "0 is no limit")+ #expect(await failure(bridge, "host.limits", ["maxSpaces": -1]) == "bad_args")+ #expect(await failure(bridge, "host.limits", ["maxSpaces": 1.5]) == "bad_args")+ }+@Test func hostStatusCarriesTheWholeStateAndTheProgress() async throws {let host = FixtureHost()let (bridge, _) = bridge(host: host)diff --git a/apps/cua-spaces-web/src/__tests__/desktop-row.test.tsx b/apps/cua-spaces-web/src/__tests__/desktop-row.test.tsxindex cc5ed4d9c6..b9884135d6 100644--- a/apps/cua-spaces-web/src/__tests__/desktop-row.test.tsx+++ b/apps/cua-spaces-web/src/__tests__/desktop-row.test.tsx@@ -127,6 +127,30 @@ describe.skipIf(!wasmBuilt)("This Mac's desktop row", () => {await act(async () => void fireEvent.click(document.querySelector("[data-desktop-share-button]")!));await waitFor(() => expect(actions).toContain("share-desktop"));});++ it("once the desktop is shared its chat works as in any Space: the message is posted to the thread", async () => {+ const posts: string[] = [];+ await mountApp("/spaces/this-mac", {+ ...withDesktop(true),+ intercept: (op, args) => {+ if (op === "thread.post") posts.push((args as { spaceId: string; text: string }).spaceId + ": " + (args as { text: string }).text);+ return undefined;+ },+ });+ const box = await waitFor(() => {+ const el = document.querySelector<HTMLTextAreaElement>("textarea");+ expect(el).not.toBeNull();+ return el!;+ });+ await act(async () => void fireEvent.change(box, { target: { value: "look at my screen" } }));+ await act(async () => void fireEvent.keyDown(box, { key: "Enter" }));+ await waitFor(() => expect(posts).toEqual(["this-mac: look at my screen"]));+ // It stays: the message is in the thread (not an error, not the share prompt).+ await waitFor(() => expect(document.body.textContent).toContain("look at my screen"));+ expect(document.querySelector("[data-this-mac-desktop][data-nudge]")).toBeNull();+ expect(document.body.textContent).not.toContain("Chat isn't available");+ expect(document.body.textContent).not.toContain("\u00b7");+ });});describe.skipIf(!wasmBuilt)("Home's Your Spaces", () => {diff --git a/apps/cua-spaces-web/src/__tests__/machines-page.test.tsx b/apps/cua-spaces-web/src/__tests__/machines-page.test.tsxindex a2bc3d23ec..66e12d0eaa 100644--- a/apps/cua-spaces-web/src/__tests__/machines-page.test.tsx+++ b/apps/cua-spaces-web/src/__tests__/machines-page.test.tsx@@ -178,6 +178,28 @@ describe.skipIf(!wasmBuilt)("the Machines page (real routes, wasm core)", () =>await waitFor(() => expect(router.state.location.pathname).toBe(`/spaces/${encodeURIComponent("relay:studio/xm")}`));});+ it("another machine's page says, read-only, how many Spaces can be created there", async () => {+ const view = await mockupView();+ const h = hostDrawn(view, []);+ const base = h.answer!;+ h.answer = (op, out) => {+ const rows = base(op, out);+ return op === "machines.list"+ ? (rows as MachineRow[]).map((m) => (m.id === "studio" ? { ...m, limits: [{ resource: "spaces", used: 2, limit: 6, reason: "" }] } : m))+ : rows;+ };+ const { router } = await mountApp("/machines", h);+ await router.load();+ await screen.findByText(view.summary);+ select("studio");+ const detail = await detailOf("cua's Mac Studio");+ const help = detail.querySelector('[data-machine-toggle-help="spaces"]');+ expect(help?.textContent).toBe("Spaces can be created here (up to 6)");+ expect(detail.textContent).not.toContain("\u00b7");+ // Read-only: the switch cannot be flipped from here.+ expect(detail.querySelector('[data-machine-toggle="spaces"] [role="switch"]')?.hasAttribute("data-disabled") || detail.querySelector('[data-machine-toggle="spaces"] [role="switch"]')?.getAttribute("aria-readonly") === "true").toBe(true);+ });+it("asks before removing a machine from the account; Cancel removes nothing", async () => {const view = await mockupView();const calls: [string, unknown][] = [];diff --git a/apps/cua-spaces-web/src/__tests__/settings-sharing.test.tsx b/apps/cua-spaces-web/src/__tests__/settings-sharing.test.tsxindex 04894499bf..d34211211e 100644--- a/apps/cua-spaces-web/src/__tests__/settings-sharing.test.tsx+++ b/apps/cua-spaces-web/src/__tests__/settings-sharing.test.tsx@@ -40,4 +40,46 @@ describe.skipIf(!wasmBuilt)("Settings, Sharing", () => {await waitFor(() => expect(actions.length).toBeGreaterThan(0));expect(actions[0]).toBe(on ? "stop-providing-spaces" : "provide-spaces");});++ it("shows the limits under the switch, with use next to each, and saves a changed number", async () => {+ const calls: [string, unknown][] = [];+ await mountApp("/settings/general", {+ failsCreates: false,+ listsGhost: false,+ intercept: (op, args) => {+ if (op === "host.limits") {+ calls.push([op, args]);+ return null;+ }+ return undefined;+ },+ });+ const rows = await waitFor(() => {+ const el = document.querySelector<HTMLElement>('[data-setting-row="limit-max-spaces"]');+ expect(el).not.toBeNull();+ return el!;+ });+ const text = document.body.textContent ?? "";+ for (const label of ["Most Spaces at once", "Most memory in total", "Most disk in total", "Longest a Space may run"]) expect(text).toContain(label);+ // Use sits next to the limit; this Mac's total next to memory and disk.+ expect(document.querySelector('[data-limit-use="max-spaces"]')?.textContent).toMatch(/of 4 Spaces/);+ expect(document.querySelector('[data-limit-use="max-memory"]')?.textContent).toMatch(/GB/);+ expect(text).not.toContain("\u00b7");+ expect(text).not.toMatch(/devices|computers/i);+ // No limit is an empty field.+ expect((document.querySelector('[data-setting-row="limit-max-memory"]') as HTMLInputElement).value).toBe("");+ // A number saves when the field is left.+ await act(async () => void fireEvent.change(rows, { target: { value: "6" } }));+ await act(async () => void fireEvent.blur(rows));+ await waitFor(() => expect(calls).toEqual([["host.limits", { maxSpaces: 6 }]]));+ // Leaving a field that was not changed saves nothing.+ const memory = document.querySelector<HTMLInputElement>('[data-setting-row="limit-max-memory"]')!;+ await act(async () => void fireEvent.blur(memory));+ expect(calls.length).toBe(1);+ // A number that is not a number is put back, not saved.+ await act(async () => void fireEvent.change(memory, { target: { value: "-3" } }));+ await act(async () => void fireEvent.blur(memory));+ expect(memory.value).toBe("");+ expect(calls.length).toBe(1);+ });});diff --git a/apps/cua-spaces-web/src/bridge/__tests__/contract-args.ts b/apps/cua-spaces-web/src/bridge/__tests__/contract-args.tsindex 51be83b84d..e87e04ff62 100644--- a/apps/cua-spaces-web/src/bridge/__tests__/contract-args.ts+++ b/apps/cua-spaces-web/src/bridge/__tests__/contract-args.ts@@ -182,6 +182,7 @@ export const DEMO_ARGS: { [K in OpName]: OpArgs<K> } = {"host.setUp": { request: { mode: "relay" } },"host.joinWithCode": { code: "K7QM-4XPB-2RHD" },"host.action": { action: "stop-sharing" },+ "host.limits": { maxSpaces: 6 },"host.openSettings": { url: "x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility" },"startup.get": {},"startup.act": { action: "allowAccess" },diff --git a/apps/cua-spaces-web/src/bridge/__tests__/coverage.test.ts b/apps/cua-spaces-web/src/bridge/__tests__/coverage.test.tsindex a087c3275c..e1c7a0a4a4 100644--- a/apps/cua-spaces-web/src/bridge/__tests__/coverage.test.ts+++ b/apps/cua-spaces-web/src/bridge/__tests__/coverage.test.ts@@ -147,6 +147,7 @@ const ARGS: { [K in OpName]: OpArgs<K> } = {"host.setUp": { request: { mode: "relay" } },"host.joinWithCode": { code: "K7QM-4XPB-2RHD" },"host.action": { action: "stop-sharing" },+ "host.limits": { maxSpaces: 6 },"host.openSettings": { url: "x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility" },"startup.get": {},"startup.act": { action: "allowAccess" },@@ -203,6 +204,7 @@ function webkitResult(method: string): unknown {case "host.setUp":case "host.joinWithCode":case "host.action":+ case "host.limits":return { configured: false, sharing: false, serviceInstalled: false, serviceRunning: false, serviceKind: "process", clients: [], permissions: [], shareDesktop: true, provideSpaces: false, maxSpaces: 0 };case "keyvault.approve":return { id: "grant-1", requestId: "req-1", items: [] };diff --git a/apps/cua-spaces-web/src/bridge/adapters/demo-data.ts b/apps/cua-spaces-web/src/bridge/adapters/demo-data.tsindex eab115c932..6bc329853f 100644--- a/apps/cua-spaces-web/src/bridge/adapters/demo-data.ts+++ b/apps/cua-spaces-web/src/bridge/adapters/demo-data.ts@@ -24,7 +24,10 @@ export const DEMO_MACHINES: MachineRow[] = [online: true,os: "macos",model: "Mac mini",- limits: [{ resource: "macos-vms", used: 1, limit: 2, reason: "macOS runs at most two VMs per Mac." }],+ limits: [+ { resource: "spaces", used: 1, limit: 4, reason: "This machine's limit." },+ { resource: "macos-vms", used: 1, limit: 2, reason: "macOS runs at most two VMs per Mac." },+ ],},{ id: "linux-box", name: "Linux box", via: "relay", online: true, os: "linux", model: "ThinkCentre M90q", limits: [] },{@@ -287,6 +290,17 @@ export function demoHostStatus(now = Date.now(), firstRun = false): HostStatus {provideSpaces: true,maxSpaces: 4,maxMacosVms: 2,+ maxMemoryGb: 0,+ maxDiskGb: 0,+ maxRunMinutes: 0,+ usedMemoryGb: 8,+ usedDiskGb: 32,+ totalMemoryGb: 32,+ totalDiskGb: 994,+ providedSpaces: [+ { relayMachine: "space-build-1", localSpace: "local:build-1", name: "build-1", image: "ghcr.io/trycua/linux", os: "linux", kind: "container", createdBy: "Mac mini", createdAtMs: now - 40 * 60_000 },+ { relayMachine: "space-build-2", localSpace: "local:build-2", name: "build-2", image: "ghcr.io/trycua/linux", os: "linux", kind: "container", createdBy: "Linux box", createdAtMs: now - 12 * 60_000 },+ ],recentAccess: [{ atMs: now - 4 * 60_000, via: "relay", who: DEMO_IDENTITY, what: "DesktopService" },{ atMs: now - 52 * 60_000, via: "relay", who: DEMO_IDENTITY, what: "MCP" },diff --git a/apps/cua-spaces-web/src/bridge/adapters/demo/host-setup.ts b/apps/cua-spaces-web/src/bridge/adapters/demo/host-setup.tsindex fadac56aff..53741570ca 100644--- a/apps/cua-spaces-web/src/bridge/adapters/demo/host-setup.ts+++ b/apps/cua-spaces-web/src/bridge/adapters/demo/host-setup.ts@@ -18,7 +18,7 @@ export interface DemoHostSetupState {export const demoHostSetupState = (now: number, firstRun: boolean): DemoHostSetupState => ({ host: demoHostStatus(now, firstRun) });-export function demoHostSetupHandlers({ state, now, wait, emit, stepMs }: DemoContext): DemoHandlers<"host.setUp" | "host.joinWithCode" | "host.action" | "host.openSettings"> {+export function demoHostSetupHandlers({ state, now, wait, emit, stepMs }: DemoContext): DemoHandlers<"host.setUp" | "host.joinWithCode" | "host.action" | "host.limits" | "host.openSettings"> {const set = (host: HostStatus) => {state.host = host;emit({ type: "machines.changed" });@@ -70,6 +70,19 @@ export function demoHostSetupHandlers({ state, now, wait, emit, stepMs }: DemoCoif (!change) throw new HostError(`${action} is not a host action`, "bad_args");return set({ ...h, ...change });},+ // The limits: what is given is kept, and use is counted from the Spaces provided here.+ "host.limits": async (limits) => {+ await wait(stepMs);+ const h = state.host;+ if (!h.configured) throw new HostError("This computer is not set up for access", "not_configured");+ return set({+ ...h,+ maxSpaces: limits.maxSpaces ?? h.maxSpaces,+ maxMemoryGb: limits.maxMemoryGb ?? h.maxMemoryGb,+ maxDiskGb: limits.maxDiskGb ?? h.maxDiskGb,+ maxRunMinutes: limits.maxRunMinutes ?? h.maxRunMinutes,+ });+ },// A browser can't open System Settings; the pane only has to be one."host.openSettings": ({ url }) => {if (!isSettingsPane(url)) throw new HostError("Only System Settings panes open here", "bad_args");diff --git a/apps/cua-spaces-web/src/bridge/adapters/tauri.ts b/apps/cua-spaces-web/src/bridge/adapters/tauri.tsindex 5791674cad..e5bee60232 100644--- a/apps/cua-spaces-web/src/bridge/adapters/tauri.ts+++ b/apps/cua-spaces-web/src/bridge/adapters/tauri.ts@@ -104,6 +104,7 @@ export const TAURI_UNSUPPORTED: readonly OpName[] = ["agents.signInStart","agents.signInWait","host.joinWithCode",+ "host.limits",...TELEPORT_TAURI_UNSUPPORTED,...KEYVAULT_MANAGE_TAURI_UNSUPPORTED,...TAURI_SETTINGS_UNSUPPORTED,diff --git a/apps/cua-spaces-web/src/bridge/adapters/webkit.ts b/apps/cua-spaces-web/src/bridge/adapters/webkit.tsindex 66715a0d50..49d7cc444b 100644--- a/apps/cua-spaces-web/src/bridge/adapters/webkit.ts+++ b/apps/cua-spaces-web/src/bridge/adapters/webkit.ts@@ -432,6 +432,13 @@ export function toHostStatus(h: WkHostState): HostStatus {// The rest of the core's state, as the host sends it: the logs, the// provided Spaces, and whether sharing waits for a sign-in.maxMacosVms: h.maxMacosVms ?? 0,+ maxMemoryGb: h.maxMemoryGb ?? 0,+ maxDiskGb: h.maxDiskGb ?? 0,+ maxRunMinutes: h.maxRunMinutes ?? 0,+ usedMemoryGb: h.usedMemoryGb ?? 0,+ usedDiskGb: h.usedDiskGb ?? 0,+ totalMemoryGb: h.totalMemoryGb ?? 0,+ totalDiskGb: h.totalDiskGb ?? 0,recentAccess: list(h.recentAccess) as HostStatus["recentAccess"],accessLogError: h.accessLogError ?? null,providedSpaces: list(h.providedSpaces) as HostStatus["providedSpaces"],diff --git a/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json b/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.jsonindex f780a6dcc2..92b94eb4ad 100644--- a/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json+++ b/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json@@ -1832,6 +1832,27 @@"maxMacosVms": {"type": "number"},+ "maxMemoryGb": {+ "type": "number"+ },+ "maxDiskGb": {+ "type": "number"+ },+ "maxRunMinutes": {+ "type": "number"+ },+ "usedMemoryGb": {+ "type": "number"+ },+ "usedDiskGb": {+ "type": "number"+ },+ "totalMemoryGb": {+ "type": "number"+ },+ "totalDiskGb": {+ "type": "number"+ },"recentAccess": {"type": "array","items": {@@ -6254,6 +6275,48 @@"null"]},+ "maxMemoryGb": {+ "type": [+ "number",+ "null"+ ]+ },+ "maxDiskGb": {+ "type": [+ "number",+ "null"+ ]+ },+ "maxRunMinutes": {+ "type": [+ "number",+ "null"+ ]+ },+ "usedMemoryGb": {+ "type": [+ "number",+ "null"+ ]+ },+ "usedDiskGb": {+ "type": [+ "number",+ "null"+ ]+ },+ "totalMemoryGb": {+ "type": [+ "number",+ "null"+ ]+ },+ "totalDiskGb": {+ "type": [+ "number",+ "null"+ ]+ },"recentAccess": {"type": ["array",@@ -7791,6 +7854,9 @@"host.joinWithCode": {"$ref": "#/$defs/HostStatus"},+ "host.limits": {+ "$ref": "#/$defs/HostStatus"+ },"host.openSettings": {"type": "null"},@@ -10204,6 +10270,16 @@}]},+ "host.limits": {+ "anyOf": [+ {+ "$ref": "#/$defs/WkHostState"+ },+ {+ "type": "null"+ }+ ]+ },"host.openSettings": {"type": "null"},diff --git a/apps/cua-spaces-web/src/bridge/contracts/host.ts b/apps/cua-spaces-web/src/bridge/contracts/host.tsindex 34fe455821..3286bf5cf2 100644--- a/apps/cua-spaces-web/src/bridge/contracts/host.ts+++ b/apps/cua-spaces-web/src/bridge/contracts/host.ts@@ -486,6 +486,18 @@ export interface HostStatus {provideSpaces?: boolean;maxSpaces?: number;maxMacosVms?: number;+ /** Memory the Spaces other machines create here may use in total, in GB (0: no limit). */+ maxMemoryGb?: number;+ /** Disk they may use in total, in GB (0: no limit). */+ maxDiskGb?: number;+ /** How long such a Space may run, in minutes (0: no limit). */+ maxRunMinutes?: number;+ /** What those Spaces were given now, in GB. */+ usedMemoryGb?: number;+ usedDiskGb?: number;+ /** This machine's own memory and disk, in GB (0: not known). */+ totalMemoryGb?: number;+ totalDiskGb?: number;recentAccess?: HostAccess[];accessLogError?: string | null;providedSpaces?: HostProvidedSpace[];@@ -539,6 +551,34 @@ export type HostActionId =| "stop-providing-spaces"| "sign-in";+/** One limit on the Spaces other machines create here (`host::HostLimitRow`). */+export interface HostLimitRow {+ /** `max-spaces`, `max-memory`, `max-disk` or `max-run`. */+ id: "max-spaces" | "max-memory" | "max-disk" | "max-run" | string;+ label: string;+ help: string;+ /** The limit; 0 is no limit. */+ value: number;+ /** `Spaces`, `GB` or `minutes`. */+ unit: string;+ /** "2 of 4 Spaces", "12 of 32 GB"; absent for a limit about time. */+ useText?: string | null;+ /** This machine's own total in `unit` (memory, disk); 0 when not known. */+ total?: number;+ /** In use above the limit: nothing stops, new Spaces are refused. */+ over?: boolean;+ /** "Over limit" while `over`. */+ overText?: string | null;+}++/** A change to the limits (`host.limits`); a missing field keeps its value, 0 is no limit. */+export interface HostLimits {+ maxSpaces?: number;+ maxMemoryGb?: number;+ maxDiskGb?: number;+ maxRunMinutes?: number;+}+/** One of the two sharing settings (`host::HostToggle`). */export interface HostToggle {id: string;@@ -602,6 +642,8 @@ export interface HostPanelView {accessWarning?: string | null;toggles?: HostToggle[];limits?: string | null;+ /** The limits as number rows (Settings, Sharing), while this machine lets others create Spaces. */+ limitRows?: HostLimitRow[];providedTitle?: string | null;provided?: HostAccessRow[];providedEmpty?: string | null;diff --git a/apps/cua-spaces-web/src/bridge/contracts/shapes.ts b/apps/cua-spaces-web/src/bridge/contracts/shapes.tsindex 9b89737736..c8230d8912 100644--- a/apps/cua-spaces-web/src/bridge/contracts/shapes.ts+++ b/apps/cua-spaces-web/src/bridge/contracts/shapes.ts@@ -245,6 +245,13 @@ const HostStatusShape = ref(provideSpaces: opt(bool),maxSpaces: opt(num),maxMacosVms: opt(num),+ maxMemoryGb: opt(num),+ maxDiskGb: opt(num),+ maxRunMinutes: opt(num),+ usedMemoryGb: opt(num),+ usedDiskGb: opt(num),+ totalMemoryGb: opt(num),+ totalDiskGb: opt(num),recentAccess: opt(list(object({ atMs: num, via: str, who: str, what: str }))),accessLogError: optNull(str),providedSpaces: opt(list(any)),@@ -1467,6 +1474,7 @@ export const OP_SHAPES: Record<OpName, Schema> = {"host.setUp": HostStatusShape,"host.joinWithCode": HostStatusShape,"host.action": HostStatusShape,+ "host.limits": HostStatusShape,"host.openSettings": nul,"startup.get": StartupShape,"startup.act": StartupShape,@@ -1495,6 +1503,13 @@ const WkHostShape = ref(provideSpaces: bool,maxSpaces: num,maxMacosVms: optNull(num),+ maxMemoryGb: optNull(num),+ maxDiskGb: optNull(num),+ maxRunMinutes: optNull(num),+ usedMemoryGb: optNull(num),+ usedDiskGb: optNull(num),+ totalMemoryGb: optNull(num),+ totalDiskGb: optNull(num),recentAccess: optNull(list(object({ atMs: num, via: str, who: str, what: str }))),accessLogError: optNull(str),providedSpaces: optNull(list(any)),@@ -1718,6 +1733,7 @@ export const WEBKIT_SHAPES: Partial<Record<WebkitMethod, Schema>> = {"host.setUp": nullable(WkHostShape),"host.joinWithCode": nullable(WkHostShape),"host.action": nullable(WkHostShape),+ "host.limits": nullable(WkHostShape),"agents.list": OP_SHAPES["agents.list"],"agents.runs": OP_SHAPES["agents.runs"],"agents.events": OP_SHAPES["agents.events"],diff --git a/apps/cua-spaces-web/src/bridge/derive.ts b/apps/cua-spaces-web/src/bridge/derive.tsindex 40e61f8770..df2913adea 100644--- a/apps/cua-spaces-web/src/bridge/derive.ts+++ b/apps/cua-spaces-web/src/bridge/derive.ts@@ -602,6 +602,13 @@ export function hostState(status: HostStatus) {provideSpaces: status.provideSpaces ?? false,maxSpaces: status.maxSpaces ?? 0,maxMacosVms: status.maxMacosVms ?? 0,+ maxMemoryGb: status.maxMemoryGb ?? 0,+ maxDiskGb: status.maxDiskGb ?? 0,+ maxRunMinutes: status.maxRunMinutes ?? 0,+ usedMemoryGb: status.usedMemoryGb ?? 0,+ usedDiskGb: status.usedDiskGb ?? 0,+ totalMemoryGb: status.totalMemoryGb ?? 0,+ totalDiskGb: status.totalDiskGb ?? 0,providedSpaces: status.providedSpaces ?? [],spacesAudit: status.spacesAudit ?? [],spacesAuditError: status.spacesAuditError ?? null,diff --git a/apps/cua-spaces-web/src/bridge/ops/host-setup.ts b/apps/cua-spaces-web/src/bridge/ops/host-setup.tsindex cb10bad3e1..6f1faec991 100644--- a/apps/cua-spaces-web/src/bridge/ops/host-setup.ts+++ b/apps/cua-spaces-web/src/bridge/ops/host-setup.ts@@ -13,12 +13,13 @@* | `host.setUp {request}` | `host_setup` | `HostModel.submit` |* | `host.joinWithCode {code, relay?}` | none | runs the bundled `cua host setup --pair` |* | `host.action {action}` | `host_stop_sharing`, `host_start_sharing`, `host_remove`, `host_configure` | `HostModel.run(action)` (`sign-in`: the inline sign-in, then sharing follows it) |+ * | `host.limits {maxSpaces?, maxMemoryGb?, maxDiskGb?, maxRunMinutes?}` | none | `HostModel.setLimits` |* | `host.openSettings {url}` | `host_open_settings` | `PermissionRows.open` |*/import { HostError } from "../adapter";import type { OpCoverage } from "../coverage";-import type { HostActionId, HostStatus } from "../contracts/host";+import type { HostActionId, HostLimits, HostStatus } from "../contracts/host";/** What host setup receives (`host::HostSetupRequest`). */export interface HostSetupRequest {@@ -72,6 +73,8 @@ export interface HostSetupOps {"host.joinWithCode": { args: { code: string; relay?: string | null }; result: HostStatus };/** Runs a This machine button; answers the status after. */"host.action": { args: { action: HostRunAction }; result: HostStatus };+ /** Changes the limits on the Spaces other machines create here (a missing field keeps its value, 0 is no limit); answers the status after. */+ "host.limits": { args: HostLimits; result: HostStatus };/** Opens a System Settings privacy pane (`x-apple.systempreferences:` only). */"host.openSettings": { args: { url: string }; result: null };}@@ -129,6 +132,11 @@ export const HOST_SETUP_COVERAGE = {webkit: { methods: ["host.action"] },tauri: ["host_stop_sharing", "host_start_sharing", "host_remove", "host_status", "host_configure"],},+ "host.limits": {+ webkit: { methods: ["host.limits"] },+ tauri: [],+ unsupported: { tauri: "the Tauri app's host settings carry the two switches only, and its Windows and Linux builds are not shipped" },+ },"host.openSettings": {webkit: { methods: ["host.openSettings"] },tauri: ["host_open_settings"],diff --git a/apps/cua-spaces-web/src/bridge/ops/space-detail.ts b/apps/cua-spaces-web/src/bridge/ops/space-detail.tsindex 80100de8fd..05e34912e5 100644--- a/apps/cua-spaces-web/src/bridge/ops/space-detail.ts+++ b/apps/cua-spaces-web/src/bridge/ops/space-detail.ts@@ -335,5 +335,6 @@ export const DETAIL_ARGS = {"host.setUp": { request: { mode: "relay" } },"host.joinWithCode": { code: "K7QM-4XPB-2RHD" },"host.action": { action: "stop-sharing" as const },+ "host.limits": { maxSpaces: 6 },"host.openSettings": { url: "x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility" },};diff --git a/apps/cua-spaces-web/src/bridge/ops/webkit-pages.ts b/apps/cua-spaces-web/src/bridge/ops/webkit-pages.tsindex c841ff1c16..def765dc81 100644--- a/apps/cua-spaces-web/src/bridge/ops/webkit-pages.ts+++ b/apps/cua-spaces-web/src/bridge/ops/webkit-pages.ts@@ -104,6 +104,7 @@ export const WEBKIT_PAGE_OPS = ["host.setUp","host.joinWithCode","host.action",+ "host.limits","host.openSettings",] as const satisfies readonly OpName[];@@ -301,6 +302,7 @@ export function webkitPageOps(request: Request, toHostStatus: (h: WkHostState) ="host.setUp": host("host.setUp"),"host.joinWithCode": ({ code, relay }) => request("host.joinWithCode", { code, relay: relay ?? null }),"host.action": host("host.action"),+ "host.limits": host("host.limits"),"host.openSettings": async ({ url }) => {if (!isSettingsPane(url)) throw new HostError("Only System Settings panes open here", "bad_args");await request("host.openSettings", { url });diff --git a/apps/cua-spaces-web/src/bridge/protocol.ts b/apps/cua-spaces-web/src/bridge/protocol.tsindex 041bd37f6e..f625c279ae 100644--- a/apps/cua-spaces-web/src/bridge/protocol.ts+++ b/apps/cua-spaces-web/src/bridge/protocol.ts@@ -399,6 +399,7 @@ export const OPERATIONS = ["host.setUp","host.joinWithCode","host.action",+ "host.limits","host.openSettings",...STARTUP_OPERATIONS,] as const satisfies readonly OpName[];diff --git a/apps/cua-spaces-web/src/bridge/this-machine.ts b/apps/cua-spaces-web/src/bridge/this-machine.tsindex bd3a63ffc4..15f6dadf1b 100644--- a/apps/cua-spaces-web/src/bridge/this-machine.ts+++ b/apps/cua-spaces-web/src/bridge/this-machine.ts@@ -14,7 +14,7 @@ import { HostError, type DataAdapter } from "./adapter";import { BridgeContext } from "./BridgeProvider";import type { CoreClient } from "./core";import { plainThrottleError } from "./friendly-errors";-import type { HostActionId, HostFormView as HostFormViewBase } from "./contracts/host";+import type { HostActionId, HostFormView as HostFormViewBase, HostLimits } from "./contracts/host";import type { HostFormAction, HostFormState, HostRunAction, HostSetupRequest } from "./ops/host-setup";export type { HostFormAction, HostFormState, HostRunAction, HostSetupRequest } from "./ops/host-setup";@@ -206,6 +206,18 @@ export class ThisMachineStore {}}+ /** Changes the limits on the Spaces other machines create here (0 is no limit); a failure shows as a toast where it was asked. */+ async setLimits(limits: HostLimits): Promise<void> {+ if (this.state.busy) return;+ this.set({ busy: true });+ try {+ await this.adapter.call("host.limits", limits);+ } finally {+ this.set({ busy: false });+ await this.changed();+ }+ }+/** Retry on a failed button: the same button again. */retry(): Promise<void> {return this.failedAction ? this.run(this.failedAction) : Promise.resolve();@@ -236,6 +248,8 @@ export interface ThisMachineHook extends ThisMachineState {/** Sends the failed setup's request again. */retrySetUp(): Promise<boolean>;run(action: HostActionId): Promise<void>;+ /** Changes the limits on Spaces other machines create here (0 is no limit); rejects with the failure. */+ setLimits(limits: HostLimits): Promise<void>;/** Runs the failed button again. */retry(): Promise<void>;openSettings(url: string): Promise<void>;@@ -262,6 +276,7 @@ export function useThisMachine(identity: string | null): ThisMachineHook {quickSetUp: () => tm?.quickSetUp(who) ?? Promise.resolve(false),retrySetUp: () => tm?.retrySetUp() ?? Promise.resolve(false),run: (a) => tm?.run(a) ?? Promise.resolve(),+ setLimits: (l) => tm?.setLimits(l) ?? Promise.resolve(),retry: () => tm?.retry() ?? Promise.resolve(),openSettings: async (url) => {await tm?.openSettings(url);diff --git a/apps/cua-spaces-web/src/bridge/webkit-protocol.ts b/apps/cua-spaces-web/src/bridge/webkit-protocol.tsindex 1602e1f61c..c80e8ea7fc 100644--- a/apps/cua-spaces-web/src/bridge/webkit-protocol.ts+++ b/apps/cua-spaces-web/src/bridge/webkit-protocol.ts@@ -158,6 +158,7 @@ export const WEBKIT_METHODS = ["host.setUp","host.joinWithCode","host.action",+ "host.limits","host.openSettings","settings.get","settings.choose",@@ -411,6 +412,13 @@ export interface WkHostState {provideSpaces: boolean;maxSpaces: number;maxMacosVms?: number | null;+ maxMemoryGb?: number | null;+ maxDiskGb?: number | null;+ maxRunMinutes?: number | null;+ usedMemoryGb?: number | null;+ usedDiskGb?: number | null;+ totalMemoryGb?: number | null;+ totalDiskGb?: number | null;recentAccess?: { atMs: number; via: string; who: string; what: string }[] | null;accessLogError?: string | null;providedSpaces?: import("./contracts/host").HostProvidedSpace[] | null;diff --git a/apps/cua-spaces-web/src/components/settings/general-tab.tsx b/apps/cua-spaces-web/src/components/settings/general-tab.tsxindex 7d09ea4f15..ceefbdcce7 100644--- a/apps/cua-spaces-web/src/components/settings/general-tab.tsx+++ b/apps/cua-spaces-web/src/components/settings/general-tab.tsx@@ -2,16 +2,19 @@// Copyright (c) 2026 Cua AI, Inc.import { MonitorIcon, MoonIcon, SunIcon } from "lucide-react";-import { useEffect, useState } from "react";+import { useEffect, useRef, useState } from "react";++import type { HostLimitRow, HostLimits } from "@/bridge/contracts/host";import { chooseSettings, useBridge, useLoginItem, useMachines, useSession, useSettings, useThisMachine, useTips, type GlobalShortcut, type SettingsRow as CoreRow } from "@/bridge";import { SettingsGroup, SettingsRow } from "@/components/settings-group";import { CoreSettingsRow } from "@/components/settings/core-section";import { Button } from "@/components/ui/button";+import { Input } from "@/components/ui/input";import { Segmented } from "@/components/ui/segmented";import { Switch } from "@/components/ui/switch";import { toastError } from "@/components/ui/toast";-import { globalShortcutLine, showsMacShellSettings } from "@/lib/host-labels";+import { globalShortcutLine, showsMacShellSettings, thisComputerLabel } from "@/lib/host-labels";import { LAUNCH_HELP, LAUNCH_LABEL } from "@/lib/settings-copy";import { acceleratorOf } from "@/lib/shortcut-keys";import { useTheme, type ThemePreference } from "@/lib/theme";@@ -169,10 +172,94 @@ function SharingGroup() {htmlFor="share-spaces"control={<Switch id="share-spaces" data-setting-row="share-spaces" checked={on} disabled={host.busy || (panel.configured && !toggle?.enabled)} onCheckedChange={flip} />}/>+ {on+ ? (panel.limitRows ?? []).map((row) => (+ <LimitRow+ key={row.id}+ row={row}+ busy={host.busy}+ onChange={(limits) =>+ host.setLimits(limits).catch((e) => {+ fail("Couldn't change the limit")(e);+ throw e;+ })+ }+ />+ ))+ : null}</SettingsGroup>);}+const LIMIT_FIELD: Record<string, keyof HostLimits> = {+ "max-spaces": "maxSpaces",+ "max-memory": "maxMemoryGb",+ "max-disk": "maxDiskGb",+ "max-run": "maxRunMinutes",+};++/**+ * One limit on the Spaces other machines create here: a number (empty is no limit), what is in use+ * next to it, and "Over limit" when it was lowered below that (nothing is stopped; new Spaces are refused).+ * Saved when the field is left or Enter is pressed.+ */+function LimitRow({ row, busy, onChange }: { row: HostLimitRow; busy: boolean; onChange: (limits: HostLimits) => Promise<unknown> }) {+ const shown = row.value > 0 ? String(row.value) : "";+ const [draft, setDraft] = useState(shown);+ const latest = useRef(shown);+ latest.current = shown;+ useEffect(() => setDraft(shown), [shown]);+ const field = LIMIT_FIELD[row.id];+ if (!field) return null;+ const save = () => {+ const n = draft.trim() === "" ? 0 : Math.floor(Number(draft));+ if (!Number.isFinite(n) || n < 0) return setDraft(shown);+ if (n === row.value) return setDraft(shown);+ // A change the host refused shows the number it still has.+ onChange({ [field]: n }).catch(() => setDraft(latest.current));+ };+ const total = row.total && row.total > 0 ? `${thisComputerLabel()} has ${row.total} GB` : null;+ return (+ <SettingsRow+ label={row.label}+ htmlFor={`limit-${row.id}`}+ description={+ <>+ {row.help}+ {row.useText ? (+ <span className="block" data-limit-use={row.id}>+ {row.useText}+ {row.over ? <span className="ml-1.5 font-medium text-destructive">{row.overText ?? "Over limit"}</span> : null}+ {total ? `. ${total}` : null}+ </span>+ ) : null}+ </>+ }+ control={+ <span className="flex items-center gap-2">+ <Input+ id={`limit-${row.id}`}+ data-setting-row={`limit-${row.id}`}+ type="number"+ inputMode="numeric"+ min={0}+ className="w-28 text-right"+ placeholder="No limit"+ value={draft}+ disabled={busy}+ onValueChange={setDraft}+ onBlur={save}+ onKeyDown={(e) => {+ if (e.key === "Enter") (e.target as HTMLInputElement).blur();+ }}+ />+ <span className="w-12 text-[13px] text-muted-foreground">{row.unit === "Spaces" ? "Spaces" : row.unit}</span>+ </span>+ }+ />+ );+}+/** Launch at login as the app core lays it out; the switch shows what the system reports, never what was asked. */function LaunchAtLogin() {const { data, setLaunchAtLogin, openLoginItems } = useLoginItem();diff --git a/apps/cua-spaces-web/src/components/space-detail/this-mac-desktop.tsx b/apps/cua-spaces-web/src/components/space-detail/this-mac-desktop.tsxindex a508f8fb96..72ff318e37 100644--- a/apps/cua-spaces-web/src/components/space-detail/this-mac-desktop.tsx+++ b/apps/cua-spaces-web/src/components/space-detail/this-mac-desktop.tsx@@ -11,6 +11,25 @@ import { Button } from "@/components/ui/button";import { thisComputerText } from "@/lib/host-labels";import { cn } from "@/lib/utils";+/** The row's thread on a daemon that has none: empty, read-only in effect. */+const EMPTY: SpaceThread = {+ status: "ready",+ items: [],+ entries: [],+ members: [],+ shares: [],+ live: [],+ me: "me",+ role: null,+ error: null,+ hasMoreBefore: false,+ loadEarlier: async () => {},+ post: async () => null,+ answer: async () => {},+ setRights: async () => {},+ removeAgent: null,+};+/** Said when a message is written while the desktop is not shared, and kept in the box. */export const NOT_SHARING_CHAT = "Share this desktop to chat here.";@@ -46,8 +65,9 @@ export function DesktopStage({ shared, nudge }: { shared: boolean; nudge?: boole/*** This Mac's desktop row opened: a Space's page as any other (the header, the thread with its composer,- * the rail), with the prompt where the stream would be. The thread has no daemon behind it: writing- * while the desktop is not shared lights the prompt and keeps the draft.+ * the rail), with the prompt where the stream would be. The thread is the daemon's own thread of this+ * machine's desktop row (`live`): writing while the desktop is not shared lights the prompt and keeps the+ * draft; once it is shared, messages are posted to the thread as in any Space.*/export function ThisMacCall({spaceName,@@ -56,6 +76,7 @@ export function ThisMacCall({facts,more,identity,+ live,}: {spaceName: string;shared: boolean;@@ -63,31 +84,25 @@ export function ThisMacCall({facts: readonly SpaceFact[];more: ReactNode;identity: string | null;+ /** The row's thread from the daemon; `unsupported` from a daemon that has none yet. */+ live: SpaceThread;}) {const [nudge, setNudge] = useState(0);+ const noThread = live.status === "unsupported";const thread = useMemo<SpaceThread>(() => ({- status: "ready",- items: [],- entries: [],- members: [],- shares: [],- live: [],- me: "me",- role: null,- error: null,- hasMoreBefore: false,- loadEarlier: async () => {},+ ...(noThread ? EMPTY : live),// Not shared: the prompt lights up and the draft stays in the box.- post: async () => {- setNudge((n) => n + 1);- throw new Error(shared ? "Chat isn't available on this Mac's own desktop yet." : NOT_SHARING_CHAT);+ post: async (text, view) => {+ if (!shared) {+ setNudge((n) => n + 1);+ throw new Error(NOT_SHARING_CHAT);+ }+ if (noThread) throw new Error("Chat isn't available on this Mac's own desktop yet.");+ return live.post(text, view);},- answer: async () => {},- setRights: async () => {},- removeAgent: null,}),- [shared],+ [shared, live, noThread],);return (<SpaceCalldiff --git a/apps/cua-spaces-web/src/routes/machines/index.tsx b/apps/cua-spaces-web/src/routes/machines/index.tsxindex 2a1dacc5fd..56ea8bdcae 100644--- a/apps/cua-spaces-web/src/routes/machines/index.tsx+++ b/apps/cua-spaces-web/src/routes/machines/index.tsx@@ -509,6 +509,9 @@ function MachineDetail({ machine: m, row, onRemoved }: { machine: MachinesViewMa// A switch is read-only on another machine: dimmed when it can't be// reached at all (offline), plain with a note when it is.const dim = (t: MachinesViewToggle) => !t.editable && !m.togglesNote;+ // Another machine's Space limit, read-only: its host reports it with its other limits.+ const spaceLimit = !m.current ? row?.limits?.find((l) => l.resource === "spaces" && l.limit > 0)?.limit : undefined;+ const helpOf = (t: MachinesViewToggle) => (t.id === "spaces" && t.on && spaceLimit ? `Spaces can be created here (up to ${spaceLimit})` : t.help);// Its shared desktop first, then its Spaces, all drawn as Space rows.const rows: { id: string; name: string; os: string; status: string; running: boolean; label?: string }[] = [...(m.desktop ? [m.desktop] : []), ...m.spaces];@@ -565,7 +568,9 @@ function MachineDetail({ machine: m, row, onRemoved }: { machine: MachinesViewMa<div className="text-[13px] font-medium" id={`toggle-${t.id}`}>{t.label}</div>- <div className="mt-px text-xs text-muted-foreground">{t.help}</div>+ <div className="mt-px text-xs text-muted-foreground" data-machine-toggle-help={t.id}>+ {helpOf(t)}+ </div></div><Switchchecked={t.on}diff --git a/apps/cua-spaces-web/src/routes/spaces/$spaceId.tsx b/apps/cua-spaces-web/src/routes/spaces/$spaceId.tsxindex 8d80aa9090..1461d6c2eb 100644--- a/apps/cua-spaces-web/src/routes/spaces/$spaceId.tsx+++ b/apps/cua-spaces-web/src/routes/spaces/$spaceId.tsx@@ -432,6 +432,7 @@ function SpaceDetailPage() {<ThisMacCallspaceName={space.name}shared={!isUnsharedDesktop(space)}+ live={thread}identity={session?.signedIn ? (session.account.identity ?? null) : null}facts={detail.facts}more={sections}diff --git a/apps/cua-spaces/src-tauri/Cargo.lock b/apps/cua-spaces/src-tauri/Cargo.lockindex 8894ce2338..e1d49a6146 100644--- a/apps/cua-spaces/src-tauri/Cargo.lock+++ b/apps/cua-spaces/src-tauri/Cargo.lock@@ -1732,6 +1732,7 @@ dependencies = ["cua-proto","cua-spacesd-client","flate2",+ "futures-util","hex","rand 0.9.5","serde",diff --git a/docs/content/docs/cua-cli/reference/cli/spaces-and-computers.mdx b/docs/content/docs/cua-cli/reference/cli/spaces-and-computers.mdxindex 71f5ef1a27..8a4c33125a 100644--- a/docs/content/docs/cua-cli/reference/cli/spaces-and-computers.mdx+++ b/docs/content/docs/cua-cli/reference/cli/spaces-and-computers.mdx@@ -689,6 +689,9 @@ cua host config [OPTIONS]| <span id="cua-host-config--provide-spaces"></span>`--provide-spaces` | `on` \| `off` | | Create Spaces for your enrolled devices: on \| off. || <span id="cua-host-config--max-spaces"></span>`--max-spaces` | integer | | Provided Spaces at once (0: no limit). || <span id="cua-host-config--max-macos-vms"></span>`--max-macos-vms` | integer | | macOS VMs at once, 0 to 2 (Apple's license allows two per Mac). |+| <span id="cua-host-config--max-memory"></span>`--max-memory` | integer | | Memory in GB the Spaces other machines create here may use in total (0: no limit). |+| <span id="cua-host-config--max-disk"></span>`--max-disk` | integer | | Disk in GB the Spaces other machines create here may use in total (0: no limit). |+| <span id="cua-host-config--max-run-time"></span>`--max-run-time` | integer | | Minutes a Space created here by another machine may run before it is stopped (0: no limit). |**Examples**@@ -698,6 +701,9 @@ cua host config# Stop sharing this desktop; keep providing Spacescua host config --desktop off --provide-spaces oncua host config --max-spaces 6++# Give the Spaces other machines create here at most 32 GB of memory and 200 GB of disk in total, and stop each after 8 hours (0: no limit)+cua host config --max-memory 32 --max-disk 200 --max-run-time 480```### `cua host status`diff --git a/docs/content/docs/cua-sdk/concepts/telemetry-events.mdx b/docs/content/docs/cua-sdk/concepts/telemetry-events.mdxindex 3c69d67e0e..23d20cb69e 100644--- a/docs/content/docs/cua-sdk/concepts/telemetry-events.mdx+++ b/docs/content/docs/cua-sdk/concepts/telemetry-events.mdx@@ -32,6 +32,7 @@ Every event carries: `telemetry_schema_version`, `event_version`, `product`| `cua_agent_signin_imported` | `harness` (`hermes`, `claude-code`, `codex` or `other`) | One-click Connect: an agent's sign-in was copied into Keyvault on This Mac. Never the sign-in, the account or the provider. || `cua_agent_run_started` | `harness` (cua-agents id or `other`), `location`, `entry` (`spaces_tool`, `cli`, `sdk`, `persistent`, `routine`), `outcome`, `error_kind` | Agent runs started, and failed starts. || `cua_agent_run_completed` | `harness`, `location`, `entry`, `outcome`, `error_kind`, `duration_bucket` | First agent run, and how reliably runs finish. Once per run. |+| `cua_agent_join_phase` | `phase` (`posted`, `dispatch_picked`, `host_prepared`, `guest_spawned`, `install_done`, `runner_started`, `agent_spawned`, `acp_initialized`, `acp_authenticated`, `session_ready`, `turn_started`, `first_token`, `turn_ended` or `failed`), `harness`, `runtime`, `cold`, `ms_since_post`, `run` (a per-install salted hash, never the run id), `tool` (`install_done` only), `failure` (`failed` only: `auth`, `install`, `timeout` or `other`) | How long an agent takes to join a Space and answer, step by step, and where joins fail. Never the message, the Space or the account. || `cua_bench_run_completed` | `taskset` (cua-bench dataset or `custom`), `score_bucket`, `task_count`, `outcome` | Benchmark use and coarse scores. || `cua_daemon_started` | `mode`, `outcome` | Daemon startup reliability. || `cua_daemon_health` | `uptime_bucket`, `sandboxes` | Hourly aggregate health. |diff --git a/docs/content/docs/cua-sdk/reference/protocol/env-host-spaces.mdx b/docs/content/docs/cua-sdk/reference/protocol/env-host-spaces.mdxindex 62b4324c9c..5dec42165f 100644--- a/docs/content/docs/cua-sdk/reference/protocol/env-host-spaces.mdx+++ b/docs/content/docs/cua-sdk/reference/protocol/env-host-spaces.mdx@@ -250,6 +250,9 @@ The host's two independent settings and its limits.| `provide_spaces` | 2 | `bool` | The host accepts Space create, list and delete requests. || `max_spaces` | 3 | `uint32` | At most this many provided Spaces at once (0: no limit besides the runtimes' own). || `max_macos_vms` | 4 | `uint32` | At most this many macOS VMs at once on this Mac (Apple's license allows two; 0 on a host that cannot run macOS VMs). |+| `max_memory_gb` | 5 | `uint32` | The Spaces other machines create here may use at most this much memory in total, in GB (0: no limit). |+| `max_disk_gb` | 6 | `uint32` | The Spaces other machines create here may use at most this much disk in total, in GB (0: no limit). |+| `max_run_minutes` | 7 | `uint32` | A Space created here by another machine stops after running this many minutes (0: no limit). |### HostSpacesCapacity@@ -257,7 +260,7 @@ How much of one limit is in use.| Field | # | Type | Description || --- | --- | --- | --- |-| `resource` | 1 | `string` | `spaces` (every provided Space) or `macos_vms` (macOS VMs on this Mac, provided or not). |+| `resource` | 1 | `string` | `spaces` (every provided Space), `macos_vms` (macOS VMs on this Mac, provided or not), `memory_gb` or `disk_gb` (what the provided Spaces were given, in GB). || `used` | 2 | `uint32` | In use now. || `limit` | 3 | `uint32` | The limit (0: none). || `reason` | 4 | `string` | Why the limit exists, for people ("Apple's macOS license allows two macOS VMs per Mac"). |diff --git a/docs/content/docs/cua-sdk/reference/spaces/host.mdx b/docs/content/docs/cua-sdk/reference/spaces/host.mdxindex 3f28a908a9..3ee0c3d006 100644--- a/docs/content/docs/cua-sdk/reference/spaces/host.mdx+++ b/docs/content/docs/cua-sdk/reference/spaces/host.mdx@@ -925,6 +925,9 @@ A change to this machine's Spaces settings (`None` keeps a value).| `provide_spaces` / `provideSpaces` | `Option<bool>` | `None` | Provide Spaces. || `max_spaces` / `maxSpaces` | `Option<u32>` | `None` | Provided Spaces at once (0: no limit). || `max_macos_vms` / `maxMacosVms` | `Option<u32>` | `None` | macOS VMs at once (0 to 2, Apple's license). |+| `max_memory_gb` / `maxMemoryGb` | `Option<u32>` | `None` | Memory the provided Spaces may use in total, in GB (0: no limit). |+| `max_disk_gb` / `maxDiskGb` | `Option<u32>` | `None` | Disk the provided Spaces may use in total, in GB (0: no limit). |+| `max_run_minutes` / `maxRunMinutes` | `Option<u32>` | `None` | How long a provided Space may run, in minutes (0: no limit). |## `HostSetupOptions` record@@ -986,6 +989,13 @@ Returned by [`Host.configure`](#hostconfigure), [`Host.pause_signed_out`](#hostp| `provide_spaces` / `provideSpaces` | `bool` | `false` | This machine provides Spaces to your other devices. || `max_spaces` / `maxSpaces` | `u32` | `0` | Provided Spaces at once (0: no limit). || `max_macos_vms` / `maxMacosVms` | `u32` | `0` | macOS VMs at once (at most two). |+| `max_memory_gb` / `maxMemoryGb` | `u32` | `0` | Memory the provided Spaces may use in total, in GB (0: no limit). |+| `max_disk_gb` / `maxDiskGb` | `u32` | `0` | Disk the provided Spaces may use in total, in GB (0: no limit). |+| `max_run_minutes` / `maxRunMinutes` | `u32` | `0` | How long a provided Space may run, in minutes (0: no limit). |+| `used_memory_gb` / `usedMemoryGb` | `u32` | `0` | What the provided Spaces were given now, in GB. |+| `used_disk_gb` / `usedDiskGb` | `u32` | `0` | |+| `total_memory_gb` / `totalMemoryGb` | `u32` | `0` | This machine's own memory and disk, in GB (0: not known). |+| `total_disk_gb` / `totalDiskGb` | `u32` | `0` | || `provided_spaces` / `providedSpaces` | [`Vec<HostProvidedSpace>`](#hostprovidedspace-record) | `[]` | The Spaces this machine provides now. || `spaces_audit` / `spacesAudit` | [`Vec<HostSpacesAuditRecord>`](#hostspacesauditrecord-record) | `[]` | The Spaces audit, newest first. || `spaces_audit_error` / `spacesAuditError` | `Option<String>` | `None` | Set when the Spaces audit does not verify. |diff --git a/docs/content/docs/spaces/guides/add-a-computer.mdx b/docs/content/docs/spaces/guides/add-a-computer.mdxindex ae435af8e7..9c4ab0b283 100644--- a/docs/content/docs/spaces/guides/add-a-computer.mdx+++ b/docs/content/docs/spaces/guides/add-a-computer.mdx@@ -250,6 +250,8 @@ setting at any time:cua host config # show both settings and the Spaces it runscua host config --desktop on --provide-spaces on # share the desktop toocua host config --max-spaces 6 # at most 6 Spaces at once (default 4)+cua host config --max-memory 32 --max-disk 200 # at most 32 GB of memory and 200 GB of disk in total+cua host config --max-run-time 480 # a Space made here stops after 8 hours```The app's **This computer** page has the same two switches, the Spaces the@@ -353,6 +355,17 @@ the Space leaves the relay.|---|---|---|| macOS VMs on one Mac | 2 | Apple's macOS license allows two macOS VMs per Mac, and Apple Virtualization (which Lume runs on) enforces it. || Spaces at once | 4 | Set with `cua host config --max-spaces N` (0: no limit). |+| Memory in total | none | The most memory the Spaces other machines create here may use together. Set with `cua host config --max-memory GB`. |+| Disk in total | none | The most disk those Spaces may use together. Set with `cua host config --max-disk GB`. |+| Running time | none | A Space made here by another machine stops after this many minutes (`cua host config --max-run-time MINUTES`); starting it again brings it back. |++The limits count only the Spaces other machines create on this computer, not the+ones you make here yourself. They apply to everyone who asks: another machine, an+agent, or a Space that overflows from a tree of Spaces. A create past a limit is+refused with "<machine> has no room for another Space", and `on="auto"` picks+another machine or your linked cloud instead. Lowering a limit never stops a Space+that is running: it only refuses new ones, and Settings shows "Over limit" until+use drops below it. The same numbers are in **Settings**, under **Sharing**.A request past a limit fails with `limit_exceeded` and says which limit and whatto do. macOS Spaces need a Mac host: a Linux or Windows host refuses them with@@ -545,7 +558,7 @@ restarts, the Mac opens the same port again.| `ambiguous_host` | Several of your computers fit the name. | Pick one of the listed IDs: `on="host:<id>"`. || `not_found` | No computer fits the name. | Check `cua spaces ls`, or set the computer up with `--share spaces` or `--share both`. || `host_capability_missing` | The computer is offline, does not provide Spaces, or cannot run that OS. | Run `cua host config --provide-spaces on` on it, or pick another computer. |-| `limit_exceeded` | Two macOS VMs already run, or the computer is at its Space limit. | Delete one with `cua spaces delete`, or raise `--max-spaces`. |+| `limit_exceeded` | Two macOS VMs already run, or the computer is at one of its limits (Spaces, memory or disk). | Delete one with `cua spaces delete`, or raise the limit with `cua host config`. || `permission_denied` | The computer is shared with you to watch only. | Ask its owner to share it as an editor. |## If it doesn't workdiff --git a/examples/openkoalabot-example-tauri/src-tauri/Cargo.lock b/examples/openkoalabot-example-tauri/src-tauri/Cargo.lockindex eeffb8d0ac..42b0ab2776 100644--- a/examples/openkoalabot-example-tauri/src-tauri/Cargo.lock+++ b/examples/openkoalabot-example-tauri/src-tauri/Cargo.lock@@ -1723,6 +1723,7 @@ dependencies = ["cua-proto","cua-spacesd-client","flate2",+ "futures-util","hex","rand 0.9.5","serde",diff --git a/examples/streaming/rust/Cargo.lock b/examples/streaming/rust/Cargo.lockindex 2419a556ba..08b4d8b9bc 100644--- a/examples/streaming/rust/Cargo.lock+++ b/examples/streaming/rust/Cargo.lock@@ -1327,6 +1327,7 @@ dependencies = ["cua-proto","cua-spacesd-client","flate2",+ "futures-util","hex","rand 0.9.5","serde",diff --git a/libs/cua-spacesd/tests/spaces-e2e/Cargo.lock b/libs/cua-spacesd/tests/spaces-e2e/Cargo.lockindex cdfe96fbc6..8ae57f7238 100644--- a/libs/cua-spacesd/tests/spaces-e2e/Cargo.lock+++ b/libs/cua-spacesd/tests/spaces-e2e/Cargo.lock@@ -2078,6 +2078,7 @@ dependencies = ["cua-proto","cua-spacesd-client","flate2",+ "futures-util","hex","rand 0.9.5","serde",diff --git a/libs/cua-spacesd/tests/teleport-e2e/Cargo.lock b/libs/cua-spacesd/tests/teleport-e2e/Cargo.lockindex bd4fd0d331..a7e4a84989 100644--- a/libs/cua-spacesd/tests/teleport-e2e/Cargo.lock+++ b/libs/cua-spacesd/tests/teleport-e2e/Cargo.lock@@ -1357,6 +1357,7 @@ dependencies = ["cua-proto","cua-spacesd-client","flate2",+ "futures-util","hex","rand 0.9.5","serde",diff --git a/libs/cua/Cargo.lock b/libs/cua/Cargo.lockindex 4be4383ad7..91f3478e20 100644--- a/libs/cua/Cargo.lock+++ b/libs/cua/Cargo.lock@@ -2346,6 +2346,7 @@ dependencies = ["cua-proto","cua-spacesd-client","flate2",+ "futures-util","hex","rand 0.9.5","serde",diff --git a/libs/cua/crates/cua-agents/Cargo.toml b/libs/cua/crates/cua-agents/Cargo.tomlindex 6294fa8ccd..d1051e29ef 100644--- a/libs/cua/crates/cua-agents/Cargo.toml+++ b/libs/cua/crates/cua-agents/Cargo.toml@@ -16,6 +16,7 @@ serde.workspace = trueserde_json.workspace = truethiserror.workspace = truetokio = { workspace = true, features = ["time"] }+futures-util.workspace = truerand.workspace = truesha2.workspace = truehex.workspace = truediff --git a/libs/cua/crates/cua-agents/runner/acp-runner.mjs b/libs/cua/crates/cua-agents/runner/acp-runner.mjsindex 02ebf31ddd..6430f63c2c 100644--- a/libs/cua/crates/cua-agents/runner/acp-runner.mjs+++ b/libs/cua/crates/cua-agents/runner/acp-runner.mjs@@ -693,6 +693,7 @@ function startAgent() {});child = c;save({ agentPid: c.pid ?? null });+ emit("agent_spawned", { pid: c.pid ?? null });const gone = new Promise((resolve) => {let done = false;const fin = (v) => {@@ -1187,6 +1188,7 @@ async function drive(a) {}async function main() {+ emit("runner_started", {});if (durable) {emit("driver_start", {session: durable.session,diff --git a/libs/cua/crates/cua-agents/runner/test/join-phases.test.mjs b/libs/cua/crates/cua-agents/runner/test/join-phases.test.mjsnew file mode 100644index 0000000000..293d589098--- /dev/null+++ b/libs/cua/crates/cua-agents/runner/test/join-phases.test.mjs@@ -0,0 +1,43 @@+// The steps of an agent joining a Space, as the runner writes them to the+// run's events (the host reads them for `cua_agent_join_phase` and for the+// "joined" note): runner_started, agent_spawned, initialized, session,+// turn_started, the first words, turn_ended, in that order, each stamped in+// the guest. Runs the real runner against the scripted mock agent (a stub+// harness: no model, no network) and prints the per-step timings.+//+// node --test libs/cua/crates/cua-agents/runner/test/+import { test } from "node:test";+import assert from "node:assert/strict";+import { Box, sdkRoot } from "./helpers.mjs";++const sdk = sdkRoot();++test("a join writes its steps in order with guest timestamps", { skip: sdk ? false : "@agentclientprotocol/sdk is not available", timeout: 60_000 }, async () => {+ const box = new Box(sdk);+ try {+ box.script({ prompts: [{ match: ".", steps: [{ say: "hello" }] }] });+ box.config();+ const t0 = Date.now();+ const r = await box.go({ epoch: 1 });+ assert.equal(r.code, 0, r.stderr);+ const evs = box.events();+ const first = (type, pred = () => true) => evs.find((e) => e.type === type && pred(e));+ const steps = [+ ["runner_started", first("runner_started")],+ ["agent_spawned", first("agent_spawned")],+ ["initialized", first("initialized")],+ ["session", first("session")],+ ["turn_started", first("turn_started")],+ ["first words", first("update", (e) => e.update?.sessionUpdate === "agent_message_chunk")],+ ["turn_ended", first("turn_ended")],+ ];+ for (const [name, e] of steps) assert.ok(e, `${name} is written`);+ const at = steps.map(([, e]) => e.ts);+ for (let i = 1; i < at.length; i++) assert.ok(at[i] >= at[i - 1], `${steps[i][0]} comes after ${steps[i - 1][0]}`);+ assert.ok(at[0] >= t0 - 1000, "stamped by the guest clock");+ const timings = steps.map(([name, e], i) => `${name} +${e.ts - at[0]} ms`);+ console.log(`join steps (stub harness): ${timings.join(", ")}`);+ } finally {+ box.cleanup();+ }+});diff --git a/libs/cua/crates/cua-agents/src/runs.rs b/libs/cua/crates/cua-agents/src/runs.rsindex 2f8d0d83a4..1b263c6974 100644--- a/libs/cua/crates/cua-agents/src/runs.rs+++ b/libs/cua/crates/cua-agents/src/runs.rs@@ -697,20 +697,56 @@ impl Agents {};let dir = loc.resolve(&env).to_string_lossy().replace('\\', "/");let mut done = vec![];+ let mut writes: Vec<(String, Vec<u8>)> = vec![];+ use sha2::Digest;+ let mut hasher = sha2::Sha256::new();for skill in cua_agent_setup::skills::bundled() {for (rel, bytes) in cua_agent_setup::skills::files(&skill.name)? {- self.write(- &format!("{dir}/{}/{rel}", skill.name),- bytes.to_vec(),- 0o644,- )- .await?;+ hasher.update(skill.name.as_bytes());+ hasher.update(rel.as_bytes());+ hasher.update((bytes.len() as u64).to_le_bytes());+ hasher.update(bytes);+ writes.push((format!("{dir}/{}/{rel}", skill.name), bytes.to_vec()));}done.push(format!("{dir}/{}", skill.name));}+ // One marker names the bundle that is in place: a start finds it+ // current and writes nothing, instead of one call per file.+ let marker = format!("{dir}/.cua-skills-{}", hex::encode(&hasher.finalize()[..8]));+ if self.read(&marker, 0, 1).await?.is_some() {+ return Ok(done);+ }+ futures_util::future::try_join_all(+ writes+ .into_iter()+ .map(|(path, bytes)| async move { self.write(&path, bytes, 0o644).await }),+ )+ .await?;+ self.write(&marker, b"1".to_vec(), 0o644).await?;Ok(done)}+ /// Puts what every start of `h` needs in the guest, once and in+ /// parallel: the bridge pipe, the runner and the cua skills, each skipped+ /// when it is already there. Safe to run ahead of a start (when an agent+ /// is added to a Space) and again at the start.+ pub async fn prewarm(&self, h: &Harness, skills: bool) -> Result<()> {+ let (bridge, runner, skills) =+ futures_util::future::join3(self.bridge_path(), self.runner_dir(), async {+ if skills {+ self.install_skills(h).await.map(|_| ())+ } else {+ Ok(())+ }+ })+ .await;+ bridge?;+ runner?;+ // Skills are a nicety: a start notes the failure and goes on.+ let _ = skills;+ Ok(())+ }+/// Uploads the bridge pipe once per version and returns its path.async fn bridge_path(&self) -> Result<String> {use sha2::Digest;@@ -874,15 +910,6 @@ impl Agents {None => format!("{rdir}/work"),});let mut notes = vec![];- // A run without a credential fails with "Authentication required"- // only after the install; refuse it before anything is installed.- if needs_probe(h, &opts) {- // A probe that cannot run decides nothing.- let probe = self.sh(&h.auth_probe(), Duration::from_secs(30)).await.ok();- if let Some(note) = credential_check(h, probe.as_deref())? {- notes.push(note);- }- }// The run directory is private to the guest user. With a repo, the// clone creates the working directory.let mk_cwd = if opts.repo.is_some() {@@ -891,14 +918,57 @@ impl Agents {quote(&cwd)};let mk_home = home_dir.as_deref().map(quote).unwrap_or_default();- self.sh(- &format!(- "umask 077; mkdir -p {mk_cwd} {mk_home} {r}/inbox/done {r}/attachments {r}/{BRIDGE_DIR}",- r = quote(&rdir)- ),- Duration::from_secs(30),- )- .await?;+ // These guest calls do not depend on each other, so they run+ // together (they used to run one after the other): the credential+ // probe (a run without a credential fails with "Authentication+ // required" only after the install; refuse it before anything is+ // installed), the run directory, and the files every start shares+ // (bridge, runner, skills: each skipped when already in place).+ let probe = async {+ if needs_probe(h, &opts) {+ // A probe that cannot run decides nothing.+ self.sh(&h.auth_probe(), Duration::from_secs(30)).await.ok()+ } else {+ None+ }+ };+ let mkdir_script = format!(+ "umask 077; mkdir -p {mk_cwd} {mk_home} {r}/inbox/done {r}/attachments {r}/{BRIDGE_DIR}",+ r = quote(&rdir)+ );+ let mkdirs = self.sh(&mkdir_script, Duration::from_secs(30));+ let shared = async {+ let (bridge, runner, skills) = futures_util::future::join3(+ async {+ if opts.bridge {+ self.bridge_path().await.map(Some)+ } else {+ Ok(None)+ }+ },+ self.runner_dir(),+ async {+ if opts.skills.unwrap_or(true) {+ Some(self.install_skills(h).await)+ } else {+ None+ }+ },+ )+ .await;+ Ok::<_, Error>((bridge?, runner?, skills))+ };+ let (probe, mkdirs, shared) = futures_util::future::join3(probe, mkdirs, shared).await;+ if needs_probe(h, &opts)+ && let Some(note) = credential_check(h, probe.as_deref())?+ {+ notes.push(note);+ }+ mkdirs?;+ let (bridge_file, runner_dir, skills_done) = shared?;+ if let Some(Err(e)) = skills_done {+ notes.push(format!("cua skills were not installed: {e}"));+ }let endpoint = opts.endpoint.clone().map(|mut e| {if e.model.is_none() {e.model = opts.model.clone();@@ -916,14 +986,15 @@ impl Agents {if opts.durable.as_ref().is_some_and(|d| d.guard) {launch.env.extend(crate::durable::guard_env(h));}- for f in &launch.files {+ futures_util::future::try_join_all(launch.files.iter().map(|f| {let path = if f.rel.starts_with('/') {f.rel.clone()} else {format!("{rdir}/{}", f.rel)};- self.write(&path, f.body.clone(), 0o600).await?;- }+ async move { self.write(&path, f.body.clone(), 0o600).await }+ }))+ .await?;// Secrets: the caller's env, plus MCP header values.let mut secrets: BTreeMap<String, String> = opts.env.clone();// A ChatGPT sign-in copied from the person's Mac becomes the guest's@@ -946,8 +1017,7 @@ impl Agents {{servers.insert(0, g.server_for(&run_id));}- if opts.bridge {- let bridge = self.bridge_path().await?;+ if let Some(bridge) = bridge_file {servers.push(McpServer {name: BRIDGE_SERVER.into(),command: Some(format!("{}/.cua/bin/node", self.home.trim_end_matches('/'))),@@ -999,16 +1069,11 @@ impl Agents {self.write(&path, a.bytes.clone(), 0o600).await?;files.push(path);}- if opts.skills.unwrap_or(true) {- match self.install_skills(h).await {- Ok(_) => {}- Err(e) => notes.push(format!("cua skills were not installed: {e}")),- }- }+ // The run's files are uploaded together, once they are all known.+ let mut uploads: Vec<(String, Vec<u8>, u32)> = vec![];let (command, args) = match &launch.wrapper {Some(w) => {- self.write(&format!("{rdir}/agent.sh"), w.clone(), 0o700)- .await?;+ uploads.push((format!("{rdir}/agent.sh"), w.clone().into(), 0o700));("/bin/sh".to_string(), vec![format!("{rdir}/agent.sh")])}None => {@@ -1044,18 +1109,16 @@ impl Agents {"secretEnv": opts.durable.as_ref().map(|_| opts.env.keys().collect::<Vec<_>>()),"durable": opts.durable.as_ref().map(|d| d.run_section(Some(&rdir))),});- self.write(- &format!("{rdir}/run.json"),+ uploads.push((+ format!("{rdir}/run.json"),serde_json::to_vec_pretty(&run)?,0o600,- )- .await?;- self.write(- &format!("{rdir}/secrets.json"),+ ));+ uploads.push((+ format!("{rdir}/secrets.json"),serde_json::to_vec(&secrets)?,0o600,- )- .await?;+ ));let meta = RunMeta {run_id: run_id.clone(),harness: h.id.into(),@@ -1067,12 +1130,11 @@ impl Agents {home: opts.home.clone(),cred_hash: Some(credential_hash(h.id, &opts.env)),};- self.write(- &format!("{rdir}/meta.json"),+ uploads.push((+ format!("{rdir}/meta.json"),serde_json::to_vec(&meta)?,0o600,- )- .await?;+ ));if let Some(d) = &opts.durable {// A journal restored from the Cua Volume goes in before the// runner starts (its fence and plan read it at start).@@ -1084,11 +1146,9 @@ impl Agents {crate::durable::JOURNAL_FILES.join(", "))));}- self.write(&format!("{state_dir}/{name}"), body.clone(), 0o600)- .await?;+ uploads.push((format!("{state_dir}/{name}"), body.clone(), 0o600));}}- let runner_dir = self.runner_dir().await?;let script = Self::launch_script(&self.home,h,@@ -1100,8 +1160,13 @@ impl Agents {.map(|r| (r, opts.branch.as_deref(), cwd.as_str())),&launch.prelude,)?;- self.write(&format!("{rdir}/launch.sh"), script, 0o700)- .await?;+ uploads.push((format!("{rdir}/launch.sh"), script.into(), 0o700));+ futures_util::future::try_join_all(+ uploads+ .into_iter()+ .map(|(path, bytes, mode)| async move { self.write(&path, bytes, mode).await }),+ )+ .await?;let tag = self.spawn_run(&run_id).await?;Ok(Started {run_id,diff --git a/libs/cua/crates/cua-cli/src/host.rs b/libs/cua/crates/cua-cli/src/host.rsindex 314f8af582..503f65eff9 100644--- a/libs/cua/crates/cua-cli/src/host.rs+++ b/libs/cua/crates/cua-cli/src/host.rs@@ -192,7 +192,10 @@ pub enum HostCmd {cua host config# Stop sharing this desktop; keep providing Spacescua host config --desktop off --provide-spaces on- cua host config --max-spaces 6")]+ cua host config --max-spaces 6+ # Give the Spaces other machines create here at most 32 GB of memory and+ # 200 GB of disk in total, and stop each after 8 hours (0: no limit)+ cua host config --max-memory 32 --max-disk 200 --max-run-time 480")]Config {/// Share this computer's own desktop: on | off.#[arg(long, value_parser = ["on", "off"])]@@ -206,6 +209,18 @@ pub enum HostCmd {/// macOS VMs at once, 0 to 2 (Apple's license allows two per Mac).#[arg(long)]max_macos_vms: Option<u32>,+ /// Memory in GB the Spaces other machines create here may use in+ /// total (0: no limit).+ #[arg(long, value_name = "GB")]+ max_memory: Option<u32>,+ /// Disk in GB the Spaces other machines create here may use in+ /// total (0: no limit).+ #[arg(long, value_name = "GB")]+ max_disk: Option<u32>,+ /// Minutes a Space created here by another machine may run before+ /// it is stopped (0: no limit).+ #[arg(long, value_name = "MINUTES")]+ max_run_time: Option<u32>,},/// Show whether this computer is set up, the service, and who is/// connected.@@ -2021,6 +2036,38 @@ fn render_settings(s: &HostStatus, out: &mut dyn Write) {}),);+ let gb = |used: u32, max: u32, total: u32| {+ let of = if total > 0 {+ format!(" (this machine has {total} GB)")+ } else {+ String::new()+ };+ if max == 0 {+ format!("{used} GB in use, no limit{of}")+ } else {+ format!("{used} of {max} GB{of}")+ }+ };+ line(+ out,+ format!(+ " memory for those Spaces: {}",+ gb(s.used_memory_gb, s.max_memory_gb, s.total_memory_gb)+ ),+ );+ line(+ out,+ format!(+ " disk for those Spaces: {}",+ gb(s.used_disk_gb, s.max_disk_gb, s.total_disk_gb)+ ),+ );+ if s.max_run_minutes > 0 {+ line(+ out,+ format!(" each Space stops after {} minutes", s.max_run_minutes),+ );+ }} else {line(out, " provides Spaces: off");}@@ -2469,6 +2516,9 @@ pub async fn run_host_to(provide_spaces,max_spaces,max_macos_vms,+ max_memory,+ max_disk,+ max_run_time,} => {let on = |v: Option<String>| v.map(|v| v == "on");let change = cua_host::HostSettingsChange {@@ -2476,6 +2526,9 @@ pub async fn run_host_to(provide_spaces: on(provide_spaces),max_spaces,max_macos_vms,+ max_memory_gb: max_memory,+ max_disk_gb: max_disk,+ max_run_minutes: max_run_time,cua_bin: None,};let s = if change == cua_host::HostSettingsChange::default() {diff --git a/libs/cua/crates/cua-host/src/host.rs b/libs/cua/crates/cua-host/src/host.rsindex 5e6ecad855..d2fae076fe 100644--- a/libs/cua/crates/cua-host/src/host.rs+++ b/libs/cua/crates/cua-host/src/host.rs@@ -101,6 +101,12 @@ pub struct SetupOptions {pub provide_spaces: Option<bool>,/// Provided Spaces at once (`None`: [`crate::provided::DEFAULT_MAX_SPACES`]).pub max_spaces: Option<u32>,+ /// Memory the provided Spaces may use in total, in GB (`None`/0: no limit).+ pub max_memory_gb: Option<u32>,+ /// Disk the provided Spaces may use in total, in GB (`None`/0: no limit).+ pub max_disk_gb: Option<u32>,+ /// How long a provided Space may run, in minutes (`None`/0: no limit).+ pub max_run_minutes: Option<u32>,/// The `cua` CLI the driver starts the host's cua daemon with when it/// is not running (default: this executable when it is `cua`, else/// `CUA_BIN`, else `cua` on `PATH`).@@ -157,6 +163,9 @@ impl SetupOptions {share_desktop: true,provide_spaces: None,max_spaces: None,+ max_memory_gb: None,+ max_disk_gb: None,+ max_run_minutes: None,cua_bin: None,allow_any_address: false,static_relay: None,@@ -184,6 +193,9 @@ impl SetupOptions {share_desktop: true,provide_spaces: None,max_spaces: None,+ max_memory_gb: None,+ max_disk_gb: None,+ max_run_minutes: None,cua_bin: None,allow_any_address: false,static_relay: None,@@ -246,6 +258,15 @@ pub struct HostPolicy {/// macOS VMs at once on this Mac (at most two, Apple's license).#[serde(default = "default_max_macos")]pub max_macos_vms: u32,+ /// Memory the provided Spaces may use in total, in GB (0: no limit).+ #[serde(default)]+ pub max_memory_gb: u32,+ /// Disk the provided Spaces may use in total, in GB (0: no limit).+ #[serde(default)]+ pub max_disk_gb: u32,+ /// How long a provided Space may run, in minutes (0: no limit).+ #[serde(default)]+ pub max_run_minutes: u32,/// Where the driver reaches (and how it starts) this machine's cua/// daemon, which creates the provided Spaces.#[serde(default, skip_serializing_if = "Option::is_none")]@@ -310,6 +331,9 @@ impl HostPolicy {max_macos_vms: self.max_macos_vms.min(crate::provided::MACOS_VM_LICENSE_LIMIT),+ max_memory_gb: self.max_memory_gb,+ max_disk_gb: self.max_disk_gb,+ max_run_minutes: self.max_run_minutes,}}}@@ -678,6 +702,27 @@ pub struct HostStatus {/// macOS VMs at once (at most two).#[serde(default)]pub max_macos_vms: u32,+ /// Memory the provided Spaces may use in total, in GB (0: no limit).+ #[serde(default)]+ pub max_memory_gb: u32,+ /// Disk the provided Spaces may use in total, in GB (0: no limit).+ #[serde(default)]+ pub max_disk_gb: u32,+ /// How long a provided Space may run, in minutes (0: no limit).+ #[serde(default)]+ pub max_run_minutes: u32,+ /// What the provided Spaces were given now, in GB (to show as "12 of 32+ /// GB").+ #[serde(default)]+ pub used_memory_gb: u32,+ #[serde(default)]+ pub used_disk_gb: u32,+ /// This machine's memory and disk in GB, to show next to the limits+ /// (0: not known).+ #[serde(default)]+ pub total_memory_gb: u32,+ #[serde(default)]+ pub total_disk_gb: u32,/// The Spaces this machine provides now (without their secrets).#[serde(default)]pub provided_spaces: Vec<crate::provided::ProvidedSpace>,@@ -992,6 +1037,12 @@ pub struct HostSettingsChange {pub max_spaces: Option<u32>,/// macOS VMs at once (0 to 2).pub max_macos_vms: Option<u32>,+ /// Memory the provided Spaces may use in total, in GB (0: no limit).+ pub max_memory_gb: Option<u32>,+ /// Disk the provided Spaces may use in total, in GB (0: no limit).+ pub max_disk_gb: Option<u32>,+ /// How long a provided Space may run, in minutes (0: no limit).+ pub max_run_minutes: Option<u32>,/// The `cua` CLI that starts the daemon.pub cua_bin: Option<PathBuf>,}@@ -1446,6 +1497,9 @@ impl Host {.max_spaces.unwrap_or(crate::provided::DEFAULT_MAX_SPACES),max_macos_vms: crate::provided::MACOS_VM_LICENSE_LIMIT,+ max_memory_gb: opts.max_memory_gb.unwrap_or(0),+ max_disk_gb: opts.max_disk_gb.unwrap_or(0),+ max_run_minutes: opts.max_run_minutes.unwrap_or(0),spaces_daemon: Some(self.spaces_daemon(opts.cua_bin.as_deref())),direct: None,tailnet_identity: false,@@ -1475,6 +1529,9 @@ impl Host {if let Some(m) = opts.max_spaces {policy.max_spaces = m;}+ policy.max_memory_gb = opts.max_memory_gb.unwrap_or(0);+ policy.max_disk_gb = opts.max_disk_gb.unwrap_or(0);+ policy.max_run_minutes = opts.max_run_minutes.unwrap_or(0);if opts.tailnet {// The tailnet's identity: this machine's tailnet user// owns it, `--allow` names other tailnet users.@@ -1654,6 +1711,9 @@ impl Host {provide_spaces: false,max_spaces: crate::provided::DEFAULT_MAX_SPACES,max_macos_vms: crate::provided::MACOS_VM_LICENSE_LIMIT,+ max_memory_gb: 0,+ max_disk_gb: 0,+ max_run_minutes: 0,spaces_daemon: Some(self.spaces_daemon(cua_bin)),direct: Some(DirectHosting {listen: listen.to_string(),@@ -1836,6 +1896,15 @@ impl Host {if let Some(m) = change.max_macos_vms {p.max_macos_vms = m;}+ if let Some(m) = change.max_memory_gb {+ p.max_memory_gb = m;+ }+ if let Some(m) = change.max_disk_gb {+ p.max_disk_gb = m;+ }+ if let Some(m) = change.max_run_minutes {+ p.max_run_minutes = m;+ }if p.spaces_daemon.is_none() || change.cua_bin.is_some() {p.spaces_daemon = Some(self.spaces_daemon(change.cua_bin.as_deref()));}@@ -1881,6 +1950,7 @@ impl Host {};let policy = self.policy()?;let manager = self.manager_for_config(&config);+ let provided_now = crate::provided::load_provided(&self.paths.dir).unwrap_or_default();let mut status = HostStatus {configured: true,mode: Some(config.mode.clone()),@@ -1896,6 +1966,14 @@ impl Host {max_macos_vms: policy.as_ref().map_or(0, |p| p.spaces_settings().max_macos_vms),+ max_memory_gb: policy.as_ref().map_or(0, |p| p.max_memory_gb),+ max_disk_gb: policy.as_ref().map_or(0, |p| p.max_disk_gb),+ max_run_minutes: policy.as_ref().map_or(0, |p| p.max_run_minutes),+ used_memory_gb: crate::provided::gb_up(crate::provided::used_memory_mb(&provided_now)),+ used_disk_gb: crate::provided::used_disk_gb(&provided_now).min(u64::from(u32::MAX))+ as u32,+ total_memory_gb: crate::sysinfo_gb::memory(),+ total_disk_gb: crate::sysinfo_gb::disk(&self.paths.dir),provided_spaces: crate::provided::load_provided(&self.paths.dir).unwrap_or_default().iter()diff --git a/libs/cua/crates/cua-host/src/lib.rs b/libs/cua/crates/cua-host/src/lib.rsindex 0519a12094..d90ed7bdfc 100644--- a/libs/cua/crates/cua-host/src/lib.rs+++ b/libs/cua/crates/cua-host/src/lib.rs@@ -51,6 +51,7 @@ pub mod service;#[cfg(test)]mod setup_tests;pub mod spaces_api;+mod sysinfo_gb;#[cfg(any(test, feature = "testing"))]pub mod testing;#[cfg(test)]diff --git a/libs/cua/crates/cua-host/src/provided.rs b/libs/cua/crates/cua-host/src/provided.rsindex 4912da2cb3..c0d94e5a12 100644--- a/libs/cua/crates/cua-host/src/provided.rs+++ b/libs/cua/crates/cua-host/src/provided.rs@@ -50,6 +50,14 @@ pub struct HostSpacesSettings {/// At most this many macOS VMs on this Mac (never above/// [`MACOS_VM_LICENSE_LIMIT`]).pub max_macos_vms: u32,+ /// The provided Spaces may use at most this much memory in total, in GB+ /// (0: no limit).+ pub max_memory_gb: u32,+ /// The provided Spaces may use at most this much disk in total, in GB+ /// (0: no limit).+ pub max_disk_gb: u32,+ /// A provided Space may run at most this many minutes (0: no limit).+ pub max_run_minutes: u32,}impl Default for HostSpacesSettings {@@ -59,6 +67,9 @@ impl Default for HostSpacesSettings {provide_spaces: false,max_spaces: DEFAULT_MAX_SPACES,max_macos_vms: MACOS_VM_LICENSE_LIMIT,+ max_memory_gb: 0,+ max_disk_gb: 0,+ max_run_minutes: 0,}}}@@ -148,12 +159,54 @@ pub struct ProvidedSpace {/// Memory (MiB) the Space was admitted with (0: not recorded).#[serde(default, skip_serializing_if = "is_zero_u64")]pub memory_mb: u64,+ /// Disk (GiB) the Space was admitted with (0: not recorded).+ #[serde(default, skip_serializing_if = "is_zero_u32")]+ pub disk_gb: u32,/// Reached through this host's own channel (its forward listens on/// loopback), not on the host's direct address.#[serde(default, skip_serializing_if = "std::ops::Not::not")]pub routed: bool,}+/// What a Space is counted at when its record does not say: the default+/// Space (4 GiB of memory, 16 GiB of disk).+pub const DEFAULT_SPACE_MEMORY_MB: u64 = 4096;+/// See [`DEFAULT_SPACE_MEMORY_MB`].+pub const DEFAULT_SPACE_DISK_GB: u64 = 16;++/// Memory (MiB) a create asking for `asked` (0: the default) is counted at.+pub fn admitted_memory_mb(asked: u64) -> u64 {+ if asked == 0 {+ DEFAULT_SPACE_MEMORY_MB+ } else {+ asked+ }+}++/// Disk (GiB) a create asking for `asked` (0: the default) is counted at.+pub fn admitted_disk_gb(asked: u32) -> u64 {+ if asked == 0 {+ DEFAULT_SPACE_DISK_GB+ } else {+ u64::from(asked)+ }+}++/// The memory (MiB) the Spaces were admitted with.+pub fn used_memory_mb(spaces: &[ProvidedSpace]) -> u64 {+ spaces.iter().map(|s| admitted_memory_mb(s.memory_mb)).sum()+}++/// The disk (GiB) the Spaces were admitted with.+pub fn used_disk_gb(spaces: &[ProvidedSpace]) -> u64 {+ spaces.iter().map(|s| admitted_disk_gb(s.disk_gb)).sum()+}++/// MiB as whole GB, rounded up (what a limit shown in GB counts).+pub fn gb_up(mb: u64) -> u32 {+ mb.div_ceil(1024).min(u64::from(u32::MAX)) as u32+}+fn is_zero_u32(n: &u32) -> bool {*n == 0}diff --git a/libs/cua/crates/cua-host/src/sysinfo_gb.rs b/libs/cua/crates/cua-host/src/sysinfo_gb.rsnew file mode 100644index 0000000000..950c8904f2--- /dev/null+++ b/libs/cua/crates/cua-host/src/sysinfo_gb.rs@@ -0,0 +1,45 @@+//! This machine's memory and disk in whole GB, to show next to the limits a+//! host sets for the Spaces others create on it. 0 when the system does not+//! say.++use std::path::Path;++#[cfg(unix)]+const GB: u64 = 1024 * 1024 * 1024;++/// Total physical memory in GB (rounded to the nearest).+pub fn memory() -> u32 {+ #[cfg(unix)]+ {+ // SAFETY: sysconf only reads system constants.+ let (pages, size) = unsafe {+ (+ libc::sysconf(libc::_SC_PHYS_PAGES),+ libc::sysconf(libc::_SC_PAGESIZE),+ )+ };+ if pages > 0 && size > 0 {+ let bytes = pages as u64 * size as u64;+ return ((bytes + GB / 2) / GB) as u32;+ }+ }+ 0+}++/// Total size of the disk `path` is on, in GB.+pub fn disk(path: &Path) -> u32 {+ #[cfg(unix)]+ {+ use std::os::unix::ffi::OsStrExt as _;+ if let Ok(c) = std::ffi::CString::new(path.as_os_str().as_bytes()) {+ // SAFETY: `c` is a valid C string and `s` is written by statvfs.+ let mut s: libc::statvfs = unsafe { std::mem::zeroed() };+ if unsafe { libc::statvfs(c.as_ptr(), &mut s) } == 0 {+ let bytes = s.f_blocks as u64 * s.f_frsize as u64;+ return (bytes / GB) as u32;+ }+ }+ }+ let _ = path;+ 0+}diff --git a/libs/cua/crates/cua-sdk/src/native/host.rs b/libs/cua/crates/cua-sdk/src/native/host.rsindex 43a16604f2..fab44a9943 100644--- a/libs/cua/crates/cua-sdk/src/native/host.rs+++ b/libs/cua/crates/cua-sdk/src/native/host.rs@@ -375,6 +375,15 @@ pub struct HostSettingsChange {/// macOS VMs at once (0 to 2, Apple's license).#[uniffi(default = None)]pub max_macos_vms: Option<u32>,+ /// Memory the provided Spaces may use in total, in GB (0: no limit).+ #[uniffi(default = None)]+ pub max_memory_gb: Option<u32>,+ /// Disk the provided Spaces may use in total, in GB (0: no limit).+ #[uniffi(default = None)]+ pub max_disk_gb: Option<u32>,+ /// How long a provided Space may run, in minutes (0: no limit).+ #[uniffi(default = None)]+ pub max_run_minutes: Option<u32>,}/// A Space this machine provides to one of your devices.@@ -481,6 +490,25 @@ pub struct HostStatus {/// macOS VMs at once (at most two).#[uniffi(default = 0)]pub max_macos_vms: u32,+ /// Memory the provided Spaces may use in total, in GB (0: no limit).+ #[uniffi(default = 0)]+ pub max_memory_gb: u32,+ /// Disk the provided Spaces may use in total, in GB (0: no limit).+ #[uniffi(default = 0)]+ pub max_disk_gb: u32,+ /// How long a provided Space may run, in minutes (0: no limit).+ #[uniffi(default = 0)]+ pub max_run_minutes: u32,+ /// What the provided Spaces were given now, in GB.+ #[uniffi(default = 0)]+ pub used_memory_gb: u32,+ #[uniffi(default = 0)]+ pub used_disk_gb: u32,+ /// This machine's own memory and disk, in GB (0: not known).+ #[uniffi(default = 0)]+ pub total_memory_gb: u32,+ #[uniffi(default = 0)]+ pub total_disk_gb: u32,/// The Spaces this machine provides now.#[uniffi(default = [])]pub provided_spaces: Vec<HostProvidedSpace>,@@ -578,6 +606,13 @@ impl From<cua_host::HostStatus> for HostStatus {provide_spaces: s.provide_spaces,max_spaces: s.max_spaces,max_macos_vms: s.max_macos_vms,+ max_memory_gb: s.max_memory_gb,+ max_disk_gb: s.max_disk_gb,+ max_run_minutes: s.max_run_minutes,+ used_memory_gb: s.used_memory_gb,+ used_disk_gb: s.used_disk_gb,+ total_memory_gb: s.total_memory_gb,+ total_disk_gb: s.total_disk_gb,provided_spaces: s.provided_spaces.into_iter()@@ -791,6 +826,9 @@ impl Host {provide_spaces: change.provide_spaces,max_spaces: change.max_spaces,max_macos_vms: change.max_macos_vms,+ max_memory_gb: change.max_memory_gb,+ max_disk_gb: change.max_disk_gb,+ max_run_minutes: change.max_run_minutes,cua_bin: None,}).await?diff --git a/libs/cua/crates/cua-spaces-app-core/src/host.rs b/libs/cua/crates/cua-spaces-app-core/src/host.rsindex b3edddead5..50e19884cc 100644--- a/libs/cua/crates/cua-spaces-app-core/src/host.rs+++ b/libs/cua/crates/cua-spaces-app-core/src/host.rs@@ -492,6 +492,28 @@ pub struct HostState {/// macOS VMs at once (at most two; 0 off a Mac).#[serde(default)]pub max_macos_vms: u32,+ /// Memory the Spaces other machines create here may use in total, in GB+ /// (0: no limit).+ #[serde(default)]+ pub max_memory_gb: u32,+ /// Disk the Spaces other machines create here may use in total, in GB+ /// (0: no limit).+ #[serde(default)]+ pub max_disk_gb: u32,+ /// How long a Space created here by another machine may run, in minutes+ /// (0: no limit).+ #[serde(default)]+ pub max_run_minutes: u32,+ /// What those Spaces were given now, in GB.+ #[serde(default)]+ pub used_memory_gb: u32,+ #[serde(default)]+ pub used_disk_gb: u32,+ /// This machine's own memory and disk in GB (0: not known).+ #[serde(default)]+ pub total_memory_gb: u32,+ #[serde(default)]+ pub total_disk_gb: u32,/// The Spaces this machine provides now.#[serde(default)]pub provided_spaces: Vec<HostProvidedSpace>,@@ -713,6 +735,38 @@ pub fn setting_change(id: HostActionId) -> Option<HostSettingChange> {})}+/// One limit on the Spaces other machines create here, drawn as a number+/// row under the switch (Settings, Sharing).+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct HostLimitRow {+ /// `max-spaces`, `max-memory`, `max-disk` or `max-run`.+ pub id: String,+ /// "Most Spaces at once".+ pub label: String,+ /// One line under it.+ pub help: String,+ /// The limit (0: no limit).+ pub value: u32,+ /// What the number counts: `Spaces`, `GB` or `minutes`.+ pub unit: String,+ /// What is in use now ("2 of 4 Spaces", "12 of 32 GB"; "2 Spaces" with+ /// no limit); none for a limit that is about time.+ #[serde(default, skip_serializing_if = "Option::is_none")]+ pub use_text: Option<String>,+ /// This machine's own total in `unit` (memory and disk), 0 when not+ /// known.+ #[serde(default)]+ pub total: u32,+ /// Use is above the limit (it was lowered below what runs): nothing+ /// is stopped, new Spaces are refused.+ #[serde(default)]+ pub over: bool,+ /// "Over limit" while `over`.+ #[serde(default, skip_serializing_if = "Option::is_none")]+ pub over_text: Option<String>,+}+/// One of the two settings, drawn as a switch.#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]#[serde(rename_all = "camelCase")]@@ -1033,6 +1087,10 @@ pub struct HostPanelView {/// providing Spaces.#[serde(default, skip_serializing_if = "Option::is_none")]pub limits: Option<String>,+ /// The limits as number rows (Settings, Sharing), while providing+ /// Spaces: most Spaces, memory and disk in total, longest running time.+ #[serde(default, skip_serializing_if = "Vec::is_empty")]+ pub limit_rows: Vec<HostLimitRow>,/// "Spaces for your devices", while providing Spaces.#[serde(default, skip_serializing_if = "Option::is_none")]pub provided_title: Option<String>,@@ -1161,6 +1219,7 @@ pub fn panel(state: Option<&HostState>) -> HostPanelView {access_warning: None,toggles: vec![],limits: None,+ limit_rows: vec![],provided_title: None,provided: vec![],provided_empty: None,@@ -1322,6 +1381,7 @@ pub fn panel(state: Option<&HostState>) -> HostPanelView {];if s.provide_spaces {v.limits = Some(limits_line(s.max_spaces, s.max_macos_vms));+ v.limit_rows = limit_rows(s);v.provided_title = Some("Spaces from your other machines".into());v.provided = provided_rows(&s.provided_spaces);v.provided_empty = s.provided_spaces.is_empty().then(|| "None yet".into());@@ -1431,6 +1491,86 @@ pub const OTHER_ACCOUNT_NOTICE: &str = "This Mac was set up with another Cua \account, so sharing is paused. Share it with the account you are signed in to \now; its name and settings stay.";+/// The limit rows: most Spaces, memory and disk in total, longest running+/// time, each with what is in use now and "Over limit" when a limit was+/// lowered below it. No limit is `0`.+pub fn limit_rows(s: &HostState) -> Vec<HostLimitRow> {+ let over = |used: u32, limit: u32| limit > 0 && used > limit;+ let use_line = |used: u32, limit: u32, unit: &str| -> String {+ let spaces = unit == "Spaces";+ if limit == 0 {+ if spaces && used == 1 {+ "1 Space".to_string()+ } else {+ format!("{used} {unit}")+ }+ } else if spaces && limit == 1 {+ format!("{used} of 1 Space")+ } else {+ format!("{used} of {limit} {unit}")+ }+ };+ let row = |id: &str,+ label: &str,+ help: &str,+ value: u32,+ unit: &str,+ used: Option<u32>,+ total: u32| {+ let o = used.is_some_and(|u| over(u, value));+ HostLimitRow {+ id: id.into(),+ label: label.into(),+ help: help.into(),+ value,+ unit: unit.into(),+ use_text: used.map(|u| use_line(u, value, unit)),+ total,+ over: o,+ over_text: o.then(|| "Over limit".into()),+ }+ };+ let spaces_used = u32::try_from(s.provided_spaces.len()).unwrap_or(u32::MAX);+ vec![+ row(+ "max-spaces",+ "Most Spaces at once",+ "Spaces other machines create here. Yours don\u{2019}t count.",+ s.max_spaces,+ "Spaces",+ Some(spaces_used),+ 0,+ ),+ row(+ "max-memory",+ "Most memory in total",+ "What the Spaces other machines create here may use together.",+ s.max_memory_gb,+ "GB",+ Some(s.used_memory_gb),+ s.total_memory_gb,+ ),+ row(+ "max-disk",+ "Most disk in total",+ "What the Spaces other machines create here may use together.",+ s.max_disk_gb,+ "GB",+ Some(s.used_disk_gb),+ s.total_disk_gb,+ ),+ row(+ "max-run",+ "Longest a Space may run",+ "A Space made here by another machine stops after this long. Empty: no limit.",+ s.max_run_minutes,+ "minutes",+ None,+ 0,+ ),+ ]+}+/// "Up to 4 Spaces · 2 macOS VMs". The macOS part is for a Mac: a shell on/// another system drops it (the web UI's `limitsFor`).pub fn limits_line(max_spaces: u32, max_macos_vms: u32) -> String {@@ -2488,6 +2628,50 @@ mod tests {assert!(!s.busy);}+ #[test]+ fn the_limits_show_use_next_to_each_limit_and_over_limit_when_lowered() {+ let mut s = host(true, true);+ s.max_spaces = 4;+ s.provided_spaces = vec![HostProvidedSpace::default(), HostProvidedSpace::default()];+ s.max_memory_gb = 32;+ s.used_memory_gb = 12;+ s.total_memory_gb = 64;+ s.total_disk_gb = 500;+ let rows = limit_rows(&s);+ let by = |id: &str| rows.iter().find(|r| r.id == id).unwrap().clone();+ assert_eq!(by("max-spaces").use_text.as_deref(), Some("2 of 4 Spaces"));+ assert_eq!(by("max-memory").use_text.as_deref(), Some("12 of 32 GB"));+ assert_eq!((by("max-memory").total, by("max-disk").total), (64, 500));+ // No limit: the use alone, no "of".+ assert_eq!(by("max-disk").value, 0);+ assert_eq!(by("max-disk").use_text.as_deref(), Some("0 GB"));+ assert_eq!(by("max-run").use_text, None);+ assert!(rows.iter().all(|r| !r.over && r.over_text.is_none()));+ // Lowered below what runs: nothing stops, the row says so.+ s.max_spaces = 1;+ s.max_memory_gb = 8;+ let rows = limit_rows(&s);+ let r = rows.iter().find(|r| r.id == "max-spaces").unwrap();+ assert!(r.over && r.over_text.as_deref() == Some("Over limit"));+ assert_eq!(r.use_text.as_deref(), Some("2 of 1 Space"));+ assert!(rows.iter().find(|r| r.id == "max-memory").unwrap().over);+ // Equal is full, not over.+ s.max_spaces = 2;+ assert!(+ !limit_rows(&s)+ .iter()+ .find(|r| r.id == "max-spaces")+ .unwrap()+ .over+ );+ // Never a middle dot or "device" wording in what the page shows.+ let all: String = limit_rows(&s)+ .iter()+ .flat_map(|r| [r.label.clone(), r.help.clone(), r.unit.clone()])+ .collect();+ assert!(!all.contains('\u{b7}') && !all.contains("device"));+ }+fn host(desktop: bool, provide: bool) -> HostState {HostState {configured: true,diff --git a/libs/cua/crates/cua-spaces-ext/src/persistent/members.rs b/libs/cua/crates/cua-spaces-ext/src/persistent/members.rsindex 3a69552406..7a49938b65 100644--- a/libs/cua/crates/cua-spaces-ext/src/persistent/members.rs+++ b/libs/cua/crates/cua-spaces-ext/src/persistent/members.rs@@ -39,6 +39,13 @@ use cua_spaces::{Error, Result};/// How long a task claim lasts without renewal. The supervisor renews the/// claims of a session whose run is alive and working on them, so a claim/// runs out only when its session is gone.+/// The id of the desktop row of this machine ("This Mac"). It is not a Space,+/// but its page has the thread of any Space: people write there, and nothing+/// runs there (no agent is a member of it). Its thread lives on this machine+/// only: it is not mirrored to the Volume, so it never mixes with another+/// machine's.+pub const HOST_DESKTOP: &str = "this-mac";+pub const CLAIM_TTL: std::time::Duration = std::time::Duration::from_secs(120);/// The largest local file attached to a post.@@ -218,20 +225,33 @@ impl Persistent {ThreadStore::open(self.spaces.home_dir(), space)}+ /// The thread key of `space`: its Space id, or [`HOST_DESKTOP`] for the+ /// desktop row of this machine (no Space, but a page with a thread).+ fn thread_key(&self, space: &str) -> Result<String> {+ if space == HOST_DESKTOP {+ return Ok(HOST_DESKTOP.to_string());+ }+ Ok(self.spaces.resolve(space)?.to_string())+ }+/// The thread of `space` (id or name) for `caller`: an agent reaches/// only its own Space's. A thread with no local log is rebuilt from the/// Volume first (once per process).pub async fn thread(&self, caller: &Caller, space: &str) -> Result<Thread> {// Everyone the transport let in reads (guests too); writing is// checked where each entry is written ([`policy`]).- let id = self.spaces.resolve(space)?.to_string();+ let id = self.thread_key(space)?;if let Some((_, own)) = caller.agent_member()&& *own != id{return Err(denied("an agent posts only in its own Space's thread"));}let store = self.thread_store(&id);- self.rebuild_once(&store).await;+ // This machine's desktop thread stays on this machine: another+ // machine's "this-mac" is not the same place.+ if id != HOST_DESKTOP {+ self.rebuild_once(&store).await;+ }Ok(Thread {p: self.clone(),store,@@ -389,14 +409,48 @@ impl Persistent {r.setup = super::durable::setup::PENDING.into();r.setup_note.clear();})?;- self.get(&rec.name)+ let rec = self.get(&rec.name)?;+ self.prewarm_in_background(&rec);+ Ok(rec)+ }++ /// Puts the member's agent stack in its Space now, in the background,+ /// so its first message does not wait for the install. A start that+ /// begins meanwhile waits for this instead of installing twice; a+ /// Space that cannot be reached yet is left for the start.+ fn prewarm_in_background(&self, rec: &AgentRecord) {+ let Ok(rt) = tokio::runtime::Handle::try_current() else {+ return;+ };+ if super::identity::is_external(rec) {+ return;+ }+ let me = self.clone();+ let rec = rec.clone();+ rt.spawn(async move {+ let Some(h) = cua_agents::harness::harness(&rec.harness).filter(|h| h.ready) else {+ return;+ };+ let lock = super::phases::prewarm_lock(&me.dir, &rec.space, &rec.harness);+ let _held = lock.lock().await;+ let Ok(agents) = me.agents_for(&rec.space).await else {+ return;+ };+ let _ = agents.prewarm(h, true).await;+ let install = agents.ensure(h.installs, |_| {});+ match tokio::time::timeout(std::time::Duration::from_secs(600), install).await {+ Ok(Ok(_)) => tracing::debug!(agent = %rec.name, "agent stack ready ahead of its first message"),+ Ok(Err(e)) => tracing::debug!(agent = %rec.name, "prewarm install: {e}"),+ Err(_) => tracing::debug!(agent = %rec.name, "prewarm install timed out"),+ }+ });}/// The agent members of `space` with what each is doing: the member's/// `status` (`working | waiting | failed | idle | asleep | paused`, the/// busiest of its sessions) and each session's in `session_states`.pub async fn members(&self, space: &str) -> Result<Vec<Value>> {- let id = self.spaces.resolve(space)?.to_string();+ let id = self.thread_key(space)?;let recs = self.members_of(&id)?;let store = self.thread_store(&id);let fold = store.fold()?;@@ -508,31 +562,59 @@ impl Persistent {// given back. A connected agent takes its tasks from its inbox// itself. A member waiting for (or failed by) its .cua/setup, or// whose durable run is being started again elsewhere, keeps its tasks.- for rec in records.into_iter().filter(|r| {- !r.paused- && r.held_by.is_none()- && !super::identity::is_external(r)- && !r.relaunch- && r.setup != super::durable::setup::PENDING- && r.setup != super::durable::setup::FAILED- }) {- let store = self.thread_store(&rec.space);- if !store.exists() {- continue;+ let members: Vec<AgentRecord> = records+ .into_iter()+ .filter(|r| {+ !r.paused+ && r.held_by.is_none()+ && !super::identity::is_external(r)+ && !r.relaunch+ && r.setup != super::durable::setup::PENDING+ && r.setup != super::durable::setup::FAILED+ })+ .filter(|r| self.thread_store(&r.space).exists())+ .collect();+ // Each member is served on its own, so one member's cold start+ // (minutes, on first use) never holds up another member's reply.+ if self.detach_dispatch {+ for rec in members {+ let Some(guard) = super::phases::ServingGuard::take(&self.dir, &rec.name) else {+ continue; // still being served by an earlier pass+ };+ let me = self.clone();+ tokio::spawn(async move {+ let _guard = guard;+ let store = me.thread_store(&rec.space);+ match tokio::time::timeout(+ super::DISPATCH_BUDGET,+ me.dispatch_member(&rec, &store),+ )+ .await+ {+ Ok(Ok(_)) => {}+ Ok(Err(e)) => tracing::warn!("{} dispatch: {e}", rec.name),+ Err(_) => tracing::warn!("{} dispatch: timed out", rec.name),+ }+ });}- let r =- tokio::time::timeout(super::AGENT_TICK_BUDGET, self.dispatch_member(&rec, &store))- .await;+ return;+ }+ let results = futures_util::future::join_all(members.iter().map(|rec| async move {+ let store = self.thread_store(&rec.space);+ let r = tokio::time::timeout(super::DISPATCH_BUDGET, self.dispatch_member(rec, &store))+ .await;+ (rec.name.as_str(), r)+ }))+ .await;+ for (name, r) in results {match r {Ok(Ok(seqs)) => {for seq in seqs {- report.fired.push(format!("{}: task #{seq}", rec.name));+ report.fired.push(format!("{name}: task #{seq}"));}}- Ok(Err(e)) => report.errors.push(format!("{} dispatch: {e}", rec.name)),- Err(_) => report- .errors- .push(format!("{} dispatch: timed out", rec.name)),+ Ok(Err(e)) => report.errors.push(format!("{name} dispatch: {e}")),+ Err(_) => report.errors.push(format!("{name} dispatch: timed out")),}}}@@ -595,10 +677,11 @@ impl Persistent {task: &TaskInfo,entry: &str,) -> Result<Delivered> {- let base = match self.current_turn(rec).await {- Some(Some(turn)) => turn,+ let picked_ms = super::phases::now_ms();+ let (base, cold) = match self.current_turn(rec).await {+ Some(Some(turn)) => (turn, false),Some(None) => return Ok(Delivered::Busy),- None => 0,+ None => (0, true),};let holder = Holder::new(&rec.name, rec.k(), rec.drive_epoch());let dispatch = || ClaimEntries {@@ -614,7 +697,10 @@ impl Persistent {Err(e) => return Err(e),}let posted = store.get(task.seq)?;- let text = posted.map(|e| e.text).unwrap_or_else(|| task.text.clone());+ let text = posted+ .as_ref()+ .map(|e| e.text.clone())+ .unwrap_or_else(|| task.text.clone());let framed = format!("[thread #{} from {}] {text}\n\n(Your answer is posted as your reply in the Space's thread when this turn ends; the `cua` tools thread_reply, thread_post and thread_read reach the thread yourself.)",task.seq, task.author.name@@ -631,6 +717,18 @@ impl Persistent {},)};+ // How long the join takes is measured from the message.+ let posted_ms = posted.as_ref().map(|e| e.ts_ms).unwrap_or(picked_ms);+ if cold {+ super::phases::set_woke(+ &self.dir,+ &format!("{}#{}", rec.name, rec.k()),+ super::phases::Woke {+ posted_ms,+ picked_ms,+ },+ );+ }// Show it at once: a run to start is `starting`, a warm one `thinking`.self.set_stage(rec,@@ -640,15 +738,18 @@ impl Persistent {"starting"}),);- let sent = self.send_session(rec, &framed, entry).await;+ let sent = Box::pin(self.send_session(rec, &framed, entry)).await;if sent.is_err() {self.set_stage(rec, None);}match sent {Ok(d) => {let base = if d.started { 0 } else { base };- // The note ("woke up and joined") comes when the agent is up.- if d.started {+ if !d.started {+ // A follow-up to a running agent: its steps are timed too.+ Box::pin(self.follow_warm(rec, &d.run_id, posted_ms, picked_ms)).await;+ } else {+ // The note ("woke up and joined") comes when the agent is up.self.live.lock().await@@ -677,6 +778,16 @@ impl Persistent {Ok(Delivered::Busy)}Err(e) => {+ super::phases::take_woke(&self.dir, &format!("{}#{}", rec.name, rec.k()));+ if cold {+ super::phases::start_failed(+ &format!("{}/{}", rec.name, task.seq),+ &rec.harness,+ &self.runtime_word(&rec.space),+ posted_ms,+ &e.to_string(),+ );+ }// The agent answers in the thread: plain words, with the// complete error (and a Connect button when it needs a// sign-in) in `failure`.@@ -704,6 +815,27 @@ impl Persistent {}}+ /// Starts timing a follow-up to a running agent (`cua_agent_join_phase`).+ async fn follow_warm(&self, rec: &AgentRecord, run_id: &str, posted_ms: u64, picked_ms: u64) {+ if let Ok(agents) = self.cached_agents(&rec.space).await {+ super::phases::follow(+ agents,+ super::phases::Join {+ run_id: run_id.to_string(),+ harness: rec.harness.clone(),+ runtime: self.runtime_word(&rec.space),+ cold: false,+ posted_ms,+ },+ vec![+ ("posted", 0),+ ("dispatch_picked", picked_ms.saturating_sub(posted_ms)),+ ],+ 0,+ );+ }+ }+/// The turn of `rec`'s run when it can take a message: `None` (no/// run), `Some(None)` (mid turn), `Some(Some(turn))`.async fn current_turn(&self, rec: &AgentRecord) -> Option<Option<u32>> {@@ -1130,6 +1262,10 @@ impl Persistent {let owner = self.owner();for store in ThreadStore::list(self.spaces.home_dir()) {let key = store.space().to_string();+ // Not shipped to the Volume: see [`HOST_DESKTOP`].+ if key == HOST_DESKTOP {+ continue;+ }let now = cua_volume::now_ms();if self.livediff --git a/libs/cua/crates/cua-spaces-ext/src/persistent/mod.rs b/libs/cua/crates/cua-spaces-ext/src/persistent/mod.rsindex 5a4e86080d..dcc375fc17 100644--- a/libs/cua/crates/cua-spaces-ext/src/persistent/mod.rs+++ b/libs/cua/crates/cua-spaces-ext/src/persistent/mod.rs@@ -34,6 +34,8 @@ pub mod identity;pub mod join;pub mod members;pub mod notify;+pub mod phases;+pub(crate) use phases::DISPATCH_BUDGET;pub mod rights;use crate::DriveResult as _;@@ -485,6 +487,9 @@ pub struct Persistent {/// What each working session has said so far this turn, for the thread's streaming row/// (`live_rows`); gone when the turn ends (the reply is then the real entry).partials: Partials,+ /// The supervisor serves each member's queued tasks on a task of its+ /// own instead of inside its pass (see [`Persistent::detached`]).+ detach_dispatch: bool,}/// What each working session has said so far this turn, by `<space>/<name>#<session>`; shared by every@@ -534,9 +539,18 @@ impl Persistent {partials,owner,admins,+ detach_dispatch: false,}}+ /// This handle with queued tasks served on tasks of their own: a pass+ /// of [`Persistent::tick`] starts each member's delivery and goes on+ /// (the daemon's supervisor), where the default pass waits for them.+ pub fn detached(mut self) -> Persistent {+ self.detach_dispatch = true;+ self+ }+pub fn dir(&self) -> &Path {&self.dir}@@ -752,6 +766,17 @@ impl Persistent {self.agents_for(space).await}+ /// What the Space runs on, as a telemetry word.+ pub(crate) fn runtime_word(&self, space: &str) -> String {+ self.spaces+ .list()+ .ok()+ .and_then(|l| l.into_iter().find(|s| s.id == space))+ .map(|s| phases::runtime_word(&s.os, &s.kind))+ .unwrap_or("other")+ .to_string()+ }+async fn forget_space(&self, space: &str) {self.live.lock().await.agents.remove(space);let _ = self.spaces.forget_connection(space).await;@@ -887,7 +912,7 @@ impl Persistent {if restore.is_some() && !rec.policy.durable {return Err(Error::invalid(format!("{name} is not durable")));}- self.start_session(&rec, prompt, entry, restore).await+ Box::pin(self.start_session(&rec, prompt, entry, restore)).await}/// Starts a run of the session `view` shows. Session 1 is the home's@@ -923,6 +948,20 @@ impl Persistent {}};let t0 = Instant::now();+ let woke = phases::take_woke(&self.dir, &format!("{}#{k}", view.name));+ let posted_ms = woke+ .as_ref()+ .map(|w| w.posted_ms)+ .unwrap_or_else(phases::now_ms);+ let picked_ms = woke.as_ref().map(|w| w.picked_ms).unwrap_or(posted_ms);+ // A prewarm of this agent's tools that is running now finishes first.+ phases::wait_for_prewarm(+ &self.dir,+ &rec.space,+ &rec.harness,+ Duration::from_secs(300),+ )+ .await;let mounted = if k == 1 {self.mounted_home(&rec).await} else {@@ -939,9 +978,21 @@ impl Persistent {let dir = home_dir.clone().unwrap_or_else(|| agents.agent_home_dir(&rec.name));- home::restore(agents.guest(), &self.session(&rec), &rec.name, &dir).await+ // The home comes back while the files every start shares+ // (bridge, runner, skills) go in: they do not depend on it.+ let (restored, _) = futures_util::future::join(+ home::restore(agents.guest(), &self.session(&rec), &rec.name, &dir),+ async {+ if let Some(h) = cua_agents::harness::harness(&rec.harness) {+ let _ = agents.prewarm(h, true).await;+ }+ },+ )+ .await;+ restored}};+ let prepared_ms = phases::now_ms();let restored = match restored {Ok(t) => t,Err(e) => {@@ -999,6 +1050,25 @@ impl Persistent {let started = match started {Ok(s) => {cua_spaces::agents::telemetry::started(&agents, &rec.space, entry, &s);+ let spawned_ms = phases::now_ms();+ let since = |t: u64| t.saturating_sub(posted_ms);+ phases::follow(+ agents.clone(),+ phases::Join {+ run_id: s.run_id.clone(),+ harness: rec.harness.clone(),+ runtime: self.runtime_word(&rec.space),+ cold: true,+ posted_ms,+ },+ vec![+ ("posted", 0),+ ("dispatch_picked", since(picked_ms)),+ ("host_prepared", since(prepared_ms)),+ ("guest_spawned", since(spawned_ms)),+ ],+ since(spawned_ms),+ );s}Err(e) => {@@ -1096,7 +1166,7 @@ impl Persistent {_ => {}}}- self.start_session(&rec, text, entry, None).await+ Box::pin(self.start_session(&rec, text, entry, None)).await}/// Whether the idle run `run` of `rec` must not take another message:@@ -2097,13 +2167,21 @@ pub trait SpacesPersistent {/// aborted (the daemon runs one for its lifetime).fn spawn_supervisor(&self, every: Duration) -> tokio::task::JoinHandle<()> {let p = self.persistent();+ // Members are served on their own tasks (a cold start never holds+ // up the pass), and a posted task wakes the pass at once; `every`+ // is the longest the supervisor sleeps.+ let p = p.detached();+ let wake = crate::thread::supervisor_wake();tokio::spawn(async move {loop {let r = p.tick().await;for e in &r.errors {tracing::warn!("persistent agents: {e}");}- tokio::time::sleep(every).await;+ tokio::select! {+ () = tokio::time::sleep(every) => {}+ () = wake.notified() => {}+ }}})}diff --git a/libs/cua/crates/cua-spaces-ext/src/persistent/phases.rs b/libs/cua/crates/cua-spaces-ext/src/persistent/phases.rsnew file mode 100644index 0000000000..08987ee9cb--- /dev/null+++ b/libs/cua/crates/cua-spaces-ext/src/persistent/phases.rs@@ -0,0 +1,341 @@+// SPDX-License-Identifier: FSL-1.1-MIT+// Copyright (c) 2026 Cua AI, Inc.++//! How fast an agent joins a Space, step by step.+//!+//! A message for an agent that has no run yet starts one (a cold join); a+//! message for an idle run is a follow-up (a warm one). Either way the path+//! from the person's message to the agent's first words has steps: the+//! message is posted, the supervisor picks it up, the host prepares the+//! start, the runner is spawned in the guest, tools are installed, the+//! runner starts the agent, the agent initializes, authenticates and opens+//! a session, the turn starts, the first words arrive, the turn ends. Each+//! step is reported once as `cua_agent_join_phase` (only fixed words, a+//! per-install hash of the run and milliseconds since the message; see+//! `cua-telemetry`), so a slow join can be seen and fixed where it is slow.+//!+//! The host steps are timed here on the host clock. The guest steps are+//! read from the run's own `events.jsonl` (the runner timestamps each one in+//! the guest) and placed on the same line: the guest's first event is the+//! moment the runner was spawned. Install events carry whole seconds.+//!+//! This module also keeps two small registries that make joins fast:+//! the members being served right now (a member is served by one task at a+//! time), and the prewarms in flight (a start waits for the install a+//! prewarm already runs instead of repeating it).++use std::collections::{HashMap, HashSet};+use std::path::Path;+use std::sync::{Arc, Mutex, OnceLock};+use std::time::Duration;++use cua_spaces::agents::Agents;++/// Longest one member's delivery may take inside the supervisor.+pub(crate) const DISPATCH_BUDGET: Duration = Duration::from_secs(60);+/// How long the steps of one join are followed.+const FOLLOW_FOR: Duration = Duration::from_secs(15 * 60);++pub(crate) fn now_ms() -> u64 {+ cua_volume::now_ms()+}++// --- one task per member ---------------------------------------------------++fn serving() -> &'static Mutex<HashSet<String>> {+ static S: OnceLock<Mutex<HashSet<String>>> = OnceLock::new();+ S.get_or_init(Default::default)+}++/// Held while a member's queued tasks are being served.+pub(crate) struct ServingGuard(String);++impl ServingGuard {+ /// `None` when `member` is already being served.+ pub(crate) fn take(dir: &Path, member: &str) -> Option<ServingGuard> {+ let key = format!("{}\u{0}{member}", dir.display());+ let taken = serving().lock().ok()?.insert(key.clone());+ taken.then(|| ServingGuard(key))+ }+}++impl Drop for ServingGuard {+ fn drop(&mut self) {+ if let Ok(mut s) = serving().lock() {+ s.remove(&self.0);+ }+ }+}++// --- prewarm ---------------------------------------------------------------++fn prewarms() -> &'static Mutex<HashMap<String, Arc<tokio::sync::Mutex<()>>>> {+ static P: OnceLock<Mutex<HashMap<String, Arc<tokio::sync::Mutex<()>>>>> = OnceLock::new();+ P.get_or_init(Default::default)+}++fn prewarm_key(dir: &Path, space: &str, harness: &str) -> String {+ format!("{}\u{0}{space}\u{0}{harness}", dir.display())+}++/// The lock a prewarm of `harness` in `space` holds while it runs.+pub(crate) fn prewarm_lock(dir: &Path, space: &str, harness: &str) -> Arc<tokio::sync::Mutex<()>> {+ prewarms()+ .lock()+ .expect("prewarms")+ .entry(prewarm_key(dir, space, harness))+ .or_default()+ .clone()+}++/// Waits (up to `max`) for a prewarm of `harness` in `space` that is running+/// now, so a start does not install what it is installing.+pub(crate) async fn wait_for_prewarm(dir: &Path, space: &str, harness: &str, max: Duration) {+ let lock = prewarm_lock(dir, space, harness);+ let _ = tokio::time::timeout(max, lock.lock()).await;+}++// --- the message a join answers ---------------------------------------------++/// What a cold start needs to know about the message that woke the agent.+#[derive(Clone)]+pub(crate) struct Woke {+ /// When the message was posted (host clock, unix ms).+ pub posted_ms: u64,+ /// When the supervisor picked it up.+ pub picked_ms: u64,+}++fn wakes() -> &'static Mutex<HashMap<String, Woke>> {+ static W: OnceLock<Mutex<HashMap<String, Woke>>> = OnceLock::new();+ W.get_or_init(Default::default)+}++fn wake_key(dir: &Path, member: &str) -> String {+ format!("{}\u{0}{member}", dir.display())+}++/// Remembers the message `member`'s next start answers.+pub(crate) fn set_woke(dir: &Path, member: &str, w: Woke) {+ if let Ok(mut m) = wakes().lock() {+ m.insert(wake_key(dir, member), w);+ }+}++/// Takes the message `member`'s start answers, if one was remembered.+pub(crate) fn take_woke(dir: &Path, member: &str) -> Option<Woke> {+ wakes().lock().ok()?.remove(&wake_key(dir, member))+}++// --- the steps --------------------------------------------------------------++/// What a join is, for the events it sends.+#[derive(Clone)]+pub(crate) struct Join {+ pub run_id: String,+ pub harness: String,+ /// One of `cua_telemetry::schema::JOIN_RUNTIMES`.+ pub runtime: String,+ pub cold: bool,+ /// The message (host clock, unix ms).+ pub posted_ms: u64,+}++impl Join {+ fn send(&self, phase: &str, ms: u64, tool: &str, failure: &str) {+ cua_telemetry::global().agent_join_phase(+ &self.run_id,+ phase,+ &self.harness,+ &self.runtime,+ self.cold,+ ms,+ tool,+ failure,+ );+ }+}++/// The runtime word of a Space from what its handshake reported.+pub(crate) fn runtime_word(os: &str, kind: &str) -> &'static str {+ match (os, kind) {+ ("linux", "container") => "linux_container",+ ("linux", "vm") => "linux_vm",+ ("macos", _) => "macos_vm",+ ("windows", _) => "windows_vm",+ _ => "other",+ }+}++/// The failure word for an error line the runner wrote.+pub(crate) fn failure_word(text: &str) -> &'static str {+ let t = text.to_ascii_lowercase();+ if cua_agents::failure::is_auth_failure(text) || t.contains("authentication") {+ "auth"+ } else if t.contains("timed out") || t.contains("timeout") {+ "timeout"+ } else if t.contains("install") {+ "install"+ } else {+ "other"+ }+}++/// A start that failed before it had a run: the `failed` step, with what it+/// failed on (`key` stands for the run: a start with no run has no id).+pub(crate) fn start_failed(key: &str, harness: &str, runtime: &str, posted_ms: u64, error: &str) {+ cua_telemetry::global().agent_join_phase(+ key,+ "failed",+ harness,+ runtime,+ true,+ now_ms().saturating_sub(posted_ms),+ "none",+ failure_word(error),+ );+}++/// Follows `join`'s run and reports each step as it is reached, until the+/// turn ends, the run fails or exits, or [`FOLLOW_FOR`] passes. `marks` are+/// the host steps already passed (name, ms since the message);+/// `guest_spawned_ms` is when the runner was spawned (ms since the message).+/// The "woke up and joined" note is the supervisor's (it reads the same+/// events when the agent is up); this only reports timings.+pub(crate) fn follow(+ agents: Agents,+ join: Join,+ marks: Vec<(&'static str, u64)>,+ guest_spawned_ms: u64,+) {+ let Ok(rt) = tokio::runtime::Handle::try_current() else {+ return;+ };+ rt.spawn(async move {+ for (phase, ms) in &marks {+ join.send(phase, *ms, "none", "none");+ }+ let started = tokio::time::Instant::now();+ let mut cursor = 0u64;+ let mut anchor: Option<u64> = None;+ let mut turn_open = false;+ let mut seen_first_token = false;+ let mut installed: HashSet<String> = HashSet::new();+ let mut reported: HashSet<&'static str> = HashSet::new();+ let mut every = Duration::from_millis(200);+ while started.elapsed() < FOLLOW_FOR {+ let page = match agents.events(&join.run_id, cursor, 200).await {+ Ok(p) => p,+ Err(cua_agents::Error::NotFound(_)) => return,+ Err(_) => {+ tokio::time::sleep(every).await;+ continue;+ }+ };+ cursor = page.cursor;+ for ev in &page.events {+ let ts = ev.ts_ms;+ // A follow-up reads a run that has history: only what the+ // guest wrote since the message counts (a few seconds of+ // clock difference between host and guest are forgiven).+ if !join.cold && ts + 5_000 < join.posted_ms {+ continue;+ }+ // A cold run's steps are placed from the runner's spawn; a+ // warm one's by the shared clock.+ let ms = if join.cold {+ let a = *anchor.get_or_insert(ts);+ guest_spawned_ms + ts.saturating_sub(a)+ } else {+ ts.saturating_sub(join.posted_ms)+ };+ let ty = ev.raw.get("type").and_then(|t| t.as_str()).unwrap_or("");+ let once = |name: &'static str, reported: &mut HashSet<&'static str>| {+ reported.insert(name)+ };+ match ty {+ "install" => {+ let id = ev.raw.get("id").and_then(|v| v.as_str()).unwrap_or("");+ let phase = ev.raw.get("phase").and_then(|v| v.as_str()).unwrap_or("");+ if matches!(phase, "done" | "cached") && installed.insert(id.to_string()) {+ join.send("install_done", ms, id, "none");+ } else if phase == "error" {+ join.send("failed", ms, "none", "install");+ return;+ }+ }+ "runner_started" if once("runner_started", &mut reported) => {+ join.send("runner_started", ms, "none", "none")+ }+ "agent_spawned" if once("agent_spawned", &mut reported) => {+ join.send("agent_spawned", ms, "none", "none")+ }+ "initialized" if once("acp_initialized", &mut reported) => {+ join.send("acp_initialized", ms, "none", "none")+ }+ "authenticated" if once("acp_authenticated", &mut reported) => {+ join.send("acp_authenticated", ms, "none", "none")+ }+ "session" if once("session_ready", &mut reported) => {+ join.send("session_ready", ms, "none", "none");+ }+ "turn_started" => {+ turn_open = true;+ seen_first_token = false;+ if once("turn_started", &mut reported) {+ join.send("turn_started", ms, "none", "none");+ }+ }+ "update" if turn_open && !seen_first_token && ev.kind == "message" => {+ seen_first_token = true;+ join.send("first_token", ms, "none", "none");+ }+ "turn_ended" if turn_open => {+ join.send("turn_ended", ms, "none", "none");+ return;+ }+ "error" => {+ let text = ev.text.as_deref().unwrap_or("");+ join.send("failed", ms, "none", failure_word(text));+ return;+ }+ "run_exited" => return,+ _ => {}+ }+ }+ if page.caught_up {+ tokio::time::sleep(every).await;+ if started.elapsed() > Duration::from_secs(30) {+ every = Duration::from_secs(1);+ }+ }+ }+ join.send("failed", FOLLOW_FOR.as_millis() as u64, "none", "timeout");+ });+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn one_task_serves_a_member_at_a_time() {+ let dir = Path::new("/tmp/phases-test");+ let a = ServingGuard::take(dir, "claude").expect("first");+ assert!(ServingGuard::take(dir, "claude").is_none());+ assert!(ServingGuard::take(dir, "hermes").is_some());+ drop(a);+ assert!(ServingGuard::take(dir, "claude").is_some());+ }++ #[test]+ fn runtime_and_failure_words() {+ assert_eq!(runtime_word("linux", "container"), "linux_container");+ assert_eq!(runtime_word("macos", "vm"), "macos_vm");+ assert_eq!(runtime_word("", ""), "other");+ assert_eq!(failure_word("Authentication required"), "auth");+ assert_eq!(failure_word("initialize timed out"), "timeout");+ assert_eq!(failure_word("npm install failed"), "install");+ assert_eq!(failure_word("boom"), "other");+ }+}diff --git a/libs/cua/crates/cua-spaces-ext/src/thread/mod.rs b/libs/cua/crates/cua-spaces-ext/src/thread/mod.rsindex 7a698e5d8e..1647f96c0f 100644--- a/libs/cua/crates/cua-spaces-ext/src/thread/mod.rs+++ b/libs/cua/crates/cua-spaces-ext/src/thread/mod.rs@@ -779,6 +779,13 @@ fn notifiers() -> &'static Mutex<HashMap<PathBuf, Arc<tokio::sync::Notify>>> {N.get_or_init(Default::default)}+/// Wakes the agent supervisor of this process: a task was posted, so its+/// member is served now instead of at the next poll.+pub fn supervisor_wake() -> Arc<tokio::sync::Notify> {+ static W: OnceLock<Arc<tokio::sync::Notify>> = OnceLock::new();+ W.get_or_init(Default::default).clone()+}+fn fold_cache() -> &'static Mutex<HashMap<PathBuf, Fold>> {static CACHE: OnceLock<Mutex<HashMap<PathBuf, Fold>>> = OnceLock::new();CACHE.get_or_init(Default::default)@@ -952,6 +959,7 @@ impl ThreadStore {}let mut head = self.recovered_head()?;let mut out = vec![];+ let wakes = drafts.iter().any(|d| d.task.is_some());for d in drafts {let e = ThreadEntry {v: VERSION,@@ -983,6 +991,9 @@ impl ThreadStore {}self.write_head(&head)?;self.notifier().notify_waiters();+ if wakes {+ supervisor_wake().notify_one();+ }Ok(out)}diff --git a/libs/cua/crates/cua-spaces-ext/tests/agent_join.rs b/libs/cua/crates/cua-spaces-ext/tests/agent_join.rsnew file mode 100644index 0000000000..80484633cd--- /dev/null+++ b/libs/cua/crates/cua-spaces-ext/tests/agent_join.rs@@ -0,0 +1,135 @@+// SPDX-License-Identifier: FSL-1.1-MIT+// Copyright (c) 2026 Cua AI, Inc.++//! How an agent joins a Space quickly: a posted task wakes the supervisor at+//! once (no waiting for the poll), a member with no run says it is joining+//! right away (and "woke up and joined" only once it has a session), and each+//! member is served on its own. Against the in-process spacesd mock and a+//! temporary cua home (the mock runs no shell, so a start cannot finish here).++use std::time::Duration;++use cua_spaces::Spaces;+use cua_spaces::mcp::McpServer;+use cua_spaces_ext::SpacesPersistent as _;+use cua_spacesd_client::testing::{MockAuth, MockServer};+use serde_json::{Value, json};++async fn call(mcp: &McpServer, tool: &str, args: Value) -> Result<Value, (String, String)> {+ let out = Box::pin(mcp.call(tool, args)).await;+ cua_spaces::extension::outcome_json(out).map_err(|e| (e.tag().to_string(), e.to_string()))+}++struct Fx {+ _srv: MockServer,+ _home: tempfile::TempDir,+ spaces: Spaces,+ space: String,+ mcp: McpServer,+}++async fn setup() -> Fx {+ let srv = MockServer::start(MockAuth::default()).await;+ let home = tempfile::tempdir().unwrap();+ let spaces = cua_spaces_ext::register(+ Spaces::builder().home(home.path()),+ cua_volume::Drive::open_local(home.path()),+ None,+ )+ .build();+ let info = spaces+ .add(&format!("http://{}", srv.addr), None, Some("room".into()))+ .await+ .unwrap();+ let mcp = McpServer::new(spaces.clone());+ call(+ &mcp,+ "agent_add",+ json!({"space": info.id, "name": "ada", "harness": "claude-code"}),+ )+ .await+ .unwrap();+ Fx {+ _srv: srv,+ _home: home,+ spaces,+ space: info.id,+ mcp,+ }+}++/// Whether the agent has answered the task (the mock guest cannot run a+/// start, so the answer is its plain "could not start" reply).+fn answered(thread: &Value) -> bool {+ thread["entries"]+ .as_array()+ .unwrap()+ .iter()+ .any(|e| e["kind"] == "message" && e["author"]["kind"] == "agent")+}++fn notes(thread: &Value) -> Vec<String> {+ thread["entries"]+ .as_array()+ .unwrap()+ .iter()+ .filter(|e| e["kind"] == "system")+ .filter_map(|e| e["text"].as_str().map(str::to_string))+ .collect()+}++#[tokio::test(flavor = "multi_thread", worker_threads = 2)]+async fn a_posted_task_wakes_the_supervisor_without_waiting_for_the_poll() {+ let fx = setup().await;+ // The poll is a minute: only a wake can serve the task sooner.+ let supervisor = fx.spaces.spawn_supervisor(Duration::from_secs(60));+ // The first pass (it sets the member up) ends, and the supervisor sleeps.+ tokio::time::sleep(Duration::from_millis(1500)).await;+ let posted = std::time::Instant::now();+ call(+ &fx.mcp,+ "thread_post",+ json!({"space": fx.space, "text": "@ada hello"}),+ )+ .await+ .unwrap();+ // The supervisor serves it well inside the minute.+ let mut waited = None;+ for _ in 0..40 {+ let t = call(&fx.mcp, "thread_read", json!({"space": fx.space}))+ .await+ .unwrap();+ if answered(&t) {+ waited = Some(posted.elapsed());+ break;+ }+ tokio::time::sleep(Duration::from_millis(100)).await;+ }+ supervisor.abort();+ let waited = waited.expect("a posted task wakes the supervisor");+ assert!(waited < Duration::from_secs(4), "served after {waited:?}");+}++#[tokio::test(flavor = "multi_thread", worker_threads = 2)]+async fn a_member_with_no_run_is_not_said_to_have_joined_before_it_has() {+ let fx = setup().await;+ let p = fx.spaces.persistent();+ call(+ &fx.mcp,+ "thread_post",+ json!({"space": fx.space, "text": "@ada look at the flaky test"}),+ )+ .await+ .unwrap();+ // (The mock guest runs no shell, so the start itself cannot finish.)+ Box::pin(p.tick()).await;+ let t = call(&fx.mcp, "thread_read", json!({"space": fx.space}))+ .await+ .unwrap();+ assert!(answered(&t), "the failed start is answered");+ let said = notes(&t);+ assert!(+ !said.iter().any(|n| n.contains("woke up and joined")),+ "joined waits for the agent being up: {said:?}"+ );+}diff --git a/libs/cua/crates/cua-spaces-ext/tests/thread_host_desktop.rs b/libs/cua/crates/cua-spaces-ext/tests/thread_host_desktop.rsnew file mode 100644index 0000000000..b985bea1f9--- /dev/null+++ b/libs/cua/crates/cua-spaces-ext/tests/thread_host_desktop.rs@@ -0,0 +1,80 @@+// SPDX-License-Identifier: FSL-1.1-MIT+// Copyright (c) 2026 Cua AI, Inc.++//! The desktop row of this machine ("This Mac") has the thread of any+//! Space: people post and read there, though it is not a Space (nothing+//! runs there, so no agent is a member).++use cua_spaces::Spaces;+use cua_spaces::mcp::McpServer;+use serde_json::{Value, json};++async fn call(mcp: &McpServer, tool: &str, args: Value) -> Result<Value, (String, String)> {+ let out = Box::pin(mcp.call(tool, args)).await;+ cua_spaces::extension::outcome_json(out).map_err(|e| (e.tag().to_string(), e.to_string()))+}++fn mcp(home: &std::path::Path) -> McpServer {+ let spaces = cua_spaces_ext::register(+ Spaces::builder().home(home),+ cua_volume::Drive::open_local(home),+ None,+ )+ .build();+ McpServer::new(spaces)+}++#[tokio::test]+async fn this_machines_desktop_has_a_thread_people_can_post_and_read() {+ let home = tempfile::tempdir().unwrap();+ let mcp = mcp(home.path());+ let id = cua_spaces_ext::persistent::members::HOST_DESKTOP;+ assert_eq!(id, "this-mac");++ // Empty at first, and readable.+ let first = call(&mcp, "thread_read", json!({"space": id}))+ .await+ .expect("the desktop row reads like a Space");+ assert_eq!(+ first["entries"].as_array().map(Vec::len),+ Some(0),+ "{first}"+ );++ // A message is posted as the person, kept, and read back.+ let posted = call(+ &mcp,+ "thread_post",+ json!({"space": id, "text": "look at my screen"}),+ )+ .await+ .expect("a message posts");+ assert_eq!(posted["entry"]["text"], "look at my screen");+ let after = call(&mcp, "thread_read", json!({"space": id}))+ .await+ .unwrap();+ let texts: Vec<&str> = after["entries"]+ .as_array()+ .unwrap()+ .iter()+ .filter_map(|e| e["text"].as_str())+ .collect();+ assert_eq!(texts, ["look at my screen"], "{after}");++ // Its members are none (nothing runs on the desktop), and it is its own+ // thread: a Space of the same name elsewhere would not share it.+ let members = call(&mcp, "agent_members", json!({"space": id}))+ .await+ .expect("members read");+ assert_eq!(+ members["members"].as_array().map(Vec::len),+ Some(0),+ "{members}"+ );++ // An unknown name is still an error, not a thread.+ let e = call(&mcp, "thread_read", json!({"space": "no-such-space"}))+ .await+ .unwrap_err();+ assert!(!e.1.is_empty());+}diff --git a/libs/cua/crates/cua-spaces-ffi/src/app_core.rs b/libs/cua/crates/cua-spaces-ffi/src/app_core.rsindex a255cd57c6..109dc08c32 100644--- a/libs/cua/crates/cua-spaces-ffi/src/app_core.rs+++ b/libs/cua/crates/cua-spaces-ffi/src/app_core.rs@@ -507,6 +507,13 @@ pub fn app_host_state(status: cua_sdk::HostStatus) -> AppHostState {provide_spaces: status.provide_spaces,max_spaces: status.max_spaces,max_macos_vms: status.max_macos_vms,+ max_memory_gb: status.max_memory_gb,+ max_disk_gb: status.max_disk_gb,+ max_run_minutes: status.max_run_minutes,+ used_memory_gb: status.used_memory_gb,+ used_disk_gb: status.used_disk_gb,+ total_memory_gb: status.total_memory_gb,+ total_disk_gb: status.total_disk_gb,provided_spaces: status.provided_spaces.into_iter()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 bb3ee0a2d6..1676c31155 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@@ -7639,6 +7639,21 @@ pub struct AppHostState {pub max_spaces: u32,/// macOS VMs at once (at most two; 0 off a Mac).pub max_macos_vms: u32,+ /// Memory the Spaces other machines create here may use in total, in GB+ /// (0: no limit).+ pub max_memory_gb: u32,+ /// Disk the Spaces other machines create here may use in total, in GB+ /// (0: no limit).+ pub max_disk_gb: u32,+ /// How long a Space created here by another machine may run, in minutes+ /// (0: no limit).+ pub max_run_minutes: u32,+ /// What those Spaces were given now, in GB.+ pub used_memory_gb: u32,+ pub used_disk_gb: u32,+ /// This machine's own memory and disk in GB (0: not known).+ pub total_memory_gb: u32,+ pub total_disk_gb: u32,/// The Spaces this machine provides now.pub provided_spaces: Vec<AppHostProvidedSpace>,/// Remote creates, deletes and refusals, and settings changes, newest@@ -7718,6 +7733,34 @@ pub struct AppHostSettingChange {pub provide_spaces: Option<bool>,}+/// One limit on the Spaces other machines create here, drawn as a number+/// row under the switch (Settings, Sharing).+pub type AppHostLimitRow = core::host::HostLimitRow;+#[uniffi::remote(Record)]+pub struct AppHostLimitRow {+ /// `max-spaces`, `max-memory`, `max-disk` or `max-run`.+ pub id: String,+ /// "Most Spaces at once".+ pub label: String,+ /// One line under it.+ pub help: String,+ /// The limit (0: no limit).+ pub value: u32,+ /// What the number counts: `Spaces`, `GB` or `minutes`.+ pub unit: String,+ /// What is in use now ("2 of 4 Spaces", "12 of 32 GB"; "2 Spaces" with+ /// no limit); none for a limit that is about time.+ pub use_text: Option<String>,+ /// This machine's own total in `unit` (memory and disk), 0 when not+ /// known.+ pub total: u32,+ /// Use is above the limit (it was lowered below what runs): nothing+ /// is stopped, new Spaces are refused.+ pub over: bool,+ /// "Over limit" while `over`.+ pub over_text: Option<String>,+}+/// One of the two settings, drawn as a switch.pub type AppHostToggle = core::host::HostToggle;#[uniffi::remote(Record)]@@ -7849,6 +7892,9 @@ pub struct AppHostPanelView {/// The limits, one line ("Up to 4 Spaces \u{b7} 2 macOS VMs"), while/// providing Spaces.pub limits: Option<String>,+ /// The limits as number rows (Settings, Sharing), while providing+ /// Spaces: most Spaces, memory and disk in total, longest running time.+ pub limit_rows: Vec<AppHostLimitRow>,/// "Spaces for your devices", while providing Spaces.pub provided_title: Option<String>,/// One row per Space this machine provides.diff --git a/libs/cua/crates/cua-spaces/src/elastic.rs b/libs/cua/crates/cua-spaces/src/elastic.rsindex 6ad07e37e0..ca5b2140b4 100644--- a/libs/cua/crates/cua-spaces/src/elastic.rs+++ b/libs/cua/crates/cua-spaces/src/elastic.rs@@ -879,14 +879,7 @@ impl Spaces {if ch.is_some_and(|c| c.state == "cordoned") {host.ready = false;}- // At its own Space limit (`cua host config --max-spaces`): it- // takes none now, whatever its CPU and memory say.- if h.limits- .iter()- .any(|l| l.resource == "spaces" && l.limit > 0 && l.used >= l.limit)- {- host.ready = false;- }+ apply_host_limits(&mut host, &h.limits);view.ids.insert(host.name.clone(), h.id.clone());view.hosts.push(host);}@@ -2440,6 +2433,35 @@ fn paid_left(c: &CloudHost, t: u64) -> u64 {h.paid_until(t).saturating_sub(t)}+/// What the owner's limits on a machine (`cua host config --max-spaces`,+/// `--max-memory`, `--max-disk`) leave it for new Spaces: at its Space limit+/// it takes none, whatever its CPU and memory say; below its memory or disk+/// limit it takes only what is left under it. The machine's own daemon+/// refuses a create past a limit for any requester, so a plan that placed+/// one there would only be refused: the pool leaves the machine out instead+/// and the Space goes to another machine or the linked cloud.+pub(crate) fn apply_host_limits(host: &mut Host, limits: &[crate::host_spaces::HostLimit]) {+ for l in limits.iter().filter(|l| l.limit > 0) {+ let left = u64::from(l.limit.saturating_sub(l.used));+ match l.resource.as_str() {+ "spaces" if l.used >= l.limit => host.ready = false,+ "memory_gb" => {+ host.free.memory_mb = host.free.memory_mb.min(left * 1024);+ if left == 0 {+ host.ready = false;+ }+ }+ "disk_gb" => {+ host.free.disk_gb = host.free.disk_gb.min(left);+ if left == 0 {+ host.ready = false;+ }+ }+ _ => {}+ }+ }+}+fn host_of(name: &str,os: &str,@@ -2545,6 +2567,69 @@ fn resolve_target(mod tests {use super::*;+ /// A machine at one of its limits for Spaces other machines create+ /// (`cua host config --max-spaces`, `--max-memory`, `--max-disk`) is+ /// skipped by `on="auto"`: the Space goes to the other machine, and+ /// below a memory limit a machine takes only what is left under it.+ #[test]+ fn auto_placement_skips_a_machine_at_its_limit() {+ let status = cua_proto::env::v1::HostNodeStatus {+ millicpus_free: 8000,+ millicpus_total: 8000,+ memory_free_mb: 32 * 1024,+ memory_total_mb: 32 * 1024,+ kinds: vec!["container".into()],+ ..Default::default()+ };+ let limit = |resource: &str, used: u32, limit: u32| crate::host_spaces::HostLimit {+ resource: resource.into(),+ used,+ limit,+ reason: String::new(),+ };+ let place = |a_limits: &[crate::host_spaces::HostLimit]| {+ let mut a = host_of("mini", "macos", &status, None, 0);+ apply_host_limits(&mut a, a_limits);+ let b = host_of("studio", "macos", &status, None, 0);+ let r = ElasticRequest {+ cpus: Some(1),+ memory_mb: Some(4096),+ count: 1,+ caller: Caller::Batch,+ ..Default::default()+ };+ let g = detect(&r, &UsageBook::default(), "run".into());+ let plan = el::solve(&[g], &[a, b], &[], &Default::default());+ plan.assignments+ .iter()+ .map(|x| match &x.target {+ Target::Host { name } => name.clone(),+ Target::New { .. } => "new".into(),+ })+ .collect::<Vec<_>>()+ };+ // No limits, or room under them: either machine may take it.+ let open = place(&[limit("spaces", 1, 4), limit("memory_gb", 8, 32)]);+ assert_eq!(open.len(), 1, "{open:?}");+ // At its Space limit, memory limit or disk limit: the other one.+ for full in [+ limit("spaces", 4, 4),+ limit("memory_gb", 32, 32),+ limit("disk_gb", 100, 100),+ ] {+ assert_eq!(place(std::slice::from_ref(&full)), ["studio"], "{full:?}");+ }+ // Over a limit (it was lowered below what runs) is full too.+ assert_eq!(place(&[limit("spaces", 3, 2)]), ["studio"]);+ // Below the memory limit it takes only what is left under it: 2 GB+ // left cannot take a 4 GB Space.+ assert_eq!(place(&[limit("memory_gb", 30, 32)]), ["studio"]);+ // No limit (0) never skips.+ let mut a = host_of("mini", "macos", &status, None, 0);+ apply_host_limits(&mut a, &[limit("spaces", 99, 0), limit("memory_gb", 99, 0)]);+ assert!(a.ready && a.free.memory_mb == 32 * 1024);+ }+/// Live sessions left for Spaces in your cloud: the relay's count, or/// this home's cloud Spaces when more, plus creates under way; the/// refusal says the plan's numbers and how to get more.diff --git a/libs/cua/crates/cua-spaces/src/host_spaces.rs b/libs/cua/crates/cua-spaces/src/host_spaces.rsindex f125565545..b493bc4c4c 100644--- a/libs/cua/crates/cua-spaces/src/host_spaces.rs+++ b/libs/cua/crates/cua-spaces/src/host_spaces.rs@@ -370,18 +370,25 @@ const DISK_ANSWER_WITHIN: Duration = Duration::from_secs(10);struct Reserved {spaces: u32,macos: u32,+ /// Memory (MiB) and disk (GiB) of the creates in flight.+ memory_mb: u64,+ disk_gb: u64,}/// Holds a capacity slot until the Space is recorded (or the create fails).struct Slot<'a> {reserved: &'a Mutex<Reserved>,macos: bool,+ memory_mb: u64,+ disk_gb: u64,}impl Drop for Slot<'_> {fn drop(&mut self) {let mut r = self.reserved.lock().expect("reserved");r.spaces = r.spaces.saturating_sub(1);+ r.memory_mb = r.memory_mb.saturating_sub(self.memory_mb);+ r.disk_gb = r.disk_gb.saturating_sub(self.disk_gb);if self.macos {r.macos = r.macos.saturating_sub(1);}@@ -1230,6 +1237,22 @@ impl HostSpacesServer {limit: settings.max_spaces,reason: "this host's limit (`cua host config --max-spaces`)".into(),}];+ if settings.max_memory_gb > 0 {+ out.push(pb::HostSpacesCapacity {+ resource: "memory_gb".into(),+ used: gb_up(provided_memory_mb(provided) + r.memory_mb),+ limit: settings.max_memory_gb,+ reason: "this host's limit (`cua host config --max-memory`)".into(),+ });+ }+ if settings.max_disk_gb > 0 {+ out.push(pb::HostSpacesCapacity {+ resource: "disk_gb".into(),+ used: (provided_disk_gb(provided) + r.disk_gb).min(u64::from(u32::MAX)) as u32,+ limit: settings.max_disk_gb,+ reason: "this host's limit (`cua host config --max-disk`)".into(),+ });+ }if cfg!(target_os = "macos") {out.push(pb::HostSpacesCapacity {resource: "macos_vms".into(),@@ -1248,6 +1271,8 @@ impl HostSpacesServer {provided: &[ProvidedSpace],macos: bool,host_name: &str,+ memory_mb: u64,+ disk_gb: u64,) -> Result<Slot<'_>> {let settings = policy.spaces_settings();let macos_used = if macos {@@ -1259,8 +1284,32 @@ impl HostSpacesServer {let used = provided.len() as u32 + r.spaces;if settings.max_spaces > 0 && used >= settings.max_spaces {return Err(Error::LimitExceeded(format!(- "{host_name} already provides {used} Spaces, its limit (on it: `cua host config \- --max-spaces N`); delete one first"+ "{host_name} has no room for another Space: it allows {} from other machines and \+ {used} {} in use (on it: `cua host config --max-spaces N`)",+ spaces_text(settings.max_spaces),+ if used == 1 { "is" } else { "are" },+ )));+ }+ let mem_used = provided_memory_mb(provided) + r.memory_mb;+ if settings.max_memory_gb > 0+ && mem_used + memory_mb > u64::from(settings.max_memory_gb) * 1024+ {+ return Err(Error::LimitExceeded(format!(+ "{host_name} has no room for another Space: it allows {} GB of memory for Spaces \+ from other machines and {} GB are in use, so another {} GB does not fit (on it: \+ `cua host config --max-memory N`)",+ settings.max_memory_gb,+ gb_up(mem_used),+ gb_up(memory_mb),+ )));+ }+ let disk_used = provided_disk_gb(provided) + r.disk_gb;+ if settings.max_disk_gb > 0 && disk_used + disk_gb > u64::from(settings.max_disk_gb) {+ return Err(Error::LimitExceeded(format!(+ "{host_name} has no room for another Space: it allows {} GB of disk for Spaces \+ from other machines and {disk_used} GB are in use, so another {disk_gb} GB does \+ not fit (on it: `cua host config --max-disk N`)",+ settings.max_disk_gb,)));}if macos {@@ -1277,12 +1326,36 @@ impl HostSpacesServer {r.macos += 1;}r.spaces += 1;+ r.memory_mb += memory_mb;+ r.disk_gb += disk_gb;Ok(Slot {reserved: &self.reserved,macos,+ memory_mb,+ disk_gb,})}+ /// Gives the new Space the longest running time the owner set (`cua+ /// host config --max-run-time`): when it passes the cua daemon turns+ /// the Space off (`start` brings it back; nothing is deleted).+ fn limit_run_time(&self, policy: &cua_host::HostPolicy, local_space: &str) {+ let minutes = policy.spaces_settings().max_run_minutes;+ if minutes == 0 {+ return;+ }+ if let Err(e) = self.spaces.set_lifetime(+ local_space,+ Duration::from_secs(u64::from(minutes) * 60),+ Some(cua_sandbox_core::LocalExpiry::Suspend),+ ) {+ tracing::warn!(+ space = local_space,+ "could not set the running time limit: {e}"+ );+ }+ }+fn host_name(&self) -> String {self.host().config()@@ -1348,6 +1421,9 @@ impl HostSpacesServer {} else {0},+ max_memory_gb: settings.max_memory_gb,+ max_disk_gb: settings.max_disk_gb,+ max_run_minutes: settings.max_run_minutes,}),capacity: self.capacity(&policy, &all),spaces: all@@ -1536,7 +1612,14 @@ impl HostSpacesServer {.map_err(|e| self.refuse(caller, &label, place(e)))?;let provided_now = provided::load_provided(&self.host_dir())?;let slot = self- .reserve(&policy, &provided_now, macos, &host_name)+ .reserve(+ &policy,+ &provided_now,+ macos,+ &host_name,+ admitted_memory_mb(req.memory_mb),+ admitted_disk_gb(req.disk_gb),+ ).map_err(|e| self.refuse(caller, &label, e))?;// Without a Space limit (`max_spaces` 0, a cluster host), what is// free decides: the CPU and memory its jobs and Spaces do not@@ -1760,10 +1843,12 @@ impl HostSpacesServer {direct_port: port,cpus: req.cpus,memory_mb: req.memory_mb,+ disk_gb: req.disk_gb,routed,};provided::update_provided(&self.host_dir(), |all| all.push(record.clone()))?;drop(slot);+ self.limit_run_time(&policy, &record.local_space);self.audit("create",caller,@@ -1828,10 +1913,12 @@ impl HostSpacesServer {direct_port: 0,cpus: req.cpus,memory_mb: req.memory_mb,+ disk_gb: req.disk_gb,routed: false,};provided::update_provided(&self.host_dir(), |all| all.push(record.clone()))?;drop(slot);+ self.limit_run_time(&policy, &record.local_space);self.audit("create",caller,@@ -2540,6 +2627,21 @@ fn provided_reservation(host_dir: &std::path::Path) -> cua_cluster::External {ext}+use provided::{admitted_disk_gb, admitted_memory_mb, gb_up};++fn provided_memory_mb(provided: &[ProvidedSpace]) -> u64 {+ provided::used_memory_mb(provided)+}++fn provided_disk_gb(provided: &[ProvidedSpace]) -> u64 {+ provided::used_disk_gb(provided)+}++/// "1 Space", "4 Spaces".+fn spaces_text(n: u32) -> String {+ format!("{n} Space{}", if n == 1 { "" } else { "s" })+}+fn now_ms() -> u64 {std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH)diff --git a/libs/cua/crates/cua-spaces/tests/host_spaces.rs b/libs/cua/crates/cua-spaces/tests/host_spaces.rsindex 1c575473fc..ce5723f2c3 100644--- a/libs/cua/crates/cua-spaces/tests/host_spaces.rs+++ b/libs/cua/crates/cua-spaces/tests/host_spaces.rs@@ -651,6 +651,251 @@ async fn limits_two_macos_vms_per_mac_and_the_hosts_own() {assert!(e.to_string().contains("--max-spaces"), "{e}");}+/// A provided Space of `memory_mb` and `disk_gb` that exists on the host.+fn provided_of(f: &Fixture, n: u32, memory_mb: u64, disk_gb: u32) -> ProvidedSpace {+ f.rt.running+ .lock()+ .unwrap()+ .insert(format!("limit-{n}"), true);+ f.spaces+ .sandboxes()+ .state()+ .save(&cua_sandbox_core::SandboxState::Local(+ cua_sandbox_core::LocalState {+ name: format!("limit-{n}"),+ runtime_type: "fake".into(),+ status: "running".into(),+ ..Default::default()+ },+ ))+ .unwrap();+ ProvidedSpace {+ relay_machine: format!("space-limit0000{n}"),+ local_space: format!("local:limit-{n}"),+ image: "linux".into(),+ os: "linux".into(),+ created_by_account: "ada".into(),+ memory_mb,+ disk_gb,+ ..Default::default()+ }+}++async fn ask_bob(+ f: &Fixture,+ memory_mb: u64,+ disk_gb: u32,+ attach: pb::AttachRelayRequest,+) -> cua_spaces::Result<pb::HostSpace> {+ f.server+ .create(+ &bob(),+ pb::CreateHostSpaceRequest {+ image: "linux".into(),+ memory_mb,+ disk_gb,+ attach: Some(attach),+ ..Default::default()+ },+ )+ .await+}++async fn configure(f: &Fixture, change: HostSettingsChange) {+ Host::new(&f.home)+ .with_service_manager(Arc::new(FakeServiceManager::default()))+ .configure(change)+ .await+ .unwrap();+}++/// The owner's limits on the Spaces other machines create here: memory and+/// disk in total. A create past one is refused for any requester with "has+/// no room for another Space"; a limit lowered below what runs stops+/// nothing (it only refuses new ones); the use is reported live.+#[tokio::test]+async fn memory_and_disk_limits_refuse_what_does_not_fit_and_stop_nothing() {+ let f = fixture(HostProfile::Spare).await;+ provided::save_provided(&f.host_dir(), &[provided_of(&f, 1, 6144, 40)]).unwrap();+ configure(+ &f,+ HostSettingsChange {+ max_spaces: Some(0),+ max_memory_gb: Some(8),+ max_disk_gb: Some(100),+ ..Default::default()+ },+ )+ .await;+ // 6 GB are given out of 8: another 4 GB does not fit, whoever asks (an+ // editor of the machine, as an agent or a child Space's overflow would).+ for (who, id) in [(bob(), "space-mem00001"), (ada(), "space-mem00002")] {+ let e = f+ .server+ .create(+ &who,+ pb::CreateHostSpaceRequest {+ image: "linux".into(),+ memory_mb: 4096,+ attach: Some(f.register("ada-token", id).await),+ ..Default::default()+ },+ )+ .await+ .unwrap_err();+ assert_eq!(e.tag(), "limit_exceeded", "{e}");+ let m = e.to_string();+ assert!(m.contains("has no room for another Space"), "{m}");+ assert!(+ m.contains("Mac mini (spare)") && m.contains("--max-memory"),+ "{m}"+ );+ }+ assert!(f.rt.started.lock().unwrap().is_empty(), "nothing started");+ assert_eq!(f.audit().last().unwrap().0, "refused");+ // A smaller one fits exactly (6 + 2 = 8 GB), and the use says so.+ ask_bob(+ &f,+ 2048,+ 10,+ f.register("ada-token", "space-mem00003").await,+ )+ .await+ .unwrap();+ let caps = f.server.get(&ada()).await.unwrap().capacity;+ let c = |r: &str| {+ caps.iter()+ .find(|c| c.resource == r)+ .map(|c| (c.used, c.limit))+ };+ assert_eq!(c("memory_gb"), Some((8, 8)));+ assert_eq!(c("disk_gb"), Some((50, 100)));+ assert_eq!(c("spaces"), Some((2, 0)));+ // Disk: 50 of 100 GB are given; lowering the limit to 30 stops nothing,+ // shows as over, and refuses the next one.+ configure(+ &f,+ HostSettingsChange {+ max_disk_gb: Some(30),+ max_memory_gb: Some(0),+ ..Default::default()+ },+ )+ .await;+ let caps = f.server.get(&ada()).await.unwrap().capacity;+ assert_eq!(+ caps.iter()+ .find(|c| c.resource == "disk_gb")+ .map(|c| (c.used, c.limit)),+ Some((50, 30))+ );+ let e = ask_bob(&f, 1024, 5, f.register("ada-token", "space-disk0001").await)+ .await+ .unwrap_err();+ assert_eq!(e.tag(), "limit_exceeded", "{e}");+ assert!(+ e.to_string().contains("has no room for another Space"),+ "{e}"+ );+ assert!(e.to_string().contains("--max-disk"), "{e}");+ assert!(+ f.rt.deleted.lock().unwrap().is_empty(),+ "nothing was stopped or removed"+ );+ assert_eq!(provided::load_provided(&f.host_dir()).unwrap().len(), 2);+ // No limit (0) gives the room back.+ configure(+ &f,+ HostSettingsChange {+ max_disk_gb: Some(0),+ max_memory_gb: Some(0),+ ..Default::default()+ },+ )+ .await;+ ask_bob(&f, 1024, 5, f.register("ada-token", "space-disk0002").await)+ .await+ .unwrap();+}++/// The owner's Space limit is refused with the same words, and a Space+/// made here by another machine gets the longest running time the owner set.+#[tokio::test]+async fn the_space_limit_says_no_room_and_a_run_time_limit_ends_a_space() {+ let f = fixture(HostProfile::Spare).await;+ provided::save_provided(&f.host_dir(), &[provided_of(&f, 1, 0, 0)]).unwrap();+ configure(+ &f,+ HostSettingsChange {+ max_spaces: Some(1),+ max_run_minutes: Some(5),+ ..Default::default()+ },+ )+ .await;+ let e = f+ .create(+ &ada(),+ "linux",+ f.register("ada-token", "space-room00001").await,+ )+ .await+ .unwrap_err();+ assert_eq!(e.tag(), "limit_exceeded", "{e}");+ assert!(+ e.to_string().contains("has no room for another Space"),+ "{e}"+ );+ assert!(e.to_string().contains("--max-spaces"), "{e}");+ configure(+ &f,+ HostSettingsChange {+ max_spaces: Some(3),+ ..Default::default()+ },+ )+ .await;+ let made = f+ .create(+ &ada(),+ "linux",+ f.register("ada-token", "space-room00002").await,+ )+ .await+ .unwrap();+ let life = f+ .spaces+ .lifetime(&made.local_space)+ .expect("a running time limit");+ assert_eq!(life.on_expire, "suspend", "turned off, not deleted");+ let left = life+ .expires_at()+ .duration_since(std::time::SystemTime::now())+ .unwrap();+ assert!(+ left > std::time::Duration::from_secs(240) && left <= std::time::Duration::from_secs(300),+ "{left:?}"+ );+ // Without the limit a Space has no lifetime.+ configure(+ &f,+ HostSettingsChange {+ max_run_minutes: Some(0),+ ..Default::default()+ },+ )+ .await;+ let free = f+ .create(+ &ada(),+ "linux",+ f.register("ada-token", "space-room00003").await,+ )+ .await+ .unwrap();+ assert!(f.spaces.lifetime(&free.local_space).is_none());+}+/// The owner deleting a provided Space on the host itself takes it off the/// relay and the host's list too; a host that still provides Spaces is not/// removed out from under them.diff --git a/libs/cua/crates/cua-spacesd-html5/web/src/gen/cua/env/v1/host_pb.ts b/libs/cua/crates/cua-spacesd-html5/web/src/gen/cua/env/v1/host_pb.tsindex 616347cd5a..1d0c257f58 100644--- a/libs/cua/crates/cua-spacesd-html5/web/src/gen/cua/env/v1/host_pb.ts+++ b/libs/cua/crates/cua-spacesd-html5/web/src/gen/cua/env/v1/host_pb.ts@@ -20,7 +20,7 @@ import type { Message } from "@bufbuild/protobuf";* Describes the file cua/env/v1/host.proto.*/export const file_cua_env_v1_host: GenFile = /*@__PURE__*/- fileDesc("ChVjdWEvZW52L3YxL2hvc3QucHJvdG8SCmN1YS5lbnYudjEiJgoTRGlhZ25vc2VIb3N0UmVxdWVzdBIPCgdtYWNoaW5lGAEgASgJImMKFERpYWdub3NlSG9zdFJlc3BvbnNlEioKBnJlcG9ydBgBIAEoCzIaLmN1YS5lbnYudjEuRGlhZ25vc2VSZXBvcnQSEwoLY3VhX3ZlcnNpb24YAiABKAkSCgoCb3MYAyABKAkibgoSSG9zdFNwYWNlc1NldHRpbmdzEhUKDXNoYXJlX2Rlc2t0b3AYASABKAgSFgoOcHJvdmlkZV9zcGFjZXMYAiABKAgSEgoKbWF4X3NwYWNlcxgDIAEoDRIVCg1tYXhfbWFjb3Nfdm1zGAQgASgNIlMKEkhvc3RTcGFjZXNDYXBhY2l0eRIQCghyZXNvdXJjZRgBIAEoCRIMCgR1c2VkGAIgASgNEg0KBWxpbWl0GAMgASgNEg4KBnJlYXNvbhgEIAEoCSKoAgoJSG9zdFNwYWNlEhUKDXJlbGF5X21hY2hpbmUYASABKAkSEwoLbG9jYWxfc3BhY2UYAiABKAkSDAoEbmFtZRgDIAEoCRINCgVpbWFnZRgE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YWRUb29sEiEuY3VhLmVudi52MS5DYWxsVGhyZWFkVG9vbFJlcXVlc3QaIi5jdWEuZW52LnYxLkNhbGxUaHJlYWRUb29sUmVzcG9uc2ViBnByb3RvMw", [file_cua_env_v1_capacity, file_cua_env_v1_diagnose, file_cua_env_v1_host_egress, file_cua_env_v1_system, file_cua_env_v1_warm]);/*** Request for `HostSpacesService.DiagnoseHost`.@@ -117,6 +117,30 @@ export type HostSpacesSettings = Message<"cua.env.v1.HostSpacesSettings"> & {* @generated from field: uint32 max_macos_vms = 4;*/maxMacosVms: number;++ /**+ * The Spaces other machines create here may use at most this much memory+ * in total, in GB (0: no limit).+ *+ * @generated from field: uint32 max_memory_gb = 5;+ */+ maxMemoryGb: number;++ /**+ * The Spaces other machines create here may use at most this much disk in+ * total, in GB (0: no limit).+ *+ * @generated from field: uint32 max_disk_gb = 6;+ */+ maxDiskGb: number;++ /**+ * A Space created here by another machine stops after running this many+ * minutes (0: no limit).+ *+ * @generated from field: uint32 max_run_minutes = 7;+ */+ maxRunMinutes: number;};/**@@ -133,8 +157,9 @@ export const HostSpacesSettingsSchema: GenMessage<HostSpacesSettings> = /*@__PUR*/export type HostSpacesCapacity = Message<"cua.env.v1.HostSpacesCapacity"> & {/**- * `spaces` (every provided Space) or `macos_vms` (macOS VMs on this Mac,- * provided or not).+ * `spaces` (every provided Space), `macos_vms` (macOS VMs on this Mac,+ * provided or not), `memory_gb` or `disk_gb` (what the provided Spaces+ * were given, in GB).** @generated from field: string resource = 1;*/diff --git a/libs/cua/crates/cua-telemetry/src/agent_runs.rs b/libs/cua/crates/cua-telemetry/src/agent_runs.rsindex 84c7612a04..dd9dc9d88d 100644--- a/libs/cua/crates/cua-telemetry/src/agent_runs.rs+++ b/libs/cua/crates/cua-telemetry/src/agent_runs.rs@@ -123,6 +123,41 @@ impl Telemetry {))}+ /// An agent joining a Space reached `phase` (see+ /// [`crate::schema::JOIN_PHASES`]), `ms_since_post` after the message+ /// that woke it. One event per phase; the run is sent as a per-install+ /// salted hash, never its id, and nothing about the Space or the message.+ #[allow(clippy::too_many_arguments)]+ pub fn agent_join_phase(+ &self,+ run_id: &str,+ phase: &str,+ harness: &str,+ runtime: &str,+ cold: bool,+ ms_since_post: u64,+ tool: &str,+ failure: &str,+ ) -> Captured {+ if self.in_agent_run() || !self.is_enabled() {+ return Captured::Disabled;+ }+ let run = self.identity().hash("agent_join_run", run_id);+ match events::agent_join_phase(+ phase,+ harness,+ runtime,+ cold,+ ms_since_post,+ &run,+ tool,+ failure,+ ) {+ Some(ev) => self.capture(ev),+ None => Captured::Invalid(format!("unknown join phase {phase}")),+ }+ }+/// Whether this install started `run_id` and has not seen it end yet.pub fn agent_run_pending(&self, run_id: &str) -> bool {self.pending_path(run_id).is_some_and(|p| p.exists())diff --git a/libs/cua/crates/cua-telemetry/src/client.rs b/libs/cua/crates/cua-telemetry/src/client.rsindex e3f3f47d5b..df78fe333c 100644--- a/libs/cua/crates/cua-telemetry/src/client.rs+++ b/libs/cua/crates/cua-telemetry/src/client.rs@@ -581,7 +581,7 @@ impl Telemetry {false}- fn identity(&self) -> Identity {+ pub(crate) fn identity(&self) -> Identity {let mut g = lock(&self.inner.identity);if let Some(i) = g.as_ref() {return i.clone();diff --git a/libs/cua/crates/cua-telemetry/src/events.rs b/libs/cua/crates/cua-telemetry/src/events.rsindex 2bf656d2a0..9cc6f12b5c 100644--- a/libs/cua/crates/cua-telemetry/src/events.rs+++ b/libs/cua/crates/cua-telemetry/src/events.rs@@ -708,6 +708,36 @@ pub fn agent_run_started()}+/// `cua_agent_join_phase`: an agent joining a Space reached `phase`+/// (one of [`schema::JOIN_PHASES`]) `ms_since_post` after the message that+/// woke it. `run` is the salted hash of the run (see+/// [`crate::Telemetry::agent_join_phase`]); `tool` is the installed tool for+/// `install_done`; `failure` a fixed word for a `failed` phase.+#[allow(clippy::too_many_arguments)]+pub fn agent_join_phase(+ phase: &str,+ harness_id: &str,+ runtime_id: &str,+ cold: bool,+ ms_since_post: u64,+ run: &str,+ tool: &str,+ failure: &str,+) -> Option<Event> {+ let phase = schema::JOIN_PHASES.iter().copied().find(|p| *p == phase)?;+ Some(+ Event::new(event::AGENT_JOIN_PHASE)+ .s("phase", phase)+ .s("harness", harness(harness_id))+ .s("runtime", pick(schema::JOIN_RUNTIMES, runtime_id, "other"))+ .b("cold", cold)+ .n("ms_since_post", ms_since_post.min(3_600_000))+ .owned("run", run.to_string())+ .s("tool", pick(schema::JOIN_TOOLS, tool, "other"))+ .s("failure", pick(schema::JOIN_FAILURES, failure, "other")),+ )+}+/// `cua_agent_run_completed`: a run's first turn ended (or the run failed,/// crashed or was stopped first).pub fn agent_run_completed(diff --git a/libs/cua/crates/cua-telemetry/src/schema.rs b/libs/cua/crates/cua-telemetry/src/schema.rsindex 22ddfd447b..1e43808837 100644--- a/libs/cua/crates/cua-telemetry/src/schema.rs+++ b/libs/cua/crates/cua-telemetry/src/schema.rs@@ -664,6 +664,55 @@ pub const HARNESSES: &[&str] = &["openclaw","other",];+/// The steps of an agent joining a Space, in order (`cua_agent_join_phase`).+pub const JOIN_PHASES: &[&str] = &[+ "posted",+ "dispatch_picked",+ "host_prepared",+ "guest_spawned",+ "install_done",+ "runner_started",+ "agent_spawned",+ "acp_initialized",+ "acp_authenticated",+ "session_ready",+ "turn_started",+ "first_token",+ "turn_ended",+ "failed",+];+/// What the Space an agent joined runs on: the guest OS and whether it is a+/// container or a VM, `other` when not known.+pub const JOIN_RUNTIMES: &[&str] = &[+ "linux_container",+ "linux_vm",+ "macos_vm",+ "windows_vm",+ "other",+];+/// What an agent's join failed on: a sign-in, an install, a timeout, or+/// anything else. `none` for a step that worked.+pub const JOIN_FAILURES: &[&str] = &["none", "auth", "install", "timeout", "other"];+/// The tools an agent's start installs (`cua-agents` installables), `other`+/// for any other, `none` for a phase that is not an install.+pub const JOIN_TOOLS: &[&str] = &[+ "none",+ "node",+ "uv",+ "acp-sdk",+ "mcp-remote",+ "claude-agent-acp",+ "claude-code",+ "codex-acp",+ "gemini-cli",+ "opencode",+ "pi",+ "openclaw",+ "goose",+ "hermes",+ "antigravity-acp",+ "other",+];/// Agents whose sign-in Connect copies into Keyvault on This Mac/// (`cua-agent-setup` ids), or `other`.pub const SIGNIN_HARNESSES: &[&str] = &["hermes", "claude-code", "codex", "other"];@@ -873,6 +922,7 @@ pub mod event {pub const ONBOARDING_STEP: &str = "cua_onboarding_step";pub const AGENT_RUN_STARTED: &str = "cua_agent_run_started";pub const AGENT_RUN_COMPLETED: &str = "cua_agent_run_completed";+ pub const AGENT_JOIN_PHASE: &str = "cua_agent_join_phase";pub const BENCH_RUN_COMPLETED: &str = "cua_bench_run_completed";pub const DAEMON_STARTED: &str = "cua_daemon_started";pub const DAEMON_HEALTH: &str = "cua_daemon_health";@@ -1239,6 +1289,52 @@ pub const EVENTS: &[EventSpec] = &[],purpose: "Activation (first agent run) and which coding-agent harnesses finish their first turn, and how reliably. Sent once per run, by the install that started it.",},+ EventSpec {+ name: event::AGENT_JOIN_PHASE,+ version: 1,+ tier: Tier::Usage,+ sample_rate: 1.0,+ products: AGENT_PRODUCTS,+ props: &[+ p(+ "phase",+ Kind::Enum(JOIN_PHASES),+ "The step of an agent joining a Space that was just reached (posted, dispatch_picked, host_prepared, guest_spawned, install_done, runner_started, agent_spawned, acp_initialized, acp_authenticated, session_ready, turn_started, first_token, turn_ended) or failed.",+ ),+ AGENT_HARNESS,+ p(+ "runtime",+ Kind::Enum(JOIN_RUNTIMES),+ "What the Space the agent joined runs on: linux_container, linux_vm, macos_vm, windows_vm or other.",+ ),+ p(+ "cold",+ Kind::Bool,+ "The agent had to start from nothing (no run to send to), not a follow-up to a running agent.",+ ),+ p(+ "ms_since_post",+ Kind::Count { max: 3_600_000 },+ "Milliseconds from the message that woke the agent to this step.",+ ),+ p(+ "run",+ Kind::SaltedHash,+ "A per-install salted hash of the run, so the steps of one join can be put together. Not the run id.",+ ),+ p(+ "tool",+ Kind::Enum(JOIN_TOOLS),+ "install_done only: which tool was installed (or found cached); none otherwise.",+ ),+ p(+ "failure",+ Kind::Enum(JOIN_FAILURES),+ "failed only: auth, install, timeout or other; none otherwise. Never the message.",+ ),+ ],+ purpose: "How long an agent takes to join a Space and answer, step by step, per agent and runtime, cold and warm; where joins fail.",+ },EventSpec {name: event::BENCH_RUN_COMPLETED,version: 1,diff --git a/libs/cua/crates/cua-telemetry/tests/privacy.rs b/libs/cua/crates/cua-telemetry/tests/privacy.rsindex fbd968bb12..7b0c398561 100644--- a/libs/cua/crates/cua-telemetry/tests/privacy.rs+++ b/libs/cua/crates/cua-telemetry/tests/privacy.rs@@ -254,6 +254,58 @@ fn all_builders(s: &str) -> Vec<Event> {v.push(events::plan_limit_shown("app_create", "sessions", "team"));v.push(events::upgrade_link_opened(s, s, s));v.push(events::upgrade_link_opened("cli_limit", "", "pro"));+ v.push(+ events::agent_join_phase(+ "session_ready",+ "claude-code",+ "linux_container",+ true,+ 4200,+ "0123456789abcdef",+ "none",+ "none",+ )+ .unwrap(),+ );+ v.push(+ events::agent_join_phase(+ "install_done",+ s,+ s,+ false,+ 99_999_999,+ "0123456789abcdef",+ s,+ s,+ )+ .unwrap(),+ );+ v.push(+ events::agent_join_phase(+ "failed",+ "hermes",+ "macos_vm",+ true,+ 10,+ "0123456789abcdef",+ "none",+ "auth",+ )+ .unwrap(),+ );+ assert!(+ events::agent_join_phase(+ s,+ "hermes",+ "macos_vm",+ true,+ 10,+ "0123456789abcdef",+ "none",+ "none"+ )+ .is_none()+ );v.push(events::agent_signin_imported("codex"));v.push(events::agent_signin_imported(s));v.push(events::agent_used_space("space_bash").unwrap());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 856c4e0543..15c6a56b32 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@@ -36605,6 +36605,21 @@ data class HostSettingsChange (* macOS VMs at once (0 to 2, Apple's license).*/var `maxMacosVms`: kotlin.UInt? = null+ ,+ /**+ * Memory the provided Spaces may use in total, in GB (0: no limit).+ */+ var `maxMemoryGb`: kotlin.UInt? = null+ ,+ /**+ * Disk the provided Spaces may use in total, in GB (0: no limit).+ */+ var `maxDiskGb`: kotlin.UInt? = null+ ,+ /**+ * How long a provided Space may run, in minutes (0: no limit).+ */+ var `maxRunMinutes`: kotlin.UInt? = null){@@ -36625,6 +36640,9 @@ public object FfiConverterTypeHostSettingsChange: FfiConverterRustBuffer<HostSetFfiConverterOptionalBoolean.read(buf),FfiConverterOptionalUInt.read(buf),FfiConverterOptionalUInt.read(buf),+ FfiConverterOptionalUInt.read(buf),+ FfiConverterOptionalUInt.read(buf),+ FfiConverterOptionalUInt.read(buf),)}@@ -36632,7 +36650,10 @@ public object FfiConverterTypeHostSettingsChange: FfiConverterRustBuffer<HostSetFfiConverterOptionalBoolean.allocationSize(value.`shareDesktop`) +FfiConverterOptionalBoolean.allocationSize(value.`provideSpaces`) +FfiConverterOptionalUInt.allocationSize(value.`maxSpaces`) +- FfiConverterOptionalUInt.allocationSize(value.`maxMacosVms`)+ FfiConverterOptionalUInt.allocationSize(value.`maxMacosVms`) ++ FfiConverterOptionalUInt.allocationSize(value.`maxMemoryGb`) ++ FfiConverterOptionalUInt.allocationSize(value.`maxDiskGb`) ++ FfiConverterOptionalUInt.allocationSize(value.`maxRunMinutes`))override fun write(value: HostSettingsChange, buf: ByteBuffer) {@@ -36640,6 +36661,9 @@ public object FfiConverterTypeHostSettingsChange: FfiConverterRustBuffer<HostSetFfiConverterOptionalBoolean.write(value.`provideSpaces`, buf)FfiConverterOptionalUInt.write(value.`maxSpaces`, buf)FfiConverterOptionalUInt.write(value.`maxMacosVms`, buf)+ FfiConverterOptionalUInt.write(value.`maxMemoryGb`, buf)+ FfiConverterOptionalUInt.write(value.`maxDiskGb`, buf)+ FfiConverterOptionalUInt.write(value.`maxRunMinutes`, buf)}}@@ -36947,6 +36971,35 @@ data class HostStatus (*/var `maxMacosVms`: kotlin.UInt = 0u,+ /**+ * Memory the provided Spaces may use in total, in GB (0: no limit).+ */+ var `maxMemoryGb`: kotlin.UInt = 0u+ ,+ /**+ * Disk the provided Spaces may use in total, in GB (0: no limit).+ */+ var `maxDiskGb`: kotlin.UInt = 0u+ ,+ /**+ * How long a provided Space may run, in minutes (0: no limit).+ */+ var `maxRunMinutes`: kotlin.UInt = 0u+ ,+ /**+ * What the provided Spaces were given now, in GB.+ */+ var `usedMemoryGb`: kotlin.UInt = 0u+ ,+ var `usedDiskGb`: kotlin.UInt = 0u+ ,+ /**+ * This machine's own memory and disk, in GB (0: not known).+ */+ var `totalMemoryGb`: kotlin.UInt = 0u+ ,+ var `totalDiskGb`: kotlin.UInt = 0u+ ,/*** The Spaces this machine provides now.*/@@ -37026,6 +37079,13 @@ public object FfiConverterTypeHostStatus: FfiConverterRustBuffer<HostStatus> {FfiConverterBoolean.read(buf),FfiConverterUInt.read(buf),FfiConverterUInt.read(buf),+ FfiConverterUInt.read(buf),+ FfiConverterUInt.read(buf),+ FfiConverterUInt.read(buf),+ FfiConverterUInt.read(buf),+ FfiConverterUInt.read(buf),+ FfiConverterUInt.read(buf),+ FfiConverterUInt.read(buf),FfiConverterSequenceTypeHostProvidedSpace.read(buf),FfiConverterSequenceTypeHostSpacesAuditRecord.read(buf),FfiConverterOptionalString.read(buf),@@ -37060,6 +37120,13 @@ public object FfiConverterTypeHostStatus: FfiConverterRustBuffer<HostStatus> {FfiConverterBoolean.allocationSize(value.`provideSpaces`) +FfiConverterUInt.allocationSize(value.`maxSpaces`) +FfiConverterUInt.allocationSize(value.`maxMacosVms`) ++ FfiConverterUInt.allocationSize(value.`maxMemoryGb`) ++ FfiConverterUInt.allocationSize(value.`maxDiskGb`) ++ FfiConverterUInt.allocationSize(value.`maxRunMinutes`) ++ FfiConverterUInt.allocationSize(value.`usedMemoryGb`) ++ FfiConverterUInt.allocationSize(value.`usedDiskGb`) ++ FfiConverterUInt.allocationSize(value.`totalMemoryGb`) ++ FfiConverterUInt.allocationSize(value.`totalDiskGb`) +FfiConverterSequenceTypeHostProvidedSpace.allocationSize(value.`providedSpaces`) +FfiConverterSequenceTypeHostSpacesAuditRecord.allocationSize(value.`spacesAudit`) +FfiConverterOptionalString.allocationSize(value.`spacesAuditError`) +@@ -37093,6 +37160,13 @@ public object FfiConverterTypeHostStatus: FfiConverterRustBuffer<HostStatus> {FfiConverterBoolean.write(value.`provideSpaces`, buf)FfiConverterUInt.write(value.`maxSpaces`, buf)FfiConverterUInt.write(value.`maxMacosVms`, buf)+ FfiConverterUInt.write(value.`maxMemoryGb`, buf)+ FfiConverterUInt.write(value.`maxDiskGb`, buf)+ FfiConverterUInt.write(value.`maxRunMinutes`, buf)+ FfiConverterUInt.write(value.`usedMemoryGb`, buf)+ FfiConverterUInt.write(value.`usedDiskGb`, buf)+ FfiConverterUInt.write(value.`totalMemoryGb`, buf)+ FfiConverterUInt.write(value.`totalDiskGb`, buf)FfiConverterSequenceTypeHostProvidedSpace.write(value.`providedSpaces`, buf)FfiConverterSequenceTypeHostSpacesAuditRecord.write(value.`spacesAudit`, buf)FfiConverterOptionalString.write(value.`spacesAuditError`, buf)diff --git a/libs/cua/proto/cua/env/v1/host.proto b/libs/cua/proto/cua/env/v1/host.protoindex 4a31c90726..283c54ef76 100644--- a/libs/cua/proto/cua/env/v1/host.proto+++ b/libs/cua/proto/cua/env/v1/host.proto@@ -107,12 +107,22 @@ message HostSpacesSettings {// At most this many macOS VMs at once on this Mac (Apple's license allows// two; 0 on a host that cannot run macOS VMs).uint32 max_macos_vms = 4;+ // The Spaces other machines create here may use at most this much memory+ // in total, in GB (0: no limit).+ uint32 max_memory_gb = 5;+ // The Spaces other machines create here may use at most this much disk in+ // total, in GB (0: no limit).+ uint32 max_disk_gb = 6;+ // A Space created here by another machine stops after running this many+ // minutes (0: no limit).+ uint32 max_run_minutes = 7;}// How much of one limit is in use.message HostSpacesCapacity {- // `spaces` (every provided Space) or `macos_vms` (macOS VMs on this Mac,- // provided or not).+ // `spaces` (every provided Space), `macos_vms` (macOS VMs on this Mac,+ // provided or not), `memory_gb` or `disk_gb` (what the provided Spaces+ // were given, in GB).string resource = 1;// In use now.uint32 used = 2;diff --git a/libs/cua/python/src/cua/_native.py b/libs/cua/python/src/cua/_native.pyindex 9d944336bc..fe8db584ab 100644--- a/libs/cua/python/src/cua/_native.py+++ b/libs/cua/python/src/cua/_native.py@@ -17193,7 +17193,7 @@ class HostSettingsChange:"""A change to this machine's Spaces settings (`None` keeps a value)."""- def __init__(self, *, share_desktop:typing.Optional[bool] = _DEFAULT, provide_spaces:typing.Optional[bool] = _DEFAULT, max_spaces:typing.Optional[int] = _DEFAULT, max_macos_vms:typing.Optional[int] = _DEFAULT):+ def __init__(self, *, share_desktop:typing.Optional[bool] = _DEFAULT, provide_spaces:typing.Optional[bool] = _DEFAULT, max_spaces:typing.Optional[int] = _DEFAULT, max_macos_vms:typing.Optional[int] = _DEFAULT, max_memory_gb:typing.Optional[int] = _DEFAULT, max_disk_gb:typing.Optional[int] = _DEFAULT, max_run_minutes:typing.Optional[int] = _DEFAULT):if share_desktop is _DEFAULT:self.share_desktop = Noneelse:@@ -17210,12 +17210,24 @@ class HostSettingsChange:self.max_macos_vms = Noneelse:self.max_macos_vms = max_macos_vms+ if max_memory_gb is _DEFAULT:+ self.max_memory_gb = None+ else:+ self.max_memory_gb = max_memory_gb+ if max_disk_gb is _DEFAULT:+ self.max_disk_gb = None+ else:+ self.max_disk_gb = max_disk_gb+ if max_run_minutes is _DEFAULT:+ self.max_run_minutes = None+ else:+ self.max_run_minutes = max_run_minutesdef __str__(self):- return "HostSettingsChange(share_desktop={}, provide_spaces={}, max_spaces={}, max_macos_vms={})".format(self.share_desktop, self.provide_spaces, self.max_spaces, self.max_macos_vms)+ return "HostSettingsChange(share_desktop={}, provide_spaces={}, max_spaces={}, max_macos_vms={}, max_memory_gb={}, max_disk_gb={}, max_run_minutes={})".format(self.share_desktop, self.provide_spaces, self.max_spaces, self.max_macos_vms, self.max_memory_gb, self.max_disk_gb, self.max_run_minutes)def __eq__(self, other):if self.share_desktop != other.share_desktop:return False@@ -17225,6 +17237,12 @@ class HostSettingsChange:return Falseif self.max_macos_vms != other.max_macos_vms:return False+ if self.max_memory_gb != other.max_memory_gb:+ return False+ if self.max_disk_gb != other.max_disk_gb:+ return False+ if self.max_run_minutes != other.max_run_minutes:+ return Falsereturn Trueclass _UniffiFfiConverterTypeHostSettingsChange(_UniffiConverterRustBuffer):@@ -17235,6 +17253,9 @@ class _UniffiFfiConverterTypeHostSettingsChange(_UniffiConverterRustBuffer):provide_spaces=_UniffiFfiConverterOptionalBoolean.read(buf),max_spaces=_UniffiFfiConverterOptionalUInt32.read(buf),max_macos_vms=_UniffiFfiConverterOptionalUInt32.read(buf),+ max_memory_gb=_UniffiFfiConverterOptionalUInt32.read(buf),+ max_disk_gb=_UniffiFfiConverterOptionalUInt32.read(buf),+ max_run_minutes=_UniffiFfiConverterOptionalUInt32.read(buf),)@staticmethod@@ -17243,6 +17264,9 @@ class _UniffiFfiConverterTypeHostSettingsChange(_UniffiConverterRustBuffer):_UniffiFfiConverterOptionalBoolean.check_lower(value.provide_spaces)_UniffiFfiConverterOptionalUInt32.check_lower(value.max_spaces)_UniffiFfiConverterOptionalUInt32.check_lower(value.max_macos_vms)+ _UniffiFfiConverterOptionalUInt32.check_lower(value.max_memory_gb)+ _UniffiFfiConverterOptionalUInt32.check_lower(value.max_disk_gb)+ _UniffiFfiConverterOptionalUInt32.check_lower(value.max_run_minutes)@staticmethoddef write(value, buf):@@ -17250,6 +17274,9 @@ class _UniffiFfiConverterTypeHostSettingsChange(_UniffiConverterRustBuffer):_UniffiFfiConverterOptionalBoolean.write(value.provide_spaces, buf)_UniffiFfiConverterOptionalUInt32.write(value.max_spaces, buf)_UniffiFfiConverterOptionalUInt32.write(value.max_macos_vms, buf)+ _UniffiFfiConverterOptionalUInt32.write(value.max_memory_gb, buf)+ _UniffiFfiConverterOptionalUInt32.write(value.max_disk_gb, buf)+ _UniffiFfiConverterOptionalUInt32.write(value.max_run_minutes, buf)@dataclassclass HostSetupOptions:@@ -17502,7 +17529,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, paused_signed_out:bool = False, owner:typing.Optional[str] = _DEFAULT, owner_email:typing.Optional[str] = _DEFAULT, helper_available:bool = False, legacy_service:bool = False):+ 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, max_memory_gb:int = 0, max_disk_gb:int = 0, max_run_minutes:int = 0, used_memory_gb:int = 0, used_disk_gb:int = 0, total_memory_gb:int = 0, total_disk_gb: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, helper_available:bool = False, legacy_service:bool = False):self.configured = configuredself.mode = modeself.relay_url = relay_url@@ -17531,6 +17558,13 @@ class HostStatus:self.provide_spaces = provide_spacesself.max_spaces = max_spacesself.max_macos_vms = max_macos_vms+ self.max_memory_gb = max_memory_gb+ self.max_disk_gb = max_disk_gb+ self.max_run_minutes = max_run_minutes+ self.used_memory_gb = used_memory_gb+ self.used_disk_gb = used_disk_gb+ self.total_memory_gb = total_memory_gb+ self.total_disk_gb = total_disk_gbif provided_spaces is _DEFAULT:self.provided_spaces = []else:@@ -17559,7 +17593,7 @@ class HostStatus:def __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={}, paused_signed_out={}, owner={}, owner_email={}, helper_available={}, legacy_service={})".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, self.helper_available, self.legacy_service)+ 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={}, max_memory_gb={}, max_disk_gb={}, max_run_minutes={}, used_memory_gb={}, used_disk_gb={}, total_memory_gb={}, total_disk_gb={}, provided_spaces={}, spaces_audit={}, spaces_audit_error={}, paused_signed_out={}, owner={}, owner_email={}, helper_available={}, legacy_service={})".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.max_memory_gb, self.max_disk_gb, self.max_run_minutes, self.used_memory_gb, self.used_disk_gb, self.total_memory_gb, self.total_disk_gb, self.provided_spaces, self.spaces_audit, self.spaces_audit_error, self.paused_signed_out, self.owner, self.owner_email, self.helper_available, self.legacy_service)def __eq__(self, other):if self.configured != other.configured:return False@@ -17605,6 +17639,20 @@ class HostStatus:return Falseif self.max_macos_vms != other.max_macos_vms:return False+ if self.max_memory_gb != other.max_memory_gb:+ return False+ if self.max_disk_gb != other.max_disk_gb:+ return False+ if self.max_run_minutes != other.max_run_minutes:+ return False+ if self.used_memory_gb != other.used_memory_gb:+ return False+ if self.used_disk_gb != other.used_disk_gb:+ return False+ if self.total_memory_gb != other.total_memory_gb:+ return False+ if self.total_disk_gb != other.total_disk_gb:+ return Falseif self.provided_spaces != other.provided_spaces:return Falseif self.spaces_audit != other.spaces_audit:@@ -17649,6 +17697,13 @@ class _UniffiFfiConverterTypeHostStatus(_UniffiConverterRustBuffer):provide_spaces=_UniffiFfiConverterBoolean.read(buf),max_spaces=_UniffiFfiConverterUInt32.read(buf),max_macos_vms=_UniffiFfiConverterUInt32.read(buf),+ max_memory_gb=_UniffiFfiConverterUInt32.read(buf),+ max_disk_gb=_UniffiFfiConverterUInt32.read(buf),+ max_run_minutes=_UniffiFfiConverterUInt32.read(buf),+ used_memory_gb=_UniffiFfiConverterUInt32.read(buf),+ used_disk_gb=_UniffiFfiConverterUInt32.read(buf),+ total_memory_gb=_UniffiFfiConverterUInt32.read(buf),+ total_disk_gb=_UniffiFfiConverterUInt32.read(buf),provided_spaces=_UniffiFfiConverterSequenceTypeHostProvidedSpace.read(buf),spaces_audit=_UniffiFfiConverterSequenceTypeHostSpacesAuditRecord.read(buf),spaces_audit_error=_UniffiFfiConverterOptionalString.read(buf),@@ -17683,6 +17738,13 @@ class _UniffiFfiConverterTypeHostStatus(_UniffiConverterRustBuffer):_UniffiFfiConverterBoolean.check_lower(value.provide_spaces)_UniffiFfiConverterUInt32.check_lower(value.max_spaces)_UniffiFfiConverterUInt32.check_lower(value.max_macos_vms)+ _UniffiFfiConverterUInt32.check_lower(value.max_memory_gb)+ _UniffiFfiConverterUInt32.check_lower(value.max_disk_gb)+ _UniffiFfiConverterUInt32.check_lower(value.max_run_minutes)+ _UniffiFfiConverterUInt32.check_lower(value.used_memory_gb)+ _UniffiFfiConverterUInt32.check_lower(value.used_disk_gb)+ _UniffiFfiConverterUInt32.check_lower(value.total_memory_gb)+ _UniffiFfiConverterUInt32.check_lower(value.total_disk_gb)_UniffiFfiConverterSequenceTypeHostProvidedSpace.check_lower(value.provided_spaces)_UniffiFfiConverterSequenceTypeHostSpacesAuditRecord.check_lower(value.spaces_audit)_UniffiFfiConverterOptionalString.check_lower(value.spaces_audit_error)@@ -17716,6 +17778,13 @@ class _UniffiFfiConverterTypeHostStatus(_UniffiConverterRustBuffer):_UniffiFfiConverterBoolean.write(value.provide_spaces, buf)_UniffiFfiConverterUInt32.write(value.max_spaces, buf)_UniffiFfiConverterUInt32.write(value.max_macos_vms, buf)+ _UniffiFfiConverterUInt32.write(value.max_memory_gb, buf)+ _UniffiFfiConverterUInt32.write(value.max_disk_gb, buf)+ _UniffiFfiConverterUInt32.write(value.max_run_minutes, buf)+ _UniffiFfiConverterUInt32.write(value.used_memory_gb, buf)+ _UniffiFfiConverterUInt32.write(value.used_disk_gb, buf)+ _UniffiFfiConverterUInt32.write(value.total_memory_gb, buf)+ _UniffiFfiConverterUInt32.write(value.total_disk_gb, buf)_UniffiFfiConverterSequenceTypeHostProvidedSpace.write(value.provided_spaces, buf)_UniffiFfiConverterSequenceTypeHostSpacesAuditRecord.write(value.spaces_audit, buf)_UniffiFfiConverterOptionalString.write(value.spaces_audit_error, buf)diff --git a/libs/cua/scripts/generate-app-core-ffi.py b/libs/cua/scripts/generate-app-core-ffi.pyindex 520eff3cbc..cfa4bce942 100644--- a/libs/cua/scripts/generate-app-core-ffi.py+++ b/libs/cua/scripts/generate-app-core-ffi.py@@ -58,7 +58,7 @@ TYPES = [("settings.rs", "settings", ["SwitcherTheme", "AppSettings", "KeyCombo", "SignInPhase", "TelemetryInput", "SettingsInput", "SettingsRowKind", "SettingsOption", "SettingsRow", "SettingsSection", "SettingsPage"]),("sign_in.rs", "sign_in", ["SignInFailure", "SignInFooterState", "SignInFooterInput", "SignInToast", "SignInFooter"]),("window.rs", "window", ["ChromeInput", "MainChrome", "MenuItemId", "MenuItem", "MenuInput"]),- ("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"]),+ ("host.rs", "host", ["HostSummaryInput", "HostSetupRequest", "HostClient", "HostAccess", "HostPermissionInput", "HostProvidedSpace", "HostSpacesAudit", "HostState", "HostAccount", "HostAccountStep", "HostActionId", "HostSettingChange", "HostLimitRow", "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 b06b51a0b6..df24a2f5ac 100644--- a/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift+++ b/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift@@ -28558,6 +28558,18 @@ public struct HostSettingsChange: Equatable, Hashable {* macOS VMs at once (0 to 2, Apple's license).*/public var maxMacosVms: UInt32?+ /**+ * Memory the provided Spaces may use in total, in GB (0: no limit).+ */+ public var maxMemoryGb: UInt32?+ /**+ * Disk the provided Spaces may use in total, in GB (0: no limit).+ */+ public var maxDiskGb: UInt32?+ /**+ * How long a provided Space may run, in minutes (0: no limit).+ */+ public var maxRunMinutes: UInt32?// Default memberwise initializers are never public by default, so we// declare one manually.@@ -28573,11 +28585,23 @@ public struct HostSettingsChange: Equatable, Hashable {*/maxSpaces: UInt32? = nil,/*** macOS VMs at once (0 to 2, Apple's license).- */maxMacosVms: UInt32? = nil) {+ */maxMacosVms: UInt32? = nil,+ /**+ * Memory the provided Spaces may use in total, in GB (0: no limit).+ */maxMemoryGb: UInt32? = nil,+ /**+ * Disk the provided Spaces may use in total, in GB (0: no limit).+ */maxDiskGb: UInt32? = nil,+ /**+ * How long a provided Space may run, in minutes (0: no limit).+ */maxRunMinutes: UInt32? = nil) {self.shareDesktop = shareDesktopself.provideSpaces = provideSpacesself.maxSpaces = maxSpacesself.maxMacosVms = maxMacosVms+ self.maxMemoryGb = maxMemoryGb+ self.maxDiskGb = maxDiskGb+ self.maxRunMinutes = maxRunMinutes}@@ -28599,7 +28623,10 @@ public struct FfiConverterTypeHostSettingsChange: FfiConverterRustBuffer {shareDesktop: FfiConverterOptionBool.read(from: &buf),provideSpaces: FfiConverterOptionBool.read(from: &buf),maxSpaces: FfiConverterOptionUInt32.read(from: &buf),- maxMacosVms: FfiConverterOptionUInt32.read(from: &buf)+ maxMacosVms: FfiConverterOptionUInt32.read(from: &buf),+ maxMemoryGb: FfiConverterOptionUInt32.read(from: &buf),+ maxDiskGb: FfiConverterOptionUInt32.read(from: &buf),+ maxRunMinutes: FfiConverterOptionUInt32.read(from: &buf))}@@ -28608,6 +28635,9 @@ public struct FfiConverterTypeHostSettingsChange: FfiConverterRustBuffer {FfiConverterOptionBool.write(value.provideSpaces, into: &buf)FfiConverterOptionUInt32.write(value.maxSpaces, into: &buf)FfiConverterOptionUInt32.write(value.maxMacosVms, into: &buf)+ FfiConverterOptionUInt32.write(value.maxMemoryGb, into: &buf)+ FfiConverterOptionUInt32.write(value.maxDiskGb, into: &buf)+ FfiConverterOptionUInt32.write(value.maxRunMinutes, into: &buf)}}@@ -28977,6 +29007,28 @@ public struct HostStatus: Equatable, Hashable {* macOS VMs at once (at most two).*/public var maxMacosVms: UInt32+ /**+ * Memory the provided Spaces may use in total, in GB (0: no limit).+ */+ public var maxMemoryGb: UInt32+ /**+ * Disk the provided Spaces may use in total, in GB (0: no limit).+ */+ public var maxDiskGb: UInt32+ /**+ * How long a provided Space may run, in minutes (0: no limit).+ */+ public var maxRunMinutes: UInt32+ /**+ * What the provided Spaces were given now, in GB.+ */+ public var usedMemoryGb: UInt32+ public var usedDiskGb: UInt32+ /**+ * This machine's own memory and disk, in GB (0: not known).+ */+ public var totalMemoryGb: UInt32+ public var totalDiskGb: UInt32/*** The Spaces this machine provides now.*/@@ -29082,6 +29134,21 @@ public struct HostStatus: Equatable, Hashable {/*** macOS VMs at once (at most two).*/maxMacosVms: UInt32 = UInt32(0),+ /**+ * Memory the provided Spaces may use in total, in GB (0: no limit).+ */maxMemoryGb: UInt32 = UInt32(0),+ /**+ * Disk the provided Spaces may use in total, in GB (0: no limit).+ */maxDiskGb: UInt32 = UInt32(0),+ /**+ * How long a provided Space may run, in minutes (0: no limit).+ */maxRunMinutes: UInt32 = UInt32(0),+ /**+ * What the provided Spaces were given now, in GB.+ */usedMemoryGb: UInt32 = UInt32(0), usedDiskGb: UInt32 = UInt32(0),+ /**+ * This machine's own memory and disk, in GB (0: not known).+ */totalMemoryGb: UInt32 = UInt32(0), totalDiskGb: UInt32 = UInt32(0),/*** The Spaces this machine provides now.*/providedSpaces: [HostProvidedSpace] = [],@@ -29130,6 +29197,13 @@ public struct HostStatus: Equatable, Hashable {self.provideSpaces = provideSpacesself.maxSpaces = maxSpacesself.maxMacosVms = maxMacosVms+ self.maxMemoryGb = maxMemoryGb+ self.maxDiskGb = maxDiskGb+ self.maxRunMinutes = maxRunMinutes+ self.usedMemoryGb = usedMemoryGb+ self.usedDiskGb = usedDiskGb+ self.totalMemoryGb = totalMemoryGb+ self.totalDiskGb = totalDiskGbself.providedSpaces = providedSpacesself.spacesAudit = spacesAuditself.spacesAuditError = spacesAuditError@@ -29178,6 +29252,13 @@ public struct FfiConverterTypeHostStatus: FfiConverterRustBuffer {provideSpaces: FfiConverterBool.read(from: &buf),maxSpaces: FfiConverterUInt32.read(from: &buf),maxMacosVms: FfiConverterUInt32.read(from: &buf),+ maxMemoryGb: FfiConverterUInt32.read(from: &buf),+ maxDiskGb: FfiConverterUInt32.read(from: &buf),+ maxRunMinutes: FfiConverterUInt32.read(from: &buf),+ usedMemoryGb: FfiConverterUInt32.read(from: &buf),+ usedDiskGb: FfiConverterUInt32.read(from: &buf),+ totalMemoryGb: FfiConverterUInt32.read(from: &buf),+ totalDiskGb: FfiConverterUInt32.read(from: &buf),providedSpaces: FfiConverterSequenceTypeHostProvidedSpace.read(from: &buf),spacesAudit: FfiConverterSequenceTypeHostSpacesAuditRecord.read(from: &buf),spacesAuditError: FfiConverterOptionString.read(from: &buf),@@ -29212,6 +29293,13 @@ public struct FfiConverterTypeHostStatus: FfiConverterRustBuffer {FfiConverterBool.write(value.provideSpaces, into: &buf)FfiConverterUInt32.write(value.maxSpaces, into: &buf)FfiConverterUInt32.write(value.maxMacosVms, into: &buf)+ FfiConverterUInt32.write(value.maxMemoryGb, into: &buf)+ FfiConverterUInt32.write(value.maxDiskGb, into: &buf)+ FfiConverterUInt32.write(value.maxRunMinutes, into: &buf)+ FfiConverterUInt32.write(value.usedMemoryGb, into: &buf)+ FfiConverterUInt32.write(value.usedDiskGb, into: &buf)+ FfiConverterUInt32.write(value.totalMemoryGb, into: &buf)+ FfiConverterUInt32.write(value.totalDiskGb, into: &buf)FfiConverterSequenceTypeHostProvidedSpace.write(value.providedSpaces, into: &buf)FfiConverterSequenceTypeHostSpacesAuditRecord.write(value.spacesAudit, into: &buf)FfiConverterOptionString.write(value.spacesAuditError, into: &buf)diff --git a/libs/cua/typescript/src/native/cua_sdk.ts b/libs/cua/typescript/src/native/cua_sdk.tsindex a2aa8457d2..3e76e4c465 100644--- a/libs/cua/typescript/src/native/cua_sdk.ts+++ b/libs/cua/typescript/src/native/cua_sdk.ts@@ -11889,7 +11889,19 @@ export type HostSettingsChange = {/*** macOS VMs at once (0 to 2, Apple's license).*/- maxMacosVms?: number+ maxMacosVms?: number,+ /**+ * Memory the provided Spaces may use in total, in GB (0: no limit).+ */+ maxMemoryGb?: number,+ /**+ * Disk the provided Spaces may use in total, in GB (0: no limit).+ */+ maxDiskGb?: number,+ /**+ * How long a provided Space may run, in minutes (0: no limit).+ */+ maxRunMinutes?: number}/**@@ -11900,7 +11912,10 @@ export const HostSettingsChange = (() => {shareDesktop: undefined,provideSpaces: undefined,maxSpaces: undefined,- maxMacosVms: undefined+ maxMacosVms: undefined,+ maxMemoryGb: undefined,+ maxDiskGb: undefined,+ maxRunMinutes: undefined});const create = (() => {return uniffiCreateRecord<HostSettingsChange, ReturnType<typeof defaults>>(defaults);@@ -11920,7 +11935,10 @@ const FfiConverterTypeHostSettingsChange = (() => {shareDesktop: FfiConverterOptionalBoolean.read(from),provideSpaces: FfiConverterOptionalBoolean.read(from),maxSpaces: FfiConverterOptionalUInt32.read(from),- maxMacosVms: FfiConverterOptionalUInt32.read(from)+ maxMacosVms: FfiConverterOptionalUInt32.read(from),+ maxMemoryGb: FfiConverterOptionalUInt32.read(from),+ maxDiskGb: FfiConverterOptionalUInt32.read(from),+ maxRunMinutes: FfiConverterOptionalUInt32.read(from)};}write(value: TypeName, into: RustBuffer): void {@@ -11928,12 +11946,18 @@ const FfiConverterTypeHostSettingsChange = (() => {FfiConverterOptionalBoolean.write(value.provideSpaces, into);FfiConverterOptionalUInt32.write(value.maxSpaces, into);FfiConverterOptionalUInt32.write(value.maxMacosVms, into);+ FfiConverterOptionalUInt32.write(value.maxMemoryGb, into);+ FfiConverterOptionalUInt32.write(value.maxDiskGb, into);+ FfiConverterOptionalUInt32.write(value.maxRunMinutes, into);}allocationSize(value: TypeName): number {return FfiConverterOptionalBoolean.allocationSize(value.shareDesktop) +FfiConverterOptionalBoolean.allocationSize(value.provideSpaces) +FfiConverterOptionalUInt32.allocationSize(value.maxSpaces) +- FfiConverterOptionalUInt32.allocationSize(value.maxMacosVms);+ FfiConverterOptionalUInt32.allocationSize(value.maxMacosVms) ++ FfiConverterOptionalUInt32.allocationSize(value.maxMemoryGb) ++ FfiConverterOptionalUInt32.allocationSize(value.maxDiskGb) ++ FfiConverterOptionalUInt32.allocationSize(value.maxRunMinutes);}};@@ -12222,6 +12246,28 @@ export type HostStatus = {* macOS VMs at once (at most two).*/maxMacosVms: number,+ /**+ * Memory the provided Spaces may use in total, in GB (0: no limit).+ */+ maxMemoryGb: number,+ /**+ * Disk the provided Spaces may use in total, in GB (0: no limit).+ */+ maxDiskGb: number,+ /**+ * How long a provided Space may run, in minutes (0: no limit).+ */+ maxRunMinutes: number,+ /**+ * What the provided Spaces were given now, in GB.+ */+ usedMemoryGb: number,+ usedDiskGb: number,+ /**+ * This machine's own memory and disk, in GB (0: not known).+ */+ totalMemoryGb: number,+ totalDiskGb: number,/*** The Spaces this machine provides now.*/@@ -12269,6 +12315,13 @@ export const HostStatus = (() => {provideSpaces: false,maxSpaces: 0,maxMacosVms: 0,+ maxMemoryGb: 0,+ maxDiskGb: 0,+ maxRunMinutes: 0,+ usedMemoryGb: 0,+ usedDiskGb: 0,+ totalMemoryGb: 0,+ totalDiskGb: 0,providedSpaces: [],spacesAudit: [],spacesAuditError: undefined,@@ -12315,6 +12368,13 @@ const FfiConverterTypeHostStatus = (() => {provideSpaces: FfiConverterBool.read(from),maxSpaces: FfiConverterUInt32.read(from),maxMacosVms: FfiConverterUInt32.read(from),+ maxMemoryGb: FfiConverterUInt32.read(from),+ maxDiskGb: FfiConverterUInt32.read(from),+ maxRunMinutes: FfiConverterUInt32.read(from),+ usedMemoryGb: FfiConverterUInt32.read(from),+ usedDiskGb: FfiConverterUInt32.read(from),+ totalMemoryGb: FfiConverterUInt32.read(from),+ totalDiskGb: FfiConverterUInt32.read(from),providedSpaces: FfiConverterSequenceTypeHostProvidedSpace.read(from),spacesAudit: FfiConverterSequenceTypeHostSpacesAuditRecord.read(from),spacesAuditError: FfiConverterOptionalString.read(from),@@ -12348,6 +12408,13 @@ const FfiConverterTypeHostStatus = (() => {FfiConverterBool.write(value.provideSpaces, into);FfiConverterUInt32.write(value.maxSpaces, into);FfiConverterUInt32.write(value.maxMacosVms, into);+ FfiConverterUInt32.write(value.maxMemoryGb, into);+ FfiConverterUInt32.write(value.maxDiskGb, into);+ FfiConverterUInt32.write(value.maxRunMinutes, into);+ FfiConverterUInt32.write(value.usedMemoryGb, into);+ FfiConverterUInt32.write(value.usedDiskGb, into);+ FfiConverterUInt32.write(value.totalMemoryGb, into);+ FfiConverterUInt32.write(value.totalDiskGb, into);FfiConverterSequenceTypeHostProvidedSpace.write(value.providedSpaces, into);FfiConverterSequenceTypeHostSpacesAuditRecord.write(value.spacesAudit, into);FfiConverterOptionalString.write(value.spacesAuditError, into);@@ -12380,6 +12447,13 @@ const FfiConverterTypeHostStatus = (() => {FfiConverterBool.allocationSize(value.provideSpaces) +FfiConverterUInt32.allocationSize(value.maxSpaces) +FfiConverterUInt32.allocationSize(value.maxMacosVms) ++ FfiConverterUInt32.allocationSize(value.maxMemoryGb) ++ FfiConverterUInt32.allocationSize(value.maxDiskGb) ++ FfiConverterUInt32.allocationSize(value.maxRunMinutes) ++ FfiConverterUInt32.allocationSize(value.usedMemoryGb) ++ FfiConverterUInt32.allocationSize(value.usedDiskGb) ++ FfiConverterUInt32.allocationSize(value.totalMemoryGb) ++ FfiConverterUInt32.allocationSize(value.totalDiskGb) +FfiConverterSequenceTypeHostProvidedSpace.allocationSize(value.providedSpaces) +FfiConverterSequenceTypeHostSpacesAuditRecord.allocationSize(value.spacesAudit) +FfiConverterOptionalString.allocationSize(value.spacesAuditError) +diff --git a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swiftindex 5dfc81f991..0fb99fca5a 100644--- a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift+++ b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift@@ -19230,6 +19230,148 @@ public func FfiConverterTypeAppHostLimit_lower(_ value: AppHostLimit) -> RustBuf}+public struct AppHostLimitRow: Equatable, Hashable {+ /**+ * `max-spaces`, `max-memory`, `max-disk` or `max-run`.+ */+ public var id: String+ /**+ * "Most Spaces at once".+ */+ public var label: String+ /**+ * One line under it.+ */+ public var help: String+ /**+ * The limit (0: no limit).+ */+ public var value: UInt32+ /**+ * What the number counts: `Spaces`, `GB` or `minutes`.+ */+ public var unit: String+ /**+ * What is in use now ("2 of 4 Spaces", "12 of 32 GB"; "2 Spaces" with+ * no limit); none for a limit that is about time.+ */+ public var useText: String?+ /**+ * This machine's own total in `unit` (memory and disk), 0 when not+ * known.+ */+ public var total: UInt32+ /**+ * Use is above the limit (it was lowered below what runs): nothing+ * is stopped, new Spaces are refused.+ */+ public var over: Bool+ /**+ * "Over limit" while `over`.+ */+ public var overText: String?++ // Default memberwise initializers are never public by default, so we+ // declare one manually.+ public init(+ /**+ * `max-spaces`, `max-memory`, `max-disk` or `max-run`.+ */id: String,+ /**+ * "Most Spaces at once".+ */label: String,+ /**+ * One line under it.+ */help: String,+ /**+ * The limit (0: no limit).+ */value: UInt32,+ /**+ * What the number counts: `Spaces`, `GB` or `minutes`.+ */unit: String,+ /**+ * What is in use now ("2 of 4 Spaces", "12 of 32 GB"; "2 Spaces" with+ * no limit); none for a limit that is about time.+ */useText: String?,+ /**+ * This machine's own total in `unit` (memory and disk), 0 when not+ * known.+ */total: UInt32,+ /**+ * Use is above the limit (it was lowered below what runs): nothing+ * is stopped, new Spaces are refused.+ */over: Bool,+ /**+ * "Over limit" while `over`.+ */overText: String?) {+ self.id = id+ self.label = label+ self.help = help+ self.value = value+ self.unit = unit+ self.useText = useText+ self.total = total+ self.over = over+ self.overText = overText+ }+++++}++#if compiler(>=6)+extension AppHostLimitRow: Sendable {}+#endif++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public struct FfiConverterTypeAppHostLimitRow: FfiConverterRustBuffer {+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppHostLimitRow {+ return+ try AppHostLimitRow(+ id: FfiConverterString.read(from: &buf),+ label: FfiConverterString.read(from: &buf),+ help: FfiConverterString.read(from: &buf),+ value: FfiConverterUInt32.read(from: &buf),+ unit: FfiConverterString.read(from: &buf),+ useText: FfiConverterOptionString.read(from: &buf),+ total: FfiConverterUInt32.read(from: &buf),+ over: FfiConverterBool.read(from: &buf),+ overText: FfiConverterOptionString.read(from: &buf)+ )+ }++ public static func write(_ value: AppHostLimitRow, into buf: inout [UInt8]) {+ FfiConverterString.write(value.id, into: &buf)+ FfiConverterString.write(value.label, into: &buf)+ FfiConverterString.write(value.help, into: &buf)+ FfiConverterUInt32.write(value.value, into: &buf)+ FfiConverterString.write(value.unit, into: &buf)+ FfiConverterOptionString.write(value.useText, into: &buf)+ FfiConverterUInt32.write(value.total, into: &buf)+ FfiConverterBool.write(value.over, into: &buf)+ FfiConverterOptionString.write(value.overText, into: &buf)+ }+}+++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public func FfiConverterTypeAppHostLimitRow_lift(_ buf: RustBuffer) throws -> AppHostLimitRow {+ return try FfiConverterTypeAppHostLimitRow.lift(buf)+}++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public func FfiConverterTypeAppHostLimitRow_lower(_ value: AppHostLimitRow) -> RustBuffer {+ return FfiConverterTypeAppHostLimitRow.lower(value)+}++public struct AppHostLoad: Equatable, Hashable {/*** CPU it offers, in thousandths.@@ -19422,6 +19564,11 @@ public struct AppHostPanelView: Equatable, Hashable {* providing Spaces.*/public var limits: String?+ /**+ * The limits as number rows (Settings, Sharing), while providing+ * Spaces: most Spaces, memory and disk in total, longest running time.+ */+ public var limitRows: [AppHostLimitRow]/*** "Spaces for your devices", while providing Spaces.*/@@ -19539,6 +19686,10 @@ public struct AppHostPanelView: Equatable, Hashable {* The limits, one line ("Up to 4 Spaces \u{b7} 2 macOS VMs"), while* providing Spaces.*/limits: String?,+ /**+ * The limits as number rows (Settings, Sharing), while providing+ * Spaces: most Spaces, memory and disk in total, longest running time.+ */limitRows: [AppHostLimitRow],/*** "Spaces for your devices", while providing Spaces.*/providedTitle: String?,@@ -19599,6 +19750,7 @@ public struct AppHostPanelView: Equatable, Hashable {self.accessWarning = accessWarningself.toggles = togglesself.limits = limits+ self.limitRows = limitRowsself.providedTitle = providedTitleself.provided = providedself.providedEmpty = providedEmpty@@ -19648,6 +19800,7 @@ public struct FfiConverterTypeAppHostPanelView: FfiConverterRustBuffer {accessWarning: FfiConverterOptionString.read(from: &buf),toggles: FfiConverterSequenceTypeAppHostToggle.read(from: &buf),limits: FfiConverterOptionString.read(from: &buf),+ limitRows: FfiConverterSequenceTypeAppHostLimitRow.read(from: &buf),providedTitle: FfiConverterOptionString.read(from: &buf),provided: FfiConverterSequenceTypeAppHostAccessRow.read(from: &buf),providedEmpty: FfiConverterOptionString.read(from: &buf),@@ -19683,6 +19836,7 @@ public struct FfiConverterTypeAppHostPanelView: FfiConverterRustBuffer {FfiConverterOptionString.write(value.accessWarning, into: &buf)FfiConverterSequenceTypeAppHostToggle.write(value.toggles, into: &buf)FfiConverterOptionString.write(value.limits, into: &buf)+ FfiConverterSequenceTypeAppHostLimitRow.write(value.limitRows, into: &buf)FfiConverterOptionString.write(value.providedTitle, into: &buf)FfiConverterSequenceTypeAppHostAccessRow.write(value.provided, into: &buf)FfiConverterOptionString.write(value.providedEmpty, into: &buf)@@ -20387,6 +20541,31 @@ public struct AppHostState: Equatable, Hashable {* macOS VMs at once (at most two; 0 off a Mac).*/public var maxMacosVms: UInt32+ /**+ * Memory the Spaces other machines create here may use in total, in GB+ * (0: no limit).+ */+ public var maxMemoryGb: UInt32+ /**+ * Disk the Spaces other machines create here may use in total, in GB+ * (0: no limit).+ */+ public var maxDiskGb: UInt32+ /**+ * How long a Space created here by another machine may run, in minutes+ * (0: no limit).+ */+ public var maxRunMinutes: UInt32+ /**+ * What those Spaces were given now, in GB.+ */+ public var usedMemoryGb: UInt32+ public var usedDiskGb: UInt32+ /**+ * This machine's own memory and disk in GB (0: not known).+ */+ public var totalMemoryGb: UInt32+ public var totalDiskGb: UInt32/*** The Spaces this machine provides now.*/@@ -20479,6 +20658,24 @@ public struct AppHostState: Equatable, Hashable {/*** macOS VMs at once (at most two; 0 off a Mac).*/maxMacosVms: UInt32,+ /**+ * Memory the Spaces other machines create here may use in total, in GB+ * (0: no limit).+ */maxMemoryGb: UInt32,+ /**+ * Disk the Spaces other machines create here may use in total, in GB+ * (0: no limit).+ */maxDiskGb: UInt32,+ /**+ * How long a Space created here by another machine may run, in minutes+ * (0: no limit).+ */maxRunMinutes: UInt32,+ /**+ * What those Spaces were given now, in GB.+ */usedMemoryGb: UInt32, usedDiskGb: UInt32,+ /**+ * This machine's own memory and disk in GB (0: not known).+ */totalMemoryGb: UInt32, totalDiskGb: UInt32,/*** The Spaces this machine provides now.*/providedSpaces: [AppHostProvidedSpace],@@ -20522,6 +20719,13 @@ public struct AppHostState: Equatable, Hashable {self.provideSpaces = provideSpacesself.maxSpaces = maxSpacesself.maxMacosVms = maxMacosVms+ self.maxMemoryGb = maxMemoryGb+ self.maxDiskGb = maxDiskGb+ self.maxRunMinutes = maxRunMinutes+ self.usedMemoryGb = usedMemoryGb+ self.usedDiskGb = usedDiskGb+ self.totalMemoryGb = totalMemoryGb+ self.totalDiskGb = totalDiskGbself.providedSpaces = providedSpacesself.spacesAudit = spacesAuditself.spacesAuditError = spacesAuditError@@ -20566,6 +20770,13 @@ public struct FfiConverterTypeAppHostState: FfiConverterRustBuffer {provideSpaces: FfiConverterBool.read(from: &buf),maxSpaces: FfiConverterUInt32.read(from: &buf),maxMacosVms: FfiConverterUInt32.read(from: &buf),+ maxMemoryGb: FfiConverterUInt32.read(from: &buf),+ maxDiskGb: FfiConverterUInt32.read(from: &buf),+ maxRunMinutes: FfiConverterUInt32.read(from: &buf),+ usedMemoryGb: FfiConverterUInt32.read(from: &buf),+ usedDiskGb: FfiConverterUInt32.read(from: &buf),+ totalMemoryGb: FfiConverterUInt32.read(from: &buf),+ totalDiskGb: FfiConverterUInt32.read(from: &buf),providedSpaces: FfiConverterSequenceTypeAppHostProvidedSpace.read(from: &buf),spacesAudit: FfiConverterSequenceTypeAppHostSpacesAudit.read(from: &buf),spacesAuditError: FfiConverterOptionString.read(from: &buf),@@ -20596,6 +20807,13 @@ public struct FfiConverterTypeAppHostState: FfiConverterRustBuffer {FfiConverterBool.write(value.provideSpaces, into: &buf)FfiConverterUInt32.write(value.maxSpaces, into: &buf)FfiConverterUInt32.write(value.maxMacosVms, into: &buf)+ FfiConverterUInt32.write(value.maxMemoryGb, into: &buf)+ FfiConverterUInt32.write(value.maxDiskGb, into: &buf)+ FfiConverterUInt32.write(value.maxRunMinutes, into: &buf)+ FfiConverterUInt32.write(value.usedMemoryGb, into: &buf)+ FfiConverterUInt32.write(value.usedDiskGb, into: &buf)+ FfiConverterUInt32.write(value.totalMemoryGb, into: &buf)+ FfiConverterUInt32.write(value.totalDiskGb, into: &buf)FfiConverterSequenceTypeAppHostProvidedSpace.write(value.providedSpaces, into: &buf)FfiConverterSequenceTypeAppHostSpacesAudit.write(value.spacesAudit, into: &buf)FfiConverterOptionString.write(value.spacesAuditError, into: &buf)@@ -74274,6 +74492,31 @@ fileprivate struct FfiConverterSequenceTypeAppHostLimit: FfiConverterRustBuffer}}+#if swift(>=5.8)+@_documentation(visibility: private)+#endif+fileprivate struct FfiConverterSequenceTypeAppHostLimitRow: FfiConverterRustBuffer {+ typealias SwiftType = [AppHostLimitRow]++ public static func write(_ value: [AppHostLimitRow], into buf: inout [UInt8]) {+ let len = Int32(value.count)+ writeInt(&buf, len)+ for item in value {+ FfiConverterTypeAppHostLimitRow.write(item, into: &buf)+ }+ }++ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [AppHostLimitRow] {+ let len: Int32 = try readInt(&buf)+ var seq = [AppHostLimitRow]()+ seq.reserveCapacity(Int(len))+ for _ in 0 ..< len {+ seq.append(try FfiConverterTypeAppHostLimitRow.read(from: &buf))+ }+ return seq+ }+}+#if swift(>=5.8)@_documentation(visibility: private)#endifdiff --git a/scripts/docs-generators/cli-specs/cua.json b/scripts/docs-generators/cli-specs/cua.jsonindex 50c5c0c440..bf6aa96292 100644--- a/scripts/docs-generators/cli-specs/cua.json+++ b/scripts/docs-generators/cli-specs/cua.json@@ -13405,7 +13405,7 @@},{"abstract": "Show or change what this computer shares: its own desktop, and whether it creates Spaces for your other devices",- "after_help": "Examples:\n cua host config\n # Stop sharing this desktop; keep providing Spaces\n cua host config --desktop off --provide-spaces on\n cua host config --max-spaces 6",+ "after_help": "Examples:\n cua host config\n # Stop sharing this desktop; keep providing Spaces\n cua host config --desktop off --provide-spaces on\n cua host config --max-spaces 6\n # Give the Spaces other machines create here at most 32 GB of memory and\n # 200 GB of disk in total, and stop each after 8 hours (0: no limit)\n cua host config --max-memory 32 --max-disk 200 --max-run-time 480","aliases": [],"arguments": [],"flags": [],@@ -13482,6 +13482,54 @@"takes_value": true,"type": "integer","value_name": "MAX_MACOS_VMS"+ },+ {+ "aliases": [],+ "default_value": null,+ "env": null,+ "help": "Memory in GB the Spaces other machines create here may use in total (0: no limit)",+ "hidden": false,+ "is_optional": true,+ "multiple_values": false,+ "name": "max-memory",+ "possible_values": [],+ "repeatable": false,+ "short_name": null,+ "takes_value": true,+ "type": "integer",+ "value_name": "GB"+ },+ {+ "aliases": [],+ "default_value": null,+ "env": null,+ "help": "Disk in GB the Spaces other machines create here may use in total (0: no limit)",+ "hidden": false,+ "is_optional": true,+ "multiple_values": false,+ "name": "max-disk",+ "possible_values": [],+ "repeatable": false,+ "short_name": null,+ "takes_value": true,+ "type": "integer",+ "value_name": "GB"+ },+ {+ "aliases": [],+ "default_value": null,+ "env": null,+ "help": "Minutes a Space created here by another machine may run before it is stopped (0: no limit)",+ "hidden": false,+ "is_optional": true,+ "multiple_values": false,+ "name": "max-run-time",+ "possible_values": [],+ "repeatable": false,+ "short_name": null,+ "takes_value": true,+ "type": "integer",+ "value_name": "MINUTES"}],"subcommand_optional": false,diff --git a/tests/e2e/cua-sdk/rust/Cargo.lock b/tests/e2e/cua-sdk/rust/Cargo.lockindex d712e59352..0441f2e9c2 100644--- a/tests/e2e/cua-sdk/rust/Cargo.lock+++ b/tests/e2e/cua-sdk/rust/Cargo.lock@@ -1327,6 +1327,7 @@ dependencies = ["cua-proto","cua-spacesd-client","flate2",+ "futures-util","hex","rand 0.9.5","serde",diff --git a/tests/e2e/local-runtimes/Cargo.lock b/tests/e2e/local-runtimes/Cargo.lockindex a8e55e8ee1..ac762db741 100644--- a/tests/e2e/local-runtimes/Cargo.lock+++ b/tests/e2e/local-runtimes/Cargo.lock@@ -1154,6 +1154,7 @@ dependencies = ["cua-proto","cua-spacesd-client","flate2",+ "futures-util","hex","rand 0.9.5","serde",