@devlab.group/agent-commerce 2.5.0 → 2.7.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 (129) hide show
  1. package/README.md +78 -21
  2. package/dist/ap2.d.ts +19 -6
  3. package/dist/ap2.js +56 -18
  4. package/dist/ap2.js.map +1 -1
  5. package/dist/{chunk-ES3V6ECS.js → chunk-77HLISG4.js} +3 -2
  6. package/dist/chunk-77HLISG4.js.map +1 -0
  7. package/dist/{chunk-5ZYXBCDX.js → chunk-D7FPSGUQ.js} +25 -4
  8. package/dist/chunk-D7FPSGUQ.js.map +1 -0
  9. package/dist/{chunk-VUCMBGUR.js → chunk-DJRWYDKJ.js} +3 -3
  10. package/dist/{chunk-VUCMBGUR.js.map → chunk-DJRWYDKJ.js.map} +1 -1
  11. package/dist/{chunk-4K7FIBJM.js → chunk-EMKITGVV.js} +4 -4
  12. package/dist/chunk-EMKITGVV.js.map +1 -0
  13. package/dist/chunk-IWXVQYG5.js +6 -0
  14. package/dist/chunk-IWXVQYG5.js.map +1 -0
  15. package/dist/chunk-O3ACF45K.js +8 -0
  16. package/dist/chunk-O3ACF45K.js.map +1 -0
  17. package/dist/chunk-WDD2ZUR3.js +20 -0
  18. package/dist/chunk-WDD2ZUR3.js.map +1 -0
  19. package/dist/{chunk-3OTCFFFT.js → chunk-YHNTTMED.js} +7 -7
  20. package/dist/chunk-YHNTTMED.js.map +1 -0
  21. package/dist/{chunk-FKQK5XZA.js → chunk-ZSIUZPNB.js} +183 -80
  22. package/dist/chunk-ZSIUZPNB.js.map +1 -0
  23. package/dist/cli/{ap2-YAPLERSC.js → ap2-5FFGSW6F.js} +61 -25
  24. package/dist/cli/ap2-5FFGSW6F.js.map +1 -0
  25. package/dist/cli/{chunk-5K4XEAZV.js → chunk-3IEXJ7I3.js} +25 -4
  26. package/dist/cli/chunk-3IEXJ7I3.js.map +1 -0
  27. package/dist/cli/{chunk-NIU5EMSB.js → chunk-3NVJAQRO.js} +5 -5
  28. package/dist/cli/{chunk-NIU5EMSB.js.map → chunk-3NVJAQRO.js.map} +1 -1
  29. package/dist/cli/{chunk-IDY2735M.js → chunk-55AI6CLW.js} +6 -4
  30. package/dist/cli/chunk-55AI6CLW.js.map +1 -0
  31. package/dist/cli/{chunk-QA2OPHBF.js → chunk-5K2JDM4G.js} +185 -83
  32. package/dist/cli/chunk-5K2JDM4G.js.map +1 -0
  33. package/dist/cli/{chunk-QLUCNPRT.js → chunk-5TID36YG.js} +860 -170
  34. package/dist/cli/chunk-5TID36YG.js.map +1 -0
  35. package/dist/cli/{chunk-5R7DM5LM.js → chunk-66NTYSXI.js} +27 -27
  36. package/dist/cli/chunk-66NTYSXI.js.map +1 -0
  37. package/dist/cli/{chunk-VJ4EO4LE.js → chunk-6EBDOH37.js} +3 -3
  38. package/dist/cli/{chunk-VJ4EO4LE.js.map → chunk-6EBDOH37.js.map} +1 -1
  39. package/dist/cli/{chunk-4H2QLHQI.js → chunk-AGQ4U7IN.js} +5 -5
  40. package/dist/cli/chunk-AGQ4U7IN.js.map +1 -0
  41. package/dist/cli/chunk-APC5BTQM.js +6 -0
  42. package/dist/cli/chunk-APC5BTQM.js.map +1 -0
  43. package/dist/cli/{chunk-SYQLJXIU.js → chunk-C5YISPT6.js} +3 -3
  44. package/dist/cli/chunk-C5YISPT6.js.map +1 -0
  45. package/dist/cli/chunk-DKWO6LLX.js +34 -0
  46. package/dist/cli/chunk-DKWO6LLX.js.map +1 -0
  47. package/dist/cli/{chunk-SPAYKVUP.js → chunk-FL4HPCD4.js} +3 -2
  48. package/dist/cli/chunk-FL4HPCD4.js.map +1 -0
  49. package/dist/cli/{chunk-3EQBCFZY.js → chunk-H7EBJ4I3.js} +3 -3
  50. package/dist/cli/{chunk-3EQBCFZY.js.map → chunk-H7EBJ4I3.js.map} +1 -1
  51. package/dist/cli/{chunk-Z34UMZBB.js → chunk-OETKXDGA.js} +546 -175
  52. package/dist/cli/chunk-OETKXDGA.js.map +1 -0
  53. package/dist/cli/{chunk-JFVRG2HH.js → chunk-PLHPKXAT.js} +8 -8
  54. package/dist/cli/chunk-PLHPKXAT.js.map +1 -0
  55. package/dist/cli/{chunk-2UPPX3FJ.js → chunk-VSSSU4AU.js} +76 -14
  56. package/dist/cli/chunk-VSSSU4AU.js.map +1 -0
  57. package/dist/cli/chunk-ZCW56PZ3.js +8 -0
  58. package/dist/cli/{chunk-M7NXVRU5.js.map → chunk-ZCW56PZ3.js.map} +1 -1
  59. package/dist/cli/{chunk-2J2IQQ4X.js → chunk-ZFVQWOGG.js} +95 -42
  60. package/dist/cli/chunk-ZFVQWOGG.js.map +1 -0
  61. package/dist/cli/config-WT5HHDRR.js +13 -0
  62. package/dist/cli/{config-BWFMN2ZB.js.map → config-WT5HHDRR.js.map} +1 -1
  63. package/dist/cli/index.js +560 -252
  64. package/dist/cli/index.js.map +1 -1
  65. package/dist/cli/{mcp-KZEMXLHR.js → mcp-HHGNOUKE.js} +7 -7
  66. package/dist/cli/{mcp-KZEMXLHR.js.map → mcp-HHGNOUKE.js.map} +1 -1
  67. package/dist/cli/payment-providers-EWXZFBIE.js +6 -0
  68. package/dist/cli/{payment-providers-SZL36H3Y.js.map → payment-providers-EWXZFBIE.js.map} +1 -1
  69. package/dist/cli/{provider-6TKB5ADJ.js → provider-XUPLYNQ7.js} +36 -18
  70. package/dist/cli/provider-XUPLYNQ7.js.map +1 -0
  71. package/dist/cli/receipts-3DSV4DIK.js +9 -0
  72. package/dist/cli/{receipts-ZGLJWMQG.js.map → receipts-3DSV4DIK.js.map} +1 -1
  73. package/dist/cli/reconcile-GS25MQ42.js +4 -0
  74. package/dist/cli/{reconcile-IC22MJD5.js.map → reconcile-GS25MQ42.js.map} +1 -1
  75. package/dist/cli/{run-ZTYPQI4D.js → run-7KLKW3HE.js} +310 -91
  76. package/dist/cli/run-7KLKW3HE.js.map +1 -0
  77. package/dist/cli/{x402-WLYBLODI.js → x402-HP4E3QET.js} +11 -10
  78. package/dist/cli/x402-HP4E3QET.js.map +1 -0
  79. package/dist/{guardrails-CX_jYXvZ.d.ts → guardrails-CeyLS1ou.d.ts} +2 -2
  80. package/dist/index.d.ts +119 -206
  81. package/dist/index.js +1703 -427
  82. package/dist/index.js.map +1 -1
  83. package/dist/logger-CllGwQ8i.d.ts +19 -0
  84. package/dist/mcp.d.ts +3 -1
  85. package/dist/mcp.js +4 -3
  86. package/dist/mcp.js.map +1 -1
  87. package/dist/mpp.d.ts +2 -1
  88. package/dist/mpp.js +32 -13
  89. package/dist/mpp.js.map +1 -1
  90. package/dist/{protocol-adapter-DEXpdp8m.d.ts → protocol-adapter-DdFL5LBU.d.ts} +15 -132
  91. package/dist/{runtime-Dz2fSO-P.d.ts → runtime-BmaSp2Ce.d.ts} +36 -23
  92. package/dist/store-BVvMzpuV.d.ts +389 -0
  93. package/dist/testing.d.ts +51 -0
  94. package/dist/testing.js +2050 -0
  95. package/dist/testing.js.map +1 -0
  96. package/dist/transaction-BXXJltZ-.d.ts +129 -0
  97. package/dist/{types-j7MnUXYN.d.ts → types-DWqjz81-.d.ts} +5 -2
  98. package/dist/x402.d.ts +9 -3
  99. package/dist/x402.js +7 -5
  100. package/dist/x402.js.map +1 -1
  101. package/package.json +17 -29
  102. package/dist/chunk-3OTCFFFT.js.map +0 -1
  103. package/dist/chunk-4K7FIBJM.js.map +0 -1
  104. package/dist/chunk-5ZYXBCDX.js.map +0 -1
  105. package/dist/chunk-ES3V6ECS.js.map +0 -1
  106. package/dist/chunk-FKQK5XZA.js.map +0 -1
  107. package/dist/cli/ap2-YAPLERSC.js.map +0 -1
  108. package/dist/cli/chunk-2J2IQQ4X.js.map +0 -1
  109. package/dist/cli/chunk-2UPPX3FJ.js.map +0 -1
  110. package/dist/cli/chunk-4H2QLHQI.js.map +0 -1
  111. package/dist/cli/chunk-5K4XEAZV.js.map +0 -1
  112. package/dist/cli/chunk-5R7DM5LM.js.map +0 -1
  113. package/dist/cli/chunk-FHCFR2GS.js +0 -17
  114. package/dist/cli/chunk-FHCFR2GS.js.map +0 -1
  115. package/dist/cli/chunk-IDY2735M.js.map +0 -1
  116. package/dist/cli/chunk-JFVRG2HH.js.map +0 -1
  117. package/dist/cli/chunk-M7NXVRU5.js +0 -8
  118. package/dist/cli/chunk-QA2OPHBF.js.map +0 -1
  119. package/dist/cli/chunk-QLUCNPRT.js.map +0 -1
  120. package/dist/cli/chunk-SPAYKVUP.js.map +0 -1
  121. package/dist/cli/chunk-SYQLJXIU.js.map +0 -1
  122. package/dist/cli/chunk-Z34UMZBB.js.map +0 -1
  123. package/dist/cli/config-BWFMN2ZB.js +0 -12
  124. package/dist/cli/payment-providers-SZL36H3Y.js +0 -6
  125. package/dist/cli/provider-6TKB5ADJ.js.map +0 -1
  126. package/dist/cli/receipts-ZGLJWMQG.js +0 -8
  127. package/dist/cli/reconcile-IC22MJD5.js +0 -4
  128. package/dist/cli/run-ZTYPQI4D.js.map +0 -1
  129. package/dist/cli/x402-WLYBLODI.js.map +0 -1
