@haven_ai/signer 0.0.0-dev.202609142053.7f40fec → 0.0.0-dev.202609142145.5df01af
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/README.md +5 -1
- package/dist/cli.cjs +20 -5
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +20 -5
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +20 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +20 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -207,7 +207,11 @@ read.** Since [#1263](https://github.com/d-hinders/Haven-AI/issues/1263) the
|
|
|
207
207
|
authenticated, read-only `GET /x402/:payment_id/sign-context` against Haven, so
|
|
208
208
|
that agents never have to relay multi-KB EIP-712 payloads through a model's
|
|
209
209
|
context window. **Only the Bearer API key goes out; the delegate key is never
|
|
210
|
-
part of that request or its response.**
|
|
210
|
+
part of that request or its response.** Since #2985 that read is bounded:
|
|
211
|
+
it aborts after `SIGN_CONTEXT_TIMEOUT_MS` (15 s) and reports a
|
|
212
|
+
`HavenSigningError` naming the timeout and the `typed_data_b64` fallback,
|
|
213
|
+
so a hung backend cannot hang the signer — and the agent — past the funding
|
|
214
|
+
window. Nothing else in the package reaches the
|
|
211
215
|
network: `haven_x402_sign_header` and `haven_sign_sweep_delegate` never fetch,
|
|
212
216
|
the library surface above (`createEdgeSigner` and its six signing methods, over
|
|
213
217
|
the network-free `src/core.ts`) never fetches, and passing the payload as
|
package/dist/cli.cjs
CHANGED
|
@@ -548,19 +548,34 @@ async function loadHavenIdentity(credentialsPath) {
|
|
|
548
548
|
return null;
|
|
549
549
|
}
|
|
550
550
|
}
|
|
551
|
-
|
|
551
|
+
var SIGN_CONTEXT_TIMEOUT_MS = 15e3;
|
|
552
|
+
async function fetchX402SignContext(identity, paymentId, fetchImpl = fetch, timeoutMs = SIGN_CONTEXT_TIMEOUT_MS) {
|
|
552
553
|
let response;
|
|
553
554
|
try {
|
|
554
555
|
response = await fetchImpl(
|
|
555
556
|
`${identity.apiUrl}/x402/${encodeURIComponent(paymentId)}/sign-context`,
|
|
556
|
-
{
|
|
557
|
+
{
|
|
558
|
+
headers: { Authorization: `Bearer ${identity.apiKey}` },
|
|
559
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
560
|
+
}
|
|
557
561
|
);
|
|
558
562
|
} catch (err) {
|
|
563
|
+
const timedOut = err instanceof Error && (err.name === "TimeoutError" || err.name === "AbortError");
|
|
559
564
|
throw new sdk.HavenSigningError(
|
|
560
|
-
`Could not reach Haven to fetch the signing context for ${paymentId}: ${err instanceof Error ? err.message : String(err)}. Retry, or pass typed_data_b64 from the quote result instead.`
|
|
565
|
+
timedOut ? `Haven did not answer the signing-context fetch for ${paymentId} within ${timeoutMs} ms. Retry, or pass typed_data_b64 from the quote result instead.` : `Could not reach Haven to fetch the signing context for ${paymentId}: ${err instanceof Error ? err.message : String(err)}. Retry, or pass typed_data_b64 from the quote result instead.`
|
|
561
566
|
);
|
|
562
567
|
}
|
|
563
|
-
|
|
568
|
+
let body;
|
|
569
|
+
try {
|
|
570
|
+
body = await response.json();
|
|
571
|
+
} catch (err) {
|
|
572
|
+
if (err instanceof Error && (err.name === "TimeoutError" || err.name === "AbortError")) {
|
|
573
|
+
throw new sdk.HavenSigningError(
|
|
574
|
+
`Haven did not finish sending the signing context for ${paymentId} within ${timeoutMs} ms. Retry, or pass typed_data_b64 from the quote result instead.`
|
|
575
|
+
);
|
|
576
|
+
}
|
|
577
|
+
body = {};
|
|
578
|
+
}
|
|
564
579
|
if (!response.ok) {
|
|
565
580
|
const detail = typeof body.error === "string" ? body.error : `HTTP ${response.status}`;
|
|
566
581
|
throw new sdk.HavenSigningError(
|
|
@@ -1247,7 +1262,7 @@ async function warnIfCredentialFilePermissive(path, log = (message) => process.s
|
|
|
1247
1262
|
|
|
1248
1263
|
// src/server.ts
|
|
1249
1264
|
var SIGNER_NAME = "@haven_ai/signer";
|
|
1250
|
-
var SIGNER_VERSION = "0.0.0-dev.
|
|
1265
|
+
var SIGNER_VERSION = "0.0.0-dev.202609142145.5df01af";
|
|
1251
1266
|
async function resolveSignerRuntime(options = {}) {
|
|
1252
1267
|
assertSupportedNodeVersion(options.nodeVersion);
|
|
1253
1268
|
if (options.delegateKey) {
|