@devlab.group/agent-commerce 2.3.0 → 2.4.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 +17 -13
- package/dist/ap2.d.ts +6 -5
- package/dist/ap2.js +3 -3
- package/dist/{authorization-CMkIuAkO.d.ts → authorization-DjAecwuW.d.ts} +1 -1
- package/dist/{chunk-XVU46YAH.js → chunk-4OEXK3YG.js} +4 -4
- package/dist/{chunk-XVU46YAH.js.map → chunk-4OEXK3YG.js.map} +1 -1
- package/dist/{chunk-4ZSE5DCH.js → chunk-6WACRJVT.js} +3 -3
- package/dist/{chunk-4ZSE5DCH.js.map → chunk-6WACRJVT.js.map} +1 -1
- package/dist/{chunk-Q5TII32R.js → chunk-AITMDXKW.js} +3 -3
- package/dist/{chunk-Q5TII32R.js.map → chunk-AITMDXKW.js.map} +1 -1
- package/dist/{chunk-TNS7U5Q4.js → chunk-WUIAUAA7.js} +200 -8
- package/dist/chunk-WUIAUAA7.js.map +1 -0
- package/dist/cli/{ap2-GINAXBFV.js → ap2-QDHPRSTF.js} +3 -3
- package/dist/cli/{ap2-GINAXBFV.js.map → ap2-QDHPRSTF.js.map} +1 -1
- package/dist/cli/{chunk-BR7CMJOE.js → chunk-AZDWFVDW.js} +200 -8
- package/dist/cli/chunk-AZDWFVDW.js.map +1 -0
- package/dist/cli/{chunk-KABFUZ6L.js → chunk-DCMW67JM.js} +4 -4
- package/dist/cli/{chunk-KABFUZ6L.js.map → chunk-DCMW67JM.js.map} +1 -1
- package/dist/cli/{chunk-55N55KL4.js → chunk-G2JEY7MB.js} +22 -6
- package/dist/cli/chunk-G2JEY7MB.js.map +1 -0
- package/dist/cli/{chunk-2LN5PO5I.js → chunk-PIMFPCNZ.js} +3 -2
- package/dist/cli/chunk-PIMFPCNZ.js.map +1 -0
- package/dist/cli/chunk-UXB65XCS.js +8 -0
- package/dist/cli/{chunk-DYHVNKRB.js.map → chunk-UXB65XCS.js.map} +1 -1
- package/dist/cli/{chunk-KTV52MCU.js → chunk-WYOGIANL.js} +3 -3
- package/dist/cli/{chunk-KTV52MCU.js.map → chunk-WYOGIANL.js.map} +1 -1
- package/dist/cli/{config-ZOFHJ5FB.js → config-UI4EDG4L.js} +5 -5
- package/dist/cli/{config-ZOFHJ5FB.js.map → config-UI4EDG4L.js.map} +1 -1
- package/dist/cli/index.js +87 -8
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/{mcp-V3BNRUWL.js → mcp-26LJMN4N.js} +3 -3
- package/dist/cli/{mcp-V3BNRUWL.js.map → mcp-26LJMN4N.js.map} +1 -1
- package/dist/cli/{provider-BTIFALIT.js → provider-Z4OJNAYI.js} +5 -5
- package/dist/cli/{provider-BTIFALIT.js.map → provider-Z4OJNAYI.js.map} +1 -1
- package/dist/cli/{run-DS2KXUTW.js → run-TEPYJUHG.js} +23 -12
- package/dist/cli/run-TEPYJUHG.js.map +1 -0
- package/dist/cli/{x402-YTKFNWVQ.js → x402-BMVONZKA.js} +6 -6
- package/dist/cli/{x402-YTKFNWVQ.js.map → x402-BMVONZKA.js.map} +1 -1
- package/dist/{constants-nackLItD.d.ts → constants-BG22tE8S.d.ts} +2 -1
- package/dist/index.d.ts +19 -11
- package/dist/index.js +32 -7
- package/dist/index.js.map +1 -1
- package/dist/mcp.d.ts +5 -4
- package/dist/mcp.js +1 -1
- package/dist/mpp.d.ts +5 -4
- package/dist/mpp.js +3 -3
- package/dist/{networks-DTWRlj-K.d.ts → networks-DDHYJLcg.d.ts} +2 -1
- package/dist/{protocol-adapter-CfxU8Z2T.d.ts → protocol-adapter-C9odYl6l.d.ts} +4 -3
- package/dist/{runtime-7vLNYvmU.d.ts → runtime-Cl_BLVZV.d.ts} +8 -1
- package/dist/{types-CVw6Sf46.d.ts → types-j7MnUXYN.d.ts} +2 -1
- package/dist/x402.d.ts +27 -18
- package/dist/x402.js +4 -4
- package/package.json +6 -6
- package/dist/chunk-TNS7U5Q4.js.map +0 -1
- package/dist/cli/chunk-2LN5PO5I.js.map +0 -1
- package/dist/cli/chunk-55N55KL4.js.map +0 -1
- package/dist/cli/chunk-BR7CMJOE.js.map +0 -1
- package/dist/cli/chunk-DYHVNKRB.js +0 -8
- package/dist/cli/index.d.ts +0 -1
- package/dist/cli/run-DS2KXUTW.js.map +0 -1
package/dist/cli/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { createSqliteReceiptStore, A2A_SPEC_VERSION, A2A_PROTOCOL_VERSION, A2A_PROTOCOL_BINDING, A2A_AGENT_CARD_PATH, A2A_UNSUPPORTED, ACP_UNSUPPORTED } from './chunk-
|
|
3
|
-
import { DEFAULT_CONFIG_FILENAME, extractPathParameterNames, ACP_SPEC_VERSION, ACP_API_VERSION, ACP_WELL_KNOWN_PATH, findUnparsedBraceToken } from './chunk-
|
|
2
|
+
import { createSqliteReceiptStore, A2A_SPEC_VERSION, A2A_PROTOCOL_VERSION, A2A_PROTOCOL_BINDING, A2A_AGENT_CARD_PATH, A2A_UNSUPPORTED, ACP_UNSUPPORTED } from './chunk-DCMW67JM.js';
|
|
3
|
+
import { DEFAULT_CONFIG_FILENAME, extractPathParameterNames, ACP_SPEC_VERSION, ACP_API_VERSION, ACP_WELL_KNOWN_PATH, findUnparsedBraceToken } from './chunk-PIMFPCNZ.js';
|
|
4
4
|
import { MPP_PROFILE, MPP_SPEC_DRAFTS, MPPX_VERSION, MPP_SPEC_COMMIT, MPP_DEFAULT_PAYMENT_FLOW } from './chunk-AA3FIEAR.js';
|
|
5
5
|
import { ANVIL_WELL_KNOWN_ACCOUNTS, describeDeploymentMode, X402_DEFAULT_PAYMENT_FLOW, findX402Network, isEvmAddress, LOCAL_CHAIN_ID, resolveDeploymentMode, sameAddress } from './chunk-OZ4LAWBK.js';
|
|
6
6
|
import { AP2_UNSUPPORTED } from './chunk-3EQBCFZY.js';
|
|
7
7
|
import './chunk-3MGAJ5FX.js';
|
|
8
8
|
import { AP2_SPEC_VERSION, AP2_CHECKOUT_MANDATE_VCT, AP2_CHECKOUT_PROFILE } from './chunk-FHCFR2GS.js';
|
|
9
9
|
import { MCP_TOOL_NAME_MAX_LENGTH, MCP_TOOL_NAME_CHARS } from './chunk-TPC4EJLT.js';
|
|
10
|
-
import { PACKAGE_VERSION } from './chunk-
|
|
10
|
+
import { PACKAGE_VERSION } from './chunk-UXB65XCS.js';
|
|
11
11
|
import { PROTOCOL_NAMES, isCommerceError, CommerceError } from './chunk-QQ3WY5L3.js';
|
|
12
12
|
import { isRecord } from './chunk-3M6U7ILB.js';
|
|
13
13
|
import { CommanderError, Command } from 'commander';
|
|
@@ -78,7 +78,7 @@ async function execCommand(command, args) {
|
|
|
78
78
|
// src/cli/lib/config-client.ts
|
|
79
79
|
async function importConfig() {
|
|
80
80
|
try {
|
|
81
|
-
return await import('./config-
|
|
81
|
+
return await import('./config-UI4EDG4L.js');
|
|
82
82
|
} catch (err) {
|
|
83
83
|
throw new CommerceError(
|
|
84
84
|
"INTERNAL_ERROR",
|
|
@@ -219,7 +219,7 @@ var package_default = {
|
|
|
219
219
|
"ajv-formats": "3.0.1",
|
|
220
220
|
"better-sqlite3": "13.0.3",
|
|
221
221
|
commander: "15.0.0",
|
|
222
|
-
fastify: "5.12.
|
|
222
|
+
fastify: "5.12.7",
|
|
223
223
|
picocolors: "1.1.1",
|
|
224
224
|
pino: "10.3.1",
|
|
225
225
|
yaml: "2.9.0",
|
|
@@ -710,7 +710,75 @@ function offerHealthCheck(live, named) {
|
|
|
710
710
|
detail: `${problems.join("; ")}. The gateway logs each reason at debug level`
|
|
711
711
|
};
|
|
712
712
|
}
|
|
713
|
-
function
|
|
713
|
+
function extractLiveQuote(body) {
|
|
714
|
+
const payments = body?.["payments"];
|
|
715
|
+
const x402 = isRecord(payments) ? payments["x402"] : void 0;
|
|
716
|
+
const quote = isRecord(x402) ? x402["quote"] : void 0;
|
|
717
|
+
if (quote === void 0) return void 0;
|
|
718
|
+
if (!isRecord(quote)) return "unreadable";
|
|
719
|
+
const { issuer, requestScheme, extension } = quote;
|
|
720
|
+
return typeof issuer === "string" && typeof requestScheme === "string" && typeof extension === "string" ? { issuer, requestScheme, extension } : "unreadable";
|
|
721
|
+
}
|
|
722
|
+
async function localQuoteIssuer(signerPrivateKey, loadAccounts) {
|
|
723
|
+
let accounts;
|
|
724
|
+
try {
|
|
725
|
+
accounts = await loadAccounts();
|
|
726
|
+
} catch {
|
|
727
|
+
return void 0;
|
|
728
|
+
}
|
|
729
|
+
try {
|
|
730
|
+
return accounts.privateKeyToAccount(signerPrivateKey).address;
|
|
731
|
+
} catch {
|
|
732
|
+
return "invalid";
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
function quoteCheck(enabled, local, live, body, gatewayUrl, stale) {
|
|
736
|
+
const name = "Payments (quotes)";
|
|
737
|
+
if (enabled && local === "invalid") {
|
|
738
|
+
return {
|
|
739
|
+
name,
|
|
740
|
+
status: "FAIL",
|
|
741
|
+
detail: 'quote.signerPrivateKey is not a valid private key (expected "0x" followed by 64 hex characters), so start refuses it'
|
|
742
|
+
};
|
|
743
|
+
}
|
|
744
|
+
const localIssuer = local === void 0 ? void 0 : maskMiddle(local);
|
|
745
|
+
const quote = live === void 0 || live === "disabled" ? "unreadable" : extractLiveQuote(body);
|
|
746
|
+
if (quote === "unreadable") {
|
|
747
|
+
return enabled ? {
|
|
748
|
+
name,
|
|
749
|
+
status: "INFO",
|
|
750
|
+
detail: `ERC-8409 quotes enabled (experimental)${localIssuer !== void 0 ? `, issuer=${localIssuer} from the local key` : ""}; the gateway's issuer could not be read`
|
|
751
|
+
} : void 0;
|
|
752
|
+
}
|
|
753
|
+
if (quote === void 0) {
|
|
754
|
+
return enabled ? {
|
|
755
|
+
name,
|
|
756
|
+
status: "FAIL",
|
|
757
|
+
detail: `Local config enables ERC-8409 quotes, but the gateway at ${gatewayUrl} publishes no quote issuer${stale}`
|
|
758
|
+
} : void 0;
|
|
759
|
+
}
|
|
760
|
+
const issuer = maskMiddle(quote.issuer);
|
|
761
|
+
if (!enabled) {
|
|
762
|
+
return {
|
|
763
|
+
name,
|
|
764
|
+
status: "FAIL",
|
|
765
|
+
detail: `The gateway at ${gatewayUrl} signs ERC-8409 quotes as ${issuer}, but local config does not enable them${stale}`
|
|
766
|
+
};
|
|
767
|
+
}
|
|
768
|
+
if (local !== void 0 && local.toLowerCase() !== quote.issuer.toLowerCase()) {
|
|
769
|
+
return {
|
|
770
|
+
name,
|
|
771
|
+
status: "FAIL",
|
|
772
|
+
detail: `The gateway at ${gatewayUrl} signs ERC-8409 quotes as ${issuer}, but quote.signerPrivateKey belongs to ${localIssuer}${stale}`
|
|
773
|
+
};
|
|
774
|
+
}
|
|
775
|
+
return {
|
|
776
|
+
name,
|
|
777
|
+
status: "PASS",
|
|
778
|
+
detail: `ERC-8409 quotes (experimental) - issuer=${issuer}${local === void 0 ? " as the gateway publishes it (viem could not be loaded to check it against the local key)" : ""}, requestScheme=${quote.requestScheme}, extension=${quote.extension}`
|
|
779
|
+
};
|
|
780
|
+
}
|
|
781
|
+
async function paymentChecks(config, wellKnown, gatewayUrl, chainDeploy = false, loadAccounts = () => import('viem/accounts')) {
|
|
714
782
|
const checks = [];
|
|
715
783
|
const stale = `; the gateway may be running against an older deployment - restart it${chainDeploy ? " or re-run chain:deploy" : ""}`;
|
|
716
784
|
const x402 = config?.payments.x402;
|
|
@@ -765,6 +833,15 @@ function paymentChecks(config, wellKnown, gatewayUrl, chainDeploy = false) {
|
|
|
765
833
|
const offerHealth = offerHealthCheck(live, named);
|
|
766
834
|
if (offerHealth !== void 0) checks.push(offerHealth);
|
|
767
835
|
}
|
|
836
|
+
const quotes = quoteCheck(
|
|
837
|
+
x402.quote !== void 0,
|
|
838
|
+
x402.quote !== void 0 ? await localQuoteIssuer(x402.quote.signerPrivateKey, loadAccounts) : void 0,
|
|
839
|
+
live,
|
|
840
|
+
wellKnown?.ok ? wellKnown.body : void 0,
|
|
841
|
+
gatewayUrl,
|
|
842
|
+
stale
|
|
843
|
+
);
|
|
844
|
+
if (quotes !== void 0) checks.push(quotes);
|
|
768
845
|
if (mode === "mainnet") {
|
|
769
846
|
checks.push(
|
|
770
847
|
mainnetSafetyCheck("Mainnet safety", "payTo", x402.facilitator, [
|
|
@@ -1032,7 +1109,9 @@ async function runDoctor(options, deps = {}) {
|
|
|
1032
1109
|
) : void 0;
|
|
1033
1110
|
checks.push(...protocolChecks(config, wellKnown));
|
|
1034
1111
|
checks.push(...ap2Checks(config));
|
|
1035
|
-
checks.push(
|
|
1112
|
+
checks.push(
|
|
1113
|
+
...await paymentChecks(config, wellKnown, gatewayUrl, chainDeploy, deps.loadViemAccounts)
|
|
1114
|
+
);
|
|
1036
1115
|
checks.push(...await storageChecks(config, createStore));
|
|
1037
1116
|
if (wellKnown?.ok) {
|
|
1038
1117
|
checks.push({
|
|
@@ -2457,7 +2536,7 @@ function buildProgram(io = processIo) {
|
|
|
2457
2536
|
`Start the gateway from ${DEFAULT_CONFIG_FILENAME} and serve until SIGTERM or SIGINT.`
|
|
2458
2537
|
).option("--config <path>", `path to ${DEFAULT_CONFIG_FILENAME}`).option("--env-file <path>", ENV_FILE_HELP).action(async (opts) => {
|
|
2459
2538
|
try {
|
|
2460
|
-
const { runGateway } = await import('./run-
|
|
2539
|
+
const { runGateway } = await import('./run-TEPYJUHG.js');
|
|
2461
2540
|
await runGateway(opts.config !== void 0 ? { configPath: opts.config } : {});
|
|
2462
2541
|
} catch (error) {
|
|
2463
2542
|
io.stderr(formatConfigError(error, false, false));
|