@agent-score/commerce 1.2.0 → 1.3.1
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 +26 -11
- 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-d3UWTdam.d.mts → agent_instructions-DiMSGkdm.d.mts} +10 -6
- package/dist/{agent_instructions-d3UWTdam.d.ts → agent_instructions-DiMSGkdm.d.ts} +10 -6
- package/dist/challenge/index.d.mts +18 -9
- package/dist/challenge/index.d.ts +18 -9
- package/dist/challenge/index.js +25 -24
- package/dist/challenge/index.js.map +1 -1
- package/dist/challenge/index.mjs +25 -24
- 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 +130 -6
- package/dist/discovery/index.d.ts +130 -6
- package/dist/discovery/index.js +75 -59
- package/dist/discovery/index.js.map +1 -1
- package/dist/discovery/index.mjs +70 -58
- 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 +158 -49
- package/dist/payment/index.d.ts +158 -49
- package/dist/payment/index.js +194 -73
- package/dist/payment/index.js.map +1 -1
- package/dist/payment/index.mjs +192 -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
package/dist/challenge/index.mjs
CHANGED
|
@@ -23,14 +23,15 @@ function buildAcceptedMethods(input) {
|
|
|
23
23
|
pay_to: input.x402_base.recipient
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
-
if (input.
|
|
26
|
+
if (input.solana_mpp) {
|
|
27
27
|
out.push({
|
|
28
|
-
method: "
|
|
29
|
-
network: input.
|
|
30
|
-
token: input.
|
|
31
|
-
symbol: input.
|
|
32
|
-
decimals: input.
|
|
33
|
-
pay_to: input.
|
|
28
|
+
method: "solana/charge",
|
|
29
|
+
network: input.solana_mpp.network ?? "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
|
|
30
|
+
token: input.solana_mpp.token ?? "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
|
|
31
|
+
symbol: input.solana_mpp.symbol ?? "USDC",
|
|
32
|
+
decimals: input.solana_mpp.decimals ?? 6,
|
|
33
|
+
pay_to: input.solana_mpp.recipient,
|
|
34
|
+
...input.solana_mpp.feePayerKey ? { fee_payer_key: input.solana_mpp.feePayerKey } : {}
|
|
34
35
|
});
|
|
35
36
|
}
|
|
36
37
|
if (input.stripe) {
|
|
@@ -90,7 +91,7 @@ function buildHowToPay(input) {
|
|
|
90
91
|
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.`,
|
|
91
92
|
command: recommend === "agentscore-pay" ? payCommand : tempoCommand,
|
|
92
93
|
...recommend === "both" ? { alternative_command: payCommand } : recommend === "agentscore-pay" ? { alternative_command: tempoCommand } : {},
|
|
93
|
-
what_it_does: `
|
|
94
|
+
what_it_does: `Pays via Tempo USDC on ${networkName}.`
|
|
94
95
|
};
|
|
95
96
|
}
|
|
96
97
|
if (input.rails.x402_base) {
|
|
@@ -99,16 +100,16 @@ function buildHowToPay(input) {
|
|
|
99
100
|
setup: PAY_SETUP_BASE,
|
|
100
101
|
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.`,
|
|
101
102
|
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}`,
|
|
102
|
-
what_it_does: "
|
|
103
|
+
what_it_does: "Pays via USDC on Base."
|
|
103
104
|
};
|
|
104
105
|
}
|
|
105
|
-
if (input.rails.
|
|
106
|
-
const network = input.rails.
|
|
107
|
-
block.
|
|
106
|
+
if (input.rails.solana_mpp) {
|
|
107
|
+
const network = input.rails.solana_mpp.network ?? "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
|
108
|
+
block.solana_mpp = {
|
|
108
109
|
setup: PAY_SETUP_SOLANA,
|
|
109
110
|
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.`,
|
|
110
111
|
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}`,
|
|
111
|
-
what_it_does: "
|
|
112
|
+
what_it_does: "Pays via USDC on Solana."
|
|
112
113
|
};
|
|
113
114
|
}
|
|
114
115
|
if (input.rails.stripe) {
|
|
@@ -131,7 +132,7 @@ function buildHowToPay(input) {
|
|
|
131
132
|
`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)`,
|
|
132
133
|
`link-cli mpp pay ${input.url} --spend-request-id $SPEND_ID --method POST --data '${input.retryBodyJson}' --header 'X-Operator-Token: ${opToken}' --output-json`
|
|
133
134
|
];
|
|
134
|
-
stripe.what_it_does_link_cli = "
|
|
135
|
+
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.";
|
|
135
136
|
} else if (linkCliBlocked) {
|
|
136
137
|
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.`;
|
|
137
138
|
}
|
|
@@ -141,27 +142,27 @@ function buildHowToPay(input) {
|
|
|
141
142
|
}
|
|
142
143
|
|
|
143
144
|
// src/challenge/agent_instructions.ts
|
|
144
|
-
var TEMPO_WARNING = "Do NOT use `tempo wallet transfer
|
|
145
|
-
var X402_WARNING = "Do NOT send USDC manually to the
|
|
146
|
-
var TEMPO_TOOL = "`tempo request` for Tempo USDC
|
|
147
|
-
var AGENTSCORE_PAY_TOOL = "`agentscore-pay`
|
|
148
|
-
var DEFAULT_WALLET_COMPATIBILITY = "
|
|
145
|
+
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.";
|
|
146
|
+
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.";
|
|
147
|
+
var TEMPO_TOOL = "`tempo request` for Tempo USDC";
|
|
148
|
+
var AGENTSCORE_PAY_TOOL = "`agentscore-pay` \u2014 Base + Solana + Tempo from one CLI";
|
|
149
|
+
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.";
|
|
149
150
|
function defaultRecommendedTools(howToPay) {
|
|
150
151
|
const tools = [];
|
|
151
152
|
if (howToPay.tempo) tools.push(TEMPO_TOOL);
|
|
152
|
-
if (howToPay.tempo || howToPay.x402_base || howToPay.
|
|
153
|
+
if (howToPay.tempo || howToPay.x402_base || howToPay.solana_mpp) tools.push(AGENTSCORE_PAY_TOOL);
|
|
153
154
|
return tools;
|
|
154
155
|
}
|
|
155
156
|
function defaultWarnings(howToPay) {
|
|
156
157
|
const w = [];
|
|
157
158
|
if (howToPay.tempo) w.push(TEMPO_WARNING);
|
|
158
|
-
if (howToPay.x402_base
|
|
159
|
+
if (howToPay.x402_base) w.push(X402_WARNING);
|
|
159
160
|
return w;
|
|
160
161
|
}
|
|
161
162
|
var RAIL_CLIENTS = {
|
|
162
163
|
tempo_mpp: ["agentscore-pay", "tempo request", "x402-proxy"],
|
|
163
164
|
x402_base: ["agentscore-pay", "x402-proxy", "purl (omit --network flag)"],
|
|
164
|
-
|
|
165
|
+
solana_mpp: ["agentscore-pay"],
|
|
165
166
|
stripe: ["link-cli"]
|
|
166
167
|
};
|
|
167
168
|
function compatibleClientsByRails(rails) {
|
|
@@ -173,7 +174,7 @@ function defaultCompatibleClients(howToPay) {
|
|
|
173
174
|
const rails = [];
|
|
174
175
|
if (howToPay.tempo) rails.push("tempo_mpp");
|
|
175
176
|
if (howToPay.x402_base) rails.push("x402_base");
|
|
176
|
-
if (howToPay.
|
|
177
|
+
if (howToPay.solana_mpp) rails.push("solana_mpp");
|
|
177
178
|
if (howToPay.stripe) rails.push("stripe");
|
|
178
179
|
return compatibleClientsByRails(rails);
|
|
179
180
|
}
|
|
@@ -184,7 +185,7 @@ function buildAgentInstructions(input) {
|
|
|
184
185
|
recommended_tools: input.recommendedTools ?? defaultRecommendedTools(input.howToPay),
|
|
185
186
|
wallet_compatibility: input.walletCompatibility ?? DEFAULT_WALLET_COMPATIBILITY,
|
|
186
187
|
timeout_seconds: input.timeoutSeconds ?? 300,
|
|
187
|
-
warnings: input.warnings ?? defaultWarnings(input.howToPay),
|
|
188
|
+
warnings: input.warnings ?? [...defaultWarnings(input.howToPay), ...input.extraWarnings ?? []],
|
|
188
189
|
...input.recommended ? { recommended: input.recommended } : {},
|
|
189
190
|
...compatibleClients ? { compatible_clients: compatibleClients } : {},
|
|
190
191
|
...input.extra ?? {}
|