diff --git a/apps/macos/Sources/OpenClaw/GeneralSettings.swift b/apps/macos/Sources/OpenClaw/GeneralSettings.swift index 9ba2f1b28478..62844c10de0f 100644 --- a/apps/macos/Sources/OpenClaw/GeneralSettings.swift +++ b/apps/macos/Sources/OpenClaw/GeneralSettings.swift @@ -681,82 +681,6 @@ struct GeneralSettings: View { } } - private var healthCard: some View { - let snapshot = self.healthStore.snapshot - return VStack(alignment: .leading, spacing: 6) { - HStack(spacing: 8) { - Circle() - .fill(self.healthStore.state.tint) - .frame(width: 10, height: 10) - Text(self.healthStore.summaryLine) - .font(.callout.weight(.semibold)) - } - - if let snap = snapshot { - let linkId = snap.channelOrder?.first(where: { - if let summary = snap.channels[$0] { return summary.linked != nil } - return false - }) ?? snap.channels.keys.first(where: { - if let summary = snap.channels[$0] { return summary.linked != nil } - return false - }) - let linkLabel = - linkId.flatMap { snap.channelLabels?[$0] } ?? - linkId?.capitalized ?? - "Link channel" - let linkAge = linkId.flatMap { snap.channels[$0]?.authAgeMs } - Text("\(linkLabel) auth age: \(healthAgeString(linkAge))") - .font(.caption) - .foregroundStyle(.secondary) - Text("Session store: \(snap.sessions.path) (\(snap.sessions.count) entries)") - .font(.caption) - .foregroundStyle(.secondary) - if let recent = snap.sessions.recent.first { - let lastActivity = recent.updatedAt != nil - ? relativeAge(from: Date(timeIntervalSince1970: (recent.updatedAt ?? 0) / 1000)) - : "unknown" - Text("Last activity: \(recent.key) \(lastActivity)") - .font(.caption) - .foregroundStyle(.secondary) - } - Text("Last check: \(relativeAge(from: self.healthStore.lastSuccess))") - .font(.caption) - .foregroundStyle(.secondary) - } else if let error = self.healthStore.lastError { - Text(error) - .font(.caption) - .foregroundStyle(.red) - } else { - Text("Health check pending…") - .font(.caption) - .foregroundStyle(.secondary) - } - - HStack(spacing: 12) { - Button { - Task { await self.healthStore.refresh(onDemand: true) } - } label: { - if self.healthStore.isRefreshing { - ProgressView().controlSize(.small) - } else { - Label("Run Health Check", systemImage: "arrow.clockwise") - } - } - .disabled(self.healthStore.isRefreshing) - - Divider().frame(height: 18) - - Button { - self.revealLogs() - } label: { - Label("Reveal Logs", systemImage: "doc.text.magnifyingglass") - } - } - } - .padding(12) - .background(Color.gray.opacity(0.08)) - .cornerRadius(10) - } } private enum RemoteStatus: Equatable { @@ -839,11 +763,6 @@ extension GeneralSettings { } } -private func healthAgeString(_ ms: Double?) -> String { - guard let ms else { return "unknown" } - return msToAge(ms) -} - #if DEBUG struct GeneralSettings_Previews: PreviewProvider { static var previews: some View { diff --git a/apps/macos/Sources/OpenClaw/InstancesStore.swift b/apps/macos/Sources/OpenClaw/InstancesStore.swift index 073d129b944b..298331e8d8cc 100644 --- a/apps/macos/Sources/OpenClaw/InstancesStore.swift +++ b/apps/macos/Sources/OpenClaw/InstancesStore.swift @@ -221,16 +221,6 @@ final class InstancesStore { } } - private func decodeAndApplyPresenceData(_ data: Data) { - do { - let decoded = try JSONDecoder().decode([PresenceEntry].self, from: data) - self.applyPresence(decoded) - } catch { - self.logger.error("presence decode from event failed: \(error.localizedDescription, privacy: .public)") - self.lastError = error.localizedDescription - } - } - func handlePresenceEventPayload(_ payload: OpenClawProtocol.AnyCodable) { do { let wrapper = try GatewayPayloadDecoding.decode(payload, as: PresenceEventPayload.self) diff --git a/apps/macos/Sources/OpenClaw/MenuBar.swift b/apps/macos/Sources/OpenClaw/MenuBar.swift index 82b0257ec33a..1bb1201e8a83 100644 --- a/apps/macos/Sources/OpenClaw/MenuBar.swift +++ b/apps/macos/Sources/OpenClaw/MenuBar.swift @@ -16,7 +16,6 @@ struct OpenClawApp: App { private let gatewayManager = GatewayProcessManager.shared private let controlChannel = ControlChannel.shared private let activityStore = WorkActivityStore.shared - private let connectivityCoordinator = GatewayConnectivityCoordinator.shared @State private var statusItem: NSStatusItem? @State private var isMenuPresented = false @State private var isPanelVisible = false @@ -34,6 +33,7 @@ struct OpenClawApp: App { init() { OpenClawLogging.bootstrapIfNeeded() + GatewayConnectivityCoordinator.shared.start() Self.applyAttachOnlyOverrideIfNeeded() _state = State(initialValue: AppStateStore.shared) diff --git a/apps/macos/Sources/OpenClaw/MenuSessionsInjector.swift b/apps/macos/Sources/OpenClaw/MenuSessionsInjector.swift index dc73327c5ae5..4e15cf7250c1 100644 --- a/apps/macos/Sources/OpenClaw/MenuSessionsInjector.swift +++ b/apps/macos/Sources/OpenClaw/MenuSessionsInjector.swift @@ -1045,16 +1045,6 @@ extension MenuSessionsInjector { return item } - private func formatVersionLabel(_ version: String) -> String { - let trimmed = version.trimmingCharacters(in: .whitespacesAndNewlines) - guard !trimmed.isEmpty else { return version } - if trimmed.hasPrefix("v") { return trimmed } - if let first = trimmed.unicodeScalars.first, CharacterSet.decimalDigits.contains(first) { - return "v\(trimmed)" - } - return trimmed - } - @objc private func patchThinking(_ sender: NSMenuItem) { guard let dict = sender.representedObject as? [String: Any], diff --git a/apps/macos/Sources/OpenClaw/SessionData.swift b/apps/macos/Sources/OpenClaw/SessionData.swift index 2aab6dc01d99..d34150b7b3fd 100644 --- a/apps/macos/Sources/OpenClaw/SessionData.swift +++ b/apps/macos/Sources/OpenClaw/SessionData.swift @@ -217,18 +217,6 @@ extension String? { } } -extension [String] { - fileprivate func dedupedPreserveOrder() -> [String] { - var seen = Set() - var result: [String] = [] - for item in self where !seen.contains(item) { - seen.insert(item) - result.append(item) - } - return result - } -} - enum SessionLoadError: LocalizedError { case gatewayUnavailable(String) case decodeFailed(String) diff --git a/apps/macos/Sources/OpenClaw/VoiceWakeSettings.swift b/apps/macos/Sources/OpenClaw/VoiceWakeSettings.swift index 9d7d8de270ba..00cbc1befb18 100644 --- a/apps/macos/Sources/OpenClaw/VoiceWakeSettings.swift +++ b/apps/macos/Sources/OpenClaw/VoiceWakeSettings.swift @@ -23,7 +23,6 @@ struct VoiceWakeSettings: View { @State private var meterStartupTask: Task? @State private var availableLocales: [Locale] = [] @State private var triggerEntries: [TriggerEntry] = [] - private let fieldLabelWidth: CGFloat = 140 private let controlWidth: CGFloat = 240 private let isPreview = ProcessInfo.processInfo.isPreview diff --git a/apps/macos/Sources/OpenClaw/VoiceWakeTester.swift b/apps/macos/Sources/OpenClaw/VoiceWakeTester.swift index 9971b0b9cd1a..ff06948045f3 100644 --- a/apps/macos/Sources/OpenClaw/VoiceWakeTester.swift +++ b/apps/macos/Sources/OpenClaw/VoiceWakeTester.swift @@ -368,31 +368,6 @@ final class VoiceWakeTester { } } - private func holdUntilSilence(onUpdate: @escaping @Sendable (VoiceWakeTestState) -> Void) { - Task { [weak self] in - guard let self else { return } - let detectedAt = Date() - let hardStop = detectedAt.addingTimeInterval(6) // cap overall listen after trigger - - while !self.isStopping { - let now = Date() - if now >= hardStop { break } - if let last = self.lastHeard, now.timeIntervalSince(last) >= silenceWindow { - break - } - try? await Task.sleep(nanoseconds: 200_000_000) - } - if !self.isStopping { - self.stop() - await MainActor.run { AppStateStore.shared.stopVoiceEars() } - if let detectedText { - self.logger.info("voice wake hold finished; len=\(detectedText.count)") - Task { @MainActor in onUpdate(.detected(detectedText)) } - } - } - } - } - private func scheduleSilenceCheck( triggers: [String], onUpdate: @escaping @Sendable (VoiceWakeTestState) -> Void)