openzoo 0.30.2 → 0.30.3
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/launch.js +21 -21
- package/package.json +1 -1
package/lib/launch.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* harness with the two env vars set. The proxy must already be running
|
|
10
10
|
* (`npx openzoo` in another terminal); we check first and say so if not.
|
|
11
11
|
*/
|
|
12
|
-
import { spawn } from 'node:child_process';
|
|
12
|
+
import { spawn, spawnSync } from 'node:child_process';
|
|
13
13
|
import fs from 'node:fs';
|
|
14
14
|
import os from 'node:os';
|
|
15
15
|
import path from 'node:path';
|
|
@@ -84,29 +84,29 @@ export async function launchClaude(argv) {
|
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
// DESKTOP
|
|
87
|
+
// DESKTOP, ROUTED THROUGH THE ZOO.
|
|
88
88
|
//
|
|
89
|
-
//
|
|
90
|
-
//
|
|
91
|
-
//
|
|
92
|
-
// .
|
|
93
|
-
//
|
|
94
|
-
//
|
|
95
|
-
//
|
|
96
|
-
//
|
|
89
|
+
// The force-quit was NOT Launch Services — it was the single-instance lock:
|
|
90
|
+
// spawning the bundle binary while a Claude instance is already running makes
|
|
91
|
+
// the new process detect the existing one and immediately exit ("force
|
|
92
|
+
// quited"). `open -a` dodges that but hands off to launchd and DROPS our env,
|
|
93
|
+
// so ANTHROPIC_BASE_URL never reaches the app and it cannot route.
|
|
94
|
+
//
|
|
95
|
+
// To get BOTH — no force-quit AND our env — quit any running instance first,
|
|
96
|
+
// then spawn the bundle binary directly with the env set. Whether the desktop
|
|
97
|
+
// app honours ANTHROPIC_BASE_URL is up to the app; this at least gives it the
|
|
98
|
+
// variable, which `open` never could.
|
|
99
|
+
const app = resolveClaudeDesktop();
|
|
100
|
+
if (!app) { console.error('openzoo: Claude desktop app not found — install it, or use `npx openzoo claude --terminal`'); process.exit(1); }
|
|
97
101
|
if (process.platform === 'darwin') {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
child.unref();
|
|
104
|
-
return;
|
|
102
|
+
// Quit a running instance so the fresh one is not killed by the single-
|
|
103
|
+
// instance lock. `osascript quit` is graceful; pkill is the backstop.
|
|
104
|
+
try { spawnSync('osascript', ['-e', 'tell application "Claude" to quit'], { stdio: 'ignore', timeout: 4000 }); } catch { /* not running */ }
|
|
105
|
+
try { spawnSync('pkill', ['-x', 'Claude'], { stdio: 'ignore' }); } catch { /* already gone */ }
|
|
106
|
+
await new Promise((r) => setTimeout(r, 800));
|
|
105
107
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
if (!app) { console.error('openzoo: Claude desktop app not found — use `npx openzoo claude --terminal` for the CLI'); process.exit(1); }
|
|
109
|
-
console.error(`openzoo: Claude desktop (ANTHROPIC_BASE_URL=${base}); --terminal is the guaranteed-x402 path.`);
|
|
108
|
+
console.error(`openzoo: Claude desktop with ANTHROPIC_BASE_URL=${base} (quit any running instance first).`);
|
|
109
|
+
console.error(' if the desktop app ignores that variable, use --terminal for guaranteed x402.');
|
|
110
110
|
const child = spawn(app, rest, { stdio: 'ignore', env, detached: true });
|
|
111
111
|
child.on('error', (e) => console.error(`openzoo: could not launch Claude desktop: ${e.message}`));
|
|
112
112
|
child.unref();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openzoo",
|
|
3
|
-
"version": "0.30.
|
|
3
|
+
"version": "0.30.3",
|
|
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",
|