@agent-score/commerce 2.5.0 → 2.6.1
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 +19 -17
- package/dist/challenge/index.d.mts +26 -2
- package/dist/challenge/index.d.ts +26 -2
- package/dist/challenge/index.js +14 -5
- package/dist/challenge/index.js.map +1 -1
- package/dist/challenge/index.mjs +14 -5
- package/dist/challenge/index.mjs.map +1 -1
- package/dist/{checkout-McfNpZJf.d.ts → checkout-C4RD7M0Z.d.ts} +46 -13
- package/dist/{checkout-o17dIxHi.d.mts → checkout-CzB9f_jf.d.mts} +46 -13
- package/dist/core.d.mts +20 -9
- package/dist/core.d.ts +20 -9
- package/dist/core.js +35 -24
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +35 -24
- package/dist/core.mjs.map +1 -1
- package/dist/discovery/index.d.mts +17 -2
- package/dist/discovery/index.d.ts +17 -2
- package/dist/discovery/index.js +36 -12
- package/dist/discovery/index.js.map +1 -1
- package/dist/discovery/index.mjs +35 -12
- package/dist/discovery/index.mjs.map +1 -1
- package/dist/{gate-CWP10xPQ.d.mts → gate-D2RP6bZg.d.ts} +109 -141
- package/dist/{gate-CWP10xPQ.d.ts → gate-GCXy4FHI.d.mts} +109 -141
- package/dist/identity/express.d.mts +3 -1
- package/dist/identity/express.d.ts +3 -1
- package/dist/identity/express.js +164 -55
- package/dist/identity/express.js.map +1 -1
- package/dist/identity/express.mjs +164 -55
- package/dist/identity/express.mjs.map +1 -1
- package/dist/identity/fastify.d.mts +3 -1
- package/dist/identity/fastify.d.ts +3 -1
- package/dist/identity/fastify.js +171 -57
- package/dist/identity/fastify.js.map +1 -1
- package/dist/identity/fastify.mjs +171 -57
- package/dist/identity/fastify.mjs.map +1 -1
- package/dist/identity/hono.d.mts +3 -1
- package/dist/identity/hono.d.ts +3 -1
- package/dist/identity/hono.js +159 -59
- package/dist/identity/hono.js.map +1 -1
- package/dist/identity/hono.mjs +159 -59
- package/dist/identity/hono.mjs.map +1 -1
- package/dist/identity/nextjs.d.mts +3 -1
- package/dist/identity/nextjs.d.ts +3 -1
- package/dist/identity/nextjs.js +153 -56
- package/dist/identity/nextjs.js.map +1 -1
- package/dist/identity/nextjs.mjs +153 -56
- package/dist/identity/nextjs.mjs.map +1 -1
- package/dist/identity/policy.d.mts +21 -2
- package/dist/identity/policy.d.ts +21 -2
- package/dist/identity/policy.js +22 -1
- package/dist/identity/policy.js.map +1 -1
- package/dist/identity/policy.mjs +21 -1
- package/dist/identity/policy.mjs.map +1 -1
- package/dist/identity/web.d.mts +3 -1
- package/dist/identity/web.d.ts +3 -1
- package/dist/identity/web.js +153 -56
- package/dist/identity/web.js.map +1 -1
- package/dist/identity/web.mjs +153 -56
- package/dist/identity/web.mjs.map +1 -1
- package/dist/index.d.mts +55 -10
- package/dist/index.d.ts +55 -10
- package/dist/index.js +2227 -501
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2219 -501
- package/dist/index.mjs.map +1 -1
- package/dist/payment/index.d.mts +1 -1
- package/dist/payment/index.d.ts +1 -1
- package/dist/payment/index.js +10 -2
- package/dist/payment/index.js.map +1 -1
- package/dist/payment/index.mjs +10 -2
- package/dist/payment/index.mjs.map +1 -1
- package/dist/stripe-multichain/index.js +1621 -266
- package/dist/stripe-multichain/index.js.map +1 -1
- package/dist/stripe-multichain/index.mjs +1621 -266
- package/dist/stripe-multichain/index.mjs.map +1 -1
- package/dist/types-D1slMt0H.d.mts +137 -0
- package/dist/types-D1slMt0H.d.ts +137 -0
- package/dist/{wwwauthenticate-CVaGUMjU.d.mts → wwwauthenticate-Dgm-_af9.d.mts} +11 -1
- package/dist/{wwwauthenticate-CVaGUMjU.d.ts → wwwauthenticate-Dgm-_af9.d.ts} +11 -1
- package/package.json +23 -18
|
@@ -2,6 +2,7 @@ import { T as TempoRailSpec, S as SolanaMppRailSpec, c as TempoSessionRailSpec,
|
|
|
2
2
|
import { P as PricingBlock, R as RailKey } from './pricing-CytRwhC2.js';
|
|
3
3
|
import { CreateSessionOnMissing, AgentScoreCoreOptions, DenialReason } from './core.js';
|
|
4
4
|
import { a as X402Server } from './x402_server-Ciz2mls2.js';
|
|
5
|
+
import { T as TrustLevel } from './types-D1slMt0H.js';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* UCP (Universal Commerce Protocol) profile builder.
|
|
@@ -11,7 +12,7 @@ import { a as X402Server } from './x402_server-Ciz2mls2.js';
|
|
|
11
12
|
* envelope, with `services` / `capabilities` / `payment_handlers` as MAPs keyed by
|
|
12
13
|
* reverse-DNS service / capability / handler name.
|
|
13
14
|
*
|
|
14
|
-
* AgentScore identity claims layer over UCP via the `
|
|
15
|
+
* AgentScore identity claims layer over UCP via the `com.agentscore.identity` capability
|
|
15
16
|
* (vendor-namespaced; UCP doesn't define KYC/sanctions/age/jurisdiction natively). The
|
|
16
17
|
* capability extends `dev.ucp.shopping.checkout` AND `dev.ucp.shopping.cart` (multi-parent,
|
|
17
18
|
* the standard pattern UCP allows for capabilities that compose multiple parents).
|
|
@@ -160,7 +161,7 @@ interface BuildUCPProfileInput {
|
|
|
160
161
|
/** Services map, keyed by service name. UCP-shopping merchants typically advertise
|
|
161
162
|
* bindings under `'dev.ucp.shopping'`. */
|
|
162
163
|
services?: Record<string, UCPServiceBinding[]>;
|
|
163
|
-
/** Capabilities map, keyed by capability name. The `
|
|
164
|
+
/** Capabilities map, keyed by capability name. The `com.agentscore.identity` capability
|
|
164
165
|
* is auto-added when `agentscore_gate` is provided. */
|
|
165
166
|
capabilities?: Record<string, UCPCapabilityBinding[]>;
|
|
166
167
|
/** Payment handlers map, keyed by handler reverse-DNS name. */
|
|
@@ -168,7 +169,7 @@ interface BuildUCPProfileInput {
|
|
|
168
169
|
/** JWKS — public keys the merchant signs with. REQUIRED by spec. */
|
|
169
170
|
signing_keys: UCPSigningKey[];
|
|
170
171
|
/** Merchant gate policy declaration. When provided, the SDK auto-injects an
|
|
171
|
-
* `
|
|
172
|
+
* `com.agentscore.identity` capability binding into `capabilities`, with the
|
|
172
173
|
* policy as the binding's `config`. Static merchant declaration only — no
|
|
173
174
|
* per-operator data ever ends up on the public profile. Per-operator identity
|
|
174
175
|
* attestation lives on the AP2 risk-signal endpoint, not here. */
|
|
@@ -186,7 +187,7 @@ interface BuildUCPProfileInput {
|
|
|
186
187
|
/** Vendor-specific extras INSIDE the `ucp` envelope (alongside `version`, `services`, etc.). */
|
|
187
188
|
ucp_extras?: Record<string, unknown>;
|
|
188
189
|
}
|
|
189
|
-
/** Merchant gate policy declared on the UCP profile via `
|
|
190
|
+
/** Merchant gate policy declared on the UCP profile via `com.agentscore.identity` capability config.
|
|
190
191
|
* All fields optional; merchant declares which AgentScore checks the gate enforces. Snake-case
|
|
191
192
|
* field names match the AgentScore API's `/v1/assess` policy contract verbatim — no conversion
|
|
192
193
|
* layer between this declaration and what the gate actually enforces at runtime. */
|
|
@@ -210,7 +211,7 @@ interface AgentScoreGatePolicy {
|
|
|
210
211
|
* signing_keys: [...] }`. Pass through `signUCPProfile` to attach a JWS signature for
|
|
211
212
|
* trust-mode verifiers.
|
|
212
213
|
*
|
|
213
|
-
* Auto-injects `
|
|
214
|
+
* Auto-injects `com.agentscore.identity` as a vendor capability extending both
|
|
214
215
|
* `dev.ucp.shopping.checkout` and `dev.ucp.shopping.cart` when `agentscore_gate`
|
|
215
216
|
* is provided. The capability's `config` carries the merchant's static gate
|
|
216
217
|
* policy declaration (require_kyc / require_sanctions_clear / min_age /
|
|
@@ -240,10 +241,10 @@ interface AgentScoreGatePolicy {
|
|
|
240
241
|
* ```
|
|
241
242
|
*/
|
|
242
243
|
declare function buildUCPProfile(input: BuildUCPProfileInput): UCPProfile;
|
|
243
|
-
declare const AGENTSCORE_UCP_CAPABILITY = "
|
|
244
|
+
declare const AGENTSCORE_UCP_CAPABILITY = "com.agentscore.identity";
|
|
244
245
|
type MppRailSpec = TempoRailSpec | SolanaMppRailSpec | TempoSessionRailSpec;
|
|
245
246
|
/**
|
|
246
|
-
* Build the `
|
|
247
|
+
* Build the `com.agentscore.payment.mpp` payment handler block for a UCP profile.
|
|
247
248
|
*
|
|
248
249
|
* Pass any mix of `TempoRailSpec`, `SolanaMppRailSpec`, and `TempoSessionRailSpec`.
|
|
249
250
|
*
|
|
@@ -266,7 +267,7 @@ declare function mppPaymentHandler({ networks, }: {
|
|
|
266
267
|
networks: MppRailSpec[];
|
|
267
268
|
}): Record<string, UCPPaymentHandlerBinding[]>;
|
|
268
269
|
/**
|
|
269
|
-
* Build the `
|
|
270
|
+
* Build the `com.agentscore.payment.x402` payment handler block for a UCP profile.
|
|
270
271
|
*
|
|
271
272
|
* @example
|
|
272
273
|
* ```ts
|
|
@@ -282,7 +283,7 @@ declare function x402PaymentHandler({ networks, }: {
|
|
|
282
283
|
networks: X402BaseRailSpec[];
|
|
283
284
|
}): Record<string, UCPPaymentHandlerBinding[]>;
|
|
284
285
|
/**
|
|
285
|
-
* Build the `
|
|
286
|
+
* Build the `com.agentscore.payment.stripe_spt` payment handler block for a UCP profile.
|
|
286
287
|
*
|
|
287
288
|
* @example
|
|
288
289
|
* ```ts
|
|
@@ -534,7 +535,7 @@ type RunGateFn = (ctx: CheckoutContext) => Promise<GateDenial | null>;
|
|
|
534
535
|
interface CheckoutGateConfig {
|
|
535
536
|
/** AgentScore API key. Required when `runGate` is omitted. */
|
|
536
537
|
apiKey?: string;
|
|
537
|
-
/** Override the default `https://api.agentscore.
|
|
538
|
+
/** Override the default `https://api.agentscore.com` base URL. */
|
|
538
539
|
baseUrl?: string;
|
|
539
540
|
/** Prepended to the default User-Agent on API calls. */
|
|
540
541
|
userAgent?: string;
|
|
@@ -594,7 +595,7 @@ interface AipGateConfig {
|
|
|
594
595
|
* Omit/empty to accept only AgentScore-issued AITs. */
|
|
595
596
|
trustedIssuers?: string[];
|
|
596
597
|
/** Clock-skew tolerance in seconds for the RFC 9421 signature window (and, as an override,
|
|
597
|
-
* the AIT JWT `exp`/`iat`). Defaults to
|
|
598
|
+
* the AIT JWT `exp`/`iat`). Defaults to 60s for both. */
|
|
598
599
|
maxSkewSeconds?: number;
|
|
599
600
|
/** Expected `@authority` (public hostname) the RFC 9421 signature must cover. When set, the
|
|
600
601
|
* verifier binds the signature to this value instead of trusting the inbound `Host` header —
|
|
@@ -602,6 +603,15 @@ interface AipGateConfig {
|
|
|
602
603
|
* not normalize `Host`, to prevent a captured AIT+signature from being replayed to a
|
|
603
604
|
* different virtual host on the same origin. */
|
|
604
605
|
authority?: string;
|
|
606
|
+
/** Minimum `trust_level` an AIT must assert to pass this gate (autonomous < human_present <
|
|
607
|
+
* human_confirmed) — the spec's human-presence gate (e.g. require `human_confirmed` for
|
|
608
|
+
* checkout). Enforced at the edge from the verified token; insufficient → 403 weak_auth with
|
|
609
|
+
* `required_trust_level`. Unset = any trust level accepted. */
|
|
610
|
+
requireTrustLevel?: TrustLevel;
|
|
611
|
+
/** Acceptable `auth.amr` methods (RFC 8176); the AIT must carry at least one (e.g.
|
|
612
|
+
* `['face','fpt','hwk']` to require strong human auth). Insufficient → 403 weak_auth with
|
|
613
|
+
* `required_amr`. Unset = not enforced. */
|
|
614
|
+
requireAmr?: string[];
|
|
605
615
|
/** Per-issuer compliance policy override, keyed by issuer URL (canonicalized before lookup).
|
|
606
616
|
* When a request's AIT is verified and its `iss` matches a key here, that block REPLACES the
|
|
607
617
|
* gate's default policy fields (`requireKyc` / `requireSanctionsClear` / `minAge` /
|
|
@@ -800,9 +810,19 @@ declare class Checkout {
|
|
|
800
810
|
readonly mintReferenceId: ReferenceIdFn | undefined;
|
|
801
811
|
readonly onSettled: OnSettledFn | undefined;
|
|
802
812
|
readonly isCachedAddress: IsCachedAddressFn | undefined;
|
|
813
|
+
/** Lowercased static recipient addresses for the x402-base rail(s). When the merchant
|
|
814
|
+
* configured a static recipient and supplied no `isCachedAddress`, the gate binds the
|
|
815
|
+
* agent-supplied `payTo` to this set (anti funds-drain). Empty for pure per-order minting. */
|
|
816
|
+
private readonly x402StaticRecipients;
|
|
803
817
|
readonly zeroSettleCarveOut: boolean;
|
|
804
818
|
readonly gate: CheckoutGateConfig | undefined;
|
|
805
819
|
readonly discoveryExtensions: Record<string, unknown> | undefined;
|
|
820
|
+
readonly resourceInfo: {
|
|
821
|
+
serviceName?: string;
|
|
822
|
+
tags?: string[];
|
|
823
|
+
iconUrl?: string;
|
|
824
|
+
description?: string;
|
|
825
|
+
} | undefined;
|
|
806
826
|
readonly discoveryProbe: DiscoveryProbeConfig | undefined;
|
|
807
827
|
private _x402ServerGetter;
|
|
808
828
|
/** Lazily-built JWKS cache for AIP verification, shared across requests so issuer keys
|
|
@@ -853,7 +873,10 @@ declare class Checkout {
|
|
|
853
873
|
/** Runs after a settle lands; can return an inline response body for API sellers. */
|
|
854
874
|
onSettled?: OnSettledFn;
|
|
855
875
|
/** Pass when the merchant mints per-order addresses so `verifyX402Request` can
|
|
856
|
-
* confirm the `payTo` was minted by this merchant.
|
|
876
|
+
* confirm the `payTo` was minted by this merchant (e.g. `piCache.hasAddress`).
|
|
877
|
+
* When omitted, Checkout auto-binds the agent-supplied `payTo` to the rail's
|
|
878
|
+
* configured STATIC recipient(s) — the permissive default applies ONLY when no
|
|
879
|
+
* static recipient exists (pure per-order minting). */
|
|
857
880
|
isCachedAddress?: IsCachedAddressFn;
|
|
858
881
|
/** Engage the EIP-3009 value=0 + pympp `proof` carve-out when pricing
|
|
859
882
|
* resolves to $0. Goods merchants offering free redemption codes set this
|
|
@@ -869,6 +892,16 @@ declare class Checkout {
|
|
|
869
892
|
* `extensions` field so Bazaar crawlers and other spec-compliant clients
|
|
870
893
|
* read the route's declared input/output schema. */
|
|
871
894
|
discoveryExtensions?: Record<string, unknown>;
|
|
895
|
+
/** Optional x402 v2 ResourceInfo metadata advertised on the 402 (both the
|
|
896
|
+
* body and the PAYMENT-REQUIRED header): `serviceName` / `tags` (max 5) /
|
|
897
|
+
* `iconUrl` / `description`, used by Bazaar search + filtering. `url` and
|
|
898
|
+
* `mimeType` are filled automatically from the request. */
|
|
899
|
+
resourceInfo?: {
|
|
900
|
+
serviceName?: string;
|
|
901
|
+
tags?: string[];
|
|
902
|
+
iconUrl?: string;
|
|
903
|
+
description?: string;
|
|
904
|
+
};
|
|
872
905
|
/** Optional discovery-probe config: auto-route empty-body POSTs without a
|
|
873
906
|
* payment header to a sample 402 advertising the merchant's shape for
|
|
874
907
|
* crawlers (`awal x402 details`, x402-proxy, x402scan, ...). */
|
|
@@ -915,7 +948,7 @@ declare class Checkout {
|
|
|
915
948
|
* - `AGENTSCORE_API_KEY` — required. No key → one-time warning + skip
|
|
916
949
|
* (dev/testnet pattern; production should always configure a key).
|
|
917
950
|
* - `AGENTSCORE_BASE_URL` — optional override for staging/dev API
|
|
918
|
-
* (e.g. `https://api
|
|
951
|
+
* (e.g. `https://api.staging.example` or `http://localhost:3002`).
|
|
919
952
|
*
|
|
920
953
|
* Stripe SPT (no extractable wallet signer) → skip silently; Stripe runs
|
|
921
954
|
* its own OFAC screen on the buyer's Stripe account at customer creation.
|
|
@@ -2,6 +2,7 @@ import { T as TempoRailSpec, S as SolanaMppRailSpec, c as TempoSessionRailSpec,
|
|
|
2
2
|
import { P as PricingBlock, R as RailKey } from './pricing-KHDqMLd7.mjs';
|
|
3
3
|
import { CreateSessionOnMissing, AgentScoreCoreOptions, DenialReason } from './core.mjs';
|
|
4
4
|
import { a as X402Server } from './x402_server-Ciz2mls2.mjs';
|
|
5
|
+
import { T as TrustLevel } from './types-D1slMt0H.mjs';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* UCP (Universal Commerce Protocol) profile builder.
|
|
@@ -11,7 +12,7 @@ import { a as X402Server } from './x402_server-Ciz2mls2.mjs';
|
|
|
11
12
|
* envelope, with `services` / `capabilities` / `payment_handlers` as MAPs keyed by
|
|
12
13
|
* reverse-DNS service / capability / handler name.
|
|
13
14
|
*
|
|
14
|
-
* AgentScore identity claims layer over UCP via the `
|
|
15
|
+
* AgentScore identity claims layer over UCP via the `com.agentscore.identity` capability
|
|
15
16
|
* (vendor-namespaced; UCP doesn't define KYC/sanctions/age/jurisdiction natively). The
|
|
16
17
|
* capability extends `dev.ucp.shopping.checkout` AND `dev.ucp.shopping.cart` (multi-parent,
|
|
17
18
|
* the standard pattern UCP allows for capabilities that compose multiple parents).
|
|
@@ -160,7 +161,7 @@ interface BuildUCPProfileInput {
|
|
|
160
161
|
/** Services map, keyed by service name. UCP-shopping merchants typically advertise
|
|
161
162
|
* bindings under `'dev.ucp.shopping'`. */
|
|
162
163
|
services?: Record<string, UCPServiceBinding[]>;
|
|
163
|
-
/** Capabilities map, keyed by capability name. The `
|
|
164
|
+
/** Capabilities map, keyed by capability name. The `com.agentscore.identity` capability
|
|
164
165
|
* is auto-added when `agentscore_gate` is provided. */
|
|
165
166
|
capabilities?: Record<string, UCPCapabilityBinding[]>;
|
|
166
167
|
/** Payment handlers map, keyed by handler reverse-DNS name. */
|
|
@@ -168,7 +169,7 @@ interface BuildUCPProfileInput {
|
|
|
168
169
|
/** JWKS — public keys the merchant signs with. REQUIRED by spec. */
|
|
169
170
|
signing_keys: UCPSigningKey[];
|
|
170
171
|
/** Merchant gate policy declaration. When provided, the SDK auto-injects an
|
|
171
|
-
* `
|
|
172
|
+
* `com.agentscore.identity` capability binding into `capabilities`, with the
|
|
172
173
|
* policy as the binding's `config`. Static merchant declaration only — no
|
|
173
174
|
* per-operator data ever ends up on the public profile. Per-operator identity
|
|
174
175
|
* attestation lives on the AP2 risk-signal endpoint, not here. */
|
|
@@ -186,7 +187,7 @@ interface BuildUCPProfileInput {
|
|
|
186
187
|
/** Vendor-specific extras INSIDE the `ucp` envelope (alongside `version`, `services`, etc.). */
|
|
187
188
|
ucp_extras?: Record<string, unknown>;
|
|
188
189
|
}
|
|
189
|
-
/** Merchant gate policy declared on the UCP profile via `
|
|
190
|
+
/** Merchant gate policy declared on the UCP profile via `com.agentscore.identity` capability config.
|
|
190
191
|
* All fields optional; merchant declares which AgentScore checks the gate enforces. Snake-case
|
|
191
192
|
* field names match the AgentScore API's `/v1/assess` policy contract verbatim — no conversion
|
|
192
193
|
* layer between this declaration and what the gate actually enforces at runtime. */
|
|
@@ -210,7 +211,7 @@ interface AgentScoreGatePolicy {
|
|
|
210
211
|
* signing_keys: [...] }`. Pass through `signUCPProfile` to attach a JWS signature for
|
|
211
212
|
* trust-mode verifiers.
|
|
212
213
|
*
|
|
213
|
-
* Auto-injects `
|
|
214
|
+
* Auto-injects `com.agentscore.identity` as a vendor capability extending both
|
|
214
215
|
* `dev.ucp.shopping.checkout` and `dev.ucp.shopping.cart` when `agentscore_gate`
|
|
215
216
|
* is provided. The capability's `config` carries the merchant's static gate
|
|
216
217
|
* policy declaration (require_kyc / require_sanctions_clear / min_age /
|
|
@@ -240,10 +241,10 @@ interface AgentScoreGatePolicy {
|
|
|
240
241
|
* ```
|
|
241
242
|
*/
|
|
242
243
|
declare function buildUCPProfile(input: BuildUCPProfileInput): UCPProfile;
|
|
243
|
-
declare const AGENTSCORE_UCP_CAPABILITY = "
|
|
244
|
+
declare const AGENTSCORE_UCP_CAPABILITY = "com.agentscore.identity";
|
|
244
245
|
type MppRailSpec = TempoRailSpec | SolanaMppRailSpec | TempoSessionRailSpec;
|
|
245
246
|
/**
|
|
246
|
-
* Build the `
|
|
247
|
+
* Build the `com.agentscore.payment.mpp` payment handler block for a UCP profile.
|
|
247
248
|
*
|
|
248
249
|
* Pass any mix of `TempoRailSpec`, `SolanaMppRailSpec`, and `TempoSessionRailSpec`.
|
|
249
250
|
*
|
|
@@ -266,7 +267,7 @@ declare function mppPaymentHandler({ networks, }: {
|
|
|
266
267
|
networks: MppRailSpec[];
|
|
267
268
|
}): Record<string, UCPPaymentHandlerBinding[]>;
|
|
268
269
|
/**
|
|
269
|
-
* Build the `
|
|
270
|
+
* Build the `com.agentscore.payment.x402` payment handler block for a UCP profile.
|
|
270
271
|
*
|
|
271
272
|
* @example
|
|
272
273
|
* ```ts
|
|
@@ -282,7 +283,7 @@ declare function x402PaymentHandler({ networks, }: {
|
|
|
282
283
|
networks: X402BaseRailSpec[];
|
|
283
284
|
}): Record<string, UCPPaymentHandlerBinding[]>;
|
|
284
285
|
/**
|
|
285
|
-
* Build the `
|
|
286
|
+
* Build the `com.agentscore.payment.stripe_spt` payment handler block for a UCP profile.
|
|
286
287
|
*
|
|
287
288
|
* @example
|
|
288
289
|
* ```ts
|
|
@@ -534,7 +535,7 @@ type RunGateFn = (ctx: CheckoutContext) => Promise<GateDenial | null>;
|
|
|
534
535
|
interface CheckoutGateConfig {
|
|
535
536
|
/** AgentScore API key. Required when `runGate` is omitted. */
|
|
536
537
|
apiKey?: string;
|
|
537
|
-
/** Override the default `https://api.agentscore.
|
|
538
|
+
/** Override the default `https://api.agentscore.com` base URL. */
|
|
538
539
|
baseUrl?: string;
|
|
539
540
|
/** Prepended to the default User-Agent on API calls. */
|
|
540
541
|
userAgent?: string;
|
|
@@ -594,7 +595,7 @@ interface AipGateConfig {
|
|
|
594
595
|
* Omit/empty to accept only AgentScore-issued AITs. */
|
|
595
596
|
trustedIssuers?: string[];
|
|
596
597
|
/** Clock-skew tolerance in seconds for the RFC 9421 signature window (and, as an override,
|
|
597
|
-
* the AIT JWT `exp`/`iat`). Defaults to
|
|
598
|
+
* the AIT JWT `exp`/`iat`). Defaults to 60s for both. */
|
|
598
599
|
maxSkewSeconds?: number;
|
|
599
600
|
/** Expected `@authority` (public hostname) the RFC 9421 signature must cover. When set, the
|
|
600
601
|
* verifier binds the signature to this value instead of trusting the inbound `Host` header —
|
|
@@ -602,6 +603,15 @@ interface AipGateConfig {
|
|
|
602
603
|
* not normalize `Host`, to prevent a captured AIT+signature from being replayed to a
|
|
603
604
|
* different virtual host on the same origin. */
|
|
604
605
|
authority?: string;
|
|
606
|
+
/** Minimum `trust_level` an AIT must assert to pass this gate (autonomous < human_present <
|
|
607
|
+
* human_confirmed) — the spec's human-presence gate (e.g. require `human_confirmed` for
|
|
608
|
+
* checkout). Enforced at the edge from the verified token; insufficient → 403 weak_auth with
|
|
609
|
+
* `required_trust_level`. Unset = any trust level accepted. */
|
|
610
|
+
requireTrustLevel?: TrustLevel;
|
|
611
|
+
/** Acceptable `auth.amr` methods (RFC 8176); the AIT must carry at least one (e.g.
|
|
612
|
+
* `['face','fpt','hwk']` to require strong human auth). Insufficient → 403 weak_auth with
|
|
613
|
+
* `required_amr`. Unset = not enforced. */
|
|
614
|
+
requireAmr?: string[];
|
|
605
615
|
/** Per-issuer compliance policy override, keyed by issuer URL (canonicalized before lookup).
|
|
606
616
|
* When a request's AIT is verified and its `iss` matches a key here, that block REPLACES the
|
|
607
617
|
* gate's default policy fields (`requireKyc` / `requireSanctionsClear` / `minAge` /
|
|
@@ -800,9 +810,19 @@ declare class Checkout {
|
|
|
800
810
|
readonly mintReferenceId: ReferenceIdFn | undefined;
|
|
801
811
|
readonly onSettled: OnSettledFn | undefined;
|
|
802
812
|
readonly isCachedAddress: IsCachedAddressFn | undefined;
|
|
813
|
+
/** Lowercased static recipient addresses for the x402-base rail(s). When the merchant
|
|
814
|
+
* configured a static recipient and supplied no `isCachedAddress`, the gate binds the
|
|
815
|
+
* agent-supplied `payTo` to this set (anti funds-drain). Empty for pure per-order minting. */
|
|
816
|
+
private readonly x402StaticRecipients;
|
|
803
817
|
readonly zeroSettleCarveOut: boolean;
|
|
804
818
|
readonly gate: CheckoutGateConfig | undefined;
|
|
805
819
|
readonly discoveryExtensions: Record<string, unknown> | undefined;
|
|
820
|
+
readonly resourceInfo: {
|
|
821
|
+
serviceName?: string;
|
|
822
|
+
tags?: string[];
|
|
823
|
+
iconUrl?: string;
|
|
824
|
+
description?: string;
|
|
825
|
+
} | undefined;
|
|
806
826
|
readonly discoveryProbe: DiscoveryProbeConfig | undefined;
|
|
807
827
|
private _x402ServerGetter;
|
|
808
828
|
/** Lazily-built JWKS cache for AIP verification, shared across requests so issuer keys
|
|
@@ -853,7 +873,10 @@ declare class Checkout {
|
|
|
853
873
|
/** Runs after a settle lands; can return an inline response body for API sellers. */
|
|
854
874
|
onSettled?: OnSettledFn;
|
|
855
875
|
/** Pass when the merchant mints per-order addresses so `verifyX402Request` can
|
|
856
|
-
* confirm the `payTo` was minted by this merchant.
|
|
876
|
+
* confirm the `payTo` was minted by this merchant (e.g. `piCache.hasAddress`).
|
|
877
|
+
* When omitted, Checkout auto-binds the agent-supplied `payTo` to the rail's
|
|
878
|
+
* configured STATIC recipient(s) — the permissive default applies ONLY when no
|
|
879
|
+
* static recipient exists (pure per-order minting). */
|
|
857
880
|
isCachedAddress?: IsCachedAddressFn;
|
|
858
881
|
/** Engage the EIP-3009 value=0 + pympp `proof` carve-out when pricing
|
|
859
882
|
* resolves to $0. Goods merchants offering free redemption codes set this
|
|
@@ -869,6 +892,16 @@ declare class Checkout {
|
|
|
869
892
|
* `extensions` field so Bazaar crawlers and other spec-compliant clients
|
|
870
893
|
* read the route's declared input/output schema. */
|
|
871
894
|
discoveryExtensions?: Record<string, unknown>;
|
|
895
|
+
/** Optional x402 v2 ResourceInfo metadata advertised on the 402 (both the
|
|
896
|
+
* body and the PAYMENT-REQUIRED header): `serviceName` / `tags` (max 5) /
|
|
897
|
+
* `iconUrl` / `description`, used by Bazaar search + filtering. `url` and
|
|
898
|
+
* `mimeType` are filled automatically from the request. */
|
|
899
|
+
resourceInfo?: {
|
|
900
|
+
serviceName?: string;
|
|
901
|
+
tags?: string[];
|
|
902
|
+
iconUrl?: string;
|
|
903
|
+
description?: string;
|
|
904
|
+
};
|
|
872
905
|
/** Optional discovery-probe config: auto-route empty-body POSTs without a
|
|
873
906
|
* payment header to a sample 402 advertising the merchant's shape for
|
|
874
907
|
* crawlers (`awal x402 details`, x402-proxy, x402scan, ...). */
|
|
@@ -915,7 +948,7 @@ declare class Checkout {
|
|
|
915
948
|
* - `AGENTSCORE_API_KEY` — required. No key → one-time warning + skip
|
|
916
949
|
* (dev/testnet pattern; production should always configure a key).
|
|
917
950
|
* - `AGENTSCORE_BASE_URL` — optional override for staging/dev API
|
|
918
|
-
* (e.g. `https://api
|
|
951
|
+
* (e.g. `https://api.staging.example` or `http://localhost:3002`).
|
|
919
952
|
*
|
|
920
953
|
* Stripe SPT (no extractable wallet signer) → skip silently; Stripe runs
|
|
921
954
|
* its own OFAC screen on the buyer's Stripe account at customer creation.
|
package/dist/core.d.mts
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
|
+
import { AipSignatureMaterial } from '@agent-score/sdk';
|
|
1
2
|
import { P as PaymentSigner } from './signer-3FAit11j.mjs';
|
|
2
3
|
|
|
3
4
|
interface AgentIdentity {
|
|
4
5
|
address?: string;
|
|
5
6
|
operatorToken?: string;
|
|
6
|
-
/** Raw AIP Agent Identity Token (a JWT). When set, the gate has
|
|
7
|
-
*
|
|
8
|
-
* as `aip_token` for server-side
|
|
7
|
+
/** Raw AIP Agent Identity Token (a JWT). When set, the gate has verified the token's RFC 9421
|
|
8
|
+
* proof-of-possession at the edge as a fail-fast filter; `evaluate` forwards it to `/v1/assess`
|
|
9
|
+
* as `aip_token` (with {@link aipSignature}) for AUTHORITATIVE server-side re-verification of the
|
|
10
|
+
* IdP signature + proof-of-possession + policy. */
|
|
9
11
|
aipToken?: string;
|
|
12
|
+
/** RFC 9421 signature material accompanying {@link aipToken}, forwarded to `/v1/assess` as
|
|
13
|
+
* `aip_signature` so the API re-verifies proof-of-possession itself (the edge is not trusted as
|
|
14
|
+
* the authority). Always set together with `aipToken`. */
|
|
15
|
+
aipSignature?: AipSignatureMaterial;
|
|
10
16
|
}
|
|
11
17
|
/**
|
|
12
18
|
* Session metadata returned from `POST /v1/sessions`. Surfaced to the `onBeforeSession`
|
|
@@ -70,7 +76,7 @@ interface AgentScoreCoreOptions {
|
|
|
70
76
|
failOpen?: boolean;
|
|
71
77
|
/** How long to cache results, in seconds. Defaults to 300. */
|
|
72
78
|
cacheSeconds?: number;
|
|
73
|
-
/** AgentScore API base URL. Defaults to "https://api.agentscore.
|
|
79
|
+
/** AgentScore API base URL. Defaults to "https://api.agentscore.com". */
|
|
74
80
|
baseUrl?: string;
|
|
75
81
|
/** Optional chain to filter scoring to. */
|
|
76
82
|
chain?: string;
|
|
@@ -190,6 +196,8 @@ interface AssessResult {
|
|
|
190
196
|
subject: string;
|
|
191
197
|
trust_level?: 'autonomous' | 'human_present' | 'human_confirmed';
|
|
192
198
|
agent_provider?: string;
|
|
199
|
+
/** True when /v1/assess re-verified the RFC 9421 proof-of-possession (always true on success). */
|
|
200
|
+
pop_verified?: boolean;
|
|
193
201
|
};
|
|
194
202
|
}
|
|
195
203
|
/**
|
|
@@ -222,6 +230,12 @@ interface GateQuotaInfo {
|
|
|
222
230
|
* merchants can alert/log without parsing console output.
|
|
223
231
|
* - `quota` propagates the SDK's per-request quota observability when the API emits the
|
|
224
232
|
* `X-Quota-*` headers. Optional; absent on Enterprise / unlimited tiers.
|
|
233
|
+
* - `signerVerdict` carries the per-request wallet-signer verdicts (signer_match + signer_sanctions)
|
|
234
|
+
* composed by this evaluate's assess call. It rides on the RETURN VALUE (not a shared slot on the
|
|
235
|
+
* core) so concurrent same-wallet/different-signer requests can't read each other's verdict —
|
|
236
|
+
* the adapter stashes it on its per-request state for `getSignerVerdict(ctx)` to read back.
|
|
237
|
+
* Present only on wallet-only identity when the response carried either signer block; `undefined`
|
|
238
|
+
* otherwise (operator-token / AIT paths, discovery legs with no signer).
|
|
225
239
|
* - `{ kind: 'deny', reason }` — the request was denied. Adapters should render a 403 with the
|
|
226
240
|
* reason, or invoke the caller's custom denial handler.
|
|
227
241
|
*/
|
|
@@ -231,9 +245,11 @@ type EvaluateOutcome = {
|
|
|
231
245
|
degraded?: boolean;
|
|
232
246
|
infraReason?: FailOpenInfraReason;
|
|
233
247
|
quota?: GateQuotaInfo;
|
|
248
|
+
signerVerdict?: SignerVerdict;
|
|
234
249
|
} | {
|
|
235
250
|
kind: 'deny';
|
|
236
251
|
reason: DenialReason;
|
|
252
|
+
signerVerdict?: SignerVerdict;
|
|
237
253
|
};
|
|
238
254
|
interface CaptureWalletOptions {
|
|
239
255
|
/** Operator credential (`opc_...`) that the agent authenticated with. */
|
|
@@ -302,11 +318,6 @@ interface AgentScoreCore {
|
|
|
302
318
|
* it and the response includes `signer_match` + `signer_sanctions` verdicts in one
|
|
303
319
|
* round trip. */
|
|
304
320
|
signer?: PaymentSigner | null): Promise<EvaluateOutcome>;
|
|
305
|
-
/** Synchronous read of the cached signer verdicts (signer_match + signer_sanctions)
|
|
306
|
-
* populated when the gate's evaluate call was made with a pre-extracted signer. Returns
|
|
307
|
-
* `undefined` when the gate didn't run, the request was operator-token-authenticated,
|
|
308
|
-
* or no signer was extractable (discovery legs). */
|
|
309
|
-
getSignerVerdict(claimedAddress: string): SignerVerdict | undefined;
|
|
310
321
|
/** Report a wallet seen paying under an operator credential. Fire-and-forget; silently
|
|
311
322
|
* swallows non-fatal errors because capture is informational, not on the critical path. */
|
|
312
323
|
captureWallet(options: CaptureWalletOptions): Promise<void>;
|
package/dist/core.d.ts
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
|
+
import { AipSignatureMaterial } from '@agent-score/sdk';
|
|
1
2
|
import { P as PaymentSigner } from './signer-3FAit11j.js';
|
|
2
3
|
|
|
3
4
|
interface AgentIdentity {
|
|
4
5
|
address?: string;
|
|
5
6
|
operatorToken?: string;
|
|
6
|
-
/** Raw AIP Agent Identity Token (a JWT). When set, the gate has
|
|
7
|
-
*
|
|
8
|
-
* as `aip_token` for server-side
|
|
7
|
+
/** Raw AIP Agent Identity Token (a JWT). When set, the gate has verified the token's RFC 9421
|
|
8
|
+
* proof-of-possession at the edge as a fail-fast filter; `evaluate` forwards it to `/v1/assess`
|
|
9
|
+
* as `aip_token` (with {@link aipSignature}) for AUTHORITATIVE server-side re-verification of the
|
|
10
|
+
* IdP signature + proof-of-possession + policy. */
|
|
9
11
|
aipToken?: string;
|
|
12
|
+
/** RFC 9421 signature material accompanying {@link aipToken}, forwarded to `/v1/assess` as
|
|
13
|
+
* `aip_signature` so the API re-verifies proof-of-possession itself (the edge is not trusted as
|
|
14
|
+
* the authority). Always set together with `aipToken`. */
|
|
15
|
+
aipSignature?: AipSignatureMaterial;
|
|
10
16
|
}
|
|
11
17
|
/**
|
|
12
18
|
* Session metadata returned from `POST /v1/sessions`. Surfaced to the `onBeforeSession`
|
|
@@ -70,7 +76,7 @@ interface AgentScoreCoreOptions {
|
|
|
70
76
|
failOpen?: boolean;
|
|
71
77
|
/** How long to cache results, in seconds. Defaults to 300. */
|
|
72
78
|
cacheSeconds?: number;
|
|
73
|
-
/** AgentScore API base URL. Defaults to "https://api.agentscore.
|
|
79
|
+
/** AgentScore API base URL. Defaults to "https://api.agentscore.com". */
|
|
74
80
|
baseUrl?: string;
|
|
75
81
|
/** Optional chain to filter scoring to. */
|
|
76
82
|
chain?: string;
|
|
@@ -190,6 +196,8 @@ interface AssessResult {
|
|
|
190
196
|
subject: string;
|
|
191
197
|
trust_level?: 'autonomous' | 'human_present' | 'human_confirmed';
|
|
192
198
|
agent_provider?: string;
|
|
199
|
+
/** True when /v1/assess re-verified the RFC 9421 proof-of-possession (always true on success). */
|
|
200
|
+
pop_verified?: boolean;
|
|
193
201
|
};
|
|
194
202
|
}
|
|
195
203
|
/**
|
|
@@ -222,6 +230,12 @@ interface GateQuotaInfo {
|
|
|
222
230
|
* merchants can alert/log without parsing console output.
|
|
223
231
|
* - `quota` propagates the SDK's per-request quota observability when the API emits the
|
|
224
232
|
* `X-Quota-*` headers. Optional; absent on Enterprise / unlimited tiers.
|
|
233
|
+
* - `signerVerdict` carries the per-request wallet-signer verdicts (signer_match + signer_sanctions)
|
|
234
|
+
* composed by this evaluate's assess call. It rides on the RETURN VALUE (not a shared slot on the
|
|
235
|
+
* core) so concurrent same-wallet/different-signer requests can't read each other's verdict —
|
|
236
|
+
* the adapter stashes it on its per-request state for `getSignerVerdict(ctx)` to read back.
|
|
237
|
+
* Present only on wallet-only identity when the response carried either signer block; `undefined`
|
|
238
|
+
* otherwise (operator-token / AIT paths, discovery legs with no signer).
|
|
225
239
|
* - `{ kind: 'deny', reason }` — the request was denied. Adapters should render a 403 with the
|
|
226
240
|
* reason, or invoke the caller's custom denial handler.
|
|
227
241
|
*/
|
|
@@ -231,9 +245,11 @@ type EvaluateOutcome = {
|
|
|
231
245
|
degraded?: boolean;
|
|
232
246
|
infraReason?: FailOpenInfraReason;
|
|
233
247
|
quota?: GateQuotaInfo;
|
|
248
|
+
signerVerdict?: SignerVerdict;
|
|
234
249
|
} | {
|
|
235
250
|
kind: 'deny';
|
|
236
251
|
reason: DenialReason;
|
|
252
|
+
signerVerdict?: SignerVerdict;
|
|
237
253
|
};
|
|
238
254
|
interface CaptureWalletOptions {
|
|
239
255
|
/** Operator credential (`opc_...`) that the agent authenticated with. */
|
|
@@ -302,11 +318,6 @@ interface AgentScoreCore {
|
|
|
302
318
|
* it and the response includes `signer_match` + `signer_sanctions` verdicts in one
|
|
303
319
|
* round trip. */
|
|
304
320
|
signer?: PaymentSigner | null): Promise<EvaluateOutcome>;
|
|
305
|
-
/** Synchronous read of the cached signer verdicts (signer_match + signer_sanctions)
|
|
306
|
-
* populated when the gate's evaluate call was made with a pre-extracted signer. Returns
|
|
307
|
-
* `undefined` when the gate didn't run, the request was operator-token-authenticated,
|
|
308
|
-
* or no signer was extractable (discovery legs). */
|
|
309
|
-
getSignerVerdict(claimedAddress: string): SignerVerdict | undefined;
|
|
310
321
|
/** Report a wallet seen paying under an operator credential. Fire-and-forget; silently
|
|
311
322
|
* swallows non-fatal errors because capture is informational, not on the critical path. */
|
|
312
323
|
captureWallet(options: CaptureWalletOptions): Promise<void>;
|