@haven_ai/sdk 0.10.0-alpha.0 → 0.12.0-alpha.0

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 (40) hide show
  1. package/README.md +45 -9
  2. package/dist/{base64-CiR5BJhk.d.cts → base64-C5OrJLij.d.ts} +10 -2
  3. package/dist/{base64-CxkinHPQ.d.ts → base64-COaV1Sis.d.cts} +10 -2
  4. package/dist/{chunk-6LEXYQ7J.cjs → chunk-4JTLJVBS.cjs} +4 -4
  5. package/dist/chunk-4JTLJVBS.cjs.map +1 -0
  6. package/dist/{chunk-MLUWABVT.js → chunk-7M3CIW7W.js} +7 -6
  7. package/dist/chunk-7M3CIW7W.js.map +1 -0
  8. package/dist/{chunk-TD2PHUYP.js → chunk-UPEDQLAL.js} +72 -6
  9. package/dist/chunk-UPEDQLAL.js.map +1 -0
  10. package/dist/{chunk-22FJ4JQO.cjs → chunk-V2ODMLDD.cjs} +38 -37
  11. package/dist/chunk-V2ODMLDD.cjs.map +1 -0
  12. package/dist/{chunk-EWTHDEIW.js → chunk-WFTGZS24.js} +3 -3
  13. package/dist/chunk-WFTGZS24.js.map +1 -0
  14. package/dist/{chunk-H37YVYZA.cjs → chunk-ZA3NOSO2.cjs} +73 -5
  15. package/dist/chunk-ZA3NOSO2.cjs.map +1 -0
  16. package/dist/edge.cjs +93 -93
  17. package/dist/edge.d.cts +11 -8
  18. package/dist/edge.d.ts +11 -8
  19. package/dist/edge.js +4 -4
  20. package/dist/index.cjs +866 -475
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +69 -33
  23. package/dist/index.d.ts +69 -33
  24. package/dist/index.js +554 -171
  25. package/dist/index.js.map +1 -1
  26. package/dist/{receipt-q7ez8Zb2.d.cts → receipt-Dy77vCea.d.cts} +5 -4
  27. package/dist/{receipt-Cg9a5Seq.d.ts → receipt-DyUInpvF.d.ts} +5 -4
  28. package/dist/test-support.cjs +21 -21
  29. package/dist/test-support.d.cts +2 -2
  30. package/dist/test-support.d.ts +2 -2
  31. package/dist/test-support.js +2 -2
  32. package/dist/{types-BKgqzvnk.d.ts → types-CAvsjRKi.d.cts} +209 -12
  33. package/dist/{types-BKgqzvnk.d.cts → types-CAvsjRKi.d.ts} +209 -12
  34. package/package.json +1 -1
  35. package/dist/chunk-22FJ4JQO.cjs.map +0 -1
  36. package/dist/chunk-6LEXYQ7J.cjs.map +0 -1
  37. package/dist/chunk-EWTHDEIW.js.map +0 -1
  38. package/dist/chunk-H37YVYZA.cjs.map +0 -1
  39. package/dist/chunk-MLUWABVT.js.map +0 -1
  40. package/dist/chunk-TD2PHUYP.js.map +0 -1
@@ -314,7 +314,35 @@ var AgentPaymentWarningCode = {
314
314
  * money moved". Carries the intent's `expires_at`: after that instant the
315
315
  * settlement can no longer land at all.
316
316
  */
317
- SettlementUnconfirmed: "SETTLEMENT_UNCONFIRMED"
317
+ SettlementUnconfirmed: "SETTLEMENT_UNCONFIRMED",
318
+ /**
319
+ * #3967: the quote-time budget pre-check decided the quoted amount does NOT
320
+ * fit the agent's remaining delegation budget — the same server-side compare
321
+ * the payment path runs before funding. Travels beside
322
+ * `budget_check.sufficient: false` and, on `haven_quote_x402`,
323
+ * `safe_to_continue: false` with no prefilled cap. The on-chain policy
324
+ * remains the actual gate either way.
325
+ */
326
+ QuoteExceedsRemainingBudget: "QUOTE_EXCEEDS_REMAINING_BUDGET",
327
+ /**
328
+ * #4458: the agent's only budget for the token has ENDED — the quote-time
329
+ * pre-check answered the typed 403 `delegation_expired`, not an over-budget
330
+ * compare. Travels beside `budget_check.sufficient: false` and, on
331
+ * `haven_quote_x402`, `safe_to_continue: false` with no prefilled cap. The
332
+ * remedy is the owner setting a NEW budget: waiting for a period to reset
333
+ * cannot help, which is why this is its own code rather than
334
+ * {@link AgentPaymentWarningCode.QuoteExceedsRemainingBudget}. Additive: an
335
+ * older backend never emits it, and the on-chain policy remains the actual
336
+ * gate either way.
337
+ */
338
+ QuoteBudgetEnded: "QUOTE_BUDGET_ENDED",
339
+ /**
340
+ * #3967: the MERCHANT reported a denial on one of its x402 payment options —
341
+ * a known denial key (starting with `issuanceDenied`) in `accepts[].extra`.
342
+ * Strictly informational: it flips neither `safe_to_continue` nor
343
+ * `expected_settleable`; the agent should surface it to the user.
344
+ */
345
+ MerchantReportedDenial: "MERCHANT_REPORTED_DENIAL"
318
346
  };
