@kenhkl/agent-moss 0.12.2 → 0.12.4
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/cli.js +10 -3
- package/dist/cli.js.map +1 -1
- package/dist/engine/coordinator.js +8 -2
- package/dist/engine/coordinator.js.map +1 -1
- package/dist/server.js +10 -3
- package/dist/server.js.map +1 -1
- package/dist/static/index.html +119 -28
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3548,6 +3548,7 @@ var init_script_content_analyzer = __esm({
|
|
|
3548
3548
|
var token_stats_exports = {};
|
|
3549
3549
|
__export(token_stats_exports, {
|
|
3550
3550
|
getRecentRecords: () => getRecentRecords,
|
|
3551
|
+
getRecentRecordsCount: () => getRecentRecordsCount,
|
|
3551
3552
|
getTokenStats: () => getTokenStats,
|
|
3552
3553
|
getTokenTrend: () => getTokenTrend,
|
|
3553
3554
|
recordTokenUsage: () => recordTokenUsage,
|
|
@@ -3668,9 +3669,14 @@ function getTokenStats(days = 0, startDate, endDate) {
|
|
|
3668
3669
|
by_date: a.byDate
|
|
3669
3670
|
};
|
|
3670
3671
|
}
|
|
3671
|
-
function getRecentRecords(limit = 20) {
|
|
3672
|
+
function getRecentRecords(limit = 20, offset = 0) {
|
|
3672
3673
|
const records = loadAllRecords(getStatsPath());
|
|
3673
|
-
|
|
3674
|
+
const start = Math.max(0, records.length - offset - limit);
|
|
3675
|
+
const end = records.length - offset;
|
|
3676
|
+
return records.slice(start, end);
|
|
3677
|
+
}
|
|
3678
|
+
function getRecentRecordsCount() {
|
|
3679
|
+
return loadAllRecords(getStatsPath()).length;
|
|
3674
3680
|
}
|
|
3675
3681
|
function getTokenTrend(days = 0, startDate, endDate) {
|
|
3676
3682
|
const records = filterByDate(loadAllRecords(getStatsPath()), days, startDate, endDate);
|
|
@@ -5511,7 +5517,8 @@ function createConsoleRouter() {
|
|
|
5511
5517
|
});
|
|
5512
5518
|
console2.get("/api/token-stats/recent", (c) => {
|
|
5513
5519
|
const limit = parseInt(c.req.query("limit") || "20", 10);
|
|
5514
|
-
|
|
5520
|
+
const offset = parseInt(c.req.query("offset") || "0", 10);
|
|
5521
|
+
return c.json({ records: getRecentRecords(limit, offset), total: getRecentRecordsCount() });
|
|
5515
5522
|
});
|
|
5516
5523
|
console2.get("/api/token-stats/trend", (c) => {
|
|
5517
5524
|
const days = parseInt(c.req.query("days") || "7", 10);
|