UNPKG

@juspay/neurolink

Version:

The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002

48 lines (47 loc) • 2.49 kB
/** * Whistle assets: the pinned manifest, where the files live, and the * first-use download. * * Three files make up the engine — the Cactus "needle" runtime (an Emscripten * build: `needle.js` + `needle.wasm`) and the Whistle speech model * (`whistle.cact`). They are fetched from pinned Hugging Face revisions on * first use, verified against a SHA-256, and written atomically (temp file + * rename), so an interrupted download never leaves a file that looks complete. * * Both upstream repositories are Apache-2.0. * * @module voice/whistle/assets */ import type { STTCredentials, WhistleAsset, WhistleAssetPaths } from "../../types/index.js"; /** Pinned files, in the order they are fetched. */ export declare const WHISTLE_ASSETS: readonly WhistleAsset[]; /** * Where Whistle keeps its files: `slice.modelDir` → `NEUROLINK_WHISTLE_DIR` → * `NEUROLINK_MODEL_DIR/whistle` → the copy shipped with the package * (`models/whistle`, when all three files are there) → * `~/.neurolink/models/whistle`, the only one a download ever writes to. */ export declare function resolveWhistleDir(slice?: STTCredentials["whistle"]): string; /** * The package's own `models/whistle`, found by walking up from this module * to the directory holding NeuroLink's `package.json`. Works from the source * tree, from `dist/` and from the single-file bundles, since all of them sit * below the package root; `null` when nothing above looks like the package. */ export declare function bundledWhistleDir(): string | null; /** * Whether missing files may be fetched: on unless `slice.autoDownload` is * `false` or `NEUROLINK_WHISTLE_AUTO_DOWNLOAD` is `0` / `false` / `off` / `no`. */ export declare function whistleAutoDownloadEnabled(slice?: STTCredentials["whistle"]): boolean; /** Cheap presence check (no hashing): all three files exist in `dir`. */ export declare function whistleAssetsPresent(dir: string): boolean; /** * Make sure all three files are in `dir` and match their pinned hashes, * downloading what is missing when allowed. Concurrent calls for the same * directory share one preparation. */ export declare function ensureWhistleAssets(dir: string, autoDownload: boolean): Promise<WhistleAssetPaths>; /** The friendly "here is exactly what to put where" error. */ /** The three files, where they go and where they come from — the body of every "unusable" message. */ export declare function describeWhistleAssets(dir: string, reason: string): string;