/** * SMI-5039: Canonical embedding-capability probe. * * Extracted from `packages/mcp-server/src/index.ts` (originally landed in * SMI-5009) to give all consumers — MCP servers, CLIs, future tooling — a * single source of truth for the "is the @huggingface/transformers stack * available at boot?" question. * * Design contract (preserved verbatim from the mcp-server origin so behavior * is bit-for-bit identical for that consumer; new options are additive): * * - Hard 2 s default timeout via `Promise.race` against a `Symbol` sentinel. * Bound applies even if `EmbeddingService.checkAvailability()` hangs. * - try/catch wraps the probe; a throw is logged and never propagates. * - Logs to **stderr only** via the supplied `logger` (default * `console.error`). MCP servers communicate over stdio — polluting stdout * would corrupt protocol framing. This invariant is asserted by spawn- * based "stdout pollution" tests in each consumer package. * - Silent on success (real embeddings active); only emits a line when * mock fallback is engaged, the probe times out, or the probe throws. * - Honors `SKILLSMITH_QUIET=true` env var (case-insensitive) AND the * explicit `quiet` option — when set, the log line is suppressed even on * mock fallback. The probe still **runs** (it warms the module-load * cache); only the operator-visible warning is silenced. * - Never throws. Probe failure must never block server / CLI boot. * * @see SMI-5009 — original probe in mcp-server. * @see SMI-5039 — extraction to core. * @see ADR-009 — embedding service fallback policy. */ export interface ProbeEmbeddingCapabilityOptions { /** * Override the hard probe timeout (milliseconds). Defaults to 2 000 ms. * The bound applies even if `EmbeddingService.checkAvailability()` never * resolves — that is the entire point of the probe. */ timeoutMs?: number; /** * Custom log sink. Defaults to `console.error`. MUST write to stderr (or a * stderr-equivalent sink) — see the "stdio invariant" note in this file's * docstring. Provided primarily for unit tests + future structured-logging * consumers. */ logger?: (msg: string) => void; /** * When `true`, suppress the warning log line even on mock fallback. * The probe still runs and warms the module-load cache; only the * operator-visible warning is silenced. Equivalent to setting * `SKILLSMITH_QUIET=true` in the environment. */ quiet?: boolean; } /** * Probe `@huggingface/transformers` availability with a hard timeout + * structured stderr warning when the mock fallback engages. * * NEVER throws. Returns within `timeoutMs` even if the underlying capability * check hangs. Safe to `await` directly before connecting an MCP transport or * dispatching a CLI command that depends on embeddings. */ export declare function probeEmbeddingCapability(opts?: ProbeEmbeddingCapabilityOptions): Promise; //# sourceMappingURL=probe.d.ts.map