@juspay/neurolink 10.4.3 → 10.4.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 +6 -0
- package/dist/auth/tokenStore.d.ts +7 -0
- package/dist/auth/tokenStore.js +54 -0
- package/dist/browser/neurolink.min.js +374 -374
- package/dist/cli/commands/proxy.d.ts +1 -0
- package/dist/cli/commands/proxy.js +183 -24
- package/dist/lib/auth/tokenStore.d.ts +7 -0
- package/dist/lib/auth/tokenStore.js +54 -0
- package/dist/lib/proxy/proxyTranslationEngine.d.ts +1 -0
- package/dist/lib/proxy/proxyTranslationEngine.js +56 -12
- package/dist/lib/proxy/rawStreamCapture.js +47 -1
- package/dist/lib/proxy/sseInterceptor.js +47 -1
- package/dist/lib/proxy/tokenRefresh.d.ts +6 -0
- package/dist/lib/proxy/tokenRefresh.js +70 -15
- package/dist/lib/proxy/usageStats.d.ts +25 -3
- package/dist/lib/proxy/usageStats.js +546 -55
- package/dist/lib/server/routes/claudeProxyRoutes.d.ts +2 -0
- package/dist/lib/server/routes/claudeProxyRoutes.js +198 -222
- package/dist/lib/types/proxy.d.ts +60 -1
- package/dist/proxy/proxyTranslationEngine.d.ts +1 -0
- package/dist/proxy/proxyTranslationEngine.js +56 -12
- package/dist/proxy/rawStreamCapture.js +47 -1
- package/dist/proxy/sseInterceptor.js +47 -1
- package/dist/proxy/tokenRefresh.d.ts +6 -0
- package/dist/proxy/tokenRefresh.js +70 -15
- package/dist/proxy/usageStats.d.ts +25 -3
- package/dist/proxy/usageStats.js +546 -55
- package/dist/server/routes/claudeProxyRoutes.d.ts +2 -0
- package/dist/server/routes/claudeProxyRoutes.js +198 -222
- package/dist/types/proxy.d.ts +60 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [10.4.4](https://github.com/juspay/neurolink/compare/v10.4.3...v10.4.4) (2026-07-23)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- **(proxy):** persist explainable terminal failures ([1684203](https://github.com/juspay/neurolink/commit/16842035e6199a3b1bdd1876a614d5ce869cf3fd))
|
|
6
|
+
|
|
1
7
|
## [10.4.3](https://github.com/juspay/neurolink/compare/v10.4.2...v10.4.3) (2026-07-22)
|
|
2
8
|
|
|
3
9
|
### Bug Fixes
|
|
@@ -96,6 +96,8 @@ export declare class TokenStore {
|
|
|
96
96
|
* @throws TokenStoreError if reading fails (other than file not found)
|
|
97
97
|
*/
|
|
98
98
|
loadTokens(provider: string): Promise<StoredOAuthTokens | null>;
|
|
99
|
+
/** Reads tokens without updating access metadata or rewriting the store. */
|
|
100
|
+
peekTokens(provider: string): Promise<StoredOAuthTokens | null>;
|
|
99
101
|
/**
|
|
100
102
|
* Internal load without mutex — callers must already hold the mutex.
|
|
101
103
|
*/
|
|
@@ -179,6 +181,11 @@ export declare class TokenStore {
|
|
|
179
181
|
* @param reason - Optional human-readable reason (e.g., "refresh_failed")
|
|
180
182
|
*/
|
|
181
183
|
markDisabled(provider: string, reason?: string): Promise<void>;
|
|
184
|
+
/**
|
|
185
|
+
* Disables an account only when the persisted credentials still match the
|
|
186
|
+
* request that observed the authentication failure.
|
|
187
|
+
*/
|
|
188
|
+
markDisabledIfCurrent(provider: string, expectedTokens: Pick<StoredOAuthTokens, "accessToken" | "refreshToken" | "expiresAt">, reason?: string): Promise<boolean>;
|
|
182
189
|
/**
|
|
183
190
|
* Re-enables a previously disabled provider (persisted to disk).
|
|
184
191
|
*
|
package/dist/auth/tokenStore.js
CHANGED
|
@@ -213,6 +213,22 @@ export class TokenStore {
|
|
|
213
213
|
return result;
|
|
214
214
|
});
|
|
215
215
|
}
|
|
216
|
+
/** Reads tokens without updating access metadata or rewriting the store. */
|
|
217
|
+
async peekTokens(provider) {
|
|
218
|
+
return this._mutex.runExclusive(async () => {
|
|
219
|
+
try {
|
|
220
|
+
const storageData = await this.loadStorageData();
|
|
221
|
+
const tokens = storageData.providers[provider]?.tokens;
|
|
222
|
+
return tokens ? { ...tokens } : null;
|
|
223
|
+
}
|
|
224
|
+
catch (error) {
|
|
225
|
+
if (error instanceof TokenStoreError && error.code === "NOT_FOUND") {
|
|
226
|
+
return null;
|
|
227
|
+
}
|
|
228
|
+
throw error;
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
}
|
|
216
232
|
/**
|
|
217
233
|
* Internal load without mutex — callers must already hold the mutex.
|
|
218
234
|
*/
|
|
@@ -539,6 +555,44 @@ export class TokenStore {
|
|
|
539
555
|
});
|
|
540
556
|
});
|
|
541
557
|
}
|
|
558
|
+
/**
|
|
559
|
+
* Disables an account only when the persisted credentials still match the
|
|
560
|
+
* request that observed the authentication failure.
|
|
561
|
+
*/
|
|
562
|
+
async markDisabledIfCurrent(provider, expectedTokens, reason) {
|
|
563
|
+
return this._mutex.runExclusive(async () => {
|
|
564
|
+
let storageData;
|
|
565
|
+
try {
|
|
566
|
+
storageData = await this.loadStorageData();
|
|
567
|
+
}
|
|
568
|
+
catch (error) {
|
|
569
|
+
if (error instanceof TokenStoreError && error.code === "NOT_FOUND") {
|
|
570
|
+
return false;
|
|
571
|
+
}
|
|
572
|
+
throw error;
|
|
573
|
+
}
|
|
574
|
+
const providerData = storageData.providers[provider];
|
|
575
|
+
if (!providerData) {
|
|
576
|
+
return false;
|
|
577
|
+
}
|
|
578
|
+
const current = providerData.tokens;
|
|
579
|
+
if (current.accessToken !== expectedTokens.accessToken ||
|
|
580
|
+
current.refreshToken !== expectedTokens.refreshToken ||
|
|
581
|
+
current.expiresAt !== expectedTokens.expiresAt) {
|
|
582
|
+
return false;
|
|
583
|
+
}
|
|
584
|
+
providerData.disabled = true;
|
|
585
|
+
providerData.disabledAt = Date.now();
|
|
586
|
+
providerData.disabledReason = reason;
|
|
587
|
+
storageData.lastModified = Date.now();
|
|
588
|
+
await this.saveStorageData(storageData);
|
|
589
|
+
logger.info("Provider marked as disabled", {
|
|
590
|
+
provider,
|
|
591
|
+
reason: reason ?? "unspecified",
|
|
592
|
+
});
|
|
593
|
+
return true;
|
|
594
|
+
});
|
|
595
|
+
}
|
|
542
596
|
/**
|
|
543
597
|
* Re-enables a previously disabled provider (persisted to disk).
|
|
544
598
|
*
|