fix(macos): resolve AnyCodable alias conflicts

This commit is contained in:
Peter Steinberger
2026-01-20 17:27:28 +00:00
parent 02ca148583
commit 26fcca087b
6 changed files with 15 additions and 21 deletions

View File

@@ -81,7 +81,7 @@ private struct EventRow: View {
return f.string(from: date) 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 } let normalized = dict.mapValues { $0.value }
guard JSONSerialization.isValidJSONObject(normalized), guard JSONSerialization.isValidJSONObject(normalized),
let data = try? JSONSerialization.data(withJSONObject: normalized, options: [.prettyPrinted]), let data = try? JSONSerialization.data(withJSONObject: normalized, options: [.prettyPrinted]),
@@ -98,7 +98,10 @@ struct AgentEventsWindow_Previews: PreviewProvider {
seq: 1, seq: 1,
stream: "tool", stream: "tool",
ts: Date().timeIntervalSince1970 * 1000, ts: Date().timeIntervalSince1970 * 1000,
data: ["phase": AnyCodable("start"), "name": AnyCodable("bash")], data: [
"phase": ClawdbotProtocol.AnyCodable("start"),
"name": ClawdbotProtocol.AnyCodable("bash"),
],
summary: nil) summary: nil)
AgentEventStore.shared.append(sample) AgentEventStore.shared.append(sample)
return AgentEventsWindow() return AgentEventsWindow()

View File

@@ -4,8 +4,6 @@ import Foundation
import Observation import Observation
import OSLog import OSLog
private typealias AnyCodable = ClawdbotKit.AnyCodable
@MainActor @MainActor
@Observable @Observable
final class CronJobsStore { final class CronJobsStore {

View File

@@ -3,8 +3,6 @@ import ClawdbotProtocol
import Foundation import Foundation
import OSLog import OSLog
private typealias AnyCodable = ClawdbotKit.AnyCodable
@MainActor @MainActor
final class ExecApprovalsGatewayPrompter { final class ExecApprovalsGatewayPrompter {
static let shared = ExecApprovalsGatewayPrompter() static let shared = ExecApprovalsGatewayPrompter()

View File

@@ -4,8 +4,6 @@ import ClawdbotProtocol
import Foundation import Foundation
import OSLog import OSLog
private typealias AnyCodable = ClawdbotKit.AnyCodable
private let gatewayConnectionLogger = Logger(subsystem: "com.clawdbot", category: "gateway.connection") private let gatewayConnectionLogger = Logger(subsystem: "com.clawdbot", category: "gateway.connection")
enum GatewayAgentChannel: String, Codable, CaseIterable, Sendable { enum GatewayAgentChannel: String, Codable, CaseIterable, Sendable {

View File

@@ -12,7 +12,6 @@ private let onboardingWizardLogger = Logger(subsystem: "com.clawdbot", category:
// Bridge between ClawdbotProtocol.AnyCodable and the local module to avoid // Bridge between ClawdbotProtocol.AnyCodable and the local module to avoid
// Swift 6 strict concurrency type conflicts. // Swift 6 strict concurrency type conflicts.
private typealias AnyCodable = ClawdbotKit.AnyCodable
private typealias ProtocolAnyCodable = ClawdbotProtocol.AnyCodable private typealias ProtocolAnyCodable = ClawdbotProtocol.AnyCodable
private func bridgeToLocal(_ value: ProtocolAnyCodable) -> AnyCodable { private func bridgeToLocal(_ value: ProtocolAnyCodable) -> AnyCodable {
@@ -218,7 +217,7 @@ final class OnboardingWizardModel {
struct OnboardingWizardStepView: View { struct OnboardingWizardStepView: View {
let step: WizardStep let step: WizardStep
let isSubmitting: Bool let isSubmitting: Bool
let onSubmit: (AnyCodable?) -> Void let onStepSubmit: (AnyCodable?) -> Void
@State private var textValue: String @State private var textValue: String
@State private var confirmValue: Bool @State private var confirmValue: Bool
@@ -230,7 +229,7 @@ struct OnboardingWizardStepView: View {
init(step: WizardStep, isSubmitting: Bool, onSubmit: @escaping (AnyCodable?) -> Void) { init(step: WizardStep, isSubmitting: Bool, onSubmit: @escaping (AnyCodable?) -> Void) {
self.step = step self.step = step
self.isSubmitting = isSubmitting self.isSubmitting = isSubmitting
self.onSubmit = onSubmit self.onStepSubmit = onSubmit
let options = parseWizardOptions(step.options).enumerated().map { index, option in let options = parseWizardOptions(step.options).enumerated().map { index, option in
WizardOptionItem(index: index, option: option) WizardOptionItem(index: index, option: option)
} }
@@ -380,27 +379,27 @@ struct OnboardingWizardStepView: View {
private func submit() { private func submit() {
switch wizardStepType(self.step) { switch wizardStepType(self.step) {
case "note", "progress": case "note", "progress":
self.onSubmit(nil) self.onStepSubmit(nil)
case "text": case "text":
self.onSubmit(AnyCodable(self.textValue)) self.onStepSubmit(AnyCodable(self.textValue))
case "confirm": case "confirm":
self.onSubmit(AnyCodable(self.confirmValue)) self.onStepSubmit(AnyCodable(self.confirmValue))
case "select": case "select":
guard self.optionItems.indices.contains(self.selectedIndex) else { guard self.optionItems.indices.contains(self.selectedIndex) else {
self.onSubmit(nil) self.onStepSubmit(nil)
return return
} }
let option = self.optionItems[self.selectedIndex].option 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": case "multiselect":
let values = self.optionItems let values = self.optionItems
.filter { self.selectedIndices.contains($0.index) } .filter { self.selectedIndices.contains($0.index) }
.map { bridgeToLocal($0.option.value) ?? AnyCodable($0.option.label) } .map { bridgeToLocal($0.option.value) ?? AnyCodable($0.option.label) }
self.onSubmit(AnyCodable(values)) self.onStepSubmit(AnyCodable(values))
case "action": case "action":
self.onSubmit(AnyCodable(true)) self.onStepSubmit(AnyCodable(true))
default: default:
self.onSubmit(nil) self.onStepSubmit(nil)
} }
} }
} }

View File

@@ -9,8 +9,6 @@ import SwiftUI
private let webChatSwiftLogger = Logger(subsystem: "com.clawdbot", category: "WebChatSwiftUI") private let webChatSwiftLogger = Logger(subsystem: "com.clawdbot", category: "WebChatSwiftUI")
private typealias AnyCodable = ClawdbotKit.AnyCodable
private enum WebChatSwiftUILayout { private enum WebChatSwiftUILayout {
static let windowSize = NSSize(width: 500, height: 840) static let windowSize = NSSize(width: 500, height: 840)
static let panelSize = NSSize(width: 480, height: 640) static let panelSize = NSSize(width: 480, height: 640)