openzoo 0.38.0 → 0.38.2
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/cursorapi.js +29 -0
- package/lib/grokbot.js +29 -0
- package/lib/hosts.js +19 -0
- package/package.json +1 -1
package/lib/cursorapi.js
CHANGED
|
@@ -130,11 +130,40 @@ export function encodeIsOnNewPricing() {
|
|
|
130
130
|
return new Buf().bool(1, false).bool(2, false).bool(3, false).bool(5, false).done();
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
/**
|
|
134
|
+
* BYOK, forced on.
|
|
135
|
+
*
|
|
136
|
+
* Grok Bot (com.anysphere.sand) is Anysphere's app on the SAME aiserver.v1 API
|
|
137
|
+
* Cursor uses, and BYOK there is a SERVER-DELIVERED FLAG, not a local setting:
|
|
138
|
+
* the settings message carries `byok_enabled` at field 14 and `byok_disabled`
|
|
139
|
+
* at field 19 (read from the app bundle). The empty-protobuf default this
|
|
140
|
+
* server returns for unknown methods decodes byok_enabled = false, so BYOK
|
|
141
|
+
* stays hidden unless we say otherwise.
|
|
142
|
+
*
|
|
143
|
+
* UNVERIFIED, AND IT MATTERS: flipping this reveals the BYOK surface, but the
|
|
144
|
+
* ByokEntry message is only { enabled, models[] } — it has NO base_url field.
|
|
145
|
+
* So this may only let you supply an xAI key (still billing xAI) rather than
|
|
146
|
+
* redirect inference to the zoo. Run with OPENZOO_LOG_METHODS=1 and watch
|
|
147
|
+
* whether StreamChat starts arriving here before trusting it.
|
|
148
|
+
*/
|
|
149
|
+
export function encodeByokConfig() {
|
|
150
|
+
return new Buf()
|
|
151
|
+
.bool(14, true) // byok_enabled
|
|
152
|
+
.bool(19, false) // byok_disabled (admin kill-switch)
|
|
153
|
+
.done();
|
|
154
|
+
}
|
|
155
|
+
|
|
133
156
|
/**
|
|
134
157
|
* The bare proto body for a method, or null to fall through to empty-ok.
|
|
135
158
|
* Only the methods that gate entitlement or the model list are populated.
|
|
136
159
|
*/
|
|
137
160
|
export function encodeForMethod(method, models) {
|
|
161
|
+
// Any settings/config-shaped method carries the feature flags; answering the
|
|
162
|
+
// wrong one is harmless (extra fields are ignored by proto), answering none
|
|
163
|
+
// leaves BYOK off.
|
|
164
|
+
if (process.env.OPENZOO_BYOK === '1' && /Config|Settings|FeatureFlags/i.test(method)) {
|
|
165
|
+
return encodeByokConfig();
|
|
166
|
+
}
|
|
138
167
|
switch (method) {
|
|
139
168
|
case 'AvailableModels': return encodeAvailableModels(models);
|
|
140
169
|
case 'GetPlanInfo': return encodeGetPlanInfo();
|
package/lib/grokbot.js
CHANGED
|
@@ -143,6 +143,35 @@ 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
|
+
if (argv.includes('--byok')) {
|
|
147
|
+
// BYOK PROBE — NO /etc/hosts, NO sudo.
|
|
148
|
+
//
|
|
149
|
+
// Grok Bot asks aiserver.v1 whether BYOK is allowed (`byok_enabled`,
|
|
150
|
+
// field 14). Answering that ourselves needs us to BE api2.cursor.sh, and
|
|
151
|
+
// the obvious way — pinning it in /etc/hosts — is exactly what took the
|
|
152
|
+
// app offline for an hour with "Reconnecting to your computer", because
|
|
153
|
+
// the pin is machine-wide and outlives the app.
|
|
154
|
+
//
|
|
155
|
+
// Chromium's own --host-resolver-rules does the same redirect scoped to
|
|
156
|
+
// THIS LAUNCH ONLY. Quit and reopen normally and it is gone; nothing
|
|
157
|
+
// persists, nothing else on the machine is affected, no password needed.
|
|
158
|
+
const { startCursorBackend } = await import('./cursorbackend.js');
|
|
159
|
+
const port = 8443;
|
|
160
|
+
process.env.OPENZOO_BYOK = '1';
|
|
161
|
+
startCursorBackend({ port, log: (m) => console.error(` backend: ${m}`) });
|
|
162
|
+
console.error('openzoo: BYOK probe — impersonating api2.cursor.sh on :' + port);
|
|
163
|
+
console.error(' scoped to this launch only (no /etc/hosts, no sudo)');
|
|
164
|
+
console.error(' WATCH: if StreamChat starts arriving at the proxy, inference moved.');
|
|
165
|
+
console.error(' If only a BYOK settings pane appears, it is xAI-key-only and buys nothing.');
|
|
166
|
+
spawn('open', ['-a', APP, '--args',
|
|
167
|
+
'--ignore-certificate-errors',
|
|
168
|
+
`--host-resolver-rules=MAP api2.cursor.sh 127.0.0.1:${port}`,
|
|
169
|
+
], { stdio: 'ignore', detached: true }).unref();
|
|
170
|
+
// keep this process alive so the backend keeps answering
|
|
171
|
+
console.error('openzoo: leave this running while you test. ctrl-c to stop.');
|
|
172
|
+
await new Promise(() => {});
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
146
175
|
console.error('openzoo: launching Grok Bot...');
|
|
147
176
|
spawn('open', ['-a', APP], { stdio: 'ignore', detached: true }).unref();
|
|
148
177
|
} else {
|
package/lib/hosts.js
CHANGED
|
@@ -137,6 +137,25 @@ export function blockBackend(hosts = BACKEND_HOSTS) {
|
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
if (!pairs.length) return { already: true };
|
|
140
|
+
|
|
141
|
+
// GROK BOT SHARES CURSOR'S BACKEND — REFUSE RATHER THAN BREAK IT.
|
|
142
|
+
// MEASURED 2026-08-16: api2.cursor.sh pinned to 127.0.0.1 by this function
|
|
143
|
+
// took out Grok Bot (bundle com.anysphere.sand, Anysphere's app on Cursor
|
|
144
|
+
// infrastructure) completely — "Reconnecting to your computer...",
|
|
145
|
+
// edge/handler-failed: [unavailable] on every call, and profile writes
|
|
146
|
+
// failing. The user uninstalled and reinstalled the app twice chasing it,
|
|
147
|
+
// because nothing in the app can reveal an OS-level DNS blackhole.
|
|
148
|
+
// This block predates Grok Bot existing, so it never knew to warn.
|
|
149
|
+
if (!process.env.OPENZOO_FORCE_BLOCK && fs.existsSync('/Applications/Grok Bot.app')) {
|
|
150
|
+
console.log('');
|
|
151
|
+
console.log('REFUSING to block the editor backend: Grok Bot is installed.');
|
|
152
|
+
console.log(' Grok Bot runs on the SAME host this would blackhole (api2.cursor.sh),');
|
|
153
|
+
console.log(' so blocking it breaks Grok Bot entirely — it will report');
|
|
154
|
+
console.log(' "Reconnecting to your computer" and edge/handler-failed forever,');
|
|
155
|
+
console.log(' and reinstalling the app cannot fix an /etc/hosts entry.');
|
|
156
|
+
console.log(' Re-run without --block-backend, or set OPENZOO_FORCE_BLOCK=1 to override.');
|
|
157
|
+
return { ok: false, blocked: false, refused: 'grok-bot-installed' };
|
|
158
|
+
}
|
|
140
159
|
const entries = pairs.join('\\n');
|
|
141
160
|
console.log('');
|
|
142
161
|
console.log('blocking the editor\'s backend so it cannot re-sync over your model list.');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openzoo",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.2",
|
|
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",
|