openzoo 0.50.47 → 0.50.48

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.
Files changed (2) hide show
  1. package/lib/ozSpendChip.js +19 -17
  2. package/package.json +1 -1
@@ -181,20 +181,22 @@ function ozVisibleSpendText(root) {
181
181
  return s;
182
182
  }
183
183
 
184
- function ozBlankAfter(root, keepLen) {
185
- let off = 0;
184
+ /** Per-node. Global keepLen ate list items when vis had no newlines (head ''). */
185
+ export function stripSpendFromText(s) {
186
+ const t = String(s || '');
187
+ const cut = t.search(/::oz-spend::/i);
188
+ if (cut >= 0) return cut > 0 ? t.slice(0, cut) : '';
189
+ if (/^\s*(this call \$|spent \$[0-9.]+(?:\s|·)|tx https?:|memo |proves )/i.test(t)) return '';
190
+ return t;
191
+ }
192
+
193
+ function ozBlankSpendIn(root) {
186
194
  const w = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, null);
187
- const tns = [];
188
- while (w.nextNode()) tns.push(w.currentNode);
189
- for (let i = 0; i < tns.length; i += 1) {
190
- const tn = tns[i];
195
+ while (w.nextNode()) {
196
+ const tn = w.currentNode;
191
197
  if (tn.parentElement && tn.parentElement.closest && tn.parentElement.closest('.oz-spend')) continue;
192
- const s = tn.nodeValue || '';
193
- const start = off;
194
- off += s.length;
195
- if (off <= keepLen) continue;
196
- if (start >= keepLen) tn.nodeValue = '';
197
- else tn.nodeValue = s.slice(0, keepLen - start);
198
+ const next = stripSpendFromText(tn.nodeValue || '');
199
+ if (next !== tn.nodeValue) tn.nodeValue = next;
198
200
  }
199
201
  }
200
202
 
@@ -283,11 +285,10 @@ function ozCollapseSpend() {
283
285
  if (prev && prev !== host) {
284
286
  ozAttachSpendChip(prev, split);
285
287
  host.setAttribute('data-oz-spend-hide', '1');
286
- ozBlankAfter(host, 0);
287
288
  continue;
288
289
  }
289
290
  }
290
- ozBlankAfter(host, split.head.length);
291
+ ozBlankSpendIn(host);
291
292
  ozAttachSpendChip(host, split);
292
293
  }
293
294
  ozHideSpendLeftovers();
@@ -310,8 +311,8 @@ export function spendChipSource() {
310
311
  return [
311
312
  '(function ozSpendChip(){',
312
313
  "'use strict';",
313
- 'if (window.__OZ_SPEND_CHIP__ === 3) return;',
314
- 'window.__OZ_SPEND_CHIP__ = 3;',
314
+ 'if (window.__OZ_SPEND_CHIP__ === 4) return;',
315
+ 'window.__OZ_SPEND_CHIP__ = 4;',
315
316
  chipUsd.toString(),
316
317
  labelFromSpendBody.toString(),
317
318
  spendLinesOnly.toString(),
@@ -320,7 +321,8 @@ export function spendChipSource() {
320
321
  ozEnsureSpendCss.toString(),
321
322
  ozSpendHost.toString(),
322
323
  ozVisibleSpendText.toString(),
323
- ozBlankAfter.toString(),
324
+ stripSpendFromText.toString(),
325
+ ozBlankSpendIn.toString(),
324
326
  ozHideSpendLeftovers.toString(),
325
327
  ozPreviousMessageCard.toString(),
326
328
  ozAttachSpendChip.toString(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openzoo",
3
- "version": "0.50.47",
3
+ "version": "0.50.48",
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",