@agent-score/commerce 1.5.1 → 1.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 (52) hide show
  1. package/README.md +27 -15
  2. package/dist/challenge/index.js.map +1 -1
  3. package/dist/challenge/index.mjs.map +1 -1
  4. package/dist/core.d.mts +36 -27
  5. package/dist/core.d.ts +36 -27
  6. package/dist/core.js +1 -1
  7. package/dist/core.js.map +1 -1
  8. package/dist/core.mjs +1 -1
  9. package/dist/core.mjs.map +1 -1
  10. package/dist/identity/express.d.mts +2 -2
  11. package/dist/identity/express.d.ts +2 -2
  12. package/dist/identity/express.js +1 -1
  13. package/dist/identity/express.js.map +1 -1
  14. package/dist/identity/express.mjs +1 -1
  15. package/dist/identity/express.mjs.map +1 -1
  16. package/dist/identity/fastify.d.mts +2 -2
  17. package/dist/identity/fastify.d.ts +2 -2
  18. package/dist/identity/fastify.js +1 -1
  19. package/dist/identity/fastify.js.map +1 -1
  20. package/dist/identity/fastify.mjs +1 -1
  21. package/dist/identity/fastify.mjs.map +1 -1
  22. package/dist/identity/hono.d.mts +2 -2
  23. package/dist/identity/hono.d.ts +2 -2
  24. package/dist/identity/hono.js +1 -1
  25. package/dist/identity/hono.js.map +1 -1
  26. package/dist/identity/hono.mjs +1 -1
  27. package/dist/identity/hono.mjs.map +1 -1
  28. package/dist/identity/nextjs.d.mts +2 -2
  29. package/dist/identity/nextjs.d.ts +2 -2
  30. package/dist/identity/nextjs.js +1 -1
  31. package/dist/identity/nextjs.js.map +1 -1
  32. package/dist/identity/nextjs.mjs +1 -1
  33. package/dist/identity/nextjs.mjs.map +1 -1
  34. package/dist/identity/policy.d.mts +3 -3
  35. package/dist/identity/policy.d.ts +3 -3
  36. package/dist/identity/policy.js +3 -3
  37. package/dist/identity/policy.js.map +1 -1
  38. package/dist/identity/policy.mjs +2 -2
  39. package/dist/identity/policy.mjs.map +1 -1
  40. package/dist/identity/web.d.mts +3 -3
  41. package/dist/identity/web.d.ts +3 -3
  42. package/dist/identity/web.js +1 -1
  43. package/dist/identity/web.js.map +1 -1
  44. package/dist/identity/web.mjs +1 -1
  45. package/dist/identity/web.mjs.map +1 -1
  46. package/dist/index.d.mts +286 -130
  47. package/dist/index.d.ts +286 -130
  48. package/dist/index.js +130 -72
  49. package/dist/index.js.map +1 -1
  50. package/dist/index.mjs +124 -69
  51. package/dist/index.mjs.map +1 -1
  52. package/package.json +2 -2
package/dist/index.d.mts CHANGED
@@ -1,151 +1,222 @@
1
- import { AgentScoreData } from './core.mjs';
2
- export { AgentIdentity, AgentMemoryHint, AgentScoreCore, AgentScoreCoreOptions, CreateSessionOnMissing, DenialCode, DenialReason, EvaluateOutcome, VerifyWalletSignerMatchOptions, VerifyWalletSignerResult, buildAgentMemoryHint } from './core.mjs';
1
+ export { AccountVerification, AgentIdentity, AgentMemoryHint, AgentScoreCore, AgentScoreCoreOptions, AssessResult, CreateSessionOnMissing, DenialCode, DenialReason, EvaluateOutcome, OperatorVerification, PolicyCheck, PolicyResult, VerifyWalletSignerMatchOptions, VerifyWalletSignerResult, buildAgentMemoryHint } from './core.mjs';
3
2
  export { P as PaymentSigner, S as SignerNetwork, a as extractPaymentSigner, e as extractPaymentSignerAddress, r as readX402PaymentHeader } from './signer-kCAJUZwp.mjs';
4
3
  export { F as FIXABLE_DENIAL_REASONS, b as buildContactSupportNextSteps, a as buildSignerMismatchBody, d as denialReasonStatus, c as denialReasonToBody, i as isFixableDenial, v as verificationAgentInstructions } from './_response-DpB-cm2c.mjs';
5
- export { EnforcementMode, GateResult, IdentityStatus, PolicyBlock, policyToGateOptions, runGateWithEnforcement, shippingCountryAllowed, shippingStateAllowed } from './identity/policy.mjs';
4
+ export { EnforcementMode, GateResult, IdentityStatus, PolicyBlock, buildGateOptionsFromPolicy, runGateWithEnforcement, shippingCountryAllowed, shippingStateAllowed } from './identity/policy.mjs';
6
5
 