319
347
  var AgentPaymentRailDescriptions = {
320
348
  [AgentPaymentRail.Direct]: "Standard Haven payment from the user-controlled account, redeeming the agent's on-chain budget delegation.",
@@ -361,13 +389,51 @@ var HavenError = class extends Error {
361
389
  statusCode;
362
390
  paymentId;
363
391
  };
364
- var HavenApiError = class extends HavenError {
365
- constructor(message, statusCode, body, paymentId) {
392
+ var HavenApiError = class _HavenApiError extends HavenError {
393
+ constructor(message, statusCode, body, paymentId, failureCause) {
366
394
  super(message, "API_ERROR", statusCode, paymentId);
367
395
  this.body = body;
396
+ this.failureCause = failureCause;
368
397
  this.name = "HavenApiError";
369
398
  }
370
399
  body;
400
+ failureCause;
401
+ /**
402
+ * #4470: an error a retry cannot change. The census in
403
+ * `haven-api-error-census.test.ts` requires every literal 5xx site to use
404
+ * this or be allowlisted there with a reason.
405
+ */
406
+ static deterministic(message, statusCode, body, paymentId) {
407
+ return new _HavenApiError(message, statusCode, body, paymentId, { kind: "deterministic" });
408
+ }
409
+ };
410
+ var FundingConfirmationUnknownError = class extends HavenApiError {
411
+ constructor(txHash, chainId, reason) {
412
+ super(
413
+ `Funding tx ${txHash} was submitted, but its on-chain confirmation could not be read (${reason}).`,
414
+ 504,
415
+ { txHash, chainId }
416
+ );
417
+ this.txHash = txHash;
418
+ this.chainId = chainId;
419
+ this.name = "FundingConfirmationUnknownError";
420
+ }
421
+ txHash;
422
+ chainId;
423
+ fundingErrorCode = "funding_confirmation_unknown";
424
+ };
425
+ var FundingRevertedError = class extends HavenApiError {
426
+ constructor(txHash, chainId) {
427
+ super(`Funding tx ${txHash} reverted on-chain; nothing reached the delegate.`, 502, { txHash, chainId }, void 0, {
428
+ kind: "deterministic"
429
+ });
430
+ this.txHash = txHash;
431
+ this.chainId = chainId;
432
+ this.name = "FundingRevertedError";
433
+ }
434
+ txHash;
435
+ chainId;
436
+ fundingErrorCode = "funding_reverted";
371
437
  };
372
438
  var MerchantTimeoutError = class extends HavenApiError {
373
439
  merchantErrorCode = "merchant_timeout";
@@ -1043,6 +1109,8 @@ exports.DELEGATION_MANAGER = DELEGATION_MANAGER;
1043
1109
  exports.DELEGATION_TUPLE_COMPONENTS = DELEGATION_TUPLE_COMPONENTS;
1044
1110
  exports.DIRECT_SIGN_CONTEXT_VERSION = DIRECT_SIGN_CONTEXT_VERSION;
1045
1111
  exports.ENTRY_POINT_V07 = ENTRY_POINT_V07;
1112
+ exports.FundingConfirmationUnknownError = FundingConfirmationUnknownError;
1113
+ exports.FundingRevertedError = FundingRevertedError;
1046
1114
  exports.HAVEN_CONNECTOR_CHANNEL = HAVEN_CONNECTOR_CHANNEL;
1047
1115
  exports.HYBRID_DELEGATOR_DOMAIN_NAME = HYBRID_DELEGATOR_DOMAIN_NAME;
1048
1116
  exports.HYBRID_DELEGATOR_DOMAIN_VERSION = HYBRID_DELEGATOR_DOMAIN_VERSION;
@@ -1083,5 +1151,5 @@ exports.packedUserOperationHash = packedUserOperationHash;
1083
1151
  exports.resolveConnectorChannel = resolveConnectorChannel;
1084
1152
  exports.signerUpdateFallback = signerUpdateFallback;
1085
1153
  exports.verifySettlementChild = verifySettlementChild;
1086
- //# sourceMappingURL=chunk-H37YVYZA.cjs.map
1087
- //# sourceMappingURL=chunk-H37YVYZA.cjs.map
1154
+ //# sourceMappingURL=chunk-ZA3NOSO2.cjs.map
1155
+ //# sourceMappingURL=chunk-ZA3NOSO2.cjs.map