@haven_ai/sdk 0.0.0-dev.202609282003.b645eff → 0.0.0-dev.202609282315.dd06d7c
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 +3 -1
- package/dist/{base64-Br8mJPgm.d.cts → base64-YC49ypsN.d.cts} +21 -2
- package/dist/{base64-Br8mJPgm.d.ts → base64-YC49ypsN.d.ts} +21 -2
- package/dist/{chunk-Y2Q4DZVU.js → chunk-FVLF2A66.js} +19 -4
- package/dist/chunk-FVLF2A66.js.map +1 -0
- package/dist/{chunk-PZLGXWSP.cjs → chunk-TKJDIRAY.cjs} +29 -29
- package/dist/{chunk-PZLGXWSP.cjs.map → chunk-TKJDIRAY.cjs.map} +1 -1
- package/dist/{chunk-FXPB3NEJ.cjs → chunk-WQ4UYTPE.cjs} +19 -4
- package/dist/chunk-WQ4UYTPE.cjs.map +1 -0
- package/dist/{chunk-AFJ7XDDI.js → chunk-XDJAPMS2.js} +4 -4
- package/dist/{chunk-AFJ7XDDI.js.map → chunk-XDJAPMS2.js.map} +1 -1
- package/dist/edge.cjs +65 -65
- package/dist/edge.d.cts +1 -1
- package/dist/edge.d.ts +1 -1
- package/dist/edge.js +3 -3
- package/dist/index.cjs +385 -311
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +61 -19
- package/dist/index.d.ts +61 -19
- package/dist/index.js +98 -24
- package/dist/index.js.map +1 -1
- package/dist/test-support.cjs +18 -18
- package/dist/test-support.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-FXPB3NEJ.cjs.map +0 -1
- package/dist/chunk-Y2Q4DZVU.js.map +0 -1
package/README.md
CHANGED
|
@@ -425,6 +425,7 @@ x402 tool-window failures:
|
|
|
425
425
|
| `rejected` | The payment was rejected and cannot proceed. | yes |
|
|
426
426
|
| `expired` | Payment expired before completion. | yes |
|
|
427
427
|
| `failed` | Haven could not complete the payment. | yes |
|
|
428
|
+
| `delivered_unverified` | **#3420: terminal.** The merchant delivered, but the settlement window and the sweep's last attribution chance have both passed with no verified on-chain evidence. Polling cannot change this; the only remedy is reporting a real settlement hash (`haven_report_settlement_evidence`). | yes |
|
|
428
429
|
|
|
429
430
|
The merchant settlement leg of x402 (and the MPP retry) is the agent's own request to the merchant — it does not have a Haven `phase`. The payment is `funding_sent` until the agent retries with the payment header (`PAYMENT-SIGNATURE`, plus `X-PAYMENT` on this bridged path) (x402) or the MPP proof header; from Haven's perspective the payment becomes `executed` only after the agent successfully resumes.
|
|
430
431
|
|
|
@@ -435,10 +436,11 @@ The merchant settlement leg of x402 (and the MPP retry) is the agent's own reque
|
|
|
435
436
|
| `sign_and_submit_payment` | Sign with the delegate key and submit the payment to Haven. |
|
|
436
437
|
| `check_status_later` | Poll `getPaymentStatus(payment_id)` later. |
|
|
437
438
|
| `none` | Stop polling; no more action is needed for this payment id. |
|
|
439
|
+
| `awaiting_settlement_evidence` | #2970/#3420: the erc7710 settlement window passed with no verified evidence. Poll `getPaymentStatus(payment_id)` once more shortly after the payment's expiry; if it still shows nothing (or already answers the terminal `delivered_unverified` phase), tell the user the goods were delivered but unverified. |
|
|
438
440
|
| `wait_for_user_approval` | **No longer produced — nothing maps to it.** Retired with the Safe rail's approval queue; kept in the exported enum for wire compatibility. The SDK's own status mapping now answers `stop_and_tell_user` for the statuses that used to yield this. |
|
|
439
441
|
| `wait_for_user_to_complete_payment` | **No longer produced — nothing maps to it.** Same retirement as above. |
|
|
440
442
|
| `retry_original_x402_request` | Haven's funding leg confirmed but no merchant response was ever recorded — most often because the process crashed between the funding confirmation and the merchant retry (a 15-minute grace window applies before this fires; a client-reported merchant rejection instead yields `sweep_stranded_funds`). Call `resumeX402Payment()` with the preserved `resumeState`, or rehydrate it first with `getResumeState(payment_id)`. Do not start a new payment for the same purchase. |
|
|
441
|
-
| `stop_and_tell_user` | Stop retrying and tell the user the payment failed or was
|
|
443
|
+
| `stop_and_tell_user` | Stop retrying and tell the user what happened — the payment failed, was rejected, or (#3420) was delivered but its settlement can no longer be verified. |
|
|
442
444
|
| `request_again_if_user_still_wants_it` | The request expired; ask again only if the user still wants the payment. |
|
|
443
445
|
| `payment_window_expired` | The x402 funding/quote window expired. Re-quote the same paid MCP tool call with the same `idempotency_key`, then sign the fresh `payload_hash`. |
|
|
444
446
|
| `sweep_stranded_funds` | A funding leg succeeded but the merchant/protocol leg did not settle. Stop retrying and use `haven_sweep_delegate` to recover stranded delegate funds. |
|
|
@@ -1106,6 +1106,20 @@ declare const AgentPaymentPhase: {
|
|
|
1106
1106
|
* the funds.
|
|
1107
1107
|
*/
|
|
1108
1108
|
readonly FundedButUnsettled: "funded_but_unsettled";
|
|
1109
|
+
/**
|
|
1110
|
+
* #3420: TERMINAL — a `submitted` erc7710 x402 intent whose settlement
|
|
1111
|
+
* window AND the sweep's last attribution chance have both passed with no
|
|
1112
|
+
* verified evidence. The sweep's tick (120s) only ever confirms a
|
|
1113
|
+
* transaction mined inside the payment's own settlement window (the child
|
|
1114
|
+
* delegation's on-chain `timestamp` caveat, plus the verifier's 120s
|
|
1115
|
+
* clock-skew allowance), so once authorize + window + skew is behind the
|
|
1116
|
+
* payment, no poll — and no sweep tick — can ever change the answer.
|
|
1117
|
+
* The paired `next_action` is `stop_and_tell_user`: tell the user the goods
|
|
1118
|
+
* were delivered but Haven holds no verified settlement evidence; reporting
|
|
1119
|
+
* a real settlement hash (`haven_report_settlement_evidence`) still works
|
|
1120
|
+
* at any age.
|
|
1121
|
+
*/
|
|
1122
|
+
readonly DeliveredUnverified: "delivered_unverified";
|
|
1109
1123
|
};
|
|
1110
1124
|
type AgentPaymentPhase = (typeof AgentPaymentPhase)[keyof typeof AgentPaymentPhase];
|
|
1111
1125
|
declare const AgentPaymentNextAction: {
|
|
@@ -1263,7 +1277,7 @@ declare const AgentPaymentRail: {
|
|
|
1263
1277
|
type AgentPaymentRail = (typeof AgentPaymentRail)[keyof typeof AgentPaymentRail];
|
|
1264
1278
|
type PaymentPhase = AgentPaymentPhase;
|
|
1265
1279
|
type PaymentNextAction = AgentPaymentNextAction;
|
|
1266
|
-
declare const AGENT_PAYMENT_PHASE_VALUES: ("rejected" | "expired" | "failed" | "agent_signature_required" | "payment_submitted" | "payment_confirmed" | "user_approval_required" | "user_execution_required" | "waiting_for_additional_approvals" | "funding_sent" | "insufficient_funds" | "funded_but_unsettled")[];
|
|
1280
|
+
declare const AGENT_PAYMENT_PHASE_VALUES: ("rejected" | "expired" | "failed" | "agent_signature_required" | "payment_submitted" | "payment_confirmed" | "user_approval_required" | "user_execution_required" | "waiting_for_additional_approvals" | "funding_sent" | "insufficient_funds" | "funded_but_unsettled" | "delivered_unverified")[];
|
|
1267
1281
|
declare const AGENT_PAYMENT_NEXT_ACTION_VALUES: ("sign_and_submit_payment" | "check_status_later" | "none" | "wait_for_user_approval" | "wait_for_user_to_complete_payment" | "retry_original_x402_request" | "stop_and_tell_user" | "request_again_if_user_still_wants_it" | "retry_with_explicit_context" | "payment_window_expired" | "fund_account_or_raise_allowance" | "sweep_stranded_funds" | "awaiting_settlement_evidence")[];
|
|
1268
1282
|
declare const AGENT_PAYMENT_FAILURE_CODE_VALUES: ("PRICE_EXCEEDS_MAX" | "PAYMENT_WINDOW_EXPIRED" | "MERCHANT_REJECTED_AFTER_FUNDING" | "MERCHANT_UNRESPONSIVE_AFTER_FUNDING" | "MERCHANT_CALL_CONTEXT_UNAVAILABLE" | "AMBIGUOUS_MAX_AMOUNT" | "MAX_AMOUNT_UNCONVERTIBLE" | "MERCHANT_NOT_READY")[];
|
|
1269
1283
|
declare const AGENT_PAYMENT_RAIL_VALUES: ("x402" | "mpp_demo" | "mpp_crypto" | "stripe_deposit" | "spt" | "direct" | "mpp")[];
|
|
@@ -1449,6 +1463,11 @@ interface PaymentStatusResult {
|
|
|
1449
1463
|
expiresAt: string;
|
|
1450
1464
|
chainId: number;
|
|
1451
1465
|
message: string;
|
|
1466
|
+
/**
|
|
1467
|
+
* #3420: `true` = the merchant answered 2xx (a `machine_payment_evidence`
|
|
1468
|
+
* row records its response); absent = unknown. See the raw field's doc.
|
|
1469
|
+
*/
|
|
1470
|
+
delivered?: boolean;
|
|
1452
1471
|
/** Platform fee surfaced so it's never silently collected (#386). */
|
|
1453
1472
|
fee?: PaymentFee | null;
|
|
1454
1473
|
amountAtomic?: string | null;
|
|
@@ -1995,7 +2014,7 @@ declare function buildSweepAuthorizationMessage(auth: SweepAuthorization): strin
|
|
|
1995
2014
|
* This SDK's own version. Owned by `scripts/release-bump.mjs`, which rewrites
|
|
1996
2015
|
* it with the package version on every release — never hand-edit it.
|
|
1997
2016
|
*/
|
|
1998
|
-
declare const SDK_VERSION = "0.0.0-dev.
|
|
2017
|
+
declare const SDK_VERSION = "0.0.0-dev.202609282315.dd06d7c";
|
|
1999
2018
|
/** The request header every published Haven client sends. */
|
|
2000
2019
|
declare const HAVEN_CLIENT_HEADER = "X-Haven-Client";
|
|
2001
2020
|
/** `<package>/<version>` — the value of {@link HAVEN_CLIENT_HEADER}. */
|
|
@@ -1106,6 +1106,20 @@ declare const AgentPaymentPhase: {
|
|
|
1106
1106
|
* the funds.
|
|
1107
1107
|
*/
|
|
1108
1108
|
readonly FundedButUnsettled: "funded_but_unsettled";
|
|
1109
|
+
/**
|
|
1110
|
+
* #3420: TERMINAL — a `submitted` erc7710 x402 intent whose settlement
|
|
1111
|
+
* window AND the sweep's last attribution chance have both passed with no
|
|
1112
|
+
* verified evidence. The sweep's tick (120s) only ever confirms a
|
|
1113
|
+
* transaction mined inside the payment's own settlement window (the child
|
|
1114
|
+
* delegation's on-chain `timestamp` caveat, plus the verifier's 120s
|
|
1115
|
+
* clock-skew allowance), so once authorize + window + skew is behind the
|
|
1116
|
+
* payment, no poll — and no sweep tick — can ever change the answer.
|
|
1117
|
+
* The paired `next_action` is `stop_and_tell_user`: tell the user the goods
|
|
1118
|
+
* were delivered but Haven holds no verified settlement evidence; reporting
|
|
1119
|
+
* a real settlement hash (`haven_report_settlement_evidence`) still works
|
|
1120
|
+
* at any age.
|
|
1121
|
+
*/
|
|
1122
|
+
readonly DeliveredUnverified: "delivered_unverified";
|
|
1109
1123
|
};
|
|
1110
1124
|
type AgentPaymentPhase = (typeof AgentPaymentPhase)[keyof typeof AgentPaymentPhase];
|
|
1111
1125
|
declare const AgentPaymentNextAction: {
|
|
@@ -1263,7 +1277,7 @@ declare const AgentPaymentRail: {
|
|
|
1263
1277
|
type AgentPaymentRail = (typeof AgentPaymentRail)[keyof typeof AgentPaymentRail];
|
|
1264
1278
|
type PaymentPhase = AgentPaymentPhase;
|
|
1265
1279
|
type PaymentNextAction = AgentPaymentNextAction;
|
|
1266
|
-
declare const AGENT_PAYMENT_PHASE_VALUES: ("rejected" | "expired" | "failed" | "agent_signature_required" | "payment_submitted" | "payment_confirmed" | "user_approval_required" | "user_execution_required" | "waiting_for_additional_approvals" | "funding_sent" | "insufficient_funds" | "funded_but_unsettled")[];
|
|
1280
|
+
declare const AGENT_PAYMENT_PHASE_VALUES: ("rejected" | "expired" | "failed" | "agent_signature_required" | "payment_submitted" | "payment_confirmed" | "user_approval_required" | "user_execution_required" | "waiting_for_additional_approvals" | "funding_sent" | "insufficient_funds" | "funded_but_unsettled" | "delivered_unverified")[];
|
|
1267
1281
|
declare const AGENT_PAYMENT_NEXT_ACTION_VALUES: ("sign_and_submit_payment" | "check_status_later" | "none" | "wait_for_user_approval" | "wait_for_user_to_complete_payment" | "retry_original_x402_request" | "stop_and_tell_user" | "request_again_if_user_still_wants_it" | "retry_with_explicit_context" | "payment_window_expired" | "fund_account_or_raise_allowance" | "sweep_stranded_funds" | "awaiting_settlement_evidence")[];
|
|
1268
1282
|
declare const AGENT_PAYMENT_FAILURE_CODE_VALUES: ("PRICE_EXCEEDS_MAX" | "PAYMENT_WINDOW_EXPIRED" | "MERCHANT_REJECTED_AFTER_FUNDING" | "MERCHANT_UNRESPONSIVE_AFTER_FUNDING" | "MERCHANT_CALL_CONTEXT_UNAVAILABLE" | "AMBIGUOUS_MAX_AMOUNT" | "MAX_AMOUNT_UNCONVERTIBLE" | "MERCHANT_NOT_READY")[];
|
|
1269
1283
|
declare const AGENT_PAYMENT_RAIL_VALUES: ("x402" | "mpp_demo" | "mpp_crypto" | "stripe_deposit" | "spt" | "direct" | "mpp")[];
|
|
@@ -1449,6 +1463,11 @@ interface PaymentStatusResult {
|
|
|
1449
1463
|
expiresAt: string;
|
|
1450
1464
|
chainId: number;
|
|
1451
1465
|
message: string;
|
|
1466
|
+
/**
|
|
1467
|
+
* #3420: `true` = the merchant answered 2xx (a `machine_payment_evidence`
|
|
1468
|
+
* row records its response); absent = unknown. See the raw field's doc.
|
|
1469
|
+
*/
|
|
1470
|
+
delivered?: boolean;
|
|
1452
1471
|
/** Platform fee surfaced so it's never silently collected (#386). */
|
|
1453
1472
|
fee?: PaymentFee | null;
|
|
1454
1473
|
amountAtomic?: string | null;
|
|
@@ -1995,7 +2014,7 @@ declare function buildSweepAuthorizationMessage(auth: SweepAuthorization): strin
|
|
|
1995
2014
|
* This SDK's own version. Owned by `scripts/release-bump.mjs`, which rewrites
|
|
1996
2015
|
* it with the package version on every release — never hand-edit it.
|
|
1997
2016
|
*/
|
|
1998
|
-
declare const SDK_VERSION = "0.0.0-dev.
|
|
2017
|
+
declare const SDK_VERSION = "0.0.0-dev.202609282315.dd06d7c";
|
|
1999
2018
|
/** The request header every published Haven client sends. */
|
|
2000
2019
|
declare const HAVEN_CLIENT_HEADER = "X-Haven-Client";
|
|
2001
2020
|
/** `<package>/<version>` — the value of {@link HAVEN_CLIENT_HEADER}. */
|
|
@@ -74,7 +74,21 @@ var AgentPaymentPhase = {
|
|
|
74
74
|
* agent should stop, tell the user, and wait for the sweep flow to reclaim
|
|
75
75
|
* the funds.
|
|
76
76
|
*/
|
|
77
|
-
FundedButUnsettled: "funded_but_unsettled"
|
|
77
|
+
FundedButUnsettled: "funded_but_unsettled",
|
|
78
|
+
/**
|
|
79
|
+
* #3420: TERMINAL — a `submitted` erc7710 x402 intent whose settlement
|
|
80
|
+
* window AND the sweep's last attribution chance have both passed with no
|
|
81
|
+
* verified evidence. The sweep's tick (120s) only ever confirms a
|
|
82
|
+
* transaction mined inside the payment's own settlement window (the child
|
|
83
|
+
* delegation's on-chain `timestamp` caveat, plus the verifier's 120s
|
|
84
|
+
* clock-skew allowance), so once authorize + window + skew is behind the
|
|
85
|
+
* payment, no poll — and no sweep tick — can ever change the answer.
|
|
86
|
+
* The paired `next_action` is `stop_and_tell_user`: tell the user the goods
|
|
87
|
+
* were delivered but Haven holds no verified settlement evidence; reporting
|
|
88
|
+
* a real settlement hash (`haven_report_settlement_evidence`) still works
|
|
89
|
+
* at any age.
|
|
90
|
+
*/
|
|
91
|
+
DeliveredUnverified: "delivered_unverified"
|
|
78
92
|
};
|
|
79
93
|
var AgentPaymentNextAction = {
|
|
80
94
|
/** Sign with the delegate key and submit the payment to Haven. */
|
|
@@ -222,7 +236,8 @@ var AgentPaymentPhaseDescriptions = {
|
|
|
222
236
|
[AgentPaymentPhase.Expired]: "The payment expired before completion.",
|
|
223
237
|
[AgentPaymentPhase.Failed]: "Haven could not complete the payment; the agent should stop and surface the failure.",
|
|
224
238
|
[AgentPaymentPhase.InsufficientFunds]: "Pre-flight check determined the delegate balance plus the remaining on-chain budget cannot cover the requested amount, so no payment was created. The account must be funded or the agent budget raised before retrying.",
|
|
225
|
-
[AgentPaymentPhase.FundedButUnsettled]: "Haven's funding leg confirmed on-chain but the merchant rejected the x402 retry. The delegate wallet may hold stranded funds. The agent should stop and wait for the wallet owner to sweep the stranded funds back to the account."
|
|
239
|
+
[AgentPaymentPhase.FundedButUnsettled]: "Haven's funding leg confirmed on-chain but the merchant rejected the x402 retry. The delegate wallet may hold stranded funds. The agent should stop and wait for the wallet owner to sweep the stranded funds back to the account.",
|
|
240
|
+
[AgentPaymentPhase.DeliveredUnverified]: "Terminal: the merchant delivered the goods and the settlement window plus the sweep's last attribution chance have both passed with no verified on-chain evidence. The payment can no longer resolve by polling. Tell the user the goods were delivered but Haven holds no verified settlement evidence for this payment."
|
|
226
241
|
};
|
|
227
242
|
var AgentPaymentNextActionDescriptions = {
|
|
228
243
|
[AgentPaymentNextAction.SignAndSubmitPayment]: "Sign with the delegate key and submit the payment to Haven.",
|
|
@@ -969,5 +984,5 @@ function assertRedeemsOwnBudgetDelegation(redeemCalldata, ownAccount) {
|
|
|
969
984
|
}
|
|
970
985
|
|
|
971
986
|
export { AGENT_PAYMENT_FAILURE_CODE_VALUES, AGENT_PAYMENT_NEXT_ACTION_VALUES, AGENT_PAYMENT_PHASE_VALUES, AGENT_PAYMENT_RAIL_VALUES, AgentPaymentFailureCode, AgentPaymentFailureCodeDescriptions, AgentPaymentFailureCodeSchema, AgentPaymentNextAction, AgentPaymentNextActionDescriptions, AgentPaymentNextActionSchema, AgentPaymentPhase, AgentPaymentPhaseDescriptions, AgentPaymentPhaseSchema, AgentPaymentRail, AgentPaymentRailDescriptions, AgentPaymentRailSchema, AgentPaymentWarningCode, CAVEAT_ENFORCERS, CONNECTOR_PACKAGE_NAME, DEFAULT_CONFIRMATION_TIMEOUT_MS, DELEGATION_MANAGER, DELEGATION_TUPLE_COMPONENTS, DIRECT_SIGN_CONTEXT_VERSION, ENTRY_POINT_V07, HAVEN_CONNECTOR_CHANNEL, HYBRID_DELEGATOR_DOMAIN_NAME, HYBRID_DELEGATOR_DOMAIN_VERSION, HYBRID_DELEGATOR_IMPLEMENTATION, HavenApiError, HavenError, HavenPaymentStateError, HavenSigningError, HavenTimeoutError, HavenUnsupportedSignerVersionError, HavenUserOpBindingError, HavenZeroSettlementHashError, MAX_SETTLEMENT_WINDOW_SECONDS, MerchantTimeoutError, PACKED_USER_OPERATION_FIELDS, REDEEM_DELEGATIONS_ABI, ROOT_AUTHORITY, SIGNER_UPDATE_FALLBACK, SIMPLE_FACTORY_ADDRESS, SINGLE_DEFAULT_MODE, SignerRefusalCode, X402AlreadySettledError, X402Erc7710AlreadySettledError, X402TaskBudgetMismatchError, X402UnexpectedStatusError, assertRedeemsOwnBudgetDelegation, assertUserOpTypedDataBinding, chainIdForNetwork, connectorRerunCommand, connectorSpec, connectorUpgradeCommand, deriveDelegateAccountAddress, isConnectorChannel, isPackedUserOperationTypedData, isSettlementChildTypedData, packedUserOperationHash, resolveConnectorChannel, signerUpdateFallback, verifySettlementChild };
|
|
972
|
-
//# sourceMappingURL=chunk-
|
|
973
|
-
//# sourceMappingURL=chunk-
|
|
987
|
+
//# sourceMappingURL=chunk-FVLF2A66.js.map
|
|
988
|
+
//# sourceMappingURL=chunk-FVLF2A66.js.map
|