import { type WakeComponentOutcome, type WakeProvisionOptions, type WakeProvisionResult, type WakeProvisionStatus } from './provisioning.js'; import { type WakeReapSummary, type WakeRecoveryOptions, type WakeRecoverySweeper } from './recovery.js'; /** * Set this to `1` (or `true`) to install without the wake-word model. * * A real switch rather than an undocumented behaviour: an air-gapped build host, * a CI image that should not pull 6 MB per install, or a user who simply does not * want the feature all have the same legitimate need. Opting out is reported in * the outcome message together with how to get the model later, so it is never * indistinguishable from a silent failure. */ export declare const WAKE_INSTALL_SKIP_ENV = "GOODVIBES_SKIP_WAKE_MODEL_DOWNLOAD"; /** * The recovery act named in a degraded message when the caller does not supply a * surface-specific one. The control-plane verb, because it is the same on every * surface; a terminal passes `/voice wake setup` instead. */ /** * What a degraded install names as the thing that will fix it. * * Phrased as something the PLATFORM does, not something the user types: the * daemon retries this at every start, so an unfetched model recovers on its own * and a message ordering someone to run a command describes work the product * has already taken on. A surface may name its own equivalent, but the same * rule applies to whatever it passes. */ export declare const WAKE_INSTALL_DEFAULT_RECOVERY_HINT = "the next daemon start fetches it automatically"; /** * How long one install-time provision may take before it is abandoned. * * Shorter than the 10 minutes {@link provisionWakeWordModels} allows by default, * because the caller here is an installer or a booting daemon: a black-holed * connection must degrade in a couple of minutes, not hold an install open for * ten. Abandoning is safe, nothing partial is kept, and the next boot retries. */ export declare const WAKE_INSTALL_TIMEOUT_MS = 120000; /** Delay before a boot-time attempt starts, so it never sits in front of startup. */ export declare const WAKE_BOOT_PROVISION_DELAY_MS = 5000; /** What one install/boot provisioning attempt concluded. */ export type WakeInstallProvisionState = /** Content-verified before anything was attempted; nothing was fetched. */ 'already-provisioned' /** Fetched and verified during this run: the detector can start now. */ | 'provisioned' /** Attempted and did not land. Installation continues; the feature reports not-provisioned. */ | 'degraded' /** {@link WAKE_INSTALL_SKIP_ENV} asked for no download. */ | 'opted-out'; export interface WakeInstallProvisionOutcome { readonly state: WakeInstallProvisionState; /** Content-verified after the attempt: is the DETECTOR able to start. */ readonly ready: boolean; /** The tflite twin also landed, so the daemon can serve that form. */ readonly mobileFormatReady: boolean; /** One plain line for the caller to print or log verbatim. Never empty. */ readonly message: string; /** Per-artifact outcomes when a fetch was attempted; empty otherwise. */ readonly outcomes: readonly WakeComponentOutcome[]; readonly modelVersion: string | null; /** Artifacts the pre-attempt sweep removed (torn files, abandoned partials). */ readonly reapedBeforeAttempt: number; } export interface WakeInstallProvisionOptions { /** The managed voice root; wake artifacts live in its `wake` subdirectory. */ readonly managedRoot: string; /** Model version to provision. Defaults to the manifest's pinned default. */ readonly version?: string | undefined; /** Named in a degraded message. Defaults to {@link WAKE_INSTALL_DEFAULT_RECOVERY_HINT}. */ readonly recoveryHint?: string | undefined; /** Environment to read the opt-out from. Defaults to `process.env`. */ readonly env?: Readonly> | undefined; readonly fetchImpl?: typeof fetch | undefined; readonly timeoutMs?: number | undefined; /** Provisioner seam, so a test never downloads. */ readonly provision?: ((options: WakeProvisionOptions) => Promise) | undefined; /** Status-read seam, paired with `provision`. */ readonly readStatus?: ((options: { managedRoot: string; version?: string | undefined; }) => WakeProvisionStatus) | undefined; /** Pre-attempt sweep seam. */ readonly sweep?: ((options: WakeRecoveryOptions) => WakeReapSummary) | undefined; } /** * Provision the wake-word artifacts as part of an install or a boot. * * NEVER THROWS. Every failure path, an absent network, an unwritable directory, * a provisioner that itself threw, comes back as a `degraded` outcome whose * message names what happened and how to retry. Callers are installers; an * exception here is an aborted installation. */ export declare function provisionWakeWordModelsAtInstall(options: WakeInstallProvisionOptions): Promise; /** A running boot-provisioning + housekeeping pair. */ export interface WakeBootProvisioning { /** The periodic recovery sweeper this started, for a caller that wants a sweep now. */ readonly sweeper: WakeRecoverySweeper; /** Stop the sweep schedule and cancel a pending first attempt. Idempotent. */ stop(): void; } export interface WakeBootProvisioningOptions { readonly managedRoot: string; /** * The provisioning attempt, injected rather than called directly, so a host * routes it through ITS single-flight, a boot attempt and a user typing the * setup command at the same moment must join one download, not race. */ readonly ensureProvisioned: () => Promise; /** Where the one message goes. Called at most once per boot. */ readonly announce: (message: string) => void; /** Delay before the attempt. Defaults to {@link WAKE_BOOT_PROVISION_DELAY_MS}. */ readonly startDelayMs?: number | undefined; /** Recovery sweep interval. Defaults to the recovery module's own. */ readonly sweepIntervalMs?: number | undefined; /** Live session ids, so retained wake clips of dead sessions are reaped. */ readonly liveSessionIds?: (() => readonly string[]) | undefined; readonly setTimeoutImpl?: ((handler: () => void, ms: number) => unknown) | undefined; readonly clearTimeoutImpl?: ((handle: unknown) => void) | undefined; } /** * Start the boot half: sweep the wake tree now and on a schedule, then make one * provisioning attempt for whatever the install could not get. * * The attempt is delayed and never awaited, so a daemon's startup is not held * behind a download, and it announces only when there is something to say, a * host that is already provisioned stays silent rather than logging a line about * doing nothing on every restart. */ export declare function startWakeBootProvisioning(options: WakeBootProvisioningOptions): WakeBootProvisioning; //# sourceMappingURL=install-provision.d.ts.map