@juspay/neurolink 11.26.2 → 11.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.md +3 -3
  2. package/dist/adapters/providerImageAdapter.js +20 -0
  3. package/dist/adapters/video/index.d.ts +30 -0
  4. package/dist/adapters/video/index.js +74 -0
  5. package/dist/avatar/index.d.ts +6 -3
  6. package/dist/avatar/index.js +21 -16
  7. package/dist/browser/neurolink.min.js +393 -393
  8. package/dist/cli/factories/commandFactory.d.ts +6 -0
  9. package/dist/cli/factories/commandFactory.js +6 -2
  10. package/dist/constants/contextWindows.d.ts +18 -4
  11. package/dist/constants/contextWindows.js +35 -4
  12. package/dist/core/baseProvider.js +5 -3
  13. package/dist/core/constants.js +59 -1
  14. package/dist/factories/mediaHandlerCatalog.d.ts +18 -0
  15. package/dist/factories/mediaHandlerCatalog.js +65 -0
  16. package/dist/factories/providerRegistry.js +50 -207
  17. package/dist/index.d.ts +1 -4
  18. package/dist/index.js +2 -5
  19. package/dist/models/anthropicModels.d.ts +3 -6
  20. package/dist/models/anthropicModels.js +97 -123
  21. package/dist/models/manifestRegistry.d.ts +9 -0
  22. package/dist/models/manifestRegistry.js +23 -0
  23. package/dist/models/manifests/anthropic.js +5 -3
  24. package/dist/models/manifests/azure.js +6 -1
  25. package/dist/models/modelRegistry.d.ts +22 -2
  26. package/dist/models/modelRegistry.js +143 -8
  27. package/dist/music/index.d.ts +6 -3
  28. package/dist/music/index.js +22 -21
  29. package/dist/neurolink.js +12 -0
  30. package/dist/providers/amazonSagemaker.d.ts +1 -1
  31. package/dist/providers/sagemaker/language-model.d.ts +2 -2
  32. package/dist/types/index.d.ts +1 -0
  33. package/dist/types/index.js +1 -0
  34. package/dist/types/mediaCatalog.d.ts +12 -0
  35. package/dist/types/mediaCatalog.js +7 -0
  36. package/dist/utils/pricing.js +51 -0
  37. package/dist/voice/index.d.ts +7 -3
  38. package/dist/voice/index.js +50 -40
  39. package/package.json +2 -1
@@ -8,12 +8,17 @@
8
8
  * Use STTProcessor (src/lib/utils/sttProcessor.ts) for STT.
9
9
  * Use RealtimeProcessor for realtime voice sessions.
10
10
  *
11
- * Importing this module also auto-registers every shipped TTS / STT /
12
- * Realtime handler whose backing API key is present in `process.env`.
13
- * Registration is idempotent and silently skipped on failure.
11
+ * Importing this module does NOT register any handlers as a side effect.
12
+ * Call `registerDefaultTTSHandlers()` / `registerDefaultSTTHandlers()` /
13
+ * `registerDefaultRealtimeHandlers()` explicitly (or go through
14
+ * `ProviderRegistry.registerAllProviders()`, which every documented
15
+ * `NeuroLink` entry point already calls) to register every shipped handler
16
+ * whose backing API key is present in `process.env`. Registration is
17
+ * idempotent and silently skipped on failure.
14
18
  *
15
19
  * @module voice
16
20
  */
21
+ import { MEDIA_HANDLER_CATALOG } from "../factories/mediaHandlerCatalog.js";
17
22
  import { logger } from "../utils/logger.js";
18
23
  import { STTProcessor } from "../utils/sttProcessor.js";
19
24
  import { TTSProcessor } from "../utils/ttsProcessor.js";
@@ -76,37 +81,48 @@ import { GoogleSTT } from "./providers/GoogleSTT.js";
76
81
  import { OpenAISTT } from "./providers/OpenAISTT.js";
77
82
  import { GeminiLive } from "./providers/GeminiLive.js";
78
83
  import { OpenAIRealtime } from "./providers/OpenAIRealtime.js";
