fix: arbiter session collision — separate session folder + always fresh session

- resolveSessionFolder now always returns unique folder for arbiter
  (prevents sharing session with owner when both use same agent type)
- Arbiter sessionId forced to undefined to prevent resume attempts
This commit is contained in:
Eyejoker
2026-03-31 04:26:48 +09:00
parent 56c85c357a
commit 60408cc1fa
3 changed files with 18 additions and 1 deletions

View File

@@ -1137,6 +1137,18 @@ export function getLastHumanMessageTimestamp(chatJid: string): string | null {
return row?.timestamp ?? null;
}
export function getLastHumanMessageSender(chatJid: string): string | null {
const row = db
.prepare(
`SELECT sender FROM messages
WHERE chat_jid = ? AND is_bot_message = 0 AND is_from_me = 0
AND content != '' AND content IS NOT NULL
ORDER BY timestamp DESC, seq DESC LIMIT 1`,
)
.get(chatJid) as { sender: string } | undefined;
return row?.sender ?? null;
}
export function getLastHumanMessageContent(chatJid: string): string | null {
const row = db
.prepare(