@opencompress/openclaw 3.0.9 → 3.0.10
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 +21 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
6
6
|
});
|
|
7
7
|
|
|
8
8
|
// src/config.ts
|
|
9
|
-
var VERSION = "3.0.
|
|
9
|
+
var VERSION = "3.0.10";
|
|
10
10
|
var PROXY_PORT = 8401;
|
|
11
11
|
var PROXY_HOST = "127.0.0.1";
|
|
12
12
|
var OCC_API = "https://www.opencompress.ai/api";
|
|
@@ -645,24 +645,27 @@ var plugin = {
|
|
|
645
645
|
const s = await res.json();
|
|
646
646
|
const balance = Number(s.balanceUsd || s.balance || 0);
|
|
647
647
|
const calls = s.monthlyApiCalls ?? s.totalCalls ?? 0;
|
|
648
|
-
const tokensSaved = Number(s.totalOriginalTokens || 0) - Number(s.totalCompressedTokens || 0);
|
|
649
|
-
const totalCharged = Number(s.month?.totalCharged || 0);
|
|
650
648
|
const totalSaved = Number(s.month?.costSaved || s.totalSavings || 0);
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
649
|
+
const crypto = __require("crypto");
|
|
650
|
+
const linkToken = crypto.createHash("sha256").update(key).digest("hex").slice(0, 16);
|
|
651
|
+
const dashboardUrl = `https://www.opencompress.ai/dashboard?link=${linkToken}`;
|
|
652
|
+
const isLinked = !!(s.email || s.accountLinked);
|
|
653
|
+
const lines = [
|
|
654
|
+
"```",
|
|
655
|
+
"OpenCompress",
|
|
656
|
+
"============",
|
|
657
|
+
`Balance: $${balance.toFixed(4)}`,
|
|
658
|
+
`Saved: $${totalSaved.toFixed(4)}`,
|
|
659
|
+
`API calls: ${calls}`,
|
|
660
|
+
"```",
|
|
661
|
+
""
|
|
662
|
+
];
|
|
663
|
+
if (isLinked) {
|
|
664
|
+
lines.push(`View details: ${dashboardUrl}`);
|
|
665
|
+
} else {
|
|
666
|
+
lines.push(`Sign up and claim $10 extra free credit: ${dashboardUrl}`);
|
|
667
|
+
}
|
|
668
|
+
return { text: lines.join("\n") };
|
|
666
669
|
} catch (err) {
|
|
667
670
|
return { text: `Error: ${err instanceof Error ? err.message : String(err)}` };
|
|
668
671
|
}
|