/** * @octomil/browser — Control client * * Device registration and heartbeat management. Builds on top of * the DeviceAuth module to provide the full control-plane namespace * required by the SDK facade contract. */ import type { ControlSyncResult } from "./types.js"; import type { DeviceContext } from "./device-context.js"; import type { TelemetryReporter } from "./telemetry.js"; export interface DeviceRegistration { id: string; deviceIdentifier: string; orgId: string; status: string; } export interface HeartbeatResponse { status: string; serverTime?: string; } export interface ControlClientOptions { serverUrl?: string; apiKey?: string; orgId?: string; deviceContext?: DeviceContext | null; telemetry?: TelemetryReporter | null; } /** Per-model status in an observed state report. */ export interface ObservedModelStatus { modelId: string; status: string; version?: string; bindingKey?: string; useCase?: string; deploymentId?: string; deploymentKey?: string; modelName?: string; modelRef?: string; bytesDownloaded?: number; totalBytes?: number; errorCode?: string; } /** Per-model entry in server-authoritative desired state. */ export interface DesiredModelEntry { modelId: string; desiredVersion: string; useCase?: string; bindingKey?: string; deploymentId?: string; deploymentKey?: string; modelName?: string; modelRef?: string; currentChannel?: string; deliveryMode?: string; activationPolicy?: string; enginePolicy?: { allowed?: string[]; forced?: string; }; artifactManifest?: { downloadUrl: string; sizeBytes?: number; sha256?: string; }; rolloutId?: string; } export interface ServingBindingEntry { binding_key?: string; use_case?: string; base_model_id: string; base_version: string; deployment_id?: string; deployment_key?: string; model_name?: string; model_ref?: string; } /** Server-authoritative desired state for this device. */ export interface DesiredState { schemaVersion: string; deviceId: string; generatedAt: string; activeBinding?: Record; models: DesiredModelEntry[]; serving?: ServingBindingEntry[]; policyConfig?: Record; federationOffers?: Array<{ roundId: string; jobId: string; expiresAt: string; }>; gcEligibleArtifactIds?: string[]; } export interface ModelInventoryEntry { modelId: string; version: string; artifactId?: string; status?: string; } export interface DeviceSyncRequest { schemaVersion?: string; requestedAt?: string; knownStateVersion?: string; sdkVersion?: string; platform?: string; appId?: string; appVersion?: string; modelInventory?: ModelInventoryEntry[]; activeVersions?: Array>; availableStorageBytes?: number; } export interface DeviceSyncResponse { schemaVersion: string; deviceId: string; generatedAt?: string; stateChanged: boolean; models: DesiredModelEntry[]; gcEligibleArtifactIds: string[]; nextPollIntervalSeconds: number; serverTimestamp?: string; serving?: ServingBindingEntry[]; training_policy?: Record | null; round_offers?: Array>; } export declare class ControlClient { private serverUrl; private apiKey; private orgId; private serverDeviceId; private heartbeatTimer; private heartbeatSequence; private readonly deviceContext; private readonly telemetry; constructor(options: ControlClientOptions); /** Fetch current device assignments from the server. */ refresh(): Promise; /** Register a device with the Octomil server. */ register(deviceId?: string): Promise; /** Send a heartbeat to the server for the registered device. */ heartbeat(): Promise; /** * Report observed device state to the server (GAP-05). * POSTs per-model statuses and runtime metadata to * `/api/v1/devices/{id}/observed-state`. * * Typically called by {@link SyncManager} after a reconcile cycle, but can * also be invoked manually for custom reporting. */ reportObservedState(models?: ObservedModelStatus[]): Promise; /** * Fetch server-authoritative desired state (GAP-13). * GETs `/api/v1/devices/{id}/desired-state`. * * Typically called by {@link SyncManager} during reconciliation, but can * also be invoked manually for inspection. */ fetchDesiredState(): Promise; sync(request?: DeviceSyncRequest): Promise; /** Start periodic heartbeats at the given interval. */ startHeartbeat(intervalMs?: number): void; /** Stop periodic heartbeats. */ stopHeartbeat(): void; /** The server-assigned device ID, set after registration. */ get registeredDeviceId(): string | null; /** Generate a stable device ID by hashing browser fingerprint data. */ private generateDeviceId; private resolveAuthHeaders; private resolveApiKeyHeaders; } //# sourceMappingURL=control.d.ts.map