@agent-score/commerce 1.1.0 → 1.2.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 CHANGED
@@ -25,7 +25,7 @@ npm install hono mppx @x402/core @x402/evm @x402/svm stripe # whatever your st
25
25
  |---|---|
26
26
  | `/identity/{hono,express,fastify,nextjs,web}` | Trust gate middleware: KYC, sanctions, age, jurisdiction. `agentscoreGate(...)`, `getAgentScoreData(c)`, `captureWallet(...)`, `verifyWalletSignerMatch(...)`. Plus shared denial helpers: `denialReasonStatus`, `denialReasonToBody`, `buildSignerMismatchBody`, `buildContactSupportNextSteps`, `verificationAgentInstructions`, `isFixableDenial`, `FIXABLE_DENIAL_REASONS`. |
27
27
  | `/payment` | `networks`, `USDC`, `rails` registries; `paymentDirective`, `buildPaymentDirective`, `wwwAuthenticateHeader`, `paymentRequiredHeader`, `aliasAmountFields` (v1↔v2 amount field shim — emits both `amount` and `maxAmountRequired` so v1-only x402 parsers like Coinbase awal can read v2 bodies), `settlementOverrideHeader`, `dispatchSettlementByNetwork`, `extractPaymentSigner` (returns `{address, network}`); `createX402Server`, `createMppxServer`; drop-in x402 helpers: `validateX402NetworkConfig` (boot-time guard), `verifyX402Request` (parse + validate inbound X-Payment), `processX402Settle` (verify-then-settle with one call). |
28
- | `/discovery` | `isDiscoveryProbeRequest`, `buildDiscoveryProbeResponse` (with optional `x402Sample` for x402-aware crawlers — `awal x402 details` etc.), `sampleX402AcceptForNetwork` (USDC sample-accept builder for known CAIP-2 networks), `buildWellKnownMpp`, `buildLlmsTxt` + `llmsTxtIdentitySection` + `llmsTxtPaymentSection` (compact + verbose modes), `agentscoreOpenApiSnippets`, `createBazaarDiscovery`, `noindexNonDiscoveryPaths` (Hono middleware that emits `X-Robots-Tag: noindex` on every path except the agent-discovery surfaces — defaults cover `/openapi.json`, `/llms.txt`, `/.well-known/{mpp.json,agent-card.json,ucp}`, `/favicon.{png,ico}`; pure helpers `isDiscoveryPath` + `defaultDiscoveryPaths` for non-Hono frameworks). |
28
+ | `/discovery` | `isDiscoveryProbeRequest`, `buildDiscoveryProbeResponse` (with optional `x402Sample` for x402-aware crawlers — `awal x402 details` etc.), `sampleX402AcceptForNetwork` (USDC sample-accept builder for known CAIP-2 networks), `buildWellKnownMpp`, `buildLlmsTxt` + `llmsTxtIdentitySection` + `llmsTxtPaymentSection` (compact + verbose modes), `buildSkillMd` (Claude-Skill-compatible `/skill.md` agent-discovery manifest — strictly agent-facing data only, no internal posture), `agentscoreOpenApiSnippets`, `createBazaarDiscovery`, `noindexNonDiscoveryPaths` (Hono middleware that emits `X-Robots-Tag: noindex` on every path except the agent-discovery surfaces — defaults cover `/openapi.json`, `/llms.txt`, `/skill.md`, `/.well-known/{mpp.json,agent-card.json,ucp}`, `/favicon.{png,ico}`; pure helpers `isDiscoveryPath` + `defaultDiscoveryPaths` for non-Hono frameworks). |
29
29
  | `/challenge` | `build402Body`, `buildAcceptedMethods`, `buildIdentityMetadata`, `buildHowToPay`, `buildAgentInstructions` (auto-emits per-rail `compatible_clients` — smoke-verified CLIs the agent should use; vendor override supported), `buildPricingBlock`, `firstEncounterAgentMemory`, `OrderReceipt`; `respond402` — drop-in 402 emit that preserves mppx's `WWW-Authenticate` and layers x402's `PAYMENT-REQUIRED`. `buildValidationError` — structured 4xx body builder (`{error: {code, message}, required_fields?, example_body?, next_steps?, ...extra}`) so vendors compose body shapes by name instead of inlining at every validation site. |
