mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-16 04:45:33 -08:00
Add Back to the dashboard to the loop's end screen
AI Assisted
This commit is contained in:
1 parent
c8d12a3d99
commit
26cb17f04a
10 files changed
+62
-7
No files matched your search
@@ -10,6 +10,10 @@ All notable changes to Plan2Code will be documented in this file.
|
||||
|
||||
**Stale installs are still cleaned up.** `install.js` keeps a small `removeLegacyLoopShims()` step that removes the old global artifacts (`plan2code-loop`, `plan2code-loop.cmd`, `plan2code-loop.ps1` and `node_modules/plan2code-loop` under the npm prefix) when they are present. `update()` runs it once before reinstalling and quietly skips a stale `"loop"` entry in `~/.plan2code/install.json`; uninstall runs it too.
|
||||
|
||||
### 🐛 Fixed
|
||||
|
||||
- **desktop app**: the Implementation Loop's end screen offers **Back to the dashboard** next to its other actions, on a finished loop and a stopped one, and it works with no agent running (it opens a fresh dashboard console session in the frame). The screen's status line also tells the truth now: it reads "Loop finished. Pick what happens next." (or "The loop stopped.") as your move instead of spinning "Starting Building + review…", so the taskbar dot goes green there instead of staying dark while the loop's finished page waits.
|
||||
|
||||
## v3.0.0
|
||||
|
||||
### ✨ Added
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -291,7 +291,7 @@ const goodEnd = (extra = {}) => ({
|
||||
line: "Stopped at phase 2: a Critical finding was skipped",
|
||||
phases: [{ n: 1, name: "Setup", commit: "abc1234", unfixed: 0, retries: 0 }],
|
||||
uncommitted: ["src/x.js"],
|
||||
can: ["resume", "fix"],
|
||||
can: ["resume", "fix", "dashboard"],
|
||||
...extra,
|
||||
});
|
||||
const EVIDENCE = { id: "evidence", title: "What happened", blocks: [{ id: "b1", md: "The phase stopped on a skipped Critical." }] };
|
||||
@@ -313,7 +313,7 @@ test("loopEnd: a valid stopped with an evidence doc in the same patch is stored"
|
||||
test("loopEnd: an unknown evidence id, a push in can, and the other bad fields are refused, each named", () => {
|
||||
const cases = [
|
||||
["an unknown evidence id", goodEnd({ evidence: "nope" }), /loopEnd\.evidence must be the id of a doc on the page/],
|
||||
["a push in can", goodEnd({ can: ["resume", "push"] }), /loopEnd\.can must be an array with entries from resume, fix, finalize/],
|
||||
["a push in can", goodEnd({ can: ["resume", "push"] }), /loopEnd\.can must be an array with entries from resume, fix, finalize, dashboard/],
|
||||
["a bad kind", goodEnd({ kind: "paused" }), /loopEnd\.kind must be "stopped" or "finished"/],
|
||||
["a two-line line", goodEnd({ line: "one\ntwo" }), /loopEnd\.line must be one line/],
|
||||
["an absolute uncommitted path", goodEnd({ uncommitted: ["/etc/passwd"] }), /loopEnd\.uncommitted must be an array of relative paths/],
|
||||
|
||||
@@ -242,16 +242,18 @@ test("the finish card counts each kind of decision per phase and opens on the fu
|
||||
line: "All 1 phases built",
|
||||
phases: [{ n: 2, name: "API", commit: "abc1234", unfixed: 3, retries: 1, fixed: 4, skipped: 2, left: 1, assumed: 5, decisions: 6 }],
|
||||
uncommitted: [],
|
||||
can: ["finalize"],
|
||||
can: ["finalize", "dashboard"],
|
||||
});
|
||||
return {
|
||||
head: [...card.querySelectorAll("th")].map((c) => c.textContent),
|
||||
row: [...card.querySelectorAll("td")].map((c) => c.textContent),
|
||||
actions: [...card.querySelectorAll(".loop-end-actions button")].map((b) => b.textContent),
|
||||
};
|
||||
});
|
||||
assert.deepEqual(seen.head, ["Phase", "Commit", "Fixed", "Not fixed", "Left open", "Assumed", "Other decisions", "Retries"]);
|
||||
assert.deepEqual(seen.row.slice(0, 1), ["Phase 2: API"]);
|
||||
assert.deepEqual(seen.row.slice(2), ["4", "2", "1", "5", "6", "1"]);
|
||||
assert.deepEqual(seen.actions, ["Finalize", "Back to the dashboard"], "the way home is offered next to Finalize");
|
||||
});
|
||||
|
||||
// A real loop session: `open --loop` under the app's signal stamps the lock.
|
||||
|
||||
@@ -1054,7 +1054,7 @@ export function isOpen(item) {
|
||||
|
||||
const LOOP_LEVELS = ["critical", "warning", "suggestion"];
|
||||
const LOOP_REASONS = ["tests", "findings", "blocked", "conflict", "other"];
|
||||
const LOOP_CAN = ["resume", "fix", "finalize"];
|
||||
const LOOP_CAN = ["resume", "fix", "finalize", "dashboard"];
|
||||
const TASK_ID = /^\d+\.\d+$/;
|
||||
|
||||
// A one-line path that stays inside the project: not absolute, no `..` step.
|
||||
|
||||
@@ -62,7 +62,7 @@ export function wireLoopMessages(store, redraw) {
|
||||
store.loopNotifyTest = { waiting: false, ok: data.ok === true, sent: data.sent === true, error: data.ok === true ? null : String(data.error || "The app could not send the test.") };
|
||||
redraw();
|
||||
});
|
||||
for (const kind of ["loop-resume-result", "loop-fix-result", "loop-finalize-result"]) {
|
||||
for (const kind of ["loop-resume-result", "loop-fix-result", "loop-finalize-result", "loop-dashboard-result"]) {
|
||||
onAppMessage(kind, (data) => {
|
||||
store.loopAction = { kind, ok: data.ok === true, error: data.ok === true ? null : String(data.error || "The app could not do that.") };
|
||||
redraw();
|
||||
|
||||
@@ -1225,6 +1225,17 @@ export function renderStatus() {
|
||||
return say("done", `All done. You can close this ${closeWord}.`);
|
||||
}
|
||||
if (page.gone) return say("gone", "Not connected. Your answers are saved.", "", false, true);
|
||||
// The loop's own end screen (the app's `loopEnd`) is no `finish()`: while it
|
||||
// still has presses on offer the move is theirs; with none, it is done.
|
||||
if (page.S.loopEnd) {
|
||||
const end = page.S.loopEnd;
|
||||
const moves = Array.isArray(end.can) ? end.can.length : 0;
|
||||
if (!moves) return say("done", "The loop is done.");
|
||||
return say(
|
||||
"point",
|
||||
end.kind === "finished" ? "Loop finished. Pick what happens next." : "The loop stopped. Pick what happens next."
|
||||
);
|
||||
}
|
||||
// On the way home: the request is sent, and the page stays this skill's
|
||||
// until the agent resumes the session as the dashboard.
|
||||
if (page.local.homeward && !isDashboard()) {
|
||||
|
||||
@@ -165,6 +165,7 @@ const LOOP_BUTTONS = [
|
||||
["resume", "loop-resume", "Resume the loop", "primary"],
|
||||
["fix", "loop-fix", "Fix it by hand", ""],
|
||||
["finalize", "loop-finalize", "Finalize", "primary"],
|
||||
["dashboard", "loop-dashboard", "Back to the dashboard", ""],
|
||||
];
|
||||
|
||||
function shortHash(h) {
|
||||
|
||||
Reference in new issue
Block a user