@blockrun/clawrouter 0.12.127 → 0.12.128
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 +39 -37
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -79995,6 +79995,45 @@ function buildPartnerTools(proxyBaseUrl) {
|
|
|
79995
79995
|
return PARTNER_SERVICES.map((service) => buildTool(service, proxyBaseUrl));
|
|
79996
79996
|
}
|
|
79997
79997
|
|
|
79998
|
+
// src/commands/stats.ts
|
|
79999
|
+
function createStatsCommand() {
|
|
80000
|
+
return {
|
|
80001
|
+
name: "stats",
|
|
80002
|
+
description: "Show ClawRouter usage statistics and cost savings",
|
|
80003
|
+
acceptsArgs: true,
|
|
80004
|
+
requireAuth: false,
|
|
80005
|
+
handler: async (ctx) => {
|
|
80006
|
+
const arg = ctx.args?.trim().toLowerCase() || "7";
|
|
80007
|
+
if (arg === "clear" || arg === "reset") {
|
|
80008
|
+
try {
|
|
80009
|
+
const { deletedFiles } = await clearStats();
|
|
80010
|
+
return {
|
|
80011
|
+
text: `Stats cleared \u2014 ${deletedFiles} log file(s) deleted. Fresh start!`
|
|
80012
|
+
};
|
|
80013
|
+
} catch (err) {
|
|
80014
|
+
return {
|
|
80015
|
+
text: `Failed to clear stats: ${err instanceof Error ? err.message : String(err)}`,
|
|
80016
|
+
isError: true
|
|
80017
|
+
};
|
|
80018
|
+
}
|
|
80019
|
+
}
|
|
80020
|
+
const days = parseInt(arg, 10) || 7;
|
|
80021
|
+
try {
|
|
80022
|
+
const stats = await getStats(Math.min(days, 30));
|
|
80023
|
+
const ascii = formatStatsAscii(stats);
|
|
80024
|
+
return {
|
|
80025
|
+
text: ["```", ascii, "```"].join("\n")
|
|
80026
|
+
};
|
|
80027
|
+
} catch (err) {
|
|
80028
|
+
return {
|
|
80029
|
+
text: `Failed to load stats: ${err instanceof Error ? err.message : String(err)}`,
|
|
80030
|
+
isError: true
|
|
80031
|
+
};
|
|
80032
|
+
}
|
|
80033
|
+
}
|
|
80034
|
+
};
|
|
80035
|
+
}
|
|
80036
|
+
|
|
79998
80037
|
// src/index.ts
|
|
79999
80038
|
init_solana_balance();
|
|
80000
80039
|
|
|
@@ -80727,43 +80766,6 @@ async function startProxyInBackground(api) {
|
|
|
80727
80766
|
api.logger.info(`Wallet (${network}): ${displayAddress} | Balance: (checking...)`);
|
|
80728
80767
|
});
|
|
80729
80768
|
}
|
|
80730
|
-
function createStatsCommand() {
|
|
80731
|
-
return {
|
|
80732
|
-
name: "stats",
|
|
80733
|
-
description: "Show ClawRouter usage statistics and cost savings",
|
|
80734
|
-
acceptsArgs: true,
|
|
80735
|
-
requireAuth: false,
|
|
80736
|
-
handler: async (ctx) => {
|
|
80737
|
-
const arg = ctx.args?.trim().toLowerCase() || "7";
|
|
80738
|
-
if (arg === "clear" || arg === "reset") {
|
|
80739
|
-
try {
|
|
80740
|
-
const { deletedFiles } = await clearStats();
|
|
80741
|
-
return {
|
|
80742
|
-
text: `Stats cleared \u2014 ${deletedFiles} log file(s) deleted. Fresh start!`
|
|
80743
|
-
};
|
|
80744
|
-
} catch (err) {
|
|
80745
|
-
return {
|
|
80746
|
-
text: `Failed to clear stats: ${err instanceof Error ? err.message : String(err)}`,
|
|
80747
|
-
isError: true
|
|
80748
|
-
};
|
|
80749
|
-
}
|
|
80750
|
-
}
|
|
80751
|
-
const days = parseInt(arg, 10) || 7;
|
|
80752
|
-
try {
|
|
80753
|
-
const stats = await getStats(Math.min(days, 30));
|
|
80754
|
-
const ascii = formatStatsAscii(stats);
|
|
80755
|
-
return {
|
|
80756
|
-
text: ["```", ascii, "```"].join("\n")
|
|
80757
|
-
};
|
|
80758
|
-
} catch (err) {
|
|
80759
|
-
return {
|
|
80760
|
-
text: `Failed to load stats: ${err instanceof Error ? err.message : String(err)}`,
|
|
80761
|
-
isError: true
|
|
80762
|
-
};
|
|
80763
|
-
}
|
|
80764
|
-
}
|
|
80765
|
-
};
|
|
80766
|
-
}
|
|
80767
80769
|
function createExcludeCommand() {
|
|
80768
80770
|
return {
|
|
80769
80771
|
name: "exclude",
|