Skip to content

armgit / cua

Public Imported from GitHub
0

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

feat(spaces-macos): Machines page, Get started checklist, ⌘K palette, ⌘1-4 (CUA-1412) (#5035)

Francesco Bonacci5b4a16a522c7
diff --git a/.github/workflows/ci-cua-spaces-macos.yml b/.github/workflows/ci-cua-spaces-macos.yml
index c08e6677d9..38b4ae7fed 100644
--- a/.github/workflows/ci-cua-spaces-macos.yml
+++ b/.github/workflows/ci-cua-spaces-macos.yml
@@ -16,6 +16,8 @@ on:
paths:
- "apps/cua-spaces-macos/**"
- "libs/cua/crates/cua-spaces-app-core/**"
+ # The shared keyboard shortcuts the core reads (palette.rs).
+ - "apps/cua-spaces-web/src/lib/keybindings.json"
- "libs/cua/crates/cua-spaces-ffi/**"
- "libs/cua/crates/cua-spaces-ext/**"
- "libs/cua/crates/cua-teleport/**"
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift
index 61739e6295..469b37b839 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift
@@ -33,6 +33,17 @@ public enum MainSelection: Hashable {
case drive
/// The notifications feed.
case notifications
+ /// Your machines: this one and the others that run your Spaces.
+ case machines
+ /// The getting-started checklist.
+ case gettingStarted
+}
+
+/// A detail action to run once that Space's detail shows (the checklist's
+/// Teleport and Share).
+public struct DetailRequest: Equatable {
+ public let spaceId: String
+ public let action: AppDetailActionId
}
/// The app's root model. It holds the core's Space list state and forwards
@@ -60,6 +71,10 @@ public final class AppModel {
public var banner: String?
public var bannerIsError = false
public var showingNewSpace = false
+ /// The command palette (⌘K).
+ public var showingPalette = false
+ /// Run by the Space's detail when it shows (`DetailRequest`).
+ public var detailRequest: DetailRequest?
public var confirmDeleteId: String?
/// A teleport the notch started: the Space and the dropped app.
public var pendingTeleport: PendingTeleport?
@@ -75,6 +90,8 @@ public final class AppModel {
public let devices: DevicesModel
/// Persistent agents, the Cua Volume and the notifications feed.
public let persistent: PersistentModel
+ /// The getting-started checklist.
+ public let checklist: ChecklistModel
/// Settings, Storage: the Cua Volume's store, Finder volume and cache.
public internal(set) var storage: StorageModel
/// Settings, Agents: the provider keys agents get (kept by the daemon).
@@ -145,6 +162,8 @@ public final class AppModel {
self.startup = startup ?? StartupModel()
self.devices = DevicesModel(devices: devices, presence: presence)
self.persistent = PersistentModel(tools: backend as? AgentsToolRunning)
+ self.checklist = ChecklistModel(path: URL(fileURLWithPath: settingsPath)
+ .deletingLastPathComponent().appendingPathComponent("checklist.json").path)
self.storage = StorageModel(tools: backend as? AgentsToolRunning)
self.agentKeys = AgentKeysModel(tools: backend as? AgentsToolRunning)
self.cloud = CloudModel(tools: backend as? CloudToolRunning)
@@ -173,6 +192,7 @@ public final class AppModel {
// The app core's usage events for each step (the Tauri app sends
// the same ones): the first run, Settings, Storage, enrollment.
onboarding.telemetry = telemetry
+ self.checklist.telemetry = telemetry
self.storage.telemetry = telemetry
self.devices.telemetry = telemetry
// Live Keyvault sign-ins show left of the notch (and in the menu).
@@ -328,6 +348,67 @@ public final class AppModel {
appHostedRows(spaces: spaces, machineSpaceId: machineId, selectedId: sidebar.selectedId ?? "")
}
+ // MARK: - Machines and getting started
+
+ /// The Machines page's rows, whatever the search: This machine, then
+ /// your other machines (the core's `relay:<machine>` rows; the Spaces
+ /// they provide are nested under them and listed in their detail).
+ public var machineRows: [AppSidebarRow] {
+ let all = appSidebar(spaces: spaces, query: "", selectedId: "")
+ let others = all.sections.flatMap(\.rows).filter { !$0.nested && $0.id.hasPrefix("relay:") }
+ return (all.thisMachine.map { [$0] } ?? []) + others
+ }
+
+ /// Your Spaces: neither This machine nor one of your machines.
+ var realSpaces: [AppSpace] {
+ spaces.filter { !$0.id.hasPrefix("relay:") && !detail($0).isHost }
+ }
+
+ /// What the checklist ticks off from what the app shows.
+ var checklistSeen: AppChecklistAction {
+ .observe(otherMachine: machineRows.contains { $0.id.hasPrefix("relay:") },
+ hasSpace: realSpaces.contains { $0.status == .running || $0.status == .suspended },
+ agentRan: persistent.agentCount > 0)
+ }
+
+ /// "Add a machine": New Space's "Connect by address".
+ public func openAddMachine() async {
+ await openNativeNewSpace()
+ wizard.send(.showAddress)
+ }
+
+ /// Getting started (the palette, Help): opens the checklist again.
+ public func openGettingStarted() {
+ checklist.send(.reopen)
+ selection = .gettingStarted
+ }
+
+ /// A checklist step's button.
+ public func runChecklistStep(_ step: AppChecklistStep) async {
+ switch step {
+ case .addMachine:
+ selection = .machines
+ await openAddMachine()
+ case .createSpace: await openNewSpace()
+ case .teleport: await openOnSpace(.teleport)
+ case .share: await openOnSpace(.share)
+ case .runAgent: selection = .agents
+ }
+ }
+
+ /// Opens `action` on the first Space that offers it now; without one,
+ /// New Space (no Space yet) or the first Space (to start it).
+ private func openOnSpace(_ action: AppDetailActionId) async {
+ let real = realSpaces
+ if real.isEmpty { return await openNewSpace() }
+ let ready = real.first { space in
+ detail(space).actions.contains { $0.id == action && $0.enabled }
+ }
+ let space = ready ?? real[0]
+ selection = .space(space.id)
+ if ready != nil { detailRequest = DetailRequest(spaceId: space.id, action: action) }
+ }
+
/// Reads a Space's memory and storage use now.
public func refreshUsage(_ id: String) async {
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/ChecklistModel.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/ChecklistModel.swift
new file mode 100644
index 0000000000..3fdd322156
--- /dev/null
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/ChecklistModel.swift
@@ -0,0 +1,67 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+import CuaSpacesFFI
+import Foundation
+import Observation
+
+/// The getting-started checklist: the core's `appChecklistReduce` and
+/// `appChecklistView` (the React UI makes the same calls), kept in
+/// `checklist.json` beside the settings file.
+@MainActor @Observable
+public final class ChecklistModel {
+ public private(set) var state: AppChecklistState
+ private let path: String?
+ /// Where usage events go (`checklist_<step>`, `checklist_completed`, ...).
+ var telemetry: TelemetryRunning?
+
+ /// `path`: the file it is kept in; nil keeps it in memory (tests).
+ public init(path: String?) {
+ self.path = path
+ state = path.flatMap(Self.read) ?? AppChecklistState(done: [], dismissed: false, shown: false)
+ }
+
+ public var view: AppChecklistView { appChecklistView(state: state) }
+
+ public func send(_ action: AppChecklistAction) {
+ let t = appChecklistReduce(state: state, action: action)
+ // Every change records an event; no event, nothing changed.
+ guard !t.signals.isEmpty else { return }
+ state = t.state
+ save()
+ telemetry?.record(t.signals)
+ }
+
+ public func done(_ step: AppChecklistStep) { send(.done(step: step)) }
+
+ // MARK: - The file
+
+ /// What the file holds: the core's state with each step as its word.
+ private struct Stored: Codable {
+ var done: [String]
+ var dismissed: Bool
+ var shown: Bool
+ }
+
+ private static let words: [(AppChecklistStep, String)] = [
+ (.addMachine, "add_machine"), (.createSpace, "create_space"), (.teleport, "teleport"),
+ (.share, "share"), (.runAgent, "run_agent"),
+ ]
+
+ private static func read(_ path: String) -> AppChecklistState? {
+ guard let data = FileManager.default.contents(atPath: path),
+ let s = try? JSONDecoder().decode(Stored.self, from: data) else { return nil }
+ let done = words.filter { s.done.contains($0.1) }.map(\.0)
+ return AppChecklistState(done: done, dismissed: s.dismissed, shown: s.shown)
+ }
+
+ private func save() {
+ guard let path else { return }
+ let done = state.done.compactMap { step in Self.words.first { $0.0 == step }?.1 }
+ guard let data = try? JSONEncoder().encode(Stored(done: done, dismissed: state.dismissed, shown: state.shown))
+ else { return }
+ let url = URL(fileURLWithPath: path)
+ try? FileManager.default.createDirectory(at: url.deletingLastPathComponent(), withIntermediateDirectories: true)
+ try? data.write(to: url, options: .atomic)
+ }
+}
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/ShareModel.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/ShareModel.swift
index 359d178f82..9e95da5691 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/ShareModel.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/ShareModel.swift
@@ -41,6 +41,8 @@ public final class ShareModel {
/// Where usage events go (shared view-only or not, unshared, a role
/// changed: never who; the app core's, like the Tauri app).
public var telemetry: TelemetryRunning?
+ /// A Space was shared with someone (the getting-started checklist).
+ public var onShared: (() -> Void)?
public func send(_ action: AppShareSheetAction) async {
let wasBusy = state.busy
@@ -54,6 +56,7 @@ public final class ShareModel {
case let .unshare(space, who): shares = try await backend.unshare(id: space, who: who)
}
telemetry?.record(appTelemetryShare(input: before, state: state, action: .done))
+ if case .share = request { onShared?() }
state = appShareReduce(input: input, state: state, action: .done)
} catch {
let failed = AppShareSheetAction.failed(error: "\(error.localizedDescription)")
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/TeleportModel.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/TeleportModel.swift
index 21954a3074..4628f18847 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/TeleportModel.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/TeleportModel.swift
@@ -84,6 +84,8 @@ public final class TeleportModel {
private var sdkEntries: [String: TeleportCatalogEntry] = [:]
private var sdkPlan: TeleportPlan?
/// A run started (true) or ended (false): the notch shows a transfer.
+ /// An app was teleported (the getting-started checklist).
+ public var onTeleported: (() -> Void)?
public var onTransfer: ((Bool) -> Void)?
/// Streams one of the Space's windows here (From <Space>).
public var onStreamWindow: ((String) -> Void)?
@@ -462,6 +464,7 @@ public final class TeleportModel {
listener: RunEvents { [weak self] event in
Task { @MainActor in self?.send(.progress(event: appTeleportRunEvent(event: event))) }
})
+ onTeleported?()
send(.finished(report: AppTeleportRunReport(
appId: report.appId, installed: report.installed, sent: report.sent,
imported: report.imported, skipped: report.skipped, launched: report.launched)))
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/CommandPaletteView.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/CommandPaletteView.swift
new file mode 100644
index 0000000000..9225e575a1
--- /dev/null
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/CommandPaletteView.swift
@@ -0,0 +1,248 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+import CuaSpacesFFI
+import SwiftUI
+
+/// The shared keyboard shortcuts: the core's `appKeybindings`, which are
+/// the React UI's `keybindings.json`, so both bind the same keys.
+enum SharedShortcuts {
+ static let keys: [String: String] = Dictionary(
+ appKeybindings().map { ($0.command, $0.key) }, uniquingKeysWith: { first, _ in first })
+
+ private static func parts(_ command: String) -> (key: String, mods: [String])? {
+ guard let spec = keys[command] else { return nil }
+ var parts = spec.lowercased().split(separator: "+").map(String.init)
+ guard let key = parts.popLast(), key.count == 1 else { return nil }
+ return (key, parts)
+ }
+
+ /// `mod+k` as ⌘K.
+ static func shortcut(_ command: String) -> KeyboardShortcut? {
+ guard let (key, mods) = parts(command), let ch = key.first else { return nil }
+ var modifiers: EventModifiers = []
+ if mods.contains("mod") { modifiers.insert(.command) }
+ if mods.contains("alt") { modifiers.insert(.option) }
+ if mods.contains("shift") { modifiers.insert(.shift) }
+ return KeyboardShortcut(KeyEquivalent(ch), modifiers: modifiers)
+ }
+
+ /// `mod+shift+l` as "⌘⇧L".
+ static func label(_ command: String) -> String? {
+ guard let (key, mods) = parts(command) else { return nil }
+ let marks = [("mod", "⌘"), ("alt", "⌥"), ("shift", "⇧")].filter { mods.contains($0.0) }.map(\.1)
+ return marks.joined() + key.uppercased()
+ }
+}
+
+/// A page ⌘1–4 go to (the shared keybindings' `nav.*` commands).
+struct NavTarget: Identifiable {
+ let command: String
+ let label: String
+ let symbol: String
+ var id: String { command }
+
+ @MainActor static func all(_ model: AppModel) -> [NavTarget] {
+ [NavTarget(command: "nav.spaces", label: "Spaces", symbol: "square.grid.2x2"),
+ NavTarget(command: "nav.machines", label: "Machines", symbol: "server.rack"),
+ NavTarget(command: "nav.agents", label: "Agents", symbol: "person.2"),
+ NavTarget(command: "nav.keyvault", label: model.chrome.keyvaultTitle, symbol: "key")]
+ }
+}
+
+extension AppModel {
+ /// Goes to the page a `nav.*` command names.
+ public func go(_ command: String) {
+ switch command {
+ case "nav.spaces": selection = sidebar.selectedId.map { .space($0) }
+ case "nav.machines": selection = .machines
+ case "nav.agents": selection = .agents
+ case "nav.keyvault":
+ if let first = keyvault.sidebar.categories.first {
+ selection = .keyvault(.category(category: first.category))
+ }
+ default: break
+ }
+ }
+}
+
+/// 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.
+struct NavigationCommands: View {
+ let model: AppModel
+ @Environment(\.openWindow) private var openWindow
+
+ var body: some View {
+ Button("Command Palette…") { inMain { model.showingPalette = true } }
+ .keyboardShortcut(SharedShortcuts.shortcut("commandPalette.toggle"))
+ Divider()
+ ForEach(NavTarget.all(model)) { target in
+ Button(target.label) { inMain { model.go(target.command) } }
+ .keyboardShortcut(SharedShortcuts.shortcut(target.command))
+ }
+ }
+
+ private func inMain(_ then: () -> Void) {
+ if WebUIWindowController.shared?.window?.isKeyWindow == true { return }
+ guard model.startup.isReady, model.onboarding.completed else { return }
+ openWindow(id: "main")
+ then()
+ }
+}
+
+/// The command palette (⌘K): actions, pages and your Spaces, matched as you
+/// type in the core's order (`appPaletteRank`, the React palette's too).
+struct CommandPaletteView: View {
+ let model: AppModel
+ @Environment(\.openSettings) private var openSettings
+ @State private var query = ""
+ @State private var active = 0
+ @FocusState private var focused: Bool
+
+ struct Command: Identifiable {
+ let id: String
+ let entry: AppPaletteEntry
+ var symbol: String?
+ var osIcon: String?
+ var shortcut: String?
+ let run: () -> Void
+ }
+
+ var body: some View {
+ let all = commands
+ let results = appPaletteRank(entries: all.map(\.entry), query: query).map { all[Int($0)] }
+ let current = min(active, max(0, results.count - 1))
+ VStack(spacing: 0) {
+ HStack(spacing: 8) {
+ Image(systemName: "magnifyingglass").foregroundStyle(.secondary)
+ TextField("Search for a Space or command", text: $query)
+ .textFieldStyle(.plain)
+ .font(.title3)
+ .focused($focused)
+ .onSubmit { run(results, current) }
+ .onKeyPress(.downArrow) { active = (current + 1) % max(1, results.count); return .handled }
+ .onKeyPress(.upArrow) { active = (current - 1 + max(1, results.count)) % max(1, results.count); return .handled }
+ .accessibilityIdentifier("palette-search")
+ }
+ .padding(.horizontal, 14)
+ .padding(.vertical, 12)
+ Divider()
+ if results.isEmpty {
+ Text("No matches")
+ .foregroundStyle(.secondary)
+ .frame(maxWidth: .infinity, maxHeight: .infinity)
+ } else {
+ ScrollViewReader { scroller in
+ ScrollView {
+ LazyVStack(alignment: .leading, spacing: 0) {
+ ForEach(Array(results.enumerated()), id: \.element.id) { i, cmd in
+ if i == 0 || results[i - 1].entry.group != cmd.entry.group {
+ Text(cmd.entry.group)
+ .font(.caption.weight(.medium))
+ .foregroundStyle(.secondary)
+ .padding(.horizontal, 10)
+ .padding(.top, 8)
+ .padding(.bottom, 2)
+ }
+ row(cmd, active: i == current)
+ .id(cmd.id)
+ .contentShape(.rect)
+ .onTapGesture { run(results, i) }
+ .onHover { if $0 { active = i } }
+ }
+ }
+ .padding(6)
+ }
+ .onChange(of: current) { _, i in
+ if results.indices.contains(i) { scroller.scrollTo(results[i].id) }
+ }
+ }
+ }
+ }
+ .frame(width: 560, height: 420)
+ .onChange(of: query) { active = 0 }
+ .onExitCommand { model.showingPalette = false }
+ .onAppear { focused = true }
+ .accessibilityIdentifier("command-palette")
+ }
+
+ private func row(_ cmd: Command, active: Bool) -> some View {
+ HStack(spacing: 10) {
+ Group {
+ if let os = cmd.osIcon {
+ OsIconImage(id: os, size: 13)
+ } else if let symbol = cmd.symbol {
+ Image(systemName: symbol)
+ }
+ }
+ .foregroundStyle(.secondary)
+ .frame(width: 18)
+ Text(cmd.entry.label).lineLimit(1)
+ Spacer(minLength: 8)
+ if let hint = cmd.entry.hint {
+ Text(hint).font(.callout).foregroundStyle(.secondary)
+ }
+ if let shortcut = cmd.shortcut {
+ Text(shortcut).font(.callout.monospaced()).foregroundStyle(.secondary)
+ }
+ }
+ .padding(.horizontal, 10)
+ .frame(height: 30)
+ .background(active ? Color.primary.opacity(0.08) : .clear, in: .rect(cornerRadius: 6))
+ .accessibilityElement(children: .combine)
+ .accessibilityAddTraits(active ? .isSelected : [])
+ }
+
+ private func run(_ results: [Command], _ i: Int) {
+ guard results.indices.contains(i) else { return }
+ model.showingPalette = false
+ results[i].run()
+ }
+
+ private var commands: [Command] {
+ func entry(_ group: String, _ label: String, hint: String? = nil, keywords: String? = nil) -> AppPaletteEntry {
+ AppPaletteEntry(group: group, label: label, hint: hint, keywords: keywords)
+ }
+ let chrome = model.chrome
+ var out: [Command] = [
+ Command(id: "space:new", entry: entry("Actions", chrome.newSpaceLabel, keywords: "create add"),
+ symbol: "plus", shortcut: "⌘N") { Task { await model.openNewSpace() } },
+ Command(id: "machine:add", entry: entry("Actions", "Add a machine", keywords: "connect computer address"),
+ symbol: "plus.rectangle.on.rectangle") {
+ model.selection = .machines
+ Task { await model.openAddMachine() }
+ },
+ ]
+ if let signIn = chrome.signInLabel {
+ out.append(Command(id: "session:signIn", entry: entry("Actions", signIn, keywords: "account log in cloud"),
+ symbol: "person.crop.circle") { Task { await model.beginSignIn() } })
+ }
+ out += NavTarget.all(model).map { t in
+ Command(id: "nav:\(t.command)", entry: entry("Go to", t.label, keywords: "page"), symbol: t.symbol,
+ shortcut: SharedShortcuts.label(t.command)) { model.go(t.command) }
+ }
+ out += [
+ Command(id: "nav:notifications", entry: entry("Go to", "Notifications", keywords: "page"), symbol: "bell") {
+ model.selection = .notifications
+ },
+ Command(id: "nav:settings", entry: entry("Go to", chrome.settingsLabel, keywords: "page preferences"),
+ symbol: "gearshape", shortcut: SharedShortcuts.label("nav.settings")) { openSettings() },
+ Command(id: "nav:checklist", entry: entry("Go to", "Getting started", keywords: "checklist steps tour help first"),
+ symbol: "checklist") { model.openGettingStarted() },
+ ]
+ let rows = appSidebar(spaces: model.spaces, query: "", selectedId: "").sections.flatMap(\.rows)
+ for space in model.realSpaces {
+ let row = rows.first { $0.id == space.id }
+ let hint = row?.statusText
+ let keywords = "\(row?.osIcon ?? "") \(hint ?? "")"
+ out.append(Command(id: "space:open:\(space.id)", entry: entry("Spaces", "Open \(space.name)", hint: hint, keywords: keywords),
+ osIcon: row?.osIcon) { model.selection = .space(space.id) })
+ if let power = appPowerButton(space: space), power.enabled, !power.busy {
+ let label = power.turnOn ? "Start \(space.name)" : "Stop \(space.name)"
+ out.append(Command(id: "space:power:\(space.id)", entry: entry("Spaces", label, hint: hint, keywords: keywords),
+ osIcon: row?.osIcon) { model.setPower(space, on: power.turnOn) })
+ }
+ }
+ return out
+ }
+}
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/CuaSpacesMacApp.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/CuaSpacesMacApp.swift
index a026b3e2f7..0345d1f3f6 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/CuaSpacesMacApp.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/CuaSpacesMacApp.swift
@@ -53,6 +53,13 @@ public struct CuaSpacesMacApp: App {
.keyboardShortcut("u", modifiers: [.command, .shift])
}
}
+ CommandGroup(before: .sidebar) {
+ NavigationCommands(model: model)
+ Divider()
+ }
+ CommandGroup(after: .help) {
+ GettingStartedCommand(model: model)
+ }
}
// A Space's desktop in its own window ("Open"); never at launch.
@@ -142,6 +149,21 @@ struct RootView: View {
}
}
+/// Help, Getting Started: the checklist again, in the main window.
+struct GettingStartedCommand: View {
+ let model: AppModel
+ @Environment(\.openWindow) private var openWindow
+
+ var body: some View {
+ Button("Getting Started") {
+ guard model.startup.isReady, model.onboarding.completed else { return }
+ NSApp.activate()
+ openWindow(id: "main")
+ model.openGettingStarted()
+ }
+ }
+}
+
/// The menu bar item's menu: the core's items in order.
struct MenuBarContent: View {
let model: AppModel
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/GettingStartedView.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/GettingStartedView.swift
new file mode 100644
index 0000000000..711f34d09e
--- /dev/null
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/GettingStartedView.swift
@@ -0,0 +1,81 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+import CuaSpacesFFI
+import SwiftUI
+
+/// The getting-started checklist: the core's rows (`appChecklistView`),
+/// each step's button, and × to close it (Getting Started in the Help menu
+/// or the command palette opens it again).
+struct GettingStartedView: View {
+ let model: AppModel
+
+ var body: some View {
+ let view = model.checklist.view
+ Form {
+ Section {
+ ForEach(view.rows, id: \.step) { row in
+ ChecklistRowView(row: row) {
+ Task { await model.runChecklistStep(row.step) }
+ }
+ }
+ } header: {
+ HStack(alignment: .firstTextBaseline, spacing: 10) {
+ VStack(alignment: .leading, spacing: 2) {
+ Text(view.title).font(.headline)
+ Text(view.detail).font(.callout).foregroundStyle(.secondary)
+ }
+ Spacer()
+ Text(view.progress)
+ .font(.callout.monospacedDigit())
+ .foregroundStyle(.secondary)
+ .accessibilityIdentifier("checklist-progress")
+ Button {
+ model.checklist.send(.dismiss)
+ model.selection = model.sidebar.selectedId.map { .space($0) }
+ } label: {
+ Image(systemName: "xmark")
+ }
+ .buttonStyle(.borderless)
+ .help(view.closeLabel)
+ .accessibilityLabel(view.closeLabel)
+ .accessibilityIdentifier("checklist-close")
+ }
+ .padding(.bottom, 4)
+ }
+ }
+ .formStyle(.grouped)
+ .navigationTitle(view.title)
+ .onAppear { model.checklist.send(.shown) }
+ }
+}
+
+/// One step: a tick when done, its title and line, and its button until done.
+struct ChecklistRowView: View {
+ let row: AppChecklistRow
+ let action: () -> Void
+
+ var body: some View {
+ HStack(spacing: 12) {
+ Image(systemName: row.done ? "checkmark.circle.fill" : "circle")
+ .font(.title3)
+ .foregroundStyle(row.done ? Color.accentColor : Color.secondary)
+ .accessibilityHidden(true)
+ VStack(alignment: .leading, spacing: 2) {
+ Text(row.title)
+ .strikethrough(row.done)
+ .foregroundStyle(row.done ? .secondary : .primary)
+ Text(row.detail)
+ .font(.callout)
+ .foregroundStyle(.secondary)
+ }
+ Spacer(minLength: 8)
+ if !row.done {
+ Button(row.action, action: action)
+ }
+ }
+ .accessibilityElement(children: .combine)
+ .accessibilityValue(row.done ? "Done" : "")
+ .accessibilityIdentifier("checklist-step")
+ }
+}
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/MachinesViews.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/MachinesViews.swift
new file mode 100644
index 0000000000..b603a53f8c
--- /dev/null
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/MachinesViews.swift
@@ -0,0 +1,112 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+import CuaSpacesFFI
+import SwiftUI
+
+/// Machines: This machine and your other machines, each with its Spaces;
+/// the selected one's page beside them (This machine's own page, or the
+/// machine's detail with the Spaces it provides and Remove). The rows are
+/// the core's sidebar rows (`AppModel.machineRows`).
+struct MachinesPageView: View {
+ @Bindable var model: AppModel
+ @State private var selectedId: String?
+
+ var body: some View {
+ let rows = model.machineRows
+ let selected = rows.first { $0.id == selectedId } ?? rows.first
+ HStack(spacing: 0) {
+ VStack(alignment: .leading, spacing: 0) {
+ List(selection: $selectedId) {
+ ForEach(rows, id: \.id) { row in
+ MachineRowView(row: row, isThisMachine: isThisMachine(row),
+ spaces: isThisMachine(row) ? nil : model.hostedRows(row.id).count)
+ .tag(row.id)
+ }
+ }
+ .listStyle(.inset)
+ .accessibilityIdentifier("machines-list")
+ if rows.count <= 1 {
+ Text("Only this machine so far. Add another to run Spaces on it from here.")
+ .font(.callout)
+ .foregroundStyle(.secondary)
+ .padding(12)
+ }
+ }
+ .frame(width: 300)
+ Divider()
+ Group {
+ if let row = selected, let space = model.spaces.first(where: { $0.id == row.id }) {
+ if isThisMachine(row) {
+ ThisMachineView(host: model.host)
+ } else {
+ SpaceDetailView(model: model, space: space)
+ .id(space.id)
+ }
+ } else {
+ ContentUnavailableView {
+ Label("No machines yet", systemImage: "server.rack")
+ } description: {
+ Text("Set up a Mac, Linux or Windows computer for access and it shows here, ready to run Spaces.")
+ }
+ }
+ }
+ .frame(maxWidth: .infinity, maxHeight: .infinity)
+ }
+ .navigationTitle("Machines")
+ .toolbar {
+ ToolbarItem(placement: .primaryAction) {
+ Button {
+ Task { await model.openAddMachine() }
+ } label: {
+ Label("Add a machine", systemImage: "plus.rectangle.on.rectangle")
+ }
+ .help("Add a machine")
+ .accessibilityIdentifier("machines-add")
+ }
+ }
+ }
+
+ private func isThisMachine(_ row: AppSidebarRow) -> Bool {
+ model.spaces.first { $0.id == row.id }.map { model.detail($0).isHost } ?? false
+ }
+}
+
+/// One machine: its OS mark, name, status word and how many Spaces it runs.
+struct MachineRowView: View {
+ let row: AppSidebarRow
+ let isThisMachine: Bool
+ /// Spaces it provides (nil for This machine).
+ let spaces: Int?
+
+ var body: some View {
+ HStack(spacing: 10) {
+ OsIconImage(id: row.osIcon, size: 16)
+ .foregroundStyle(.secondary)
+ .frame(width: 30, height: 30)
+ .background(.fill.tertiary, in: .rect(cornerRadius: 7))
+ VStack(alignment: .leading, spacing: 2) {
+ HStack(spacing: 4) {
+ Text(row.name).lineLimit(1)
+ if isThisMachine {
+ Text("(this machine)").foregroundStyle(.secondary)
+ }
+ }
+ Text(row.statusText)
+ .font(.callout)
+ .foregroundStyle(.secondary)
+ .lineLimit(1)
+ }
+ Spacer(minLength: 4)
+ if let spaces {
+ Text(spaces == 1 ? "1 Space" : "\(spaces) Spaces")
+ .font(.callout.monospacedDigit())
+ .foregroundStyle(.secondary)
+ }
+ }
+ .padding(.vertical, 3)
+ .opacity(row.dim ? 0.6 : 1)
+ .help(row.detail)
+ .accessibilityIdentifier("machine-row")
+ }
+}
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/MainWindow.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/MainWindow.swift
index 09dfb8b2f7..be705e1e85 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/MainWindow.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/MainWindow.swift
@@ -7,7 +7,8 @@ import SwiftUI
/// The main window: a sidebar of Spaces and the Keyvault (with its global
/// switch), and the selected item's detail. Rows are one line; the
-/// sections, search, selection fallback and dimming are the core's.
+/// sections, search, selection fallback and dimming are the core's. ⌘K
+/// opens the command palette.
public struct MainWindow: View {
@Bindable var model: AppModel
@Environment(\.openSettings) private var openSettings
@@ -61,6 +62,9 @@ public struct MainWindow: View {
cloud: model.cloud,
onRuntimeSwitch: { await model.applyRuntimeSwitch($0) })
}
+ .sheet(isPresented: $model.showingPalette) {
+ CommandPaletteView(model: model)
+ }
.sheet(item: approvalBinding) { _ in
ApprovalSheet(keyvault: model.keyvault)
}
@@ -76,6 +80,8 @@ public struct MainWindow: View {
await model.refresh()
await model.keyvault.refresh()
}
+ // The checklist ticks off what the app already shows.
+ .onChange(of: model.checklistSeen, initial: true) { _, seen in model.checklist.send(seen) }
}
/// The main window's copy of a Devices sheet (Settings has its own).
@@ -121,6 +127,10 @@ public struct MainWindow: View {
EmptySpaces(model: model)
case .notifications:
NotificationsPageView(model: model.persistent)
+ case .machines:
+ MachinesPageView(model: model)
+ case .gettingStarted:
+ GettingStartedView(model: model)
case nil:
EmptySpaces(model: model)
}
@@ -141,7 +151,14 @@ struct Sidebar: View {
var body: some View {
let sidebar = model.sidebar
let kv = model.keyvault
+ let checklist = model.checklist.view
List(selection: $model.selection) {
+ if checklist.visible {
+ Label(checklist.title, systemImage: "checklist")
+ .badge(Text(checklist.progress))
+ .tag(MainSelection.gettingStarted)
+ .accessibilityIdentifier("sidebar-getting-started")
+ }
if let row = sidebar.thisMachine {
spaceRow(row)
}
@@ -174,6 +191,7 @@ struct Sidebar: View {
KeyvaultHeader(keyvault: kv, title: model.chrome.keyvaultTitle)
}
Section {
+ Label("Machines", systemImage: "server.rack").tag(MainSelection.machines)
Label("Agents", systemImage: "person.2").tag(MainSelection.agents)
// Only with the Cua Volume experiment on (the core's chrome).
if let volume = model.chrome.volumeLabel {
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/SpaceDetailView.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/SpaceDetailView.swift
index 9002b417e2..f0b79129bc 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/SpaceDetailView.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/SpaceDetailView.swift
@@ -148,6 +148,12 @@ struct SpaceDetailView: View {
model.pendingTeleport = nil
await openTeleport(entry: p.entry, files: p.files)
}
+ // The checklist's Teleport or Share, on this Space.
+ .task(id: model.detailRequest) {
+ guard let r = model.detailRequest, r.spaceId == space.id else { return }
+ model.detailRequest = nil
+ perform(r.action)
+ }
.sheet(item: Binding(get: { teleport.map { TeleportSheetItem(model: $0) } },
set: { if $0 == nil { teleport = nil } })) { item in
TeleportPickerSheet(teleport: item.model) { teleport = nil }
@@ -330,6 +336,7 @@ struct SpaceDetailView: View {
signedIn: model.identity != nil,
shareable: space.id.hasPrefix("relay:") || (space.sdk?.features.contains("relay_attach") ?? false))
sharing?.telemetry = model.telemetrySink
+ sharing?.onShared = { [weak model] in model?.checklist.done(.share) }
model.recordFeature("share_open")
case .power:
if let button = appPowerButton(space: space) { model.setPower(space, on: button.turnOn) }
@@ -388,6 +395,7 @@ struct SpaceDetailView: View {
// The review reads saved Keyvault items and a browser's sites
// from the Keyvault, and starts from what was sent last time.
t.keyvault = model.keyvault
+ t.onTeleported = { [weak model] in model?.checklist.done(.teleport) }
t.rememberedChoices = model.settings.teleportChoices
t.onRemember = { [weak model] choices in
model?.settings.teleportChoices = choices
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ChecklistPaletteTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ChecklistPaletteTests.swift
new file mode 100644
index 0000000000..d1d0b1e75a
--- /dev/null
+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ChecklistPaletteTests.swift
@@ -0,0 +1,110 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+import CuaSpacesFFI
+@testable import CuaSpacesMacKit
+import Foundation
+import SwiftUI
+import Testing
+
+/// The getting-started checklist, the Machines page's rows, ⌘1–4 and the
+/// command palette: the core's decisions, the React UI's keys.
+@MainActor
+struct ChecklistPaletteTests {
+ private func steps(_ t: FixtureTelemetry) -> [String] {
+ t.recorded.compactMap { if case let .step(step, _) = $0 { return step } else { return nil } }
+ }
+
+ @Test func checklistStepsCountOnceAndAreKeptBetweenLaunches() throws {
+ let path = FileManager.default.temporaryDirectory
+ .appendingPathComponent("cua-checklist-\(UUID().uuidString)/checklist.json").path
+ let telemetry = FixtureTelemetry()
+ let checklist = ChecklistModel(path: path)
+ checklist.telemetry = telemetry
+ #expect(checklist.view.visible)
+ #expect(checklist.view.progress == "0 of 5")
+
+ checklist.send(.shown)
+ checklist.send(.shown)
+ checklist.done(.share)
+ checklist.done(.share)
+ checklist.send(.observe(otherMachine: false, hasSpace: true, agentRan: false))
+ #expect(steps(telemetry) == ["checklist_shown", "checklist_share", "checklist_create_space"])
+ #expect(checklist.view.progress == "2 of 5")
+
+ let again = ChecklistModel(path: path)
+ #expect(again.state.done == [.createSpace, .share])
+ #expect(again.state.shown)
+
+ again.send(.dismiss)
+ #expect(!again.view.visible)
+ #expect(!ChecklistModel(path: path).view.visible)
+ }
+
+ @Test func theLastStepCompletesIt() {
+ let telemetry = FixtureTelemetry()
+ let checklist = ChecklistModel(path: nil)
+ checklist.telemetry = telemetry
+ for step in [AppChecklistStep.addMachine, .createSpace, .teleport, .share, .runAgent] { checklist.done(step) }
+ #expect(steps(telemetry).last == "checklist_completed")
+ #expect(checklist.view.complete)
+ #expect(checklist.view.title == "You're set up")
+ }
+
+ @Test func theAppTicksOffWhatItShows() async {
+ let m = ViewModelTests().makeModel()
+ await m.refresh()
+ if case let .observe(otherMachine, hasSpace, agentRan) = m.checklistSeen {
+ #expect(hasSpace, "the fixtures have a running Space")
+ #expect(!otherMachine)
+ #expect(!agentRan)
+ } else {
+ Issue.record("not an observation")
+ }
+ m.checklist.send(m.checklistSeen)
+ #expect(m.checklist.state.done == [.createSpace])
+ }
+
+ @Test func machinesListThisMachineAndNoSpaces() async {
+ let m = ViewModelTests().makeModel()
+ await m.refresh()
+ let ids = m.machineRows.map(\.id)
+ #expect(!ids.contains("local:aurora"))
+ #expect(!ids.contains("direct:10.0.0.5:3211"))
+ #expect(ids.allSatisfy { id in id.hasPrefix("relay:") || m.spaces.first { $0.id == id }.map { m.detail($0).isHost } == true })
+ }
+
+ @Test func checklistButtonsGoWhereTheStepIsDone() async {
+ let m = ViewModelTests().makeModel()
+ await m.refresh()
+ await m.runChecklistStep(.runAgent)
+ #expect(m.selection == .agents)
+ m.openGettingStarted()
+ #expect(m.selection == .gettingStarted)
+ }
+
+ @Test func navigationKeysAreTheSharedOnes() {
+ #expect(SharedShortcuts.shortcut("commandPalette.toggle") == KeyboardShortcut("k", modifiers: .command))
+ #expect(SharedShortcuts.shortcut("nav.machines") == KeyboardShortcut("2", modifiers: .command))
+ #expect(SharedShortcuts.label("nav.keyvault") == "⌘4")
+ #expect(SharedShortcuts.label("theme.cycle") == "⌘⇧L")
+ #expect(SharedShortcuts.shortcut("no.such.command") == nil)
+
+ let m = ViewModelTests().makeModel()
+ m.go("nav.machines")
+ #expect(m.selection == .machines)
+ m.go("nav.agents")
+ #expect(m.selection == .agents)
+ }
+
+ @Test func thePaletteRanksWithTheCore() {
+ let entries = [
+ AppPaletteEntry(group: "Actions", label: "New Space", hint: nil, keywords: "create add"),
+ AppPaletteEntry(group: "Go to", label: "Machines", hint: nil, keywords: "page"),
+ AppPaletteEntry(group: "Spaces", label: "Stop builder", hint: "Running", keywords: nil),
+ ]
+ #expect(appPaletteRank(entries: entries, query: "") == [0, 1, 2])
+ #expect(appPaletteRank(entries: entries, query: "mach") == [1])
+ #expect(appPaletteRank(entries: entries, query: "stop run") == [2])
+ }
+}
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/discovery-warm-sidebar.png b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/discovery-warm-sidebar.png
index b2e3346456..c86f24e8fe 100644
Binary files a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/discovery-warm-sidebar.png and b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/discovery-warm-sidebar.png differ
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/sidebar-my-machines-not-enrolled.png b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/sidebar-my-machines-not-enrolled.png
index 8bc183bed6..6d6a8dc702 100644
Binary files a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/sidebar-my-machines-not-enrolled.png and b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/sidebar-my-machines-not-enrolled.png differ
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/sidebar-power.png b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/sidebar-power.png
index b6bb33fc8c..b886fe0c1f 100644
Binary files a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/sidebar-power.png and b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/sidebar-power.png differ
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/sidebar-signed-in.png b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/sidebar-signed-in.png
index bf5c2295c1..9c7a20d9a6 100644
Binary files a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/sidebar-signed-in.png and b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/sidebar-signed-in.png differ
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/sidebar-without-this-mac.png b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/sidebar-without-this-mac.png
index 7f4e238b4b..6d5746cdf6 100644
Binary files a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/sidebar-without-this-mac.png and b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/sidebar-without-this-mac.png differ
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/sidebar.png b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/sidebar.png
index 0a42fab2eb..03b9d04bf0 100644
Binary files a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/sidebar.png and b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/sidebar.png differ
diff --git a/apps/cua-spaces-web/src/bridge/__tests__/checklist.test.ts b/apps/cua-spaces-web/src/bridge/__tests__/checklist.test.ts
index a24c55c7c6..c8d3d44a38 100644
--- a/apps/cua-spaces-web/src/bridge/__tests__/checklist.test.ts
+++ b/apps/cua-spaces-web/src/bridge/__tests__/checklist.test.ts
@@ -3,17 +3,19 @@
import { beforeEach, describe, expect, it } from "vitest";
-import { CHECKLIST_STEPS, checklistDone, readChecklist, resetChecklistCache, telemetryChecklist } from "../checklist";
+import { CHECKLIST_STEPS, checklistDone, checklistView, readChecklist, resetChecklistCache } from "../checklist";
import type { BridgeStore } from "../store";
import { sanitizeSignals, type TelemetrySignal } from "../ops/telemetry";
-import { testCore, wasmBuilt } from "./testCore";
+import { noCore, testCore, wasmBuilt } from "./testCore";
const KEY = "cua-spaces:checklist";
-async function fakeStore(): Promise<{ store: BridgeStore; sent: TelemetrySignal[] }> {
+async function fakeStore(core?: BridgeStore["core"]): Promise<{ store: BridgeStore; sent: TelemetrySignal[] }> {
const sent: TelemetrySignal[] = [];
- const core = await testCore();
- const store = { core, telemetry: { track: async (s: readonly unknown[]) => void sent.push(...sanitizeSignals(s)) } } as unknown as BridgeStore;
+ const store = {
+ core: core ?? (await testCore()),
+ telemetry: { track: async (s: readonly unknown[]) => void sent.push(...sanitizeSignals(s)) },
+ } as unknown as BridgeStore;
return { store, sent };
}
@@ -23,7 +25,7 @@ beforeEach(() => {
});
describe("the getting-started checklist", () => {
- it("keeps each step done between launches", async () => {
+ it.skipIf(!wasmBuilt)("keeps each step done between launches, in the stored shape", async () => {
const { store } = await fakeStore();
checklistDone(store, "create_space");
resetChecklistCache();
@@ -56,9 +58,25 @@ describe("the getting-started checklist", () => {
]);
});
- it.skipIf(!wasmBuilt)("sends nothing for a word the core doesn't know", async () => {
+ it.skipIf(!wasmBuilt)("draws the core's rows and progress", async () => {
const core = await testCore();
- expect(telemetryChecklist(core, "shown")).toEqual([{ type: "step", step: "checklist_shown", ok: true }]);
- expect(telemetryChecklist(core, "[email protected]" as never)).toEqual([]);
+ const view = checklistView(core, { done: { teleport: true }, dismissed: false, shown: true })!;
+ expect(view).toMatchObject({ visible: true, complete: false, title: "Get started", progress: "1 of 5" });
+ expect(view.rows.map((r) => [r.step, r.action, r.done])).toEqual([
+ ["add_machine", "Add machine", false],
+ ["create_space", "Create", false],
+ ["teleport", "Teleport", true],
+ ["share", "Share", false],
+ ["run_agent", "Open Agents", false],
+ ]);
+ expect(checklistView(core, { done: {}, dismissed: true, shown: true })?.visible).toBe(false);
+ });
+
+ it("without the core: not drawn, and nothing changes", async () => {
+ const { store, sent } = await fakeStore(noCore);
+ checklistDone(store, "share");
+ expect(readChecklist().done).toEqual({});
+ expect(sent).toEqual([]);
+ expect(checklistView(noCore, readChecklist())).toBeNull();
});
});
diff --git a/apps/cua-spaces-web/src/bridge/checklist.ts b/apps/cua-spaces-web/src/bridge/checklist.ts
index 22605268b3..73337e879b 100644
--- a/apps/cua-spaces-web/src/bridge/checklist.ts
+++ b/apps/cua-spaces-web/src/bridge/checklist.ts
@@ -6,9 +6,12 @@
* Spaces, ticked off as they happen and kept between launches (this
* page's storage, like the first run's progress).
*
- * Usage events are the core's (`telemetry.checklist`): `cua_onboarding_step`
- * with step `checklist_shown`, `checklist_<step>` (once per step),
+ * What each event does to it, its words and its usage events are the
+ * core's (`checklist.reduce`, `checklist.view`), the same calls the SwiftUI
+ * app makes. Usage events: `cua_onboarding_step` with step
+ * `checklist_shown`, `checklist_<step>` (once per step),
* `checklist_completed`, `checklist_dismissed` or `checklist_reopened`.
+ * Without the core the checklist is not shown and nothing changes.
*/
import { useContext, useEffect, useSyncExternalStore } from "react";
@@ -18,13 +21,11 @@ import type { CoreClient } from "./core";
import type { TelemetrySignal } from "./ops/telemetry";
import type { BridgeStore } from "./store";
-/** The steps in order (`telemetry::CHECKLIST_STEPS`). */
+/** The steps in order (`checklist::STEPS`). */
export const CHECKLIST_STEPS = ["add_machine", "create_space", "teleport", "share", "run_agent"] as const;
export type ChecklistStep = (typeof CHECKLIST_STEPS)[number];
-/** What happens to the checklist itself. */
-export type ChecklistEvent = ChecklistStep | "shown" | "completed" | "dismissed" | "reopened";
-
+/** As stored (the shape earlier versions wrote). */
export interface ChecklistState {
/** Steps done, each once. */
done: Partial<Record<ChecklistStep, true>>;
@@ -34,6 +35,55 @@ export interface ChecklistState {
shown: boolean;
}
+/** `checklist::ChecklistAction`. */
+export type ChecklistAction =
+ | { type: "done"; step: ChecklistStep }
+ | { type: "shown" }
+ | { type: "dismiss" }
+ | { type: "reopen" }
+ | { type: "observe"; otherMachine: boolean; hasSpace: boolean; agentRan: boolean };
+
+/** `checklist::ChecklistRow`. */
+export interface ChecklistRow {
+ step: ChecklistStep;
+ title: string;
+ detail: string;
+ /** The button that does it; hidden once done. */
+ action: string;
+ done: boolean;
+}
+
+/** `checklist::ChecklistView`. */
+export interface ChecklistView {
+ visible: boolean;
+ complete: boolean;
+ title: string;
+ detail: string;
+ /** "2 of 5". */
+ progress: string;
+ closeLabel: string;
+ rows: ChecklistRow[];
+}
+
+/** `checklist::ChecklistState`. */
+interface CoreChecklistState {
+ done: ChecklistStep[];
+ dismissed: boolean;
+ shown: boolean;
+}
+
+const toCore = (s: ChecklistState): CoreChecklistState => ({
+ done: CHECKLIST_STEPS.filter((step) => s.done[step]),
+ dismissed: s.dismissed,
+ shown: s.shown,
+});
+
+function fromCore(c: CoreChecklistState): ChecklistState {
+ const done: ChecklistState["done"] = {};
+ for (const step of c.done) done[step] = true;
+ return { done, dismissed: c.dismissed, shown: c.shown };
+}
+
const STORAGE_KEY = "cua-spaces:checklist";
const EMPTY: ChecklistState = { done: {}, dismissed: false, shown: false };
let saved: ChecklistState | undefined;
@@ -97,52 +147,38 @@ export function subscribeChecklist(listener: () => void): () => void {
};
}
-export const checklistComplete = (s: ChecklistState) => CHECKLIST_STEPS.every((step) => s.done[step]);
-
-/** The core's usage events for one checklist event. */
-export function telemetryChecklist(core: CoreClient, event: ChecklistEvent): TelemetrySignal[] {
- return core.tryCall<TelemetrySignal[]>("telemetry.checklist", { event }) ?? [];
+/** The checklist as drawn, or null without the core. */
+export function checklistView(core: CoreClient, state: ChecklistState): ChecklistView | null {
+ return core.tryCall<ChecklistView>("checklist.view", { state: toCore(state) }) ?? null;
}
-function track(store: BridgeStore | null, events: ChecklistEvent[]): void {
- if (!store) return;
- for (const e of events) void store.telemetry.track(telemetryChecklist(store.core, e));
+/** Runs `action` through the core: saves what changed and answers the
+ * usage events it means. */
+function apply(core: CoreClient, action: ChecklistAction): TelemetrySignal[] {
+ const t = core.tryCall<{ state: CoreChecklistState; signals: TelemetrySignal[] }>("checklist.reduce", {
+ state: toCore(readChecklist()),
+ action,
+ });
+ if (!t || t.signals.length === 0) return [];
+ write(fromCore(t.state));
+ return t.signals;
}
-/** Events waiting for the bridge store. */
-const pending: ChecklistEvent[] = [];
-
-/* Each change is saved at once and answers with the events it means. */
-
-function markDone(step: ChecklistStep): ChecklistEvent[] {
- const s = readChecklist();
- if (s.done[step]) return [];
- const next = { ...s, done: { ...s.done, [step]: true as const } };
- write(next);
- return checklistComplete(next) ? [step, "completed"] : [step];
-}
-
-function markShown(): ChecklistEvent[] {
- const s = readChecklist();
- if (s.shown) return [];
- write({ ...s, shown: true });
- return ["shown"];
-}
-
-function markDismissed(dismissed: boolean): ChecklistEvent[] {
- const s = readChecklist();
- if (s.dismissed === dismissed) return [];
- write({ ...s, dismissed });
- return [dismissed ? "dismissed" : "reopened"];
-}
+/** Usage events waiting for the bridge store. */
+const pending: TelemetrySignal[] = [];
/** Ticks off `step` (once): records it, and `completed` with the last one. */
export function checklistDone(store: BridgeStore | null, step: ChecklistStep): void {
- track(store, markDone(step));
+ if (!store) return;
+ const signals = apply(store.core, { type: "done", step });
+ if (signals.length) void store.telemetry.track(signals);
}
export interface ChecklistHook {
state: ChecklistState;
+ /** Null without the core. */
+ view: ChecklistView | null;
+ send(action: ChecklistAction): void;
done(step: ChecklistStep): void;
shown(): void;
dismiss(): void;
@@ -154,23 +190,26 @@ export function useChecklist(): ChecklistHook {
const ctx = useContext(BridgeContext);
if (!ctx) throw new Error("useChecklist needs a <BridgeProvider> above it");
const state = useSyncExternalStore(subscribeChecklist, readChecklist, readChecklist);
- const { store } = ctx;
+ const { core, store } = ctx;
// Events from before the store exists wait for it (the first `ready`
// promise can be replaced before it resolves).
useEffect(() => {
- if (store && pending.length) track(store, pending.splice(0));
+ if (store && pending.length) void store.telemetry.track(pending.splice(0));
}, [store]);
- const later = (events: ChecklistEvent[]) => {
- if (!events.length) return;
- if (store) track(store, events);
- else pending.push(...events);
+ const send = (action: ChecklistAction) => {
+ const signals = apply(core, action);
+ if (!signals.length) return;
+ if (store) void store.telemetry.track(signals);
+ else pending.push(...signals);
};
return {
state,
- done: (step) => later(markDone(step)),
- shown: () => later(markShown()),
- dismiss: () => later(markDismissed(true)),
- reopen: () => later(markDismissed(false)),
+ view: checklistView(core, state),
+ send,
+ done: (step) => send({ type: "done", step }),
+ shown: () => send({ type: "shown" }),
+ dismiss: () => send({ type: "dismiss" }),
+ reopen: () => send({ type: "reopen" }),
};
}
diff --git a/apps/cua-spaces-web/src/bridge/index.ts b/apps/cua-spaces-web/src/bridge/index.ts
index 84ea552f07..60d6cb6210 100644
--- a/apps/cua-spaces-web/src/bridge/index.ts
+++ b/apps/cua-spaces-web/src/bridge/index.ts
@@ -109,10 +109,11 @@ export { expiresInText, PAIRING_POLL_MS, pairingUnsupported, usePairingCode, typ
export { READY_STARTUP, type StartupAction, type StartupPhase, type StartupState } from "./ops/startup";
export {
CHECKLIST_STEPS,
- checklistComplete,
useChecklist,
type ChecklistHook,
+ type ChecklistRow,
type ChecklistState,
type ChecklistStep,
+ type ChecklistView,
} from "./checklist";
export { formatHours, relayUsageLine, useRelayUsage, RELAY_USAGE_FOCUS_MS, RELAY_USAGE_POLL_MS, type RelayUsage } from "./relay-usage";
diff --git a/apps/cua-spaces-web/src/components/getting-started.tsx b/apps/cua-spaces-web/src/components/getting-started.tsx
index e985c1f980..e51c4f0fe8 100644
--- a/apps/cua-spaces-web/src/components/getting-started.tsx
+++ b/apps/cua-spaces-web/src/components/getting-started.tsx
@@ -3,8 +3,9 @@
/**
* The getting-started checklist on the Spaces page: five first steps,
- * ticked off as they happen (`bridge/checklist.ts` keeps them), closable,
- * and back from the command palette or Help > Getting Started.
+ * ticked off as they happen, closable, and back from the command palette
+ * or Help > Getting Started. Its steps, words and progress are the core's
+ * (`bridge/checklist.ts`); this draws them and runs each step's button.
*/
import { useNavigate } from "@tanstack/react-router";
@@ -12,8 +13,6 @@ import { CheckIcon, XIcon } from "lucide-react";
import { useEffect } from "react";
import {
- CHECKLIST_STEPS,
- checklistComplete,
useAgents,
useBridge,
useChecklist,
@@ -40,14 +39,6 @@ import { cn } from "@/lib/utils";
*/
export const ADD_MACHINE_HREF = "/machines?add=1";
-const COPY: Record<ChecklistStep, { title: string; detail: string; action: string }> = {
- add_machine: { title: "Add a machine", detail: "Connect a Mac, Linux or Windows computer you own.", action: "Add machine" },
- create_space: { title: "Create a Space", detail: "A computer for one task, on one of your machines.", action: "Create" },
- teleport: { title: "Teleport an app", detail: "Move a signed-in app into a Space.", action: "Teleport" },
- share: { title: "Share a Space", detail: "Let a teammate watch or work in it.", action: "Share" },
- run_agent: { title: "Run an agent", detail: "Give an agent a Space to work in.", action: "Open Agents" },
-};
-
/** The first Space whose own page offers `action` now (the core's detail
* actions: Share follows Settings, Experiments; both need it running). */
function spaceFor(spaces: Space[], offers: (space: Space) => boolean | undefined): { space?: Space; offered: boolean } {
@@ -63,16 +54,14 @@ function spaceFor(spaces: Space[], offers: (space: Space) => boolean | undefined
}
export function GettingStarted() {
- const { state, shown, dismiss } = useChecklist();
+ const { view, shown, dismiss } = useChecklist();
const navigate = useNavigate();
const newSpace = useNewSpace();
const { data: spaces = [], isLoading: spacesLoading } = useSpaces();
const { data: session } = useSession();
const teleport = useTeleport();
const share = useShareSheet();
- const visible = !state.dismissed;
- const complete = checklistComplete(state);
- const count = CHECKLIST_STEPS.filter((s) => state.done[s]).length;
+ const visible = view?.visible ?? false;
useEffect(() => {
if (visible) shown();
@@ -100,7 +89,7 @@ export function GettingStarted() {
toast("Start a Space first", { description: `${what} works on a running Space.` });
};
- if (!visible) return null;
+ if (!view || !visible) return null;
const go = (step: ChecklistStep) => {
switch (step) {
@@ -122,64 +111,57 @@ export function GettingStarted() {
<header className="flex items-start gap-3 px-4 pt-3.5 pb-2">
<div className="min-w-0 flex-1">
<h2 id="checklist-title" className="text-[14px] font-semibold">
- {complete ? "You're set up" : "Get started"}
+ {view.title}
</h2>
- <p className="mt-0.5 text-xs text-muted-foreground">
- {complete
- ? "Your team and its agents can now share computers you own."
- : "Shared computers for your team and its agents, on machines you own."}
- </p>
+ <p className="mt-0.5 text-xs text-muted-foreground">{view.detail}</p>
</div>
<span className="mt-0.5 text-xs tabular-nums text-muted-foreground" data-checklist-count="">
- {count} of {CHECKLIST_STEPS.length}
+ {view.progress}
</span>
- <Button variant="ghost" size="icon-sm" aria-label="Close getting started" onClick={() => dismiss()}>
+ <Button variant="ghost" size="icon-sm" aria-label={view.closeLabel} onClick={() => dismiss()}>
<XIcon className="size-3.5 text-muted-foreground" />
</Button>
</header>
<ol className="divide-y border-t">
- {CHECKLIST_STEPS.map((step) => {
- const done = state.done[step] === true;
- const copy = COPY[step];
- return (
- <li key={step} data-checklist-step={step} data-done={done || undefined} className="flex items-center gap-3 px-4 py-2.5">
- <span
- aria-hidden
- className={cn(
- "flex size-5 shrink-0 items-center justify-center rounded-full border",
- done ? "border-brand bg-brand text-white" : "border-foreground/20",
- )}
- >
- {done ? <CheckIcon className="size-3" strokeWidth={3} /> : null}
- </span>
- <div className="min-w-0 flex-1">
- <div className={cn("text-[13px] font-medium", done && "text-muted-foreground line-through decoration-foreground/30")}>
- {copy.title}
- <span className="sr-only">{done ? " (done)" : ""}</span>
- </div>
- <div className="truncate text-xs text-muted-foreground">{copy.detail}</div>
- </div>
- {done ? null : (
- <Button variant="outline" size="sm" onClick={() => go(step)}>
- {copy.action}
- </Button>
+ {view.rows.map(({ step, title, detail, action, done }) => (
+ <li key={step} data-checklist-step={step} data-done={done || undefined} className="flex items-center gap-3 px-4 py-2.5">
+ <span
+ aria-hidden
+ className={cn(
+ "flex size-5 shrink-0 items-center justify-center rounded-full border",
+ done ? "border-brand bg-brand text-white" : "border-foreground/20",
)}
- </li>
- );
- })}
+ >
+ {done ? <CheckIcon className="size-3" strokeWidth={3} /> : null}
+ </span>
+ <div className="min-w-0 flex-1">
+ <div className={cn("text-[13px] font-medium", done && "text-muted-foreground line-through decoration-foreground/30")}>
+ {title}
+ <span className="sr-only">{done ? " (done)" : ""}</span>
+ </div>
+ <div className="truncate text-xs text-muted-foreground">{detail}</div>
+ </div>
+ {done ? null : (
+ <Button variant="outline" size="sm" onClick={() => go(step)}>
+ {action}
+ </Button>
+ )}
+ </li>
+ ))}
</ol>
</section>
);
}
/**
- * Ticks steps off from what the app already shows (another machine, a
- * Space, an agent's run) and answers Help > Getting Started. Teleport and
- * Share tick themselves off where they finish (`bridge/teleport.ts`,
- * `bridge/share.ts`). Mounted once, under the main layout.
+ * Tells the checklist what the app already shows (another machine, a
+ * Space, an agent; the core ticks those steps off) and answers Help >
+ * Getting Started. Teleport and Share tick themselves off where they
+ * finish (`bridge/teleport.ts`, `bridge/share.ts`). Mounted once, under
+ * the main layout.
*/
export function ChecklistTracker() {
- const { state, done, reopen } = useChecklist();
+ const { state, send, reopen } = useChecklist();
const navigate = useNavigate();
const { data: machines } = useMachines();
const { data: spaces } = useSpaces();
@@ -187,11 +169,8 @@ export function ChecklistTracker() {
const otherMachine = machines?.some((m) => !m.current) ?? false;
const hasSpace = spaces ? realSpaces(spaces).some((s) => ["running", "stopped"].includes(spaceState(s))) : false;
useEffect(() => {
- if (otherMachine && !state.done.add_machine) done("add_machine");
- }, [otherMachine, state.done.add_machine, done]);
- useEffect(() => {
- if (hasSpace && !state.done.create_space) done("create_space");
- }, [hasSpace, state.done.create_space, done]);
+ if (otherMachine || hasSpace) send({ type: "observe", otherMachine, hasSpace, agentRan: false });
+ }, [otherMachine, hasSpace, send]);
useEffect(() => {
const onHostEvent = (event: Event) => {
@@ -204,7 +183,7 @@ export function ChecklistTracker() {
}, [reopen, navigate]);
// Agents are only read while this step is open.
- return state.done.run_agent ? null : <AgentProgress onRun={() => done("run_agent")} />;
+ return state.done.run_agent ? null : <AgentProgress onRun={() => send({ type: "observe", otherMachine: false, hasSpace: false, agentRan: true })} />;
}
function AgentProgress({ onRun }: { onRun: () => void }) {
diff --git a/apps/cua-spaces-web/src/components/shell/command-palette.tsx b/apps/cua-spaces-web/src/components/shell/command-palette.tsx
index ad18ca936e..274b5eac0c 100644
--- a/apps/cua-spaces-web/src/components/shell/command-palette.tsx
+++ b/apps/cua-spaces-web/src/components/shell/command-palette.tsx
@@ -19,7 +19,7 @@ import {
} from "lucide-react";
import { useState, type KeyboardEvent } from "react";
-import { useChecklist, useKeyvault, useSession, useSpaces } from "@/bridge";
+import { useBridge, useChecklist, useKeyvault, useSession, useSpaces } from "@/bridge";
import { OsIcon } from "@/components/os-icon";
import { Dialog, DialogPopup, DialogTitle } from "@/components/ui/dialog";
import { Kbd, Shortcut } from "@/components/ui/kbd";
@@ -60,6 +60,7 @@ function PaletteBody({ onClose }: { onClose: () => void }) {
const { preference, resolved, setPreference } = useTheme();
const toggleSidebar = useUiStore((s) => s.toggleSidebar);
const checklist = useChecklist();
+ const { core } = useBridge();
const [query, setQuery] = useState("");
const [active, setActive] = useState(0);
@@ -157,7 +158,7 @@ function PaletteBody({ onClose }: { onClose: () => void }) {
}),
];
- const results = filterCommands(commands, query);
+ const results = filterCommands(commands, query, core);
const current = Math.min(active, Math.max(0, results.length - 1));
const runAt = (i: number) => {
diff --git a/apps/cua-spaces-web/src/lib/commands.test.ts b/apps/cua-spaces-web/src/lib/commands.test.ts
index cc4c44f688..75cb2bed2e 100644
--- a/apps/cua-spaces-web/src/lib/commands.test.ts
+++ b/apps/cua-spaces-web/src/lib/commands.test.ts
@@ -3,7 +3,8 @@
import { describe, expect, it } from "vitest";
-import { filterCommands, fuzzyScore } from "./commands";
+import { noCore, testCore, wasmBuilt } from "@/bridge/__tests__/testCore";
+import { filterCommands } from "./commands";
const cmds = [
{ group: "Go to", label: "Spaces", keywords: "" },
@@ -13,32 +14,33 @@ const cmds = [
{ group: "Keyvault", label: "Lock Keyvault", keywords: "secure" },
];
-describe("fuzzyScore", () => {
- it("matches characters in order and prefers word starts and runs", () => {
- expect(fuzzyScore("Lock Keyvault", "lkv")).toBeGreaterThan(0);
- expect(fuzzyScore("Lock Keyvault", "vkl")).toBe(0);
- expect(fuzzyScore("Spaces", "spa")).toBeGreaterThan(fuzzyScore("Settings and spare", "spa"));
- expect(fuzzyScore("Keyvault", "key")).toBeGreaterThan(fuzzyScore("Keyvault", "kvt"));
- });
-});
-
-describe("filterCommands", () => {
- it("matches every word across label, hint and keywords", () => {
- expect(filterCommands(cmds, "tahoe running").map((c) => c.label)).toEqual(["Open QA on Tahoe", "Stop QA on Tahoe"]);
- expect(filterCommands(cmds, "THEME").map((c) => c.label)).toEqual(["Switch to dark appearance"]);
- expect(filterCommands(cmds, " ")).toHaveLength(cmds.length);
+describe.skipIf(!wasmBuilt)("filterCommands (the core's ranking)", () => {
+ it("matches every word across label, hint and keywords", async () => {
+ const core = await testCore();
+ expect(filterCommands(cmds, "tahoe running", core).map((c) => c.label)).toEqual(["Open QA on Tahoe", "Stop QA on Tahoe"]);
+ expect(filterCommands(cmds, "THEME", core).map((c) => c.label)).toEqual(["Switch to dark appearance"]);
+ expect(filterCommands(cmds, " ", core)).toHaveLength(cmds.length);
});
- it("matches loosely and ranks the best match first", () => {
- expect(filterCommands(cmds, "stp tah").map((c) => c.label)).toEqual(["Stop QA on Tahoe"]);
- expect(filterCommands(cmds, "lock kv")[0]?.label).toBe("Lock Keyvault");
- expect(filterCommands(cmds, "spa")[0]?.label).toBe("Spaces");
+ it("matches loosely and ranks the best match first", async () => {
+ const core = await testCore();
+ expect(filterCommands(cmds, "stp tah", core).map((c) => c.label)).toEqual(["Stop QA on Tahoe"]);
+ expect(filterCommands(cmds, "lock kv", core)[0]?.label).toBe("Lock Keyvault");
+ expect(filterCommands(cmds, "spa", core)[0]?.label).toBe("Spaces");
});
- it("keeps groups together", () => {
- const groups = filterCommands(cmds, "a").map((c) => c.group);
+ it("keeps groups together", async () => {
+ const core = await testCore();
+ const groups = filterCommands(cmds, "a", core).map((c) => c.group);
const seen: string[] = [];
for (const g of groups) if (seen.at(-1) !== g) seen.push(g);
expect(new Set(seen).size).toBe(seen.length);
});
});
+
+describe("filterCommands without the core", () => {
+ it("keeps the commands that contain every word, in order", () => {
+ expect(filterCommands(cmds, "tahoe stop", noCore).map((c) => c.label)).toEqual(["Stop QA on Tahoe"]);
+ expect(filterCommands(cmds, "", noCore)).toHaveLength(cmds.length);
+ });
+});
diff --git a/apps/cua-spaces-web/src/lib/commands.ts b/apps/cua-spaces-web/src/lib/commands.ts
index db90dbe7ea..3284feecc5 100644
--- a/apps/cua-spaces-web/src/lib/commands.ts
+++ b/apps/cua-spaces-web/src/lib/commands.ts
@@ -1,6 +1,8 @@
// SPDX-License-Identifier: FSL-1.1-MIT
// Copyright (c) 2026 Cua AI, Inc.
+import type { CoreClient } from "@/bridge";
+
export interface PaletteCommand {
id: string;
group: string;
@@ -11,73 +13,26 @@ export interface PaletteCommand {
run: () => void;
}
-/**
- * How well `query` fuzzy-matches `text`: its characters must appear in order.
- * Matches at the start of a word and runs of consecutive characters score
- * higher, gaps score lower. Returns 0 for no match.
- */
-export function fuzzyScore(text: string, query: string): number {
- const t = text.toLowerCase();
- const q = query.toLowerCase();
- if (!q) return 1;
- let score = 0;
- let from = 0;
- let prev = -2;
- for (const ch of q) {
- const at = t.indexOf(ch, from);
- if (at < 0) return 0;
- const wordStart = at === 0 || /[\s\-_/.:]/.test(t[at - 1]!);
- score += 1;
- if (at === prev + 1) score += 4;
- if (wordStart) score += 6;
- score -= Math.min(3, (at - from) * 0.1);
- prev = at;
- from = at + 1;
- }
- if (t.startsWith(q)) score += 10;
- return Math.max(score, 0.01);
-}
+type Rankable = Pick<PaletteCommand, "label" | "hint" | "keywords"> & { group?: string };
-/** The best score for one query word across label, hint and keywords (label counts most). */
-function wordScore(c: Pick<PaletteCommand, "label" | "hint" | "keywords">, word: string): number {
- return Math.max(fuzzyScore(c.label, word) * 1.5, fuzzyScore(c.hint ?? "", word), fuzzyScore(c.keywords ?? "", word));
+/** Without the core: every word somewhere in label, hint or keywords, in order. */
+function plainFilter<T extends Rankable>(commands: readonly T[], words: string[]): T[] {
+ return commands.filter((c) => {
+ const text = `${c.label} ${c.hint ?? ""} ${c.keywords ?? ""}`.toLowerCase();
+ return words.every((w) => text.includes(w));
+ });
}
/**
- * Commands whose label, hint or keywords fuzzy-match every word of the query,
- * best first. Groups stay together, ordered by their best match. An empty
- * query returns every command in its original order.
+ * Commands whose label, hint or keywords fuzzy-match every word of the
+ * query, best first, with groups kept together: the core's ranking
+ * (`palette.rank`), the same as the SwiftUI app's palette. An empty query
+ * returns every command in its original order.
*/
-export function filterCommands<T extends Pick<PaletteCommand, "label" | "hint" | "keywords"> & { group?: string }>(
- commands: readonly T[],
- query: string,
-): T[] {
+export function filterCommands<T extends Rankable>(commands: readonly T[], query: string, core?: CoreClient): T[] {
const words = query.toLowerCase().split(/\s+/).filter(Boolean);
if (words.length === 0) return [...commands];
- const scored: { c: T; score: number; index: number }[] = [];
- commands.forEach((c, index) => {
- let score = 0;
- for (const w of words) {
- const s = wordScore(c, w);
- if (s === 0) return;
- score += s;
- }
- scored.push({ c, score, index });
- });
- const groupBest = new Map<string | undefined, number>();
- for (const s of scored) groupBest.set(s.c.group, Math.max(groupBest.get(s.c.group) ?? 0, s.score));
- return scored
- .toSorted(
- (a, b) =>
- groupBest.get(b.c.group)! - groupBest.get(a.c.group)! ||
- // Ties between groups keep the first group's place.
- (a.c.group === b.c.group ? 0 : firstIndex(scored, a.c.group) - firstIndex(scored, b.c.group)) ||
- b.score - a.score ||
- a.index - b.index,
- )
- .map((s) => s.c);
-}
-
-function firstIndex<T extends { group?: string }>(scored: readonly { c: T; index: number }[], group: string | undefined): number {
- return scored.find((s) => s.c.group === group)!.index;
+ const entries = commands.map((c) => ({ group: c.group ?? "", label: c.label, hint: c.hint, keywords: c.keywords }));
+ const order = core?.tryCall<number[]>("palette.rank", { entries, query });
+ return order ? order.map((i) => commands[i]!) : plainFilter(commands, words);
}
diff --git a/docs/content/docs/cua-sdk/reference/index.mdx b/docs/content/docs/cua-sdk/reference/index.mdx
index 61cd888ae8..b5f34620a4 100644
--- a/docs/content/docs/cua-sdk/reference/index.mdx
+++ b/docs/content/docs/cua-sdk/reference/index.mdx
@@ -105,6 +105,7 @@ Pages marked *Cua Spaces app export* document the APIs the Cua Spaces apps are b
| [Devices](/cua-sdk/reference/spaces/app-core/devices) | Settings &gt; Devices: this device's enrollment, the account's devices, Recent Access, and the enroll and approval sheets. *Cua Spaces app export.* |
| [Settings, Agents](/cua-sdk/reference/spaces/app-core/agent-keys) | Settings &gt; Agents: the coding agents' rows, the provider keys saved in the keychain, and the add or replace sheet. *Cua Spaces app export.* |
| [Share sheet](/cua-sdk/reference/spaces/app-core/share) | The Share sheet: who a Space is shared with (viewer or editor) and the share request to run. *Cua Spaces app export.* |
+| [Getting started and the command palette](/cua-sdk/reference/spaces/app-checklist-palette) | The getting-started checklist, the command palette's ranking and the shared keyboard shortcuts. *Cua Spaces app export.* |
| [Usage telemetry](/cua-sdk/reference/spaces/app-core/telemetry) | Which anonymous usage events a Spaces app step means, and sending them. *Cua Spaces app export.* |
| [Devices](/cua-sdk/reference/spaces/devices) | This device as a client of the account on the relay: enroll, approve, rename, revoke and the audit log. |
| [Host and relay](/cua-sdk/reference/spaces/host) | Unattended host setup and the cua-relay directory client. |
@@ -140,4 +141,4 @@ Pages marked *Cua Spaces app export* document the APIs the Cua Spaces apps are b
291 items, 385 methods. The [Types](/cua-sdk/reference/types) page lists them.
-The Cua Spaces app export adds 738 items and 38 methods.
+The Cua Spaces app export adds 750 items and 38 methods.
diff --git a/docs/content/docs/cua-sdk/reference/spaces/app-checklist-palette.mdx b/docs/content/docs/cua-sdk/reference/spaces/app-checklist-palette.mdx
new file mode 100644
index 0000000000..9e33957f2e
--- /dev/null
+++ b/docs/content/docs/cua-sdk/reference/spaces/app-checklist-palette.mdx
@@ -0,0 +1,256 @@
+---
+title: "Getting started and the command palette"
+description: "The getting-started checklist, the command palette's ranking and the shared keyboard shortcuts."
+---
+
+{/*
+ AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
+ Generated by: pnpm --dir docs docs:generate:cua-sdk
+ Source: cua-bindgen docs --namespace cua_spaces_ffi (UniFFI metadata of libcua_spaces_ffi)
+ Version: 0.4.1
+*/}
+
+import { Callout } from 'fumadocs-ui/components/callout';
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+<Callout title="Cua Spaces app export">
+These APIs are part of the Cua Spaces app export for building Spaces UIs. They are source-available under FSL-1.1-MIT and ship for Swift only (`import CuaSpacesFFI`); the Rust tab shows the `cua-spaces-ffi` crate they come from. The open source SDK packages for Python, TypeScript and Kotlin do not include them.
+</Callout>
+
+App core functions beside the [Spaces app core](/cua-sdk/reference/spaces/app-core) screens. `app_checklist_reduce` applies a checklist action (a step done, shown, closed, opened again, or what the app shows now) and returns the new `AppChecklistState` with the usage events it means; `app_checklist_view` derives the rows, title and progress. `app_palette_rank` orders the command palette's entries for a query, and `app_keybindings` lists the default keyboard shortcuts the apps share.
+
+## `AppChecklistRow` record
+
+| Field | Type | Default | Description |
+| --- | --- | --- | --- |
+| `step` | [`AppChecklistStep`](#appcheckliststep-enum) | | The step. |
+| `title` | `String` | | "Add a machine". |
+| `detail` | `String` | | One line under the title. |
+| `action` | `String` | | The button that does it; hidden once done. |
+| `done` | `bool` | | Done (ticked, struck through). |
+
+## `AppChecklistState` record
+
+| Field | Type | Default | Description |
+| --- | --- | --- | --- |
+| `done` | [`Vec<AppChecklistStep>`](#appcheckliststep-enum) | | Steps done, each once, in checklist order. |
+| `dismissed` | `bool` | | Closed with ×; Getting Started opens it again. |
+| `shown` | `bool` | | It was on screen once (`checklist_shown` was recorded). |
+
+## `AppChecklistTransition` record
+
+Returned by [`app_checklist_reduce`](#app_checklist_reduce).
+
+| Field | Type | Default | Description |
+| --- | --- | --- | --- |
+| `state` | [`AppChecklistState`](#appcheckliststate-record) | | The new state (save it when it changed). |
+| `signals` | [`Vec<AppTelemetrySignal>`](/cua-sdk/reference/spaces/app-core/telemetry#apptelemetrysignal-enum) | | `cua_onboarding_step` events to record (`checklist_<event>`). |
+
+## `AppChecklistView` record
+
+Returned by [`app_checklist_view`](#app_checklist_view).
+
+| Field | Type | Default | Description |
+| --- | --- | --- | --- |
+| `visible` | `bool` | | On screen (not closed). |
+| `complete` | `bool` | | Every step done. |
+| `title` | `String` | | "Get started", or "You're set up" when complete. |
+| `detail` | `String` | | The line under the title. |
+| `progress` | `String` | | "2 of 5". |
+| `close_label` / `closeLabel` | `String` | | The close button's accessibility label. |
+| `rows` | [`Vec<AppChecklistRow>`](#appchecklistrow-record) | | The steps in order. |
+
+## `AppKeybinding` record
+
+Returned by [`app_keybindings`](#app_keybindings).
+
+| Field | Type | Default | Description |
+| --- | --- | --- | --- |
+| `command` | `String` | | `commandPalette.toggle`, `nav.spaces`, ... |
+| `key` | `String` | | `mod+k`, `mod+shift+l`: `mod` is ⌘ on macOS and Ctrl elsewhere. |
+
+## `AppPaletteEntry` record
+
+| Field | Type | Default | Description |
+| --- | --- | --- | --- |
+| `group` | `String` | | "Actions", "Go to", "Spaces". |
+| `label` | `String` | | "New Space". |
+| `hint` | `Option<String>` | | Secondary text ("Linux"). |
+| `keywords` | `Option<String>` | | Extra words it answers to ("create add"). |
+
+## `AppChecklistAction` enum
+
+<Tabs items={['Swift', 'Rust']} groupId="sdk-lang" persist>
+<Tab value="Swift">
+
+```swift
+.done(step: AppChecklistStep)
+.shown
+.dismiss
+.reopen
+.observe(otherMachine: Bool, hasSpace: Bool, agentRan: Bool)
+```
+
+</Tab>
+<Tab value="Rust">
+
+```rust
+AppChecklistAction::Done { step: AppChecklistStep }
+AppChecklistAction::Shown
+AppChecklistAction::Dismiss
+AppChecklistAction::Reopen
+AppChecklistAction::Observe { other_machine: bool, has_space: bool, agent_ran: bool }
+```
+
+</Tab>
+</Tabs>
+
+| Variant | Description |
+| --- | --- |
+| `Done` | A step finished (a teleport ran, a Space was shared). Fields: `step: AppChecklistStep` |
+| `Shown` | The checklist is on screen. |
+| `Dismiss` | Closed with ×. |
+| `Reopen` | Getting Started (the palette, the Help menu): open it again. |
+| `Observe` | What the app shows now: each `true` ticks its step off. Fields: `other_machine: bool`, `has_space: bool`, `agent_ran: bool` |
+
+## `AppChecklistStep` enum
+
+<Tabs items={['Swift', 'Rust']} groupId="sdk-lang" persist>
+<Tab value="Swift">
+
+```swift
+.addMachine
+.createSpace
+.teleport
+.share
+.runAgent
+```
+
+</Tab>
+<Tab value="Rust">
+
+```rust
+AppChecklistStep::AddMachine
+AppChecklistStep::CreateSpace
+AppChecklistStep::Teleport
+AppChecklistStep::Share
+AppChecklistStep::RunAgent
+```
+
+</Tab>
+</Tabs>
+
+| Variant | Description |
+| --- | --- |
+| `AddMachine` | Connect another computer you own. |
+| `CreateSpace` | Create a Space. |
+| `Teleport` | Teleport an app into a Space. |
+| `Share` | Share a Space with someone. |
+| `RunAgent` | Run an agent. |
+
+## `app_checklist_reduce`
+
+The getting-started checklist after `action`, and its usage events.
+
+<Tabs items={['Swift', 'Rust']} groupId="sdk-lang" persist>
+<Tab value="Swift">
+
+```swift
+func appChecklistReduce(state: AppChecklistState, action: AppChecklistAction) -> AppChecklistTransition
+```
+
+</Tab>
+<Tab value="Rust">
+
+```rust
+pub fn app_checklist_reduce(state: AppChecklistState, action: AppChecklistAction) -> AppChecklistTransition
+```
+
+</Tab>
+</Tabs>
+
+| Parameter | Type | Default |
+| --- | --- | --- |
+| `state` | [`AppChecklistState`](#appcheckliststate-record) | required |
+| `action` | [`AppChecklistAction`](#appchecklistaction-enum) | required |
+
+**Returns** [`AppChecklistTransition`](#appchecklisttransition-record)
+
+## `app_checklist_view`
+
+The getting-started checklist as drawn.
+
+<Tabs items={['Swift', 'Rust']} groupId="sdk-lang" persist>
+<Tab value="Swift">
+
+```swift
+func appChecklistView(state: AppChecklistState) -> AppChecklistView
+```
+
+</Tab>
+<Tab value="Rust">
+
+```rust
+pub fn app_checklist_view(state: AppChecklistState) -> AppChecklistView
+```
+
+</Tab>
+</Tabs>
+
+| Parameter | Type | Default |
+| --- | --- | --- |
+| `state` | [`AppChecklistState`](#appcheckliststate-record) | required |
+
+**Returns** [`AppChecklistView`](#appchecklistview-record)
+
+## `app_keybindings`
+
+The default keyboard shortcuts (the shared UI's `keybindings.json`).
+
+<Tabs items={['Swift', 'Rust']} groupId="sdk-lang" persist>
+<Tab value="Swift">
+
+```swift
+func appKeybindings() -> [AppKeybinding]
+```
+
+</Tab>
+<Tab value="Rust">
+
+```rust
+pub fn app_keybindings() -> Vec<AppKeybinding>
+```
+
+</Tab>
+</Tabs>
+
+**Returns** [`Vec<AppKeybinding>`](#appkeybinding-record)
+
+## `app_palette_rank`
+
+The command palette's matches for `query`, best first, as indices into
+`entries`.
+
+<Tabs items={['Swift', 'Rust']} groupId="sdk-lang" persist>
+<Tab value="Swift">
+
+```swift
+func appPaletteRank(entries: [AppPaletteEntry], query: String) -> [UInt32]
+```
+
+</Tab>
+<Tab value="Rust">
+
+```rust
+pub fn app_palette_rank(entries: Vec<AppPaletteEntry>, query: String) -> Vec<u32>
+```
+
+</Tab>
+</Tabs>
+
+| Parameter | Type | Default |
+| --- | --- | --- |
+| `entries` | [`Vec<AppPaletteEntry>`](#apppaletteentry-record) | required |
+| `query` | `String` | required |
+
+**Returns** `Vec<u32>`
diff --git a/docs/content/docs/cua-sdk/reference/spaces/meta.json b/docs/content/docs/cua-sdk/reference/spaces/meta.json
index 059c7ed09b..2952572ca8 100644
--- a/docs/content/docs/cua-sdk/reference/spaces/meta.json
+++ b/docs/content/docs/cua-sdk/reference/spaces/meta.json
@@ -17,6 +17,7 @@
"app-core",
"volume-app-core",
"agents-app-core",
+ "app-checklist-palette",
"devices",
"host"
]
diff --git a/docs/content/docs/cua-sdk/reference/types.mdx b/docs/content/docs/cua-sdk/reference/types.mdx
index 5fcb491627..0da3f36090 100644
--- a/docs/content/docs/cua-sdk/reference/types.mdx
+++ b/docs/content/docs/cua-sdk/reference/types.mdx
@@ -50,7 +50,7 @@ Renamed members: in Kotlin, objects implement `AutoCloseable`, whose `close()` f
292 items. Methods are listed on their object.
-The 738 items of the Cua Spaces app export (source-available, FSL-1.1-MIT, Swift only) are listed on their pages: [Decoded media](/cua-sdk/reference/spaces/decoded-media), [Host teleport](/cua-sdk/reference/spaces/teleport-host), [Teleport an app](/cua-sdk/reference/spaces/teleport-apps), [Spaces app core](/cua-sdk/reference/spaces/app-core#all-items), [App core: Cua Volume storage, mount and sync](/cua-sdk/reference/spaces/volume-app-core#all-items), [App core: agents, drive, notifications](/cua-sdk/reference/spaces/agents-app-core#all-items).
+The 750 items of the Cua Spaces app export (source-available, FSL-1.1-MIT, Swift only) are listed on their pages: [Decoded media](/cua-sdk/reference/spaces/decoded-media), [Host teleport](/cua-sdk/reference/spaces/teleport-host), [Teleport an app](/cua-sdk/reference/spaces/teleport-apps), [Spaces app core](/cua-sdk/reference/spaces/app-core#all-items), [App core: Cua Volume storage, mount and sync](/cua-sdk/reference/spaces/volume-app-core#all-items), [App core: agents, drive, notifications](/cua-sdk/reference/spaces/agents-app-core#all-items), [Getting started and the command palette](/cua-sdk/reference/spaces/app-checklist-palette).
| Item | Kind | Summary |
| --- | --- | --- |
diff --git a/libs/cua/crates/cua-spaces-app-core/src/checklist.rs b/libs/cua/crates/cua-spaces-app-core/src/checklist.rs
new file mode 100644
index 0000000000..809582a0ca
--- /dev/null
+++ b/libs/cua/crates/cua-spaces-app-core/src/checklist.rs
@@ -0,0 +1,470 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+//! The getting-started checklist: the first five things worth doing in Cua
+//! Spaces, ticked off as they happen, closable, and opened again from the
+//! command palette or Help, Getting Started.
+//!
+//! The shell keeps the [`ChecklistState`] (the React UI in the page's
+//! storage, the SwiftUI app in its support folder), sends a
+//! [`ChecklistAction`] for each thing that happens and records the usage
+//! events the [`ChecklistTransition`] carries. [`ChecklistAction::Observe`]
+//! ticks steps off from what the app already shows (another machine, a
+//! Space, an agent); Teleport and Share tick themselves off where they
+//! finish.
+
+use serde::{Deserialize, Serialize};
+
+use crate::telemetry::{self, TelemetrySignal};
+
+/// One step, in the order the checklist lists them
+/// ([`telemetry::CHECKLIST_STEPS`]).
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
+#[serde(rename_all = "snake_case")]
+pub enum ChecklistStep {
+ /// Connect another computer you own.
+ AddMachine,
+ /// Create a Space.
+ CreateSpace,
+ /// Teleport an app into a Space.
+ Teleport,
+ /// Share a Space with someone.
+ Share,
+ /// Run an agent.
+ RunAgent,
+}
+
+/// Every step, in order.
+pub const STEPS: [ChecklistStep; 5] = [
+ ChecklistStep::AddMachine,
+ ChecklistStep::CreateSpace,
+ ChecklistStep::Teleport,
+ ChecklistStep::Share,
+ ChecklistStep::RunAgent,
+];
+
+impl ChecklistStep {
+ /// The step's word (`add_machine`), as stored and as its usage event says.
+ pub fn word(self) -> &'static str {
+ match self {
+ ChecklistStep::AddMachine => "add_machine",
+ ChecklistStep::CreateSpace => "create_space",
+ ChecklistStep::Teleport => "teleport",
+ ChecklistStep::Share => "share",
+ ChecklistStep::RunAgent => "run_agent",
+ }
+ }
+
+ fn copy(self) -> (&'static str, &'static str, &'static str) {
+ match self {
+ ChecklistStep::AddMachine => (
+ "Add a machine",
+ "Connect a Mac, Linux or Windows computer you own.",
+ "Add machine",
+ ),
+ ChecklistStep::CreateSpace => (
+ "Create a Space",
+ "A computer for one task, on one of your machines.",
+ "Create",
+ ),
+ ChecklistStep::Teleport => (
+ "Teleport an app",
+ "Move a signed-in app into a Space.",
+ "Teleport",
+ ),
+ ChecklistStep::Share => (
+ "Share a Space",
+ "Let a teammate watch or work in it.",
+ "Share",
+ ),
+ ChecklistStep::RunAgent => (
+ "Run an agent",
+ "Give an agent a Space to work in.",
+ "Open Agents",
+ ),
+ }
+ }
+}
+
+/// What the checklist remembers between launches.
+#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ChecklistState {
+ /// Steps done, each once, in checklist order.
+ #[serde(default)]
+ pub done: Vec<ChecklistStep>,
+ /// Closed with ×; Getting Started opens it again.
+ #[serde(default)]
+ pub dismissed: bool,
+ /// It was on screen once (`checklist_shown` was recorded).
+ #[serde(default)]
+ pub shown: bool,
+}
+
+/// Something that happened to the checklist.
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(
+ tag = "type",
+ rename_all = "kebab-case",
+ rename_all_fields = "camelCase"
+)]
+pub enum ChecklistAction {
+ /// A step finished (a teleport ran, a Space was shared).
+ Done {
+ /// The step.
+ step: ChecklistStep,
+ },
+ /// The checklist is on screen.
+ Shown,
+ /// Closed with ×.
+ Dismiss,
+ /// Getting Started (the palette, the Help menu): open it again.
+ Reopen,
+ /// What the app shows now: each `true` ticks its step off.
+ Observe {
+ /// One of your machines other than this one is listed.
+ other_machine: bool,
+ /// A Space of yours exists (running or stopped).
+ has_space: bool,
+ /// An agent exists or has run.
+ agent_ran: bool,
+ },
+}
+
+/// The state after an action and the usage events it means.
+#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ChecklistTransition {
+ /// The new state (save it when it changed).
+ pub state: ChecklistState,
+ /// `cua_onboarding_step` events to record (`checklist_<event>`).
+ pub signals: Vec<TelemetrySignal>,
+}
+
+/// One row of the checklist.
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ChecklistRow {
+ /// The step.
+ pub step: ChecklistStep,
+ /// "Add a machine".
+ pub title: String,
+ /// One line under the title.
+ pub detail: String,
+ /// The button that does it; hidden once done.
+ pub action: String,
+ /// Done (ticked, struck through).
+ pub done: bool,
+}
+
+/// The checklist as drawn.
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ChecklistView {
+ /// On screen (not closed).
+ pub visible: bool,
+ /// Every step done.
+ pub complete: bool,
+ /// "Get started", or "You're set up" when complete.
+ pub title: String,
+ /// The line under the title.
+ pub detail: String,
+ /// "2 of 5".
+ pub progress: String,
+ /// The close button's accessibility label.
+ pub close_label: String,
+ /// The steps in order.
+ pub rows: Vec<ChecklistRow>,
+}
+
+fn is_done(state: &ChecklistState, step: ChecklistStep) -> bool {
+ state.done.contains(&step)
+}
+
+/// Every step done.
+pub fn complete(state: &ChecklistState) -> bool {
+ STEPS.iter().all(|s| is_done(state, *s))
+}
+
+fn signals(events: &[&str]) -> Vec<TelemetrySignal> {
+ events
+ .iter()
+ .flat_map(|e| telemetry::checklist(e))
+ .collect()
+}
+
+/// Ticks `steps` off (each once, kept in checklist order) and answers the
+/// events: each new step, then `completed` with the last one.
+fn tick(state: &ChecklistState, steps: &[ChecklistStep]) -> ChecklistTransition {
+ let new: Vec<ChecklistStep> = STEPS
+ .iter()
+ .copied()
+ .filter(|s| steps.contains(s) && !is_done(state, *s))
+ .collect();
+ if new.is_empty() {
+ return ChecklistTransition {
+ state: state.clone(),
+ signals: vec![],
+ };
+ }
+ let mut next = state.clone();
+ next.done = STEPS
+ .iter()
+ .copied()
+ .filter(|s| is_done(state, *s) || new.contains(s))
+ .collect();
+ let mut events: Vec<&str> = new.iter().map(|s| s.word()).collect();
+ if complete(&next) {
+ events.push("completed");
+ }
+ ChecklistTransition {
+ signals: signals(&events),
+ state: next,
+ }
+}
+
+/// The checklist after `action`, and the usage events it means.
+pub fn reduce(state: &ChecklistState, action: &ChecklistAction) -> ChecklistTransition {
+ let same = || ChecklistTransition {
+ state: state.clone(),
+ signals: vec![],
+ };
+ match action {
+ ChecklistAction::Done { step } => tick(state, &[*step]),
+ ChecklistAction::Observe {
+ other_machine,
+ has_space,
+ agent_ran,
+ } => {
+ let seen: Vec<ChecklistStep> = [
+ (*other_machine, ChecklistStep::AddMachine),
+ (*has_space, ChecklistStep::CreateSpace),
+ (*agent_ran, ChecklistStep::RunAgent),
+ ]
+ .into_iter()
+ .filter_map(|(on, s)| on.then_some(s))
+ .collect();
+ tick(state, &seen)
+ }
+ ChecklistAction::Shown if !state.shown => ChecklistTransition {
+ state: ChecklistState {
+ shown: true,
+ ..state.clone()
+ },
+ signals: signals(&["shown"]),
+ },
+ ChecklistAction::Dismiss | ChecklistAction::Reopen => {
+ let dismissed = matches!(action, ChecklistAction::Dismiss);
+ if state.dismissed == dismissed {
+ return same();
+ }
+ ChecklistTransition {
+ state: ChecklistState {
+ dismissed,
+ ..state.clone()
+ },
+ signals: signals(&[if dismissed { "dismissed" } else { "reopened" }]),
+ }
+ }
+ ChecklistAction::Shown => same(),
+ }
+}
+
+/// The checklist as drawn.
+pub fn view(state: &ChecklistState) -> ChecklistView {
+ let complete = complete(state);
+ let count = STEPS.iter().filter(|s| is_done(state, **s)).count();
+ ChecklistView {
+ visible: !state.dismissed,
+ complete,
+ title: if complete {
+ "You're set up"
+ } else {
+ "Get started"
+ }
+ .into(),
+ detail: if complete {
+ "Your team and its agents can now share computers you own."
+ } else {
+ "Shared computers for your team and its agents, on machines you own."
+ }
+ .into(),
+ progress: format!("{count} of {}", STEPS.len()),
+ close_label: "Close getting started".into(),
+ rows: STEPS
+ .iter()
+ .map(|&step| {
+ let (title, detail, action) = step.copy();
+ ChecklistRow {
+ step,
+ title: title.into(),
+ detail: detail.into(),
+ action: action.into(),
+ done: is_done(state, step),
+ }
+ })
+ .collect(),
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ fn events(t: &ChecklistTransition) -> Vec<String> {
+ t.signals
+ .iter()
+ .map(|s| match s {
+ TelemetrySignal::Step { step, ok: true } => step.clone(),
+ other => panic!("unexpected {other:?}"),
+ })
+ .collect()
+ }
+
+ #[test]
+ fn steps_match_the_usage_vocabulary() {
+ let words: Vec<&str> = STEPS.iter().map(|s| s.word()).collect();
+ assert_eq!(words, telemetry::CHECKLIST_STEPS);
+ for s in STEPS {
+ assert_eq!(serde_json::to_value(s).unwrap(), s.word());
+ }
+ }
+
+ #[test]
+ fn each_step_counts_once_and_the_last_completes_it() {
+ let mut state = ChecklistState::default();
+ let mut seen = vec![];
+ for step in STEPS.iter().rev() {
+ for _ in 0..2 {
+ let t = reduce(&state, &ChecklistAction::Done { step: *step });
+ seen.extend(events(&t));
+ state = t.state;
+ }
+ }
+ assert_eq!(
+ seen,
+ [
+ "checklist_run_agent",
+ "checklist_share",
+ "checklist_teleport",
+ "checklist_create_space",
+ "checklist_add_machine",
+ "checklist_completed",
+ ]
+ );
+ assert_eq!(state.done, STEPS, "kept in checklist order");
+ let v = view(&state);
+ assert!(v.complete);
+ assert_eq!(v.title, "You're set up");
+ assert_eq!(v.progress, "5 of 5");
+ }
+
+ #[test]
+ fn observing_ticks_off_what_the_app_shows() {
+ let t = reduce(
+ &ChecklistState::default(),
+ &ChecklistAction::Observe {
+ other_machine: true,
+ has_space: true,
+ agent_ran: false,
+ },
+ );
+ assert_eq!(
+ events(&t),
+ ["checklist_add_machine", "checklist_create_space"]
+ );
+ let again = reduce(
+ &t.state,
+ &ChecklistAction::Observe {
+ other_machine: true,
+ has_space: false,
+ agent_ran: false,
+ },
+ );
+ assert!(again.signals.is_empty());
+ assert_eq!(again.state, t.state, "nothing is unticked");
+ assert_eq!(view(&again.state).progress, "2 of 5");
+ }
+
+ #[test]
+ fn shown_once_and_closing_and_reopening() {
+ let s = ChecklistState::default();
+ let shown = reduce(&s, &ChecklistAction::Shown);
+ assert_eq!(events(&shown), ["checklist_shown"]);
+ assert!(
+ reduce(&shown.state, &ChecklistAction::Shown)
+ .signals
+ .is_empty()
+ );
+
+ let closed = reduce(&shown.state, &ChecklistAction::Dismiss);
+ assert_eq!(events(&closed), ["checklist_dismissed"]);
+ assert!(!view(&closed.state).visible);
+ assert!(
+ reduce(&closed.state, &ChecklistAction::Dismiss)
+ .signals
+ .is_empty()
+ );
+
+ let open = reduce(&closed.state, &ChecklistAction::Reopen);
+ assert_eq!(events(&open), ["checklist_reopened"]);
+ assert!(view(&open.state).visible);
+ assert!(
+ reduce(&open.state, &ChecklistAction::Reopen)
+ .signals
+ .is_empty()
+ );
+ }
+
+ #[test]
+ fn the_view_lists_every_step_with_its_button() {
+ let s = ChecklistState {
+ done: vec![ChecklistStep::Teleport],
+ ..Default::default()
+ };
+ let v = view(&s);
+ assert_eq!(v.title, "Get started");
+ assert_eq!(v.progress, "1 of 5");
+ let rows: Vec<(&str, &str, bool)> = v
+ .rows
+ .iter()
+ .map(|r| (r.title.as_str(), r.action.as_str(), r.done))
+ .collect();
+ assert_eq!(
+ rows,
+ [
+ ("Add a machine", "Add machine", false),
+ ("Create a Space", "Create", false),
+ ("Teleport an app", "Teleport", true),
+ ("Share a Space", "Share", false),
+ ("Run an agent", "Open Agents", false),
+ ]
+ );
+ }
+
+ #[test]
+ fn reads_the_stored_shape() {
+ let s: ChecklistState =
+ serde_json::from_str(r#"{"done":["share","add_machine"],"dismissed":true}"#).unwrap();
+ assert_eq!(
+ s,
+ ChecklistState {
+ done: vec![ChecklistStep::Share, ChecklistStep::AddMachine],
+ dismissed: true,
+ shown: false
+ }
+ );
+ let a: ChecklistAction = serde_json::from_str(
+ r#"{"type":"observe","otherMachine":false,"hasSpace":true,"agentRan":false}"#,
+ )
+ .unwrap();
+ assert_eq!(
+ a,
+ ChecklistAction::Observe {
+ other_machine: false,
+ has_space: true,
+ agent_ran: false
+ }
+ );
+ }
+}
diff --git a/libs/cua/crates/cua-spaces-app-core/src/dispatch.rs b/libs/cua/crates/cua-spaces-app-core/src/dispatch.rs
index cf76e89be9..bac5e7a5d2 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/dispatch.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/dispatch.rs
@@ -14,10 +14,10 @@ use crate::model::*;
use crate::spaces::{self, creating, roster, sidebar, stream};
use crate::teleport::{drag, flow, grid, transfer, windows};
use crate::{
- CoreError, about, agent_keys, agents, cloud_connect, devices, drive_mount_preview, drive_page,
- drive_settings, driver_preview, experiments, host, login_item, machines, notch, notifications,
- onboarding, onboarding_preview, paths, persistent, presence, settings, share, telemetry,
- window, wizard,
+ CoreError, about, agent_keys, agents, checklist, cloud_connect, devices, drive_mount_preview,
+ drive_page, drive_settings, driver_preview, experiments, host, login_item, machines, notch,
+ notifications, onboarding, onboarding_preview, palette, paths, persistent, presence, settings,
+ share, telemetry, window, wizard,
};
use serde::Serialize;
use serde::de::DeserializeOwned;
@@ -272,6 +272,10 @@ pub const METHODS: &[&str] = &[
"telemetry.share",
"telemetry.enroll",
"telemetry.checklist",
+ "checklist.reduce",
+ "checklist.view",
+ "palette.keybindings",
+ "palette.rank",
"telemetry.experimentsChanged",
"telemetry.experimentsOn",
"settings.withStorage",
@@ -1020,6 +1024,18 @@ pub fn call_value(method: &str, args: Value) -> Result<Value, CoreError> {
)),
"telemetry.enroll" => out(telemetry::enroll(&a.get("state")?, &a.get("action")?)),
"telemetry.checklist" => out(telemetry::checklist(&a.get::<String>("event")?)),
+ "checklist.reduce" => out(checklist::reduce(
+ &a.get::<checklist::ChecklistState>("state")?,
+ &a.get::<checklist::ChecklistAction>("action")?,
+ )),
+ "checklist.view" => out(checklist::view(
+ &a.get::<checklist::ChecklistState>("state")?,
+ )),
+ "palette.keybindings" => out(palette::keybindings()),
+ "palette.rank" => out(palette::rank(
+ &a.get::<Vec<palette::PaletteEntry>>("entries")?,
+ &a.get::<String>("query")?,
+ )),
"telemetry.experimentsChanged" => out(telemetry::experiments_changed(
&a.get::<Option<experiments::Experiments>>("before")?
.unwrap_or_default(),
diff --git a/libs/cua/crates/cua-spaces-app-core/src/lib.rs b/libs/cua/crates/cua-spaces-app-core/src/lib.rs
index 712c9cac15..5d5252137d 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/lib.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/lib.rs
@@ -25,6 +25,8 @@
//! | [`teleport`] | picker filters and primary action, the review gate, drag-to-notch, transfer overlay |
//! | [`keyvault`] | grouping, consent chips, decisions, categories, the approval sheet, the broker client |
//! | [`onboarding`] | the first-run steps |
+//! | [`checklist`] | the getting-started checklist: its steps, what ticks them off, its usage events |
+//! | [`palette`] | the command palette's ranking and the shared keyboard shortcuts |
//! | [`driver_preview`] | the AI agents page's background computer-use card (its animated miniature) |
//! | [`settings`] | hotkey format, defaults, the settings file, the Settings page |
//! | [`experiments`] | Settings, Experiments: one switch per feature still being built, and what each hides while off |
@@ -55,6 +57,7 @@ pub mod about;
pub mod agent_keys;
pub mod agents;
pub mod billing;
+pub mod checklist;
pub mod cloud_connect;
pub mod devices;
pub mod dispatch;
@@ -75,6 +78,7 @@ pub mod notch;
pub mod notifications;
pub mod onboarding;
pub mod onboarding_preview;
+pub mod palette;
pub mod parity;
pub mod paths;
pub mod persistent;
diff --git a/libs/cua/crates/cua-spaces-app-core/src/palette.rs b/libs/cua/crates/cua-spaces-app-core/src/palette.rs
new file mode 100644
index 0000000000..7d11e66320
--- /dev/null
+++ b/libs/cua/crates/cua-spaces-app-core/src/palette.rs
@@ -0,0 +1,215 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+//! The command palette (⌘K) and the app's keyboard shortcuts.
+//!
+//! [`keybindings`] are the shared UI's own file
+//! (`apps/cua-spaces-web/src/lib/keybindings.json`), read here so the
+//! SwiftUI app binds the same keys as the React UI. [`rank`] orders the
+//! palette's commands for a query, the same way in every shell.
+
+use std::cmp::Ordering;
+
+use serde::{Deserialize, Serialize};
+
+const KEYBINDINGS_JSON: &str =
+ include_str!("../../../../../apps/cua-spaces-web/src/lib/keybindings.json");
+
+/// One command's default key.
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+pub struct Keybinding {
+ /// `commandPalette.toggle`, `nav.spaces`, ...
+ pub command: String,
+ /// `mod+k`, `mod+shift+l`: `mod` is ⌘ on macOS and Ctrl elsewhere.
+ pub key: String,
+}
+
+/// The default keyboard shortcuts, in the shared file's order.
+pub fn keybindings() -> Vec<Keybinding> {
+ serde_json::from_str(KEYBINDINGS_JSON).expect("keybindings.json is a list of {command, key}")
+}
+
+/// What the palette matches a query against, for one command.
+#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
+pub struct PaletteEntry {
+ /// "Actions", "Go to", "Spaces".
+ pub group: String,
+ /// "New Space".
+ pub label: String,
+ /// Secondary text ("Linux").
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub hint: Option<String>,
+ /// Extra words it answers to ("create add").
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub keywords: Option<String>,
+}
+
+/// How well `query` fuzzy-matches `text`: its characters must appear in
+/// order. Matches at the start of a word and runs of consecutive characters
+/// score higher, gaps lower. 0: no match.
+pub fn fuzzy_score(text: &str, query: &str) -> f64 {
+ let t: Vec<char> = text.to_lowercase().chars().collect();
+ let q: Vec<char> = query.to_lowercase().chars().collect();
+ if q.is_empty() {
+ return 1.0;
+ }
+ let mut score = 0.0;
+ let mut from = 0usize;
+ let mut prev: isize = -2;
+ for ch in &q {
+ let Some(at) = t[from.min(t.len())..]
+ .iter()
+ .position(|c| c == ch)
+ .map(|i| i + from)
+ else {
+ return 0.0;
+ };
+ let word_start = at == 0
+ || matches!(t[at - 1], '-' | '_' | '/' | '.' | ':')
+ || t[at - 1].is_whitespace();
+ score += 1.0;
+ if at as isize == prev + 1 {
+ score += 4.0;
+ }
+ if word_start {
+ score += 6.0;
+ }
+ score -= f64::min(3.0, (at - from) as f64 * 0.1);
+ prev = at as isize;
+ from = at + 1;
+ }
+ if t.starts_with(&q) {
+ score += 10.0;
+ }
+ f64::max(score, 0.01)
+}
+
+/// The best score for one query word across label, hint and keywords (the
+/// label counts most).
+fn word_score(e: &PaletteEntry, word: &str) -> f64 {
+ let label = fuzzy_score(&e.label, word) * 1.5;
+ let hint = fuzzy_score(e.hint.as_deref().unwrap_or(""), word);
+ let keywords = fuzzy_score(e.keywords.as_deref().unwrap_or(""), word);
+ label.max(hint).max(keywords)
+}
+
+/// The entries that match every word of `query`, best first, as indices
+/// into `entries`. Groups stay together, ordered by their best match; an
+/// empty query keeps every entry in its order.
+pub fn rank(entries: &[PaletteEntry], query: &str) -> Vec<u32> {
+ let words: Vec<String> = query.split_whitespace().map(str::to_lowercase).collect();
+ if words.is_empty() {
+ return (0..entries.len() as u32).collect();
+ }
+ let scored: Vec<(usize, f64)> = entries
+ .iter()
+ .enumerate()
+ .filter_map(|(i, e)| {
+ let mut score = 0.0;
+ for w in &words {
+ let s = word_score(e, w);
+ if s == 0.0 {
+ return None;
+ }
+ score += s;
+ }
+ Some((i, score))
+ })
+ .collect();
+ let group_best = |g: &str| {
+ scored
+ .iter()
+ .filter(|(i, _)| entries[*i].group == g)
+ .map(|(_, s)| *s)
+ .fold(0.0, f64::max)
+ };
+ let first_index = |g: &str| {
+ scored
+ .iter()
+ .find(|(i, _)| entries[*i].group == g)
+ .map_or(usize::MAX, |(i, _)| *i)
+ };
+ let mut sorted = scored.clone();
+ sorted.sort_by(|(ai, a), (bi, b)| {
+ let (ga, gb) = (&entries[*ai].group, &entries[*bi].group);
+ group_best(gb)
+ .partial_cmp(&group_best(ga))
+ .unwrap_or(Ordering::Equal)
+ // Ties between groups keep the first group's place.
+ .then_with(|| {
+ if ga == gb {
+ Ordering::Equal
+ } else {
+ first_index(ga).cmp(&first_index(gb))
+ }
+ })
+ .then_with(|| b.partial_cmp(a).unwrap_or(Ordering::Equal))
+ .then_with(|| ai.cmp(bi))
+ });
+ sorted.into_iter().map(|(i, _)| i as u32).collect()
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ fn entry(group: &str, label: &str, keywords: &str) -> PaletteEntry {
+ PaletteEntry {
+ group: group.into(),
+ label: label.into(),
+ hint: None,
+ keywords: (!keywords.is_empty()).then(|| keywords.into()),
+ }
+ }
+
+ #[test]
+ fn the_shared_keybindings_have_the_navigation_keys() {
+ let keys: Vec<(String, String)> = keybindings()
+ .into_iter()
+ .map(|k| (k.command, k.key))
+ .collect();
+ for (command, key) in [
+ ("commandPalette.toggle", "mod+k"),
+ ("nav.spaces", "mod+1"),
+ ("nav.machines", "mod+2"),
+ ("nav.agents", "mod+3"),
+ ("nav.keyvault", "mod+4"),
+ ] {
+ assert!(
+ keys.contains(&(command.into(), key.into())),
+ "{command} {key} in {keys:?}"
+ );
+ }
+ }
+
+ #[test]
+ fn fuzzy_scores_prefer_word_starts_and_runs() {
+ assert_eq!(fuzzy_score("Machines", ""), 1.0);
+ assert_eq!(fuzzy_score("Machines", "xz"), 0.0);
+ assert!(fuzzy_score("Machines", "mac") > fuzzy_score("Open Linux machine", "mac"));
+ assert!(fuzzy_score("New Space", "ns") > 0.0);
+ assert!(fuzzy_score("New Space", "sp") > fuzzy_score("Unspecified", "sp"));
+ assert!(fuzzy_score("Lock Keyvault", "lkv") > 0.0);
+ assert_eq!(fuzzy_score("Lock Keyvault", "vkl"), 0.0);
+ assert!(fuzzy_score("Spaces", "spa") > fuzzy_score("Settings and spare", "spa"));
+ assert!(fuzzy_score("Keyvault", "key") > fuzzy_score("Keyvault", "kvt"));
+ }
+
+ #[test]
+ fn ranks_matches_best_first_with_groups_together() {
+ let entries = vec![
+ entry("Actions", "New Space", "create add"),
+ entry("Go to", "Spaces", "page"),
+ entry("Go to", "Machines", "page"),
+ entry("Spaces", "Open dev box", "linux running"),
+ entry("Spaces", "Stop dev box", "linux running"),
+ ];
+ assert_eq!(rank(&entries, ""), [0, 1, 2, 3, 4]);
+ assert_eq!(rank(&entries, " "), [0, 1, 2, 3, 4]);
+ assert_eq!(rank(&entries, "machines"), [2]);
+ assert_eq!(rank(&entries, "dev stop"), [4]);
+ // "spa": Spaces (Go to) beats New Space; Go to's group comes first.
+ assert_eq!(rank(&entries, "spa"), [1, 0]);
+ assert_eq!(rank(&entries, "zzz"), Vec::<u32>::new());
+ }
+}
diff --git a/libs/cua/crates/cua-spaces-ffi/src/app_core.rs b/libs/cua/crates/cua-spaces-ffi/src/app_core.rs
index 767189d60f..eb829f4359 100644
--- a/libs/cua/crates/cua-spaces-ffi/src/app_core.rs
+++ b/libs/cua/crates/cua-spaces-ffi/src/app_core.rs
@@ -2402,6 +2402,36 @@ pub fn app_telemetry_enroll(
core::telemetry::enroll(&state, &action)
}
+// ---- Getting started and the command palette -----------------------------
+
+/// The getting-started checklist after `action`, and its usage events.
+#[uniffi::export]
+pub fn app_checklist_reduce(
+ state: AppChecklistState,
+ action: AppChecklistAction,
+) -> AppChecklistTransition {
+ core::checklist::reduce(&state, &action)
+}
+
+/// The getting-started checklist as drawn.
+#[uniffi::export]
+pub fn app_checklist_view(state: AppChecklistState) -> AppChecklistView {
+ core::checklist::view(&state)
+}
+
+/// The default keyboard shortcuts (the shared UI's `keybindings.json`).
+#[uniffi::export]
+pub fn app_keybindings() -> Vec<AppKeybinding> {
+ core::palette::keybindings()
+}
+
+/// The command palette's matches for `query`, best first, as indices into
+/// `entries`.
+#[uniffi::export]
+pub fn app_palette_rank(entries: Vec<AppPaletteEntry>, query: String) -> Vec<u32> {
+ core::palette::rank(&entries, &query)
+}
+
// ---- Fixtures ----------------------------------------------------------------
fn from_json<T: serde::de::DeserializeOwned>(what: &str, json: &str) -> Result<T> {
diff --git a/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rs b/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rs
index 6e1779e9fb..6b45cfaa7d 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
@@ -9021,3 +9021,128 @@ pub enum AppTelemetrySignal {
experiments: Vec<String>,
},
}
+
+/// One step, in the order the checklist lists them
+/// ([`telemetry::CHECKLIST_STEPS`]).
+pub type AppChecklistStep = core::checklist::ChecklistStep;
+#[uniffi::remote(Enum)]
+pub enum AppChecklistStep {
+ /// Connect another computer you own.
+ AddMachine,
+ /// Create a Space.
+ CreateSpace,
+ /// Teleport an app into a Space.
+ Teleport,
+ /// Share a Space with someone.
+ Share,
+ /// Run an agent.
+ RunAgent,
+}
+
+/// What the checklist remembers between launches.
+pub type AppChecklistState = core::checklist::ChecklistState;
+#[uniffi::remote(Record)]
+pub struct AppChecklistState {
+ /// Steps done, each once, in checklist order.
+ pub done: Vec<AppChecklistStep>,
+ /// Closed with ×; Getting Started opens it again.
+ pub dismissed: bool,
+ /// It was on screen once (`checklist_shown` was recorded).
+ pub shown: bool,
+}
+
+/// `checklist::ChecklistAction`.
+pub type AppChecklistAction = core::checklist::ChecklistAction;
+#[uniffi::remote(Enum)]
+pub enum AppChecklistAction {
+ /// A step finished (a teleport ran, a Space was shared).
+ Done {
+ /// The step.
+ step: AppChecklistStep,
+ },
+ /// The checklist is on screen.
+ Shown,
+ /// Closed with ×.
+ Dismiss,
+ /// Getting Started (the palette, the Help menu): open it again.
+ Reopen,
+ /// What the app shows now: each `true` ticks its step off.
+ Observe {
+ /// One of your machines other than this one is listed.
+ other_machine: bool,
+ /// A Space of yours exists (running or stopped).
+ has_space: bool,
+ /// An agent exists or has run.
+ agent_ran: bool,
+ },
+}
+
+/// The state after an action and the usage events it means.
+pub type AppChecklistTransition = core::checklist::ChecklistTransition;
+#[uniffi::remote(Record)]
+pub struct AppChecklistTransition {
+ /// The new state (save it when it changed).
+ pub state: AppChecklistState,
+ /// `cua_onboarding_step` events to record (`checklist_<event>`).
+ pub signals: Vec<AppTelemetrySignal>,
+}
+
+/// One row of the checklist.
+pub type AppChecklistRow = core::checklist::ChecklistRow;
+#[uniffi::remote(Record)]
+pub struct AppChecklistRow {
+ /// The step.
+ pub step: AppChecklistStep,
+ /// "Add a machine".
+ pub title: String,
+ /// One line under the title.
+ pub detail: String,
+ /// The button that does it; hidden once done.
+ pub action: String,
+ /// Done (ticked, struck through).
+ pub done: bool,
+}
+
+/// The checklist as drawn.
+pub type AppChecklistView = core::checklist::ChecklistView;
+#[uniffi::remote(Record)]
+pub struct AppChecklistView {
+ /// On screen (not closed).
+ pub visible: bool,
+ /// Every step done.
+ pub complete: bool,
+ /// "Get started", or "You're set up" when complete.
+ pub title: String,
+ /// The line under the title.
+ pub detail: String,
+ /// "2 of 5".
+ pub progress: String,
+ /// The close button's accessibility label.
+ pub close_label: String,
+ /// The steps in order.
+ pub rows: Vec<AppChecklistRow>,
+}
+
+/// One command's default key.
+pub type AppKeybinding = core::palette::Keybinding;
+#[uniffi::remote(Record)]
+pub struct AppKeybinding {
+ /// `commandPalette.toggle`, `nav.spaces`, ...
+ pub command: String,
+ /// `mod+k`, `mod+shift+l`: `mod` is ⌘ on macOS and Ctrl elsewhere.
+ pub key: String,
+}
+
+/// What the palette matches a query against, for one command.
+pub type AppPaletteEntry = core::palette::PaletteEntry;
+#[uniffi::remote(Record)]
+pub struct AppPaletteEntry {
+ /// "Actions", "Go to", "Spaces".
+ pub group: String,
+ /// "New Space".
+ pub label: String,
+ /// Secondary text ("Linux").
+ pub hint: Option<String>,
+ /// Extra words it answers to ("create add").
+ pub keywords: Option<String>,
+}
diff --git a/libs/cua/scripts/generate-app-core-ffi.py b/libs/cua/scripts/generate-app-core-ffi.py
index 823e932941..02cdd89b7f 100644
--- a/libs/cua/scripts/generate-app-core-ffi.py
+++ b/libs/cua/scripts/generate-app-core-ffi.py
@@ -65,6 +65,8 @@ TYPES = [
("drive_page.rs", "drive_page", ["DriveRequestInput", "DriveGrantInput", "DriveDeviceInput", "DriveConflictInput", "DriveSyncInput", "DriveInput", "DriveRequest", "DriveState", "DriveAction", "ConflictView", "DriveView"]),
("notifications.rs", "notifications", ["NotificationInput", "SystemNote", "NotificationsPlan", "NotificationsView"]),
("telemetry.rs", "telemetry", ["TelemetrySignal"]),
+ ("checklist.rs", "checklist", ["ChecklistStep", "ChecklistState", "ChecklistAction", "ChecklistTransition", "ChecklistRow", "ChecklistView"]),
+ ("palette.rs", "palette", ["Keybinding", "PaletteEntry"]),
]
# FFI names that read better than the plain prefix.
diff --git a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
index 3c0c785e23..2a758fe087 100644
--- a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
+++ b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
@@ -6556,6 +6556,360 @@ public func FfiConverterTypeAppCatalogEntry_lower(_ value: AppCatalogEntry) -> R
}
+public struct AppChecklistRow: Equatable, Hashable {
+ /**
+ * The step.
+ */
+ public var step: AppChecklistStep
+ /**
+ * "Add a machine".
+ */
+ public var title: String
+ /**
+ * One line under the title.
+ */
+ public var detail: String
+ /**
+ * The button that does it; hidden once done.
+ */
+ public var action: String
+ /**
+ * Done (ticked, struck through).
+ */
+ public var done: Bool
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ /**
+ * The step.
+ */step: AppChecklistStep,
+ /**
+ * "Add a machine".
+ */title: String,
+ /**
+ * One line under the title.
+ */detail: String,
+ /**
+ * The button that does it; hidden once done.
+ */action: String,
+ /**
+ * Done (ticked, struck through).
+ */done: Bool) {
+ self.step = step
+ self.title = title
+ self.detail = detail
+ self.action = action
+ self.done = done
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension AppChecklistRow: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeAppChecklistRow: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppChecklistRow {
+ return
+ try AppChecklistRow(
+ step: FfiConverterTypeAppChecklistStep.read(from: &buf),
+ title: FfiConverterString.read(from: &buf),
+ detail: FfiConverterString.read(from: &buf),
+ action: FfiConverterString.read(from: &buf),
+ done: FfiConverterBool.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: AppChecklistRow, into buf: inout [UInt8]) {
+ FfiConverterTypeAppChecklistStep.write(value.step, into: &buf)
+ FfiConverterString.write(value.title, into: &buf)
+ FfiConverterString.write(value.detail, into: &buf)
+ FfiConverterString.write(value.action, into: &buf)
+ FfiConverterBool.write(value.done, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppChecklistRow_lift(_ buf: RustBuffer) throws -> AppChecklistRow {
+ return try FfiConverterTypeAppChecklistRow.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppChecklistRow_lower(_ value: AppChecklistRow) -> RustBuffer {
+ return FfiConverterTypeAppChecklistRow.lower(value)
+}
+
+
+public struct AppChecklistState: Equatable, Hashable {
+ /**
+ * Steps done, each once, in checklist order.
+ */
+ public var done: [AppChecklistStep]
+ /**
+ * Closed with ×; Getting Started opens it again.
+ */
+ public var dismissed: Bool
+ /**
+ * It was on screen once (`checklist_shown` was recorded).
+ */
+ public var shown: Bool
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ /**
+ * Steps done, each once, in checklist order.
+ */done: [AppChecklistStep],
+ /**
+ * Closed with ×; Getting Started opens it again.
+ */dismissed: Bool,
+ /**
+ * It was on screen once (`checklist_shown` was recorded).
+ */shown: Bool) {
+ self.done = done
+ self.dismissed = dismissed
+ self.shown = shown
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension AppChecklistState: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeAppChecklistState: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppChecklistState {
+ return
+ try AppChecklistState(
+ done: FfiConverterSequenceTypeAppChecklistStep.read(from: &buf),
+ dismissed: FfiConverterBool.read(from: &buf),
+ shown: FfiConverterBool.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: AppChecklistState, into buf: inout [UInt8]) {
+ FfiConverterSequenceTypeAppChecklistStep.write(value.done, into: &buf)
+ FfiConverterBool.write(value.dismissed, into: &buf)
+ FfiConverterBool.write(value.shown, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppChecklistState_lift(_ buf: RustBuffer) throws -> AppChecklistState {
+ return try FfiConverterTypeAppChecklistState.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppChecklistState_lower(_ value: AppChecklistState) -> RustBuffer {
+ return FfiConverterTypeAppChecklistState.lower(value)
+}
+
+
+public struct AppChecklistTransition: Equatable, Hashable {
+ /**
+ * The new state (save it when it changed).
+ */
+ public var state: AppChecklistState
+ /**
+ * `cua_onboarding_step` events to record (`checklist_<event>`).
+ */
+ public var signals: [AppTelemetrySignal]
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ /**
+ * The new state (save it when it changed).
+ */state: AppChecklistState,
+ /**
+ * `cua_onboarding_step` events to record (`checklist_<event>`).
+ */signals: [AppTelemetrySignal]) {
+ self.state = state
+ self.signals = signals
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension AppChecklistTransition: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeAppChecklistTransition: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppChecklistTransition {
+ return
+ try AppChecklistTransition(
+ state: FfiConverterTypeAppChecklistState.read(from: &buf),
+ signals: FfiConverterSequenceTypeAppTelemetrySignal.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: AppChecklistTransition, into buf: inout [UInt8]) {
+ FfiConverterTypeAppChecklistState.write(value.state, into: &buf)
+ FfiConverterSequenceTypeAppTelemetrySignal.write(value.signals, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppChecklistTransition_lift(_ buf: RustBuffer) throws -> AppChecklistTransition {
+ return try FfiConverterTypeAppChecklistTransition.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppChecklistTransition_lower(_ value: AppChecklistTransition) -> RustBuffer {
+ return FfiConverterTypeAppChecklistTransition.lower(value)
+}
+
+
+public struct AppChecklistView: Equatable, Hashable {
+ /**
+ * On screen (not closed).
+ */
+ public var visible: Bool
+ /**
+ * Every step done.
+ */
+ public var complete: Bool
+ /**
+ * "Get started", or "You're set up" when complete.
+ */
+ public var title: String
+ /**
+ * The line under the title.
+ */
+ public var detail: String
+ /**
+ * "2 of 5".
+ */
+ public var progress: String
+ /**
+ * The close button's accessibility label.
+ */
+ public var closeLabel: String
+ /**
+ * The steps in order.
+ */
+ public var rows: [AppChecklistRow]
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ /**
+ * On screen (not closed).
+ */visible: Bool,
+ /**
+ * Every step done.
+ */complete: Bool,
+ /**
+ * "Get started", or "You're set up" when complete.
+ */title: String,
+ /**
+ * The line under the title.
+ */detail: String,
+ /**
+ * "2 of 5".
+ */progress: String,
+ /**
+ * The close button's accessibility label.
+ */closeLabel: String,
+ /**
+ * The steps in order.
+ */rows: [AppChecklistRow]) {
+ self.visible = visible
+ self.complete = complete
+ self.title = title
+ self.detail = detail
+ self.progress = progress
+ self.closeLabel = closeLabel
+ self.rows = rows
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension AppChecklistView: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeAppChecklistView: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppChecklistView {
+ return
+ try AppChecklistView(
+ visible: FfiConverterBool.read(from: &buf),
+ complete: FfiConverterBool.read(from: &buf),
+ title: FfiConverterString.read(from: &buf),
+ detail: FfiConverterString.read(from: &buf),
+ progress: FfiConverterString.read(from: &buf),
+ closeLabel: FfiConverterString.read(from: &buf),
+ rows: FfiConverterSequenceTypeAppChecklistRow.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: AppChecklistView, into buf: inout [UInt8]) {
+ FfiConverterBool.write(value.visible, into: &buf)
+ FfiConverterBool.write(value.complete, into: &buf)
+ FfiConverterString.write(value.title, into: &buf)
+ FfiConverterString.write(value.detail, into: &buf)
+ FfiConverterString.write(value.progress, into: &buf)
+ FfiConverterString.write(value.closeLabel, into: &buf)
+ FfiConverterSequenceTypeAppChecklistRow.write(value.rows, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppChecklistView_lift(_ buf: RustBuffer) throws -> AppChecklistView {
+ return try FfiConverterTypeAppChecklistView.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppChecklistView_lower(_ value: AppChecklistView) -> RustBuffer {
+ return FfiConverterTypeAppChecklistView.lower(value)
+}
+
+
public struct AppChromeInput: Equatable, Hashable {
/**
* The signed-in account.
@@ -17256,6 +17610,72 @@ public func FfiConverterTypeAppKeyCombo_lower(_ value: AppKeyCombo) -> RustBuffe
}
+public struct AppKeybinding: Equatable, Hashable {
+ /**
+ * `commandPalette.toggle`, `nav.spaces`, ...
+ */
+ public var command: String
+ /**
+ * `mod+k`, `mod+shift+l`: `mod` is ⌘ on macOS and Ctrl elsewhere.
+ */
+ public var key: String
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ /**
+ * `commandPalette.toggle`, `nav.spaces`, ...
+ */command: String,
+ /**
+ * `mod+k`, `mod+shift+l`: `mod` is ⌘ on macOS and Ctrl elsewhere.
+ */key: String) {
+ self.command = command
+ self.key = key
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension AppKeybinding: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeAppKeybinding: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppKeybinding {
+ return
+ try AppKeybinding(
+ command: FfiConverterString.read(from: &buf),
+ key: FfiConverterString.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: AppKeybinding, into buf: inout [UInt8]) {
+ FfiConverterString.write(value.command, into: &buf)
+ FfiConverterString.write(value.key, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppKeybinding_lift(_ buf: RustBuffer) throws -> AppKeybinding {
+ return try FfiConverterTypeAppKeybinding.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppKeybinding_lower(_ value: AppKeybinding) -> RustBuffer {
+ return FfiConverterTypeAppKeybinding.lower(value)
+}
+
+
public struct AppKindOption: Equatable, Hashable {
/**
* Container or VM.
@@ -22114,6 +22534,92 @@ public func FfiConverterTypeAppOpenWindow_lower(_ value: AppOpenWindow) -> RustB
}
+public struct AppPaletteEntry: Equatable, Hashable {
+ /**
+ * "Actions", "Go to", "Spaces".
+ */
+ public var group: String
+ /**
+ * "New Space".
+ */
+ public var label: String
+ /**
+ * Secondary text ("Linux").
+ */
+ public var hint: String?
+ /**
+ * Extra words it answers to ("create add").
+ */
+ public var keywords: String?
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ /**
+ * "Actions", "Go to", "Spaces".
+ */group: String,
+ /**
+ * "New Space".
+ */label: String,
+ /**
+ * Secondary text ("Linux").
+ */hint: String?,
+ /**
+ * Extra words it answers to ("create add").
+ */keywords: String?) {
+ self.group = group
+ self.label = label
+ self.hint = hint
+ self.keywords = keywords
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension AppPaletteEntry: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeAppPaletteEntry: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppPaletteEntry {
+ return
+ try AppPaletteEntry(
+ group: FfiConverterString.read(from: &buf),
+ label: FfiConverterString.read(from: &buf),
+ hint: FfiConverterOptionString.read(from: &buf),
+ keywords: FfiConverterOptionString.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: AppPaletteEntry, into buf: inout [UInt8]) {
+ FfiConverterString.write(value.group, into: &buf)
+ FfiConverterString.write(value.label, into: &buf)
+ FfiConverterOptionString.write(value.hint, into: &buf)
+ FfiConverterOptionString.write(value.keywords, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppPaletteEntry_lift(_ buf: RustBuffer) throws -> AppPaletteEntry {
+ return try FfiConverterTypeAppPaletteEntry.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppPaletteEntry_lower(_ value: AppPaletteEntry) -> RustBuffer {
+ return FfiConverterTypeAppPaletteEntry.lower(value)
+}
+
+
public struct AppPendingCreate: Equatable, Hashable {
/**
* `pending:<token>`.
@@ -41581,6 +42087,232 @@ public func FfiConverterTypeAppBannerTone_lower(_ value: AppBannerTone) -> RustB
}
+// Note that we don't yet support `indirect` for enums.
+// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
+
+public enum AppChecklistAction: Equatable, Hashable {
+
+ /**
+ * A step finished (a teleport ran, a Space was shared).
+ */
+ case done(
+ /**
+ * The step.
+ */step: AppChecklistStep
+ )
+ /**
+ * The checklist is on screen.
+ */
+ case shown
+ /**
+ * Closed with ×.
+ */
+ case dismiss
+ /**
+ * Getting Started (the palette, the Help menu): open it again.
+ */
+ case reopen
+ /**
+ * What the app shows now: each `true` ticks its step off.
+ */
+ case observe(
+ /**
+ * One of your machines other than this one is listed.
+ */otherMachine: Bool,
+ /**
+ * A Space of yours exists (running or stopped).
+ */hasSpace: Bool,
+ /**
+ * An agent exists or has run.
+ */agentRan: Bool
+ )
+
+
+
+
+
+}
+
+#if compiler(>=6)
+extension AppChecklistAction: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeAppChecklistAction: FfiConverterRustBuffer {
+ typealias SwiftType = AppChecklistAction
+
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppChecklistAction {
+ let variant: Int32 = try readInt(&buf)
+ switch variant {
+
+ case 1: return .done(step: try FfiConverterTypeAppChecklistStep.read(from: &buf)
+ )
+
+ case 2: return .shown
+
+ case 3: return .dismiss
+
+ case 4: return .reopen
+
+ case 5: return .observe(otherMachine: try FfiConverterBool.read(from: &buf), hasSpace: try FfiConverterBool.read(from: &buf), agentRan: try FfiConverterBool.read(from: &buf)
+ )
+
+ default: throw UniffiInternalError.unexpectedEnumCase
+ }
+ }
+
+ public static func write(_ value: AppChecklistAction, into buf: inout [UInt8]) {
+ switch value {
+
+
+ case let .done(step):
+ writeInt(&buf, Int32(1))
+ FfiConverterTypeAppChecklistStep.write(step, into: &buf)
+
+
+ case .shown:
+ writeInt(&buf, Int32(2))
+
+
+ case .dismiss:
+ writeInt(&buf, Int32(3))
+
+
+ case .reopen:
+ writeInt(&buf, Int32(4))
+
+
+ case let .observe(otherMachine,hasSpace,agentRan):
+ writeInt(&buf, Int32(5))
+ FfiConverterBool.write(otherMachine, into: &buf)
+ FfiConverterBool.write(hasSpace, into: &buf)
+ FfiConverterBool.write(agentRan, into: &buf)
+
+ }
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppChecklistAction_lift(_ buf: RustBuffer) throws -> AppChecklistAction {
+ return try FfiConverterTypeAppChecklistAction.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppChecklistAction_lower(_ value: AppChecklistAction) -> RustBuffer {
+ return FfiConverterTypeAppChecklistAction.lower(value)
+}
+
+
+// Note that we don't yet support `indirect` for enums.
+// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
+
+public enum AppChecklistStep: Equatable, Hashable {
+
+ /**
+ * Connect another computer you own.
+ */
+ case addMachine
+ /**
+ * Create a Space.
+ */
+ case createSpace
+ /**
+ * Teleport an app into a Space.
+ */
+ case teleport
+ /**
+ * Share a Space with someone.
+ */
+ case share
+ /**
+ * Run an agent.
+ */
+ case runAgent
+
+
+
+
+
+}
+
+#if compiler(>=6)
+extension AppChecklistStep: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeAppChecklistStep: FfiConverterRustBuffer {
+ typealias SwiftType = AppChecklistStep
+
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppChecklistStep {
+ let variant: Int32 = try readInt(&buf)
+ switch variant {
+
+ case 1: return .addMachine
+
+ case 2: return .createSpace
+
+ case 3: return .teleport
+
+ case 4: return .share
+
+ case 5: return .runAgent
+
+ default: throw UniffiInternalError.unexpectedEnumCase
+ }
+ }
+
+ public static func write(_ value: AppChecklistStep, into buf: inout [UInt8]) {
+ switch value {
+
+
+ case .addMachine:
+ writeInt(&buf, Int32(1))
+
+
+ case .createSpace:
+ writeInt(&buf, Int32(2))
+
+
+ case .teleport:
+ writeInt(&buf, Int32(3))
+
+
+ case .share:
+ writeInt(&buf, Int32(4))
+
+
+ case .runAgent:
+ writeInt(&buf, Int32(5))
+
+ }
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppChecklistStep_lift(_ buf: RustBuffer) throws -> AppChecklistStep {
+ return try FfiConverterTypeAppChecklistStep.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppChecklistStep_lower(_ value: AppChecklistStep) -> RustBuffer {
+ return FfiConverterTypeAppChecklistStep.lower(value)
+}
+
+
// Note that we don't yet support `indirect` for enums.
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
@@ -57154,6 +57886,31 @@ fileprivate struct FfiConverterSequenceInt16: FfiConverterRustBuffer {
}
}
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+fileprivate struct FfiConverterSequenceUInt32: FfiConverterRustBuffer {
+ typealias SwiftType = [UInt32]
+
+ public static func write(_ value: [UInt32], into buf: inout [UInt8]) {
+ let len = Int32(value.count)
+ writeInt(&buf, len)
+ for item in value {
+ FfiConverterUInt32.write(item, into: &buf)
+ }
+ }
+
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [UInt32] {
+ let len: Int32 = try readInt(&buf)
+ var seq = [UInt32]()
+ seq.reserveCapacity(Int(len))
+ for _ in 0 ..< len {
+ seq.append(try FfiConverterUInt32.read(from: &buf))
+ }
+ return seq
+ }
+}
+
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
@@ -57529,6 +58286,31 @@ fileprivate struct FfiConverterSequenceTypeAppCatalogEntry: FfiConverterRustBuff
}
}
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+fileprivate struct FfiConverterSequenceTypeAppChecklistRow: FfiConverterRustBuffer {
+ typealias SwiftType = [AppChecklistRow]
+
+ public static func write(_ value: [AppChecklistRow], into buf: inout [UInt8]) {
+ let len = Int32(value.count)
+ writeInt(&buf, len)
+ for item in value {
+ FfiConverterTypeAppChecklistRow.write(item, into: &buf)
+ }
+ }
+
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [AppChecklistRow] {
+ let len: Int32 = try readInt(&buf)
+ var seq = [AppChecklistRow]()
+ seq.reserveCapacity(Int(len))
+ for _ in 0 ..< len {
+ seq.append(try FfiConverterTypeAppChecklistRow.read(from: &buf))
+ }
+ return seq
+ }
+}
+
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
@@ -58454,6 +59236,31 @@ fileprivate struct FfiConverterSequenceTypeAppImageSuggestion: FfiConverterRustB
}
}
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+fileprivate struct FfiConverterSequenceTypeAppKeybinding: FfiConverterRustBuffer {
+ typealias SwiftType = [AppKeybinding]
+
+ public static func write(_ value: [AppKeybinding], into buf: inout [UInt8]) {
+ let len = Int32(value.count)
+ writeInt(&buf, len)
+ for item in value {
+ FfiConverterTypeAppKeybinding.write(item, into: &buf)
+ }
+ }
+
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [AppKeybinding] {
+ let len: Int32 = try readInt(&buf)
+ var seq = [AppKeybinding]()
+ seq.reserveCapacity(Int(len))
+ for _ in 0 ..< len {
+ seq.append(try FfiConverterTypeAppKeybinding.read(from: &buf))
+ }
+ return seq
+ }
+}
+
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
@@ -58754,6 +59561,31 @@ fileprivate struct FfiConverterSequenceTypeAppOpenWindow: FfiConverterRustBuffer
}
}
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+fileprivate struct FfiConverterSequenceTypeAppPaletteEntry: FfiConverterRustBuffer {
+ typealias SwiftType = [AppPaletteEntry]
+
+ public static func write(_ value: [AppPaletteEntry], into buf: inout [UInt8]) {
+ let len = Int32(value.count)
+ writeInt(&buf, len)
+ for item in value {
+ FfiConverterTypeAppPaletteEntry.write(item, into: &buf)
+ }
+ }
+
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [AppPaletteEntry] {
+ let len: Int32 = try readInt(&buf)
+ var seq = [AppPaletteEntry]()
+ seq.reserveCapacity(Int(len))
+ for _ in 0 ..< len {
+ seq.append(try FfiConverterTypeAppPaletteEntry.read(from: &buf))
+ }
+ return seq
+ }
+}
+
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
@@ -60554,6 +61386,31 @@ fileprivate struct FfiConverterSequenceTypeTeleportWindow: FfiConverterRustBuffe
}
}
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+fileprivate struct FfiConverterSequenceTypeAppChecklistStep: FfiConverterRustBuffer {
+ typealias SwiftType = [AppChecklistStep]
+
+ public static func write(_ value: [AppChecklistStep], into buf: inout [UInt8]) {
+ let len = Int32(value.count)
+ writeInt(&buf, len)
+ for item in value {
+ FfiConverterTypeAppChecklistStep.write(item, into: &buf)
+ }
+ }
+
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [AppChecklistStep] {
+ let len: Int32 = try readInt(&buf)
+ var seq = [AppChecklistStep]()
+ seq.reserveCapacity(Int(len))
+ for _ in 0 ..< len {
+ seq.append(try FfiConverterTypeAppChecklistStep.read(from: &buf))
+ }
+ return seq
+ }
+}
+
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
@@ -61255,6 +62112,27 @@ public func appCatalogEntry(entry: TeleportCatalogEntry) -> AppCatalogEntry {
)
})
}
+/**
+ * The getting-started checklist after `action`, and its usage events.
+ */
+public func appChecklistReduce(state: AppChecklistState, action: AppChecklistAction) -> AppChecklistTransition {
+ return try! FfiConverterTypeAppChecklistTransition_lift(try! rustCall() {
+ uniffi_cua_spaces_ffi_fn_func_app_checklist_reduce(
+ FfiConverterTypeAppChecklistState_lower(state),
+ FfiConverterTypeAppChecklistAction_lower(action),$0
+ )
+})
+}
+/**
+ * The getting-started checklist as drawn.
+ */
+public func appChecklistView(state: AppChecklistState) -> AppChecklistView {
+ return try! FfiConverterTypeAppChecklistView_lift(try! rustCall() {
+ uniffi_cua_spaces_ffi_fn_func_app_checklist_view(
+ FfiConverterTypeAppChecklistState_lower(state),$0
+ )
+})
+}
/**
* The chrome's input from JSON (parity flows).
*/
@@ -62033,6 +62911,15 @@ public func appIsCloudWord(on: String) -> Bool {
)
})
}
+/**
+ * The default keyboard shortcuts (the shared UI's `keybindings.json`).
+ */
+public func appKeybindings() -> [AppKeybinding] {
+ return try! FfiConverterSequenceTypeAppKeybinding.lift(try! rustCall() {
+ uniffi_cua_spaces_ffi_fn_func_app_keybindings($0
+ )
+})
+}
/**
* A launch from JSON (parity flows).
*/
@@ -62366,6 +63253,18 @@ public func appOsIconSystemSymbol(id: String) -> String? {
)
})
}
+/**
+ * The command palette's matches for `query`, best first, as indices into
+ * `entries`.
+ */
+public func appPaletteRank(entries: [AppPaletteEntry], query: String) -> [UInt32] {
+ return try! FfiConverterSequenceUInt32.lift(try! rustCall() {
+ uniffi_cua_spaces_ffi_fn_func_app_palette_rank(
+ FfiConverterSequenceTypeAppPaletteEntry.lower(entries),
+ FfiConverterString.lower(query),$0
+ )
+})
+}
/**
* The picker's Apps tab as tiles (`windows`: this machine's, front to back,
* for each app's frontmost-window preview).
@@ -64056,6 +64955,12 @@ private let initializationResult: InitializationResult = {
if (uniffi_cua_spaces_ffi_checksum_func_app_catalog_entry() != 56759) {
return InitializationResult.apiChecksumMismatch
}
+ if (uniffi_cua_spaces_ffi_checksum_func_app_checklist_reduce() != 46431) {
+ return InitializationResult.apiChecksumMismatch
+ }
+ if (uniffi_cua_spaces_ffi_checksum_func_app_checklist_view() != 58453) {
+ return InitializationResult.apiChecksumMismatch
+ }
if (uniffi_cua_spaces_ffi_checksum_func_app_chrome_input_from_json() != 46275) {
return InitializationResult.apiChecksumMismatch
}
@@ -64278,6 +65183,9 @@ private let initializationResult: InitializationResult = {
if (uniffi_cua_spaces_ffi_checksum_func_app_is_cloud_word() != 38584) {
return InitializationResult.apiChecksumMismatch
}
+ if (uniffi_cua_spaces_ffi_checksum_func_app_keybindings() != 16108) {
+ return InitializationResult.apiChecksumMismatch
+ }
if (uniffi_cua_spaces_ffi_checksum_func_app_launch_input_from_json() != 52356) {
return InitializationResult.apiChecksumMismatch
}
@@ -64371,6 +65279,9 @@ private let initializationResult: InitializationResult = {
if (uniffi_cua_spaces_ffi_checksum_func_app_os_icon_system_symbol() != 36995) {
return InitializationResult.apiChecksumMismatch
}
+ if (uniffi_cua_spaces_ffi_checksum_func_app_palette_rank() != 5421) {
+ return InitializationResult.apiChecksumMismatch
+ }
if (uniffi_cua_spaces_ffi_checksum_func_app_picker_app_grid() != 16625) {
return InitializationResult.apiChecksumMismatch
}
diff --git a/libs/spaces-app-swift/Sources/cua_spaces_ffiFFI/include/cua_spaces_ffiFFI.h b/libs/spaces-app-swift/Sources/cua_spaces_ffiFFI/include/cua_spaces_ffiFFI.h
index 90e1d45a16..5810d15f48 100644
--- a/libs/spaces-app-swift/Sources/cua_spaces_ffiFFI/include/cua_spaces_ffiFFI.h
+++ b/libs/spaces-app-swift/Sources/cua_spaces_ffiFFI/include/cua_spaces_ffiFFI.h
@@ -836,6 +836,16 @@ RustBuffer uniffi_cua_spaces_ffi_fn_func_app_catalog_entries_from_json(RustBuffe
RustBuffer uniffi_cua_spaces_ffi_fn_func_app_catalog_entry(RustBuffer entry, RustCallStatus *_Nonnull out_status
);
#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_CHECKLIST_REDUCE
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_CHECKLIST_REDUCE
+RustBuffer uniffi_cua_spaces_ffi_fn_func_app_checklist_reduce(RustBuffer state, RustBuffer action, RustCallStatus *_Nonnull out_status
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_CHECKLIST_VIEW
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_CHECKLIST_VIEW
+RustBuffer uniffi_cua_spaces_ffi_fn_func_app_checklist_view(RustBuffer state, RustCallStatus *_Nonnull out_status
+);
+#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_CHROME_INPUT_FROM_JSON
#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_CHROME_INPUT_FROM_JSON
RustBuffer uniffi_cua_spaces_ffi_fn_func_app_chrome_input_from_json(RustBuffer json, RustCallStatus *_Nonnull out_status
@@ -1214,6 +1224,12 @@ RustBuffer uniffi_cua_spaces_ffi_fn_func_app_hosted_rows(RustBuffer spaces, Rust
#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_IS_CLOUD_WORD
#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_IS_CLOUD_WORD
int8_t uniffi_cua_spaces_ffi_fn_func_app_is_cloud_word(RustBuffer on, RustCallStatus *_Nonnull out_status
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_KEYBINDINGS
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_KEYBINDINGS
+RustBuffer uniffi_cua_spaces_ffi_fn_func_app_keybindings(RustCallStatus *_Nonnull out_status
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_LAUNCH_INPUT_FROM_JSON
@@ -1375,6 +1391,11 @@ RustBuffer uniffi_cua_spaces_ffi_fn_func_app_os_icon_svg(RustBuffer id, RustCall
RustBuffer uniffi_cua_spaces_ffi_fn_func_app_os_icon_system_symbol(RustBuffer id, RustCallStatus *_Nonnull out_status
);
#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_PALETTE_RANK
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_PALETTE_RANK
+RustBuffer uniffi_cua_spaces_ffi_fn_func_app_palette_rank(RustBuffer entries, RustBuffer query, RustCallStatus *_Nonnull out_status
+);
+#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_PICKER_APP_GRID
#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_PICKER_APP_GRID
RustBuffer uniffi_cua_spaces_ffi_fn_func_app_picker_app_grid(RustBuffer state, RustBuffer windows, RustCallStatus *_Nonnull out_status
@@ -2556,6 +2577,18 @@ uint16_t uniffi_cua_spaces_ffi_checksum_func_app_catalog_entries_from_json(void
#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_CATALOG_ENTRY
uint16_t uniffi_cua_spaces_ffi_checksum_func_app_catalog_entry(void
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_CHECKLIST_REDUCE
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_CHECKLIST_REDUCE
+uint16_t uniffi_cua_spaces_ffi_checksum_func_app_checklist_reduce(void
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_CHECKLIST_VIEW
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_CHECKLIST_VIEW
+uint16_t uniffi_cua_spaces_ffi_checksum_func_app_checklist_view(void
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_CHROME_INPUT_FROM_JSON
@@ -3000,6 +3033,12 @@ uint16_t uniffi_cua_spaces_ffi_checksum_func_app_hosted_rows(void
#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_IS_CLOUD_WORD
uint16_t uniffi_cua_spaces_ffi_checksum_func_app_is_cloud_word(void
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_KEYBINDINGS
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_KEYBINDINGS
+uint16_t uniffi_cua_spaces_ffi_checksum_func_app_keybindings(void
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_LAUNCH_INPUT_FROM_JSON
@@ -3186,6 +3225,12 @@ uint16_t uniffi_cua_spaces_ffi_checksum_func_app_os_icon_svg(void
#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_OS_ICON_SYSTEM_SYMBOL
uint16_t uniffi_cua_spaces_ffi_checksum_func_app_os_icon_system_symbol(void
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_PALETTE_RANK
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_PALETTE_RANK
+uint16_t uniffi_cua_spaces_ffi_checksum_func_app_palette_rank(void
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_PICKER_APP_GRID
diff --git a/scripts/docs-generators/cua-sdk.ts b/scripts/docs-generators/cua-sdk.ts
index 233c89ce33..d3d3ab6368 100644
--- a/scripts/docs-generators/cua-sdk.ts
+++ b/scripts/docs-generators/cua-sdk.ts
@@ -1094,6 +1094,16 @@ export const PAGES: PageSpec[] = [
prefixes: ['AppShare', 'app_share_', 'AppRoleOption'],
spaces: true,
},
+ {
+ slug: 'spaces/app-checklist-palette',
+ title: 'Getting started and the command palette',
+ description: 'The getting-started checklist, the command palette\'s ranking and the shared keyboard shortcuts.',
+ intro:
+ 'App core functions beside the [Spaces app core](/cua-sdk/reference/spaces/app-core) screens. `app_checklist_reduce` applies a checklist action (a step done, shown, closed, opened again, or what the app shows now) and returns the new `AppChecklistState` with the usage events it means; `app_checklist_view` derives the rows, title and progress. `app_palette_rank` orders the command palette\'s entries for a query, and `app_keybindings` lists the default keyboard shortcuts the apps share.',
+ items: [],
+ prefixes: ['AppChecklist', 'app_checklist_', 'AppKeybinding', 'app_keybindings', 'AppPaletteEntry', 'app_palette_'],
+ spaces: true,
+ },
{
slug: 'spaces/app-core/telemetry',
title: 'Usage telemetry',