z-zero-mcp-server 1.12.5 → 1.12.7

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.
@@ -496,11 +496,22 @@ async function cancelTokenRemote(token) {
496
496
  });
497
497
  if (data?.error)
498
498
  return data;
499
+ // The refund is SENT only when the server names its transaction. With none, the card is
500
+ // closed but the money has not moved yet: held for a check (the issuer reported activity
501
+ // on the card, or a daily limit was reached) or waiting for a retry. Until 1.12.6 this
502
+ // function said "refunded on-chain" either way, and dropped the unused-card fee and rule
503
+ // the server sends — so cancel_payment_token never told the agent a fee had been kept.
504
+ const sent = typeof data?.tx_hash === "string" && data.tx_hash.length > 0;
499
505
  return {
500
506
  success: !!data,
501
507
  refunded_amount: data?.refunded_amount || 0,
502
- tx_hash: data?.tx_hash || null, // On-chain refund tx hash
503
- note: 'Stablecoin (USDC) refunded on-chain to your Base wallet.'
508
+ tx_hash: sent ? data.tx_hash : null,
509
+ refund_sent: sent,
510
+ ...(data?.unused_card_fee ? { unused_card_fee: data.unused_card_fee } : {}),
511
+ ...(data?.unused_card_policy ? { unused_card_policy: data.unused_card_policy } : {}),
512
+ note: sent
513
+ ? 'Stablecoin (USDC) refunded on-chain to your Base wallet.'
514
+ : 'The card is closed, but the refund has NOT been sent yet: it is held for a check or will be retried automatically. The money is not in the wallet yet.',
504
515
  };
505
516
  }
506
517
  // ──────────────────────────────────────────────────────────────────────────────