@@ -1,10 +1,10 @@
1
- import { chainIdFromCaip2 } from './chunk-QA2OPHBF.js';
2
- export { createX402PaymentProvider } from './chunk-QA2OPHBF.js';
3
- import './chunk-M7NXVRU5.js';
4
- import './chunk-4H2QLHQI.js';
5
- export { SUPPORTED_NETWORK_IDS } from './chunk-5R7DM5LM.js';
6
- import './chunk-IDY2735M.js';
7
- import { CommerceError } from './chunk-SYQLJXIU.js';
1
+ import { chainIdFromCaip2 } from './chunk-5K2JDM4G.js';
2
+ export { createX402PaymentProvider } from './chunk-5K2JDM4G.js';
3
+ import './chunk-AGQ4U7IN.js';
4
+ export { SUPPORTED_NETWORK_IDS } from './chunk-66NTYSXI.js';
5
+ import './chunk-ZCW56PZ3.js';
6
+ import './chunk-55AI6CLW.js';
7
+ import { CommerceError } from './chunk-C5YISPT6.js';
8
8
  import './chunk-663ALDZA.js';
9
9
  import './chunk-3M6U7ILB.js';
10
10
  import { PaymentRequirementsV2Schema } from '@x402/core/schemas';
@@ -82,7 +82,8 @@ async function createPaymentProof(options) {
82
82
  validBefore: validBefore.toString(),
83
83
  nonce
84
84
  }
