mppx 0.21.1 → 0.21.2
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/CHANGELOG.md +13 -0
- package/dist/Errors.d.ts +55 -0
- package/dist/Errors.js +48 -0
- package/dist/Html.d.ts +1 -1
- package/dist/Html.js +2 -2
- package/dist/Method.d.ts +1 -1
- package/dist/cli/cli.js +138 -138
- package/dist/cli/internal.js +1 -1
- package/dist/cli/plugins/evm.js +1 -1
- package/dist/cli/plugins/index.js +13 -13
- package/dist/cli/plugins/x402.js +1 -1
- package/dist/cli/utils.d.ts +2 -45
- package/dist/cli/utils.js +2 -79
- package/dist/cli/validate/index.js +5 -2
- package/dist/cli/validate/payment.d.ts +1 -1
- package/dist/cli/validate/payment.js +3 -3
- package/dist/cli/validate/print.d.ts +12 -0
- package/dist/cli/validate/print.js +35 -0
- package/dist/client/core.d.ts +6 -0
- package/dist/client/core.js +6 -0
- package/dist/client/index.d.ts +2 -8
- package/dist/client/index.js +2 -6
- package/dist/client/internal/protocols/Shared.js +1 -1
- package/dist/client/internal/protocols/X402.js +3 -3
- package/dist/evm/client/Charge.js +1 -1
- package/dist/evm/index.d.ts +1 -1
- package/dist/evm/server/Charge.js +1 -1
- package/dist/integrations/x402/Evm.js +1 -1
- package/dist/integrations/x402/Negotiator.js +1 -1
- package/dist/internal/AcceptPayment.js +1 -1
- package/dist/internal/CredentialExpiry.js +1 -1
- package/dist/{mcp/internal/Credential.d.ts → internal/McpCredential.d.ts} +2 -2
- package/dist/{mcp/internal/Credential.js → internal/McpCredential.js} +2 -2
- package/dist/{server/internal → internal}/challengeMeta.js +1 -1
- package/dist/{server/internal → internal}/html/config.d.ts +2 -2
- package/dist/internal/pc.d.ts +46 -0
- package/dist/internal/pc.js +80 -0
- package/dist/internal/version.d.ts +2 -2
- package/dist/internal/version.js +1 -1
- package/dist/{x402 → internal/x402}/Header.js +1 -1
- package/dist/{x402 → internal/x402}/Siwx.d.ts +2 -2
- package/dist/{x402 → internal/x402}/Siwx.js +2 -2
- package/dist/{x402 → internal/x402}/Types.d.ts +1 -1
- package/dist/{x402 → internal/x402}/Types.js +1 -1
- package/dist/mcp/server/index.d.ts +1 -1
- package/dist/mcp/server/index.js +1 -1
- package/dist/server/Mppx.d.ts +1 -1
- package/dist/server/Mppx.js +6 -6
- package/dist/server/Transport.d.ts +2 -2
- package/dist/server/Transport.js +4 -4
- package/dist/server/index.d.ts +1 -8
- package/dist/server/index.js +1 -8
- package/dist/{mcp/server/Transport.d.ts → server/internal/mcpSdk.d.ts} +2 -2
- package/dist/{mcp/server/Transport.js → server/internal/mcpSdk.js} +3 -3
- package/dist/stripe/server/Charge.d.ts +1 -1
- package/dist/stripe/server/internal/html.gen.js +1 -1
- package/dist/tempo/Methods.d.ts +3 -0
- package/dist/tempo/Methods.js +3 -1
- package/dist/tempo/client/Charge.js +1 -1
- package/dist/tempo/client/Methods.d.ts +3 -0
- package/dist/tempo/client/index.d.ts +3 -0
- package/dist/tempo/client/index.js +1 -0
- package/dist/tempo/internal/configurable-account.d.ts +26 -0
- package/dist/tempo/internal/configurable-account.js +77 -0
- package/dist/tempo/internal/signature.d.ts +15 -0
- package/dist/tempo/internal/signature.js +43 -0
- package/dist/tempo/server/Charge.d.ts +1 -1
- package/dist/tempo/server/Charge.js +1 -1
- package/dist/tempo/server/Methods.d.ts +139 -4
- package/dist/tempo/server/internal/html.gen.js +1 -1
- package/dist/tempo/session/client/ChannelOps.d.ts +29 -0
- package/dist/tempo/session/client/ChannelOps.js +108 -3
- package/dist/tempo/session/client/CredentialState.d.ts +6 -0
- package/dist/tempo/session/client/CredentialState.js +29 -4
- package/dist/tempo/session/client/Session.d.ts +3 -0
- package/dist/tempo/session/client/SessionManager.js +4 -0
- package/dist/tempo/session/precompile/Chain.d.ts +35 -1
- package/dist/tempo/session/precompile/Chain.js +52 -0
- package/dist/tempo/session/precompile/Voucher.d.ts +46 -5
- package/dist/tempo/session/precompile/Voucher.js +78 -29
- package/dist/tempo/session/precompile/escrow.abi.d.ts +79 -0
- package/dist/tempo/session/precompile/escrow.abi.js +38 -0
- package/dist/tempo/session/server/ChannelStore.d.ts +27 -0
- package/dist/tempo/session/server/ChannelStore.js +24 -3
- package/dist/tempo/session/server/CredentialVerification.d.ts +7 -1
- package/dist/tempo/session/server/CredentialVerification.js +91 -12
- package/dist/tempo/session/server/RequestState.d.ts +2 -0
- package/dist/tempo/session/server/RequestState.js +1 -0
- package/dist/tempo/session/server/Session.d.ts +11 -0
- package/dist/tempo/session/server/Session.js +10 -2
- package/dist/tempo/session/server/SponsorshipLimit.d.ts +11 -3
- package/dist/tempo/session/server/SponsorshipLimit.js +36 -4
- package/dist/tempo/subscription/KeyAuthorization.js +6 -2
- package/dist/{cli/validate → validation}/challenge.d.ts +1 -1
- package/dist/{cli/validate → validation}/challenge.js +4 -4
- package/dist/validation/core.d.ts +29 -2
- package/dist/validation/core.js +41 -10
- package/dist/{cli/validate → validation}/helpers.d.ts +0 -10
- package/dist/{cli/validate → validation}/helpers.js +1 -35
- package/dist/validation/index.d.ts +2 -2
- package/dist/validation/index.js +1 -1
- package/dist/x402/Assets.d.ts +1 -1
- package/dist/x402/client/Exact.d.ts +1 -1
- package/dist/x402/client/Exact.js +2 -2
- package/dist/x402/index.d.ts +4 -4
- package/dist/x402/index.js +4 -4
- package/dist/x402/internal/RouteBinding.d.ts +1 -1
- package/dist/x402/mcp.js +2 -2
- package/dist/x402/server/EvmCharge.d.ts +2 -2
- package/dist/x402/server/EvmCharge.js +4 -4
- package/dist/x402/server/Facilitator.d.ts +1 -1
- package/dist/x402/server/Facilitator.js +1 -1
- package/package.json +13 -1
- /package/dist/{server/internal → internal}/challengeMeta.d.ts +0 -0
- /package/dist/{server/internal → internal}/html/compose.main.gen.d.ts +0 -0
- /package/dist/{server/internal → internal}/html/compose.main.gen.js +0 -0
- /package/dist/{server/internal → internal}/html/config.js +0 -0
- /package/dist/{server/internal → internal}/html/constants.d.ts +0 -0
- /package/dist/{server/internal → internal}/html/constants.js +0 -0
- /package/dist/{server/internal → internal}/html/serviceWorker.client.d.ts +0 -0
- /package/dist/{server/internal → internal}/html/serviceWorker.client.js +0 -0
- /package/dist/{server/internal → internal}/html/serviceWorker.gen.d.ts +0 -0
- /package/dist/{server/internal → internal}/html/serviceWorker.gen.js +0 -0
- /package/dist/{x402/internal → internal/x402}/ChallengeBrand.d.ts +0 -0
- /package/dist/{x402/internal → internal/x402}/ChallengeBrand.js +0 -0
- /package/dist/{x402 → internal/x402}/Header.d.ts +0 -0
- /package/dist/{cli/validate → validation}/discovery.d.ts +0 -0
- /package/dist/{cli/validate → validation}/discovery.js +0 -0
- /package/dist/{cli/validate → validation}/messages.d.ts +0 -0
- /package/dist/{cli/validate → validation}/messages.js +0 -0
package/dist/cli/plugins/x402.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as viemChains from 'viem/chains';
|
|
2
2
|
import { evm as evmMethods, assets as evmAssets } from '../../evm/client/index.js';
|
|
3
|
+
import * as x402_ChallengeBrand from '../../internal/x402/ChallengeBrand.js';
|
|
3
4
|
import * as Assets from '../../x402/Assets.js';
|
|
4
|
-
import * as x402_ChallengeBrand from '../../x402/internal/ChallengeBrand.js';
|
|
5
5
|
import { resolveAccount } from '../account.js';
|
|
6
6
|
import { createPlugin } from './plugin.js';
|
|
7
7
|
const knownAssets = [
|
package/dist/cli/utils.d.ts
CHANGED
|
@@ -1,50 +1,7 @@
|
|
|
1
1
|
import type { Chain } from 'viem';
|
|
2
2
|
import { type Address, createClient } from 'viem';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
reset: (input: unknown) => string;
|
|
6
|
-
bold: (input: unknown) => string;
|
|
7
|
-
dim: (input: unknown) => string;
|
|
8
|
-
italic: (input: unknown) => string;
|
|
9
|
-
underline: (input: unknown) => string;
|
|
10
|
-
inverse: (input: unknown) => string;
|
|
11
|
-
hidden: (input: unknown) => string;
|
|
12
|
-
strikethrough: (input: unknown) => string;
|
|
13
|
-
black: (input: unknown) => string;
|
|
14
|
-
red: (input: unknown) => string;
|
|
15
|
-
green: (input: unknown) => string;
|
|
16
|
-
yellow: (input: unknown) => string;
|
|
17
|
-
blue: (input: unknown) => string;
|
|
18
|
-
magenta: (input: unknown) => string;
|
|
19
|
-
cyan: (input: unknown) => string;
|
|
20
|
-
white: (input: unknown) => string;
|
|
21
|
-
gray: (input: unknown) => string;
|
|
22
|
-
bgBlack: (input: unknown) => string;
|
|
23
|
-
bgRed: (input: unknown) => string;
|
|
24
|
-
bgGreen: (input: unknown) => string;
|
|
25
|
-
bgYellow: (input: unknown) => string;
|
|
26
|
-
bgBlue: (input: unknown) => string;
|
|
27
|
-
bgMagenta: (input: unknown) => string;
|
|
28
|
-
bgCyan: (input: unknown) => string;
|
|
29
|
-
bgWhite: (input: unknown) => string;
|
|
30
|
-
blackBright: (input: unknown) => string;
|
|
31
|
-
redBright: (input: unknown) => string;
|
|
32
|
-
greenBright: (input: unknown) => string;
|
|
33
|
-
yellowBright: (input: unknown) => string;
|
|
34
|
-
blueBright: (input: unknown) => string;
|
|
35
|
-
magentaBright: (input: unknown) => string;
|
|
36
|
-
cyanBright: (input: unknown) => string;
|
|
37
|
-
whiteBright: (input: unknown) => string;
|
|
38
|
-
bgBlackBright: (input: unknown) => string;
|
|
39
|
-
bgRedBright: (input: unknown) => string;
|
|
40
|
-
bgGreenBright: (input: unknown) => string;
|
|
41
|
-
bgYellowBright: (input: unknown) => string;
|
|
42
|
-
bgBlueBright: (input: unknown) => string;
|
|
43
|
-
bgMagentaBright: (input: unknown) => string;
|
|
44
|
-
bgCyanBright: (input: unknown) => string;
|
|
45
|
-
bgWhiteBright: (input: unknown) => string;
|
|
46
|
-
link(url: string, text: string, noUnderline?: boolean): string;
|
|
47
|
-
};
|
|
3
|
+
import { pc } from '../internal/pc.js';
|
|
4
|
+
export { pc };
|
|
48
5
|
export declare function printRequestHeaders(reqUrl: string, init: RequestInit, info: (msg: string) => void): void;
|
|
49
6
|
export declare function printResponseHeaders(res: Response, opts: {
|
|
50
7
|
include: boolean;
|
package/dist/cli/utils.js
CHANGED
|
@@ -1,86 +1,9 @@
|
|
|
1
1
|
import * as readline from 'node:readline';
|
|
2
2
|
import { createClient, http } from 'viem';
|
|
3
3
|
import { tempo as tempoMainnet, tempoModerato } from 'viem/tempo/chains';
|
|
4
|
+
import { pc } from '../internal/pc.js';
|
|
4
5
|
import * as defaults from '../tempo/internal/defaults.js';
|
|
5
|
-
|
|
6
|
-
export const pc = (() => {
|
|
7
|
-
const p = process || {};
|
|
8
|
-
const argv = p.argv || [];
|
|
9
|
-
const env = p.env || {};
|
|
10
|
-
const isColorSupported = !(!!env.NO_COLOR || argv.includes('--no-color')) &&
|
|
11
|
-
(!!env.FORCE_COLOR ||
|
|
12
|
-
argv.includes('--color') ||
|
|
13
|
-
((p.stdout || {}).isTTY && env.TERM !== 'dumb') ||
|
|
14
|
-
!!env.CI);
|
|
15
|
-
const replaceClose = (string, close, replace, index) => {
|
|
16
|
-
let result = '';
|
|
17
|
-
let cursor = 0;
|
|
18
|
-
let i = index;
|
|
19
|
-
do {
|
|
20
|
-
result += string.substring(cursor, i) + replace;
|
|
21
|
-
cursor = i + close.length;
|
|
22
|
-
i = string.indexOf(close, cursor);
|
|
23
|
-
} while (~i);
|
|
24
|
-
return result + string.substring(cursor);
|
|
25
|
-
};
|
|
26
|
-
const formatter = (open, close, replace = open) => (input) => {
|
|
27
|
-
const string = `${input}`;
|
|
28
|
-
const index = string.indexOf(close, open.length);
|
|
29
|
-
return ~index
|
|
30
|
-
? open + replaceClose(string, close, replace, index) + close
|
|
31
|
-
: open + string + close;
|
|
32
|
-
};
|
|
33
|
-
const f = isColorSupported ? formatter : () => String;
|
|
34
|
-
return {
|
|
35
|
-
isColorSupported,
|
|
36
|
-
reset: f('\x1b[0m', '\x1b[0m'),
|
|
37
|
-
bold: f('\x1b[1m', '\x1b[22m', '\x1b[22m\x1b[1m'),
|
|
38
|
-
dim: f('\x1b[2m', '\x1b[22m', '\x1b[22m\x1b[2m'),
|
|
39
|
-
italic: f('\x1b[3m', '\x1b[23m'),
|
|
40
|
-
underline: f('\x1b[4m', '\x1b[24m'),
|
|
41
|
-
inverse: f('\x1b[7m', '\x1b[27m'),
|
|
42
|
-
hidden: f('\x1b[8m', '\x1b[28m'),
|
|
43
|
-
strikethrough: f('\x1b[9m', '\x1b[29m'),
|
|
44
|
-
black: f('\x1b[30m', '\x1b[39m'),
|
|
45
|
-
red: f('\x1b[31m', '\x1b[39m'),
|
|
46
|
-
green: f('\x1b[32m', '\x1b[39m'),
|
|
47
|
-
yellow: f('\x1b[33m', '\x1b[39m'),
|
|
48
|
-
blue: f('\x1b[34m', '\x1b[39m'),
|
|
49
|
-
magenta: f('\x1b[35m', '\x1b[39m'),
|
|
50
|
-
cyan: f('\x1b[36m', '\x1b[39m'),
|
|
51
|
-
white: f('\x1b[37m', '\x1b[39m'),
|
|
52
|
-
gray: f('\x1b[90m', '\x1b[39m'),
|
|
53
|
-
bgBlack: f('\x1b[40m', '\x1b[49m'),
|
|
54
|
-
bgRed: f('\x1b[41m', '\x1b[49m'),
|
|
55
|
-
bgGreen: f('\x1b[42m', '\x1b[49m'),
|
|
56
|
-
bgYellow: f('\x1b[43m', '\x1b[49m'),
|
|
57
|
-
bgBlue: f('\x1b[44m', '\x1b[49m'),
|
|
58
|
-
bgMagenta: f('\x1b[45m', '\x1b[49m'),
|
|
59
|
-
bgCyan: f('\x1b[46m', '\x1b[49m'),
|
|
60
|
-
bgWhite: f('\x1b[47m', '\x1b[49m'),
|
|
61
|
-
blackBright: f('\x1b[90m', '\x1b[39m'),
|
|
62
|
-
redBright: f('\x1b[91m', '\x1b[39m'),
|
|
63
|
-
greenBright: f('\x1b[92m', '\x1b[39m'),
|
|
64
|
-
yellowBright: f('\x1b[93m', '\x1b[39m'),
|
|
65
|
-
blueBright: f('\x1b[94m', '\x1b[39m'),
|
|
66
|
-
magentaBright: f('\x1b[95m', '\x1b[39m'),
|
|
67
|
-
cyanBright: f('\x1b[96m', '\x1b[39m'),
|
|
68
|
-
whiteBright: f('\x1b[97m', '\x1b[39m'),
|
|
69
|
-
bgBlackBright: f('\x1b[100m', '\x1b[49m'),
|
|
70
|
-
bgRedBright: f('\x1b[101m', '\x1b[49m'),
|
|
71
|
-
bgGreenBright: f('\x1b[102m', '\x1b[49m'),
|
|
72
|
-
bgYellowBright: f('\x1b[103m', '\x1b[49m'),
|
|
73
|
-
bgBlueBright: f('\x1b[104m', '\x1b[49m'),
|
|
74
|
-
bgMagentaBright: f('\x1b[105m', '\x1b[49m'),
|
|
75
|
-
bgCyanBright: f('\x1b[106m', '\x1b[49m'),
|
|
76
|
-
bgWhiteBright: f('\x1b[107m', '\x1b[49m'),
|
|
77
|
-
link(url, text, noUnderline) {
|
|
78
|
-
if (!isColorSupported)
|
|
79
|
-
return text;
|
|
80
|
-
return `\x1b]8;;${url}\x07${noUnderline ? text : pc.underline(text)}\x1b]8;;\x07`;
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
})();
|
|
6
|
+
export { pc };
|
|
84
7
|
export function printRequestHeaders(reqUrl, init, info) {
|
|
85
8
|
const { pathname, host } = new URL(reqUrl);
|
|
86
9
|
const method = (init.method ?? 'GET').toUpperCase();
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Cli, z } from 'incur';
|
|
2
2
|
import { validate as validateCore, validateStream } from '../../validation/core.js';
|
|
3
|
+
import { missingDiscoverySuggestion } from '../../validation/messages.js';
|
|
3
4
|
import { isAgentEnvironment, pc } from '../utils.js';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
5
|
+
import { validatePaymentFlow } from './payment.js';
|
|
6
|
+
import { printResults, printSection } from './print.js';
|
|
6
7
|
const validate = Cli.create('validate', {
|
|
7
8
|
description: 'Validate an MPP server implementation end-to-end',
|
|
8
9
|
args: z.object({
|
|
@@ -43,6 +44,7 @@ const validate = Cli.create('validate', {
|
|
|
43
44
|
verbose: c.options.verbose > 0,
|
|
44
45
|
yes: c.options.yes,
|
|
45
46
|
interactive: false,
|
|
47
|
+
payment: validatePaymentFlow,
|
|
46
48
|
});
|
|
47
49
|
console.log(JSON.stringify(result, null, 2));
|
|
48
50
|
const noEndpoints = result.endpoints.length === 0 && !c.options.endpoint;
|
|
@@ -72,6 +74,7 @@ const validate = Cli.create('validate', {
|
|
|
72
74
|
yes: c.options.yes,
|
|
73
75
|
interactive: !!process.stdin.isTTY,
|
|
74
76
|
onPaymentResults: (results) => printResults(results, counts),
|
|
77
|
+
payment: validatePaymentFlow,
|
|
75
78
|
})) {
|
|
76
79
|
switch (event.phase) {
|
|
77
80
|
case 'discovery':
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type SessionReceipt } from '../../tempo/session/precompile/Protocol.js';
|
|
2
|
-
import type { CheckResult, EndpointSpec } from '
|
|
2
|
+
import type { CheckResult, EndpointSpec } from '../../validation/helpers.js';
|
|
3
3
|
export declare function validatePaymentFlow(baseUrl: string, endpoint: EndpointSpec, verbose: boolean, options: {
|
|
4
4
|
body?: string | undefined;
|
|
5
5
|
query?: string[] | undefined;
|
|
@@ -14,12 +14,12 @@ import { tempo as tempoMethods } from '../../tempo/client/index.js';
|
|
|
14
14
|
import { chainId as tempoChainIds } from '../../tempo/internal/defaults.js';
|
|
15
15
|
import { isTempoSessionChallenge } from '../../tempo/session/client/Transports.js';
|
|
16
16
|
import { isEventStream, parseEvent, } from '../../tempo/session/precompile/Protocol.js';
|
|
17
|
+
import { validateRealmMatchesHost } from '../../validation/challenge.js';
|
|
18
|
+
import { buildUrl } from '../../validation/discovery.js';
|
|
19
|
+
import { check, fail, fetchWithTimeout, formatBytes, isValidIntegerAmount, parseHeaders, skip, warn, } from '../../validation/helpers.js';
|
|
17
20
|
import { resolveAccount, resolveAccountName } from '../account.js';
|
|
18
21
|
import { assertSamePaymentRequest, flattenConfigMethods, loadConfig, preparePayment, resolvePlugin, } from '../internal.js';
|
|
19
22
|
import { fetchTokenInfo, confirm, pc } from '../utils.js';
|
|
20
|
-
import { validateRealmMatchesHost } from './challenge.js';
|
|
21
|
-
import { buildUrl } from './discovery.js';
|
|
22
|
-
import { check, fail, fetchWithTimeout, formatBytes, isValidIntegerAmount, parseHeaders, skip, warn, } from './helpers.js';
|
|
23
23
|
async function provisionAndPayTestnet(challenge, verbose, silent) {
|
|
24
24
|
try {
|
|
25
25
|
if (!silent)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CheckResult } from '../../validation/helpers.js';
|
|
2
|
+
export declare function printCheck(result: CheckResult): void;
|
|
3
|
+
export declare function printSection(title: string): void;
|
|
4
|
+
export type Counts = {
|
|
5
|
+
passed: number;
|
|
6
|
+
failed: number;
|
|
7
|
+
warnings: number;
|
|
8
|
+
suggested: number;
|
|
9
|
+
skipped: number;
|
|
10
|
+
};
|
|
11
|
+
export declare function printResults(results: CheckResult[], counts: Counts): void;
|
|
12
|
+
//# sourceMappingURL=print.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { pc } from '../utils.js';
|
|
2
|
+
const SEVERITY_ICONS = {
|
|
3
|
+
pass: pc.green('✓'),
|
|
4
|
+
fail: pc.red('✗'),
|
|
5
|
+
warn: pc.yellow('⚠'),
|
|
6
|
+
suggested: pc.cyan('◇'),
|
|
7
|
+
skip: pc.dim('○'),
|
|
8
|
+
};
|
|
9
|
+
export function printCheck(result) {
|
|
10
|
+
const icon = SEVERITY_ICONS[result.severity];
|
|
11
|
+
const text = result.detail ? `${result.label} (${result.detail})` : result.label;
|
|
12
|
+
console.log(` ${icon} ${text}`);
|
|
13
|
+
if (result.hint && result.severity !== 'pass') {
|
|
14
|
+
console.log(pc.dim(` → ${result.hint}`));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export function printSection(title) {
|
|
18
|
+
console.log(`\n${pc.bold(title)}`);
|
|
19
|
+
}
|
|
20
|
+
export function printResults(results, counts) {
|
|
21
|
+
for (const result of results) {
|
|
22
|
+
printCheck(result);
|
|
23
|
+
if (result.severity === 'pass')
|
|
24
|
+
counts.passed++;
|
|
25
|
+
else if (result.severity === 'fail')
|
|
26
|
+
counts.failed++;
|
|
27
|
+
else if (result.severity === 'warn')
|
|
28
|
+
counts.warnings++;
|
|
29
|
+
else if (result.severity === 'suggested')
|
|
30
|
+
counts.suggested++;
|
|
31
|
+
else if (result.severity === 'skip')
|
|
32
|
+
counts.skipped++;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=print.js.map
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
export *
|
|
2
|
-
export * as Expires from '../Expires.js';
|
|
3
|
-
export * as Fetch from './internal/Fetch.js';
|
|
1
|
+
export * from './core.js';
|
|
4
2
|
export { evm, session, sessionManager, sessionMethod, stripe, tempo } from './Methods.js';
|
|
5
|
-
export { createChannelStore, createJsonChannelStore, entryKey, type ChannelStore, type JsonChannelKv, } from '../tempo/
|
|
6
|
-
export type { ChargeContext } from '../tempo/client/Charge.js';
|
|
7
|
-
export type { ResolveAccount, ResolveAccountCall, ResolveAccountInfo, ResolveAccountOperation, } from '../tempo/client/ResolveAccount.js';
|
|
8
|
-
export * as Mppx from './Mppx.js';
|
|
9
|
-
export * as Transport from './Transport.js';
|
|
3
|
+
export { createChannelStore, createJsonChannelStore, entryKey, type ChannelStore, type ChargeContext, type JsonChannelKv, type ResolveAccount, type ResolveAccountCall, type ResolveAccountInfo, type ResolveAccountOperation, } from '../tempo/client/index.js';
|
|
10
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/client/index.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
export *
|
|
2
|
-
export * as Expires from '../Expires.js';
|
|
3
|
-
export * as Fetch from './internal/Fetch.js';
|
|
1
|
+
export * from './core.js';
|
|
4
2
|
export { evm, session, sessionManager, sessionMethod, stripe, tempo } from './Methods.js';
|
|
5
|
-
export { createChannelStore, createJsonChannelStore, entryKey, } from '../tempo/
|
|
6
|
-
export * as Mppx from './Mppx.js';
|
|
7
|
-
export * as Transport from './Transport.js';
|
|
3
|
+
export { createChannelStore, createJsonChannelStore, entryKey, } from '../tempo/client/index.js';
|
|
8
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as Constants from '../../../Constants.js';
|
|
2
|
-
import * as x402_Types from '../../../x402/Types.js';
|
|
2
|
+
import * as x402_Types from '../../../internal/x402/Types.js';
|
|
3
3
|
/** HTTP status that signals a native payment challenge. */
|
|
4
4
|
export const paymentRequiredStatus = 402;
|
|
5
5
|
/** Credential headers purged before a fresh credential is attached. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Challenge from '../../../Challenge.js';
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
4
|
-
import * as x402_Types from '../../../x402/Types.js';
|
|
2
|
+
import * as x402_ChallengeBrand from '../../../internal/x402/ChallengeBrand.js';
|
|
3
|
+
import * as x402_Header from '../../../internal/x402/Header.js';
|
|
4
|
+
import * as x402_Types from '../../../internal/x402/Types.js';
|
|
5
5
|
import { paymentRequiredStatus, setCredentialHeader } from './Shared.js';
|
|
6
6
|
/**
|
|
7
7
|
* x402 — a 402 carrying a `PAYMENT-REQUIRED` header, paid back in `PAYMENT-SIGNATURE`. Synthesized
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getAddress, parseUnits } from 'viem';
|
|
2
2
|
import * as Credential from '../../Credential.js';
|
|
3
|
+
import * as x402_ChallengeBrand from '../../internal/x402/ChallengeBrand.js';
|
|
3
4
|
import * as Method from '../../Method.js';
|
|
4
5
|
import * as x402_Exact from '../../x402/client/Exact.js';
|
|
5
|
-
import * as x402_ChallengeBrand from '../../x402/internal/ChallengeBrand.js';
|
|
6
6
|
import * as z from '../../zod.js';
|
|
7
7
|
import * as Assets from '../Assets.js';
|
|
8
8
|
import * as Methods from '../Methods.js';
|
package/dist/evm/index.d.ts
CHANGED
|
@@ -8,5 +8,5 @@ export * as assets from './Assets.js';
|
|
|
8
8
|
export * as chains from './Chains.js';
|
|
9
9
|
export { charge } from './Methods.js';
|
|
10
10
|
export * from './Types.js';
|
|
11
|
-
export type { ExactEip3009Transfer, ExactPermit2Transfer, ExactTransfer, ResourceInfo, } from '../x402/Types.js';
|
|
11
|
+
export type { ExactEip3009Transfer, ExactPermit2Transfer, ExactTransfer, ResourceInfo, } from '../internal/x402/Types.js';
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { getAddress, recoverTypedDataAddress } from 'viem';
|
|
2
2
|
import * as Currency from '../../Currency.js';
|
|
3
3
|
import { VerificationFailedError } from '../../Errors.js';
|
|
4
|
+
import * as Siwx from '../../internal/x402/Siwx.js';
|
|
4
5
|
import * as Method from '../../Method.js';
|
|
5
6
|
import * as Receipt from '../../Receipt.js';
|
|
6
7
|
import * as ServerTransport from '../../server/Transport.js';
|
|
7
8
|
import * as X402 from '../../x402/server/EvmCharge.js';
|
|
8
|
-
import * as Siwx from '../../x402/Siwx.js';
|
|
9
9
|
import * as Assets from '../Assets.js';
|
|
10
10
|
import * as Methods from '../Methods.js';
|
|
11
11
|
import * as Types from '../Types.js';
|
|
@@ -3,8 +3,8 @@ import { VerificationFailedError } from '../../Errors.js';
|
|
|
3
3
|
import { evm } from '../../evm/server/Methods.js';
|
|
4
4
|
import { eip3009 } from '../../evm/Types.js';
|
|
5
5
|
import * as Expires from '../../Expires.js';
|
|
6
|
+
import * as Types from '../../internal/x402/Types.js';
|
|
6
7
|
import * as Mppx from '../../server/Mppx.js';
|
|
7
|
-
import * as Types from '../../x402/Types.js';
|
|
8
8
|
/** Creates a native MPP handler backed by a compatible x402 EVM requirement. */
|
|
9
9
|
export function createHandler(parameters) {
|
|
10
10
|
const requirement = selectRequirement(parameters.paymentRequired, parameters.config.server);
|
|
@@ -2,8 +2,8 @@ import { decodePaymentRequiredHeader } from '@x402/core/http';
|
|
|
2
2
|
import { getFacilitatorResponseError, x402HTTPResourceServer } from '@x402/core/server';
|
|
3
3
|
import * as Constants from '../../Constants.js';
|
|
4
4
|
import * as Credential from '../../Credential.js';
|
|
5
|
+
import * as Types from '../../internal/x402/Types.js';
|
|
5
6
|
import * as SecretKey from '../../server/internal/SecretKey.js';
|
|
6
|
-
import * as Types from '../../x402/Types.js';
|
|
7
7
|
import * as Evm from './Evm.js';
|
|
8
8
|
/** Creates the native MPP side of an x402 compatibility integration. */
|
|
9
9
|
export function create(config) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as x402_ChallengeBrand from '
|
|
1
|
+
import * as x402_ChallengeBrand from './x402/ChallengeBrand.js';
|
|
2
2
|
/**
|
|
3
3
|
* Selection context for flows that receive the credential context only after an offer is chosen,
|
|
4
4
|
* such as `preparePayment()`. Methods may accept offers they would otherwise skip by policy and
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PaymentExpiredError } from '../Errors.js';
|
|
2
2
|
import * as Expires from '../Expires.js';
|
|
3
|
-
import * as ChallengeMeta from '
|
|
3
|
+
import * as ChallengeMeta from './challengeMeta.js';
|
|
4
4
|
// A symbol-keyed property survives the spreads that copy and configure methods.
|
|
5
5
|
const graceKey = Symbol.for('mppx.credentialExpiryGrace');
|
|
6
6
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as Credential from '
|
|
1
|
+
import * as Credential from '../Credential.js';
|
|
2
2
|
/** Parsed MCP credential and its canonical HTTP Authorization value. */
|
|
3
3
|
export type Parsed = {
|
|
4
4
|
header: string;
|
|
@@ -6,4 +6,4 @@ export type Parsed = {
|
|
|
6
6
|
};
|
|
7
7
|
/** Validates an MCP metadata credential through the canonical wire serializer. */
|
|
8
8
|
export declare function parse(value: unknown): Parsed | undefined;
|
|
9
|
-
//# sourceMappingURL=
|
|
9
|
+
//# sourceMappingURL=McpCredential.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as Credential from '
|
|
1
|
+
import * as Credential from '../Credential.js';
|
|
2
2
|
/** Validates an MCP metadata credential through the canonical wire serializer. */
|
|
3
3
|
export function parse(value) {
|
|
4
4
|
if (!value || typeof value !== 'object')
|
|
@@ -13,4 +13,4 @@ export function parse(value) {
|
|
|
13
13
|
return undefined;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
//# sourceMappingURL=
|
|
16
|
+
//# sourceMappingURL=McpCredential.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Secp256k1 } from 'ox';
|
|
2
|
-
import * as PaymentRequest from '
|
|
2
|
+
import * as PaymentRequest from '../PaymentRequest.js';
|
|
3
3
|
/** Reserved metadata key for HMAC-bound, per-issuance challenge randomness. */
|
|
4
4
|
const nonceKey = '_mppx_nonce';
|
|
5
5
|
/** Adds fresh issuance randomness while preserving application and route metadata. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type * as Challenge from '
|
|
2
|
-
import type * as Method from '
|
|
1
|
+
import type * as Challenge from '../../Challenge.js';
|
|
2
|
+
import type * as Method from '../../Method.js';
|
|
3
3
|
export type Options = {
|
|
4
4
|
config: Record<string, unknown>;
|
|
5
5
|
/**
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export declare const pc: {
|
|
2
|
+
isColorSupported: boolean;
|
|
3
|
+
reset: (input: unknown) => string;
|
|
4
|
+
bold: (input: unknown) => string;
|
|
5
|
+
dim: (input: unknown) => string;
|
|
6
|
+
italic: (input: unknown) => string;
|
|
7
|
+
underline: (input: unknown) => string;
|
|
8
|
+
inverse: (input: unknown) => string;
|
|
9
|
+
hidden: (input: unknown) => string;
|
|
10
|
+
strikethrough: (input: unknown) => string;
|
|
11
|
+
black: (input: unknown) => string;
|
|
12
|
+
red: (input: unknown) => string;
|
|
13
|
+
green: (input: unknown) => string;
|
|
14
|
+
yellow: (input: unknown) => string;
|
|
15
|
+
blue: (input: unknown) => string;
|
|
16
|
+
magenta: (input: unknown) => string;
|
|
17
|
+
cyan: (input: unknown) => string;
|
|
18
|
+
white: (input: unknown) => string;
|
|
19
|
+
gray: (input: unknown) => string;
|
|
20
|
+
bgBlack: (input: unknown) => string;
|
|
21
|
+
bgRed: (input: unknown) => string;
|
|
22
|
+
bgGreen: (input: unknown) => string;
|
|
23
|
+
bgYellow: (input: unknown) => string;
|
|
24
|
+
bgBlue: (input: unknown) => string;
|
|
25
|
+
bgMagenta: (input: unknown) => string;
|
|
26
|
+
bgCyan: (input: unknown) => string;
|
|
27
|
+
bgWhite: (input: unknown) => string;
|
|
28
|
+
blackBright: (input: unknown) => string;
|
|
29
|
+
redBright: (input: unknown) => string;
|
|
30
|
+
greenBright: (input: unknown) => string;
|
|
31
|
+
yellowBright: (input: unknown) => string;
|
|
32
|
+
blueBright: (input: unknown) => string;
|
|
33
|
+
magentaBright: (input: unknown) => string;
|
|
34
|
+
cyanBright: (input: unknown) => string;
|
|
35
|
+
whiteBright: (input: unknown) => string;
|
|
36
|
+
bgBlackBright: (input: unknown) => string;
|
|
37
|
+
bgRedBright: (input: unknown) => string;
|
|
38
|
+
bgGreenBright: (input: unknown) => string;
|
|
39
|
+
bgYellowBright: (input: unknown) => string;
|
|
40
|
+
bgBlueBright: (input: unknown) => string;
|
|
41
|
+
bgMagentaBright: (input: unknown) => string;
|
|
42
|
+
bgCyanBright: (input: unknown) => string;
|
|
43
|
+
bgWhiteBright: (input: unknown) => string;
|
|
44
|
+
link(url: string, text: string, noUnderline?: boolean): string;
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=pc.d.ts.map
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// Inlined from https://github.com/alexeyraspopov/picocolors (ISC License)
|
|
2
|
+
export const pc = (() => {
|
|
3
|
+
const p = process || {};
|
|
4
|
+
const argv = p.argv || [];
|
|
5
|
+
const env = p.env || {};
|
|
6
|
+
const isColorSupported = !(!!env.NO_COLOR || argv.includes('--no-color')) &&
|
|
7
|
+
(!!env.FORCE_COLOR ||
|
|
8
|
+
argv.includes('--color') ||
|
|
9
|
+
((p.stdout || {}).isTTY && env.TERM !== 'dumb') ||
|
|
10
|
+
!!env.CI);
|
|
11
|
+
const replaceClose = (string, close, replace, index) => {
|
|
12
|
+
let result = '';
|
|
13
|
+
let cursor = 0;
|
|
14
|
+
let i = index;
|
|
15
|
+
do {
|
|
16
|
+
result += string.substring(cursor, i) + replace;
|
|
17
|
+
cursor = i + close.length;
|
|
18
|
+
i = string.indexOf(close, cursor);
|
|
19
|
+
} while (~i);
|
|
20
|
+
return result + string.substring(cursor);
|
|
21
|
+
};
|
|
22
|
+
const formatter = (open, close, replace = open) => (input) => {
|
|
23
|
+
const string = `${input}`;
|
|
24
|
+
const index = string.indexOf(close, open.length);
|
|
25
|
+
return ~index
|
|
26
|
+
? open + replaceClose(string, close, replace, index) + close
|
|
27
|
+
: open + string + close;
|
|
28
|
+
};
|
|
29
|
+
const f = isColorSupported ? formatter : () => String;
|
|
30
|
+
return {
|
|
31
|
+
isColorSupported,
|
|
32
|
+
reset: f('\x1b[0m', '\x1b[0m'),
|
|
33
|
+
bold: f('\x1b[1m', '\x1b[22m', '\x1b[22m\x1b[1m'),
|
|
34
|
+
dim: f('\x1b[2m', '\x1b[22m', '\x1b[22m\x1b[2m'),
|
|
35
|
+
italic: f('\x1b[3m', '\x1b[23m'),
|
|
36
|
+
underline: f('\x1b[4m', '\x1b[24m'),
|
|
37
|
+
inverse: f('\x1b[7m', '\x1b[27m'),
|
|
38
|
+
hidden: f('\x1b[8m', '\x1b[28m'),
|
|
39
|
+
strikethrough: f('\x1b[9m', '\x1b[29m'),
|
|
40
|
+
black: f('\x1b[30m', '\x1b[39m'),
|
|
41
|
+
red: f('\x1b[31m', '\x1b[39m'),
|
|
42
|
+
green: f('\x1b[32m', '\x1b[39m'),
|
|
43
|
+
yellow: f('\x1b[33m', '\x1b[39m'),
|
|
44
|
+
blue: f('\x1b[34m', '\x1b[39m'),
|
|
45
|
+
magenta: f('\x1b[35m', '\x1b[39m'),
|
|
46
|
+
cyan: f('\x1b[36m', '\x1b[39m'),
|
|
47
|
+
white: f('\x1b[37m', '\x1b[39m'),
|
|
48
|
+
gray: f('\x1b[90m', '\x1b[39m'),
|
|
49
|
+
bgBlack: f('\x1b[40m', '\x1b[49m'),
|
|
50
|
+
bgRed: f('\x1b[41m', '\x1b[49m'),
|
|
51
|
+
bgGreen: f('\x1b[42m', '\x1b[49m'),
|
|
52
|
+
bgYellow: f('\x1b[43m', '\x1b[49m'),
|
|
53
|
+
bgBlue: f('\x1b[44m', '\x1b[49m'),
|
|
54
|
+
bgMagenta: f('\x1b[45m', '\x1b[49m'),
|
|
55
|
+
bgCyan: f('\x1b[46m', '\x1b[49m'),
|
|
56
|
+
bgWhite: f('\x1b[47m', '\x1b[49m'),
|
|
57
|
+
blackBright: f('\x1b[90m', '\x1b[39m'),
|
|
58
|
+
redBright: f('\x1b[91m', '\x1b[39m'),
|
|
59
|
+
greenBright: f('\x1b[92m', '\x1b[39m'),
|
|
60
|
+
yellowBright: f('\x1b[93m', '\x1b[39m'),
|
|
61
|
+
blueBright: f('\x1b[94m', '\x1b[39m'),
|
|
62
|
+
magentaBright: f('\x1b[95m', '\x1b[39m'),
|
|
63
|
+
cyanBright: f('\x1b[96m', '\x1b[39m'),
|
|
64
|
+
whiteBright: f('\x1b[97m', '\x1b[39m'),
|
|
65
|
+
bgBlackBright: f('\x1b[100m', '\x1b[49m'),
|
|
66
|
+
bgRedBright: f('\x1b[101m', '\x1b[49m'),
|
|
67
|
+
bgGreenBright: f('\x1b[102m', '\x1b[49m'),
|
|
68
|
+
bgYellowBright: f('\x1b[103m', '\x1b[49m'),
|
|
69
|
+
bgBlueBright: f('\x1b[104m', '\x1b[49m'),
|
|
70
|
+
bgMagentaBright: f('\x1b[105m', '\x1b[49m'),
|
|
71
|
+
bgCyanBright: f('\x1b[106m', '\x1b[49m'),
|
|
72
|
+
bgWhiteBright: f('\x1b[107m', '\x1b[49m'),
|
|
73
|
+
link(url, text, noUnderline) {
|
|
74
|
+
if (!isColorSupported)
|
|
75
|
+
return text;
|
|
76
|
+
return `\x1b]8;;${url}\x07${noUnderline ? text : pc.underline(text)}\x1b]8;;\x07`;
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
})();
|
|
80
|
+
//# sourceMappingURL=pc.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Current mppx package version. */
|
|
2
|
-
export declare const version = "0.21.
|
|
2
|
+
export declare const version = "0.21.2";
|
|
3
3
|
/** Canonical SDK identifier for this mppx release. */
|
|
4
|
-
export declare const sdkIdentifier = "mppx/0.21.
|
|
4
|
+
export declare const sdkIdentifier = "mppx/0.21.2";
|
|
5
5
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/internal/version.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Generated by scripts/sync-version.ts.
|
|
2
2
|
/** Current mppx package version. */
|
|
3
|
-
export const version = '0.21.
|
|
3
|
+
export const version = '0.21.2';
|
|
4
4
|
/** Canonical SDK identifier for this mppx release. */
|
|
5
5
|
export const sdkIdentifier = `mppx/${version}`;
|
|
6
6
|
//# sourceMappingURL=version.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Base64 } from 'ox';
|
|
2
|
-
import * as HeaderCodec from '../
|
|
2
|
+
import * as HeaderCodec from '../HeaderCodec.js';
|
|
3
3
|
import { ExtensionsSchema, PaymentPayloadSchema, PaymentRequiredSchema, ResourceInfoSchema, SettleResponseSchema, } from './Types.js';
|
|
4
4
|
const paymentRequired = HeaderCodec.createJson(PaymentRequiredSchema);
|
|
5
5
|
const paymentSignature = HeaderCodec.createJson(PaymentPayloadSchema);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Account, type Address, type Client } from 'viem';
|
|
2
|
-
import * as Store from '
|
|
3
|
-
import * as z from '
|
|
2
|
+
import * as Store from '../../Store.js';
|
|
3
|
+
import * as z from '../../zod.js';
|
|
4
4
|
/** Key of the x402 `sign-in-with-x` (SIWX) extension in a 402's `extensions`. */
|
|
5
5
|
export declare const extensionKey = "sign-in-with-x";
|
|
6
6
|
/** Request header that carries a signed SIWX proof as base64-encoded JSON. */
|
|
@@ -2,8 +2,8 @@ import { Base64, Bytes, Hex } from 'ox';
|
|
|
2
2
|
import { getAddress, recoverMessageAddress } from 'viem';
|
|
3
3
|
import { getChainId, verifyMessage } from 'viem/actions';
|
|
4
4
|
import { createSiweMessage } from 'viem/siwe';
|
|
5
|
-
import * as Store from '
|
|
6
|
-
import * as z from '
|
|
5
|
+
import * as Store from '../../Store.js';
|
|
6
|
+
import * as z from '../../zod.js';
|
|
7
7
|
import * as Types from './Types.js';
|
|
8
8
|
/** Key of the x402 `sign-in-with-x` (SIWX) extension in a 402's `extensions`. */
|
|
9
9
|
export const extensionKey = 'sign-in-with-x';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * as Transport from '
|
|
1
|
+
export * as Transport from '../../server/internal/mcpSdk.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/mcp/server/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * as Transport from '
|
|
1
|
+
export * as Transport from '../../server/internal/mcpSdk.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|