mirror of
https://github.com/myronblair/jarvis
synced 2026-06-30 17:50:23 -05:00
Fix Vision Protocol: rename shadowed ts var, load agents dynamically
const ts = ts() in loadVision caused TDZ ReferenceError crashing gallery. visionRunScreenshot now fetches online agents from agents_list API when no screenshots exist yet (previously showed No agents online falsely). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2922,7 +2922,7 @@ async function loadVision() {
|
||||
}
|
||||
|
||||
gallery.innerHTML = shots.map(s => {
|
||||
const ts = ts(s.created_at);
|
||||
const shotTs = ts(s.created_at);
|
||||
const has = s.file_size > 0;
|
||||
const meth = (s.method || 'unknown').toUpperCase();
|
||||
const dim = s.width && s.height ? `${s.width}×${s.height}` : '';
|
||||
@@ -2939,7 +2939,7 @@ async function loadVision() {
|
||||
◈ ${dim ? dim + ' · ' : ''}${Math.round((s.file_size||0)/1024)}KB IMAGE
|
||||
</div>` : '<div style="font-size:0.6rem;color:var(--dim);margin-bottom:6px;font-family:var(--mono)">TEXT SNAPSHOT ONLY</div>'}
|
||||
${analysis ? `<div style="font-size:0.62rem;line-height:1.5;color:var(--text-dim)">${esc(analysis)}${s.vision_analysis?.length>180?'…':''}</div>` : ''}
|
||||
<div style="font-family:var(--mono);font-size:0.55rem;color:var(--border2);margin-top:6px">${ts}</div>
|
||||
<div style="font-family:var(--mono);font-size:0.55rem;color:var(--border2);margin-top:6px">${shotTs}</div>
|
||||
</div>
|
||||
</div>`;
|
||||
}).join('');
|
||||
@@ -2965,8 +2965,11 @@ async function visionViewScreenshot(id) {
|
||||
}
|
||||
|
||||
async function visionRunScreenshot() {
|
||||
// Pick agent from dropdown or prompt
|
||||
const agents = _visionAgents;
|
||||
let agents = _visionAgents.length ? _visionAgents : null;
|
||||
if (!agents) {
|
||||
const all = await api('agents_list');
|
||||
agents = (Array.isArray(all) ? all : []).filter(a => a.status === 'online').map(a => a.hostname).filter(Boolean);
|
||||
}
|
||||
if (!agents.length) {
|
||||
toast('No agents online — check AGENTS tab', 'err'); return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user