@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
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { jsonSchema, tool } from "ai";
|
|
12
12
|
import { randomBytes } from "crypto";
|
|
13
|
+
import { normalizeJsonSchemaObject } from "../utils/schemaConversion.js";
|
|
13
14
|
// ---------------------------------------------------------------------------
|
|
14
15
|
// Helpers
|
|
15
16
|
// ---------------------------------------------------------------------------
|
|
@@ -122,7 +123,9 @@ export function parseClaudeRequest(body) {
|
|
|
122
123
|
const resultContent = typeof block.content === "string"
|
|
123
124
|
? block.content
|
|
124
125
|
: Array.isArray(block.content)
|
|
125
|
-
? block.content
|
|
126
|
+
? block.content
|
|
127
|
+
.map((b) => (b.type === "text" ? b.text : `[${b.type}]`))
|
|
128
|
+
.join("\n")
|
|
126
129
|
: "";
|
|
127
130
|
textParts.push(`[tool_result:${block.tool_use_id}] ${resultContent}`);
|
|
128
131
|
}
|
|
@@ -151,7 +154,7 @@ export function parseClaudeRequest(body) {
|
|
|
151
154
|
// Fallback providers consume AI SDK-style tools, not Claude wire-format
|
|
152
155
|
// tool descriptors. Wrap the raw JSON schema once here so every
|
|
153
156
|
// downstream provider sees a canonical `inputSchema` shape.
|
|
154
|
-
inputSchema: jsonSchema(t.input_schema ?? { type: "object" }),
|
|
157
|
+
inputSchema: jsonSchema(normalizeJsonSchemaObject(t.input_schema ?? { type: "object" })),
|
|
155
158
|
});
|
|
156
159
|
}
|
|
157
160
|
}
|
|
@@ -184,7 +187,9 @@ export function parseClaudeRequest(body) {
|
|
|
184
187
|
enabled: isEnabled,
|
|
185
188
|
budgetTokens: body.thinking.budget_tokens,
|
|
186
189
|
// Pass the raw type so providers can map "adaptive" appropriately
|
|
187
|
-
...(body.thinking.type === "adaptive"
|
|
190
|
+
...(body.thinking.type === "adaptive"
|
|
191
|
+
? { thinkingLevel: "medium" }
|
|
192
|
+
: {}),
|
|
188
193
|
};
|
|
189
194
|
}
|
|
190
195
|
return {
|
|
@@ -235,7 +240,9 @@ function mapStopReason(finishReason) {
|
|
|
235
240
|
*/
|
|
236
241
|
export function serializeClaudeResponse(result, requestModel) {
|
|
237
242
|
const content = [];
|
|
238
|
-
const inferredFinishReason = result.toolCalls &&
|
|
243
|
+
const inferredFinishReason = result.toolCalls &&
|
|
244
|
+
result.toolCalls.length > 0 &&
|
|
245
|
+
(!result.finishReason || result.finishReason === "stop")
|
|
239
246
|
? "tool_use"
|
|
240
247
|
: result.finishReason;
|
|
241
248
|
// Thinking/reasoning content block (if present)
|
|
@@ -572,7 +579,9 @@ export class ClaudeStreamSerializer {
|
|
|
572
579
|
return;
|
|
573
580
|
}
|
|
574
581
|
this.outputTokens = outputTokens ?? this.outputTokens;
|
|
575
|
-
const resolvedFinishReason = this.sawToolUseBlock && (!finishReason || finishReason === "stop")
|
|
582
|
+
const resolvedFinishReason = this.sawToolUseBlock && (!finishReason || finishReason === "stop")
|
|
583
|
+
? "tool_use"
|
|
584
|
+
: finishReason;
|
|
576
585
|
// Close any open content block
|
|
577
586
|
yield* this.closeCurrentBlock();
|
|
578
587
|
// message_delta
|