From 26fcca087b557da447d2034e01829fd148d7b398 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Tue, 20 Jan 2026 17:27:28 +0000 Subject: [PATCH] fix(macos): resolve AnyCodable alias conflicts --- .../Sources/Clawdbot/AgentEventsWindow.swift | 7 +++++-- .../Sources/Clawdbot/CronJobsStore.swift | 2 -- .../ExecApprovalsGatewayPrompter.swift | 2 -- .../Sources/Clawdbot/GatewayConnection.swift | 2 -- .../Sources/Clawdbot/OnboardingWizard.swift | 21 +++++++++---------- .../Sources/Clawdbot/WebChatSwiftUI.swift | 2 -- 6 files changed, 15 insertions(+), 21 deletions(-) diff --git a/apps/macos/Sources/Clawdbot/AgentEventsWindow.swift b/apps/macos/Sources/Clawdbot/AgentEventsWindow.swift index e3ccc87bc..43b60a270 100644 --- a/apps/macos/Sources/Clawdbot/AgentEventsWindow.swift +++ b/apps/macos/Sources/Clawdbot/AgentEventsWindow.swift @@ -81,7 +81,7 @@ private struct EventRow: View { return f.string(from: date) } - private func prettyJSON(_ dict: [String: AnyCodable]) -> String? { + private func prettyJSON(_ dict: [String: ClawdbotProtocol.AnyCodable]) -> String? { let normalized = dict.mapValues { $0.value } guard JSONSerialization.isValidJSONObject(normalized), let data = try? JSONSerialization.data(withJSONObject: normalized, options: [.prettyPrinted]), @@ -98,7 +98,10 @@ struct AgentEventsWindow_Previews: PreviewProvider { seq: 1, stream: "tool", ts: Date().timeIntervalSince1970 * 1000, - data: ["phase": AnyCodable("start"), "name": AnyCodable("bash")], + data: [ + "phase": ClawdbotProtocol.AnyCodable("start"), + "name": ClawdbotProtocol.AnyCodable("bash"), + ], summary: nil) AgentEventStore.shared.append(sample) return AgentEventsWindow() diff --git a/apps/macos/Sources/Clawdbot/CronJobsStore.swift b/apps/macos/Sources/Clawdbot/CronJobsStore.swift index ced586915..b44f9cb3a 100644 --- a/apps/macos/Sources/Clawdbot/CronJobsStore.swift +++ b/apps/macos/Sources/Clawdbot/CronJobsStore.swift @@ -4,8 +4,6 @@ import Foundation import Observation import OSLog -private typealias AnyCodable = ClawdbotKit.AnyCodable - @MainActor @Observable final class CronJobsStore { diff --git a/apps/macos/Sources/Clawdbot/ExecApprovalsGatewayPrompter.swift b/apps/macos/Sources/Clawdbot/ExecApprovalsGatewayPrompter.swift index 06b213342..4cd79d5f6 100644 --- a/apps/macos/Sources/Clawdbot/ExecApprovalsGatewayPrompter.swift +++ b/apps/macos/Sources/Clawdbot/ExecApprovalsGatewayPrompter.swift @@ -3,8 +3,6 @@ import ClawdbotProtocol import Foundation import OSLog -private typealias AnyCodable = ClawdbotKit.AnyCodable - @MainActor final class ExecApprovalsGatewayPrompter { static let shared = ExecApprovalsGatewayPrompter() diff --git a/apps/macos/Sources/Clawdbot/GatewayConnection.swift b/apps/macos/Sources/Clawdbot/GatewayConnection.swift index 0b077ad5d..32e04db10 100644 --- a/apps/macos/Sources/Clawdbot/GatewayConnection.swift +++ b/apps/macos/Sources/Clawdbot/GatewayConnection.swift @@ -4,8 +4,6 @@ import ClawdbotProtocol import Foundation import OSLog -private typealias AnyCodable = ClawdbotKit.AnyCodable - private let gatewayConnectionLogger = Logger(subsystem: "com.clawdbot", category: "gateway.connection") enum GatewayAgentChannel: String, Codable, CaseIterable, Sendable { diff --git a/apps/macos/Sources/Clawdbot/OnboardingWizard.swift b/apps/macos/Sources/Clawdbot/OnboardingWizard.swift index e5ea0a763..e9d071328 100644 --- a/apps/macos/Sources/Clawdbot/OnboardingWizard.swift +++ b/apps/macos/Sources/Clawdbot/OnboardingWizard.swift @@ -12,7 +12,6 @@ private let onboardingWizardLogger = Logger(subsystem: "com.clawdbot", category: // Bridge between ClawdbotProtocol.AnyCodable and the local module to avoid // Swift 6 strict concurrency type conflicts. -private typealias AnyCodable = ClawdbotKit.AnyCodable private typealias ProtocolAnyCodable = ClawdbotProtocol.AnyCodable private func bridgeToLocal(_ value: ProtocolAnyCodable) -> AnyCodable { @@ -218,7 +217,7 @@ final class OnboardingWizardModel { struct OnboardingWizardStepView: View { let step: WizardStep let isSubmitting: Bool - let onSubmit: (AnyCodable?) -> Void + let onStepSubmit: (AnyCodable?) -> Void @State private var textValue: String @State private var confirmValue: Bool @@ -230,7 +229,7 @@ struct OnboardingWizardStepView: View { init(step: WizardStep, isSubmitting: Bool, onSubmit: @escaping (AnyCodable?) -> Void) { self.step = step self.isSubmitting = isSubmitting - self.onSubmit = onSubmit + self.onStepSubmit = onSubmit let options = parseWizardOptions(step.options).enumerated().map { index, option in WizardOptionItem(index: index, option: option) } @@ -380,27 +379,27 @@ struct OnboardingWizardStepView: View { private func submit() { switch wizardStepType(self.step) { case "note", "progress": - self.onSubmit(nil) + self.onStepSubmit(nil) case "text": - self.onSubmit(AnyCodable(self.textValue)) + self.onStepSubmit(AnyCodable(self.textValue)) case "confirm": - self.onSubmit(AnyCodable(self.confirmValue)) + self.onStepSubmit(AnyCodable(self.confirmValue)) case "select": guard self.optionItems.indices.contains(self.selectedIndex) else { - self.onSubmit(nil) + self.onStepSubmit(nil) return } let option = self.optionItems[self.selectedIndex].option - self.onSubmit(bridgeToLocal(option.value) ?? AnyCodable(option.label)) + self.onStepSubmit(bridgeToLocal(option.value) ?? AnyCodable(option.label)) case "multiselect": let values = self.optionItems .filter { self.selectedIndices.contains($0.index) } .map { bridgeToLocal($0.option.value) ?? AnyCodable($0.option.label) } - self.onSubmit(AnyCodable(values)) + self.onStepSubmit(AnyCodable(values)) case "action": - self.onSubmit(AnyCodable(true)) + self.onStepSubmit(AnyCodable(true)) default: - self.onSubmit(nil) + self.onStepSubmit(nil) } } } diff --git a/apps/macos/Sources/Clawdbot/WebChatSwiftUI.swift b/apps/macos/Sources/Clawdbot/WebChatSwiftUI.swift index 118fbb048..665416d31 100644 --- a/apps/macos/Sources/Clawdbot/WebChatSwiftUI.swift +++ b/apps/macos/Sources/Clawdbot/WebChatSwiftUI.swift @@ -9,8 +9,6 @@ import SwiftUI private let webChatSwiftLogger = Logger(subsystem: "com.clawdbot", category: "WebChatSwiftUI") -private typealias AnyCodable = ClawdbotKit.AnyCodable - private enum WebChatSwiftUILayout { static let windowSize = NSSize(width: 500, height: 840) static let panelSize = NSSize(width: 480, height: 640)