openzoo 0.18.9 → 0.18.11

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/proxy.js CHANGED
@@ -285,6 +285,7 @@ export async function startProxy({ silent = false, requireToken = null, sessionM
285
285
  // origin, not off whether the URL exists yet, so there is no startup window
286
286
  // where public traffic slips through ungated.
287
287
  let tunnelGate = null;
288
+ let tunnelError = null;
288
289
 
289
290
  const server = http.createServer(async (req, res) => {
290
291
  // MCP on the SAME port as the proxy. One `npx openzoo` gives a harness
@@ -746,6 +747,10 @@ export async function startProxy({ silent = false, requireToken = null, sessionM
746
747
  log(` (key REQUIRED on the public URL — it spends this wallet; ${Number.isFinite(cap) ? `capped at $${cap.toFixed(2)}/session` : 'NO session cap — OPENZOO_TUNNEL_MAX_USD adds one'},`);
747
748
  log(' OPENZOO_NO_TUNNEL=1 for localhost-only)');
748
749
  } catch (err) {
750
+ // Record it: a caller polling for publicUrl (openzoo cursor) would
751
+ // otherwise spin the full timeout on a tunnel that already died, with
752
+ // silent:true swallowing this very message.
753
+ tunnelError = err.message;
749
754
  log(`public URL unavailable (${err.message}) — localhost still works; OPENZOO_NO_TUNNEL=1 hides this line`);
750
755
  }
751
756
  })();
@@ -760,5 +765,6 @@ export async function startProxy({ silent = false, requireToken = null, sessionM
760
765
  spent: () => sessionSpent,
761
766
  get publicUrl() { return tunnelGate?.publicUrl ?? null; },
762
767
  get tunnelToken() { return tunnelGate?.token ?? null; },
768
+ get tunnelError() { return tunnelError; },
763
769
  };
764
770
  }
package/lib/setup.js CHANGED
@@ -152,17 +152,27 @@ export async function setupEditor(which, target) {
152
152
  const started = await startProxy({ silent: true, autoTunnel: true });
153
153
  publicUrl = started?.publicUrl ?? null;
154
154
  tunnelKey = started?.tunnelToken ?? null;
155
- // Wait for cloudflared to publish the URL. It downloads on first run and
156
- // routinely takes 30-45s; a 10s wait meant the tunnel line simply never
157
- // printed and the user never learned the public URL existed.
158
- process.stdout.write('waiting for tunnel');
159
- for (let i = 0; i < 120 && !publicUrl; i++) {
160
- await new Promise((r) => setTimeout(r, 500));
161
- publicUrl = started?.publicUrl ?? null;
162
- tunnelKey = started?.tunnelToken ?? null;
163
- if (i % 4 === 3) process.stdout.write('.');
155
+ // DO NOT BLOCK ON THE TUNNEL. Everything below (settings, MCP, launching
156
+ // the editor) is local and works without it; only a CLOUD-run harness needs
157
+ // the public URL. Waiting inline meant a slow or failing cloudflared left
158
+ // the user staring at "waiting for tunnel.." while nothing else happened —
159
+ // and if it never came up, the editor never launched at all. Announce it
160
+ // when it arrives instead.
161
+ if (!publicUrl) {
162
+ const started0 = started;
163
+ (async () => {
164
+ for (let i = 0; i < 240; i++) { // up to 2 min, in the background
165
+ await new Promise((r) => setTimeout(r, 500));
166
+ if (started0?.publicUrl) {
167
+ console.log('');
168
+ console.log(`tunnel: ${started0.publicUrl}/v1 api_key ${started0.tunnelToken}`);
169
+ console.log(' (for a cloud-run harness — it cannot reach localhost)');
170
+ return;
171
+ }
172
+ }
173
+ console.log('tunnel: still not up — localhost is unaffected; OPENZOO_NO_TUNNEL=1 to skip it');
174
+ })();
164
175
  }
165
- process.stdout.write(publicUrl ? ' ok\n' : ' (not up yet — it will print in this terminal when ready)\n');
166
176
  } else {
167
177
  console.log(`proxy already running on ${base}`);
168
178
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openzoo",
3
- "version": "0.18.9",
3
+ "version": "0.18.11",
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",