update
This commit is contained in:
@@ -89,10 +89,10 @@
|
||||
let activeView = sessionStorage.getItem(VIEW_KEY) === "hardware"
|
||||
? "hardware"
|
||||
: "software";
|
||||
let executionMode = sessionStorage.getItem(MODE_KEY) === "bench"
|
||||
? "bench"
|
||||
: "shadow";
|
||||
sessionStorage.removeItem(MODE_KEY);
|
||||
let executionMode = "shadow";
|
||||
let polling = false;
|
||||
let bootstrapRuntimeReset = false;
|
||||
let toastTimer = 0;
|
||||
let confirmationResolve = null;
|
||||
let eventFilter = "all";
|
||||
@@ -642,6 +642,29 @@
|
||||
});
|
||||
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
||||
latest = await response.json();
|
||||
if (!bootstrapRuntimeReset) {
|
||||
bootstrapRuntimeReset = true;
|
||||
const backendMode = latest.runtime?.execution_mode === "bench" ? "bench" : "shadow";
|
||||
if (backendMode === "bench") {
|
||||
// A physical session is authoritative: retain it and render bench feedback.
|
||||
executionMode = "bench";
|
||||
sessionStorage.setItem(MODE_KEY, executionMode);
|
||||
if ($("#repairExecutionMode")) $("#repairExecutionMode").value = executionMode;
|
||||
} else {
|
||||
// Shadow state is one-run-only. A full web runtime restart always returns
|
||||
// counters, injected faults, and the twin to the initial safe state.
|
||||
if (latest.runtime?.active) {
|
||||
await apiPost("/runtime", { active: false, execution_mode: "shadow" });
|
||||
}
|
||||
await apiPost("/runtime/reset-statistics");
|
||||
const resetResponse = await fetch(`${API_ROOT}/state`, {
|
||||
cache: "no-store",
|
||||
credentials: "same-origin",
|
||||
headers: { Accept: "application/json", "X-Cognitive-Agent-Role": "admin" },
|
||||
});
|
||||
if (resetResponse.ok) latest = await resetResponse.json();
|
||||
}
|
||||
}
|
||||
if (!["IDLE"].includes(latest.healing?.phase)) selectedCaseId = latest.healing.case_id;
|
||||
renderAll();
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user