feat(chat): share SwiftUI chat across macOS+iOS

This commit is contained in:
Peter Steinberger
2025-12-14 00:17:07 +00:00
parent c286573f5c
commit e6d522493b
22 changed files with 2001 additions and 1061 deletions

View File

@@ -0,0 +1,27 @@
import Foundation
public enum ClawdisChatTransportEvent: Sendable {
case health(ok: Bool)
case tick
case chat(ClawdisChatEventPayload)
case seqGap
}
public protocol ClawdisChatTransport: Sendable {
func requestHistory(sessionKey: String) async throws -> ClawdisChatHistoryPayload
func sendMessage(
sessionKey: String,
message: String,
thinking: String,
idempotencyKey: String,
attachments: [ClawdisChatAttachmentPayload]) async throws -> ClawdisChatSendResponse
func requestHealth(timeoutMs: Int) async throws -> Bool
func events() -> AsyncStream<ClawdisChatTransportEvent>
func setActiveSessionKey(_ sessionKey: String) async throws
}
extension ClawdisChatTransport {
public func setActiveSessionKey(_: String) async throws {}
}