' + '
' + '
Select an entry
' + @@ -474,21 +551,44 @@ // Entry list async function loadEntries(autoImport) { try { - entries = await api('GET', '/api/entries?meta=1'); + entries = await api('GET', '/api/entries'); history.replaceState({list: true}, '', '/app/'); renderEntryList(); + loadAgentWidget(); // Load agents count if (autoImport && entries.length === 0) { - setTimeout(function() { showImport(); }, 200); + location.href = '/app/import.html'; } } catch (e) { + console.error('loadEntries error:', e); if (e.message !== 'Unauthorized') { // Vault not found (deleted/new device) — clear stale session sessionStorage.removeItem('clavitor_master'); + alert('Vault error: ' + e.message); init(); } } } + async function loadAgentWidget() { + try { + var agents = await api('GET', '/api/agents'); + var widget = document.getElementById('agentWidget'); + if (!agents || agents.length === 0) { + widget.classList.add('hidden'); + return; + } + var active = agents.filter(function(a) { return a.status === 'active'; }).length; + widget.innerHTML = '
' + + '🤖' + + '' + active + ' active agent' + (active !== 1 ? 's' : '') + '' + + 'Click to manage' + + '
'; + widget.classList.remove('hidden'); + } catch(e) { + // Silently fail - agents not critical + } + } + function domainFrom(url) { try { return new URL(url).hostname.replace(/^www\./, ''); } catch(e) { return url; } } @@ -587,11 +687,17 @@ // Entry detail async function showEntry(id, skipPush) { try { - currentEntry = await api('GET', '/api/entries/' + id); + var result = await api('GET', '/api/entries/' + id); + if (result.error) { + toast('Entry error: ' + result.error, 'error'); + return; + } + currentEntry = result; if (!skipPush) history.pushState({entry: id}, '', '#' + id); renderEntryDetail(); } catch (e) { - toast('Failed to load entry', 'error'); + toast('Failed to load entry: ' + (e.message || e), 'error'); + console.error('showEntry error:', e); } } @@ -632,7 +738,7 @@ fieldsHtml += 'decrypting...' + ''; } else if (f.kind === 'password') { - fieldsHtml += '••••••••' + + fieldsHtml += '••••••••' + ''; } else { fieldsHtml += '' + escapeHtml(f.value) + ''; @@ -673,20 +779,26 @@ '