mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-01 21:25:52 +00:00
Summary: - Replace the legacy iOS shell with Pro Command, Chat, Agents, and Settings tabs. - Wire iOS chat/session/settings/diagnostics and realtime Talk flows through gateway-backed APIs. - Add gateway/session and shared chat coverage for the new iOS flow. Verification: - git diff --check - node scripts/run-vitest.mjs src/gateway/server.sessions.create.test.ts src/gateway/talk-realtime-relay.test.ts - swift test --filter ChatViewModelTests (apps/shared/OpenClawKit) - xcodebuild build for Nimrod's iPhone succeeded; install succeeded; launch was blocked because the phone was locked Known follow-up: - Preserve traceLevel in sessions.create parent runtime inheritance and keep the changelog credit in the follow-up patch.
108 lines
4.0 KiB
Swift
108 lines
4.0 KiB
Swift
import Foundation
|
|
|
|
public enum OpenClawChatTransportEvent: Sendable {
|
|
case health(ok: Bool)
|
|
case tick
|
|
case chat(OpenClawChatEventPayload)
|
|
case sessionMessage(OpenClawSessionMessageEventPayload)
|
|
case agent(OpenClawAgentEventPayload)
|
|
case seqGap
|
|
}
|
|
|
|
public protocol OpenClawChatTransport: Sendable {
|
|
func createSession(
|
|
key: String,
|
|
label: String?,
|
|
parentSessionKey: String?) async throws -> OpenClawChatCreateSessionResponse
|
|
|
|
func requestHistory(sessionKey: String) async throws -> OpenClawChatHistoryPayload
|
|
func listModels() async throws -> [OpenClawChatModelChoice]
|
|
func sendMessage(
|
|
sessionKey: String,
|
|
message: String,
|
|
thinking: String,
|
|
idempotencyKey: String,
|
|
attachments: [OpenClawChatAttachmentPayload]) async throws -> OpenClawChatSendResponse
|
|
|
|
func abortRun(sessionKey: String, runId: String) async throws
|
|
func listSessions(limit: Int?) async throws -> OpenClawChatSessionsListResponse
|
|
func setSessionModel(sessionKey: String, model: String?) async throws
|
|
func setSessionThinking(sessionKey: String, thinkingLevel: String) async throws
|
|
|
|
func requestHealth(timeoutMs: Int) async throws -> Bool
|
|
func waitForRunCompletion(runId: String, timeoutMs: Int) async -> Bool
|
|
func events() -> AsyncStream<OpenClawChatTransportEvent>
|
|
|
|
func setActiveSessionKey(_ sessionKey: String) async throws
|
|
func resetSession(sessionKey: String) async throws
|
|
func compactSession(sessionKey: String) async throws
|
|
}
|
|
|
|
extension OpenClawChatTransport {
|
|
public func createSession(
|
|
key _: String,
|
|
label _: String?,
|
|
parentSessionKey _: String?) async throws -> OpenClawChatCreateSessionResponse
|
|
{
|
|
throw NSError(
|
|
domain: "OpenClawChatTransport",
|
|
code: 0,
|
|
userInfo: [NSLocalizedDescriptionKey: "sessions.create not supported by this transport"])
|
|
}
|
|
|
|
public func setActiveSessionKey(_: String) async throws {}
|
|
|
|
public func waitForRunCompletion(runId _: String, timeoutMs _: Int) async -> Bool {
|
|
false
|
|
}
|
|
|
|
public func resetSession(sessionKey _: String) async throws {
|
|
throw NSError(
|
|
domain: "OpenClawChatTransport",
|
|
code: 0,
|
|
userInfo: [NSLocalizedDescriptionKey: "sessions.reset not supported by this transport"])
|
|
}
|
|
|
|
public func compactSession(sessionKey _: String) async throws {
|
|
throw NSError(
|
|
domain: "OpenClawChatTransport",
|
|
code: 0,
|
|
userInfo: [NSLocalizedDescriptionKey: "sessions.compact not supported by this transport"])
|
|
}
|
|
|
|
public func abortRun(sessionKey _: String, runId _: String) async throws {
|
|
throw NSError(
|
|
domain: "OpenClawChatTransport",
|
|
code: 0,
|
|
userInfo: [NSLocalizedDescriptionKey: "chat.abort not supported by this transport"])
|
|
}
|
|
|
|
public func listSessions(limit _: Int?) async throws -> OpenClawChatSessionsListResponse {
|
|
throw NSError(
|
|
domain: "OpenClawChatTransport",
|
|
code: 0,
|
|
userInfo: [NSLocalizedDescriptionKey: "sessions.list not supported by this transport"])
|
|
}
|
|
|
|
public func listModels() async throws -> [OpenClawChatModelChoice] {
|
|
throw NSError(
|
|
domain: "OpenClawChatTransport",
|
|
code: 0,
|
|
userInfo: [NSLocalizedDescriptionKey: "models.list not supported by this transport"])
|
|
}
|
|
|
|
public func setSessionModel(sessionKey _: String, model _: String?) async throws {
|
|
throw NSError(
|
|
domain: "OpenClawChatTransport",
|
|
code: 0,
|
|
userInfo: [NSLocalizedDescriptionKey: "sessions.patch(model) not supported by this transport"])
|
|
}
|
|
|
|
public func setSessionThinking(sessionKey _: String, thinkingLevel _: String) async throws {
|
|
throw NSError(
|
|
domain: "OpenClawChatTransport",
|
|
code: 0,
|
|
userInfo: [NSLocalizedDescriptionKey: "sessions.patch(thinkingLevel) not supported by this transport"])
|
|
}
|
|
}
|