85
- }
85
+ },
86
+ ...options.extensions !== void 0 ? { extensions: { ...options.extensions } } : {}
86
87
  };
87
88
  return Buffer.from(JSON.stringify(payload), "utf8").toString("base64");
88
89
  }
@@ -93,5 +94,5 @@ function randomNonce() {
93
94
  }
94
95
 
95
96
  export { createPaymentProof };
96
- //# sourceMappingURL=x402-WLYBLODI.js.map
97
- //# sourceMappingURL=x402-WLYBLODI.js.map
97
+ //# sourceMappingURL=x402-HP4E3QET.js.map
98
+ //# sourceMappingURL=x402-HP4E3QET.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/payments/x402/client.ts"],"names":[],"mappings":"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","file":"x402-HP4E3QET.js","sourcesContent":["/**\n * Client-side payment helper: builds and EIP-712-signs an x402 v2 `exact`/EVM\n * authorization on the buyer's side. The demo buyer agent and the test suites\n * use it, and the `/x402` entry exports it. The gateway never calls it and\n * never holds a buyer key.\n *\n * It signs directly rather than through the SDK's `x402Client` because of\n * `overrides`: negative tests need deliberately wrong authorizations that a\n * conforming client will not produce. The x402 settlement E2E suite also\n * settles a payment built by `x402Client` itself to cover interoperability.\n */\n\nimport { PaymentRequirementsV2Schema } from '@x402/core/schemas';\nimport type { PaymentPayload, PaymentRequirements } from '@x402/core/types';\nimport { getAddress, toHex } from 'viem';\nimport { privateKeyToAccount } from 'viem/accounts';\nimport { CommerceError } from '../../core';\nimport { chainIdFromCaip2 } from './chain';\n\nexport interface CreatePaymentProofOptions {\n /** The buyer's private key. It signs locally and is never sent anywhere */\n readonly buyerPrivateKey: `0x${string}`;\n /** One entry from PaymentRequiredEnvelope.payment.accepts, verbatim */\n readonly accepts: Readonly<Record<string, unknown>>;\n /**\n * `PaymentPayload.extensions`, sent outside the signature. Echo the challenge's\n * declarations; for `payment-identifier`, add the buyer's `id` to `info`.\n */\n readonly extensions?: Readonly<Record<string, unknown>>;\n /** For negative tests only: a wrong amount, recipient, nonce or validity window */\n readonly overrides?: {\n readonly value?: string;\n readonly payTo?: string;\n readonly nonce?: `0x${string}`;\n readonly validBefore?: number;\n readonly validAfter?: number;\n };\n}\n\nconst X402_VERSION = 2;\n\nconst TRANSFER_WITH_AUTHORIZATION_TYPES = {\n TransferWithAuthorization: [\n { name: 'from', type: 'address' },\n { name: 'to', type: 'address' },\n { name: 'value', type: 'uint256' },\n { name: 'validAfter', type: 'uint256' },\n { name: 'validBefore', type: 'uint256' },\n { name: 'nonce', type: 'bytes32' },\n ],\n} as const;\n\n/** Returns the base64 `PAYMENT-SIGNATURE` value to send back to the gateway */\nexport async function createPaymentProof(options: CreatePaymentProofOptions): Promise<string> {\n const requirements = PaymentRequirementsV2Schema.parse(options.accepts);\n const method = requirements.extra?.['assetTransferMethod'];\n if (method !== undefined && method !== 'eip3009') {\n throw new CommerceError(\n 'INPUT_INVALID',\n `createPaymentProof: signs EIP-3009 only, and this offer uses \"${String(method)}\"; sign it with the SDK's x402Client`,\n );\n }\n if (\n !requirements.extra ||\n typeof requirements.extra['name'] !== 'string' ||\n typeof requirements.extra['version'] !== 'string'\n ) {\n throw new CommerceError(\n 'INPUT_INVALID',\n 'createPaymentProof: payment requirement is missing extra.name/extra.version, so the EIP-712 domain cannot be built',\n );\n }\n\n const chainId = chainIdFromCaip2(requirements.network);\n if (chainId === undefined) {\n throw new CommerceError(\n 'INPUT_INVALID',\n `createPaymentProof: network \"${requirements.network}\" is not a CAIP-2 eip155 identifier, so there is no chain id to sign against`,\n );\n }\n\n const account = privateKeyToAccount(options.buyerPrivateKey);\n\n const nonce = options.overrides?.nonce ?? randomNonce();\n const nowSeconds = Math.floor(Date.now() / 1000);\n // 0, as in the SDK's own v2 client: nothing here wants the authorization\n // delayed\n const validAfter = options.overrides?.validAfter ?? 0;\n const validBefore = options.overrides?.validBefore ?? nowSeconds + requirements.maxTimeoutSeconds;\n const to = getAddress((options.overrides?.payTo ?? requirements.payTo) as `0x${string}`);\n const value = BigInt(options.overrides?.value ?? requirements.amount);\n\n const signature = await account.signTypedData({\n domain: {\n name: requirements.extra['name'],\n version: requirements.extra['version'],\n chainId,\n verifyingContract: getAddress(requirements.asset as `0x${string}`),\n },\n types: TRANSFER_WITH_AUTHORIZATION_TYPES,\n primaryType: 'TransferWithAuthorization',\n message: {\n from: account.address,\n to,\n value,\n validAfter: BigInt(validAfter),\n validBefore: BigInt(validBefore),\n nonce,\n },\n });\n\n // v2 echoes the chosen requirement back as `accepted` so a stateless\n // facilitator knows which offer was taken. The gateway verifies against its\n // own copy.\n const payload: PaymentPayload = {\n x402Version: X402_VERSION,\n accepted: requirements as PaymentRequirements,\n payload: {\n signature,\n authorization: {\n from: account.address,\n to,\n value: value.toString(),\n validAfter: validAfter.toString(),\n validBefore: validBefore.toString(),\n nonce,\n },\n },\n ...(options.extensions !== undefined ? { extensions: { ...options.extensions } } : {}),\n };\n\n return Buffer.from(JSON.stringify(payload), 'utf8').toString('base64');\n}\n\nfunction randomNonce(): `0x${string}` {\n const bytes = new Uint8Array(32);\n crypto.getRandomValues(bytes);\n return toHex(bytes);\n}\n"]}
@@ -12,8 +12,8 @@ type X402PaymentFlow = (typeof X402_PAYMENT_FLOWS)[number];
12
12
  * - `none`: send no credential; use it when the facilitator accepts