7
6
  /**
8
- * Google A2A (Agent-to-Agent) Signed Agent Cards builder.
7
+ * Google A2A (Agent-to-Agent) v1.0 Agent Card builder.
9
8
  *
10
- * Compose the JSON payload for an A2A v1.0 Signed Agent Card that includes the
11
- * agent's AgentScore identity claims. Returned object is the unsigned card body —
12
- * the merchant (or agent) signs it with their wallet / signing key before publishing.
9
+ * Compose the JSON payload for an A2A v1.0 Agent Card per the canonical proto at
10
+ * https://github.com/a2aproject/A2A/blob/main/specification/a2a.proto. Returned object
11
+ * is the unsigned card body wrap with an A2A `AgentCardSignature` (RFC 7515 JWS)
12
+ * to sign vendor-side before publishing at /.well-known/agent-card.json.
13
13
  *
14
- * Why publish: A2A is a Linux Foundation standard with 150+ orgs (Microsoft, AWS,
15
- * Salesforce in production). Signed Agent Cards let any A2A-compatible reader discover
16
- * an agent's verified-identity claims without per-platform integration. AgentScore
17
- * publishing operator identity in this format means our identity travels with the agent
18
- * across A2A-aware ecosystems.
14
+ * Why publish: A2A is a Linux Foundation standard. Signed Agent Cards let any
15
+ * A2A-compatible reader discover an agent's capabilities + protocol bindings without
16
+ * per-platform integration. Per UCP §A2A binding, agents serving UCP via the A2A
17
+ * transport MUST declare the canonical UCP extension URI in `capabilities.extensions[]`
18
+ * so platforms detect UCP support without re-fetching the profile.
19
19
  *
20
20
  * Spec reference: https://a2a-protocol.org/latest/
21
21
  */
