@blockrun/clawrouter 0.12.52 → 0.12.53
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/index.js +22 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8739,16 +8739,10 @@ async function createStatsCommand() {
|
|
|
8739
8739
|
async function createWalletCommand() {
|
|
8740
8740
|
return {
|
|
8741
8741
|
name: "wallet",
|
|
8742
|
-
description: "Show BlockRun wallet info or export private key
|
|
8742
|
+
description: "Show BlockRun wallet info, usage stats, or export private key",
|
|
8743
8743
|
acceptsArgs: true,
|
|
8744
8744
|
requireAuth: true,
|
|
8745
8745
|
handler: async (ctx) => {
|
|
8746
|
-
const primary = String(
|
|
8747
|
-
ctx.config?.agents?.defaults?.model?.primary ?? ""
|
|
8748
|
-
);
|
|
8749
|
-
if (!primary.startsWith("blockrun/")) {
|
|
8750
|
-
return null;
|
|
8751
|
-
}
|
|
8752
8746
|
const subcommand = ctx.args?.trim().toLowerCase() || "status";
|
|
8753
8747
|
let walletKey;
|
|
8754
8748
|
let address;
|
|
@@ -8920,6 +8914,25 @@ Run \`openclaw plugins install @blockrun/clawrouter\` to generate a wallet.`,
|
|
|
8920
8914
|
} catch {
|
|
8921
8915
|
}
|
|
8922
8916
|
const currentChain = await resolvePaymentChain();
|
|
8917
|
+
let usageSection = "";
|
|
8918
|
+
try {
|
|
8919
|
+
const stats = await getStats(7);
|
|
8920
|
+
if (stats.totalRequests > 0) {
|
|
8921
|
+
const modelLines = Object.entries(stats.byModel).sort((a, b) => b[1].count - a[1].count).slice(0, 8).map(
|
|
8922
|
+
([model, data]) => ` ${model.length > 30 ? model.slice(0, 27) + "..." : model} ${data.count} reqs $${data.cost.toFixed(4)}`
|
|
8923
|
+
);
|
|
8924
|
+
usageSection = [
|
|
8925
|
+
"",
|
|
8926
|
+
`**Usage (${stats.period}):**`,
|
|
8927
|
+
` Total: ${stats.totalRequests} requests, $${stats.totalCost.toFixed(4)} spent`,
|
|
8928
|
+
stats.totalSavings > 0 ? ` Saved: $${stats.totalSavings.toFixed(4)} (${stats.savingsPercentage.toFixed(0)}% vs Opus baseline)` : "",
|
|
8929
|
+
"",
|
|
8930
|
+
"**Top Models:**",
|
|
8931
|
+
...modelLines
|
|
8932
|
+
].filter(Boolean).join("\n");
|
|
8933
|
+
}
|
|
8934
|
+
} catch {
|
|
8935
|
+
}
|
|
8923
8936
|
return {
|
|
8924
8937
|
text: [
|
|
8925
8938
|
"**ClawRouter Wallet**",
|
|
@@ -8931,12 +8944,14 @@ Run \`openclaw plugins install @blockrun/clawrouter\` to generate a wallet.`,
|
|
|
8931
8944
|
` ${evmBalanceText}`,
|
|
8932
8945
|
` Fund (USDC only): https://basescan.org/address/${address}`,
|
|
8933
8946
|
solanaSection,
|
|
8947
|
+
usageSection,
|
|
8934
8948
|
"",
|
|
8935
8949
|
`**Key File:** \`${WALLET_FILE}\``,
|
|
8936
8950
|
"",
|
|
8937
8951
|
"**Commands:**",
|
|
8938
8952
|
"\u2022 `/wallet` - Show this status",
|
|
8939
8953
|
"\u2022 `/wallet export` - Export private key for backup",
|
|
8954
|
+
"\u2022 `/stats` - Detailed usage breakdown",
|
|
8940
8955
|
!solanaSection ? "\u2022 `/wallet solana` - Enable Solana payments" : "",
|
|
8941
8956
|
solanaSection ? "\u2022 `/wallet base` - Switch to Base (EVM)" : "",
|
|
8942
8957
|
solanaSection ? "\u2022 `/wallet solana` - Switch to Solana" : ""
|