agent402-client 0.8.4 → 0.8.6
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 +9 -5
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -23,13 +23,12 @@ 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.6";
|
|
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
|
|
30
30
|
// caller, while still stopping the class it exists for. A ceiling that is off
|
|
31
31
|
// by default protects nobody, so this one is on; pass null to disable it.
|
|
32
|
-
const FAILURE_DETAIL_MAX_CHARS = 2_000;
|
|
33
32
|
const DEFAULT_MAX_RESPONSE_BYTES = 32 * 1024 * 1024;
|
|
34
33
|
|
|
35
34
|
const leadingZeroBits = (buf) => { let n = 0; for (const b of buf) { if (b === 0) { n += 8; continue; } n += Math.clz32(b) - 24; break; } return n; };
|
|
@@ -479,8 +478,13 @@ export class Agent402 {
|
|
|
479
478
|
/** The message for a failed call CARRIES THE SELLER'S OWN DETAIL. Agent402's
|
|
480
479
|
* 4xx bodies are self-explaining ({error, tool, expected}); a message that
|
|
481
480
|
* said only "HTTP 400" threw that away, and an agent reading it could not
|
|
482
|
-
* correct its input (elizaOS registry review, 2026-09-14).
|
|
483
|
-
*
|
|
481
|
+
* correct its input (elizaOS registry review, 2026-09-14). WHOLE: 0.8.4
|
|
482
|
+
* cut the detail at 2,000 characters and 0.8.5 said so when it cut, and
|
|
483
|
+
* the same review measured a 2,517-character seller error reaching the
|
|
484
|
+
* model without its end (2026-09-16). The body is already bounded before
|
|
485
|
+
* it is parsed (maxResponseBytes, 32 MB default), so a second cut here
|
|
486
|
+
* protected nothing and lost the part of the message an agent needs to
|
|
487
|
+
* act on. A body that is not JSON contributes nothing but its status. */
|
|
484
488
|
async _failureDetail(slug, r, when = "") {
|
|
485
489
|
let detail = "";
|
|
486
490
|
try {
|
|
@@ -489,7 +493,7 @@ export class Agent402 {
|
|
|
489
493
|
if (msg != null) detail = ` - ${typeof msg === "string" ? msg : JSON.stringify(msg)}`;
|
|
490
494
|
if (body?.expected != null) detail += ` (expected: ${JSON.stringify(body.expected)})`;
|
|
491
495
|
} catch { /* not JSON: the status is the whole story */ }
|
|
492
|
-
return `call "${slug}" failed${when}: HTTP ${r.status}${detail
|
|
496
|
+
return `call "${slug}" failed${when}: HTTP ${r.status}${detail}`;
|
|
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.
|
|
3
|
+
"version": "0.8.6",
|
|
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",
|