@juspay/neurolink 10.4.4 → 10.5.1

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.
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Shared ISO-BMFF (`ftyp`) image-brand detection.
3
+ *
4
+ * FileDetector and ImageProcessor must use the same brand tables and declared
5
+ * box boundary when classifying AVIF, HEIC, and structural HEIF brands. Keeping
6
+ * the scan here prevents the two consumers from drifting as new brands are
7
+ * added.
8
+ */
9
+ export declare const AVIF_FTYP_BRANDS: Set<string>;
10
+ export declare const HEIC_FTYP_BRANDS: Set<string>;
11
+ export declare const HEIF_STRUCTURAL_FTYP_BRANDS: Set<string>;
12
+ /**
13
+ * Whether the buffer starts with an ISO-BMFF `ftyp` box signature.
14
+ */
15
+ export declare function hasFtypBoxSignature(input: Buffer): boolean;
16
+ /**
17
+ * Read compatible brands without scanning past the declared `ftyp` box.
18
+ */
19
+ export declare function getCompatibleFtypBrands(input: Buffer): Set<string>;
20
+ /**
21
+ * Return the image MIME type encoded by an ISO-BMFF `ftyp` box, or null when
22
+ * the box belongs to a non-image ISO-BMFF flavor.
23
+ */
24
+ export declare function detectIsoBmffImageMimeType(input: Buffer): string | null;
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Shared ISO-BMFF (`ftyp`) image-brand detection.
3
+ *
4
+ * FileDetector and ImageProcessor must use the same brand tables and declared
5
+ * box boundary when classifying AVIF, HEIC, and structural HEIF brands. Keeping
6
+ * the scan here prevents the two consumers from drifting as new brands are
7
+ * added.
8
+ */
9
+ export const AVIF_FTYP_BRANDS = new Set(["avif", "avis", "avio"]);
10
+ export const HEIC_FTYP_BRANDS = new Set([
11
+ "heic",
12
+ "heix",
13
+ "hevc",
14
+ "hevx",
15
+ "heim",
16
+ "heis",
17
+ "hevm",
18
+ "hevs",
19
+ ]);
20
+ export const HEIF_STRUCTURAL_FTYP_BRANDS = new Set(["mif1", "msf1"]);
21
+ /**
22
+ * Whether the buffer starts with an ISO-BMFF `ftyp` box signature.
23
+ */
24
+ export function hasFtypBoxSignature(input) {
25
+ return (input.length >= 8 &&
26
+ input[4] === 0x66 &&
27
+ input[5] === 0x74 &&
28
+ input[6] === 0x79 &&
29
+ input[7] === 0x70);
30
+ }
31
+ /**
32
+ * Read compatible brands without scanning past the declared `ftyp` box.
33
+ */
34
+ export function getCompatibleFtypBrands(input) {
35
+ const compatibleBrands = new Set();
36
+ if (input.length < 20) {
37
+ return compatibleBrands;
38
+ }
39
+ const declaredBoxSize = input.readUInt32BE(0);
40
+ const boxEnd = declaredBoxSize === 0
41
+ ? input.length
42
+ : Math.min(input.length, declaredBoxSize);
43
+ for (let offset = 16; offset + 4 <= boxEnd; offset += 4) {
44
+ compatibleBrands.add(input.toString("latin1", offset, offset + 4));
45
+ }
46
+ return compatibleBrands;
47
+ }
48
+ function hasFtypBrand(compatibleBrands, candidates) {
49
+ for (const brand of compatibleBrands) {
50
+ if (candidates.has(brand)) {
51
+ return true;
52
+ }
53
+ }
54
+ return false;
55
+ }
56
+ /**
57
+ * Return the image MIME type encoded by an ISO-BMFF `ftyp` box, or null when
58
+ * the box belongs to a non-image ISO-BMFF flavor.
59
+ */
60
+ export function detectIsoBmffImageMimeType(input) {
61
+ if (input.length < 12 || !hasFtypBoxSignature(input)) {
62
+ return null;
63
+ }
64
+ const brand = input.toString("latin1", 8, 12);
65
+ if (AVIF_FTYP_BRANDS.has(brand)) {
66
+ return "image/avif";
67
+ }
68
+ if (HEIC_FTYP_BRANDS.has(brand)) {
69
+ return "image/heic";
70
+ }
71
+ if (!HEIF_STRUCTURAL_FTYP_BRANDS.has(brand)) {
72
+ return null;
73
+ }
74
+ const compatibleBrands = getCompatibleFtypBrands(input);
75
+ if (hasFtypBrand(compatibleBrands, HEIC_FTYP_BRANDS)) {
76
+ return "image/heif";
77
+ }
78
+ if (hasFtypBrand(compatibleBrands, AVIF_FTYP_BRANDS)) {
79
+ return "image/avif";
80
+ }
81
+ return null;
82
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/neurolink",
3
- "version": "10.4.4",
3
+ "version": "10.5.1",
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": {
@@ -120,6 +120,7 @@
120
120
  "test:proxy": "npx tsx test/continuous-test-suite-proxy.ts",
121
121
  "test:bugfixes": "npx tsx test/continuous-test-suite-bugfixes.ts",
122
122
  "test:file-detector-extension": "npx tsx test/continuous-test-suite-file-detector-extension.ts",
123
+ "test:file-detector-magic-bytes": "npx tsx test/continuous-test-suite-file-detector-magic-bytes.ts",
123
124
  "test:json": "npx tsx test/continuous-test-suite-json.ts",
124
125
  "test:json-e2e": "npx tsx test/continuous-test-suite-json-e2e.ts",
125
126
  "test:workflow": "npx tsx test/continuous-test-suite-workflow.ts",
@@ -148,7 +149,7 @@
148
149
  "test:system-messages:vitest": "pnpm exec vitest run test/systemMessages.test.ts",
149
150
  "test:tool-routing-semantic:vitest": "pnpm exec vitest run test/toolRoutingSemantic.test.ts",
150
151
  "test:tool-routing-semantic": "pnpm run test:tool-routing-semantic:vitest && npx tsx test/continuous-test-suite-tool-routing-semantic.ts",
151
- "test:unit": "pnpm run test:envguard && pnpm run test:bugfixes && pnpm run test:file-detector-extension && pnpm run test:mcp:infra && pnpm run test:mcp:bash && pnpm run test:mcp:limits && pnpm run test:mcp:spans && pnpm run test:autoresearch:redis && pnpm run test:unit:vitest && pnpm run test:tool-routing-cli:vitest && pnpm run test:tool-dedup:vitest && pnpm run test:model-pool:vitest && pnpm run test:litellm-context:vitest && pnpm run test:step-budget-guard:vitest && pnpm run test:system-messages:vitest && pnpm run test:tool-routing-semantic:vitest && pnpm run test:anthropic-tools-policy && pnpm run test:sagemaker-tools && pnpm run test:anthropic-multimodal && pnpm run test:excel-interop",
152
+ "test:unit": "pnpm run test:envguard && pnpm run test:bugfixes && pnpm run test:file-detector-extension && pnpm run test:file-detector-magic-bytes && pnpm run test:mcp:infra && pnpm run test:mcp:bash && pnpm run test:mcp:limits && pnpm run test:mcp:spans && pnpm run test:autoresearch:redis && pnpm run test:unit:vitest && pnpm run test:tool-routing-cli:vitest && pnpm run test:tool-dedup:vitest && pnpm run test:model-pool:vitest && pnpm run test:litellm-context:vitest && pnpm run test:step-budget-guard:vitest && pnpm run test:system-messages:vitest && pnpm run test:tool-routing-semantic:vitest && pnpm run test:anthropic-tools-policy && pnpm run test:sagemaker-tools && pnpm run test:anthropic-multimodal && pnpm run test:excel-interop",
152
153
  "// CI tier — live providers, runs only when API keys are present (test:credentials and test:dynamic make real provider calls when keys are set, so they live here, not in test:unit)": "",
153
154
  "test:live": "pnpm run test:providers && pnpm run test:mcp:http && pnpm run test:mcp:sdk && pnpm run test:mcp:cli && pnpm run test:observability && pnpm run test:context && pnpm run test:memory && pnpm run test:tool-reliability && pnpm run test:evaluation && pnpm run test:autoresearch && pnpm run test:credentials && pnpm run test:dynamic",
154
155
  "// CI tier — product output (image/video/TTS/PPT) — costs $$ per run": "",