style(swift): run swiftformat + swiftlint autocorrect

This commit is contained in:
Peter Steinberger
2026-02-15 05:38:07 +01:00
parent 511ba938fb
commit 8725c2b19f
101 changed files with 771 additions and 482 deletions

View File

@@ -110,8 +110,8 @@ struct AboutSettings: View {
private var buildTimestamp: String? {
guard
let raw =
(Bundle.main.object(forInfoDictionaryKey: "OpenClawBuildTimestamp") as? String) ??
(Bundle.main.object(forInfoDictionaryKey: "OpenClawBuildTimestamp") as? String)
(Bundle.main.object(forInfoDictionaryKey: "OpenClawBuildTimestamp") as? String) ??
(Bundle.main.object(forInfoDictionaryKey: "OpenClawBuildTimestamp") as? String)
else { return nil }
let parser = ISO8601DateFormatter()
parser.formatOptions = [.withInternetDateTime]

View File

@@ -1,6 +1,6 @@
import Foundation
// Human-friendly age string (e.g., "2m ago").
/// Human-friendly age string (e.g., "2m ago").
func age(from date: Date, now: Date = .init()) -> String {
let seconds = max(0, Int(now.timeIntervalSince(date)))
let minutes = seconds / 60

View File

@@ -19,7 +19,7 @@ enum AgentWorkspace {
]
enum BootstrapSafety: Equatable {
case safe
case unsafe(reason: String)
case unsafe (reason: String)
}
static func displayPath(for url: URL) -> String {
@@ -72,7 +72,7 @@ enum AgentWorkspace {
return .safe
}
if !isDir.boolValue {
return .unsafe(reason: "Workspace path points to a file.")
return .unsafe (reason: "Workspace path points to a file.")
}
let agentsURL = self.agentsURL(workspaceURL: workspaceURL)
if fm.fileExists(atPath: agentsURL.path) {
@@ -82,9 +82,9 @@ enum AgentWorkspace {
let entries = try self.workspaceEntries(workspaceURL: workspaceURL)
return entries.isEmpty
? .safe
: .unsafe(reason: "Folder isn't empty. Choose a new folder or add AGENTS.md first.")
: .unsafe (reason: "Folder isn't empty. Choose a new folder or add AGENTS.md first.")
} catch {
return .unsafe(reason: "Couldn't inspect the workspace folder.")
return .unsafe (reason: "Couldn't inspect the workspace folder.")
}
}

View File

@@ -234,9 +234,8 @@ enum OpenClawOAuthStore {
return URL(fileURLWithPath: expanded, isDirectory: true)
}
let home = FileManager().homeDirectoryForCurrentUser
let preferred = home.appendingPathComponent(".openclaw", isDirectory: true)
return home.appendingPathComponent(".openclaw", isDirectory: true)
.appendingPathComponent("credentials", isDirectory: true)
return preferred
}
static func oauthURL() -> URL {

View File

@@ -1,18 +1,35 @@
import Foundation
import OpenClawKit
import OpenClawProtocol
import Foundation
// Prefer the OpenClawKit wrapper to keep gateway request payloads consistent.
typealias AnyCodable = OpenClawKit.AnyCodable
typealias InstanceIdentity = OpenClawKit.InstanceIdentity
extension AnyCodable {
var stringValue: String? { self.value as? String }
var boolValue: Bool? { self.value as? Bool }
var intValue: Int? { self.value as? Int }
var doubleValue: Double? { self.value as? Double }
var dictionaryValue: [String: AnyCodable]? { self.value as? [String: AnyCodable] }
var arrayValue: [AnyCodable]? { self.value as? [AnyCodable] }
var stringValue: String? {
self.value as? String
}
var boolValue: Bool? {
self.value as? Bool
}
var intValue: Int? {
self.value as? Int
}
var doubleValue: Double? {
self.value as? Double
}
var dictionaryValue: [String: AnyCodable]? {
self.value as? [String: AnyCodable]
}
var arrayValue: [AnyCodable]? {
self.value as? [AnyCodable]
}
var foundationValue: Any {
switch self.value {
@@ -27,12 +44,29 @@ extension AnyCodable {
}
extension OpenClawProtocol.AnyCodable {
var stringValue: String? { self.value as? String }
var boolValue: Bool? { self.value as? Bool }
var intValue: Int? { self.value as? Int }
var doubleValue: Double? { self.value as? Double }
var dictionaryValue: [String: OpenClawProtocol.AnyCodable]? { self.value as? [String: OpenClawProtocol.AnyCodable] }
var arrayValue: [OpenClawProtocol.AnyCodable]? { self.value as? [OpenClawProtocol.AnyCodable] }
var stringValue: String? {
self.value as? String
}
var boolValue: Bool? {
self.value as? Bool
}
var intValue: Int? {
self.value as? Int
}
var doubleValue: Double? {
self.value as? Double
}
var dictionaryValue: [String: OpenClawProtocol.AnyCodable]? {
self.value as? [String: OpenClawProtocol.AnyCodable]
}
var arrayValue: [OpenClawProtocol.AnyCodable]? {
self.value as? [OpenClawProtocol.AnyCodable]
}
var foundationValue: Any {
switch self.value {

View File

@@ -422,11 +422,10 @@ final class AppState {
let trimmedUser = parsed.user?.trimmingCharacters(in: .whitespacesAndNewlines)
let user = (trimmedUser?.isEmpty ?? true) ? nil : trimmedUser
let port = parsed.port
let assembled: String
if let user {
assembled = port == 22 ? "\(user)@\(host)" : "\(user)@\(host):\(port)"
let assembled: String = if let user {
port == 22 ? "\(user)@\(host)" : "\(user)@\(host):\(port)"
} else {
assembled = port == 22 ? host : "\(host):\(port)"
port == 22 ? host : "\(host):\(port)"
}
if assembled != self.remoteTarget {
self.remoteTarget = assembled
@@ -698,7 +697,9 @@ extension AppState {
@MainActor
enum AppStateStore {
static let shared = AppState()
static var isPausedFlag: Bool { UserDefaults.standard.bool(forKey: pauseDefaultsKey) }
static var isPausedFlag: Bool {
UserDefaults.standard.bool(forKey: pauseDefaultsKey)
}
static func updateLaunchAtLogin(enabled: Bool) {
Task.detached(priority: .utility) {

View File

@@ -1,8 +1,8 @@
import AVFoundation
import OpenClawIPC
import OpenClawKit
import CoreGraphics
import Foundation
import OpenClawIPC
import OpenClawKit
import OSLog
actor CameraCaptureService {

View File

@@ -1,7 +1,7 @@
import AppKit
import Foundation
import OpenClawIPC
import OpenClawKit
import Foundation
import WebKit
final class CanvasA2UIActionMessageHandler: NSObject, WKScriptMessageHandler {

View File

@@ -39,7 +39,9 @@ final class HoverChromeContainerView: NSView {
}
@available(*, unavailable)
required init?(coder: NSCoder) { fatalError("init(coder:) is not supported") }
required init?(coder: NSCoder) {
fatalError("init(coder:) is not supported")
}
override func updateTrackingAreas() {
super.updateTrackingAreas()
@@ -60,14 +62,18 @@ final class HoverChromeContainerView: NSView {
self.window?.performDrag(with: event)
}
override func acceptsFirstMouse(for _: NSEvent?) -> Bool { true }
override func acceptsFirstMouse(for _: NSEvent?) -> Bool {
true
}
}
private final class CanvasResizeHandleView: NSView {
private var startPoint: NSPoint = .zero
private var startFrame: NSRect = .zero
override func acceptsFirstMouse(for _: NSEvent?) -> Bool { true }
override func acceptsFirstMouse(for _: NSEvent?) -> Bool {
true
}
override func mouseDown(with event: NSEvent) {
guard let window else { return }
@@ -102,7 +108,9 @@ final class HoverChromeContainerView: NSView {
private let resizeHandle = CanvasResizeHandleView(frame: .zero)
private final class PassthroughVisualEffectView: NSVisualEffectView {
override func hitTest(_: NSPoint) -> NSView? { nil }
override func hitTest(_: NSPoint) -> NSView? {
nil
}
}
private let closeBackground: NSVisualEffectView = {
@@ -190,7 +198,9 @@ final class HoverChromeContainerView: NSView {
}
@available(*, unavailable)
required init?(coder: NSCoder) { fatalError("init(coder:) is not supported") }
required init?(coder: NSCoder) {
fatalError("init(coder:) is not supported")
}
override func hitTest(_ point: NSPoint) -> NSView? {
// When the chrome is hidden, do not intercept any mouse events (let the WKWebView receive them).

View File

@@ -1,7 +1,7 @@
import AppKit
import Foundation
import OpenClawIPC
import OpenClawKit
import Foundation
import OSLog
@MainActor

View File

@@ -1,5 +1,5 @@
import OpenClawKit
import Foundation
import OpenClawKit
import OSLog
import WebKit

View File

@@ -11,8 +11,13 @@ enum CanvasLayout {
}
final class CanvasPanel: NSPanel {
override var canBecomeKey: Bool { true }
override var canBecomeMain: Bool { true }
override var canBecomeKey: Bool {
true
}
override var canBecomeMain: Bool {
true
}
}
enum CanvasPresentation {

View File

@@ -19,7 +19,8 @@ extension CanvasWindowController {
// Deep links: allow local Canvas content to invoke the agent without bouncing through NSWorkspace.
if scheme == "openclaw" {
if let currentScheme = self.webView.url?.scheme,
CanvasScheme.allSchemes.contains(currentScheme) {
CanvasScheme.allSchemes.contains(currentScheme)
{
Task { await DeepLinkHandler.shared.handle(url: url) }
} else {
canvasWindowLogger

View File

@@ -1,7 +1,7 @@
import AppKit
import Foundation
import OpenClawIPC
import OpenClawKit
import Foundation
import WebKit
@MainActor
@@ -183,7 +183,9 @@ final class CanvasWindowController: NSWindowController, WKNavigationDelegate, NS
}
@available(*, unavailable)
required init?(coder: NSCoder) { fatalError("init(coder:) is not supported") }
required init?(coder: NSCoder) {
fatalError("init(coder:) is not supported")
}
@MainActor deinit {
for name in CanvasA2UIActionMessageHandler.allMessageNames {

View File

@@ -10,7 +10,6 @@ extension ChannelsSettings {
}
}
@ViewBuilder
func channelHeaderActions(_ channel: ChannelItem) -> some View {
HStack(spacing: 8) {
if channel.id == "whatsapp" {
@@ -88,7 +87,6 @@ extension ChannelsSettings {
}
}
@ViewBuilder
func genericChannelSection(_ channel: ChannelItem) -> some View {
VStack(alignment: .leading, spacing: 16) {
self.configEditorSection(channelId: channel.id)

View File

@@ -1,5 +1,5 @@
import OpenClawProtocol
import Foundation
import OpenClawProtocol
extension ChannelsStore {
func loadConfigSchema() async {

View File

@@ -1,5 +1,5 @@
import OpenClawProtocol
import Foundation
import OpenClawProtocol
extension ChannelsStore {
func start() {

View File

@@ -1,6 +1,6 @@
import OpenClawProtocol
import Foundation
import Observation
import OpenClawProtocol
struct ChannelsStatusSnapshot: Codable {
struct WhatsAppSelf: Codable {

View File

@@ -39,11 +39,26 @@ struct ConfigSchemaNode {
self.raw = dict
}
var title: String? { self.raw["title"] as? String }
var description: String? { self.raw["description"] as? String }
var enumValues: [Any]? { self.raw["enum"] as? [Any] }
var constValue: Any? { self.raw["const"] }
var explicitDefault: Any? { self.raw["default"] }
var title: String? {
self.raw["title"] as? String
}
var description: String? {
self.raw["description"] as? String
}
var enumValues: [Any]? {
self.raw["enum"] as? [Any]
}
var constValue: Any? {
self.raw["const"]
}
var explicitDefault: Any? {
self.raw["default"]
}
var requiredKeys: Set<String> {
Set((self.raw["required"] as? [String]) ?? [])
}

View File

@@ -45,7 +45,9 @@ extension ConfigSettings {
let help: String?
let node: ConfigSchemaNode
var id: String { self.key }
var id: String {
self.key
}
}
private struct ConfigSubsection: Identifiable {
@@ -55,7 +57,9 @@ extension ConfigSettings {
let node: ConfigSchemaNode
let path: ConfigPath
var id: String { self.key }
var id: String {
self.key
}
}
private var sections: [ConfigSection] {

View File

@@ -1,5 +1,5 @@
import OpenClawProtocol
import Foundation
import OpenClawProtocol
enum ConfigStore {
struct Overrides: Sendable {

View File

@@ -70,7 +70,6 @@ struct ContextMenuCardView: View {
return "\(count) sessions · 24h"
}
@ViewBuilder
private func sessionRow(_ row: SessionRow) -> some View {
VStack(alignment: .leading, spacing: 5) {
ContextUsageBar(

View File

@@ -1,7 +1,7 @@
import OpenClawKit
import OpenClawProtocol
import Foundation
import Observation
import OpenClawKit
import OpenClawProtocol
import SwiftUI
struct ControlHeartbeatEvent: Codable {
@@ -15,7 +15,10 @@ struct ControlHeartbeatEvent: Codable {
}
struct ControlAgentEvent: Codable, Sendable, Identifiable {
var id: String { "\(self.runId)-\(self.seq)" }
var id: String {
"\(self.runId)-\(self.seq)"
}
let runId: String
let seq: Int
let stream: String

View File

@@ -1,5 +1,5 @@
import OpenClawProtocol
import Foundation
import OpenClawProtocol
import SwiftUI
extension CronJobEditor {

View File

@@ -1,5 +1,5 @@
import OpenClawProtocol
import Observation
import OpenClawProtocol
import SwiftUI
struct CronJobEditor: View {
@@ -32,18 +32,24 @@ struct CronJobEditor: View {
@State var wakeMode: CronWakeMode = .now
@State var deleteAfterRun: Bool = false
enum ScheduleKind: String, CaseIterable, Identifiable { case at, every, cron; var id: String { rawValue } }
enum ScheduleKind: String, CaseIterable, Identifiable { case at, every, cron; var id: String {
rawValue
} }
@State var scheduleKind: ScheduleKind = .every
@State var atDate: Date = .init().addingTimeInterval(60 * 5)
@State var everyText: String = "1h"
@State var cronExpr: String = "0 9 * * 3"
@State var cronTz: String = ""
enum PayloadKind: String, CaseIterable, Identifiable { case systemEvent, agentTurn; var id: String { rawValue } }
enum PayloadKind: String, CaseIterable, Identifiable { case systemEvent, agentTurn; var id: String {
rawValue
} }
@State var payloadKind: PayloadKind = .systemEvent
@State var systemEventText: String = ""
@State var agentMessage: String = ""
enum DeliveryChoice: String, CaseIterable, Identifiable { case announce, none; var id: String { rawValue } }
enum DeliveryChoice: String, CaseIterable, Identifiable { case announce, none; var id: String {
rawValue
} }
@State var deliveryMode: DeliveryChoice = .announce
@State var channel: String = "last"
@State var to: String = ""
@@ -244,7 +250,6 @@ struct CronJobEditor: View {
}
}
}
}
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.vertical, 2)

View File

@@ -1,7 +1,7 @@
import OpenClawKit
import OpenClawProtocol
import Foundation
import Observation
import OpenClawKit
import OpenClawProtocol
import OSLog
@MainActor

View File

@@ -4,21 +4,27 @@ enum CronSessionTarget: String, CaseIterable, Identifiable, Codable {
case main
case isolated
var id: String { self.rawValue }
var id: String {
self.rawValue
}
}
enum CronWakeMode: String, CaseIterable, Identifiable, Codable {
case now
case nextHeartbeat = "next-heartbeat"
var id: String { self.rawValue }
var id: String {
self.rawValue
}
}
enum CronDeliveryMode: String, CaseIterable, Identifiable, Codable {
case none
case announce
var id: String { self.rawValue }
var id: String {
self.rawValue
}
}
struct CronDelivery: Codable, Equatable {
@@ -98,11 +104,11 @@ enum CronSchedule: Codable, Equatable {
let trimmed = value.trimmingCharacters(in: .whitespacesAndNewlines)
if trimmed.isEmpty { return nil }
if let date = makeIsoFormatter(withFractional: true).date(from: trimmed) { return date }
return makeIsoFormatter(withFractional: false).date(from: trimmed)
return self.makeIsoFormatter(withFractional: false).date(from: trimmed)
}
static func formatIsoDate(_ date: Date) -> String {
makeIsoFormatter(withFractional: false).string(from: date)
self.makeIsoFormatter(withFractional: false).string(from: date)
}
private static func makeIsoFormatter(withFractional: Bool) -> ISO8601DateFormatter {
@@ -231,7 +237,9 @@ struct CronEvent: Codable, Sendable {
}
struct CronRunLogEntry: Codable, Identifiable, Sendable {
var id: String { "\(self.jobId)-\(self.ts)" }
var id: String {
"\(self.jobId)-\(self.ts)"
}
let ts: Int
let jobId: String
@@ -243,7 +251,10 @@ struct CronRunLogEntry: Codable, Identifiable, Sendable {
let durationMs: Int?
let nextRunAtMs: Int?
var date: Date { Date(timeIntervalSince1970: TimeInterval(self.ts) / 1000) }
var date: Date {
Date(timeIntervalSince1970: TimeInterval(self.ts) / 1000)
}
var runDate: Date? {
guard let runAtMs else { return nil }
return Date(timeIntervalSince1970: TimeInterval(runAtMs) / 1000)

View File

@@ -1,5 +1,5 @@
import OpenClawProtocol
import Foundation
import OpenClawProtocol
extension CronSettings {
func save(payload: [String: AnyCodable]) async {

View File

@@ -1,13 +1,13 @@
import AppKit
import OpenClawKit
import Foundation
import OpenClawKit
import OSLog
import Security
private let deepLinkLogger = Logger(subsystem: "ai.openclaw", category: "DeepLink")
enum DeepLinkAgentPolicy {
static let maxMessageChars = 20_000
static let maxMessageChars = 20000
static let maxUnkeyedConfirmChars = 240
enum ValidationError: Error, Equatable, LocalizedError {
@@ -16,7 +16,7 @@ enum DeepLinkAgentPolicy {
var errorDescription: String? {
switch self {
case let .messageTooLongForConfirmation(max, actual):
return "Message is too long to confirm safely (\(actual) chars; max \(max) without key)."
"Message is too long to confirm safely (\(actual) chars; max \(max) without key)."
}
}
}
@@ -49,9 +49,9 @@ final class DeepLinkHandler {
private var lastPromptAt: Date = .distantPast
// Ephemeral, in-memory key used for unattended deep links originating from the in-app Canvas.
// This avoids blocking Canvas init on UserDefaults and doesn't weaken the external deep-link prompt:
// outside callers can't know this randomly generated key.
/// Ephemeral, in-memory key used for unattended deep links originating from the in-app Canvas.
/// This avoids blocking Canvas init on UserDefaults and doesn't weaken the external deep-link prompt:
/// outside callers can't know this randomly generated key.
private nonisolated static let canvasUnattendedKey: String = DeepLinkHandler.generateRandomKey()
func handle(url: URL) async {

View File

@@ -1,8 +1,8 @@
import AppKit
import OpenClawKit
import OpenClawProtocol
import Foundation
import Observation
import OpenClawKit
import OpenClawProtocol
import OSLog
@MainActor
@@ -23,8 +23,13 @@ final class DevicePairingApprovalPrompter {
private var resolvedByRequestId: Set<String> = []
private final class AlertHostWindow: NSWindow {
override var canBecomeKey: Bool { true }
override var canBecomeMain: Bool { true }
override var canBecomeKey: Bool {
true
}
override var canBecomeMain: Bool {
true
}
}
private struct PairingList: Codable {
@@ -55,7 +60,9 @@ final class DevicePairingApprovalPrompter {
let isRepair: Bool?
let ts: Double
var id: String { self.requestId }
var id: String {
self.requestId
}
}
private struct PairingResolvedEvent: Codable {

View File

@@ -8,7 +8,9 @@ enum ExecSecurity: String, CaseIterable, Codable, Identifiable {
case allowlist
case full
var id: String { self.rawValue }
var id: String {
self.rawValue
}
var title: String {
switch self {
@@ -24,7 +26,9 @@ enum ExecApprovalQuickMode: String, CaseIterable, Identifiable {
case ask
case allow
var id: String { self.rawValue }
var id: String {
self.rawValue
}
var title: String {
switch self {
@@ -67,7 +71,9 @@ enum ExecAsk: String, CaseIterable, Codable, Identifiable {
case onMiss = "on-miss"
case always
var id: String { self.rawValue }
var id: String {
self.rawValue
}
var title: String {
switch self {

View File

@@ -1,7 +1,7 @@
import OpenClawKit
import OpenClawProtocol
import CoreGraphics
import Foundation
import OpenClawKit
import OpenClawProtocol
import OSLog
@MainActor

View File

@@ -1,8 +1,8 @@
import AppKit
import OpenClawKit
import CryptoKit
import Darwin
import Foundation
import OpenClawKit
import OSLog
struct ExecApprovalPromptRequest: Codable, Sendable {
@@ -76,7 +76,9 @@ private struct ExecHostResponse: Codable {
enum ExecApprovalsSocketClient {
private struct TimeoutError: LocalizedError {
var message: String
var errorDescription: String? { self.message }
var errorDescription: String? {
self.message
}
}
static func requestDecision(

View File

@@ -1,7 +1,7 @@
import Foundation
import OpenClawChatUI
import OpenClawKit
import OpenClawProtocol
import Foundation
import OSLog
private let gatewayConnectionLogger = Logger(subsystem: "ai.openclaw", category: "gateway.connection")
@@ -24,9 +24,13 @@ enum GatewayAgentChannel: String, Codable, CaseIterable, Sendable {
self = GatewayAgentChannel(rawValue: normalized) ?? .last
}
var isDeliverable: Bool { self != .webchat }
var isDeliverable: Bool {
self != .webchat
}
func shouldDeliver(_ deliver: Bool) -> Bool { deliver && self.isDeliverable }
func shouldDeliver(_ deliver: Bool) -> Bool {
deliver && self.isDeliverable
}
}
struct GatewayAgentInvocation: Sendable {

View File

@@ -1,5 +1,5 @@
import OpenClawDiscovery
import Foundation
import OpenClawDiscovery
enum GatewayDiscoveryHelpers {
static func sshTarget(for gateway: GatewayDiscoveryModel.DiscoveredGateway) -> String? {

View File

@@ -1,14 +1,16 @@
import OpenClawIPC
import Foundation
import OpenClawIPC
import OSLog
// Lightweight SemVer helper (major.minor.patch only) for gateway compatibility checks.
/// Lightweight SemVer helper (major.minor.patch only) for gateway compatibility checks.
struct Semver: Comparable, CustomStringConvertible, Sendable {
let major: Int
let minor: Int
let patch: Int
var description: String { "\(self.major).\(self.minor).\(self.patch)" }
var description: String {
"\(self.major).\(self.minor).\(self.patch)"
}
static func < (lhs: Semver, rhs: Semver) -> Bool {
if lhs.major != rhs.major { return lhs.major < rhs.major }
@@ -93,7 +95,7 @@ enum GatewayEnvironment {
return (trimmed?.isEmpty == false) ? trimmed : nil
}
// Exposed for tests so we can inject fake version checks without rewriting bundle metadata.
/// Exposed for tests so we can inject fake version checks without rewriting bundle metadata.
static func expectedGatewayVersion(from versionString: String?) -> Semver? {
Semver.parse(versionString)
}

View File

@@ -1,8 +1,8 @@
import AppKit
import Observation
import OpenClawDiscovery
import OpenClawIPC
import OpenClawKit
import Observation
import SwiftUI
struct GeneralSettings: View {
@@ -16,8 +16,13 @@ struct GeneralSettings: View {
@State private var remoteStatus: RemoteStatus = .idle
@State private var showRemoteAdvanced = false
private let isPreview = ProcessInfo.processInfo.isPreview
private var isNixMode: Bool { ProcessInfo.processInfo.isNixMode }
private var remoteLabelWidth: CGFloat { 88 }
private var isNixMode: Bool {
ProcessInfo.processInfo.isNixMode
}
private var remoteLabelWidth: CGFloat {
88
}
var body: some View {
ScrollView(.vertical) {

View File

@@ -89,8 +89,8 @@ final class HealthStore {
}
}
// Test-only escape hatch: the HealthStore is a process-wide singleton but
// state derivation is pure from `snapshot` + `lastError`.
/// Test-only escape hatch: the HealthStore is a process-wide singleton but
/// state derivation is pure from `snapshot` + `lastError`.
func __setSnapshotForTest(_ snapshot: HealthSnapshot?, lastError: String? = nil) {
self.snapshot = snapshot
self.lastError = lastError

View File

@@ -72,7 +72,9 @@ enum IconOverrideSelection: String, CaseIterable, Identifiable {
case mainBash, mainRead, mainWrite, mainEdit, mainOther
case otherBash, otherRead, otherWrite, otherEdit, otherOther
var id: String { self.rawValue }
var id: String {
self.rawValue
}
var label: String {
switch self {

View File

@@ -1,8 +1,8 @@
import OpenClawKit
import OpenClawProtocol
import Cocoa
import Foundation
import Observation
import OpenClawKit
import OpenClawProtocol
import OSLog
struct InstanceInfo: Identifiable, Codable {

View File

@@ -7,8 +7,7 @@ enum LogLocator {
{
return URL(fileURLWithPath: override)
}
let preferred = URL(fileURLWithPath: "/tmp/openclaw")
return preferred
return URL(fileURLWithPath: "/tmp/openclaw")
}
private static var stdoutLog: URL {

View File

@@ -37,7 +37,9 @@ enum AppLogLevel: String, CaseIterable, Identifiable {
static let `default`: AppLogLevel = .info
var id: String { self.rawValue }
var id: String {
self.rawValue
}
var title: String {
switch self {

View File

@@ -345,7 +345,7 @@ protocol UpdaterProviding: AnyObject {
func checkForUpdates(_ sender: Any?)
}
// No-op updater used for debug/dev runs to suppress Sparkle dialogs.
/// No-op updater used for debug/dev runs to suppress Sparkle dialogs.
final class DisabledUpdaterController: UpdaterProviding {
var automaticallyChecksForUpdates: Bool = false
var automaticallyDownloadsUpdates: Bool = false
@@ -394,7 +394,9 @@ final class SparkleUpdaterController: NSObject, UpdaterProviding {
set { self.controller.updater.automaticallyDownloadsUpdates = newValue }
}
var isAvailable: Bool { true }
var isAvailable: Bool {
true
}
func checkForUpdates(_ sender: Any?) {
self.controller.checkForUpdates(sender)

View File

@@ -400,7 +400,6 @@ struct MenuContent: View {
}
}
@ViewBuilder
private func statusLine(label: String, color: Color) -> some View {
HStack(spacing: 6) {
Circle()
@@ -590,6 +589,8 @@ struct MenuContent: View {
private struct AudioInputDevice: Identifiable, Equatable {
let uid: String
let name: String
var id: String { self.uid }
var id: String {
self.uid
}
}
}

View File

@@ -22,7 +22,9 @@ final class HighlightedMenuItemHostView: NSView {
}
@available(*, unavailable)
required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") }
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override var intrinsicContentSize: NSSize {
let size = self.hosting.fittingSize

View File

@@ -159,7 +159,9 @@ final class MenuSessionsInjector: NSObject, NSMenuDelegate {
extension MenuSessionsInjector {
// MARK: - Injection
private var mainSessionKey: String { WorkActivityStore.shared.mainSessionKey }
private var mainSessionKey: String {
WorkActivityStore.shared.mainSessionKey
}
private func inject(into menu: NSMenu) {
self.cancelPreviewTasks()
@@ -1175,8 +1177,7 @@ extension MenuSessionsInjector {
private func makeHostedView(rootView: AnyView, width: CGFloat, highlighted: Bool) -> NSView {
if highlighted {
let container = HighlightedMenuItemHostView(rootView: rootView, width: width)
return container
return HighlightedMenuItemHostView(rootView: rootView, width: width)
}
let hosting = NSHostingView(rootView: rootView)

View File

@@ -64,8 +64,7 @@ actor MicLevelMonitor {
}
let rms = sqrt(sum / Float(frameCount) + 1e-12)
let db = 20 * log10(Double(rms))
let normalized = max(0, min(1, (db + 50) / 50))
return normalized
return max(0, min(1, (db + 50) / 50))
}
}

View File

@@ -2,7 +2,10 @@ import Foundation
import JavaScriptCore
enum ModelCatalogLoader {
static var defaultPath: String { self.resolveDefaultPath() }
static var defaultPath: String {
self.resolveDefaultPath()
}
private static let logger = Logger(subsystem: "ai.openclaw", category: "models")
private nonisolated static let appSupportDir: URL = {
let base = FileManager().urls(for: .applicationSupportDirectory, in: .userDomainMask).first!

View File

@@ -1,6 +1,6 @@
import OpenClawKit
import CoreLocation
import Foundation
import OpenClawKit
@MainActor
final class MacNodeLocationService: NSObject, CLLocationManagerDelegate {

View File

@@ -1,5 +1,5 @@
import OpenClawKit
import Foundation
import OpenClawKit
import OSLog
@MainActor

View File

@@ -1,7 +1,7 @@
import AppKit
import Foundation
import OpenClawIPC
import OpenClawKit
import Foundation
actor MacNodeRuntime {
private let cameraCapture = CameraCaptureService()

View File

@@ -1,6 +1,6 @@
import OpenClawKit
import CoreLocation
import Foundation
import OpenClawKit
@MainActor
protocol MacNodeRuntimeMainActorServices: Sendable {

View File

@@ -1,10 +1,10 @@
import AppKit
import Foundation
import Observation
import OpenClawDiscovery
import OpenClawIPC
import OpenClawKit
import OpenClawProtocol
import Foundation
import Observation
import OSLog
import UserNotifications
@@ -39,8 +39,13 @@ final class NodePairingApprovalPrompter {
private var autoApproveAttempts: Set<String> = []
private final class AlertHostWindow: NSWindow {
override var canBecomeKey: Bool { true }
override var canBecomeMain: Bool { true }
override var canBecomeKey: Bool {
true
}
override var canBecomeMain: Bool {
true
}
}
private struct PairingList: Codable {
@@ -68,7 +73,9 @@ final class NodePairingApprovalPrompter {
let silent: Bool?
let ts: Double
var id: String { self.requestId }
var id: String {
self.requestId
}
}
private struct PairingResolvedEvent: Codable {

View File

@@ -18,9 +18,17 @@ struct NodeInfo: Identifiable, Codable {
let paired: Bool?
let connected: Bool?
var id: String { self.nodeId }
var isConnected: Bool { self.connected ?? false }
var isPaired: Bool { self.paired ?? false }
var id: String {
self.nodeId
}
var isConnected: Bool {
self.connected ?? false
}
var isPaired: Bool {
self.paired ?? false
}
}
private struct NodeListResponse: Codable {

View File

@@ -1,5 +1,5 @@
import OpenClawIPC
import Foundation
import OpenClawIPC
import Security
import UserNotifications

View File

@@ -10,7 +10,9 @@ final class NotifyOverlayController {
static let shared = NotifyOverlayController()
private(set) var model = Model()
var isVisible: Bool { self.model.isVisible }
var isVisible: Bool {
self.model.isVisible
}
struct Model {
var title: String = ""

View File

@@ -1,9 +1,9 @@
import AppKit
import Combine
import Observation
import OpenClawChatUI
import OpenClawDiscovery
import OpenClawIPC
import Combine
import Observation
import SwiftUI
enum UIStrings {
@@ -142,18 +142,30 @@ struct OnboardingView: View {
Self.pageOrder(for: self.state.connectionMode, showOnboardingChat: self.showOnboardingChat)
}
var pageCount: Int { self.pageOrder.count }
var pageCount: Int {
self.pageOrder.count
}
var activePageIndex: Int {
self.activePageIndex(for: self.currentPage)
}
var buttonTitle: String { self.currentPage == self.pageCount - 1 ? "Finish" : "Next" }
var wizardPageOrderIndex: Int? { self.pageOrder.firstIndex(of: self.wizardPageIndex) }
var buttonTitle: String {
self.currentPage == self.pageCount - 1 ? "Finish" : "Next"
}
var wizardPageOrderIndex: Int? {
self.pageOrder.firstIndex(of: self.wizardPageIndex)
}
var isWizardBlocking: Bool {
self.activePageIndex == self.wizardPageIndex && !self.onboardingWizard.isComplete
}
var canAdvance: Bool { !self.isWizardBlocking }
var canAdvance: Bool {
!self.isWizardBlocking
}
var devLinkCommand: String {
let version = GatewayEnvironment.expectedGatewayVersionString() ?? "latest"
return "npm install -g openclaw@\(version)"

View File

@@ -1,7 +1,7 @@
import AppKit
import Foundation
import OpenClawDiscovery
import OpenClawIPC
import Foundation
import SwiftUI
extension OnboardingView {

View File

@@ -1,5 +1,5 @@
import OpenClawIPC
import Foundation
import OpenClawIPC
extension OnboardingView {
@MainActor

View File

@@ -206,7 +206,9 @@ extension OnboardingView {
.textFieldStyle(.roundedBorder)
.frame(width: fieldWidth)
}
if let message = CommandResolver.sshTargetValidationMessage(self.state.remoteTarget) {
if let message = CommandResolver
.sshTargetValidationMessage(self.state.remoteTarget)
{
GridRow {
Text("")
.frame(width: labelWidth, alignment: .leading)

View File

@@ -1,5 +1,5 @@
import OpenClawProtocol
import Observation
import OpenClawProtocol
import SwiftUI
extension OnboardingView {

View File

@@ -23,7 +23,7 @@ extension OnboardingView {
} catch {
self.workspaceStatus = "Failed to create workspace: \(error.localizedDescription)"
}
case let .unsafe(reason):
case let .unsafe (reason):
self.workspaceStatus = "Workspace not touched: \(reason)"
}
self.refreshBootstrapStatus()
@@ -54,7 +54,7 @@ extension OnboardingView {
do {
let url = AgentWorkspace.resolveWorkspaceURL(from: self.workspacePath)
if case let .unsafe(reason) = AgentWorkspace.bootstrapSafety(for: url) {
if case let .unsafe (reason) = AgentWorkspace.bootstrapSafety(for: url) {
self.workspaceStatus = "Workspace not created: \(reason)"
return
}

View File

@@ -1,7 +1,7 @@
import OpenClawKit
import OpenClawProtocol
import Foundation
import Observation
import OpenClawKit
import OpenClawProtocol
import OSLog
import SwiftUI
@@ -41,8 +41,13 @@ final class OnboardingWizardModel {
private var restartAttempts = 0
private let maxRestartAttempts = 1
var isComplete: Bool { self.status == "done" }
var isRunning: Bool { self.status == "running" }
var isComplete: Bool {
self.status == "done"
}
var isRunning: Bool {
self.status == "running"
}
func reset() {
self.sessionId = nil
@@ -408,5 +413,7 @@ private struct WizardOptionItem: Identifiable {
let index: Int
let option: WizardOption
var id: Int { self.index }
var id: Int {
self.index
}
}

View File

@@ -1,5 +1,5 @@
import OpenClawProtocol
import Foundation
import OpenClawProtocol
enum OpenClawConfigFile {
private static let logger = Logger(subsystem: "ai.openclaw", category: "config")

View File

@@ -24,8 +24,7 @@ enum OpenClawPaths {
}
}
let home = FileManager().homeDirectoryForCurrentUser
let preferred = home.appendingPathComponent(".openclaw", isDirectory: true)
return preferred
return home.appendingPathComponent(".openclaw", isDirectory: true)
}
private static func resolveConfigCandidate(in dir: URL) -> URL? {

View File

@@ -1,11 +1,11 @@
import AppKit
import ApplicationServices
import AVFoundation
import OpenClawIPC
import CoreGraphics
import CoreLocation
import Foundation
import Observation
import OpenClawIPC
import Speech
import UserNotifications
@@ -336,7 +336,7 @@ final class LocationPermissionRequester: NSObject, CLLocationManagerDelegate {
cont.resume(returning: status)
}
// nonisolated for Swift 6 strict concurrency compatibility
/// nonisolated for Swift 6 strict concurrency compatibility
nonisolated func locationManagerDidChangeAuthorization(_ manager: CLLocationManager) {
let status = manager.authorizationStatus
Task { @MainActor in
@@ -344,7 +344,7 @@ final class LocationPermissionRequester: NSObject, CLLocationManagerDelegate {
}
}
// Legacy callback (still used on some macOS versions / configurations).
/// Legacy callback (still used on some macOS versions / configurations).
nonisolated func locationManager(
_ manager: CLLocationManager,
didChangeAuthorization status: CLAuthorizationStatus)

View File

@@ -1,6 +1,6 @@
import CoreLocation
import OpenClawIPC
import OpenClawKit
import CoreLocation
import SwiftUI
struct PermissionsSettings: View {
@@ -164,7 +164,9 @@ struct PermissionRow: View {
.padding(.vertical, self.compact ? 4 : 6)
}
private var iconSize: CGFloat { self.compact ? 28 : 32 }
private var iconSize: CGFloat {
self.compact ? 28 : 32
}
private var title: String {
switch self.capability {

View File

@@ -103,7 +103,9 @@ actor PortGuardian {
let status: Status
let listeners: [ReportListener]
var id: Int { self.port }
var id: Int {
self.port
}
var offenders: [ReportListener] {
if case let .interference(_, offenders) = self.status { return offenders }
@@ -141,7 +143,9 @@ actor PortGuardian {
let user: String?
let expected: Bool
var id: Int32 { self.pid }
var id: Int32 {
self.pid
}
}
func diagnose(mode: AppState.ConnectionMode) async -> [PortReport] {

View File

@@ -12,8 +12,8 @@ extension ProcessInfo {
environment: [String: String],
standard: UserDefaults,
stableSuite: UserDefaults?,
isAppBundle: Bool
) -> Bool {
isAppBundle: Bool) -> Bool
{
if environment["OPENCLAW_NIX_MODE"] == "1" { return true }
if standard.bool(forKey: "openclaw.nixMode") { return true }

View File

@@ -10,7 +10,9 @@ struct RuntimeVersion: Comparable, CustomStringConvertible {
let minor: Int
let patch: Int
var description: String { "\(self.major).\(self.minor).\(self.patch)" }
var description: String {
"\(self.major).\(self.minor).\(self.patch)"
}
static func < (lhs: RuntimeVersion, rhs: RuntimeVersion) -> Bool {
if lhs.major != rhs.major { return lhs.major < rhs.major }
@@ -163,5 +165,7 @@ enum RuntimeLocator {
}
extension RuntimeKind {
fileprivate var binaryName: String { "node" }
fileprivate var binaryName: String {
"node"
}
}

View File

@@ -84,8 +84,13 @@ struct SessionRow: Identifiable {
let tokens: SessionTokenStats
let model: String?
var ageText: String { relativeAge(from: self.updatedAt) }
var label: String { self.displayName ?? self.key }
var ageText: String {
relativeAge(from: self.updatedAt)
}
var label: String {
self.displayName ?? self.key
}
var flagLabels: [String] {
var flags: [String] = []

View File

@@ -1,14 +1,7 @@
import SwiftUI
private struct MenuItemHighlightedKey: EnvironmentKey {
static let defaultValue = false
}
extension EnvironmentValues {
var menuItemHighlighted: Bool {
get { self[MenuItemHighlightedKey.self] }
set { self[MenuItemHighlightedKey.self] = newValue }
}
@Entry var menuItemHighlighted: Bool = false
}
struct SessionMenuLabelView: View {

View File

@@ -183,7 +183,6 @@ struct SessionMenuPreviewView: View {
.frame(width: max(1, self.width), alignment: .leading)
}
@ViewBuilder
private func previewRow(_ item: SessionPreviewItem) -> some View {
HStack(alignment: .top, spacing: 4) {
Text(item.role.label)
@@ -212,7 +211,6 @@ struct SessionMenuPreviewView: View {
}
}
@ViewBuilder
private func placeholder(_ text: String) -> some View {
Text(text)
.font(.caption)
@@ -227,7 +225,9 @@ enum SessionMenuPreviewLoader {
private static let previewMaxChars = 240
private struct PreviewTimeoutError: LocalizedError {
var errorDescription: String? { "preview timeout" }
var errorDescription: String? {
"preview timeout"
}
}
static func prewarm(sessionKeys: [String], maxItems: Int) async {

View File

@@ -85,7 +85,6 @@ struct SessionsSettings: View {
}
}
@ViewBuilder
private func sessionRow(_ row: SessionRow) -> some View {
VStack(alignment: .leading, spacing: 6) {
HStack(alignment: .firstTextBaseline, spacing: 8) {

View File

@@ -1,5 +1,5 @@
import OpenClawIPC
import Foundation
import OpenClawIPC
enum ShellExecutor {
struct ShellResult {
@@ -69,7 +69,7 @@ enum ShellExecutor {
if let timeout, timeout > 0 {
let nanos = UInt64(timeout * 1_000_000_000)
let result = await withTaskGroup(of: ShellResult.self) { group in
return await withTaskGroup(of: ShellResult.self) { group in
group.addTask { await waitTask.value }
group.addTask {
try? await Task.sleep(nanoseconds: nanos)
@@ -87,7 +87,6 @@ enum ShellExecutor {
group.cancelAll()
return first
}
return result
}
return await waitTask.value

View File

@@ -1,5 +1,5 @@
import OpenClawProtocol
import Foundation
import OpenClawProtocol
struct SkillsStatusReport: Codable {
let workspaceDir: String
@@ -25,7 +25,9 @@ struct SkillStatus: Codable, Identifiable {
let configChecks: [SkillStatusConfigCheck]
let install: [SkillInstallOption]
var id: String { self.name }
var id: String {
self.name
}
}
struct SkillRequirements: Codable {
@@ -45,7 +47,9 @@ struct SkillStatusConfigCheck: Codable, Identifiable {
let value: AnyCodable?
let satisfied: Bool
var id: String { self.path }
var id: String {
self.path
}
}
struct SkillInstallOption: Codable, Identifiable {

View File

@@ -1,5 +1,5 @@
import OpenClawProtocol
import Observation
import OpenClawProtocol
import SwiftUI
struct SkillsSettings: View {
@@ -142,7 +142,9 @@ private enum SkillsFilter: String, CaseIterable, Identifiable {
case needsSetup
case disabled
var id: String { self.rawValue }
var id: String {
self.rawValue
}
var title: String {
switch self {
@@ -171,24 +173,16 @@ private struct SkillRow: View {
let onInstall: (SkillInstallOption, InstallTarget) -> Void
let onSetEnv: (String, Bool) -> Void
private var missingBins: [String] { self.skill.missing.bins }
private var missingEnv: [String] { self.skill.missing.env }
private var missingConfig: [String] { self.skill.missing.config }
private var missingBins: [String] {
self.skill.missing.bins
}
init(
skill: SkillStatus,
isBusy: Bool,
connectionMode: AppState.ConnectionMode,
onToggleEnabled: @escaping (Bool) -> Void,
onInstall: @escaping (SkillInstallOption, InstallTarget) -> Void,
onSetEnv: @escaping (String, Bool) -> Void)
{
self.skill = skill
self.isBusy = isBusy
self.connectionMode = connectionMode
self.onToggleEnabled = onToggleEnabled
self.onInstall = onInstall
self.onSetEnv = onSetEnv
private var missingEnv: [String] {
self.skill.missing.env
}
private var missingConfig: [String] {
self.skill.missing.config
}
var body: some View {
@@ -274,7 +268,6 @@ private struct SkillRow: View {
set: { self.onToggleEnabled($0) })
}
@ViewBuilder
private var missingSummary: some View {
VStack(alignment: .leading, spacing: 4) {
if self.shouldShowMissingBins {
@@ -295,7 +288,6 @@ private struct SkillRow: View {
}
}
@ViewBuilder
private var configChecksView: some View {
VStack(alignment: .leading, spacing: 4) {
ForEach(self.skill.configChecks) { check in
@@ -326,7 +318,6 @@ private struct SkillRow: View {
}
}
@ViewBuilder
private var trailingActions: some View {
VStack(alignment: .trailing, spacing: 8) {
if !self.installOptions.isEmpty {
@@ -438,7 +429,9 @@ private struct EnvEditorState: Identifiable {
let envKey: String
let isPrimary: Bool
var id: String { "\(self.skillKey)::\(self.envKey)" }
var id: String {
"\(self.skillKey)::\(self.envKey)"
}
}
private struct EnvEditorView: View {

View File

@@ -10,7 +10,9 @@ enum SoundEffectCatalog {
return ["Glass"] + sorted
}
static func displayName(for raw: String) -> String { raw }
static func displayName(for raw: String) -> String {
raw
}
static func url(for name: String) -> URL? {
self.discoveredSoundMap[name]

View File

@@ -150,7 +150,9 @@ private enum ExecApprovalsSettingsTab: String, CaseIterable, Identifiable {
case policy
case allowlist
var id: String { self.rawValue }
var id: String {
self.rawValue
}
var title: String {
switch self {

View File

@@ -5,7 +5,9 @@ private enum GatewayTailscaleMode: String, CaseIterable, Identifiable {
case serve
case funnel
var id: String { self.rawValue }
var id: String {
self.rawValue
}
var label: String {
switch self {

View File

@@ -1,7 +1,7 @@
import AVFoundation
import Foundation
import OpenClawChatUI
import OpenClawKit
import Foundation
import OSLog
import Speech

View File

@@ -99,8 +99,13 @@ private final class OrbInteractionNSView: NSView {
private var didDrag = false
private var suppressSingleClick = false
override var acceptsFirstResponder: Bool { true }
override func acceptsFirstMouse(for event: NSEvent?) -> Bool { true }
override var acceptsFirstResponder: Bool {
true
}
override func acceptsFirstMouse(for event: NSEvent?) -> Bool {
true
}
override func mouseDown(with event: NSEvent) {
self.mouseDownEvent = event

View File

@@ -41,8 +41,7 @@ struct UsageRow: Identifiable {
var remainingPercent: Int? {
guard let usedPercent, usedPercent.isFinite else { return nil }
let remaining = max(0, min(100, Int(round(100 - usedPercent))))
return remaining
return max(0, min(100, Int(round(100 - usedPercent))))
}
func detailText(now: Date = .init()) -> String {

View File

@@ -122,7 +122,7 @@ actor VoicePushToTalk {
private var recognitionTask: SFSpeechRecognitionTask?
private var tapInstalled = false
// Session token used to drop stale callbacks when a new capture starts.
/// Session token used to drop stale callbacks when a new capture starts.
private var sessionID = UUID()
private var committed: String = ""

View File

@@ -28,7 +28,9 @@ enum VoiceWakeChime: Codable, Equatable, Sendable {
enum VoiceWakeChimeCatalog {
/// Options shown in the picker.
static var systemOptions: [String] { SoundEffectCatalog.systemOptions }
static var systemOptions: [String] {
SoundEffectCatalog.systemOptions
}
static func displayName(for raw: String) -> String {
SoundEffectCatalog.displayName(for: raw)

View File

@@ -1,5 +1,5 @@
import OpenClawKit
import Foundation
import OpenClawKit
import OSLog
@MainActor

View File

@@ -18,7 +18,9 @@ final class VoiceWakeOverlayController {
enum Source: String { case wakeWord, pushToTalk }
var model = Model()
var isVisible: Bool { self.model.isVisible }
var isVisible: Bool {
self.model.isVisible
}
struct Model {
var text: String = ""

View File

@@ -11,7 +11,9 @@ struct TranscriptTextView: NSViewRepresentable {
var onEndEditing: () -> Void
var onSend: () -> Void
func makeCoordinator() -> Coordinator { Coordinator(self) }
func makeCoordinator() -> Coordinator {
Coordinator(self)
}
func makeNSView(context: Context) -> NSScrollView {
let textView = TranscriptNSTextView()
@@ -77,7 +79,9 @@ struct TranscriptTextView: NSViewRepresentable {
var parent: TranscriptTextView
var isProgrammaticUpdate = false
init(_ parent: TranscriptTextView) { self.parent = parent }
init(_ parent: TranscriptTextView) {
self.parent = parent
}
func textDidBeginEditing(_ notification: Notification) {
self.parent.onBeginEditing()
@@ -147,7 +151,9 @@ private final class ClickCatcher: NSView {
}
@available(*, unavailable)
required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") }
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func mouseDown(with event: NSEvent) {
super.mouseDown(with: event)

View File

@@ -131,7 +131,9 @@ private struct OverlayBackground: View {
}
extension OverlayBackground: @MainActor Equatable {
static func == (lhs: Self, rhs: Self) -> Bool { true }
static func == (lhs: Self, rhs: Self) -> Bool {
true
}
}
struct CloseHoverButton: View {

View File

@@ -48,10 +48,10 @@ actor VoiceWakeRuntime {
private var isStarting: Bool = false
private var triggerOnlyTask: Task<Void, Never>?
// Tunables
// Silence threshold once we've captured user speech (post-trigger).
/// Tunables
/// Silence threshold once we've captured user speech (post-trigger).
private let silenceWindow: TimeInterval = 2.0
// Silence threshold when we only heard the trigger but no post-trigger speech yet.
/// Silence threshold when we only heard the trigger but no post-trigger speech yet.
private let triggerOnlySilenceWindow: TimeInterval = 5.0
// Maximum capture duration from trigger until we force-send, to avoid runaway sessions.
private let captureHardStop: TimeInterval = 120.0

View File

@@ -29,7 +29,9 @@ struct VoiceWakeSettings: View {
private struct AudioInputDevice: Identifiable, Equatable {
let uid: String
let name: String
var id: String { self.uid }
var id: String {
self.uid
}
}
private struct TriggerEntry: Identifiable {

View File

@@ -3,8 +3,13 @@ import Foundation
/// A borderless panel that can still accept key focus (needed for typing).
final class WebChatPanel: NSPanel {
override var canBecomeKey: Bool { true }
override var canBecomeMain: Bool { true }
override var canBecomeKey: Bool {
true
}
override var canBecomeMain: Bool {
true
}
}
enum WebChatPresentation {

View File

@@ -1,8 +1,8 @@
import AppKit
import Foundation
import OpenClawChatUI
import OpenClawKit
import OpenClawProtocol
import Foundation
import OSLog
import QuartzCore
import SwiftUI

View File

@@ -1,7 +1,7 @@
import OpenClawKit
import OpenClawProtocol
import Foundation
import Observation
import OpenClawKit
import OpenClawProtocol
import SwiftUI
@MainActor
@@ -31,7 +31,9 @@ final class WorkActivityStore {
private var mainSessionKeyStorage = "main"
private let toolResultGrace: TimeInterval = 2.0
var mainSessionKey: String { self.mainSessionKeyStorage }
var mainSessionKey: String {
self.mainSessionKeyStorage
}
func handleJob(sessionKey: String, state: String) {
let isStart = state.lowercased() == "started" || state.lowercased() == "streaming"

View File

@@ -1,7 +1,7 @@
import OpenClawKit
import Foundation
import Network
import Observation
import OpenClawKit
import OSLog
@MainActor
@@ -18,7 +18,10 @@ public final class GatewayDiscoveryModel {
}
public struct DiscoveredGateway: Identifiable, Equatable, Sendable {
public var id: String { self.stableID }
public var id: String {
self.stableID
}
public var displayName: String
// Resolved service endpoint (SRV + A/AAAA). Used for routing; do not trust TXT for routing.
public var serviceHost: String?

View File

@@ -1,5 +1,5 @@
import OpenClawKit
import Foundation
import OpenClawKit
struct WideAreaGatewayBeacon: Sendable, Equatable {
var instanceName: String
@@ -117,13 +117,12 @@ enum WideAreaGatewayDiscovery {
}
var seen = Set<String>()
let ordered = ips.filter { value in
return ips.filter { value in
guard self.isTailnetIPv4(value) else { return false }
if seen.contains(value) { return false }
seen.insert(value)
return true
}
return ordered
}
private static func readTailscaleStatus() -> String? {
@@ -370,5 +369,7 @@ private struct TailscaleStatus: Decodable {
}
extension Collection {
fileprivate var nonEmpty: Self? { isEmpty ? nil : self }
fileprivate var nonEmpty: Self? {
isEmpty ? nil : self
}
}

View File

@@ -407,11 +407,10 @@ extension Request: Codable {
}
}
// Shared transport settings
/// Shared transport settings
public let controlSocketPath: String = {
let home = FileManager().homeDirectoryForCurrentUser
let preferred = home
return home
.appendingPathComponent("Library/Application Support/OpenClaw/control.sock")
.path
return preferred
}()

View File

@@ -1,6 +1,6 @@
import Foundation
import OpenClawKit
import OpenClawProtocol
import Foundation
#if canImport(Darwin)
import Darwin
#endif

View File

@@ -1,5 +1,5 @@
import OpenClawDiscovery
import Foundation
import OpenClawDiscovery
struct DiscoveryOptions {
var timeoutMs: Int = 2000

View File

@@ -1,7 +1,7 @@
import OpenClawKit
import OpenClawProtocol
import Darwin
import Foundation
import OpenClawKit
import OpenClawProtocol
struct WizardCliOptions {
var url: String?

Some files were not shown because too many files have changed in this diff Show More