async function renderBackups() { const content = document.getElementById('pageContent'); content.innerHTML = `
`; try { const backups = await api.getBackups(); const container = document.getElementById('backupList'); if (backups.length === 0) { container.innerHTML = '
💾
No backups yet
Create your first backup to protect your system configuration
'; return; } container.innerHTML = `
${backups.map(b => ` `).join('')}
NameSizeCreated
${escapeHtml(b.name)} ${formatBytes(b.size)} ${formatDate(b.created)}
${backups.length} backup${backups.length !== 1 ? 's' : ''}
`; } catch (err) { document.getElementById('backupList').innerHTML = `
âš 
${escapeHtml(err.message)}
`; } } async function createBackup() { try { const r = await api.createBackup(); showToast(`Backup created: ${r.file} (${formatBytes(r.size)})`, 'success'); renderBackups(); } catch (err) { showToast(`Error: ${err.message}`, 'error'); } } async function restoreBackup(encodedName) { const name = decodeURIComponent(encodedName); showModal('Restore Backup', `

Restore ${escapeHtml(name)}? This will overwrite current brain, skills, agents, registry, standards, and prompts data.

âš This action cannot be undone
`, ` `); } async function confirmRestore(encodedName) { const name = decodeURIComponent(encodedName); try { const r = await api.restoreBackup(name); closeModal(); showToast('Backup restored successfully', 'success'); renderBackups(); } catch (err) { showToast(`Error: ${err.message}`, 'error'); } }