fix(core): recent() accepts options objects like sessions()
CLI / Node 22 / macos-latest (push) Canceled after 0s
CLI / Node 22 / ubuntu-latest (push) Canceled after 0s
CLI / Node 22 / windows-latest (push) Canceled after 0s
Publish Skill / publish (push) Canceled after 0s

Passing { limit } to recent() used to crash with 'Unknown named
parameter limit' because the options object was forwarded as the limit
value. Mirror sessions()'s QueryOptions | number signature.
This commit is contained in:
nanobot
2026-08-05 20:20:57 +08:00
parent 7c1b478e33
commit bf05a1ea50
+1 -1
View File
@@ -383,7 +383,7 @@ function createQueryApi(
return db.prepare(`SELECT * FROM sessions s WHERE ${where} ORDER BY ended_at DESC LIMIT ?`).all(...params); return db.prepare(`SELECT * FROM sessions s WHERE ${where} ORDER BY ended_at DESC LIMIT ?`).all(...params);
}; };
const recent = (n = 10) => sessions({ limit: n }); const recent = (n: QueryOptions | number = 10) => sessions(typeof n === 'object' && n !== null ? n : { limit: n });
const summaries = (optsOrSid?: QueryOptions | string) => { const summaries = (optsOrSid?: QueryOptions | string) => {
const opts = normalizeOpts(optsOrSid); const opts = normalizeOpts(optsOrSid);