chore(ci): sync protocol + swiftformat

This commit is contained in:
Peter Steinberger
2025-12-14 00:36:30 +00:00
parent 2710841801
commit dd763b45e1
4 changed files with 60 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
import AppKit import AppKit
import ClawdisProtocol
import ClawdisKit import ClawdisKit
import ClawdisProtocol
import Foundation import Foundation
import Network import Network
import OSLog import OSLog
@@ -174,6 +174,7 @@ actor BridgeServer {
deliver: false, deliver: false,
to: nil, to: nil,
channel: "last") channel: "last")
case "agent.request": case "agent.request":
guard let json = evt.payloadJSON, let data = json.data(using: .utf8) else { guard let json = evt.payloadJSON, let data = json.data(using: .utf8) else {
return return
@@ -199,6 +200,7 @@ actor BridgeServer {
deliver: link.deliver, deliver: link.deliver,
to: to, to: to,
channel: channel ?? "last") channel: channel ?? "last")
default: default:
break break
} }
@@ -234,7 +236,7 @@ actor BridgeServer {
} }
do { 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 { guard let json = String(data: data, encoding: .utf8) else {
return BridgeRPCResponse( return BridgeRPCResponse(
id: req.id, id: req.id,
@@ -303,7 +305,8 @@ actor BridgeServer {
let payloadJSON = payloadData.flatMap { String(data: $0, encoding: .utf8) } let payloadJSON = payloadData.flatMap { String(data: $0, encoding: .utf8) }
struct MinimalChat: Codable { var sessionKey: String } 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 { if let sessionKey {
for nodeId in subscribedNodes { for nodeId in subscribedNodes {
guard self.chatSubscriptions[nodeId]?.contains(sessionKey) == true else { continue } guard self.chatSubscriptions[nodeId]?.contains(sessionKey) == true else { continue }

View File

@@ -33,7 +33,7 @@ struct MacGatewayChatTransport: ClawdisChatTransport, Sendable {
"message": AnyCodable(message), "message": AnyCodable(message),
"thinking": AnyCodable(thinking), "thinking": AnyCodable(thinking),
"idempotencyKey": AnyCodable(idempotencyKey), "idempotencyKey": AnyCodable(idempotencyKey),
"timeoutMs": AnyCodable(30_000), "timeoutMs": AnyCodable(30000),
] ]
if !attachments.isEmpty { if !attachments.isEmpty {

View File

@@ -482,28 +482,35 @@ public struct NodePairVerifyParams: Codable {
} }
} }
public struct NodeListParams: Codable {
}
public struct NodeInvokeParams: Codable { public struct NodeInvokeParams: Codable {
public let nodeid: String public let nodeid: String
public let command: String public let command: String
public let params: AnyCodable? public let params: AnyCodable?
public let timeoutms: Int? public let timeoutms: Int?
public let idempotencykey: String
public init( public init(
nodeid: String, nodeid: String,
command: String, command: String,
params: AnyCodable?, params: AnyCodable?,
timeoutms: Int? timeoutms: Int?,
idempotencykey: String
) { ) {
self.nodeid = nodeid self.nodeid = nodeid
self.command = command self.command = command
self.params = params self.params = params
self.timeoutms = timeoutms self.timeoutms = timeoutms
self.idempotencykey = idempotencykey
} }
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case nodeid = "nodeId" case nodeid = "nodeId"
case command case command
case params case params
case timeoutms = "timeoutMs" case timeoutms = "timeoutMs"
case idempotencykey = "idempotencyKey"
} }
} }

View File

@@ -181,6 +181,10 @@
"minLength": 1, "minLength": 1,
"type": "string" "type": "string"
}, },
"platform": {
"minLength": 1,
"type": "string"
},
"mode": { "mode": {
"minLength": 1, "minLength": 1,
"type": "string" "type": "string"
@@ -530,6 +534,10 @@
"minLength": 1, "minLength": 1,
"type": "string" "type": "string"
}, },
"platform": {
"minLength": 1,
"type": "string"
},
"mode": { "mode": {
"minLength": 1, "minLength": 1,
"type": "string" "type": "string"
@@ -605,6 +613,10 @@
"minLength": 1, "minLength": 1,
"type": "string" "type": "string"
}, },
"platform": {
"minLength": 1,
"type": "string"
},
"mode": { "mode": {
"minLength": 1, "minLength": 1,
"type": "string" "type": "string"
@@ -906,6 +918,39 @@
"token" "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": { "SessionsListParams": {
"additionalProperties": false, "additionalProperties": false,
"type": "object", "type": "object",