22
-
23
- interface A2AAgentCardCapabilities {
24
- /** Endpoints the agent exposes `[{ name: "purchase", path: "/purchase", method: "POST" }, ...]`. */
25
- endpoints?: {
26
- name: string;
27
- path?: string;
28
- method?: string;
29
- }[];
30
- /** Free-form skill tags — `["product-purchase", "regulated-commerce", ...]`. */
31
- skills?: string[];
22
+ /** Canonical UCP A2A extension URI — verifiers look for this exact URI in
23
+ * `capabilities.extensions[]` to detect UCP support on the agent card. Pinned
24
+ * to the 2026-04-08 spec snapshot. */
25
+ declare const UCP_A2A_EXTENSION_URI = "https://ucp.dev/2026-04-08/specification/reference";
26
+ /** Per spec §4.4.6. Each entry advertises one protocol binding the agent supports.
27
+ * `supported_interfaces[0]` is the preferred binding (ordered list). */
28
+ interface A2AAgentInterface {
29
+ /** Interface URL (https in production). */
30
+ url: string;
31
+ /** Open string — core values are `JSONRPC`, `GRPC`, `HTTP+JSON`. */
32
+ protocol_binding: string;
33
+ /** A2A protocol version, e.g. `"1.0"`. Distinct from the agent's own version. */
34
+ protocol_version: string;
35
+ tenant?: string;
36
+ }
37
+ /** Per spec §4.4.2. The org/service that provides the agent. */
38
+ interface A2AAgentProvider {
39
+ url: string;
40
+ organization: string;
32
41
  }
33
- /** Per A2A v1.0: an entry in the card's top-level `extensions` array. UCP support
34
- * is declared this way (UCP §A2A binding requires `https://ucp.dev/2026-04-08/specification/reference`). */
42
+ /** Per spec §4.4.5. A distinct capability or function the agent performs.
43
+ * Lives at the TOP LEVEL of AgentCard (not inside `capabilities`). */
44
+ interface A2AAgentSkill {
45
+ id: string;
46
+ name: string;
47
+ description: string;
48
+ tags: string[];
49
+ examples?: string[];
50
+ input_modes?: string[];
51
+ output_modes?: string[];
52
+ }
53
+ /** Per spec §4.4.4. A protocol extension the agent supports.
54
+ * Lives in `capabilities.extensions[]`. `description` and `required` are
55
+ * spec-mandated fields, not optional. */
35
56
  interface A2AAgentCardExtension {
36
- /** Canonical extension URI — for UCP, `https://ucp.dev/2026-04-08/specification/reference`. */
37
57
  uri: string;
38
- /** Extension-specific params. UCP places `{ capabilities: { "<reverse-dns>": [{ version: "..." }, ...] } }` here. */
58
+ description: string;
59
+ required: boolean;
39
60
  params?: Record<string, unknown>;
40
61
  }
41
- /** Canonical UCP A2A extension URI — verifiers look for this exact URI in `extensions[]`
42
- * to detect UCP support on the agent card. Pinned to the 2026-04-08 spec snapshot. */
43
- declare const UCP_A2A_EXTENSION_URI = "https://ucp.dev/2026-04-08/specification/reference";
44
- /** Build the canonical UCP entry for an A2A agent card's `extensions[]` array.
62
+ /** Build the canonical UCP entry for an A2A agent card's `capabilities.extensions[]`
63
+ * array.
45
64
  *
46
65
  * Per UCP §A2A binding: "Businesses supporting UCP must advertise the extension and
47
66
  * any optional capabilities in their A2A Agent Card to allow platforms to activate
48
67
  * the extension." Pass the `capabilities` map keyed by reverse-DNS service/capability
49
68
  * name (e.g. `dev.ucp.shopping.checkout`), each value a list of `{ version }` records.
50
69
  * Pass `{}` (or omit) when you serve UCP at the discovery layer but have no formal
51
- * capability bindings yet — vendors that haven't implemented checkout/cart/etc. should
52
- * declare the extension URI without claiming capabilities they don't service.
70
+ * capability bindings yet.
71
+ *
72
+ * `required: true` declares the platform must understand UCP to interoperate with
73
+ * this agent. Default `false`: UCP is offered but not mandatory.
53
74
  */
54
75
  declare function ucpA2AExtension(capabilities?: Record<string, Array<{
55
76
  version: string;
56
- }>>): A2AAgentCardExtension;
57
- interface A2AAgentCardIdentity {
58
- /** Issuer of the identity claims — always `"https://agentscore.sh"` for the AgentScore-issued card. */
59
- issuer: string;
60
- /** Operator id under AgentScore. */
61
- operator_id: string;
62
- /** KYC tier. */
63
- kyc_level: string;
64
- /** Sanctions screening result. */
65
- sanctions_clear: boolean;
66
- /** Age bracket. */
67
- age_bracket: string;
68
- /** Jurisdiction (ISO-3166-1 alpha-2 or empty). */
69
- jurisdiction: string;
70
- /** ISO-8601 timestamp of last verification refresh. */
71
- verified_at: string | null;
72
- /** Verify URL where the identity was minted. */
73
- verify_url: string;
77
+ }>>, options?: {
78
+ required?: boolean;
79
+ }): A2AAgentCardExtension;
80
+ /** Per spec §4.4.3. Optional capabilities the agent supports.
81
+ *
82
+ * Per the canonical proto, `capabilities` declares: streaming, push_notifications,
83
+ * extensions (the protocol extensions the agent supports), and extended_agent_card.
84
+ * REST-style endpoint metadata does NOT belong here — A2A uses `supported_interfaces`
85
+ * on the AgentCard for protocol bindings, and `skills` (top-level) for capability
86
+ * descriptions. */
87
+ interface A2AAgentCardCapabilities {
88
+ streaming?: boolean;
89
+ push_notifications?: boolean;
90
+ extensions?: A2AAgentCardExtension[];
91
+ extended_agent_card?: boolean;
74
92
  }
