@juspay/neurolink 9.75.0 → 9.77.0
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 +12 -0
- package/dist/browser/neurolink.min.js +341 -341
- package/dist/core/baseProvider.js +29 -4
- package/dist/core/toolDedup.d.ts +51 -0
- package/dist/core/toolDedup.js +193 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +35 -0
- package/dist/lib/core/baseProvider.js +29 -4
- package/dist/lib/core/toolDedup.d.ts +51 -0
- package/dist/lib/core/toolDedup.js +194 -0
- package/dist/lib/index.d.ts +31 -0
- package/dist/lib/index.js +35 -0
- package/dist/lib/neurolink.d.ts +36 -1
- package/dist/lib/neurolink.js +387 -90
- package/dist/lib/routing/index.d.ts +7 -0
- package/dist/lib/routing/index.js +8 -0
- package/dist/lib/routing/modelPool.d.ts +83 -0
- package/dist/lib/routing/modelPool.js +243 -0
- package/dist/lib/routing/requestRouter.d.ts +30 -0
- package/dist/lib/routing/requestRouter.js +81 -0
- package/dist/lib/types/config.d.ts +32 -2
- package/dist/lib/types/index.d.ts +3 -0
- package/dist/lib/types/index.js +5 -0
- package/dist/lib/types/modelPool.d.ts +47 -0
- package/dist/lib/types/modelPool.js +11 -0
- package/dist/lib/types/requestRouter.d.ts +75 -0
- package/dist/lib/types/requestRouter.js +16 -0
- package/dist/lib/types/toolDedup.d.ts +45 -0
- package/dist/lib/types/toolDedup.js +14 -0
- package/dist/lib/utils/providerErrorClassification.d.ts +24 -0
- package/dist/lib/utils/providerErrorClassification.js +89 -0
- package/dist/neurolink.d.ts +36 -1
- package/dist/neurolink.js +387 -90
- package/dist/routing/index.d.ts +7 -0
- package/dist/routing/index.js +7 -0
- package/dist/routing/modelPool.d.ts +83 -0
- package/dist/routing/modelPool.js +242 -0
- package/dist/routing/requestRouter.d.ts +30 -0
- package/dist/routing/requestRouter.js +80 -0
- package/dist/types/config.d.ts +32 -2
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.js +5 -0
- package/dist/types/modelPool.d.ts +47 -0
- package/dist/types/modelPool.js +10 -0
- package/dist/types/requestRouter.d.ts +75 -0
- package/dist/types/requestRouter.js +15 -0
- package/dist/types/toolDedup.d.ts +45 -0
- package/dist/types/toolDedup.js +13 -0
- package/dist/utils/providerErrorClassification.d.ts +24 -0
- package/dist/utils/providerErrorClassification.js +88 -0
- package/package.json +6 -2
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared provider-error classification utilities used by both neurolink.ts and
|
|
3
|
+
* the ModelPool routing subsystem.
|
|
4
|
+
*
|
|
5
|
+
* Extracted here to avoid duplication and to ensure that typed error classes
|
|
6
|
+
* (AuthenticationError, AuthorizationError, ModelAccessDeniedError) are
|
|
7
|
+
* checked consistently in both code paths.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Detects whether an error object looks like a model-access-denied condition.
|
|
11
|
+
* Matches LiteLLM "team not allowed" / "team can only access models=[...]"
|
|
12
|
+
* plus typed-error name/code markers when the full typed class is not present.
|
|
13
|
+
*/
|
|
14
|
+
export declare function looksLikeModelAccessDenied(error: unknown): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Returns true when the error is definitively non-retryable: typed error
|
|
17
|
+
* classes (auth, access-denied, invalid-model), non-retryable HTTP status
|
|
18
|
+
* codes, or deterministic 400-class message patterns.
|
|
19
|
+
*
|
|
20
|
+
* NOTE: ContextBudgetExceededError is intentionally NOT non-retryable —
|
|
21
|
+
* each provider has its own context window, so a budget rejection on one
|
|
22
|
+
* provider does not preclude another provider accepting the same payload.
|
|
23
|
+
*/
|
|
24
|
+
export declare function isNonRetryableProviderError(error: unknown): boolean;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared provider-error classification utilities used by both neurolink.ts and
|
|
3
|
+
* the ModelPool routing subsystem.
|
|
4
|
+
*
|
|
5
|
+
* Extracted here to avoid duplication and to ensure that typed error classes
|
|
6
|
+
* (AuthenticationError, AuthorizationError, ModelAccessDeniedError) are
|
|
7
|
+
* checked consistently in both code paths.
|
|
8
|
+
*/
|
|
9
|
+
import { AuthenticationError, AuthorizationError, InvalidModelError, ModelAccessDeniedError, } from "../types/index.js";
|
|
10
|
+
import { NON_RETRYABLE_HTTP_STATUS_CODES, isDeterministicClientErrorMessage, } from "./retryability.js";
|
|
11
|
+
/**
|
|
12
|
+
* Detects whether an error object looks like a model-access-denied condition.
|
|
13
|
+
* Matches LiteLLM "team not allowed" / "team can only access models=[...]"
|
|
14
|
+
* plus typed-error name/code markers when the full typed class is not present.
|
|
15
|
+
*/
|
|
16
|
+
export function looksLikeModelAccessDenied(error) {
|
|
17
|
+
if (!error) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
const e = error;
|
|
21
|
+
if (e.name === "ModelAccessDeniedError") {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
if (e.code === "MODEL_ACCESS_DENIED") {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
const msg = typeof e.message === "string"
|
|
28
|
+
? e.message
|
|
29
|
+
: error instanceof Error
|
|
30
|
+
? error.message
|
|
31
|
+
: String(error);
|
|
32
|
+
if (!msg) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
const lower = msg.toLowerCase();
|
|
36
|
+
return ((lower.includes("team") && lower.includes("not allowed")) ||
|
|
37
|
+
lower.includes("team can only access") ||
|
|
38
|
+
/not\s+allowed\s+to\s+access\s+(this\s+)?model/i.test(msg));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Returns true when the error is definitively non-retryable: typed error
|
|
42
|
+
* classes (auth, access-denied, invalid-model), non-retryable HTTP status
|
|
43
|
+
* codes, or deterministic 400-class message patterns.
|
|
44
|
+
*
|
|
45
|
+
* NOTE: ContextBudgetExceededError is intentionally NOT non-retryable —
|
|
46
|
+
* each provider has its own context window, so a budget rejection on one
|
|
47
|
+
* provider does not preclude another provider accepting the same payload.
|
|
48
|
+
*/
|
|
49
|
+
export function isNonRetryableProviderError(error) {
|
|
50
|
+
if (error instanceof InvalidModelError) {
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
if (error instanceof AuthenticationError) {
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
if (error instanceof AuthorizationError) {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
if (error instanceof ModelAccessDeniedError) {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
if (error && typeof error === "object") {
|
|
63
|
+
const err = error;
|
|
64
|
+
const status = typeof err.status === "number"
|
|
65
|
+
? err.status
|
|
66
|
+
: typeof err.statusCode === "number"
|
|
67
|
+
? err.statusCode
|
|
68
|
+
: undefined;
|
|
69
|
+
if (status !== undefined &&
|
|
70
|
+
NON_RETRYABLE_HTTP_STATUS_CODES.includes(status)) {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (error instanceof Error) {
|
|
75
|
+
const msg = error.message;
|
|
76
|
+
if (msg.includes("NOT_FOUND") ||
|
|
77
|
+
msg.includes("Model Not Found") ||
|
|
78
|
+
msg.includes("model not found") ||
|
|
79
|
+
msg.includes("PERMISSION_DENIED") ||
|
|
80
|
+
msg.includes("UNAUTHENTICATED")) {
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
if (isDeterministicClientErrorMessage(msg)) {
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return false;
|
|
88
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/neurolink",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.77.0",
|
|
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": {
|
|
@@ -120,11 +120,15 @@
|
|
|
120
120
|
"test:envguard": "npx tsx test/helpers/envGuard.test.ts",
|
|
121
121
|
"test:tool-routing-cli:vitest": "pnpm exec vitest run test/toolRoutingCli.test.ts",
|
|
122
122
|
"test:tool-routing-cli": "pnpm run test:tool-routing-cli:vitest && npx tsx test/continuous-test-suite-tool-routing-cli.ts",
|
|
123
|
+
"test:tool-dedup:vitest": "pnpm exec vitest run test/toolDedup.test.ts",
|
|
124
|
+
"test:tool-dedup": "pnpm run test:tool-dedup:vitest && npx tsx test/continuous-test-suite-tool-dedup.ts",
|
|
125
|
+
"test:model-pool:vitest": "pnpm exec vitest run test/modelPool.test.ts",
|
|
126
|
+
"test:model-pool": "pnpm run test:model-pool:vitest && npx tsx test/continuous-test-suite-model-pool.ts",
|
|
123
127
|
"test:ci": "pnpm run test && pnpm run test:client && pnpm run test:hitl",
|
|
124
128
|
"// CI tier — fast, no live AI calls, safe for every commit": "",
|
|
125
129
|
"test:unit:vitest": "pnpm exec vitest run test/toolRouting.test.ts",
|
|
126
130
|
"test:tool-routing": "pnpm run test:unit:vitest && npx tsx test/continuous-test-suite-tool-routing.ts",
|
|
127
|
-
"test:unit": "pnpm run test:envguard && pnpm run test:bugfixes && 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",
|
|
131
|
+
"test:unit": "pnpm run test:envguard && pnpm run test:bugfixes && 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",
|
|
128
132
|
"// 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)": "",
|
|
129
133
|
"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",
|
|
130
134
|
"// CI tier — product output (image/video/TTS/PPT) — costs $$ per run": "",
|