@juspay/neurolink 12.7.3 → 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 +399 -399
- package/dist/cli/commands/auth.js +252 -125
- package/dist/cli/commands/proxy.js +110 -91
- package/dist/cli/factories/authCommandFactory.js +8 -11
- package/dist/proxy/codexAccountUsage.d.ts +1 -1
- package/dist/proxy/codexAccountUsage.js +13 -1
- 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 +2 -1
- package/dist/server/routes/claudeProxyRoutes.js +62 -12
- package/dist/server/routes/codexProxyRoutes.d.ts +8 -2
- package/dist/server/routes/codexProxyRoutes.js +191 -58
- package/dist/types/cli.d.ts +37 -5
- package/dist/types/proxy.d.ts +37 -0
- package/package.json +1 -1
package/dist/types/cli.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import type { PPTGenerationResult } from "./ppt.js";
|
|
|
11
11
|
import type { AvatarResult } from "./avatar.js";
|
|
12
12
|
import type { MusicResult } from "./music.js";
|
|
13
13
|
import type { OAuthTokens } from "./auth.js";
|
|
14
|
-
import type { AccountQuota } from "./proxy.js";
|
|
14
|
+
import type { AccountQuota, ProxyPassthroughAccount } from "./proxy.js";
|
|
15
15
|
import type { ClaudeSubscriptionTier } from "./subscription.js";
|
|
16
16
|
import type { ServerFramework } from "./server.js";
|
|
17
17
|
import type { AuthProviderType } from "./auth.js";
|
|
@@ -954,7 +954,7 @@ export type AuthCommandArgs = BaseCommandArgs & {
|
|
|
954
954
|
label?: string;
|
|
955
955
|
account?: string;
|
|
956
956
|
force?: boolean;
|
|
957
|
-
/** `auth list --refresh`: fetch fresh limits
|
|
957
|
+
/** `auth list --refresh`: fetch fresh provider limits before listing */
|
|
958
958
|
refresh?: boolean;
|
|
959
959
|
/** Path to the proxy config YAML, used by set-/get-/clear-primary */
|
|
960
960
|
config?: string;
|
|
@@ -969,12 +969,44 @@ export type AuthCommandArgs = BaseCommandArgs & {
|
|
|
969
969
|
/** Yargs positional arguments */
|
|
970
970
|
_?: (string | number)[];
|
|
971
971
|
};
|
|
972
|
+
/** Refresh state for a provider-qualified account. */
|
|
973
|
+
export type AuthListRefreshStatus = "refreshed" | "snapshot" | "unavailable" | "not_supported";
|
|
974
|
+
/** Fresh-limit result for one provider-qualified account. */
|
|
975
|
+
export type AuthListRefreshAccountResult = {
|
|
976
|
+
/** Provider prefix parsed from the configured account key. */
|
|
977
|
+
provider: string;
|
|
978
|
+
/** A missing limit is explicit rather than being rendered as an unexplained dash. */
|
|
979
|
+
status: AuthListRefreshStatus;
|
|
980
|
+
error?: string;
|
|
981
|
+
};
|
|
982
|
+
/** One direct quota-adapter result used by `auth list --refresh`. */
|
|
983
|
+
export type AuthListDirectQuotaRefreshResult = {
|
|
984
|
+
status: "refreshed";
|
|
985
|
+
quota: AccountQuota;
|
|
986
|
+
} | {
|
|
987
|
+
status: "unavailable" | "not_supported";
|
|
988
|
+
error?: string;
|
|
989
|
+
};
|
|
990
|
+
/** Provider-specific quota capability used by the generic auth-list refresh. */
|
|
991
|
+
export type AuthListQuotaRefreshAdapter = {
|
|
992
|
+
/** A successful local proxy `/limits` response is authoritative for this provider. */
|
|
993
|
+
supportsProxyRefresh?: boolean;
|
|
994
|
+
listAccounts: () => Promise<ProxyPassthroughAccount[]>;
|
|
995
|
+
priorQuotaKeys: (account: ProxyPassthroughAccount) => readonly string[];
|
|
996
|
+
refreshAccount: (account: ProxyPassthroughAccount, options: {
|
|
997
|
+
prior: AccountQuota | null;
|
|
998
|
+
}) => Promise<AuthListDirectQuotaRefreshResult>;
|
|
999
|
+
};
|
|
1000
|
+
/** Applies one account's explicit auth-list refresh state. */
|
|
1001
|
+
export type AuthListRefreshResultSetter = (key: string, status: AuthListRefreshStatus, error?: string) => void;
|
|
972
1002
|
/** Outcome of the `auth list --refresh` fresh-limit fetch. */
|
|
973
1003
|
export type AuthListRefreshOutcome = {
|
|
974
1004
|
/** How the fresh limits were obtained ("none" when every path failed). */
|
|
975
|
-
via: "proxy" | "direct" | "none";
|
|
976
|
-
/** Freshly fetched quotas keyed by account
|
|
1005
|
+
via: "proxy" | "direct" | "mixed" | "none";
|
|
1006
|
+
/** Freshly fetched quotas keyed by provider-qualified account key. */
|
|
977
1007
|
quotas: Record<string, AccountQuota> | null;
|
|
1008
|
+
/** Per-account refresh status, also keyed by provider-qualified account key. */
|
|
1009
|
+
accounts: Record<string, AuthListRefreshAccountResult>;
|
|
978
1010
|
/** Per-account and transport errors, already formatted for display. */
|
|
979
1011
|
errors: string[];
|
|
980
1012
|
};
|
|
@@ -1220,7 +1252,7 @@ export type ProviderSetupConfig = {
|
|
|
1220
1252
|
endpoint?: string;
|
|
1221
1253
|
isReconfiguring?: boolean;
|
|
1222
1254
|
};
|
|
1223
|
-
/** Providers
|
|
1255
|
+
/** Providers with first-class credential flows implemented by `neurolink auth`. */
|
|
1224
1256
|
export type SupportedProvider = "anthropic" | "codex";
|
|
1225
1257
|
/** Arguments for `neurolink autoresearch init`. */
|
|
1226
1258
|
export type AutoresearchInitArgs = {
|
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": {
|