@juspay/neurolink 10.12.7 → 10.12.8
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 +451 -451
- package/dist/cli/commands/proxyAnalyze.js +7 -0
- package/dist/lib/proxy/accountQuotaRefreshCoordinator.d.ts +19 -0
- package/dist/lib/proxy/accountQuotaRefreshCoordinator.js +105 -0
- package/dist/lib/proxy/accountUsage.d.ts +5 -5
- package/dist/lib/proxy/accountUsage.js +5 -5
- package/dist/lib/proxy/providerTransportCoordinator.d.ts +17 -0
- package/dist/lib/proxy/providerTransportCoordinator.js +156 -0
- package/dist/lib/proxy/proxyAnalysis.js +59 -0
- package/dist/lib/proxy/routingEvidence.d.ts +1 -1
- package/dist/lib/proxy/routingEvidence.js +3 -0
- package/dist/lib/server/routes/claudeProxyRoutes.d.ts +12 -4
- package/dist/lib/server/routes/claudeProxyRoutes.js +319 -69
- package/dist/lib/types/proxy.d.ts +79 -0
- package/dist/proxy/accountQuotaRefreshCoordinator.d.ts +19 -0
- package/dist/proxy/accountQuotaRefreshCoordinator.js +104 -0
- package/dist/proxy/accountUsage.d.ts +5 -5
- package/dist/proxy/accountUsage.js +5 -5
- package/dist/proxy/providerTransportCoordinator.d.ts +17 -0
- package/dist/proxy/providerTransportCoordinator.js +155 -0
- package/dist/proxy/proxyAnalysis.js +59 -0
- package/dist/proxy/routingEvidence.d.ts +1 -1
- package/dist/proxy/routingEvidence.js +3 -0
- package/dist/server/routes/claudeProxyRoutes.d.ts +12 -4
- package/dist/server/routes/claudeProxyRoutes.js +319 -69
- package/dist/types/proxy.d.ts +79 -0
- package/package.json +1 -1
package/dist/types/proxy.d.ts
CHANGED
|
@@ -430,6 +430,21 @@ export type ProxyAccountRoutingStrategy = (typeof PROXY_ACCOUNT_ROUTING_STRATEGI
|
|
|
430
430
|
export type ProxyAccountRoutingMode = (typeof PROXY_ACCOUNT_ROUTING_MODES)[number];
|
|
431
431
|
export type ProxyAccountRoutingReason = (typeof PROXY_ACCOUNT_ROUTING_REASONS)[number];
|
|
432
432
|
export type ProxyAccountType = (typeof PROXY_ACCOUNT_TYPES)[number];
|
|
433
|
+
export type ProxyQuotaFreshness = "unknown" | "fresh" | "stale_known" | "refresh_due";
|
|
434
|
+
export type ProxyQuotaRefreshReason = "startup_unknown" | "handoff_prewarm" | "ambiguous_snapshot" | "manual";
|
|
435
|
+
export type ProxyQuotaSaturationKind = "none" | "soft" | "hard";
|
|
436
|
+
export type ProxyTransportScope = "shared_provider_transport" | "connection_transport" | "account_specific";
|
|
437
|
+
export type ProxyNetworkTransportScope = Exclude<ProxyTransportScope, "account_specific">;
|
|
438
|
+
export type ProxyProviderTransportProbeOutcome = "recovered" | "failed" | "abandoned";
|
|
439
|
+
export type ProxyProviderTransportPermit = {
|
|
440
|
+
allowed: true;
|
|
441
|
+
probe: boolean;
|
|
442
|
+
generation: number;
|
|
443
|
+
} | {
|
|
444
|
+
allowed: false;
|
|
445
|
+
errorCode: string | null;
|
|
446
|
+
transportScope: ProxyNetworkTransportScope;
|
|
447
|
+
};
|
|
433
448
|
export type ProxyAccountRoutingCandidate = {
|
|
434
449
|
account: string;
|
|
435
450
|
accountType: ProxyAccountType;
|
|
@@ -440,6 +455,15 @@ export type ProxyAccountRoutingCandidate = {
|
|
|
440
455
|
saturated: boolean;
|
|
441
456
|
quotaObserved: boolean;
|
|
442
457
|
quotaStale: boolean;
|
|
458
|
+
quotaFreshness?: ProxyQuotaFreshness;
|
|
459
|
+
refreshNeeded?: boolean;
|
|
460
|
+
refreshReason?: ProxyQuotaRefreshReason | null;
|
|
461
|
+
refreshInFlight?: boolean;
|
|
462
|
+
lastRefreshAttemptAt?: number | null;
|
|
463
|
+
lastRefreshSuccessAt?: number | null;
|
|
464
|
+
nextRefreshEligibleAt?: number | null;
|
|
465
|
+
saturationKind?: ProxyQuotaSaturationKind;
|
|
466
|
+
softLimitOverrideReason?: "overage" | "weekly_expiry" | null;
|
|
443
467
|
quotaLastUpdated: number | null;
|
|
444
468
|
quotaAgeMs: number | null;
|
|
445
469
|
coolingActive: boolean;
|
|
@@ -478,7 +502,17 @@ export type ProxyAccountSortMetrics = {
|
|
|
478
502
|
usable: boolean;
|
|
479
503
|
saturated: boolean;
|
|
480
504
|
hasQuota: boolean;
|
|
505
|
+
quotaEvidenceRank: number;
|
|
481
506
|
quotaStale: boolean;
|
|
507
|
+
quotaFreshness: ProxyQuotaFreshness;
|
|
508
|
+
refreshNeeded: boolean;
|
|
509
|
+
refreshReason: ProxyQuotaRefreshReason | null;
|
|
510
|
+
refreshInFlight: boolean;
|
|
511
|
+
lastRefreshAttemptAt: number | null;
|
|
512
|
+
lastRefreshSuccessAt: number | null;
|
|
513
|
+
nextRefreshEligibleAt: number | null;
|
|
514
|
+
saturationKind: ProxyQuotaSaturationKind;
|
|
515
|
+
softLimitOverrideReason: "overage" | "weekly_expiry" | null;
|
|
482
516
|
quotaLastUpdated: number | null;
|
|
483
517
|
quotaAgeMs: number | null;
|
|
484
518
|
coolingActive: boolean;
|
|
@@ -514,6 +548,8 @@ export type RequestLogEntry = {
|
|
|
514
548
|
errorMessage?: string;
|
|
515
549
|
/** Low-level transport code such as ETIMEDOUT or EADDRNOTAVAIL. */
|
|
516
550
|
errorCode?: string;
|
|
551
|
+
/** Whether changing credentials can affect this transport failure. */
|
|
552
|
+
transportScope?: ProxyTransportScope;
|
|
517
553
|
inputTokens?: number;
|
|
518
554
|
outputTokens?: number;
|
|
519
555
|
cacheCreationTokens?: number;
|
|
@@ -545,6 +581,8 @@ export type RequestAttemptLogEntry = {
|
|
|
545
581
|
errorMessage?: string;
|
|
546
582
|
/** Low-level transport code such as ETIMEDOUT or EADDRNOTAVAIL. */
|
|
547
583
|
errorCode?: string;
|
|
584
|
+
/** Whether changing credentials can affect this transport failure. */
|
|
585
|
+
transportScope?: ProxyTransportScope;
|
|
548
586
|
/** Whether this failed attempt may be retried without changing the request. */
|
|
549
587
|
retryable?: boolean;
|
|
550
588
|
/** Distinguishes short-lived admission throttles from exhausted quota windows. */
|
|
@@ -579,11 +617,15 @@ export type ClaudeFinalRequestLogger = (status: number, accountLabel: string, ac
|
|
|
579
617
|
outputTokens?: number;
|
|
580
618
|
cacheCreationTokens?: number;
|
|
581
619
|
cacheReadTokens?: number;
|
|
620
|
+
errorCode?: string;
|
|
621
|
+
transportScope?: ProxyTransportScope;
|
|
582
622
|
}) => void;
|
|
583
623
|
export type ClaudeLoggedErrorBuilder = (status: number, message: string, errorType?: string, extra?: {
|
|
584
624
|
account?: string;
|
|
585
625
|
accountType?: string;
|
|
586
626
|
attempt?: number;
|
|
627
|
+
errorCode?: string;
|
|
628
|
+
transportScope?: ProxyTransportScope;
|
|
587
629
|
}) => ClaudeErrorResponse;
|
|
588
630
|
export type ClaudeRequestRuntimeContext = {
|
|
589
631
|
tracer?: ProxyTracer;
|
|
@@ -603,6 +645,7 @@ export type AnthropicAttemptLogger = (status: number, errorType?: string, errorM
|
|
|
603
645
|
retryable?: boolean;
|
|
604
646
|
/** Low-level transport code such as ETIMEDOUT or EADDRNOTAVAIL. */
|
|
605
647
|
errorCode?: string;
|
|
648
|
+
transportScope?: ProxyTransportScope;
|
|
606
649
|
rateLimitKind?: "transient" | "quota";
|
|
607
650
|
cooldownReason?: "transient" | "session" | "weekly" | "unified";
|
|
608
651
|
/** Override for nested retries whose attempt starts after this logger. */
|
|
@@ -624,6 +667,8 @@ export type AnthropicLoopState = {
|
|
|
624
667
|
authCooldownMessage: string | null;
|
|
625
668
|
fallbackFailureMessage?: string;
|
|
626
669
|
attemptNumber: number;
|
|
670
|
+
lastTransportErrorCode?: string;
|
|
671
|
+
lastTransportScope?: ProxyNetworkTransportScope;
|
|
627
672
|
};
|
|
628
673
|
export type AnthropicUpstreamBody = {
|
|
629
674
|
bodyStr: string;
|
|
@@ -765,6 +810,8 @@ export type TransientRateLimitRetryBudget = {
|
|
|
765
810
|
export type AnthropicUpstreamFetchResult = {
|
|
766
811
|
continueLoop: boolean;
|
|
767
812
|
retrySameAccount?: boolean;
|
|
813
|
+
transportScope?: ProxyNetworkTransportScope;
|
|
814
|
+
errorCode?: string;
|
|
768
815
|
/** When set, the caller should wait this many ms before retrying (from upstream retry-after). */
|
|
769
816
|
retryAfterMs?: number;
|
|
770
817
|
/** Set on a genuine 429: how long / why to cool this account before rotating. */
|
|
@@ -1033,6 +1080,35 @@ export type AccountUsageFetchResult = {
|
|
|
1033
1080
|
error: string;
|
|
1034
1081
|
status?: number;
|
|
1035
1082
|
};
|
|
1083
|
+
export type ProxyQuotaRefreshRuntimeState = {
|
|
1084
|
+
inFlight: boolean;
|
|
1085
|
+
lastAttemptAt?: number;
|
|
1086
|
+
lastSuccessAt?: number;
|
|
1087
|
+
nextEligibleAt?: number;
|
|
1088
|
+
consecutiveFailures: number;
|
|
1089
|
+
lastFailureReason?: string;
|
|
1090
|
+
lastCompletedTrigger?: string;
|
|
1091
|
+
coalesced: number;
|
|
1092
|
+
};
|
|
1093
|
+
export type ProxyQuotaRefreshMetrics = {
|
|
1094
|
+
attempted: number;
|
|
1095
|
+
succeeded: number;
|
|
1096
|
+
failed: number;
|
|
1097
|
+
coalesced: number;
|
|
1098
|
+
backoffSuppressed: number;
|
|
1099
|
+
triggerDeduplicated: number;
|
|
1100
|
+
};
|
|
1101
|
+
export type ProxyQuotaRefreshRunResult = {
|
|
1102
|
+
kind: "completed";
|
|
1103
|
+
result: AccountUsageFetchResult;
|
|
1104
|
+
/** Lower bound for the freshness of the returned usage snapshot. */
|
|
1105
|
+
startedAt: number;
|
|
1106
|
+
} | {
|
|
1107
|
+
kind: "backoff";
|
|
1108
|
+
nextEligibleAt: number;
|
|
1109
|
+
} | {
|
|
1110
|
+
kind: "not_due";
|
|
1111
|
+
};
|
|
1036
1112
|
/** Per-account result inside a GET /limits response. */
|
|
1037
1113
|
export type ProxyLimitsAccountResult = {
|
|
1038
1114
|
/** Account label (quota-store key). */
|
|
@@ -1053,6 +1129,8 @@ export type ProxyLimitsRefreshResponse = {
|
|
|
1053
1129
|
/** True when served from stored state without contacting Anthropic. */
|
|
1054
1130
|
snapshot: boolean;
|
|
1055
1131
|
results: ProxyLimitsAccountResult[];
|
|
1132
|
+
/** Process-local refresh activity; contains no credentials or response body. */
|
|
1133
|
+
refreshMetrics?: ProxyQuotaRefreshMetrics;
|
|
1056
1134
|
};
|
|
1057
1135
|
/**
|
|
1058
1136
|
* Provenance of the quota numbers attached to a single proxy response.
|
|
@@ -1518,6 +1596,7 @@ export type ProxyAnalysisReport = {
|
|
|
1518
1596
|
errors: number;
|
|
1519
1597
|
errorTypes: Record<string, number>;
|
|
1520
1598
|
errorCodes: Record<string, number>;
|
|
1599
|
+
transportScopes: Record<string, number>;
|
|
1521
1600
|
};
|
|
1522
1601
|
rateLimits: {
|
|
1523
1602
|
attemptRateLimits: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/neurolink",
|
|
3
|
-
"version": "10.12.
|
|
3
|
+
"version": "10.12.8",
|
|
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": {
|