93
+ /** Per spec §4.4.7. JWS signature embedded in an Agent Card.
94
+ *
95
+ * Multiple signatures MAY be attached to a single card. Verifiers reconstruct the
96
+ * card body without `signatures` to verify each entry. Format follows RFC 7515 JSON
97
+ * Web Signature (JWS). */
98
+ interface A2AAgentCardSignature {
99
+ /** Base64url-encoded JSON of the protected JWS header. REQUIRED. */
100
+ protected: string;
101
+ /** Base64url-encoded computed signature. REQUIRED. */
102
+ signature: string;
103
+ /** Optional unprotected JWS header values. */
104
+ header?: Record<string, unknown>;
105
+ }
106
+ /** Per spec §4.4.1. A2A v1.0 Agent Card body.
107
+ *
108
+ * Per spec §4.4.7, JWS signatures may be embedded directly in the card via the
109
+ * `signatures` field; verifiers reconstruct the card body without `signatures` and
110
+ * verify each entry. Per-vendor identity attestation can also be expressed via a
111
+ * vendor extension entry inside `capabilities.extensions[]`. */
75
112
  interface A2AAgentCard {
76
- /** A2A protocol version. v1.0 was donated to Linux Foundation. */
77
- protocol_version: string;
78
- /** Card schema version (this builder emits v1). */
79
- card_version: number;
80
- /** Agent's display name. */
81
113
  name: string;
82
- /** One-line description shown to A2A consumers. */
83
- description?: string;
84
- /** Agent's canonical URL (homepage, Discord, repo, etc.). */
85
- url?: string;
86
- /** Agent capabilities endpoints + skills. */
87
- capabilities?: A2AAgentCardCapabilities;
88
- /** A2A v1.0 extensions array. Use `ucpA2AExtension()` to add the UCP entry. */
89
- extensions?: A2AAgentCardExtension[];
90
- /** AgentScore identity claims. Empty `null` when no identity is available (pre-KYC). */
91
- identity: A2AAgentCardIdentity | null;
92
- /** Vendor-specific extras merged at the top level. */
93
- extras?: Record<string, unknown>;
114
+ description: string;
115
+ /** Ordered; first entry is preferred. */
116
+ supported_interfaces: A2AAgentInterface[];
117
+ /** Agent's own version, e.g. `"1.0.0"`. Distinct from the A2A protocol version,
118
+ * which lives on each `A2AAgentInterface.protocol_version`. */
119
+ version: string;
120
+ capabilities: A2AAgentCardCapabilities;
121
+ default_input_modes: string[];
122
+ default_output_modes: string[];
123
+ /** Per spec §4.4.1 (proto field 12, REQUIRED): the agent must declare ≥1 skill.
124
+ * The convenience builder `buildA2AAgentCard` enforces non-empty. */
125
+ skills: A2AAgentSkill[];
126
+ provider?: A2AAgentProvider;
127
+ documentation_url?: string;
128
+ /** Per spec §4.4.1 (proto field 14, optional): URL to an icon for the agent. */
129
+ icon_url?: string;
130
+ /** Per spec §4.4.1 (proto field 13, optional) + §4.4.7: JWS signatures embedded
131
+ * in the card. Compute over the canonical card body MINUS this field, then attach. */
132
+ signatures?: A2AAgentCardSignature[];
133
+ security_schemes?: Record<string, unknown>;
134
+ security_requirements?: unknown[];
135
+ /** Vendor-specific extras merged at top level. */
136
+ [k: string]: unknown;
94
137
  }
95
138
  interface BuildA2AAgentCardInput {
96
- /** Display name for the agent — e.g. a merchant brand or service name. */
139
+ /** Agent display name. REQUIRED. */
97
140
  name: string;
98
- /** Optional one-line description. */
99
- description?: string;
100
- /** Agent's canonical URL. */
101
- url?: string;
102
- /** Capabilities endpoints exposed + skill tags. */
103
- capabilities?: A2AAgentCardCapabilities;
104
- /** A2A v1.0 extensions to declare on the card. Build the UCP entry with
105
- * `ucpA2AExtension()`. Other A2A extensions can be added the same way. */
141
+ /** Agent purpose/description. REQUIRED per spec. */
142
+ description: string;
143
+ /** The primary interface URL — becomes `supported_interfaces[0].url` (with
144
+ * `protocol_binding=HTTP+JSON`, `protocol_version=1.0` by default). For
145
+ * multi-binding agents, construct `A2AAgentCard` directly. */
146
+ url: string;
147
+ /** Top-level skill declarations what the agent can do. REQUIRED per spec
148
+ * (proto field 12 [field_behavior=REQUIRED]); must have ≥1 entry. */
149
+ skills: A2AAgentSkill[];
150
+ /** Agent's own version, e.g. `"1.0.0"`. Distinct from the A2A protocol version. */
151
+ version?: string;
152
+ /** A2A v1.0 capability extensions. Build the UCP entry with `ucpA2AExtension()`. */
106
153
  extensions?: A2AAgentCardExtension[];
107
- /** AgentScore assess data what `getAgentScoreData(c)` returns or what `assess()` returned directly.
108
- * Pass `null` to emit a card with no identity claims (publishable but unverified). */
109
- data?: AgentScoreData | null;
110
- /** Override the default issuer URL. Default `"https://agentscore.sh"`. */
111
- issuer?: string;
112
- /** Override the verify URL. */
113
- verifyUrl?: string;
154
+ /** Capability flag: agent supports streaming responses. */
155
+ streaming?: boolean;
156
+ /** Capability flag: agent supports push notifications for async task updates. */
157
+ push_notifications?: boolean;
158
+ /** Capability flag: agent serves an extended (more detailed) card when authenticated. */
159
+ extended_agent_card?: boolean;
160
+ /** Provider org for the agent. */
161
+ provider?: A2AAgentProvider;
162
+ /** URL to additional human-readable documentation. */
163
+ documentation_url?: string;
164
+ /** URL to an icon for the agent. */
165
+ icon_url?: string;
166
+ /** JWS signatures embedded in the card (per spec §4.4.7). */
167
+ signatures?: A2AAgentCardSignature[];
168
+ /** Default input media types (defaults to `["application/json"]`). */
169
+ default_input_modes?: string[];
170
+ /** Default output media types (defaults to `["application/json"]`). */
171
+ default_output_modes?: string[];
172
+ /** Override the protocol binding for the auto-built primary interface (default `"HTTP+JSON"`). */
173
+ protocol_binding?: string;
174
+ /** Override the A2A protocol version for the auto-built primary interface (default `"1.0"`). */
175
+ a2a_protocol_version?: string;
176
+ /** Per-scheme security details (key = scheme name). */
177
+ security_schemes?: Record<string, unknown>;
178
+ /** Required security requirements for invoking the agent. */
179
+ security_requirements?: unknown[];
114
180
  /** Vendor-specific extras merged at the card top level. */
115
181
  extras?: Record<string, unknown>;
116
182
  }
