qwenproxy-cli 1.0.15 → 1.0.16
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qwenproxy-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.16",
|
|
4
4
|
"description": "High-performance OpenAI & Anthropic compatible API gateway for Qwen with multi-account rotation, interactive TUI, and resilient tool calling.",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"bin": {
|
|
@@ -216,7 +216,10 @@ export function shouldRetryChatInProgressOnSameAccount(
|
|
|
216
216
|
|
|
217
217
|
export function isAccountInitializationError(err: unknown): boolean {
|
|
218
218
|
const message = errMessage(err).toLowerCase();
|
|
219
|
+
const code = errCode(err).toLowerCase();
|
|
219
220
|
return (
|
|
221
|
+
code === "acquire_deadline" ||
|
|
222
|
+
message.includes("acquire deadline") ||
|
|
220
223
|
message.includes("header capture returned incomplete anti-fraud headers") ||
|
|
221
224
|
message.includes("required qwen anti-fraud headers are unavailable") ||
|
|
222
225
|
message.includes("playwright not initialized for account") ||
|
|
@@ -265,6 +265,7 @@ export function loadStorageState(accountId: string): string | undefined {
|
|
|
265
265
|
export async function saveStorageState(
|
|
266
266
|
context: BrowserContext,
|
|
267
267
|
accountId: string,
|
|
268
|
+
timeoutMs = 5_000,
|
|
268
269
|
): Promise<void> {
|
|
269
270
|
try {
|
|
270
271
|
const stateFile = getStorageStatePath(accountId);
|
|
@@ -272,7 +273,11 @@ export async function saveStorageState(
|
|
|
272
273
|
if (!fs.existsSync(dir)) {
|
|
273
274
|
fs.mkdirSync(dir, { recursive: true });
|
|
274
275
|
}
|
|
275
|
-
await
|
|
276
|
+
await withTimeout(
|
|
277
|
+
context.storageState({ path: stateFile }),
|
|
278
|
+
timeoutMs,
|
|
279
|
+
`storageState timed out after ${timeoutMs}ms`,
|
|
280
|
+
);
|
|
276
281
|
} catch (error) {
|
|
277
282
|
console.warn(
|
|
278
283
|
`[Playwright] Failed to save storage state for ${accountId}: ${getErrorMessage(error)}`,
|
|
@@ -280,9 +285,13 @@ export async function saveStorageState(
|
|
|
280
285
|
}
|
|
281
286
|
}
|
|
282
287
|
|
|
283
|
-
async function hasValidAuthCookie(context: BrowserContext): Promise<boolean> {
|
|
288
|
+
async function hasValidAuthCookie(context: BrowserContext, timeoutMs = 3_000): Promise<boolean> {
|
|
284
289
|
try {
|
|
285
|
-
const cookies = await
|
|
290
|
+
const cookies = await withTimeout(
|
|
291
|
+
context.cookies(),
|
|
292
|
+
timeoutMs,
|
|
293
|
+
`cookies check timed out after ${timeoutMs}ms`,
|
|
294
|
+
);
|
|
286
295
|
return cookies.some(
|
|
287
296
|
(c) =>
|
|
288
297
|
(c.name.toLowerCase().includes("token") || c.name.toLowerCase().includes("session")) &&
|