polydev-ai 1.10.5 → 1.10.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.
@@ -27,6 +27,10 @@ class TunnelClient {
27
27
  this._started = false;
28
28
  this._consecutive401s = 0; // track auth failures for token reload
29
29
 
30
+ // Cache version at startup — prevents stale processes from misreporting
31
+ // after npm cache is updated by another `npx polydev-ai@latest` invocation
32
+ this._cachedVersion = this._getPackageVersion();
33
+
30
34
  // Configurable intervals
31
35
  this.HEARTBEAT_INTERVAL_MS = 30_000; // 30s
32
36
  this.POLL_INTERVAL_MS = 3_000; // 3s
@@ -171,8 +175,6 @@ class TunnelClient {
171
175
  .filter(([_, s]) => s.available && s.authenticated)
172
176
  .map(([id]) => id);
173
177
 
174
- const packageVersion = this._getPackageVersion();
175
-
176
178
  const url = `${this.serverBaseUrl}/api/tunnel/heartbeat`;
177
179
  const res = await fetch(url, {
178
180
  method: 'POST',
@@ -182,7 +184,7 @@ class TunnelClient {
182
184
  },
183
185
  body: JSON.stringify({
184
186
  available_providers: providers,
185
- client_version: packageVersion,
187
+ client_version: this._cachedVersion,
186
188
  instance_id: this.instanceId,
187
189
  }),
188
190
  });
@@ -251,7 +253,7 @@ class TunnelClient {
251
253
  // Use streaming path ONLY for gemini_cli.
252
254
  // claude_code streaming (--output-format stream-json) produces no NDJSON output
253
255
  // in headless/tunnel mode — the non-streaming sendCliPrompt() path works reliably.
254
- if (request.provider !== 'claude_code' && this.cliManager.supportsStreaming(request.provider)) {
256
+ if (!request._forceNonStreaming && request.provider !== 'claude_code' && this.cliManager.supportsStreaming(request.provider)) {
255
257
  return this.handleStreamingRequest(request);
256
258
  }
257
259
 
@@ -300,12 +302,19 @@ class TunnelClient {
300
302
  }
301
303
 
302
304
  /**
303
- * Handle a streaming-capable tunnel request (Claude Code or Gemini CLI).
305
+ * Handle a streaming-capable tunnel request (Gemini CLI only).
304
306
  * Spawns CLI with stream-json flags, reads NDJSON stdout line-by-line,
305
307
  * extracts text deltas, batches them, and POSTs chunks to /api/tunnel/stream-chunk.
306
308
  * On completion, POSTs final response to /api/tunnel/respond for backward compat.
307
309
  */
308
310
  async handleStreamingRequest(request) {
311
+ // Safety guard: claude_code should NEVER enter this path.
312
+ // Redirect to non-streaming sendCliPrompt() which works reliably.
313
+ if (request.provider === 'claude_code') {
314
+ console.error(`[Tunnel] WARNING: claude_code routed to streaming path — redirecting to non-streaming`);
315
+ return this.handleRequest({ ...request, _forceNonStreaming: true });
316
+ }
317
+
309
318
  const startTime = Date.now();
310
319
  const requestId = request.id;
311
320
  const provider = request.provider;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polydev-ai",
3
- "version": "1.10.5",
3
+ "version": "1.10.6",
4
4
  "engines": {
5
5
  "node": ">=20.x <=22.x"
6
6
  },
@@ -82,6 +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.5",
85
86
  "posthog-js": "^1.157.2",
86
87
  "prismjs": "^1.30.0",
87
88
  "react": "^18.3.1",