@juspay/neurolink 9.70.0 → 9.70.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.
@@ -76,6 +76,61 @@ export function getSafeMaxTokens(provider, model, requestedMaxTokens) {
76
76
  // Use the requested value if it's within limits
77
77
  return requestedMaxTokens;
78
78
  }
79
+ /**
80
+ * Maximum output tokens supported by a given Anthropic Claude model.
81
+ *
82
+ * The native Vertex+Claude and native Anthropic message paths send `max_tokens`
83
+ * straight to the Anthropic API, which returns 400 if the value exceeds the
84
+ * model's published output ceiling. (The AI-SDK path clamps automatically;
85
+ * these native paths do not.) This table lets those paths default to the
86
+ * model's real ceiling — 64K for Sonnet/Haiku 4.x, 32K for Opus 4.x — instead of
87
+ * the legacy 4096 that silently truncated large structured responses.
88
+ *
89
+ * Unknown identifiers fall back to a safe modern floor (8192).
90
+ */
91
+ export function getClaudeMaxOutputTokens(model) {
92
+ const m = (model ?? "").toLowerCase();
93
+ // Claude 4.x family: Opus 4.x = 32K, Sonnet/Haiku 4.x = 64K.
94
+ if (/opus[-_.]?4/.test(m)) {
95
+ return 32000;
96
+ }
97
+ if (/sonnet[-_.]?4/.test(m) || /haiku[-_.]?4/.test(m)) {
98
+ return 64000;
99
+ }
100
+ // Claude 3.7 Sonnet supports 64K output.
101
+ if (/3[-_.]?7[-_.]?sonnet/.test(m)) {
102
+ return 64000;
103
+ }
104
+ // Claude 3.5 Sonnet / Haiku → 8192.
105
+ if (/3[-_.]?5[-_.]?(sonnet|haiku)/.test(m)) {
106
+ return 8192;
107
+ }
108
+ // Claude 3 Opus / Sonnet / Haiku → 4096.
109
+ if (/claude-3-(opus|sonnet|haiku)/.test(m) || /3[-_.]?opus/.test(m)) {
110
+ return 4096;
111
+ }
112
+ // Bare family aliases (latest of a family) → assume the modern ceiling.
113
+ if (m.includes("opus")) {
114
+ return 32000;
115
+ }
116
+ if (m.includes("sonnet") || m.includes("haiku")) {
117
+ return 64000;
118
+ }
119
+ return 8192;
120
+ }
121
+ /**
122
+ * Resolve the `max_tokens` to send on a native Anthropic/Claude request: honour
123
+ * the caller's value but clamp it to the model's published ceiling, and default
124
+ * to that ceiling when the caller did not specify one. Prevents both silent
125
+ * truncation (the legacy 4096 default) and 400s from over-large requests.
126
+ */
127
+ export function resolveClaudeMaxTokens(model, requested) {
128
+ const ceiling = getClaudeMaxOutputTokens(model);
129
+ if (requested !== undefined && requested !== null && requested > 0) {
130
+ return Math.min(requested, ceiling);
131
+ }
132
+ return ceiling;
133
+ }
79
134
  /**
80
135
  * Validate if maxTokens is safe for a provider/model combination
81
136
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/neurolink",
3
- "version": "9.70.0",
3
+ "version": "9.70.1",
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": {
@@ -108,6 +108,8 @@
108
108
  "test:dynamic": "npx tsx test/continuous-test-suite-dynamic.ts",
109
109
  "test:proxy": "npx tsx test/continuous-test-suite-proxy.ts",
110
110
  "test:bugfixes": "npx tsx test/continuous-test-suite-bugfixes.ts",
111
+ "test:json": "npx tsx test/continuous-test-suite-json.ts",
112
+ "test:json-e2e": "npx tsx test/continuous-test-suite-json-e2e.ts",
111
113
  "test:workflow": "npx tsx test/continuous-test-suite-workflow.ts",
112
114
  "test:hitl": "npx tsx test/continuous-test-suite-hitl.ts",
113
115
  "test:tasks": "npx tsx test/continuous-test-suite-tasks.ts",
@@ -341,6 +343,7 @@
341
343
  "inquirer": "^13.3.0",
342
344
  "jose": "^6.1.3",
343
345
  "json-schema-to-zod": "^2.7.0",
346
+ "jsonrepair": "^3.14.0",
344
347
  "nanoid": "^5.1.5",
345
348
  "open": "^11.0.0",
346
349
  "ora": "^9.3.0",