openzoo 0.21.7 → 0.21.8
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/setup.js +31 -7
- package/package.json +1 -1
package/lib/setup.js
CHANGED
|
@@ -285,15 +285,39 @@ export async function setupEditor(which, target) {
|
|
|
285
285
|
const models = await catalogModels(base);
|
|
286
286
|
let wrote = null;
|
|
287
287
|
if (editorBase) {
|
|
288
|
+
// UNPIN FIRST — THIS IS THE BUG THAT BROKE THE TUNNEL ALL NIGHT.
|
|
289
|
+
// pinEditorProviderConfig installs a SQL trigger that re-applies the URL it
|
|
290
|
+
// was pinned with on EVERY update to that row. A previous run's trigger
|
|
291
|
+
// therefore silently rewrote each new tunnel URL back to its own, dead one:
|
|
292
|
+
// the banner printed the live tunnel while the DB (and Cursor) got the old
|
|
293
|
+
// hostname, which answered 530. Observed verbatim in one run —
|
|
294
|
+
// tunnel: https://friendly-api-suppliers-suits.trycloudflare.com/v1
|
|
295
|
+
// settings: openAIBaseUrl -> https://motors-multiple-parade-surround...
|
|
296
|
+
// Two hostnames, one run, because the printed value is read BACK from the DB
|
|
297
|
+
// after the trigger has had its say.
|
|
298
|
+
try { unpinEditorProviderConfig(target0); } catch { /* nothing pinned yet */ }
|
|
288
299
|
try { wrote = writeEditorProviderConfig(target0, { baseUrl: editorBase, models, apiKey: tunnelKey }); } catch (e) { wrote = { error: e.message }; }
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
300
|
+
// SELF-HEAL: verify what actually landed, and if anything rewrote it, drop
|
|
301
|
+
// the pin and write again rather than launching an editor we know is
|
|
302
|
+
// pointed at a dead host.
|
|
303
|
+
for (let attempt = 0; attempt < 2 && wrote && !wrote.error; attempt++) {
|
|
304
|
+
const got = wrote.verified?.openAIBaseUrl;
|
|
305
|
+
if (!got || got === editorBase) break;
|
|
306
|
+
console.log(`settings: something rewrote the url (${got}) — unpinning and retrying`);
|
|
307
|
+
try { unpinEditorProviderConfig(target0); } catch { /* ignore */ }
|
|
308
|
+
try { wrote = writeEditorProviderConfig(target0, { baseUrl: editorBase, models, apiKey: tunnelKey }); } catch (e) { wrote = { error: e.message }; }
|
|
309
|
+
}
|
|
296
310
|
const pin = pinEditorProviderConfig(target0, { baseUrl: editorBase, models });
|
|
311
|
+
// A pin that re-applies the WRONG url is worse than no pin at all.
|
|
312
|
+
try {
|
|
313
|
+
const after = writeEditorProviderConfig(target0, { baseUrl: editorBase, models, apiKey: tunnelKey });
|
|
314
|
+
const got = after?.verified?.openAIBaseUrl;
|
|
315
|
+
if (got && got !== editorBase) {
|
|
316
|
+
console.log(`settings: the pin re-applied ${got} — removing it so the live url stands`);
|
|
317
|
+
unpinEditorProviderConfig(target0);
|
|
318
|
+
writeEditorProviderConfig(target0, { baseUrl: editorBase, models, apiKey: tunnelKey });
|
|
319
|
+
}
|
|
320
|
+
} catch { /* advisory */ }
|
|
297
321
|
console.log(` models -> ${models.join(', ')}`);
|
|
298
322
|
console.log(` selected -> ${models[0]}`);
|
|
299
323
|
console.log(pin?.pinned
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openzoo",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.8",
|
|
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",
|