@juspay/neurolink 9.86.4 → 9.87.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 +12 -0
- package/dist/adapters/video/replicateVideoHandler.js +27 -17
- package/dist/auth/tokenStore.d.ts +6 -0
- package/dist/auth/tokenStore.js +36 -4
- package/dist/browser/neurolink.min.js +417 -417
- package/dist/cli/commands/auth.js +3 -0
- package/dist/cli/commands/proxy.js +310 -107
- package/dist/lib/adapters/video/replicateVideoHandler.js +27 -17
- package/dist/lib/auth/tokenStore.d.ts +6 -0
- package/dist/lib/auth/tokenStore.js +36 -4
- package/dist/lib/proxy/accountCooldown.d.ts +5 -0
- package/dist/lib/proxy/accountCooldown.js +93 -0
- package/dist/lib/proxy/accountQuota.d.ts +3 -4
- package/dist/lib/proxy/accountQuota.js +75 -44
- package/dist/lib/proxy/accountSelection.d.ts +8 -0
- package/dist/lib/proxy/accountSelection.js +26 -0
- package/dist/lib/proxy/proxyConfig.js +24 -0
- package/dist/lib/proxy/proxyPaths.js +2 -0
- package/dist/lib/proxy/requestLogger.js +2 -0
- package/dist/lib/proxy/snapshotPersistence.js +1 -1
- package/dist/lib/proxy/sseInterceptor.js +16 -0
- package/dist/lib/proxy/streamOutcome.d.ts +3 -0
- package/dist/lib/proxy/streamOutcome.js +27 -0
- package/dist/lib/proxy/tokenRefresh.d.ts +8 -0
- package/dist/lib/proxy/tokenRefresh.js +92 -15
- package/dist/lib/proxy/updateState.js +17 -4
- package/dist/lib/server/routes/claudeProxyRoutes.d.ts +18 -3
- package/dist/lib/server/routes/claudeProxyRoutes.js +624 -223
- package/dist/lib/types/auth.d.ts +1 -1
- package/dist/lib/types/cli.d.ts +2 -0
- package/dist/lib/types/multimodal.d.ts +12 -0
- package/dist/lib/types/proxy.d.ts +49 -8
- package/dist/lib/types/subscription.d.ts +5 -0
- package/dist/proxy/accountCooldown.d.ts +5 -0
- package/dist/proxy/accountCooldown.js +92 -0
- package/dist/proxy/accountQuota.d.ts +3 -4
- package/dist/proxy/accountQuota.js +75 -44
- package/dist/proxy/accountSelection.d.ts +8 -0
- package/dist/proxy/accountSelection.js +25 -0
- package/dist/proxy/proxyConfig.js +24 -0
- package/dist/proxy/proxyPaths.js +2 -0
- package/dist/proxy/requestLogger.js +2 -0
- package/dist/proxy/snapshotPersistence.js +1 -1
- package/dist/proxy/sseInterceptor.js +16 -0
- package/dist/proxy/streamOutcome.d.ts +3 -0
- package/dist/proxy/streamOutcome.js +26 -0
- package/dist/proxy/tokenRefresh.d.ts +8 -0
- package/dist/proxy/tokenRefresh.js +92 -15
- package/dist/proxy/updateState.js +17 -4
- package/dist/server/routes/claudeProxyRoutes.d.ts +18 -3
- package/dist/server/routes/claudeProxyRoutes.js +624 -223
- package/dist/types/auth.d.ts +1 -1
- package/dist/types/cli.d.ts +2 -0
- package/dist/types/multimodal.d.ts +12 -0
- package/dist/types/proxy.d.ts +49 -8
- package/dist/types/subscription.d.ts +5 -0
- package/package.json +1 -1
package/dist/types/auth.d.ts
CHANGED
|
@@ -69,7 +69,7 @@ export type StoredProviderTokens = {
|
|
|
69
69
|
disabled?: boolean;
|
|
70
70
|
/** When the tokens were disabled (Unix ms) */
|
|
71
71
|
disabledAt?: number;
|
|
72
|
-
/** Reason the tokens were disabled (e.g., "
|
|
72
|
+
/** Reason the tokens were disabled (e.g., "refresh_invalid") */
|
|
73
73
|
disabledReason?: string;
|
|
74
74
|
};
|
|
75
75
|
/**
|
package/dist/types/cli.d.ts
CHANGED
|
@@ -825,6 +825,8 @@ export type ProxyState = {
|
|
|
825
825
|
envFile?: string;
|
|
826
826
|
/** Fallback chain from proxy config (persisted at start time) */
|
|
827
827
|
fallbackChain?: FallbackInfo[];
|
|
828
|
+
/** Normalized Anthropic account keys allowed for this proxy process. */
|
|
829
|
+
accountAllowlist?: string[];
|
|
828
830
|
/** Optional fail-open guard PID that reverts Claude settings if proxy dies */
|
|
829
831
|
guardPid?: number;
|
|
830
832
|
/** How the proxy was launched — "launchd" if installed as service, "manual" otherwise */
|
|
@@ -190,6 +190,18 @@ export type VideoOutputOptions = {
|
|
|
190
190
|
* `image` Buffer argument passed to `generate()`.
|
|
191
191
|
*/
|
|
192
192
|
imageUrl?: string;
|
|
193
|
+
/**
|
|
194
|
+
* Replicate only: the input-schema key the model expects the image under.
|
|
195
|
+
* Replicate image-to-video models disagree on this — e.g.
|
|
196
|
+
* `minimax/hailuo-2.3-fast` requires `first_frame_image`,
|
|
197
|
+
* `wan-video/wan-2.7-i2v` requires `first_frame` — and a model whose
|
|
198
|
+
* required image key is missing fails the prediction on submit. Setting
|
|
199
|
+
* this also switches the payload to the modern `duration`/`resolution`
|
|
200
|
+
* field shape those models expect (instead of the legacy
|
|
201
|
+
* `num_frames`/`fps`/`aspect_ratio` shape). Omit for models that accept
|
|
202
|
+
* the default `image` key.
|
|
203
|
+
*/
|
|
204
|
+
imageInputKey?: string;
|
|
193
205
|
/**
|
|
194
206
|
* Per-call provider credentials. Takes precedence over instance-level
|
|
195
207
|
* credentials set at construction time, which in turn override env vars.
|
package/dist/types/proxy.d.ts
CHANGED
|
@@ -517,6 +517,7 @@ export type AnthropicLoopState = {
|
|
|
517
517
|
contentType?: string;
|
|
518
518
|
} | null;
|
|
519
519
|
authFailureMessage: string | null;
|
|
520
|
+
authCooldownMessage: string | null;
|
|
520
521
|
attemptNumber: number;
|
|
521
522
|
};
|
|
522
523
|
export type AnthropicUpstreamBody = {
|
|
@@ -580,9 +581,9 @@ export type AccountCooldownPlan = {
|
|
|
580
581
|
reason: AccountCoolingReason;
|
|
581
582
|
/** Epoch-ms until which the account should not be used. */
|
|
582
583
|
coolingUntil: number;
|
|
583
|
-
/** When true (5h/7d
|
|
584
|
-
* account is futile until its window resets. When false (transient
|
|
585
|
-
* a small number of jittered same-account retries is allowed first. */
|
|
584
|
+
/** When true (unified/5h/7d rejected), rotate immediately — retrying the
|
|
585
|
+
* same account is futile until its window resets. When false (transient
|
|
586
|
+
* burst), a small number of jittered same-account retries is allowed first. */
|
|
586
587
|
rotateImmediately: boolean;
|
|
587
588
|
};
|
|
588
589
|
export type AnthropicUpstreamFetchResult = {
|
|
@@ -630,12 +631,22 @@ export type RefreshResult = {
|
|
|
630
631
|
error?: string;
|
|
631
632
|
status?: number;
|
|
632
633
|
};
|
|
634
|
+
/** Result shared by callers waiting on the same rotating refresh token. */
|
|
635
|
+
export type SharedRefreshResult = {
|
|
636
|
+
result: RefreshResult;
|
|
637
|
+
token: string;
|
|
638
|
+
refreshToken?: string;
|
|
639
|
+
expiresAt?: number;
|
|
640
|
+
};
|
|
633
641
|
export type TokenPersistTarget = string | {
|
|
634
642
|
credPath: string;
|
|
635
643
|
} | {
|
|
636
644
|
providerKey: string;
|
|
637
645
|
};
|
|
638
646
|
export type AccountQuota = {
|
|
647
|
+
/** Top-level unified status. A rejected value can be authoritative even
|
|
648
|
+
* while both 5h and 7d sub-window statuses still report allowed. */
|
|
649
|
+
unifiedStatus?: string;
|
|
639
650
|
/** 0.0-1.0 (from unified-5h-utilization) */
|
|
640
651
|
sessionUsed: number;
|
|
641
652
|
/** "allowed" | "throttled" | "rejected" */
|
|
@@ -658,9 +669,18 @@ export type AccountQuota = {
|
|
|
658
669
|
/** Why an account is currently cooling. Drives cooldown duration and logging.
|
|
659
670
|
* - "weekly" : 7d unified limit rejected — cool until the weekly reset.
|
|
660
671
|
* - "session" : 5h unified limit rejected — cool until the session reset.
|
|
672
|
+
* - "unified" : top-level unified limit rejected — cool for retry-after.
|
|
661
673
|
* - "transient" : short per-minute/burst 429 — cool for retry-after only.
|
|
662
|
-
* - "auth" :
|
|
663
|
-
export type AccountCoolingReason = "weekly" | "session" | "transient" | "auth";
|
|
674
|
+
* - "auth" : transient refresh failure with bounded backoff. */
|
|
675
|
+
export type AccountCoolingReason = "weekly" | "session" | "unified" | "transient" | "auth";
|
|
676
|
+
/** Restart-safe cooldown snapshot for one account. */
|
|
677
|
+
export type PersistedAccountCooldown = {
|
|
678
|
+
coolingUntil: number;
|
|
679
|
+
reason: AccountCoolingReason;
|
|
680
|
+
updatedAt: number;
|
|
681
|
+
};
|
|
682
|
+
/** Normalized Anthropic account keys eligible for proxy routing. */
|
|
683
|
+
export type AccountAllowlist = ReadonlySet<string>;
|
|
664
684
|
/** Runtime state for a proxy account. */
|
|
665
685
|
export type RuntimeAccountState = {
|
|
666
686
|
consecutiveRefreshFailures: number;
|
|
@@ -668,9 +688,9 @@ export type RuntimeAccountState = {
|
|
|
668
688
|
lastToken?: string;
|
|
669
689
|
lastRefreshToken?: string;
|
|
670
690
|
/** Epoch-ms timestamp until which the account should not be used for new
|
|
671
|
-
* requests. Set from the
|
|
672
|
-
*
|
|
673
|
-
*
|
|
691
|
+
* requests. Set from the actual Anthropic reset/retry window or from
|
|
692
|
+
* bounded refresh backoff. Other requests arriving during this window skip
|
|
693
|
+
* the account rather than hammering it. */
|
|
674
694
|
coolingUntil?: number;
|
|
675
695
|
/** Why the account is cooling (set alongside coolingUntil). */
|
|
676
696
|
coolingReason?: AccountCoolingReason;
|
|
@@ -769,6 +789,8 @@ export type ProxyPaths = {
|
|
|
769
789
|
logsDir: string;
|
|
770
790
|
/** account-quotas.json — per-account rate limit state */
|
|
771
791
|
quotaFile: string;
|
|
792
|
+
/** account-cooldowns.json — restart-safe account cooldown state */
|
|
793
|
+
cooldownFile: string;
|
|
772
794
|
/** Whether this is a dev-mode isolated instance */
|
|
773
795
|
isDev: boolean;
|
|
774
796
|
};
|
|
@@ -958,8 +980,26 @@ export type SSETelemetry = {
|
|
|
958
980
|
timestamp: number;
|
|
959
981
|
data: string;
|
|
960
982
|
}>;
|
|
983
|
+
/** Error carried as a terminal SSE `event: error`, if one was observed. */
|
|
984
|
+
streamErrorMessage?: string;
|
|
961
985
|
rawText?: string;
|
|
962
986
|
};
|
|
987
|
+
/** Terminal outcome of a response body after the HTTP headers were sent. */
|
|
988
|
+
export type StreamTerminalOutcome = {
|
|
989
|
+
kind: "completed";
|
|
990
|
+
} | {
|
|
991
|
+
kind: "upstream_error";
|
|
992
|
+
message: string;
|
|
993
|
+
} | {
|
|
994
|
+
kind: "client_cancelled";
|
|
995
|
+
};
|
|
996
|
+
/** First-writer-wins tracker for an upstream streaming response. */
|
|
997
|
+
export type StreamTerminalOutcomeTracker = {
|
|
998
|
+
outcome: Promise<StreamTerminalOutcome>;
|
|
999
|
+
complete: () => void;
|
|
1000
|
+
fail: (message: string) => void;
|
|
1001
|
+
cancel: () => void;
|
|
1002
|
+
};
|
|
963
1003
|
/** Mutable accumulator the SSE interceptor uses internally. */
|
|
964
1004
|
export type TelemetryAccumulator = {
|
|
965
1005
|
messageId: string;
|
|
@@ -984,6 +1024,7 @@ export type TelemetryAccumulator = {
|
|
|
984
1024
|
rawTextBytes: number;
|
|
985
1025
|
rawTextTruncated: boolean;
|
|
986
1026
|
eventLogTruncated: boolean;
|
|
1027
|
+
streamErrorMessage?: string;
|
|
987
1028
|
};
|
|
988
1029
|
/** Result of createSSEInterceptor: the pass-through stream and a telemetry promise. */
|
|
989
1030
|
export type SSEInterceptorResult = {
|
|
@@ -914,6 +914,11 @@ export type ProxyRoutingConfig = {
|
|
|
914
914
|
* Resolved per-request to a stable key (anthropic:<email>); does not
|
|
915
915
|
* encode an index. */
|
|
916
916
|
primaryAccount?: string;
|
|
917
|
+
/** Anthropic account emails/labels that may be loaded by the proxy. When
|
|
918
|
+
* present, every token-store, legacy, and environment credential outside
|
|
919
|
+
* this set is excluded before refresh or routing. An empty list denies all
|
|
920
|
+
* stored credentials. */
|
|
921
|
+
accountAllowlist?: string[];
|
|
917
922
|
};
|
|
918
923
|
/** Cloaking plugin config */
|
|
919
924
|
export type CloakingConfig = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/neurolink",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.87.0",
|
|
4
4
|
"packageManager": "pnpm@10.15.1",
|
|
5
5
|
"description": "TypeScript AI SDK with 24+ LLM providers behind one consistent API. MCP-native (58+ servers), voice TTS/STT/realtime, RAG, agents, memory, context compaction. OpenAI · Anthropic · Gemini · Bedrock · Azure · Ollama · DeepSeek · NVIDIA NIM and more.",
|
|
6
6
|
"author": {
|