@juspay/neurolink 9.42.0 → 9.43.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 +8 -0
- package/dist/auth/anthropicOAuth.js +12 -0
- package/dist/browser/neurolink.min.js +335 -334
- package/dist/cli/commands/mcp.d.ts +6 -0
- package/dist/cli/commands/mcp.js +200 -184
- package/dist/cli/commands/proxy.js +560 -518
- package/dist/core/baseProvider.d.ts +6 -1
- package/dist/core/baseProvider.js +219 -232
- package/dist/core/factory.d.ts +3 -0
- package/dist/core/factory.js +140 -190
- package/dist/core/modules/ToolsManager.d.ts +1 -0
- package/dist/core/modules/ToolsManager.js +40 -42
- package/dist/core/toolEvents.d.ts +3 -0
- package/dist/core/toolEvents.js +7 -0
- package/dist/evaluation/pipeline/evaluationPipeline.js +5 -2
- package/dist/evaluation/scorers/scorerRegistry.d.ts +3 -0
- package/dist/evaluation/scorers/scorerRegistry.js +356 -284
- package/dist/lib/auth/anthropicOAuth.js +12 -0
- package/dist/lib/core/baseProvider.d.ts +6 -1
- package/dist/lib/core/baseProvider.js +219 -232
- package/dist/lib/core/factory.d.ts +3 -0
- package/dist/lib/core/factory.js +140 -190
- package/dist/lib/core/modules/ToolsManager.d.ts +1 -0
- package/dist/lib/core/modules/ToolsManager.js +40 -42
- package/dist/lib/core/toolEvents.d.ts +3 -0
- package/dist/lib/core/toolEvents.js +8 -0
- package/dist/lib/evaluation/pipeline/evaluationPipeline.js +5 -2
- package/dist/lib/evaluation/scorers/scorerRegistry.d.ts +3 -0
- package/dist/lib/evaluation/scorers/scorerRegistry.js +356 -284
- package/dist/lib/mcp/toolRegistry.d.ts +2 -0
- package/dist/lib/mcp/toolRegistry.js +32 -31
- package/dist/lib/neurolink.d.ts +38 -0
- package/dist/lib/neurolink.js +1890 -1707
- package/dist/lib/providers/googleAiStudio.js +0 -5
- package/dist/lib/providers/googleNativeGemini3.d.ts +4 -0
- package/dist/lib/providers/googleNativeGemini3.js +39 -1
- package/dist/lib/providers/googleVertex.d.ts +10 -0
- package/dist/lib/providers/googleVertex.js +445 -445
- package/dist/lib/providers/litellm.d.ts +1 -0
- package/dist/lib/providers/litellm.js +73 -64
- package/dist/lib/providers/ollama.js +17 -4
- package/dist/lib/providers/openAI.d.ts +2 -0
- package/dist/lib/providers/openAI.js +139 -140
- package/dist/lib/proxy/claudeFormat.js +14 -5
- package/dist/lib/proxy/oauthFetch.js +298 -318
- package/dist/lib/proxy/proxyConfig.js +3 -1
- package/dist/lib/proxy/proxyFetch.js +250 -222
- package/dist/lib/proxy/proxyHealth.d.ts +17 -0
- package/dist/lib/proxy/proxyHealth.js +55 -0
- package/dist/lib/proxy/requestLogger.js +140 -48
- package/dist/lib/proxy/routingPolicy.d.ts +33 -0
- package/dist/lib/proxy/routingPolicy.js +255 -0
- package/dist/lib/proxy/snapshotPersistence.d.ts +2 -0
- package/dist/lib/proxy/snapshotPersistence.js +41 -0
- package/dist/lib/proxy/sseInterceptor.js +36 -11
- package/dist/lib/server/routes/claudeProxyRoutes.d.ts +2 -1
- package/dist/lib/server/routes/claudeProxyRoutes.js +2916 -2377
- package/dist/lib/services/server/ai/observability/instrumentation.js +194 -218
- package/dist/lib/tasks/backends/bullmqBackend.js +24 -18
- package/dist/lib/tasks/store/redisTaskStore.js +42 -17
- package/dist/lib/tasks/taskManager.d.ts +2 -0
- package/dist/lib/tasks/taskManager.js +100 -5
- package/dist/lib/telemetry/telemetryService.js +9 -5
- package/dist/lib/types/cli.d.ts +4 -0
- package/dist/lib/types/proxyTypes.d.ts +211 -1
- package/dist/lib/types/tools.d.ts +18 -0
- package/dist/lib/utils/providerHealth.d.ts +1 -0
- package/dist/lib/utils/providerHealth.js +46 -31
- package/dist/lib/utils/providerUtils.js +11 -22
- package/dist/lib/utils/schemaConversion.d.ts +1 -0
- package/dist/lib/utils/schemaConversion.js +3 -0
- package/dist/mcp/toolRegistry.d.ts +2 -0
- package/dist/mcp/toolRegistry.js +32 -31
- package/dist/neurolink.d.ts +38 -0
- package/dist/neurolink.js +1890 -1707
- package/dist/providers/googleAiStudio.js +0 -5
- package/dist/providers/googleNativeGemini3.d.ts +4 -0
- package/dist/providers/googleNativeGemini3.js +39 -1
- package/dist/providers/googleVertex.d.ts +10 -0
- package/dist/providers/googleVertex.js +445 -445
- package/dist/providers/litellm.d.ts +1 -0
- package/dist/providers/litellm.js +73 -64
- package/dist/providers/ollama.js +17 -4
- package/dist/providers/openAI.d.ts +2 -0
- package/dist/providers/openAI.js +139 -140
- package/dist/proxy/claudeFormat.js +14 -5
- package/dist/proxy/oauthFetch.js +298 -318
- package/dist/proxy/proxyConfig.js +3 -1
- package/dist/proxy/proxyFetch.js +250 -222
- package/dist/proxy/proxyHealth.d.ts +17 -0
- package/dist/proxy/proxyHealth.js +54 -0
- package/dist/proxy/requestLogger.js +140 -48
- package/dist/proxy/routingPolicy.d.ts +33 -0
- package/dist/proxy/routingPolicy.js +254 -0
- package/dist/proxy/snapshotPersistence.d.ts +2 -0
- package/dist/proxy/snapshotPersistence.js +40 -0
- package/dist/proxy/sseInterceptor.js +36 -11
- package/dist/server/routes/claudeProxyRoutes.d.ts +2 -1
- package/dist/server/routes/claudeProxyRoutes.js +2916 -2377
- package/dist/services/server/ai/observability/instrumentation.js +194 -218
- package/dist/tasks/backends/bullmqBackend.js +24 -18
- package/dist/tasks/store/redisTaskStore.js +42 -17
- package/dist/tasks/taskManager.d.ts +2 -0
- package/dist/tasks/taskManager.js +100 -5
- package/dist/telemetry/telemetryService.js +9 -5
- package/dist/types/cli.d.ts +4 -0
- package/dist/types/proxyTypes.d.ts +211 -1
- package/dist/types/tools.d.ts +18 -0
- package/dist/utils/providerHealth.d.ts +1 -0
- package/dist/utils/providerHealth.js +46 -31
- package/dist/utils/providerUtils.js +12 -22
- package/dist/utils/schemaConversion.d.ts +1 -0
- package/dist/utils/schemaConversion.js +3 -0
- package/package.json +3 -2
- package/scripts/observability/check-proxy-telemetry.mjs +1 -1
- package/scripts/observability/manage-local-openobserve.sh +36 -5
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { AIProviderFactory } from "../core/factory.js";
|
|
6
6
|
import { logger } from "./logger.js";
|
|
7
|
+
import { AIProviderName } from "../constants/enums.js";
|
|
7
8
|
import { ProviderHealthChecker } from "./providerHealth.js";
|
|
8
9
|
import { API_KEY_FORMATS, API_KEY_LENGTHS, PROJECT_ID_FORMAT, } from "./providerConfig.js";
|
|
9
10
|
/**
|
|
@@ -49,7 +50,8 @@ export async function getBestProvider(requestedProvider) {
|
|
|
49
50
|
return process.env.DEFAULT_PROVIDER;
|
|
50
51
|
}
|
|
51
52
|
// Special case for Ollama - prioritize local when available
|
|
52
|
-
if (process.env.OLLAMA_BASE_URL
|
|
53
|
+
if ((process.env.OLLAMA_BASE_URL || process.env.OLLAMA_API_BASE) &&
|
|
54
|
+
process.env.OLLAMA_MODEL) {
|
|
53
55
|
try {
|
|
54
56
|
if (await isProviderAvailable("ollama")) {
|
|
55
57
|
logger.debug(`[getBestProvider] Prioritizing working local Ollama`);
|
|
@@ -63,7 +65,7 @@ export async function getBestProvider(requestedProvider) {
|
|
|
63
65
|
/**
|
|
64
66
|
* Provider priority order rationale:
|
|
65
67
|
* - LiteLLM and Ollama are prioritized first for local/self-hosted deployments,
|
|
66
|
-
* avoiding
|
|
68
|
+
* avoiding unnecessary dependence on external providers during fallback scenarios.
|
|
67
69
|
* - Vertex (Google Cloud AI) follows for enterprise-grade reliability.
|
|
68
70
|
* - Google AI follows as second cloud priority for comprehensive Google AI ecosystem support.
|
|
69
71
|
* - OpenAI maintains high priority due to its consistent reliability and broad model support.
|
|
@@ -71,8 +73,8 @@ export async function getBestProvider(requestedProvider) {
|
|
|
71
73
|
* Please update this comment if the order is changed in the future, and document the rationale for maintainability.
|
|
72
74
|
*/
|
|
73
75
|
const providers = [
|
|
74
|
-
"litellm", // Prioritize self-hosted
|
|
75
|
-
"ollama", // Local models
|
|
76
|
+
"litellm", // Prioritize self-hosted proxy deployments first
|
|
77
|
+
"ollama", // Local models when the configured runtime target is installed
|
|
76
78
|
"vertex", // Google Cloud AI (enterprise)
|
|
77
79
|
"google-ai", // Google AI ecosystem support
|
|
78
80
|
"openai", // Reliable with broad model support
|
|
@@ -100,25 +102,13 @@ async function isProviderAvailable(providerName) {
|
|
|
100
102
|
if (!hasProviderEnvVars(providerName) && providerName !== "ollama") {
|
|
101
103
|
return false;
|
|
102
104
|
}
|
|
105
|
+
if (providerName === "litellm") {
|
|
106
|
+
const availability = await ProviderHealthChecker.checkFallbackProviderAvailability(AIProviderName.LITELLM, process.env.LITELLM_MODEL || "openai/gpt-4o-mini");
|
|
107
|
+
return availability.available;
|
|
108
|
+
}
|
|
103
109
|
if (providerName === "ollama") {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
method: "GET",
|
|
107
|
-
signal: AbortSignal.timeout(2000),
|
|
108
|
-
});
|
|
109
|
-
if (response.ok) {
|
|
110
|
-
const { models } = await response.json();
|
|
111
|
-
const defaultOllamaModel = process.env.OLLAMA_MODEL || "llama3.1:8b";
|
|
112
|
-
// Check for exact match first, then prefix match (e.g. "gemma3:27b" matches "gemma3:27b-fp16")
|
|
113
|
-
return models.some((m) => m.name === defaultOllamaModel ||
|
|
114
|
-
(typeof m.name === "string" &&
|
|
115
|
-
m.name.startsWith(defaultOllamaModel.split(":")[0] + ":")));
|
|
116
|
-
}
|
|
117
|
-
return false;
|
|
118
|
-
}
|
|
119
|
-
catch {
|
|
120
|
-
return false;
|
|
121
|
-
}
|
|
110
|
+
const availability = await ProviderHealthChecker.checkFallbackProviderAvailability(AIProviderName.OLLAMA, process.env.OLLAMA_MODEL || "llama3.1:8b");
|
|
111
|
+
return availability.available;
|
|
122
112
|
}
|
|
123
113
|
try {
|
|
124
114
|
const provider = await AIProviderFactory.createProvider(providerName);
|
|
@@ -20,6 +20,7 @@ export declare function inlineJsonSchema(schema: Record<string, unknown>, defini
|
|
|
20
20
|
* 3. Plain JSON Schema objects (have `type`/`properties` but no `_def`) — returned as-is
|
|
21
21
|
*/
|
|
22
22
|
export declare function convertZodToJsonSchema(zodSchema: ZodUnknownSchema): object;
|
|
23
|
+
export declare function normalizeJsonSchemaObject(schema: Record<string, unknown> | undefined | null): Record<string, unknown>;
|
|
23
24
|
/**
|
|
24
25
|
* Check if a value is a Zod schema
|
|
25
26
|
*/
|
|
@@ -138,6 +138,9 @@ export function convertZodToJsonSchema(zodSchema) {
|
|
|
138
138
|
return { type: "object", properties: {} };
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
|
+
export function normalizeJsonSchemaObject(schema) {
|
|
142
|
+
return ensureTypeField(inlineJsonSchema(schema ? { ...schema } : { type: "object", properties: {} }));
|
|
143
|
+
}
|
|
141
144
|
/**
|
|
142
145
|
* Ensure a JSON Schema object has a `type` field (required by Vertex/Gemini).
|
|
143
146
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/neurolink",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.43.0",
|
|
4
4
|
"packageManager": "pnpm@10.15.1",
|
|
5
5
|
"description": "Universal AI Development Platform with working MCP integration, multi-provider support, and professional CLI. Built-in tools operational, 58+ external MCP servers discoverable. Connect to filesystem, GitHub, database operations, and more. Build, test, and deploy AI applications with 13 providers: OpenAI, Anthropic, Google AI, AWS Bedrock, Azure, Hugging Face, Ollama, and Mistral AI.",
|
|
6
6
|
"author": {
|
|
@@ -220,7 +220,7 @@
|
|
|
220
220
|
"@opentelemetry/core": "^2.6.0",
|
|
221
221
|
"@opentelemetry/exporter-logs-otlp-http": "^0.214.0",
|
|
222
222
|
"@opentelemetry/exporter-metrics-otlp-http": "^0.214.0",
|
|
223
|
-
"@opentelemetry/exporter-trace-otlp-http": "^0.
|
|
223
|
+
"@opentelemetry/exporter-trace-otlp-http": "^0.214.0",
|
|
224
224
|
"@opentelemetry/resources": "^2.6.0",
|
|
225
225
|
"@opentelemetry/sdk-logs": "^0.214.0",
|
|
226
226
|
"@opentelemetry/sdk-metrics": "^2.6.1",
|
|
@@ -434,6 +434,7 @@
|
|
|
434
434
|
"js-yaml@>=3.0.0 <3.14.2": ">=3.14.2",
|
|
435
435
|
"markdown-it@<14.1.1": ">=14.1.1",
|
|
436
436
|
"ajv@>=8.0.0 <8.18.0": ">=8.18.0",
|
|
437
|
+
"@xmldom/xmldom@<0.8.12": ">=0.8.12",
|
|
437
438
|
"rollup@>=4.0.0 <4.59.0": ">=4.59.0"
|
|
438
439
|
}
|
|
439
440
|
},
|
|
@@ -10,10 +10,40 @@ DOCTOR_SCRIPT="${SCRIPT_DIR}/check-proxy-telemetry.mjs"
|
|
|
10
10
|
|
|
11
11
|
load_env() {
|
|
12
12
|
if [[ -f "${ENV_FILE}" ]]; then
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
while IFS= read -r line || [[ -n "${line}" ]]; do
|
|
14
|
+
[[ "${line}" =~ ^[[:space:]]*$ ]] && continue
|
|
15
|
+
[[ "${line}" =~ ^[[:space:]]*# ]] && continue
|
|
16
|
+
|
|
17
|
+
line="${line#"${line%%[![:space:]]*}"}"
|
|
18
|
+
if [[ "${line}" =~ ^[[:space:]]*export[[:space:]]+ ]]; then
|
|
19
|
+
line="${line#export }"
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
if [[ "${line}" != *=* ]]; then
|
|
23
|
+
continue
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
local key="${line%%=*}"
|
|
27
|
+
local value="${line#*=}"
|
|
28
|
+
|
|
29
|
+
key="${key#"${key%%[![:space:]]*}"}"
|
|
30
|
+
key="${key%"${key##*[![:space:]]}"}"
|
|
31
|
+
value="${value#"${value%%[![:space:]]*}"}"
|
|
32
|
+
value="${value%"${value##*[![:space:]]}"}"
|
|
33
|
+
|
|
34
|
+
if [[ "${value}" =~ ^\".*\"$ || "${value}" =~ ^\'.*\'$ ]]; then
|
|
35
|
+
value="${value:1:${#value}-2}"
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
if [[ -n "${key}" ]]; then
|
|
39
|
+
if [[ ! "${key}" =~ ^[A-Za-z_][A-Za-z0-9_]*$ ]]; then
|
|
40
|
+
echo "Skipping invalid env var name in ${ENV_FILE}: ${key}" >&2
|
|
41
|
+
continue
|
|
42
|
+
fi
|
|
43
|
+
printf -v "${key}" '%s' "${value}"
|
|
44
|
+
export "${key}"
|
|
45
|
+
fi
|
|
46
|
+
done < "${ENV_FILE}"
|
|
17
47
|
fi
|
|
18
48
|
}
|
|
19
49
|
|
|
@@ -149,7 +179,8 @@ case "${command}" in
|
|
|
149
179
|
Local proxy observability is ready.
|
|
150
180
|
|
|
151
181
|
OpenObserve UI: ${NEUROLINK_OPENOBSERVE_URL}
|
|
152
|
-
OpenObserve login: ${NEUROLINK_OPENOBSERVE_USER}
|
|
182
|
+
OpenObserve login user: ${NEUROLINK_OPENOBSERVE_USER}
|
|
183
|
+
OpenObserve password source: ${ENV_FILE} (NEUROLINK_OPENOBSERVE_PASSWORD)
|
|
153
184
|
OTLP HTTP endpoint: http://localhost:${NEUROLINK_OTLP_HTTP_PORT}
|
|
154
185
|
|
|
155
186
|
Set this before starting the proxy:
|