@juspay/neurolink 10.4.3 → 10.4.4
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/auth/tokenStore.d.ts +7 -0
- package/dist/auth/tokenStore.js +54 -0
- package/dist/browser/neurolink.min.js +374 -374
- package/dist/cli/commands/proxy.d.ts +1 -0
- package/dist/cli/commands/proxy.js +183 -24
- package/dist/lib/auth/tokenStore.d.ts +7 -0
- package/dist/lib/auth/tokenStore.js +54 -0
- package/dist/lib/proxy/proxyTranslationEngine.d.ts +1 -0
- package/dist/lib/proxy/proxyTranslationEngine.js +56 -12
- package/dist/lib/proxy/rawStreamCapture.js +47 -1
- package/dist/lib/proxy/sseInterceptor.js +47 -1
- package/dist/lib/proxy/tokenRefresh.d.ts +6 -0
- package/dist/lib/proxy/tokenRefresh.js +70 -15
- package/dist/lib/proxy/usageStats.d.ts +25 -3
- package/dist/lib/proxy/usageStats.js +546 -55
- package/dist/lib/server/routes/claudeProxyRoutes.d.ts +2 -0
- package/dist/lib/server/routes/claudeProxyRoutes.js +198 -222
- package/dist/lib/types/proxy.d.ts +60 -1
- package/dist/proxy/proxyTranslationEngine.d.ts +1 -0
- package/dist/proxy/proxyTranslationEngine.js +56 -12
- package/dist/proxy/rawStreamCapture.js +47 -1
- package/dist/proxy/sseInterceptor.js +47 -1
- package/dist/proxy/tokenRefresh.d.ts +6 -0
- package/dist/proxy/tokenRefresh.js +70 -15
- package/dist/proxy/usageStats.d.ts +25 -3
- package/dist/proxy/usageStats.js +546 -55
- package/dist/server/routes/claudeProxyRoutes.d.ts +2 -0
- package/dist/server/routes/claudeProxyRoutes.js +198 -222
- package/dist/types/proxy.d.ts +60 -1
- package/package.json +1 -1
package/dist/types/proxy.d.ts
CHANGED
|
@@ -671,6 +671,29 @@ export type AnthropicUpstreamFetchResult = {
|
|
|
671
671
|
sawNetworkError: boolean;
|
|
672
672
|
upstreamSpan?: Span;
|
|
673
673
|
};
|
|
674
|
+
export type ProxyTerminalErrorCategory = "authentication" | "client_cancelled" | "fallback_exhausted" | "invalid_request" | "proxy_error" | "rate_limit" | "stream_error" | "unclassified" | "upstream_error" | "other";
|
|
675
|
+
/** Compact, redacted terminal failure retained independently of body logs. */
|
|
676
|
+
export type ProxyTerminalErrorSummary = {
|
|
677
|
+
id: string;
|
|
678
|
+
at: number;
|
|
679
|
+
status: number;
|
|
680
|
+
category: ProxyTerminalErrorCategory;
|
|
681
|
+
requestId?: string;
|
|
682
|
+
account?: string;
|
|
683
|
+
accountType?: string;
|
|
684
|
+
errorType?: string;
|
|
685
|
+
errorCode?: string;
|
|
686
|
+
terminalOutcome?: string;
|
|
687
|
+
message?: string;
|
|
688
|
+
};
|
|
689
|
+
/** Optional terminal context supplied when a final request error is recorded. */
|
|
690
|
+
export type ProxyTerminalErrorDetails = {
|
|
691
|
+
requestId?: string;
|
|
692
|
+
errorType?: string;
|
|
693
|
+
errorCode?: string;
|
|
694
|
+
terminalOutcome?: string;
|
|
695
|
+
message?: string;
|
|
696
|
+
};
|
|
674
697
|
export type AccountStats = {
|
|
675
698
|
label: string;
|
|
676
699
|
type: string;
|
|
@@ -700,6 +723,19 @@ export type ProxyStats = {
|
|
|
700
723
|
totalQuotaRateLimits: number;
|
|
701
724
|
accounts: Record<string, AccountStats>;
|
|
702
725
|
};
|
|
726
|
+
/** Bounded terminal-error state stored separately from counters and body logs. */
|
|
727
|
+
export type ProxyTerminalErrorJournal = {
|
|
728
|
+
startedAt: number;
|
|
729
|
+
totalErrors: number;
|
|
730
|
+
counts: Record<ProxyTerminalErrorCategory, number>;
|
|
731
|
+
recent: ProxyTerminalErrorSummary[];
|
|
732
|
+
};
|
|
733
|
+
export type ProxyUsageStatsSnapshot = {
|
|
734
|
+
stats: ProxyStats;
|
|
735
|
+
statsVersion: number;
|
|
736
|
+
terminalErrors: ProxyTerminalErrorJournal;
|
|
737
|
+
terminalErrorsVersion: number;
|
|
738
|
+
};
|
|
703
739
|
/** Durability and reconciliation state for the proxy usage counters. */
|
|
704
740
|
export type ProxyStatsPersistenceStatus = {
|
|
705
741
|
enabled: boolean;
|
|
@@ -712,6 +748,14 @@ export type ProxyStatsPersistenceStatus = {
|
|
|
712
748
|
lastReconciledAt: number | null;
|
|
713
749
|
lastRecoveryAt: number | null;
|
|
714
750
|
lastError: string | null;
|
|
751
|
+
terminalErrorsFilePath?: string | null;
|
|
752
|
+
terminalErrorsRevision?: number;
|
|
753
|
+
terminalErrorsPending?: number;
|
|
754
|
+
terminalErrorsInFlight?: number;
|
|
755
|
+
terminalErrorsUnpersisted?: number;
|
|
756
|
+
terminalErrorsLastFlushedAt?: number | null;
|
|
757
|
+
terminalErrorsLastRecoveryAt?: number | null;
|
|
758
|
+
terminalErrorsLastError?: string | null;
|
|
715
759
|
};
|
|
716
760
|
/** Versioned on-disk snapshot shared by overlapping proxy workers. */
|
|
717
761
|
export type PersistedProxyStatsSnapshot = {
|
|
@@ -720,6 +764,13 @@ export type PersistedProxyStatsSnapshot = {
|
|
|
720
764
|
updatedAt: number;
|
|
721
765
|
stats: ProxyStats;
|
|
722
766
|
};
|
|
767
|
+
/** Versioned terminal-error snapshot isolated from rolling-worker counter writes. */
|
|
768
|
+
export type PersistedProxyTerminalErrorSnapshot = {
|
|
769
|
+
schemaVersion: 1;
|
|
770
|
+
revision: number;
|
|
771
|
+
updatedAt: number;
|
|
772
|
+
journal: ProxyTerminalErrorJournal;
|
|
773
|
+
};
|
|
723
774
|
/** Ownership metadata for the proxy statistics cross-process lock. */
|
|
724
775
|
export type ProxyStatsLockOwner = {
|
|
725
776
|
token: string;
|
|
@@ -729,6 +780,7 @@ export type ProxyStatsLockOwner = {
|
|
|
729
780
|
/** Construction options for an isolated proxy statistics store. */
|
|
730
781
|
export type ProxyUsageStatsStoreOptions = {
|
|
731
782
|
filePath?: string;
|
|
783
|
+
terminalErrorsFilePath?: string;
|
|
732
784
|
flushIntervalMs?: number;
|
|
733
785
|
lockTimeoutMs?: number;
|
|
734
786
|
staleLockMs?: number;
|
|
@@ -1951,6 +2003,11 @@ export type StatusStats = {
|
|
|
1951
2003
|
totalRateLimits: number;
|
|
1952
2004
|
totalTransientRateLimits?: number;
|
|
1953
2005
|
totalQuotaRateLimits?: number;
|
|
2006
|
+
terminalErrors?: ProxyTerminalErrorJournal;
|
|
2007
|
+
lastTerminalError?: ProxyTerminalErrorSummary | null;
|
|
2008
|
+
terminalErrorDetailsComparable?: boolean;
|
|
2009
|
+
terminalErrorDetailsMissing?: number;
|
|
2010
|
+
terminalErrorDetailsExcess?: number;
|
|
1954
2011
|
accounts?: {
|
|
1955
2012
|
label: string;
|
|
1956
2013
|
type: string;
|
|
@@ -1963,7 +2020,9 @@ export type StatusStats = {
|
|
|
1963
2020
|
transientRateLimits?: number;
|
|
1964
2021
|
quotaRateLimits?: number;
|
|
1965
2022
|
cooling: boolean;
|
|
1966
|
-
|
|
2023
|
+
allowed?: boolean;
|
|
2024
|
+
expired?: boolean;
|
|
2025
|
+
status?: "active" | "cooling" | "disabled" | "expired" | "excluded" | "removed" | "internal" | "unattributed";
|
|
1967
2026
|
}[];
|
|
1968
2027
|
persistence?: ProxyStatsPersistenceStatus;
|
|
1969
2028
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/neurolink",
|
|
3
|
-
"version": "10.4.
|
|
3
|
+
"version": "10.4.4",
|
|
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": {
|