@juspay/neurolink 12.7.2 → 12.7.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 +2 -2
- package/dist/browser/neurolink.min.js +422 -414
- package/dist/cli/commands/auth.js +252 -125
- package/dist/cli/commands/proxy.js +115 -75
- package/dist/cli/factories/authCommandFactory.js +8 -11
- package/dist/proxy/codexAccountUsage.d.ts +5 -0
- package/dist/proxy/codexAccountUsage.js +30 -0
- package/dist/proxy/codexFallback.d.ts +26 -0
- package/dist/proxy/codexFallback.js +371 -0
- package/dist/proxy/proxyActivity.js +12 -1
- package/dist/proxy/usageStats.d.ts +2 -2
- package/dist/proxy/usageStats.js +66 -10
- package/dist/server/routes/claudeProxyRoutes.d.ts +25 -2
- package/dist/server/routes/claudeProxyRoutes.js +413 -108
- package/dist/server/routes/codexProxyRoutes.d.ts +10 -2
- package/dist/server/routes/codexProxyRoutes.js +192 -59
- package/dist/types/claudeProxy.d.ts +16 -0
- package/dist/types/claudeProxy.js +4 -0
- package/dist/types/cli.d.ts +37 -5
- package/dist/types/codex.d.ts +62 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/proxy.d.ts +37 -0
- package/package.json +1 -1
package/dist/types/proxy.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ import type { ProxyTracer } from "../proxy/proxyTracer.js";
|
|
|
21
21
|
import type { ACCOUNT_COOLING_REASONS, PROXY_ACCOUNT_TYPES, PROXY_ACCOUNT_ROUTING_MODES, PROXY_ACCOUNT_ROUTING_REASONS, PROXY_ACCOUNT_ROUTING_STRATEGIES } from "../proxy/routingEvidence.js";
|
|
22
22
|
import type { FallbackEntry, ModelMapping, ProxyRoutingConfig, CloakingConfig } from "./subscription.js";
|
|
23
23
|
import type { RouteDeprecation } from "./server.js";
|
|
24
|
+
import type { StoredOAuthTokens } from "./auth.js";
|
|
24
25
|
/**
|
|
25
26
|
* Type describing the ModelRouter contract.
|
|
26
27
|
* Defined here to avoid a circular dependency between types and implementation.
|
|
@@ -557,6 +558,8 @@ export type RequestLogEntry = {
|
|
|
557
558
|
stream: boolean;
|
|
558
559
|
toolCount: number;
|
|
559
560
|
account: string;
|
|
561
|
+
/** Provider-qualified account key for collision-free reconstruction. */
|
|
562
|
+
accountKey?: string;
|
|
560
563
|
accountType: string;
|
|
561
564
|
responseStatus: number;
|
|
562
565
|
responseTimeMs: number;
|
|
@@ -576,6 +579,8 @@ export type RequestLogEntry = {
|
|
|
576
579
|
* cross-provider model lookup rather than assuming Anthropic.
|
|
577
580
|
*/
|
|
578
581
|
provider?: string;
|
|
582
|
+
/** Terminal state of the client-facing response when known. */
|
|
583
|
+
terminalOutcome?: "completed" | "bodyless" | "client_cancelled" | "stream_error" | "handler_error";
|
|
579
584
|
/**
|
|
580
585
|
* Which CLI made the request, derived from User-Agent, and the raw header it
|
|
581
586
|
* was derived from.
|
|
@@ -605,6 +610,8 @@ export type RequestAttemptLogEntry = {
|
|
|
605
610
|
stream: boolean;
|
|
606
611
|
toolCount: number;
|
|
607
612
|
account: string;
|
|
613
|
+
/** Provider-qualified account key for collision-free reconstruction. */
|
|
614
|
+
accountKey?: string;
|
|
608
615
|
accountType: string;
|
|
609
616
|
responseStatus: number;
|
|
610
617
|
/** End-to-end request age when this attempt completed. */
|
|
@@ -627,11 +634,28 @@ export type RequestAttemptLogEntry = {
|
|
|
627
634
|
outputTokens?: number;
|
|
628
635
|
cacheCreationTokens?: number;
|
|
629
636
|
cacheReadTokens?: number;
|
|
637
|
+
/** Provider that received this upstream attempt. */
|
|
638
|
+
provider?: string;
|
|
630
639
|
/** OTel trace ID for correlation with distributed traces */
|
|
631
640
|
traceId?: string;
|
|
632
641
|
/** OTel span ID for correlation with distributed traces */
|
|
633
642
|
spanId?: string;
|
|
634
643
|
};
|
|
644
|
+
/** Additional fields recorded when a Codex response becomes client-final. */
|
|
645
|
+
export type CodexFinalLogExtra = Partial<Pick<RequestLogEntry, "errorType" | "errorMessage" | "errorCode" | "transportScope" | "inputTokens" | "outputTokens" | "cacheReadTokens" | "cacheCreationTokens" | "terminalOutcome">>;
|
|
646
|
+
/** Additional fields recorded for each upstream Codex account attempt. */
|
|
647
|
+
export type CodexAttemptLogExtra = Partial<Pick<RequestAttemptLogEntry, "errorType" | "errorMessage" | "errorCode" | "transportScope" | "retryable" | "rateLimitKind" | "cooldownReason">>;
|
|
648
|
+
/** Minimal persistence contract needed by Codex rotating-token refreshes. */
|
|
649
|
+
export type CodexRefreshTokenStore = {
|
|
650
|
+
peekTokens(provider: string): Promise<StoredOAuthTokens | null>;
|
|
651
|
+
saveTokens(provider: string, tokens: StoredOAuthTokens): Promise<void>;
|
|
652
|
+
};
|
|
653
|
+
/** Result contract for a Codex OAuth refresh operation. */
|
|
654
|
+
export type CodexTokenRefresher = (refreshToken: string) => Promise<{
|
|
655
|
+
accessToken: string;
|
|
656
|
+
refreshToken?: string;
|
|
657
|
+
expiresAt?: number;
|
|
658
|
+
}>;
|
|
635
659
|
export type ProxyBodyCaptureInput = {
|
|
636
660
|
phase: string;
|
|
637
661
|
headers?: Record<string, string>;
|
|
@@ -880,6 +904,8 @@ export type ProxyTerminalErrorSummary = {
|
|
|
880
904
|
category: ProxyTerminalErrorCategory;
|
|
881
905
|
requestId?: string;
|
|
882
906
|
account?: string;
|
|
907
|
+
/** Provider-qualified account identity when the failure was attributable. */
|
|
908
|
+
accountKey?: string;
|
|
883
909
|
accountType?: string;
|
|
884
910
|
errorType?: string;
|
|
885
911
|
errorCode?: string;
|
|
@@ -889,12 +915,20 @@ export type ProxyTerminalErrorSummary = {
|
|
|
889
915
|
/** Optional terminal context supplied when a final request error is recorded. */
|
|
890
916
|
export type ProxyTerminalErrorDetails = {
|
|
891
917
|
requestId?: string;
|
|
918
|
+
/** Exact provider-qualified account key when the caller has it. */
|
|
919
|
+
accountKey?: string;
|
|
892
920
|
errorType?: string;
|
|
893
921
|
errorCode?: string;
|
|
894
922
|
terminalOutcome?: string;
|
|
895
923
|
message?: string;
|
|
896
924
|
};
|
|
897
925
|
export type AccountStats = {
|
|
926
|
+
/**
|
|
927
|
+
* Provider-qualified account identity for rows written by current builds.
|
|
928
|
+
* Omitted only by legacy snapshots whose bare map keys are intentionally
|
|
929
|
+
* treated as unattributed rather than guessed at during status rendering.
|
|
930
|
+
*/
|
|
931
|
+
key?: string;
|
|
898
932
|
label: string;
|
|
899
933
|
type: string;
|
|
900
934
|
attemptCount: number;
|
|
@@ -2611,6 +2645,9 @@ export type StatusStats = {
|
|
|
2611
2645
|
/** Whether this status response reconciled shared state or used local memory. */
|
|
2612
2646
|
snapshotSource?: "reconciled" | "memory";
|
|
2613
2647
|
accounts?: {
|
|
2648
|
+
/** Provider-qualified key; null for explicitly unattributed legacy rows. */
|
|
2649
|
+
key?: string | null;
|
|
2650
|
+
provider?: "anthropic" | "codex" | "other" | "unknown";
|
|
2614
2651
|
label: string;
|
|
2615
2652
|
type: string;
|
|
2616
2653
|
attempts?: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/neurolink",
|
|
3
|
-
"version": "12.7.
|
|
3
|
+
"version": "12.7.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": {
|