79
- const TTS_HANDLER_CANDIDATES = [
80
- {
81
- // Google TTS doubles as both the AI Studio and Vertex TTS handler.
82
- name: "google-ai",
83
- aliases: ["vertex"],
84
- factory: () => new GoogleTTSHandler(),
85
- },
86
- { name: "openai-tts", factory: () => new OpenAITTS() },
87
- {
88
- name: "elevenlabs",
89
- aliases: ["elevenlabs-tts"],
90
- factory: () => new ElevenLabsTTS(),
91
- },
92
- { name: "azure-tts", factory: () => new AzureTTS() },
93
- { name: "fish-audio", factory: () => new FishAudioTTS() },
94
- { name: "cartesia", factory: () => new CartesiaTTS() },
95
- ];
96
- const STT_HANDLER_CANDIDATES = [
97
- {
98
- name: "whisper",
99
- aliases: ["openai-stt"],
100
- factory: () => new OpenAISTT(),
101
- },
102
- { name: "deepgram", factory: () => new DeepgramSTT() },
103
- { name: "google-stt", factory: () => new GoogleSTT() },
104
- { name: "azure-stt", factory: () => new AzureSTT() },
105
- ];
106
- const REALTIME_HANDLER_CANDIDATES = [
107
- { name: "openai-realtime", factory: () => new OpenAIRealtime() },
108
- { name: "gemini-live", factory: () => new GeminiLive() },
109
- ];
84
+ // Provider names + aliases are the Task-8 catalog's job — only the factory
85
+ // (which needs the imported handler class) stays local to this module.
86
+ const TTS_HANDLER_FACTORIES = {
87
+ // Google TTS doubles as both the AI Studio and Vertex TTS handler.
88
+ "google-ai": () => new GoogleTTSHandler(),
89
+ "openai-tts": () => new OpenAITTS(),
90
+ elevenlabs: () => new ElevenLabsTTS(),
91
+ "azure-tts": () => new AzureTTS(),
92
+ "fish-audio": () => new FishAudioTTS(),
93
+ cartesia: () => new CartesiaTTS(),
94
+ };
95
+ const TTS_HANDLER_CANDIDATES = MEDIA_HANDLER_CATALOG.filter((entry) => entry.kind === "tts").map((entry) => {
96
+ const factory = TTS_HANDLER_FACTORIES[entry.name];
97
+ if (!factory) {
98
+ throw new Error(`[voice/tts] no handler factory for catalog entry "${entry.name}"`);
99
+ }
100
+ return { name: entry.name, aliases: entry.aliases, factory };
101
+ });
102
+ const STT_HANDLER_FACTORIES = {
103
+ whisper: () => new OpenAISTT(),
104
+ deepgram: () => new DeepgramSTT(),
105
+ "google-stt": () => new GoogleSTT(),
106
+ "azure-stt": () => new AzureSTT(),
107
+ };
108
+ const STT_HANDLER_CANDIDATES = MEDIA_HANDLER_CATALOG.filter((entry) => entry.kind === "stt").map((entry) => {
109
+ const factory = STT_HANDLER_FACTORIES[entry.name];
110
+ if (!factory) {
111
+ throw new Error(`[voice/stt] no handler factory for catalog entry "${entry.name}"`);
112
+ }
113
+ return { name: entry.name, aliases: entry.aliases, factory };
114
+ });
115
+ const REALTIME_HANDLER_FACTORIES = {
116
+ "openai-realtime": () => new OpenAIRealtime(),
117
+ "gemini-live": () => new GeminiLive(),
118
+ };
119
+ const REALTIME_HANDLER_CANDIDATES = MEDIA_HANDLER_CATALOG.filter((entry) => entry.kind === "realtime").map((entry) => {
120
+ const factory = REALTIME_HANDLER_FACTORIES[entry.name];
121
+ if (!factory) {
122
+ throw new Error(`[voice/realtime] no handler factory for catalog entry "${entry.name}"`);
123
+ }
124
+ return { name: entry.name, aliases: entry.aliases, factory };
125
+ });
110
126
  function registerCandidates(candidates, supports, getRegistered, register, scope, requireConfigured) {
111
127
  for (const { name, aliases, factory } of candidates) {
112
128
  // Compute missingName / missingAliases separately so a manually-
@@ -168,9 +184,3 @@ export function registerDefaultSTTHandlers() {
168
184
  export function registerDefaultRealtimeHandlers() {
169
185
  registerCandidates(REALTIME_HANDLER_CANDIDATES, (name) => RealtimeProcessor.supports(name), (name) => RealtimeProcessor.getHandler(name), (name, handler) => RealtimeProcessor.registerHandler(name, handler), "voice/realtime", false);
170
186
  }
171
- // Run once at module import so consumers who follow the documented
172
- // `nl.generate(...)` flow get every configured handler without manually
173
- // calling `registerHandler`.
174
- registerDefaultTTSHandlers();
175
- registerDefaultSTTHandlers();
176
- registerDefaultRealtimeHandlers();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/neurolink",
3
- "version": "11.26.2",
3
+ "version": "11.28.0",
4
4
  "packageManager": "pnpm@10.15.1",
5
5
  "description": "TypeScript AI SDK with 24+ LLM providers behind one consistent API. MCP-native (connect any MCP server), voice TTS/STT/realtime, RAG, agents, memory, context compaction. OpenAI · Anthropic · Gemini · Bedrock · Azure · Ollama · DeepSeek · NVIDIA NIM and more.",
6
6
  "author": {
@@ -80,6 +80,7 @@
80
80
  "test:mcp:cli": "pnpm exec tsx test/continuous-test-suite-mcp-cli.ts",
81
81
  "test:mcp:full": "pnpm run test:mcp:infra && pnpm run test:mcp:spans && pnpm run test:mcp:sdk && pnpm run test:mcp:cli && pnpm run test:mcp:http",
82
82
  "test:media": "pnpm exec tsx test/continuous-test-suite-media-gen.ts",
83
+ "test:media-registry-collisions": "pnpm exec tsx test/continuous-test-suite-media-registry-collisions.ts",
83
84
  "test:memory": "pnpm exec tsx test/continuous-test-suite-memory.ts",
84
85
  "test:openai-compat-streaming-retry": "pnpm exec tsx test/continuous-test-suite-openai-compat-streaming-retry.ts",
85
86
  "test:anthropic-streaming-retry": "pnpm exec tsx test/continuous-test-suite-anthropic-streaming-retry.ts",