@juspay/neurolink 12.12.8 → 12.12.9

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.
@@ -49,6 +49,15 @@ export declare function normalizeWireToolSchema(schema: unknown): Record<string,
49
49
  * Check if a value is a Zod schema
50
50
  */
51
51
  export declare function isZodSchema(value: unknown): boolean;
52
+ /**
53
+ * Whether a schema was built by Zod 4 specifically.
54
+ *
55
+ * Zod 4 hangs its internals off `_zod` (and `z.toJSONSchema` reads
56
+ * `schema._zod.def`); Zod 3 has only `_def`. The two can coexist in one install
57
+ * — a host on Zod 3 still resolves NeuroLink's own Zod 4 — so the presence of
58
+ * `z.toJSONSchema` says nothing about the schema actually being handed to it.
59
+ */
60
+ export declare function isZod4Schema(value: unknown): boolean;
52
61
  /**
53
62
  * Convert JSON Schema to Zod schema format using official json-schema-to-zod library
54
63
  * This ensures complete preservation of all schema structure and validation rules
@@ -340,7 +340,7 @@ target = "jsonSchema7") {
340
340
  // Translate our `target` to Zod 4's native dialect identifier so the
341
341
  // openApi3 path emits the OpenAPI 3 schema shape Vertex/Gemini expect
342
342
  // (and not the default draft-07 anyOf/null union).
343
- if (zodToJsonSchemaV4) {
343
+ if (zodToJsonSchemaV4 && isZod4Schema(zodSchema)) {
344
344
  const nativeTarget = target === "openApi3" ? "openapi-3.0" : "draft-07";
345
345
  try {
346
346
  const native = zodToJsonSchemaV4(zodSchema, {
@@ -572,6 +572,17 @@ export function isZodSchema(value) {
572
572
  "_def" in value &&
573
573
  typeof value.parse === "function");
574
574
  }
575
+ /**
576
+ * Whether a schema was built by Zod 4 specifically.
577
+ *
578
+ * Zod 4 hangs its internals off `_zod` (and `z.toJSONSchema` reads
579
+ * `schema._zod.def`); Zod 3 has only `_def`. The two can coexist in one install
580
+ * — a host on Zod 3 still resolves NeuroLink's own Zod 4 — so the presence of
581
+ * `z.toJSONSchema` says nothing about the schema actually being handed to it.
582
+ */
583
+ export function isZod4Schema(value) {
584
+ return !!(value && typeof value === "object" && "_zod" in value);
585
+ }
575
586
  /**
576
587
  * Convert JSON Schema to Zod schema format using official json-schema-to-zod library
577
588
  * This ensures complete preservation of all schema structure and validation rules
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/neurolink",
3
- "version": "12.12.8",
3
+ "version": "12.12.9",
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": {
@@ -96,6 +96,7 @@
96
96
  "test:openai-compat-streaming-retry": "pnpm exec tsx test/continuous-test-suite-openai-compat-streaming-retry.ts",
97
97
  "test:anthropic-streaming-retry": "pnpm exec tsx test/continuous-test-suite-anthropic-streaming-retry.ts",
98
98
  "test:adjust-body-after-400": "pnpm exec tsx test/continuous-test-suite-adjust-body-after-400.ts",
99
+ "test:zod3-schema-native-path": "pnpm exec tsx test/continuous-test-suite-zod3-schema-native-path.ts",
99
100
  "test:error-classification-e2e": "pnpm exec tsx test/continuous-test-suite-error-classification-e2e.ts",
100
101
  "test:error-classifier-contract": "pnpm exec tsx test/continuous-test-suite-error-classifier-contract.ts",
101
102
  "test:bedrock-inference-profile": "pnpm exec tsx test/continuous-test-suite-bedrock-inference-profile.ts",