openzoo 0.38.2 → 0.38.4
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/bin/openzoo.js +3 -1
- package/lib/grokbot.js +23 -4
- package/package.json +1 -1
package/bin/openzoo.js
CHANGED
|
@@ -25,7 +25,9 @@ usage:
|
|
|
25
25
|
(claude, aider...) already pointed at the zoo
|
|
26
26
|
npx openzoo grokbot point Grok Bot / the grok CLI at the zoo — GROK MODELS ONLY,
|
|
27
27
|
paid per call by x402 instead of xAI first-party billing,
|
|
28
|
-
then launch it
|
|
28
|
+
then launch it with BYOK interception ON (impersonates
|
|
29
|
+
api2.cursor.sh for that launch only — no /etc/hosts, no sudo).
|
|
30
|
+
--no-byok plain launch · --no-launch config only
|
|
29
31
|
npx openzoo mcp stdio MCP server (tools: zoo_ask, zoo_bind, zoo_models, zoo_wallet, zoo_contexts)
|
|
30
32
|
npx openzoo unblock restore the editor's own backend in the hosts file
|
|
31
33
|
npx openzoo tunnel public-url-only mode (everything key-gated, no keyless localhost)
|
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';
|
|
@@ -143,7 +143,11 @@ export async function setupGrokBot(argv = []) {
|
|
|
143
143
|
|
|
144
144
|
// 3. launch the app if it exists, else the CLI
|
|
145
145
|
if (existsSync(APP)) {
|
|
146
|
-
|
|
146
|
+
// BYOK IS THE DEFAULT. Without it this command only rewrites the CLI's
|
|
147
|
+
// model table, and the APP — the thing you actually look at — keeps talking
|
|
148
|
+
// to Cursor's cloud, which is the whole problem it was meant to solve.
|
|
149
|
+
// --no-byok drops back to plain launch.
|
|
150
|
+
if (!argv.includes('--no-byok')) {
|
|
147
151
|
// BYOK PROBE — NO /etc/hosts, NO sudo.
|
|
148
152
|
//
|
|
149
153
|
// Grok Bot asks aiserver.v1 whether BYOK is allowed (`byok_enabled`,
|
|
@@ -158,17 +162,32 @@ export async function setupGrokBot(argv = []) {
|
|
|
158
162
|
const { startCursorBackend } = await import('./cursorbackend.js');
|
|
159
163
|
const port = 8443;
|
|
160
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.
|
|
161
168
|
startCursorBackend({ port, log: (m) => console.error(` backend: ${m}`) });
|
|
162
169
|
console.error('openzoo: BYOK probe — impersonating api2.cursor.sh on :' + port);
|
|
163
170
|
console.error(' scoped to this launch only (no /etc/hosts, no sudo)');
|
|
164
171
|
console.error(' WATCH: if StreamChat starts arriving at the proxy, inference moved.');
|
|
165
172
|
console.error(' If only a BYOK settings pane appears, it is xAI-key-only and buys nothing.');
|
|
166
|
-
|
|
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
|
+
spawn('open', ['-n', '-a', APP, '--args',
|
|
167
184
|
'--ignore-certificate-errors',
|
|
168
185
|
`--host-resolver-rules=MAP api2.cursor.sh 127.0.0.1:${port}`,
|
|
169
186
|
], { stdio: 'ignore', detached: true }).unref();
|
|
170
187
|
// keep this process alive so the backend keeps answering
|
|
171
|
-
console.error('openzoo: leave this running while
|
|
188
|
+
console.error('openzoo: leave this running while Grok Bot is open. ctrl-c stops the');
|
|
189
|
+
console.error(' backend; the app then reconnects to xAI normally on next launch.');
|
|
190
|
+
console.error(' (skip all of this with --no-byok)');
|
|
172
191
|
await new Promise(() => {});
|
|
173
192
|
return;
|
|
174
193
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openzoo",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.4",
|
|
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",
|