@agent-score/commerce 2.6.4 → 2.6.5

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 CHANGED
@@ -26,13 +26,13 @@ npm install hono mppx @x402/core @x402/evm @solana/mpp @solana/kit stripe # wh
26
26
  | `/identity/{hono,express,fastify}` | Trust gate middleware: KYC, sanctions (account name + signer wallet), age, jurisdiction. Context-getter pattern: `agentscoreGate(opts)` middleware + `getAgentScoreData(ctx)` / `getGateDegradedState(ctx)` / `getGateQuotaInfo(ctx)` / `getSignerVerdict(ctx)` accessors, `captureWallet(...)`. The denial helpers (`denialReasonStatus`, `denialReasonToBody`, `buildSignerMismatchBody`, `buildContactSupportNextSteps`, `verificationAgentInstructions`, `isFixableDenial`, `FIXABLE_DENIAL_REASONS`) are exported from the top-level `@agent-score/commerce`, not the adapters. |
27
27
  | `/identity/policy` | Per-product compliance helpers for multi-product merchants (each product carries its own policy: hard gate vs soft vs none, per-product shipping allowlists): `PolicyBlock`, `GateResult`, `EnforcementMode`, `IdentityStatus`, `buildGateFromPolicy`, `runGateWithEnforcement`, `shippingCountryAllowed`, `shippingStateAllowed`, `validateShippingAgainstPolicy` (one-call country+state validator that raises `CheckoutValidationError` with the canonical envelope on miss). |
28
28
  | `/identity/{nextjs,web}` | Same gate, wrapper pattern: `withAgentScoreGate(opts, handler)` / `createAgentScoreGate(opts) => guard(req)`. The `data` + `degraded` + `infraReason` + `getSignerVerdict` fields land directly on the handler arg / guard result (no separate getter). Plus shared `captureWallet`. |
