mirror of
https://github.com/hanzoai/bot.git
synced 2026-10-30 17:24:26 +00:00
Automated rebrand of all openclaw references to hanzo bot: - Package: openclaw -> @hanzo/bot - Binary: openclaw -> hanzo-bot - Config: ~/.openclaw -> ~/.hanzo/bot - Docker: ghcr.io/hanzoai/bot - Env vars: OPENCLAW_* -> BOT_* - Bundle IDs: ai.hanzo.bot.* - Product name: Hanzo Bot
78 lines
2.9 KiB
Swift
78 lines
2.9 KiB
Swift
import Foundation
|
|
|
|
public enum Hanzo BotChatTransportEvent: Sendable {
|
|
case health(ok: Bool)
|
|
case tick
|
|
case chat(Hanzo BotChatEventPayload)
|
|
case agent(Hanzo BotAgentEventPayload)
|
|
case seqGap
|
|
}
|
|
|
|
public protocol Hanzo BotChatTransport: Sendable {
|
|
func requestHistory(sessionKey: String) async throws -> Hanzo BotChatHistoryPayload
|
|
func listModels() async throws -> [Hanzo BotChatModelChoice]
|
|
func sendMessage(
|
|
sessionKey: String,
|
|
message: String,
|
|
thinking: String,
|
|
idempotencyKey: String,
|
|
attachments: [Hanzo BotChatAttachmentPayload]) async throws -> Hanzo BotChatSendResponse
|
|
|
|
func abortRun(sessionKey: String, runId: String) async throws
|
|
func listSessions(limit: Int?) async throws -> Hanzo BotChatSessionsListResponse
|
|
func setSessionModel(sessionKey: String, model: String?) async throws
|
|
func setSessionThinking(sessionKey: String, thinkingLevel: String) async throws
|
|
|
|
func requestHealth(timeoutMs: Int) async throws -> Bool
|
|
func events() -> AsyncStream<Hanzo BotChatTransportEvent>
|
|
|
|
func setActiveSessionKey(_ sessionKey: String) async throws
|
|
func resetSession(sessionKey: String) async throws
|
|
}
|
|
|
|
extension Hanzo BotChatTransport {
|
|
public func setActiveSessionKey(_: String) async throws {}
|
|
|
|
public func resetSession(sessionKey _: String) async throws {
|
|
throw NSError(
|
|
domain: "Hanzo BotChatTransport",
|
|
code: 0,
|
|
userInfo: [NSLocalizedDescriptionKey: "sessions.reset not supported by this transport"])
|
|
}
|
|
|
|
public func abortRun(sessionKey _: String, runId _: String) async throws {
|
|
throw NSError(
|
|
domain: "Hanzo BotChatTransport",
|
|
code: 0,
|
|
userInfo: [NSLocalizedDescriptionKey: "chat.abort not supported by this transport"])
|
|
}
|
|
|
|
public func listSessions(limit _: Int?) async throws -> Hanzo BotChatSessionsListResponse {
|
|
throw NSError(
|
|
domain: "Hanzo BotChatTransport",
|
|
code: 0,
|
|
userInfo: [NSLocalizedDescriptionKey: "sessions.list not supported by this transport"])
|
|
}
|
|
|
|
public func listModels() async throws -> [Hanzo BotChatModelChoice] {
|
|
throw NSError(
|
|
domain: "Hanzo BotChatTransport",
|
|
code: 0,
|
|
userInfo: [NSLocalizedDescriptionKey: "models.list not supported by this transport"])
|
|
}
|
|
|
|
public func setSessionModel(sessionKey _: String, model _: String?) async throws {
|
|
throw NSError(
|
|
domain: "Hanzo BotChatTransport",
|
|
code: 0,
|
|
userInfo: [NSLocalizedDescriptionKey: "sessions.patch(model) not supported by this transport"])
|
|
}
|
|
|
|
public func setSessionThinking(sessionKey _: String, thinkingLevel _: String) async throws {
|
|
throw NSError(
|
|
domain: "Hanzo BotChatTransport",
|
|
code: 0,
|
|
userInfo: [NSLocalizedDescriptionKey: "sessions.patch(thinkingLevel) not supported by this transport"])
|
|
}
|
|
}
|