openzoo 0.38.3 → 0.38.5

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.
Files changed (2) hide show
  1. package/lib/grokbot.js +24 -4
  2. package/package.json +1 -1
package/lib/grokbot.js CHANGED
@@ -15,7 +15,7 @@
15
15
  // payment. Pointing base_url at the gateway makes every request fail
16
16
  // "payment required".
17
17
 
18
- import { spawn } from 'node:child_process';
18
+ import { spawn, execSync } from 'node:child_process';
19
19
  import { existsSync, readFileSync, writeFileSync, copyFileSync, mkdirSync } from 'node:fs';
20
20
  import { homedir } from 'node:os';
21
21
  import { join } from 'node:path';
@@ -162,14 +162,34 @@ export async function setupGrokBot(argv = []) {
162
162
  const { startCursorBackend } = await import('./cursorbackend.js');
163
163
  const port = 8443;
164
164
  process.env.OPENZOO_BYOK = '1';
165
+ // LOUD BY DEFAULT. The previous run failed silently — "listening" and then
166
+ // nothing — and silence looked identical to success. Every arriving method
167
+ // is printed so "did it connect at all" is answerable at a glance.
165
168
  startCursorBackend({ port, log: (m) => console.error(` backend: ${m}`) });
166
- console.error('openzoo: BYOK probe — impersonating api2.cursor.sh on :' + port);
169
+ console.error('openzoo: BYOK probe — impersonating api2/api3/api4/repo42.cursor.sh on :' + port);
167
170
  console.error(' scoped to this launch only (no /etc/hosts, no sudo)');
168
171
  console.error(' WATCH: if StreamChat starts arriving at the proxy, inference moved.');
169
172
  console.error(' If only a BYOK settings pane appears, it is xAI-key-only and buys nothing.');
170
- spawn('open', ['-a', APP, '--args',
173
+ // QUIT FIRST — `open -a X --args` is a NO-OP ON A RUNNING APP.
174
+ // macOS just activates the existing instance and drops the args, so the
175
+ // resolver rule never applies and the app keeps talking to the real
176
+ // api2.cursor.sh. MEASURED: the backend logged "listening" and then zero
177
+ // requests, while the app carried on answering normally.
178
+ try {
179
+ execSync('osascript -e \'tell application "Grok Bot" to quit\'', { stdio: 'ignore' });
180
+ } catch { /* not running is fine */ }
181
+ // give it a moment to actually exit before relaunching
182
+ await new Promise((r) => setTimeout(r, 2500));
183
+ // MAP EVERY CURSOR HOST, NOT JUST api2.
184
+ // MEASURED: mapping api2 alone applied cleanly (verified in the running
185
+ // process args) and still produced ZERO requests, because Grok Bot's own
186
+ // surface is api3 — the bundle carries `https://api3.cursor.sh/tev1/v1`.
187
+ // The self-signed cert already covers all four names, so map them all.
188
+ const hosts = ['api2.cursor.sh', 'api3.cursor.sh', 'api4.cursor.sh', 'repo42.cursor.sh'];
189
+ const rules = hosts.map((h) => `MAP ${h} 127.0.0.1:${port}`).join(',');
190
+ spawn('open', ['-n', '-a', APP, '--args',
171
191
  '--ignore-certificate-errors',
172
- `--host-resolver-rules=MAP api2.cursor.sh 127.0.0.1:${port}`,
192
+ `--host-resolver-rules=${rules}`,
173
193
  ], { stdio: 'ignore', detached: true }).unref();
174
194
  // keep this process alive so the backend keeps answering
175
195
  console.error('openzoo: leave this running while Grok Bot is open. ctrl-c stops the');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openzoo",
3
- "version": "0.38.3",
3
+ "version": "0.38.5",
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",