Skip to content

An agentic browser harness: an AI side panel & orb in your own logged-in Chrome, Edge, Arc, Brave or even Firefox run by the agent/subscription you already use (Claude Code, Codex, Antigravity). Free, open source, no API key. Also an MCP server.

feat(mac): check GitHub and npm for a newer release, and update the app from the Overview tab

Shahriar77f6ec162d9f
diff --git a/src/mac/Sources/Browsentic/App/AppModel.swift b/src/mac/Sources/Browsentic/App/AppModel.swift
index 2a6303e..381f507 100644
--- a/src/mac/Sources/Browsentic/App/AppModel.swift
+++ b/src/mac/Sources/Browsentic/App/AppModel.swift
@@ -62,13 +62,16 @@ final class AppModel: ObservableObject {
@Published var logText = ""
@Published var commandDir: String?
@Published var foreignCommand: String?
- @Published var latestRelease: String?
+ @Published var update: AppRelease?
+ @Published var updatePhase: UpdatePhase = .idle
+ @Published var lastUpdateCheck: Date?
@Published var busy: Set<String> = []
@Published var notice: Notice?
private(set) var node: NodeInstall?
private let control = ControlClient()
private var poller: Task<Void, Never>?
+ private var updateWatcher: Task<Void, Never>?
var cli: CLI? { node.map(CLI.init) }
var appVersion: String { Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? Payload.bundledVersion ?? "dev" }
@@ -90,6 +93,11 @@ final class AppModel: ObservableObject {
withAnimation(.spring(duration: 0.45)) { checks[id] = state }
}
preflightBusy = false
+ if finishingUpdate() {
+ await setUpEverything()
+ if phase == .main { say("Browsentic \(appVersion) is installed.") }
+ return
+ }
if CheckID.allCases.filter(\.blocksEntry).allSatisfy({ checks[$0]?.isPassed == true }),
!CheckID.allCases.contains(where: { checks[$0]?.needsAttention == true }) {
await Self.pause(0.9)
@@ -136,6 +144,15 @@ final class AppModel: ObservableObject {
}
}
+ /// After an in-app update the new bundle carries a newer command and extension than the ones
+ /// on disk, and the person already asked for them by pressing Update.
+ private func finishingUpdate() -> Bool {
+ let defaults = UserDefaults.standard
+ guard defaults.bool(forKey: AppUpdater.finishKey) else { return false }
+ defaults.removeObject(forKey: AppUpdater.finishKey)
+ return [CheckID.command, .extensionFiles].contains { checks[$0]?.isPassed != true } && checks[.node]?.isPassed == true
+ }
+
func setUpEverything() async {
fixing = true
defer { fixing = false }
@@ -196,8 +213,8 @@ final class AppModel: ObservableObject {
Task {
refreshCommandLink()
if UserDefaults.standard.object(forKey: "startDaemonOnLaunch") as? Bool ?? true, daemon == .off { await setDaemon(on: true) }
- await checkForUpdate()
}
+ watchForUpdates()
}
// MARK: Daemon
@@ -393,22 +410,63 @@ final class AppModel: ObservableObject {
CommandLink.unlink()
_ = try await cli.uninstall(keepSkills: keepSkills)
self.poller?.cancel()
+ self.updateWatcher?.cancel()
self.markOff()
self.phase = .preflight
}
await runPreflight()
}
- func checkForUpdate() async {
- struct Release: Decodable { let tag_name: String }
- var request = URLRequest(url: URL(string: "https://api.github.com/repos/imshaikot/browsentic/releases/latest")!)
- request.timeoutInterval = 6
- guard
- let (data, _) = try? await URLSession.shared.data(for: request),
- let release = try? JSONDecoder().decode(Release.self, from: data)
- else { return }
- let latest = release.tag_name.trimmingCharacters(in: CharacterSet(charactersIn: "v"))
- latestRelease = Version.isNewer(latest, than: appVersion) ? latest : nil
+ // MARK: Updates
+
+ private func watchForUpdates() {
+ updateWatcher?.cancel()
+ updateWatcher = Task { [weak self] in
+ while !Task.isCancelled {
+ await self?.checkForUpdate()
+ try? await Task.sleep(nanoseconds: 6 * 3_600 * 1_000_000_000)
+ }
+ }
+ }
+
+ func checkForUpdate(announce: Bool = false) async {
+ guard updatePhase == .idle else { return }
+ updatePhase = .checking
+ defer { if updatePhase == .checking { updatePhase = .idle } }
+ do {
+ let found = try await UpdateFeed.latest(after: appVersion)
+ lastUpdateCheck = Date()
+ if let found, found.version != update?.version {
+ say("Browsentic \(found.version) is out — you have \(appVersion). Update from the Overview tab.")
+ } else if announce, found == nil {
+ say("Browsentic \(appVersion) is the latest.")
+ }
+ update = found
+ } catch {
+ if announce { report(error) }
+ }
+ }
+
+ func installUpdate() async {
+ guard let update, update.hasMacBuild, !updatePhase.isInstalling else { return }
+ updatePhase = .downloading(0)
+ do {
+ let (staged, destination) = try await AppUpdater.stage(update) { phase in
+ Task { @MainActor [weak self] in
+ if self?.updatePhase.isInstalling == true { self?.updatePhase = phase }
+ }
+ }
+ updatePhase = .relaunching
+ try AppUpdater.relaunch(into: staged, at: destination)
+ UserDefaults.standard.set(true, forKey: AppUpdater.finishKey)
+ NSApp.terminate(nil)
+ } catch {
+ updatePhase = .failed(error.localizedDescription)
+ }
+ }
+
+ func dismissUpdateFailure() {
+ if case .failed = updatePhase { updatePhase = .idle }
}
// MARK: Plumbing
diff --git a/src/mac/Sources/Browsentic/Core/Models.swift b/src/mac/Sources/Browsentic/Core/Models.swift
index d3ad062..1b6681b 100644
--- a/src/mac/Sources/Browsentic/Core/Models.swift
+++ b/src/mac/Sources/Browsentic/Core/Models.swift
@@ -157,6 +157,10 @@ enum Timestamp {
static func ago(_ text: String, now: Date = Date()) -> String {
guard let date = date(text) else { return text }
+ return ago(date, now: now)
+ }
+
+ static func ago(_ date: Date, now: Date = Date()) -> String {
if now.timeIntervalSince(date) < 5 { return "just now" }
return relative.localizedString(for: date, relativeTo: now)
}
diff --git a/src/mac/Sources/Browsentic/Core/Updater.swift b/src/mac/Sources/Browsentic/Core/Updater.swift
new file mode 100644
index 0000000..08e3d75
--- /dev/null
+++ b/src/mac/Sources/Browsentic/Core/Updater.swift
@@ -0,0 +1,170 @@
+import Foundation
+
+struct AppRelease: Equatable {
+ let version: String
+ let hasMacBuild: Bool
+
+ var dmg: URL { URL(string: "https://github.com/\(UpdateFeed.repo)/releases/download/v\(version)/Browsentic-\(version).dmg")! }
+ var notes: URL { URL(string: "https://github.com/\(UpdateFeed.repo)/releases/tag/v\(version)")! }
+}
+
+enum UpdatePhase: Equatable {
+ case idle
+ case checking
+ case downloading(Double)
+ case verifying
+ case relaunching
+ case failed(String)
+
+ var isInstalling: Bool {
+ switch self {
+ case .downloading, .verifying, .relaunching: true
+ default: false
+ }
+ }
+}
+
+enum UpdateError: LocalizedError {
+ case unreachable
+ case notABundle
+ case image(String)
+ case signature
+ case mismatch(found: String, expected: String)
+ case copy(String)
+
+ var errorDescription: String? {
+ switch self {
+ case .unreachable: "Neither GitHub nor npm answered — check the connection and try again."
+ case .notABundle: "This copy is not running from Browsentic.app, so there is nothing to replace."
+ case .image(let detail): "The download would not open as a disk image. \(detail)"
+ case .signature: "The downloaded app's signature does not match its contents, so it was not installed."
+ case .mismatch(let found, let expected): "The download holds \(found), not Browsentic \(expected), so it was not installed."
+ case .copy(let detail): "The new app could not be copied into place. \(detail)"
+ }
+ }
+}
+
+/// A release reaches npm and GitHub minutes apart, and the disk image is attached to the GitHub
+/// release last of all, so the newest version either source names may not have a Mac build yet.
+enum UpdateFeed {
+ static let repo = "imshaikot/browsentic"
+ static let package = "browsentic"
+
+ static func newest(of candidates: [String?], after current: String) -> String? {
+ candidates.compactMap { $0 }.reduce(nil) { best, next in
+ Version.isNewer(next, than: best ?? current) ? next : best
+ }
+ }
+
+ static func latest(after current: String) async throws -> AppRelease? {
+ async let tag = field("tag_name", at: "https://api.github.com/repos/\(repo)/releases/latest")
+ async let published = field("version", at: "https://registry.npmjs.org/\(package)/latest")
+ let candidates = await [tag.map { $0.trimmingCharacters(in: CharacterSet(charactersIn: "v")) }, published]
+ guard candidates.contains(where: { $0 != nil }) else { throw UpdateError.unreachable }
+ guard let version = newest(of: candidates, after: current) else { return nil }
+ let release = AppRelease(version: version, hasMacBuild: false)
+ return AppRelease(version: version, hasMacBuild: await exists(release.dmg))
+ }
+
+ private static func field(_ key: String, at address: String) async -> String? {
+ var request = URLRequest(url: URL(string: address)!)
+ request.timeoutInterval = 8
+ request.cachePolicy = .reloadIgnoringLocalCacheData
+ guard
+ let (data, response) = try? await URLSession.shared.data(for: request),
+ (response as? HTTPURLResponse)?.statusCode == 200,
+ let object = try? JSONSerialization.jsonObject(with: data) as? [String: Any]
+ else { return nil }
+ return object[key] as? String
+ }
+
+ private static func exists(_ url: URL) async -> Bool {
+ var request = URLRequest(url: url)
+ request.httpMethod = "HEAD"
+ request.timeoutInterval = 8
+ request.cachePolicy = .reloadIgnoringLocalCacheData
+ guard let (_, response) = try? await URLSession.shared.data(for: request) else { return false }
+ return (response as? HTTPURLResponse)?.statusCode == 200
+ }
+}
+
+enum AppUpdater {
+ static let finishKey = "finishUpdateOnLaunch"
+
+ /// A translocated or disk-image copy cannot be replaced where it runs, so the new app goes
+ /// where the installer would have put it.
+ static func destination(running bundle: URL = Bundle.main.bundleURL) throws -> URL {
+ guard bundle.pathExtension == "app" else { throw UpdateError.notABundle }
+ let files = FileManager.default
+ let parent = bundle.deletingLastPathComponent()
+ if !bundle.path.contains("/AppTranslocation/"), files.isWritableFile(atPath: parent.path) { return bundle }
+ let shared = URL(fileURLWithPath: "/Applications", isDirectory: true)
+ let folder = files.isWritableFile(atPath: shared.path) ? shared : Paths.home.appendingPathComponent("Applications", isDirectory: true)
+ return folder.appendingPathComponent("Browsentic.app", isDirectory: true)
+ }
+
+ /// Downloads, verifies and copies the new app next to where it will live, so the swap that
+ /// follows is a rename on one volume.
+ static func stage(_ release: AppRelease, onPhase: @escaping @Sendable (UpdatePhase) -> Void) async throws -> (staged: URL, destination: URL) {
+ let files = FileManager.default
+ let destination = try destination()
+
+ onPhase(.downloading(0))
+ let image = try await Downloader().download(release.dmg) { onPhase(.downloading($0)) }
+ defer { try? files.removeItem(at: image) }
+
+ onPhase(.verifying)
+ let mount = files.temporaryDirectory.appendingPathComponent("browsentic-update-\(UUID().uuidString)", isDirectory: true)
+ try files.createDirectory(at: mount, withIntermediateDirectories: true)
+ let attached = await Shell.run("/usr/bin/hdiutil", ["attach", image.path, "-nobrowse", "-readonly", "-quiet", "-mountpoint", mount.path])
+ guard attached.ok else { throw UpdateError.image(attached.failure) }
+ defer {
+ _ = Shell.runSync("/usr/bin/hdiutil", ["detach", mount.path, "-quiet", "-force"], timeout: 30)
+ try? files.removeItem(at: mount)
+ }
+
+ let source = mount.appendingPathComponent("Browsentic.app", isDirectory: true)
+ guard await Shell.run("/usr/bin/codesign", ["--verify", "--deep", source.path]).ok else { throw UpdateError.signature }
+ let found = identity(of: source)
+ guard found == "\(Bundle.main.bundleIdentifier ?? "") \(release.version)" else {
+ throw UpdateError.mismatch(found: found, expected: release.version)
+ }
+
+ try files.createDirectory(at: destination.deletingLastPathComponent(), withIntermediateDirectories: true)
+ let staged = destination.deletingLastPathComponent().appendingPathComponent(".Browsentic-\(release.version).app", isDirectory: true)
+ try? files.removeItem(at: staged)
+ let copied = await Shell.run("/usr/bin/ditto", [source.path, staged.path], timeout: 300)
+ guard copied.ok else {
+ try? files.removeItem(at: staged)
+ throw UpdateError.copy(copied.failure)
+ }
+ _ = await Shell.run("/usr/bin/xattr", ["-dr", "com.apple.quarantine", staged.path])
+ return (staged, destination)
+ }
+
+ static func identity(of bundle: URL) -> String {
+ let info = NSDictionary(contentsOf: bundle.appendingPathComponent("Contents/Info.plist"))
+ return "\(info?["CFBundleIdentifier"] as? String ?? "an unknown app") \(info?["CFBundleShortVersionString"] as? String ?? "?")"
+ }
+
+ /// A running app cannot replace its own bundle, so a detached shell waits for this process
+ /// to exit, swaps the bundles, puts the old one back if the swap fails, and reopens the app.
+ static func relaunch(into staged: URL, at destination: URL) throws {
+ let script = """
+ tries=0
+ while kill -0 "$1" 2>/dev/null && [ "$tries" -lt 150 ]; do sleep 0.2; tries=$((tries + 1)); done
+ if kill -0 "$1" 2>/dev/null; then rm -rf "$2"; exit 1; fi
+ rm -rf "$3.previous"
+ [ -e "$3" ] && mv "$3" "$3.previous"
+ if mv "$2" "$3"; then rm -rf "$3.previous"; else mv "$3.previous" "$3"; fi
+ open -n "$3"
+ """
+ let process = Process()
+ process.executableURL = URL(fileURLWithPath: "/bin/sh")
+ process.arguments = ["-c", script, "browsentic-update", "\(ProcessInfo.processInfo.processIdentifier)", staged.path, destination.path]
+ process.standardInput = FileHandle.nullDevice
+ process.standardOutput = FileHandle.nullDevice
+ process.standardError = FileHandle.nullDevice
+ try process.run()
+ }
+}
diff --git a/src/mac/Sources/Browsentic/Views/MainView.swift b/src/mac/Sources/Browsentic/Views/MainView.swift
index dc81496..a8dcf14 100644
--- a/src/mac/Sources/Browsentic/Views/MainView.swift
+++ b/src/mac/Sources/Browsentic/Views/MainView.swift
@@ -46,6 +46,9 @@ private struct TabCapsule: View {
HStack(spacing: 6) {
Image(systemName: tab.icon).font(.system(size: 11, weight: .semibold))
Text(tab.label).font(.system(size: 12, weight: .medium))
+ if tab == .overview, model.update != nil {
+ Circle().fill(selected ? Palette.onBrand : Palette.brand).frame(width: 6, height: 6)
+ }
}
.foregroundStyle(selected ? Palette.onBrand : Palette.inkDim)
.padding(.horizontal, 12)
diff --git a/src/mac/Sources/Browsentic/Views/OverviewView.swift b/src/mac/Sources/Browsentic/Views/OverviewView.swift
index 3dc8bd9..ec57c58 100644
--- a/src/mac/Sources/Browsentic/Views/OverviewView.swift
+++ b/src/mac/Sources/Browsentic/Views/OverviewView.swift
@@ -5,6 +5,8 @@ struct OverviewView: View {
var body: some View {
VStack(spacing: 18) {
+ if model.update != nil { UpdateCard().transition(.opacity.combined(with: .offset(y: -8))) }
+
Card(padding: 26) {
HStack(spacing: 28) {
PowerOrb(phase: model.daemon) { Task { await model.setDaemon(on: model.daemon == .off) } }
@@ -52,8 +54,10 @@ struct OverviewView: View {
if model.daemon == .on, model.status?.pairedBrowsers == 0 || model.pairing != nil { ConnectCard() }
ExtensionCard()
+ if model.update == nil { UpdateCard() }
}
.animation(.spring(duration: 0.45), value: model.daemon)
+ .animation(.spring(duration: 0.45), value: model.update)
.animation(.spring(duration: 0.45), value: model.status)
}
diff --git a/src/mac/Sources/Browsentic/Views/SettingsView.swift b/src/mac/Sources/Browsentic/Views/SettingsView.swift
index 18e2374..badda7e 100644
--- a/src/mac/Sources/Browsentic/Views/SettingsView.swift
+++ b/src/mac/Sources/Browsentic/Views/SettingsView.swift
@@ -7,22 +7,11 @@ struct SettingsView: View {
@State private var confirmingUninstall = false
@State private var keepSkills = true
- private static let installLine = "curl -fsSL https://browsentic.com/install.sh | sh"
-
private var mcpCommand: String { "claude mcp add browsentic -- \(Paths.mcpShim.path)" }
var body: some View {
VStack(spacing: 18) {
- if let latest = model.latestRelease {
- Card {
- HStack(spacing: 14) {
- Image(systemName: "arrow.down.circle.fill").font(.system(size: 22)).foregroundStyle(Palette.brand)
- SectionTitle(title: "Browsentic \(latest) is out", subtitle: "You have \(model.appVersion). Paste this into a terminal and it replaces the app, which then replaces the command and the extension: \(Self.installLine)")
- Spacer()
- CopyButton(value: Self.installLine, label: "Copy the line")
- }
- }
- }
+ UpdateCard()
Card {
VStack(alignment: .leading, spacing: 14) {
diff --git a/src/mac/Sources/Browsentic/Views/UpdateCard.swift b/src/mac/Sources/Browsentic/Views/UpdateCard.swift
new file mode 100644
index 0000000..7982152
--- /dev/null
+++ b/src/mac/Sources/Browsentic/Views/UpdateCard.swift
@@ -0,0 +1,97 @@
+import SwiftUI
+
+struct UpdateCard: View {
+ @EnvironmentObject private var model: AppModel
+
+ static let installLine = "curl -fsSL https://browsentic.com/install.sh | sh"
+
+ var body: some View {
+ Card {
+ VStack(alignment: .leading, spacing: 12) {
+ HStack(spacing: 14) {
+ Image(systemName: icon).font(.system(size: 22)).foregroundStyle(tint)
+ SectionTitle(title: title, subtitle: subtitle)
+ Spacer(minLength: 12)
+ actions
+ }
+ if case .downloading(let fraction) = model.updatePhase {
+ ProgressView(value: fraction).tint(Palette.brand)
+ }
+ }
+ }
+ .overlay {
+ if model.update != nil {
+ RoundedRectangle(cornerRadius: 16, style: .continuous).strokeBorder(Palette.brand.opacity(0.45))
+ }
+ }
+ .animation(.spring(duration: 0.4), value: model.updatePhase)
+ }
+
+ @ViewBuilder private var actions: some View {
+ switch model.updatePhase {
+ case .downloading, .verifying, .relaunching:
+ ProgressView().controlSize(.small)
+ case .failed:
+ CopyButton(value: Self.installLine, label: "Copy the terminal line")
+ Button { Task { await model.installUpdate() } } label: { Label("Try again", systemImage: "arrow.clockwise") }
+ .buttonStyle(PrimaryButtonStyle())
+ case .idle, .checking:
+ if let update = model.update {
+ Button("What's new") { NSWorkspace.shared.open(update.notes) }.buttonStyle(QuietButtonStyle())
+ if update.hasMacBuild {
+ Button { Task { await model.installUpdate() } } label: { Label("Update now", systemImage: "arrow.down.circle") }
+ .buttonStyle(PrimaryButtonStyle())
+ } else {
+ checkButton("Check again")
+ }
+ } else {
+ checkButton("Check for updates")
+ }
+ }
+ }
+
+ private func checkButton(_ label: String) -> some View {
+ Button { Task { await model.checkForUpdate(announce: true) } } label: {
+ Label(model.updatePhase == .checking ? "Checking…" : label, systemImage: "arrow.triangle.2.circlepath")
+ }
+ .buttonStyle(QuietButtonStyle())
+ .disabled(model.updatePhase == .checking)
+ }
+
+ private var icon: String {
+ if case .failed = model.updatePhase { return "exclamationmark.triangle.fill" }
+ return model.update == nil ? "checkmark.seal.fill" : "arrow.down.circle.fill"
+ }
+
+ private var tint: Color {
+ if case .failed = model.updatePhase { return Palette.amber }
+ return model.update == nil ? Palette.lime : Palette.brand
+ }
+
+ private var title: String {
+ switch model.updatePhase {
+ case .downloading(let fraction): return "Downloading Browsentic \(model.update?.version ?? "") · \(Int(fraction * 100))%"
+ case .verifying: return "Checking the download"
+ case .relaunching: return "Reopening on the new version"
+ case .failed: return "The update did not install"
+ case .idle, .checking:
+ guard let update = model.update else { return "Browsentic \(model.appVersion) is up to date" }
+ return "Browsentic \(update.version) is out"
+ }
+ }
+
+ private var subtitle: String {
+ switch model.updatePhase {
+ case .downloading, .verifying: return "The daemon keeps running while this happens."
+ case .relaunching: return "The app closes for a moment, then replaces the command, the daemon and the extension."
+ case .failed(let reason): return "\(reason) Nothing was changed. The terminal line installs the same release."
+ case .idle, .checking:
+ guard let update = model.update else {
+ return model.lastUpdateCheck.map { "Checked GitHub and npm \(Timestamp.ago($0))." } ?? "Checks GitHub and npm when it opens and every few hours after."
+ }
+ return update.hasMacBuild
+ ? "You have \(model.appVersion). One press replaces the app, then the command, the daemon and the extension, and reopens it."
+ : "You have \(model.appVersion). The release is published, but its Mac build is still being attached — usually a few minutes."
+ }
+ }
+}
diff --git a/src/mac/Tests/BrowsenticTests/ModelTests.swift b/src/mac/Tests/BrowsenticTests/ModelTests.swift
index 5a3afe9..cad18ab 100644
--- a/src/mac/Tests/BrowsenticTests/ModelTests.swift
+++ b/src/mac/Tests/BrowsenticTests/ModelTests.swift
@@ -57,3 +57,46 @@ import Testing
#expect(Timestamp.ago("not a date") == "not a date")
}
}
+
+@Suite struct UpdateTests {
+ @Test func takesTheNewerOfGitHubAndNpm() {
+ #expect(UpdateFeed.newest(of: ["0.6.3", "0.7.0"], after: "0.6.2") == "0.7.0")
+ #expect(UpdateFeed.newest(of: ["0.7.0", "0.6.3"], after: "0.6.2") == "0.7.0")
+ #expect(UpdateFeed.newest(of: [nil, "0.6.3"], after: "0.6.2") == "0.6.3")
+ }
+
+ @Test func offersNothingWhenCurrentOrAhead() {
+ #expect(UpdateFeed.newest(of: ["0.6.2", "0.6.2"], after: "0.6.2") == nil)
+ #expect(UpdateFeed.newest(of: ["0.6.1", nil], after: "0.6.2") == nil)
+ #expect(UpdateFeed.newest(of: [nil, nil], after: "0.6.2") == nil)
+ }
+
+ @Test func releaseLinksFollowTheAssetNameTheInstallerUses() {
+ let release = AppRelease(version: "0.7.0", hasMacBuild: true)
+ #expect(release.dmg.absoluteString == "https://github.com/imshaikot/browsentic/releases/download/v0.7.0/Browsentic-0.7.0.dmg")
+ #expect(release.notes.absoluteString == "https://github.com/imshaikot/browsentic/releases/tag/v0.7.0")
+ }
+
+ @Test func replacesTheRunningBundleOnlyWhereItCanBeReplaced() throws {
+ let folder = FileManager.default.temporaryDirectory.appendingPathComponent("browsentic-tests-\(UUID().uuidString)", isDirectory: true)
+ try FileManager.default.createDirectory(at: folder, withIntermediateDirectories: true)
+ defer { try? FileManager.default.removeItem(at: folder) }
+
+ let writable = folder.appendingPathComponent("Browsentic.app", isDirectory: true)
+ #expect(try AppUpdater.destination(running: writable) == writable)
+
+ let translocated = URL(fileURLWithPath: "/private/var/folders/xx/T/AppTranslocation/1234/d/Browsentic.app", isDirectory: true)
+ #expect(try AppUpdater.destination(running: translocated).lastPathComponent == "Browsentic.app")
+ #expect(try AppUpdater.destination(running: translocated) != translocated)
+
+ #expect(throws: UpdateError.self) { try AppUpdater.destination(running: folder.appendingPathComponent("debug/Browsentic")) }
+ }
+
+ @Test func onlyTheInstallingPhasesBlockASecondPress() {
+ #expect(UpdatePhase.downloading(0.4).isInstalling)
+ #expect(UpdatePhase.verifying.isInstalling)
+ #expect(UpdatePhase.relaunching.isInstalling)
+ #expect(!UpdatePhase.failed("offline").isInstalling)
+ #expect(!UpdatePhase.checking.isInstalling)
+ }
+}