openzoo 0.51.20 → 0.51.21
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 +17 -18
- package/package.json +1 -1
package/lib/proxy.js
CHANGED
|
@@ -111,10 +111,10 @@ print('\\n'.join(str(p) for p in pids if p != os.getpid()))
|
|
|
111
111
|
return [...seen];
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
114
|
+
// Capture the loaded code version once. An npm update must not make an old
|
|
115
|
+
// running proxy advertise the newly installed version and evade restart.
|
|
116
|
+
const loadedVersion = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version;
|
|
117
|
+
export function packageVersion() { return loadedVersion; }
|
|
118
118
|
|
|
119
119
|
/** True when the listener on this port is THIS openzoo version or newer.
|
|
120
120
|
* Missing / unparseable version is stale (0.49.x answered with no version).
|
|
@@ -139,7 +139,7 @@ export async function oursOn(port = config.port) {
|
|
|
139
139
|
const r = await fetch(`http://127.0.0.1:${Number(port)}${path}`, { signal: AbortSignal.timeout(1500) });
|
|
140
140
|
if (!r.ok) continue;
|
|
141
141
|
const j = await r.json().catch(() => ({}));
|
|
142
|
-
if (attachable(j.
|
|
142
|
+
if (attachable(j.runtimeVersion)) return true;
|
|
143
143
|
} catch { /* try next */ }
|
|
144
144
|
}
|
|
145
145
|
return false;
|
|
@@ -259,12 +259,14 @@ function jsonErr(res, status, message, extraFields = {}) {
|
|
|
259
259
|
*/
|
|
260
260
|
async function snapshotBalances(client) {
|
|
261
261
|
const out = [];
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
262
|
+
const bals = await Promise.allSettled(
|
|
263
|
+
FUNDING_ASSETS.map((a) => tokenBalance(client.connection, client.keypair.publicKey, a.mint)),
|
|
264
|
+
);
|
|
265
|
+
FUNDING_ASSETS.forEach((a, i) => {
|
|
266
|
+
if (bals[i].status === 'fulfilled') {
|
|
267
|
+
out.push({ symbol: a.symbol, ui: Number(bals[i].value.ui ?? 0), chain: 'solana' });
|
|
268
|
+
}
|
|
269
|
+
});
|
|
268
270
|
const owner = client.evmAddress;
|
|
269
271
|
if (owner) {
|
|
270
272
|
await Promise.all(Object.entries(EVM_FUNDING_ASSETS).flatMap(([rail, assets]) => assets.map(async (a) => {
|
|
@@ -568,11 +570,9 @@ export async function startProxy({ silent = false, requireToken = null, sessionM
|
|
|
568
570
|
refreshPrices();
|
|
569
571
|
const money = walletMoney();
|
|
570
572
|
res.writeHead(200, { 'content-type': 'application/json' });
|
|
571
|
-
const
|
|
572
|
-
readFileSync(new URL('../package.json', import.meta.url), 'utf8'),
|
|
573
|
-
);
|
|
573
|
+
const version = packageVersion();
|
|
574
574
|
res.end(JSON.stringify({
|
|
575
|
-
version,
|
|
575
|
+
version, runtimeVersion: version,
|
|
576
576
|
spentUsd: sessionSpent, cogsUsd: sessionCogs, directUsd: sessionDirect, paidCalls,
|
|
577
577
|
creditUsd, chainUsd: money.chainUsd, lastQuoteUsd,
|
|
578
578
|
}));
|
|
@@ -669,12 +669,11 @@ export async function startProxy({ silent = false, requireToken = null, sessionM
|
|
|
669
669
|
'content-type': 'application/json',
|
|
670
670
|
'access-control-allow-origin': '*',
|
|
671
671
|
});
|
|
672
|
-
const
|
|
673
|
-
readFileSync(new URL('../package.json', import.meta.url), 'utf8'),
|
|
674
|
-
);
|
|
672
|
+
const ozVersion = packageVersion();
|
|
675
673
|
res.end(JSON.stringify({
|
|
676
674
|
youAreTalkingTo: 'openzoo proxy',
|
|
677
675
|
version: ozVersion,
|
|
676
|
+
runtimeVersion: ozVersion,
|
|
678
677
|
solana: client.address,
|
|
679
678
|
evm: client.evmAddress,
|
|
680
679
|
yourEndpoint: self,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openzoo",
|
|
3
|
-
"version": "0.51.
|
|
3
|
+
"version": "0.51.21",
|
|
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",
|