Establish watch relay contracts and platform package wiring

This commit is contained in:
2026-09-18 09:34:26 +04:00
parent a92698e1e6
commit 9b87299bf5
22 changed files with 778 additions and 159 deletions
@@ -0,0 +1,15 @@
import Foundation
import RemoteCore
/// Typed outgoing container seam. Workstream B owns WCSession dictionary parsing,
/// strict incoming key/type validation, routing and exactly-once replies.
public struct RelayContainer: Sendable {
public let schemaVersion = RelayWire.schemaVersion
public let kind: RelayMessageKind
public let payload: Data
public init<Value: Encodable>(kind: RelayMessageKind, value: Value) throws {
self.kind = kind
self.payload = try RelayJSON.encode(value)
}
}
@@ -0,0 +1,10 @@
import RemoteCore
import WatchBridgeCommon
/// Pure outgoing container construction: does not activate WCSession, grant a
/// session, queue a command, or transmit it. Live delivery belongs to B.
public enum WatchCommandPayload {
public static func container(for envelope: CommandEnvelope) throws -> RelayContainer {
try RelayContainer(kind: .command, value: envelope)
}
}
@@ -0,0 +1,11 @@
import RemoteCore
/// An injection seam, not a live relay. App composition supplies the same actor
/// used for phone commands; this holder creates no admission or session state.
public struct PhoneRelayDependency: Sendable {
public let coordinator: any PhoneCommandCoordinating
public init(coordinator: any PhoneCommandCoordinating) {
self.coordinator = coordinator
}
}