@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
|
@@ -33,11 +33,6 @@ async function createGoogleGenAIClient(apiKey) {
|
|
|
33
33
|
const Ctor = ctor;
|
|
34
34
|
return new Ctor({ apiKey });
|
|
35
35
|
}
|
|
36
|
-
// Environment variable setup
|
|
37
|
-
if (!process.env.GOOGLE_GENERATIVE_AI_API_KEY &&
|
|
38
|
-
process.env.GOOGLE_AI_API_KEY) {
|
|
39
|
-
process.env.GOOGLE_GENERATIVE_AI_API_KEY = process.env.GOOGLE_AI_API_KEY;
|
|
40
|
-
}
|
|
41
36
|
/**
|
|
42
37
|
* Google AI Studio provider implementation using BaseProvider
|
|
43
38
|
* Migrated from original GoogleAIStudio class to new factory pattern
|
|
@@ -38,6 +38,10 @@ export declare function sanitizeToolsForGemini(tools: Record<string, Tool>): {
|
|
|
38
38
|
tools: Record<string, Tool>;
|
|
39
39
|
dropped: string[];
|
|
40
40
|
};
|
|
41
|
+
export declare function normalizeToolsForJsonSchemaProvider(tools: Record<string, Tool>): {
|
|
42
|
+
tools: Record<string, Tool>;
|
|
43
|
+
normalized: string[];
|
|
44
|
+
};
|
|
41
45
|
/**
|
|
42
46
|
* Convert Vercel AI SDK tools to @google/genai FunctionDeclarations and an execute map.
|
|
43
47
|
*
|
|
@@ -12,7 +12,7 @@ import { randomUUID } from "node:crypto";
|
|
|
12
12
|
import { jsonSchema as aiJsonSchema, tool as createAISDKTool, } from "ai";
|
|
13
13
|
import { DEFAULT_MAX_STEPS, DEFAULT_TOOL_MAX_RETRIES, } from "../core/constants.js";
|
|
14
14
|
import { logger } from "../utils/logger.js";
|
|
15
|
-
import { convertZodToJsonSchema, inlineJsonSchema, isZodSchema, } from "../utils/schemaConversion.js";
|
|
15
|
+
import { convertZodToJsonSchema, inlineJsonSchema, isZodSchema, normalizeJsonSchemaObject, } from "../utils/schemaConversion.js";
|
|
16
16
|
import { createNativeThinkingConfig } from "../utils/thinkingConfig.js";
|
|
17
17
|
// ── Functions ──
|
|
18
18
|
/**
|
|
@@ -163,6 +163,44 @@ export function sanitizeToolsForGemini(tools) {
|
|
|
163
163
|
}
|
|
164
164
|
return { tools: sanitized, dropped };
|
|
165
165
|
}
|
|
166
|
+
export function normalizeToolsForJsonSchemaProvider(tools) {
|
|
167
|
+
const normalizedTools = {};
|
|
168
|
+
const normalized = [];
|
|
169
|
+
for (const [name, tool] of Object.entries(tools)) {
|
|
170
|
+
const legacyTool = tool;
|
|
171
|
+
const toolParams = legacyTool.parameters || tool.inputSchema;
|
|
172
|
+
let rawSchema;
|
|
173
|
+
if (isZodSchema(toolParams)) {
|
|
174
|
+
rawSchema = convertZodToJsonSchema(toolParams);
|
|
175
|
+
}
|
|
176
|
+
else if (toolParams && typeof toolParams === "object") {
|
|
177
|
+
rawSchema = toolParams;
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
rawSchema = { type: "object", properties: {} };
|
|
181
|
+
}
|
|
182
|
+
if (rawSchema.jsonSchema &&
|
|
183
|
+
typeof rawSchema.jsonSchema === "object" &&
|
|
184
|
+
!rawSchema.type) {
|
|
185
|
+
rawSchema = rawSchema.jsonSchema;
|
|
186
|
+
}
|
|
187
|
+
const schemaBefore = JSON.stringify(rawSchema);
|
|
188
|
+
const normalizedSchema = normalizeJsonSchemaObject(rawSchema);
|
|
189
|
+
if (JSON.stringify(normalizedSchema) !== schemaBefore) {
|
|
190
|
+
normalized.push(name);
|
|
191
|
+
}
|
|
192
|
+
const wrappedSchema = aiJsonSchema(normalizedSchema);
|
|
193
|
+
normalizedTools[name] = {
|
|
194
|
+
...tool,
|
|
195
|
+
inputSchema: wrappedSchema,
|
|
196
|
+
...(legacyTool.parameters ? { parameters: wrappedSchema } : {}),
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
return {
|
|
200
|
+
tools: normalizedTools,
|
|
201
|
+
normalized,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
166
204
|
/**
|
|
167
205
|
* Convert Vercel AI SDK tools to @google/genai FunctionDeclarations and an execute map.
|
|
168
206
|
*
|
|
@@ -121,6 +121,14 @@ export declare class GoogleVertexProvider extends BaseProvider {
|
|
|
121
121
|
*/
|
|
122
122
|
private validateStreamOptionsOnly;
|
|
123
123
|
protected executeStream(options: StreamOptions, analysisSchema?: ZodType | Schema<unknown>): Promise<StreamResult>;
|
|
124
|
+
private maybeExecuteNativeGemini3ToolStream;
|
|
125
|
+
private executeAISDKStream;
|
|
126
|
+
private resolveAISDKStreamTools;
|
|
127
|
+
private buildAISDKStreamOptions;
|
|
128
|
+
private captureAISDKStreamToolStep;
|
|
129
|
+
private startObservedAISDKStream;
|
|
130
|
+
private attachAISDKStreamObservers;
|
|
131
|
+
private observeAISDKStreamResult;
|
|
124
132
|
/**
|
|
125
133
|
* Create @google/genai client configured for Vertex AI
|
|
126
134
|
*/
|
|
@@ -142,6 +150,8 @@ export declare class GoogleVertexProvider extends BaseProvider {
|
|
|
142
150
|
* This bypasses @ai-sdk/google-vertex to properly handle thought_signature
|
|
143
151
|
*/
|
|
144
152
|
private executeNativeGemini3Stream;
|
|
153
|
+
private executeNativeGemini3StreamWithSpan;
|
|
154
|
+
private runNativeGemini3StreamLoop;
|
|
145
155
|
/**
|
|
146
156
|
* Execute generate using native @google/genai SDK for Gemini 3 models on Vertex AI
|
|
147
157
|
* This bypasses @ai-sdk/google-vertex to properly handle thought_signature
|