x402-proxy 0.11.3 → 0.11.4
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/dist/bin/cli.js
CHANGED
|
@@ -4,7 +4,7 @@ import { C as run, S as buildRouteMap, _ as base58, a as getDebugLogPath, b as b
|
|
|
4
4
|
import { C as warn, S as success, _ as decodePaymentResponseHeader, b as info, c as resolveWallet, d as displayNetwork, f as formatAmount, g as wrapFetchWithPayment, h as readHistory, l as appendHistory, m as formatUsdcValue, n as fetchAllBalances, o as walletInfoCommand, p as formatTxLine, s as buildX402Client, u as calcSpend, v as dim, x as isTTY, y as error } from "../wallet-CUCoLEqs.js";
|
|
5
5
|
import { i as deserializeSessionReceipt, n as tempo, o as parseUnits, r as parseEvent, t as create } from "../client-DqtxTnu6.js";
|
|
6
6
|
import { t as privateKeyToAccount } from "../accounts-D9KsVVpJ.js";
|
|
7
|
-
import { a as Nt, c as Wt, i as Jt, l as Ct, n as setupCommand, o as R, r as Gt, s as Rt, t as runSetup } from "../setup-
|
|
7
|
+
import { a as Nt, c as Wt, i as Jt, l as Ct, n as setupCommand, o as R, r as Gt, s as Rt, t as runSetup } from "../setup-C10O8N36.js";
|
|
8
8
|
import { n as statusCommand } from "../status-DjZdIeES.js";
|
|
9
9
|
import { dirname, join, normalize, resolve } from "node:path";
|
|
10
10
|
import { spawn } from "node:child_process";
|
|
@@ -17,9 +17,9 @@ import { homedir } from "node:os";
|
|
|
17
17
|
const DEFAULT_SURF_PROVIDER_ID = "surf";
|
|
18
18
|
const DEFAULT_SURF_BASE_URL = "/x402-proxy/v1";
|
|
19
19
|
const DEFAULT_SURF_UPSTREAM_URL = "https://surf.cascade.fyi/api/v1/inference";
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
/** Known model metadata for cost/capability enrichment. */
|
|
21
|
+
const MODEL_METADATA = {
|
|
22
|
+
"anthropic/claude-opus-4.6": {
|
|
23
23
|
name: "Claude Opus 4.6",
|
|
24
24
|
maxTokens: 2e5,
|
|
25
25
|
reasoning: true,
|
|
@@ -32,8 +32,20 @@ const DEFAULT_SURF_MODELS = [
|
|
|
32
32
|
},
|
|
33
33
|
contextWindow: 2e5
|
|
34
34
|
},
|
|
35
|
-
{
|
|
36
|
-
|
|
35
|
+
"anthropic/claude-opus-4.5": {
|
|
36
|
+
name: "Claude Opus 4.5",
|
|
37
|
+
maxTokens: 2e5,
|
|
38
|
+
reasoning: true,
|
|
39
|
+
input: ["text", "image"],
|
|
40
|
+
cost: {
|
|
41
|
+
input: .015,
|
|
42
|
+
output: .075,
|
|
43
|
+
cacheRead: .0015,
|
|
44
|
+
cacheWrite: .01875
|
|
45
|
+
},
|
|
46
|
+
contextWindow: 2e5
|
|
47
|
+
},
|
|
48
|
+
"anthropic/claude-sonnet-4.6": {
|
|
37
49
|
name: "Claude Sonnet 4.6",
|
|
38
50
|
maxTokens: 2e5,
|
|
39
51
|
reasoning: true,
|
|
@@ -46,8 +58,20 @@ const DEFAULT_SURF_MODELS = [
|
|
|
46
58
|
},
|
|
47
59
|
contextWindow: 2e5
|
|
48
60
|
},
|
|
49
|
-
{
|
|
50
|
-
|
|
61
|
+
"anthropic/claude-sonnet-4.5": {
|
|
62
|
+
name: "Claude Sonnet 4.5",
|
|
63
|
+
maxTokens: 2e5,
|
|
64
|
+
reasoning: true,
|
|
65
|
+
input: ["text", "image"],
|
|
66
|
+
cost: {
|
|
67
|
+
input: .003,
|
|
68
|
+
output: .015,
|
|
69
|
+
cacheRead: 3e-4,
|
|
70
|
+
cacheWrite: .00375
|
|
71
|
+
},
|
|
72
|
+
contextWindow: 2e5
|
|
73
|
+
},
|
|
74
|
+
"x-ai/grok-4.20-beta": {
|
|
51
75
|
name: "Grok 4.20 Beta",
|
|
52
76
|
maxTokens: 131072,
|
|
53
77
|
reasoning: true,
|
|
@@ -60,8 +84,33 @@ const DEFAULT_SURF_MODELS = [
|
|
|
60
84
|
},
|
|
61
85
|
contextWindow: 131072
|
|
62
86
|
},
|
|
63
|
-
{
|
|
64
|
-
|
|
87
|
+
"x-ai/grok-4.1-fast": {
|
|
88
|
+
name: "Grok 4.1 Fast",
|
|
89
|
+
maxTokens: 131072,
|
|
90
|
+
reasoning: false,
|
|
91
|
+
input: ["text"],
|
|
92
|
+
cost: {
|
|
93
|
+
input: .001,
|
|
94
|
+
output: .005,
|
|
95
|
+
cacheRead: 0,
|
|
96
|
+
cacheWrite: 0
|
|
97
|
+
},
|
|
98
|
+
contextWindow: 131072
|
|
99
|
+
},
|
|
100
|
+
"minimax/minimax-m2.7": {
|
|
101
|
+
name: "MiniMax M2.7",
|
|
102
|
+
maxTokens: 1e6,
|
|
103
|
+
reasoning: false,
|
|
104
|
+
input: ["text"],
|
|
105
|
+
cost: {
|
|
106
|
+
input: .001,
|
|
107
|
+
output: .005,
|
|
108
|
+
cacheRead: 0,
|
|
109
|
+
cacheWrite: 0
|
|
110
|
+
},
|
|
111
|
+
contextWindow: 1e6
|
|
112
|
+
},
|
|
113
|
+
"minimax/minimax-m2.5": {
|
|
65
114
|
name: "MiniMax M2.5",
|
|
66
115
|
maxTokens: 1e6,
|
|
67
116
|
reasoning: false,
|
|
@@ -74,8 +123,7 @@ const DEFAULT_SURF_MODELS = [
|
|
|
74
123
|
},
|
|
75
124
|
contextWindow: 1e6
|
|
76
125
|
},
|
|
77
|
-
{
|
|
78
|
-
id: "moonshotai/kimi-k2.5",
|
|
126
|
+
"moonshotai/kimi-k2.5": {
|
|
79
127
|
name: "Kimi K2.5",
|
|
80
128
|
maxTokens: 131072,
|
|
81
129
|
reasoning: true,
|
|
@@ -88,8 +136,7 @@ const DEFAULT_SURF_MODELS = [
|
|
|
88
136
|
},
|
|
89
137
|
contextWindow: 131072
|
|
90
138
|
},
|
|
91
|
-
{
|
|
92
|
-
id: "z-ai/glm-5",
|
|
139
|
+
"z-ai/glm-5": {
|
|
93
140
|
name: "GLM-5",
|
|
94
141
|
maxTokens: 128e3,
|
|
95
142
|
reasoning: false,
|
|
@@ -101,8 +148,85 @@ const DEFAULT_SURF_MODELS = [
|
|
|
101
148
|
cacheWrite: 0
|
|
102
149
|
},
|
|
103
150
|
contextWindow: 128e3
|
|
151
|
+
},
|
|
152
|
+
"z-ai/glm-5-turbo": {
|
|
153
|
+
name: "GLM-5 Turbo",
|
|
154
|
+
maxTokens: 128e3,
|
|
155
|
+
reasoning: false,
|
|
156
|
+
input: ["text"],
|
|
157
|
+
cost: {
|
|
158
|
+
input: .001,
|
|
159
|
+
output: .005,
|
|
160
|
+
cacheRead: 0,
|
|
161
|
+
cacheWrite: 0
|
|
162
|
+
},
|
|
163
|
+
contextWindow: 128e3
|
|
164
|
+
},
|
|
165
|
+
"qwen/qwen-2.5-7b-instruct": {
|
|
166
|
+
name: "Qwen 2.5 7B Instruct",
|
|
167
|
+
maxTokens: 32768,
|
|
168
|
+
reasoning: false,
|
|
169
|
+
input: ["text"],
|
|
170
|
+
cost: {
|
|
171
|
+
input: 5e-4,
|
|
172
|
+
output: .002,
|
|
173
|
+
cacheRead: 0,
|
|
174
|
+
cacheWrite: 0
|
|
175
|
+
},
|
|
176
|
+
contextWindow: 131072
|
|
177
|
+
},
|
|
178
|
+
"stepfun/step-3.5-flash": {
|
|
179
|
+
name: "Step 3.5 Flash",
|
|
180
|
+
maxTokens: 131072,
|
|
181
|
+
reasoning: false,
|
|
182
|
+
input: ["text"],
|
|
183
|
+
cost: {
|
|
184
|
+
input: .001,
|
|
185
|
+
output: .005,
|
|
186
|
+
cacheRead: 0,
|
|
187
|
+
cacheWrite: 0
|
|
188
|
+
},
|
|
189
|
+
contextWindow: 131072
|
|
190
|
+
},
|
|
191
|
+
"xiaomi/mimo-v2-pro": {
|
|
192
|
+
name: "MiMo V2 Pro",
|
|
193
|
+
maxTokens: 131072,
|
|
194
|
+
reasoning: true,
|
|
195
|
+
input: ["text"],
|
|
196
|
+
cost: {
|
|
197
|
+
input: .001,
|
|
198
|
+
output: .005,
|
|
199
|
+
cacheRead: 0,
|
|
200
|
+
cacheWrite: 0
|
|
201
|
+
},
|
|
202
|
+
contextWindow: 131072
|
|
104
203
|
}
|
|
105
|
-
|
|
204
|
+
};
|
|
205
|
+
const DEFAULT_CONTEXT_WINDOW = 131072;
|
|
206
|
+
const ZERO_COST = {
|
|
207
|
+
input: 0,
|
|
208
|
+
output: 0,
|
|
209
|
+
cacheRead: 0,
|
|
210
|
+
cacheWrite: 0
|
|
211
|
+
};
|
|
212
|
+
function modelFromId(id) {
|
|
213
|
+
const known = MODEL_METADATA[id];
|
|
214
|
+
if (known) return {
|
|
215
|
+
id,
|
|
216
|
+
...known
|
|
217
|
+
};
|
|
218
|
+
return {
|
|
219
|
+
id,
|
|
220
|
+
name: (id.split("/").pop() ?? id).replace(/[-_]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase()),
|
|
221
|
+
maxTokens: DEFAULT_CONTEXT_WINDOW,
|
|
222
|
+
reasoning: false,
|
|
223
|
+
input: ["text"],
|
|
224
|
+
cost: ZERO_COST,
|
|
225
|
+
contextWindow: DEFAULT_CONTEXT_WINDOW
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
/** Static fallback models used when upstream fetch fails. */
|
|
229
|
+
const DEFAULT_SURF_MODELS = Object.keys(MODEL_METADATA).map(modelFromId);
|
|
106
230
|
function resolveProviders(config) {
|
|
107
231
|
const defaultProtocol = resolveProtocol(config.protocol);
|
|
108
232
|
const defaultMppSessionBudget = resolveMppSessionBudget(config.mppSessionBudget);
|
|
@@ -1184,7 +1308,7 @@ async function resolveWalletForServe(flags) {
|
|
|
1184
1308
|
solanaKey: flags.solanaKey
|
|
1185
1309
|
});
|
|
1186
1310
|
if (wallet.source !== "none") return wallet;
|
|
1187
|
-
const { runSetup } = await import("../setup-
|
|
1311
|
+
const { runSetup } = await import("../setup-BdSfEdx4.js");
|
|
1188
1312
|
if (isTTY()) {
|
|
1189
1313
|
dim(" No wallet found. Let's set one up first.\n");
|
|
1190
1314
|
await runSetup();
|
|
@@ -1825,7 +1949,7 @@ Examples:
|
|
|
1825
1949
|
process.exit(1);
|
|
1826
1950
|
}
|
|
1827
1951
|
dim(" No wallet found. Let's set one up first.\n");
|
|
1828
|
-
const { runSetup } = await import("../setup-
|
|
1952
|
+
const { runSetup } = await import("../setup-BdSfEdx4.js");
|
|
1829
1953
|
await runSetup();
|
|
1830
1954
|
console.log();
|
|
1831
1955
|
wallet = resolveWallet();
|
|
@@ -2258,7 +2382,7 @@ Wallet is auto-generated on first run. No env vars needed.`
|
|
|
2258
2382
|
});
|
|
2259
2383
|
if (wallet.source === "none") {
|
|
2260
2384
|
dim("No wallet found. Auto-generating...");
|
|
2261
|
-
const { runSetup } = await import("../setup-
|
|
2385
|
+
const { runSetup } = await import("../setup-BdSfEdx4.js");
|
|
2262
2386
|
await runSetup({ nonInteractive: true });
|
|
2263
2387
|
const fresh = resolveWallet({
|
|
2264
2388
|
evmKey: flags.evmKey,
|
|
@@ -2279,7 +2403,7 @@ Wallet is auto-generated on first run. No env vars needed.`
|
|
|
2279
2403
|
const { SSEClientTransport } = await import("../sse-kba68iqF.js");
|
|
2280
2404
|
const { StreamableHTTPClientTransport } = await import("../streamableHttp-DRntYTFN.js");
|
|
2281
2405
|
const { Server } = await import("../server-Dbsk9dql.js");
|
|
2282
|
-
const { StdioServerTransport } = await import("../stdio-
|
|
2406
|
+
const { StdioServerTransport } = await import("../stdio-CdmkLt8r.js");
|
|
2283
2407
|
const { ListToolsRequestSchema, CallToolRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, ToolListChangedNotificationSchema, ResourceListChangedNotificationSchema } = await import("../types-DH9rDVeP.js");
|
|
2284
2408
|
async function connectTransport(target) {
|
|
2285
2409
|
try {
|
|
@@ -2321,7 +2445,7 @@ Wallet is auto-generated on first run. No env vars needed.`
|
|
|
2321
2445
|
}
|
|
2322
2446
|
const remoteClient = new Client({
|
|
2323
2447
|
name: "x402-proxy",
|
|
2324
|
-
version: "0.11.
|
|
2448
|
+
version: "0.11.4"
|
|
2325
2449
|
});
|
|
2326
2450
|
await connectTransport(remoteClient);
|
|
2327
2451
|
function recordX402Payment(ctx) {
|
|
@@ -2352,7 +2476,7 @@ Wallet is auto-generated on first run. No env vars needed.`
|
|
|
2352
2476
|
}
|
|
2353
2477
|
const localServer = new Server({
|
|
2354
2478
|
name: "x402-proxy",
|
|
2355
|
-
version: "0.11.
|
|
2479
|
+
version: "0.11.4"
|
|
2356
2480
|
}, { capabilities: {
|
|
2357
2481
|
tools: tools.length > 0 ? {} : void 0,
|
|
2358
2482
|
resources: remoteResources.length > 0 ? {} : void 0
|
|
@@ -2425,7 +2549,7 @@ Wallet is auto-generated on first run. No env vars needed.`
|
|
|
2425
2549
|
}));
|
|
2426
2550
|
const remoteClient = new Client({
|
|
2427
2551
|
name: "x402-proxy",
|
|
2428
|
-
version: "0.11.
|
|
2552
|
+
version: "0.11.4"
|
|
2429
2553
|
});
|
|
2430
2554
|
await connectTransport(remoteClient);
|
|
2431
2555
|
const mppClient = McpClient.wrap(remoteClient, { methods: wrappedMethods });
|
|
@@ -2440,7 +2564,7 @@ Wallet is auto-generated on first run. No env vars needed.`
|
|
|
2440
2564
|
}
|
|
2441
2565
|
const localServer = new Server({
|
|
2442
2566
|
name: "x402-proxy",
|
|
2443
|
-
version: "0.11.
|
|
2567
|
+
version: "0.11.4"
|
|
2444
2568
|
}, { capabilities: {
|
|
2445
2569
|
tools: tools.length > 0 ? {} : void 0,
|
|
2446
2570
|
resources: remoteResources.length > 0 ? {} : void 0
|
|
@@ -2826,7 +2950,7 @@ const app = buildApplication(buildRouteMap({
|
|
|
2826
2950
|
docs: { brief: "curl for x402 paid APIs" }
|
|
2827
2951
|
}), {
|
|
2828
2952
|
name: "x402-proxy",
|
|
2829
|
-
versionInfo: { currentVersion: "0.11.
|
|
2953
|
+
versionInfo: { currentVersion: "0.11.4" },
|
|
2830
2954
|
scanner: { caseStyle: "allow-kebab-for-camel" }
|
|
2831
2955
|
});
|
|
2832
2956
|
//#endregion
|
|
@@ -4,7 +4,7 @@ import { c as isConfigured, d as saveConfig, g as generateMnemonic, i as getConf
|
|
|
4
4
|
import "node:path";
|
|
5
5
|
import "node:fs";
|
|
6
6
|
import { stripVTControlCharacters, styleText } from "node:util";
|
|
7
|
-
import
|
|
7
|
+
import process$1, { stdin, stdout } from "node:process";
|
|
8
8
|
import "node:readline";
|
|
9
9
|
import ot from "node:readline";
|
|
10
10
|
import "node:tty";
|
|
@@ -493,7 +493,7 @@ var $t = class extends B {
|
|
|
493
493
|
//#endregion
|
|
494
494
|
//#region node_modules/.pnpm/@clack+prompts@1.1.0/node_modules/@clack/prompts/dist/index.mjs
|
|
495
495
|
function pt() {
|
|
496
|
-
return
|
|
496
|
+
return process$1.platform !== "win32" ? process$1.env.TERM !== "linux" : !!process$1.env.CI || !!process$1.env.WT_SESSION || !!process$1.env.TERMINUS_SUBLIME || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
497
497
|
}
|
|
498
498
|
const ee = pt(), I = (e, r) => ee ? e : r, Re = I("◆", "*"), $e = I("■", "x"), de = I("▲", "x"), V = I("◇", "o"), he = I("┌", "T"), h = I("│", "|"), x = I("└", "—");
|
|
499
499
|
I("┐", "T");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Z as JSONRPCMessageSchema } from "./types-BQ17ZF7g.js";
|
|
3
|
-
import
|
|
3
|
+
import process from "node:process";
|
|
4
4
|
//#region node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
|
|
5
5
|
/**
|
|
6
6
|
* Buffers a continuous stdio stream into discrete JSON-RPC messages.
|
|
@@ -35,7 +35,7 @@ function serializeMessage(message) {
|
|
|
35
35
|
* This transport is only available in Node.js environments.
|
|
36
36
|
*/
|
|
37
37
|
var StdioServerTransport = class {
|
|
38
|
-
constructor(_stdin =
|
|
38
|
+
constructor(_stdin = process.stdin, _stdout = process.stdout) {
|
|
39
39
|
this._stdin = _stdin;
|
|
40
40
|
this._stdout = _stdout;
|
|
41
41
|
this._readBuffer = new ReadBuffer();
|
package/package.json
CHANGED
package/dist/setup-DPuLACk7.js
DELETED