29
- | `/payment` | `networks`, `USDC`, `rails` registries; `paymentDirective`, `buildPaymentDirective`, `wwwAuthenticateHeader`, `paymentRequiredHeader`, `aliasAmountFields` (opt-in v1↔v2 amount-field shim: adds both `amount` and `maxAmountRequired` to an entry. The 402 builders do NOT apply it by default, strict x402 v2 settlement matches the agent's echoed requirement by exact comparison, so an extra field the server's rebuilt requirement lacks breaks settle; use only when you know a client is hardcoded to read `maxAmountRequired`), `settlementOverrideHeader`, `dispatchSettlementByNetwork`, `extractPaymentSigner` (Request-based; recovers signer from x402 EIP-3009 `payload.authorization.from` OR MPP `Authorization: Payment <base64>` `did:pkh:eip155:<chain>:<addr>` / `did:pkh:solana:<genesis>:<addr>` source DID, including Solana `TransferChecked` authority fallback when `@solana/kit` is installed), `extractPaymentSignerFromAuth` (header-string variant for callers that already have the `Authorization` value in hand), `detectRailFromHeaders` (returns `"x402"` / `"mpp"` / `null` from inbound headers); `createX402Server`, `createMppxServer` (the solana rail's `ataCreationRequired` defaults to `true` so Solana settles work on `@solana/mpp >= 0.6.0` out of the box, opt out only if every recipient's ATA is guaranteed to pre-exist; see `SolanaMppRailSpec.ataCreationRequired` for economics), `buildDefaultCheckoutRails({tempo?, x402Base?, solanaMpp?, stripe?})` (canonical 4-rail `rails` dict factory: flipping `network` alone derives the right `token` + `chainId`, Base Sepolia → Sepolia USDC + chainId 84532, Solana devnet → devnet USDC mint. Solana's `network` accepts both CAIP-2 and the raw `@solana/mpp` form `mainnet-beta` / `devnet` / `localnet`. Explicit overrides always win), `buildMppxComposeRails({amountUsd, tempoRecipient?, solanaRecipient?, ...})` (per-call intent factory replacing the hand-rolled `[['tempo/charge',{...}],['solana/charge',{...}],['stripe/charge',{...}]]` array; auto-handles USD→atomic conversion for Solana; auto-drops `stripe/charge` when `amountUsd < 0.50` since Stripe's fixed ~$0.30 fee makes sub-50-cent charges unprofitable, sub-50-cent APIs pass `includeStripe: false` explicitly to silence the warning); drop-in x402 helpers: `validateX402NetworkConfig` (boot-time guard), `verifyX402Request` (parse + validate inbound X-Payment), `processX402Settle` (verify-then-settle with one call), `classifyX402SettleResult` (maps the tagged settle result to a recommended HTTP status / code / nextSteps so merchants get a controlled envelope without coupling to facilitator-specific error text), `classifyOrchestrationError` (same `ClassifiedX402Error` shape but for uncaught exceptions thrown elsewhere in the orchestration; returns `null` for unknown errors so merchants rethrow instead of swallowing); `zeroAmountCarveOut` (skip CDP / mppx upstream verify+settle for $0 settles where the upstream rejects value=0 payloads; parses the credential, lifts signer + network, returns a `ZeroSettleResult` shaped identically to the success path so callers branch on rail, not on result shape); `usdToAtomic` (BigInt-based USD → atomic value, ROUND_HALF_UP, for Tempo / Solana / Base USDC amount construction). |
29
+ | `/payment` | `networks`, `USDC`, `rails` registries; `paymentDirective`, `buildPaymentDirective`, `wwwAuthenticateHeader`, `paymentRequiredHeader`, `aliasAmountFields` (opt-in v1↔v2 amount-field shim: adds both `amount` and `maxAmountRequired` to an entry. The 402 builders do NOT apply it by default, strict x402 v2 settlement matches the agent's echoed requirement by exact comparison, so an extra field the server's rebuilt requirement lacks breaks settle; use only when you know a client is hardcoded to read `maxAmountRequired`), `settlementOverrideHeader`, `dispatchSettlementByNetwork`, `extractPaymentSigner` (Request-based; recovers signer from x402 EIP-3009 `payload.authorization.from` OR MPP `Authorization: Payment <base64>` `did:pkh:eip155:<chain>:<addr>` / `did:pkh:solana:<genesis>:<addr>` source DID, including Solana `TransferChecked` authority fallback when `@solana/kit` is installed), `extractPaymentSignerFromAuth` (header-string variant for callers that already have the `Authorization` value in hand), `detectRailFromHeaders` (returns `"x402"` / `"mpp"` / `null` from inbound headers); `createX402Server`, `createMppxServer` (the solana rail's `ataCreationRequired` defaults to `true` so Solana settles work on `@solana/mpp >= 0.6.0` out of the box, opt out only if every recipient's ATA is guaranteed to pre-exist; see `SolanaMppRailSpec.ataCreationRequired` for economics), `buildDefaultCheckoutRails({tempo?, x402Base?, solanaMpp?, stripe?})` (canonical 4-rail `rails` dict factory: flipping `network` alone derives the right `token` + `chainId`, Base Sepolia → Sepolia USDC + chainId 84532, Solana devnet → devnet USDC mint. Solana's `network` accepts both CAIP-2 and the raw `@solana/mpp` form `mainnet-beta` / `devnet` / `localnet`. Explicit overrides always win), `buildMppxComposeRails({amountUsd, tempoRecipient?, solanaRecipient?, ...})` (per-call intent factory replacing the hand-rolled `[['tempo/charge',{...}],['solana/charge',{...}],['stripe/charge',{...}]]` array; auto-handles USD→atomic conversion for Solana; auto-drops `stripe/charge` when `amountUsd < 0.50` since Stripe's fixed ~$0.30 fee makes sub-50-cent charges unprofitable, sub-50-cent APIs pass `includeStripe: false` explicitly to silence the warning); drop-in x402 helpers: `validateX402NetworkConfig` (boot-time guard), `verifyX402Request` (parse + validate inbound X-Payment), `processX402Settle` (verify-then-settle with one call), `classifyX402SettleResult` (maps the tagged settle result to a recommended HTTP status / code / nextSteps so merchants get a controlled envelope without coupling to facilitator-specific error text), `classifyOrchestrationError` (same `ClassifiedX402Error` shape but for uncaught exceptions thrown elsewhere in the orchestration; returns `null` for unknown errors so merchants rethrow instead of swallowing); `zeroAmountCarveOut` (skip upstream verify+settle for $0 settles the upstream cannot process: x402 value=0 payloads and non-proof MPP credentials, e.g. an agent that signed against a nonzero quote the merchant re-priced to $0 at settle; parses the credential, lifts signer + network, returns a `ZeroSettleResult` shaped identically to the success path so callers branch on rail, not on result shape. MPP `proof` credentials are NOT carved out: `Checkout` delegates those to mppx's native zero-amount verification), `mppCredentialPayloadType` (reads `payload.type` from an `Authorization: Payment` header without an mppx dependency; the router behind that delegation); `usdToAtomic` (BigInt-based USD → atomic value, ROUND_HALF_UP, for Tempo / Solana / Base USDC amount construction). |
30
30
  | `/discovery` | `isDiscoveryProbeRequest`, `buildDiscoveryProbeResponse` (with optional `x402Sample` for x402-aware crawlers, e.g. `awal x402 details`), `sampleX402AcceptForNetwork` (USDC sample-accept builder for known CAIP-2 networks), `buildWellKnownMpp`, `buildLlmsTxt` + `llmsTxtIdentitySection` + `llmsTxtPaymentSection` (compact + verbose modes), `buildSkillMd` (Claude-Skill-compatible `/skill.md` agent-discovery manifest; strictly agent-facing data only, no internal posture), `buildRedemptionSkillMd` (delivery-neutral redemption-code template, printed mailers, emailed codes, API trial credits all covered; `endpointPath`/`deliveryIntro`/`bodyShape`/`bodyRules`/`extraRecoveryRows` overrides for non-goods shapes), `agentscoreOpenApiSnippets`, `createBazaarDiscovery`, `noindexNonDiscoveryPaths` (Hono middleware emitting `X-Robots-Tag: noindex` on every path except the agent-discovery surfaces; pure helpers `isDiscoveryPath` + `defaultDiscoveryPaths` for non-Hono frameworks), `buildMerchantIndexJson` (canonical `/` discovery body), `standardEndpointDescriptions({kind})` (canonical method+path → description map for goods vs api merchants; optional `includeOrderStatusRoute` for goods), `buildSuccessNextSteps` (universal Passport-active success block), `buildAgentscoreOnboardingSteps` (canonical skill.md onboarding for goods or API merchants). Plus the UCP/JWKS publish surface: `buildSignedUcpResponse`, `buildSignedJwksResponse`, `wellKnownPreflightResponse`, `defaultA2aServices`, `bootstrapUcpSigningKey`, and the framework-neutral `SignedDiscoveryResponse` + per-framework wrappers `signedResponse{Hono,Express,Fastify,Nextjs,Web}`. |
31
31
  | `/challenge` | `build402Body`, `buildAcceptedMethods`, `buildIdentityMetadata`, `buildHowToPay`, `buildAgentInstructions` (auto-emits per-rail `compatible_clients`: smoke-verified CLIs the agent should use; vendor override supported; pure helper `compatibleClientsByRails(rails)` returns the same map for vendors building custom 402s), `buildPricingBlock`, `firstEncounterAgentMemory`, `Receipt` (canonical 200-receipt shape returned post-settle, universal: goods merchants fill the shipping/fulfillment/product slots, API merchants populate only the universal fields); `respond402`, a drop-in 402 emit that preserves mppx's `WWW-Authenticate` and layers x402's `PAYMENT-REQUIRED`. `buildValidationError`: structured 4xx body builder (`{error: {code, message}, required_fields?, example_body?, next_steps?, ...extra}`) so vendors compose body shapes by name instead of inlining at every validation site. |
32
32
  | `/stripe-multichain` | `createMultichainPaymentIntent` (returns `{ paymentIntentId, depositAddresses }`, read `depositAddresses[network]` directly), `createPayToAddressFromStripePI({request, amountCents, stripe, piCache, networks?, staticRecipients?, metadata?, orderId?, preferredNetwork?})`, per-order payTo resolver: on the settle leg, reuses the buyer's signed-against payTo from the MPP credential (after `piCache.hasAddress` check OR a `staticRecipients` match, the static address is always-accepted because the merchant owns it); on the discovery leg, mints a fresh PI for the rails NOT covered by `staticRecipients`, caches the merged map, registers static addresses with `piCache.cacheAddress` so verify-leg lookups pass. `mintMultichainRecipients({...same opts})`, structured variant that returns `{ recipients: Record<string,string>, paymentIntentId?, reusedFromCredential }`; prefer this when your `mintRecipients` hook needs the full per-rail map (typical multi-rail merchant). Solana MPP requires a static recipient: pass `staticRecipients: { solana: '<wallet>' }` and pre-fund its USDC ATA once from any external wallet. Rotating (per-order, Stripe-minted) Solana recipients do not settle, since the settlement transaction does not create the recipient's token account; the SDK logs a warning when one is minted. The static recipient is reused forever, each settle pays only the ~$0.001 per-tx fee, and this also sidesteps the per-call ATA rent (~$0.50 against MPP spec §13.6). `simulateCryptoDeposit`, `createMppxStripe`; `createPiCache` (TTL'd PI / deposit-address cache, Redis-backed when `redisUrl` set, in-memory otherwise), `simulateDepositIfTestMode` (gates on `sk_test_` and looks up the PI for you), `STRIPE_TEST_TX_HASH_SUCCESS` / `STRIPE_TEST_TX_HASH_FAILED` constants. Peer dep on `stripe`. |
33
33
  | `/api` | Everything from `@agent-score/sdk` re-exported in one place: `AgentScore` + `AgentScoreError`, `AGENTSCORE_TEST_ADDRESSES` + `isAgentScoreTestAddress`. **Don't add `@agent-score/sdk` as a separate dep**; the two can drift versions and cause subtle type mismatches. |
34
34
  | `/middleware/{hono,express,fastify,nextjs,web}` | Framework-specific rate-limit middleware. Hono / Express / Fastify expose middleware factories (`rateLimitHono`, `rateLimitExpress`, `rateLimitFastify`); Next.js exposes `withRateLimit(opts, handler)`; Web Fetch exposes `createRateLimit(opts) => guard(req)`. Shared options: `windowSeconds` (default 60), `maxRequests` (default 60), `keyResolver` (default first hop of `x-forwarded-for`), `redisUrl` (lazy-imports `ioredis` when set, in-memory `Map` fallback otherwise), `keyPrefix`. `ioredis` is an optional peer dep, install it only if you want distributed limiting. |
35
- | `@agent-score/commerce` (top-level) | `Checkout` orchestrator + `CheckoutContext` + `CheckoutGateConfig` + `CheckoutValidationError` + `DiscoveryProbeConfig` + `MountUcpRoutesOptions` + `SettleOutcome` + `MppxComposeOutcome` + `PricingResult` (the 2.0 high-level surface: one config object, hooks for preValidate/computePricing/onSettled/mintRecipients/composeMppx, auto-derived x402+mppx servers, per-framework adapters `handleHono`/`handleExpress`/`handleFastify`/`handleNextjs`/`handleWeb`, signed UCP routes via `mountUcpRoutes{Hono,Express,Fastify}`); `pricingResult` (factory: cents-denominated → typed `PricingResult` with embedded `PricingBlock`); `validationResponse{Hono,Express,Fastify,Nextjs,Web}` (per-framework 4xx envelope wrappers); `loadUCPSigningKeyFromEnv` (cached env-driven loader for the UCP signing key, reads `UCP_SIGNING_KEY_JWK_PRIVATE` JSON JWK, detects alg from shape, falls back to ephemeral when unset, sanitizes errors so key bytes never reach logs, concurrent-safe via Promise-pinned cache); `hashOperatorToken` (sha256 hex of plaintext `opc_...`, for merchants persisting `operator_token_id` to their own DB without ever storing the plaintext); `extractOwnerScope(headers) → { walletAddress?, operatorTokenHash? }` (canonical owner-identity extractor for caller-scoped resource queries, reads `X-Wallet-Address` / `X-Operator-Token`, hashes the token so plaintext never leaves the request); `hasPaymentHeader` / `hasX402Header` / `hasMppxHeader` (request discriminators, any-credential vs x402 vs MPP); `defaultReadOnlyOnDenied(reason)` (canonical `onDenied` for read-only resource gates: 401 + `Cache-Control: no-store` while still spreading `denialReasonToBody`); plus the cross-vendor publishers `buildA2AAgentCard` + `buildUCPProfile` (return unsigned payloads: vendor signs + publishes). |
35
+ | `@agent-score/commerce` (top-level) | `Checkout` orchestrator + `CheckoutContext` + `CheckoutGateConfig` + `CheckoutValidationError` + `DiscoveryProbeConfig` + `MountUcpRoutesOptions` + `SettleOutcome` + `MppxComposeOutcome` + `PricingResult` (the 2.0 high-level surface: one config object, hooks for preValidate/computePricing/onSettled/mintRecipients/composeMppx, auto-derived x402+mppx servers, per-framework adapters `handleHono`/`handleExpress`/`handleFastify`/`handleNextjs`/`handleWeb`, signed UCP routes via `mountUcpRoutes{Hono,Express,Fastify}`); `pricingResult` (factory: cents-denominated → typed `PricingResult` with embedded `PricingBlock`); `validationResponse{Hono,Express,Fastify,Nextjs,Web}` (per-framework 4xx envelope wrappers); `loadUCPSigningKeyFromEnv` (cached env-driven loader for the UCP signing key, reads `UCP_SIGNING_KEY_JWK_PRIVATE` JSON JWK, detects alg from shape, falls back to ephemeral when unset, sanitizes errors so key bytes never reach logs, concurrent-safe via Promise-pinned cache); `hashOperatorToken` (sha256 hex of plaintext `opc_...`, for merchants persisting `operator_token_id` to their own DB without ever storing the plaintext); `extractOwnerScope(headers) → { walletAddress?, operatorTokenHash? }` (canonical owner-identity extractor for caller-scoped resource queries, reads `X-Wallet-Address` / `X-Operator-Token`, hashes the token so plaintext never leaves the request); `hasPaymentHeader` / `hasX402Header` / `hasMppxHeader` (request discriminators, any-credential vs x402 vs MPP); `malformedPaymentCredential` (wire-shape gate: payment headers that are not base64 JSON and not token-shaped are rejected before merchant hooks run; `Checkout` applies it by default, opt out with `credentialPreCheck: false`); `createResultCache` (neutral keyed JSON-value cache with a stable body-hash key builder; cache a probe-leg result, e.g. a paid upstream call made in `preValidate`, and replay it on the settle leg) plus the compute-first-shaped `createQuoteCache` built on it; `defaultReadOnlyOnDenied(reason)` (canonical `onDenied` for read-only resource gates: 401 + `Cache-Control: no-store` while still spreading `denialReasonToBody`); plus the cross-vendor publishers `buildA2AAgentCard` + `buildUCPProfile` (return unsigned payloads: vendor signs + publishes). |
36
36
 
37
37
  ## Quick start
38
38
 
@@ -879,9 +879,12 @@ declare class Checkout {
879
879
  * configured STATIC recipient(s) — the permissive default applies ONLY when no
880
880
  * static recipient exists (pure per-order minting). */
881
881
  isCachedAddress?: IsCachedAddressFn;
882
- /** Engage the EIP-3009 value=0 + pympp `proof` carve-out when pricing
883
- * resolves to $0. Goods merchants offering free redemption codes set this
884
- * to `true` so the credential parses without an on-chain settle. */
882
+ /** Engage the $0 carve-out when pricing resolves to $0: x402 and
883
+ * non-proof MPP credentials (repriced no-match / redemption flows,
884
+ * Solana, token-style) settle free without an upstream call, while MPP
885
+ * `proof` credentials delegate to mppx's native zero-amount
886
+ * verification. Set `true` for free-redemption and no-match-refund
887
+ * merchants. */
885
888
  zeroSettleCarveOut?: boolean;
886
889
  /** Reject payment credentials that fail the cheap wire-shape check (not
887
890
  * base64 JSON, not a token-shaped value) BEFORE any merchant hook runs,
@@ -879,9 +879,12 @@ declare class Checkout {
879
879
  * configured STATIC recipient(s) — the permissive default applies ONLY when no
880
880
  * static recipient exists (pure per-order minting). */
881
881
  isCachedAddress?: IsCachedAddressFn;
882
- /** Engage the EIP-3009 value=0 + pympp `proof` carve-out when pricing
883
- * resolves to $0. Goods merchants offering free redemption codes set this
884
- * to `true` so the credential parses without an on-chain settle. */
882
+ /** Engage the $0 carve-out when pricing resolves to $0: x402 and
883
+ * non-proof MPP credentials (repriced no-match / redemption flows,
884
+ * Solana, token-style) settle free without an upstream call, while MPP
885
+ * `proof` credentials delegate to mppx's native zero-amount
886
+ * verification. Set `true` for free-redemption and no-match-refund
887
+ * merchants. */
885
888
  zeroSettleCarveOut?: boolean;
886
889
  /** Reject payment credentials that fail the cheap wire-shape check (not
887
890
  * base64 JSON, not a token-shaped value) BEFORE any merchant hook runs,
package/dist/core.js CHANGED
@@ -227,7 +227,7 @@ function createAgentScoreCore(options) {
227
227
  } = options;
228
228
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
229
229
  const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
230
- const defaultUa = `@agent-score/commerce@${"2.6.4"}`;
230
+ const defaultUa = `@agent-score/commerce@${"2.6.5"}`;
231
231
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
232
232
  const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
233
233
  const sessionSdkCache = /* @__PURE__ */ new Map();
package/dist/core.mjs CHANGED
@@ -209,7 +209,7 @@ function createAgentScoreCore(options) {
209
209
  } = options;
210
210
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
211
211
  const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
212
- const defaultUa = `@agent-score/commerce@${"2.6.4"}`;
212
+ const defaultUa = `@agent-score/commerce@${"2.6.5"}`;
213
213
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
214
214
  const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
215
215
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -1,6 +1,6 @@
1
1
  import { R as RailKey, C as CompatibleClients } from '../pricing-KHDqMLd7.mjs';
2
2
  export { g as compatibleClientsByRails } from '../pricing-KHDqMLd7.mjs';
3
- import { C as Checkout, p as UCPServiceBinding, a as AgentScoreGatePolicy } from '../checkout-BtdHSF_w.mjs';
3
+ import { C as Checkout, p as UCPServiceBinding, a as AgentScoreGatePolicy } from '../checkout-DOd9GDmt.mjs';
4
4
  import '../rail_spec-BFZmW9RN.mjs';
5
5
  import '../core.mjs';
6
6
  import '@agent-score/sdk';
@@ -1,6 +1,6 @@
1
1
  import { R as RailKey, C as CompatibleClients } from '../pricing-CytRwhC2.js';
2
2
  export { g as compatibleClientsByRails } from '../pricing-CytRwhC2.js';
3
- import { C as Checkout, p as UCPServiceBinding, a as AgentScoreGatePolicy } from '../checkout-B-Z5_EQP.js';
3
+ import { C as Checkout, p as UCPServiceBinding, a as AgentScoreGatePolicy } from '../checkout-GcDNDzSK.js';
4
4
  import '../rail_spec-BFZmW9RN.js';
5
5
  import '../core.js';
6
6
  import '@agent-score/sdk';
@@ -920,7 +920,7 @@ function createAgentScoreCore(options) {
920
920
  } = options;
921
921
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
922
922
  const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
923
- const defaultUa = `@agent-score/commerce@${"2.6.4"}`;
923
+ const defaultUa = `@agent-score/commerce@${"2.6.5"}`;
924
924
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
925
925
  const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
926
926
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -892,7 +892,7 @@ function createAgentScoreCore(options) {
892
892
  } = options;
893
893
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
894
894
  const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
895
- const defaultUa = `@agent-score/commerce@${"2.6.4"}`;
895
+ const defaultUa = `@agent-score/commerce@${"2.6.5"}`;
896
896
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
897
897
  const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
898
898
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -921,7 +921,7 @@ function createAgentScoreCore(options) {
921
921
  } = options;
922
922
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
923
923
  const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
924
- const defaultUa = `@agent-score/commerce@${"2.6.4"}`;
924
+ const defaultUa = `@agent-score/commerce@${"2.6.5"}`;
925
925
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
926
926
  const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
927
927
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -892,7 +892,7 @@ function createAgentScoreCore(options) {
892
892
  } = options;
893
893
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
894
894
  const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
895
- const defaultUa = `@agent-score/commerce@${"2.6.4"}`;
895
+ const defaultUa = `@agent-score/commerce@${"2.6.5"}`;
896
896
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
897
897
  const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
898
898
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -901,7 +901,7 @@ function createAgentScoreCore(options) {
901
901
  } = options;
902
902
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
903
903
  const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
904
- const defaultUa = `@agent-score/commerce@${"2.6.4"}`;
904
+ const defaultUa = `@agent-score/commerce@${"2.6.5"}`;
905
905
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
906
906
  const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
907
907
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -873,7 +873,7 @@ function createAgentScoreCore(options) {
873
873
  } = options;
874
874
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
875
875
  const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
876
- const defaultUa = `@agent-score/commerce@${"2.6.4"}`;
876
+ const defaultUa = `@agent-score/commerce@${"2.6.5"}`;
877
877
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
878
878
  const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
879
879
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -922,7 +922,7 @@ function createAgentScoreCore(options) {
922
922
  } = options;
923
923
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
924
924
  const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
925
- const defaultUa = `@agent-score/commerce@${"2.6.4"}`;
925
+ const defaultUa = `@agent-score/commerce@${"2.6.5"}`;
926
926
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
927
927
  const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
928
928
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -897,7 +897,7 @@ function createAgentScoreCore(options) {
897
897
  } = options;
898
898
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
899
899
  const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
900
- const defaultUa = `@agent-score/commerce@${"2.6.4"}`;
900
+ const defaultUa = `@agent-score/commerce@${"2.6.5"}`;
901
901
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
902
902
  const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
903
903
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -898,7 +898,7 @@ function createAgentScoreCore(options) {
898
898
  } = options;
899
899
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
900
900
  const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
901
- const defaultUa = `@agent-score/commerce@${"2.6.4"}`;
901
+ const defaultUa = `@agent-score/commerce@${"2.6.5"}`;
902
902
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
903
903
  const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
904
904
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -873,7 +873,7 @@ function createAgentScoreCore(options) {
873
873
  } = options;
874
874
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
875
875
  const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
876
- const defaultUa = `@agent-score/commerce@${"2.6.4"}`;
876
+ const defaultUa = `@agent-score/commerce@${"2.6.5"}`;
877
877
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
878
878
  const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
879
879
  const sessionSdkCache = /* @__PURE__ */ new Map();
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { VerifyWalletSignerResult, DenialReason } from './core.mjs';
2
2
  export { AccountVerification, AgentIdentity, AgentMemoryHint, AgentScoreCore, AssessResult, CreateSessionOnMissing, DenialCode, EvaluateOutcome, OperatorVerification, PolicyCheck, PolicyResult, SignerVerdict, buildAgentMemoryHint } from './core.mjs';
3
3
  export { P as PaymentSigner, S as SignerNetwork, e as extractPaymentSigner, a as extractPaymentSignerFromAuth, b as extractSignerForPrecheck, r as readX402PaymentHeader } from './signer-3FAit11j.mjs';
4
- import { q as UCPSigningKey, n as UCPProfile } from './checkout-BtdHSF_w.mjs';
5
- export { A as AGENTSCORE_UCP_CAPABILITY, a as AgentScoreGatePolicy, C as Checkout, b as CheckoutContext, c as CheckoutGateConfig, d as CheckoutRailSpec, e as CheckoutRequest, f as CheckoutResult, g as ComposeMppxFn, D as DiscoveryProbeConfig, G as GateDenial, I as IsCachedAddressFn, M as MountUcpRoutesOptions, h as MppxComposeOutcome, O as OnSettledFn, P as PreValidateFn, i as PricingFn, j as PricingResult, R as RecipientsFn, k as ReferenceIdFn, l as RunGateFn, S as SettleOutcome, U as UCPCapabilityBinding, m as UCPPaymentHandlerBinding, o as UCPProfileBody, p as UCPServiceBinding, r as buildAipTrustedIssuers, s as buildUCPProfile, t as getIdentityStatus, u as makeMppxComposeHook, v as mppPaymentHandler, w as pricingResult, x as stripeSptPaymentHandler, y as validationEnvelope, z as validationResponseExpress, B as validationResponseFastify, E as validationResponseHono, F as validationResponseNextjs, H as validationResponseWeb, J as x402PaymentHandler } from './checkout-BtdHSF_w.mjs';
4
+ import { q as UCPSigningKey, n as UCPProfile } from './checkout-DOd9GDmt.mjs';
5
+ export { A as AGENTSCORE_UCP_CAPABILITY, a as AgentScoreGatePolicy, C as Checkout, b as CheckoutContext, c as CheckoutGateConfig, d as CheckoutRailSpec, e as CheckoutRequest, f as CheckoutResult, g as ComposeMppxFn, D as DiscoveryProbeConfig, G as GateDenial, I as IsCachedAddressFn, M as MountUcpRoutesOptions, h as MppxComposeOutcome, O as OnSettledFn, P as PreValidateFn, i as PricingFn, j as PricingResult, R as RecipientsFn, k as ReferenceIdFn, l as RunGateFn, S as SettleOutcome, U as UCPCapabilityBinding, m as UCPPaymentHandlerBinding, o as UCPProfileBody, p as UCPServiceBinding, r as buildAipTrustedIssuers, s as buildUCPProfile, t as getIdentityStatus, u as makeMppxComposeHook, v as mppPaymentHandler, w as pricingResult, x as stripeSptPaymentHandler, y as validationEnvelope, z as validationResponseExpress, B as validationResponseFastify, E as validationResponseHono, F as validationResponseNextjs, H as validationResponseWeb, J as x402PaymentHandler } from './checkout-DOd9GDmt.mjs';
6
6
  export { EnforcementMode, GateResult, IdentityStatus, PolicyBlock, buildGateFromPolicy, runGateWithEnforcement, shippingCountryAllowed, shippingStateAllowed, validateShippingAgainstPolicy } from './identity/policy.mjs';
7
7
  import { H as HeadersLike } from './network_kind-D2xpo2Fj.mjs';
8
8
  export { M as MalformedPaymentCredential, c as buildDefaultCheckoutRails, d as buildMppxComposeRails, f as formatUsdCents, h as hasMppxHeader, e as hasPaymentHeader, g as hasX402Header, i as isEvmNetwork, j as isSolanaNetwork, l as loadSolanaFeePayer, m as malformedPaymentCredential } from './network_kind-D2xpo2Fj.mjs';
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { VerifyWalletSignerResult, DenialReason } from './core.js';
2
2
  export { AccountVerification, AgentIdentity, AgentMemoryHint, AgentScoreCore, AssessResult, CreateSessionOnMissing, DenialCode, EvaluateOutcome, OperatorVerification, PolicyCheck, PolicyResult, SignerVerdict, buildAgentMemoryHint } from './core.js';
3
3
  export { P as PaymentSigner, S as SignerNetwork, e as extractPaymentSigner, a as extractPaymentSignerFromAuth, b as extractSignerForPrecheck, r as readX402PaymentHeader } from './signer-3FAit11j.js';
4
- import { q as UCPSigningKey, n as UCPProfile } from './checkout-B-Z5_EQP.js';
5
- export { A as AGENTSCORE_UCP_CAPABILITY, a as AgentScoreGatePolicy, C as Checkout, b as CheckoutContext, c as CheckoutGateConfig, d as CheckoutRailSpec, e as CheckoutRequest, f as CheckoutResult, g as ComposeMppxFn, D as DiscoveryProbeConfig, G as GateDenial, I as IsCachedAddressFn, M as MountUcpRoutesOptions, h as MppxComposeOutcome, O as OnSettledFn, P as PreValidateFn, i as PricingFn, j as PricingResult, R as RecipientsFn, k as ReferenceIdFn, l as RunGateFn, S as SettleOutcome, U as UCPCapabilityBinding, m as UCPPaymentHandlerBinding, o as UCPProfileBody, p as UCPServiceBinding, r as buildAipTrustedIssuers, s as buildUCPProfile, t as getIdentityStatus, u as makeMppxComposeHook, v as mppPaymentHandler, w as pricingResult, x as stripeSptPaymentHandler, y as validationEnvelope, z as validationResponseExpress, B as validationResponseFastify, E as validationResponseHono, F as validationResponseNextjs, H as validationResponseWeb, J as x402PaymentHandler } from './checkout-B-Z5_EQP.js';
4
+ import { q as UCPSigningKey, n as UCPProfile } from './checkout-GcDNDzSK.js';
5
+ export { A as AGENTSCORE_UCP_CAPABILITY, a as AgentScoreGatePolicy, C as Checkout, b as CheckoutContext, c as CheckoutGateConfig, d as CheckoutRailSpec, e as CheckoutRequest, f as CheckoutResult, g as ComposeMppxFn, D as DiscoveryProbeConfig, G as GateDenial, I as IsCachedAddressFn, M as MountUcpRoutesOptions, h as MppxComposeOutcome, O as OnSettledFn, P as PreValidateFn, i as PricingFn, j as PricingResult, R as RecipientsFn, k as ReferenceIdFn, l as RunGateFn, S as SettleOutcome, U as UCPCapabilityBinding, m as UCPPaymentHandlerBinding, o as UCPProfileBody, p as UCPServiceBinding, r as buildAipTrustedIssuers, s as buildUCPProfile, t as getIdentityStatus, u as makeMppxComposeHook, v as mppPaymentHandler, w as pricingResult, x as stripeSptPaymentHandler, y as validationEnvelope, z as validationResponseExpress, B as validationResponseFastify, E as validationResponseHono, F as validationResponseNextjs, H as validationResponseWeb, J as x402PaymentHandler } from './checkout-GcDNDzSK.js';
6
6
  export { EnforcementMode, GateResult, IdentityStatus, PolicyBlock, buildGateFromPolicy, runGateWithEnforcement, shippingCountryAllowed, shippingStateAllowed, validateShippingAgainstPolicy } from './identity/policy.js';
7
7
  import { H as HeadersLike } from './network_kind-BmbWKNud.js';
8
8
  export { M as MalformedPaymentCredential, c as buildDefaultCheckoutRails, d as buildMppxComposeRails, f as formatUsdCents, h as hasMppxHeader, e as hasPaymentHeader, g as hasX402Header, i as isEvmNetwork, j as isSolanaNetwork, l as loadSolanaFeePayer, m as malformedPaymentCredential } from './network_kind-BmbWKNud.js';
package/dist/index.js CHANGED
@@ -22666,7 +22666,7 @@ function createAgentScoreCore(options) {
22666
22666
  } = options;
22667
22667
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
22668
22668
  const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
22669
- const defaultUa = `@agent-score/commerce@${"2.6.4"}`;
22669
+ const defaultUa = `@agent-score/commerce@${"2.6.5"}`;
22670
22670
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
22671
22671
  const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
22672
22672
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -25313,6 +25313,22 @@ function x402SignerFromPayload(payload) {
25313
25313
  txHash: null
25314
25314
  };
25315
25315
  }
25316
+ function mppCredentialPayloadType(authorizationHeader) {
25317
+ if (typeof authorizationHeader !== "string") return null;
25318
+ if (!authorizationHeader.toLowerCase().startsWith("payment ")) return null;
25319
+ const token = authorizationHeader.slice("payment ".length).trim();
25320
+ if (!token) return null;
25321
+ try {
25322
+ const credential = JSON.parse(atob(token));
25323
+ if (!credential || typeof credential !== "object") return null;
25324
+ const payload = credential.payload;
25325
+ if (!payload || typeof payload !== "object") return null;
25326
+ const type = payload.type;
25327
+ return typeof type === "string" ? type : null;
25328
+ } catch {
25329
+ return null;
25330
+ }
25331
+ }
25316
25332
  function mppSignerFromAuth(authorizationHeader) {
25317
25333
  if (typeof authorizationHeader !== "string") return NULL_RESULT;
25318
25334
  if (!authorizationHeader.toLowerCase().startsWith("payment ")) return NULL_RESULT;
@@ -26152,9 +26168,12 @@ var Checkout = class {
26152
26168
  zero = zeroAmountCarveOut({ rail, payload: verified.payload });
26153
26169
  railKey = this.x402RailKey();
26154
26170
  } else {
26155
- zero = zeroAmountCarveOut({ rail, authorizationHeader: headers["authorization"] });
26156
- if (zero.signerNetwork !== "solana") return null;
26157
- railKey = this.railsKeyForMppxMethod("solana") ?? this.mppRailKey();
26171
+ const authHeader = headers["authorization"] ?? null;
26172
+ if (mppCredentialPayloadType(authHeader) === "proof") return null;
26173
+ const inline = zeroAmountCarveOut({ rail, authorizationHeader: authHeader });
26174
+ const extracted = await extractPaymentSignerFromAuth(authHeader);
26175
+ zero = extracted !== null ? { signerAddress: extracted.address, signerNetwork: extracted.network, txHash: null } : inline;
26176
+ railKey = (zero.signerNetwork !== null ? this.railsKeyForMppxMethod(zero.signerNetwork === "solana" ? "solana" : "tempo") : void 0) ?? this.mppRailKey();
26158
26177
  }
26159
26178
  const outcome = {
26160
26179
  rail: rail === "x402-base" ? "x402" : "mpp",