@juspay/neurolink 10.10.9 → 10.10.11

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.
@@ -212,8 +212,14 @@ export class OpenAITTS {
212
212
  }
213
213
  /**
214
214
  * Map TTSAudioFormat to OpenAI response_format.
215
- * OpenAI TTS supports: mp3, wav, opus (ogg maps to opus).
216
- * Unsupported formats are coerced to mp3 with a warning.
215
+ *
216
+ * OpenAI's /audio/speech accepts mp3, opus, aac, flac, wav and pcm. This map
217
+ * previously stopped at mp3/wav/ogg/opus/pcm16, so `flac` — a valid
218
+ * TTSAudioFormat *and* a real OpenAI response_format — was treated as
219
+ * unsupported and silently downgraded to mp3 (#479). A caller who asked for
220
+ * lossless got lossy, and the only signal was a warn-level log.
221
+ *
222
+ * Formats OpenAI genuinely cannot produce still coerce to mp3 with a warning.
217
223
  */
218
224
  mapFormat(format) {
219
225
  const formats = {
@@ -221,13 +227,19 @@ export class OpenAITTS {
221
227
  wav: "wav",
222
228
  ogg: "opus", // OpenAI uses opus for ogg
223
229
  opus: "opus",
230
+ // #479: flac is the entry this fix added. It is a first-class OpenAI
231
+ // response_format and was the only TTSAudioFormat member missing from
232
+ // this map, so it fell through to the mp3 coercion below. The issue also
233
+ // mentions aac, but aac is not a member of TTSAudioFormat and therefore
234
+ // cannot be requested — no mapping is needed or possible for it.
235
+ flac: "flac",
224
236
  // OpenAI's "pcm" is raw 16-bit signed LE @ 24kHz (no header) — maps to
225
237
  // canonical pcm16 in TTSResult.format. See effectiveFormat() below.
226
238
  pcm16: "pcm",
227
239
  };
228
240
  const mapped = formats[format];
229
241
  if (mapped === undefined) {
230
- logger.warn(`[OpenAITTSHandler] Unsupported format "${format}" — falling back to "mp3". Supported formats: mp3, wav, ogg, opus, pcm16.`);
242
+ logger.warn(`[OpenAITTSHandler] Unsupported format "${format}" — falling back to "mp3". Supported formats: mp3, wav, ogg, opus, flac, pcm16.`);
231
243
  return "mp3";
232
244
  }
233
245
  return mapped;
@@ -259,6 +271,8 @@ export class OpenAITTS {
259
271
  return "wav";
260
272
  case "opus":
261
273
  return "opus";
274
+ case "flac":
275
+ return "flac";
262
276
  // Raw PCM (16-bit signed LE @ 24kHz, no header) — keep semantics in
263
277
  // TTSResult.format so consumers don't write raw bytes to a .wav file.
264
278
  case "pcm":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/neurolink",
3
- "version": "10.10.9",
3
+ "version": "10.10.11",
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": {