fix(macos): clean swiftformat pass and sendable warning

This commit is contained in:
Peter Steinberger
2026-03-08 13:22:46 +00:00
parent eb0758e172
commit 53fb317e7f
129 changed files with 505 additions and 512 deletions

View File

@@ -6,14 +6,14 @@ import OpenClawKit
import OSLog
actor CameraCaptureService {
struct CameraDeviceInfo: Encodable, Sendable {
struct CameraDeviceInfo: Encodable {
let id: String
let name: String
let position: String
let deviceType: String
}
enum CameraError: LocalizedError, Sendable {
enum CameraError: LocalizedError {
case cameraUnavailable
case microphoneUnavailable
case permissionDenied(kind: String)

View File

@@ -2,7 +2,7 @@ import Foundation
import OpenClawProtocol
enum ConfigStore {
struct Overrides: Sendable {
struct Overrides {
var isRemoteMode: (@Sendable () async -> Bool)?
var loadLocal: (@MainActor @Sendable () -> [String: Any])?
var saveLocal: (@MainActor @Sendable ([String: Any]) -> Void)?

View File

@@ -1,13 +1,13 @@
import Foundation
enum EffectiveConnectionModeSource: Sendable, Equatable {
enum EffectiveConnectionModeSource: Equatable {
case configMode
case configRemoteURL
case userDefaults
case onboarding
}
struct EffectiveConnectionMode: Sendable, Equatable {
struct EffectiveConnectionMode: Equatable {
let mode: AppState.ConnectionMode
let source: EffectiveConnectionModeSource
}

View File

@@ -14,7 +14,7 @@ struct ControlHeartbeatEvent: Codable {
let reason: String?
}
struct ControlAgentEvent: Codable, Sendable, Identifiable {
struct ControlAgentEvent: Codable, Identifiable {
var id: String {
"\(self.runId)-\(self.seq)"
}

View File

@@ -226,7 +226,7 @@ struct CronJob: Identifiable, Codable, Equatable {
}
}
struct CronEvent: Codable, Sendable {
struct CronEvent: Codable {
let jobId: String
let action: String
let runAtMs: Int?
@@ -237,7 +237,7 @@ struct CronEvent: Codable, Sendable {
let nextRunAtMs: Int?
}
struct CronRunLogEntry: Codable, Identifiable, Sendable {
struct CronRunLogEntry: Codable, Identifiable {
var id: String {
"\(self.jobId)-\(self.ts)"
}

View File

@@ -1,6 +1,6 @@
import Foundation
struct DevicePresentation: Sendable {
struct DevicePresentation {
let title: String
let symbol: String?
}

View File

@@ -7,7 +7,7 @@ actor DiagnosticsFileLog {
private let maxBytes: Int64 = 5 * 1024 * 1024
private let maxBackups = 5
struct Record: Codable, Sendable {
struct Record: Codable {
let ts: String
let pid: Int32
let category: String

View File

@@ -84,13 +84,13 @@ enum ExecAsk: String, CaseIterable, Codable, Identifiable {
}
}
enum ExecApprovalDecision: String, Codable, Sendable {
enum ExecApprovalDecision: String, Codable {
case allowOnce = "allow-once"
case allowAlways = "allow-always"
case deny
}
enum ExecAllowlistPatternValidationReason: String, Codable, Sendable, Equatable {
enum ExecAllowlistPatternValidationReason: String, Codable, Equatable {
case empty
case missingPathComponent
@@ -104,12 +104,12 @@ enum ExecAllowlistPatternValidationReason: String, Codable, Sendable, Equatable
}
}
enum ExecAllowlistPatternValidation: Sendable, Equatable {
enum ExecAllowlistPatternValidation: Equatable {
case valid(String)
case invalid(ExecAllowlistPatternValidationReason)
}
struct ExecAllowlistRejectedEntry: Sendable, Equatable {
struct ExecAllowlistRejectedEntry: Equatable {
let id: UUID
let pattern: String
let reason: ExecAllowlistPatternValidationReason
@@ -753,7 +753,7 @@ enum ExecApprovalHelpers {
}
}
struct ExecEventPayload: Codable, Sendable {
struct ExecEventPayload: Codable {
var sessionKey: String
var runId: String
var host: String

View File

@@ -11,7 +11,7 @@ final class ExecApprovalsGatewayPrompter {
private let logger = Logger(subsystem: "ai.openclaw", category: "exec-approvals.gateway")
private var task: Task<Void, Never>?
struct GatewayApprovalRequest: Codable, Sendable {
struct GatewayApprovalRequest: Codable {
var id: String
var request: ExecApprovalPromptRequest
var createdAtMs: Int

View File

@@ -5,7 +5,7 @@ import Foundation
import OpenClawKit
import OSLog
struct ExecApprovalPromptRequest: Codable, Sendable {
struct ExecApprovalPromptRequest: Codable {
var command: String
var cwd: String?
var host: String?

View File

@@ -1,6 +1,6 @@
import Foundation
struct ExecCommandResolution: Sendable {
struct ExecCommandResolution {
let rawExecutable: String
let resolvedPath: String?
let executableName: String

View File

@@ -6,7 +6,7 @@ import OSLog
private let gatewayConnectionLogger = Logger(subsystem: "ai.openclaw", category: "gateway.connection")
enum GatewayAgentChannel: String, Codable, CaseIterable, Sendable {
enum GatewayAgentChannel: String, Codable, CaseIterable {
case last
case whatsapp
case telegram
@@ -33,7 +33,7 @@ enum GatewayAgentChannel: String, Codable, CaseIterable, Sendable {
}
}
struct GatewayAgentInvocation: Sendable {
struct GatewayAgentInvocation {
var message: String
var sessionKey: String = "main"
var thinking: String?
@@ -53,7 +53,7 @@ actor GatewayConnection {
typealias Config = (url: URL, token: String?, password: String?)
enum Method: String, Sendable {
enum Method: String {
case agent
case status
case setHeartbeats = "set-heartbeats"
@@ -428,9 +428,9 @@ actor GatewayConnection {
// MARK: - Typed gateway API
extension GatewayConnection {
struct ConfigGetSnapshot: Decodable, Sendable {
struct SnapshotConfig: Decodable, Sendable {
struct Session: Decodable, Sendable {
struct ConfigGetSnapshot: Decodable {
struct SnapshotConfig: Decodable {
struct Session: Decodable {
let mainKey: String?
let scope: String?
}
@@ -729,7 +729,7 @@ extension GatewayConnection {
// MARK: - Cron
struct CronSchedulerStatus: Decodable, Sendable {
struct CronSchedulerStatus: Decodable {
let enabled: Bool
let storePath: String
let jobs: Int

View File

@@ -2,7 +2,7 @@ import ConcurrencyExtras
import Foundation
import OSLog
enum GatewayEndpointState: Sendable, Equatable {
enum GatewayEndpointState: Equatable {
case ready(mode: AppState.ConnectionMode, url: URL, token: String?, password: String?)
case connecting(mode: AppState.ConnectionMode, detail: String)
case unavailable(mode: AppState.ConnectionMode, reason: String)
@@ -24,14 +24,14 @@ actor GatewayEndpointStore {
]
private static let remoteConnectingDetail = "Connecting to remote gateway…"
private static let staticLogger = Logger(subsystem: "ai.openclaw", category: "gateway-endpoint")
private enum EnvOverrideWarningKind: Sendable {
private enum EnvOverrideWarningKind {
case token
case password
}
private static let envOverrideWarnings = LockIsolated((token: false, password: false))
struct Deps: Sendable {
struct Deps {
let mode: @Sendable () async -> AppState.ConnectionMode
let token: @Sendable () -> String?
let password: @Sendable () -> String?

View File

@@ -3,7 +3,7 @@ import OpenClawIPC
import OSLog
/// Lightweight SemVer helper (major.minor.patch only) for gateway compatibility checks.
struct Semver: Comparable, CustomStringConvertible, Sendable {
struct Semver: Comparable, CustomStringConvertible {
let major: Int
let minor: Int
let patch: Int

View File

@@ -3,14 +3,14 @@ import Network
import Observation
import SwiftUI
struct HealthSnapshot: Codable, Sendable {
struct ChannelSummary: Codable, Sendable {
struct Probe: Codable, Sendable {
struct Bot: Codable, Sendable {
struct HealthSnapshot: Codable {
struct ChannelSummary: Codable {
struct Probe: Codable {
struct Bot: Codable {
let username: String?
}
struct Webhook: Codable, Sendable {
struct Webhook: Codable {
let url: String?
}
@@ -29,13 +29,13 @@ struct HealthSnapshot: Codable, Sendable {
let lastProbeAt: Double?
}
struct SessionInfo: Codable, Sendable {
struct SessionInfo: Codable {
let key: String
let updatedAt: Double?
let age: Double?
}
struct Sessions: Codable, Sendable {
struct Sessions: Codable {
let path: String
let count: Int
let recent: [SessionInfo]

View File

@@ -22,7 +22,7 @@ enum HostEnvSecurityPolicy {
"PS4",
"GCONV_PATH",
"IFS",
"SSLKEYLOGFILE"
"SSLKEYLOGFILE",
]
static let blockedOverrideKeys: Set<String> = [
@@ -50,17 +50,17 @@ enum HostEnvSecurityPolicy {
"OPENSSL_ENGINES",
"PYTHONSTARTUP",
"WGETRC",
"CURL_HOME"
"CURL_HOME",
]
static let blockedOverridePrefixes: [String] = [
"GIT_CONFIG_",
"NPM_CONFIG_"
"NPM_CONFIG_",
]
static let blockedPrefixes: [String] = [
"DYLD_",
"LD_",
"BASH_FUNC_"
"BASH_FUNC_",
]
}

View File

@@ -1,7 +1,7 @@
import Foundation
enum Launchctl {
struct Result: Sendable {
struct Result {
let status: Int32
let output: String
}
@@ -26,7 +26,7 @@ enum Launchctl {
}
}
struct LaunchAgentPlistSnapshot: Equatable, Sendable {
struct LaunchAgentPlistSnapshot: Equatable {
let programArguments: [String]
let environment: [String: String]
let stdoutPath: String?

View File

@@ -122,7 +122,7 @@ actor MacNodeBrowserProxy {
}
}
let profile = params.profile?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
if !profile.isEmpty && !queryItems.contains(where: { $0.name == "profile" }) {
if !profile.isEmpty, !queryItems.contains(where: { $0.name == "profile" }) {
queryItems.append(URLQueryItem(name: "profile", value: profile))
}
if !queryItems.isEmpty {
@@ -172,7 +172,7 @@ actor MacNodeBrowserProxy {
}
if let text = String(data: data, encoding: .utf8)?
.trimmingCharacters(in: .whitespacesAndNewlines),
!text.isEmpty
!text.isEmpty
{
return text
}

View File

@@ -1,10 +1,10 @@
import Foundation
enum MacNodeScreenCommand: String, Codable, Sendable {
enum MacNodeScreenCommand: String, Codable {
case record = "screen.record"
}
struct MacNodeScreenRecordParams: Codable, Sendable, Equatable {
struct MacNodeScreenRecordParams: Codable, Equatable {
var screenIndex: Int?
var durationMs: Int?
var fps: Double?

View File

@@ -87,7 +87,7 @@ enum OverlayPanelFactory {
offsetX: CGFloat = 6,
offsetY: CGFloat = 6,
duration: TimeInterval = 0.16,
completion: @escaping () -> Void)
completion: @escaping @MainActor @Sendable () -> Void)
{
let target = window.frame.offsetBy(dx: offsetX, dy: offsetY)
NSAnimationContext.runAnimationGroup { context in
@@ -96,7 +96,7 @@ enum OverlayPanelFactory {
window.animator().setFrame(target, display: true)
window.animator().alphaValue = 0
} completionHandler: {
completion()
Task { @MainActor in completion() }
}
}
@@ -109,10 +109,8 @@ enum OverlayPanelFactory {
onHidden: @escaping @MainActor () -> Void)
{
self.animateDismiss(window: window, offsetX: offsetX, offsetY: offsetY, duration: duration) {
Task { @MainActor in
window.orderOut(nil)
onHidden()
}
window.orderOut(nil)
onHidden()
}
}

View File

@@ -56,7 +56,7 @@ final class PeekabooBridgeHostCoordinator {
private func startIfNeeded() async {
guard self.host == nil else { return }
var allowlistedTeamIDs: Set<String> = ["Y5PE65HELJ"]
var allowlistedTeamIDs: Set = ["Y5PE65HELJ"]
if let teamID = Self.currentTeamID() {
allowlistedTeamIDs.insert(teamID)
}

View File

@@ -15,7 +15,7 @@ actor PortGuardian {
let timestamp: TimeInterval
}
struct Descriptor: Sendable {
struct Descriptor {
let pid: Int32
let command: String
let executablePath: String?

View File

@@ -4,13 +4,13 @@ import OpenClawProtocol
import OSLog
import SwiftUI
struct SessionPreviewItem: Identifiable, Sendable {
struct SessionPreviewItem: Identifiable {
let id: String
let role: PreviewRole
let text: String
}
enum PreviewRole: String, Sendable {
enum PreviewRole: String {
case user
case assistant
case tool
@@ -114,7 +114,7 @@ extension SessionPreviewCache {
}
#endif
struct SessionMenuPreviewSnapshot: Sendable {
struct SessionMenuPreviewSnapshot {
let items: [SessionPreviewItem]
let status: SessionMenuPreviewView.LoadStatus
}

View File

@@ -152,7 +152,7 @@ final class TalkAudioPlayer: NSObject, @preconcurrency AVAudioPlayerDelegate {
}
}
struct TalkPlaybackResult: Sendable {
struct TalkPlaybackResult {
let finished: Bool
let interruptedAt: Double?
}

View File

@@ -2,7 +2,7 @@ import AppKit
import Foundation
import OSLog
enum VoiceWakeChime: Codable, Equatable, Sendable {
enum VoiceWakeChime: Codable, Equatable {
case none
case system(name: String)
case custom(displayName: String, bookmark: Data)

View File

@@ -32,7 +32,7 @@ enum VoiceWakeForwarder {
}
}
struct ForwardOptions: Sendable {
struct ForwardOptions {
var sessionKey: String = "main"
var thinking: String = "low"
var deliver: Bool = true

View File

@@ -16,7 +16,7 @@ private enum WebChatSwiftUILayout {
static let anchorPadding: CGFloat = 8
}
struct MacGatewayChatTransport: OpenClawChatTransport, Sendable {
struct MacGatewayChatTransport: OpenClawChatTransport {
func requestHistory(sessionKey: String) async throws -> OpenClawChatHistoryPayload {
try await GatewayConnection.shared.chatHistory(sessionKey: sessionKey)
}