@agent-score/commerce 2.4.0 → 2.6.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.
- package/README.md +19 -17
- package/dist/challenge/index.d.mts +31 -3
- package/dist/challenge/index.d.ts +31 -3
- package/dist/challenge/index.js +25 -9
- package/dist/challenge/index.js.map +1 -1
- package/dist/challenge/index.mjs +25 -9
- package/dist/challenge/index.mjs.map +1 -1
- package/dist/{checkout-B-MIzYzW.d.ts → checkout-C4RD7M0Z.d.ts} +117 -13
- package/dist/{checkout-Bn7ZKIBD.d.mts → checkout-CzB9f_jf.d.mts} +117 -13
- package/dist/core.d.mts +40 -7
- package/dist/core.d.ts +40 -7
- package/dist/core.js +52 -27
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +52 -27
- package/dist/core.mjs.map +1 -1
- package/dist/discovery/index.d.mts +33 -3
- package/dist/discovery/index.d.ts +33 -3
- package/dist/discovery/index.js +50 -16
- package/dist/discovery/index.js.map +1 -1
- package/dist/discovery/index.mjs +49 -16
- package/dist/discovery/index.mjs.map +1 -1
- package/dist/gate-D2RP6bZg.d.ts +307 -0
- package/dist/gate-GCXy4FHI.d.mts +307 -0
- package/dist/identity/express.d.mts +28 -1
- package/dist/identity/express.d.ts +28 -1
- package/dist/identity/express.js +714 -31
- package/dist/identity/express.js.map +1 -1
- package/dist/identity/express.mjs +710 -30
- package/dist/identity/express.mjs.map +1 -1
- package/dist/identity/fastify.d.mts +14 -2
- package/dist/identity/fastify.d.ts +14 -2
- package/dist/identity/fastify.js +727 -31
- package/dist/identity/fastify.js.map +1 -1
- package/dist/identity/fastify.mjs +723 -30
- package/dist/identity/fastify.mjs.map +1 -1
- package/dist/identity/hono.d.mts +28 -1
- package/dist/identity/hono.d.ts +28 -1
- package/dist/identity/hono.js +696 -33
- package/dist/identity/hono.js.map +1 -1
- package/dist/identity/hono.mjs +692 -32
- package/dist/identity/hono.mjs.map +1 -1
- package/dist/identity/nextjs.d.mts +5 -0
- package/dist/identity/nextjs.d.ts +5 -0
- package/dist/identity/nextjs.js +695 -30
- package/dist/identity/nextjs.js.map +1 -1
- package/dist/identity/nextjs.mjs +691 -29
- 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 +26 -1
- package/dist/identity/web.d.ts +26 -1
- package/dist/identity/web.js +695 -30
- package/dist/identity/web.js.map +1 -1
- package/dist/identity/web.mjs +691 -29
- package/dist/identity/web.mjs.map +1 -1
- package/dist/index.d.mts +165 -4
- package/dist/index.d.ts +165 -4
- package/dist/index.js +3103 -534
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3086 -545
- 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 +1614 -266
- package/dist/stripe-multichain/index.js.map +1 -1
- package/dist/stripe-multichain/index.mjs +1614 -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 +26 -21
|
@@ -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;
|
|
@@ -569,9 +570,73 @@ interface CheckoutGateConfig {
|
|
|
569
570
|
* DenialReason. Return a `GateDenial` to override the canonical body, or
|
|
570
571
|
* null to use `denialReasonToBody`. */
|
|
571
572
|
onDenied?: (ctx: CheckoutContext, reason: DenialReason) => GateDenial | null | Promise<GateDenial | null>;
|
|
573
|
+
/** Accept AIP Agent Identity Tokens (AITs) on this route. When set and a request carries
|
|
574
|
+
* an `Agent-Identity` header, the gate verifies the token offline (issuer signature via the
|
|
575
|
+
* trusted-issuer JWKS + RFC 9421 proof-of-possession) BEFORE the assess call, then sends the
|
|
576
|
+
* raw token to `/v1/assess` as `aip_token` so the same wine/age/sanctions policy evaluates
|
|
577
|
+
* against the token's attested identity. A present-but-invalid AIT is a hard deny (the gate
|
|
578
|
+
* does NOT fall through to wallet / operator-token). Requests with no `Agent-Identity` header
|
|
579
|
+
* use the existing wallet / operator-token path unchanged.
|
|
580
|
+
*
|
|
581
|
+
* Ignored when `runGate` is also set (a custom gate fully owns the flow). Without an `apiKey`,
|
|
582
|
+
* a verified AIT is honored offline for identity-only gates, but a gate that declares policy
|
|
583
|
+
* fields (KYC / age / sanctions / jurisdiction) without an `apiKey` fails closed
|
|
584
|
+
* (`aip_policy_requires_api_key`) since policy can only be evaluated via `/v1/assess`. */
|
|
585
|
+
aip?: AipGateConfig;
|
|
572
586
|
/** Full escape hatch — replaces the SDK gate flow. */
|
|
573
587
|
runGate?: RunGateFn;
|
|
574
588
|
}
|
|
589
|
+
/** AIP acceptance config for {@link CheckoutGateConfig.aip}. */
|
|
590
|
+
interface AipGateConfig {
|
|
591
|
+
/** ADDITIONAL external issuers to trust beyond AgentScore's own (e.g. `['https://issuer.example']`),
|
|
592
|
+
* matched after canonicalization. AgentScore's canonical issuer
|
|
593
|
+
* ({@link AGENTSCORE_CANONICAL_ISSUER}) is ALWAYS trusted and never needs listing — this SDK
|
|
594
|
+
* is the AgentScore verifier, so a merchant can't accidentally fail to trust AgentScore AITs.
|
|
595
|
+
* Omit/empty to accept only AgentScore-issued AITs. */
|
|
596
|
+
trustedIssuers?: string[];
|
|
597
|
+
/** Clock-skew tolerance in seconds for the RFC 9421 signature window (and, as an override,
|
|
598
|
+
* the AIT JWT `exp`/`iat`). Defaults to 60s for both. */
|
|
599
|
+
maxSkewSeconds?: number;
|
|
600
|
+
/** Expected `@authority` (public hostname) the RFC 9421 signature must cover. When set, the
|
|
601
|
+
* verifier binds the signature to this value instead of trusting the inbound `Host` header —
|
|
602
|
+
* pin it to your real public host (e.g. `'wine.example.com'`) when behind a proxy that does
|
|
603
|
+
* not normalize `Host`, to prevent a captured AIT+signature from being replayed to a
|
|
604
|
+
* different virtual host on the same origin. */
|
|
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[];
|
|
615
|
+
/** Per-issuer compliance policy override, keyed by issuer URL (canonicalized before lookup).
|
|
616
|
+
* When a request's AIT is verified and its `iss` matches a key here, that block REPLACES the
|
|
617
|
+
* gate's default policy fields (`requireKyc` / `requireSanctionsClear` / `minAge` /
|
|
618
|
+
* `allowed/blockedJurisdictions`) for that request — letting a merchant apply different rules
|
|
619
|
+
* by issuer (e.g. full compliance for its own AITs, a relaxed set for a partner issuer whose
|
|
620
|
+
* tokens carry fewer attested claims). The replacement is whole-policy, not a merge: an issuer
|
|
621
|
+
* block of `{ requireKyc: true, minAge: 21 }` evaluates ONLY those two rules for that issuer
|
|
622
|
+
* (sanctions / jurisdiction omitted → not enforced for that issuer). Issuers NOT listed here
|
|
623
|
+
* use the gate's default policy unchanged. Only the AIT path consults this — wallet /
|
|
624
|
+
* operator-token requests are unaffected.
|
|
625
|
+
*
|
|
626
|
+
* This is a deliberate compliance posture per issuer, not a default; an empty/absent map keeps
|
|
627
|
+
* every issuer on the gate's default policy. */
|
|
628
|
+
issuerPolicies?: Record<string, AipIssuerPolicy>;
|
|
629
|
+
}
|
|
630
|
+
/** A per-issuer compliance policy block for {@link AipGateConfig.issuerPolicies}. The same
|
|
631
|
+
* compliance fields as the gate, applied (as a whole-policy replacement) only to AITs from the
|
|
632
|
+
* matching issuer. */
|
|
633
|
+
interface AipIssuerPolicy {
|
|
634
|
+
requireKyc?: boolean;
|
|
635
|
+
requireSanctionsClear?: boolean;
|
|
636
|
+
minAge?: number;
|
|
637
|
+
blockedJurisdictions?: string[];
|
|
638
|
+
allowedJurisdictions?: string[];
|
|
639
|
+
}
|
|
575
640
|
/** Surface passed to `Checkout.onSettled` after a payment lands. */
|
|
576
641
|
interface SettleOutcome {
|
|
577
642
|
/** Protocol family that handled the settle. */
|
|
@@ -663,6 +728,18 @@ type IsCachedAddressFn = (address: string) => boolean | Promise<boolean>;
|
|
|
663
728
|
declare function makeMppxComposeHook(opts: {
|
|
664
729
|
serverGetter: () => Promise<unknown>;
|
|
665
730
|
}): ComposeMppxFn;
|
|
731
|
+
/** Resolve a per-issuer compliance-policy override for a verified AIT's issuer. Both the verified
|
|
732
|
+
* `iss` and the map keys are canonicalized (lowercase scheme+host, no default port / trailing
|
|
733
|
+
* slash) before comparison so `https://issuer.example` and `https://issuer.example/` resolve the same.
|
|
734
|
+
* Returns the matching policy block, or undefined when the issuer is not overridden (→ caller
|
|
735
|
+
* falls back to the gate's default policy). */
|
|
736
|
+
/** The effective AIP trusted-issuer list: AgentScore's canonical issuer (ALWAYS trusted) plus any
|
|
737
|
+
* external issuers. De-duped after canonicalization. Use this for the `agent_memory` hint and any
|
|
738
|
+
* presentation surface (llms.txt / mpp.json / skill.md) that advertises AIP acceptance, so a
|
|
739
|
+
* merchant relying solely on AgentScore AITs (no external issuers) still advertises the
|
|
740
|
+
* `agent_identity` path. Trust enforcement itself lives in {@link JwksCache}, which merges the
|
|
741
|
+
* canonical issuer independently. */
|
|
742
|
+
declare function buildAipTrustedIssuers(externalIssuers?: string[]): string[];
|
|
666
743
|
/**
|
|
667
744
|
* Framework-neutral 4xx envelope (`{ error, next_steps, agent_instructions }`).
|
|
668
745
|
*
|
|
@@ -733,11 +810,25 @@ declare class Checkout {
|
|
|
733
810
|
readonly mintReferenceId: ReferenceIdFn | undefined;
|
|
734
811
|
readonly onSettled: OnSettledFn | undefined;
|
|
735
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;
|
|
736
817
|
readonly zeroSettleCarveOut: boolean;
|
|
737
818
|
readonly gate: CheckoutGateConfig | undefined;
|
|
738
819
|
readonly discoveryExtensions: Record<string, unknown> | undefined;
|
|
820
|
+
readonly resourceInfo: {
|
|
821
|
+
serviceName?: string;
|
|
822
|
+
tags?: string[];
|
|
823
|
+
iconUrl?: string;
|
|
824
|
+
description?: string;
|
|
825
|
+
} | undefined;
|
|
739
826
|
readonly discoveryProbe: DiscoveryProbeConfig | undefined;
|
|
740
827
|
private _x402ServerGetter;
|
|
828
|
+
/** Lazily-built JWKS cache for AIP verification, shared across requests so issuer keys
|
|
829
|
+
* are fetched once and cached (per the verifier's hard 24h cap). Built on first AIT. */
|
|
830
|
+
private aipJwks;
|
|
831
|
+
private getAipJwks;
|
|
741
832
|
/**
|
|
742
833
|
* True when the merchant has configured an identity-bearing policy flag —
|
|
743
834
|
* `require_kyc`, `require_sanctions_clear` (name screening on the KYC
|
|
@@ -782,7 +873,10 @@ declare class Checkout {
|
|
|
782
873
|
/** Runs after a settle lands; can return an inline response body for API sellers. */
|
|
783
874
|
onSettled?: OnSettledFn;
|
|
784
875
|
/** Pass when the merchant mints per-order addresses so `verifyX402Request` can
|
|
785
|
-
* 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). */
|
|
786
880
|
isCachedAddress?: IsCachedAddressFn;
|
|
787
881
|
/** Engage the EIP-3009 value=0 + pympp `proof` carve-out when pricing
|
|
788
882
|
* resolves to $0. Goods merchants offering free redemption codes set this
|
|
@@ -798,6 +892,16 @@ declare class Checkout {
|
|
|
798
892
|
* `extensions` field so Bazaar crawlers and other spec-compliant clients
|
|
799
893
|
* read the route's declared input/output schema. */
|
|
800
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
|
+
};
|
|
801
905
|
/** Optional discovery-probe config: auto-route empty-body POSTs without a
|
|
802
906
|
* payment header to a sample 402 advertising the merchant's shape for
|
|
803
907
|
* crawlers (`awal x402 details`, x402-proxy, x402scan, ...). */
|
|
@@ -844,7 +948,7 @@ declare class Checkout {
|
|
|
844
948
|
* - `AGENTSCORE_API_KEY` — required. No key → one-time warning + skip
|
|
845
949
|
* (dev/testnet pattern; production should always configure a key).
|
|
846
950
|
* - `AGENTSCORE_BASE_URL` — optional override for staging/dev API
|
|
847
|
-
* (e.g. `https://api
|
|
951
|
+
* (e.g. `https://api.staging.example` or `http://localhost:3002`).
|
|
848
952
|
*
|
|
849
953
|
* Stripe SPT (no extractable wallet signer) → skip silently; Stripe runs
|
|
850
954
|
* its own OFAC screen on the buyer's Stripe account at customer creation.
|
|
@@ -955,4 +1059,4 @@ interface MountUcpRoutesOptions {
|
|
|
955
1059
|
jwksPath?: string;
|
|
956
1060
|
}
|
|
957
1061
|
|
|
958
|
-
export { AGENTSCORE_UCP_CAPABILITY as A,
|
|
1062
|
+
export { AGENTSCORE_UCP_CAPABILITY as A, validationResponseFastify as B, Checkout as C, type DiscoveryProbeConfig as D, validationResponseHono as E, validationResponseNextjs as F, type GateDenial as G, validationResponseWeb as H, type IsCachedAddressFn as I, x402PaymentHandler as J, type MountUcpRoutesOptions as M, type OnSettledFn as O, type PreValidateFn as P, type RecipientsFn as R, type SettleOutcome as S, type UCPCapabilityBinding as U, type AgentScoreGatePolicy as a, type CheckoutContext as b, type CheckoutGateConfig as c, type CheckoutRailSpec as d, type CheckoutRequest as e, type CheckoutResult as f, type ComposeMppxFn as g, type MppxComposeOutcome as h, type PricingFn as i, type PricingResult as j, type ReferenceIdFn as k, type RunGateFn as l, type UCPPaymentHandlerBinding as m, type UCPProfile as n, type UCPProfileBody as o, type UCPServiceBinding as p, UCPSigningKey as q, buildAipTrustedIssuers as r, buildUCPProfile as s, getIdentityStatus as t, makeMppxComposeHook as u, mppPaymentHandler as v, pricingResult as w, stripeSptPaymentHandler as x, validationEnvelope as y, validationResponseExpress as z };
|
|
@@ -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;
|
|
@@ -569,9 +570,73 @@ interface CheckoutGateConfig {
|
|
|
569
570
|
* DenialReason. Return a `GateDenial` to override the canonical body, or
|
|
570
571
|
* null to use `denialReasonToBody`. */
|
|
571
572
|
onDenied?: (ctx: CheckoutContext, reason: DenialReason) => GateDenial | null | Promise<GateDenial | null>;
|
|
573
|
+
/** Accept AIP Agent Identity Tokens (AITs) on this route. When set and a request carries
|
|
574
|
+
* an `Agent-Identity` header, the gate verifies the token offline (issuer signature via the
|
|
575
|
+
* trusted-issuer JWKS + RFC 9421 proof-of-possession) BEFORE the assess call, then sends the
|
|
576
|
+
* raw token to `/v1/assess` as `aip_token` so the same wine/age/sanctions policy evaluates
|
|
577
|
+
* against the token's attested identity. A present-but-invalid AIT is a hard deny (the gate
|
|
578
|
+
* does NOT fall through to wallet / operator-token). Requests with no `Agent-Identity` header
|
|
579
|
+
* use the existing wallet / operator-token path unchanged.
|
|
580
|
+
*
|
|
581
|
+
* Ignored when `runGate` is also set (a custom gate fully owns the flow). Without an `apiKey`,
|
|
582
|
+
* a verified AIT is honored offline for identity-only gates, but a gate that declares policy
|
|
583
|
+
* fields (KYC / age / sanctions / jurisdiction) without an `apiKey` fails closed
|
|
584
|
+
* (`aip_policy_requires_api_key`) since policy can only be evaluated via `/v1/assess`. */
|
|
585
|
+
aip?: AipGateConfig;
|
|
572
586
|
/** Full escape hatch — replaces the SDK gate flow. */
|
|
573
587
|
runGate?: RunGateFn;
|
|
574
588
|
}
|
|
589
|
+
/** AIP acceptance config for {@link CheckoutGateConfig.aip}. */
|
|
590
|
+
interface AipGateConfig {
|
|
591
|
+
/** ADDITIONAL external issuers to trust beyond AgentScore's own (e.g. `['https://issuer.example']`),
|
|
592
|
+
* matched after canonicalization. AgentScore's canonical issuer
|
|
593
|
+
* ({@link AGENTSCORE_CANONICAL_ISSUER}) is ALWAYS trusted and never needs listing — this SDK
|
|
594
|
+
* is the AgentScore verifier, so a merchant can't accidentally fail to trust AgentScore AITs.
|
|
595
|
+
* Omit/empty to accept only AgentScore-issued AITs. */
|
|
596
|
+
trustedIssuers?: string[];
|
|
597
|
+
/** Clock-skew tolerance in seconds for the RFC 9421 signature window (and, as an override,
|
|
598
|
+
* the AIT JWT `exp`/`iat`). Defaults to 60s for both. */
|
|
599
|
+
maxSkewSeconds?: number;
|
|
600
|
+
/** Expected `@authority` (public hostname) the RFC 9421 signature must cover. When set, the
|
|
601
|
+
* verifier binds the signature to this value instead of trusting the inbound `Host` header —
|
|
602
|
+
* pin it to your real public host (e.g. `'wine.example.com'`) when behind a proxy that does
|
|
603
|
+
* not normalize `Host`, to prevent a captured AIT+signature from being replayed to a
|
|
604
|
+
* different virtual host on the same origin. */
|
|
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[];
|
|
615
|
+
/** Per-issuer compliance policy override, keyed by issuer URL (canonicalized before lookup).
|
|
616
|
+
* When a request's AIT is verified and its `iss` matches a key here, that block REPLACES the
|
|
617
|
+
* gate's default policy fields (`requireKyc` / `requireSanctionsClear` / `minAge` /
|
|
618
|
+
* `allowed/blockedJurisdictions`) for that request — letting a merchant apply different rules
|
|
619
|
+
* by issuer (e.g. full compliance for its own AITs, a relaxed set for a partner issuer whose
|
|
620
|
+
* tokens carry fewer attested claims). The replacement is whole-policy, not a merge: an issuer
|
|
621
|
+
* block of `{ requireKyc: true, minAge: 21 }` evaluates ONLY those two rules for that issuer
|
|
622
|
+
* (sanctions / jurisdiction omitted → not enforced for that issuer). Issuers NOT listed here
|
|
623
|
+
* use the gate's default policy unchanged. Only the AIT path consults this — wallet /
|
|
624
|
+
* operator-token requests are unaffected.
|
|
625
|
+
*
|
|
626
|
+
* This is a deliberate compliance posture per issuer, not a default; an empty/absent map keeps
|
|
627
|
+
* every issuer on the gate's default policy. */
|
|
628
|
+
issuerPolicies?: Record<string, AipIssuerPolicy>;
|
|
629
|
+
}
|
|
630
|
+
/** A per-issuer compliance policy block for {@link AipGateConfig.issuerPolicies}. The same
|
|
631
|
+
* compliance fields as the gate, applied (as a whole-policy replacement) only to AITs from the
|
|
632
|
+
* matching issuer. */
|
|
633
|
+
interface AipIssuerPolicy {
|
|
634
|
+
requireKyc?: boolean;
|
|
635
|
+
requireSanctionsClear?: boolean;
|
|
636
|
+
minAge?: number;
|
|
637
|
+
blockedJurisdictions?: string[];
|
|
638
|
+
allowedJurisdictions?: string[];
|
|
639
|
+
}
|
|
575
640
|
/** Surface passed to `Checkout.onSettled` after a payment lands. */
|
|
576
641
|
interface SettleOutcome {
|
|
577
642
|
/** Protocol family that handled the settle. */
|
|
@@ -663,6 +728,18 @@ type IsCachedAddressFn = (address: string) => boolean | Promise<boolean>;
|
|
|
663
728
|
declare function makeMppxComposeHook(opts: {
|
|
664
729
|
serverGetter: () => Promise<unknown>;
|
|
665
730
|
}): ComposeMppxFn;
|
|
731
|
+
/** Resolve a per-issuer compliance-policy override for a verified AIT's issuer. Both the verified
|
|
732
|
+
* `iss` and the map keys are canonicalized (lowercase scheme+host, no default port / trailing
|
|
733
|
+
* slash) before comparison so `https://issuer.example` and `https://issuer.example/` resolve the same.
|
|
734
|
+
* Returns the matching policy block, or undefined when the issuer is not overridden (→ caller
|
|
735
|
+
* falls back to the gate's default policy). */
|
|
736
|
+
/** The effective AIP trusted-issuer list: AgentScore's canonical issuer (ALWAYS trusted) plus any
|
|
737
|
+
* external issuers. De-duped after canonicalization. Use this for the `agent_memory` hint and any
|
|
738
|
+
* presentation surface (llms.txt / mpp.json / skill.md) that advertises AIP acceptance, so a
|
|
739
|
+
* merchant relying solely on AgentScore AITs (no external issuers) still advertises the
|
|
740
|
+
* `agent_identity` path. Trust enforcement itself lives in {@link JwksCache}, which merges the
|
|
741
|
+
* canonical issuer independently. */
|
|
742
|
+
declare function buildAipTrustedIssuers(externalIssuers?: string[]): string[];
|
|
666
743
|
/**
|
|
667
744
|
* Framework-neutral 4xx envelope (`{ error, next_steps, agent_instructions }`).
|
|
668
745
|
*
|
|
@@ -733,11 +810,25 @@ declare class Checkout {
|
|
|
733
810
|
readonly mintReferenceId: ReferenceIdFn | undefined;
|
|
734
811
|
readonly onSettled: OnSettledFn | undefined;
|
|
735
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;
|
|
736
817
|
readonly zeroSettleCarveOut: boolean;
|
|
737
818
|
readonly gate: CheckoutGateConfig | undefined;
|
|
738
819
|
readonly discoveryExtensions: Record<string, unknown> | undefined;
|
|
820
|
+
readonly resourceInfo: {
|
|
821
|
+
serviceName?: string;
|
|
822
|
+
tags?: string[];
|
|
823
|
+
iconUrl?: string;
|
|
824
|
+
description?: string;
|
|
825
|
+
} | undefined;
|
|
739
826
|
readonly discoveryProbe: DiscoveryProbeConfig | undefined;
|
|
740
827
|
private _x402ServerGetter;
|
|
828
|
+
/** Lazily-built JWKS cache for AIP verification, shared across requests so issuer keys
|
|
829
|
+
* are fetched once and cached (per the verifier's hard 24h cap). Built on first AIT. */
|
|
830
|
+
private aipJwks;
|
|
831
|
+
private getAipJwks;
|
|
741
832
|
/**
|
|
742
833
|
* True when the merchant has configured an identity-bearing policy flag —
|
|
743
834
|
* `require_kyc`, `require_sanctions_clear` (name screening on the KYC
|
|
@@ -782,7 +873,10 @@ declare class Checkout {
|
|
|
782
873
|
/** Runs after a settle lands; can return an inline response body for API sellers. */
|
|
783
874
|
onSettled?: OnSettledFn;
|
|
784
875
|
/** Pass when the merchant mints per-order addresses so `verifyX402Request` can
|
|
785
|
-
* 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). */
|
|
786
880
|
isCachedAddress?: IsCachedAddressFn;
|
|
787
881
|
/** Engage the EIP-3009 value=0 + pympp `proof` carve-out when pricing
|
|
788
882
|
* resolves to $0. Goods merchants offering free redemption codes set this
|
|
@@ -798,6 +892,16 @@ declare class Checkout {
|
|
|
798
892
|
* `extensions` field so Bazaar crawlers and other spec-compliant clients
|
|
799
893
|
* read the route's declared input/output schema. */
|
|
800
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
|
+
};
|
|
801
905
|
/** Optional discovery-probe config: auto-route empty-body POSTs without a
|
|
802
906
|
* payment header to a sample 402 advertising the merchant's shape for
|
|
803
907
|
* crawlers (`awal x402 details`, x402-proxy, x402scan, ...). */
|
|
@@ -844,7 +948,7 @@ declare class Checkout {
|
|
|
844
948
|
* - `AGENTSCORE_API_KEY` — required. No key → one-time warning + skip
|
|
845
949
|
* (dev/testnet pattern; production should always configure a key).
|
|
846
950
|
* - `AGENTSCORE_BASE_URL` — optional override for staging/dev API
|
|
847
|
-
* (e.g. `https://api
|
|
951
|
+
* (e.g. `https://api.staging.example` or `http://localhost:3002`).
|
|
848
952
|
*
|
|
849
953
|
* Stripe SPT (no extractable wallet signer) → skip silently; Stripe runs
|
|
850
954
|
* its own OFAC screen on the buyer's Stripe account at customer creation.
|
|
@@ -955,4 +1059,4 @@ interface MountUcpRoutesOptions {
|
|
|
955
1059
|
jwksPath?: string;
|
|
956
1060
|
}
|
|
957
1061
|
|
|
958
|
-
export { AGENTSCORE_UCP_CAPABILITY as A,
|
|
1062
|
+
export { AGENTSCORE_UCP_CAPABILITY as A, validationResponseFastify as B, Checkout as C, type DiscoveryProbeConfig as D, validationResponseHono as E, validationResponseNextjs as F, type GateDenial as G, validationResponseWeb as H, type IsCachedAddressFn as I, x402PaymentHandler as J, type MountUcpRoutesOptions as M, type OnSettledFn as O, type PreValidateFn as P, type RecipientsFn as R, type SettleOutcome as S, type UCPCapabilityBinding as U, type AgentScoreGatePolicy as a, type CheckoutContext as b, type CheckoutGateConfig as c, type CheckoutRailSpec as d, type CheckoutRequest as e, type CheckoutResult as f, type ComposeMppxFn as g, type MppxComposeOutcome as h, type PricingFn as i, type PricingResult as j, type ReferenceIdFn as k, type RunGateFn as l, type UCPPaymentHandlerBinding as m, type UCPProfile as n, type UCPProfileBody as o, type UCPServiceBinding as p, UCPSigningKey as q, buildAipTrustedIssuers as r, buildUCPProfile as s, getIdentityStatus as t, makeMppxComposeHook as u, mppPaymentHandler as v, pricingResult as w, stripeSptPaymentHandler as x, validationEnvelope as y, validationResponseExpress as z };
|
package/dist/core.d.mts
CHANGED
|
@@ -1,8 +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;
|
|
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. */
|
|
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;
|
|
6
16
|
}
|
|
7
17
|
/**
|
|
8
18
|
* Session metadata returned from `POST /v1/sessions`. Surfaced to the `onBeforeSession`
|
|
@@ -66,7 +76,7 @@ interface AgentScoreCoreOptions {
|
|
|
66
76
|
failOpen?: boolean;
|
|
67
77
|
/** How long to cache results, in seconds. Defaults to 300. */
|
|
68
78
|
cacheSeconds?: number;
|
|
69
|
-
/** AgentScore API base URL. Defaults to "https://api.agentscore.
|
|
79
|
+
/** AgentScore API base URL. Defaults to "https://api.agentscore.com". */
|
|
70
80
|
baseUrl?: string;
|
|
71
81
|
/** Optional chain to filter scoring to. */
|
|
72
82
|
chain?: string;
|
|
@@ -74,6 +84,11 @@ interface AgentScoreCoreOptions {
|
|
|
74
84
|
userAgent?: string;
|
|
75
85
|
/** When set and no identity is found, create a verification session instead of denying immediately. */
|
|
76
86
|
createSessionOnMissing?: CreateSessionOnMissing;
|
|
87
|
+
/** Issuers whose AIP Agent Identity Tokens this gate accepts. When set, the missing-identity
|
|
88
|
+
* recovery instructions and the `agent_memory` hint advertise the AIT path so agents holding
|
|
89
|
+
* one can present it. Set by Checkout from `gate.aip.trustedIssuers`; the actual AIT
|
|
90
|
+
* verification happens at the edge (Checkout) before `evaluate`. */
|
|
91
|
+
aipTrustedIssuers?: string[];
|
|
77
92
|
}
|
|
78
93
|
type DenialCode = 'wallet_not_trusted' | 'missing_identity' | 'api_error' | 'payment_required' | 'identity_verification_required' | 'wallet_signer_mismatch' | 'wallet_auth_requires_wallet_signing' | 'token_expired' | 'invalid_credential';
|
|
79
94
|
/**
|
|
@@ -90,7 +105,12 @@ interface AgentMemoryHint {
|
|
|
90
105
|
identity_paths: {
|
|
91
106
|
wallet: string;
|
|
92
107
|
operator_token: string;
|
|
108
|
+
agent_identity?: string;
|
|
93
109
|
};
|
|
110
|
+
/** Issuers whose AIP Agent Identity Tokens this merchant accepts. Present only when the
|
|
111
|
+
* merchant opted into AIP; an agent holding an AIT from one of these can present it via an
|
|
112
|
+
* `Agent-Identity` header + RFC 9421 signature instead of bootstrapping a fresh credential. */
|
|
113
|
+
aip_trusted_issuers?: string[];
|
|
94
114
|
bootstrap: string;
|
|
95
115
|
do_not_persist_in_memory: string[];
|
|
96
116
|
persist_in_credential_store: string[];
|
|
@@ -169,6 +189,16 @@ interface AssessResult {
|
|
|
169
189
|
linked_wallets?: string[];
|
|
170
190
|
verify_url?: string;
|
|
171
191
|
policy_result?: PolicyResult | null;
|
|
192
|
+
/** IdP provenance, present only when `identity_method === 'aip_token'` — which issuer attested
|
|
193
|
+
* the identity and the trust level it asserted. Mirrors the SDK's `AssessResponse.aip`. */
|
|
194
|
+
aip?: {
|
|
195
|
+
issuer: string;
|
|
196
|
+
subject: string;
|
|
197
|
+
trust_level?: 'autonomous' | 'human_present' | 'human_confirmed';
|
|
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;
|
|
201
|
+
};
|
|
172
202
|
}
|
|
173
203
|
/**
|
|
174
204
|
* Reason a failOpen allow short-circuited an evaluate call due to AgentScore-side
|
|
@@ -200,6 +230,12 @@ interface GateQuotaInfo {
|
|
|
200
230
|
* merchants can alert/log without parsing console output.
|
|
201
231
|
* - `quota` propagates the SDK's per-request quota observability when the API emits the
|
|
202
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).
|
|
203
239
|
* - `{ kind: 'deny', reason }` — the request was denied. Adapters should render a 403 with the
|
|
204
240
|
* reason, or invoke the caller's custom denial handler.
|
|
205
241
|
*/
|
|
@@ -209,9 +245,11 @@ type EvaluateOutcome = {
|
|
|
209
245
|
degraded?: boolean;
|
|
210
246
|
infraReason?: FailOpenInfraReason;
|
|
211
247
|
quota?: GateQuotaInfo;
|
|
248
|
+
signerVerdict?: SignerVerdict;
|
|
212
249
|
} | {
|
|
213
250
|
kind: 'deny';
|
|
214
251
|
reason: DenialReason;
|
|
252
|
+
signerVerdict?: SignerVerdict;
|
|
215
253
|
};
|
|
216
254
|
interface CaptureWalletOptions {
|
|
217
255
|
/** Operator credential (`opc_...`) that the agent authenticated with. */
|
|
@@ -280,16 +318,11 @@ interface AgentScoreCore {
|
|
|
280
318
|
* it and the response includes `signer_match` + `signer_sanctions` verdicts in one
|
|
281
319
|
* round trip. */
|
|
282
320
|
signer?: PaymentSigner | null): Promise<EvaluateOutcome>;
|
|
283
|
-
/** Synchronous read of the cached signer verdicts (signer_match + signer_sanctions)
|
|
284
|
-
* populated when the gate's evaluate call was made with a pre-extracted signer. Returns
|
|
285
|
-
* `undefined` when the gate didn't run, the request was operator-token-authenticated,
|
|
286
|
-
* or no signer was extractable (discovery legs). */
|
|
287
|
-
getSignerVerdict(claimedAddress: string): SignerVerdict | undefined;
|
|
288
321
|
/** Report a wallet seen paying under an operator credential. Fire-and-forget; silently
|
|
289
322
|
* swallows non-fatal errors because capture is informational, not on the critical path. */
|
|
290
323
|
captureWallet(options: CaptureWalletOptions): Promise<void>;
|
|
291
324
|
}
|
|
292
|
-
declare function buildAgentMemoryHint(): AgentMemoryHint;
|
|
325
|
+
declare function buildAgentMemoryHint(aipTrustedIssuers?: string[]): AgentMemoryHint;
|
|
293
326
|
declare function createAgentScoreCore(options: AgentScoreCoreOptions): AgentScoreCore;
|
|
294
327
|
|
|
295
328
|
export { type AccountVerification, type AgentIdentity, type AgentMemoryHint, type AgentScoreCore, type AgentScoreCoreOptions, type AssessResult, type CreateSessionOnMissing, type DenialCode, type DenialReason, type EvaluateOutcome, type FailOpenInfraReason, type GateQuotaInfo, type OperatorVerification, type PolicyCheck, type PolicyResult, type SessionMetadata, type SignerVerdict, type VerifyWalletSignerResult, buildAgentMemoryHint, createAgentScoreCore };
|