fix: make sessionExists() SQLite-aware for session_read tool
sessionExists() relied on JSON message directories which don't exist on SQLite. Return true on SQLite and let readSessionMessages() handle lookup. Also add empty-messages fallback in session_read for graceful not-found.
This commit is contained in:
parent
52161ef69f
commit
a25b35c380
@ -139,6 +139,7 @@ export function getMessageDir(sessionID: string): string | null {
|
||||
}
|
||||
|
||||
export function sessionExists(sessionID: string): boolean {
|
||||
if (isSqliteBackend()) return true
|
||||
return getMessageDir(sessionID) !== null
|
||||
}
|
||||
|
||||
|
||||
@ -76,6 +76,10 @@ export function createSessionManagerTools(ctx: PluginInput): Record<string, Tool
|
||||
|
||||
let messages = await readSessionMessages(args.session_id)
|
||||
|
||||
if (messages.length === 0) {
|
||||
return `Session not found: ${args.session_id}`
|
||||
}
|
||||
|
||||
if (args.limit && args.limit > 0) {
|
||||
messages = messages.slice(0, args.limit)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user