13
13
  * anonymous requests.
14
14
  * - `bearer`: send a static token; no extra peer package is needed.
15
- * - `cdp`: Coinbase Developer Platform. The optional peer `@coinbase/x402`,
16
- * imported only for this type, signs a fresh JWT per request.
15
+ * - `cdp`: Coinbase Developer Platform. The gateway signs a fresh JWT per
16
+ * request with the API key; no extra peer package is needed.
17
17
  *
18
18
  * Any other auth type is refused at config load.
19
19
  */
package/dist/index.d.ts CHANGED
@@ -1,11 +1,16 @@
1
1
  import { Ap2AuthorizationConfig } from './ap2.js';
2
- import { I as IsoTimestamp, D as DecimalAmount, P as PaymentMethodName, a as AuthorizationRequirement, b as CommerceResource, c as PaymentSubmission, d as AuthorizationSubmission, B as BackendHandler, e as ProtocolName, f as AuthorizationRecord, g as PaymentAttempt, h as CommerceReceipt, i as PaymentAttemptResolution, j as AdapterDescriptor, k as AdapterHealth, R as ResourceRegistry, l as PaymentProvider, A as AuthorizationProvider, L as Logger, C as Clock, m as IdGenerator } from './runtime-Dz2fSO-P.js';
3
- export { n as AdapterHealthComponent, o as AuthorizationFinalizeContext, p as AuthorizationMethodName, q as AuthorizationVerification, r as AuthorizationVerificationContext, s as BackendMethod, t as DEFAULT_BACKEND_TIMEOUT_MS, J as JsonSchema, N as NOOP_LOGGER, u as PAYMENT_METHOD_NAMES, v as PROTOCOL_NAMES, w as PaymentChallenge, x as PaymentContext, y as PaymentReconciliationContext, z as PaymentReconciliationResult, E as PaymentRequirement, F as PaymentResult, G as PaymentSettlementContext, H as PaymentVerificationContext, K as Pricing, M as RECONCILIATION_METADATA_KEY, O as systemClock } from './runtime-Dz2fSO-P.js';
2
+ import { I as IsoTimestamp, D as DecimalAmount, P as PaymentMethodName, a as AuthorizationRequirement, b as CommerceResource, c as PaymentSubmission, d as AuthorizationSubmission, B as BackendHandler, R as ResourceRegistry, e as PaymentProvider, A as AuthorizationProvider, C as Clock, f as IdGenerator, g as AdapterDescriptor, h as AdapterHealth } from './runtime-BmaSp2Ce.js';
3
+ export { i as AdapterHealthComponent, j as AuthorizationFinalizeContext, k as AuthorizationMethodName, l as AuthorizationRecord, m as AuthorizationVerification, n as AuthorizationVerificationContext, o as BackendMethod, p as CommerceReceipt, q as DEFAULT_BACKEND_TIMEOUT_MS, J as JsonSchema, r as PAYMENT_METHOD_NAMES, s as PROTOCOL_NAMES, t as PaymentAttempt, u as PaymentAttemptResolution, v as PaymentChallenge, w as PaymentContext, x as PaymentReconciliationContext, y as PaymentReconciliationResult, z as PaymentRequirement, E as PaymentResult, F as PaymentSettlementContext, G as PaymentVerificationContext, H as Pricing, K as ProtocolName, L as RECONCILIATION_METADATA_KEY, M as systemClock } from './runtime-BmaSp2Ce.js';
4
4
  import { M as MppNetwork } from './constants-BG22tE8S.js';
5
5
  import { X402PaymentFlow, X402FacilitatorConfig } from './x402.js';
6
6
  import { C as CustomNetworks } from './networks-DDHYJLcg.js';
7
- import { D as DeliveredOutcome, P as PaymentRequiredOutcome, C as CommerceEvent, A as AuthorizationHoldState, a as PersistenceFailure, T as Transaction, b as TransactionState, E as ExecutionPipeline, c as ProtocolAdapter, H as HttpProtocolAdapter, d as AdapterHttpRoute, e as ProtocolAdapterContext } from './protocol-adapter-DEXpdp8m.js';
8
- export { f as COMMERCE_EVENT_TYPES, g as CanonicalRequest, h as CommerceEventType, i as EventSink, j as ExecutionOutcome, k as TRANSACTION_STATES, l as TransactionFacts, m as isHttpProtocolAdapter, t as transactionState } from './protocol-adapter-DEXpdp8m.js';
7
+ export { A as AuthorizationHoldState, C as COMMERCE_EVENT_TYPES, a as CommerceEvent, b as CommerceEventType, E as EventSink, P as PersistenceFailure, T as TRANSACTION_STATES, c as Transaction, d as TransactionFacts, e as TransactionState, t as transactionState } from './transaction-BXXJltZ-.js';
8
+ import { D as DeliveredOutcome, P as PaymentRequiredOutcome, E as ExecutionPipeline, a as ProtocolAdapter, H as HttpProtocolAdapter, A as AdapterHttpRoute, b as ProtocolAdapterContext } from './protocol-adapter-DdFL5LBU.js';
9
+ export { C as CanonicalRequest, c as ExecutionOutcome, i as isHttpProtocolAdapter } from './protocol-adapter-DdFL5LBU.js';
10
+ import { R as ReceiptStore } from './store-BVvMzpuV.js';
11
+ export { A as AuthorizationHold, a as AuthorizationHoldReservation, b as AuthorizationHoldResult, I as IdempotencyClaim, c as IdempotencyScope, d as IdempotencyUpdate, L as ListOptions, N as NewTransaction, P as PaymentAttemptListOptions, e as PaymentAttemptReservation, f as PaymentAttemptResolveRequest, g as PaymentAttemptUpdate, h as PendingTask, i as ReceiptListOptions, T as TransactionListOptions, j as TransactionPage, k as TransactionStep } from './store-BVvMzpuV.js';
12
+ import { L as Logger } from './logger-CllGwQ8i.js';
13
+ export { N as NOOP_LOGGER } from './logger-CllGwQ8i.js';
9
14
  import { FastifyInstance } from 'fastify';
