agent402-client 0.8.4 → 0.8.5

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/index.js +6 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -23,7 +23,7 @@ import { createHash, randomBytes } from "node:crypto";
23
23
  // `User-Agent: agent402-client/<version>` - a standard header, no extra
24
24
  // network calls - so a seller can attribute traffic (and settled payments)
25
25
  // to this SDK. Product token only; nothing about the caller rides along.
26
- const VERSION = "0.8.4";
26
+ const VERSION = "0.8.5";
27
27
  const USER_AGENT = `agent402-client/${VERSION}`;
28
28
  // 32MB: about a hundred times any realistic response from this catalog (the
29
29
  // largest is a base64 image at a few MB), so it cannot break a legitimate
@@ -489,7 +489,11 @@ export class Agent402 {
489
489
  if (msg != null) detail = ` - ${typeof msg === "string" ? msg : JSON.stringify(msg)}`;
490
490
  if (body?.expected != null) detail += ` (expected: ${JSON.stringify(body.expected)})`;
491
491
  } catch { /* not JSON: the status is the whole story */ }
492
- return `call "${slug}" failed${when}: HTTP ${r.status}${detail.slice(0, FAILURE_DETAIL_MAX_CHARS)}`;
492
+ // A seller-authored body is untrusted, so the detail is bounded - and a
493
+ // bound that cuts says so, with the length it cut, rather than ending
494
+ // mid-sentence as if that were the whole message.
495
+ const cut = detail.length > FAILURE_DETAIL_MAX_CHARS ? `${detail.slice(0, FAILURE_DETAIL_MAX_CHARS)} [${detail.length - FAILURE_DETAIL_MAX_CHARS} more characters not shown]` : detail;
496
+ return `call "${slug}" failed${when}: HTTP ${r.status}${cut}`;
493
497
  }
494
498
 
495
499
  /** True if any spending ceiling is configured (worth preflighting the 402). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent402-client",
3
- "version": "0.8.4",
3
+ "version": "0.8.5",
4
4
  "description": "Agent402 buyer SDK: resolve a task to a tool across 500+ pay-per-call endpoints and call it with payment handled - free via proof-of-work, or over x402 or MPP (a stock mppx fetch works) with a wallet you keep; the buy side of Agentic Finance. Caching, idempotent retries (Idempotency-Key), non-custodial, zero dependencies.",
5
5
  "type": "module",
6
6
  "main": "index.js",