Build Mac palette and task windows for focused validation
21 files changed,
+1,080
−44
docs/superpowers/plans/CONTROLLER-REPORT-native-mac-power.md+28 −0native/apple/Sources/EquipoActivity/Resources/Localizable.xcstrings+120 −0native/apple/Sources/EquipoKit/MacPower/MacJumpIndex.swift+79 −0native/apple/Sources/EquipoKit/MacPower/MacTaskContext.swift+68 −0native/apple/Sources/EquipoKit/Push/PushRoute.swift+4 −2native/apple/Sources/EquipoKit/Resources/Localizable.xcstrings+120 −0native/apple/Sources/EquipoKit/Session/EquipoSession.swift+2 −0native/apple/Sources/EquipoKit/UI/Screens/TaskDetailScreen.swift+16 −5native/apple/Sources/EquipoMac/EquipoMacApp.swift+31 −13native/apple/Sources/EquipoMac/LiveTranscript.swift+19 −0native/apple/Sources/EquipoMac/MacJumpPalette.swift+150 −0native/apple/Sources/EquipoMac/MacMainView.swift+23 −21native/apple/Sources/EquipoMac/MacPowerCommands.swift+57 −0native/apple/Sources/EquipoMac/MacPowerFixture.swift+47 −0native/apple/Sources/EquipoMac/MacTaskWindow.swift+44 −0native/apple/Sources/EquipoMac/MacWorkspace.swift+72 −0native/apple/Tests/EquipoKitTests/MacPowerTests.swift+119 −0native/apple/Tests/EquipoKitTests/MacWorkspaceTests.swift+65 −0native/apple/Tests/EquipoKitTests/TaskDetailModelTests.swift+4 −1native/scripts/check-strings.py+1 −1native/scripts/strings.json+11 −1
diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-native-mac-power.md b/docs/superpowers/plans/CONTROLLER-REPORT-native-mac-power.md| new file mode 100644 |
| index 00000000..75a03893 |
| --- /dev/null |
| +++ b/docs/superpowers/plans/CONTROLLER-REPORT-native-mac-power.md |
| @@ -0,0 +1,28 @@ |
| +# Mac power use |
| + |
| +Branch `native/mac-power`, based on `602b91fe`. Paused for the controller's |
| +slice 7 review fixes before publication. No merge or release. |
| + |
| +Implementation in progress: local fuzzy palette; window-focused Task and Go |
| +commands; the task screen's existing action model and confirmations; task |
| +WindowGroup bound to a local, non-secret session UUID; task-window visibility |
| +and move/cancellation handling; navigation history and composer focus. |
| + |
| +Copy: the ten `native.mac.*` keys were accepted by Luna, 2026-11-27, with the |
| +controller's final casing. Existing action labels retain reviewed sentence |
| +case in Mac menus; follow-up for Luna to review menu-specific casing. |
| + |
| +Validation so far: |
| +- Test-first `swift test --package-path native/apple --jobs 4 --filter MacPowerTests` |
| + failed on missing new model types. |
| +- `swift test --package-path native/apple --jobs 4 --filter |
| + 'MacPowerTests|MacWorkspaceTests|TaskDetailModelTests'`: 32 tests passed. |
| +- String catalog check, 334-string parity, Oficina ID and sign-in lifetime |
| + scripts passed. Full local gate deliberately not run under machine rules. |
| +- `swift build --package-path native/apple --jobs 4 --product EquipoMac` passed. |
| +- An offline bundled fixture opened the palette through the actual Command-K |
| + menu equivalent. An in-app NSView capture was inspected; regrouping actions |
| + ahead of the app destinations is implemented and awaits recapture. |
| + |
| +Still required: guard mutations (prepared, not yet run), keyboard/VoiceOver |
| +fixture checks, final screenshots, post-commit reference scan, push and CI. |
diff --git a/native/apple/Sources/EquipoActivity/Resources/Localizable.xcstrings b/native/apple/Sources/EquipoActivity/Resources/Localizable.xcstrings| index 47e4b98f..4d90c069 100644 |
| --- a/native/apple/Sources/EquipoActivity/Resources/Localizable.xcstrings |
| +++ b/native/apple/Sources/EquipoActivity/Resources/Localizable.xcstrings |
| @@ -1506,6 +1506,126 @@ |
| } |
| } |
| }, |
| + "native.mac.back": { |
| + "comment": "COPY APPROVED: Luna, 2026-11-27.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Back" |
| + } |
| + } |
| + } |
| + }, |
| + "native.mac.forward": { |
| + "comment": "COPY APPROVED: Luna, 2026-11-27.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Forward" |
| + } |
| + } |
| + } |
| + }, |
| + "native.mac.go": { |
| + "comment": "COPY APPROVED: Luna, 2026-11-27.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Go" |
| + } |
| + } |
| + } |
| + }, |
| + "native.mac.jump": { |
| + "comment": "COPY APPROVED: Luna, 2026-11-27.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Jump to…" |
| + } |
| + } |
| + } |
| + }, |
| + "native.mac.new_message": { |
| + "comment": "COPY APPROVED: Luna, 2026-11-27.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "New Message" |
| + } |
| + } |
| + } |
| + }, |
| + "native.mac.no_results": { |
| + "comment": "COPY APPROVED: Luna, 2026-11-27.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "No matches" |
| + } |
| + } |
| + } |
| + }, |
| + "native.mac.open_window": { |
| + "comment": "COPY APPROVED: Luna, 2026-11-27.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Open in New Window" |
| + } |
| + } |
| + } |
| + }, |
| + "native.mac.refresh": { |
| + "comment": "COPY APPROVED: Luna, 2026-11-27.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Refresh" |
| + } |
| + } |
| + } |
| + }, |
| + "native.mac.search": { |
| + "comment": "COPY APPROVED: Luna, 2026-11-27.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Search tasks, projects and actions" |
| + } |
| + } |
| + } |
| + }, |
| + "native.mac.selected_task": { |
| + "comment": "COPY APPROVED: Luna, 2026-11-27.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "For the selected task" |
| + } |
| + } |
| + } |
| + }, |
| "native.needs.done_at": { |
| "extractionState": "manual", |
| "localizations": { |
diff --git a/native/apple/Sources/EquipoKit/MacPower/MacJumpIndex.swift b/native/apple/Sources/EquipoKit/MacPower/MacJumpIndex.swift| new file mode 100644 |
| index 00000000..1828a7ea |
| --- /dev/null |
| +++ b/native/apple/Sources/EquipoKit/MacPower/MacJumpIndex.swift |
| @@ -0,0 +1,79 @@ |
| +import Foundation |
| +import Observation |
| + |
| +public enum MacDestination: Hashable, Sendable { |
| + case pane(Destination.Pane), task(String), project(String) |
| +} |
| + |
| +public struct MacJumpResult: Identifiable, Sendable { |
| + public let target: MacDestination |
| + public let title: String |
| + public let subtitle: String |
| + public let needsYou: Bool |
| + let search: String |
| + public var id: MacDestination { target } |
| +} |
| + |
| +/// Local, bounded by the same task window as the sidebar. No remote search |
| +/// or text from a task thread is implied by a match. |
| +public struct MacJumpIndex { |
| + private var entries: [MacJumpResult] = [] |
| + public init(tasks: [ThinTask], needs: [ThinTask], projects: [ThinProject]) { |
| + let needsIDs = Set(needs.map(\.id)) |
| + var seen = Set<String>() |
| + for task in needs + tasks where seen.insert(task.id).inserted { |
| + entries.append(.init(target: .task(task.id), title: task.title, subtitle: task.project, |
| + needsYou: needsIDs.contains(task.id), |
| + search: [task.title, task.project, task.repo ?? "", task.branch, task.brief].joined(separator: " "))) |
| + } |
| + for project in projects where project.state == "active" { |
| + entries.append(.init(target: .project(project.id), title: project.displayName, subtitle: project.repo, |
| + needsYou: false, search: [project.displayName, project.repo].joined(separator: " "))) |
| + } |
| + for (pane, key) in [(Destination.Pane.conversation, "tab.conversation"), (.needs, "tab.needs"), (.tasks, "tab.tasks"), (.projects, "nav.projects")] { |
| + let title = EquipoStrings.text(.init(key)) |
| + entries.append(.init(target: .pane(pane), title: title, subtitle: "", needsYou: false, search: title)) |
| + } |
| + } |
| + public func results(_ query: String) -> [MacJumpResult] { |
| + entries.enumerated().compactMap { index, entry -> (Int, Int, MacJumpResult)? in |
| + guard let score = Self.score(query, in: entry.search) else { return nil } |
| + return (score, index, entry) |
| + }.sorted { $0.0 == $1.0 ? $0.1 < $1.1 : $0.0 > $1.0 }.map(\.2) |
| + } |
| + public static func score(_ query: String, in text: String) -> Int? { |
| + let query = query.trimmingCharacters(in: .whitespacesAndNewlines).folding(options: [.caseInsensitive, .diacriticInsensitive], locale: .current) |
| + let text = text.folding(options: [.caseInsensitive, .diacriticInsensitive], locale: .current) |
| + if query.isEmpty { return 0 } |
| + if text.hasPrefix(query) { return 10000 } |
| + if text.contains(query) { return 5000 } |
| + var cursor = text.startIndex, gaps = 0 |
| + for character in query { |
| + guard let next = text[cursor...].firstIndex(of: character) else { return nil } |
| + gaps += text.distance(from: cursor, to: next) |
| + cursor = text.index(after: next) |
| + } |
| + return 1000 - gaps |
| + } |
| +} |
| + |
| +@MainActor @Observable public final class MacNavigationHistory { |
| + private var entries: [MacDestination] = [.pane(.conversation)] |
| + private var index = 0 |
| + public init() {} |
| + public var current: MacDestination { entries[index] } |
| + public var pane: Destination.Pane { |
| + for entry in entries.prefix(index + 1).reversed() { |
| + switch entry { case .pane(let pane): return pane; case .project: return .projects; case .task: continue } |
| + } |
| + return .conversation |
| + } |
| + public var canBack: Bool { index > 0 } |
| + public var canForward: Bool { index + 1 < entries.count } |
| + public func go(_ destination: MacDestination) { |
| + guard current != destination else { return } |
| + entries = Array(entries.prefix(index + 1)); entries.append(destination); index += 1 |
| + } |
| + @discardableResult public func back() -> MacDestination? { guard canBack else { return nil }; index -= 1; return current } |
| + @discardableResult public func forward() -> MacDestination? { guard canForward else { return nil }; index += 1; return current } |
| +} |
diff --git a/native/apple/Sources/EquipoKit/MacPower/MacTaskContext.swift b/native/apple/Sources/EquipoKit/MacPower/MacTaskContext.swift| new file mode 100644 |
| index 00000000..7f43c722 |
| --- /dev/null |
| +++ b/native/apple/Sources/EquipoKit/MacPower/MacTaskContext.swift |
| @@ -0,0 +1,68 @@ |
| +import Foundation |
| +import Observation |
| + |
| +public enum MacTaskAction: String, CaseIterable, Identifiable, Sendable { |
| + case merge, retry, move, web, cancel |
| + public var id: String { rawValue } |
| + public var title: String { |
| + switch self { |
| + case .merge: TaskAction.merge.title |
| + case .retry: TaskAction.retry.title |
| + case .move: TaskAction.move.title |
| + case .cancel: TaskAction.cancel.title |
| + case .web: EquipoStrings.text("task.open_web") |
| + } |
| + } |
| +} |
| + |
| +/// The menu and palette share the screen's existing model, including its |
| +/// current-revision checks, confirmations, move chooser and reviewed errors. |
| +@MainActor @Observable public final class MacTaskContext { |
| + let detail: TaskDetailModel |
| + @ObservationIgnored private var openWeb: ((URL, String) -> Void)? |
| + public var taskID: String { detail.taskID } |
| + public var title: String { detail.task?.title ?? EquipoStrings.text("task.title") } |
| + public var task: ThinTask? { detail.task } |
| + public private(set) var refused = false |
| + public init(session: EquipoSession, taskID: String) { detail = TaskDetailModel(session: session, taskID: taskID) } |
| + init(detail: TaskDetailModel, openWeb: ((URL, String) -> Void)? = nil) { self.detail = detail; self.openWeb = openWeb } |
| + public var actions: [MacTaskAction] { |
| + guard !detail.busy, !refused, detail.session.lifetime.isActive, |
| + let task = detail.task, detail.loaded?.revision == task.revision, detail.readFailure == nil else { return [] } |
| + var actions: [MacTaskAction] = [] |
| + if detail.rules.available.contains(.merge) || detail.decision.canAnswer("merge", note: "") { actions.append(.merge) } |
| + if detail.rules.available.contains(.retry) { actions.append(.retry) } |
| + if detail.rules.available.contains(.move) { actions.append(.move) } |
| + actions.append(.web) |
| + if detail.rules.available.contains(.cancel) { actions.append(.cancel) } |
| + return actions |
| + } |
| + public func load() async { |
| + let error = await detail.load() |
| + refused = [401, 403, 404].contains((error as? EquipoAPIError)?.status ?? 0) |
| + } |
| + public func refresh() async { await detail.session.refresh(); await load() } |
| + public func perform(_ action: MacTaskAction) async { |
| + guard actions.contains(action) else { return } |
| + switch action { |
| + case .merge: |
| + if let card = detail.decision.card, detail.decision.canAnswer("merge", note: "") { |
| + await detail.answer(card, choice: "merge", note: "") |
| + } else { await detail.perform(.merge) } |
| + case .retry: await detail.perform(.retry) |
| + case .cancel: await detail.perform(.cancel) |
| + case .move: await detail.beginMove() |
| + case .web: |
| + if let openWeb { SettingsNavigation.open(origin: detail.session.origin, path: "/tasks/\(taskID)") { openWeb($0, "/tasks/\(taskID)") } } |
| + else { detail.session.settings.open(origin: detail.session.origin, path: "/tasks/\(taskID)") } |
| + } |
| + } |
| +} |
| + |
| +public enum MacTaskWindowPolicy { |
| + public static func shouldClose(task: ThinTask?, initialRepo: String?, status: Int?) -> Bool { |
| + if let status, [401, 403, 404].contains(status) { return true } |
| + guard let task else { return false } |
| + return task.stage == "cancelled" || task.moving == true || (initialRepo != nil && task.repo != initialRepo) |
| + } |
| +} |
diff --git a/native/apple/Sources/EquipoKit/Push/PushRoute.swift b/native/apple/Sources/EquipoKit/Push/PushRoute.swift| index 892abc5e..338869c3 100644 |
| --- a/native/apple/Sources/EquipoKit/Push/PushRoute.swift |
| +++ b/native/apple/Sources/EquipoKit/Push/PushRoute.swift |
| @@ -50,7 +50,9 @@ public struct Destination: Equatable, Sendable { |
| public var pane: Pane |
| public var cardID: String? |
| public var taskID: String? |
| - public init(pane: Pane, cardID: String? = nil, taskID: String? = nil) { |
| - self.pane = pane; self.cardID = cardID; self.taskID = taskID |
| + public var projectID: String? |
| + public var focusComposer: Bool |
| + public init(pane: Pane, cardID: String? = nil, taskID: String? = nil, projectID: String? = nil, focusComposer: Bool = false) { |
| + self.pane = pane; self.cardID = cardID; self.taskID = taskID; self.projectID = projectID; self.focusComposer = focusComposer |
| } |
| } |
diff --git a/native/apple/Sources/EquipoKit/Resources/Localizable.xcstrings b/native/apple/Sources/EquipoKit/Resources/Localizable.xcstrings| index 47e4b98f..4d90c069 100644 |
| --- a/native/apple/Sources/EquipoKit/Resources/Localizable.xcstrings |
| +++ b/native/apple/Sources/EquipoKit/Resources/Localizable.xcstrings |
| @@ -1506,6 +1506,126 @@ |
| } |
| } |
| }, |
| + "native.mac.back": { |
| + "comment": "COPY APPROVED: Luna, 2026-11-27.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Back" |
| + } |
| + } |
| + } |
| + }, |
| + "native.mac.forward": { |
| + "comment": "COPY APPROVED: Luna, 2026-11-27.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Forward" |
| + } |
| + } |
| + } |
| + }, |
| + "native.mac.go": { |
| + "comment": "COPY APPROVED: Luna, 2026-11-27.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Go" |
| + } |
| + } |
| + } |
| + }, |
| + "native.mac.jump": { |
| + "comment": "COPY APPROVED: Luna, 2026-11-27.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Jump to…" |
| + } |
| + } |
| + } |
| + }, |
| + "native.mac.new_message": { |
| + "comment": "COPY APPROVED: Luna, 2026-11-27.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "New Message" |
| + } |
| + } |
| + } |
| + }, |
| + "native.mac.no_results": { |
| + "comment": "COPY APPROVED: Luna, 2026-11-27.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "No matches" |
| + } |
| + } |
| + } |
| + }, |
| + "native.mac.open_window": { |
| + "comment": "COPY APPROVED: Luna, 2026-11-27.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Open in New Window" |
| + } |
| + } |
| + } |
| + }, |
| + "native.mac.refresh": { |
| + "comment": "COPY APPROVED: Luna, 2026-11-27.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Refresh" |
| + } |
| + } |
| + } |
| + }, |
| + "native.mac.search": { |
| + "comment": "COPY APPROVED: Luna, 2026-11-27.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Search tasks, projects and actions" |
| + } |
| + } |
| + } |
| + }, |
| + "native.mac.selected_task": { |
| + "comment": "COPY APPROVED: Luna, 2026-11-27.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "For the selected task" |
| + } |
| + } |
| + } |
| + }, |
| "native.needs.done_at": { |
| "extractionState": "manual", |
| "localizations": { |
diff --git a/native/apple/Sources/EquipoKit/Session/EquipoSession.swift b/native/apple/Sources/EquipoKit/Session/EquipoSession.swift| index 6427c5df..a5cb7abb 100644 |
| --- a/native/apple/Sources/EquipoKit/Session/EquipoSession.swift |
| +++ b/native/apple/Sources/EquipoKit/Session/EquipoSession.swift |
| @@ -28,6 +28,8 @@ public final class EquipoSession { |
| /// A departing session can never become current again, even if a read |
| /// or credential renewal ignores cancellation and completes later. |
| + /// Local window identity, never sent or persisted as a credential. |
| + public let presentationID = UUID() |
| public let lifetime: SignInLifetime |
| let settings = SettingsPresentation() |
| let previews = PreviewPresentation() |
diff --git a/native/apple/Sources/EquipoKit/UI/Screens/TaskDetailScreen.swift b/native/apple/Sources/EquipoKit/UI/Screens/TaskDetailScreen.swift| index bea29989..8b270921 100644 |
| --- a/native/apple/Sources/EquipoKit/UI/Screens/TaskDetailScreen.swift |
| +++ b/native/apple/Sources/EquipoKit/UI/Screens/TaskDetailScreen.swift |
| @@ -17,12 +17,18 @@ enum TaskDetailTab: String, CaseIterable, Identifiable { |
| /// The same task detail on phone and Mac. The task owns its reads and keeps |
| /// the decision outside the scrolling evidence on every tab. |
| public struct TaskScreen: View { |
| + private let macContext: MacTaskContext? |
| @State private var model: TaskDetailModel |
| @State private var tab: TaskDetailTab = .overview |
| @State private var talking = false |
| public init(session: EquipoSession, taskID: String) { |
| + macContext = nil |
| _model = State(initialValue: TaskDetailModel(session: session, taskID: taskID)) |
| } |
| + public init(context: MacTaskContext) { |
| + macContext = context |
| + _model = State(initialValue: context.detail) |
| + } |
| public var body: some View { |
| @Bindable var model = model |
| VStack(spacing: 0) { |
| @@ -41,7 +47,7 @@ public struct TaskScreen: View { |
| heading(task) |
| if let failure = model.readFailure { |
| Text(failure).foregroundStyle(Palette.negative) |
| - Button(EquipoStrings.text("read.retry")) { Task { await model.load() } } |
| + Button(EquipoStrings.text("read.retry")) { Task { await load() } } |
| } |
| switch tab { |
| case .overview: overview(task) |
| @@ -67,7 +73,7 @@ public struct TaskScreen: View { |
| } else if let failure = model.readFailure { |
| ContentUnavailableView { Label(EquipoStrings.text("read.failed_title"), systemImage: "wifi.exclamationmark") } |
| description: { Text(failure) } |
| - actions: { Button(EquipoStrings.text("read.retry")) { Task { await model.load() } } } |
| + actions: { Button(EquipoStrings.text("read.retry")) { Task { await load() } } } |
| } else { ProgressView().accessibilityLabel(EquipoStrings.text("work.details.task")) } |
| } |
| .scrollDismissesKeyboard(.interactively) |
| @@ -77,8 +83,8 @@ public struct TaskScreen: View { |
| if (ProcessInfo.processInfo.environment["EQUIPO_TASK_FIXTURE"] ?? "").hasPrefix("changes") { tab = .changes } |
| } |
| #endif |
| - .task(id: model.session.task(model.taskID)?.revision) { await model.load() } |
| - .refreshable { await model.session.refresh(); await model.load() } |
| + .task(id: ReadKey(revision: model.session.task(model.taskID)?.revision, cursor: macContext == nil ? nil : model.session.cursor)) { await load() } |
| + .refreshable { await model.session.refresh(); await load() } |
| .sheet(item: $model.confirmation) { confirm in TaskConfirmationSheet(model: model, confirmation: confirm) } |
| .sheet(isPresented: $model.moving) { TaskMoveSheet(model: model) } |
| .modifier(PreviewSheetPresenter(session: model.session)) |
| @@ -86,6 +92,11 @@ public struct TaskScreen: View { |
| .onChange(of: model.decision.card?.id) { model.directionNote = "" } |
| } |
| + private struct ReadKey: Equatable { let revision: Int64?; let cursor: Int64? } |
| + private func load() async { |
| + if let macContext { await macContext.load() } else { await model.load() } |
| + } |
| + |
| private func heading(_ task: ThinTask) -> some View { |
| let report = TaskReport(task, needsYou: model.session.waitsOnYou(task), mine: model.session.isMine(task)) |
| return VStack(alignment: .leading, spacing: 10) { |
| @@ -116,7 +127,7 @@ public struct TaskScreen: View { |
| Panel { StepsView(task: task, client: model.session.client) } |
| } |
| Button(talking ? EquipoStrings.text("task.hide_talk") : EquipoStrings.text("task.talk")) { talking.toggle() } |
| - if talking { TaskThread(session: model.session, task: task) { Task { await model.load() } } } |
| + if talking { TaskThread(session: model.session, task: task) { Task { await load() } } } |
| Button(EquipoStrings.text("task.open_web")) { openWeb(task) } |
| } |
| private func detail(_ label: String, _ value: String) -> some View { |
diff --git a/native/apple/Sources/EquipoMac/EquipoMacApp.swift b/native/apple/Sources/EquipoMac/EquipoMacApp.swift| index cebc01f4..b54fa150 100644 |
| --- a/native/apple/Sources/EquipoMac/EquipoMacApp.swift |
| +++ b/native/apple/Sources/EquipoMac/EquipoMacApp.swift |
| @@ -6,7 +6,7 @@ import EquipoKit |
| import RastrilloApple |
| import SwiftUI |
| -/// Equipo for the Mac. One window: pairing until there is a team, then the |
| +/// Equipo for the Mac. Pairing until there is a team, then the |
| /// conversation, Needs you and Tasks. Settings shows the team and this |
| /// device, and signs out. |
| @main struct EquipoMacApp: App { |
| @@ -19,17 +19,18 @@ import SwiftUI |
| #if DEBUG |
| // Offline fixture captures must run this build, without an updater |
| // replacing it with a published app during the capture. |
| - if ProcessInfo.processInfo.environment["EQUIPO_PREVIEW_FIXTURE"] != nil || ProcessInfo.processInfo.environment["EQUIPO_TASK_FIXTURE"] != nil || ProcessInfo.processInfo.environment["EQUIPO_NEEDS_FIXTURE"] != nil || ProcessInfo.processInfo.environment["EQUIPO_STOPPED_FIXTURE"] != nil || ProcessInfo.processInfo.environment["EQUIPO_ATTACHMENTS_FIXTURE"] != nil { return nil } |
| + if ProcessInfo.processInfo.environment["EQUIPO_MAC_POWER_FIXTURE"] != nil || ProcessInfo.processInfo.environment["EQUIPO_PREVIEW_FIXTURE"] != nil || ProcessInfo.processInfo.environment["EQUIPO_TASK_FIXTURE"] != nil || ProcessInfo.processInfo.environment["EQUIPO_NEEDS_FIXTURE"] != nil || ProcessInfo.processInfo.environment["EQUIPO_STOPPED_FIXTURE"] != nil || ProcessInfo.processInfo.environment["EQUIPO_ATTACHMENTS_FIXTURE"] != nil { return nil } |
| #endif |
| return NativeUpdater(policy: .quiet) |
| }() |
| #endif |
| var body: some Scene { |
| - WindowGroup(EquipoStrings.text("app.name")) { |
| + Window(EquipoStrings.text("app.name"), id: "main") { |
| Group { |
| #if DEBUG |
| - if ProcessInfo.processInfo.environment["EQUIPO_PREVIEW_FIXTURE"] != nil { PreviewFixture() } |
| + if ProcessInfo.processInfo.environment["EQUIPO_MAC_POWER_FIXTURE"] != nil { MacPowerFixture(model: model) } |
| + else if ProcessInfo.processInfo.environment["EQUIPO_PREVIEW_FIXTURE"] != nil { PreviewFixture() } |
| else if ProcessInfo.processInfo.environment["EQUIPO_NEEDS_FIXTURE"] != nil { MacNeedsFixture() } |
| else if ProcessInfo.processInfo.environment["EQUIPO_STOPPED_FIXTURE"]?.hasPrefix("conversation-") == true { StoppedConversationFixture() } |
| else if ProcessInfo.processInfo.environment["EQUIPO_STOPPED_FIXTURE"] != nil { StoppedWorkFixture() } |
| @@ -50,10 +51,14 @@ import SwiftUI |
| .commands { |
| // First: About, Hide and Quit say "Equipo", not the Finder name. |
| PlainAppNameCommands() |
| + MacPowerCommands() |
| #if canImport(RastrilloMacUpdates) |
| if let updater { NativeUpdateCommands(updater: updater) } |
| #endif |
| } |
| + WindowGroup(EquipoStrings.text("task.title"), id: "task", for: MacTaskWindowID.self) { $identity in |
| + MacTaskWindow(model: model, identity: identity) |
| + }.defaultSize(width: 820, height: 900) |
| Settings { MacSettings(model: model) } |
| } |
| } |
| @@ -65,7 +70,12 @@ import SwiftUI |
| @MainActor |
| final class EquipoMacDelegate: NSObject, NSApplicationDelegate { |
| let notifications = SystemNotifications() |
| - private(set) lazy var model = EquipoAppModel(notifications: notifications) |
| + private(set) lazy var model: EquipoAppModel = { |
| + #if DEBUG |
| + if ProcessInfo.processInfo.environment["EQUIPO_MAC_POWER_FIXTURE"] != nil { return NeedsViewFixture.makeModel() } |
| + #endif |
| + return EquipoAppModel(notifications: notifications) |
| + }() |
| func applicationWillFinishLaunching(_ notification: Notification) { |
| notifications.onRoute = { [weak self] route in |
| @@ -97,14 +107,7 @@ struct MacRoot: View { |
| } |
| .tint(Color(nsColor: .webAccent)) |
| .frame(minWidth: 860, minHeight: 560) |
| - .task { model.foreground(); await model.runRenewals() } |
| - .onReceive(NotificationCenter.default.publisher(for: NSApplication.didBecomeActiveNotification)) { _ in model.foreground() } |
| - // Live while a window can be seen, even beside another app. |
| - .onReceive(NotificationCenter.default.publisher(for: NSApplication.didChangeOcclusionStateNotification)) { _ in |
| - NSApp.occlusionState.contains(.visible) ? model.foreground() : model.background() |
| - } |
| - .onChange(of: model.session?.status) { _, status in if status == .signedOut { model.sessionEnded() } } |
| - .onChange(of: model.session?.needsYouCount) { _, count in model.needsYouChanged(count) } |
| + .modifier(MacSessionLifecycle(model: model)) |
| } |
| } |
| @@ -123,3 +126,18 @@ struct MacSettings: View { |
| .padding(.vertical, 8) |
| } |
| } |
| + |
| +struct MacSessionLifecycle: ViewModifier { |
| + let model: EquipoAppModel |
| + func body(content: Content) -> some View { |
| + content |
| + .task { model.foreground(); await model.runRenewals() } |
| + .onReceive(NotificationCenter.default.publisher(for: NSApplication.didBecomeActiveNotification)) { _ in model.foreground() } |
| + // Live while a window can be seen, even beside another app. |
| + .onReceive(NotificationCenter.default.publisher(for: NSApplication.didChangeOcclusionStateNotification)) { _ in |
| + NSApp.occlusionState.contains(.visible) ? model.foreground() : model.background() |
| + } |
| + .onChange(of: model.session?.status) { _, status in if status == .signedOut { model.sessionEnded() } } |
| + .onChange(of: model.session?.needsYouCount) { _, count in model.needsYouChanged(count) } |
| + } |
| +} |
diff --git a/native/apple/Sources/EquipoMac/LiveTranscript.swift b/native/apple/Sources/EquipoMac/LiveTranscript.swift| index 633c7295..e8fde92b 100644 |
| --- a/native/apple/Sources/EquipoMac/LiveTranscript.swift |
| +++ b/native/apple/Sources/EquipoMac/LiveTranscript.swift |
| @@ -57,6 +57,15 @@ final class LiveTranscript: NSView { |
| private var contentHeight: CGFloat = 0 |
| private var laidOutWidth: CGFloat = 0 |
| private var hasScrolledOnce = false |
| + private var wantsComposerFocus = false |
| + func focusComposer() { |
| + wantsComposerFocus = true |
| + if let window { window.makeFirstResponder(composer.editor); wantsComposerFocus = false } |
| + } |
| + override func viewDidMoveToWindow() { |
| + super.viewDidMoveToWindow() |
| + if wantsComposerFocus { focusComposer() } |
| + } |
| init(session: EquipoSession, openTask: @escaping (String) -> Void) { |
| self.session = session |
| @@ -647,6 +656,9 @@ struct TranscriptView: NSViewRepresentable { |
| let session: EquipoSession |
| @Binding var focusCard: String? |
| var openTask: (String) -> Void |
| + var composerFocus: Int = 0 |
| + final class Coordinator { var focus = -1 } |
| + func makeCoordinator() -> Coordinator { Coordinator() } |
| func makeNSView(context: Context) -> LiveTranscript { |
| let view = LiveTranscript(session: session, openTask: openTask) |
| @@ -658,6 +670,13 @@ struct TranscriptView: NSViewRepresentable { |
| view.openTask = openTask |
| view.update(items: items) |
| focus(view) |
| + if context.coordinator.focus != composerFocus { |
| + context.coordinator.focus = composerFocus |
| + if composerFocus > 0 { Task { @MainActor [weak view] in |
| + guard let view else { return } |
| + view.focusComposer() |
| + } } |
| + } |
| } |
| /// Brings the card into view once the feed has it; reads again if not yet. |
| private func focus(_ view: LiveTranscript) { |
diff --git a/native/apple/Sources/EquipoMac/MacJumpPalette.swift b/native/apple/Sources/EquipoMac/MacJumpPalette.swift| new file mode 100644 |
| index 00000000..94b33a6b |
| --- /dev/null |
| +++ b/native/apple/Sources/EquipoMac/MacJumpPalette.swift |
| @@ -0,0 +1,150 @@ |
| +import EquipoKit |
| +import SwiftUI |
| + |
| +struct MacJumpPalette: View { |
| + @Bindable var workspace: MacWorkspace |
| + @Environment(\.dismiss) private var dismiss |
| + @Environment(\.openWindow) private var openWindow |
| + @FocusState private var searchFocused: Bool |
| + @State private var query = "" |
| + @State private var selected: MacDestination? |
| + @State private var selectedAction: MacTaskAction? |
| + @State private var taskContext: MacTaskContext? |
| + |
| + private var results: [MacJumpResult] { workspace.index.results(query) } |
| + private var taskResults: [MacJumpResult] { results.filter { if case .task = $0.target { true } else { false } } } |
| + private var otherResults: [MacJumpResult] { results.filter { if case .task = $0.target { false } else { true } } } |
| + private var context: MacTaskContext? { workspace.standalone ? workspace.context : taskContext ?? workspace.context } |
| + private var actions: [MacTaskAction] { |
| + guard let context else { return [] } |
| + // Task matches keep their actions visible while a title is typed. |
| + return context.actions.filter { !results.isEmpty || MacJumpIndex.score(query, in: $0.title) != nil } |
| + } |
| + private var rowIDs: [String] { taskResults.map { String(describing: $0.id) } + actions.map { "action:" + $0.rawValue } + otherResults.map { String(describing: $0.id) } } |
| + private var selectedID: String? { selectedAction.map { "action:" + $0.rawValue } ?? selected.map { String(describing: $0) } } |
| + |
| + var body: some View { |
| + VStack(alignment: .leading, spacing: 0) { |
| + TextField(EquipoStrings.text("native.mac.search"), text: $query) |
| + .textFieldStyle(.plain).font(.title3).padding(20).focused($searchFocused) |
| + .accessibilityIdentifier("mac-jump-search") |
| + Divider() |
| + ScrollViewReader { proxy in |
| + ScrollView { |
| + LazyVStack(alignment: .leading, spacing: 3) { |
| + ForEach(taskResults) { result in resultRow(result) } |
| + if !actions.isEmpty, let context { |
| + VStack(alignment: .leading, spacing: 4) { |
| + Text(EquipoStrings.text("native.mac.selected_task")).font(.caption).foregroundStyle(.secondary) |
| + Text(context.title).font(.callout.weight(.medium)).lineLimit(2) |
| + }.padding(10) |
| + ForEach(actions) { action in actionRow(action) } |
| + } |
| + ForEach(otherResults) { result in resultRow(result) } |
| + if results.isEmpty && actions.isEmpty { |
| + Text(EquipoStrings.text("native.mac.no_results")).foregroundStyle(.secondary).padding(20) |
| + } |
| + }.padding(10) |
| + }.frame(height: 380) |
| + .onChange(of: selectedID) { _, id in if let id { proxy.scrollTo(id) } } |
| + } |
| + Divider() |
| + HStack { |
| + Button(EquipoStrings.text("chat.card.not_now"), role: .cancel) { dismiss() } |
| + Spacer() |
| + Button(EquipoStrings.text("native.mac.open_window")) { |
| + if let selected { activate(selected, window: true) } |
| + }.disabled(!selectedIsTask) |
| + }.padding(12) |
| + } |
| + .frame(width: 620) |
| + .background(Color(nsColor: .webBackground)) |
| + .defaultFocus($searchFocused, true) |
| + .onAppear { |
| + resetSelection() |
| + #if DEBUG |
| + if ProcessInfo.processInfo.environment["EQUIPO_MAC_POWER_FIXTURE"] == "palette" { query = "button" } |
| + #endif |
| + } |
| + .onChange(of: query) { resetSelection() } |
| + .onChange(of: rowIDs) { if selectedID == nil || !rowIDs.contains(selectedID!) { resetSelection() } } |
| + .onKeyPress(.downArrow) { move(1); return .handled } |
| + .onKeyPress(.upArrow) { move(-1); return .handled } |
| + .onKeyPress(keys: [.return], phases: .down) { event in |
| + if let action = selectedAction { activate(action) } |
| + else if let selected { activate(selected, window: event.modifiers.contains(.command)) } |
| + return .handled |
| + } |
| + .onExitCommand { dismiss() } |
| + .task(id: taskContext?.taskID) { await taskContext?.load() } |
| + .accessibilityLabel(EquipoStrings.text("native.mac.jump")) |
| + } |
| + private func resultRow(_ result: MacJumpResult) -> some View { |
| + Button { activate(result.target, window: false) } label: { |
| + HStack { |
| + Image(systemName: symbol(result.target)) |
| + VStack(alignment: .leading, spacing: 3) { |
| + Text(result.title).lineLimit(2) |
| + if !result.subtitle.isEmpty { Text(result.subtitle).font(.caption).foregroundStyle(.secondary) } |
| + } |
| + Spacer() |
| + if result.needsYou { Image(systemName: "tray").accessibilityLabel(EquipoStrings.text("tab.needs")) } |
| + }.frame(maxWidth: .infinity, alignment: .leading).padding(10) |
| + } |
| + .buttonStyle(.plain) |
| + .background(selected == result.target && selectedAction == nil ? Color.accentColor.opacity(0.14) : .clear, in: .rect(cornerRadius: 7)) |
| + .accessibilityAddTraits(selected == result.target && selectedAction == nil ? .isSelected : []) |
| + .id(String(describing: result.id)) |
| + } |
| + private func actionRow(_ action: MacTaskAction) -> some View { |
| + Button(action.title, role: action == .cancel ? .destructive : nil) { activate(action) } |
| + .buttonStyle(.plain).padding(10).frame(maxWidth: .infinity, alignment: .leading) |
| + .background(selectedAction == action ? Color.accentColor.opacity(0.14) : .clear, in: .rect(cornerRadius: 7)) |
| + .accessibilityAddTraits(selectedAction == action ? .isSelected : []) |
| + .id("action:" + action.rawValue) |
| + } |
| + private var selectedIsTask: Bool { if case .task = selected, selectedAction == nil { true } else { false } } |
| + private func resetSelection() { select(results.first?.target); selectedAction = results.isEmpty ? actions.first : nil } |
| + private func select(_ target: MacDestination?) { |
| + selected = target |
| + if case .task(let id) = target, taskContext?.taskID != id { |
| + taskContext = workspace.context?.taskID == id ? workspace.context : MacTaskContext(session: workspace.session, taskID: id) |
| + } |
| + } |
| + private func move(_ offset: Int) { |
| + let ids = rowIDs |
| + guard !ids.isEmpty else { return } |
| + let previous = selectedID.flatMap { ids.firstIndex(of: $0) } ?? (offset > 0 ? -1 : ids.count) |
| + let index = min(max(previous + offset, 0), ids.count - 1) |
| + let id = ids[index] |
| + if let result = results.first(where: { String(describing: $0.id) == id }) { selectedAction = nil; select(result.target) } |
| + else { selectedAction = actions.first { "action:" + $0.rawValue == id } } |
| + } |
| + private func activate(_ target: MacDestination, window: Bool) { |
| + if window, case .task(let id) = target { |
| + openWindow(id: "task", value: MacTaskWindowID(taskID: id, session: workspace.session)) |
| + } else { workspace.go(target); if workspace.standalone { openWindow(id: "main") } } |
| + dismiss() |
| + } |
| + private func activate(_ action: MacTaskAction) { |
| + guard let context, context.actions.contains(action) else { return } |
| + workspace.context = context; workspace.inspector = true |
| + workspace.pendingAction = action |
| + dismiss() |
| + } |
| + private func symbol(_ target: MacDestination) -> String { |
| + switch target { case .task: "checklist"; case .project: "folder"; case .pane(.conversation): "bubble.left.and.bubble.right"; case .pane(.needs): "tray"; case .pane(.tasks): "checklist"; case .pane(.projects): "folder" } |
| + } |
| +} |
| + |
| +struct MacWorkspacePresenter: ViewModifier { |
| + @Bindable var workspace: MacWorkspace |
| + func body(content: Content) -> some View { |
| + content.focusedSceneValue(\.macWorkspace, workspace) |
| + .sheet(isPresented: $workspace.palette, onDismiss: { |
| + let action = workspace.pendingAction, context = workspace.context |
| + workspace.pendingAction = nil |
| + if let action { Task { await context?.perform(action) } } |
| + }) { MacJumpPalette(workspace: workspace) } |
| + } |
| +} |
diff --git a/native/apple/Sources/EquipoMac/MacMainView.swift b/native/apple/Sources/EquipoMac/MacMainView.swift| index 0c2f633f..d567e028 100644 |
| --- a/native/apple/Sources/EquipoMac/MacMainView.swift |
| +++ b/native/apple/Sources/EquipoMac/MacMainView.swift |
| @@ -9,16 +9,16 @@ struct MacMainView: View { |
| let session: EquipoSession |
| typealias Pane = Destination.Pane |
| - @State private var pane: Pane = .conversation |
| - @State private var inspectedTask: String? |
| - @State private var inspectedProject: String? |
| - @State private var showsInspector = false |
| - /// A card to bring into view (a tapped notification). |
| - @State private var focusCard: String? |
| + @State private var workspace: MacWorkspace |
| + init(model: EquipoAppModel, session: EquipoSession) { |
| + self.model = model; self.session = session |
| + _workspace = State(initialValue: MacWorkspace(app: model, session: session)) |
| + } |
| var body: some View { |
| + @Bindable var workspace = workspace |
| NavigationSplitView { |
| - List(selection: $pane) { |
| + List(selection: Binding(get: { workspace.pane }, set: { workspace.go(.pane($0)) })) { |
| Label(EquipoStrings.text("tab.conversation"), systemImage: "bubble.left.and.bubble.right").tag(Pane.conversation) |
| needsRow.tag(Pane.needs) |
| Label(EquipoStrings.text("tab.tasks"), systemImage: "checklist").tag(Pane.tasks) |
| @@ -30,15 +30,16 @@ struct MacMainView: View { |
| detail |
| .safeAreaInset(edge: .top, spacing: 0) { NativeOfflineBanner(origin: session.origin) } |
| .navigationTitle(session.teamName) |
| - .navigationSubtitle(title(for: pane)) |
| + .navigationSubtitle(title(for: workspace.pane)) |
| } |
| - .inspector(isPresented: $showsInspector) { |
| + .inspector(isPresented: $workspace.inspector) { |
| Group { |
| - if let id = inspectedTask { TaskScreen(session: session, taskID: id).id(id) } |
| + if let context = workspace.context { TaskScreen(context: context).id(context.taskID) } |
| else { Text(EquipoStrings.text("task.none_selected")).foregroundStyle(.secondary) } |
| } |
| .inspectorColumnWidth(min: 300, ideal: 360, max: 480) |
| } |
| + .modifier(MacWorkspacePresenter(workspace: workspace)) |
| .onChange(of: model.destination, initial: true) { _, destination in |
| guard let destination else { return } |
| go(destination) |
| @@ -47,7 +48,7 @@ struct MacMainView: View { |
| .toolbar { |
| ToolbarItem(placement: .primaryAction) { needsPill } |
| ToolbarItem(placement: .primaryAction) { |
| - Button { showsInspector.toggle() } label: { Image(systemName: "sidebar.right") } |
| + Button { workspace.inspector.toggle() } label: { Image(systemName: "sidebar.right") } |
| .help(EquipoStrings.text("task.inspector")) |
| .accessibilityLabel(EquipoStrings.text("task.inspector")) |
| } |
| @@ -55,17 +56,17 @@ struct MacMainView: View { |
| } |
| @ViewBuilder private var detail: some View { |
| - switch pane { |
| + switch workspace.pane { |
| case .conversation: |
| - TranscriptView(projectSelectionID: session.projectCatalog.selection?.id, projectSelectionNotice: session.projectCatalog.selectionNotice, items: Feed.build(session), session: session, focusCard: $focusCard, openTask: open) |
| + TranscriptView(projectSelectionID: session.projectCatalog.selection?.id, projectSelectionNotice: session.projectCatalog.selectionNotice, items: Feed.build(session), session: session, focusCard: Binding(get: { workspace.focusCard }, set: { workspace.focusCard = $0 }), openTask: open, composerFocus: workspace.composerFocus) |
| case .projects: |
| HStack(spacing: 0) { |
| - ProjectsScreen(session: session) { inspectedProject = $0 } |
| + ProjectsScreen(session: session) { workspace.go(.project($0)) } |
| .frame(minWidth: 260, idealWidth: 340, maxWidth: 420) |
| Divider() |
| - if let id = inspectedProject { |
| + if let id = workspace.projectID { |
| ProjectDetailScreen(session: session, projectID: id) { project in |
| - session.projectCatalog.selection = project; pane = .conversation |
| + session.projectCatalog.selection = project; workspace.go(.pane(.conversation)) |
| } openTask: { open($0) } |
| } else { Color.clear.frame(maxWidth: .infinity) } |
| } |
| @@ -86,7 +87,7 @@ struct MacMainView: View { |
| /// The web's Needs you pill: an inbox and its count, only when known. |
| private var needsPill: some View { |
| - Button { pane = .needs } label: { |
| + Button { workspace.go(.pane(.needs)) } label: { |
| HStack(spacing: 6) { |
| Image(systemName: "tray") |
| if let count = session.needsYouCount { Text(count.formatted()).monospacedDigit() } |
| @@ -108,13 +109,14 @@ struct MacMainView: View { |
| /// A tapped notification: the conversation at its card, or the task in |
| /// the inspector beside Tasks. |
| private func go(_ destination: Destination) { |
| - pane = destination.pane |
| - focusCard = destination.cardID |
| + workspace.go(.pane(destination.pane)) |
| + workspace.focusCard = destination.cardID |
| + if destination.focusComposer { workspace.composerFocus += 1 } |
| + if let project = destination.projectID { workspace.go(.project(project)) } |
| if let task = destination.taskID { open(task) } |
| } |
| private func open(_ taskID: String) { |
| - inspectedTask = taskID |
| - showsInspector = true |
| + workspace.go(.task(taskID)) |
| } |
| } |
diff --git a/native/apple/Sources/EquipoMac/MacPowerCommands.swift b/native/apple/Sources/EquipoMac/MacPowerCommands.swift| new file mode 100644 |
| index 00000000..0ad009e4 |
| --- /dev/null |
| +++ b/native/apple/Sources/EquipoMac/MacPowerCommands.swift |
| @@ -0,0 +1,57 @@ |
| +import AppKit |
| +import EquipoKit |
| +import SwiftUI |
| + |
| +struct MacPowerCommands: Commands { |
| + @FocusedValue(\.macWorkspace) private var workspace |
| + @Environment(\.openWindow) private var openWindow |
| + var body: some Commands { |
| + CommandGroup(replacing: .newItem) { |
| + Button(EquipoStrings.text("native.mac.new_message")) { |
| + if let workspace { workspace.newMessage(); if workspace.standalone { openWindow(id: "main") } } |
| + else { openWindow(id: "main") } |
| + }.keyboardShortcut("n") |
| + } |
| + CommandMenu(EquipoStrings.text("native.mac.go")) { |
| + Button(EquipoStrings.text("native.mac.jump")) { workspace?.palette = true }.keyboardShortcut("k").disabled(workspace == nil) |
| + Divider() |
| + pane("tab.conversation", .conversation, "1") |
| + pane("tab.needs", .needs, "2") |
| + pane("tab.tasks", .tasks, "3") |
| + pane("nav.projects", .projects, "4") |
| + Divider() |
| + Button(EquipoStrings.text("native.mac.back")) { workspace?.back() }.keyboardShortcut("[").disabled(workspace?.history.canBack != true || workspace?.standalone == true) |
| + Button(EquipoStrings.text("native.mac.forward")) { workspace?.forward() }.keyboardShortcut("]").disabled(workspace?.history.canForward != true || workspace?.standalone == true) |
| + Button(EquipoStrings.text("native.mac.refresh")) { Task { await workspace?.refresh() } }.keyboardShortcut("r").disabled(workspace == nil) |
| + } |
| + CommandMenu(EquipoStrings.text("task.title")) { |
| + Button(EquipoStrings.text("native.mac.open_window")) { |
| + if let workspace, let context = workspace.context { |
| + openWindow(id: "task", value: MacTaskWindowID(taskID: context.taskID, session: workspace.session)) |
| + } |
| + }.disabled(workspace?.context == nil) |
| + // ⌘Return belongs to Send in an editor, and opens a task only in |
| + // the palette. No global shortcut can steal an unfinished message. |
| + Divider() |
| + action(.merge, shortcut: "m") |
| + action(.retry) |
| + action(.move) |
| + action(.web) |
| + Divider() |
| + action(.cancel) |
| + } |
| + } |
| + private func pane(_ key: String, _ pane: Destination.Pane, _ keyEquivalent: KeyEquivalent) -> some View { |
| + Button(EquipoStrings.text(.init(key))) { |
| + workspace?.go(.pane(pane)); if workspace?.standalone == true { openWindow(id: "main") } |
| + }.keyboardShortcut(keyEquivalent).disabled(workspace == nil) |
| + } |
| + @ViewBuilder private func action(_ action: MacTaskAction, shortcut: KeyEquivalent? = nil) -> some View { |
| + let button = Button(action.title, role: action == .cancel ? .destructive : nil) { |
| + let context = workspace?.context |
| + Task { await context?.perform(action) } |
| + }.disabled(workspace?.context?.actions.contains(action) != true || workspace?.palette == true) |
| + if let shortcut { button.keyboardShortcut(shortcut, modifiers: [.command, .shift]) } |
| + else { button } |
| + } |
| +} |
diff --git a/native/apple/Sources/EquipoMac/MacPowerFixture.swift b/native/apple/Sources/EquipoMac/MacPowerFixture.swift| new file mode 100644 |
| index 00000000..415ac0bf |
| --- /dev/null |
| +++ b/native/apple/Sources/EquipoMac/MacPowerFixture.swift |
| @@ -0,0 +1,47 @@ |
| +#if DEBUG |
| +import AppKit |
| +import EquipoKit |
| +import SwiftUI |
| + |
| +/// Offline evidence from the real main window, commands and task WindowGroup. |
| +struct MacPowerFixture: View { |
| + let model: EquipoAppModel |
| + @Environment(\.openWindow) private var openWindow |
| + var body: some View { |
| + if let session = model.session { |
| + MacMainView(model: model, session: session) |
| + .preferredColorScheme(.light) |
| + .task { |
| + await session.refresh() |
| + guard let task = session.tasks.first(where: { $0.needsYou == "merge" }) else { return } |
| + model.destination = Destination(pane: .tasks, taskID: task.id) |
| + try? await Task.sleep(for: .seconds(2)) |
| + let mode = ProcessInfo.processInfo.environment["EQUIPO_MAC_POWER_FIXTURE"] ?? "palette" |
| + if mode == "window" { |
| + openWindow(id: "task", value: MacTaskWindowID(taskID: task.id, session: session)) |
| + } else { |
| + NSApp.activate() |
| + NSApp.windows.first { $0.isVisible && !$0.isSheet }?.makeKeyAndOrderFront(nil) |
| + let event = NSEvent.keyEvent(with: .keyDown, location: .zero, modifierFlags: mode == "merge" ? [.command, .shift] : .command, |
| + timestamp: 0, windowNumber: NSApp.keyWindow?.windowNumber ?? 0, context: nil, |
| + characters: mode == "merge" ? "M" : "k", charactersIgnoringModifiers: mode == "merge" ? "m" : "k", isARepeat: false, keyCode: mode == "merge" ? 46 : 40)! |
| + let invoked = NSApp.mainMenu?.performKeyEquivalent(with: event) == true |
| + print("Mac power fixture command invoked: \(invoked)") |
| + } |
| + try? await Task.sleep(for: .seconds(2)) |
| + guard let path = ProcessInfo.processInfo.environment["EQUIPO_FIXTURE_CAPTURE"] else { return } |
| + let windows = NSApp.windows.filter { $0.isVisible } |
| + let window = mode == "window" ? windows.last(where: { !$0.isSheet && $0.title != "Oficina" }) : windows.first(where: \.isSheet) ?? NSApp.keyWindow |
| + guard let window, let view = window.contentView else { return } |
| + window.appearance = NSAppearance(named: .aqua) |
| + view.layoutSubtreeIfNeeded(); window.displayIfNeeded() |
| + if let bitmap = view.bitmapImageRepForCachingDisplay(in: view.bounds) { |
| + view.cacheDisplay(in: view.bounds, to: bitmap) |
| + try? bitmap.representation(using: .png, properties: [:])?.write(to: URL(fileURLWithPath: path)) |
| + } |
| + print("Mac power fixture captured: \(window.title)") |
| + } |
| + } |
| + } |
| +} |
| +#endif |
diff --git a/native/apple/Sources/EquipoMac/MacTaskWindow.swift b/native/apple/Sources/EquipoMac/MacTaskWindow.swift| new file mode 100644 |
| index 00000000..fe609d9c |
| --- /dev/null |
| +++ b/native/apple/Sources/EquipoMac/MacTaskWindow.swift |
| @@ -0,0 +1,44 @@ |
| +import EquipoKit |
| +import SwiftUI |
| + |
| +struct MacTaskWindow: View { |
| + let model: EquipoAppModel |
| + let identity: MacTaskWindowID? |
| + @Environment(\.dismiss) private var dismiss |
| + var body: some View { |
| + Group { |
| + if let identity, let session = model.session, identity.matches(session), !model.needsPairing { |
| + MacTaskWindowContent(app: model, session: session, identity: identity) |
| + .id(identity) |
| + } else { Color.clear.task { dismiss() } } |
| + }.modifier(MacSessionLifecycle(model: model)) |
| + } |
| +} |
| + |
| +private struct MacTaskWindowContent: View { |
| + let session: EquipoSession |
| + let identity: MacTaskWindowID |
| + @State private var workspace: MacWorkspace |
| + @State private var initialRepo: String? |
| + @Environment(\.dismiss) private var dismiss |
| + init(app: EquipoAppModel, session: EquipoSession, identity: MacTaskWindowID) { |
| + self.session = session; self.identity = identity |
| + _workspace = State(initialValue: MacWorkspace(app: app, session: session, taskID: identity.taskID)) |
| + _initialRepo = State(initialValue: session.task(identity.taskID)?.repo) |
| + } |
| + private var shouldClose: Bool { |
| + workspace.context?.refused == true || !identity.matches(session) || |
| + MacTaskWindowPolicy.shouldClose(task: workspace.context?.task, initialRepo: initialRepo, status: nil) |
| + } |
| + var body: some View { |
| + Group { |
| + if let context = workspace.context { TaskScreen(context: context) } |
| + } |
| + .navigationTitle(workspace.context?.title ?? EquipoStrings.text("task.title")) |
| + .frame(minWidth: 520, minHeight: 480) |
| + .modifier(MacWorkspacePresenter(workspace: workspace)) |
| + .onChange(of: shouldClose, initial: true) { _, close in if close { dismiss() } } |
| + .onChange(of: workspace.context?.task?.repo) { _, repo in if initialRepo == nil { initialRepo = repo } } |
| + |
| + } |
| +} |
diff --git a/native/apple/Sources/EquipoMac/MacWorkspace.swift b/native/apple/Sources/EquipoMac/MacWorkspace.swift| new file mode 100644 |
| index 00000000..c4e32eaa |
| --- /dev/null |
| +++ b/native/apple/Sources/EquipoMac/MacWorkspace.swift |
| @@ -0,0 +1,72 @@ |
| +import EquipoKit |
| +import Observation |
| +import SwiftUI |
| + |
| +extension FocusedValues { |
| + @Entry var macWorkspace: MacWorkspace? |
| +} |
| + |
| +/// One focused window's navigation and task selection. Commands never use a |
| +/// global selected task, so moving focus between windows changes authority. |
| +@MainActor @Observable final class MacWorkspace { |
| + let session: EquipoSession |
| + let app: EquipoAppModel |
| + let standalone: Bool |
| + let history = MacNavigationHistory() |
| + var pane = Destination.Pane.conversation |
| + var projectID: String? |
| + var focusCard: String? |
| + var inspector = false |
| + var palette = false |
| + var pendingAction: MacTaskAction? |
| + var composerFocus = 0 |
| + var context: MacTaskContext? |
| + var mainRequest = 0 |
| + init(app: EquipoAppModel, session: EquipoSession, taskID: String? = nil) { |
| + self.app = app; self.session = session; standalone = taskID != nil |
| + if let taskID { context = MacTaskContext(session: session, taskID: taskID) } |
| + } |
| + var index: MacJumpIndex { MacJumpIndex(tasks: session.tasks, needs: session.needsYou ?? [], projects: session.projectCatalog.items) } |
| + func go(_ destination: MacDestination, record: Bool = true) { |
| + if standalone { |
| + switch destination { |
| + case .pane(let pane): app.destination = Destination(pane: pane) |
| + case .task(let id): app.destination = Destination(pane: .tasks, taskID: id) |
| + case .project(let id): app.destination = Destination(pane: .projects, projectID: id) |
| + } |
| + mainRequest += 1 |
| + return |
| + } |
| + if record { history.go(destination) } |
| + switch destination { |
| + case .pane(let value): pane = value; inspector = false; context = nil |
| + case .project(let id): pane = .projects; projectID = id |
| + case .task(let id): |
| + pane = history.pane |
| + if context?.taskID != id { context = MacTaskContext(session: session, taskID: id) } |
| + inspector = true |
| + } |
| + } |
| + func back() { if let destination = history.back() { go(destination, record: false) } } |
| + func forward() { if let destination = history.forward() { go(destination, record: false) } } |
| + func newMessage() { |
| + go(.pane(.conversation)); composerFocus += 1 |
| + if standalone { app.destination = Destination(pane: .conversation, focusComposer: true) } |
| + } |
| + func refresh() async { if let context { await context.refresh() } else { await session.refresh() } } |
| +} |
| + |
| +struct MacTaskWindowID: Codable, Hashable { |
| + let taskID: String |
| + let origin: String |
| + let account: String |
| + @MainActor init(taskID: String, session: EquipoSession) { |
| + self.taskID = taskID; origin = session.origin.absoluteString |
| + // Local lifetime identity is deliberately not a credential. Restored |
| + // windows after a restart close; they cannot follow an account switch. |
| + account = session.presentationID.uuidString |
| + } |
| + @MainActor func matches(_ session: EquipoSession) -> Bool { |
| + origin == session.origin.absoluteString && account == session.presentationID.uuidString && session.lifetime.isActive |
| + } |
| +} |
diff --git a/native/apple/Tests/EquipoKitTests/MacPowerTests.swift b/native/apple/Tests/EquipoKitTests/MacPowerTests.swift| new file mode 100644 |
| index 00000000..0d6eb821 |
| --- /dev/null |
| +++ b/native/apple/Tests/EquipoKitTests/MacPowerTests.swift |
| @@ -0,0 +1,119 @@ |
| +import Foundation |
| +import Testing |
| +@testable import EquipoKit |
| + |
| +@MainActor @Suite struct MacPowerTests { |
| + @Test func fuzzySearchIsOrderedCaseAndDiacriticInsensitive() { |
| + #expect(MacJumpIndex.score("tile", in: "Tile labels")! > MacJumpIndex.score("tile", in: "The icon labels overlap")!) |
| + #expect(MacJumpIndex.score("cafe", in: "Café") != nil) |
| + #expect(MacJumpIndex.score("abc", in: "cba") == nil) |
| + #expect(MacJumpIndex.score("", in: "anything") != nil) |
| + } |
| + @Test func searchIncludesBriefBranchProjectsAndNeedsWithoutDuplicateTasks() throws { |
| + var task = try TaskDetailTests.task(); task.brief = "Fix narrow phones"; task.branch = "equipo/retina" |
| + let projects: ThinList<ThinProject> = try Fixture.decode("thin/projects") |
| + let index = MacJumpIndex(tasks: [task], needs: [task], projects: projects.items ?? []) |
| + #expect(index.results("narrow").map(\.target) == [.task(task.id)]) |
| + #expect(index.results("retina").first?.target == .task(task.id)) |
| + #expect(index.results("").filter { $0.target == .task(task.id) }.count == 1) |
| + #expect(index.results("").first { $0.target == .task(task.id) }?.needsYou == true) |
| + #expect(index.results("").contains { $0.target == .pane(.conversation) }) |
| + #expect(index.results("").contains { if case .project = $0.target { true } else { false } }) |
| + } |
| + @Test func historyDoesNotRepeatAndNewNavigationDropsForward() { |
| + let history = MacNavigationHistory() |
| + history.go(.pane(.tasks)); history.go(.task("a")); history.go(.task("a")) |
| + #expect(history.back() == .pane(.tasks)) |
| + #expect(history.back() == .pane(.conversation)) |
| + #expect(history.back() == nil) |
| + #expect(history.forward() == .pane(.tasks)) |
| + history.go(.project("p")); #expect(history.forward() == nil) |
| + } |
| + @Test func paletteAndMenuReuseTaskRulesAndConfirmBeforeWriting() async throws { |
| + for action in [MacTaskAction.merge, .cancel] { |
| + let server = TaskDetailServer(), detail = try TaskDetailModelTests.model(server) |
| + await detail.load(); detail.loaded?.mergeOffered = true |
| + let context = MacTaskContext(detail: detail) |
| + #expect(context.actions.contains(action)) |
| + await context.perform(action) |
| + #expect(await server.writes == 0) |
| + #expect(detail.confirmation?.action == (action == .merge ? .merge : .cancel)) |
| + await detail.confirm(); #expect(await server.writes == 1) |
| + } |
| + } |
| + @Test func actionsRequireFreshReadOwnerCreatorAndNotBusy() async throws { |
| + let server = TaskDetailServer(), detail = try TaskDetailModelTests.model(server) |
| + let context = MacTaskContext(detail: detail) |
| + #expect(context.actions.isEmpty) |
| + await detail.load(); detail.loaded?.mergeOffered = true |
| + #expect(context.actions.contains(.merge)) |
| + detail.busy = true; #expect(context.actions.isEmpty) |
| + await context.perform(.merge); #expect(detail.confirmation == nil) |
| + detail.busy = false |
| + var snapshot: Snapshot = try Fixture.decode("thin/snapshot") |
| + snapshot.me.address = "other@example.com"; detail.session.apply(snapshot) |
| + #expect(!context.actions.contains(.merge)); #expect(!context.actions.contains(.cancel)) |
| + #expect(context.actions.contains(.move)) |
| + snapshot.me.role = "member"; detail.session.apply(snapshot) |
| + #expect(!context.actions.contains(.move)) |
| + detail.readFailure = "offline"; #expect(context.actions.isEmpty) |
| + } |
| + @Test func mergeCardUsesCardConfirmationAndRetryUsesTerminatedGuard() async throws { |
| + let server = TaskDetailServer(), detail = try TaskDetailModelTests.model(server) |
| + await detail.load() |
| + var snapshot: Snapshot = try Fixture.decode("thin/snapshot") |
| + let card = try TaskDecisionTests.card(try #require(detail.task)); snapshot.cards = [card] |
| + detail.session.apply(snapshot) |
| + let context = MacTaskContext(detail: detail) |
| + await context.perform(.merge) |
| + #expect(detail.confirmation?.card?.id == card.id) |
| + #expect(await server.writes == 0) |
| + detail.loaded?.steps?[2].state = "failed"; detail.loaded?.steps?[2].terminated = true |
| + #expect(context.actions.contains(.retry)) |
| + detail.loaded?.steps?[2].terminated = false |
| + #expect(!context.actions.contains(.retry)) |
| + } |
| + @Test func webActionRequiresAReadableTaskAndUsesTheFixedAllowlistedPath() async throws { |
| + let detail = try TaskDetailModelTests.model(TaskDetailServer()) |
| + var opened: [URL] = [] |
| + let context = MacTaskContext(detail: detail, openWeb: { url, _ in opened.append(url) }) |
| + await context.perform(.web); #expect(opened.isEmpty) |
| + await context.load(); await context.perform(.web) |
| + #expect(opened.map(\.absoluteString) == ["https://task-detail.invalid/tasks/tkqsrho7oq3n"]) |
| + detail.busy = true; await context.perform(.web); #expect(opened.count == 1) |
| + } |
| + @Test func refusedAndStaleContextsCannotActAndNetworkErrorsDoNotCloseAWindow() async throws { |
| + let server = TaskDetailServer(), detail = try TaskDetailModelTests.model(server) |
| + let context = MacTaskContext(detail: detail) |
| + await context.load(); detail.loaded?.mergeOffered = true |
| + #expect(context.actions.contains(.merge)) |
| + let loaded = detail.loaded |
| + await detail.session.refresh() |
| + detail.loaded?.revision = 0 |
| + #expect(context.actions.isEmpty) |
| + detail.loaded = loaded |
| + await server.refuseRead(403); await context.load() |
| + #expect(context.refused); #expect(context.actions.isEmpty) |
| + detail.readFailure = nil; #expect(context.actions.isEmpty) |
| + await context.perform(.cancel); #expect(detail.confirmation == nil) |
| + await server.refuseRead(500); await context.load() |
| + #expect(!context.refused); #expect(context.actions.isEmpty) |
| + await server.refuseRead(200); await context.load() |
| + #expect(!context.actions.isEmpty) |
| + detail.session.lifetime.end() |
| + #expect(context.actions.isEmpty) |
| + } |
| + @Test func windowClosesOnlyForTerminalStateOrVerifiedLossOfVisibility() throws { |
| + var task = try TaskDetailTests.task() |
| + #expect(!MacTaskWindowPolicy.shouldClose(task: task, initialRepo: task.repo, status: nil)) |
| + #expect(!MacTaskWindowPolicy.shouldClose(task: nil, initialRepo: task.repo, status: 500)) |
| + for status in [401, 403, 404] { #expect(MacTaskWindowPolicy.shouldClose(task: nil, initialRepo: task.repo, status: status)) } |
| + task.stage = "cancelled" |
| + #expect(MacTaskWindowPolicy.shouldClose(task: task, initialRepo: task.repo, status: nil)) |
| + task.stage = "done" |
| + #expect(!MacTaskWindowPolicy.shouldClose(task: task, initialRepo: task.repo, status: nil)) |
| + #expect(MacTaskWindowPolicy.shouldClose(task: task, initialRepo: "another/repo", status: nil)) |
| + task.moving = true |
| + #expect(MacTaskWindowPolicy.shouldClose(task: task, initialRepo: task.repo, status: nil)) |
| + } |
| +} |
diff --git a/native/apple/Tests/EquipoKitTests/MacWorkspaceTests.swift b/native/apple/Tests/EquipoKitTests/MacWorkspaceTests.swift| new file mode 100644 |
| index 00000000..c99a9b03 |
| --- /dev/null |
| +++ b/native/apple/Tests/EquipoKitTests/MacWorkspaceTests.swift |
| @@ -0,0 +1,65 @@ |
| +#if os(macOS) |
| +import AppKit |
| +import SwiftUI |
| +import Testing |
| +@testable import EquipoKit |
| +@testable import EquipoMac |
| + |
| +@MainActor @Suite(.serialized) struct MacWorkspaceTests { |
| + @Test func eachWindowOwnsSelectionAndHistory() async throws { |
| + let detail = try TaskDetailModelTests.model(TaskDetailServer()) |
| + let app = EquipoAppModel(store: MemorySecretStore()) |
| + let one = MacWorkspace(app: app, session: detail.session) |
| + let two = MacWorkspace(app: app, session: detail.session) |
| + one.go(.task(detail.taskID)); two.go(.task("other")) |
| + #expect(one.context?.taskID == detail.taskID) |
| + #expect(two.context?.taskID == "other") |
| + one.go(.project("project")); #expect(one.pane == .projects); #expect(one.projectID == "project") |
| + one.back(); #expect(one.context?.taskID == detail.taskID); #expect(one.pane == .conversation) |
| + one.back(); #expect(one.pane == .conversation); #expect(!one.inspector) |
| + one.forward(); #expect(one.inspector) |
| + one.newMessage(); #expect(one.pane == .conversation); #expect(one.composerFocus == 1) |
| + #expect(two.context?.taskID == "other") |
| + } |
| + @Test func windowsCannotFollowAccountChangesOrRestoredOldSessions() throws { |
| + let session = try TaskDetailModelTests.model(TaskDetailServer()).session |
| + let other = try TaskDetailModelTests.model(TaskDetailServer()).session |
| + let identity = MacTaskWindowID(taskID: "task", session: session) |
| + #expect(identity.matches(session)) |
| + #expect(!identity.matches(other)) |
| + let encoded = try JSONEncoder().encode(identity) |
| + #expect(try JSONDecoder().decode(MacTaskWindowID.self, from: encoded) == identity) |
| + #expect(!String(decoding: encoded, as: UTF8.self).contains("token")) |
| + session.lifetime.end() |
| + #expect(!identity.matches(session)) |
| + } |
| + @Test func taskWindowsRouteGoToTheMainWindow() throws { |
| + let session = try TaskDetailModelTests.model(TaskDetailServer()).session |
| + let app = EquipoAppModel(store: MemorySecretStore()) |
| + let window = MacWorkspace(app: app, session: session, taskID: "task") |
| + window.go(.project("project")) |
| + #expect(app.destination?.projectID == "project") |
| + #expect(window.context?.taskID == "task") |
| + #expect(window.mainRequest == 1) |
| + window.newMessage(); #expect(app.destination?.pane == .conversation) |
| + } |
| + @Test func commandReturnSendsButShiftReturnAndMarkedTextDoNot() throws { |
| + let editor = ComposerEditor(); var sends = 0 |
| + editor.onSubmit = { sends += 1 } |
| + let event = try #require(NSEvent.keyEvent(with: .keyDown, location: .zero, modifierFlags: .command, timestamp: 0, |
| + windowNumber: 0, context: nil, characters: "\r", charactersIgnoringModifiers: "\r", isARepeat: false, keyCode: 36)) |
| + editor.keyDown(with: event); #expect(sends == 1) |
| + editor.setMarkedText("unfinished", selectedRange: NSRange(location: 0, length: 0), replacementRange: NSRange(location: NSNotFound, length: 0)) |
| + editor.keyDown(with: event); #expect(sends == 1) |
| + } |
| + @Test func focusRequestSurvivesAttachingTheConversationToAWindow() throws { |
| + let session = try TaskDetailModelTests.model(TaskDetailServer()).session |
| + let transcript = LiveTranscript(session: session, openTask: { _ in }) |
| + transcript.focusComposer() |
| + let window = NSWindow(contentRect: NSRect(x: 0, y: 0, width: 900, height: 700), styleMask: [.titled], backing: .buffered, defer: false) |
| + window.contentView = transcript |
| + #expect(window.firstResponder === transcript.composer.editor) |
| + window.contentView = nil |
| + } |
| +} |
| +#endif |
diff --git a/native/apple/Tests/EquipoKitTests/TaskDetailModelTests.swift b/native/apple/Tests/EquipoKitTests/TaskDetailModelTests.swift| index 476839cc..94837ecc 100644 |
| --- a/native/apple/Tests/EquipoKitTests/TaskDetailModelTests.swift |
| +++ b/native/apple/Tests/EquipoKitTests/TaskDetailModelTests.swift |
| @@ -260,7 +260,7 @@ import Testing |
| } |
| -private actor TaskDetailServer: EquipoTransport { |
| +actor TaskDetailServer: EquipoTransport { |
| nonisolated let origin = URL(string: "https://task-detail.invalid")! |
| var requests: [APIRequest] = [] |
| var projectReads = 0 |
| @@ -271,6 +271,8 @@ private actor TaskDetailServer: EquipoTransport { |
| var held = false |
| var conflict = false |
| var revision = 9 |
| + var readStatus = 200 |
| + func refuseRead(_ status: Int) { readStatus = status } |
| var pending: [CheckedContinuation<Void, Never>] = [] |
| func configure(held: Bool = false, conflict: Bool = false) { self.held = held; self.conflict = conflict } |
| func finish() { held = false; for c in pending { c.resume() }; pending = [] } |
| @@ -278,6 +280,7 @@ private actor TaskDetailServer: EquipoTransport { |
| requests.append(request) |
| if request.method == "GET", request.path == "/tasks/tkqsrho7oq3n" { |
| reads += 1 |
| + if readStatus != 200 { return APIResponse(status: readStatus, data: Data()) } |
| var json = try JSONSerialization.jsonObject(with: Fixture.data("thin/task")) as! [String: Any] |
| json["revision"] = revision |
| return APIResponse(status: 200, data: try JSONSerialization.data(withJSONObject: json)) |
diff --git a/native/scripts/check-strings.py b/native/scripts/check-strings.py| index b8a05da1..bad23718 100755 |
| --- a/native/scripts/check-strings.py |
| +++ b/native/scripts/check-strings.py |
| @@ -18,7 +18,7 @@ plurals = json.loads((native / 'scripts/plurals.json').read_text()) |
| def catalog(): |
| return {'sourceLanguage': 'en', 'version': '1.0', 'strings': { |
| - k: {**({'comment': 'COPY APPROVED: Luna, 2026-11-26.'} if k.startswith('native.changes.') or k in ('api.preview_changed', 'api.preview_expired') else {}), 'extractionState': 'manual', 'localizations': {'en': plurals.get(k, {'stringUnit': {'state': 'translated', 'value': v}})}} |
| + k: {**({'comment': 'COPY APPROVED: Luna, 2026-11-27.'} if k.startswith('native.mac.') else {'comment': 'COPY APPROVED: Luna, 2026-11-26.'} if k.startswith('native.changes.') or k in ('api.preview_changed', 'api.preview_expired') else {}), 'extractionState': 'manual', 'localizations': {'en': plurals.get(k, {'stringUnit': {'state': 'translated', 'value': v}})}} |
| for k, v in sorted(source.items())}} |
| def used_keys(): |
diff --git a/native/scripts/strings.json b/native/scripts/strings.json| index 80aa2cf9..b152c204 100644 |
| --- a/native/scripts/strings.json |
| +++ b/native/scripts/strings.json |
| @@ -502,5 +502,15 @@ |
| "work.merged": "Merged into %@ at %@", |
| "native.needs.merged_at": "Merged into %1$@ at %2$@", |
| "api.preview_changed": "The change has been updated. Review it again.", |
| - "api.preview_expired": "This preview expired. Open it again." |
| + "api.preview_expired": "This preview expired. Open it again.", |
| + "native.mac.back": "Back", |
| + "native.mac.forward": "Forward", |
| + "native.mac.go": "Go", |
| + "native.mac.jump": "Jump to…", |
| + "native.mac.new_message": "New Message", |
| + "native.mac.no_results": "No matches", |
| + "native.mac.open_window": "Open in New Window", |
| + "native.mac.refresh": "Refresh", |
| + "native.mac.search": "Search tasks, projects and actions", |
| + "native.mac.selected_task": "For the selected task" |
| } |