openzoo 0.50.16 → 0.50.18
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/x402.js +32 -14
- package/package.json +1 -1
package/lib/x402.js
CHANGED
|
@@ -373,15 +373,15 @@ export async function buildPaymentOnline(connection, keypair, accept) {
|
|
|
373
373
|
// recent blockhash, because a 60-second window beats no payment at all.
|
|
374
374
|
let nonce = null;
|
|
375
375
|
const facilitator = accept?.extra?.facilitator;
|
|
376
|
-
//
|
|
376
|
+
// ON BY DEFAULT — PROVEN ON CHAIN 2026-08-28.
|
|
377
377
|
//
|
|
378
|
-
//
|
|
379
|
-
//
|
|
380
|
-
//
|
|
381
|
-
//
|
|
382
|
-
//
|
|
383
|
-
// OPENZOO_NONCE=
|
|
384
|
-
if (facilitator && process.env.OPENZOO_NONCE
|
|
378
|
+
// It shipped opt-in first because the fallback below covers a missing, slow
|
|
379
|
+
// or exhausted nonce but NOT a malformed nonce transaction: a wrong
|
|
380
|
+
// instruction order or account meta only surfaces at settle time, after the
|
|
381
|
+
// fallback is long past. That risk is now retired by a real settlement —
|
|
382
|
+
// tx 3pJbRH2u…mMWAZ3, instruction 0 `advanceNonceAccount`, err None.
|
|
383
|
+
// OPENZOO_NONCE=0 is the kill switch back to recent blockhashes.
|
|
384
|
+
if (facilitator && process.env.OPENZOO_NONCE !== '0') {
|
|
385
385
|
try {
|
|
386
386
|
const r = await fetch(`${facilitator}/nonce?network=${encodeURIComponent(accept.network)}`, {
|
|
387
387
|
signal: AbortSignal.timeout(4000),
|
|
@@ -433,13 +433,31 @@ export function receiptLine(accept, settle) {
|
|
|
433
433
|
: (Number.isFinite(billed) && billed > 0 && Number.isFinite(direct) ? direct / billed : null);
|
|
434
434
|
// Wallet path: OpenRouter price, plus 33% of savings vs direct when any.
|
|
435
435
|
// Never print extra.markup — that field is leftover 3× and is not the quote.
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
436
|
+
//
|
|
437
|
+
// THE BASIS DECIDES THE CLAIM, NOT THE RATIO'S SIZE.
|
|
438
|
+
//
|
|
439
|
+
// This used to gate the discount purely on `ratio >= 1.05`, which is the
|
|
440
|
+
// wrong test: on the `markup` basis the gateway sets directUsd to its OWN
|
|
441
|
+
// forwarded cost so downstream sums stay like-for-like (quote.ts), and
|
|
442
|
+
// savesVsDirect is computed against that same internal number — so the ratio
|
|
443
|
+
// can read well above 1 while billedUsd and directUsd are IDENTICAL.
|
|
444
|
+
// MEASURED 2026-08-28 on a live short-body call: billed $0.0013178, direct
|
|
445
|
+
// $0.0013178, savesVsDirect 1.457 — and this line printed "1.5× cheaper than
|
|
446
|
+
// direct" on a call that by its own two dollar figures saved nothing.
|
|
447
|
+
//
|
|
448
|
+
// The 402's own `description` already guards this correctly by branching on
|
|
449
|
+
// q.pricing; the receipt did not, so the challenge told the truth and the
|
|
450
|
+
// receipt for the same call did not. Only the counterfactual basis — leCore
|
|
451
|
+
// actually spilled, so "what this would have cost sent whole" is a real
|
|
452
|
+
// computed number — has earned the discount claim.
|
|
453
|
+
const counterfactual = x.pricing === 'counterfactual';
|
|
454
|
+
const saves = !counterfactual
|
|
455
|
+
? ' (at OpenRouter price — nothing to compress; bind a corpus to save)'
|
|
456
|
+
: ratio != null && ratio >= 1.05
|
|
457
|
+
? ` (${ratio.toFixed(1)}× cheaper than direct)`
|
|
458
|
+
: Number.isFinite(saved) && saved > 0
|
|
441
459
|
? ` ($${saved.toFixed(4)} saved vs direct)`
|
|
442
|
-
: ' (at OpenRouter price —
|
|
460
|
+
: ' (at OpenRouter price — nothing to compress; bind a corpus to save)';
|
|
443
461
|
const tx = settle?.transaction || settle?.txHash || settle?.signature;
|
|
444
462
|
const rail = railOf(accept);
|
|
445
463
|
return `paid ${usd}${saves}${rail ? ` · rail ${rail}` : ''}${tx ? ` · tx ${tx}` : ''}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openzoo",
|
|
3
|
-
"version": "0.50.
|
|
3
|
+
"version": "0.50.18",
|
|
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",
|