agent402-client 0.8.8 → 0.8.9
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/index.js +5 -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.
|
|
26
|
+
const VERSION = "0.8.9";
|
|
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
|
|
@@ -519,7 +519,10 @@ export class Agent402 {
|
|
|
519
519
|
let detail = "";
|
|
520
520
|
try {
|
|
521
521
|
const body = await r.json();
|
|
522
|
-
|
|
522
|
+
// A refused payment that says what went wrong carries that sentence in
|
|
523
|
+
// `detail` (an RFC 9457 problem) or `hint` (an x402 refusal), with no
|
|
524
|
+
// `error`; a seller's plain error keeps its place first.
|
|
525
|
+
const msg = body?.error ?? body?.message ?? body?.detail ?? body?.hint;
|
|
523
526
|
if (msg != null) detail = ` - ${typeof msg === "string" ? msg : JSON.stringify(msg)}`;
|
|
524
527
|
if (body?.expected != null) detail += ` (expected: ${JSON.stringify(body.expected)})`;
|
|
525
528
|
} catch { /* not JSON: the status is the whole story */ }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent402-client",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.9",
|
|
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",
|