/** * @octomil/browser — Routing client * * ADVANCED — MAY: Calls the Octomil routing API to decide whether inference * should run on-device or in the cloud. Caches decisions with a configurable * TTL and provides a cloud inference proxy when the server picks "cloud". * * This module is part of the ADVANCED tier. SDKs MAY implement routing * support. It is not required for core SDK compliance. */ import type { CloudInferenceResponse, DeviceCapabilities, RoutingConfig, RoutingDecision } from "./types.js"; export declare class RoutingClient { private readonly serverUrl; private readonly apiKey; private readonly cacheTtlMs; private readonly prefer; private readonly cache; /** Whether the last `route()` call was answered from offline fallback. */ lastRouteWasOffline: boolean; constructor(config: RoutingConfig); /** * Ask the routing API whether to run on-device or in the cloud. * * Returns a cached decision when available and not expired. * On network failure, returns a persistent-cached decision or a synthetic * device decision. Never returns `null`. */ route(modelId: string, modelParams: number, modelSizeMb: number, deviceCapabilities: DeviceCapabilities): Promise; /** * Run inference in the cloud via POST /api/v1/inference. * * Throws on failure so the caller can catch and fall back to local. */ cloudInfer(modelId: string, inputData: unknown, parameters?: Record): Promise; /** Invalidate all cached routing decisions (in-memory and persistent). */ clearCache(): void; /** Invalidate the cached routing decision for a specific model. */ invalidate(modelId: string): void; private offlineFallback; private persistToStorage; private loadPersistentCache; private savePersistentCache; } /** * Detect device capabilities in a browser environment. * Returns reasonable defaults when APIs are unavailable. */ export declare function detectDeviceCapabilities(): Promise; //# sourceMappingURL=routing.d.ts.map