feat: group sidebar sessions by project

This commit is contained in:
shiyue
2026-04-24 15:22:31 +08:00
parent 2e2dc21047
commit a6f3ab0485
3 changed files with 198 additions and 44 deletions

View File

@@ -1460,12 +1460,15 @@ function sendSessionList(ws) {
for (const f of files) {
try {
const s = normalizeSession(JSON.parse(fs.readFileSync(path.join(SESSIONS_DIR, f), 'utf8')));
const cwd = s.cwd || '';
sessions.push({
id: s.id,
title: s.title || 'Untitled',
updated: s.updated,
hasUnread: !!s.hasUnread,
agent: getSessionAgent(s),
cwd,
projectName: cwd ? path.basename(cwd.replace(/[\\/]+$/, '')) : '',
isRunning: activeProcesses.has(s.id),
});
} catch {}