x402-proxy 0.8.2 → 0.8.3
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 -1
- package/dist/bin/cli.js +26 -9
- package/dist/openclaw/plugin.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.8.3] - 2026-03-24
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- JSON response pretty-printing: non-streaming `application/json` responses auto-formatted with 2-space indent on TTY
|
|
14
|
+
- `--json` flag now works: forces JSON pretty-printing even when piped (non-TTY)
|
|
15
|
+
- Color-coded HTTP status lines: green for 2xx, yellow for 3xx, red for 4xx/5xx
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
- MPP streaming payment label unified from `MPP session:` to `Payment: ... MPP` to match non-streaming format
|
|
19
|
+
- MPP streaming status line now starts on a new line instead of appending to last JSON chunk
|
|
20
|
+
|
|
10
21
|
## [0.8.2] - 2026-03-24
|
|
11
22
|
|
|
12
23
|
### Fixed
|
|
@@ -219,7 +230,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
219
230
|
- `appendHistory` / `readHistory` / `calcSpend` - JSONL transaction history
|
|
220
231
|
- Re-exports from `@x402/fetch`, `@x402/svm`, `@x402/evm`
|
|
221
232
|
|
|
222
|
-
[Unreleased]: https://github.com/cascade-protocol/x402-proxy/compare/v0.8.
|
|
233
|
+
[Unreleased]: https://github.com/cascade-protocol/x402-proxy/compare/v0.8.3...HEAD
|
|
234
|
+
[0.8.3]: https://github.com/cascade-protocol/x402-proxy/compare/v0.8.2...v0.8.3
|
|
223
235
|
[0.8.2]: https://github.com/cascade-protocol/x402-proxy/compare/v0.8.1...v0.8.2
|
|
224
236
|
[0.8.1]: https://github.com/cascade-protocol/x402-proxy/compare/v0.8.0...v0.8.1
|
|
225
237
|
[0.8.0]: https://github.com/cascade-protocol/x402-proxy/compare/v0.7.1...v0.8.0
|
package/dist/bin/cli.js
CHANGED
|
@@ -301,6 +301,9 @@ async function createMppProxyHandler(opts) {
|
|
|
301
301
|
|
|
302
302
|
//#endregion
|
|
303
303
|
//#region src/commands/fetch.ts
|
|
304
|
+
function isStreamingResponse(res) {
|
|
305
|
+
return (res.headers.get("content-type") ?? "").includes("text/event-stream");
|
|
306
|
+
}
|
|
304
307
|
const fetchCommand = buildCommand({
|
|
305
308
|
docs: {
|
|
306
309
|
brief: "Make a paid HTTP request (default command)",
|
|
@@ -527,7 +530,8 @@ Examples:
|
|
|
527
530
|
usedProtocol = "mpp";
|
|
528
531
|
const elapsedMs = Date.now() - startMs;
|
|
529
532
|
const spentAmount = mppPayment.amount ? Number(mppPayment.amount) : void 0;
|
|
530
|
-
if (
|
|
533
|
+
if (isTTY()) process.stderr.write("\n");
|
|
534
|
+
if (mppPayment && isTTY()) info(` Payment:${spentAmount != null ? ` ${formatAmount(spentAmount, "USDC")}` : ""} MPP (${displayNetwork(mppPayment.network)})`);
|
|
531
535
|
if (isTTY()) dim(` Streamed (${elapsedMs}ms)`);
|
|
532
536
|
if (mppPayment) {
|
|
533
537
|
const record = {
|
|
@@ -688,7 +692,11 @@ Examples:
|
|
|
688
692
|
else if (x402Payment) info(` Payment: ${x402Payment.amount ? formatAmount(Number(x402Payment.amount) / 1e6, "USDC") : "? USDC"} (${displayNetwork(x402Payment.network ?? "unknown")})`);
|
|
689
693
|
if (txSig) dim(` Tx: ${txSig}`);
|
|
690
694
|
}
|
|
691
|
-
if (isTTY())
|
|
695
|
+
if (isTTY()) {
|
|
696
|
+
const statusText = ` ${response.status} ${response.statusText} (${elapsedMs}ms)`;
|
|
697
|
+
const colorFn = response.status < 300 ? pc.green : response.status < 400 ? pc.yellow : pc.red;
|
|
698
|
+
process.stderr.write(`${colorFn(statusText)}\n`);
|
|
699
|
+
}
|
|
692
700
|
if (x402Payment) {
|
|
693
701
|
const record = {
|
|
694
702
|
t: Date.now(),
|
|
@@ -719,7 +727,16 @@ Examples:
|
|
|
719
727
|
};
|
|
720
728
|
appendHistory(getHistoryPath(), record);
|
|
721
729
|
}
|
|
722
|
-
|
|
730
|
+
const shouldPrettyPrint = (response.headers.get("content-type") ?? "").includes("application/json") && (flags.json || isTTY()) && !isStreamingResponse(response);
|
|
731
|
+
if (response.body) if (shouldPrettyPrint) {
|
|
732
|
+
const text = await response.text();
|
|
733
|
+
try {
|
|
734
|
+
process.stdout.write(`${JSON.stringify(JSON.parse(text), null, 2)}\n`);
|
|
735
|
+
} catch {
|
|
736
|
+
process.stdout.write(text);
|
|
737
|
+
if (isTTY()) process.stdout.write("\n");
|
|
738
|
+
}
|
|
739
|
+
} else {
|
|
723
740
|
const reader = response.body.getReader();
|
|
724
741
|
try {
|
|
725
742
|
while (true) {
|
|
@@ -730,8 +747,8 @@ Examples:
|
|
|
730
747
|
} finally {
|
|
731
748
|
reader.releaseLock();
|
|
732
749
|
}
|
|
750
|
+
if (isTTY()) process.stdout.write("\n");
|
|
733
751
|
}
|
|
734
|
-
if (isTTY() && response.body) process.stdout.write("\n");
|
|
735
752
|
}
|
|
736
753
|
});
|
|
737
754
|
|
|
@@ -843,7 +860,7 @@ Add to your MCP client config (Claude, Cursor, etc.):
|
|
|
843
860
|
}
|
|
844
861
|
const remoteClient = new Client({
|
|
845
862
|
name: "x402-proxy",
|
|
846
|
-
version: "0.8.
|
|
863
|
+
version: "0.8.3"
|
|
847
864
|
});
|
|
848
865
|
const x402Mcp = new x402MCPClient(remoteClient, x402PaymentClient, {
|
|
849
866
|
autoPayment: true,
|
|
@@ -881,7 +898,7 @@ Add to your MCP client config (Claude, Cursor, etc.):
|
|
|
881
898
|
}
|
|
882
899
|
const localServer = new Server({
|
|
883
900
|
name: "x402-proxy",
|
|
884
|
-
version: "0.8.
|
|
901
|
+
version: "0.8.3"
|
|
885
902
|
}, { capabilities: {
|
|
886
903
|
tools: tools.length > 0 ? {} : void 0,
|
|
887
904
|
resources: remoteResources.length > 0 ? {} : void 0
|
|
@@ -976,7 +993,7 @@ Add to your MCP client config (Claude, Cursor, etc.):
|
|
|
976
993
|
}));
|
|
977
994
|
const remoteClient = new Client({
|
|
978
995
|
name: "x402-proxy",
|
|
979
|
-
version: "0.8.
|
|
996
|
+
version: "0.8.3"
|
|
980
997
|
});
|
|
981
998
|
await connectTransport(remoteClient);
|
|
982
999
|
const mppClient = McpClient.wrap(remoteClient, { methods: wrappedMethods });
|
|
@@ -991,7 +1008,7 @@ Add to your MCP client config (Claude, Cursor, etc.):
|
|
|
991
1008
|
}
|
|
992
1009
|
const localServer = new Server({
|
|
993
1010
|
name: "x402-proxy",
|
|
994
|
-
version: "0.8.
|
|
1011
|
+
version: "0.8.3"
|
|
995
1012
|
}, { capabilities: {
|
|
996
1013
|
tools: tools.length > 0 ? {} : void 0,
|
|
997
1014
|
resources: remoteResources.length > 0 ? {} : void 0
|
|
@@ -1203,7 +1220,7 @@ const routes = buildRouteMap({
|
|
|
1203
1220
|
});
|
|
1204
1221
|
const app = buildApplication(routes, {
|
|
1205
1222
|
name: "x402-proxy",
|
|
1206
|
-
versionInfo: { currentVersion: "0.8.
|
|
1223
|
+
versionInfo: { currentVersion: "0.8.3" },
|
|
1207
1224
|
scanner: { caseStyle: "allow-kebab-for-camel" }
|
|
1208
1225
|
});
|
|
1209
1226
|
|
package/dist/openclaw/plugin.js
CHANGED
|
@@ -726,7 +726,7 @@ function createWalletCommand(ctx) {
|
|
|
726
726
|
try {
|
|
727
727
|
const snap = await getWalletSnapshot(ctx.rpcUrl, walletAddress, ctx.historyPath);
|
|
728
728
|
const solscanUrl = `https://solscan.io/account/${walletAddress}`;
|
|
729
|
-
const lines = [`x402-proxy v0.8.
|
|
729
|
+
const lines = [`x402-proxy v0.8.3`];
|
|
730
730
|
const defaultModel = ctx.allModels[0];
|
|
731
731
|
if (defaultModel) lines.push("", `**Model** - ${defaultModel.name} (${defaultModel.provider})`);
|
|
732
732
|
lines.push("", `**[Wallet](${solscanUrl})**`, `\`${walletAddress}\``);
|
package/package.json
CHANGED