@juspay/neurolink 9.70.4 → 9.70.5

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.
@@ -3,6 +3,32 @@ import { AIProviderName } from "../constants/enums.js";
3
3
  import { BaseProvider } from "../core/baseProvider.js";
4
4
  import type { EnhancedGenerateResult, TextGenerationOptions, StreamOptions, StreamResult } from "../types/index.js";
5
5
  import type { Schema, LanguageModel } from "../types/index.js";
6
+ /**
7
+ * Recursively strip JSON-schema fields that Vertex Gemini's function-call AND
8
+ * `responseSchema` (structured output) validators reject with 400
9
+ * INVALID_ARGUMENT. Vertex implements OpenAPI 3.0 Schema strictly and rejects
10
+ * extension fields that the broader JSON Schema spec allows. The fields
11
+ * stripped here have no semantic meaning for the model, so removing them is
12
+ * safe for every caller.
13
+ *
14
+ * Fields removed:
15
+ * - `additionalProperties` — extension; Vertex rejects on any nested object.
16
+ * - `default` — Vertex rejects defaults on object/array-typed properties and
17
+ * on properties that are also marked `required`. Safest to strip globally
18
+ * because the model never inspects them.
19
+ * - `$schema`, `$id`, `$ref`, `definitions`, `$defs` — JSON-Schema-meta
20
+ * fields that Vertex doesn't recognise.
21
+ * - `examples` — accepted by some Gemini variants but not 2.5-flash; strip
22
+ * to avoid the model rejecting tool schemas under that path.
23
+ * - `errorMessage` — emitted by `convertZodToJsonSchema` (which enables
24
+ * zod-to-json-schema's `errorMessages: true`) for any field carrying a
25
+ * custom message, e.g. `z.string().regex(re, { message })`. Vertex's
26
+ * `response_schema` validator rejects it with `Unknown name "errorMessage"
27
+ * … Cannot find field`, failing the whole structured-output request.
28
+ *
29
+ * Exported for deterministic unit testing of the sanitization contract.
30
+ */
31
+ export declare function stripAdditionalPropertiesDeep(schema: Record<string, unknown> | undefined): void;
6
32
  /**
7
33
  * Resolve the effective Vertex region for a given model.
8
34
  *
@@ -41,11 +41,12 @@ const hasAnthropicSupport = () => {
41
41
  return true;
42
42
  };
43
43
  /**
44
- * Recursively strip JSON-schema fields that Vertex Gemini's function-call
45
- * validator rejects with 400 INVALID_ARGUMENT. Vertex implements OpenAPI 3.0
46
- * Schema strictly and rejects extension fields that the broader JSON Schema
47
- * spec allows. The fields stripped here have no semantic meaning for the
48
- * model, so removing them is safe for every caller.
44
+ * Recursively strip JSON-schema fields that Vertex Gemini's function-call AND
45
+ * `responseSchema` (structured output) validators reject with 400
46
+ * INVALID_ARGUMENT. Vertex implements OpenAPI 3.0 Schema strictly and rejects
47
+ * extension fields that the broader JSON Schema spec allows. The fields
48
+ * stripped here have no semantic meaning for the model, so removing them is
49
+ * safe for every caller.
49
50
  *
50
51
  * Fields removed:
51
52
  * - `additionalProperties` — extension; Vertex rejects on any nested object.
@@ -56,8 +57,15 @@ const hasAnthropicSupport = () => {
56
57
  * fields that Vertex doesn't recognise.
57
58
  * - `examples` — accepted by some Gemini variants but not 2.5-flash; strip
58
59
  * to avoid the model rejecting tool schemas under that path.
60
+ * - `errorMessage` — emitted by `convertZodToJsonSchema` (which enables
61
+ * zod-to-json-schema's `errorMessages: true`) for any field carrying a
62
+ * custom message, e.g. `z.string().regex(re, { message })`. Vertex's
63
+ * `response_schema` validator rejects it with `Unknown name "errorMessage"
64
+ * … Cannot find field`, failing the whole structured-output request.
65
+ *
66
+ * Exported for deterministic unit testing of the sanitization contract.
59
67
  */
