openzoo 0.25.0 → 0.27.0
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 +5 -4
- package/lib/proxy.js +13 -4
- package/lib/setup.js +19 -2
- package/package.json +1 -1
package/bin/openzoo.js
CHANGED
|
@@ -12,10 +12,11 @@ usage:
|
|
|
12
12
|
a missing dir is created)
|
|
13
13
|
--profile use an isolated editor profile the
|
|
14
14
|
vendor account cannot re-sync over
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
--block-backend OPT-IN: point cursor's own backend
|
|
16
|
+
at 127.0.0.1 so it cannot re-sync over your
|
|
17
|
+
model list. WARNING: that host also serves
|
|
18
|
+
cursor's own catalog, so the picker may show
|
|
19
|
+
only "Auto". Undo: npx openzoo unblock
|
|
19
20
|
npx openzoo vscode [path] same, for VS Code
|
|
20
21
|
npx openzoo editor [path] whichever is installed (Cursor wins if both)
|
|
21
22
|
npx openzoo launch <cmd> [args] launch a TERMINAL Messages API client
|
package/lib/proxy.js
CHANGED
|
@@ -268,6 +268,12 @@ async function maybeCacheCorpus(req, bodyBuf, log) {
|
|
|
268
268
|
export async function startProxy({ silent = false, requireToken = null, sessionMaxUsd = null, autoTunnel = false } = {}) {
|
|
269
269
|
const client = new PayClient();
|
|
270
270
|
const log = silent ? () => {} : (...a) => console.log(...a);
|
|
271
|
+
// ALWAYS-ON. `silent: true` is used by the editor path to keep startup tidy,
|
|
272
|
+
// but it also swallowed the per-request lines and the payment receipts — so the
|
|
273
|
+
// terminal sat blank and there was no way to tell a working setup from an editor
|
|
274
|
+
// quietly answering from its own backend. Traffic and receipts are the whole
|
|
275
|
+
// point of watching this window; they are never silenced.
|
|
276
|
+
const say = (...a) => console.log(...a);
|
|
271
277
|
let sessionSpent = 0;
|
|
272
278
|
let tunnelSpent = 0;
|
|
273
279
|
// Live balance refresh state — the real implementation is assigned in the
|
|
@@ -472,7 +478,10 @@ export async function startProxy({ silent = false, requireToken = null, sessionM
|
|
|
472
478
|
// carries a model field, not just chat/completions, so /completions,
|
|
473
479
|
// /responses and future shapes all work. Never silent.
|
|
474
480
|
let wantsStream = false;
|
|
475
|
-
if ((req.url || '').includes('/chat/completions') && req.method === 'POST')
|
|
481
|
+
if ((req.url || '').includes('/chat/completions') && req.method === 'POST') {
|
|
482
|
+
servedRequests += 1;
|
|
483
|
+
say(`\n<- request #${servedRequests} from ${(req.headers['user-agent'] || 'unknown').slice(0, 40)}`);
|
|
484
|
+
}
|
|
476
485
|
if (rewritablePath(req.method, req.url)) {
|
|
477
486
|
const rw = await maybeRewriteModel(bodyBuf);
|
|
478
487
|
if (rw) {
|
|
@@ -581,9 +590,9 @@ export async function startProxy({ silent = false, requireToken = null, sessionM
|
|
|
581
590
|
}
|
|
582
591
|
const line = receipt.ok ? receipt.line : `paid retry -> HTTP ${receipt.status}`;
|
|
583
592
|
// Wherever a running total is the thing to watch, it rides the receipt.
|
|
584
|
-
if (requireToken)
|
|
585
|
-
else if (viaTunnel)
|
|
586
|
-
else
|
|
593
|
+
if (requireToken) say(`${line} · session $${sessionSpent.toFixed(6)}`);
|
|
594
|
+
else if (viaTunnel) say(`${line} · public-url session $${tunnelSpent.toFixed(6)}`);
|
|
595
|
+
else say(line);
|
|
587
596
|
scheduleRefresh(4000); // settlement lands on-chain in a few seconds
|
|
588
597
|
}
|
|
589
598
|
// Chat completions come back as one JSON object (settle-before-serve).
|
package/lib/setup.js
CHANGED
|
@@ -420,13 +420,30 @@ export async function setupEditor(which, target) {
|
|
|
420
420
|
// route its own inference takes. Blackholing it in the hosts file is what
|
|
421
421
|
// leaves the configured base URL as the only way out. System-wide and
|
|
422
422
|
// needs a password, so it is opt-in and reversible.
|
|
423
|
-
|
|
423
|
+
// THE BACKEND BLOCK IS NOW OPT-IN — it was doing more harm than good.
|
|
424
|
+
//
|
|
425
|
+
// Blackholing api2.cursor.sh stopped the editor re-syncing its model list over
|
|
426
|
+
// ours, which was real. But that same host serves the editor's OWN catalog and
|
|
427
|
+
// auth, so blocking it means the picker cannot populate — the symptom is a
|
|
428
|
+
// picker showing only "Auto" and every named model "unavailable". It also
|
|
429
|
+
// re-applied itself on every run, so a user who removed the line by hand got it
|
|
430
|
+
// straight back and could not tell why.
|
|
431
|
+
// Routing does not need it: the editor honours the custom base URL on its own.
|
|
432
|
+
if (target0 === 'cursor' && process.argv.includes('--block-backend')) {
|
|
424
433
|
const { blockBackend, isBlocked } = await import('./hosts.js');
|
|
425
434
|
const r = blockBackend();
|
|
426
435
|
if (r.already) console.log('backend: already blocked (npx openzoo unblock to restore)');
|
|
427
|
-
else console.log(`backend: ${isBlocked() ? 'blocked -> 127.0.0.1' : 'NOT blocked
|
|
436
|
+
else console.log(`backend: ${isBlocked() ? 'blocked -> 127.0.0.1' : 'NOT blocked'}`);
|
|
437
|
+
} else if (target0 === 'cursor') {
|
|
438
|
+
const { isBlocked } = await import('./hosts.js');
|
|
439
|
+
if (isBlocked()) {
|
|
440
|
+
console.log('backend: BLOCKED in /etc/hosts from an earlier run.');
|
|
441
|
+
console.log(' That stops the editor loading its own model catalog — if the picker');
|
|
442
|
+
console.log(' shows only "Auto", this is why. Undo with: npx openzoo unblock');
|
|
443
|
+
}
|
|
428
444
|
}
|
|
429
445
|
|
|
446
|
+
|
|
430
447
|
// 3. LAUNCH with that env. Editor resolved platform-agnostically; Cursor
|
|
431
448
|
// wins when both are installed.
|
|
432
449
|
// Open the directory you ran this from, or the one you named. The earlier
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openzoo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
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",
|