30
30
  | `/stripe-multichain` | `createMultichainPaymentIntent`, `getDepositAddress`, `simulateCryptoDeposit`, `createMppxStripe`; `createPiCache` (TTL'd PI / deposit-address cache, Redis-backed when `redisUrl` set, in-memory otherwise), `simulateDepositIfTestMode` (gates on `sk_test_` and looks up the PI for you), `STRIPE_TEST_TX_HASH_SUCCESS` / `STRIPE_TEST_TX_HASH_FAILED` constants. Peer dep on `stripe`. |
31
31
  | `/api` | Everything from `@agent-score/sdk` re-exported in one place: `AgentScore` + `AgentScoreError`, `AGENTSCORE_TEST_ADDRESSES` + `isAgentScoreTestAddress`. **Don't add `@agent-score/sdk` as a separate dep** — the two can drift versions and cause subtle type mismatches. |
@@ -0,0 +1,129 @@
1
+ interface HowToPayRailEntry {
2
+ setup?: string[];
3
+ prerequisite?: string;
4
+ command: string;
5
+ alternative_command?: string;
6
+ what_it_does: string;
7
+ }
8
+ interface HowToPayStripeEntry {
9
+ prerequisite: string;
10
+ instructions: string;
11
+ setup_link_cli?: string[];
12
+ command_link_cli?: string[];
13
+ what_it_does_link_cli?: string;
14
+ note?: string;
15
+ }
16
+ interface HowToPayBlock {
17
+ tempo?: HowToPayRailEntry;
18
+ x402_base?: HowToPayRailEntry;
19
+ x402_solana?: HowToPayRailEntry;
20
+ stripe?: HowToPayStripeEntry;
21
+ }
22
+ interface BuildHowToPayInput {
23
+ /** The merchant's full URL (e.g., 'https://agents.merchant.example/api/buy'). */
24
+ url: string;
25
+ /** JSON string of the body the agent should retry with — typically the original request body. */
26
+ retryBodyJson: string;
27
+ /** Total amount in USD (string or number). Used to compute max-spend defaults and stripe context. */
28
+ totalUsd: string | number;
29
+ /** Per-rail config — each is optional. Pass only the rails you support. */
30
+ rails: {
31
+ tempo?: {
32
+ recipient: string;
33
+ networkName?: string;
34
+ chainId?: number;
35
+ recommend?: 'tempo' | 'agentscore-pay' | 'both';
36
+ };
37
+ x402_base?: {
38
+ recipient: string;
39
+ network?: string;
40
+ };
41
+ x402_solana?: {
42
+ recipient: string;
43
+ network?: string;
44
+ };
45
+ stripe?: {
46
+ profileId?: string | null;
47
+ productName?: string;
48
+ };
49
+ };
50
+ /** Placeholder text for the operator token in commands. Defaults to '<your_opc_token>'. */
51
+ opTokenPlaceholder?: string;
52
+ /** Override max-spend value used in commands. Default: ceil(totalUsd) + 1. */
53
+ maxSpend?: string | number;
54
+ }
55
+ /**
56
+ * Build the agent_instructions.how_to_pay block. Generates per-rail setup/command/what_it_does
57
+ * boilerplate so agents see concrete commands per rail in the 402 body. Vendors pass the rails
58
+ * they support; the helper produces the right command for each.
59
+ *
60
+ * Tool recommendations (tempo CLI vs agentscore-pay vs link-cli) are configurable per rail.
61
+ */
62
+ declare function buildHowToPay(input: BuildHowToPayInput): HowToPayBlock;
63
+
64
+ /** Map of rail key (e.g. 'x402_base', 'tempo_mpp', 'stripe') → list of client identifiers
65
+ * that have been smoke-verified by the merchant against the protocol shape they emit.
66
+ * Strings are display labels, not install commands — agents already get install commands
67
+ * via `how_to_pay.<rail>.setup`. Use these as a "what's known to work" hint. */
68
+ type CompatibleClients = Record<string, string[]>;
69
+ interface BuildAgentInstructionsInput {
70
+ /** Per-rail commands. Build with `buildHowToPay`. */
71
+ howToPay: HowToPayBlock;
72
+ /** Tool recommendations as human-readable strings. Defaults to a sensible set covering tempo + agentscore-pay. */
73
+ recommendedTools?: string[];
74
+ /** Wallet-stack compatibility note for the agent. Default: rail-neutral, no specific wallet stack required. */
75
+ walletCompatibility?: string;
76
+ /** How long the merchant will wait for payment after the 402. Default 300 (5 minutes). */
77
+ timeoutSeconds?: number;
78
+ /** Warnings about common footguns. Defaults include tempo wallet transfer + raw on-chain x402 deposits. */
79
+ warnings?: string[];
80
+ /** Recommended rail (e.g., 'tempo', 'x402_base'). Surfaced for agents to default to. */
81
+ recommended?: string;
82
+ /** Per-rail list of client names the merchant has verified work end-to-end. Vendors set
83
+ * this from their own smoke matrix — defaults to none (avoids vouching for clients the
84
+ * merchant has not tested). When omitted, the field is not emitted. */
85
+ compatibleClients?: CompatibleClients;
86
+ /** Arbitrary additional fields the vendor wants merged into the agent_instructions object. */
87
+ extra?: Record<string, unknown>;
88
+ }
89
+ interface AgentInstructions {
90
+ how_to_pay: HowToPayBlock;
91
+ recommended_tools: string[];
92
+ wallet_compatibility: string;
93
+ timeout_seconds: number;
94
+ warnings: string[];
95
+ recommended?: string;
96
+ compatible_clients?: CompatibleClients;
97
+ [key: string]: unknown;
98
+ }
99
+ /**
100
+ * Default `compatible_clients` derived from the rails declared in `howToPay`. Lists
101
+ * clients the AgentScore team has smoke-verified end-to-end against an `@agent-score/commerce`
102
+ * merchant; entries appear only for rails the vendor actually offers. Vendors override
103
+ * this in `buildAgentInstructions({compatibleClients: {...}})` to add their own tested
104
+ * clients or remove entries that don't fit their endpoint.
105
+ *
106
+ * Verified state as of the SDK release. The same data is also published as a docs page
107
+ * for humans (rationale, per-rail commands, why some clients don't fully work, last
108
+ * verified date) — this default keeps the merchant-side surface in sync.
109
+ */
110
+ /** Symbolic rail keys agent-facing surfaces use to talk about a rail without spelling out
111
+ * network/scheme details. Same keys as `CompatibleClients` map keys. */
112
+ type RailKey = 'tempo_mpp' | 'x402_base' | 'x402_solana' | 'stripe';
113
+ /** Returns the smoke-verified client list for a set of rail keys. The single source of
114
+ * truth for "which CLIs we've verified end-to-end on each rail" — consumed both by the
115
+ * 402-body builder (`defaultCompatibleClients`) and by discovery surfaces (skill.md,
116
+ * llms.txt, etc.). Update here, every surface inherits. */
117
+ declare function compatibleClientsByRails(rails: readonly RailKey[]): CompatibleClients | undefined;
118
+ /**
119
+ * Build the agent_instructions object for the 402 body. Combines how_to_pay with
120
+ * recommended tools, warnings, wallet-compatibility note, and timeout.
121
+ *
122
+ * Defaults adapt to the rails declared in `howToPay`: only tempo-relevant warnings/tools
123
+ * appear if `howToPay.tempo` is set, only x402-relevant ones if `x402_base`/`x402_solana`
124
+ * are set. Stripe-only merchants get neither rail-specific warning. Vendors override
125
+ * `warnings`/`recommendedTools` for full control.
126
+ */
127
+ declare function buildAgentInstructions(input: BuildAgentInstructionsInput): AgentInstructions;
128
+
129
+ export { type AgentInstructions as A, type BuildAgentInstructionsInput as B, type CompatibleClients as C, type HowToPayBlock as H, type RailKey as R, type BuildHowToPayInput as a, type HowToPayRailEntry as b, compatibleClientsByRails as c, type HowToPayStripeEntry as d, buildAgentInstructions as e, buildHowToPay as f };
@@ -0,0 +1,129 @@
1
+ interface HowToPayRailEntry {
2
+ setup?: string[];
3
+ prerequisite?: string;
4
+ command: string;
5
+ alternative_command?: string;
6
+ what_it_does: string;
7
+ }
8
+ interface HowToPayStripeEntry {
9
+ prerequisite: string;
10
+ instructions: string;
11
+ setup_link_cli?: string[];
12
+ command_link_cli?: string[];
13
+ what_it_does_link_cli?: string;
14
+ note?: string;
15
+ }
16
+ interface HowToPayBlock {
17
+ tempo?: HowToPayRailEntry;
18
+ x402_base?: HowToPayRailEntry;
19
+ x402_solana?: HowToPayRailEntry;
20
+ stripe?: HowToPayStripeEntry;
21
+ }
22
+ interface BuildHowToPayInput {
23
+ /** The merchant's full URL (e.g., 'https://agents.merchant.example/api/buy'). */
24
+ url: string;
25
+ /** JSON string of the body the agent should retry with — typically the original request body. */
26
+ retryBodyJson: string;
27
+ /** Total amount in USD (string or number). Used to compute max-spend defaults and stripe context. */
28
+ totalUsd: string | number;
29
+ /** Per-rail config — each is optional. Pass only the rails you support. */
30
+ rails: {
31
+ tempo?: {
32
+ recipient: string;
33
+ networkName?: string;
34
+ chainId?: number;
35
+ recommend?: 'tempo' | 'agentscore-pay' | 'both';
36
+ };
37
+ x402_base?: {
38
+ recipient: string;
39
+ network?: string;
40
+ };
41
+ x402_solana?: {
42
+ recipient: string;
43
+ network?: string;
44
+ };
45
+ stripe?: {
46
+ profileId?: string | null;
47
+ productName?: string;
48
+ };
49
+ };
50
+ /** Placeholder text for the operator token in commands. Defaults to '<your_opc_token>'. */
51
+ opTokenPlaceholder?: string;
52
+ /** Override max-spend value used in commands. Default: ceil(totalUsd) + 1. */
53
+ maxSpend?: string | number;
54
+ }
55
+ /**
56
+ * Build the agent_instructions.how_to_pay block. Generates per-rail setup/command/what_it_does
57
+ * boilerplate so agents see concrete commands per rail in the 402 body. Vendors pass the rails
58
+ * they support; the helper produces the right command for each.
59
+ *
60
+ * Tool recommendations (tempo CLI vs agentscore-pay vs link-cli) are configurable per rail.
61
+ */
62
+ declare function buildHowToPay(input: BuildHowToPayInput): HowToPayBlock;
63
+
64
+ /** Map of rail key (e.g. 'x402_base', 'tempo_mpp', 'stripe') → list of client identifiers
65
+ * that have been smoke-verified by the merchant against the protocol shape they emit.
66
+ * Strings are display labels, not install commands — agents already get install commands
67
+ * via `how_to_pay.<rail>.setup`. Use these as a "what's known to work" hint. */
68
+ type CompatibleClients = Record<string, string[]>;
69
+ interface BuildAgentInstructionsInput {
70
+ /** Per-rail commands. Build with `buildHowToPay`. */
71
+ howToPay: HowToPayBlock;
72
+ /** Tool recommendations as human-readable strings. Defaults to a sensible set covering tempo + agentscore-pay. */
73
+ recommendedTools?: string[];
74
+ /** Wallet-stack compatibility note for the agent. Default: rail-neutral, no specific wallet stack required. */
75
+ walletCompatibility?: string;
76
+ /** How long the merchant will wait for payment after the 402. Default 300 (5 minutes). */
77
+ timeoutSeconds?: number;
78
+ /** Warnings about common footguns. Defaults include tempo wallet transfer + raw on-chain x402 deposits. */
79
+ warnings?: string[];
80
+ /** Recommended rail (e.g., 'tempo', 'x402_base'). Surfaced for agents to default to. */
81
+ recommended?: string;
82
+ /** Per-rail list of client names the merchant has verified work end-to-end. Vendors set
83
+ * this from their own smoke matrix — defaults to none (avoids vouching for clients the
84
+ * merchant has not tested). When omitted, the field is not emitted. */
85
+ compatibleClients?: CompatibleClients;
86
+ /** Arbitrary additional fields the vendor wants merged into the agent_instructions object. */
87
+ extra?: Record<string, unknown>;
88
+ }
89
+ interface AgentInstructions {
90
+ how_to_pay: HowToPayBlock;
91
+ recommended_tools: string[];
92
+ wallet_compatibility: string;
93
+ timeout_seconds: number;
94
+ warnings: string[];
95
+ recommended?: string;
96
+ compatible_clients?: CompatibleClients;
97
+ [key: string]: unknown;
98
+ }
99
+ /**
100
+ * Default `compatible_clients` derived from the rails declared in `howToPay`. Lists
101
+ * clients the AgentScore team has smoke-verified end-to-end against an `@agent-score/commerce`
102
+ * merchant; entries appear only for rails the vendor actually offers. Vendors override
103
+ * this in `buildAgentInstructions({compatibleClients: {...}})` to add their own tested
104
+ * clients or remove entries that don't fit their endpoint.
105
+ *
106
+ * Verified state as of the SDK release. The same data is also published as a docs page
107
+ * for humans (rationale, per-rail commands, why some clients don't fully work, last
108
+ * verified date) — this default keeps the merchant-side surface in sync.
109
+ */
110
+ /** Symbolic rail keys agent-facing surfaces use to talk about a rail without spelling out
111
+ * network/scheme details. Same keys as `CompatibleClients` map keys. */
112
+ type RailKey = 'tempo_mpp' | 'x402_base' | 'x402_solana' | 'stripe';
113
+ /** Returns the smoke-verified client list for a set of rail keys. The single source of
114
+ * truth for "which CLIs we've verified end-to-end on each rail" — consumed both by the
115
+ * 402-body builder (`defaultCompatibleClients`) and by discovery surfaces (skill.md,
116
+ * llms.txt, etc.). Update here, every surface inherits. */
117
+ declare function compatibleClientsByRails(rails: readonly RailKey[]): CompatibleClients | undefined;
118
+ /**
119
+ * Build the agent_instructions object for the 402 body. Combines how_to_pay with
120
+ * recommended tools, warnings, wallet-compatibility note, and timeout.
121
+ *
122
+ * Defaults adapt to the rails declared in `howToPay`: only tempo-relevant warnings/tools
123
+ * appear if `howToPay.tempo` is set, only x402-relevant ones if `x402_base`/`x402_solana`
124
+ * are set. Stripe-only merchants get neither rail-specific warning. Vendors override
125
+ * `warnings`/`recommendedTools` for full control.
126
+ */
127
+ declare function buildAgentInstructions(input: BuildAgentInstructionsInput): AgentInstructions;
128
+
129
+ export { type AgentInstructions as A, type BuildAgentInstructionsInput as B, type CompatibleClients as C, type HowToPayBlock as H, type RailKey as R, type BuildHowToPayInput as a, type HowToPayRailEntry as b, compatibleClientsByRails as c, type HowToPayStripeEntry as d, buildAgentInstructions as e, buildHowToPay as f };
@@ -1,3 +1,5 @@
1
+ import { A as AgentInstructions } from '../agent_instructions-d3UWTdam.mjs';
2
+ export { B as BuildAgentInstructionsInput, a as BuildHowToPayInput, C as CompatibleClients, H as HowToPayBlock, b as HowToPayRailEntry, d as HowToPayStripeEntry, R as RailKey, e as buildAgentInstructions, f as buildHowToPay, c as compatibleClientsByRails } from '../agent_instructions-d3UWTdam.mjs';
1
3
  import { AgentMemoryHint } from '../core.mjs';
2
4
  export { buildAgentMemoryHint } from '../core.mjs';
3
5
  import { P as PaymentRequiredHeaderInput } from '../wwwauthenticate-CU1eNvMQ.mjs';
@@ -95,115 +97,6 @@ interface IdentityMetadataBlock {
95
97
  */
96
98
  declare function buildIdentityMetadata(input: IdentityMetadataInput): IdentityMetadataBlock;
97
99
 
98
- interface HowToPayRailEntry {
99
- setup?: string[];
100
- prerequisite?: string;
101
- command: string;
102
- alternative_command?: string;
103
- what_it_does: string;
104
- }
105
- interface HowToPayStripeEntry {
106
- prerequisite: string;
107
- instructions: string;
108
- setup_link_cli?: string[];
109
- command_link_cli?: string[];
110
- what_it_does_link_cli?: string;
111
- note?: string;
112
- }
113
- interface HowToPayBlock {
114
- tempo?: HowToPayRailEntry;
115
- x402_base?: HowToPayRailEntry;
116
- x402_solana?: HowToPayRailEntry;
117
- stripe?: HowToPayStripeEntry;
118
- }
119
- interface BuildHowToPayInput {
120
- /** The merchant's full URL (e.g., 'https://agents.merchant.example/api/buy'). */
121
- url: string;
122
- /** JSON string of the body the agent should retry with — typically the original request body. */
123
- retryBodyJson: string;
124
- /** Total amount in USD (string or number). Used to compute max-spend defaults and stripe context. */
125
- totalUsd: string | number;
126
- /** Per-rail config — each is optional. Pass only the rails you support. */
127
- rails: {
128
- tempo?: {
129
- recipient: string;
130
- networkName?: string;
131
- chainId?: number;
132
- recommend?: 'tempo' | 'agentscore-pay' | 'both';
133
- };
134
- x402_base?: {
135
- recipient: string;
136
- network?: string;
137
- };
138
- x402_solana?: {
139
- recipient: string;
140
- network?: string;
141
- };
142
- stripe?: {
143
- profileId?: string | null;
144
- productName?: string;
145
- };
146
- };
147
- /** Placeholder text for the operator token in commands. Defaults to '<your_opc_token>'. */
148
- opTokenPlaceholder?: string;
149
- /** Override max-spend value used in commands. Default: ceil(totalUsd) + 1. */
150
- maxSpend?: string | number;
151
- }
152
- /**
153
- * Build the agent_instructions.how_to_pay block. Generates per-rail setup/command/what_it_does
154
- * boilerplate so agents see concrete commands per rail in the 402 body. Vendors pass the rails
155
- * they support; the helper produces the right command for each.
156
- *
157
- * Tool recommendations (tempo CLI vs agentscore-pay vs link-cli) are configurable per rail.
158
- */
159
- declare function buildHowToPay(input: BuildHowToPayInput): HowToPayBlock;
160
-
161
- /** Map of rail key (e.g. 'x402_base', 'tempo_mpp', 'stripe') → list of client identifiers
162
- * that have been smoke-verified by the merchant against the protocol shape they emit.
163
- * Strings are display labels, not install commands — agents already get install commands
164
- * via `how_to_pay.<rail>.setup`. Use these as a "what's known to work" hint. */
165
- type CompatibleClients = Record<string, string[]>;
166
- interface BuildAgentInstructionsInput {
167
- /** Per-rail commands. Build with `buildHowToPay`. */
168
- howToPay: HowToPayBlock;
169
- /** Tool recommendations as human-readable strings. Defaults to a sensible set covering tempo + agentscore-pay. */
170
- recommendedTools?: string[];
171
- /** Wallet-stack compatibility note for the agent. Default: rail-neutral, no specific wallet stack required. */
172
- walletCompatibility?: string;
173
- /** How long the merchant will wait for payment after the 402. Default 300 (5 minutes). */
174
- timeoutSeconds?: number;
175
- /** Warnings about common footguns. Defaults include tempo wallet transfer + raw on-chain x402 deposits. */
176
- warnings?: string[];
177
- /** Recommended rail (e.g., 'tempo', 'x402_base'). Surfaced for agents to default to. */
178
- recommended?: string;
179
- /** Per-rail list of client names the merchant has verified work end-to-end. Vendors set
180
- * this from their own smoke matrix — defaults to none (avoids vouching for clients the
181
- * merchant has not tested). When omitted, the field is not emitted. */
182
- compatibleClients?: CompatibleClients;
183
- /** Arbitrary additional fields the vendor wants merged into the agent_instructions object. */
184
- extra?: Record<string, unknown>;
185
- }
186
- interface AgentInstructions {
187
- how_to_pay: HowToPayBlock;
188
- recommended_tools: string[];
189
- wallet_compatibility: string;
190
- timeout_seconds: number;
191
- warnings: string[];
192
- recommended?: string;
193
- compatible_clients?: CompatibleClients;
194
- [key: string]: unknown;
195
- }
196
- /**
197
- * Build the agent_instructions object for the 402 body. Combines how_to_pay with
198
- * recommended tools, warnings, wallet-compatibility note, and timeout.
199
- *
200
- * Defaults adapt to the rails declared in `howToPay`: only tempo-relevant warnings/tools
201
- * appear if `howToPay.tempo` is set, only x402-relevant ones if `x402_base`/`x402_solana`
202
- * are set. Stripe-only merchants get neither rail-specific warning. Vendors override
203
- * `warnings`/`recommendedTools` for full control.
204
- */
205
- declare function buildAgentInstructions(input: BuildAgentInstructionsInput): AgentInstructions;
206
-
207
100
  /**
208
101
  * Helpers for emitting the cross-merchant `agent_memory` hint on merchant 402 responses.
209
102
  *
@@ -520,4 +413,4 @@ interface ValidationErrorBody {
520
413
  */
521
414
  declare function buildValidationError(input: BuildValidationErrorInput): ValidationErrorBody;
522
415
 
523
- export { type AcceptedMethodEntry, type AgentInstructions, AgentMemoryHint, type Build402BodyInput, type BuildAcceptedMethodsInput, type BuildAgentInstructionsInput, type BuildHowToPayInput, type BuildPricingBlockInput, type BuildValidationErrorInput, type CompatibleClients, type FirstEncounterAgentMemoryInput, type HowToPayBlock, type HowToPayRailEntry, type HowToPayStripeEntry, type IdentityMetadataBlock, type IdentityMetadataInput, type IdentityMode, type OrderReceipt, type PricingBlock, type Respond402Input, type SignerMatchResultLike, type StripeMethodEntry, type TempoMethodEntry, type ValidationErrorBody, type X402MethodEntry, build402Body, buildAcceptedMethods, buildAgentInstructions, buildHowToPay, buildIdentityMetadata, buildPricingBlock, buildValidationError, firstEncounterAgentMemory, respond402 };
416
+ export { type AcceptedMethodEntry, AgentInstructions, AgentMemoryHint, type Build402BodyInput, type BuildAcceptedMethodsInput, type BuildPricingBlockInput, type BuildValidationErrorInput, type FirstEncounterAgentMemoryInput, type IdentityMetadataBlock, type IdentityMetadataInput, type IdentityMode, type OrderReceipt, type PricingBlock, type Respond402Input, type SignerMatchResultLike, type StripeMethodEntry, type TempoMethodEntry, type ValidationErrorBody, type X402MethodEntry, build402Body, buildAcceptedMethods, buildIdentityMetadata, buildPricingBlock, buildValidationError, firstEncounterAgentMemory, respond402 };
@@ -1,3 +1,5 @@
1
+ import { A as AgentInstructions } from '../agent_instructions-d3UWTdam.js';
2
+ export { B as BuildAgentInstructionsInput, a as BuildHowToPayInput, C as CompatibleClients, H as HowToPayBlock, b as HowToPayRailEntry, d as HowToPayStripeEntry, R as RailKey, e as buildAgentInstructions, f as buildHowToPay, c as compatibleClientsByRails } from '../agent_instructions-d3UWTdam.js';
1
3
  import { AgentMemoryHint } from '../core.js';
2
4
  export { buildAgentMemoryHint } from '../core.js';
3
5
  import { P as PaymentRequiredHeaderInput } from '../wwwauthenticate-CU1eNvMQ.js';
@@ -95,115 +97,6 @@ interface IdentityMetadataBlock {
95
97
  */
96
98
  declare function buildIdentityMetadata(input: IdentityMetadataInput): IdentityMetadataBlock;
97
99
 
98
- interface HowToPayRailEntry {
99
- setup?: string[];
100
- prerequisite?: string;
101
- command: string;
102
- alternative_command?: string;
103
- what_it_does: string;
104
- }
105
- interface HowToPayStripeEntry {
106
- prerequisite: string;
107
- instructions: string;
108
- setup_link_cli?: string[];
109
- command_link_cli?: string[];
110
- what_it_does_link_cli?: string;
111
- note?: string;
112
- }
113
- interface HowToPayBlock {
114
- tempo?: HowToPayRailEntry;
115
- x402_base?: HowToPayRailEntry;
116
- x402_solana?: HowToPayRailEntry;
117
- stripe?: HowToPayStripeEntry;
118
- }
119
- interface BuildHowToPayInput {
120
- /** The merchant's full URL (e.g., 'https://agents.merchant.example/api/buy'). */
121
- url: string;
122
- /** JSON string of the body the agent should retry with — typically the original request body. */
123
- retryBodyJson: string;
124
- /** Total amount in USD (string or number). Used to compute max-spend defaults and stripe context. */
125
- totalUsd: string | number;
126
- /** Per-rail config — each is optional. Pass only the rails you support. */
127
- rails: {
128
- tempo?: {
129
- recipient: string;
130
- networkName?: string;
131
- chainId?: number;
132
- recommend?: 'tempo' | 'agentscore-pay' | 'both';
133
- };
134
- x402_base?: {
135
- recipient: string;
136
- network?: string;
137
- };
138
- x402_solana?: {
139
- recipient: string;
140
- network?: string;
141
- };
142
- stripe?: {
143
- profileId?: string | null;
144
- productName?: string;
145
- };
146
- };
147
- /** Placeholder text for the operator token in commands. Defaults to '<your_opc_token>'. */
148
- opTokenPlaceholder?: string;
149
- /** Override max-spend value used in commands. Default: ceil(totalUsd) + 1. */
150
- maxSpend?: string | number;
151
- }
152
- /**
153
- * Build the agent_instructions.how_to_pay block. Generates per-rail setup/command/what_it_does
154
- * boilerplate so agents see concrete commands per rail in the 402 body. Vendors pass the rails
155
- * they support; the helper produces the right command for each.
156
- *
157
- * Tool recommendations (tempo CLI vs agentscore-pay vs link-cli) are configurable per rail.
158
- */
159
- declare function buildHowToPay(input: BuildHowToPayInput): HowToPayBlock;
160
-
161
- /** Map of rail key (e.g. 'x402_base', 'tempo_mpp', 'stripe') → list of client identifiers
162
- * that have been smoke-verified by the merchant against the protocol shape they emit.
163
- * Strings are display labels, not install commands — agents already get install commands
164
- * via `how_to_pay.<rail>.setup`. Use these as a "what's known to work" hint. */
165
- type CompatibleClients = Record<string, string[]>;
166
- interface BuildAgentInstructionsInput {
167
- /** Per-rail commands. Build with `buildHowToPay`. */
168
- howToPay: HowToPayBlock;
169
- /** Tool recommendations as human-readable strings. Defaults to a sensible set covering tempo + agentscore-pay. */
170
- recommendedTools?: string[];
171
- /** Wallet-stack compatibility note for the agent. Default: rail-neutral, no specific wallet stack required. */
172
- walletCompatibility?: string;
173
- /** How long the merchant will wait for payment after the 402. Default 300 (5 minutes). */
174
- timeoutSeconds?: number;
175
- /** Warnings about common footguns. Defaults include tempo wallet transfer + raw on-chain x402 deposits. */
176
- warnings?: string[];
177
- /** Recommended rail (e.g., 'tempo', 'x402_base'). Surfaced for agents to default to. */
178
- recommended?: string;
179
- /** Per-rail list of client names the merchant has verified work end-to-end. Vendors set
180
- * this from their own smoke matrix — defaults to none (avoids vouching for clients the
181
- * merchant has not tested). When omitted, the field is not emitted. */
182
- compatibleClients?: CompatibleClients;
183
- /** Arbitrary additional fields the vendor wants merged into the agent_instructions object. */
184
- extra?: Record<string, unknown>;
185
- }
186
- interface AgentInstructions {
187
- how_to_pay: HowToPayBlock;
188
- recommended_tools: string[];
189
- wallet_compatibility: string;
190
- timeout_seconds: number;
191
- warnings: string[];
192
- recommended?: string;
193
- compatible_clients?: CompatibleClients;
194
- [key: string]: unknown;
195
- }
196
- /**
197
- * Build the agent_instructions object for the 402 body. Combines how_to_pay with
198
- * recommended tools, warnings, wallet-compatibility note, and timeout.
199
- *
200
- * Defaults adapt to the rails declared in `howToPay`: only tempo-relevant warnings/tools
201
- * appear if `howToPay.tempo` is set, only x402-relevant ones if `x402_base`/`x402_solana`
202
- * are set. Stripe-only merchants get neither rail-specific warning. Vendors override
203
- * `warnings`/`recommendedTools` for full control.
204
- */
205
- declare function buildAgentInstructions(input: BuildAgentInstructionsInput): AgentInstructions;
206
-
207
100
  /**
208
101
  * Helpers for emitting the cross-merchant `agent_memory` hint on merchant 402 responses.
209
102
  *
@@ -520,4 +413,4 @@ interface ValidationErrorBody {
520
413
  */
521
414
  declare function buildValidationError(input: BuildValidationErrorInput): ValidationErrorBody;
522
415
 
523
- export { type AcceptedMethodEntry, type AgentInstructions, AgentMemoryHint, type Build402BodyInput, type BuildAcceptedMethodsInput, type BuildAgentInstructionsInput, type BuildHowToPayInput, type BuildPricingBlockInput, type BuildValidationErrorInput, type CompatibleClients, type FirstEncounterAgentMemoryInput, type HowToPayBlock, type HowToPayRailEntry, type HowToPayStripeEntry, type IdentityMetadataBlock, type IdentityMetadataInput, type IdentityMode, type OrderReceipt, type PricingBlock, type Respond402Input, type SignerMatchResultLike, type StripeMethodEntry, type TempoMethodEntry, type ValidationErrorBody, type X402MethodEntry, build402Body, buildAcceptedMethods, buildAgentInstructions, buildHowToPay, buildIdentityMetadata, buildPricingBlock, buildValidationError, firstEncounterAgentMemory, respond402 };
416
+ export { type AcceptedMethodEntry, AgentInstructions, AgentMemoryHint, type Build402BodyInput, type BuildAcceptedMethodsInput, type BuildPricingBlockInput, type BuildValidationErrorInput, type FirstEncounterAgentMemoryInput, type IdentityMetadataBlock, type IdentityMetadataInput, type IdentityMode, type OrderReceipt, type PricingBlock, type Respond402Input, type SignerMatchResultLike, type StripeMethodEntry, type TempoMethodEntry, type ValidationErrorBody, type X402MethodEntry, build402Body, buildAcceptedMethods, buildIdentityMetadata, buildPricingBlock, buildValidationError, firstEncounterAgentMemory, respond402 };
@@ -28,6 +28,7 @@ __export(challenge_exports, {
28
28
  buildIdentityMetadata: () => buildIdentityMetadata,
29
29
  buildPricingBlock: () => buildPricingBlock,
30
30
  buildValidationError: () => buildValidationError,
31
+ compatibleClientsByRails: () => compatibleClientsByRails,
31
32
  firstEncounterAgentMemory: () => firstEncounterAgentMemory,
32
33
  respond402: () => respond402
33
34
  });
@@ -193,14 +194,25 @@ function defaultWarnings(howToPay) {
193
194
  if (howToPay.x402_base || howToPay.x402_solana) w.push(X402_WARNING);
194
195
  return w;
195
196
  }
196
- function defaultCompatibleClients(howToPay) {
197
+ var RAIL_CLIENTS = {
198
+ tempo_mpp: ["agentscore-pay", "tempo request", "x402-proxy"],
199
+ x402_base: ["agentscore-pay", "x402-proxy", "purl (omit --network flag)"],
200
+ x402_solana: ["agentscore-pay"],
201
+ stripe: ["link-cli"]
202
+ };
203
+ function compatibleClientsByRails(rails) {
197
204
  const out = {};
198
- if (howToPay.tempo) out.tempo_mpp = ["agentscore-pay", "tempo request", "x402-proxy"];
199
- if (howToPay.x402_base) out.x402_base = ["agentscore-pay", "x402-proxy", "purl (omit --network flag)"];
200
- if (howToPay.x402_solana) out.x402_solana = ["agentscore-pay"];
201
- if (howToPay.stripe) out.stripe = ["link-cli"];
205
+ for (const r of rails) out[r] = [...RAIL_CLIENTS[r]];
202
206
  return Object.keys(out).length === 0 ? void 0 : out;
203
207
  }
208
+ function defaultCompatibleClients(howToPay) {
209
+ const rails = [];
210
+ if (howToPay.tempo) rails.push("tempo_mpp");
211
+ if (howToPay.x402_base) rails.push("x402_base");
212
+ if (howToPay.x402_solana) rails.push("x402_solana");
213
+ if (howToPay.stripe) rails.push("stripe");
214
+ return compatibleClientsByRails(rails);
215
+ }
204
216
  function buildAgentInstructions(input) {
205
217
  const compatibleClients = input.compatibleClients ?? defaultCompatibleClients(input.howToPay);
206
218
  return {
@@ -406,6 +418,7 @@ function buildValidationError(input) {
406
418
  buildIdentityMetadata,
407
419
  buildPricingBlock,
408
420
  buildValidationError,
421
+ compatibleClientsByRails,
409
422
  firstEncounterAgentMemory,
410
423
  respond402
411
424
  });