Add Back to the dashboard to the loop's end screen

AI Assisted
This commit is contained in:
jparkerweb committed 2026-11-02 13:23:13 -08:00
1 parent c8d12a3d99
commit 26cb17f04a
10 files changed
+62 -7

No files matched your search

+2 -2
View File
@@ -2540,7 +2540,7 @@ fn stop_loop(ctx: &Ctx, cause: StopCause, line: String, can: &[&str]) {
"evidence": "evidence",
"phases": phase_rows(&rec),
"uncommitted": uncommitted,
"can": can,
"can": can.iter().copied().chain(["dashboard"]).collect::<Vec<_>>(),
},
});
post_end(ctx, &rec, &patch);
@@ -2609,7 +2609,7 @@ fn finish(ctx: &Ctx) {
"line": one_line(&said),
"phases": phase_rows(&rec),
"uncommitted": [],
"can": ["finalize"],
"can": ["finalize", "dashboard"],
});
if let Some(id) = evidence {
end["evidence"] = json!(id);
+25
View File
@@ -1185,6 +1185,30 @@ fn loop_finalize(state: State<'_, AppState>) -> Result<(), String> {
)
}
/// The loop end screen's way home: stop the session it ended on and open a
/// fresh dashboard console in its place. Needs no agent: a dashboard session
/// is only `console.mjs open --workflow dashboard`, which the supervisor runs
/// itself.
#[tauri::command]
fn loop_dashboard(state: State<'_, AppState>) -> Result<serde_json::Value, String> {
let app = state.app.get().cloned().ok_or("no window yet")?;
let origin = window_origin(&app);
let dir = state
.project
.lock()
.ok()
.and_then(|p| p.as_ref().map(|p| p.dir.clone()))
.ok_or("no project yet")?;
let mut guard = state.console.lock().map_err(|e| e.to_string())?;
if let Some(mut sup) = guard.take() {
let _ = sup.stop();
}
let sup = ConsoleSupervisor::start(dir, origin)?;
let session = serde_json::to_value(sup.session()).map_err(|e| e.to_string())?;
*guard = Some(sup);
Ok(session)
}
fn main() {
// Without Node 18+ the console and skills cannot run: say so and stop (FR-13).
let status = node_check::check_node();
@@ -1240,6 +1264,7 @@ fn main() {
loop_resume,
loop_fix,
loop_finalize,
loop_dashboard,
set_attention,
clear_attention_cmd,
set_taskbar_signal
+12
View File
@@ -729,6 +729,18 @@ window.addEventListener('message', (event) => {
invoke(command)
.then(() => source.postMessage({ plan2code: `${kind}-result`, ok: true, error: null }, '*'))
.catch((error) => source.postMessage({ plan2code: `${kind}-result`, ok: false, error: String(error) }, '*'));
} else if (kind === 'loop-dashboard') {
// The loop end screen's way home: a fresh dashboard session in the frame.
const source = event.source;
invoke('loop_dashboard')
.then((info) => {
source.postMessage({ plan2code: 'loop-dashboard-result', ok: true, error: null }, '*');
if (info && info.url) {
showState('Opening the dashboard');
loadFrame(info.url);
}
})
.catch((error) => source.postMessage({ plan2code: 'loop-dashboard-result', ok: false, error: String(error) }, '*'));
} else if (kind === 'loop-notify-test') {
// Send a test: no values at all. The app reads the saved setup itself and
// asks the person to confirm in its own dialog.