openzoo 0.50.18 → 0.50.19

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.
@@ -342,7 +342,7 @@ async function passthroughToRealAnthropic(req, res, body, host, full, log) {
342
342
  fs.writeFileSync(`${dir}/${Date.now()}_${safe}.bin`, buf);
343
343
  } catch { /* dumping must never break the proxy */ }
344
344
  }
345
- log(`cursor-backend: ${req.method} ${full} -> REAL anthropic (${status}, ${buf.length}b)`);
345
+ log(`cursor-backend: ${req.method} ${full} -> REAL ${host} (${status}, ${buf.length}b)`);
346
346
  } catch (e) {
347
347
  res.writeHead(502, { 'content-type': 'application/json' });
348
348
  res.end(JSON.stringify({ type: 'error', error: { type: 'api_error', message: `passthrough failed: ${e.message}` } }));
@@ -486,6 +486,22 @@ export function startCursorBackend({ port = 8443, models, log = () => {} } = {})
486
486
  return;
487
487
  }
488
488
  log(`cursor-backend: #${conns} ${req.method} ${full} ct=${ct} body=${body.length}b`);
489
+ // OAUTH MUST HIT THE REAL ISSUER. empty-ok on /oauth/token is the
490
+ // "Reconnecting to your computer" / edge/handler-failed loop: the app
491
+ // retries the same 509b body forever and never reaches AvailableModels
492
+ // or EnsureSandBox. Measured live: #14–#88 POST /oauth/token -> empty-ok.
493
+ // Same for the sandbox RPCs unless we are hijacking the pod.
494
+ {
495
+ const path0 = full.split('?')[0];
496
+ const oauth = /^\/oauth(\/|$)/.test(path0);
497
+ const needRealPod = /GrokBotService\/(EnsureSandBox|WatchSandBoxMigration)/.test(full)
498
+ && !process.env.OZ_HIJACK_POD;
499
+ if (oauth || needRealPod) {
500
+ const upstream = /cursor\.sh$/.test(host) ? host : 'api2.cursor.sh';
501
+ await passthroughToRealAnthropic(req, res, body, upstream, full, log);
502
+ return;
503
+ }
504
+ }
489
505
  // HIJACK EnsureSandBox FIRST — before passthrough, or passthrough eats it.
490
506
  // MEASURED: with OPENZOO_PASSTHRU=1 set, EnsureSandBox went `-> REAL
491
507
  // anthropic (200, 707b)` every time and the app got a real cursorvm pod,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openzoo",
3
- "version": "0.50.18",
3
+ "version": "0.50.19",
4
4
  "description": "Local x402-paying proxy + MCP server for openzoo.fun — point any OpenAI-compatible harness (Cursor, Claude Code, aider, SDKs) at localhost and it pays per call from a local burner wallet. Solana and Base rails live; Robinhood experimental.",
5
5
  "license": "MIT",
6
6
  "type": "module",