mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 22:40:45 +08:00
同时收敛启动与运维脚本默认行为(含 wiki worker)、更新 Admin 可观测性与相关测试,降低首轮时延并提高运行稳定性。 Made-with: Cursor
28 lines
1.1 KiB
Swift
28 lines
1.1 KiB
Swift
import Foundation
|
|
import OpenClawKit
|
|
|
|
/// Single source of truth for "how we connect" to the current gateway.
|
|
///
|
|
/// The iOS app maintains two WebSocket sessions to the same gateway:
|
|
/// - a `role=node` session for device capabilities (`node.invoke.*`)
|
|
/// - a `role=operator` session for chat/talk/config (`chat.*`, `talk.*`, etc.)
|
|
///
|
|
/// Both sessions should derive all connection inputs from this config so we
|
|
/// don't accidentally persist gateway-scoped state under different keys.
|
|
struct GatewayConnectConfig: Sendable {
|
|
let url: URL
|
|
let stableID: String
|
|
let tls: GatewayTLSParams?
|
|
let token: String?
|
|
let bootstrapToken: String?
|
|
let password: String?
|
|
let nodeOptions: GatewayConnectOptions
|
|
|
|
/// Stable, non-empty identifier used for gateway-scoped persistence keys.
|
|
/// If the caller doesn't provide a stableID, fall back to URL identity.
|
|
var effectiveStableID: String {
|
|
let trimmed = self.stableID.trimmingCharacters(in: .whitespacesAndNewlines)
|
|
if trimmed.isEmpty { return self.url.absoluteString }
|
|
return trimmed
|
|
}
|
|
}
|