diff --git a/public/index.html b/public/index.html
index c352e76..a678ac3 100644
--- a/public/index.html
+++ b/public/index.html
@@ -1002,6 +1002,43 @@
}
}
+ async function fetchExistingSessions() {
+ try {
+ const res = await fetch('/api/sessions');
+ if (!res.ok) {
+ console.error('Failed to fetch existing sessions:', await res.text());
+ return;
+ }
+ const sessions = await res.json();
+ sessions.forEach(session => {
+ state.sessions.set(session.id, {
+ id: session.id,
+ cwd: session.cwd,
+ command: session.command,
+ output: '',
+ outputRenderedLength: 0,
+ expanded: false,
+ state: 'ready',
+ prompts: 0,
+ completions: 0,
+ tools: 0,
+ compressions: 0,
+ thinking_seconds: 0,
+ work_seconds: 0,
+ mode: 'normal',
+ model: null,
+ idle_since: null,
+ git_branch: null,
+ git_files_json: null,
+ autoScroll: true,
+ });
+ });
+ renderSessions();
+ } catch (error) {
+ console.error('Error fetching existing sessions:', error);
+ }
+ }
+
function connectSSE() {
if (state.eventSource) {
state.eventSource.close();
@@ -1016,6 +1053,7 @@
clearTimeout(state.reconnectTimeout);
state.reconnectTimeout = null;
}
+ fetchExistingSessions();
});
es.addEventListener('error', () => {