fix(ui): preserve server-reported live agent count (#71)
The Settings agent card's render() set window.__t3mpLiveAgents from CLIENT-side pings only (Object.keys(pingStatus).filter(ok)). Agents connected server-side — via autoReconnect (ping:false) or a status?check=1 re-ping — are live on the server even though this client never pinged them, so every re-render reset the count to 0. Since upstream's t3mpHasBackend() is now `llmAvailable || live > 0`, that clobber made the War Room show "No LLM backbone — connect an agent before hunting" on localhost even with a genuinely-live local agent (repro: 3 agents connected, hermes lastPing.ok on the server, yet hasBackend=false after any detect/render). Fix: live = max(client-pinged-ok, server-reported-live), reading the server's own agent state (window.__t3mpServerAgents, refreshed via status?check=1). The summary and the global now both reflect reality and re-renders no longer break the gate. Verified: hasBackend stays true across detect/connect re-renders. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
5b4ac700ad
commit
8e436d0da2
1 file changed
+8
-1
+8
-1
@@ -24817,7 +24817,14 @@ Be specific and actionable. Format as structured JSON.`;
|
||||
list.innerHTML = agents.map(function(a){ return rowHtml(a); }).join('');
|
||||
const ready = agents.filter(function(a){return a.ready;}).length;
|
||||
const installed = agents.filter(function(a){return a.installed;}).length;
|
||||
const live = Object.keys(pingStatus).filter(function(k){return pingStatus[k].ok;}).length;
|
||||
// Live = client-side successful pings OR agents the SERVER already reports live. Agents connected
|
||||
// server-side (autoReconnect, or a status?check=1 re-ping) are live even though THIS client never
|
||||
// pinged them; counting only client pings here clobbered window.__t3mpLiveAgents back to 0 on every
|
||||
// re-render, which broke the War Room backbone gate (t3mpHasBackend) for a genuinely-usable agent.
|
||||
const clientLive = Object.keys(pingStatus).filter(function(k){return pingStatus[k].ok;}).length;
|
||||
const serverLive = Array.isArray(window.__t3mpServerAgents)
|
||||
? window.__t3mpServerAgents.filter(function(a){ return a.lastPing && a.lastPing.ok; }).length : 0;
|
||||
const live = Math.max(clientLive, serverLive);
|
||||
const sum = document.getElementById('localAgentsSummary');
|
||||
if (sum) sum.innerHTML = connectedIds.length+' active'+(live?' · '+live+' live':'')+' · '+ready+' ready · '+installed+'/'+agents.length+' installed';
|
||||
// expose live/connected counts separately. A plain connect is just a registration; only a
|
||||
|
||||
Reference in new issue
Block a user