117
183
  /**
118
- * Compose an A2A Signed Agent Card body with AgentScore identity claims included.
184
+ * Compose an A2A v1.0 Agent Card body per the canonical proto.
119
185
  *
120
- * Returns the UNSIGNED card. The vendor signs it with their wallet (typically using
121
- * the same wallet they use for x402 / MPP payments) and publishes the signed envelope
122
- * to wherever A2A consumers discover cards (a hosted endpoint, on-chain registry,
123
- * agent-card-server, etc.). Signing is vendor-side because the agent's signing key
124
- * never leaves their environment.
186
+ * Returns the UNSIGNED card. To attach identity claims, sign the serialized body
187
+ * as an RFC 7515 JWS (`AgentCardSignature`). Vendors can also add an identity-flavored
188
+ * extension to `capabilities.extensions[]`.
189
+ *
190
+ * The single `url` argument becomes the primary `supported_interfaces[0].url`
191
+ * (with `protocol_binding=HTTP+JSON`, `protocol_version=1.0` by default).
125
192
  *
126
193
  * Example:
127
194
  * ```ts
128
- * import { buildA2AAgentCard } from '@agent-score/commerce/identity/hono';
129
- *
130
- * app.get('/.well-known/agent-card', async (c) => {
131
- * const data = getAgentScoreData(c);
132
- * const card = buildA2AAgentCard({
133
- * name: 'Example Merchant Concierge',
134
- * description: 'Buy regulated goods via agent payments.',
135
- * url: 'https://agents.example.com',
136
- * capabilities: {
137
- * endpoints: [{ name: 'purchase', path: '/purchase', method: 'POST' }],
138
- * skills: ['product-purchase', 'regulated-commerce'],
139
- * },
140
- * data,
141
- * });
142
- * const signed = await yourSign(card);
143
- * return c.json(signed);
195
+ * import { buildA2AAgentCard, ucpA2AExtension } from '@agent-score/commerce';
196
+ *
197
+ * const card = buildA2AAgentCard({
198
+ * name: 'Example Merchant Concierge',
199
+ * description: 'Buy regulated goods via agent payments.',
200
+ * url: 'https://agents.example.com',
201
+ * version: '1.0.0',
202
+ * skills: [
203
+ * { id: 'purchase', name: 'Purchase', description: 'Buy products via agent payments.', tags: ['commerce', 'payment'] },
204
+ * ],
205
+ * extensions: [ucpA2AExtension()],
144
206
  * });
207
+ * const signed = await yourJWSSign(card);
145
208
  * ```
146
209
  */
147
210
  declare function buildA2AAgentCard(input: BuildA2AAgentCardInput): A2AAgentCard;
148
211
 
212
+ /**
213
+ * Construct a UCPSigningKey from a public JWK dict (e.g. the `publicJWK` returned by
214
+ * `generateUCPSigningKey()`). Validates required fields and rejects symmetric keys that
215
+ * can't publicly verify a JWS in trust-mode UCP. Mirrors python's
216
+ * `UCPSigningKey.from_jwk(public_jwk)` classmethod via the `UCPSigningKey.fromJWK`
217
+ * static-method-style namespace export below.
218
+ */
219
+ declare function ucpSigningKeyFromJWKImpl(jwk: Record<string, unknown>): UCPSigningKey;
149
220
  /**
150
221
  * UCP (Universal Commerce Protocol) profile builder.
151
222
  *
@@ -165,7 +236,6 @@ declare function buildA2AAgentCard(input: BuildA2AAgentCardInput): A2AAgentCard;
165
236
  *
166
237
  * Spec reference: https://ucp.dev/
167
238
  */
