@juspay/neurolink 12.33.0 → 12.34.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.
- package/CHANGELOG.md +3 -3
- package/dist/adapters/providerImageAdapter.js +13 -0
- package/dist/browser/neurolink.min.js +419 -419
- package/dist/constants/contextWindows.js +28 -0
- package/dist/constants/enums.d.ts +21 -0
- package/dist/constants/enums.js +30 -0
- package/dist/constants/tokens.d.ts +3 -0
- package/dist/constants/tokens.js +3 -0
- package/dist/evaluation/EvaluatorFactory.js +3 -3
- package/dist/evaluation/EvaluatorRegistry.js +1 -1
- package/dist/evaluation/ragasEvaluator.js +1 -1
- package/dist/mcp/externalServerManager.js +1 -1
- package/dist/mcp/mcpClientFactory.d.ts +1 -1
- package/dist/mcp/mcpClientFactory.js +5 -5
- package/dist/middleware/utils/guardrailsUtils.js +1 -1
- package/dist/models/manifests/anthropic.js +33 -1
- package/dist/neurolink.js +6 -2
- package/dist/providers/catalog/xai.json +17 -3
- package/dist/providers/googleVertex/client.js +0 -2
- package/dist/providers/litellm/client.js +2 -2
- package/dist/providers/openAI/client.js +1 -1
- package/dist/providers/openRouter/client.js +1 -1
- package/dist/proxy/vertexAnthropicFallback.d.ts +8 -0
- package/dist/proxy/vertexAnthropicFallback.js +30 -6
- package/dist/services/server/ai/observability/instrumentation.d.ts +7 -14
- package/dist/services/server/ai/observability/instrumentation.js +80 -32
- package/dist/utils/modelChoices.js +0 -9
- package/dist/utils/pricing.js +5 -0
- package/dist/utils/providerHealth.js +7 -9
- package/dist/utils/redis.js +3 -1
- package/dist/utils/tokenLimits.js +9 -0
- package/dist/workflow/workflows/multiJudgeWorkflow.js +2 -2
- package/docs-site/static/search-index.json +10 -10
- package/package.json +4 -2
|
@@ -83,6 +83,10 @@ export const MODEL_CONTEXT_WINDOWS = {
|
|
|
83
83
|
voyage: {
|
|
84
84
|
// Voyage embeddings: max input tokens vary 16K-32K per model
|
|
85
85
|
_default: 32_000,
|
|
86
|
+
"voyage-4": 32_000,
|
|
87
|
+
"voyage-4-large": 32_000,
|
|
88
|
+
"voyage-4-lite": 32_000,
|
|
89
|
+
"voyage-code-4": 32_000,
|
|
86
90
|
"voyage-3.5": 32_000,
|
|
87
91
|
"voyage-3.5-lite": 32_000,
|
|
88
92
|
"voyage-3-large": 32_000,
|
|
@@ -111,6 +115,10 @@ export const MODEL_CONTEXT_WINDOWS = {
|
|
|
111
115
|
},
|
|
112
116
|
anthropic: {
|
|
113
117
|
_default: 200_000,
|
|
118
|
+
// Claude 5.5 / 5.1 (Sep 2026) — 1M context window, confirmed on
|
|
119
|
+
// platform.claude.com/docs/en/about-claude/models/overview
|
|
120
|
+
"claude-opus-5-5": 1_000_000,
|
|
121
|
+
"claude-fable-5-1": 1_000_000,
|
|
114
122
|
// Claude 5 (mid 2026) — 1M context window
|
|
115
123
|
"claude-sonnet-5": 1_000_000,
|
|
116
124
|
// Claude 4.6 (Feb 2026) — 1M context window
|
|
@@ -134,6 +142,11 @@ export const MODEL_CONTEXT_WINDOWS = {
|
|
|
134
142
|
},
|
|
135
143
|
openai: {
|
|
136
144
|
_default: 128_000,
|
|
145
|
+
// GPT-6 family (Sep 2026) — 1.05M context, per
|
|
146
|
+
// developers.openai.com/api/docs/models
|
|
147
|
+
"gpt-6-astra": 1_050_000,
|
|
148
|
+
"gpt-6-sol": 1_050_000,
|
|
149
|
+
"gpt-6-luna": 1_050_000,
|
|
137
150
|
// GPT-5.4 family — 1.05M context
|
|
138
151
|
"gpt-5.4": 1_050_000,
|
|
139
152
|
"gpt-5.4-mini": 400_000,
|
|
@@ -202,6 +215,8 @@ export const MODEL_CONTEXT_WINDOWS = {
|
|
|
202
215
|
vertex: {
|
|
203
216
|
_default: 1_048_576,
|
|
204
217
|
// Claude on Vertex
|
|
218
|
+
"claude-opus-5-5": 1_000_000,
|
|
219
|
+
"claude-fable-5-1": 1_000_000,
|
|
205
220
|
"claude-sonnet-5": 1_000_000,
|
|
206
221
|
"claude-opus-4-6": 1_000_000,
|
|
207
222
|
"claude-sonnet-4-6": 1_000_000,
|
|
@@ -238,6 +253,9 @@ export const MODEL_CONTEXT_WINDOWS = {
|
|
|
238
253
|
},
|
|
239
254
|
bedrock: {
|
|
240
255
|
_default: 200_000,
|
|
256
|
+
// Claude 5.5 / 5.1 (Sep 2026)
|
|
257
|
+
"anthropic.claude-opus-5-5": 1_000_000,
|
|
258
|
+
"anthropic.claude-fable-5-1": 1_000_000,
|
|
241
259
|
// Claude 4.6
|
|
242
260
|
"anthropic.claude-opus-4-6-v1": 1_000_000,
|
|
243
261
|
"anthropic.claude-sonnet-4-6": 1_000_000,
|
|
@@ -263,6 +281,16 @@ export const MODEL_CONTEXT_WINDOWS = {
|
|
|
263
281
|
},
|
|
264
282
|
azure: {
|
|
265
283
|
_default: 128_000,
|
|
284
|
+
// GPT-6 family (Sep 2026) — 1.05M context, per
|
|
285
|
+
// learn.microsoft.com/azure/ai-foundry/openai/concepts/models
|
|
286
|
+
"gpt-6-astra": 1_050_000,
|
|
287
|
+
"gpt-6-sol": 1_050_000,
|
|
288
|
+
"gpt-6-luna": 1_050_000,
|
|
289
|
+
// GPT-5.6 / GPT-5.5 — Azure-only as of Sep 2026, same 1.05M context
|
|
290
|
+
"gpt-5.6-sol": 1_050_000,
|
|
291
|
+
"gpt-5.6-terra": 1_050_000,
|
|
292
|
+
"gpt-5.6-luna": 1_050_000,
|
|
293
|
+
"gpt-5.5": 1_050_000,
|
|
266
294
|
// GPT-5.4
|
|
267
295
|
"gpt-5.4": 1_050_000,
|
|
268
296
|
"gpt-5.4-mini": 400_000,
|
|
@@ -180,6 +180,9 @@ export declare enum BedrockModels {
|
|
|
180
180
|
* Supported Models for OpenAI
|
|
181
181
|
*/
|
|
182
182
|
export declare enum OpenAIModels {
|
|
183
|
+
GPT_6_ASTRA = "gpt-6-astra",
|
|
184
|
+
GPT_6_SOL = "gpt-6-sol",
|
|
185
|
+
GPT_6_LUNA = "gpt-6-luna",
|
|
183
186
|
GPT_5_3_CODEX = "gpt-5.3-codex",
|
|
184
187
|
GPT_5_4 = "gpt-5.4",
|
|
185
188
|
GPT_5_4_MINI = "gpt-5.4-mini",
|
|
@@ -228,6 +231,13 @@ export declare enum OpenAIModels {
|
|
|
228
231
|
* Note: Azure uses deployment names, these are model identifiers
|
|
229
232
|
*/
|
|
230
233
|
export declare enum AzureOpenAIModels {
|
|
234
|
+
GPT_6_ASTRA = "gpt-6-astra",
|
|
235
|
+
GPT_6_SOL = "gpt-6-sol",
|
|
236
|
+
GPT_6_LUNA = "gpt-6-luna",
|
|
237
|
+
GPT_5_6_SOL = "gpt-5.6-sol",
|
|
238
|
+
GPT_5_6_TERRA = "gpt-5.6-terra",
|
|
239
|
+
GPT_5_6_LUNA = "gpt-5.6-luna",
|
|
240
|
+
GPT_5_5 = "gpt-5.5",
|
|
231
241
|
GPT_5_2 = "gpt-5.2",
|
|
232
242
|
GPT_5_2_CHAT = "gpt-5.2-chat",
|
|
233
243
|
GPT_5_2_PRO = "gpt-5.2-pro",
|
|
@@ -355,6 +365,8 @@ export declare enum AnthropicModels {
|
|
|
355
365
|
CLAUDE_OPUS_5 = "claude-opus-5",
|
|
356
366
|
CLAUDE_SONNET_5 = "claude-sonnet-5",
|
|
357
367
|
CLAUDE_FABLE_5 = "claude-fable-5",
|
|
368
|
+
CLAUDE_OPUS_5_5 = "claude-opus-5-5",
|
|
369
|
+
CLAUDE_FABLE_5_1 = "claude-fable-5-1",
|
|
358
370
|
CLAUDE_OPUS_4_8 = "claude-opus-4-8",
|
|
359
371
|
CLAUDE_OPUS_4_7 = "claude-opus-4-7",
|
|
360
372
|
CLAUDE_OPUS_4_6 = "claude-opus-4-6",
|
|
@@ -650,6 +662,14 @@ export declare enum CohereModels {
|
|
|
650
662
|
* @see https://docs.voyageai.com/docs/embeddings
|
|
651
663
|
*/
|
|
652
664
|
export declare enum VoyageModels {
|
|
665
|
+
/** Voyage 4 — latest general-purpose flagship */
|
|
666
|
+
VOYAGE_4 = "voyage-4",
|
|
667
|
+
/** Voyage 4 Large — largest / highest quality */
|
|
668
|
+
VOYAGE_4_LARGE = "voyage-4-large",
|
|
669
|
+
/** Voyage 4 Lite — smaller / cheaper */
|
|
670
|
+
VOYAGE_4_LITE = "voyage-4-lite",
|
|
671
|
+
/** Voyage Code 4 — code-tuned */
|
|
672
|
+
VOYAGE_CODE_4 = "voyage-code-4",
|
|
653
673
|
/** Voyage 3.5 — latest general-purpose (default) */
|
|
654
674
|
VOYAGE_3_5 = "voyage-3.5",
|
|
655
675
|
/** Voyage 3.5 Lite — smaller / cheaper */
|
|
@@ -1042,6 +1062,7 @@ export declare enum UpstageModels {
|
|
|
1042
1062
|
SYN_PRO_251021 = "syn-pro-251021"
|
|
1043
1063
|
}
|
|
1044
1064
|
export declare enum XaiModels {
|
|
1065
|
+
GROK_4_7 = "grok-4.7",
|
|
1045
1066
|
GROK_4_6 = "grok-4.6",
|
|
1046
1067
|
GROK_4_5 = "grok-4.5",
|
|
1047
1068
|
GROK_4_3 = "grok-4.3",
|
package/dist/constants/enums.js
CHANGED
|
@@ -257,6 +257,11 @@ export var BedrockModels;
|
|
|
257
257
|
*/
|
|
258
258
|
export var OpenAIModels;
|
|
259
259
|
(function (OpenAIModels) {
|
|
260
|
+
// GPT-6 Series (Released September 2026) - current flagship family, per
|
|
261
|
+
// developers.openai.com/api/docs/models
|
|
262
|
+
OpenAIModels["GPT_6_ASTRA"] = "gpt-6-astra";
|
|
263
|
+
OpenAIModels["GPT_6_SOL"] = "gpt-6-sol";
|
|
264
|
+
OpenAIModels["GPT_6_LUNA"] = "gpt-6-luna";
|
|
260
265
|
// GPT-5.3 Series (Released February 2026) - Latest coding models
|
|
261
266
|
OpenAIModels["GPT_5_3_CODEX"] = "gpt-5.3-codex";
|
|
262
267
|
// GPT-5.4 Series (Released March 2026) - Latest flagship models
|
|
@@ -318,6 +323,18 @@ export var OpenAIModels;
|
|
|
318
323
|
*/
|
|
319
324
|
export var AzureOpenAIModels;
|
|
320
325
|
(function (AzureOpenAIModels) {
|
|
326
|
+
// GPT-6 Series (September 2026) - current flagship family, confirmed on
|
|
327
|
+
// Azure OpenAI (learn.microsoft.com/azure/ai-foundry/openai/concepts/models)
|
|
328
|
+
AzureOpenAIModels["GPT_6_ASTRA"] = "gpt-6-astra";
|
|
329
|
+
AzureOpenAIModels["GPT_6_SOL"] = "gpt-6-sol";
|
|
330
|
+
AzureOpenAIModels["GPT_6_LUNA"] = "gpt-6-luna";
|
|
331
|
+
// GPT-5.6 Series (Azure-only as of Sep 2026 — retired from the OpenAI-direct
|
|
332
|
+
// catalog, still documented on Azure OpenAI)
|
|
333
|
+
AzureOpenAIModels["GPT_5_6_SOL"] = "gpt-5.6-sol";
|
|
334
|
+
AzureOpenAIModels["GPT_5_6_TERRA"] = "gpt-5.6-terra";
|
|
335
|
+
AzureOpenAIModels["GPT_5_6_LUNA"] = "gpt-5.6-luna";
|
|
336
|
+
// GPT-5.5 (Azure-only as of Sep 2026 — same situation as GPT-5.6 above)
|
|
337
|
+
AzureOpenAIModels["GPT_5_5"] = "gpt-5.5";
|
|
321
338
|
// GPT-5.2 Series (Latest - December 2025)
|
|
322
339
|
AzureOpenAIModels["GPT_5_2"] = "gpt-5.2";
|
|
323
340
|
AzureOpenAIModels["GPT_5_2_CHAT"] = "gpt-5.2-chat";
|
|
@@ -482,6 +499,10 @@ export var AnthropicModels;
|
|
|
482
499
|
AnthropicModels["CLAUDE_OPUS_5"] = "claude-opus-5";
|
|
483
500
|
AnthropicModels["CLAUDE_SONNET_5"] = "claude-sonnet-5";
|
|
484
501
|
AnthropicModels["CLAUDE_FABLE_5"] = "claude-fable-5";
|
|
502
|
+
// Claude 5.5 / 5.1 Series (September 2026) — confirmed on
|
|
503
|
+
// platform.claude.com/docs/en/about-claude/models/overview
|
|
504
|
+
AnthropicModels["CLAUDE_OPUS_5_5"] = "claude-opus-5-5";
|
|
505
|
+
AnthropicModels["CLAUDE_FABLE_5_1"] = "claude-fable-5-1";
|
|
485
506
|
// Claude 4.7 / 4.8 Series
|
|
486
507
|
AnthropicModels["CLAUDE_OPUS_4_8"] = "claude-opus-4-8";
|
|
487
508
|
AnthropicModels["CLAUDE_OPUS_4_7"] = "claude-opus-4-7";
|
|
@@ -868,6 +889,14 @@ export var CohereModels;
|
|
|
868
889
|
*/
|
|
869
890
|
export var VoyageModels;
|
|
870
891
|
(function (VoyageModels) {
|
|
892
|
+
/** Voyage 4 — latest general-purpose flagship */
|
|
893
|
+
VoyageModels["VOYAGE_4"] = "voyage-4";
|
|
894
|
+
/** Voyage 4 Large — largest / highest quality */
|
|
895
|
+
VoyageModels["VOYAGE_4_LARGE"] = "voyage-4-large";
|
|
896
|
+
/** Voyage 4 Lite — smaller / cheaper */
|
|
897
|
+
VoyageModels["VOYAGE_4_LITE"] = "voyage-4-lite";
|
|
898
|
+
/** Voyage Code 4 — code-tuned */
|
|
899
|
+
VoyageModels["VOYAGE_CODE_4"] = "voyage-code-4";
|
|
871
900
|
/** Voyage 3.5 — latest general-purpose (default) */
|
|
872
901
|
VoyageModels["VOYAGE_3_5"] = "voyage-3.5";
|
|
873
902
|
/** Voyage 3.5 Lite — smaller / cheaper */
|
|
@@ -1290,6 +1319,7 @@ export var UpstageModels;
|
|
|
1290
1319
|
})(UpstageModels || (UpstageModels = {}));
|
|
1291
1320
|
export var XaiModels;
|
|
1292
1321
|
(function (XaiModels) {
|
|
1322
|
+
XaiModels["GROK_4_7"] = "grok-4.7";
|
|
1293
1323
|
XaiModels["GROK_4_6"] = "grok-4.6";
|
|
1294
1324
|
XaiModels["GROK_4_5"] = "grok-4.5";
|
|
1295
1325
|
XaiModels["GROK_4_3"] = "grok-4.3";
|
|
@@ -71,6 +71,9 @@ export declare const PROVIDER_TOKEN_LIMITS: {
|
|
|
71
71
|
};
|
|
72
72
|
/** OpenAI model limits */
|
|
73
73
|
readonly OPENAI: {
|
|
74
|
+
readonly "gpt-6-astra": 128000;
|
|
75
|
+
readonly "gpt-6-sol": 128000;
|
|
76
|
+
readonly "gpt-6-luna": 128000;
|
|
74
77
|
readonly "gpt-5.4": 128000;
|
|
75
78
|
readonly "gpt-5.4-mini": 128000;
|
|
76
79
|
readonly "gpt-5.4-nano": 128000;
|
package/dist/constants/tokens.js
CHANGED
|
@@ -57,7 +57,7 @@ export class EvaluatorFactory extends BaseFactory {
|
|
|
57
57
|
const mergedConfig = {
|
|
58
58
|
threshold: 7,
|
|
59
59
|
evaluationStrategy: "ragas",
|
|
60
|
-
evaluationModel: process.env.NEUROLINK_RAGAS_EVALUATION_MODEL || "gemini-
|
|
60
|
+
evaluationModel: process.env.NEUROLINK_RAGAS_EVALUATION_MODEL || "gemini-2.5-flash",
|
|
61
61
|
provider: process.env.NEUROLINK_RAGAS_EVALUATION_PROVIDER || "vertex",
|
|
62
62
|
...config,
|
|
63
63
|
};
|
|
@@ -95,7 +95,7 @@ export class EvaluatorFactory extends BaseFactory {
|
|
|
95
95
|
const mergedConfig = {
|
|
96
96
|
threshold: 5,
|
|
97
97
|
evaluationStrategy: "ragas",
|
|
98
|
-
evaluationModel: process.env.NEUROLINK_RAGAS_EVALUATION_MODEL || "gemini-
|
|
98
|
+
evaluationModel: process.env.NEUROLINK_RAGAS_EVALUATION_MODEL || "gemini-2.5-flash",
|
|
99
99
|
provider: process.env.NEUROLINK_RAGAS_EVALUATION_PROVIDER || "vertex",
|
|
100
100
|
...config,
|
|
101
101
|
};
|
|
@@ -114,7 +114,7 @@ export class EvaluatorFactory extends BaseFactory {
|
|
|
114
114
|
const mergedConfig = {
|
|
115
115
|
threshold: 6,
|
|
116
116
|
evaluationStrategy: "ragas",
|
|
117
|
-
evaluationModel: "gemini-
|
|
117
|
+
evaluationModel: "gemini-2.5-flash",
|
|
118
118
|
provider: "vertex",
|
|
119
119
|
...config,
|
|
120
120
|
};
|
|
@@ -73,7 +73,7 @@ export class EvaluatorRegistry extends BaseRegistry {
|
|
|
73
73
|
name: "RAGAS Evaluator",
|
|
74
74
|
description: "RAGAS-style LLM-as-judge evaluation with relevance, accuracy, and completeness metrics",
|
|
75
75
|
requiresLLM: true,
|
|
76
|
-
defaultModel: "gemini-
|
|
76
|
+
defaultModel: "gemini-2.5-flash",
|
|
77
77
|
defaultProvider: "vertex",
|
|
78
78
|
version: "1.0.0",
|
|
79
79
|
features: [
|
|
@@ -18,7 +18,7 @@ export class RAGASEvaluator {
|
|
|
18
18
|
this.evaluationModel =
|
|
19
19
|
evaluationModel ||
|
|
20
20
|
process.env.NEUROLINK_RAGAS_EVALUATION_MODEL ||
|
|
21
|
-
"gemini-
|
|
21
|
+
"gemini-2.5-flash";
|
|
22
22
|
this.providerName =
|
|
23
23
|
providerName ||
|
|
24
24
|
process.env.NEUROLINK_RAGAS_EVALUATION_PROVIDER ||
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
* - Tool discovery and registration
|
|
8
8
|
*/
|
|
9
9
|
import { EventEmitter } from "events";
|
|
10
|
-
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
11
10
|
import { mcpLogger } from "../utils/logger.js";
|
|
12
11
|
import { MCPClientFactory } from "./mcpClientFactory.js";
|
|
13
12
|
import { ToolDiscoveryService } from "./toolDiscoveryService.js";
|
|
@@ -1063,6 +1062,7 @@ export class ExternalServerManager extends EventEmitter {
|
|
|
1063
1062
|
instance.client = clientResult.client;
|
|
1064
1063
|
instance.transportInstance = clientResult.transport;
|
|
1065
1064
|
instance.process = clientResult.process || null;
|
|
1065
|
+
const { StdioClientTransport } = await import("@modelcontextprotocol/sdk/client/stdio.js");
|
|
1066
1066
|
instance.pid =
|
|
1067
1067
|
clientResult.transport instanceof StdioClientTransport
|
|
1068
1068
|
? (clientResult.transport.pid ?? undefined)
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Supports stdio, SSE, WebSocket, and HTTP transports
|
|
5
5
|
* Enhanced with retry, rate limiting, and OAuth 2.1 support
|
|
6
6
|
*/
|
|
7
|
-
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
7
|
+
import type { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
8
8
|
import type { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
|
|
9
9
|
import type { ClientCapabilities } from "@modelcontextprotocol/sdk/types.js";
|
|
10
10
|
import type { ChildProcess } from "child_process";
|
|
@@ -4,11 +4,6 @@
|
|
|
4
4
|
* Supports stdio, SSE, WebSocket, and HTTP transports
|
|
5
5
|
* Enhanced with retry, rate limiting, and OAuth 2.1 support
|
|
6
6
|
*/
|
|
7
|
-
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
8
|
-
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
9
|
-
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
10
|
-
import { WebSocketClientTransport } from "@modelcontextprotocol/sdk/client/websocket.js";
|
|
11
|
-
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
12
7
|
import { mcpLogger } from "../utils/logger.js";
|
|
13
8
|
import { globalCircuitBreakerManager } from "./mcpCircuitBreaker.js";
|
|
14
9
|
import { CircuitBreakerOpenError } from "../types/index.js";
|
|
@@ -209,6 +204,7 @@ export class MCPClientFactory {
|
|
|
209
204
|
const transport = transportResult.transport;
|
|
210
205
|
try {
|
|
211
206
|
// Create client
|
|
207
|
+
const { Client } = await import("@modelcontextprotocol/sdk/client/index.js");
|
|
212
208
|
const client = new Client(this.NEUROLINK_IMPLEMENTATION, {
|
|
213
209
|
capabilities: this.DEFAULT_CAPABILITIES,
|
|
214
210
|
});
|
|
@@ -296,6 +292,7 @@ export class MCPClientFactory {
|
|
|
296
292
|
if (!config.command) {
|
|
297
293
|
throw new Error(`Command is required for stdio transport`);
|
|
298
294
|
}
|
|
295
|
+
const { StdioClientTransport } = await import("@modelcontextprotocol/sdk/client/stdio.js");
|
|
299
296
|
const transport = new StdioClientTransport({
|
|
300
297
|
command: config.command,
|
|
301
298
|
args: config.args || [],
|
|
@@ -333,6 +330,7 @@ export class MCPClientFactory {
|
|
|
333
330
|
});
|
|
334
331
|
try {
|
|
335
332
|
const url = new URL(config.url);
|
|
333
|
+
const { SSEClientTransport } = await import("@modelcontextprotocol/sdk/client/sse.js");
|
|
336
334
|
const transport = new SSEClientTransport(url);
|
|
337
335
|
return { transport };
|
|
338
336
|
}
|
|
@@ -352,6 +350,7 @@ export class MCPClientFactory {
|
|
|
352
350
|
});
|
|
353
351
|
try {
|
|
354
352
|
const url = new URL(config.url);
|
|
353
|
+
const { WebSocketClientTransport } = await import("@modelcontextprotocol/sdk/client/websocket.js");
|
|
355
354
|
const transport = new WebSocketClientTransport(url);
|
|
356
355
|
return { transport };
|
|
357
356
|
}
|
|
@@ -402,6 +401,7 @@ export class MCPClientFactory {
|
|
|
402
401
|
const requestInit = {
|
|
403
402
|
headers: Object.keys(headers).length > 0 ? headers : undefined,
|
|
404
403
|
};
|
|
404
|
+
const { StreamableHTTPClientTransport } = await import("@modelcontextprotocol/sdk/client/streamableHttp.js");
|
|
405
405
|
const transport = new StreamableHTTPClientTransport(url, {
|
|
406
406
|
requestInit,
|
|
407
407
|
fetch: fetchWithEnhancements,
|
|
@@ -113,7 +113,7 @@ params, config) {
|
|
|
113
113
|
*/
|
|
114
114
|
export async function performPrecallEvaluation(config, userInput) {
|
|
115
115
|
try {
|
|
116
|
-
const provider = await AIProviderFactory.createProvider(config.provider || "google-ai", config.evaluationModel || "gemini-
|
|
116
|
+
const provider = await AIProviderFactory.createProvider(config.provider || "google-ai", config.evaluationModel || "gemini-2.5-flash");
|
|
117
117
|
const evaluationPrompt = config.evaluationPrompt || DEFAULT_EVALUATION_PROMPT;
|
|
118
118
|
const prompt = evaluationPrompt.replace("{USER_INPUT}", userInput);
|
|
119
119
|
const result = await provider.generate({
|
|
@@ -23,11 +23,43 @@ export const anthropicManifest = {
|
|
|
23
23
|
},
|
|
24
24
|
],
|
|
25
25
|
models: {
|
|
26
|
+
"claude-opus-5-5": {
|
|
27
|
+
aliases: ["opus-5.5"],
|
|
28
|
+
displayName: "Claude Opus 5.5",
|
|
29
|
+
contextWindow: 1_000_000,
|
|
30
|
+
maxOutputTokens: 128_000,
|
|
31
|
+
// No pricingPerMTok DELIBERATELY: PRICING.anthropic already carries
|
|
32
|
+
// real rates for this id (input 4.0/output 20.0 per MTok) — see the
|
|
33
|
+
// claude-sonnet-5 comment below for why this defers to that table.
|
|
34
|
+
vision: true,
|
|
35
|
+
functionCalling: true,
|
|
36
|
+
reasoning: true,
|
|
37
|
+
jsonMode: true,
|
|
38
|
+
samplingParams: false, // matches SAMPLING_PARAM_REJECTING_FAMILIES /opus[-_.]?5(?![0-9])/i
|
|
39
|
+
},
|
|
40
|
+
"claude-fable-5-1": {
|
|
41
|
+
aliases: ["fable-5.1"],
|
|
42
|
+
displayName: "Claude Fable 5.1",
|
|
43
|
+
contextWindow: 1_000_000,
|
|
44
|
+
maxOutputTokens: 128_000,
|
|
45
|
+
// No pricingPerMTok DELIBERATELY: PRICING.anthropic already carries
|
|
46
|
+
// real rates for this id (input 10.0/output 50.0 per MTok) — see the
|
|
47
|
+
// claude-sonnet-5 comment below for why this defers to that table.
|
|
48
|
+
vision: true,
|
|
49
|
+
functionCalling: true,
|
|
50
|
+
reasoning: true,
|
|
51
|
+
jsonMode: true,
|
|
52
|
+
samplingParams: false, // matches SAMPLING_PARAM_REJECTING_FAMILIES /fable/i
|
|
53
|
+
},
|
|
26
54
|
"claude-sonnet-5": {
|
|
27
55
|
aliases: ["sonnet-5", "claude-sonnet"],
|
|
28
56
|
displayName: "Claude Sonnet 5",
|
|
29
57
|
contextWindow: 1_000_000,
|
|
30
|
-
|
|
58
|
+
// Was 64_000; corrected to 128_000 to match the official spec
|
|
59
|
+
// (platform.claude.com/docs/en/about-claude/models/overview) and the
|
|
60
|
+
// matching fix in getClaudeMaxOutputTokens (tokenLimits.ts), which this
|
|
61
|
+
// manifest's own header comment names as the authoritative source.
|
|
62
|
+
maxOutputTokens: 128_000,
|
|
31
63
|
// No pricingPerMTok DELIBERATELY: PRICING.anthropic carries real
|
|
32
64
|
// rates for this id, and findRates() is manifest-first with a legacy
|
|
33
65
|
// fallback — omitting the rate here defers to that table instead of
|
package/dist/neurolink.js
CHANGED
|
@@ -2804,11 +2804,15 @@ Current user's request: ${currentInput}`;
|
|
|
2804
2804
|
try {
|
|
2805
2805
|
const langfuseConfig = this.observabilityConfig?.langfuse;
|
|
2806
2806
|
if (langfuseConfig?.enabled) {
|
|
2807
|
-
|
|
2807
|
+
try {
|
|
2808
|
+
await initializeOpenTelemetry(langfuseConfig);
|
|
2809
|
+
}
|
|
2810
|
+
catch (err) {
|
|
2808
2811
|
logger.error("[NeuroLink] OpenTelemetry initialization failed", {
|
|
2809
2812
|
error: err instanceof Error ? err.message : String(err),
|
|
2810
2813
|
});
|
|
2811
|
-
|
|
2814
|
+
return;
|
|
2815
|
+
}
|
|
2812
2816
|
logger.debug("[NeuroLink] Langfuse observability initialized via public method");
|
|
2813
2817
|
}
|
|
2814
2818
|
else {
|
|
@@ -9,10 +9,24 @@
|
|
|
9
9
|
},
|
|
10
10
|
"models": {
|
|
11
11
|
"default": "grok-4.6",
|
|
12
|
-
"fallbacks": [
|
|
12
|
+
"fallbacks": [
|
|
13
|
+
"grok-4.6",
|
|
14
|
+
"grok-4.5",
|
|
15
|
+
"grok-4.3",
|
|
16
|
+
"grok-3",
|
|
17
|
+
"grok-3-mini",
|
|
18
|
+
"grok-4.7"
|
|
19
|
+
],
|
|
13
20
|
"defaultContextWindow": 131072,
|
|
14
21
|
"defaultMaxOutputTokens": 4096,
|
|
15
22
|
"catalog": {
|
|
23
|
+
"grok-4.7": {
|
|
24
|
+
"enumMember": "GROK_4_7",
|
|
25
|
+
"contextWindow": 500000,
|
|
26
|
+
"vision": true,
|
|
27
|
+
"status": "production",
|
|
28
|
+
"description": "Grok 4.7 — xAI's newest flagship as of 2026-09-27 (text + image input); not yet the SDK default, see docs.x.ai/developers/grok-4-7"
|
|
29
|
+
},
|
|
16
30
|
"grok-4.6": {
|
|
17
31
|
"enumMember": "GROK_4_6",
|
|
18
32
|
"contextWindow": 131072,
|
|
@@ -71,7 +85,7 @@
|
|
|
71
85
|
}
|
|
72
86
|
},
|
|
73
87
|
"visionModel": "grok-4.6",
|
|
74
|
-
"topModels": ["grok-4.6", "grok-4.5", "grok-4.3", "grok-3"]
|
|
88
|
+
"topModels": ["grok-4.6", "grok-4.5", "grok-4.3", "grok-3", "grok-4.7"]
|
|
75
89
|
},
|
|
76
90
|
"capabilities": {
|
|
77
91
|
"text": true,
|
|
@@ -114,7 +128,7 @@
|
|
|
114
128
|
},
|
|
115
129
|
"liveMatrix": {
|
|
116
130
|
"date": "2026-08-30",
|
|
117
|
-
"result": "grok-2-latest, grok-2-vision-latest and grok-beta are rejected as invalid models. The grok-4.x line replaces them: 4.3/4.5/4.6 all answer, and all three read a 64x64 PNG correctly, so vision moved there from the retired grok-2-vision-latest. An earlier probe with an 8x8 PNG reported no vision — that was xAI answering 'Invalid PNG image', a complaint about the file rather than the capability. grok-3 and grok-3-mini are kept because they still serve, even though xAI's /models roster omits them: roster absence is not evidence of death here."
|
|
131
|
+
"result": "grok-2-latest, grok-2-vision-latest and grok-beta are rejected as invalid models. The grok-4.x line replaces them: 4.3/4.5/4.6 all answer, and all three read a 64x64 PNG correctly, so vision moved there from the retired grok-2-vision-latest. An earlier probe with an 8x8 PNG reported no vision — that was xAI answering 'Invalid PNG image', a complaint about the file rather than the capability. grok-3 and grok-3-mini are kept because they still serve, even though xAI's /models roster omits them: roster absence is not evidence of death here. grok-4.7 added 2026-09-27 from docs.x.ai/developers/grok-4-7 and docs.x.ai/developers/pricing (official docs review only — no xAI API key was available in this environment, so unlike the rest of this file it has not been roster/chat-probed live; context 500,000 tokens and text+image input are as published, and it is deliberately left with no pricingPerMTok, matching grok-4.6/4.5/4.3, because its real rate is tiered by prompt length ($2/$0.50/$6 per 1M below 200k tokens, $4/$1/$12 at or above) and the schema's pricingPerMTok field can only hold one flat rate)."
|
|
118
132
|
},
|
|
119
133
|
"addedInPR": "https://github.com/juspay/neurolink/pull/1587"
|
|
120
134
|
}
|
|
@@ -6480,8 +6480,6 @@ export class GoogleVertexProvider extends BaseProvider {
|
|
|
6480
6480
|
"gemini-2.5-flash-lite",
|
|
6481
6481
|
"gemini-2.0-flash-001",
|
|
6482
6482
|
"gemini-2.0-flash-lite",
|
|
6483
|
-
"gemini-1.5-pro",
|
|
6484
|
-
"gemini-1.5-flash",
|
|
6485
6483
|
],
|
|
6486
6484
|
claude: [
|
|
6487
6485
|
"claude-sonnet-4-5@20250929",
|
|
@@ -13,7 +13,7 @@ import { createTimeoutController } from "../../utils/timeout.js";
|
|
|
13
13
|
import { stripTrailingSlash } from "../openaiChatCompletionsClient.js";
|
|
14
14
|
import { OpenAIChatCompletionsProvider } from "../openaiChatCompletionsBase.js";
|
|
15
15
|
const streamTracer = trace.getTracer("neurolink.provider.litellm");
|
|
16
|
-
const FALLBACK_LITELLM_MODEL = "openai/gpt-
|
|
16
|
+
const FALLBACK_LITELLM_MODEL = "openai/gpt-5.4-mini";
|
|
17
17
|
const getLiteLLMConfig = () => ({
|
|
18
18
|
baseURL: process.env.LITELLM_BASE_URL || "http://localhost:4000",
|
|
19
19
|
apiKey: process.env.LITELLM_API_KEY || "sk-anything",
|
|
@@ -243,7 +243,7 @@ export class LiteLLMProvider extends OpenAIChatCompletionsProvider {
|
|
|
243
243
|
.map((m) => m.trim())
|
|
244
244
|
.filter((m) => m.length > 0) || [
|
|
245
245
|
"openai/gpt-4o",
|
|
246
|
-
"anthropic/claude-
|
|
246
|
+
"anthropic/claude-haiku-4-5-20251001",
|
|
247
247
|
"meta-llama/llama-3.1-8b-instruct",
|
|
248
248
|
"google/gemini-2.5-flash",
|
|
249
249
|
]);
|
|
@@ -44,7 +44,7 @@ const resolveOpenAIBaseURL = (credentialBaseURL, envBaseURL) => {
|
|
|
44
44
|
return resolved;
|
|
45
45
|
};
|
|
46
46
|
const getOpenAIApiKey = () => validateApiKey(createOpenAIConfig());
|
|
47
|
-
const getOpenAIModel = () => getProviderModel("OPENAI_MODEL", "gpt-
|
|
47
|
+
const getOpenAIModel = () => getProviderModel("OPENAI_MODEL", "gpt-5.4");
|
|
48
48
|
const streamTracer = trace.getTracer("neurolink.provider.openai");
|
|
49
49
|
/**
|
|
50
50
|
* OpenAI Provider — direct HTTP, no AI SDK.
|
|
@@ -278,7 +278,7 @@ export class OpenRouterProvider extends OpenAIChatCompletionsProvider {
|
|
|
278
278
|
"openai/gpt-4-turbo",
|
|
279
279
|
// Google models
|
|
280
280
|
"google/gemini-2.0-flash",
|
|
281
|
-
"google/gemini-
|
|
281
|
+
"google/gemini-2.5-pro",
|
|
282
282
|
// Meta Llama models
|
|
283
283
|
"meta-llama/llama-3.1-70b-instruct",
|
|
284
284
|
"meta-llama/llama-3.1-8b-instruct",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* `tool_use`, `tool_result`, `cache_control` and thinking blocks all survive
|
|
13
13
|
* here because nothing reshapes them.
|
|
14
14
|
*/
|
|
15
|
+
import type { GoogleAuth } from "google-auth-library";
|
|
15
16
|
import type { VertexAccessTokenProvider, UsageContext, VertexPassthroughTerminal, VertexAnthropicPassthroughRequest, VertexAnthropicPassthroughTarget } from "../types/index.js";
|
|
16
17
|
/**
|
|
17
18
|
* Translate `output_config` for Vertex.
|
|
@@ -40,6 +41,13 @@ export declare function buildVertexAnthropicPayload(body: Readonly<Record<string
|
|
|
40
41
|
* caller's `stream` flag selects the verb rather than changing the body.
|
|
41
42
|
*/
|
|
42
43
|
export declare function buildVertexAnthropicUrl(target: VertexAnthropicPassthroughTarget): string;
|
|
44
|
+
/** Exported only for continuous-test-suite-vertex-anthropic-fallback.ts,
|
|
45
|
+
* which proves concurrent callers share one instance. Not part of the
|
|
46
|
+
* package's public surface — this module isn't re-exported from index.ts. */
|
|
47
|
+
export declare function auth(): Promise<GoogleAuth>;
|
|
48
|
+
/** Test-only: isolates the concurrency proof from cache state any earlier
|
|
49
|
+
* test in the same process may have left behind. */
|
|
50
|
+
export declare function resetAuthCacheForTests(): void;
|
|
43
51
|
/**
|
|
44
52
|
* Replace the Google credential lookup, for tests only.
|
|
45
53
|
*
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
* `tool_use`, `tool_result`, `cache_control` and thinking blocks all survive
|
|
13
13
|
* here because nothing reshapes them.
|
|
14
14
|
*/
|
|
15
|
-
import { GoogleAuth } from "google-auth-library";
|
|
16
15
|
import { logger } from "../utils/logger.js";
|
|
17
16
|
import { isTransientNetworkError } from "./proxyFetch.js";
|
|
18
17
|
/** Vertex pins the Anthropic API version in the body, not a header. */
|
|
@@ -379,16 +378,41 @@ export function buildVertexAnthropicUrl(target) {
|
|
|
379
378
|
return (`https://${host}/v1/projects/${target.projectId}/locations/` +
|
|
380
379
|
`${target.location}/publishers/anthropic/models/${target.model}:${verb}`);
|
|
381
380
|
}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
381
|
+
// google-auth-library is only needed once a Vertex fallback request actually
|
|
382
|
+
// needs a Google access token, so it's loaded with `await import(...)` instead
|
|
383
|
+
// of a static import. The module promise is cached at module scope, and the
|
|
384
|
+
// resulting client instance is cached separately, exactly as before.
|
|
385
|
+
let googleAuthModulePromise;
|
|
386
|
+
function loadGoogleAuth() {
|
|
387
|
+
if (!googleAuthModulePromise) {
|
|
388
|
+
googleAuthModulePromise = import("google-auth-library");
|
|
389
|
+
}
|
|
390
|
+
return googleAuthModulePromise;
|
|
391
|
+
}
|
|
392
|
+
// Cache the PROMISE, not the resolved client: the guard below runs to
|
|
393
|
+
// completion before any await, so two calls entering before the first
|
|
394
|
+
// resolves both see the same in-flight promise instead of each racing to
|
|
395
|
+
// construct — and return — its own GoogleAuth instance.
|
|
396
|
+
let cachedAuthPromise;
|
|
397
|
+
/** Exported only for continuous-test-suite-vertex-anthropic-fallback.ts,
|
|
398
|
+
* which proves concurrent callers share one instance. Not part of the
|
|
399
|
+
* package's public surface — this module isn't re-exported from index.ts. */
|
|
400
|
+
export function auth() {
|
|
401
|
+
if (!cachedAuthPromise) {
|
|
402
|
+
cachedAuthPromise = loadGoogleAuth().then(({ GoogleAuth }) => new GoogleAuth({ scopes: [CLOUD_PLATFORM_SCOPE] }));
|
|
403
|
+
}
|
|
404
|
+
return cachedAuthPromise;
|
|
405
|
+
}
|
|
406
|
+
/** Test-only: isolates the concurrency proof from cache state any earlier
|
|
407
|
+
* test in the same process may have left behind. */
|
|
408
|
+
export function resetAuthCacheForTests() {
|
|
409
|
+
cachedAuthPromise = undefined;
|
|
386
410
|
}
|
|
387
411
|
let accessTokenProviderForTests;
|
|
388
412
|
async function vertexAccessToken() {
|
|
389
413
|
return accessTokenProviderForTests
|
|
390
414
|
? accessTokenProviderForTests()
|
|
391
|
-
: auth().getAccessToken();
|
|
415
|
+
: (await auth()).getAccessToken();
|
|
392
416
|
}
|
|
393
417
|
/**
|
|
394
418
|
* Replace the Google credential lookup, for tests only.
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
* Flow: Vercel AI SDK → OpenTelemetry Spans → LangfuseSpanProcessor → Langfuse Platform
|
|
8
8
|
*/
|
|
9
9
|
import { trace, type Span as ApiSpan } from "@opentelemetry/api";
|
|
10
|
-
import { LoggerProvider } from "@opentelemetry/sdk-logs";
|
|
11
|
-
import {
|
|
12
|
-
import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
|
|
10
|
+
import type { LoggerProvider } from "@opentelemetry/sdk-logs";
|
|
11
|
+
import type { SpanProcessor } from "@opentelemetry/sdk-trace-base";
|
|
12
|
+
import type { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
|
|
13
13
|
import type { LangfuseConfig, LangfuseContext } from "../../../../types/index.js";
|
|
14
14
|
/**
|
|
15
15
|
* True when a span is an internal NeuroLink wrapper that should NOT be sent to
|
|
@@ -38,18 +38,11 @@ export declare function langfuseShouldExportSpan({ otelSpan, }: {
|
|
|
38
38
|
};
|
|
39
39
|
}): boolean;
|
|
40
40
|
/**
|
|
41
|
-
* Initialize OpenTelemetry
|
|
41
|
+
* Initialize OpenTelemetry once and let concurrent callers share the work.
|
|
42
42
|
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* 3. Registering the provider globally for AI SDK to use
|
|
47
|
-
*
|
|
48
|
-
* NEW: If useExternalTracerProvider is true or autoDetectExternalProvider detects
|
|
49
|
-
* an existing provider, steps 2 and 3 are skipped. The span processors are still
|
|
50
|
-
* created and can be retrieved via getSpanProcessors().
|
|
51
|
-
*
|
|
52
|
-
* @param config - Langfuse configuration passed from parent application
|
|
43
|
+
* NeuroLink constructors intentionally start this asynchronously. Keeping the
|
|
44
|
+
* in-flight promise here lets another constructor join it and lets an immediate
|
|
45
|
+
* flush or shutdown wait for the same initialization before touching providers.
|
|
53
46
|
*/
|
|
54
47
|
export declare function initializeOpenTelemetry(config: LangfuseConfig): Promise<void>;
|
|
55
48
|
/**
|