import { type WakeProvisionResult, type WakeProvisionStatus } from '../voice/wake/provisioning.js'; import { type WakeInstallProvisionOutcome } from '../voice/wake/install-provision.js'; /** * Which pinned artifact a chunk read is asking for. * * `tflite` is the same classifier in TensorFlow Lite form. It is served because * it is provisioned: a surface whose inference runtime cannot load onnx has the * same claim on the model as one that can, and it has no more ability to fetch * the release asset itself. * * `vad` is the speech gate `voice.wake.vadThreshold` runs. A browser tab needs it * from here for exactly the reason it needs the classifier from here: the release * assets answer without an `access-control-allow-origin` header, so the tab cannot * fetch them itself. * * EVERY NOTICE is served, and that is the point of listing them here. This * service hands out three redistributable artifacts, the classifier, Google's * Apache-2.0 embedding build, and the speech gate, and each has an attribution * file that must travel with it. A client that can fetch the bytes but not the * NOTICE cannot satisfy the terms it received them under. */ export type WakeModelComponent = 'classifier' | 'tflite' | 'embedding' | 'notice' | 'embedding-notice' | 'vad' | 'vad-notice'; /** Largest chunk a single read returns, before base64. */ export declare const WAKE_MODEL_CHUNK_MAX_BYTES: number; export interface WakeModelChunkRequest { readonly component: WakeModelComponent; readonly offset?: number | undefined; readonly maxBytes?: number | undefined; } export interface WakeModelChunkResult { readonly component: WakeModelComponent; /** Byte offset this chunk starts at. */ readonly offset: number; /** Bytes in this chunk (before base64). */ readonly bytes: number; /** Size of the whole artifact, so a client knows when it is done. */ readonly totalBytes: number; /** The PINNED sha256 of the whole artifact, for the client to verify against. */ readonly sha256: string; readonly dataBase64: string; /** True when this chunk ends the artifact. */ readonly complete: boolean; } export interface WakeSetupServiceDeps { /** The managed voice root; wake artifacts live in its `wake` subdirectory. */ readonly managedVoiceRoot: string; /** Provisioner seam, so a test never downloads. */ readonly provision?: ((options: { managedRoot: string; }) => Promise) | undefined; /** Status-read seam. */ readonly readStatus?: ((options: { managedRoot: string; }) => WakeProvisionStatus) | undefined; /** File-read seam, so a test serves bytes without writing 2.4 MB to disk. */ readonly readArtifact?: ((path: string, offset: number, length: number) => Uint8Array) | undefined; /** Artifact size seam, paired with readArtifact. */ readonly artifactSize?: ((path: string) => number) | undefined; } export interface WakeSetupService { status(): WakeProvisionStatus; provision(): Promise; /** * The install/boot path: provision what is missing, never throw, and report one * plain line. Joins the same single-flight as {@link provision}, so a boot * attempt and a user-triggered setup are one download. */ ensureProvisioned(options?: { readonly recoveryHint?: string | undefined; }): Promise; modelChunk(request: WakeModelChunkRequest): WakeModelChunkResult; } export declare function createWakeSetupService(deps: WakeSetupServiceDeps): WakeSetupService; //# sourceMappingURL=wake-setup.d.ts.map