@opencompress/openclaw 3.0.9 → 3.0.11
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 -26
- 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.11";
|
|
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";
|
|
@@ -312,14 +312,6 @@ function startProxy(getProviders2, getOccKey) {
|
|
|
312
312
|
server.on("error", (err) => {
|
|
313
313
|
if (err.code === "EADDRINUSE") {
|
|
314
314
|
server = null;
|
|
315
|
-
try {
|
|
316
|
-
const { execSync } = __require("child_process");
|
|
317
|
-
execSync(`lsof -i :${PROXY_PORT} -t | xargs kill -9 2>/dev/null`, { stdio: "ignore" });
|
|
318
|
-
} catch {
|
|
319
|
-
}
|
|
320
|
-
setTimeout(() => {
|
|
321
|
-
if (!server) startProxy(getProviders2, getOccKey);
|
|
322
|
-
}, 2e3);
|
|
323
315
|
}
|
|
324
316
|
});
|
|
325
317
|
return server;
|
|
@@ -645,24 +637,27 @@ var plugin = {
|
|
|
645
637
|
const s = await res.json();
|
|
646
638
|
const balance = Number(s.balanceUsd || s.balance || 0);
|
|
647
639
|
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
640
|
const totalSaved = Number(s.month?.costSaved || s.totalSavings || 0);
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
641
|
+
const crypto = __require("crypto");
|
|
642
|
+
const linkToken = crypto.createHash("sha256").update(key).digest("hex").slice(0, 16);
|
|
643
|
+
const dashboardUrl = `https://www.opencompress.ai/dashboard?link=${linkToken}`;
|
|
644
|
+
const isLinked = !!(s.email || s.accountLinked);
|
|
645
|
+
const lines = [
|
|
646
|
+
"```",
|
|
647
|
+
"OpenCompress",
|
|
648
|
+
"============",
|
|
649
|
+
`Balance: $${balance.toFixed(4)}`,
|
|
650
|
+
`Saved: $${totalSaved.toFixed(4)}`,
|
|
651
|
+
`API calls: ${calls}`,
|
|
652
|
+
"```",
|
|
653
|
+
""
|
|
654
|
+
];
|
|
655
|
+
if (isLinked) {
|
|
656
|
+
lines.push(`View details: ${dashboardUrl}`);
|
|
657
|
+
} else {
|
|
658
|
+
lines.push(`Sign up and claim $10 extra free credit: ${dashboardUrl}`);
|
|
659
|
+
}
|
|
660
|
+
return { text: lines.join("\n") };
|
|
666
661
|
} catch (err) {
|
|
667
662
|
return { text: `Error: ${err instanceof Error ? err.message : String(err)}` };
|
|
668
663
|
}
|