Scope skill usage to request profile

This commit is contained in:
ekko
2026-05-24 08:48:40 +08:00
committed by ekko
parent f372d0a905
commit 4db3940e65
3 changed files with 67 additions and 2 deletions
+2 -1
View File
@@ -953,11 +953,12 @@ function formatUnixDate(timestamp: number | null): string {
export async function getSkillUsageStatsFromDb(
days = 7,
nowSeconds = Math.floor(Date.now() / 1000),
profile?: string,
): Promise<HermesSkillUsageStats> {
const normalizedDays = Number.isFinite(days) ? days : 7
const safeDays = Math.max(1, Math.floor(normalizedDays))
const since = nowSeconds - safeDays * 24 * 60 * 60
const db = await openSessionDb()
const db = await openSessionDb(profile)
try {
const hasStartedIndex = db.prepare("PRAGMA index_list(sessions)").all()