@juspay/neurolink 11.20.0 → 11.20.1
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.
|
@@ -187,6 +187,20 @@ declare function executeClaudeFallbackTranslation(args: {
|
|
|
187
187
|
}) => void;
|
|
188
188
|
options: Parameters<ServerContext["neurolink"]["stream"]>[0];
|
|
189
189
|
providerLabel: string;
|
|
190
|
+
/**
|
|
191
|
+
* Idle timeout for the fallback stream, in ms. Defaults to
|
|
192
|
+
* FALLBACK_STREAM_IDLE_TIMEOUT_MS.
|
|
193
|
+
*
|
|
194
|
+
* Injectable purely so a test can drive the timeout path in milliseconds
|
|
195
|
+
* instead of two minutes. The alternative the coverage used before was
|
|
196
|
+
* patching `globalThis.setTimeout` to fire every timer at 0ms for the
|
|
197
|
+
* duration of an await — which rewrites the delay of ANY timer created in
|
|
198
|
+
* that window, not just this one's, inside a 280-case suite sharing a single
|
|
199
|
+
* process. That is not a hypothetical: an attempt to measure the patched
|
|
200
|
+
* case with its own `setTimeout`-based watchdog had the watchdog rewritten
|
|
201
|
+
* out from under it and reported an instant false hang.
|
|
202
|
+
*/
|
|
203
|
+
idleTimeoutMs?: number;
|
|
190
204
|
}): Promise<unknown>;
|
|
191
205
|
declare function executeClaudeFallbackWithRetry(args: Parameters<typeof executeClaudeFallbackTranslation>[0]): Promise<unknown>;
|
|
192
206
|
declare function buildClaudeAnthropicFailureResponse(args: {
|
|
@@ -2690,14 +2690,14 @@ async function loadClaudeProxyAccounts(args) {
|
|
|
2690
2690
|
};
|
|
2691
2691
|
}
|
|
2692
2692
|
async function executeClaudeFallbackTranslation(args) {
|
|
2693
|
-
const { ctx, body, tracer, requestStartTime, logProxyBody, logFinalRequest, options, providerLabel, } = args;
|
|
2693
|
+
const { ctx, body, tracer, requestStartTime, logProxyBody, logFinalRequest, options, providerLabel, idleTimeoutMs = FALLBACK_STREAM_IDLE_TIMEOUT_MS, } = args;
|
|
2694
2694
|
const fallbackAbortController = new AbortController();
|
|
2695
2695
|
let streamResult;
|
|
2696
2696
|
try {
|
|
2697
2697
|
streamResult = await withTimeout(ctx.neurolink.stream({
|
|
2698
2698
|
...options,
|
|
2699
2699
|
abortSignal: fallbackAbortController.signal,
|
|
2700
|
-
}),
|
|
2700
|
+
}), idleTimeoutMs, `Fallback ${providerLabel} initialization timed out after ${idleTimeoutMs}ms`);
|
|
2701
2701
|
}
|
|
2702
2702
|
catch (error) {
|
|
2703
2703
|
fallbackAbortController.abort(error);
|
|
@@ -2708,7 +2708,7 @@ async function executeClaudeFallbackTranslation(args) {
|
|
|
2708
2708
|
let collectedText = "";
|
|
2709
2709
|
try {
|
|
2710
2710
|
while (true) {
|
|
2711
|
-
const { value: chunk, done } = await withTimeout(iterator.next(),
|
|
2711
|
+
const { value: chunk, done } = await withTimeout(iterator.next(), idleTimeoutMs, `Fallback ${providerLabel} stream timed out after ${idleTimeoutMs}ms of inactivity`);
|
|
2712
2712
|
if (done) {
|
|
2713
2713
|
return collectedText;
|
|
2714
2714
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/neurolink",
|
|
3
|
-
"version": "11.20.
|
|
3
|
+
"version": "11.20.1",
|
|
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": {
|