@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,5 @@
|
|
|
1
|
+
import { A as AgentInstructions } from '../agent_instructions-DiMSGkdm.js';
|
|
2
|
+
export { B as BuildAgentInstructionsInput, a as BuildHowToPayInput, C as CompatibleClients, H as HowToPayBlock, b as HowToPayRailEntry, c as HowToPayStripeEntry, R as RailKey, d as buildAgentInstructions, e as buildHowToPay, f as compatibleClientsByRails } from '../agent_instructions-DiMSGkdm.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';
|
|
@@ -20,12 +22,21 @@ interface X402MethodEntry {
|
|
|
20
22
|
decimals: number;
|
|
21
23
|
pay_to: string;
|
|
22
24
|
}
|
|
25
|
+
interface SolanaMppMethodEntry {
|
|
26
|
+
method: 'solana/charge';
|
|
27
|
+
network: string;
|
|
28
|
+
token: string;
|
|
29
|
+
symbol: string;
|
|
30
|
+
decimals: number;
|
|
31
|
+
pay_to: string;
|
|
32
|
+
fee_payer_key?: string;
|
|
33
|
+
}
|
|
23
34
|
interface StripeMethodEntry {
|
|
24
35
|
method: 'stripe/charge';
|
|
25
36
|
rails: ('card' | 'link' | 'shared_payment_token')[];
|
|
26
37
|
profile_id: string | null;
|
|
27
38
|
}
|
|
28
|
-
type AcceptedMethodEntry = TempoMethodEntry | X402MethodEntry | StripeMethodEntry;
|
|
39
|
+
type AcceptedMethodEntry = TempoMethodEntry | X402MethodEntry | SolanaMppMethodEntry | StripeMethodEntry;
|
|
29
40
|
interface BuildAcceptedMethodsInput {
|
|
30
41
|
tempo?: {
|
|
31
42
|
recipient: string;
|
|
@@ -43,12 +54,13 @@ interface BuildAcceptedMethodsInput {
|
|
|
43
54
|
symbol?: string;
|
|
44
55
|
decimals?: number;
|
|
45
56
|
};
|
|
46
|
-
|
|
57
|
+
solana_mpp?: {
|
|
47
58
|
recipient: string;
|
|
48
59
|
network?: string;
|
|
49
60
|
token?: string;
|
|
50
61
|
symbol?: string;
|
|
51
62
|
decimals?: number;
|
|
63
|
+
feePayerKey?: string;
|
|
52
64
|
};
|
|
53
65
|
stripe?: {
|
|
54
66
|
profileId?: string | null;
|
|
@@ -95,115 +107,6 @@ interface IdentityMetadataBlock {
|
|
|
95
107
|
*/
|
|
96
108
|
declare function buildIdentityMetadata(input: IdentityMetadataInput): IdentityMetadataBlock;
|
|
97
109
|
|
|
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
110
|
/**
|
|
208
111
|
* Helpers for emitting the cross-merchant `agent_memory` hint on merchant 402 responses.
|
|
209
112
|
*
|
|
@@ -366,10 +269,9 @@ declare function build402Body(input: Build402BodyInput): Record<string, unknown>
|
|
|
366
269
|
/**
|
|
367
270
|
* Canonical order-receipt shape returned to agents on the 200 after a successful settlement.
|
|
368
271
|
*
|
|
369
|
-
* Merchants own their order schema, but converging on this shape across
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
* care about, and ignore (or extend via `extras`) what you don't.
|
|
272
|
+
* Merchants own their order schema, but converging on this shape across AgentScore-gated
|
|
273
|
+
* merchants means agents can render and post-process orders consistently. Lift this type,
|
|
274
|
+
* fill the fields you care about, and ignore (or extend via `extras`) what you don't.
|
|
373
275
|
*
|
|
374
276
|
* All money fields are dollar-strings (e.g. `"250.00"`). Use `buildPricingBlock` from
|
|
375
277
|
* `@agent-score/commerce/challenge` to compose the pricing fields from cents.
|
|
@@ -520,4 +422,4 @@ interface ValidationErrorBody {
|
|
|
520
422
|
*/
|
|
521
423
|
declare function buildValidationError(input: BuildValidationErrorInput): ValidationErrorBody;
|
|
522
424
|
|
|
523
|
-
export { type AcceptedMethodEntry,
|
|
425
|
+
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 SolanaMppMethodEntry, type StripeMethodEntry, type TempoMethodEntry, type ValidationErrorBody, type X402MethodEntry, build402Body, buildAcceptedMethods, buildIdentityMetadata, buildPricingBlock, buildValidationError, firstEncounterAgentMemory, respond402 };
|
package/dist/challenge/index.js
CHANGED
|
@@ -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
|
});
|
|
@@ -58,14 +59,15 @@ function buildAcceptedMethods(input) {
|
|
|
58
59
|
pay_to: input.x402_base.recipient
|
|
59
60
|
});
|
|
60
61
|
}
|
|
61
|
-
if (input.
|
|
62
|
+
if (input.solana_mpp) {
|
|
62
63
|
out.push({
|
|
63
|
-
method: "
|
|
64
|
-
network: input.
|
|
65
|
-
token: input.
|
|
66
|
-
symbol: input.
|
|
67
|
-
decimals: input.
|
|
68
|
-
pay_to: input.
|
|
64
|
+
method: "solana/charge",
|
|
65
|
+
network: input.solana_mpp.network ?? "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
|
|
66
|
+
token: input.solana_mpp.token ?? "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
|
|
67
|
+
symbol: input.solana_mpp.symbol ?? "USDC",
|
|
68
|
+
decimals: input.solana_mpp.decimals ?? 6,
|
|
69
|
+
pay_to: input.solana_mpp.recipient,
|
|
70
|
+
...input.solana_mpp.feePayerKey ? { fee_payer_key: input.solana_mpp.feePayerKey } : {}
|
|
69
71
|
});
|
|
70
72
|
}
|
|
71
73
|
if (input.stripe) {
|
|
@@ -125,7 +127,7 @@ function buildHowToPay(input) {
|
|
|
125
127
|
prerequisite: `Run \`tempo wallet whoami\` and confirm USDC.e balance on ${networkName} (chain ${chainId}) is at least $${maxSpend}. If the tempo CLI is not installed, run the setup commands above first.`,
|
|
126
128
|
command: recommend === "agentscore-pay" ? payCommand : tempoCommand,
|
|
127
129
|
...recommend === "both" ? { alternative_command: payCommand } : recommend === "agentscore-pay" ? { alternative_command: tempoCommand } : {},
|
|
128
|
-
what_it_does: `
|
|
130
|
+
what_it_does: `Pays via Tempo USDC on ${networkName}.`
|
|
129
131
|
};
|
|
130
132
|
}
|
|
131
133
|
if (input.rails.x402_base) {
|
|
@@ -134,16 +136,16 @@ function buildHowToPay(input) {
|
|
|
134
136
|
setup: PAY_SETUP_BASE,
|
|
135
137
|
prerequisite: `Run \`agentscore-pay balance --chain base\` and confirm USDC balance on Base (${network}) is at least $${maxSpend}. If the CLI is not installed, run the setup commands above first.`,
|
|
136
138
|
command: `agentscore-pay pay POST ${input.url} --chain base -H 'X-Operator-Token: ${opToken}' -H 'Content-Type: application/json' -d '${input.retryBodyJson}' --max-spend ${maxSpend}`,
|
|
137
|
-
what_it_does: "
|
|
139
|
+
what_it_does: "Pays via USDC on Base."
|
|
138
140
|
};
|
|
139
141
|
}
|
|
140
|
-
if (input.rails.
|
|
141
|
-
const network = input.rails.
|
|
142
|
-
block.
|
|
142
|
+
if (input.rails.solana_mpp) {
|
|
143
|
+
const network = input.rails.solana_mpp.network ?? "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
|
144
|
+
block.solana_mpp = {
|
|
143
145
|
setup: PAY_SETUP_SOLANA,
|
|
144
146
|
prerequisite: `Run \`agentscore-pay balance --chain solana\` and confirm USDC balance on Solana (${network}) is at least $${maxSpend}. If the CLI is not installed, run the setup commands above first.`,
|
|
145
147
|
command: `agentscore-pay pay POST ${input.url} --chain solana -H 'X-Operator-Token: ${opToken}' -H 'Content-Type: application/json' -d '${input.retryBodyJson}' --max-spend ${maxSpend}`,
|
|
146
|
-
what_it_does: "
|
|
148
|
+
what_it_does: "Pays via USDC on Solana."
|
|
147
149
|
};
|
|
148
150
|
}
|
|
149
151
|
if (input.rails.stripe) {
|
|
@@ -166,7 +168,7 @@ function buildHowToPay(input) {
|
|
|
166
168
|
`SPEND_ID=$(link-cli spend-request create --payment-method-id <csmrpd_id_from_payment_methods_list> --credential-type shared_payment_token --network-id ${stripeCfg.profileId} --amount ${amountCents} --context "${sptContext}" --request-approval --output-json | jq -r .id)`,
|
|
167
169
|
`link-cli mpp pay ${input.url} --spend-request-id $SPEND_ID --method POST --data '${input.retryBodyJson}' --header 'X-Operator-Token: ${opToken}' --output-json`
|
|
168
170
|
];
|
|
169
|
-
stripe.what_it_does_link_cli = "
|
|
171
|
+
stripe.what_it_does_link_cli = "Mints a one-time-use SharedPaymentToken scoped to this purchase (user approves in Link wallet), then submits it as the payment credential.";
|
|
170
172
|
} else if (linkCliBlocked) {
|
|
171
173
|
stripe.note = `link-cli SPT path not available for this purchase \u2014 Stripe link-cli caps spend requests at $500.00 ($50000 cents); your total is $${totalNum}. Use your own Stripe account with the SharedPaymentToken API instead.`;
|
|
172
174
|
}
|
|
@@ -176,31 +178,42 @@ function buildHowToPay(input) {
|
|
|
176
178
|
}
|
|
177
179
|
|
|
178
180
|
// src/challenge/agent_instructions.ts
|
|
179
|
-
var TEMPO_WARNING = "Do NOT use `tempo wallet transfer
|
|
180
|
-
var X402_WARNING = "Do NOT send USDC manually to the
|
|
181
|
-
var TEMPO_TOOL = "`tempo request` for Tempo USDC
|
|
182
|
-
var AGENTSCORE_PAY_TOOL = "`agentscore-pay`
|
|
183
|
-
var DEFAULT_WALLET_COMPATIBILITY = "
|
|
181
|
+
var TEMPO_WARNING = "Do NOT use `tempo wallet transfer`. That moves USDC on-chain without completing the protocol handshake, so the order will not complete. Use `tempo request` instead.";
|
|
182
|
+
var X402_WARNING = "Do NOT send USDC manually to the deposit addresses. Use `agentscore-pay pay` so the credential is signed and submitted; otherwise the order will not complete even though the deposit lands.";
|
|
183
|
+
var TEMPO_TOOL = "`tempo request` for Tempo USDC";
|
|
184
|
+
var AGENTSCORE_PAY_TOOL = "`agentscore-pay` \u2014 Base + Solana + Tempo from one CLI";
|
|
185
|
+
var DEFAULT_WALLET_COMPATIBILITY = "Any client that can produce a valid MPP credential (Authorization: Payment) or x402 X-Payment header. Use the CLI commands above; sign-it-yourself is also fine.";
|
|
184
186
|
function defaultRecommendedTools(howToPay) {
|
|
185
187
|
const tools = [];
|
|
186
188
|
if (howToPay.tempo) tools.push(TEMPO_TOOL);
|
|
187
|
-
if (howToPay.tempo || howToPay.x402_base || howToPay.
|
|
189
|
+
if (howToPay.tempo || howToPay.x402_base || howToPay.solana_mpp) tools.push(AGENTSCORE_PAY_TOOL);
|
|
188
190
|
return tools;
|
|
189
191
|
}
|
|
190
192
|
function defaultWarnings(howToPay) {
|
|
191
193
|
const w = [];
|
|
192
194
|
if (howToPay.tempo) w.push(TEMPO_WARNING);
|
|
193
|
-
if (howToPay.x402_base
|
|
195
|
+
if (howToPay.x402_base) w.push(X402_WARNING);
|
|
194
196
|
return w;
|
|
195
197
|
}
|
|
196
|
-
|
|
198
|
+
var RAIL_CLIENTS = {
|
|
199
|
+
tempo_mpp: ["agentscore-pay", "tempo request", "x402-proxy"],
|
|
200
|
+
x402_base: ["agentscore-pay", "x402-proxy", "purl (omit --network flag)"],
|
|
201
|
+
solana_mpp: ["agentscore-pay"],
|
|
202
|
+
stripe: ["link-cli"]
|
|
203
|
+
};
|
|
204
|
+
function compatibleClientsByRails(rails) {
|
|
197
205
|
const out = {};
|
|
198
|
-
|
|
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"];
|
|
206
|
+
for (const r of rails) out[r] = [...RAIL_CLIENTS[r]];
|
|
202
207
|
return Object.keys(out).length === 0 ? void 0 : out;
|
|
203
208
|
}
|
|
209
|
+
function defaultCompatibleClients(howToPay) {
|
|
210
|
+
const rails = [];
|
|
211
|
+
if (howToPay.tempo) rails.push("tempo_mpp");
|
|
212
|
+
if (howToPay.x402_base) rails.push("x402_base");
|
|
213
|
+
if (howToPay.solana_mpp) rails.push("solana_mpp");
|
|
214
|
+
if (howToPay.stripe) rails.push("stripe");
|
|
215
|
+
return compatibleClientsByRails(rails);
|
|
216
|
+
}
|
|
204
217
|
function buildAgentInstructions(input) {
|
|
205
218
|
const compatibleClients = input.compatibleClients ?? defaultCompatibleClients(input.howToPay);
|
|
206
219
|
return {
|
|
@@ -208,7 +221,7 @@ function buildAgentInstructions(input) {
|
|
|
208
221
|
recommended_tools: input.recommendedTools ?? defaultRecommendedTools(input.howToPay),
|
|
209
222
|
wallet_compatibility: input.walletCompatibility ?? DEFAULT_WALLET_COMPATIBILITY,
|
|
210
223
|
timeout_seconds: input.timeoutSeconds ?? 300,
|
|
211
|
-
warnings: input.warnings ?? defaultWarnings(input.howToPay),
|
|
224
|
+
warnings: input.warnings ?? [...defaultWarnings(input.howToPay), ...input.extraWarnings ?? []],
|
|
212
225
|
...input.recommended ? { recommended: input.recommended } : {},
|
|
213
226
|
...compatibleClients ? { compatible_clients: compatibleClients } : {},
|
|
214
227
|
...input.extra ?? {}
|
|
@@ -406,6 +419,7 @@ function buildValidationError(input) {
|
|
|
406
419
|
buildIdentityMetadata,
|
|
407
420
|
buildPricingBlock,
|
|
408
421
|
buildValidationError,
|
|
422
|
+
compatibleClientsByRails,
|
|
409
423
|
firstEncounterAgentMemory,
|
|
410
424
|
respond402
|
|
411
425
|
});
|