polydev-ai 1.10.7 → 1.10.9
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/lib/tunnelClient.js +32 -11
- package/package.json +2 -2
package/lib/tunnelClient.js
CHANGED
|
@@ -34,7 +34,7 @@ class TunnelClient {
|
|
|
34
34
|
// Configurable intervals
|
|
35
35
|
this.HEARTBEAT_INTERVAL_MS = 30_000; // 30s
|
|
36
36
|
this.POLL_INTERVAL_MS = 3_000; // 3s
|
|
37
|
-
this.CLI_TIMEOUT_MS =
|
|
37
|
+
this.CLI_TIMEOUT_MS = 300_000; // 5 min per request (generous for slow CLIs like Codex)
|
|
38
38
|
|
|
39
39
|
// Try to load freshest token from file on construction
|
|
40
40
|
// (env var may be stale if process was started long ago)
|
|
@@ -273,16 +273,37 @@ class TunnelClient {
|
|
|
273
273
|
const latencyMs = Date.now() - startTime;
|
|
274
274
|
|
|
275
275
|
if (result.success) {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
276
|
+
// Detect CLI error responses returned as "successful" content
|
|
277
|
+
// (e.g., claude_code returns "Invalid API key" with success=true)
|
|
278
|
+
const content = result.content || '';
|
|
279
|
+
const CLI_ERROR_PATTERNS = [
|
|
280
|
+
'Invalid API key',
|
|
281
|
+
'Authentication required',
|
|
282
|
+
'Please sign in',
|
|
283
|
+
'rate limit exceeded',
|
|
284
|
+
'quota exceeded',
|
|
285
|
+
];
|
|
286
|
+
const isErrorContent = CLI_ERROR_PATTERNS.some(p => content.includes(p));
|
|
287
|
+
|
|
288
|
+
if (isErrorContent) {
|
|
289
|
+
console.error(`[Tunnel] Request ${request.id} CLI returned error as content: ${content.substring(0, 100)}`);
|
|
290
|
+
await this.sendResponse({
|
|
291
|
+
request_id: request.id,
|
|
292
|
+
error: `CLI auth error: ${content}. Re-authenticate your ${request.provider} CLI.`,
|
|
293
|
+
latency_ms: latencyMs,
|
|
294
|
+
});
|
|
295
|
+
} else {
|
|
296
|
+
console.error(`[Tunnel] Request ${request.id} completed (${latencyMs}ms)`);
|
|
297
|
+
await this.sendResponse({
|
|
298
|
+
request_id: request.id,
|
|
299
|
+
content,
|
|
300
|
+
model_used: result.model || result.detectedModel || request.provider,
|
|
301
|
+
tokens_used: result.tokens_used || null,
|
|
302
|
+
input_tokens: result.input_tokens || null,
|
|
303
|
+
output_tokens: result.output_tokens || null,
|
|
304
|
+
latency_ms: latencyMs,
|
|
305
|
+
});
|
|
306
|
+
}
|
|
286
307
|
} else {
|
|
287
308
|
console.error(`[Tunnel] Request ${request.id} CLI error: ${result.error}`);
|
|
288
309
|
await this.sendResponse({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "polydev-ai",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.9",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=20.x <=22.x"
|
|
6
6
|
},
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"marked": "^16.2.1",
|
|
83
83
|
"next": "^15.5.7",
|
|
84
84
|
"open": "^11.0.0",
|
|
85
|
-
"polydev-ai": "^1.10.
|
|
85
|
+
"polydev-ai": "^1.10.8",
|
|
86
86
|
"posthog-js": "^1.157.2",
|
|
87
87
|
"prismjs": "^1.30.0",
|
|
88
88
|
"react": "^18.3.1",
|