openzoo 0.34.2 → 0.34.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/lib/hosts.js +35 -5
- package/package.json +1 -1
package/lib/hosts.js
CHANGED
|
@@ -258,14 +258,42 @@ export function bindBackend443(modelsPath, logPath, log = console.log) {
|
|
|
258
258
|
// 443, no cursor-backend.log, nothing to read. Send both streams to the log
|
|
259
259
|
// the caller already passes, so a crash is on disk.
|
|
260
260
|
+ `mkdir -p "$(dirname '${logPath}')" 2>/dev/null; `
|
|
261
|
-
|
|
261
|
+
// `nohup VAR=val prog` DOES NOT WORK. nohup execs its first argument as a
|
|
262
|
+
// program; it is not a shell and does not parse leading VAR=val assignments.
|
|
263
|
+
// The old form died instantly with "nohup: OPENZOO_MEMBERSHIP=pro: No such
|
|
264
|
+
// file or directory" — the backend never started, nothing held :443, and
|
|
265
|
+
// before the logging fix above that message went to /dev/null and the
|
|
266
|
+
// failure was invisible. `env` is the program that does understand it.
|
|
267
|
+
+ `nohup env ${memEnv} '${node}' '${script}' 443 '${modelsPath}' '${logPath}' >>'${logPath}' 2>&1 & `
|
|
262
268
|
+ 'sleep 1; true',
|
|
263
269
|
);
|
|
264
270
|
// Report whether it ACTUALLY came up rather than whether sudo exited 0 —
|
|
265
271
|
// `nohup ... &` always succeeds, so `ok` alone said nothing about the bind.
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
272
|
+
//
|
|
273
|
+
// PROBE BY CONNECTING, NOT BY lsof. The backend we just started is ROOT-owned;
|
|
274
|
+
// unprivileged `lsof -iTCP:443` cannot see another user's descriptors and exits
|
|
275
|
+
// 1 even while `netstat -an` shows `*.443 LISTEN`. That false negative made the
|
|
276
|
+
// caller tear down a WORKING setup and print "FAILED to bind" directly under
|
|
277
|
+
// the backend's own "listening on [::]+127.0.0.1:443" log line. A TCP connect
|
|
278
|
+
// is ownership-blind, and it proves the far more useful property anyway: that
|
|
279
|
+
// the socket actually accepts. Try both families — hosts.js pins both.
|
|
280
|
+
const listening = spawnSync(node, ['-e', `
|
|
281
|
+
const net = require('net');
|
|
282
|
+
const hit = (host) => new Promise((r) => {
|
|
283
|
+
const s = net.connect({ host, port: 443 });
|
|
284
|
+
s.setTimeout(1000);
|
|
285
|
+
s.on('connect', () => { s.destroy(); r(true); });
|
|
286
|
+
s.on('error', () => r(false));
|
|
287
|
+
s.on('timeout', () => { s.destroy(); r(false); });
|
|
288
|
+
});
|
|
289
|
+
(async () => {
|
|
290
|
+
for (let i = 0; i < 10; i++) {
|
|
291
|
+
if (await hit('127.0.0.1') || await hit('::1')) process.exit(0);
|
|
292
|
+
await new Promise((r) => setTimeout(r, 500));
|
|
293
|
+
}
|
|
294
|
+
process.exit(1);
|
|
295
|
+
})();
|
|
296
|
+
`], { timeout: 20000 }).status === 0;
|
|
269
297
|
if (!listening) {
|
|
270
298
|
log(` backend did NOT bind :443 — see ${logPath}`);
|
|
271
299
|
try {
|
|
@@ -282,6 +310,8 @@ export function unbindBackend443() {
|
|
|
282
310
|
return { ok: privileged(
|
|
283
311
|
flushPf
|
|
284
312
|
+ "pkill -9 -f 'cursor-backend.js' 2>/dev/null; "
|
|
285
|
-
|
|
313
|
+
// 443 as well as 8443: the backend binds :443 directly now, and this runs
|
|
314
|
+
// under sudo so lsof CAN see the root-owned socket here.
|
|
315
|
+
+ 'for p in $(lsof -nP -iTCP:443 -sTCP:LISTEN -t 2>/dev/null) $(lsof -nP -iTCP:8443 -sTCP:LISTEN -t 2>/dev/null); do kill -9 "$p" 2>/dev/null; done; true',
|
|
286
316
|
) };
|
|
287
317
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openzoo",
|
|
3
|
-
"version": "0.34.
|
|
3
|
+
"version": "0.34.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",
|