168
-
169
239
  /**
170
240
  * UCP per-element shape note: each binding interface (`UCPServiceBinding`,
171
241
  * `UCPCapabilityBinding`, `UCPPaymentHandlerBinding`) carries the canonical UCP fields
@@ -187,13 +257,11 @@ interface UCPSigningKey {
187
257
  /** JWK x / y / n / e / etc. The full key material; passed through verbatim. */
188
258
  [k: string]: unknown;
189
259
  }
190
- /**
191
- * Construct a UCPSigningKey from a public JWK dict (e.g. the `publicJWK` returned by
192
- * `generateUCPSigningKey()`). Validates required fields and rejects symmetric keys that
193
- * can't publicly verify a JWS in trust-mode UCP. Symmetric to Python's
194
- * `UCPSigningKey.from_jwk(public_jwk)` classmethod.
195
- */
196
- declare function ucpSigningKeyFromJWK(jwk: Record<string, unknown>): UCPSigningKey;
260
+ /** Static-method-style namespace on the `UCPSigningKey` interface — mirrors python's
261
+ * `UCPSigningKey.from_jwk(jwk)` classmethod. Use as `UCPSigningKey.fromJWK(jwk)`. */
262
+ declare const UCPSigningKey: {
263
+ fromJWK: typeof ucpSigningKeyFromJWKImpl;
264
+ };
197
265
  /** Transport binding — keyed under a service name (e.g., `dev.ucp.shopping`). */
198
266
  interface UCPServiceBinding {
199
267
  /** Spec version, YYYY-MM-DD per UCP convention. REQUIRED. */
@@ -238,7 +306,8 @@ interface UCPCapabilityBinding {
238
306
  max?: string;
239
307
  }>;
240
308
  };
241
- /** Vendor-specific extras (e.g., AgentScore claims block on `sh.agentscore.identity`). */
309
+ /** Vendor-specific extras allowed per UCP convention (e.g., the AgentScore identity
310
+ * capability adds a vendor-namespaced policy declaration here). */
242
311
  [k: string]: unknown;
243
312
  }
244
313
  /** Payment handler binding — keyed under a handler reverse-DNS name (e.g., `com.google.pay`). */
