From dd763b45e1d5aa0ba03fe97ddce3fa4ae56d9dac Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 14 Dec 2025 00:36:30 +0000 Subject: [PATCH] chore(ci): sync protocol + swiftformat --- .../Sources/Clawdis/Bridge/BridgeServer.swift | 9 ++-- .../Sources/Clawdis/WebChatSwiftUI.swift | 2 +- .../ClawdisProtocol/GatewayModels.swift | 9 +++- dist/protocol.schema.json | 45 +++++++++++++++++++ 4 files changed, 60 insertions(+), 5 deletions(-) diff --git a/apps/macos/Sources/Clawdis/Bridge/BridgeServer.swift b/apps/macos/Sources/Clawdis/Bridge/BridgeServer.swift index 63e630678..9295d94e1 100644 --- a/apps/macos/Sources/Clawdis/Bridge/BridgeServer.swift +++ b/apps/macos/Sources/Clawdis/Bridge/BridgeServer.swift @@ -1,6 +1,6 @@ import AppKit -import ClawdisProtocol import ClawdisKit +import ClawdisProtocol import Foundation import Network import OSLog @@ -174,6 +174,7 @@ actor BridgeServer { deliver: false, to: nil, channel: "last") + case "agent.request": guard let json = evt.payloadJSON, let data = json.data(using: .utf8) else { return @@ -199,6 +200,7 @@ actor BridgeServer { deliver: link.deliver, to: to, channel: channel ?? "last") + default: break } @@ -234,7 +236,7 @@ actor BridgeServer { } do { - let data = try await GatewayConnection.shared.request(method: req.method, params: params, timeoutMs: 30_000) + let data = try await GatewayConnection.shared.request(method: req.method, params: params, timeoutMs: 30000) guard let json = String(data: data, encoding: .utf8) else { return BridgeRPCResponse( id: req.id, @@ -303,7 +305,8 @@ actor BridgeServer { let payloadJSON = payloadData.flatMap { String(data: $0, encoding: .utf8) } struct MinimalChat: Codable { var sessionKey: String } - let sessionKey = payloadData.flatMap { try? JSONDecoder().decode(MinimalChat.self, from: $0) }?.sessionKey + let sessionKey = payloadData.flatMap { try? JSONDecoder().decode(MinimalChat.self, from: $0) }? + .sessionKey if let sessionKey { for nodeId in subscribedNodes { guard self.chatSubscriptions[nodeId]?.contains(sessionKey) == true else { continue } diff --git a/apps/macos/Sources/Clawdis/WebChatSwiftUI.swift b/apps/macos/Sources/Clawdis/WebChatSwiftUI.swift index 212c38798..fa81c19ca 100644 --- a/apps/macos/Sources/Clawdis/WebChatSwiftUI.swift +++ b/apps/macos/Sources/Clawdis/WebChatSwiftUI.swift @@ -33,7 +33,7 @@ struct MacGatewayChatTransport: ClawdisChatTransport, Sendable { "message": AnyCodable(message), "thinking": AnyCodable(thinking), "idempotencyKey": AnyCodable(idempotencyKey), - "timeoutMs": AnyCodable(30_000), + "timeoutMs": AnyCodable(30000), ] if !attachments.isEmpty { diff --git a/apps/macos/Sources/ClawdisProtocol/GatewayModels.swift b/apps/macos/Sources/ClawdisProtocol/GatewayModels.swift index e9cfcdfb6..873f8498e 100644 --- a/apps/macos/Sources/ClawdisProtocol/GatewayModels.swift +++ b/apps/macos/Sources/ClawdisProtocol/GatewayModels.swift @@ -482,28 +482,35 @@ public struct NodePairVerifyParams: Codable { } } +public struct NodeListParams: Codable { +} + public struct NodeInvokeParams: Codable { public let nodeid: String public let command: String public let params: AnyCodable? public let timeoutms: Int? + public let idempotencykey: String public init( nodeid: String, command: String, params: AnyCodable?, - timeoutms: Int? + timeoutms: Int?, + idempotencykey: String ) { self.nodeid = nodeid self.command = command self.params = params self.timeoutms = timeoutms + self.idempotencykey = idempotencykey } private enum CodingKeys: String, CodingKey { case nodeid = "nodeId" case command case params case timeoutms = "timeoutMs" + case idempotencykey = "idempotencyKey" } } diff --git a/dist/protocol.schema.json b/dist/protocol.schema.json index 9a2eb0361..3bd16b52d 100644 --- a/dist/protocol.schema.json +++ b/dist/protocol.schema.json @@ -181,6 +181,10 @@ "minLength": 1, "type": "string" }, + "platform": { + "minLength": 1, + "type": "string" + }, "mode": { "minLength": 1, "type": "string" @@ -530,6 +534,10 @@ "minLength": 1, "type": "string" }, + "platform": { + "minLength": 1, + "type": "string" + }, "mode": { "minLength": 1, "type": "string" @@ -605,6 +613,10 @@ "minLength": 1, "type": "string" }, + "platform": { + "minLength": 1, + "type": "string" + }, "mode": { "minLength": 1, "type": "string" @@ -906,6 +918,39 @@ "token" ] }, + "NodeListParams": { + "additionalProperties": false, + "type": "object", + "properties": {} + }, + "NodeInvokeParams": { + "additionalProperties": false, + "type": "object", + "properties": { + "nodeId": { + "minLength": 1, + "type": "string" + }, + "command": { + "minLength": 1, + "type": "string" + }, + "params": {}, + "timeoutMs": { + "minimum": 0, + "type": "integer" + }, + "idempotencyKey": { + "minLength": 1, + "type": "string" + } + }, + "required": [ + "nodeId", + "command", + "idempotencyKey" + ] + }, "SessionsListParams": { "additionalProperties": false, "type": "object",