Download apps/ios/Sources/Capabilities/NodeCapabilityRouter.swift from Darochin/openskynet: direct link, hf CLI and curl.
- Browser
- Download file 643 Bytes
-
https://huggingface.co/Darochin/openskynet/resolve/main/apps/ios/Sources/Capabilities/NodeCapabilityRouter.swift
- Command line
-
hf download hf://Darochin/openskynet/apps/ios/Sources/Capabilities/NodeCapabilityRouter.swift
-
curl -L -o NodeCapabilityRouter.swift https://huggingface.co/Darochin/openskynet/resolve/main/apps/ios/Sources/Capabilities/NodeCapabilityRouter.swift
643 Bytes
| import Foundation | |
| import OpenClawKit | |
| 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) | |
| } | |
| } | |