10
15
  import { IncomingMessage, ServerResponse } from 'node:http';
11
16
 
@@ -21,7 +26,7 @@ type CommerceErrorCode = (typeof COMMERCE_ERROR_CODES)[number];
21
26
  * 4xx or 5xx status, never to a delivery.
22
27
  */
23
28
  declare const COMMERCE_ERROR_HTTP_STATUS: Readonly<Record<CommerceErrorCode, number>>;
24
- /** Codes for which a client may reasonably retry the same request */
29
+ /** Codes for which a client may reasonably retry the same request, by default */
25
30
  declare const RETRYABLE_ERROR_CODES: ReadonlySet<CommerceErrorCode>;
26
31
 
27
32
  interface CommerceErrorOptions {
@@ -32,6 +37,8 @@ interface CommerceErrorOptions {
32
37
  readonly resourceId?: string;
33
38
  /** Override the default HTTP status for this code */
34
39
  readonly httpStatus?: number;
40
+ /** Override the code's default retryability for this error instance */
41
+ readonly retryable?: boolean;
35
42
  }
36
43
  /** Serializable wire form of a CommerceError */
37
44
  interface CommerceErrorInfo {
@@ -217,6 +224,11 @@ interface DeliverySummary {
217
224
  readonly externalReference?: string;
218
225
  readonly network?: string;
219
226
  };
227
+ /**
228
+ * True when this request reuses a stored response without another charge.
229
+ * Experimental: may change in a minor release.
230
+ */
231
+ readonly redelivered?: boolean;
220
232
  }
221
233
  /** Build the payer-facing summary of a delivered outcome */
222
234
  declare function toDeliverySummary(outcome: DeliveredOutcome): DeliverySummary;
@@ -272,10 +284,11 @@ interface BackendRequest {
272
284
  * `requestId`, which is fresh per call and would make every retry look like
273
285
  * new work.
274
286
  *
275
- * An adapter sets it only when the value survives a client retry, a
276
- * reconnect and a gateway restart. The HTTP executor sends it as the
277
- * `Idempotency-Key` header, replacing one set in `BackendHandler.headers`;
278
- * when absent, the executor adds none.
287
+ * An adapter may supply this key, or the pipeline may derive it when
288
+ * `idempotency.merchantKey` is true. The value must survive client retries,
289
+ * reconnects and gateway restarts. An adapter's key takes precedence.
290
+ * The HTTP executor sends it as the `Idempotency-Key` header, replacing one
291
+ * set in `BackendHandler.headers`; when absent, the executor adds none.
279
292
  */
280
293
  readonly idempotencyKey?: string;
281
294
  /**
@@ -302,197 +315,6 @@ interface BackendExecutor {
302
315
  call(handler: BackendHandler, request: BackendRequest): Promise<BackendResponse>;
303
316
  }
304
317
 
305
- /**
306
- * Persistence boundary for receipts, events and payment attempts, implemented
307
- * by src/storage/receipts. Core depends only on this interface, never on
308
- * SQLite.
309
- */
310
-
311
- interface PaymentAttemptReservation {
312
- readonly requestId: string;
313
- readonly resourceId: string;
314
- readonly provider: string;
315
- /** Must be unique across the store; see `PaymentResult.replayKey` */
316
- readonly replayKey: string;
317
- readonly amount: string;
318
- readonly currency: string;
319
- readonly payer?: string;
320
- readonly payee?: string;
321
- /**
322
- * Reclaim this `replayKey` if the same `provider` rejected it, which
323
- * settled nothing. Set only for rails whose authorizations remain reusable
324
- * until settled.
325
- */
326
- readonly reclaimRejected?: boolean;
327
- /**
328
- * Journal data to write atomically with the reservation. Stores without
329
- * journal support ignore it.
330
- */
331
- readonly transaction?: NewTransaction;
332
- }
333
- /**
334
- * Data for a journal row opened with a replay reservation. Journal stores
335
- * must initialize an included authorization hold as `reserved`. The reservation
336
- * supplies the request, resource, provider, replay key, amount, currency and
337
- * payee. Experimental: may change in a minor release.
338
- */
339
- interface NewTransaction {
340
- readonly id: string;
341
- readonly protocol: ProtocolName;
342
- readonly network?: string;
343
- readonly asset?: string;
344
- readonly locator?: Readonly<Record<string, unknown>>;
345
- readonly expiresAt?: IsoTimestamp;
346
- readonly authorization?: AuthorizationRecord & {
347
- readonly reservationId: string;
348
- };
349
- readonly inputDigest?: string;
350
- readonly configDigest: string;
351
- }
352
- /**
353
- * A journal update after replay reservation. Experimental: may change in a
354
- * minor release.
355
- */
356
- type TransactionStep = {
357
- readonly transactionId: string;
358
- readonly at: IsoTimestamp;
359
- } & ({
360
- readonly kind: 'settling';
361
- } | {
362
- readonly kind: 'hold';
363
- readonly hold: AuthorizationHoldState;
364
- } | {
365
- readonly kind: 'backend-dispatched';
366
- readonly deadlineAt: IsoTimestamp;
367
- } | {
368
- readonly kind: 'backend-result';
369
- readonly status: number;
370
- readonly errorCode?: string;
371
- } | {
372
- readonly kind: 'receipt';
373
- readonly receiptId: string;
374
- } | {
375
- readonly kind: 'completed';
376
- readonly persistenceFailures?: readonly PersistenceFailure[];
377
- });
378
- /** Experimental: may change in a minor release */
379
- interface TransactionListOptions extends ListOptions {
380
- /** Opaque cursor from a previous page's `nextCursor` */
381
- readonly cursor?: string;
382
- readonly state?: TransactionState;
383
- /** When true, exclude `delivered` and `payment-failed` states */
384
- readonly unresolved?: boolean;
385
- /** When true, filter for `reserved` or `uncertain` authorization holds */
386
- readonly pendingHold?: boolean;
387
- }
388
- /** Transactions in newest-first order. Experimental: may change in a minor release */
389
- interface TransactionPage {
390
- readonly transactions: readonly Transaction[];
391
- /**
392
- * Continue with this cursor even when filtering returns fewer than `limit`
393
- * transactions, including an empty page. Pagination ends when it is absent.
394
- */
395
- readonly nextCursor?: string;
396
- }
397
- /** Experimental: may change in a minor release */
398
- interface PaymentAttemptResolveRequest {
399
- readonly attemptId: string;
400
- /** Update only if the attempt still has this status and no resolution */
401
- readonly expectedStatus: PaymentAttempt['status'];
402
- readonly status: 'settled' | 'rejected';
403
- readonly rejectionReason?: string;
404
- readonly resolution: PaymentAttemptResolution;
405
- }
406
- interface PaymentAttemptUpdate {
407
- readonly replayKey: string;
408
- readonly status: PaymentAttempt['status'];
409
- readonly externalReference?: string;
410
- readonly rejectionReason?: string;
411
- }
412
- interface ListOptions {
413
- readonly limit?: number;
414
- readonly requestId?: string;
415
- }
416
- interface ReceiptListOptions extends ListOptions {
417
- /**
418
- * When true, return only receipts counted by {@link ReceiptStore.countUndeliveredReceipts}.
419
- * Stores ignoring this flag also return delivered receipts.
420
- */
421
- readonly undelivered?: boolean;
422
- }
423
- interface PaymentAttemptListOptions extends ListOptions {
424
- /**
425
- * When true, return only attempts counted by {@link ReceiptStore.countUncertainPaymentAttempts}.
426
- * Stores that ignore this flag do not filter by settlement status.
427
- */
428
- readonly uncertain?: boolean;
429
- }
430
- interface ReceiptStore {
431
- init(): Promise<void>;
432
- /** Append a canonical event. Must not throw into the caller's flow */
433
- appendEvent(event: CommerceEvent): Promise<void>;
434
- /**
435
- * Atomically reserve a payment authorization before settlement. If its
436
- * `replayKey` is already reserved, throws `CommerceError('PAYMENT_REPLAYED')`
437
- * with the existing attempt's `PaymentAttempt.status` in
438
- * `details.attemptStatus` when available.
439
- *
440
- * With `reclaimRejected`, replace the same provider's `rejected` attempt,
441
- * which settled nothing. Only one concurrent claim can replace it with the
442
- * new reservation.
443
- */
444
- reservePaymentAttempt(reservation: PaymentAttemptReservation): Promise<PaymentAttempt>;
445
- /** Must not change an attempt that has a resolution; the SQLite store throws `STORAGE_ERROR` */
446
- updatePaymentAttempt(update: PaymentAttemptUpdate): Promise<void>;
447
- saveReceipt(receipt: CommerceReceipt): Promise<void>;
448
- getReceipt(id: string): Promise<CommerceReceipt | undefined>;
449
- listReceipts(options?: ReceiptListOptions): Promise<readonly CommerceReceipt[]>;
450
- /**
451
- * Total receipts held. `listReceipts` clamps every page, so counting a list's
452
- * length would stop at the clamp.
453
- */
454
- countReceipts(): Promise<number>;
455
- /**
456
- * Receipts whose delivery failed: `backendStatus` outside 2xx, including 0
457
- * when no status is known. Counted rather than listed for the same reason as
458
- * {@link countReceipts}.
459
- *
460
- * In practice this is "paid but undelivered": the pipeline writes a receipt
461
- * for a failed delivery only after a settled payment, so a free resource
462
- * whose backend fails leaves no row here. It is the row a merchant must
463
- * notice, because settlement is final and the gateway issues no refunds.
464
- */
465
- countUndeliveredReceipts(): Promise<number>;
466
- /**
467
- * Counts `settlement-uncertain` and legacy `failed` payment attempts.
468
- * Funds may have moved, but the pipeline withholds delivery and writes no
469
- * receipt for an uncertain settlement. {@link countUndeliveredReceipts}
470
- * therefore misses these attempts. Reconcile them on chain using
471
- * `externalReference` when it holds a transaction hash.
472
- */
473
- countUncertainPaymentAttempts(): Promise<number>;
474
- listEvents(options?: ListOptions): Promise<readonly CommerceEvent[]>;
475
- listPaymentAttempts(options?: PaymentAttemptListOptions): Promise<readonly PaymentAttempt[]>;
476
- /**
477
- * Record a journal step. Journal methods are optional for compatibility with
478
- * stores that do not support the journal. Implementations must also recompute
479
- * a transaction's cached state atomically with payment-attempt updates.
480
- * Experimental: may change in a minor release.
481
- */
482
- recordTransactionStep?(step: TransactionStep): Promise<void>;
483
- getTransaction?(id: string): Promise<Transaction | undefined>;
484
- listTransactions?(options?: TransactionListOptions): Promise<TransactionPage>;
485
- getPaymentAttempt?(id: string): Promise<PaymentAttempt | undefined>;
486
- /**
487
- * Compare-and-set: return `false` without writing if the attempt's status
488
- * differs from `expectedStatus` or it already has a resolution
489
- */
490
- resolvePaymentAttempt?(request: PaymentAttemptResolveRequest): Promise<boolean>;
491
- readonly descriptor: AdapterDescriptor;
492
- health(): Promise<AdapterHealth>;
493
- close(): Promise<void>;
494
- }
495
-
496
318
  /**
497
319
  * ACP protocol constants shared by the config layer and the adapter.
498
320
  *
@@ -542,7 +364,11 @@ type AcpProtocolConfig = {
542
364
  readonly token: string;
543
365
  };
544
366
  readonly idempotency: {
545
- readonly path: string;
367
+ /**
368
+ * Legacy file for CLI import or an ACP adapter's file fallback.
369
+ * @deprecated Use the receipt store; removal of this key is planned for 3.0.0.
370
+ */
371
+ readonly path?: string;
546
372
  readonly retentionHours: number;
547
373
  readonly merchantIdempotent: boolean;
548
374
  };
@@ -697,6 +523,10 @@ interface GatewayInstance {
697
523
  listen(): Promise<{
698
524
  url: string;
699
525
  }>;
526
+ /**
527
+ * Stops accepting connections and drains in-flight requests before stopping
528
+ * adapters, then resolves when both are done.
529
+ */
700
530
  close(): Promise<void>;
701
531
  /** Fastify instance, for `.inject()` in tests */
702
532
  readonly server: FastifyInstance;
@@ -710,6 +540,12 @@ interface A2aAdapterOptions {
710
540
  readonly agentDescription?: string;
711
541
  /** Version published on the card. Defaults to this package's version */
712
542
  readonly agentVersion?: string;
543
+ /**
544
+ * Stores x402 tasks awaiting payment when all pending-task methods are
545
+ * present. Durable stores can preserve unexpired tasks across restarts;
546
+ * otherwise tasks stay in memory. The adapter never closes this store.
547
+ */
548
+ readonly store?: ReceiptStore;
713
549
  }
714
550
  declare class A2aProtocolAdapter implements HttpProtocolAdapter {
715
551
  readonly name: "a2a";
@@ -719,6 +555,7 @@ declare class A2aProtocolAdapter implements HttpProtocolAdapter {
719
555
  private readonly agentName;
720
556
  private readonly agentDescription;
721
557
  private readonly agentVersion;
558
+ private readonly store;
722
559
  private context;
723
560
  private started;
724
561
  private skillsById;
@@ -787,9 +624,19 @@ interface AcpAdapterOptions {
787
624
  readonly token: string;
788
625
  /** Which canonical resource implements each ACP checkout operation */
789
626
  readonly operations: Readonly<Record<AcpCheckoutOperation, string>>;
790
- /** Where checkout idempotency records live, and how long they are kept */
627
+ /**
628
+ * Holds checkout idempotency claims when it implements the idempotency
629
+ * methods. The adapter never closes it.
630
+ */
631
+ readonly store?: ReceiptStore;
632
+ /** How long checkout idempotency records are kept, and the file fallback */
791
633
  readonly idempotency: {
792
- readonly path: string;
634
+ /**
635
+ * Required when no suitable `store` is supplied; the adapter opens and
636
+ * closes this fallback file itself.
637
+ * @deprecated Pass a receipt store. Configured gateways use this path for legacy import.
638
+ */
639
+ readonly path?: string;
793
640
  readonly retentionHours: number;
794
641
  /**
795
642
  * Declare that the merchant deduplicates by the derived `Idempotency-Key`.
@@ -813,13 +660,16 @@ declare class AcpProtocolAdapter implements HttpProtocolAdapter {
813
660
  */
814
661
  private deployment;
815
662
  private readonly discoveryMetadata;
663
+ private readonly store;
816
664
  private idempotency;
665
+ private fileStore;
817
666
  private resources;
818
667
  private context;
819
668
  private started;
820
669
  private discovery;
821
670
  constructor(options: AcpAdapterOptions);
822
671
  start(context: ProtocolAdapterContext): Promise<void>;
672
+ private openIdempotency;
823
673
  /** `GET /.well-known/acp.json`: public, unauthenticated, cacheable */
824
674
  handleDiscovery(req: IncomingMessage, res: ServerResponse): Promise<void>;
825
675
  /** `<mountPath>/checkout_sessions...`: the five stable checkout routes */
@@ -838,14 +688,77 @@ declare class AcpProtocolAdapter implements HttpProtocolAdapter {
838
688
  }
839
689
  declare function createAcpAdapter(options: AcpAdapterOptions): AcpProtocolAdapter;
840
690
 
691
+ /** Deprecated store files to import. Experimental: through 2.x only */
692
+ interface LegacyStoreOptions {
693
+ /** Deprecated `authorization.ap2.replay.path` */
694
+ readonly ap2Replay?: string;
695
+ /** Deprecated `protocols.acp.idempotency.path` */
696
+ readonly acpIdempotency?: string;
697
+ /**
698
+ * Enabled features whose missing legacy history must be checked. Without a
699
+ * recorded import or prior check, `init()` rejects an unset key or missing
700
+ * file when the receipt database shows past use. `:memory:` explicitly
701
+ * declares that no legacy file was retained. A passed check with no file
702
+ * is recorded so later starts can omit the key.
703
+ */
704
+ readonly enabled?: {
705
+ readonly ap2?: boolean;
706
+ readonly acp?: boolean;
707
+ };
708
+ }
709
+ /** A deprecated store file's name in `legacy_imports` */
710
+ type LegacySource = 'ap2-replay' | 'acp-idempotency';
711
+
841
712
  interface SqliteReceiptStoreOptions {
842
713
  /** File path, or ':memory:' for tests. Parent directory is created if missing */
843
714
  readonly path: string;
844
715
  readonly logger?: Logger;
845
716
  readonly clock?: Clock;
846
717
  readonly ids?: IdGenerator;
718
+ /**
719
+ * Deprecated store files for `init()` to import and write-lock until
720
+ * `close()`. Imports are recorded once per source. Experimental: may change
721
+ * in a minor release.
722
+ */
723
+ readonly legacyStores?: LegacyStoreOptions;
724
+ }
725
+ /** Recorded import from a deprecated store file */
726
+ interface SqliteLegacyImport {
727
+ readonly source: string;
728
+ readonly path: string;
729
+ readonly rows: number;
730
+ readonly importedAt: IsoTimestamp;
731
+ }
732
+ /** Diagnostic counts for `doctor`. Experimental: may change in a minor release */
733
+ interface SqliteReceiptStoreSummary {
734
+ /** Unresolved transactions by state, derived when read */
735
+ readonly unresolvedTransactions: Readonly<Record<string, number>>;
736
+ /**
737
+ * `reserved` holds last updated before the age cutoff whose request has no
738
+ * current or archived payment attempt
739
+ */
740
+ readonly orphanHolds: number;
741
+ /** Unresolved claims whose endpoints do not start with `payment:` */
742
+ readonly unresolvedIdempotencyKeys: number;
743
+ /** Unresolved claims whose endpoints start with `payment:` */
744
+ readonly unresolvedPaymentKeys: number;
745
+ readonly unexpiredPendingTasks: number;
746
+ readonly legacyImports: readonly SqliteLegacyImport[];
747
+ /**
748
+ * Sources with past-use evidence and no recorded import or prior check.
749
+ * When enabled, these features cannot start with an unset key or missing
750
+ * legacy file unless the loss of that history is explicitly accepted.
751
+ */
752
+ readonly missingLegacyImports: readonly LegacySource[];
753
+ }
754
+ /** Implements every optional `ReceiptStore` method */
755
+ interface SqliteReceiptStore extends Required<ReceiptStore> {
756
+ /** Experimental: may change in a minor release */
757
+ summary(options: {
758
+ readonly orphanHoldMinAgeMs: number;
759
+ }): Promise<SqliteReceiptStoreSummary>;
847
760
  }
848
- declare function createSqliteReceiptStore(options: SqliteReceiptStoreOptions): ReceiptStore;
761
+ declare function createSqliteReceiptStore(options: SqliteReceiptStoreOptions): SqliteReceiptStore;
849
762
 
850
- export { A2A_AGENT_CARD_PATH, A2A_PROTOCOL_VERSION, A2A_SPEC_VERSION, ACP_API_VERSION, ACP_SPEC_VERSION, ACP_WELL_KNOWN_PATH, AUTHORIZATION_HEADER, AUTHORIZATION_INPUT_FIELD, AdapterDescriptor, AdapterHealth, AdapterHttpRoute, AuthorizationHoldState, AuthorizationProvider, AuthorizationRecord, AuthorizationRequirement, AuthorizationSubmission, BackendHandler, COMMERCE_ERROR_CODES, COMMERCE_ERROR_HTTP_STATUS, Clock, CommerceError, CommerceEvent, CommerceReceipt, CommerceResource, DELIVERY_SUMMARY_META_KEY, DecimalAmount, DeliveredOutcome, ExecutionPipeline, HttpProtocolAdapter, IdGenerator, IsoTimestamp, Logger, MAX_AUTHORIZATION_HEADER_BYTES, PAYMENT_HEADER, PAYMENT_INPUT_FIELD, PAYMENT_REQUIRED_HEADER, PAYMENT_RESPONSE_HEADER, PaymentAttempt, PaymentAttemptResolution, PaymentMethodName, PaymentProvider, PaymentRequiredOutcome, PaymentSubmission, PersistenceFailure, ProtocolAdapter, ProtocolAdapterContext, ProtocolName, RESERVED_INPUT_FIELDS, RETRYABLE_ERROR_CODES, ResourceRegistry, Transaction, TransactionState, createA2aAdapter, createAcpAdapter, createGateway, createSqliteReceiptStore, extractReservedInputFields, isCommerceError, isPaymentRequiredEnvelope, loadConfig, parseAuthorizationHeader, parseAuthorizationSubmission, parseConfig, createSqliteReceiptStore as receipts, toCommerceError, toDeliverySummary, toErrorEnvelope, toPaymentRequiredEnvelope };
851
- export type { A2aAdapterOptions, AcpAdapterOptions, BackendExecutor, BackendRequest, BackendResponse, CommerceErrorCode, CommerceErrorInfo, CommerceErrorOptions, DeliverySummary, ErrorEnvelope, GatewayConfig, GatewayInstance, GatewayOptions, ListOptions, NewTransaction, PaymentAttemptListOptions, PaymentAttemptReservation, PaymentAttemptResolveRequest, PaymentAttemptUpdate, PaymentRequiredEnvelope, ReceiptListOptions, ReceiptStore, TransactionListOptions, TransactionPage, TransactionStep };
763
+ export { A2A_AGENT_CARD_PATH, A2A_PROTOCOL_VERSION, A2A_SPEC_VERSION, ACP_API_VERSION, ACP_SPEC_VERSION, ACP_WELL_KNOWN_PATH, AUTHORIZATION_HEADER, AUTHORIZATION_INPUT_FIELD, AdapterDescriptor, AdapterHealth, AdapterHttpRoute, AuthorizationProvider, AuthorizationRequirement, AuthorizationSubmission, BackendHandler, COMMERCE_ERROR_CODES, COMMERCE_ERROR_HTTP_STATUS, Clock, CommerceError, CommerceResource, DELIVERY_SUMMARY_META_KEY, DecimalAmount, DeliveredOutcome, ExecutionPipeline, HttpProtocolAdapter, IdGenerator, IsoTimestamp, Logger, MAX_AUTHORIZATION_HEADER_BYTES, PAYMENT_HEADER, PAYMENT_INPUT_FIELD, PAYMENT_REQUIRED_HEADER, PAYMENT_RESPONSE_HEADER, PaymentMethodName, PaymentProvider, PaymentRequiredOutcome, PaymentSubmission, ProtocolAdapter, ProtocolAdapterContext, RESERVED_INPUT_FIELDS, RETRYABLE_ERROR_CODES, ReceiptStore, ResourceRegistry, createA2aAdapter, createAcpAdapter, createGateway, createSqliteReceiptStore, extractReservedInputFields, isCommerceError, isPaymentRequiredEnvelope, loadConfig, parseAuthorizationHeader, parseAuthorizationSubmission, parseConfig, createSqliteReceiptStore as receipts, toCommerceError, toDeliverySummary, toErrorEnvelope, toPaymentRequiredEnvelope };
764
+ export type { A2aAdapterOptions, AcpAdapterOptions, BackendExecutor, BackendRequest, BackendResponse, CommerceErrorCode, CommerceErrorInfo, CommerceErrorOptions, DeliverySummary, ErrorEnvelope, GatewayConfig, GatewayInstance, GatewayOptions, PaymentRequiredEnvelope };