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
Spaces macOS: the web UI is the only main window; remove Use classic UI (CUA-2334) (#5998)
cua-agents[bot]8ad4ce225d87
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 8a69faad7e..1021afe381 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@@ -12947,8 +12947,8 @@ export type AppExperiments = {*/sharing: boolean,/**- * The New UI (the shared web UI) is the main window: the user's choice- * or, without one, [`new_ui_default`] ([`crate::settings::resolve_new_ui`]).+ * The shared web UI is the main window. Always on in the macOS shell+ * ([`crate::settings::resolve_new_ui`]); kept for older files and builds.*/webUi: boolean}@@ -36940,17 +36940,16 @@ export type AppSettings = {launchAtLogin?: boolean,/*** Settings, Experiments: every switch off unless turned on- * ([`crate::experiments`]). Its `webUi` is the New UI as this launch- * shows it ([`resolve_new_ui`]); the file keeps only [`Self::new_ui`]'s+ * ([`crate::experiments`]). Its `webUi` is always on in the macOS+ * shell ([`resolve_new_ui`]); the file keeps only [`Self::new_ui`]'s* "on" there, the value older builds read.*/experiments: AppExperiments,/**- * The New UI as the user chose it (Settings, Experiments, "Use classic- * UI"); `None`: never chosen, so- * [`crate::experiments::new_ui_default`] decides. An older build's- * saved `webUi: true` reads as `Some(true)`; its `false` was only the- * saved default, so it reads as never chosen ([`load`]).+ * The New UI as an older build's "Use classic UI" saved it. Read and+ * kept for those builds, never acted on: the web UI is the only UI+ * ([`resolve_new_ui`]). An older build's saved `webUi: true` reads as+ * `Some(true)`; its `false` was only the saved default ([`load`]).*/newUi?: boolean,/**diff --git a/apps/cua-spaces-macos/README.md b/apps/cua-spaces-macos/README.mdindex 9dbed5fe8d..3774ee3e8c 100644--- a/apps/cua-spaces-macos/README.md+++ b/apps/cua-spaces-macos/README.md@@ -1,18 +1,21 @@-# Cua Spaces for macOS (SwiftUI)--A native macOS 26 app for Spaces and the Keyvault. It is a thin SwiftUI shell-over the same app core as the Tauri app (`apps/cua-spaces`): every product-decision lives in `libs/cua/crates/cua-spaces-app-core`, reached through the-cua SDK's Swift package (`libs/cua/swift`, module `CuaSDK`). The views only-render and do platform glue.+# Cua Spaces for macOS++A macOS 26 app for Spaces and the Keyvault: a thin Swift shell that hosts the+shared React UI (`apps/cua-spaces-web`) in a `WKWebView`, the same UI the+Electron app shows. Every product decision lives in+`libs/cua/crates/cua-spaces-app-core`, reached through the cua SDK's Swift+package (`libs/cua/swift`, module `CuaSDK`). The shell keeps only what has to+be native: the menu bar extra, the notch panel, permission (TCC) prompts and+the PermissionFlow guide, Touch ID, the Keychain, launch at login, the Sparkle+updater, URL schemes, notifications, video (a Space's desktop in its own+window) and the bridge to the app core.| Surface | What it is ||---|---|-| Main window | Sidebar with Spaces (one section per location; a dragged window drops on a row) and the Keyvault (All, Waiting, Access, Recent, one row per site) with the global Keyvault switch; Space detail with the live desktop, per-window streams, picture in picture, agent runs and the Teleport drop well |-| New Space | Step-by-step sheet: System, Resources, Options, Summary; Connect by address |-| Keyvault | Sidebar and list: categories, a site's accounts with their unattended switches, approval sheets |-| Onboarding | The shared web onboarding (`/onboarding` in `apps/cua-spaces-web`), in the New UI window, whether or not the New UI setting is on; the app draws none of its own. The page asks and finishes it through `onboarding.get` and `onboarding.complete` (the state is `onboarding.json`); a Space it creates posts a "<Space> is ready" notification (`notifyWhenReady`) that opens the Space. With the New UI off, the window gives way to the native one when the first run ends. A launch (or a window that opens again) while it is not done opens `/onboarding?due=1`: the page goes to Spaces instead when the person chose "Skip for now" (kept in the page's storage), so the welcome does not come back at every launch; Settings → Welcome and the sidebar's "Finish setting up" open it without `due` and always show it |-| Devices | Settings → Trusted devices (the page's): this Mac's enrollment (enrolled until, grace ends, needs enrollment), the account's devices with Rename and Revoke, Recent Access; the Enroll sheet (sign in again, or a one-time code approved from an enrolled device), the approval sheet for a device asking to join (a notification too; Approve asks for Touch ID or the login password), and a banner in the main window when this Mac needs enrolling |+| Main window | The shared web UI (`apps/cua-spaces-web`) in a `WKWebView` (below): Spaces, a Space's page, New Space, Machines, Agents, the Keyvault, Cua Volume, Settings. A real window dragged onto a Space tile drops on it |+| Space window | A Space's desktop in its own native window (video stays native) |+| Onboarding | The shared web onboarding (`/onboarding` in `apps/cua-spaces-web`), in the web UI window; the app draws none of its own. The page asks and finishes it through `onboarding.get` and `onboarding.complete` (the state is `onboarding.json`); a Space it creates posts a "<Space> is ready" notification (`notifyWhenReady`) that opens the Space. A launch (or a window that opens again) while it is not done opens `/onboarding?due=1`: the page goes to Spaces instead when the person chose "Skip for now" (kept in the page's storage), so the welcome does not come back at every launch; Settings → Welcome and the sidebar's "Finish setting up" open it without `due` and always show it |+| Devices | Settings → Trusted devices: this Mac's enrollment (enrolled until, grace ends, needs enrollment), the account's devices with Rename and Revoke, Recent Access; the Enroll sheet (sign in again, or a one-time code approved from an enrolled device), the approval sheet for a device asking to join (a notification too, which opens this page; Approve asks for Touch ID or the login password), and a banner on every page when this Mac needs enrolling || Menu bar | The Cua mark (template); status line, Open, New Space, Settings, Quit || Launch at login | Settings → General: `SMAppService.mainApp`, showing what macOS reports (on, off, waiting for approval with a button to Login Items, not found); the first run's Done page (the web onboarding's) ticks it. A login launch opens without the main window, and the app's daemon (host Spaces, persistent agents, Cua Volume) starts with it || Join with a code | `host.joinWithCode` runs the bundled `cua host setup --pair <code>` (3 minute limit); `cua://add/<CODE>` opens Machines at `?join=<CODE>` and the page asks before joining |@@ -28,12 +31,12 @@ Command shortcuts back to the Mac. Shortcuts macOS reserves (⌘Tab, ⌘Space,event tap and the Accessibility permission. Policy: `KeyCapture` in`libs/spaces-app-swift`.-## One core, two shells+## One core, one UI```-apps/cua-spaces (Tauri) apps/cua-spaces-macos (SwiftUI)- React: render only SwiftUI: render only- src/model/*.ts over wasm view models over UniFFI+apps/cua-spaces-desktop (Electron) apps/cua-spaces-macos (Swift shell)+ apps/cua-spaces-web in Chromium apps/cua-spaces-web in WKWebView+ bridge over the Node binding bridge over UniFFI (WebUIBridge)\ /libs/cua/crates/cua-spaces-app-core(Space list, wizard, teleport, Keyvault, onboarding, notch)@@ -108,28 +111,21 @@ run (with a throwaway `HOME`). State lives under `$HOME/Library/Application Supp`CuaSpacesMac --check-launch-only` loads the app's libraries, prints its version and exits(`scripts/check-launch.sh`; release builds too).-## New UI--The New UI (the `web_ui` experiment) makes-`WebUIWindowController` (`Sources/CuaSpacesMacKit/WebHost`) the main window: a-`WKWebView` with the shared React UI (`apps/cua-spaces-web`) in a window-without a title bar. Turning it on puts that window where the native one was-(same frame) and closes the native one; turning it off does the reverse-(`MainWindowSwitch`). While it is on, everything that opens the main window-opens it instead, at the matching page (`MainUIRouter`): the Dock icon, the-menu bar item, the notch, File, New Space (⌘N), the View menu, Help, Getting-Started and the app's notifications; the native window, opened any other way-(the Window menu), gives way to it. The notch, the menu bar extra, Touch ID, the updater and video stay-native; a Space's desktop opens in its native window.--It is on by default on the Beta update channel (the setting Sparkle uses)-from the 0.8.1 betas, and on every channel from 0.8.1 (0.8.0 shipped without it)-(`experiments::new_ui_default`). Settings, Experiments, "Use classic UI"-(`experiment:classic_ui`) is the way back; it saves the user's choice-(`AppSettings.new_ui`), which later launches keep. Only a choice is saved:-an older build's saved `webUi: false` was its default, so it reads as no-choice, and a saved `true` is kept (`settings::load`). A beta's first launch-starts on the Beta channel (`settings::first_launch_channel`).+## The web UI window++`WebUIWindowController` (`Sources/CuaSpacesMacKit/WebHost`) is the app's only+main window: a `WKWebView` with the shared React UI (`apps/cua-spaces-web`) in+a window without a title bar. Everything that opens the main window opens it,+at the matching page (`MainUIRouter`): a launch (the first run at+`/onboarding?due=1` while it is due; never at login), the Dock icon, the menu+bar item, the notch, File, New Space (⌘N), the View menu, Help, Getting+Started, ⌘⇧Space and the app's notifications (a Space that came up: its page;+a device asking to join: Settings, Devices; an agent: Agents). A Space's+desktop opens in its own native window (video stays native).++There is no native main window and no switch back: the "Use classic UI"+setting is gone. An install that had it on (`AppSettings.new_ui` false) opens+the web UI like every other one (`settings::resolve_new_ui` is always on).- Release: `scripts/build-app.sh` copies the web build (`apps/cua-spaces-web/dist`,or `CUA_WEBUI_DIST`) to `Contents/Resources/WebUI`, served at@@ -176,15 +172,13 @@ under the web bridge's operation names in `WebUIBridge+Pages.swift`, each tothe view model or service its native screen uses. New Space runs in thepage: `spaces.createOptions` is the env the native sheet opens with(`AppModel.newSpaceEnv`) and `spaces.create` runs its create-(`AppModel.runCreate`). While the `web_ui` experiment is on, every New Space-item (⌘N, the menu bar, the toolbar, a machine's "New Space on…") opens the-New UI window's wizard (`spaces.newRequested`); the native sheet is the-fallback when it is off. Settings is only the New UI's page (Account, General,-Connected apps, Trusted devices, Advanced, About): the app menu's "Settings…" (⌘,),-the menu bar item, the notch and the command palette all open it in the New UI-window, with New UI on or off (`MainUIRouter.openSettings`,-`WebUIWindowController.openSettings`; an open window gets `settings.openRequested`).-There is no native Settings window.+(`AppModel.runCreate`). Every New Space item (⌘N, the menu bar, a machine's+"New Space on…") opens the window's wizard (`spaces.newRequested`). Settings+is only the page's (Account, General, Connected apps, Trusted devices,+Advanced, About): the app menu's "Settings…" (⌘,), the menu bar item, the+notch and the command palette all open it in the web UI window+(`MainUIRouter.openSettings`, `WebUIWindowController.openSettings`; an open+window gets `settings.openRequested`). There is no native Settings window.Keyvault unlocks use the nativeprompt and the daemon's Touch ID; a passphrase never crosses the bridge.diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppEnvironment.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppEnvironment.swiftindex dea804cb71..616da46f44 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppEnvironment.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppEnvironment.swift@@ -115,8 +115,6 @@ public enum AppEnvironment {presence: fixtures ? FixturePresence() : LivePresence(),loginItem: fixtures ? fixtureLoginItem(env["CUA_SPACES_LOGIN_ITEM"]) : MainAppLoginItem(),startup: startup,- // Fixtures (UI tests, captures) keep the classic UI- // unless they turn the New UI on.appVersion: fixtures ? nil : info.version)if fixtures { model.teamsReader = FixtureTeams() }if !fixtures {@@ -406,6 +404,16 @@ public enum AppEnvironment {}}+ /// The Settings page a `settings-*` start view names.+ static func settingsRoute(_ view: String) -> MainUIRoute {+ switch view {+ case "settings-devices": return .path("/settings/devices")+ case "settings-about": return .path("/settings/about")+ case "settings-experiments": return .path("/settings/experiments")+ default: return .settings+ }+ }+private static func find<T: NSView>(_ type: T.Type, in view: NSView?) -> T? {guard let view else { return nil }if let hit = view as? T { return hit }@@ -413,13 +421,13 @@ public enum AppEnvironment {return nil}- /// `CUA_SPACES_START_VIEW`: `new-space`, `new-space-picker`, `new-space-resources`, `keyvault`, `keyvault-waiting`,- /// `approval`, `onboarding` (the first run, in the New UI window), `this-machine`, `host-setup`,- /// `host-configured`, `settings` (the app menu's ⌘, item), `device-approval` (the approval sheet for the first- /// device asking; `CUA_SPACES_APPROVE_CODE` types its code),- /// `device-enroll` (the enroll sheet), `device-enroll-code` (it, having- /// chosen Approve from another device), `space`, `space-window` (the selected- /// Space's own window), the notch states `notch-open`+ /// `CUA_SPACES_START_VIEW` opens the web UI window at a page: `new-space`+ /// (also `new-space-picker`, `new-space-resources`), `keyvault`,+ /// `keyvault-waiting`, `approval` (Access), `onboarding`, `drive`, `this-machine`+ /// (also `host-setup`, `host-configured`: Machines), `settings`,+ /// `settings-devices`, `settings-about`, `settings-experiments`,+ /// `settings-storage`, `device-approval`, `device-enroll`,+ /// `device-enroll-code` (Settings, Devices), `space`; or the notch states `notch-open`/// (`notch`; 1.5 s after launch), `notch-hover`, `notch-permission`,/// `notch-drag-target` (`notch-prompt`) and `notch-drop`; `notch-menu` (the notch/// open and the menu bar menu) and `menu` (the menu alone; `menu-popup`@@ -434,6 +442,7 @@ public enum AppEnvironment {/// start states only.static func applyStartView(_ model: AppModel, notch: NotchController) {let env = DevHooks.environment+ let web = { (route: MainUIRoute) in WebUIWindowController.show(model: model, at: route) }Task {await model.refresh()await model.keyvault.refresh()@@ -459,76 +468,38 @@ public enum AppEnvironment {case "webui":WebUIWindowController.show(model: model)WebUIWindowController.startVideoHarness(model: model)- case "new-space":- await model.openNativeNewSpace()- case "new-space-picker":- await model.openNativeNewSpace()- model.wizard.send(.openImageSuggestions)- case "new-space-resources":- // The Resources step for `CUA_SPACES_WIZARD_IMAGE` on this- // Mac (or `CUA_SPACES_WIZARD_ON=cloud`), with- // `CUA_SPACES_WIZARD_DISK` GB when its disk grows and- // `CUA_SPACES_WIZARD_CPUS` / `CUA_SPACES_WIZARD_MEMORY` (GB).- // Your cloud needs its experiment (this run only).+ case "new-space", "new-space-picker", "new-space-resources":+ // The web wizard (`CUA_SPACES_WIZARD_ON=yours`: Your cloud's+ // experiment on for this run, and "Run on" there).if env["CUA_SPACES_WIZARD_ON"] == "yours" { model.settings.experiments.yourCloud = true }- await model.openNativeNewSpace()- let w = model.wizard- if let image = env["CUA_SPACES_WIZARD_IMAGE"] { w.send(.chooseImage(imageRef: image)) }- w.send(.setPlacement(placement: env["CUA_SPACES_WIZARD_ON"] == "yours" ? .yours : .local))- w.send(.next)- if let disk = env["CUA_SPACES_WIZARD_DISK"].flatMap(UInt32.init) { w.send(.setDisk(diskGb: disk)) }- if let cpus = env["CUA_SPACES_WIZARD_CPUS"].flatMap(UInt32.init) { w.send(.setCpus(cpus: cpus)) }- if let memory = env["CUA_SPACES_WIZARD_MEMORY"].flatMap(UInt32.init) { w.send(.setMemory(memoryGb: memory)) }- case "keyvault":- model.selection = .keyvault(.category(category: .all))- case "keyvault-waiting":- model.selection = .keyvault(.category(category: .waiting))+ WebUIWindowController.showNewSpace(model: model, on: env["CUA_SPACES_WIZARD_ON"])+ case "keyvault", "keyvault-waiting":+ web(.keyvault)case "approval":- model.selection = .keyvault(.category(category: .waiting))- if let first = model.keyvault.overview.pending.first { model.keyvault.openApproval(first.id) }+ web(.access)case "onboarding":- // The first run is the web page's: its window opens on it- // (`RootView`) once the launch is ready.+ // The first run again, on its page.model.onboarding.restart()+ web(.onboarding)case "drive":// The Volume page shows with Cua Volume on (this run only).model.settings.experiments.cuaVolume = true- model.selection = .drive- case "settings":- // The app menu's ⌘, item, as a person presses it: the- // page's Settings in the New UI window.- try? await Task.sleep(for: .seconds(2))- NSApp.activate()- if let item = NSApp.mainMenu?.items.first?.submenu?.items.first(where: { $0.keyEquivalent == "," }),- let action = item.action {- NSApp.sendAction(action, to: item.target, from: item)- }- case "device-approval":- // The approval sheet for the first device asking (it opens- // on its own once the relay lists one).+ web(.drive)+ case "settings", "settings-devices", "settings-storage", "settings-about", "settings-experiments":+ // Storage shows with the Cua Volume experiment on (this run+ // only; the settings file is not written).+ if env["CUA_SPACES_START_VIEW"] == "settings-storage" { model.settings.experiments.cuaVolume = true }+ MainUIRouter(model: model).openSettings(Self.settingsRoute(env["CUA_SPACES_START_VIEW"] ?? "settings"))+ case "device-approval", "device-enroll", "device-enroll-code":+ // The web Devices page has the enroll and approval sheets.await model.devices.refresh()- if model.devices.approval == nil, let first = model.devices.view.approvals.first {- model.devices.openApproval(first, in: .main)- }- if let code = env["CUA_SPACES_APPROVE_CODE"] { model.devices.setCode(code) }- case "device-enroll":- model.devices.startEnroll(in: .main)- case "device-enroll-code":- // "Approve from another device": register, show the code, wait.- model.devices.startEnroll(in: .main)- await model.devices.chooseEnroll(.approve)+ web(.path("/settings/devices"))case "space":model.select("local:aurora")- case "this-machine":- model.select("this-mac")- case "host-setup":- model.select("this-mac")- model.host.openForm()- case "host-configured":+ web(.space("local:aurora"))+ case "this-machine", "host-setup", "host-configured":model.select("this-mac")- model.host.openForm()- model.host.send(.setName(name: "Studio"))- await model.host.submit()+ web(.machines)case "notch", "notch-open":// Closed first, then open once after 1.5 s, so a capture// sees the spring.diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swiftindex 5ef1c75eef..f303dd110e 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift@@ -952,16 +952,9 @@ public final class AppModel {// MARK: - New Space- /// Opens New UI's New Space wizard (`on`: "Run on" preset, or nil);- /// false when there is no New UI window to show it in. Set by the New UI- /// window while the `web_ui` experiment is on.+ /// Opens the web UI's New Space wizard (`on`: "Run on" preset, or nil);+ /// false when there is no window to show it in. Set at launch.public var openWebNewSpace: ((_ on: String?) -> Bool)?- /// Puts the New UI window in the native main window's place (the- /// `web_ui` experiment was turned on).- public var openWebUI: (() -> Void)?- /// Closes the New UI window and puts the native one in its place (the- /// `web_ui` experiment was turned off).- public var closeWebUI: (() -> Void)?/// The first run is due again (Settings, Welcome, Show again): opens its/// window (the web onboarding), which nothing else would while only/// Settings is up.@@ -975,8 +968,8 @@ public final class AppModel {wizard.send(.choosePlacement(on: on))}- /// New Space: New UI's wizard while the `web_ui` experiment is on, else- /// (the fallback) the native sheet.+ /// New Space: the web UI's wizard (the native sheet only without one,+ /// in tests)./// `quick`: the empty home's one click: that OS's default Space, created at once/// when the core says it can be; else New Space opens on it and says why.public func openNewSpace(quick os: AppSpaceOs? = nil) async {@@ -985,7 +978,7 @@ public final class AppModel {}private func openInWebUI(on: String?) -> Bool {- guard settings.experiments.webUi, let open = openWebNewSpace else { return false }+ guard let open = openWebNewSpace else { return false }return open(on)}@@ -1751,13 +1744,9 @@ public final class AppModel {if settings.experiments != before { applyExperiments(before: before, after: settings.experiments) }}- /// What follows a change of the switches: an open New- /// Space, and the New UI's window in place of the native one (or back).+ /// What follows a change of the switches: an open New Space.private func applyExperiments(before: AppExperiments, after: AppExperiments) {guard before != after else { return }- // New UI on: its window takes the native one's place; off: the reverse.- if !before.webUi, after.webUi { openWebUI?() }- if before.webUi, !after.webUi { closeWebUI?() }wizard.update(env: wizardEnv(from: wizard.env))// The Volume page went with Cua Volume: back to the Spaces.if selection == .drive, chrome.volumeLabel == nil { selection = nil }diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/GlobalShortcut.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/GlobalShortcut.swiftindex 02548a5e88..aae189a294 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/GlobalShortcut.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/GlobalShortcut.swift@@ -42,14 +42,10 @@ final class GlobalShortcut {installed = shortcut}- /// The window of the UI in use, in front.+ /// The main window, in front.static func bringForward(_ model: AppModel) {NSApp.activate()- if CuaSpacesMacApp.opensWebUIAtLaunch(model) {- WebUIWindowController.show(model: model)- } else {- WebUIWindowController.actions?.openMain()- }+ MainUIRouter(model: model).openMain()}}diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/CommandPaletteView.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/CommandPaletteView.swiftindex f6ba062695..0f9d39b8ec 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/CommandPaletteView.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/CommandPaletteView.swift@@ -66,31 +66,26 @@ extension AppModel {}}-/// View: Command Palette and ⌘1–4, with the shared keys. The New UI-/// window has its own palette and keys, so these act on the main window.+/// View: Command Palette and ⌘1–4, with the shared keys. The web UI+/// window handles these keys itself while it is in front; from anywhere+/// else (a Space's window) they open it at the page.struct NavigationCommands: View {let model: AppModel- @Environment(\.openWindow) private var openWindowvar body: some View {- Button("Command Palette…") { inMain(.home) { model.showingPalette = true } }+ Button("Command Palette…") { inMain(.home) }.keyboardShortcut(SharedShortcuts.shortcut("commandPalette.toggle"))Divider()ForEach(NavTarget.all(model)) { target in- Button(target.label) { inMain(MainUIRouter.route(forNav: target.command)) { model.go(target.command) } }+ Button(target.label) { inMain(MainUIRouter.route(forNav: target.command)) }.keyboardShortcut(SharedShortcuts.shortcut(target.command))}}- /// The native main window, then `then`; New UI's window at `route`- /// while it is on (its page handles these keys itself when in front).- private func inMain(_ route: MainUIRoute?, _ then: () -> Void) {+ private func inMain(_ route: MainUIRoute?) {if WebUIWindowController.shared?.window?.isKeyWindow == true { return }guard model.startup.isReady, model.onboarding.completed else { return }- MainUIRouter(model: model).open(route ?? .home) {- openWindow(id: "main")- then()- }+ MainUIRouter(model: model).open(route ?? .home)}}diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/CuaSpacesMacApp.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/CuaSpacesMacApp.swiftindex 1ce3ee3660..9f4bda364f 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/CuaSpacesMacApp.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/CuaSpacesMacApp.swift@@ -8,9 +8,12 @@ import Observationimport CuaSpacesStreamingimport SwiftUI-/// Cua Spaces for macOS: the main window, the menu bar extra and the notch-/// panel, all over one `AppModel`. Settings is a page of the New UI window-/// (`WebUIWindowController.openSettings`); there is no Settings window.+/// Cua Spaces for macOS: a thin Swift shell around the shared web UI. The+/// main window is the web UI's (`WebUIWindowController`); the scenes here are+/// what stays native: a Space's desktop in its own window (video), the menu+/// bar extra, and the app's menus (Settings is the page's). The notch panel, permission+/// prompts, Touch ID, the Keychain, launch at login, the updater, URL schemes+/// and notifications are wired in `AppDelegate`, all over one `AppModel`.public struct CuaSpacesMacApp: App {@NSApplicationDelegateAdaptor(AppDelegate.self) private var delegate@State private var model: AppModel@@ -30,16 +33,16 @@ public struct CuaSpacesMacApp: App {}public var body: some Scene {- Window("Cua Spaces", id: "main") {- RootView(model: model)- .environment(\.presenceName, model.presenceName)- .onAppear { delegate.start(model) }+ // A Space's desktop in its own window ("Open"); never at launch. The+ // main window is the web UI's, opened by `AppDelegate.start`.+ WindowGroup(id: "space", for: String.self) { $id in+ if let id {+ SpaceWindowView(model: model, spaceId: id)+ .environment(\.presenceName, model.presenceName)+ }}- .defaultSize(width: 980, height: 660)- // Open at every launch (see `ignoreSavedWindowState`), except while- // New UI is on or the first run is due: then the New UI window opens- // instead (`AppDelegate.start`).- .defaultLaunchBehavior(Self.opensWebUIAtLaunch(model) ? .suppressed : .presented)+ .defaultLaunchBehavior(.suppressed)+ .restorationBehavior(.disabled).commands {CommandGroup(replacing: .newItem) {Button(model.chrome.newSpaceLabel) { Task { await model.openNewSpace() } }@@ -61,16 +64,6 @@ public struct CuaSpacesMacApp: App {}}- // A Space's desktop in its own window ("Open"); never at launch.- WindowGroup(id: "space", for: String.self) { $id in- if let id {- SpaceWindowView(model: model, spaceId: id)- .environment(\.presenceName, model.presenceName)- }- }- .defaultLaunchBehavior(.suppressed)- .restorationBehavior(.disabled)-// Not inserted in an offscreen run (`OffscreenRun`).MenuBarExtra(isInserted: .constant(!OffscreenRun.isOn)) {MenuBarContent(model: model)@@ -78,18 +71,11 @@ public struct CuaSpacesMacApp: App {MenuBarLabel(model: model)}}-- /// New UI is on, or the first run is due (it is the web UI's onboarding):- /// a launch opens the New UI window rather than the native main window.- static func opensWebUIAtLaunch(_ model: AppModel) -> Bool {- opensWebUIAtLaunch(webUi: model.settings.experiments.webUi, onboarded: model.onboarding.completed)- }-- static func opensWebUIAtLaunch(webUi: Bool, onboarded: Bool) -> Bool { webUi || !onboarded }}-/// The menu bar icon. It is there from launch, so it also hands the New UI-/// window the scenes' actions when the main window never opened.+/// The menu bar icon. It is there from launch, so it hands the web UI+/// window the scenes' actions (a Space's own window). An offscreen run has+/// no menu bar item, so no Space window opens there (captures need none).struct MenuBarLabel: View {let model: AppModel@Environment(\.openWindow) private var openWindow@@ -110,59 +96,15 @@ struct MenuBarLabel: View {}}-/// The main window. The first run is not drawn here: it is the shared web-/// onboarding, in the New UI window (see `MainWindowSwitch`).-struct RootView: View {- @Bindable var model: AppModel- @Environment(\.dismissWindow) private var dismissWindow- @Environment(\.openWindow) private var openWindow-- var body: some View {- if !model.startup.isReady {- // The launch (the keychain, the daemon) until the live services- // are in; then the first run or the main window.- StartupView(startup: model.startup)- .onAppear {- if model.onboarding.completed, AppDelegate.takeQuietStart() { dismissWindow(id: "main") }- }- } else if model.onboarding.completed {- MainWindow(model: model)- // New UI on: whatever opened this window gets New UI in its place.- .background(WindowReader { MainWindowSwitch.nativeAppeared($0, model: model) })- .onAppear {- // The New UI window's bridge opens these scenes.- WebUIWindowController.actions = .make(openWindow: openWindow)- // Opened at login: the menu bar item and the notch only,- // as after the window is closed (once per launch).- if AppDelegate.takeQuietStart() { dismissWindow(id: "main"); return }- MainWindowSwitch.nativeAppeared(nil, model: model)- }- } else {- // First run: the web onboarding opens in this window's place.- Color.clear- .background(WindowReader { MainWindowSwitch.firstRunAppeared($0, model: model) })- .onAppear {- WebUIWindowController.actions = .make(openWindow: openWindow)- MainWindowSwitch.firstRunAppeared(nil, model: model)- }- }- }-}--/// Help, Getting Started: the checklist again, in the main window.+/// Help, Getting Started: the checklist again, on the Spaces page.struct GettingStartedCommand: View {let model: AppModel- @Environment(\.openWindow) private var openWindowvar body: some View {Button("Getting Started") {guard model.startup.isReady, model.onboarding.completed else { return }model.openGettingStarted()- // New UI shows the checklist on its Spaces page.- MainUIRouter(model: model).open(.home) {- NSApp.activate()- openWindow(id: "main")- }+ MainUIRouter(model: model).open(.home)}}}@@ -185,14 +127,13 @@ struct SystemStatusCommand: View {struct MenuBarContent: View {let model: AppModelvar disk: LowDiskMonitor = .shared- @Environment(\.openWindow) private var openWindowvar body: some View {// This Mac is short of space: the warning, with the Cua key, first.// Nothing when there's room. It opens the Spaces, biggest first.if let text = disk.warning.menuText {Button {- MainUIRouter(model: model).open(.path("/spaces?sort=size")) { activate(); openWindow(id: "main") }+ MainUIRouter(model: model).open(.path("/spaces?sort=size"))} label: {if let key = MenuBarKey.image {Label { Text(text) } icon: { Image(nsImage: key) }@@ -225,24 +166,16 @@ struct MenuBarContent: View {private func run(_ id: AppMenuItemId) {let router = MainUIRouter(model: model)switch id {- case .open: router.open(.home) { activate(); openWindow(id: "main") }+ case .open: router.openMain()case .newSpace:- activate()- // The native sheet needs the main window; New UI opens its own.- if !model.settings.experiments.webUi { openWindow(id: "main") }+ NSApp.activate()Task { await model.openNewSpace() }case .settings: router.openSettings()- case .volumeConflicts:- router.open(.drive) {- activate(); openWindow(id: "main")- model.selection = .drive- }+ case .volumeConflicts: router.open(.drive)case .quit: NSApp.terminate(nil)case .status, .separator: break}}-- private func activate() { NSApp.activate() }}/// The Cua key at menu item size, for the low-disk warning.@@ -286,17 +219,9 @@ final class AppDelegate: NSObject, NSApplicationDelegate {private var notch: NotchController?private var started = false- /// The system opened the app at login (read as the launch begins).+ /// The system opened the app at login (read as the launch begins): no+ /// window, only the menu bar item and the notch.private(set) static var launchedAtLogin = false- private static var quietStartTaken = false-- /// Once per launch: whether the main window should close because the- /// app was opened at login.- static func takeQuietStart() -> Bool {- guard launchedAtLogin, !quietStartTaken else { return false }- quietStartTaken = true- return true- }/// Whether a launch brings the app to the front: a user's launch does,/// one at login never does, a fixtures run only with@@ -317,13 +242,11 @@ final class AppDelegate: NSObject, NSApplicationDelegate {}/// The Dock icon (or opening the app again) with no window up: the main- /// UI in use, New UI while it is on. The notch and the menu bar item's- /// panels don't count as windows.+ /// window (the first run while it is due). The notch and the menu bar+ /// item's panels don't count as windows.func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool {- let model = Self.model- guard model.startup.isReady, model.onboarding.completed else { return true }guard !NSApp.windows.contains(where: { $0.isVisible && $0.canBecomeMain }) else { return true }- MainUIRouter(model: model).open(.home) { WebUIWindowController.actions?.openMain() }+ MainUIRouter(model: Self.model).openMain()return false}@@ -342,63 +265,35 @@ final class AppDelegate: NSObject, NSApplicationDelegate {// The one-time move of the host service into this app (Cua Spaces// Helper): its own window, over whichever UI is up.HelperMoveWindow.follow(model.host, loginLaunch: Self.launchedAtLogin)- // New Space opens New UI's wizard while its experiment is on.+ // New Space: the web UI's wizard, in its window.model.openWebNewSpace = { on in WebUIWindowController.showNewSpace(model: model, on: on) }- // New UI on and off: one window, its frame kept, never two.- model.openWebUI = { MainWindowSwitch.switchToWebUI(model: model) }- model.closeWebUI = { WebUIWindowController.closeShared() }- // "Show again" for the first run: the web onboarding's window.+ // "Show again" for the first run: the web onboarding's page.model.openOnboarding = { WebUIWindowController.show(model: model, at: .onboarding) }let controller = NotchController(model: model.notch)controller.sidebar = model.dropTargetscontroller.pageTiles = model.pageDropTargets- controller.showMain = { WebUIWindowController.actions?.openMain() }- // Each of these shows its result in the main window (the New UI- // window while its experiment is on): open it when it was closed- // (the notch stays up without it), or a drop would commit to- // nothing visible.+ // Each of these shows its result in the web UI window, opening it+ // when it was closed (the notch stays up without it), or a drop+ // would commit to nothing visible.let router = MainUIRouter(model: model)- controller.onOpenSpace = { [weak controller] id in+ controller.showMain = { router.openMain() }+ controller.onOpenSpace = { id inmodel.select(id)- router.open(.space(id)) {- NSApp.activate()- controller?.showMain?()- }- }- controller.onOpenList = { [weak controller] in- router.open(.home) { controller?.showMain?() }+ router.open(.space(id))}+ controller.onOpenList = { router.openMain() }controller.onOpenSettings = { router.openSettings() }- controller.onOpenAccess = { [weak controller] in- router.open(.access) {- model.selection = .keyvault(.category(category: .access))- NSApp.activate()- controller?.showMain?()- }- }+ controller.onOpenAccess = { router.open(.access) }controller.onDismissAccess = { model.keyvault.dismiss() }- controller.onTeleport = { [weak controller] spaceId, entry in+ controller.onTeleport = { spaceId, entry inmodel.select(spaceId)// The page opens Teleport at the app as for a drop of it.let app = entry?.hostPath.map { URL(fileURLWithPath: $0) }- router.open(.space(spaceId, dropped: app.map { [$0] } ?? [])) {- model.pendingTeleport = PendingTeleport(spaceId: spaceId, entry: entry, files: [])- NSApp.activate()- controller?.showMain?()- }+ router.open(.space(spaceId, dropped: app.map { [$0] } ?? []))}- controller.onDropURLs = { [weak controller] spaceId, urls in+ controller.onDropURLs = { spaceId, urls inmodel.select(spaceId)- router.open(.space(spaceId, dropped: urls)) {- Task {- guard let context = try? await model.backend.teleportContext(id: spaceId) else { return }- let parsed = context.0.parseDrop(items: urls.map(\.path))- let entry = parsed.apps.first.flatMap { try? context.0.catalogEntryForPath(path: $0, options: nil) }- model.pendingTeleport = PendingTeleport(spaceId: spaceId, entry: entry, files: parsed.files)- NSApp.activate()- controller?.showMain?()- }- }+ router.open(.space(spaceId, dropped: urls))}// "Spaces tab in the notch": applied now and on every change (an// offscreen run never puts the notch up).@@ -425,11 +320,12 @@ final class AppDelegate: NSObject, NSApplicationDelegate {// ⌘⇧Space from any app: the window of the UI in use, in front.if !OffscreenRun.isOn { GlobalShortcut.install(model) }AppEnvironment.applyStartView(model, notch: controller)- // New UI on, or the first run due: the New UI window is the one a- // launch opens (the main window is suppressed), the first run at- // `/onboarding`; not when opened at login.- if CuaSpacesMacApp.opensWebUIAtLaunch(model), !Self.launchedAtLogin {- if let route = MainWindowSwitch.firstRunRoute(onboarded: model.onboarding.completed) {+ // The web UI window is the one a launch opens, the first run at+ // `/onboarding` while it is due; not when opened at login, and not+ // for a start view (`applyStartView` opens its own page). The page+ // draws the launch (`startup.get`) until the live services are in.+ if !Self.launchedAtLogin {+ if let route = MainUIRouter.launchRoute(onboarded: model.onboarding.completed) {WebUIWindowController.show(model: model, at: route)} else if DevHooks.value("CUA_SPACES_START_VIEW") == nil {WebUIWindowController.show(model: model)@@ -451,19 +347,14 @@ final class AppDelegate: NSObject, NSApplicationDelegate {await model.keyvault.refresh()}}- // A device asking to join is announced (a notification and the- // approval sheet) even with the window closed; this Mac's own- // enrollment shows as the main window's banner. Nothing else asks.+ // A device asking to join is announced (a notification) even with+ // the window closed; this Mac's own enrollment shows as the page's+ // banner. Nothing else asks.model.devices.notify = { DeviceNotifier.shared.post($0) }- // A click on one of the app's notifications: the main UI in use- // (a Space that came up: its page).+ // A click on one of the app's notifications: its page.DeviceNotifier.shared.onOpen = { id in- if let spaceId = SpaceReadyNote.spaceId(fromIdentifier: id) {- model.select(spaceId)- router.open(.space(spaceId)) { WebUIWindowController.actions?.openMain() }- return- }- router.open(id.hasPrefix("agent-") ? .agents : .home) { WebUIWindowController.actions?.openMain() }+ if let spaceId = SpaceReadyNote.spaceId(fromIdentifier: id) { model.select(spaceId) }+ router.open(MainUIRouter.route(forNotification: id))}// Persistent agents' answers and requests, from the daemon's feed,// while the app runs (the daemon keeps them while it does not).diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/MainUIRoute.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/MainUIRoute.swiftindex 0ed8c3f739..723c73b2e0 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/MainUIRoute.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/MainUIRoute.swift@@ -4,9 +4,9 @@import AppKitimport Foundation-/// Where the app's chrome (the notch, the menu bar item) opens the main UI.-/// With New UI on it is a page of the New UI window, at the routes the-/// Electron app opens for the same actions (apps/cua-spaces-desktop/src/main.ts).+/// Where the app's chrome (the notch, the menu bar item) opens the main UI:+/// a page of the web UI window, at the routes the Electron app opens for the+/// same actions (apps/cua-spaces-desktop/src/main.ts).public enum MainUIRoute: Equatable, Sendable {/// The Spaces list.case home@@ -68,14 +68,14 @@ public enum MainUIRoute: Equatable, Sendable {}}-/// The one place the app's chrome (the notch, the menu bar item, the menus,-/// notifications) opens the main UI: the New UI window at a route while its-/// experiment is on, else the native window as before. Settings is always-/// the page's (`openSettings`).+/// The one place the app's chrome (the Dock icon, the notch, the menu bar+/// item, the menus, ⌘⇧Space, notifications) opens the main UI: the web UI+/// window (`WebUIWindowController`) at a route. It is the app's only main+/// window; there is no native one to fall back to.@MainActorstruct MainUIRouter {let model: AppModel- /// Opens the New UI window at a route (tests set their own).+ /// Opens the web UI window at a route (tests set their own).var web: (MainUIRoute) -> Void/// Opens the page's Settings (tests set their own).var settings: (MainUIRoute) -> Void@@ -86,13 +86,43 @@ struct MainUIRouter {self.settings = settings ?? { WebUIWindowController.openSettings(model: model, at: $0) }}- func open(_ route: MainUIRoute, native: () -> Void) {- if model.settings.experiments.webUi { web(route) } else { native() }+ func open(_ route: MainUIRoute) {+ web(route)+ }++ /// The main window as the person left it, or the first run while it is+ /// due (`launchRoute`): the Dock icon, Open, ⌘⇧Space, the notch's list.+ func openMain() {+ if let route = Self.launchRoute(onboarded: model.onboarding.completed) {+ web(route)+ } else if WebUIWindowController.shared != nil {+ // Open already: in front, on the page it shows.+ WebUIWindowController.show(model: model)+ } else {+ web(.home)+ }+ }++ /// Where a window opens while the first run may be due: its page until it+ /// is done (`.firstRunDue`, which keeps a "Skip for now"), else nil (the+ /// page the window shows, or Spaces).+ static func launchRoute(onboarded: Bool) -> MainUIRoute? {+ onboarded ? nil : .firstRunDue+ }++ /// The page a click on one of the app's notifications opens: a Space that+ /// came up (its page), a device asking to join (Settings, Devices, with+ /// its approval), an agent's answer or request (Agents), else Spaces.+ static func route(forNotification id: String) -> MainUIRoute {+ if let spaceId = SpaceReadyNote.spaceId(fromIdentifier: id) { return .space(spaceId) }+ if id.hasPrefix("device-") { return .path("/settings/devices") }+ if id.hasPrefix("agent-") { return .agents }+ return .home}/// Settings (⌘,, the menu bar item, the notch, the palette): the page's- /// Settings in the New UI window, with New UI on or off. There is no- /// native Settings window, so the two can't drift. `route`: one tab+ /// Settings in the web UI window. There is no native Settings window,+ /// so the two can't drift. `route`: one tab/// (`/settings/connected-apps`, ...).func openSettings(_ route: MainUIRoute = .settings) {settings(route)@@ -110,115 +140,3 @@ struct MainUIRouter {}}}--/// New UI (preview) is the main window while it is on, not a second one:-/// turning it on puts its window where the native one was (same frame) and-/// closes that; turning it off does the reverse. Whatever opens the native-/// main window while it is on (the Dock, the Window menu, a path not routed-/// through `MainUIRouter`) gets the New UI window in its place.-///-/// The first run is the web UI's onboarding, with New UI on or off: until it-/// is done the native window never shows anything of its own, and whatever-/// opens it gets the New UI window at `/onboarding` in its place. Once done,-/// New UI off puts the native window back (`WebUIWindowController.closeShared`).-@MainActor-enum MainWindowSwitch {- /// The native main window (`Window(id: "main")`), while it exists.- static weak var nativeWindow: NSWindow?- /// Where the native window opens next: New UI's frame when it was turned off.- static var pendingNativeFrame: NSRect?-- /// Whether the native window showing the main UI (not the launch or the- /// first run) gives way to New UI.- static func replacesNative(webUi: Bool, ready: Bool, onboarded: Bool) -> Bool {- webUi && ready && onboarded- }-- static func replacesNative(_ model: AppModel) -> Bool {- replacesNative(webUi: model.settings.experiments.webUi, ready: model.startup.isReady,- onboarded: model.onboarding.completed)- }-- /// The first run is due and the launch is ready: the web onboarding- /// replaces the native window, whether or not New UI is on.- static func opensFirstRun(ready: Bool, onboarded: Bool) -> Bool {- ready && !onboarded- }-- static func opensFirstRun(_ model: AppModel) -> Bool {- opensFirstRun(ready: model.startup.isReady, onboarded: model.onboarding.completed)- }-- /// Where a window opens while the first run may be due: its page until it- /// is done (`.firstRunDue`, which keeps a "Skip for now"), else nil, the- /// app as it was. The launch and the native window's replacement both ask.- static func firstRunRoute(onboarded: Bool) -> MainUIRoute? {- onboarded ? nil : .firstRunDue- }-- /// The native window is up while the first run is due (and the launch is- /// ready): the web onboarding opens in its frame and it closes.- static func firstRunAppeared(_ window: NSWindow?, model: AppModel, web: ((NSRect?) -> Void)? = nil) {- if let window { nativeWindow = window }- guard opensFirstRun(model), let window = window ?? nativeWindow else { return }- replace(window, model: model, web: web)- }-- /// The native window is showing the main UI (`MainWindow` appeared in- /// it): with New UI on, New UI opens in its frame and it closes.- static func nativeAppeared(_ window: NSWindow?, model: AppModel,- web: ((NSRect?) -> Void)? = nil) {- if let window { nativeWindow = window }- guard let window = window ?? nativeWindow else { return }- if let frame = pendingNativeFrame {- pendingNativeFrame = nil- // After SwiftUI placed it.- DispatchQueue.main.async { window.setFrame(frame, display: true) }- }- guard replacesNative(model) else { return }- replace(window, model: model, web: web)- }-- /// New UI was turned on: its window takes the native one's place.- static func switchToWebUI(model: AppModel, web: ((NSRect?) -> Void)? = nil) {- guard let window = nativeWindow, window.isVisible else {- // No native window up (only Settings, say): New UI opens as at launch.- if model.startup.isReady, model.onboarding.completed { (web ?? { show(model, frame: $0) })(nil) }- return- }- replace(window, model: model, web: web)- }-- /// The native window being closed for New UI (its reader and its- /// `onAppear` both report it).- private static weak var replacing: NSWindow?-- private static func replace(_ window: NSWindow, model: AppModel, web: ((NSRect?) -> Void)?) {- guard replacing !== window else { return }- replacing = window- let frame = window.frame.width > 0 ? window.frame : nil- // Never seen: hidden before it draws, where it can.- window.alphaValue = 0- (web ?? { show(model, frame: $0) })(frame)- DispatchQueue.main.async {- window.close()- window.alphaValue = 1- if replacing === window { replacing = nil }- }- }-- private static func show(_ model: AppModel, frame: NSRect?) {- // The first run opens on its page; the rest is the app as it was.- if let route = firstRunRoute(onboarded: model.onboarding.completed) {- WebUIWindowController.show(model: model, at: route, frame: frame)- } else {- WebUIWindowController.show(model: model, frame: frame)- }- }-- /// New UI was turned off: the native window opens in its frame.- static func switchToNative(webFrame: NSRect?, openMain: (() -> Void)?) {- pendingNativeFrame = webFrame- openMain?()- }-}diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swiftindex 1b37c48890..455e648dba 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swift@@ -14,12 +14,9 @@ import WebKitpublic struct WebUIActions {/// A Space's desktop in its own native window (video stays native).public var openSpace: (String) -> Void- /// The native main window (a passphrase is chosen there).- public var openMain: () -> Void- public init(openSpace: @escaping (String) -> Void, openMain: @escaping () -> Void) {+ public init(openSpace: @escaping (String) -> Void) {self.openSpace = openSpace- self.openMain = openMain}}@@ -461,15 +458,13 @@ final class WebUIBridge: NSObject, WKScriptMessageHandlerWithReply {/// `onboarding.complete {mode, launchAtLogin?}`: "Start using Cua Spaces"./// Saved to `onboarding.json`, Done's "Launch at login" applied, the usage- /// notice counted as shown. With New UI off the page was only the first- /// run's stand-in: its window gives way to the native main window.+ /// notice counted as shown. The page goes on to Spaces in the same window.func completeOnboarding(_ args: [String: Any]) throws -> [String: Any] {guard let word = args["mode"] as? String, word == "client" || word == "host" else {throw Failure.badArgs("mode: client | host")}model.onboarding.finish(mode: word == "host" ? .host : .client, launchAtLogin: args["launchAtLogin"] as? Bool)model.telemetrySink?.acknowledgeNotice()- if !model.settings.experiments.webUi { model.closeWebUI?() }return onboarding()}diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUISchemeHandler.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUISchemeHandler.swiftindex ad3d9f6c0e..25ed7298e3 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUISchemeHandler.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUISchemeHandler.swift@@ -8,7 +8,9 @@ import WebKit/// Serves the bundled web UI (`Contents/Resources/WebUI`) at/// `cua-spaces://app/`. A path without a file behind it and without an/// extension is a client-side route and gets `index.html`. Nothing outside-/// the WebUI directory is ever read.+/// the WebUI directory is read, except the app's own files listed in+/// `appFiles` under `/__app/` (About's Acknowledgements reads the bundled+/// third-party notices there, never from the network).final class WebUISchemeHandler: NSObject, WKURLSchemeHandler {static let scheme = "cua-spaces"static let host = "app"@@ -17,9 +19,32 @@ final class WebUISchemeHandler: NSObject, WKURLSchemeHandler {/// The web build's directory, or nil when this build carries none (the/// placeholder page says how to add it).let root: URL?+ /// The app's own files the page may read, by name, at `/__app/<name>`.+ let appFiles: [String: URL]- init(root: URL? = WebUISchemeHandler.bundledRoot()) {+ /// Where the page reads the app's own files.+ static let appPrefix = "/__app/"++ init(root: URL? = WebUISchemeHandler.bundledRoot(), appFiles: [String: URL] = WebUISchemeHandler.bundledAppFiles()) {self.root = root?.standardizedFileURL+ self.appFiles = appFiles+ }++ /// The app's third-party notices (`THIRD_PARTY_NOTICES.md`, copied into+ /// `Contents/Resources` by `scripts/build-app.sh`; in a debug build the+ /// checkout's copy when the bundle has none).+ static func bundledAppFiles() -> [String: URL] {+ let name = "THIRD_PARTY_NOTICES.md"+ var candidates: [URL] = []+ if let r = Bundle.main.resourceURL { candidates.append(r.appendingPathComponent(name)) }+ #if DEBUG+ // Sources/CuaSpacesMacKit/WebHost/<file> -> apps/cua-spaces-macos+ let app = URL(fileURLWithPath: #filePath).deletingLastPathComponent()+ .deletingLastPathComponent().deletingLastPathComponent().deletingLastPathComponent()+ candidates.append(app.appendingPathComponent(name))+ #endif+ guard let file = candidates.first(where: { FileManager.default.fileExists(atPath: $0.path) }) else { return [:] }+ return [name: file]}/// Where the web build is: the app's `Contents/Resources/WebUI`@@ -43,6 +68,12 @@ final class WebUISchemeHandler: NSObject, WKURLSchemeHandler {guard let url = task.request.url, url.scheme == Self.scheme, url.host == Self.host else {return fail(task, URLError(.unsupportedURL))}+ if url.path.hasPrefix(Self.appPrefix) {+ guard let file = appFile(url.path), let data = try? Data(contentsOf: file) else {+ return respond(task, url: url, data: Data(), mime: "text/plain", status: 404)+ }+ return respond(task, url: url, data: data, mime: "text/markdown", status: 200)+ }guard let root else {let isPage = url.path.isEmpty || url.path == "/" || url.pathExtension.isEmptyreturn isPage ? respond(task, url: url, data: Data(Self.placeholder.utf8), mime: "text/html", status: 200)@@ -61,6 +92,13 @@ final class WebUISchemeHandler: NSObject, WKURLSchemeHandler {func webView(_ webView: WKWebView, stop task: WKURLSchemeTask) {}+ /// The app file a `/__app/<name>` path names: only the listed files, by+ /// exact name (no other path reaches the bundle).+ func appFile(_ path: String) -> URL? {+ guard path.hasPrefix(Self.appPrefix) else { return nil }+ return appFiles[String(path.dropFirst(Self.appPrefix.count))]+ }+/// The file for a request path: inside `root` only; extensionless/// misses fall back to `index.html` (the app's own routing).func resolve(_ path: String, in root: URL) -> URL? {diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIWindow.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIWindow.swiftindex 81f54435e0..566a2c8d5d 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIWindow.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIWindow.swift@@ -6,10 +6,11 @@ import CuaSpacesFFIimport SwiftUIimport WebKit-/// New UI (preview): the shared React UI (`apps/cua-spaces-web`) in a window-/// of its own, behind the `web_ui` experiment. The notch, the menu bar extra,-/// Touch ID and video stay native; a Space's desktop opens in its native-/// window.+/// The app's main window: the shared React UI (`apps/cua-spaces-web`) in a+/// `WKWebView`. It is the only main window; the Swift shell around it keeps+/// what has to be native: the notch, the menu bar extra, permission prompts,+/// Touch ID, the Keychain, the updater and video (a Space's desktop opens in+/// its native window).////// - Release: the bundled build (`Contents/Resources/WebUI`) at/// `cua-spaces://app/` through `WebUISchemeHandler`.@@ -23,8 +24,8 @@ import WebKitpublic final class WebUIWindowController: NSWindowController, NSWindowDelegate, WKNavigationDelegate, WKUIDelegate {/// The open window, if any (one per app).public private(set) static var shared: WebUIWindowController?- /// What the scenes let the bridge do (open a Space's window, the main- /// window, Settings); set by whichever SwiftUI view saw them last.+ /// What the scenes let the bridge do (open a Space's window); set by+ /// whichever SwiftUI view saw them last.public static var actions: WebUIActions? {didSet { shared?.bridge.actions = actions }}@@ -44,8 +45,7 @@ public final class WebUIWindowController: NSWindowController, NSWindowDelegate,return devServer}- /// Opens the window, or brings it forward; at `frame` when given (the- /// native main window's, which it replaces).+ /// Opens the window, or brings it forward; at `frame` when given.public static func show(model: AppModel, frame: NSRect? = nil) {show(model: model, frame: frame, startRoute: nil)}@@ -83,20 +83,7 @@ public final class WebUIWindowController: NSWindowController, NSWindowDelegate,/// The apps and files last dropped on a notch tile, until the page takes them.static var notchDrop: [URL] = []- /// Closes the New UI window, if open (its experiment was turned off),- /// and shows the native main window in its place, at its frame.- public static func closeShared() {- guard let c = shared else { return }- let main = c.bridge.actions?.openMain ?? actions?.openMain- // After the bridge answered the page's switch.- DispatchQueue.main.async {- let frame = c.window?.isVisible == true ? c.window?.frame : nil- c.window?.close()- MainWindowSwitch.switchToNative(webFrame: frame, openMain: main)- }- }-- /// New Space in the New UI window: opens it (or brings it forward) and+ /// New Space in the web UI window: opens it (or brings it forward) and/// asks the page for its wizard ("Run on" set to `on` when given).@discardableResultpublic static func showNewSpace(model: AppModel, on: String?) -> Bool {@@ -551,8 +538,6 @@ extension NSColor {extension WebUIActions {/// The scenes' window actions for the bridge.static func make(openWindow: OpenWindowAction) -> WebUIActions {- WebUIActions(- openSpace: { id in NSApp.activate(); openWindow(id: "space", value: id) },- openMain: { NSApp.activate(); openWindow(id: "main") })+ WebUIActions(openSpace: { id in NSApp.activate(); openWindow(id: "space", value: id) })}}diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/BridgeContractTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/BridgeContractTests.swiftindex 5838219bcc..2b4dd70dde 100644--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/BridgeContractTests.swift+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/BridgeContractTests.swift@@ -43,7 +43,7 @@ struct BridgeContractTests {settingsPath: dir.appendingPathComponent("settings.json").path,telemetry: FixtureTelemetry())let bridge = WebUIBridge(model: model, allowedOrigins: [])- bridge.actions = WebUIActions(openSpace: { _ in }, openMain: {})+ bridge.actions = WebUIActions(openSpace: { _ in })// The CLI's plan on temp folders, not this Mac's ~/.local/bin.let cliDir = dir.appendingPathComponent("cli").pathbridge.makeCliInstaller = {@@ -196,7 +196,7 @@ struct BridgeContractTests {await model.refresh()await model.keyvault.refresh()let bridge = WebUIBridge(model: model, allowedOrigins: [])- bridge.actions = WebUIActions(openSpace: { _ in }, openMain: {})+ bridge.actions = WebUIActions(openSpace: { _ in })// The CLI's plan on temp folders, not this Mac's ~/.local/bin.let cliDir = dir.appendingPathComponent("cli").pathbridge.makeCliInstaller = {diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/FirstRunTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/FirstRunTests.swiftindex f1b52630fa..39bf148241 100644--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/FirstRunTests.swift+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/FirstRunTests.swift@@ -16,7 +16,7 @@ import Testingstruct FirstRunTests {init() { _ = NSApplication.shared }- func bridge(webUi: Bool = false, backend: SpacesBackend = FixtureSpacesBackend(),+ func bridge(backend: SpacesBackend = FixtureSpacesBackend(),loginItem: LoginItemControlling? = nil) -> (WebUIBridge, AppModel, FixtureTelemetry, URL) {let dir = FileManager.default.temporaryDirectory.appendingPathComponent("cua-firstrun-\(UUID().uuidString)")let state = dir.appendingPathComponent("onboarding.json")@@ -25,7 +25,7 @@ struct FirstRunTests {onboarding: OnboardingModel(statePath: state.path),settingsPath: dir.appendingPathComponent("settings.json").path, telemetry: telemetry,loginItem: loginItem)- model.settings.experiments = AppExperiments(cuaVolume: false, yourCloud: false, sharing: true, webUi: webUi)+ model.settings.experiments = AppExperiments(cuaVolume: false, yourCloud: false, sharing: true, webUi: true)let bridge = WebUIBridge(model: model, allowedOrigins: [])bridge.notifySpaceReady = { _ in }return (bridge, model, telemetry, state)@@ -37,15 +37,6 @@ struct FirstRunTests {// MARK: - The first run's window- /// The first run is the web onboarding, with New UI on or off: once the- /// launch is ready and until it is done, the native window gives way.- @Test func theFirstRunIsTheWebOnboardingWhateverTheNewUISetting() {- #expect(MainWindowSwitch.opensFirstRun(ready: true, onboarded: false))- #expect(!MainWindowSwitch.opensFirstRun(ready: false, onboarded: false), "the launch screen waits")- #expect(!MainWindowSwitch.opensFirstRun(ready: true, onboarded: true))- #expect(MainUIRoute.onboarding.webPath == "/onboarding")- }-/// A launch (or a window that opens again) while the first run is not/// done asks for it as due, so the page can keep a "Skip for now": the/// welcome came back at every launch, in Cua Spaces Local as in the@@ -53,49 +44,11 @@ struct FirstRunTests {/// asking for it (Settings, Welcome) still gets the page unconditionally.@Test func aWindowOpeningWhileTheFirstRunIsDueLetsThePageHonourSkipForNow() {#expect(MainUIRoute.firstRunDue.webPath == "/onboarding?due=1")- #expect(MainWindowSwitch.firstRunRoute(onboarded: false) == .firstRunDue)- #expect(MainWindowSwitch.firstRunRoute(onboarded: true) == nil, "done: the app as it was")+ #expect(MainUIRouter.launchRoute(onboarded: false) == .firstRunDue)+ #expect(MainUIRouter.launchRoute(onboarded: true) == nil, "done: the app as it was")#expect(MainUIRoute.onboarding.webPath == "/onboarding", "Show again has no due: it always shows")}- /// A window that is never shown (the replacement only reads its frame- /// and closes it).- func hiddenWindow() -> NSWindow {- let w = NSWindow(contentRect: NSRect(x: 40, y: 40, width: 760, height: 480),- styleMask: [.titled, .closable, .resizable], backing: .buffered, defer: true)- w.isReleasedWhenClosed = false- return w- }-- /// First run, New UI on or off: the native window that appeared is- /// replaced in its frame by the web window, never drawn.- @Test func theNativeWindowOnAFirstRunIsReplacedInPlace() async {- for webUi in [false, true] {- let (_, model, _, _) = bridge(webUi: webUi)- let w = hiddenWindow()- let frame = w.frame- var opened: [NSRect?] = []- MainWindowSwitch.firstRunAppeared(w, model: model, web: { opened.append($0) })- // Reported twice (its reader, its onAppear): replaced once.- MainWindowSwitch.firstRunAppeared(nil, model: model, web: { opened.append($0) })- #expect(opened == [frame], "New UI \(webUi ? "on" : "off")")- await yield()- await yield()- #expect(w.alphaValue == 1, "hidden before it draws, then back to normal")- }- }-- /// Once the first run is done the native window is left alone.- @Test func theNativeWindowStaysOnceTheFirstRunIsDone() async {- let (_, model, _, _) = bridge()- model.onboarding.finish()- let w = hiddenWindow()- var opened = 0- MainWindowSwitch.firstRunAppeared(w, model: model, web: { _ in opened += 1 })- await yield()- #expect(opened == 0 && w.alphaValue == 1)- }-// MARK: - onboarding.get, onboarding.complete@Test func theFirstRunIsDueUntilItFinishesAndPersists() async throws {@@ -134,19 +87,6 @@ struct FirstRunTests {#expect(model.settings.launchAtLogin == true)}- /// With New UI off the web page stood in for the first run: its window- /// gives way to the native one. With it on, the page carries on in the- /// same window.- @Test func completingHandsOverToTheNativeWindowOnlyWithNewUIOff() async throws {- for webUi in [false, true] {- let (bridge, model, _, _) = bridge(webUi: webUi)- var closed = 0- model.closeWebUI = { closed += 1 }- _ = try await bridge.handle("onboarding.complete", ["mode": "client"])- #expect(closed == (webUi ? 0 : 1), "New UI \(webUi ? "on" : "off")")- }- }-// MARK: - The usage notice@Test func theUsageNoticeIsSeenWhenWelcomeIsLeftNotBefore() async throws {diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/MainUIRouteTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/MainUIRouteTests.swiftindex eb6c890d29..9bd96e5849 100644--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/MainUIRouteTests.swift+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/MainUIRouteTests.swift@@ -7,21 +7,21 @@ import CuaSpacesFFIimport Foundationimport Testing-/// With New UI on, the notch and the menu bar item open the New UI window at-/// the page Electron opens for the same action; with it off, the native-/// window or Settings as before.+/// The notch, the menu bar item, the menus and notifications open the web UI+/// window (the only main window) at the page Electron opens for the same+/// action.@MainActor@Suite("Main UI routes", .serialized)struct MainUIRouteTests {init() { _ = NSApplication.shared }- func model(webUi: Bool) -> AppModel {+ func model() -> AppModel {let dir = FileManager.default.temporaryDirectory.appendingPathComponent("cua-route-\(UUID().uuidString)")let m = AppModel(backend: FixtureSpacesBackend(), keyvault: KeyvaultModel(client: nil),onboarding: OnboardingModel(statePath: dir.appendingPathComponent("onboarding.json").path),settingsPath: dir.appendingPathComponent("settings.json").path,telemetry: FixtureTelemetry())- m.settings.experiments = AppExperiments(cuaVolume: true, yourCloud: false, sharing: false, webUi: webUi)+ m.settings.experiments = AppExperiments(cuaVolume: true, yourCloud: false, sharing: false, webUi: true)return m}@@ -39,22 +39,44 @@ struct MainUIRouteTests {#expect(MainUIRoute.home.dropped.isEmpty)}- @Test func newUIOnOpensTheWebWindowElseTheNativeOne() {- for webUi in [true, false] {- var web: [MainUIRoute] = []- var native = 0- let router = MainUIRouter(model: model(webUi: webUi), web: { web.append($0) })- router.open(.space("s1")) { native += 1 }- router.open(.settings) { native += 1 }- #expect(web == (webUi ? [.space("s1"), .settings] : []))- #expect(native == (webUi ? 0 : 2))- }+ /// Every route opens the web UI window, whatever an older build saved+ /// for the New UI (there is no native window to fall back to).+ @Test func everyRouteOpensTheWebWindow() {+ let m = model()+ m.settings.experiments.webUi = false+ var web: [MainUIRoute] = []+ let router = MainUIRouter(model: m, web: { web.append($0) })+ router.open(.space("s1"))+ router.open(.settings)+ #expect(web == [.space("s1"), .settings])+ }++ /// Open, the Dock icon, ⌘⇧Space: the first run while it is due, else Spaces.+ @Test func theMainWindowIsTheFirstRunUntilItIsDone() {+ let m = model()+ var web: [MainUIRoute] = []+ let router = MainUIRouter(model: m, web: { web.append($0) })+ router.openMain()+ m.onboarding.finish()+ router.openMain()+ #expect(web == [.firstRunDue, .home])+ #expect(MainUIRouter.launchRoute(onboarded: false) == .firstRunDue)+ #expect(MainUIRouter.launchRoute(onboarded: true) == nil)+ }++ /// A click on a notification opens its page.+ @Test func aNotificationOpensItsPage() {+ let ready = SpaceReadyNote.identifierPrefix + "local:aurora"+ #expect(MainUIRouter.route(forNotification: ready) == .space("local:aurora"))+ #expect(MainUIRouter.route(forNotification: "device-abc").webPath == "/settings/devices")+ #expect(MainUIRouter.route(forNotification: "agent-42") == .agents)+ #expect(MainUIRouter.route(forNotification: "other") == .home)}/// The page gets `route.openRequested {path}`: queued until it listens/// (the latest wins), at once after.@Test func thePageIsToldWhereToGo() async {- let c = WebUIWindowController(model: model(webUi: true))+ let c = WebUIWindowController(model: model())defer { c.window?.close() }let bridge = c.bridgevar seen: [String] = []@@ -75,7 +97,7 @@ struct MainUIRouteTests {/// A drop on a notch tile reaches the page's well by name, once, and is/// then sendable.@Test func aNotchDropIsHandedToThePageOnce() async throws {- let m = model(webUi: true)+ let m = model()await m.refresh()let id = try #require(m.spaces.first?.id)let c = WebUIWindowController(model: m)@@ -108,7 +130,7 @@ struct MainUIRouteTests {#expect(calls == ["main", "native settings", "list", "settings"])}- // MARK: - One main window: New UI replaces the native one+ // MARK: - The web UI window/// A new window loads the page at its route (query included) rather/// than asking a page that may not listen yet.@@ -121,7 +143,7 @@ struct MainUIRouteTests {let dev = URL(string: "http://localhost:5174/")!#expect(WebUIWindowController.url("/spaces/a%20b?dropped=%5B%5D", in: dev).absoluteString== "http://localhost:5174/spaces/a%20b?dropped=%5B%5D")- let c = WebUIWindowController(model: model(webUi: true), route: MainUIRoute.settings.webPath)+ let c = WebUIWindowController(model: model(), route: MainUIRoute.settings.webPath)defer { c.window?.close() }#expect(c.startURL.absoluteString.hasSuffix("/settings"))}@@ -135,114 +157,6 @@ struct MainUIRouteTests {#expect(MainUIRouter.route(forNav: "nav.nope") == nil)}- /// Only the main UI gives way to New UI: the launch stays in the native- /// window, and the first run has its own rule (`opensFirstRun`).- @Test func onlyTheMainUIGivesWayToNewUI() {- #expect(MainWindowSwitch.replacesNative(webUi: true, ready: true, onboarded: true))- #expect(!MainWindowSwitch.replacesNative(webUi: false, ready: true, onboarded: true))- #expect(!MainWindowSwitch.replacesNative(webUi: true, ready: false, onboarded: true))- #expect(!MainWindowSwitch.replacesNative(webUi: true, ready: true, onboarded: false))- }-- /// A frame inside the screen (a CI runner's is small), so the window- /// server keeps it as given; `dx` tells two apart.- func onScreen(dx: CGFloat = 0) -> NSRect {- let v = NSScreen.main?.visibleFrame ?? NSRect(x: 0, y: 0, width: 1024, height: 700)- return NSRect(x: v.minX + 20 + dx, y: v.minY + 20, width: min(760, v.width - 80), height: min(480, v.height - 60))- }-- func nativeWindow(_ frame: NSRect) -> NSWindow {- let w = NSWindow(contentRect: frame, styleMask: [.titled, .closable, .resizable], backing: .buffered, defer: true)- w.isReleasedWhenClosed = false- w.setFrame(frame, display: false)- return w- }-- func settle() async {- await withCheckedContinuation { k in DispatchQueue.main.async { k.resume() } }- await withCheckedContinuation { k in DispatchQueue.main.async { k.resume() } }- }-- /// Whatever opens the native window while New UI is on (the Dock, the- /// Window menu, a path not routed) gets New UI in its frame; it closes.- @Test func theNativeWindowOpeningWithNewUIOnIsReplacedInPlace() async {- let m = model(webUi: true)- m.onboarding.finish()- let w = nativeWindow(onScreen())- w.orderFront(nil)- let frame = w.frame- var opened: [NSRect?] = []- MainWindowSwitch.nativeAppeared(w, model: m, web: { opened.append($0) })- // Reported twice (its reader, its onAppear): replaced once.- MainWindowSwitch.nativeAppeared(nil, model: m, web: { opened.append($0) })- #expect(opened == [frame])- await settle()- #expect(!w.isVisible)- #expect(w.alphaValue == 1)- }-- @Test func theNativeWindowStaysWithNewUIOff() async {- let m = model(webUi: false)- m.onboarding.finish()- let w = nativeWindow(onScreen())- w.orderFront(nil)- defer { w.close() }- var opened = 0- MainWindowSwitch.nativeAppeared(w, model: m, web: { _ in opened += 1 })- await settle()- #expect(opened == 0 && w.isVisible)- }-- /// Turning New UI on with the native window up: New UI in its frame.- @Test func turningNewUIOnSwapsTheWindowInPlace() async {- let m = model(webUi: true)- m.onboarding.finish()- let w = nativeWindow(onScreen())- w.orderFront(nil)- let frame = w.frame- MainWindowSwitch.nativeWindow = w- var opened: [NSRect?] = []- MainWindowSwitch.switchToWebUI(model: m, web: { opened.append($0) })- #expect(opened == [frame])- await settle()- #expect(!w.isVisible)- // With no native window up (only Settings), New UI opens as at launch.- MainWindowSwitch.switchToWebUI(model: m, web: { opened.append($0) })- #expect(opened == [frame, nil])- }-- /// Turning it off: the native window opens where New UI was.- @Test func turningNewUIOffOpensTheNativeWindowInItsFrame() async {- let m = model(webUi: false)- m.onboarding.finish()- let webFrame = onScreen(dx: 30)- var opened = 0- MainWindowSwitch.switchToNative(webFrame: webFrame, openMain: { opened += 1 })- #expect(opened == 1)- let w = nativeWindow(onScreen())- w.orderFront(nil)- defer { w.close() }- #expect(w.frame != webFrame)- MainWindowSwitch.nativeAppeared(w, model: m)- await settle()- #expect(w.frame == webFrame)- #expect(MainWindowSwitch.pendingNativeFrame == nil)- }-- /// The setting's switch: on puts New UI in the native window's place,- /// off the reverse.- @Test func theSwitchSwapsTheWindows() {- let m = model(webUi: false)- var calls: [String] = []- m.openWebUI = { calls.append("open") }- m.closeWebUI = { calls.append("close") }- m.chooseExperiment(row: "experiment:web_ui", option: "on")- #expect(m.settings.experiments.webUi)- m.chooseExperiment(row: "experiment:web_ui", option: "on")- m.chooseExperiment(row: "experiment:web_ui", option: "off")- #expect(calls == ["open", "close"])- }-/// An app at `version` over the settings file `json` in a fresh/// directory (nil: none, a fresh install).func launched(_ json: String?, version: String, dir: URL? = nil) -> AppModel {@@ -255,84 +169,32 @@ struct MainUIRouteTests {settingsPath: path, telemetry: FixtureTelemetry(), appVersion: version)}- /// The New UI by default: an upgraded install's saved `webUi: false`- /// was never a choice, so Beta from the 0.8.1 betas opens the New UI; a- /// saved `true` is kept; Stable keeps classic until 0.8.1 (0.8.0 shipped- /// without the default).- @Test func theNewUIIsTheDefaultOnBetaAndAnOlderSavedOffIsNotAChoice() {- let old = #"{"updateChannel":"beta","experiments":{"cuaVolume":true,"webUi":false}}"#- #expect(launched(old, version: "0.8.1-beta.1").settings.experiments.webUi)- #expect(!launched(old, version: "0.8.0").settings.experiments.webUi)- #expect(launched(old, version: "0.8.1-beta.1").settings.newUi == nil)- let stable = #"{"updateChannel":"stable","experiments":{"webUi":false}}"#- #expect(!launched(stable, version: "0.8.1-beta.1").settings.experiments.webUi)- #expect(!launched(stable, version: "0.7.2").settings.experiments.webUi)- #expect(!launched(stable, version: "0.8.0").settings.experiments.webUi)- #expect(launched(stable, version: "0.8.1").settings.experiments.webUi)- let chosen = #"{"updateChannel":"stable","experiments":{"webUi":true}}"#- #expect(launched(chosen, version: "0.7.2").settings.newUi == true)- #expect(launched(chosen, version: "0.7.2").settings.experiments.webUi)- // A fresh install (no file): Stable until the first launch records Beta.- #expect(!launched(nil, version: "0.8.1-beta.1").settings.experiments.webUi)- }-- /// "Use classic UI" swaps the windows in place, is saved as a choice,- /// and later launches (and later versions) keep it.- @Test func useClassicUIIsAChoiceLaterLaunchesKeep() {- let dir = FileManager.default.temporaryDirectory.appendingPathComponent("cua-newui-\(UUID().uuidString)")- let m = launched(#"{"updateChannel":"beta"}"#, version: "0.8.1-beta.1", dir: dir)- #expect(m.settings.experiments.webUi)- var calls: [String] = []- m.openWebUI = { calls.append("open") }- m.closeWebUI = { calls.append("close") }- let classic = m.experimentsPage.sections.flatMap(\.rows).first { $0.id == "experiment:classic_ui" }- #expect(classic?.label == "Use classic UI")- #expect(classic?.options.first { $0.active }?.id == "off")- m.chooseExperiment(row: "experiment:classic_ui", option: "on")- #expect(calls == ["close"])- #expect(!m.settings.experiments.webUi)- #expect(appSettingsLoad(path: m.settingsPath).newUi == false, "saved as a choice")- for version in ["0.8.1-beta.1", "0.8.1-beta.2", "0.8.1"] {- #expect(!launched(nil, version: version, dir: dir).settings.experiments.webUi, "\(version)")+ /// The migration: whatever an older build saved ("Use classic UI" on, a+ /// never-chosen `webUi: false`, nothing), every launch reports the web+ /// UI, and Settings has no "Use classic UI" row to turn it off.+ @Test func everyInstallIsOnTheWebUIAndThereIsNoClassicSwitch() {+ for json in [#"{"updateChannel":"stable","newUi":false,"experiments":{"webUi":false}}"#,+ #"{"updateChannel":"beta","experiments":{"cuaVolume":true,"webUi":false}}"#,+ nil] {+ for version in ["0.8.0", "0.16.1"] {+ let m = launched(json, version: version)+ #expect(m.settings.experiments.webUi, "\(json ?? "none") \(version)")+ #expect(!m.experimentsPage.sections.flatMap(\.rows).contains { $0.id.contains("classic_ui") })+ m.chooseExperiment(row: "experiment:classic_ui", option: "on")+ m.setUpdateChannel(.stable)+ #expect(m.settings.experiments.webUi)+ }}- // And back: the New UI, chosen.- let again = launched(nil, version: "0.8.1-beta.2", dir: dir)- again.openWebUI = { calls.append("open") }- again.chooseExperiment(row: "experiment:classic_ui", option: "off")- #expect(calls == ["close", "open"])- #expect(appSettingsLoad(path: again.settingsPath).newUi == true)- }-- /// Settings → About's channel moves the default (and the window) when- /// the user never chose; a choice stays put.- @Test func switchingChannelMovesTheDefaultNotAChoice() {- let m = launched(#"{"updateChannel":"beta"}"#, version: "0.8.1-beta.1")- var calls: [String] = []- m.openWebUI = { calls.append("open") }- m.closeWebUI = { calls.append("close") }- m.setUpdateChannel(.stable)- #expect(!m.settings.experiments.webUi)- #expect(appSettingsLoad(path: m.settingsPath).updateChannel == .stable)- m.setUpdateChannel(.beta)- #expect(m.settings.experiments.webUi)- #expect(calls == ["close", "open"])- m.chooseExperiment(row: "experiment:classic_ui", option: "on")- calls = []- m.setUpdateChannel(.stable)- m.setUpdateChannel(.beta)- #expect(!m.settings.experiments.webUi)- #expect(calls.isEmpty)}- /// A prerelease's first launch starts on the Beta channel (and so- /// with the New UI); a release's on Stable; a later launch keeps the channel.+ /// A prerelease's first launch starts on the Beta channel; a release's+ /// on Stable; a later launch keeps the channel.@Test func aBetasFirstLaunchIsOnBeta() {let dir = FileManager.default.temporaryDirectory.appendingPathComponent("cua-newui-\(UUID().uuidString)")try? FileManager.default.createDirectory(at: dir, withIntermediateDirectories: true)let path = dir.appendingPathComponent("settings.json").pathUpdateRefresh.record(settingsPath: path, version: "0.8.1-beta.1", build: "1", onboarded: false)#expect(appSettingsLoad(path: path).updateChannel == .beta)- #expect(launched(nil, version: "0.8.1-beta.1", dir: dir).settings.experiments.webUi)// A later launch keeps the channel the user set.var s = appSettingsLoad(path: path)s.updateChannel = .stablediff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/NotchTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/NotchTests.swiftindex 4e3ce75b69..1740d59d54 100644--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/NotchTests.swift+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/NotchTests.swift@@ -593,13 +593,4 @@ struct LaunchTests {CuaSpacesMacApp.ignoreSavedWindowState(defaults)#expect(defaults.bool(forKey: "ApplePersistenceIgnoreState"))}-- /// With New UI on, or the first run due (it is the web UI's onboarding),- /// a launch opens the New UI window, not the native main window.- @Test func newUIOrAFirstRunOpensItsWindowAtLaunchInsteadOfTheMainWindow() {- #expect(CuaSpacesMacApp.opensWebUIAtLaunch(webUi: true, onboarded: true))- #expect(CuaSpacesMacApp.opensWebUIAtLaunch(webUi: true, onboarded: false))- #expect(!CuaSpacesMacApp.opensWebUIAtLaunch(webUi: false, onboarded: true))- #expect(CuaSpacesMacApp.opensWebUIAtLaunch(webUi: false, onboarded: false))- }}diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/TeleportBridgeTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/TeleportBridgeTests.swiftindex 8fd7423026..c646458c54 100644--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/TeleportBridgeTests.swift+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/TeleportBridgeTests.swift@@ -25,7 +25,7 @@ struct TeleportBridgeTests {telemetry: FixtureTelemetry())await model.refresh()let bridge = WebUIBridge(model: model, allowedOrigins: [])- bridge.actions = WebUIActions(openSpace: { _ in }, openMain: {})+ bridge.actions = WebUIActions(openSpace: { _ in })return (bridge, model)}diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ViewModelTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ViewModelTests.swiftindex 292d7cd2b6..8fc17273ec 100644--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ViewModelTests.swift+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ViewModelTests.swift@@ -417,11 +417,9 @@ struct ViewModelTests {let telemetry = FixtureTelemetry()let model = makeModel(telemetry: telemetry)let toggles = model.experimentsPage.sections.flatMap(\.rows).filter { $0.kind == .toggle }- #expect(toggles.map(\.id) == ["experiment:cua_volume", "experiment:your_cloud", "experiment:sharing",- "experiment:classic_ui"])- // Off, the New UI shows as "Use classic UI" on (tests run with no app version: no default).- // Sharing and Your cloud are on unless turned off.- let onByDefault: Set<String> = ["experiment:classic_ui", "experiment:sharing", "experiment:your_cloud"]+ #expect(toggles.map(\.id) == ["experiment:cua_volume", "experiment:your_cloud", "experiment:sharing"])+ // Sharing and Your cloud are on unless turned off; no New UI row.+ let onByDefault: Set<String> = ["experiment:sharing", "experiment:your_cloud"]#expect(toggles.allSatisfy { r inr.options.first { $0.id == (onByDefault.contains(r.id) ? "on" : "off") }?.active == true})@@ -935,7 +933,7 @@ struct ViewModelTests {let model = makeModel(backend)var opened: [String] = []let previous = WebUIWindowController.actions- WebUIWindowController.actions = WebUIActions(openSpace: { if $0 == "local:fresh" { opened.append($0) } }, openMain: {})+ WebUIWindowController.actions = WebUIActions(openSpace: { if $0 == "local:fresh" { opened.append($0) } })defer { WebUIWindowController.actions = previous }await model.refresh()await model.openNewSpace()diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/WebUIHostTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/WebUIHostTests.swiftindex 3e326e33b3..410ad01c8f 100644--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/WebUIHostTests.swift+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/WebUIHostTests.swift@@ -33,6 +33,19 @@ struct WebUIHostTests {#expect(WebUISchemeHandler.mime("wasm") == "application/wasm")}+ /// About's Acknowledgements reads the app's bundled notices at+ /// `/__app/THIRD_PARTY_NOTICES.md`; no other app file is reachable.+ @Test func theSchemeHandlerServesTheBundledNoticesAndNothingElseOfTheApp() {+ let notices = URL(fileURLWithPath: "/tmp/THIRD_PARTY_NOTICES.md")+ let h = WebUISchemeHandler(root: nil, appFiles: ["THIRD_PARTY_NOTICES.md": notices])+ #expect(h.appFile("/__app/THIRD_PARTY_NOTICES.md") == notices)+ #expect(h.appFile("/__app/../Info.plist") == nil)+ #expect(h.appFile("/__app/Info.plist") == nil)+ #expect(h.appFile("/THIRD_PARTY_NOTICES.md") == nil)+ // A debug build finds the checkout's copy.+ #expect(WebUISchemeHandler.bundledAppFiles()["THIRD_PARTY_NOTICES.md"] != nil)+ }+@Test func coreRecordsEncodeAsPlainValues() {let x = AppExperiments(cuaVolume: true, yourCloud: false, sharing: false, webUi: true)let v = BridgeValue.encode(x) as? [String: Any]@@ -459,16 +472,13 @@ struct WebUIHostTests {#expect(await failure(bridge, "spaces.create", ["config": config, "pendingId": "pending:web-2"]) == "cancelled")}- /// While New UI is on, New Space opens its wizard; the native sheet is- /// the fallback.- @Test func newSpaceOpensTheWebWizardWhileNewUIIsOn() async {+ /// New Space opens the web wizard, whatever an older build saved for+ /// the New UI.+ @Test func newSpaceOpensTheWebWizard() async {let (_, model) = bridge()var asked: [String?] = []model.openWebNewSpace = { on in asked.append(on); return true }- await model.openNewSpace()- #expect(asked.isEmpty && model.showingNewSpace)- model.cancelNewSpace()- model.settings.experiments.webUi = true+ model.settings.experiments.webUi = falseawait model.openNewSpace()await model.openNewSpace(on: "host:m1")#expect(asked == [nil, "host:m1"])@@ -664,16 +674,6 @@ struct WebUIHostTests {#expect(opened == 1, "its window opens, even with only Settings up")}- @Test func turningNewUIOffClosesItsWindow() {- let (_, model) = bridge()- var closed = 0- model.closeWebUI = { closed += 1 }- model.chooseExperiment(row: "experiment:web_ui", option: "on")- #expect(closed == 0)- model.chooseExperiment(row: "experiment:web_ui", option: "off")- #expect(closed == 1)- }-@Test func theNewUIWindowComesBackWhereItWas() {_ = NSApplication.sharedlet (_, model) = bridge()diff --git a/apps/cua-spaces-macos/UITests/CuaSpacesMacUITests.swift b/apps/cua-spaces-macos/UITests/CuaSpacesMacUITests.swiftindex 5dbfb05ae8..bb1e5e3838 100644--- a/apps/cua-spaces-macos/UITests/CuaSpacesMacUITests.swift+++ b/apps/cua-spaces-macos/UITests/CuaSpacesMacUITests.swift@@ -3,7 +3,7 @@import XCTest-/// UI tests for the main views, on fixtures (`CUA_SPACES_FIXTURES=1`: no+/// UI tests for the app's windows, on fixtures (`CUA_SPACES_FIXTURES=1`: no/// daemon, no Space, no Keyvault broker; nothing leaves the process). They/// drive only this app. Built by project.yml (XcodeGen) on a macOS runner/// with Xcode; `swift test` cannot run XCUITest.@@ -23,39 +23,26 @@ final class CuaSpacesMacUITests: XCTestCase {return app}- func testSidebarListsSpacesByLocation() {+ /// A launch opens the web UI window: the app has no native main window.+ func testLaunchOpensTheWebUIWindow() {let app = launch()- // Names show as typed (the core no longer title-cases them).- XCTAssertTrue(app.staticTexts["aurora"].waitForExistence(timeout: 10))- XCTAssertTrue(app.staticTexts["Connected"].exists)- XCTAssertTrue(app.staticTexts["All Items"].exists, "the Keyvault categories are in the sidebar")+ XCTAssertTrue(app.windows["cua-new-ui"].waitForExistence(timeout: 15))+ XCTAssertFalse(app.staticTexts["All Items"].exists, "no native sidebar")}- func testNewSpaceWalksToCreate() {+ /// New Space (⌘N, the menu bar) is the web wizard, in the same window.+ func testNewSpaceOpensTheWebUIWindow() {let app = launch("new-space")- let next = app.buttons["Continue"]- XCTAssertTrue(next.waitForExistence(timeout: 10))- next.click()- next.click()- next.click()- XCTAssertTrue(app.buttons["Create Space"].waitForExistence(timeout: 5))- XCTAssertTrue(app.otherElements["wizard-summary"].exists || app.staticTexts["Runs on"].exists)+ XCTAssertTrue(app.windows["cua-new-ui"].waitForExistence(timeout: 15))+ XCTAssertFalse(app.buttons["Create Space"].exists && app.otherElements["wizard-summary"].exists,+ "no native New Space sheet")}- /// The first run is the shared web onboarding in the New UI window, not- /// a view of the native app: no native Welcome, no native main window.+ /// The first run is the shared web onboarding in the web UI window: no+ /// native Welcome.func testFirstRunOpensTheNewUIWindow() {let app = launch(onboarded: false)XCTAssertTrue(app.windows["cua-new-ui"].waitForExistence(timeout: 15))XCTAssertFalse(app.staticTexts["Welcome to Cua Spaces"].exists, "no native onboarding")- XCTAssertFalse(app.staticTexts["aurora"].exists, "the native main window stays closed")- }-- func testSpaceDetailShowsFactsAndTheDropWell() {- let app = launch()- XCTAssertTrue(app.staticTexts["aurora"].waitForExistence(timeout: 10))- app.staticTexts["aurora"].click()- XCTAssertTrue(app.staticTexts["Identifier"].waitForExistence(timeout: 5))- XCTAssertTrue(app.staticTexts["Drop a file or window"].exists)}}diff --git a/apps/cua-spaces-web/e2e/settings-checks.ts b/apps/cua-spaces-web/e2e/settings-checks.tsindex f842109375..d41eb8f75d 100644--- a/apps/cua-spaces-web/e2e/settings-checks.ts+++ b/apps/cua-spaces-web/e2e/settings-checks.ts@@ -210,10 +210,9 @@ async function checkStorage(page: Page, checkpoints: ParityCheckpoint[]): Promis/* ---- Experiments ------------------------------------------------------------ */-/** Advanced keeps Labs: Cua Volume and, on the Mac-native app, the previous window. Sharing and Your cloud have no switch. */+/** Advanced keeps Labs: Cua Volume. Sharing, Your cloud and the New UI have no switch. */const LABS: Record<string, { label?: string; note: string }> = {"experiment:cua_volume": { note: "Memory and files your agents share across every Space." },- "experiment:classic_ui": { label: "Use the previous Spaces window", note: "Mac-native app only." },};async function checkExperiments(page: Page, checkpoints: ParityCheckpoint[]): Promise<number> {diff --git a/apps/cua-spaces-web/src/__tests__/electron-parity-lows.test.tsx b/apps/cua-spaces-web/src/__tests__/electron-parity-lows.test.tsxindex a6bda810ef..06fe6b340e 100644--- a/apps/cua-spaces-web/src/__tests__/electron-parity-lows.test.tsx+++ b/apps/cua-spaces-web/src/__tests__/electron-parity-lows.test.tsx@@ -45,14 +45,14 @@ async function mount(path: string, mode: DataAdapter["mode"] = "demo") {const q = (sel: string) => document.querySelector<HTMLElement>(sel);describe.skipIf(!wasmBuilt)("Electron parity, the small things", () => {- it("has no Use classic UI switch in Electron (it is only the New UI); the SwiftUI host keeps it", { timeout: 20_000 }, async () => {- await mount("/settings/experiments", "electron");- await waitFor(() => expect(q("[data-settings-tab=advanced]")).not.toBeNull(), { timeout: 8000 });- expect(q('[data-setting-row="experiment:classic_ui"]')).toBeNull();- expect(document.querySelectorAll("[data-setting-row^='experiment:']").length).toBeGreaterThan(0);- cleanup();- await mount("/settings/experiments", "demo");- await waitFor(() => expect(q('[data-setting-row="experiment:classic_ui"]')).not.toBeNull(), { timeout: 8000 });+ it("has no Use classic UI switch on any host (the web UI is the only UI)", { timeout: 20_000 }, async () => {+ for (const host of ["electron", "demo"] as const) {+ await mount("/settings/experiments", host);+ await waitFor(() => expect(q("[data-settings-tab=advanced]")).not.toBeNull(), { timeout: 8000 });+ expect(q('[data-setting-row="experiment:classic_ui"]')).toBeNull();+ expect(document.querySelectorAll("[data-setting-row^='experiment:']").length).toBeGreaterThan(0);+ cleanup();+ }});it("opens and closes New Space's image list from its Show images button", { timeout: 20_000 }, async () => {diff --git a/apps/cua-spaces-web/src/components/__tests__/notices-dialog.test.tsx b/apps/cua-spaces-web/src/components/__tests__/notices-dialog.test.tsxnew file mode 100644index 0000000000..224266fe1a--- /dev/null+++ b/apps/cua-spaces-web/src/components/__tests__/notices-dialog.test.tsx@@ -0,0 +1,42 @@+// SPDX-License-Identifier: FSL-1.1-MIT+// Copyright (c) 2026 Cua AI, Inc.++import { cleanup, render, screen, waitFor } from "@testing-library/react";+import { afterEach, describe, expect, it, vi } from "vitest";++vi.mock("@/bridge", () => ({ useSession: () => ({ openExternal: vi.fn(async () => {}) }) }));++import { MAC_APP_NOTICES_PATH, NoticesDialog, tablesAsLists } from "@/components/settings/notices-dialog";++afterEach(() => {+ cleanup();+ vi.unstubAllGlobals();+ delete document.documentElement.dataset.host;+});++describe("NoticesDialog (About, Acknowledgements)", () => {+ it("in the Mac app, shows the app's bundled notices (from the app, not the network) before the web UI's", async () => {+ document.documentElement.dataset.host = "macos";+ const fetch = vi.fn(async () => new Response("# Third-party notices\n\nDynamicNotchKit by Kai Azim", { status: 200 }));+ vi.stubGlobal("fetch", fetch);+ render(<NoticesDialog open onOpenChange={() => {}} />);+ await waitFor(() => expect(screen.getByText(/DynamicNotchKit by Kai Azim/)).toBeTruthy());+ expect(fetch).toHaveBeenCalledWith(MAC_APP_NOTICES_PATH);+ expect(MAC_APP_NOTICES_PATH.startsWith("/")).toBe(true);+ expect(screen.getByText("Cua Spaces for Mac")).toBeTruthy();+ });++ it("elsewhere, asks for no app file and shows the web UI's notices", async () => {+ const fetch = vi.fn();+ vi.stubGlobal("fetch", fetch);+ render(<NoticesDialog open onOpenChange={() => {}} />);+ await waitFor(() => expect(screen.queryByText("Loading…")).toBeNull());+ expect(fetch).not.toHaveBeenCalled();+ expect(screen.queryByText("Cua Spaces for Mac")).toBeNull();+ });++ it("draws a notices table as a list (the Markdown view has no tables)", () => {+ const md = "Intro\n\n| Project | Used in |\n|---|---|\n| A @ 1 | x.swift |\n| B | y.swift |\n\nAfter";+ expect(tablesAsLists(md)).toBe("Intro\n\n- A @ 1 · x.swift\n- B · y.swift\n\nAfter");+ });+});diff --git a/apps/cua-spaces-web/src/components/settings/advanced-tab.tsx b/apps/cua-spaces-web/src/components/settings/advanced-tab.tsxindex fc4d55bb52..526fa46597 100644--- a/apps/cua-spaces-web/src/components/settings/advanced-tab.tsx+++ b/apps/cua-spaces-web/src/components/settings/advanced-tab.tsx@@ -15,7 +15,7 @@ const SELF_HOSTED = "self-hosted";const BETA_HELP = "New features sooner, with rough edges. Back on Stable, this version stays until a newer stable release.";/** Experiments that stay as Labs. "Your cloud" and "Sharing" have no switch any more: the plan decides on the server. */-const LABS = new Set(["experiment:cua_volume", "experiment:classic_ui"]);+const LABS = new Set(["experiment:cua_volume"]);/** The software choices in plain words (the core says Built-in and System). */const RUNTIME_LABEL: Record<string, string> = { "macos-runtime": "Mac computers", "linux-runtime": "Linux computers" };@@ -121,15 +121,13 @@ function askFirstRow(on: boolean): CoreRow {};}-/** Cua Volume, the new Home and, on the Mac-native app, the previous window. Off hides; nothing set up is undone. */+/** Cua Volume and the new Home. Off hides; nothing set up is undone. */function Labs() {const { data, chooseExperiment } = useExperiments();- const { mode } = useBridge();const askFirst = useFlag("spaces_ask_first_home");- const rows = (data?.page?.sections.flatMap((s) => s.rows) ?? []).filter((r) => LABS.has(r.id) && !(mode === "electron" && r.id === "experiment:classic_ui"));+ const rows = (data?.page?.sections.flatMap((s) => s.rows) ?? []).filter((r) => LABS.has(r.id));const note: Record<string, string> = {"experiment:cua_volume": "Memory and files your agents share across every Space.",- "experiment:classic_ui": "Mac-native app only.",};return (<SettingsGroup title="Labs">@@ -141,7 +139,7 @@ function Labs() {{rows.map((r) => (<CoreSettingsRowkey={r.id}- row={r.id === "experiment:classic_ui" ? { ...r, label: "Use the previous Spaces window" } : r}+ row={r}description={note[r.id]}onChoose={(row, option) => void chooseExperiment(row.id, option).catch(toastError("Couldn't change the setting"))}/>diff --git a/apps/cua-spaces-web/src/components/settings/notices-dialog.tsx b/apps/cua-spaces-web/src/components/settings/notices-dialog.tsxindex 7715e7d82a..094075cbf3 100644--- a/apps/cua-spaces-web/src/components/settings/notices-dialog.tsx+++ b/apps/cua-spaces-web/src/components/settings/notices-dialog.tsx@@ -8,21 +8,55 @@ import { Markdown } from "@/components/markdown";import { Button } from "@/components/ui/button";import { Dialog, DialogPopup, DialogTitle } from "@/components/ui/dialog";+/** Where the Mac app serves its own bundled notices (`WebUISchemeHandler`, from the app bundle, never the network). */+export const MAC_APP_NOTICES_PATH = "/__app/THIRD_PARTY_NOTICES.md";++/** In the Mac app's window (its host script sets `data-host="macos"`). */+const inMacApp = () => typeof document !== "undefined" && document.documentElement.dataset.host === "macos";++const stripComments = (t: string) => t.replace(/<!--[\s\S]*?-->\n?/g, "");++/** Markdown tables as lists (the Markdown view draws no tables): each row's cells, header and rule dropped. */+export const tablesAsLists = (t: string) => {+ const out: string[] = [];+ let inTable = false;+ for (const line of t.split("\n")) {+ if (!/^\s*\|.*\|\s*$/.test(line)) {+ inTable = false;+ out.push(line);+ continue;+ }+ if (/^\s*\|[\s:|-]+\|\s*$/.test(line)) continue;+ if (!inTable) {+ inTable = true; // the header row+ continue;+ }+ const cells = line.trim().slice(1, -1).split("|").map((c) => c.trim()).filter(Boolean);+ out.push(`- ${cells.join(" · ")}`);+ }+ return out.join("\n");+};+/**- * The third-party notices this UI ships with (the repository's- * THIRD_PARTY_NOTICES.md: T3 Code's licence and the npm dependencies),- * loaded only when opened. About's Acknowledgements opens it, as the- * SwiftUI app's opens its bundled notices.+ * The third-party notices, loaded only when opened: in the Mac app, first+ * the app's own (its bundled THIRD_PARTY_NOTICES.md: the notch's sources and+ * the Swift packages), then this UI's (the repository's+ * THIRD_PARTY_NOTICES.md: T3 Code's licence and the npm dependencies).+ * About's Acknowledgements opens it.*/export function NoticesDialog({ open, onOpenChange }: { open: boolean; onOpenChange: (open: boolean) => void }) {const { openExternal } = useSession();const [text, setText] = useState<string | null>(null);useEffect(() => {if (!open || text !== null) return;- void import("../../../../../legal/THIRD_PARTY_NOTICES.md?raw").then(- (m) => setText(m.default.replace(/<!--[\s\S]*?-->\n?/g, "")),- () => setText("The third-party notices are missing from this build (THIRD_PARTY_NOTICES.md)."),- );+ const app = inMacApp()+ ? fetch(MAC_APP_NOTICES_PATH).then((r) => (r.ok ? r.text() : null)).catch(() => null)+ : Promise.resolve(null);+ const web = import("../../../../../legal/THIRD_PARTY_NOTICES.md?raw").then((m) => m.default as string, () => null);+ void Promise.all([app, web]).then(([appText, webText]) => {+ const parts = [appText && `# Cua Spaces for Mac\n\n${tablesAsLists(stripComments(appText).replace(/^# .*\n+/, ""))}`, webText && stripComments(webText)].filter(Boolean);+ setText(parts.length ? parts.join("\n\n") : "The third-party notices are missing from this build (THIRD_PARTY_NOTICES.md).");+ });}, [open, text]);return (diff --git a/libs/cua/crates/cua-spaces-app-core/parity/experiments.json b/libs/cua/crates/cua-spaces-app-core/parity/experiments.jsonindex ba1fb8fa40..80e78f74b1 100644--- a/libs/cua/crates/cua-spaces-app-core/parity/experiments.json+++ b/libs/cua/crates/cua-spaces-app-core/parity/experiments.json@@ -10,9 +10,7 @@{ "step": "another row changes nothing", "row": "notch", "option": "hide" },{ "step": "cua volume off", "row": "experiment:cua_volume", "option": "off" },{ "step": "your cloud on again", "row": "experiment:your_cloud", "option": "on" },- { "step": "sharing off", "row": "experiment:sharing", "option": "off" },- { "step": "new ui on (use classic ui off)", "row": "experiment:classic_ui", "option": "off" },- { "step": "use classic ui on", "row": "experiment:classic_ui", "option": "on" }+ { "step": "sharing off", "row": "experiment:sharing", "option": "off" }],"settings": {"identity": "[email protected]",diff --git a/libs/cua/crates/cua-spaces-app-core/parity/golden/experiments.json b/libs/cua/crates/cua-spaces-app-core/parity/golden/experiments.jsonindex 7ac0626f73..eb4a16cda0 100644--- a/libs/cua/crates/cua-spaces-app-core/parity/golden/experiments.json+++ b/libs/cua/crates/cua-spaces-app-core/parity/golden/experiments.json@@ -89,9 +89,7 @@"- experiment:your_cloud toggle: Your cloud {*On|Off}","- experiment:your_cloud-note note: Create Spaces in your own AWS, Google Cloud, Hetzner or Modal account.","- experiment:sharing toggle: Sharing {*On|Off}",- "- experiment:sharing-note note: Share a Space with other Cua accounts.",- "- experiment:classic_ui toggle: Use classic UI {*On|Off}",- "- experiment:classic_ui-note note: Open the previous Spaces window instead of the New UI."+ "- experiment:sharing-note note: Share a Space with other Cua accounts."],"volumePage": null,"wizard": {@@ -224,9 +222,7 @@"- experiment:your_cloud toggle: Your cloud {*On|Off}","- experiment:your_cloud-note note: Create Spaces in your own AWS, Google Cloud, Hetzner or Modal account.","- experiment:sharing toggle: Sharing {*On|Off}",- "- experiment:sharing-note note: Share a Space with other Cua accounts.",- "- experiment:classic_ui toggle: Use classic UI {*On|Off}",- "- experiment:classic_ui-note note: Open the previous Spaces window instead of the New UI."+ "- experiment:sharing-note note: Share a Space with other Cua accounts."],"volumePage": "Volume","wizard": {@@ -358,9 +354,7 @@"- experiment:your_cloud toggle: Your cloud {On|*Off}","- experiment:your_cloud-note note: Create Spaces in your own AWS, Google Cloud, Hetzner or Modal account.","- experiment:sharing toggle: Sharing {*On|Off}",- "- experiment:sharing-note note: Share a Space with other Cua accounts.",- "- experiment:classic_ui toggle: Use classic UI {*On|Off}",- "- experiment:classic_ui-note note: Open the previous Spaces window instead of the New UI."+ "- experiment:sharing-note note: Share a Space with other Cua accounts."],"volumePage": "Volume","wizard": {@@ -476,9 +470,7 @@"- experiment:your_cloud toggle: Your cloud {On|*Off}","- experiment:your_cloud-note note: Create Spaces in your own AWS, Google Cloud, Hetzner or Modal account.","- experiment:sharing toggle: Sharing {*On|Off}",- "- experiment:sharing-note note: Share a Space with other Cua accounts.",- "- experiment:classic_ui toggle: Use classic UI {*On|Off}",- "- experiment:classic_ui-note note: Open the previous Spaces window instead of the New UI."+ "- experiment:sharing-note note: Share a Space with other Cua accounts."],"volumePage": "Volume","wizard": {@@ -594,9 +586,7 @@"- experiment:your_cloud toggle: Your cloud {On|*Off}","- experiment:your_cloud-note note: Create Spaces in your own AWS, Google Cloud, Hetzner or Modal account.","- experiment:sharing toggle: Sharing {*On|Off}",- "- experiment:sharing-note note: Share a Space with other Cua accounts.",- "- experiment:classic_ui toggle: Use classic UI {*On|Off}",- "- experiment:classic_ui-note note: Open the previous Spaces window instead of the New UI."+ "- experiment:sharing-note note: Share a Space with other Cua accounts."],"volumePage": "Volume","wizard": {@@ -712,9 +702,7 @@"- experiment:your_cloud toggle: Your cloud {On|*Off}","- experiment:your_cloud-note note: Create Spaces in your own AWS, Google Cloud, Hetzner or Modal account.","- experiment:sharing toggle: Sharing {*On|Off}",- "- experiment:sharing-note note: Share a Space with other Cua accounts.",- "- experiment:classic_ui toggle: Use classic UI {*On|Off}",- "- experiment:classic_ui-note note: Open the previous Spaces window instead of the New UI."+ "- experiment:sharing-note note: Share a Space with other Cua accounts."],"volumePage": "Volume","wizard": {@@ -835,9 +823,7 @@"- experiment:your_cloud toggle: Your cloud {On|*Off}","- experiment:your_cloud-note note: Create Spaces in your own AWS, Google Cloud, Hetzner or Modal account.","- experiment:sharing toggle: Sharing {*On|Off}",- "- experiment:sharing-note note: Share a Space with other Cua accounts.",- "- experiment:classic_ui toggle: Use classic UI {*On|Off}",- "- experiment:classic_ui-note note: Open the previous Spaces window instead of the New UI."+ "- experiment:sharing-note note: Share a Space with other Cua accounts."],"volumePage": null,"wizard": {@@ -959,9 +945,7 @@"- experiment:your_cloud toggle: Your cloud {*On|Off}","- experiment:your_cloud-note note: Create Spaces in your own AWS, Google Cloud, Hetzner or Modal account.","- experiment:sharing toggle: Sharing {*On|Off}",- "- experiment:sharing-note note: Share a Space with other Cua accounts.",- "- experiment:classic_ui toggle: Use classic UI {*On|Off}",- "- experiment:classic_ui-note note: Open the previous Spaces window instead of the New UI."+ "- experiment:sharing-note note: Share a Space with other Cua accounts."],"volumePage": null,"wizard": {@@ -1084,260 +1068,7 @@"- experiment:your_cloud toggle: Your cloud {*On|Off}","- experiment:your_cloud-note note: Create Spaces in your own AWS, Google Cloud, Hetzner or Modal account.","- experiment:sharing toggle: Sharing {On|*Off}",- "- experiment:sharing-note note: Share a Space with other Cua accounts.",- "- experiment:classic_ui toggle: Use classic UI {*On|Off}",- "- experiment:classic_ui-note note: Open the previous Spaces window instead of the New UI."- ],- "volumePage": null,- "wizard": {- "fields": [- "os",- "image",- "placement",- "kind",- "runtime",- "connect-cloud",- "connect-by-address"- ],- "placements": [- "auto | Auto | Least-loaded of your machines: this Mac or one of your machines that provides Spaces. | on",- "---",- "local | This Mac | Linux, on this Mac | on *",- "---",- "host:m-mini | Mac mini | Through the Cua relay | on",- "---",- "aws | AWS · us-west-2 | t4g.medium, about $0.04/hour | on"- ]- }- },- {- "actions": [- "teleport: Teleport an app [arrow.down.circle] ?Teleport an app into this Space",- "pip: Picture in picture [pip.enter] ?Picture in picture",- "delete: Remove [trash] ?Remove from the list (destructive)",- "open: Open [-] ?Open the desktop in its own window (primary)"- ],- "menu": [- "status: No Spaces running (disabled)",- "---",- "open: Open Cua Spaces",- "new-space: New Space…",- "settings: Settings… ⌘,",- "---",- "quit: Quit Cua Spaces ⌘Q"- ],- "onboarding": {- "done": {- "canBack": true,- "canSkip": false,- "choices": [],- "dots": "Welcome,Sign in,AI agents,Menu bar,This computer,*Done",- "drive": null,- "driveStorage": null,- "launchAtLogin": "[x] Launch at login ~Keeps your Spaces and agents available after a restart.",- "lede": "3 things are left. You can finish them now, or later from the menu bar.",- "notice": null,- "noticeLink": null,- "presentations": [],- "primary": "Start using Cua Spaces",- "prompts": [- "Open a Linux Space and run my test suite in it",- "Use my Space's browser to finish the checkout test and show me",- "Share this Space with a teammate as a viewer"- ],- "showMark": false,- "step": "done",- "summary": [- "Shows in: Notch and menu bar",- "This computer: Opens your other computers"- ],- "title": "Almost done",- "todos": [- "[ ] Cua CLI ~Command-line tools for you and your agents. -> Install the Cua CLI",- "[ ] Account ~Reach your computers from any device. -> Sign in",- "[ ] AI agents ~Let Claude Code, Codex and others use Cua. -> Connect an AI agent",- "[ ] Cua Volume ~Shared folder: files your agents can share across your computers. -> Turn on (optional)"- ],- "usage": null- },- "pages": [- "welcome",- "signin",- "agents",- "presentation",- "mode",- "done"- ]- },- "settings": [- "= Settings",- "# Account (account)",- "- account text: [email protected] [Sign out]",- "# Teams (teams)",- "- teams text: Teams = Manage your team in the account app",- "- teams-manage text: Invite people, roles and plans [Manage team] < https://app.cua.ai/team>",- "- teams-billing text: Billing [Billing and plans] < https://app.cua.ai/billing>",- "# General (general)",- "- launch-at-login toggle: Launch Cua Spaces at login {*On|Off}",- "- launch-at-login-note note: Keeps your Spaces and agents available after a restart.",- "- notch choice: Spaces tab in the notch {*Show|Hide}",- "- welcome text: Welcome [Show again]",- "# Privacy (privacy)",- "- telemetry choice: Share usage data to help improve Cua {*On|Off}",- "- telemetry-note note: Which features you use and when something goes wrong. Linked to your account through a random ID while you're signed in. Never your files, what you type or your screen. <What is collected https://cua.ai/docs/cua-sdk/concepts/telemetry>",- "# AI agents (agents) [Configure all detected agents] (disabled)"- ],- "signals": [- {- "action": "experiment_on",- "experiment": "web_ui",- "type": "experiment"- },- {- "experiments": [- "your_cloud",- "web_ui"- ],- "type": "experiments-on"- }- ],- "step": "new ui on (use classic ui off)",- "tab": [- "= Experiments",- "# Experiments (experiments)",- "- experiment:cua_volume toggle: Cua Volume {On|*Off}",- "- experiment:cua_volume-note note: Memory and files your agents share across every Space.",- "- experiment:your_cloud toggle: Your cloud {*On|Off}",- "- experiment:your_cloud-note note: Create Spaces in your own AWS, Google Cloud, Hetzner or Modal account.",- "- experiment:sharing toggle: Sharing {On|*Off}",- "- experiment:sharing-note note: Share a Space with other Cua accounts.",- "- experiment:classic_ui toggle: Use classic UI {On|*Off}",- "- experiment:classic_ui-note note: Open the previous Spaces window instead of the New UI."- ],- "volumePage": null,- "wizard": {- "fields": [- "os",- "image",- "placement",- "kind",- "runtime",- "connect-cloud",- "connect-by-address"- ],- "placements": [- "auto | Auto | Least-loaded of your machines: this Mac or one of your machines that provides Spaces. | on",- "---",- "local | This Mac | Linux, on this Mac | on *",- "---",- "host:m-mini | Mac mini | Through the Cua relay | on",- "---",- "aws | AWS · us-west-2 | t4g.medium, about $0.04/hour | on"- ]- }- },- {- "actions": [- "teleport: Teleport an app [arrow.down.circle] ?Teleport an app into this Space",- "pip: Picture in picture [pip.enter] ?Picture in picture",- "delete: Remove [trash] ?Remove from the list (destructive)",- "open: Open [-] ?Open the desktop in its own window (primary)"- ],- "menu": [- "status: No Spaces running (disabled)",- "---",- "open: Open Cua Spaces",- "new-space: New Space…",- "settings: Settings… ⌘,",- "---",- "quit: Quit Cua Spaces ⌘Q"- ],- "onboarding": {- "done": {- "canBack": true,- "canSkip": false,- "choices": [],- "dots": "Welcome,Sign in,AI agents,Menu bar,This computer,*Done",- "drive": null,- "driveStorage": null,- "launchAtLogin": "[x] Launch at login ~Keeps your Spaces and agents available after a restart.",- "lede": "3 things are left. You can finish them now, or later from the menu bar.",- "notice": null,- "noticeLink": null,- "presentations": [],- "primary": "Start using Cua Spaces",- "prompts": [- "Open a Linux Space and run my test suite in it",- "Use my Space's browser to finish the checkout test and show me",- "Share this Space with a teammate as a viewer"- ],- "showMark": false,- "step": "done",- "summary": [- "Shows in: Notch and menu bar",- "This computer: Opens your other computers"- ],- "title": "Almost done",- "todos": [- "[ ] Cua CLI ~Command-line tools for you and your agents. -> Install the Cua CLI",- "[ ] Account ~Reach your computers from any device. -> Sign in",- "[ ] AI agents ~Let Claude Code, Codex and others use Cua. -> Connect an AI agent",- "[ ] Cua Volume ~Shared folder: files your agents can share across your computers. -> Turn on (optional)"- ],- "usage": null- },- "pages": [- "welcome",- "signin",- "agents",- "presentation",- "mode",- "done"- ]- },- "settings": [- "= Settings",- "# Account (account)",- "- account text: [email protected] [Sign out]",- "# Teams (teams)",- "- teams text: Teams = Manage your team in the account app",- "- teams-manage text: Invite people, roles and plans [Manage team] < https://app.cua.ai/team>",- "- teams-billing text: Billing [Billing and plans] < https://app.cua.ai/billing>",- "# General (general)",- "- launch-at-login toggle: Launch Cua Spaces at login {*On|Off}",- "- launch-at-login-note note: Keeps your Spaces and agents available after a restart.",- "- notch choice: Spaces tab in the notch {*Show|Hide}",- "- welcome text: Welcome [Show again]",- "# Privacy (privacy)",- "- telemetry choice: Share usage data to help improve Cua {*On|Off}",- "- telemetry-note note: Which features you use and when something goes wrong. Linked to your account through a random ID while you're signed in. Never your files, what you type or your screen. <What is collected https://cua.ai/docs/cua-sdk/concepts/telemetry>",- "# AI agents (agents) [Configure all detected agents] (disabled)"- ],- "signals": [- {- "action": "experiment_off",- "experiment": "web_ui",- "type": "experiment"- },- {- "experiments": [- "your_cloud"- ],- "type": "experiments-on"- }- ],- "step": "use classic ui on",- "tab": [- "= Experiments",- "# Experiments (experiments)",- "- experiment:cua_volume toggle: Cua Volume {On|*Off}",- "- experiment:cua_volume-note note: Memory and files your agents share across every Space.",- "- experiment:your_cloud toggle: Your cloud {*On|Off}",- "- experiment:your_cloud-note note: Create Spaces in your own AWS, Google Cloud, Hetzner or Modal account.",- "- experiment:sharing toggle: Sharing {On|*Off}",- "- experiment:sharing-note note: Share a Space with other Cua accounts.",- "- experiment:classic_ui toggle: Use classic UI {*On|Off}",- "- experiment:classic_ui-note note: Open the previous Spaces window instead of the New UI."+ "- experiment:sharing-note note: Share a Space with other Cua accounts."],"volumePage": null,"wizard": {diff --git a/libs/cua/crates/cua-spaces-app-core/src/experiments.rs b/libs/cua/crates/cua-spaces-app-core/src/experiments.rsindex 3760a73bbe..54865beb86 100644--- a/libs/cua/crates/cua-spaces-app-core/src/experiments.rs+++ b/libs/cua/crates/cua-spaces-app-core/src/experiments.rs@@ -3,9 +3,7 @@//! Settings, Experiments: features still being built, one switch each, all//! off by default except Sharing (on, as cua.ai/pricing lists it for every-//! plan), Your cloud (on, so a linked cloud shows under Run on) and the New-//! UI, which [`new_ui_default`] turns on for the Beta channel and then for-//! every release.+//! plan) and Your cloud (on, so a linked cloud shows under Run on).//!//! - Cua Volume ([`Experiment::CuaVolume`]): the first run's Volume page//! (and its Done line) and Settings' Storage section;@@ -13,9 +11,9 @@//! connected clouds (AWS, Google Cloud, Hetzner, Modal), "Connect a cloud…" and a//! default location in a cloud;//! - Sharing ([`Experiment::Sharing`]): a Space's Share button;-//! - New UI ([`Experiment::WebUi`]): the shared web UI as the main window-//! (the macOS shell). Settings shows it as "Use classic UI"-//! ([`CLASSIC_UI_ROW`]), the way back to the SwiftUI window.+//! - New UI ([`Experiment::WebUi`]): retired. The shared web UI is the only+//! UI of every shell, so it has no row; the key stays so the macOS shell+//! can report it ([`crate::settings::resolve_new_ui`]).//!//! Off only hides the entry points. Nothing is undone: a mounted Volume//! stays mounted (and keeps syncing), a connected cloud stays connected@@ -25,16 +23,9 @@//! The switches live in the app's settings ([`crate::settings::AppSettings`],//! `experiments`): one key per experiment, missing keys read as their default (off, but on for Sharing and//! Your cloud) and unknown ones are ignored, so an older or newer build reads the file.-//!-//! The New UI is the one switch with a default of its own: `web_ui` is-//! what this launch shows, the user's own choice lives in-//! [`crate::settings::AppSettings::new_ui`] and, without one,-//! [`new_ui_default`] decides ([`crate::settings::resolve_new_ui`]).use serde::{Deserialize, Serialize};-use crate::about::UpdateChannel;-use crate::settings::{SettingsOption, SettingsPage, SettingsRow, SettingsRowKind, SettingsSection,};@@ -50,8 +41,8 @@ pub struct Experiments {/// Sharing a Space with other accounts. On unless turned off: a missing/// key reads as on (the plans on cua.ai/pricing list sharing).pub sharing: bool,- /// The New UI (the shared web UI) is the main window: the user's choice- /// or, without one, [`new_ui_default`] ([`crate::settings::resolve_new_ui`]).+ /// The shared web UI is the main window. Always on in the macOS shell+ /// ([`crate::settings::resolve_new_ui`]); kept for older files and builds.pub web_ui: bool,}@@ -175,138 +166,12 @@ pub fn of_row(id: &str) -> Option<Experiment> {id.strip_prefix("experiment:").and_then(Experiment::parse)}-/// The New UI's row on the Experiments tab: "Use classic UI", on while the-/// New UI is off. (`experiment:web_ui`, on for the New UI, is still read.)-pub const CLASSIC_UI_ROW: &str = "experiment:classic_ui";--/// From this version the New UI is on by default for the Beta channel:-/// every 0.8.1 prerelease (`0.8.1-0` is the lowest SemVer allows; 0.8.0-/// shipped without the default).-pub const NEW_UI_BETA_FROM: &str = "0.8.1-0";--/// The first release with the New UI on by default on every channel.-pub const NEW_UI_ALL_FROM: &str = "0.8.1";--/// Whether the New UI is on for someone who never chose: on the Beta-/// channel from [`NEW_UI_BETA_FROM`], everywhere from [`NEW_UI_ALL_FROM`]-/// (so 0.8.1 turns it on for Stable with no change here). `version` is the-/// running app's (`0.8.1-beta.1`); one that does not read as a version-/// (a dev build's, or none) keeps the classic UI.-pub fn new_ui_default(channel: UpdateChannel, version: &str) -> bool {- let Some(v) = Version::parse(version) else {- return false;- };- let at_least = |from: &str| Version::parse(from).is_some_and(|f| v >= f);- at_least(NEW_UI_ALL_FROM) || (channel == UpdateChannel::Beta && at_least(NEW_UI_BETA_FROM))-}--/// The New UI choice a row's option makes: `Some(on)` for the New UI's-/// row ("Use classic UI" on is the New UI off), `None` for any other row or-/// option. The shell saves it as [`crate::settings::AppSettings::new_ui`].-pub fn new_ui_choice(row: &str, option: &str) -> Option<bool> {- match (row, option) {- (CLASSIC_UI_ROW, "on") => Some(false),- (CLASSIC_UI_ROW, "off") => Some(true),- (r, "on") if of_row(r) == Some(Experiment::WebUi) => Some(true),- (r, "off") if of_row(r) == Some(Experiment::WebUi) => Some(false),- _ => None,- }-}--/// A release version, compared as SemVer does (`0.8.0-beta.6` < `0.8.0`;-/// build metadata after `+` ignored).-#[derive(Debug, Clone, PartialEq, Eq)]-struct Version {- core: [u64; 3],- pre: Vec<PreId>,-}--#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]-enum PreId {- // Numeric identifiers sort before alphanumeric ones.- Num(u64),- Alpha(String),-}--impl Version {- fn parse(s: &str) -> Option<Self> {- let s = s.trim().trim_start_matches('v');- let s = s.split('+').next()?;- let (core, pre) = match s.split_once('-') {- Some((c, p)) => (c, Some(p)),- None => (s, None),- };- let mut parts = core.split('.');- let mut n = [0u64; 3];- for slot in &mut n {- *slot = parts.next()?.parse().ok()?;- }- if parts.next().is_some() {- return None;- }- let pre = match pre {- None => vec![],- Some(p) => p- .split('.')- .map(|id| match id.parse() {- Ok(n) => Some(PreId::Num(n)),- Err(_) if !id.is_empty() => Some(PreId::Alpha(id.to_string())),- Err(_) => None,- })- .collect::<Option<Vec<_>>>()?,- };- Some(Self { core: n, pre })- }-}--impl PartialOrd for Version {- fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {- Some(self.cmp(other))- }-}--impl Ord for Version {- fn cmp(&self, other: &Self) -> std::cmp::Ordering {- use std::cmp::Ordering;- self.core.cmp(&other.core).then_with(|| {- match (self.pre.is_empty(), other.pre.is_empty()) {- (true, true) => Ordering::Equal,- // A release sorts after its prereleases.- (true, false) => Ordering::Greater,- (false, true) => Ordering::Less,- (false, false) => self.pre.cmp(&other.pre),- }- })- }-}-/// The Experiments tab: one switch per experiment, each with its one line.pub fn page(experiments: &Experiments) -> SettingsPage {let mut rows = Vec::new();for e in ALL {if e == Experiment::WebUi {- // "Use classic UI": on while the New UI is off.- let classic = !experiments.web_ui;- let mut toggle =- crate::settings::row(CLASSIC_UI_ROW, SettingsRowKind::Toggle, "Use classic UI");- toggle.options = vec![- SettingsOption {- id: "on".into(),- label: "On".into(),- active: classic,- },- SettingsOption {- id: "off".into(),- label: "Off".into(),- active: !classic,- },- ];- rows.push(toggle);- rows.push(crate::settings::row(- &format!("{CLASSIC_UI_ROW}-note"),- SettingsRowKind::Note,- "Open the previous Spaces window instead of the New UI.",- ));+ // Retired: the web UI is the only UI, so there is nothing to choose.continue;}let on = experiments.is_on(e);@@ -344,12 +209,10 @@ pub fn page(experiments: &Experiments) -> SettingsPage {}/// The switches after a row's choice (`on` or `off`); unchanged for any-/// other row or option.+/// other row or option, and for the retired New UI rows+/// (`experiment:web_ui`, `experiment:classic_ui`).pub fn choose(experiments: &Experiments, row: &str, option: &str) -> Experiments {- if let Some(on) = new_ui_choice(row, option) {- return experiments.with(Experiment::WebUi, on);- }- match (of_row(row), option) {+ match (of_row(row).filter(|e| *e != Experiment::WebUi), option) {(Some(e), "on") => experiments.with(e, true),(Some(e), "off") => experiments.with(e, false),_ => *experiments,@@ -383,16 +246,10 @@ mod tests {"experiment:your_cloud-note","experiment:sharing","experiment:sharing-note",- "experiment:classic_ui",- "experiment:classic_ui-note",]);for r in switches(&p) {- // Off, the New UI shows as "Use classic UI" on.- let shown = if r.id == CLASSIC_UI_ROW- || r.id == "experiment:sharing"- || r.id == "experiment:your_cloud"- {+ let shown = if r.id == "experiment:sharing" || r.id == "experiment:your_cloud" {"on"} else {"off"@@ -431,105 +288,28 @@ mod tests {}#[test]- fn use_classic_ui_is_the_new_ui_switch_inverted() {+ fn the_retired_new_ui_rows_are_gone_and_change_nothing() {let on = Experiments {web_ui: true,..Default::default()};- let row = |x: &Experiments| {- let p = page(x);- let r = switches(&p)- .into_iter()- .find(|r| r.id == CLASSIC_UI_ROW)- .cloned()- .unwrap();- (- r.label.clone(),- r.options.iter().find(|o| o.active).unwrap().id.clone(),- )- };- assert_eq!(row(&on), ("Use classic UI".to_string(), "off".to_string()));- assert_eq!(row(&Experiments::default()).1, "on");- // Classic on is the New UI off, and back.- assert_eq!(choose(&on, CLASSIC_UI_ROW, "on"), Experiments::default());- assert_eq!(choose(&Experiments::default(), CLASSIC_UI_ROW, "off"), on);- // The older row id still means the New UI itself.- assert_eq!(- choose(&Experiments::default(), "experiment:web_ui", "on"),- on- );- assert_eq!(- choose(&on, "experiment:web_ui", "off"),- Experiments::default()- );- assert_eq!(new_ui_choice(CLASSIC_UI_ROW, "on"), Some(false));- assert_eq!(new_ui_choice(CLASSIC_UI_ROW, "off"), Some(true));- assert_eq!(new_ui_choice("experiment:web_ui", "on"), Some(true));- assert_eq!(new_ui_choice("experiment:sharing", "on"), None);- assert_eq!(new_ui_choice(CLASSIC_UI_ROW, "maybe"), None);- }-- #[test]- fn the_new_ui_is_on_for_beta_from_0_8_1_betas_and_for_everyone_from_0_8_1() {- use UpdateChannel::{Beta, Stable};- for (channel, version, on) in [- // Before: classic on both channels, 0.8.0 included (it shipped- // without the default).- (Beta, "0.7.2", false),- (Stable, "0.7.2", false),- (Beta, "0.8.0-beta.5", false),- (Beta, "0.8.0-beta.6", false),- (Beta, "0.8.0", false),- (Stable, "0.8.0", false),- // Beta: every 0.8.1 prerelease, from the first.- (Beta, "0.8.1-0", true),- (Beta, "0.8.1-beta.0", true),- (Beta, "0.8.1-beta.1", true),- (Beta, "0.8.1-beta.10", true),- (Beta, "0.8.1-rc.1", true),- (Beta, "0.8.1-beta.1+build.7", true),- // Stable keeps classic until 0.8.1.- (Stable, "0.8.1-beta.1", false),- (Stable, "0.8.1-rc.1", false),- (Stable, "0.8.1", true),- (Beta, "0.8.1", true),- (Stable, "0.8.2", true),- (Stable, "0.9.0-beta.1", true),- (Stable, "1.0.0", true),- // Not a version: classic.- (Beta, "", false),- (Beta, "dev", false),- (Beta, "0.8", false),- ] {- assert_eq!(- new_ui_default(channel, version),- on,- "{channel:?} {version}"+ for x in [on, Experiments::default()] {+ let p = page(&x);+ assert!(+ p.sections[0]+ .rows+ .iter()+ .all(|r| !r.id.contains("classic_ui") && !r.id.contains("web_ui")),+ "no New UI row");+ for row in ["experiment:classic_ui", "experiment:web_ui"] {+ for option in ["on", "off"] {+ assert_eq!(choose(&x, row, option), x, "{row} {option}");+ }+ }}}- #[test]- fn versions_compare_as_semver() {- let v = |s: &str| Version::parse(s).unwrap();- assert!(- v("0.8.0-beta.6") < v("0.8.0-beta.10"),- "numeric parts as numbers"- );- assert!(v("0.8.0-beta.6") < v("0.8.0-rc.1"));- assert!(v("0.8.0-rc.1") < v("0.8.0"));- assert!(v("0.7.2") < v("0.8.0-beta.1"));- assert!(v("0.8.0-beta") < v("0.8.0-beta.1"));- assert!(v("0.8.0") < v("0.8.1-0"));- assert!(- v("0.8.1-0") < v("0.8.1-beta.0"),- "numeric before alphanumeric"- );- assert_eq!(v("v0.8.0+abc"), v("0.8.0"));- assert!(Version::parse("0.8.0-").is_none());- assert!(Version::parse("0.8.0.1").is_none());- }-#[test]fn stored_keys_are_forward_compatible() {let x: Experiments =diff --git a/libs/cua/crates/cua-spaces-app-core/src/settings.rs b/libs/cua/crates/cua-spaces-app-core/src/settings.rsindex 5009f491b1..fa1ad88fd5 100644--- a/libs/cua/crates/cua-spaces-app-core/src/settings.rs+++ b/libs/cua/crates/cua-spaces-app-core/src/settings.rs@@ -64,15 +64,14 @@ pub struct AppSettings {/// Settings); `None`: never chosen ([`crate::login_item::launch_plan`]).pub launch_at_login: Option<bool>,/// Settings, Experiments: every switch off unless turned on- /// ([`crate::experiments`]). Its `webUi` is the New UI as this launch- /// shows it ([`resolve_new_ui`]); the file keeps only [`Self::new_ui`]'s+ /// ([`crate::experiments`]). Its `webUi` is always on in the macOS+ /// shell ([`resolve_new_ui`]); the file keeps only [`Self::new_ui`]'s/// "on" there, the value older builds read.pub experiments: Experiments,- /// The New UI as the user chose it (Settings, Experiments, "Use classic- /// UI"); `None`: never chosen, so- /// [`crate::experiments::new_ui_default`] decides. An older build's- /// saved `webUi: true` reads as `Some(true)`; its `false` was only the- /// saved default, so it reads as never chosen ([`load`]).+ /// The New UI as an older build's "Use classic UI" saved it. Read and+ /// kept for those builds, never acted on: the web UI is the only UI+ /// ([`resolve_new_ui`]). An older build's saved `webUi: true` reads as+ /// `Some(true)`; its `false` was only the saved default ([`load`]).pub new_ui: Option<bool>,/// Keyvault copies (import ids) the user dismissed from the notch: it no/// longer shows them, nothing is revoked or wiped@@ -197,21 +196,20 @@ fn migrate_defaults(path: &Path, s: &mut AppSettings) {let _ = std::fs::write(&marker, serde_json::Value::Object(done).to_string());}-/// `settings` with the New UI as this launch shows it: the user's choice,-/// else [`crate::experiments::new_ui_default`] for the update channel and-/// the running app's `version`. Again after the channel changes.-pub fn resolve_new_ui(settings: &AppSettings, version: &str) -> AppSettings {+/// `settings` with the New UI as this launch shows it: always on. The shared+/// web UI is the only UI of the macOS app (the SwiftUI views are gone), so an+/// older build's "Use classic UI" choice ([`AppSettings::new_ui`] `false`)+/// no longer applies: that install opens the web UI like every other one.+/// `version` is unused, kept for the shells' binding.+pub fn resolve_new_ui(settings: &AppSettings, _version: &str) -> AppSettings {let mut s = settings.clone();- s.experiments.web_ui = s- .new_ui- .unwrap_or_else(|| crate::experiments::new_ui_default(s.update_channel, version));+ s.experiments.web_ui = true;s}/// The update channel of an install's first launch, from the one in the/// settings file (`channel`): Beta for a prerelease (someone who installed-/// a beta keeps getting betas, and the New UI default that comes with-/// them), else unchanged.+/// a beta keeps getting betas), else unchanged.pub fn first_launch_channel(channel: UpdateChannel, version: &str) -> UpdateChannel {if version.split('+').next().unwrap_or("").contains('-') {UpdateChannel::Beta@@ -220,16 +218,11 @@ pub fn first_launch_channel(channel: UpdateChannel, version: &str) -> UpdateChan}}-/// The settings after a Settings, Experiments row's choice: the switches-/// ([`crate::experiments::choose`]) and, for the New UI's row ("Use classic-/// UI"), the user's choice ([`AppSettings::new_ui`]), which later launches-/// keep whatever the default becomes.+/// The settings after a Settings, Experiments row's choice+/// ([`crate::experiments::choose`]).pub fn choose_experiment(settings: &AppSettings, row: &str, option: &str) -> AppSettings {let mut s = settings.clone();s.experiments = crate::experiments::choose(&s.experiments, row, option);- if let Some(on) = crate::experiments::new_ui_choice(row, option) {- s.new_ui = Some(on);- }s}@@ -1348,119 +1341,43 @@ mod tests {}#[test]- fn an_older_builds_saved_new_ui_migrates_once() {- let (dir, path) = temp_settings("migrate");- let beta = "0.8.1-beta.1";- // Every older install saved `webUi: false` without anyone choosing it:- // never chosen, so Beta gets the New UI.- std::fs::write(- &path,- r#"{"updateChannel":"beta","experiments":{"cuaVolume":true,"webUi":false}}"#,- )- .unwrap();- let s = load(&path);- assert_eq!(s.new_ui, None);- assert!(s.experiments.cua_volume);- assert!(!s.experiments.web_ui, "on only by choice until resolved");- assert!(resolve_new_ui(&s, beta).experiments.web_ui);- assert!(!resolve_new_ui(&s, "0.8.0").experiments.web_ui);- // Saving the resolved settings keeps it unchosen: the default is- // never written as a choice.- save(&path, &resolve_new_ui(&s, beta)).unwrap();- let raw: serde_json::Value =- serde_json::from_str(&std::fs::read_to_string(&path).unwrap()).unwrap();- assert_eq!(raw["experiments"]["webUi"], false, "what older builds read");- assert!(raw["newUi"].is_null());- assert_eq!(load(&path).new_ui, None);-- // A saved `webUi: true` was chosen: kept, on any channel.- std::fs::write(&path, r#"{"experiments":{"webUi":true}}"#).unwrap();- let s = load(&path);- assert_eq!(s.new_ui, Some(true));- assert!(s.experiments.web_ui);- assert!(resolve_new_ui(&s, "0.7.2").experiments.web_ui);- save(&path, &s).unwrap();- assert_eq!(load(&path).new_ui, Some(true));-- // No experiments at all (or no file): never chosen.- std::fs::write(&path, r#"{"menuBar":true}"#).unwrap();- assert_eq!(load(&path).new_ui, None);- std::fs::remove_file(&path).unwrap();- let fresh = load(&path);- assert_eq!(fresh.new_ui, None);- assert!(!resolve_new_ui(&fresh, beta).experiments.web_ui, "Stable");- let _ = std::fs::remove_dir_all(dir);- }-- #[test]- fn use_classic_ui_survives_later_launches() {- let (dir, path) = temp_settings("classic");- let beta = "0.8.1-beta.1";- let s = resolve_new_ui(- &AppSettings {- update_channel: UpdateChannel::Beta,- ..Default::default()- },- beta,- );- assert!(s.experiments.web_ui);- // "Use classic UI" on: saved as the user's choice.- let row = crate::experiments::CLASSIC_UI_ROW;- let s = choose_experiment(&s, row, "on");- assert_eq!(s.new_ui, Some(false));- assert!(!s.experiments.web_ui);- // Another row leaves the choice alone.- assert_eq!(- choose_experiment(&s, "experiment:sharing", "on").new_ui,- Some(false)- );- save(&path, &s).unwrap();- // Later launches, later versions, either channel: still classic.- for version in [beta, "0.8.1-beta.2", "0.8.1", "0.9.0"] {- let again = resolve_new_ui(&load(&path), version);- assert_eq!(again.new_ui, Some(false));- assert!(!again.experiments.web_ui, "{version}");- save(&path, &again).unwrap();+ fn the_web_ui_is_on_for_every_install_whatever_an_older_build_saved() {+ let (dir, path) = temp_settings("web-only");+ // "Use classic UI" on (an older build's choice), a never-chosen+ // `webUi: false`, a chosen `true`, no file: the web UI every time,+ // on either channel and any version.+ for raw in [+ Some(r#"{"updateChannel":"stable","newUi":false,"experiments":{"webUi":false}}"#),+ Some(r#"{"updateChannel":"beta","experiments":{"cuaVolume":true,"webUi":false}}"#),+ Some(r#"{"experiments":{"webUi":true}}"#),+ None,+ ] {+ match raw {+ Some(raw) => std::fs::write(&path, raw).unwrap(),+ None => {+ let _ = std::fs::remove_file(&path);+ }+ }+ for version in ["0.7.2", "0.8.0", "0.16.1", "dev", ""] {+ assert!(+ resolve_new_ui(&load(&path), version).experiments.web_ui,+ "{raw:?} {version}"+ );+ }}- // Off again: the New UI, kept as chosen even on Stable before 0.8.1.- let mut s = choose_experiment(&load(&path), row, "off");- assert_eq!(s.new_ui, Some(true));- s.update_channel = UpdateChannel::Stable;- save(&path, &s).unwrap();- assert!(resolve_new_ui(&load(&path), "0.7.3").experiments.web_ui);- let _ = std::fs::remove_dir_all(dir);- }-- #[test]- fn switching_channel_moves_the_default_not_a_choice() {- let beta = AppSettings {- update_channel: UpdateChannel::Beta,+ // The retired rows change nothing, and leave the old choice alone.+ let s = AppSettings {+ new_ui: Some(false),..Default::default()};- let stable = AppSettings {- update_channel: UpdateChannel::Stable,- ..beta.clone()- };- let v = "0.8.1-beta.1";- assert!(resolve_new_ui(&beta, v).experiments.web_ui);- assert!(!resolve_new_ui(&stable, v).experiments.web_ui);- // Back to Beta: on again.- let back = AppSettings {- update_channel: UpdateChannel::Beta,- ..resolve_new_ui(&stable, v)- };- assert!(resolve_new_ui(&back, v).experiments.web_ui);- // A choice holds on either channel.- for (choice, channel) in [(false, UpdateChannel::Beta), (true, UpdateChannel::Stable)] {- let s = AppSettings {- update_channel: channel,- new_ui: Some(choice),- ..Default::default()- };- assert_eq!(resolve_new_ui(&s, v).experiments.web_ui, choice);+ for row in ["experiment:classic_ui", "experiment:web_ui"] {+ for option in ["on", "off"] {+ let after = choose_experiment(&s, row, option);+ assert_eq!(after.new_ui, Some(false));+ assert_eq!(after.experiments, s.experiments);+ }}- // From 0.8.1, Stable too.- assert!(resolve_new_ui(&stable, "0.8.1").experiments.web_ui);+ let _ = std::fs::remove_dir_all(dir);}#[test]@@ -1472,12 +1389,6 @@ mod tests {assert_eq!(first_launch_channel(Stable, "0.8.0+build-7"), Stable);// A release keeps a channel already in the file.assert_eq!(first_launch_channel(Beta, "0.7.2"), Beta);- // With it, a fresh beta opens the New UI.- let fresh = AppSettings {- update_channel: first_launch_channel(Stable, "0.8.1-beta.1"),- ..Default::default()- };- assert!(resolve_new_ui(&fresh, "0.8.1-beta.1").experiments.web_ui);}#[test]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 f7c996c032..7e9b8a750b 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@@ -6745,8 +6745,8 @@ pub struct AppExperiments {/// Sharing a Space with other accounts. On unless turned off: a missing/// key reads as on (the plans on cua.ai/pricing list sharing).pub sharing: bool,- /// The New UI (the shared web UI) is the main window: the user's choice- /// or, without one, [`new_ui_default`] ([`crate::settings::resolve_new_ui`]).+ /// The shared web UI is the main window. Always on in the macOS shell+ /// ([`crate::settings::resolve_new_ui`]); kept for older files and builds.pub web_ui: bool,}@@ -6788,15 +6788,14 @@ pub struct AppSettings {/// Settings); `None`: never chosen ([`crate::login_item::launch_plan`]).pub launch_at_login: Option<bool>,/// Settings, Experiments: every switch off unless turned on- /// ([`crate::experiments`]). Its `webUi` is the New UI as this launch- /// shows it ([`resolve_new_ui`]); the file keeps only [`Self::new_ui`]'s+ /// ([`crate::experiments`]). Its `webUi` is always on in the macOS+ /// shell ([`resolve_new_ui`]); the file keeps only [`Self::new_ui`]'s/// "on" there, the value older builds read.pub experiments: AppExperiments,- /// The New UI as the user chose it (Settings, Experiments, "Use classic- /// UI"); `None`: never chosen, so- /// [`crate::experiments::new_ui_default`] decides. An older build's- /// saved `webUi: true` reads as `Some(true)`; its `false` was only the- /// saved default, so it reads as never chosen ([`load`]).+ /// The New UI as an older build's "Use classic UI" saved it. Read and+ /// kept for those builds, never acted on: the web UI is the only UI+ /// ([`resolve_new_ui`]). An older build's saved `webUi: true` reads as+ /// `Some(true)`; its `false` was only the saved default ([`load`]).pub new_ui: Option<bool>,/// Keyvault copies (import ids) the user dismissed from the notch: it no/// longer shows them, nothing is revoked or wipeddiff --git a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swiftindex 916eb29098..6979a079d4 100644--- a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift+++ b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift@@ -14341,8 +14341,8 @@ public struct AppExperiments: Equatable, Hashable {*/public var sharing: Bool/**- * The New UI (the shared web UI) is the main window: the user's choice- * or, without one, [`new_ui_default`] ([`crate::settings::resolve_new_ui`]).+ * The shared web UI is the main window. Always on in the macOS shell+ * ([`crate::settings::resolve_new_ui`]); kept for older files and builds.*/public var webUi: Bool@@ -14360,8 +14360,8 @@ public struct AppExperiments: Equatable, Hashable {* key reads as on (the plans on cua.ai/pricing list sharing).*/sharing: Bool,/**- * The New UI (the shared web UI) is the main window: the user's choice- * or, without one, [`new_ui_default`] ([`crate::settings::resolve_new_ui`]).+ * The shared web UI is the main window. Always on in the macOS shell+ * ([`crate::settings::resolve_new_ui`]); kept for older files and builds.*/webUi: Bool) {self.cuaVolume = cuaVolumeself.yourCloud = yourCloud@@ -32094,17 +32094,16 @@ public struct AppSettings: Equatable, Hashable {public var launchAtLogin: Bool?/*** Settings, Experiments: every switch off unless turned on- * ([`crate::experiments`]). Its `webUi` is the New UI as this launch- * shows it ([`resolve_new_ui`]); the file keeps only [`Self::new_ui`]'s+ * ([`crate::experiments`]). Its `webUi` is always on in the macOS+ * shell ([`resolve_new_ui`]); the file keeps only [`Self::new_ui`]'s* "on" there, the value older builds read.*/public var experiments: AppExperiments/**- * The New UI as the user chose it (Settings, Experiments, "Use classic- * UI"); `None`: never chosen, so- * [`crate::experiments::new_ui_default`] decides. An older build's- * saved `webUi: true` reads as `Some(true)`; its `false` was only the- * saved default, so it reads as never chosen ([`load`]).+ * The New UI as an older build's "Use classic UI" saved it. Read and+ * kept for those builds, never acted on: the web UI is the only UI+ * ([`resolve_new_ui`]). An older build's saved `webUi: true` reads as+ * `Some(true)`; its `false` was only the saved default ([`load`]).*/public var newUi: Bool?/**@@ -32174,16 +32173,15 @@ public struct AppSettings: Equatable, Hashable {*/launchAtLogin: Bool?,/*** Settings, Experiments: every switch off unless turned on- * ([`crate::experiments`]). Its `webUi` is the New UI as this launch- * shows it ([`resolve_new_ui`]); the file keeps only [`Self::new_ui`]'s+ * ([`crate::experiments`]). Its `webUi` is always on in the macOS+ * shell ([`resolve_new_ui`]); the file keeps only [`Self::new_ui`]'s* "on" there, the value older builds read.*/experiments: AppExperiments,/**- * The New UI as the user chose it (Settings, Experiments, "Use classic- * UI"); `None`: never chosen, so- * [`crate::experiments::new_ui_default`] decides. An older build's- * saved `webUi: true` reads as `Some(true)`; its `false` was only the- * saved default, so it reads as never chosen ([`load`]).+ * The New UI as an older build's "Use classic UI" saved it. Read and+ * kept for those builds, never acted on: the web UI is the only UI+ * ([`resolve_new_ui`]). An older build's saved `webUi: true` reads as+ * `Some(true)`; its `false` was only the saved default ([`load`]).*/newUi: Bool?,/*** Keyvault copies (import ids) the user dismissed from the notch: it no