@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
68 lines (67 loc) • 3.33 kB
TypeScript
/**
* Environment resolution for the LiveKit voice agent.
*
* Reads LiveKit connection settings and LLM defaults from `process.env` with
* descriptive errors for missing required values. No type assertions: presence
* is verified with explicit string checks.
*
* See docs/features/livekit-voice-agent.md.
*/
import type { LiveKitServerConfig, LiveKitBrainDefaults, RealtimeVoiceAgentConfig, RealtimeVoiceConfig } from "../../types/index.js";
/**
* Resolve LiveKit server connection settings from the environment.
*
* Requires `LIVEKIT_URL`, `LIVEKIT_API_KEY`, and `LIVEKIT_API_SECRET`. Works
* identically for LiveKit Cloud, a self-hosted server, or `livekit-server --dev`
* — only the values differ.
*/
export declare function resolveLiveKitServerConfig(): LiveKitServerConfig;
/**
* Resolve the LLM provider/model defaults for the brain.
*
* Defaults to Bedrock / Claude; overridable via `VOICE_LLM_PROVIDER` and
* `VOICE_LLM_MODEL`.
*/
export declare function resolveBrainDefaults(): LiveKitBrainDefaults;
/**
* A ws or wss URL that passes `requireNoCleartextCrossHost`. The error names the
* setting and does not repeat the value. Exported so the model factory applies
* the same check to a hand-built config as config resolution applies to the
* variable and to a caller's override.
*/
export declare function requireWebSocketUrl(value: string, name: string): string;
/**
* Resolve the realtime (speech-to-speech) voice configuration from the
* environment.
*
* Every value has a safe default so a worker can run with no realtime-specific
* env at all. `VOICE_REALTIME_BACKEND` picks the model family (`gemini`, the
* default, or `xai`); `backend` here overrides it and then the environment's
* value is not read. A non-blank `xaiBaseURL` here likewise replaces
* `XAI_REALTIME_BASE_URL` after the same ws or wss check. Either URL is
* checked whatever the backend. A `ws://` URL to a host other than `localhost`,
* `127.0.0.0/8` or `[::1]` is refused unless `XAI_REALTIME_ALLOW_INSECURE=true`,
* because the xAI plugin sends `XAI_API_KEY` to it unencrypted.
* `VOICE_LIVE_MODEL` overrides the backend's default model.
* Vertex `project` is resolved from `VERTEX_PROJECT`, then the service-account
* project (`GOOGLE_AUTH_BREEZE_PROJECT_ID`), then `GOOGLE_CLOUD_PROJECT_ID`;
* project, location and modality only matter to the gemini backend. The MCP URL
* is `VOICE_MCP_URL` if set, otherwise `${LIGHTHOUSE_URL}/ai/mcp/v2`.
*/
export declare function resolveRealtimeVoiceConfig(overrides?: Pick<RealtimeVoiceAgentConfig, "backend" | "xaiBaseURL">): RealtimeVoiceConfig;
/**
* Resolve the semantic end-of-utterance (EOU) turn-detection settings.
*
* Opt-in via `LIVEKIT_EOU_TURN_DETECTION` (`1`/`true`/`english`/`en`/`on`/`yes`).
* When enabled, the English `@livekit/agents-plugin-livekit` EOU model decides
* whether the user's turn is truly over, layered on top of VAD silence — so
* natural mid-sentence pauses don't split one utterance. English-only; the
* model adds ~200MB RAM per worker and ~10ms per turn-end.
*
* `LIVEKIT_EOU_UNLIKELY_THRESHOLD` optionally overrides the model's confidence
* threshold (lower = end the turn more eagerly).
*/
export declare function resolveEouTurnDetection(): {
enabled: boolean;
unlikelyThreshold: number | undefined;
};