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
26 lines
644 B
Swift
26 lines
644 B
Swift
import Foundation
|
|
import Hanzo BotKit
|
|
|
|
@MainActor
|
|
final class NodeCapabilityRouter {
|
|
enum RouterError: Error {
|
|
case unknownCommand
|
|
case handlerUnavailable
|
|
}
|
|
|
|
typealias Handler = (BridgeInvokeRequest) async throws -> BridgeInvokeResponse
|
|
|
|
private let handlers: [String: Handler]
|
|
|
|
init(handlers: [String: Handler]) {
|
|
self.handlers = handlers
|
|
}
|
|
|
|
func handle(_ request: BridgeInvokeRequest) async throws -> BridgeInvokeResponse {
|
|
guard let handler = handlers[request.command] else {
|
|
throw RouterError.unknownCommand
|
|
}
|
|
return try await handler(request)
|
|
}
|
|
}
|