@juspay/neurolink 10.1.2 → 10.2.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.
@@ -700,6 +700,40 @@ export type ProxyStats = {
700
700
  totalQuotaRateLimits: number;
701
701
  accounts: Record<string, AccountStats>;
702
702
  };
703
+ /** Durability and reconciliation state for the proxy usage counters. */
704
+ export type ProxyStatsPersistenceStatus = {
705
+ enabled: boolean;
706
+ filePath: string | null;
707
+ revision: number;
708
+ pendingMutations: number;
709
+ inFlightMutations: number;
710
+ unpersistedMutations: number;
711
+ lastFlushedAt: number | null;
712
+ lastReconciledAt: number | null;
713
+ lastRecoveryAt: number | null;
714
+ lastError: string | null;
715
+ };
716
+ /** Versioned on-disk snapshot shared by overlapping proxy workers. */
717
+ export type PersistedProxyStatsSnapshot = {
718
+ schemaVersion: 1;
719
+ revision: number;
720
+ updatedAt: number;
721
+ stats: ProxyStats;
722
+ };
723
+ /** Ownership metadata for the proxy statistics cross-process lock. */
724
+ export type ProxyStatsLockOwner = {
725
+ token: string;
726
+ pid: number;
727
+ acquiredAt: number;
728
+ };
729
+ /** Construction options for an isolated proxy statistics store. */
730
+ export type ProxyUsageStatsStoreOptions = {
731
+ filePath?: string;
732
+ flushIntervalMs?: number;
733
+ lockTimeoutMs?: number;
734
+ staleLockMs?: number;
735
+ now?: () => number;
736
+ };
703
737
  export type RefreshableAccount = {
704
738
  token: string;
705
739
  refreshToken?: string;
@@ -874,6 +908,8 @@ export type ProxyPaths = {
874
908
  quotaFile: string;
875
909
  /** account-cooldowns.json — restart-safe account cooldown state */
876
910
  cooldownFile: string;
911
+ /** proxy-usage-stats.json — restart- and handoff-safe usage counters */
912
+ statsFile?: string;
877
913
  /** Whether this is a dev-mode isolated instance */
878
914
  isDev: boolean;
879
915
  };
@@ -1876,6 +1912,7 @@ export type ProxyStartApp = {
1876
1912
  };
1877
1913
  /** Stats shape consumed by the proxy status printer. */
1878
1914
  export type StatusStats = {
1915
+ startedAt?: number;
1879
1916
  totalAttempts?: number;
1880
1917
  totalAttemptErrors?: number;
1881
1918
  totalRequests: number;
@@ -1896,7 +1933,9 @@ export type StatusStats = {
1896
1933
  transientRateLimits?: number;
1897
1934
  quotaRateLimits?: number;
1898
1935
  cooling: boolean;
1936
+ status?: "active" | "cooling" | "disabled" | "excluded" | "removed";
1899
1937
  }[];
1938
+ persistence?: ProxyStatsPersistenceStatus;
1900
1939
  };
1901
1940
  /** Sub-action of the `proxy telemetry` CLI command. */
1902
1941
  export type ProxyTelemetryAction = "setup" | "start" | "stop" | "status" | "logs" | "import-dashboard";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/neurolink",
3
- "version": "10.1.2",
3
+ "version": "10.2.0",
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": {
@@ -179,9 +179,10 @@
179
179
  "proxy:observability:doctor": "node scripts/observability/check-proxy-telemetry.mjs",
180
180
  "proxy:observability:import-dashboard": "bash scripts/observability/manage-local-openobserve.sh import-dashboard",
181
181
  "proxy:performance:lifecycle": "tsx tools/testing/proxyLifecycleBenchmark.ts",
182
+ "proxy:performance:stats": "tsx tools/testing/proxyUsageStatsBenchmark.ts",
182
183
  "proxy:performance:transport": "tsx tools/testing/proxyTransportBenchmark.ts",
183
184
  "proxy:performance:rolling": "tsx tools/testing/proxyRollingHandoffBenchmark.ts",
184
- "proxy:performance": "pnpm run proxy:performance:lifecycle && pnpm run proxy:performance:transport && pnpm run proxy:performance:rolling",
185
+ "proxy:performance": "pnpm run proxy:performance:lifecycle && pnpm run proxy:performance:stats && pnpm run proxy:performance:transport && pnpm run proxy:performance:rolling",
185
186
  "// Development & Monitoring": "",
186
187
  "dev:health": "tsx tools/development/healthMonitor.ts",
187
188
  "dev:demo": "concurrently \"pnpm run dev\" \"node neurolink-demo/complete-enhanced-server.js\"",