@haven_ai/sdk 0.0.0-dev.202609190328.55ffe63 → 0.0.0-dev.202609190647.18526db

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/dist/index.cjs CHANGED
@@ -708,7 +708,13 @@ function normalizePaymentOption(value) {
708
708
  mimeType: candidate.mimeType,
709
709
  asset: candidate.asset,
710
710
  payTo: candidate.payTo,
711
- maxTimeoutSeconds: clampAuthorizationWindow(candidate.maxTimeoutSeconds),
711
+ // Keep the merchant offer intact for v2 `accepted` matching. Only the
712
+ // signing conversion may cap its authorization lifetime (#3117).
713
+ // Retain legacy fallback behavior for missing or unusable timeouts.
714
+ // Integer, because the authorize body types it `integer` and the child's
715
+ // timestamp caveat is built from it — the old clamp floored, so keeping a
716
+ // fractional value here would 400 a merchant that used to work (#3117).
717
+ maxTimeoutSeconds: typeof candidate.maxTimeoutSeconds === "number" && Number.isFinite(candidate.maxTimeoutSeconds) && candidate.maxTimeoutSeconds >= 1 ? Math.floor(candidate.maxTimeoutSeconds) : clampAuthorizationWindow(candidate.maxTimeoutSeconds),
712
718
  extra: candidate.extra
713
719
  };
714
720
  }
@@ -958,14 +964,11 @@ function toStandardPaymentRequirements(paymentRequired, option) {
958
964
  mimeType: option.mimeType ?? paymentRequired.resource.mimeType ?? "application/octet-stream",
959
965
  payTo: option.payTo,
960
966
  asset: option.asset,
961
- // Second enforcement point (#715): the parse path clamps too, but this is
962
- // the last stop before the x402 library turns the timeout into
963
- // `validBefore` — options constructed without parsing are bounded here.
964
- // The forward margin (#1256) is added ONLY here, at signing: the parse
965
- // path keeps recording the merchant's advertised timeout unchanged, and
966
- // the library's `validBefore = now + this value` then carries enough
967
- // slack to satisfy the facilitator's `validBefore ≥ now + maxTimeout`
968
- // verify rule after our funding leg confirms.
967
+ // Signing-only policy (#715/#3117): parsed and directly supplied options
968
+ // share this cap before the library computes validBefore. Keep the offer
969
+ // echoed in `accepted` unchanged. The forward margin (#1256) adds time
970
+ // for funding/retry, but does not guarantee a merchant timeout above the
971
+ // total bounded lifetime can pass facilitator verification.
969
972
  maxTimeoutSeconds: clampAuthorizationWindow(option.maxTimeoutSeconds) + X402_SETTLEMENT_FORWARD_MARGIN_SECONDS,
970
973
  extra: option.extra
971
974
  };