@agent-score/commerce 1.1.0 → 1.3.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 +27 -12
- package/dist/{_response-RpEB7-vl.d.ts → _response-C2yFQoIA.d.ts} +1 -1
- package/dist/{_response-DS-LR590.d.mts → _response-DpB-cm2c.d.mts} +1 -1
- package/dist/agent_instructions-DiMSGkdm.d.mts +133 -0
- package/dist/agent_instructions-DiMSGkdm.d.ts +133 -0
- package/dist/challenge/index.d.mts +18 -116
- package/dist/challenge/index.d.ts +18 -116
- package/dist/challenge/index.js +41 -27
- package/dist/challenge/index.js.map +1 -1
- package/dist/challenge/index.mjs +40 -27
- package/dist/challenge/index.mjs.map +1 -1
- package/dist/core.js +1 -1
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +1 -1
- package/dist/core.mjs.map +1 -1
- package/dist/discovery/index.d.mts +245 -2
- package/dist/discovery/index.d.ts +245 -2
- package/dist/discovery/index.js +276 -56
- package/dist/discovery/index.js.map +1 -1
- package/dist/discovery/index.mjs +269 -55
- package/dist/discovery/index.mjs.map +1 -1
- package/dist/identity/express.d.mts +2 -2
- package/dist/identity/express.d.ts +2 -2
- package/dist/identity/express.js +48 -25
- package/dist/identity/express.js.map +1 -1
- package/dist/identity/express.mjs +48 -25
- package/dist/identity/express.mjs.map +1 -1
- package/dist/identity/fastify.d.mts +2 -2
- package/dist/identity/fastify.d.ts +2 -2
- package/dist/identity/fastify.js +48 -25
- package/dist/identity/fastify.js.map +1 -1
- package/dist/identity/fastify.mjs +48 -25
- package/dist/identity/fastify.mjs.map +1 -1
- package/dist/identity/hono.d.mts +2 -2
- package/dist/identity/hono.d.ts +2 -2
- package/dist/identity/hono.js +48 -25
- package/dist/identity/hono.js.map +1 -1
- package/dist/identity/hono.mjs +48 -25
- package/dist/identity/hono.mjs.map +1 -1
- package/dist/identity/nextjs.d.mts +2 -2
- package/dist/identity/nextjs.d.ts +2 -2
- package/dist/identity/nextjs.js +48 -25
- package/dist/identity/nextjs.js.map +1 -1
- package/dist/identity/nextjs.mjs +48 -25
- package/dist/identity/nextjs.mjs.map +1 -1
- package/dist/identity/web.d.mts +2 -2
- package/dist/identity/web.d.ts +2 -2
- package/dist/identity/web.js +48 -25
- package/dist/identity/web.js.map +1 -1
- package/dist/identity/web.mjs +48 -25
- package/dist/identity/web.mjs.map +1 -1
- package/dist/index.d.mts +12 -12
- package/dist/index.d.ts +12 -12
- package/dist/index.js +47 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +47 -24
- package/dist/index.mjs.map +1 -1
- package/dist/payment/index.d.mts +136 -49
- package/dist/payment/index.d.ts +136 -49
- package/dist/payment/index.js +161 -73
- package/dist/payment/index.js.map +1 -1
- package/dist/payment/index.mjs +160 -72
- package/dist/payment/index.mjs.map +1 -1
- package/dist/{signer-Cvdwn6Cs.d.mts → signer-kCAJUZwp.d.mts} +10 -12
- package/dist/{signer-Cvdwn6Cs.d.ts → signer-kCAJUZwp.d.ts} +10 -12
- package/dist/stripe-multichain/index.d.mts +2 -2
- package/dist/stripe-multichain/index.d.ts +2 -2
- package/dist/stripe-multichain/index.js.map +1 -1
- package/dist/stripe-multichain/index.mjs.map +1 -1
- package/package.json +13 -4
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { R as RailKey, C as CompatibleClients } from '../agent_instructions-DiMSGkdm.mjs';
|
|
2
|
+
export { f as compatibleClientsByRails } from '../agent_instructions-DiMSGkdm.mjs';
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
5
|
* Build a sample x402 accepts entry for a CAIP-2 network. Looks up the USDC asset
|
|
3
6
|
* for the network from the `USDC` registry and uses a placeholder payTo. Used by
|
|
@@ -177,6 +180,40 @@ interface WellKnownMppInput {
|
|
|
177
180
|
*/
|
|
178
181
|
declare function buildWellKnownMpp(input: WellKnownMppInput): Record<string, unknown>;
|
|
179
182
|
|
|
183
|
+
/**
|
|
184
|
+
* `buildWellKnownX402`: emits the x402scan v1 `/.well-known/x402` discovery shape.
|
|
185
|
+
*
|
|
186
|
+
* x402scan accepts three discovery strategies (OpenAPI > `/.well-known/x402` > endpoint
|
|
187
|
+
* probe). Most AgentScore merchants already publish a richer `/.well-known/mpp.json`,
|
|
188
|
+
* but x402scan's strict parser only reads the v1 shape, so we emit both. The two
|
|
189
|
+
* coexist on different paths.
|
|
190
|
+
*
|
|
191
|
+
* Spec (verbatim, x402scan):
|
|
192
|
+
*
|
|
193
|
+
* {
|
|
194
|
+
* "version": 1,
|
|
195
|
+
* "resources": ["POST /api/route", ...]
|
|
196
|
+
* }
|
|
197
|
+
*
|
|
198
|
+
* Resource entries are `"METHOD /path"` strings, not objects. Runtime 402 behavior
|
|
199
|
+
* is authoritative over this static metadata.
|
|
200
|
+
*/
|
|
201
|
+
interface WellKnownX402Resource {
|
|
202
|
+
/** HTTP method, uppercase: `'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'`. */
|
|
203
|
+
method: string;
|
|
204
|
+
/** Path, leading slash: `'/purchase'`. */
|
|
205
|
+
path: string;
|
|
206
|
+
}
|
|
207
|
+
interface BuildWellKnownX402Input {
|
|
208
|
+
/** Invocable, payment-required routes. Each entry becomes `"METHOD /path"`. */
|
|
209
|
+
resources: WellKnownX402Resource[];
|
|
210
|
+
}
|
|
211
|
+
interface WellKnownX402Document {
|
|
212
|
+
version: 1;
|
|
213
|
+
resources: string[];
|
|
214
|
+
}
|
|
215
|
+
declare function buildWellKnownX402(input: BuildWellKnownX402Input): WellKnownX402Document;
|
|
216
|
+
|
|
180
217
|
interface LlmsTxtIdentitySectionInput {
|
|
181
218
|
/** When true, include the AgentScore identity-paths explanation (wallet vs operator-token). */
|
|
182
219
|
agentscore?: boolean;
|
|
@@ -196,7 +233,7 @@ interface LlmsTxtIdentitySectionInput {
|
|
|
196
233
|
declare function llmsTxtIdentitySection(input?: LlmsTxtIdentitySectionInput): string;
|
|
197
234
|
interface LlmsTxtPaymentSectionInput {
|
|
198
235
|
/** Symbolic rail names supported. */
|
|
199
|
-
rails: ('tempo-mainnet' | 'tempo-testnet' | 'x402-base-mainnet' | 'x402-base-sepolia' | '
|
|
236
|
+
rails: ('tempo-mainnet' | 'tempo-testnet' | 'x402-base-mainnet' | 'x402-base-sepolia' | 'mpp-solana-mainnet' | 'mpp-solana-devnet' | 'stripe-spt' | string)[];
|
|
200
237
|
/** Merchant URL — used in the example commands. */
|
|
201
238
|
appUrl: string;
|
|
202
239
|
/**
|
|
@@ -250,8 +287,20 @@ declare function buildLlmsTxt(input: BuildLlmsTxtInput): string;
|
|
|
250
287
|
*/
|
|
251
288
|
/**
|
|
252
289
|
* Standard AgentScore identity security schemes. Plug into `components.securitySchemes`.
|
|
290
|
+
*
|
|
291
|
+
* Includes `siwx` (Sign-In With X) per the x402scan discovery spec so identity-gated
|
|
292
|
+
* operations can declare `security: [{ siwx: [] }]` and stay classified as identity-only,
|
|
293
|
+
* not paid.
|
|
253
294
|
*/
|
|
254
295
|
declare function agentscoreSecuritySchemes(): Record<string, unknown>;
|
|
296
|
+
/**
|
|
297
|
+
* Sign-In With X security scheme entry, per the x402scan discovery spec.
|
|
298
|
+
*
|
|
299
|
+
* Reference it on identity-gated (but free) operations as
|
|
300
|
+
* `security: [{ siwx: [] }]`. Do NOT also attach `x-payment-info` to those routes,
|
|
301
|
+
* x402scan will misclassify them as paid.
|
|
302
|
+
*/
|
|
303
|
+
declare function siwxSecurityScheme(): Record<string, unknown>;
|
|
255
304
|
/**
|
|
256
305
|
* Standard AgentScore denial response schemas. Plug into `components.schemas` so OpenAPI
|
|
257
306
|
* validators understand the 403 body shape across denial codes.
|
|
@@ -263,6 +312,84 @@ declare function agentscoreDenialSchemas(): Record<string, unknown>;
|
|
|
263
312
|
* fields a typical merchant emits via build402Body.
|
|
264
313
|
*/
|
|
265
314
|
declare function agentscorePaymentRequiredSchema(): Record<string, unknown>;
|
|
315
|
+
/**
|
|
316
|
+
* Per-operation `x-payment-info` extension, per the x402scan discovery spec.
|
|
317
|
+
*
|
|
318
|
+
* Every payment-required OpenAPI operation should carry this block alongside a
|
|
319
|
+
* 402 response. Tells discovery crawlers (x402scan, agent CLIs) the static price
|
|
320
|
+
* and which protocols the route accepts. Runtime 402 behavior is authoritative
|
|
321
|
+
* over this static metadata; the static side is for indexability.
|
|
322
|
+
*
|
|
323
|
+
* @example fixed price across x402 + MPP Tempo
|
|
324
|
+
* ```ts
|
|
325
|
+
* Object.assign(operation, {
|
|
326
|
+
* ...xPaymentInfoExtension({
|
|
327
|
+
* price: { mode: 'fixed', currency: 'USD', amount: '0.10' },
|
|
328
|
+
* protocols: [
|
|
329
|
+
* { x402: {} },
|
|
330
|
+
* { mpp: { method: 'tempo/charge', intent: 'pay', currency: 'USD' } },
|
|
331
|
+
* ],
|
|
332
|
+
* }),
|
|
333
|
+
* responses: {
|
|
334
|
+
* '200': {...},
|
|
335
|
+
* '402': { description: 'Payment Required' },
|
|
336
|
+
* },
|
|
337
|
+
* });
|
|
338
|
+
* ```
|
|
339
|
+
*/
|
|
340
|
+
interface XPaymentInfoFixedPrice {
|
|
341
|
+
mode: 'fixed';
|
|
342
|
+
currency: string;
|
|
343
|
+
amount: string;
|
|
344
|
+
}
|
|
345
|
+
interface XPaymentInfoDynamicPrice {
|
|
346
|
+
mode: 'dynamic';
|
|
347
|
+
currency: string;
|
|
348
|
+
min: string;
|
|
349
|
+
max: string;
|
|
350
|
+
}
|
|
351
|
+
type XPaymentInfoPrice = XPaymentInfoFixedPrice | XPaymentInfoDynamicPrice;
|
|
352
|
+
interface XPaymentInfoX402Protocol {
|
|
353
|
+
x402: Record<string, unknown>;
|
|
354
|
+
}
|
|
355
|
+
interface XPaymentInfoMppProtocol {
|
|
356
|
+
mpp: {
|
|
357
|
+
method: string;
|
|
358
|
+
intent: string;
|
|
359
|
+
currency: string;
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
type XPaymentInfoProtocol = XPaymentInfoX402Protocol | XPaymentInfoMppProtocol;
|
|
363
|
+
interface XPaymentInfoInput {
|
|
364
|
+
price: XPaymentInfoPrice;
|
|
365
|
+
protocols: XPaymentInfoProtocol[];
|
|
366
|
+
}
|
|
367
|
+
declare function xPaymentInfoExtension(input: XPaymentInfoInput): {
|
|
368
|
+
'x-payment-info': {
|
|
369
|
+
price: XPaymentInfoPrice;
|
|
370
|
+
protocols: XPaymentInfoProtocol[];
|
|
371
|
+
};
|
|
372
|
+
};
|
|
373
|
+
/**
|
|
374
|
+
* `info.x-guidance` extension, per the x402scan discovery spec. Spread into your
|
|
375
|
+
* OpenAPI document's `info` block to give agents a high-level prose description
|
|
376
|
+
* of how to use the API. Discovery crawlers surface this on the listing page.
|
|
377
|
+
*
|
|
378
|
+
* @example
|
|
379
|
+
* ```ts
|
|
380
|
+
* const spec = {
|
|
381
|
+
* openapi: '3.1.0',
|
|
382
|
+
* info: {
|
|
383
|
+
* title: 'My Merchant API',
|
|
384
|
+
* version: '1.0',
|
|
385
|
+
* ...xGuidanceExtension('Wine merchant. POST /purchase with a verified operator token...'),
|
|
386
|
+
* },
|
|
387
|
+
* };
|
|
388
|
+
* ```
|
|
389
|
+
*/
|
|
390
|
+
declare function xGuidanceExtension(text: string): {
|
|
391
|
+
'x-guidance': string;
|
|
392
|
+
};
|
|
266
393
|
interface BuildAgentScoreOpenApiSnippetsInput {
|
|
267
394
|
/** Include security schemes in the snippet. Default true. */
|
|
268
395
|
security?: boolean;
|
|
@@ -379,4 +506,120 @@ declare function wrapNoindexResponse(path: string, response: Response, options?:
|
|
|
379
506
|
* in Next.js docs/examples. */
|
|
380
507
|
declare const applyNoindexHeader: typeof wrapNoindexResponse;
|
|
381
508
|
|
|
382
|
-
|
|
509
|
+
interface SkillMdEndpoint {
|
|
510
|
+
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
511
|
+
path: string;
|
|
512
|
+
authRequired: boolean;
|
|
513
|
+
description: string;
|
|
514
|
+
}
|
|
515
|
+
interface SkillMdIdentityRequirements {
|
|
516
|
+
/** Whether KYC is required for gated routes. */
|
|
517
|
+
kycRequired?: boolean;
|
|
518
|
+
/** Minimum age (e.g. 21 for alcohol). */
|
|
519
|
+
minAge?: number;
|
|
520
|
+
/** Allowed-jurisdictions list (ISO 3166-1 alpha-2 country codes). */
|
|
521
|
+
allowedJurisdictions?: string[];
|
|
522
|
+
/** Whether sanctions screening is enforced. */
|
|
523
|
+
sanctionsClear?: boolean;
|
|
524
|
+
}
|
|
525
|
+
interface SkillMdShippingPolicy {
|
|
526
|
+
/** Allowed shipping countries (ISO 3166-1 alpha-2). */
|
|
527
|
+
allowedCountries?: string[];
|
|
528
|
+
/** Blocked US states (2-letter codes). */
|
|
529
|
+
blockedStates?: string[];
|
|
530
|
+
}
|
|
531
|
+
interface SkillMdLink {
|
|
532
|
+
label: string;
|
|
533
|
+
url: string;
|
|
534
|
+
}
|
|
535
|
+
interface BuildSkillMdInput {
|
|
536
|
+
/** Skill manifest identifier — kebab-case per agentskills.io spec: 1-64 chars, lowercase
|
|
537
|
+
* alphanumeric + hyphens, no leading/trailing/consecutive hyphens. Validated at build
|
|
538
|
+
* time; invalid names throw. e.g. 'example-merchant-commerce'. */
|
|
539
|
+
name: string;
|
|
540
|
+
/** Skill description — agentskills.io spec: 1-1024 chars, non-empty. Should describe both
|
|
541
|
+
* what the skill does AND when to use it; imperative phrasing recommended ("Use when…").
|
|
542
|
+
* Validated at build time; over-length throws. */
|
|
543
|
+
description: string;
|
|
544
|
+
/** Merchant homepage (or domain root). Emitted as `metadata.homepage` per spec
|
|
545
|
+
* (top-level non-spec fields go under metadata). */
|
|
546
|
+
homepage: string;
|
|
547
|
+
/** Skill schema version — increment when the skill body materially changes. Emitted as
|
|
548
|
+
* a quoted string under `metadata.version` per agentskills.io spec (metadata values
|
|
549
|
+
* must be strings). Accepts string or number; numbers are converted. Default "1". */
|
|
550
|
+
version?: string | number;
|
|
551
|
+
/** Optional license name or path to a bundled license file. Emitted as top-level
|
|
552
|
+
* frontmatter `license:` per spec. */
|
|
553
|
+
license?: string;
|
|
554
|
+
/** Optional environment-requirements note (max 500 chars). e.g. "Requires Node 20+".
|
|
555
|
+
* Emitted as top-level frontmatter `compatibility:` per spec. */
|
|
556
|
+
compatibility?: string;
|
|
557
|
+
/** Optional space-separated string of pre-approved tools (experimental per spec). */
|
|
558
|
+
allowedTools?: string;
|
|
559
|
+
/** Additional caller-defined metadata entries — flat key/value strings nested under
|
|
560
|
+
* `metadata:`. Spec requires string values. */
|
|
561
|
+
metadata?: Record<string, string | number>;
|
|
562
|
+
/** Human display name (e.g. "Example Merchant"). */
|
|
563
|
+
merchantName: string;
|
|
564
|
+
/** Optional one-line tagline appearing under the title. */
|
|
565
|
+
tagline?: string;
|
|
566
|
+
/** Optional short prose intro describing what the merchant offers. Renders below the title. */
|
|
567
|
+
intro?: string;
|
|
568
|
+
/** Files / well-known URLs surfaced under the "Important Files" table. The skill.md URL
|
|
569
|
+
* itself is added automatically — list other discovery surfaces (llms.txt, mpp.json,
|
|
570
|
+
* openapi.json, agent-card.json). */
|
|
571
|
+
files?: SkillMdLink[];
|
|
572
|
+
/** Rails the merchant accepts. Drives the Payment + Compatible Clients sections. Order
|
|
573
|
+
* is preserved in render. Default to the rails actually declared on the merchant's
|
|
574
|
+
* `respond402` config — keep these in sync. */
|
|
575
|
+
acceptedRails: RailKey[];
|
|
576
|
+
/** Override the per-rail compatible-clients matrix. When omitted, derives from
|
|
577
|
+
* `acceptedRails` via the SDK's smoke-verified default. Override keys not in
|
|
578
|
+
* `acceptedRails` are dropped (the rail isn't accepted, so the row isn't rendered). */
|
|
579
|
+
compatibleClients?: CompatibleClients;
|
|
580
|
+
/** Identity requirements as agent-observable outcomes (kyc / age / jurisdiction /
|
|
581
|
+
* sanctions). Internal posture (`failOpen`, mount strategy, KYC vendor) is intentionally
|
|
582
|
+
* not part of this shape — agents act on outcomes, not implementation. */
|
|
583
|
+
identity?: SkillMdIdentityRequirements;
|
|
584
|
+
/** URL to the identity-bootstrap skill. Linked from the Identity Prerequisite section
|
|
585
|
+
* so an agent without a Passport can follow the bootstrap before attempting purchase. */
|
|
586
|
+
identityBootstrapUrl?: string;
|
|
587
|
+
/** Shipping policy, for physical-goods merchants. Omit for digital merchants. */
|
|
588
|
+
shipping?: SkillMdShippingPolicy;
|
|
589
|
+
/** Agent-facing endpoints — path, method, whether auth is required, brief purpose. */
|
|
590
|
+
endpoints: SkillMdEndpoint[];
|
|
591
|
+
/** When this skill should fire (skill loader uses for trigger matching). */
|
|
592
|
+
triggers: string[];
|
|
593
|
+
/** Optional numbered onboarding steps. Each entry renders as a numbered list item;
|
|
594
|
+
* may include shell snippets in markdown code fences. */
|
|
595
|
+
onboardingSteps?: string[];
|
|
596
|
+
/** Support / homepage / docs links rendered in the "Support" section. */
|
|
597
|
+
supportLinks?: SkillMdLink[];
|
|
598
|
+
/** When true (default), append a footer noting clients can refresh skill.md to pick
|
|
599
|
+
* up new endpoints. Set to false to suppress. */
|
|
600
|
+
refreshFooter?: boolean;
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* Render an agentskills.io-compatible `skill.md` for an agent-commerce merchant.
|
|
604
|
+
*
|
|
605
|
+
* Output is YAML frontmatter (`name` / `description` / optional `license` /
|
|
606
|
+
* `compatibility` / `allowed-tools` / `metadata`) followed by markdown sections
|
|
607
|
+
* describing payment rails, identity requirements, endpoints, triggers, and support
|
|
608
|
+
* links — strictly the agent-facing contract, with no internal posture (no `failOpen`,
|
|
609
|
+
* no mount-strategy names, no KYC vendor, no defense parameters).
|
|
610
|
+
*
|
|
611
|
+
* Spec compliance:
|
|
612
|
+
* - `name` validated against the agentskills.io regex (lowercase alphanumeric + hyphens,
|
|
613
|
+
* no leading/trailing/consecutive hyphens, ≤64 chars).
|
|
614
|
+
* - `description` length capped at 1024.
|
|
615
|
+
* - `metadata` values always emitted as quoted strings.
|
|
616
|
+
* - `description` (and other user scalars) double-quoted to defuse the colon /
|
|
617
|
+
* newline / quote pitfall the spec explicitly warns about.
|
|
618
|
+
*
|
|
619
|
+
* The compatible-clients-per-rail table sources from the same SDK constant
|
|
620
|
+
* (`compatibleClientsByRails`) that drives the live 402 body's `compatible_clients`
|
|
621
|
+
* field, so updating a smoke-verified client in one place propagates to every surface.
|
|
622
|
+
*/
|
|
623
|
+
declare function buildSkillMd(input: BuildSkillMdInput): string;
|
|
624
|
+
|
|
625
|
+
export { type BazaarDiscoveryConfig, type BuildAgentScoreOpenApiSnippetsInput, type BuildLlmsTxtInput, type BuildSkillMdInput, type BuildWellKnownX402Input, CompatibleClients, type DiscoveryProbeOptions, type DiscoveryProbeResponse, type LlmsTxtIdentitySectionInput, type LlmsTxtPaymentSectionInput, type NoindexNonDiscoveryOptions, type PaymentMethodConfig, RailKey, type RequestLike, type SkillMdEndpoint, type SkillMdIdentityRequirements, type SkillMdLink, type SkillMdShippingPolicy, type WellKnownMppInput, type WellKnownX402Document, type WellKnownX402Resource, type XPaymentInfoDynamicPrice, type XPaymentInfoFixedPrice, type XPaymentInfoInput, type XPaymentInfoMppProtocol, type XPaymentInfoPrice, type XPaymentInfoProtocol, type XPaymentInfoX402Protocol, agentscoreDenialSchemas, agentscoreOpenApiSnippets, agentscorePaymentRequiredSchema, agentscoreSecuritySchemes, applyNoindexHeader, buildDiscoveryProbeResponse, buildLlmsTxt, buildSkillMd, buildWellKnownMpp, buildWellKnownX402, createBazaarDiscovery, defaultDiscoveryPaths, isDiscoveryPath, isDiscoveryProbeRequest, llmsTxtIdentitySection, llmsTxtPaymentSection, noindexNonDiscoveryPaths, noindexNonDiscoveryPathsExpress, noindexNonDiscoveryPathsFastify, sampleX402AcceptForNetwork, siwxSecurityScheme, wrapNoindexResponse, xGuidanceExtension, xPaymentInfoExtension };
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { R as RailKey, C as CompatibleClients } from '../agent_instructions-DiMSGkdm.js';
|
|
2
|
+
export { f as compatibleClientsByRails } from '../agent_instructions-DiMSGkdm.js';
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
5
|
* Build a sample x402 accepts entry for a CAIP-2 network. Looks up the USDC asset
|
|
3
6
|
* for the network from the `USDC` registry and uses a placeholder payTo. Used by
|
|
@@ -177,6 +180,40 @@ interface WellKnownMppInput {
|
|
|
177
180
|
*/
|
|
178
181
|
declare function buildWellKnownMpp(input: WellKnownMppInput): Record<string, unknown>;
|
|
179
182
|
|
|
183
|
+
/**
|
|
184
|
+
* `buildWellKnownX402`: emits the x402scan v1 `/.well-known/x402` discovery shape.
|
|
185
|
+
*
|
|
186
|
+
* x402scan accepts three discovery strategies (OpenAPI > `/.well-known/x402` > endpoint
|
|
187
|
+
* probe). Most AgentScore merchants already publish a richer `/.well-known/mpp.json`,
|
|
188
|
+
* but x402scan's strict parser only reads the v1 shape, so we emit both. The two
|
|
189
|
+
* coexist on different paths.
|
|
190
|
+
*
|
|
191
|
+
* Spec (verbatim, x402scan):
|
|
192
|
+
*
|
|
193
|
+
* {
|
|
194
|
+
* "version": 1,
|
|
195
|
+
* "resources": ["POST /api/route", ...]
|
|
196
|
+
* }
|
|
197
|
+
*
|
|
198
|
+
* Resource entries are `"METHOD /path"` strings, not objects. Runtime 402 behavior
|
|
199
|
+
* is authoritative over this static metadata.
|
|
200
|
+
*/
|
|
201
|
+
interface WellKnownX402Resource {
|
|
202
|
+
/** HTTP method, uppercase: `'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'`. */
|
|
203
|
+
method: string;
|
|
204
|
+
/** Path, leading slash: `'/purchase'`. */
|
|
205
|
+
path: string;
|
|
206
|
+
}
|
|
207
|
+
interface BuildWellKnownX402Input {
|
|
208
|
+
/** Invocable, payment-required routes. Each entry becomes `"METHOD /path"`. */
|
|
209
|
+
resources: WellKnownX402Resource[];
|
|
210
|
+
}
|
|
211
|
+
interface WellKnownX402Document {
|
|
212
|
+
version: 1;
|
|
213
|
+
resources: string[];
|
|
214
|
+
}
|
|
215
|
+
declare function buildWellKnownX402(input: BuildWellKnownX402Input): WellKnownX402Document;
|
|
216
|
+
|
|
180
217
|
interface LlmsTxtIdentitySectionInput {
|
|
181
218
|
/** When true, include the AgentScore identity-paths explanation (wallet vs operator-token). */
|
|
182
219
|
agentscore?: boolean;
|
|
@@ -196,7 +233,7 @@ interface LlmsTxtIdentitySectionInput {
|
|
|
196
233
|
declare function llmsTxtIdentitySection(input?: LlmsTxtIdentitySectionInput): string;
|
|
197
234
|
interface LlmsTxtPaymentSectionInput {
|
|
198
235
|
/** Symbolic rail names supported. */
|
|
199
|
-
rails: ('tempo-mainnet' | 'tempo-testnet' | 'x402-base-mainnet' | 'x402-base-sepolia' | '
|
|
236
|
+
rails: ('tempo-mainnet' | 'tempo-testnet' | 'x402-base-mainnet' | 'x402-base-sepolia' | 'mpp-solana-mainnet' | 'mpp-solana-devnet' | 'stripe-spt' | string)[];
|
|
200
237
|
/** Merchant URL — used in the example commands. */
|
|
201
238
|
appUrl: string;
|
|
202
239
|
/**
|
|
@@ -250,8 +287,20 @@ declare function buildLlmsTxt(input: BuildLlmsTxtInput): string;
|
|
|
250
287
|
*/
|
|
251
288
|
/**
|
|
252
289
|
* Standard AgentScore identity security schemes. Plug into `components.securitySchemes`.
|
|
290
|
+
*
|
|
291
|
+
* Includes `siwx` (Sign-In With X) per the x402scan discovery spec so identity-gated
|
|
292
|
+
* operations can declare `security: [{ siwx: [] }]` and stay classified as identity-only,
|
|
293
|
+
* not paid.
|
|
253
294
|
*/
|
|
254
295
|
declare function agentscoreSecuritySchemes(): Record<string, unknown>;
|
|
296
|
+
/**
|
|
297
|
+
* Sign-In With X security scheme entry, per the x402scan discovery spec.
|
|
298
|
+
*
|
|
299
|
+
* Reference it on identity-gated (but free) operations as
|
|
300
|
+
* `security: [{ siwx: [] }]`. Do NOT also attach `x-payment-info` to those routes,
|
|
301
|
+
* x402scan will misclassify them as paid.
|
|
302
|
+
*/
|
|
303
|
+
declare function siwxSecurityScheme(): Record<string, unknown>;
|
|
255
304
|
/**
|
|
256
305
|
* Standard AgentScore denial response schemas. Plug into `components.schemas` so OpenAPI
|
|
257
306
|
* validators understand the 403 body shape across denial codes.
|
|
@@ -263,6 +312,84 @@ declare function agentscoreDenialSchemas(): Record<string, unknown>;
|
|
|
263
312
|
* fields a typical merchant emits via build402Body.
|
|
264
313
|
*/
|
|
265
314
|
declare function agentscorePaymentRequiredSchema(): Record<string, unknown>;
|
|
315
|
+
/**
|
|
316
|
+
* Per-operation `x-payment-info` extension, per the x402scan discovery spec.
|
|
317
|
+
*
|
|
318
|
+
* Every payment-required OpenAPI operation should carry this block alongside a
|
|
319
|
+
* 402 response. Tells discovery crawlers (x402scan, agent CLIs) the static price
|
|
320
|
+
* and which protocols the route accepts. Runtime 402 behavior is authoritative
|
|
321
|
+
* over this static metadata; the static side is for indexability.
|
|
322
|
+
*
|
|
323
|
+
* @example fixed price across x402 + MPP Tempo
|
|
324
|
+
* ```ts
|
|
325
|
+
* Object.assign(operation, {
|
|
326
|
+
* ...xPaymentInfoExtension({
|
|
327
|
+
* price: { mode: 'fixed', currency: 'USD', amount: '0.10' },
|
|
328
|
+
* protocols: [
|
|
329
|
+
* { x402: {} },
|
|
330
|
+
* { mpp: { method: 'tempo/charge', intent: 'pay', currency: 'USD' } },
|
|
331
|
+
* ],
|
|
332
|
+
* }),
|
|
333
|
+
* responses: {
|
|
334
|
+
* '200': {...},
|
|
335
|
+
* '402': { description: 'Payment Required' },
|
|
336
|
+
* },
|
|
337
|
+
* });
|
|
338
|
+
* ```
|
|
339
|
+
*/
|
|
340
|
+
interface XPaymentInfoFixedPrice {
|
|
341
|
+
mode: 'fixed';
|
|
342
|
+
currency: string;
|
|
343
|
+
amount: string;
|
|
344
|
+
}
|
|
345
|
+
interface XPaymentInfoDynamicPrice {
|
|
346
|
+
mode: 'dynamic';
|
|
347
|
+
currency: string;
|
|
348
|
+
min: string;
|
|
349
|
+
max: string;
|
|
350
|
+
}
|
|
351
|
+
type XPaymentInfoPrice = XPaymentInfoFixedPrice | XPaymentInfoDynamicPrice;
|
|
352
|
+
interface XPaymentInfoX402Protocol {
|
|
353
|
+
x402: Record<string, unknown>;
|
|
354
|
+
}
|
|
355
|
+
interface XPaymentInfoMppProtocol {
|
|
356
|
+
mpp: {
|
|
357
|
+
method: string;
|
|
358
|
+
intent: string;
|
|
359
|
+
currency: string;
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
type XPaymentInfoProtocol = XPaymentInfoX402Protocol | XPaymentInfoMppProtocol;
|
|
363
|
+
interface XPaymentInfoInput {
|
|
364
|
+
price: XPaymentInfoPrice;
|
|
365
|
+
protocols: XPaymentInfoProtocol[];
|
|
366
|
+
}
|
|
367
|
+
declare function xPaymentInfoExtension(input: XPaymentInfoInput): {
|
|
368
|
+
'x-payment-info': {
|
|
369
|
+
price: XPaymentInfoPrice;
|
|
370
|
+
protocols: XPaymentInfoProtocol[];
|
|
371
|
+
};
|
|
372
|
+
};
|
|
373
|
+
/**
|
|
374
|
+
* `info.x-guidance` extension, per the x402scan discovery spec. Spread into your
|
|
375
|
+
* OpenAPI document's `info` block to give agents a high-level prose description
|
|
376
|
+
* of how to use the API. Discovery crawlers surface this on the listing page.
|
|
377
|
+
*
|
|
378
|
+
* @example
|
|
379
|
+
* ```ts
|
|
380
|
+
* const spec = {
|
|
381
|
+
* openapi: '3.1.0',
|
|
382
|
+
* info: {
|
|
383
|
+
* title: 'My Merchant API',
|
|
384
|
+
* version: '1.0',
|
|
385
|
+
* ...xGuidanceExtension('Wine merchant. POST /purchase with a verified operator token...'),
|
|
386
|
+
* },
|
|
387
|
+
* };
|
|
388
|
+
* ```
|
|
389
|
+
*/
|
|
390
|
+
declare function xGuidanceExtension(text: string): {
|
|
391
|
+
'x-guidance': string;
|
|
392
|
+
};
|
|
266
393
|
interface BuildAgentScoreOpenApiSnippetsInput {
|
|
267
394
|
/** Include security schemes in the snippet. Default true. */
|
|
268
395
|
security?: boolean;
|
|
@@ -379,4 +506,120 @@ declare function wrapNoindexResponse(path: string, response: Response, options?:
|
|
|
379
506
|
* in Next.js docs/examples. */
|
|
380
507
|
declare const applyNoindexHeader: typeof wrapNoindexResponse;
|
|
381
508
|
|
|
382
|
-
|
|
509
|
+
interface SkillMdEndpoint {
|
|
510
|
+
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
511
|
+
path: string;
|
|
512
|
+
authRequired: boolean;
|
|
513
|
+
description: string;
|
|
514
|
+
}
|
|
515
|
+
interface SkillMdIdentityRequirements {
|
|
516
|
+
/** Whether KYC is required for gated routes. */
|
|
517
|
+
kycRequired?: boolean;
|
|
518
|
+
/** Minimum age (e.g. 21 for alcohol). */
|
|
519
|
+
minAge?: number;
|
|
520
|
+
/** Allowed-jurisdictions list (ISO 3166-1 alpha-2 country codes). */
|
|
521
|
+
allowedJurisdictions?: string[];
|
|
522
|
+
/** Whether sanctions screening is enforced. */
|
|
523
|
+
sanctionsClear?: boolean;
|
|
524
|
+
}
|
|
525
|
+
interface SkillMdShippingPolicy {
|
|
526
|
+
/** Allowed shipping countries (ISO 3166-1 alpha-2). */
|
|
527
|
+
allowedCountries?: string[];
|
|
528
|
+
/** Blocked US states (2-letter codes). */
|
|
529
|
+
blockedStates?: string[];
|
|
530
|
+
}
|
|
531
|
+
interface SkillMdLink {
|
|
532
|
+
label: string;
|
|
533
|
+
url: string;
|
|
534
|
+
}
|
|
535
|
+
interface BuildSkillMdInput {
|
|
536
|
+
/** Skill manifest identifier — kebab-case per agentskills.io spec: 1-64 chars, lowercase
|
|
537
|
+
* alphanumeric + hyphens, no leading/trailing/consecutive hyphens. Validated at build
|
|
538
|
+
* time; invalid names throw. e.g. 'example-merchant-commerce'. */
|
|
539
|
+
name: string;
|
|
540
|
+
/** Skill description — agentskills.io spec: 1-1024 chars, non-empty. Should describe both
|
|
541
|
+
* what the skill does AND when to use it; imperative phrasing recommended ("Use when…").
|
|
542
|
+
* Validated at build time; over-length throws. */
|
|
543
|
+
description: string;
|
|
544
|
+
/** Merchant homepage (or domain root). Emitted as `metadata.homepage` per spec
|
|
545
|
+
* (top-level non-spec fields go under metadata). */
|
|
546
|
+
homepage: string;
|
|
547
|
+
/** Skill schema version — increment when the skill body materially changes. Emitted as
|
|
548
|
+
* a quoted string under `metadata.version` per agentskills.io spec (metadata values
|
|
549
|
+
* must be strings). Accepts string or number; numbers are converted. Default "1". */
|
|
550
|
+
version?: string | number;
|
|
551
|
+
/** Optional license name or path to a bundled license file. Emitted as top-level
|
|
552
|
+
* frontmatter `license:` per spec. */
|
|
553
|
+
license?: string;
|
|
554
|
+
/** Optional environment-requirements note (max 500 chars). e.g. "Requires Node 20+".
|
|
555
|
+
* Emitted as top-level frontmatter `compatibility:` per spec. */
|
|
556
|
+
compatibility?: string;
|
|
557
|
+
/** Optional space-separated string of pre-approved tools (experimental per spec). */
|
|
558
|
+
allowedTools?: string;
|
|
559
|
+
/** Additional caller-defined metadata entries — flat key/value strings nested under
|
|
560
|
+
* `metadata:`. Spec requires string values. */
|
|
561
|
+
metadata?: Record<string, string | number>;
|
|
562
|
+
/** Human display name (e.g. "Example Merchant"). */
|
|
563
|
+
merchantName: string;
|
|
564
|
+
/** Optional one-line tagline appearing under the title. */
|
|
565
|
+
tagline?: string;
|
|
566
|
+
/** Optional short prose intro describing what the merchant offers. Renders below the title. */
|
|
567
|
+
intro?: string;
|
|
568
|
+
/** Files / well-known URLs surfaced under the "Important Files" table. The skill.md URL
|
|
569
|
+
* itself is added automatically — list other discovery surfaces (llms.txt, mpp.json,
|
|
570
|
+
* openapi.json, agent-card.json). */
|
|
571
|
+
files?: SkillMdLink[];
|
|
572
|
+
/** Rails the merchant accepts. Drives the Payment + Compatible Clients sections. Order
|
|
573
|
+
* is preserved in render. Default to the rails actually declared on the merchant's
|
|
574
|
+
* `respond402` config — keep these in sync. */
|
|
575
|
+
acceptedRails: RailKey[];
|
|
576
|
+
/** Override the per-rail compatible-clients matrix. When omitted, derives from
|
|
577
|
+
* `acceptedRails` via the SDK's smoke-verified default. Override keys not in
|
|
578
|
+
* `acceptedRails` are dropped (the rail isn't accepted, so the row isn't rendered). */
|
|
579
|
+
compatibleClients?: CompatibleClients;
|
|
580
|
+
/** Identity requirements as agent-observable outcomes (kyc / age / jurisdiction /
|
|
581
|
+
* sanctions). Internal posture (`failOpen`, mount strategy, KYC vendor) is intentionally
|
|
582
|
+
* not part of this shape — agents act on outcomes, not implementation. */
|
|
583
|
+
identity?: SkillMdIdentityRequirements;
|
|
584
|
+
/** URL to the identity-bootstrap skill. Linked from the Identity Prerequisite section
|
|
585
|
+
* so an agent without a Passport can follow the bootstrap before attempting purchase. */
|
|
586
|
+
identityBootstrapUrl?: string;
|
|
587
|
+
/** Shipping policy, for physical-goods merchants. Omit for digital merchants. */
|
|
588
|
+
shipping?: SkillMdShippingPolicy;
|
|
589
|
+
/** Agent-facing endpoints — path, method, whether auth is required, brief purpose. */
|
|
590
|
+
endpoints: SkillMdEndpoint[];
|
|
591
|
+
/** When this skill should fire (skill loader uses for trigger matching). */
|
|
592
|
+
triggers: string[];
|
|
593
|
+
/** Optional numbered onboarding steps. Each entry renders as a numbered list item;
|
|
594
|
+
* may include shell snippets in markdown code fences. */
|
|
595
|
+
onboardingSteps?: string[];
|
|
596
|
+
/** Support / homepage / docs links rendered in the "Support" section. */
|
|
597
|
+
supportLinks?: SkillMdLink[];
|
|
598
|
+
/** When true (default), append a footer noting clients can refresh skill.md to pick
|
|
599
|
+
* up new endpoints. Set to false to suppress. */
|
|
600
|
+
refreshFooter?: boolean;
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* Render an agentskills.io-compatible `skill.md` for an agent-commerce merchant.
|
|
604
|
+
*
|
|
605
|
+
* Output is YAML frontmatter (`name` / `description` / optional `license` /
|
|
606
|
+
* `compatibility` / `allowed-tools` / `metadata`) followed by markdown sections
|
|
607
|
+
* describing payment rails, identity requirements, endpoints, triggers, and support
|
|
608
|
+
* links — strictly the agent-facing contract, with no internal posture (no `failOpen`,
|
|
609
|
+
* no mount-strategy names, no KYC vendor, no defense parameters).
|
|
610
|
+
*
|
|
611
|
+
* Spec compliance:
|
|
612
|
+
* - `name` validated against the agentskills.io regex (lowercase alphanumeric + hyphens,
|
|
613
|
+
* no leading/trailing/consecutive hyphens, ≤64 chars).
|
|
614
|
+
* - `description` length capped at 1024.
|
|
615
|
+
* - `metadata` values always emitted as quoted strings.
|
|
616
|
+
* - `description` (and other user scalars) double-quoted to defuse the colon /
|
|
617
|
+
* newline / quote pitfall the spec explicitly warns about.
|
|
618
|
+
*
|
|
619
|
+
* The compatible-clients-per-rail table sources from the same SDK constant
|
|
620
|
+
* (`compatibleClientsByRails`) that drives the live 402 body's `compatible_clients`
|
|
621
|
+
* field, so updating a smoke-verified client in one place propagates to every surface.
|
|
622
|
+
*/
|
|
623
|
+
declare function buildSkillMd(input: BuildSkillMdInput): string;
|
|
624
|
+
|
|
625
|
+
export { type BazaarDiscoveryConfig, type BuildAgentScoreOpenApiSnippetsInput, type BuildLlmsTxtInput, type BuildSkillMdInput, type BuildWellKnownX402Input, CompatibleClients, type DiscoveryProbeOptions, type DiscoveryProbeResponse, type LlmsTxtIdentitySectionInput, type LlmsTxtPaymentSectionInput, type NoindexNonDiscoveryOptions, type PaymentMethodConfig, RailKey, type RequestLike, type SkillMdEndpoint, type SkillMdIdentityRequirements, type SkillMdLink, type SkillMdShippingPolicy, type WellKnownMppInput, type WellKnownX402Document, type WellKnownX402Resource, type XPaymentInfoDynamicPrice, type XPaymentInfoFixedPrice, type XPaymentInfoInput, type XPaymentInfoMppProtocol, type XPaymentInfoPrice, type XPaymentInfoProtocol, type XPaymentInfoX402Protocol, agentscoreDenialSchemas, agentscoreOpenApiSnippets, agentscorePaymentRequiredSchema, agentscoreSecuritySchemes, applyNoindexHeader, buildDiscoveryProbeResponse, buildLlmsTxt, buildSkillMd, buildWellKnownMpp, buildWellKnownX402, createBazaarDiscovery, defaultDiscoveryPaths, isDiscoveryPath, isDiscoveryProbeRequest, llmsTxtIdentitySection, llmsTxtPaymentSection, noindexNonDiscoveryPaths, noindexNonDiscoveryPathsExpress, noindexNonDiscoveryPathsFastify, sampleX402AcceptForNetwork, siwxSecurityScheme, wrapNoindexResponse, xGuidanceExtension, xPaymentInfoExtension };
|