@@ -305,15 +374,18 @@ interface BuildUCPProfileInput {
305
374
  * bindings under `'dev.ucp.shopping'`. */
306
375
  services?: Record<string, UCPServiceBinding[]>;
307
376
  /** Capabilities map, keyed by capability name. The `sh.agentscore.identity` capability
308
- * is auto-added when `data` is provided. */
377
+ * is auto-added when `agentscore_gate` is provided. */
309
378
  capabilities?: Record<string, UCPCapabilityBinding[]>;
310
379
  /** Payment handlers map, keyed by handler reverse-DNS name. */
311
380
  payment_handlers?: Record<string, UCPPaymentHandlerBinding[]>;
312
381
  /** JWKS — public keys the merchant signs with. REQUIRED by spec. */
313
382
  signing_keys: UCPSigningKey[];
314
- /** AgentScore assess data adds an `sh.agentscore.identity` capability + claims
315
- * block when present. */
316
- data?: AgentScoreData | null;
383
+ /** Merchant gate policy declaration. When provided, the SDK auto-injects an
384
+ * `sh.agentscore.identity` capability binding into `capabilities`, with the
385
+ * policy as the binding's `config`. Static merchant declaration only — no
386
+ * per-operator data ever ends up on the public profile. Per-operator identity
387
+ * attestation lives on the AP2 risk-signal endpoint, not here. */
388
+ agentscore_gate?: AgentScoreGatePolicy;
317
389
  /** Optional override for the AgentScore capability schema URL. Field is snake_cased
318
390
  * for cross-language parity with the Python sibling. */
319
391
  agentscore_schema_url?: string;
@@ -327,6 +399,24 @@ interface BuildUCPProfileInput {
327
399
  /** Vendor-specific extras INSIDE the `ucp` envelope (alongside `version`, `services`, etc.). */
328
400
  ucp_extras?: Record<string, unknown>;
329
401
  }
402
+ /** Merchant gate policy declared on the UCP profile via `sh.agentscore.identity` capability config.
403
+ * All fields optional; merchant declares which AgentScore checks the gate enforces. Snake-case
404
+ * field names match the AgentScore API's `/v1/assess` policy contract verbatim — no conversion
405
+ * layer between this declaration and what the gate actually enforces at runtime. */
406
+ interface AgentScoreGatePolicy {
407
+ /** Gate denies if the operator/account behind the agent is not Stripe-Identity-verified. */
408
+ require_kyc?: boolean;
409
+ /** Gate denies if the operator/account is flagged by OpenSanctions screening. */
410
+ require_sanctions_clear?: boolean;
411
+ /** Gate denies if the verified age (from KYC) is below this threshold. Common values: 18, 21. */
412
+ min_age?: number;
413
+ /** ISO-3166-1 alpha-2 country codes the gate accepts. Empty/absent allows any. Mutually exclusive
414
+ * with `blocked_jurisdictions` (set one or the other, not both). */
415
+ allowed_jurisdictions?: string[];
416
+ /** ISO-3166-1 alpha-2 country codes the gate denies. Empty/absent denies none. Mutually exclusive
417
+ * with `allowed_jurisdictions`. */
418
+ blocked_jurisdictions?: string[];
419
+ }
330
420
  /**
331
421
  * Compose a UCP profile body for `/.well-known/ucp` publication. Returns the spec-
332
422
  * compliant shape: `{ ucp: { version, services, capabilities, payment_handlers, ... },
@@ -334,9 +424,12 @@ interface BuildUCPProfileInput {
334
424
  * trust-mode verifiers.
335
425
  *
336
426
  * Auto-injects `sh.agentscore.identity` as a vendor capability extending both
337
- * `dev.ucp.shopping.checkout` and `dev.ucp.shopping.cart` when `data` carries a
338
- * resolved operator. Verifiers that recognize the AgentScore namespace can parse
339
- * the `claims` block; vanilla UCP agents see a normal extension capability.
427
+ * `dev.ucp.shopping.checkout` and `dev.ucp.shopping.cart` when `agentscore_gate`
428
+ * is provided. The capability's `config` carries the merchant's static gate
429
+ * policy declaration (require_kyc / require_sanctions_clear / min_age /
430
+ * allowed_jurisdictions / blocked_jurisdictions). NO per-operator data is ever
431
+ * placed on the public profile — per-operator identity attestation flows through
432
+ * the AP2 risk-signal endpoint, not here.
340
433
  *
341
434
  * Example:
342
435
  * ```ts
@@ -348,24 +441,87 @@ interface BuildUCPProfileInput {
348
441
  * 'dev.ucp.shopping': [
349
442
  * { version: '2026-04-08', spec: 'https://ucp.dev/2026-04-08/specification/overview',
350
443
  * transport: 'mcp', endpoint: 'https://merchant.example/api/ucp/mcp',
351
- * schema: 'https://ucp.dev/services/shopping/openrpc.json' },
444
+ * schema: 'https://ucp.dev/services/shopping/mcp.openrpc.json' },
352
445
  * ],
353
446
  * },
354
447
  * payment_handlers: {
355
- * 'sh.agentscore.payment.tempo': [{
356
- * id: 'tempo',
357
- * version: '2026-04-08',
358
- * spec: 'https://agentscore.sh/specification/payment-handlers/tempo',
359
- * schema: 'https://agentscore.sh/schemas/payment-handlers/tempo.json',
360
- * config: { recipient: TEMPO_ADDR },
361
- * }],
448
+ * ...mppPaymentHandler({ networks: [{ network: 'tempo-mainnet', chain_id: 4217, recipient: TEMPO_ADDR }] }),
362
449
  * },
363
450
  * signing_keys: [signingKey],
451
+ * agentscore_gate: { require_kyc: true, min_age: 21, allowed_jurisdictions: ['US'] },
364
452
  * });
365
453
  * ```
366
454
  */
367
455
  declare function buildUCPProfile(input: BuildUCPProfileInput): UCPProfile;
368
456
  declare const AGENTSCORE_UCP_CAPABILITY = "sh.agentscore.identity";
457
+ type MppNetwork = 'tempo-mainnet' | 'tempo-testnet' | 'mpp-solana-mainnet' | 'mpp-solana-devnet' | (string & {});
458
+ interface MppNetworkEntry {
459
+ network: MppNetwork;
460
+ /** EVM-style chain id (e.g. 4217 for Tempo mainnet). Omit for non-EVM networks. */
461
+ chain_id?: number;
462
+ /** Static settlement address. Omit for per-order recipients (e.g. Stripe-derived deposits). */
463
+ recipient?: string;
464
+ [k: string]: unknown;
465
+ }
466
+ interface MppPaymentHandlerInput {
467
+ networks: MppNetworkEntry[];
468
+ }
469
+ type X402Network = `base-${number}` | 'solana-mainnet-beta' | 'solana-devnet' | 'stellar-pubnet' | 'stellar-testnet' | (string & {});
470
+ interface X402NetworkEntry {
471
+ network: X402Network;
472
+ /** Static settlement address. Omit for per-order recipients. */
473
+ recipient?: string;
474
+ [k: string]: unknown;
475
+ }
476
+ interface X402PaymentHandlerInput {
477
+ networks: X402NetworkEntry[];
478
+ }
479
+ interface StripeSptPaymentHandlerInput {
480
+ /** Stripe profile id (the merchant-side network identifier the agent's SPT is scoped to). */
481
+ profile_id: string;
482
+ }
483
+ /**
484
+ * Build the `sh.agentscore.payment.mpp` payment handler block for a UCP profile.
485
+ *
486
+ * @example
487
+ * ```ts
488
+ * buildUCPProfile({
489
+ * ...,
490
+ * payment_handlers: {
491
+ * ...mppPaymentHandler({ networks: [{ network: 'tempo-mainnet', chain_id: 4217 }] }),
492
+ * },
493
+ * });
494
+ * ```
495
+ */
496
+ declare function mppPaymentHandler(input: MppPaymentHandlerInput): Record<string, UCPPaymentHandlerBinding[]>;
497
+ /**
498
+ * Build the `sh.agentscore.payment.x402` payment handler block for a UCP profile.
499
+ *
500
+ * @example
501
+ * ```ts
502
+ * buildUCPProfile({
503
+ * ...,
504
+ * payment_handlers: {
505
+ * ...x402PaymentHandler({ networks: [{ network: 'base-8453', recipient: '0xabc...' }] }),
506
+ * },
507
+ * });
508
+ * ```
509
+ */
510
+ declare function x402PaymentHandler(input: X402PaymentHandlerInput): Record<string, UCPPaymentHandlerBinding[]>;
511
+ /**
512
+ * Build the `sh.agentscore.payment.stripe_spt` payment handler block for a UCP profile.
513
+ *
514
+ * @example
515
+ * ```ts
516
+ * buildUCPProfile({
517
+ * ...,
518
+ * payment_handlers: {
519
+ * ...stripeSptPaymentHandler({ profile_id: 'profile_5xKvNqM9BaH' }),
520
+ * },
521
+ * });
522
+ * ```
523
+ */
524
+ declare function stripeSptPaymentHandler(input: StripeSptPaymentHandlerInput): Record<string, UCPPaymentHandlerBinding[]>;
369
525
 
370
526
  /**
371
527
  * UCP profile signing helpers (JWKS + JWS).
@@ -498,4 +654,4 @@ declare function verifyUCPProfile(profile: SignedUCPProfile, jwks: JWKSResponse)
498
654
  */
499
655
  declare function buildJWKSResponse(keys: UCPSigningKey[]): JWKSResponse;
500
656
 
501
- export { type A2AAgentCard, type A2AAgentCardCapabilities, type A2AAgentCardExtension, type A2AAgentCardIdentity, AGENTSCORE_UCP_CAPABILITY, AgentScoreData, type BuildA2AAgentCardInput, type BuildUCPProfileInput, type GeneratedUCPKey, type JWKSResponse, type SignUCPProfileOptions, type SignedUCPProfile, type UCPCapabilityBinding, type UCPPaymentHandlerBinding, type UCPProfile, type UCPProfileBody, type UCPServiceBinding, type UCPSigningKey, UCPVerificationError, UCP_A2A_EXTENSION_URI, buildA2AAgentCard, buildJWKSResponse, buildUCPProfile, generateUCPSigningKey, signUCPProfile, ucpA2AExtension, ucpSigningKeyFromJWK, verifyUCPProfile };
657
+ export { type A2AAgentCard, type A2AAgentCardCapabilities, type A2AAgentCardExtension, type A2AAgentCardSignature, type A2AAgentInterface, type A2AAgentProvider, type A2AAgentSkill, AGENTSCORE_UCP_CAPABILITY, type AgentScoreGatePolicy, type BuildA2AAgentCardInput, type BuildUCPProfileInput, type GeneratedUCPKey, type JWKSResponse, type MppNetworkEntry, type MppPaymentHandlerInput, type SignUCPProfileOptions, type SignedUCPProfile, type StripeSptPaymentHandlerInput, type UCPCapabilityBinding, type UCPPaymentHandlerBinding, type UCPProfile, type UCPProfileBody, type UCPServiceBinding, UCPSigningKey, UCPVerificationError, UCP_A2A_EXTENSION_URI, type X402NetworkEntry, type X402PaymentHandlerInput, buildA2AAgentCard, buildJWKSResponse, buildUCPProfile, generateUCPSigningKey, mppPaymentHandler, signUCPProfile, stripeSptPaymentHandler, ucpA2AExtension, verifyUCPProfile, x402PaymentHandler };