fix: show session friendly name in resume message and status bar

/history/{session_id} now returns a 'name' field alongside messages.
resumeSession() uses data.name first, then the sessionNames map, then
raw ID as fallback — so named sessions display correctly even on page
load before the sessions panel has been opened.

'Resumed session X' message also now shows the friendly name.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Scott Idem
2026-05-05 19:14:59 -04:00
parent 5d23d04e7e
commit 0b96772fa6
3 changed files with 20 additions and 4 deletions

View File

@@ -642,9 +642,13 @@
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const data = await res.json();
// Prefer name from API response, fall back to sessionNames map, then raw ID
const displayName = data.name || sessionNames.get(id) || id;
sessionNames.set(id, displayName);
messagesEl.innerHTML = '';
sessionId = id;
sessionEl.textContent = `session: ${sessionNames.get(id) || id}`;
sessionEl.textContent = `session: ${displayName}`;
currentHistory = [];
for (let i = 0; i < data.messages.length; i++) {
@@ -662,7 +666,7 @@
}
}
if (!silent) addMessage('system', `Resumed session ${id}`);
if (!silent) addMessage('system', `Resumed session: ${displayName}`);
scrollToBottom();
sessionsPanel.classList.remove('open');
sessionsBackdrop.classList.remove('open');