@juspay/neurolink 11.1.0 → 11.1.1
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 +9 -0
- package/dist/browser/neurolink.min.js +390 -390
- package/dist/cli/commands/setup.d.ts +4 -1
- package/dist/cli/commands/setup.js +44 -14
- package/dist/constants/networkErrorCodes.d.ts +14 -0
- package/dist/constants/networkErrorCodes.js +21 -0
- package/dist/factories/providerDescriptors.js +13 -3
- package/dist/lib/constants/networkErrorCodes.d.ts +14 -0
- package/dist/lib/constants/networkErrorCodes.js +22 -0
- package/dist/lib/factories/providerDescriptors.js +13 -3
- package/dist/lib/processors/base/BaseFileProcessor.d.ts +17 -0
- package/dist/lib/processors/base/BaseFileProcessor.js +40 -0
- package/dist/lib/processors/document/OpenDocumentProcessor.js +12 -2
- package/dist/lib/proxy/proxyFetch.js +1 -9
- package/dist/lib/types/cli.d.ts +2 -0
- package/dist/lib/types/providers.d.ts +17 -2
- package/dist/lib/utils/errorClassifier.js +100 -11
- package/dist/lib/utils/providerConfig.d.ts +16 -0
- package/dist/lib/utils/providerConfig.js +23 -0
- package/dist/lib/utils/providerHealth.d.ts +30 -24
- package/dist/lib/utils/providerHealth.js +42 -41
- package/dist/lib/utils/providerUtils.js +2 -2
- package/dist/processors/base/BaseFileProcessor.d.ts +17 -0
- package/dist/processors/base/BaseFileProcessor.js +40 -0
- package/dist/processors/document/OpenDocumentProcessor.js +12 -2
- package/dist/proxy/proxyFetch.js +1 -9
- package/dist/types/cli.d.ts +2 -0
- package/dist/types/providers.d.ts +17 -2
- package/dist/utils/errorClassifier.js +100 -11
- package/dist/utils/providerConfig.d.ts +16 -0
- package/dist/utils/providerConfig.js +23 -0
- package/dist/utils/providerHealth.d.ts +30 -24
- package/dist/utils/providerHealth.js +42 -41
- package/dist/utils/providerUtils.js +2 -2
- package/package.json +1 -1
|
@@ -36,27 +36,25 @@ export declare class ProviderHealthChecker {
|
|
|
36
36
|
*/
|
|
37
37
|
private static checkModelAvailability;
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* [apiKey, ...extraRequired] from the descriptor
|
|
50
|
-
* 27 providers) would make
|
|
51
|
-
*
|
|
52
|
-
* —
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* check used for
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Get required environment variables for a provider
|
|
39
|
+
* Get required environment variables for a provider.
|
|
40
|
+
*
|
|
41
|
+
* Returns `[]` for providers with `descriptor.credentialsResolvedExternally
|
|
42
|
+
* === true` (Vertex, Bedrock, LiteLLM) — the check in
|
|
43
|
+
* checkEnvironmentConfiguration() below ANDs every entry in the returned
|
|
44
|
+
* list together, which can't express Vertex's file-OR-individual-creds-
|
|
45
|
+
* OR-service-account auth, Bedrock's AWS SDK default provider chain
|
|
46
|
+
* (profile / IAM role, no env vars at all), or LiteLLM's documented
|
|
47
|
+
* zero-config local proxy. Their real requirement is validated by
|
|
48
|
+
* checkProviderSpecificConfig()'s dedicated per-provider checks instead.
|
|
49
|
+
* Naively deriving [apiKey, ...extraRequired] from the descriptor for
|
|
50
|
+
* these three (as for the other 27 providers) would make
|
|
51
|
+
* checkEnvironmentConfiguration() push a false "missing environment
|
|
52
|
+
* variables" issue — and therefore isHealthy=false — for legitimate
|
|
53
|
+
* fallback-based Vertex auth, AWS_PROFILE/IAM-role Bedrock auth, and
|
|
54
|
+
* unauthenticated local LiteLLM proxies. See hasProviderEnvVars() in
|
|
55
|
+
* providerUtils.ts for the equivalent OR-aware check used for
|
|
56
|
+
* auto-select gating. See `ProviderDescriptor.credentialsResolvedExternally`
|
|
57
|
+
* (types/providers.ts) for the field's full documentation.
|
|
60
58
|
*/
|
|
61
59
|
static getRequiredEnvironmentVariables(providerName: string): string[];
|
|
62
60
|
/**
|
|
@@ -107,9 +105,17 @@ export declare class ProviderHealthChecker {
|
|
|
107
105
|
*/
|
|
108
106
|
private static checkGoogleApplicationCredentials;
|
|
109
107
|
/**
|
|
110
|
-
* Check
|
|
111
|
-
|
|
112
|
-
|
|
108
|
+
* Check Vertex's non-file auth fallbacks (GOOGLE_APPLICATION_CREDENTIALS_
|
|
109
|
+
* NEUROLINK, GOOGLE_SERVICE_ACCOUNT_KEY, or the GOOGLE_AUTH_CLIENT_EMAIL +
|
|
110
|
+
* GOOGLE_AUTH_PRIVATE_KEY pair) via the descriptor's extraRequiredFallbacks
|
|
111
|
+
* instead of a hand-maintained env-var list, so this stays in sync with
|
|
112
|
+
* the real gating logic (hasGoogleCredentials()) the same way
|
|
113
|
+
* checkApiKeyValidity()'s vertex branch does. The previous hand-rolled
|
|
114
|
+
* version only recognized GOOGLE_SERVICE_ACCOUNT_KEY or the email+key
|
|
115
|
+
* pair — missing GOOGLE_APPLICATION_CREDENTIALS_NEUROLINK, the
|
|
116
|
+
* descriptor's documented first-priority fallback.
|
|
117
|
+
*/
|
|
118
|
+
private static checkExtraRequiredFallbackCredentials;
|
|
113
119
|
/**
|
|
114
120
|
* Check AWS Bedrock configuration
|
|
115
121
|
*/
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { logger } from "./logger.js";
|
|
6
6
|
import { AIProviderName, OpenAIModels, GoogleAIModels, AnthropicModels, BedrockModels, } from "../constants/enums.js";
|
|
7
|
-
import { PROJECT_ID_FORMAT } from "./providerConfig.js";
|
|
7
|
+
import { PROJECT_ID_FORMAT, satisfiesFallbacks } from "./providerConfig.js";
|
|
8
8
|
import { basename } from "path";
|
|
9
9
|
import { createProxyFetch } from "../proxy/proxyFetch.js";
|
|
10
10
|
import { DEFAULT_OLLAMA_MODEL } from "../providers/ollama/constants.js";
|
|
@@ -194,7 +194,7 @@ export class ProviderHealthChecker {
|
|
|
194
194
|
const descriptor = ProviderFactory.getDescriptor(AIProviderName.VERTEX);
|
|
195
195
|
const { extraRequired, extraRequiredFallbacks } = descriptor?.envVars ?? {};
|
|
196
196
|
const hasValidAuth = (extraRequired ?? []).every((v) => !!process.env[v]) ||
|
|
197
|
-
(extraRequiredFallbacks
|
|
197
|
+
satisfiesFallbacks(extraRequiredFallbacks, process.env);
|
|
198
198
|
logger.debug("Vertex auth final result", { hasValidAuth });
|
|
199
199
|
if (hasValidAuth) {
|
|
200
200
|
healthStatus.hasApiKey = true;
|
|
@@ -342,46 +342,40 @@ export class ProviderHealthChecker {
|
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
344
|
/**
|
|
345
|
-
*
|
|
346
|
-
*
|
|
347
|
-
*
|
|
348
|
-
*
|
|
349
|
-
*
|
|
350
|
-
*
|
|
351
|
-
*
|
|
352
|
-
*
|
|
353
|
-
*
|
|
354
|
-
*
|
|
355
|
-
* [apiKey, ...extraRequired] from the descriptor
|
|
356
|
-
* 27 providers) would make
|
|
357
|
-
*
|
|
358
|
-
* —
|
|
359
|
-
*
|
|
360
|
-
*
|
|
361
|
-
* check used for
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
AIProviderName.VERTEX,
|
|
365
|
-
AIProviderName.BEDROCK,
|
|
366
|
-
AIProviderName.LITELLM,
|
|
367
|
-
]);
|
|
368
|
-
/**
|
|
369
|
-
* Get required environment variables for a provider
|
|
345
|
+
* Get required environment variables for a provider.
|
|
346
|
+
*
|
|
347
|
+
* Returns `[]` for providers with `descriptor.credentialsResolvedExternally
|
|
348
|
+
* === true` (Vertex, Bedrock, LiteLLM) — the check in
|
|
349
|
+
* checkEnvironmentConfiguration() below ANDs every entry in the returned
|
|
350
|
+
* list together, which can't express Vertex's file-OR-individual-creds-
|
|
351
|
+
* OR-service-account auth, Bedrock's AWS SDK default provider chain
|
|
352
|
+
* (profile / IAM role, no env vars at all), or LiteLLM's documented
|
|
353
|
+
* zero-config local proxy. Their real requirement is validated by
|
|
354
|
+
* checkProviderSpecificConfig()'s dedicated per-provider checks instead.
|
|
355
|
+
* Naively deriving [apiKey, ...extraRequired] from the descriptor for
|
|
356
|
+
* these three (as for the other 27 providers) would make
|
|
357
|
+
* checkEnvironmentConfiguration() push a false "missing environment
|
|
358
|
+
* variables" issue — and therefore isHealthy=false — for legitimate
|
|
359
|
+
* fallback-based Vertex auth, AWS_PROFILE/IAM-role Bedrock auth, and
|
|
360
|
+
* unauthenticated local LiteLLM proxies. See hasProviderEnvVars() in
|
|
361
|
+
* providerUtils.ts for the equivalent OR-aware check used for
|
|
362
|
+
* auto-select gating. See `ProviderDescriptor.credentialsResolvedExternally`
|
|
363
|
+
* (types/providers.ts) for the field's full documentation.
|
|
370
364
|
*/
|
|
371
365
|
static getRequiredEnvironmentVariables(providerName) {
|
|
372
|
-
// Resolve the descriptor FIRST so the
|
|
373
|
-
//
|
|
374
|
-
// raw, possibly-aliased `providerName` argument. Checking the
|
|
375
|
-
// input here would let documented aliases (e.g. "googleVertex" for
|
|
366
|
+
// Resolve the descriptor FIRST so the field check below is keyed on
|
|
367
|
+
// the canonical, alias-resolved `descriptor.credentialsResolvedExternally`
|
|
368
|
+
// — not the raw, possibly-aliased `providerName` argument. Checking the
|
|
369
|
+
// raw input here would let documented aliases (e.g. "googleVertex" for
|
|
376
370
|
// vertex, "aws" for bedrock) skip the delegation and fall through to
|
|
377
371
|
// the naive [apiKey, ...extraRequired] derivation below, reproducing
|
|
378
372
|
// the exact false "missing environment variables" regression this
|
|
379
|
-
//
|
|
373
|
+
// field exists to prevent.
|
|
380
374
|
const descriptor = ProviderFactory.getDescriptor(providerName);
|
|
381
375
|
if (!descriptor) {
|
|
382
376
|
return [];
|
|
383
377
|
}
|
|
384
|
-
if (
|
|
378
|
+
if (descriptor.credentialsResolvedExternally) {
|
|
385
379
|
return [];
|
|
386
380
|
}
|
|
387
381
|
const { apiKey, extraRequired } = descriptor.envVars;
|
|
@@ -518,11 +512,11 @@ export class ProviderHealthChecker {
|
|
|
518
512
|
hasValidAuth = await this.checkGoogleApplicationCredentials(healthStatus);
|
|
519
513
|
}
|
|
520
514
|
if (!hasValidAuth) {
|
|
521
|
-
hasValidAuth = this.
|
|
515
|
+
hasValidAuth = this.checkExtraRequiredFallbackCredentials(healthStatus);
|
|
522
516
|
}
|
|
523
517
|
if (!hasValidAuth) {
|
|
524
518
|
healthStatus.configurationIssues.push("Google Cloud authentication not configured or credentials file missing");
|
|
525
|
-
healthStatus.recommendations.push("Set either GOOGLE_APPLICATION_CREDENTIALS (valid file path), GOOGLE_SERVICE_ACCOUNT_KEY (base64), or both GOOGLE_AUTH_CLIENT_EMAIL and GOOGLE_AUTH_PRIVATE_KEY");
|
|
519
|
+
healthStatus.recommendations.push("Set either GOOGLE_APPLICATION_CREDENTIALS (valid file path), GOOGLE_APPLICATION_CREDENTIALS_NEUROLINK, GOOGLE_SERVICE_ACCOUNT_KEY (base64), or both GOOGLE_AUTH_CLIENT_EMAIL and GOOGLE_AUTH_PRIVATE_KEY");
|
|
526
520
|
}
|
|
527
521
|
return hasValidAuth;
|
|
528
522
|
}
|
|
@@ -554,13 +548,20 @@ export class ProviderHealthChecker {
|
|
|
554
548
|
}
|
|
555
549
|
}
|
|
556
550
|
/**
|
|
557
|
-
* Check
|
|
551
|
+
* Check Vertex's non-file auth fallbacks (GOOGLE_APPLICATION_CREDENTIALS_
|
|
552
|
+
* NEUROLINK, GOOGLE_SERVICE_ACCOUNT_KEY, or the GOOGLE_AUTH_CLIENT_EMAIL +
|
|
553
|
+
* GOOGLE_AUTH_PRIVATE_KEY pair) via the descriptor's extraRequiredFallbacks
|
|
554
|
+
* instead of a hand-maintained env-var list, so this stays in sync with
|
|
555
|
+
* the real gating logic (hasGoogleCredentials()) the same way
|
|
556
|
+
* checkApiKeyValidity()'s vertex branch does. The previous hand-rolled
|
|
557
|
+
* version only recognized GOOGLE_SERVICE_ACCOUNT_KEY or the email+key
|
|
558
|
+
* pair — missing GOOGLE_APPLICATION_CREDENTIALS_NEUROLINK, the
|
|
559
|
+
* descriptor's documented first-priority fallback.
|
|
558
560
|
*/
|
|
559
|
-
static
|
|
560
|
-
const
|
|
561
|
-
const
|
|
562
|
-
|
|
563
|
-
if (hasServiceAccountKey || hasIndividualCredentials) {
|
|
561
|
+
static checkExtraRequiredFallbackCredentials(healthStatus) {
|
|
562
|
+
const descriptor = ProviderFactory.getDescriptor(AIProviderName.VERTEX);
|
|
563
|
+
const hasValidAuth = satisfiesFallbacks(descriptor?.envVars.extraRequiredFallbacks, process.env);
|
|
564
|
+
if (hasValidAuth) {
|
|
564
565
|
healthStatus.hasApiKey = true;
|
|
565
566
|
return true;
|
|
566
567
|
}
|
|
@@ -6,7 +6,7 @@ import { AIProviderFactory } from "../core/factory.js";
|
|
|
6
6
|
import { logger } from "./logger.js";
|
|
7
7
|
import { AIProviderName } from "../constants/enums.js";
|
|
8
8
|
import { ProviderHealthChecker } from "./providerHealth.js";
|
|
9
|
-
import { API_KEY_FORMATS, API_KEY_LENGTHS, PROJECT_ID_FORMAT, } from "./providerConfig.js";
|
|
9
|
+
import { API_KEY_FORMATS, API_KEY_LENGTHS, PROJECT_ID_FORMAT, satisfiesFallbacks, } from "./providerConfig.js";
|
|
10
10
|
import { DEFAULT_OLLAMA_MODEL } from "../providers/ollama/constants.js";
|
|
11
11
|
import { ProviderFactory } from "../factories/providerFactory.js";
|
|
12
12
|
import { PROVIDER_DESCRIPTORS } from "../factories/providerDescriptors.js";
|
|
@@ -340,7 +340,7 @@ export function hasProviderEnvVars(provider) {
|
|
|
340
340
|
return false;
|
|
341
341
|
}
|
|
342
342
|
return ((extraRequired ?? []).every((v) => !!process.env[v]) ||
|
|
343
|
-
(extraRequiredFallbacks
|
|
343
|
+
satisfiesFallbacks(extraRequiredFallbacks, process.env));
|
|
344
344
|
}
|
|
345
345
|
/**
|
|
346
346
|
* Get available provider names
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/neurolink",
|
|
3
|
-
"version": "11.1.
|
|
3
|
+
"version": "11.1.1",
|
|
4
4
|
"packageManager": "pnpm@10.15.1",
|
|
5
5
|
"description": "TypeScript AI SDK with 24+ LLM providers behind one consistent API. MCP-native (connect any MCP server), voice TTS/STT/realtime, RAG, agents, memory, context compaction. OpenAI · Anthropic · Gemini · Bedrock · Azure · Ollama · DeepSeek · NVIDIA NIM and more.",
|
|
6
6
|
"author": {
|