openzoo 0.50.71 → 0.50.73
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 +2 -0
- package/lib/botlog.js +98 -0
- package/lib/grokcli.js +48 -1
- package/lib/mcpbridge.js +1 -1
- package/package.json +1 -1
package/bin/openzoo.js
CHANGED
|
@@ -97,6 +97,8 @@ usage:
|
|
|
97
97
|
that env — bot bounces it so send works. Already-
|
|
98
98
|
hijacked sessions are left alone.
|
|
99
99
|
--quit force bounce · --no-quit never bounce
|
|
100
|
+
--verbose print every request the app makes
|
|
101
|
+
(default is quiet: milestones + problems)
|
|
100
102
|
--web serve the renderer in a browser instead of
|
|
101
103
|
launching the .app (http://127.0.0.1:4174)
|
|
102
104
|
npx openzoo web Grok Bot renderer in the browser. Same hijack as
|
package/lib/botlog.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What `openzoo bot` prints to a first-time user's terminal.
|
|
3
|
+
*
|
|
4
|
+
* MEASURED 2026-09-01 on a fresh macOS account: the console was ~60 lines of
|
|
5
|
+
* `#N POST /aiserver.v1.…`, `cursor-tls: connected`, `-> empty-ok`, `/health`
|
|
6
|
+
* before the app even painted, and nothing said how to pay. The human's words:
|
|
7
|
+
* "onboarding is not great mate" / "it's not telling me straight up how to pay".
|
|
8
|
+
*
|
|
9
|
+
* Default is QUIET: only milestones and problems. `--verbose` / OPENZOO_DEBUG=1
|
|
10
|
+
* restores the firehose (it is still the right thing for debugging the wire).
|
|
11
|
+
*/
|
|
12
|
+
import { privateKeyToAccount } from 'viem/accounts';
|
|
13
|
+
|
|
14
|
+
const NOISE = [
|
|
15
|
+
/^cursor-backend: #\d+ (GET|POST|PUT|DELETE) /,
|
|
16
|
+
/^cursor-tls:/,
|
|
17
|
+
/-> empty-ok/,
|
|
18
|
+
/-> pod /,
|
|
19
|
+
/-> transcript /,
|
|
20
|
+
/-> getHostStatus/,
|
|
21
|
+
/-> GetMe/,
|
|
22
|
+
/-> WatchSandBoxMigration/,
|
|
23
|
+
/GetGrokBotSendStatus/,
|
|
24
|
+
/listAgents local n=/,
|
|
25
|
+
/discovered roster/,
|
|
26
|
+
/SNIFF real pod/,
|
|
27
|
+
/POST \/oauth\/token/,
|
|
28
|
+
/mcp \S+ (chrome-devtools-mcp exposes|Performance tools|\[chrome-devtools-mcp\] The connecting client)/,
|
|
29
|
+
/ProofNetwork MCP server running/,
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
const MILESTONE = [
|
|
33
|
+
/mcp ready/,
|
|
34
|
+
/mcp \S+ (mode=|FAIL|tools=\d+|re-attach|attached|appeared)/,
|
|
35
|
+
/mcp \S+ To let bots drive your real Chrome/,
|
|
36
|
+
/x402 402|upstream outage|underfunded|wallet/i,
|
|
37
|
+
/ERROR|FAIL|uncaught|rejection|timed out/,
|
|
38
|
+
/wakeups restored|wakeup fire/,
|
|
39
|
+
/ozRevive|ship_|ship:/,
|
|
40
|
+
/sendPrompt done/,
|
|
41
|
+
/create_agent tool|deleteAgents n=/,
|
|
42
|
+
/x_compose|chrome reattach/,
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
/** Pure: should this backend line reach a quiet terminal? */
|
|
46
|
+
export function isBotMilestone(line) {
|
|
47
|
+
const s = String(line || '');
|
|
48
|
+
if (NOISE.some((re) => re.test(s))) return false;
|
|
49
|
+
return MILESTONE.some((re) => re.test(s));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function makeBotLogger({ verbose = false, write = (m) => console.error(m) } = {}) {
|
|
53
|
+
return (m) => {
|
|
54
|
+
if (verbose || isBotMilestone(m)) write(` backend: ${m}`);
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The block a new user needs before anything else. `balances` is optional
|
|
60
|
+
* ({ USDC, TOKEN } in USD) — printed as `?` when unknown so nothing is invented.
|
|
61
|
+
*/
|
|
62
|
+
export const MINTS = {
|
|
63
|
+
USDC: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
|
|
64
|
+
TOKEN: 'EVULoNF4DeMBN4dGiZiDfpiiTfNZgoCvXWWgaV3epump',
|
|
65
|
+
LEOS: '5xgsnby6P9zqGK71J7H4yJLxzqPvNbC7rDZxNzjHmj7e',
|
|
66
|
+
BASE_USDC: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
|
|
67
|
+
};
|
|
68
|
+
export function payBannerLines({ solana, evm, balances = null, whop = 'https://whop.com/staccoverflow/openzoo', chromeMode = 'own-profile', mints = MINTS } = {}) {
|
|
69
|
+
const usd = (v) => (typeof v === 'number' && Number.isFinite(v) ? `$${v >= 0.01 || v === 0 ? v.toFixed(2) : v.toFixed(4)}` : '?');
|
|
70
|
+
const units = (v) => (typeof v === 'number' && Number.isFinite(v) ? `${v} units` : '?');
|
|
71
|
+
const lines = [
|
|
72
|
+
'openzoo: HOW TO PAY — no account, no API key, every call is paid from this wallet:',
|
|
73
|
+
` Solana ${solana}`,
|
|
74
|
+
' send any of these here:',
|
|
75
|
+
` USDC ${mints.USDC}`,
|
|
76
|
+
` TOKEN ${mints.TOKEN} (half price)`,
|
|
77
|
+
` LEOS ${mints.LEOS} (half price)`,
|
|
78
|
+
` Base ${evm}`,
|
|
79
|
+
` USDC ${mints.BASE_USDC}`,
|
|
80
|
+
balances ? ` balance Solana USDC ${usd(balances.USDC)} · TOKEN ${units(balances.TOKEN_UNITS)} · LEOS ${units(balances.LEOS_UNITS)} · Base USDC ${usd(balances.BASE_USDC)} (recheck: openzoo balance)` : ' balance unknown right now — run: openzoo balance',
|
|
81
|
+
` card ${whop} — paste the Solana address above when it asks`,
|
|
82
|
+
];
|
|
83
|
+
if (chromeMode === 'own-profile') {
|
|
84
|
+
lines.push('openzoo: CHROME bots open a blank Chrome until you flip chrome://inspect/#remote-debugging → "Allow remote debugging for this browser", then restart openzoo bot. After that they drive YOUR logged-in Chrome.');
|
|
85
|
+
} else {
|
|
86
|
+
lines.push(`openzoo: CHROME attached to your real browser (${chromeMode}).`);
|
|
87
|
+
}
|
|
88
|
+
lines.push('openzoo: FIRST type in any bot: "set up Grok Ship for ~/path/to/repo" — or just give it work.');
|
|
89
|
+
lines.push('openzoo: QUIET add --verbose to see every request the app makes.');
|
|
90
|
+
return lines;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function walletAddresses(wallet) {
|
|
94
|
+
return {
|
|
95
|
+
solana: wallet.keypair.publicKey.toBase58(),
|
|
96
|
+
evm: privateKeyToAccount(wallet.evmPrivateKey).address,
|
|
97
|
+
};
|
|
98
|
+
}
|
package/lib/grokcli.js
CHANGED
|
@@ -251,7 +251,9 @@ export async function runBot(argv = []) {
|
|
|
251
251
|
const models = [
|
|
252
252
|
'gpt-4o', 'gpt-4o-mini', 'gpt-4-turbo', 'gpt-4.1', 'gpt-4.1-mini', 'gpt-3.5-turbo',
|
|
253
253
|
].map((n) => ({ name: n, label: n }));
|
|
254
|
-
const
|
|
254
|
+
const { makeBotLogger, payBannerLines, walletAddresses } = await import('./botlog.js');
|
|
255
|
+
const verbose = argv.includes('--verbose') || !!process.env.OPENZOO_DEBUG || !!process.env.OPENZOO_VERBOSE;
|
|
256
|
+
const log = makeBotLogger({ verbose });
|
|
255
257
|
const stale = killListen(port);
|
|
256
258
|
if (stale.length) console.error(`openzoo: killed stale hijack on :${port} pids=${stale.join(',')}`);
|
|
257
259
|
try {
|
|
@@ -326,6 +328,51 @@ export async function runBot(argv = []) {
|
|
|
326
328
|
});
|
|
327
329
|
|
|
328
330
|
console.error('openzoo: leave this running. ctrl-c stops the backend.');
|
|
331
|
+
// HOW TO PAY, up front. A first run used to be sixty lines of wire noise and
|
|
332
|
+
// the first 402 was the only thing that ever mentioned money.
|
|
333
|
+
const payBanner = async () => {
|
|
334
|
+
try {
|
|
335
|
+
const { loadOrCreateWallet } = await import('./wallet.js');
|
|
336
|
+
const addrs = walletAddresses(loadOrCreateWallet());
|
|
337
|
+
let balances = null;
|
|
338
|
+
try {
|
|
339
|
+
const { Connection } = await import('@solana/web3.js');
|
|
340
|
+
const { config, FUNDING_ASSETS } = await import('./config.js');
|
|
341
|
+
const { tokenBalance } = await import('./x402.js');
|
|
342
|
+
const { evmTokenBalance } = await import('./evm.js');
|
|
343
|
+
const { loadOrCreateWallet: lw } = await import('./wallet.js');
|
|
344
|
+
const w = lw();
|
|
345
|
+
const conn = new Connection(config.rpcUrl, 'confirmed');
|
|
346
|
+
const within = (p, ms) => Promise.race([p, new Promise((_, rej) => setTimeout(() => rej(new Error('timeout')), ms))]);
|
|
347
|
+
const usdc = FUNDING_ASSETS.find((a) => a.symbol === 'USDC');
|
|
348
|
+
const tok = FUNDING_ASSETS.find((a) => a.symbol === 'TOKEN');
|
|
349
|
+
const leos = FUNDING_ASSETS.find((a) => a.symbol === 'LEOS');
|
|
350
|
+
const [u, t, l] = await within(Promise.all([
|
|
351
|
+
usdc ? tokenBalance(conn, w.keypair.publicKey, usdc.mint) : { ui: 0 },
|
|
352
|
+
tok ? tokenBalance(conn, w.keypair.publicKey, tok.mint) : { ui: 0 },
|
|
353
|
+
leos ? tokenBalance(conn, w.keypair.publicKey, leos.mint) : { ui: 0 },
|
|
354
|
+
]), 6000);
|
|
355
|
+
let baseUsdc = null;
|
|
356
|
+
try {
|
|
357
|
+
const { evmRpcFor, EVM_FUNDING_ASSETS } = await import('./config.js');
|
|
358
|
+
const b = (EVM_FUNDING_ASSETS.base || []).find((a) => a.symbol === 'USDC');
|
|
359
|
+
if (b) {
|
|
360
|
+
const r = await within(evmTokenBalance({ rpcUrl: evmRpcFor('base'), owner: addrs.evm, token: b.address }), 6000);
|
|
361
|
+
const raw = typeof r === 'object' && r !== null ? (r.raw ?? r.ui ?? 0) : r;
|
|
362
|
+
baseUsdc = Number(raw) / 10 ** (b.decimals ?? 6); // raw units → dollars
|
|
363
|
+
}
|
|
364
|
+
} catch { /* base unreachable: print ? */ }
|
|
365
|
+
// TOKEN is priced at the 402, not here: show units, never an invented $.
|
|
366
|
+
balances = { USDC: Number(u?.ui ?? 0), TOKEN_UNITS: t?.ui != null ? Number(t.ui) : null, LEOS_UNITS: l?.ui != null ? Number(l.ui) : null, BASE_USDC: baseUsdc };
|
|
367
|
+
} catch { balances = null; }
|
|
368
|
+
let chromeMode = 'own-profile';
|
|
369
|
+
try { const { chromeStatus } = await import('./mcpbridge.js'); chromeMode = chromeStatus().mode; } catch { /* */ }
|
|
370
|
+
for (const l of payBannerLines({ ...addrs, balances, chromeMode })) console.error(l);
|
|
371
|
+
} catch (e) {
|
|
372
|
+
console.error(`openzoo: (pay banner unavailable: ${e.message}) — run: openzoo balance`);
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
setTimeout(() => { payBanner().catch(() => {}); }, plan.spawn ? 7000 : 2500);
|
|
329
376
|
if (argv.includes('--once')) return;
|
|
330
377
|
await new Promise(() => {});
|
|
331
378
|
}
|
package/lib/mcpbridge.js
CHANGED
|
@@ -349,7 +349,7 @@ async function connectOne(cfg, log) {
|
|
|
349
349
|
try {
|
|
350
350
|
transport.stderr?.on?.('data', (buf) => {
|
|
351
351
|
const line = String(buf).trim().split('\n')[0];
|
|
352
|
-
if (line && !/No handler registered for issue code/.test(line)) log?.(`cursor-backend: mcp ${cfg.name} ${line.slice(0, 160)}`);
|
|
352
|
+
if (line && !/No handler registered for issue code|exposes content of the browser|Performance tools may send|did not negotiate the MCP roots/.test(line)) log?.(`cursor-backend: mcp ${cfg.name} ${line.slice(0, 160)}`);
|
|
353
353
|
});
|
|
354
354
|
} catch { /* */ }
|
|
355
355
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openzoo",
|
|
3
|
-
"version": "0.50.
|
|
3
|
+
"version": "0.50.73",
|
|
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",
|