fix(ui): reset War Room after declined or aborted hunt (#63)

* fix(ui): reset War Room to idle when a hunt is declined or aborted

A declined-approval hunt ("hunt not started") — or the red-X abort — left the
War Room stuck advertising an active run: the ENGAGE button stayed on the
"ENGAGING…" spinner (disabled), the LIVE fidelity banner kept claiming "real
tools probing the target", and the narration rail kept showing "Looking at your
target". completeMission() only toggled the button's display, never restoring
its label/disabled/opacity, and never cleared the fidelity banner or narration
rail; abortMission() had the same gap and no-op'd entirely when nothing was
"running" (so the red X did nothing on a declined hunt).

Add resetEngageUI(): restores the ENGAGE button (▶ ENGAGE, enabled) and clears
the fidelity banner (setFidelity('off')) + narration rail. Route both
completeMission() and abortMission() through it, and let the red X clear a
leftover engaging/probing UI even when missionRunning is already false.

Client-side only; no behavior change to an actually-running mission.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix(ui): clear stale substatus when the red X resets an idle War Room

Review nit: the idle-abort branch set cmdMissionName='STANDBY' but left
cmdMissionStatus unchanged, so after an approval-declined the header could read
STANDBY with a stale red "approval declined" line beneath it. Reset the
substatus to the initial idle state ("Awaiting orders", #666) too.

Verified: abort after a decline now shows STANDBY / "Awaiting orders" (grey).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Junaid Y. SheikhandClaude Opus 4.8 authored and GitHub committed 2026-07-15 19:41:11 -04:00
1 parent 168f7df62c
commit 8959a288e5
1 file changed
+34 -7
+34 -7
View File
@@ -7593,6 +7593,26 @@ o.id === 'coordinator' ? `1. MISSION_STATUS: Progress assessment
// (each already paired with an addIntel into System Events) stay harmless. // (each already paired with an addIntel into System Events) stay harmless.
function addMissionLog(_type, _message) { /* no-op: Mission Log panel retired */ } function addMissionLog(_type, _message) { /* no-op: Mission Log panel retired */ }
// Return the War Room to an idle, ready-to-engage state. Every mission-terminal path
// (complete, fail, approval-declined, abort) MUST call this: it restores the ENGAGE button
// (a declined hunt otherwise leaves it stuck on the "ENGAGING…" spinner) and clears the
// LIVE/SIM fidelity banner + the "what it's doing now" narration rail, so the UI can never
// keep advertising an active probe after the hunt has stopped.
function resetEngageUI() {
const cmdStart = document.getElementById('cmdStartBtn');
if (cmdStart) {
cmdStart.style.display = 'block';
cmdStart.disabled = false;
cmdStart.style.opacity = '1';
cmdStart.innerHTML = '▶ ENGAGE';
}
const cmdPause = document.getElementById('cmdPauseBtn');
if (cmdPause) cmdPause.style.display = 'none';
if (typeof setFidelity === 'function') setFidelity('off');
const narrRail = document.getElementById('narrationRail');
if (narrRail) narrRail.style.display = 'none';
}
function completeMission(errorMsg) { function completeMission(errorMsg) {
missionRunning = false; missionRunning = false;
if (missionTimer) { clearInterval(missionTimer); missionTimer = null; } if (missionTimer) { clearInterval(missionTimer); missionTimer = null; }
@@ -7603,15 +7623,13 @@ o.id === 'coordinator' ? `1. MISSION_STATUS: Progress assessment
// Update War Room command header // Update War Room command header
const cmdName = document.getElementById('cmdMissionName'); const cmdName = document.getElementById('cmdMissionName');
const cmdStatus = document.getElementById('cmdMissionStatus'); const cmdStatus = document.getElementById('cmdMissionStatus');
const cmdStart = document.getElementById('cmdStartBtn');
const cmdPause = document.getElementById('cmdPauseBtn');
if (cmdName) cmdName.textContent = isError ? 'MISSION FAILED' : 'MISSION COMPLETE'; if (cmdName) cmdName.textContent = isError ? 'MISSION FAILED' : 'MISSION COMPLETE';
if (cmdStatus) { if (cmdStatus) {
cmdStatus.textContent = isError ? errorMsg : 'All phases executed'; cmdStatus.textContent = isError ? errorMsg : 'All phases executed';
cmdStatus.style.color = isError ? '#ff4444' : '#00ff88'; cmdStatus.style.color = isError ? '#ff4444' : '#00ff88';
} }
if (cmdStart) cmdStart.style.display = 'block'; // Restore ENGAGE button + clear LIVE/SIM banner + narration rail (see resetEngageUI).
if (cmdPause) cmdPause.style.display = 'none'; resetEngageUI();
// Update mission log // Update mission log
if (isError) { if (isError) {
@@ -18503,7 +18521,17 @@ IMPORTANT: This is an authorized security testing/red team platform. All operati
// Abort mission // Abort mission
function abortMission(skipConfirm) { function abortMission(skipConfirm) {
if (!missionRunning) return; // Even when nothing is actively running (e.g. an approval was just declined), the red X
// must still clear any leftover "ENGAGING…/LIVE probing" UI instead of being a no-op.
if (!missionRunning) {
const n = document.getElementById('cmdMissionName'); if (n) n.textContent = 'STANDBY';
// Also clear the substatus, or the header reads STANDBY with a stale red
// "approval declined" line beneath it. Match the initial idle state.
const s = document.getElementById('cmdMissionStatus');
if (s) { s.textContent = 'Awaiting orders'; s.style.color = '#666'; }
resetEngageUI();
return;
}
if (!skipConfirm && !confirm('Abort the current mission? All operator progress will be lost.')) return; if (!skipConfirm && !confirm('Abort the current mission? All operator progress will be lost.')) return;
missionRunning = false; missionRunning = false;
if (missionTimer) { clearInterval(missionTimer); missionTimer = null; } if (missionTimer) { clearInterval(missionTimer); missionTimer = null; }
@@ -18511,8 +18539,7 @@ IMPORTANT: This is an authorized security testing/red team platform. All operati
document.getElementById('cmdMissionName').textContent = 'STANDBY'; document.getElementById('cmdMissionName').textContent = 'STANDBY';
document.getElementById('cmdMissionStatus').textContent = 'Mission aborted'; document.getElementById('cmdMissionStatus').textContent = 'Mission aborted';
document.getElementById('cmdMissionStatus').style.color = '#ff4444'; document.getElementById('cmdMissionStatus').style.color = '#ff4444';
document.getElementById('cmdStartBtn').style.display = 'block'; resetEngageUI();
document.getElementById('cmdPauseBtn').style.display = 'none';
addIntel('COMMAND', 'Mission aborted. All operators standing down.', 'danger'); addIntel('COMMAND', 'Mission aborted. All operators standing down.', 'danger');
addMissionLog('error', 'MISSION ABORTED BY OPERATOR'); addMissionLog('error', 'MISSION ABORTED BY OPERATOR');