@juspay/neurolink 10.8.6 → 10.8.7

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.
@@ -777,6 +777,38 @@ function appendDetectedFileResult(result, file, options) {
777
777
  logger.info(`[FileDetector] ⚠️ Unknown format (metadata extracted): ${filename}`);
778
778
  }
779
779
  }
780
+ /**
781
+ * Fold the `audioFiles` / `videoFiles` aliases into the unified `files` array.
782
+ *
783
+ * #284 gave audio and video their own input fields, but neither has a
784
+ * dedicated processor — both are meant to travel through the same
785
+ * auto-detecting `files` pipeline that already understands "audio"/"video"
786
+ * FileDetector results (see `appendDetectedFileResult`). The fold used to live
787
+ * inline in `buildMultimodalMessagesArray`, which meant any path that bypassed
788
+ * that builder never performed it and dropped the files silently: the model
789
+ * received the prompt alone and answered as though nothing were attached
790
+ * (#1259). GoogleVertex's native SDK path and `buildMultimodalOptions`
791
+ * (Bedrock) are both such paths, so the fold has to be callable from them.
792
+ *
793
+ * The aliases are cleared once merged, which makes the call idempotent: a
794
+ * provider override and the shared builder can both call this on the same
795
+ * options object without attaching every file twice.
796
+ *
797
+ * Mutates in place, matching `processUnifiedFilesArray` below — downstream
798
+ * stages all read `options.input.files`.
799
+ */
800
+ export function mergeMediaFileAliases(input) {
801
+ if (!input.audioFiles?.length && !input.videoFiles?.length) {
802
+ return;
803
+ }
804
+ input.files = [
805
+ ...(input.files ?? []),
806
+ ...(input.audioFiles ?? []),
807
+ ...(input.videoFiles ?? []),
808
+ ];
809
+ input.audioFiles = undefined;
810
+ input.videoFiles = undefined;
811
+ }
780
812
  /**
781
813
  * Process the unified files array with auto-detection.
782
814
  * Handles lazy file registration, full processing, and preview injection.
@@ -1115,18 +1147,7 @@ export async function buildMultimodalMessagesArray(options, provider, model) {
1115
1147
  // local const so TypeScript sees the definite (non-optional) type in the
1116
1148
  // rest of this function, avoiding 60+ "possibly undefined" errors.
1117
1149
  const inp = options.input;
1118
- // #284: audioFiles/videoFiles have no dedicated processor — route them
1119
- // through the same auto-detecting `files` pipeline that already
1120
- // understands "audio"/"video" FileDetector results (see
1121
- // appendDetectedFileResult), instead of silently dropping them once
1122
- // detectMultimodal() routes an audio/video-only request here.
1123
- if (inp.audioFiles?.length || inp.videoFiles?.length) {
1124
- inp.files = [
1125
- ...(inp.files || []),
1126
- ...(inp.audioFiles || []),
1127
- ...(inp.videoFiles || []),
1128
- ];
1129
- }
1150
+ mergeMediaFileAliases(inp);
1130
1151
  // Compute provider-specific max PDF size once for consistent validation
1131
1152
  const pdfConfig = PDFProcessor.getProviderConfig(provider);
1132
1153
  const maxSize = pdfConfig
@@ -12,6 +12,8 @@ import type { StreamOptions } from "../types/index.js";
12
12
  * - input.files: Auto-detected file types
13
13
  * - input.csvFiles: CSV files for tabular data
14
14
  * - input.pdfFiles: PDF documents (Buffer | string paths)
15
+ * - input.audioFiles: Audio files (Buffer | string paths)
16
+ * - input.videoFiles: Video files (Buffer | string paths)
15
17
  * - csvOptions: CSV parsing options
16
18
  * - systemPrompt: System-level instructions
17
19
  * - conversationMessages: Chat history
@@ -23,7 +25,7 @@ import type { StreamOptions } from "../types/index.js";
23
25
  * @param {string} providerName - Provider identifier (e.g., "vertex", "openai", "anthropic")
24
26
  * @param {string} modelName - Model identifier (e.g., "gemini-2.5-flash", "gpt-4o")
25
27
  * @returns {object} Normalized options object with:
26
- * - input: { text, images, content, files, csvFiles, pdfFiles }
28
+ * - input: { text, images, content, files, csvFiles, pdfFiles, audioFiles, videoFiles }
27
29
  * - csvOptions: CSV processing options
28
30
  * - systemPrompt: System prompt string
29
31
  * - conversationHistory: Message history array
@@ -49,6 +51,8 @@ export declare function buildMultimodalOptions(options: StreamOptions, providerN
49
51
  files: (string | Buffer<ArrayBufferLike> | import("../index.js").FileWithMetadata)[] | undefined;
50
52
  csvFiles: (string | Buffer<ArrayBufferLike>)[] | undefined;
51
53
  pdfFiles: (string | Buffer<ArrayBufferLike>)[] | undefined;
54
+ audioFiles: (string | Buffer<ArrayBufferLike>)[] | undefined;
55
+ videoFiles: (string | Buffer<ArrayBufferLike>)[] | undefined;
52
56
  };
53
57
  csvOptions: import("../index.js").CSVProcessorOptions | undefined;
54
58
  pdfOptions: {
@@ -11,6 +11,8 @@
11
11
  * - input.files: Auto-detected file types
12
12
  * - input.csvFiles: CSV files for tabular data
13
13
  * - input.pdfFiles: PDF documents (Buffer | string paths)
14
+ * - input.audioFiles: Audio files (Buffer | string paths)
15
+ * - input.videoFiles: Video files (Buffer | string paths)
14
16
  * - csvOptions: CSV parsing options
15
17
  * - systemPrompt: System-level instructions
16
18
  * - conversationMessages: Chat history
@@ -22,7 +24,7 @@
22
24
  * @param {string} providerName - Provider identifier (e.g., "vertex", "openai", "anthropic")
23
25
  * @param {string} modelName - Model identifier (e.g., "gemini-2.5-flash", "gpt-4o")
24
26
  * @returns {object} Normalized options object with:
25
- * - input: { text, images, content, files, csvFiles, pdfFiles }
27
+ * - input: { text, images, content, files, csvFiles, pdfFiles, audioFiles, videoFiles }
26
28
  * - csvOptions: CSV processing options
27
29
  * - systemPrompt: System prompt string
28
30
  * - conversationHistory: Message history array
@@ -49,6 +51,11 @@ export function buildMultimodalOptions(options, providerName, modelName) {
49
51
  files: options.input?.files,
50
52
  csvFiles: options.input?.csvFiles,
51
53
  pdfFiles: options.input?.pdfFiles,
54
+ // #1259: this is a whitelist — a field omitted here is dropped
55
+ // silently, and the model answers as though nothing were attached.
56
+ // audioFiles/videoFiles were missing, so Bedrock received neither.
57
+ audioFiles: options.input?.audioFiles,
58
+ videoFiles: options.input?.videoFiles,
52
59
  },
53
60
  csvOptions: options.csvOptions,
54
61
  pdfOptions: options.pdfOptions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/neurolink",
3
- "version": "10.8.6",
3
+ "version": "10.8.7",
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": {