@juspay/neurolink 12.12.4 → 12.12.6

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 CHANGED
@@ -1,8 +1,8 @@
1
- ## [12.12.4](https://github.com/juspay/neurolink/compare/v12.12.3...v12.12.4) (2026-09-05)
1
+ ## [12.12.6](https://github.com/juspay/neurolink/compare/v12.12.5...v12.12.6) (2026-09-05)
2
2
 
3
3
  ### Bug Fixes
4
4
 
5
- - **(proxy):** preserve Codex fallback reasoning effort ([2b0dfd4](https://github.com/juspay/neurolink/commit/2b0dfd4e16c263168951b3b744c6aacf0cf4187a))
5
+ - **(middleware):** apply model middleware on the OpenAI-compatible streaming path ([fabf319](https://github.com/juspay/neurolink/commit/fabf31972718ddba4ad79eef6965fcb6e432ca50)), closes [#1635](https://github.com/juspay/neurolink/issues/1635)
6
6
 
7
7
  ## [11.2.3](https://github.com/juspay/neurolink/compare/v11.2.2...v11.2.3) (2026-08-19)
8
8
 
@@ -12,7 +12,7 @@
12
12
  * - Automatic token refresh via configurable refresher functions
13
13
  * - Cross-platform support (Unix/macOS/Windows)
14
14
  */
15
- import type { StoredOAuthTokens, TokenRefresher } from "../types/index.js";
15
+ import type { TokenStorageData, StoredOAuthTokens, TokenRefresher } from "../types/index.js";
16
16
  /**
17
17
  * Secure token storage for OAuth tokens with multi-provider support
18
18
  *
@@ -59,6 +59,7 @@ export declare class TokenStore {
59
59
  private readonly tokenRefreshers;
60
60
  private readonly inFlightRefreshes;
61
61
  private readonly _mutex;
62
+ private snapshotRead;
62
63
  /**
63
64
  * Creates a new TokenStore instance
64
65
  *
@@ -98,6 +99,13 @@ export declare class TokenStore {
98
99
  loadTokens(provider: string): Promise<StoredOAuthTokens | null>;
99
100
  /** Reads tokens without updating access metadata or rewriting the store. */
100
101
  peekTokens(provider: string): Promise<StoredOAuthTokens | null>;
102
+ /**
103
+ * Read one coherent account inventory without updating access timestamps.
104
+ * Concurrent readers share only the in-flight read, never a TTL cache, so
105
+ * the next request observes account edits made by another process. Each
106
+ * caller receives its own copy, including disabled state and credentials.
107
+ */
108
+ getProviderSnapshot(): Promise<TokenStorageData["providers"]>;
101
109
  /**
102
110
  * Internal load without mutex — callers must already hold the mutex.
103
111
  */
@@ -71,6 +71,7 @@ export class TokenStore {
71
71
  tokenRefreshers = new Map();
72
72
  inFlightRefreshes = new Map();
73
73
  _mutex = new AsyncMutex();
74
+ snapshotRead;
74
75
  /**
75
76
  * Creates a new TokenStore instance
76
77
  *
@@ -229,6 +230,34 @@ export class TokenStore {
229
230
  }
230
231
  });
231
232
  }
233
+ /**
234
+ * Read one coherent account inventory without updating access timestamps.
235
+ * Concurrent readers share only the in-flight read, never a TTL cache, so
236
+ * the next request observes account edits made by another process. Each
237
+ * caller receives its own copy, including disabled state and credentials.
238
+ */
239
+ async getProviderSnapshot() {
240
+ this.snapshotRead ??= this._mutex
241
+ .runExclusive(async () => {
242
+ try {
243
+ return (await this.loadStorageData()).providers;
244
+ }
245
+ catch (error) {
246
+ if (error instanceof TokenStoreError && error.code === "NOT_FOUND") {
247
+ return {};
248
+ }
249
+ throw error;
250
+ }
251
+ })
252
+ .finally(() => {
253
+ this.snapshotRead = undefined;
254
+ });
255
+ const providers = await this.snapshotRead;
256
+ return Object.fromEntries(Object.entries(providers).map(([key, value]) => [
257
+ key,
258
+ { ...value, tokens: { ...value.tokens } },
259
+ ]));
260
+ }
232
261
  /**
233
262
  * Internal load without mutex — callers must already hold the mutex.
234
263
  */