@juspay/neurolink 9.70.1 → 9.70.2
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 +6 -0
- package/dist/browser/neurolink.min.js +279 -279
- package/dist/lib/providers/googleVertex.js +15 -7
- package/dist/lib/utils/modelDetection.d.ts +17 -0
- package/dist/lib/utils/modelDetection.js +23 -0
- package/dist/providers/googleVertex.js +15 -7
- package/dist/utils/modelDetection.d.ts +17 -0
- package/dist/utils/modelDetection.js +23 -0
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@ import { ERROR_CODES, NeuroLinkError } from "../utils/errorHandling.js";
|
|
|
13
13
|
import { FileDetector } from "../utils/fileDetector.js";
|
|
14
14
|
import { processUnifiedFilesArray } from "../utils/messageBuilder.js";
|
|
15
15
|
import { logger } from "../utils/logger.js";
|
|
16
|
-
import { hasRestrictedOutputLimit, RESTRICTED_OUTPUT_TOKEN_LIMIT, } from "../utils/modelDetection.js";
|
|
16
|
+
import { hasRestrictedOutputLimit, RESTRICTED_OUTPUT_TOKEN_LIMIT, toVertexAnthropicModelId, } from "../utils/modelDetection.js";
|
|
17
17
|
import { resolveClaudeMaxTokens } from "../utils/tokenLimits.js";
|
|
18
18
|
import { validateApiKey, createVertexProjectConfig, createGoogleAuthConfig, } from "../utils/providerConfig.js";
|
|
19
19
|
import { convertZodToJsonSchema, inlineJsonSchema, ensureNestedSchemaTypes, } from "../utils/schemaConversion.js";
|
|
@@ -2058,7 +2058,7 @@ export class GoogleVertexProvider extends BaseProvider {
|
|
|
2058
2058
|
* This bypasses @ai-sdk/google-vertex completely and uses Anthropic's native SDK
|
|
2059
2059
|
*/
|
|
2060
2060
|
async executeNativeAnthropicStream(options) {
|
|
2061
|
-
const modelName = options.model || this.modelName || "claude-sonnet-4-5@20250929";
|
|
2061
|
+
const modelName = toVertexAnthropicModelId(options.model || this.modelName || "claude-sonnet-4-5@20250929");
|
|
2062
2062
|
const startTime = Date.now();
|
|
2063
2063
|
const streamTimeoutMs = parseTimeout(options.timeout) ?? 300_000;
|
|
2064
2064
|
const client = await this.createAnthropicVertexClient(streamTimeoutMs);
|
|
@@ -2231,7 +2231,11 @@ export class GoogleVertexProvider extends BaseProvider {
|
|
|
2231
2231
|
const legacyTool = tool;
|
|
2232
2232
|
const toolParams = legacyTool.parameters || tool.inputSchema;
|
|
2233
2233
|
if (toolParams) {
|
|
2234
|
-
|
|
2234
|
+
// Anthropic validates input_schema as JSON Schema draft 2020-12 and
|
|
2235
|
+
// rejects OpenAPI-3 dialect output (e.g. `nullable: true`) with a
|
|
2236
|
+
// 400 — use the default JSON Schema target, matching the direct
|
|
2237
|
+
// anthropic provider. The Gemini paths keep "openApi3".
|
|
2238
|
+
const jsonSchema = convertZodToJsonSchema(toolParams);
|
|
2235
2239
|
const inlined = inlineJsonSchema(jsonSchema);
|
|
2236
2240
|
anthropicTool.input_schema = {
|
|
2237
2241
|
type: "object",
|
|
@@ -2257,7 +2261,7 @@ export class GoogleVertexProvider extends BaseProvider {
|
|
|
2257
2261
|
if (streamOptions.schema) {
|
|
2258
2262
|
useFinalResultTool = true;
|
|
2259
2263
|
// Convert schema to JSON schema format
|
|
2260
|
-
const schemaAsJson = convertZodToJsonSchema(streamOptions.schema
|
|
2264
|
+
const schemaAsJson = convertZodToJsonSchema(streamOptions.schema);
|
|
2261
2265
|
const inlinedSchema = inlineJsonSchema(schemaAsJson);
|
|
2262
2266
|
if (inlinedSchema.$schema) {
|
|
2263
2267
|
delete inlinedSchema.$schema;
|
|
@@ -2580,7 +2584,7 @@ export class GoogleVertexProvider extends BaseProvider {
|
|
|
2580
2584
|
* Execute generate using native @anthropic-ai/vertex-sdk for Claude models on Vertex AI
|
|
2581
2585
|
*/
|
|
2582
2586
|
async executeNativeAnthropicGenerate(options) {
|
|
2583
|
-
const modelName = options.model || this.modelName || "claude-sonnet-4-5@20250929";
|
|
2587
|
+
const modelName = toVertexAnthropicModelId(options.model || this.modelName || "claude-sonnet-4-5@20250929");
|
|
2584
2588
|
const startTime = Date.now();
|
|
2585
2589
|
const generateTimeoutMs = parseTimeout(options.timeout) ?? 300_000;
|
|
2586
2590
|
const client = await this.createAnthropicVertexClient(generateTimeoutMs);
|
|
@@ -2760,7 +2764,11 @@ export class GoogleVertexProvider extends BaseProvider {
|
|
|
2760
2764
|
const legacyTool = tool;
|
|
2761
2765
|
const toolParams = legacyTool.parameters || tool.inputSchema;
|
|
2762
2766
|
if (toolParams) {
|
|
2763
|
-
|
|
2767
|
+
// Anthropic validates input_schema as JSON Schema draft 2020-12 and
|
|
2768
|
+
// rejects OpenAPI-3 dialect output (e.g. `nullable: true`) with a
|
|
2769
|
+
// 400 — use the default JSON Schema target, matching the direct
|
|
2770
|
+
// anthropic provider. The Gemini paths keep "openApi3".
|
|
2771
|
+
const jsonSchema = convertZodToJsonSchema(toolParams);
|
|
2764
2772
|
const inlined = inlineJsonSchema(jsonSchema);
|
|
2765
2773
|
anthropicTool.input_schema = {
|
|
2766
2774
|
type: "object",
|
|
@@ -2781,7 +2789,7 @@ export class GoogleVertexProvider extends BaseProvider {
|
|
|
2781
2789
|
if (options.schema) {
|
|
2782
2790
|
useFinalResultTool = true;
|
|
2783
2791
|
// Convert schema to JSON schema format
|
|
2784
|
-
const schemaAsJson = convertZodToJsonSchema(options.schema
|
|
2792
|
+
const schemaAsJson = convertZodToJsonSchema(options.schema);
|
|
2785
2793
|
const inlinedSchema = inlineJsonSchema(schemaAsJson);
|
|
2786
2794
|
if (inlinedSchema.$schema) {
|
|
2787
2795
|
delete inlinedSchema.$schema;
|
|
@@ -18,3 +18,20 @@ export declare function hasRestrictedOutputLimit(modelName: string): boolean;
|
|
|
18
18
|
* Get the max output tokens for a model (32768 for restricted models)
|
|
19
19
|
*/
|
|
20
20
|
export declare const RESTRICTED_OUTPUT_TOKEN_LIMIT = 32768;
|
|
21
|
+
/**
|
|
22
|
+
* Normalize an Anthropic-API-style Claude model ID to the Vertex publisher
|
|
23
|
+
* format.
|
|
24
|
+
*
|
|
25
|
+
* The Anthropic API dates models with a trailing dash segment
|
|
26
|
+
* ("claude-haiku-4-5-20251001") while Vertex publisher IDs separate the date
|
|
27
|
+
* with "@" ("claude-haiku-4-5@20251001"). Vertex rejects the dash form with a
|
|
28
|
+
* 404 (verified live against us-east5), so the native Vertex+Claude paths
|
|
29
|
+
* normalize before calling @anthropic-ai/vertex-sdk.
|
|
30
|
+
*
|
|
31
|
+
* Pass-through cases: IDs already in "@" form, bare aliases with no date
|
|
32
|
+
* ("claude-sonnet-4-6" — Vertex resolves these itself), and non-Claude models.
|
|
33
|
+
* Legacy v2-suffixed Vertex IDs ("claude-3-5-sonnet-v2@20241022") have no
|
|
34
|
+
* dash-date equivalent, so those legacy dash IDs stay out of scope: they 404
|
|
35
|
+
* today and still 404 after the transform — no regression either way.
|
|
36
|
+
*/
|
|
37
|
+
export declare function toVertexAnthropicModelId(modelName: string): string;
|
|
@@ -105,4 +105,27 @@ export function hasRestrictedOutputLimit(modelName) {
|
|
|
105
105
|
* Get the max output tokens for a model (32768 for restricted models)
|
|
106
106
|
*/
|
|
107
107
|
export const RESTRICTED_OUTPUT_TOKEN_LIMIT = 32768;
|
|
108
|
+
/**
|
|
109
|
+
* Normalize an Anthropic-API-style Claude model ID to the Vertex publisher
|
|
110
|
+
* format.
|
|
111
|
+
*
|
|
112
|
+
* The Anthropic API dates models with a trailing dash segment
|
|
113
|
+
* ("claude-haiku-4-5-20251001") while Vertex publisher IDs separate the date
|
|
114
|
+
* with "@" ("claude-haiku-4-5@20251001"). Vertex rejects the dash form with a
|
|
115
|
+
* 404 (verified live against us-east5), so the native Vertex+Claude paths
|
|
116
|
+
* normalize before calling @anthropic-ai/vertex-sdk.
|
|
117
|
+
*
|
|
118
|
+
* Pass-through cases: IDs already in "@" form, bare aliases with no date
|
|
119
|
+
* ("claude-sonnet-4-6" — Vertex resolves these itself), and non-Claude models.
|
|
120
|
+
* Legacy v2-suffixed Vertex IDs ("claude-3-5-sonnet-v2@20241022") have no
|
|
121
|
+
* dash-date equivalent, so those legacy dash IDs stay out of scope: they 404
|
|
122
|
+
* today and still 404 after the transform — no regression either way.
|
|
123
|
+
*/
|
|
124
|
+
export function toVertexAnthropicModelId(modelName) {
|
|
125
|
+
if (!modelName.startsWith("claude-") || modelName.includes("@")) {
|
|
126
|
+
return modelName;
|
|
127
|
+
}
|
|
128
|
+
const dashDate = modelName.match(/^(claude-[a-z0-9-]+)-(\d{8})$/);
|
|
129
|
+
return dashDate ? `${dashDate[1]}@${dashDate[2]}` : modelName;
|
|
130
|
+
}
|
|
108
131
|
//# sourceMappingURL=modelDetection.js.map
|
|
@@ -13,7 +13,7 @@ import { ERROR_CODES, NeuroLinkError } from "../utils/errorHandling.js";
|
|
|
13
13
|
import { FileDetector } from "../utils/fileDetector.js";
|
|
14
14
|
import { processUnifiedFilesArray } from "../utils/messageBuilder.js";
|
|
15
15
|
import { logger } from "../utils/logger.js";
|
|
16
|
-
import { hasRestrictedOutputLimit, RESTRICTED_OUTPUT_TOKEN_LIMIT, } from "../utils/modelDetection.js";
|
|
16
|
+
import { hasRestrictedOutputLimit, RESTRICTED_OUTPUT_TOKEN_LIMIT, toVertexAnthropicModelId, } from "../utils/modelDetection.js";
|
|
17
17
|
import { resolveClaudeMaxTokens } from "../utils/tokenLimits.js";
|
|
18
18
|
import { validateApiKey, createVertexProjectConfig, createGoogleAuthConfig, } from "../utils/providerConfig.js";
|
|
19
19
|
import { convertZodToJsonSchema, inlineJsonSchema, ensureNestedSchemaTypes, } from "../utils/schemaConversion.js";
|
|
@@ -2058,7 +2058,7 @@ export class GoogleVertexProvider extends BaseProvider {
|
|
|
2058
2058
|
* This bypasses @ai-sdk/google-vertex completely and uses Anthropic's native SDK
|
|
2059
2059
|
*/
|
|
2060
2060
|
async executeNativeAnthropicStream(options) {
|
|
2061
|
-
const modelName = options.model || this.modelName || "claude-sonnet-4-5@20250929";
|
|
2061
|
+
const modelName = toVertexAnthropicModelId(options.model || this.modelName || "claude-sonnet-4-5@20250929");
|
|
2062
2062
|
const startTime = Date.now();
|
|
2063
2063
|
const streamTimeoutMs = parseTimeout(options.timeout) ?? 300_000;
|
|
2064
2064
|
const client = await this.createAnthropicVertexClient(streamTimeoutMs);
|
|
@@ -2231,7 +2231,11 @@ export class GoogleVertexProvider extends BaseProvider {
|
|
|
2231
2231
|
const legacyTool = tool;
|
|
2232
2232
|
const toolParams = legacyTool.parameters || tool.inputSchema;
|
|
2233
2233
|
if (toolParams) {
|
|
2234
|
-
|
|
2234
|
+
// Anthropic validates input_schema as JSON Schema draft 2020-12 and
|
|
2235
|
+
// rejects OpenAPI-3 dialect output (e.g. `nullable: true`) with a
|
|
2236
|
+
// 400 — use the default JSON Schema target, matching the direct
|
|
2237
|
+
// anthropic provider. The Gemini paths keep "openApi3".
|
|
2238
|
+
const jsonSchema = convertZodToJsonSchema(toolParams);
|
|
2235
2239
|
const inlined = inlineJsonSchema(jsonSchema);
|
|
2236
2240
|
anthropicTool.input_schema = {
|
|
2237
2241
|
type: "object",
|
|
@@ -2257,7 +2261,7 @@ export class GoogleVertexProvider extends BaseProvider {
|
|
|
2257
2261
|
if (streamOptions.schema) {
|
|
2258
2262
|
useFinalResultTool = true;
|
|
2259
2263
|
// Convert schema to JSON schema format
|
|
2260
|
-
const schemaAsJson = convertZodToJsonSchema(streamOptions.schema
|
|
2264
|
+
const schemaAsJson = convertZodToJsonSchema(streamOptions.schema);
|
|
2261
2265
|
const inlinedSchema = inlineJsonSchema(schemaAsJson);
|
|
2262
2266
|
if (inlinedSchema.$schema) {
|
|
2263
2267
|
delete inlinedSchema.$schema;
|
|
@@ -2580,7 +2584,7 @@ export class GoogleVertexProvider extends BaseProvider {
|
|
|
2580
2584
|
* Execute generate using native @anthropic-ai/vertex-sdk for Claude models on Vertex AI
|
|
2581
2585
|
*/
|
|
2582
2586
|
async executeNativeAnthropicGenerate(options) {
|
|
2583
|
-
const modelName = options.model || this.modelName || "claude-sonnet-4-5@20250929";
|
|
2587
|
+
const modelName = toVertexAnthropicModelId(options.model || this.modelName || "claude-sonnet-4-5@20250929");
|
|
2584
2588
|
const startTime = Date.now();
|
|
2585
2589
|
const generateTimeoutMs = parseTimeout(options.timeout) ?? 300_000;
|
|
2586
2590
|
const client = await this.createAnthropicVertexClient(generateTimeoutMs);
|
|
@@ -2760,7 +2764,11 @@ export class GoogleVertexProvider extends BaseProvider {
|
|
|
2760
2764
|
const legacyTool = tool;
|
|
2761
2765
|
const toolParams = legacyTool.parameters || tool.inputSchema;
|
|
2762
2766
|
if (toolParams) {
|
|
2763
|
-
|
|
2767
|
+
// Anthropic validates input_schema as JSON Schema draft 2020-12 and
|
|
2768
|
+
// rejects OpenAPI-3 dialect output (e.g. `nullable: true`) with a
|
|
2769
|
+
// 400 — use the default JSON Schema target, matching the direct
|
|
2770
|
+
// anthropic provider. The Gemini paths keep "openApi3".
|
|
2771
|
+
const jsonSchema = convertZodToJsonSchema(toolParams);
|
|
2764
2772
|
const inlined = inlineJsonSchema(jsonSchema);
|
|
2765
2773
|
anthropicTool.input_schema = {
|
|
2766
2774
|
type: "object",
|
|
@@ -2781,7 +2789,7 @@ export class GoogleVertexProvider extends BaseProvider {
|
|
|
2781
2789
|
if (options.schema) {
|
|
2782
2790
|
useFinalResultTool = true;
|
|
2783
2791
|
// Convert schema to JSON schema format
|
|
2784
|
-
const schemaAsJson = convertZodToJsonSchema(options.schema
|
|
2792
|
+
const schemaAsJson = convertZodToJsonSchema(options.schema);
|
|
2785
2793
|
const inlinedSchema = inlineJsonSchema(schemaAsJson);
|
|
2786
2794
|
if (inlinedSchema.$schema) {
|
|
2787
2795
|
delete inlinedSchema.$schema;
|
|
@@ -18,3 +18,20 @@ export declare function hasRestrictedOutputLimit(modelName: string): boolean;
|
|
|
18
18
|
* Get the max output tokens for a model (32768 for restricted models)
|
|
19
19
|
*/
|
|
20
20
|
export declare const RESTRICTED_OUTPUT_TOKEN_LIMIT = 32768;
|
|
21
|
+
/**
|
|
22
|
+
* Normalize an Anthropic-API-style Claude model ID to the Vertex publisher
|
|
23
|
+
* format.
|
|
24
|
+
*
|
|
25
|
+
* The Anthropic API dates models with a trailing dash segment
|
|
26
|
+
* ("claude-haiku-4-5-20251001") while Vertex publisher IDs separate the date
|
|
27
|
+
* with "@" ("claude-haiku-4-5@20251001"). Vertex rejects the dash form with a
|
|
28
|
+
* 404 (verified live against us-east5), so the native Vertex+Claude paths
|
|
29
|
+
* normalize before calling @anthropic-ai/vertex-sdk.
|
|
30
|
+
*
|
|
31
|
+
* Pass-through cases: IDs already in "@" form, bare aliases with no date
|
|
32
|
+
* ("claude-sonnet-4-6" — Vertex resolves these itself), and non-Claude models.
|
|
33
|
+
* Legacy v2-suffixed Vertex IDs ("claude-3-5-sonnet-v2@20241022") have no
|
|
34
|
+
* dash-date equivalent, so those legacy dash IDs stay out of scope: they 404
|
|
35
|
+
* today and still 404 after the transform — no regression either way.
|
|
36
|
+
*/
|
|
37
|
+
export declare function toVertexAnthropicModelId(modelName: string): string;
|
|
@@ -105,3 +105,26 @@ export function hasRestrictedOutputLimit(modelName) {
|
|
|
105
105
|
* Get the max output tokens for a model (32768 for restricted models)
|
|
106
106
|
*/
|
|
107
107
|
export const RESTRICTED_OUTPUT_TOKEN_LIMIT = 32768;
|
|
108
|
+
/**
|
|
109
|
+
* Normalize an Anthropic-API-style Claude model ID to the Vertex publisher
|
|
110
|
+
* format.
|
|
111
|
+
*
|
|
112
|
+
* The Anthropic API dates models with a trailing dash segment
|
|
113
|
+
* ("claude-haiku-4-5-20251001") while Vertex publisher IDs separate the date
|
|
114
|
+
* with "@" ("claude-haiku-4-5@20251001"). Vertex rejects the dash form with a
|
|
115
|
+
* 404 (verified live against us-east5), so the native Vertex+Claude paths
|
|
116
|
+
* normalize before calling @anthropic-ai/vertex-sdk.
|
|
117
|
+
*
|
|
118
|
+
* Pass-through cases: IDs already in "@" form, bare aliases with no date
|
|
119
|
+
* ("claude-sonnet-4-6" — Vertex resolves these itself), and non-Claude models.
|
|
120
|
+
* Legacy v2-suffixed Vertex IDs ("claude-3-5-sonnet-v2@20241022") have no
|
|
121
|
+
* dash-date equivalent, so those legacy dash IDs stay out of scope: they 404
|
|
122
|
+
* today and still 404 after the transform — no regression either way.
|
|
123
|
+
*/
|
|
124
|
+
export function toVertexAnthropicModelId(modelName) {
|
|
125
|
+
if (!modelName.startsWith("claude-") || modelName.includes("@")) {
|
|
126
|
+
return modelName;
|
|
127
|
+
}
|
|
128
|
+
const dashDate = modelName.match(/^(claude-[a-z0-9-]+)-(\d{8})$/);
|
|
129
|
+
return dashDate ? `${dashDate[1]}@${dashDate[2]}` : modelName;
|
|
130
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/neurolink",
|
|
3
|
-
"version": "9.70.
|
|
3
|
+
"version": "9.70.2",
|
|
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": {
|