package/dist/index.js CHANGED
@@ -364,6 +364,11 @@ server.registerTool("request_payment_token", {
364
364
  .max(50)
365
365
  .optional()
366
366
  .describe("RECOMMENDED: the items you are buying, as the USER agreed to them. This becomes a signed intent bound to the card — proof of what was authorized."),
367
+ currency: zod_1.z
368
+ .string()
369
+ .regex(/^[A-Za-z]{3}$/, "3-letter currency code, e.g. 'JPY'")
370
+ .optional()
371
+ .describe("Only when the cart's unit prices are NOT in US dollars: the currency they are in (ISO 4217, e.g. 'JPY', 'EUR'). `amount` is always USD. Leave it out for a USD shop."),
367
372
  ship_to: zod_1.z
368
373
  .string()
369
374
  .optional()
@@ -394,7 +399,7 @@ server.registerTool("request_payment_token", {
394
399
  idempotentHint: false,
395
400
  openWorldHint: true,
396
401
  },
397
- }, async ({ card_alias, amount, merchant, merchant_country, cart, ship_to, criteria, deal, list_total }) => {
402
+ }, async ({ card_alias, amount, merchant, merchant_country, cart, ship_to, criteria, deal, list_total, currency }) => {
398
403
  // An ordinary purchase names its amount; a deal order names its items and the checkout
399
404
  // total and lets the server compute the amount. One or the other — refused here, before
400
405
  // anything is sent.
@@ -421,6 +426,9 @@ server.registerTool("request_payment_token", {
421
426
  : undefined,
422
427
  ship_to,
423
428
  criteria,
429
+ // The server reads unit prices as USD unless told otherwise (it refuses a card
430
+ // smaller than the cart it was shown). Sent only for a non-USD cart.
431
+ ...(currency && currency.toUpperCase() !== "USD" ? { currency: currency.toUpperCase() } : {}),
424
432
  }
425
433
  : undefined;
426
434
  const token = await issueTokenRemote(card_alias, isDeal ? undefined : amount, merchant, intentInput, {
@@ -816,14 +824,18 @@ server.registerTool("execute_payment", {
816
824
  page_shows: zod_1.z
817
825
  .string()
818
826
  .min(1)
819
- .describe("What is ACTUALLY on the page in front of you right now — item, variant, quantity, final total. Describe it, do not summarise it as 'looks right'."),
827
+ // The last sentence: this text goes into the signed receipt, which anyone with the
828
+ // link can open. A real receipt (26/11/2026) carried the recipient's name and
829
+ // street because the agent described the delivery in full. The dashboard masks it
830
+ // when showing a receipt; this keeps it from being written in the first place.
831
+ .describe("What is ACTUALLY on the page in front of you right now — item, variant, quantity, price and final total. Describe it, do not summarise it as 'looks right'. About the delivery, say only whether it matches what your owner gave you — never the recipient's name, street, email or phone: this text is signed into a receipt anyone with the link can open."),
820
832
  decision: zod_1.z
821
833
  .enum(["go", "pause"])
822
834
  .describe("go = pay it. pause = something is off; nothing is charged, the card is not typed in, the money stays put and you tell your owner."),
823
835
  why: zod_1.z
824
836
  .string()
825
837
  .optional()
826
- .describe("Required when you pause: what did not line up."),
838
+ .describe("Required when you pause: what did not line up. Same rule as page_shows: no recipient name, street, email or phone."),
827
839
  })
828
840
  .optional()
829
841
  .describe("Your answer to the purpose check. Omit it on the first call — this tool will hand you the owner's locked criteria to read, then you call again with this."),
@@ -1253,7 +1265,10 @@ server.registerTool("cancel_payment_token", {
1253
1265
  refunded_amount: result.refunded_amount,
1254
1266
  ...(result.unused_card_fee ? { unused_card_fee: result.unused_card_fee } : {}),
1255
1267
  reason,
1256
- message: `Token cancelled. $${result.refunded_amount} has been returned to the wallet.`
1268
+ refund_sent: result.refund_sent !== false,
1269
+ message: (result.refund_sent === false
1270
+ ? `Token cancelled. The $${result.refunded_amount} refund has NOT been sent yet — it is held for a check or will be retried automatically, and is not in the wallet yet. Tell the user; no action is needed from you.`
1271
+ : `Token cancelled. $${result.refunded_amount} has been returned to the wallet.`)
1257
1272
  + (result.unused_card_fee ? ` An unused-card fee of $${result.unused_card_fee} was kept — tell the user.` : "")
1258
1273
  + " You may request a new token with the correct amount.",
1259
1274
  ...(result.unused_card_policy ? { unused_card_policy: result.unused_card_policy } : {}),
@@ -1501,6 +1516,7 @@ server.registerTool("auto_pay_checkout", {
1501
1516
  description: "⚠️ MANDATORY: Read mcp://resources/sop first. One call for a PAYMENT page whose final total is already visible (digital goods / SaaS): issues a JIT card and completes the payment. " +
1502
1517
  "You MUST pass max_amount: the most, in US dollars, the owner agreed to pay for this — read the total on the page yourself, convert it to USD if the page is in another currency, and include tax/shipping. " +
1503
1518
  "The card is never larger than max_amount. On a USD page Z-Zero also reads the visible total and stops (no card) if it is above max_amount or cannot be read. " +
1519
+ "If Pay was pressed and no confirmation was seen, the status is UNCONFIRMED and the card is KEPT (an order may exist): the result hands you the token — verify, then cancel_payment_token if there is no order. Any other failure cancels the card for you. " +
1504
1520
  "Card only: it never sends crypto to an address found on a page. For physical goods (Shopify, Etsy), use get_merchant_hints + request_payment_token + execute_payment instead.",
1505
1521
  inputSchema: {
1506
1522
  checkout_url: zod_1.z
@@ -1609,7 +1625,17 @@ server.registerTool("auto_pay_checkout", {
1609
1625
  }, true);
1610
1626
  }
1611
1627
  // STEP 2: issue the card (limit = issueAmount ≤ max_amount ≤ $50).
1612
- const token = await issueTokenRemote(card_alias, issueAmount, checkout_url);
1628
+ // The card is locked to the store's HOST, so the host is what is sent — not the whole
1629
+ // checkout link. The server takes at most 200 characters there, and a real Shopify
1630
+ // checkout link (cart key + prefilled address) is longer: the first real-money run of
1631
+ // this tool (28/11/2026) stopped right here with "merchant must be … max 200 chars".
1632
+ const merchantHost = (() => { try {
1633
+ return new URL(checkout_url).hostname;
1634
+ }
1635
+ catch {
1636
+ return checkout_url;
1637
+ } })();
1638
+ const token = await issueTokenRemote(card_alias, issueAmount, merchantHost);
1613
1639
  if (token?.error === "AUTH_REQUIRED")
1614
1640
  return authRequiredResult(token.message);
1615
1641
  if (!token || token.error) {
@@ -1636,15 +1662,26 @@ server.registerTool("auto_pay_checkout", {
1636
1662
  }
1637
1663
  // STEP 4: fill the form (reusing the same page).
1638
1664
  const fillResult = await (0, playwright_bridge_js_1.fillCheckoutForm)(checkout_url, cardData, page);
1639
- // Burn ONLY on a confirmed charge. Any other outcome releases the JIT token.
1665
+ // Three ways out, the same as execute_payment (until 1.12.6 this tool had two: paid, or
1666
+ // "cancel the card whatever happened" — independent review, 27/11/2026):
1667
+ // confirmed → record it, and say so if the server could not;
1668
+ // unconfirmed → Pay was pressed and nothing came back. An order MAY exist, so the
1669
+ // card is KEPT: closing it could fail a charge the shop takes a
1670
+ // moment later, and would file a card that was used as "unused".
1671
+ // The token goes back to the agent, who verifies and then cancels.
1672
+ // anything else (declined, no fields, blocked, …) → no order can exist: cancel now.
1640
1673
  let autoReceipt = null;
1674
+ let recorded = null;
1675
+ let released = null;
1676
+ const confirmed = fillResult.success && fillResult.status === 'confirmed';
1677
+ const keptForCheck = !confirmed && fillResult.status === 'unconfirmed';
1641
1678
  // Same rule as execute_payment: burning needs both the flag and the
1642
1679
  // observed status to say confirmed (backtest E07).
1643
- if (fillResult.success && fillResult.status === 'confirmed') {
1680
+ if (confirmed) {
1644
1681
  tokenSettled = true;
1645
- const burnOk = await burnTokenRemote(token.token, fillResult.receipt_id);
1646
- if (!burnOk)
1647
- console.error(`[WARN] Token burn failed for …${String(token.token).slice(-6)} — manual check needed`);
1682
+ recorded = await recordPaymentRemote(token.token, fillResult.receipt_id);
1683
+ if (!recorded.recorded)
1684
+ console.error(`[WARN] Payment of …${String(token.token).slice(-6)} was confirmed by the shop but not recorded by the server — manual check needed`);
1648
1685
  // Signed receipt (Primitive 3) — never blocks the confirmed result
1649
1686
  autoReceipt = await postReceiptRemote({
1650
1687
  token: token.token,
@@ -1655,9 +1692,14 @@ server.registerTool("auto_pay_checkout", {
1655
1692
  }).catch(() => null);
1656
1693
  }
1657
1694
  else {
1658
- // Release the freshly-issued JIT token so the funds don't sit locked on a non-payment.
1659
- await cancelTokenRemote(token.token).catch(() => { });
1660
- tokenSettled = true;
1695
+ if (keptForCheck) {
1696
+ tokenSettled = true; // deliberately NOT cancelled — see above
1697
+ }
1698
+ else {
1699
+ // Release the freshly-issued JIT token so the funds don't sit locked on a non-payment.
1700
+ released = await cancelTokenRemote(token.token).catch(() => null);
1701
+ tokenSettled = true;
1702
+ }
1661
1703
  // 📊 Auto-label the failed run (Primitive 2 corpus)
1662
1704
  const label = (0, failure_taxonomy_js_1.classifyBridgeResult)(fillResult.status, fillResult.message);
1663
1705
  if (label) {
@@ -1673,9 +1715,47 @@ server.registerTool("auto_pay_checkout", {
1673
1715
  });
1674
1716
  }
1675
1717
  }
1718
+ // What became of the card and its hold, in words that are true for each case.
1719
+ const releaseSaid = keptForCheck
1720
+ ? "The card was NOT cancelled: Pay was pressed, so an order may exist."
1721
+ : !released || released.error || !released.success
1722
+ ? "The card could not be cancelled automatically — call cancel_payment_token with the token below."
1723
+ : released.refund_sent === false
1724
+ ? "The card was cancelled; its refund has NOT been sent yet (held for a check, or retried automatically) and is not in the wallet yet." + (released.unused_card_fee ? ` An unused-card fee of $${released.unused_card_fee} was kept — tell the user.` : "")
1725
+ : `The card was cancelled and $${released.refunded_amount} returned to the wallet.` + (released.unused_card_fee ? ` An unused-card fee of $${released.unused_card_fee} was kept — tell the user.` : "");
1726
+ const cancelFailed = !confirmed && !keptForCheck && (!released || released.error || !released.success);
1727
+ // The visible USD total is what the shop charges; a card issued above it leaves a surplus.
1728
+ const charged = detected && !nonUsd ? detected.amount : undefined;
1729
+ const surplus = confirmed && charged !== undefined ? Math.max(0, Math.round((issueAmount - charged) * 100) / 100) : 0;
1676
1730
  return reply({
1677
1731
  route: "CARD",
1678
- status: fillResult.success ? "SUCCESS" : (fillResult.status || "FILL_FAILED").toUpperCase(),
1732
+ status: confirmed ? "SUCCESS" : (fillResult.status || "FILL_FAILED").toUpperCase(),
1733
+ ...(confirmed ? { token_status: recorded?.recorded ? "BURNED" : "PAID_BUT_NOT_RECORDED" } : {}),
1734
+ ...(keptForCheck ? {
1735
+ token_status: "ACTIVE",
1736
+ token: token.token,
1737
+ next: "Do NOT pay again. Check whether the order exists (the shop's confirmation page, the order email, or the owner). If it does NOT, call cancel_payment_token with this token to get the hold back; if it does, tell the owner and leave the card alone.",
1738
+ } : {}),
1739
+ ...(cancelFailed ? { token_status: "ACTIVE", token: token.token } : {}),
1740
+ ...(!confirmed && !keptForCheck && !cancelFailed ? { token_status: "CANCELLED", refund_sent: released?.refund_sent !== false } : {}),
1741
+ ...(released?.unused_card_fee ? { unused_card_fee: released.unused_card_fee } : {}),
1742
+ ...(released?.unused_card_policy ? { unused_card_policy: released.unused_card_policy } : {}),
1743
+ ...(confirmed && recorded && !recorded.recorded ? {
1744
+ not_recorded: {
1745
+ what: "The shop CONFIRMED this payment and the card has been charged, but Z-ZERO's server did not record it after " + recorded.attempts + " attempts.",
1746
+ server_said: [recorded.status ?? "no answer", recorded.error ?? ""].join(" ").trim(),
1747
+ do: "Tell your owner now, with the order id and this message. The order at the shop is real.",
1748
+ do_not: "Do NOT pay again, and do NOT cancel anything for it: the money is with the shop, not on hold.",
1749
+ },
1750
+ } : {}),
1751
+ ...(surplus > 0 ? {
1752
+ surplus: {
1753
+ card_amount: issueAmount,
1754
+ charged,
1755
+ coming_back: surplus,
1756
+ when: "Not yet. The unused part of the hold returns to the wallet after the shop settles the charge with the card issuer — usually 1 to 3 days. Nothing to do; do not cancel or re-request anything for it.",
1757
+ },
1758
+ } : {}),
1679
1759
  max_amount,
1680
1760
  detected_price: detected ? detected.amount : null,
1681
1761
  detected_currency: detected ? (nonUsd ? "NON_USD" : "USD") : null,
@@ -1685,9 +1765,9 @@ server.registerTool("auto_pay_checkout", {
1685
1765
  : (issueAmount > (detected?.amount ?? issueAmount)
1686
1766
  ? `Locked $${issueAmount} = visible $${detected?.amount} + rounding buffer (never above max_amount); the unspent part returns after the charge settles.`
1687
1767
  : undefined),
1688
- message: fillResult.success
1689
- ? `✅ Confirmed: JIT card issued (limit $${issueAmount}) and the merchant showed an order confirmation.`
1690
- : `❌ Not confirmed (${fillResult.status}): ${(0, failure_taxonomy_js_1.redactCardData)(fillResult.message)} Token released.`,
1768
+ message: confirmed
1769
+ ? `✅ Confirmed: JIT card issued (limit $${issueAmount}) and the merchant showed an order confirmation. ${(0, failure_taxonomy_js_1.redactCardData)(fillResult.message)}`
1770
+ : `❌ Not confirmed (${fillResult.status}): ${(0, failure_taxonomy_js_1.redactCardData)(fillResult.message)} ${releaseSaid}`,
1691
1771
  ...untrusted(fillResult.page_detail),
1692
1772
  // Order number as read off the page: page data, already card-scrubbed.
1693
1773
  receipt_id: fillResult.receipt_id || null,
@@ -1699,7 +1779,7 @@ server.registerTool("auto_pay_checkout", {
1699
1779
  verify_url: autoReceipt.verify_url || null,
1700
1780
  },
1701
1781
  } : {}),
1702
- }, !fillResult.success);
1782
+ }, !confirmed);
1703
1783
  }
1704
1784
  catch (err) {
1705
1785
  const raw = err?.message || String(err);
@@ -123,7 +123,9 @@ async function extractTotalPrice(page) {
123
123
  if (el.children.length >= 5)
124
124
  continue;
125
125
  const t = textOf(el).toLowerCase();
126
- if ((t.includes("total") || t.includes("amount due") || t.includes("you pay")) && t.length < 200 && visible(el)) {
126
+ // "total" as a WORD: includes("total") also took a bare "Subtotal $2.00" row for
127
+ // the total, and the card was sized for the goods without shipping (review, round 6).
128
+ if ((/\btotal\b/.test(t) || t.includes("amount due") || t.includes("you pay")) && t.length < 200 && visible(el)) {
127
129
  out.push({ strategy: 2, text: textOf(el) });
128
130
  }
129
131
  }
@@ -204,10 +206,17 @@ function parsePricesText(text) {
204
206
  */
205
207
  async function extractCheckoutTotalStrict(page, selector) {
206
208
  const found = await page.evaluate((sel) => {
209
+ const docW = Math.max(document.documentElement.scrollWidth, window.innerWidth);
210
+ const docH = Math.max(document.documentElement.scrollHeight, window.innerHeight);
207
211
  const visible = (el) => {
208
212
  const r = el.getBoundingClientRect();
209
213
  if (r.width < 1 || r.height < 1)
210
214
  return false;
215
+ // Parked off-screen (a screen-reader-only copy at left:-9999px) is not on the page
216
+ // a person sees — the same rule extractTotalPrice applies (review, 27/11/2026).
217
+ const left = r.left + window.scrollX, top = r.top + window.scrollY;
218
+ if (left + r.width <= 0 || top + r.height <= 0 || left >= docW || top >= docH)
219
+ return false;
211
220
  let opacity = 1;
212
221
  for (let n = el; n; n = n.parentElement) {
213
222
  const s = getComputedStyle(n);
@@ -18,6 +18,14 @@ type Page = import("playwright").Page;
18
18
  * code is a secret like the card number and is stripped from everything returned too.
19
19
  */
20
20
  export declare function fillCheckoutForm(checkoutUrl: string, cardData: CardData, existingPage?: Page, hints?: CheckoutHints, deal?: DealPayment): Promise<PaymentResult>;
21
+ /**
22
+ * Once Pay has been pressed (or may have been — the flag is set before the click), an attempt
23
+ * that then breaks off is 'unconfirmed', whatever it broke on: the browser failing, or a click
24
+ * that threw and left "no button was clicked". An order may exist. Reported as 'error' or
25
+ * 'not_submitted' it read as "nothing happened", and auto_pay_checkout cancelled the card on it
26
+ * (independent review, round 6). Only the hard timeout had this rule before.
27
+ */
28
+ export declare function mayHavePaid(r: PaymentResult, payPressed: boolean): PaymentResult;
21
29
  /**
22
30
  * Cut THIS card's expiry out of a text, in the spellings a page or a browser error would use
23
31
  * (08/29, 08 / 29, 08-29, 08/2029). An expiry alone pays for nothing, but it is the card's and
@@ -4,6 +4,7 @@
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.PAY_WORDS_RE = exports.APPLY_WORDS_RE = void 0;
6
6
  exports.fillCheckoutForm = fillCheckoutForm;
7
+ exports.mayHavePaid = mayHavePaid;
7
8
  exports.hideExpiry = hideExpiry;
8
9
  exports.hideDealCode = hideDealCode;
9
10
  exports.readReceiptId = readReceiptId;
@@ -82,7 +83,7 @@ async function fillCheckoutForm(checkoutUrl, cardData, existingPage, hints, deal
82
83
  await browser.close().catch(() => { });
83
84
  });
84
85
  // Deal orders: the total read off the page after the code was applied.
85
- return finish(await settleDealCode(dealState.total !== undefined ? { ...result, amount: dealState.total } : result), secrets);
86
+ return finish(await settleDealCode(mayHavePaid(dealState.total !== undefined ? { ...result, amount: dealState.total } : result, dealState.payPressed === true)), secrets);
86
87
  }
87
88
  catch (err) {
88
89
  if (err instanceof with_timeout_js_1.TimeoutError) {
@@ -103,12 +104,12 @@ async function fillCheckoutForm(checkoutUrl, cardData, existingPage, hints, deal
103
104
  message: `Checkout timed out after ${CHECKOUT_HARD_TIMEOUT_MS / 1000}s. The merchant page may be too slow or blocking automation.`,
104
105
  }), secrets);
105
106
  }
106
- return finish(await settleDealCode({
107
+ return finish(await settleDealCode(mayHavePaid({
107
108
  success: false,
108
109
  status: 'error',
109
110
  message: 'The browser failed during the checkout attempt.',
110
111
  page_detail: err instanceof Error ? err.message : String(err),
111
- }), secrets);
112
+ }, dealState.payPressed === true)), secrets);
112
113
  }
113
114
  finally {
114
115
  if (browser)
@@ -119,6 +120,24 @@ async function fillCheckoutForm(checkoutUrl, cardData, existingPage, hints, deal
119
120
  secrets.code = undefined;
120
121
  }
121
122
  }
123
+ /**
124
+ * Once Pay has been pressed (or may have been — the flag is set before the click), an attempt
125
+ * that then breaks off is 'unconfirmed', whatever it broke on: the browser failing, or a click
126
+ * that threw and left "no button was clicked". An order may exist. Reported as 'error' or
127
+ * 'not_submitted' it read as "nothing happened", and auto_pay_checkout cancelled the card on it
128
+ * (independent review, round 6). Only the hard timeout had this rule before.
129
+ */
130
+ function mayHavePaid(r, payPressed) {
131
+ if (!payPressed || (r.status !== 'error' && r.status !== 'not_submitted'))
132
+ return r;
133
+ return {
134
+ ...r,
135
+ success: false,
136
+ status: 'unconfirmed',
137
+ message: `Pay was pressed, then the attempt broke off before any order confirmation was seen (${r.status}: ${r.message}) ` +
138
+ `The token was NOT burned — verify whether the order went through before retrying (avoid double-charge).`,
139
+ };
140
+ }
122
141
  /**
123
142
  * Cut THIS card's expiry out of a text, in the spellings a page or a browser error would use
124
143
  * (08/29, 08 / 29, 08-29, 08/2029). An expiry alone pays for nothing, but it is the card's and
@@ -445,11 +464,43 @@ async function readPageAlerts(page) {
445
464
  return at > 0 ? head.slice(0, at) : "";
446
465
  };
447
466
  const seen = new Set();
467
+ const docW = Math.max(document.documentElement.scrollWidth, window.innerWidth);
468
+ const docH = Math.max(document.documentElement.scrollHeight, window.innerHeight);
448
469
  for (const el of Array.from(document.querySelectorAll('[role="alert"], [aria-live="assertive"], [role="status"][aria-live], [class*="error" i][class*="banner" i], [class*="notice" i][class*="error" i]'))) {
449
470
  const r = el.getBoundingClientRect();
450
- const st = getComputedStyle(el);
451
- if (r.width < 1 || r.height < 1 || st.display === "none" || st.visibility === "hidden" || parseFloat(st.opacity || "1") < 0.1)
471
+ if (r.width < 1 || r.height < 1)
452
472
  continue;
473
+ // Something a person can actually see: not parked off-screen, and not inside a
474
+ // parent that is hidden or faded out (a toast kept in the page until it is needed
475
+ // sits in such a parent; its text is not what the shop is saying now).
476
+ let opacity = 1, hidden = false, fixed = false;
477
+ for (let n = el; n; n = n.parentElement) {
478
+ const s = getComputedStyle(n);
479
+ if (s.display === "none" || s.visibility === "hidden") {
480
+ hidden = true;
481
+ break;
482
+ }
483
+ opacity *= parseFloat(s.opacity || "1");
484
+ if (s.position === "fixed")
485
+ fixed = true;
486
+ }
487
+ if (hidden || opacity < 0.1)
488
+ continue;
489
+ // Where it is. An element pinned to the window (position: fixed, itself or a parent)
490
+ // is judged against the WINDOW: a toast waiting above the top edge
491
+ // (top: 0; transform: translateY(-100%)) is at -60px however far the page has been
492
+ // scrolled — adding the scroll offset put it "on the page" once the buyer had
493
+ // scrolled down to the Pay button (review, round 6). Anything else is judged
494
+ // against the whole document.
495
+ if (fixed) {
496
+ if (r.right <= 0 || r.bottom <= 0 || r.left >= window.innerWidth || r.top >= window.innerHeight)
497
+ continue;
498
+ }
499
+ else {
500
+ const left = r.left + window.scrollX, top = r.top + window.scrollY;
501
+ if (left + r.width <= 0 || top + r.height <= 0 || left >= docW || top >= docH)
502
+ continue;
503
+ }
453
504
  const t = (el.innerText || "").replace(/\s+/g, " ").trim();
454
505
  if (t.length >= 8)
455
506
  seen.add(cutAtSpace(t, 600));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "z-zero-mcp-server",
3
- "version": "1.12.5",
3
+ "version": "1.12.7",
4
4
  "description": "Z-ZERO MCP Server — Secure JIT Virtual Card Payment tools for AI Agents (Claude, Cursor, AutoGPT) — Real Single-Use Virtual Cards, settled in USDC on Base",
5
5
  "main": "dist/index.js",
6
6
  "bin": {