60
- function stripAdditionalPropertiesDeep(schema) {
68
+ export function stripAdditionalPropertiesDeep(schema) {
61
69
  if (!schema || typeof schema !== "object") {
62
70
  return;
63
71
  }
@@ -70,6 +78,7 @@ function stripAdditionalPropertiesDeep(schema) {
70
78
  "definitions",
71
79
  "$defs",
72
80
  "examples",
81
+ "errorMessage",
73
82
  ];
74
83
  for (const field of FIELDS_TO_STRIP) {
75
84
  if (field in schema) {
@@ -1121,6 +1130,13 @@ export class GoogleVertexProvider extends BaseProvider {
1121
1130
  // ensureNestedSchemaTypes recursively adds missing type fields
1122
1131
  // Note: convertZodToJsonSchema now uses openApi3 target which produces nullable: true
1123
1132
  const typedSchema = ensureNestedSchemaTypes(inlinedSchema);
1133
+ // Sanitize the same way tool schemas are (see tool path above):
1134
+ // Vertex's responseSchema validator rejects extension keywords such
1135
+ // as `errorMessage` (from convertZodToJsonSchema's errorMessages
1136
+ // option) and `additionalProperties`. Without this a user schema with
1137
+ // a `.regex(.., { message })` field 400s the whole structured-output
1138
+ // request and the recovery loop retries the same poisoned payload.
1139
+ stripAdditionalPropertiesDeep(typedSchema);
1124
1140
  config.responseSchema = typedSchema;
1125
1141
  logger.debug("[GoogleVertex] Added responseSchema for JSON output (stream)", {
1126
1142
  schemaKeys: Object.keys(typedSchema),
@@ -1749,6 +1765,13 @@ export class GoogleVertexProvider extends BaseProvider {
1749
1765
  // ensureNestedSchemaTypes recursively adds missing type fields
1750
1766
  // Note: convertZodToJsonSchema now uses openApi3 target which produces nullable: true
1751
1767
  const typedSchema = ensureNestedSchemaTypes(inlinedSchema);
1768
+ // Sanitize the same way tool schemas are (see tool path above):
1769
+ // Vertex's responseSchema validator rejects extension keywords such
1770
+ // as `errorMessage` (from convertZodToJsonSchema's errorMessages
1771
+ // option) and `additionalProperties`. Without this a user schema with
1772
+ // a `.regex(.., { message })` field 400s the whole structured-output
1773
+ // request and the recovery loop retries the same poisoned payload.
1774
+ stripAdditionalPropertiesDeep(typedSchema);
1752
1775
  config.responseSchema = typedSchema;
1753
1776
  logger.debug("[GoogleVertex] Added responseSchema for JSON output (generate)", {
1754
1777
  schemaKeys: Object.keys(typedSchema),
@@ -3,6 +3,32 @@ import { AIProviderName } from "../constants/enums.js";
3
3
  import { BaseProvider } from "../core/baseProvider.js";
4
4
  import type { EnhancedGenerateResult, TextGenerationOptions, StreamOptions, StreamResult } from "../types/index.js";
5
5
  import type { Schema, LanguageModel } from "../types/index.js";
6
+ /**
7
+ * Recursively strip JSON-schema fields that Vertex Gemini's function-call AND
8
+ * `responseSchema` (structured output) validators reject with 400
9
+ * INVALID_ARGUMENT. Vertex implements OpenAPI 3.0 Schema strictly and rejects
10
+ * extension fields that the broader JSON Schema spec allows. The fields
11
+ * stripped here have no semantic meaning for the model, so removing them is
12
+ * safe for every caller.
13
+ *
14
+ * Fields removed:
15
+ * - `additionalProperties` — extension; Vertex rejects on any nested object.
16
+ * - `default` — Vertex rejects defaults on object/array-typed properties and
17
+ * on properties that are also marked `required`. Safest to strip globally
18
+ * because the model never inspects them.
19
+ * - `$schema`, `$id`, `$ref`, `definitions`, `$defs` — JSON-Schema-meta
20
+ * fields that Vertex doesn't recognise.
21
+ * - `examples` — accepted by some Gemini variants but not 2.5-flash; strip
22
+ * to avoid the model rejecting tool schemas under that path.
23
+ * - `errorMessage` — emitted by `convertZodToJsonSchema` (which enables
24
+ * zod-to-json-schema's `errorMessages: true`) for any field carrying a
25
+ * custom message, e.g. `z.string().regex(re, { message })`. Vertex's
26
+ * `response_schema` validator rejects it with `Unknown name "errorMessage"
27
+ * … Cannot find field`, failing the whole structured-output request.
28
+ *
29
+ * Exported for deterministic unit testing of the sanitization contract.
30
+ */
31
+ export declare function stripAdditionalPropertiesDeep(schema: Record<string, unknown> | undefined): void;
6
32
  /**
7
33
  * Resolve the effective Vertex region for a given model.
8
34
  *
@@ -41,11 +41,12 @@ const hasAnthropicSupport = () => {
41
41
  return true;
42
42
  };
43
43
  /**
44
- * Recursively strip JSON-schema fields that Vertex Gemini's function-call
45
- * validator rejects with 400 INVALID_ARGUMENT. Vertex implements OpenAPI 3.0
46
- * Schema strictly and rejects extension fields that the broader JSON Schema
47
- * spec allows. The fields stripped here have no semantic meaning for the
48
- * model, so removing them is safe for every caller.
44
+ * Recursively strip JSON-schema fields that Vertex Gemini's function-call AND
45
+ * `responseSchema` (structured output) validators reject with 400
46
+ * INVALID_ARGUMENT. Vertex implements OpenAPI 3.0 Schema strictly and rejects
47
+ * extension fields that the broader JSON Schema spec allows. The fields
48
+ * stripped here have no semantic meaning for the model, so removing them is
49
+ * safe for every caller.
49
50
  *
50
51
  * Fields removed:
51
52
  * - `additionalProperties` — extension; Vertex rejects on any nested object.
@@ -56,8 +57,15 @@ const hasAnthropicSupport = () => {
56
57
  * fields that Vertex doesn't recognise.
57
58
  * - `examples` — accepted by some Gemini variants but not 2.5-flash; strip
58
59
  * to avoid the model rejecting tool schemas under that path.
60
+ * - `errorMessage` — emitted by `convertZodToJsonSchema` (which enables
61
+ * zod-to-json-schema's `errorMessages: true`) for any field carrying a
62
+ * custom message, e.g. `z.string().regex(re, { message })`. Vertex's
63
+ * `response_schema` validator rejects it with `Unknown name "errorMessage"
64
+ * … Cannot find field`, failing the whole structured-output request.
65
+ *
66
+ * Exported for deterministic unit testing of the sanitization contract.
59
67
  */
60
- function stripAdditionalPropertiesDeep(schema) {
68
+ export function stripAdditionalPropertiesDeep(schema) {
61
69
  if (!schema || typeof schema !== "object") {
62
70
  return;
63
71
  }
@@ -70,6 +78,7 @@ function stripAdditionalPropertiesDeep(schema) {
70
78
  "definitions",
71
79
  "$defs",
72
80
  "examples",
81
+ "errorMessage",
73
82
  ];
74
83
  for (const field of FIELDS_TO_STRIP) {
75
84
  if (field in schema) {
@@ -1121,6 +1130,13 @@ export class GoogleVertexProvider extends BaseProvider {
1121
1130
  // ensureNestedSchemaTypes recursively adds missing type fields
1122
1131
  // Note: convertZodToJsonSchema now uses openApi3 target which produces nullable: true
1123
1132
  const typedSchema = ensureNestedSchemaTypes(inlinedSchema);
1133
+ // Sanitize the same way tool schemas are (see tool path above):
1134
+ // Vertex's responseSchema validator rejects extension keywords such
1135
+ // as `errorMessage` (from convertZodToJsonSchema's errorMessages
1136
+ // option) and `additionalProperties`. Without this a user schema with
1137
+ // a `.regex(.., { message })` field 400s the whole structured-output
1138
+ // request and the recovery loop retries the same poisoned payload.
1139
+ stripAdditionalPropertiesDeep(typedSchema);
1124
1140
  config.responseSchema = typedSchema;
1125
1141
  logger.debug("[GoogleVertex] Added responseSchema for JSON output (stream)", {
1126
1142
  schemaKeys: Object.keys(typedSchema),
@@ -1749,6 +1765,13 @@ export class GoogleVertexProvider extends BaseProvider {
1749
1765
  // ensureNestedSchemaTypes recursively adds missing type fields
1750
1766
  // Note: convertZodToJsonSchema now uses openApi3 target which produces nullable: true
1751
1767
  const typedSchema = ensureNestedSchemaTypes(inlinedSchema);
1768
+ // Sanitize the same way tool schemas are (see tool path above):
1769
+ // Vertex's responseSchema validator rejects extension keywords such
1770
+ // as `errorMessage` (from convertZodToJsonSchema's errorMessages
1771
+ // option) and `additionalProperties`. Without this a user schema with
1772
+ // a `.regex(.., { message })` field 400s the whole structured-output
1773
+ // request and the recovery loop retries the same poisoned payload.
1774
+ stripAdditionalPropertiesDeep(typedSchema);
1752
1775
  config.responseSchema = typedSchema;
1753
1776
  logger.debug("[GoogleVertex] Added responseSchema for JSON output (generate)", {
1754
1777
  schemaKeys: Object.keys(typedSchema),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/neurolink",
3
- "version": "9.70.4",
3
+ "version": "9.70.5",
4
4
  "packageManager": "pnpm@10.15.1",
5
5
  "description": "Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applications with 21+ providers: OpenAI, Anthropic, Google AI Studio, Google Vertex, AWS Bedrock, Azure OpenAI, Mistral, LiteLLM, SageMaker, Hugging Face, Ollama, OpenAI-compatible, OpenRouter, DeepSeek, NVIDIA NIM, LM Studio, llama.cpp, plus voice (OpenAI TTS, ElevenLabs, Deepgram, Azure Speech).",
6
6
  "author": {
@@ -350,7 +350,7 @@
350
350
  "p-limit": "^7.3.0",
351
351
  "redis": "^5.11.0",
352
352
  "tar-stream": "^3.1.8",
353
- "undici": ">=7.22.0",
353
+ "undici": ">=7.24.0 <8.0.0",
354
354
  "ws": "^8.20.1",
355
355
  "yargs": "^18.0.0",
356
356
  "zod": "^4.3.6",
@@ -396,7 +396,7 @@
396
396
  "exceljs": "^4.4.0",
397
397
  "express": "^5.1.0",
398
398
  "express-rate-limit": "^8.2.1",
399
- "fastify": "^5.7.2",
399
+ "fastify": "^5.8.5",
400
400
  "ffmpeg-static": "^5.3.0",
401
401
  "fluent-ffmpeg": "^2.1.3",
402
402
  "koa": "^3.1.1",
@@ -430,7 +430,7 @@
430
430
  "@semantic-release/release-notes-generator": "^14.1.0",
431
431
  "@smithy/types": "^4.13.0",
432
432
  "@sveltejs/adapter-auto": "^7.0.1",
433
- "@sveltejs/kit": "^2.53.4",
433
+ "@sveltejs/kit": "^2.60.1",
434
434
  "@sveltejs/package": "^2.5.7",
435
435
  "@sveltejs/vite-plugin-svelte": "^7.0.0",
436
436
  "@types/adm-zip": "^0.5.7",
@@ -548,7 +548,7 @@
548
548
  "esbuild@<=0.24.2": ">=0.25.0",
549
549
  "cookie@<0.7.0": ">=0.7.0",
550
550
  "@eslint/plugin-kit@<0.3.4": ">=0.3.4",
551
- "tmp@<=0.2.3": ">=0.2.4",
551
+ "tmp@<0.2.6": ">=0.2.6",
552
552
  "axios@<1.13.5": ">=1.13.5",
553
553
  "glob@>=10.3.7 <=11.0.3": ">=11.1.0",
554
554
  "@semantic-release/npm": "^13.1.4",
@@ -556,24 +556,35 @@
556
556
  "@opentelemetry/sdk-trace-node": "^2.6.0",
557
557
  "jws@<4.0.1": ">=4.0.1",
558
558
  "tar@<7.5.8": ">=7.5.8",
559
- "qs@<6.14.2": ">=6.14.2",
559
+ "qs@<6.15.2": ">=6.15.2",
560
560
  "minimatch@>=10.0.0 <10.2.3": ">=10.2.3",
561
561
  "minimatch@>=9.0.0 <9.0.7": ">=9.0.7",
562
562
  "typedoc>minimatch": ">=10.2.3",
563
563
  "minimatch@>=5.0.0 <5.1.8": ">=5.1.8",
564
564
  "minimatch@>=3.0.0 <3.1.4": ">=3.1.4",
565
- "fast-xml-parser@>=5.0.0 <5.3.8": ">=5.3.8",
566
- "lodash@<4.17.23": ">=4.17.23",
567
- "lodash-es@<4.17.23": ">=4.17.23",
568
- "undici@>=7.0.0 <7.22.0": ">=7.22.0",
565
+ "fast-xml-parser@>=5.0.0 <5.7.0": ">=5.7.0",
566
+ "lodash@<4.18.0": ">=4.18.0",
567
+ "lodash-es@<4.18.0": ">=4.18.0",
568
+ "undici@>=7.0.0 <7.24.0": ">=7.24.0 <8.0.0",
569
569
  "undici@>=6.0.0 <6.23.0": ">=6.23.0",
570
570
  "undici@<5.29.0": ">=5.29.0",
571
571
  "js-yaml@>=4.0.0 <4.1.1": ">=4.1.1",
572
572
  "js-yaml@>=3.0.0 <3.14.2": ">=3.14.2",
573
573
  "markdown-it@<14.1.1": ">=14.1.1",
574
574
  "ajv@>=8.0.0 <8.18.0": ">=8.18.0",
575
- "@xmldom/xmldom@<0.8.12": ">=0.8.12",
576
- "rollup@>=4.0.0 <4.59.0": ">=4.59.0"
575
+ "@xmldom/xmldom@<0.9.10": ">=0.9.10",
576
+ "@grpc/grpc-js@<1.14.4": ">=1.14.4",
577
+ "protobufjs@<7.5.8": ">=7.5.8",
578
+ "@protobufjs/utf8@<1.1.1": ">=1.1.1",
579
+ "brace-expansion@>=5.0.0 <5.0.6": ">=5.0.6",
580
+ "fast-uri@<3.1.2": ">=3.1.2",
581
+ "ip-address@<10.1.1": ">=10.1.1",
582
+ "basic-ftp@<5.2.2": ">=5.2.2",
583
+ "fast-xml-builder@<1.1.7": ">=1.1.7",
584
+ "esbuild@>=0.17.0 <0.28.1": ">=0.28.1",
585
+ "rollup@>=4.0.0 <4.59.0": ">=4.59.0",
586
+ "shell-quote@<1.8.4": ">=1.8.4",
587
+ "undici@>=8.0.0": ">=7.24.0 <8.0.0"
577
588
  }
578
589
  },
579
590
  "os": [