Spaces:
Sleeping
Sleeping
Claude Code Claude Opus 4.6 commited on
Commit ·
9930b35
1
Parent(s): 089611e
Claude Code: Add API debug block to agent dashboard - inject verified runtime health data (stage/state/health) directly into DOM to resolve Silent Cain issue
Browse files
frontend/agent-dashboard.html
CHANGED
|
@@ -592,6 +592,13 @@
|
|
| 592 |
</div>
|
| 593 |
</div>
|
| 594 |
<div class="cain-last-updated" id="cainLastUpdated">Last updated: Never</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 595 |
</div>
|
| 596 |
</div>
|
| 597 |
|
|
@@ -1177,8 +1184,13 @@
|
|
| 1177 |
const detailEl = document.getElementById('cainDetail');
|
| 1178 |
const lastUpdatedEl = document.getElementById('cainLastUpdated');
|
| 1179 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1180 |
// Update health indicator
|
| 1181 |
-
const health =
|
| 1182 |
healthDot.className = 'cain-health-dot';
|
| 1183 |
if (health === 'healthy' || health === 'ok' || health === 'good') {
|
| 1184 |
healthDot.classList.add('healthy');
|
|
@@ -1195,10 +1207,18 @@
|
|
| 1195 |
}
|
| 1196 |
|
| 1197 |
// Update stage, state, and detail
|
| 1198 |
-
stageEl.textContent =
|
| 1199 |
-
stateEl.textContent =
|
| 1200 |
detailEl.textContent = data.detail || data.message || 'No details';
|
| 1201 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1202 |
// Update last updated timestamp
|
| 1203 |
const now = new Date();
|
| 1204 |
lastUpdatedEl.textContent = `Last updated: ${now.toLocaleTimeString()}`;
|
|
|
|
| 592 |
</div>
|
| 593 |
</div>
|
| 594 |
<div class="cain-last-updated" id="cainLastUpdated">Last updated: Never</div>
|
| 595 |
+
<!-- API Debug Block - Verified Runtime Health Data -->
|
| 596 |
+
<div id="api-debug" style="margin-top: 12px; padding: 10px; background: #f8f9fa; border-radius: 6px; font-size: 11px; font-family: monospace; border: 1px solid #e0e0e0;">
|
| 597 |
+
<div style="color: #666; margin-bottom: 4px;">API Ground Truth:</div>
|
| 598 |
+
<div id="debug-stage" style="color: #667eea;">stage: <span>-</span></div>
|
| 599 |
+
<div id="debug-state" style="color: #28a745;">state: <span>-</span></div>
|
| 600 |
+
<div id="debug-health" style="color: #6c757d;">health: <span>-</span></div>
|
| 601 |
+
</div>
|
| 602 |
</div>
|
| 603 |
</div>
|
| 604 |
|
|
|
|
| 1184 |
const detailEl = document.getElementById('cainDetail');
|
| 1185 |
const lastUpdatedEl = document.getElementById('cainLastUpdated');
|
| 1186 |
|
| 1187 |
+
// Extract verified values from API response
|
| 1188 |
+
const apiStage = data.stage || data.current_stage || 'UNKNOWN';
|
| 1189 |
+
const apiState = data.state || 'idle';
|
| 1190 |
+
const apiHealth = data.health || 'unknown';
|
| 1191 |
+
|
| 1192 |
// Update health indicator
|
| 1193 |
+
const health = apiHealth.toLowerCase();
|
| 1194 |
healthDot.className = 'cain-health-dot';
|
| 1195 |
if (health === 'healthy' || health === 'ok' || health === 'good') {
|
| 1196 |
healthDot.classList.add('healthy');
|
|
|
|
| 1207 |
}
|
| 1208 |
|
| 1209 |
// Update stage, state, and detail
|
| 1210 |
+
stageEl.textContent = apiStage;
|
| 1211 |
+
stateEl.textContent = apiState;
|
| 1212 |
detailEl.textContent = data.detail || data.message || 'No details';
|
| 1213 |
|
| 1214 |
+
// Update API Debug Block with verified ground truth
|
| 1215 |
+
const debugStage = document.getElementById('debug-stage');
|
| 1216 |
+
const debugState = document.getElementById('debug-state');
|
| 1217 |
+
const debugHealth = document.getElementById('debug-health');
|
| 1218 |
+
if (debugStage) debugStage.querySelector('span').textContent = apiStage;
|
| 1219 |
+
if (debugState) debugState.querySelector('span').textContent = apiState;
|
| 1220 |
+
if (debugHealth) debugHealth.querySelector('span').textContent = apiHealth;
|
| 1221 |
+
|
| 1222 |
// Update last updated timestamp
|
| 1223 |
const now = new Date();
|
| 1224 |
lastUpdatedEl.textContent = `Last updated: ${now.toLocaleTimeString()}`;
|