mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-16 04:45:33 -08:00
Keep the Wrapping up dialog open as Done once a stop lands
AI Assisted
This commit is contained in:
1 parent
bdc4decbb4
commit
72043e20fc
3 files changed
+77
-17
No files matched your search
@@ -14,6 +14,7 @@ All notable changes to Plan2Code will be documented in this file.
|
||||
### 🔧 Changed
|
||||
|
||||
- **launcher**: `plan2code` no longer treats an SSH or service session on macOS or Windows as having a desktop, and asks before opening a folder that looks like it is not a project (no `.git`, `AGENTS.md` or `specs/`).
|
||||
- **web console**: the **Wrapping up** dialog after **Stop session** no longer closes itself when the stop lands: it turns into **Done**, with every step ticked, and stays up until you close it, so someone who stepped away comes back to an answer. Its "you can close the window/tab if you need to" line is gone.
|
||||
- **web console**: a plan's **Build order** card has a **Combine phases** button beside **No changes**. One click fills the box with a request to merge phases where possible while keeping each to a clear concern. It shows only in Plan and Revise plan, where the breakdown is phases.
|
||||
|
||||
## v2.11.1
|
||||
|
||||
@@ -207,6 +207,28 @@ test("Stop with a handoff sends __stop with handoff, and the paused finish and s
|
||||
assert.ok(await main.locator("code").filter({ hasText: /^\/plan2code-1-plan --web$/ }).count(), "the resume command is gone");
|
||||
});
|
||||
|
||||
// Someone who presses Stop and steps away comes back to an answer: the
|
||||
// wrapping-up dialog turns into Done once the stop lands and stays up until
|
||||
// it is closed, rather than quietly going away.
|
||||
test("the wrapping-up dialog says Done when the stop lands, and stays until closed", async (t) => {
|
||||
const s = await openSession(await suite.browser(), { t, workflow: "plan", payload: PLAN_QUESTION });
|
||||
await s.page.click("#btn-stop");
|
||||
await s.page.locator("#stop-go").click();
|
||||
const dlg = s.page.locator("#stopping-modal");
|
||||
await dlg.waitFor();
|
||||
assert.equal(await s.page.locator("#stopping-title").textContent(), "Wrapping up");
|
||||
assert.doesNotMatch(await dlg.innerText(), /close the (window|tab)/i, "no advice to close the page mid-stop");
|
||||
|
||||
collect(s);
|
||||
s.post({ settle: true, finish: { headline: "Paused at the naming question", body: "Your place is saved.", command: "/plan2code-1-plan" } });
|
||||
await s.page.locator("#main").getByRole("heading", { name: "Paused at the naming question" }).waitFor();
|
||||
await s.page.locator("#stopping-title").getByText("Done", { exact: true }).waitFor();
|
||||
assert.equal(await s.page.locator("#stop-steps li.is-done").count(), 3, "every step ticked");
|
||||
assert.ok(await holds(async () => dlg.isVisible(), 2000), "Done stays up on its own");
|
||||
await s.page.locator("#stopping-hide").getByText("Close", { exact: true }).click();
|
||||
await dlg.waitFor({ state: "hidden" });
|
||||
});
|
||||
|
||||
test("a page that loses its server goes offline, and after a resume it shows the session again with the unsent answer still typed", async (t) => {
|
||||
const s = await openSession(await suite.browser(), { t, workflow: "plan", payload: PLAN_QUESTION });
|
||||
const field = () => itemCard(s.page, "q1").locator("textarea, input[type=text]").first();
|
||||
|
||||
@@ -497,6 +497,10 @@ async function sendAfterBuild(kind, launch = null) {
|
||||
}
|
||||
|
||||
let stoppingHidden = false;
|
||||
// The wrapping-up dialog stays up once the stop has landed, saying it is done,
|
||||
// until it is closed: someone who pressed Stop and stepped away comes back to
|
||||
// an answer rather than to a dialog that quietly went away.
|
||||
let stopDoneShown = false;
|
||||
|
||||
// A stop is under way if this browser sent one, or if the server is holding
|
||||
// one nobody has collected: the second covers a reload on a resumed session,
|
||||
@@ -690,18 +694,21 @@ async function stopSession(handoff = false) {
|
||||
// whether the finish has landed.
|
||||
export function renderStopping() {
|
||||
const dlg = $("stopping-modal");
|
||||
if (stopDoneShown) return;
|
||||
const stopping = page.S && stopInProgress();
|
||||
if (!stopping) {
|
||||
if (dlg.open) dlg.close();
|
||||
return;
|
||||
}
|
||||
// The finish is the end of it: the hand-off card on the page says the rest.
|
||||
// Shown, the dialog says so and waits to be closed; hidden, it stays hidden.
|
||||
if (finish()) {
|
||||
page.local.stopping = null;
|
||||
saveNow();
|
||||
if (dlg.open) dlg.close();
|
||||
if (dlg.open) showStopDone(stopping.answers);
|
||||
return;
|
||||
}
|
||||
setStoppingDone(false);
|
||||
|
||||
const sent = stopping.answers;
|
||||
const collected = !page.pendingResult;
|
||||
@@ -717,19 +724,7 @@ export function renderStopping() {
|
||||
},
|
||||
{ text: "Saving your place and writing the command to pick it up", state: collected ? (stuck ? "stuck" : "now") : "later" },
|
||||
];
|
||||
const list = $("stop-steps");
|
||||
list.replaceChildren(
|
||||
...steps.map((s) => {
|
||||
const li = el("li", "is-" + s.state);
|
||||
li.appendChild(
|
||||
s.state === "now"
|
||||
? el("span", "spinner tiny")
|
||||
: el("span", "stop-mark", s.state === "done" ? "✓" : s.state === "stuck" ? "!" : "·")
|
||||
);
|
||||
li.appendChild(el("span", null, s.text));
|
||||
return li;
|
||||
})
|
||||
);
|
||||
drawStopSteps(steps);
|
||||
|
||||
const extra = $("stop-extra");
|
||||
extra.replaceChildren();
|
||||
@@ -756,7 +751,7 @@ export function renderStopping() {
|
||||
"stop-note",
|
||||
agentWorking() && !collected
|
||||
? "Plan2Code is in the middle of something. It stops as soon as that is done."
|
||||
: "This usually takes a moment. You can close the tab if you need to: the command also appears in the terminal."
|
||||
: "This usually takes a moment."
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -764,6 +759,48 @@ export function renderStopping() {
|
||||
if (!stoppingHidden && !dlg.open) dlg.showModal();
|
||||
}
|
||||
|
||||
function drawStopSteps(steps) {
|
||||
$("stop-steps").replaceChildren(
|
||||
...steps.map((s) => {
|
||||
const li = el("li", "is-" + s.state);
|
||||
li.appendChild(
|
||||
s.state === "now"
|
||||
? el("span", "spinner tiny")
|
||||
: el("span", "stop-mark", s.state === "done" ? "✓" : s.state === "stuck" ? "!" : "·")
|
||||
);
|
||||
li.appendChild(el("span", null, s.text));
|
||||
return li;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
// The title and the button, between wrapping up and done.
|
||||
function setStoppingDone(done) {
|
||||
$("stopping-title").textContent = done ? "Done" : "Wrapping up";
|
||||
$("stopping-hide").textContent = done ? "Close" : "Back to the page";
|
||||
}
|
||||
|
||||
// The stop has landed: every step ticked, and a line on where the rest is.
|
||||
function showStopDone(sent) {
|
||||
stopDoneShown = true;
|
||||
setStoppingDone(true);
|
||||
drawStopSteps([
|
||||
{ text: sent ? `Sent your ${sent === 1 ? "answer" : sent + " answers"} and the stop` : "Sent the stop", state: "done" },
|
||||
{ text: "Plan2Code picked it up", state: "done" },
|
||||
{ text: "Saved your place and wrote the command to pick it up", state: "done" },
|
||||
]);
|
||||
$("stop-extra").replaceChildren(
|
||||
el("p", "stop-note stop-done-note", "The session is stopped. The page behind this shows what was saved and the command to pick it up.")
|
||||
);
|
||||
}
|
||||
|
||||
// Closed by its button or Esc: done is read, so the next stop starts fresh.
|
||||
function closeStopping() {
|
||||
stoppingHidden = true;
|
||||
stopDoneShown = false;
|
||||
setStoppingDone(false);
|
||||
}
|
||||
|
||||
// The top bar's way home and Stop, wired once at start-up.
|
||||
export function wireEnding() {
|
||||
$("btn-home").addEventListener("click", openHomeConfirm);
|
||||
@@ -774,12 +811,12 @@ export function wireEnding() {
|
||||
$("stop-handoff").addEventListener("click", () => stopSession(true));
|
||||
$("stop-go").addEventListener("click", () => stopSession(false));
|
||||
$("stopping-hide").addEventListener("click", () => {
|
||||
stoppingHidden = true;
|
||||
closeStopping();
|
||||
$("stopping-modal").close();
|
||||
});
|
||||
// Esc on a native dialog closes it without our say; count that as hiding, or
|
||||
// the next render would open it straight back up.
|
||||
$("stopping-modal").addEventListener("cancel", () => (stoppingHidden = true));
|
||||
$("stopping-modal").addEventListener("cancel", closeStopping);
|
||||
}
|
||||
|
||||
// The three stop-related controls, drawn again when the agent comes or goes.
|
||||
|
||||
Reference in new issue
Block a user