Add Continue here, Update CHANGELOG first and Ask prompt blocks to the web console

AI Assisted
This commit is contained in:
jparkerweb committed 2026-10-19 17:55:37 -07:00
1 parent f8b54ef708
commit d32925cccf
25 files changed
+454 -28

No files matched your search

+14
View File
@@ -432,3 +432,17 @@ test("a reply proposing an edit under the running spec is refused; a valid reply
cli(["stop", "--session", s.sid]);
}
});
// The Ask tab's prompt blocks are contract only: the page already draws Copy on a
// fenced block, so the agent has to be told when and how to write one.
test("console-chat.md teaches the prompt block: when, what it holds, and not to open it with a command word", () => {
const text = fs.readFileSync(path.join(ROOT, "src", "web-console", "console-chat.md"), "utf8");
const section = text.split(/^## /m).find((s) => s.startsWith("Prompts to carry away"));
assert.ok(section, "console-chat.md has no 'Prompts to carry away' section");
assert.match(section, /fenced block/);
assert.match(section, /Copy/);
assert.match(section, /paste it into the Ask tab/);
assert.match(section, /out of scope/);
assert.match(section, /files to read/);
assert.doesNotMatch(section, /\u2014/, "no em dash in the section");
});
+51 -1
View File
@@ -63,6 +63,9 @@ import {
REVIEW_REPLY,
afterFinishButton,
commitOffer,
changelogOffer,
continueOffer,
continueReply,
pendingNote,
reviewOffer,
SKILL_CATALOG,
@@ -348,12 +351,17 @@ test("the resume command follows the entry's resume kind, and an unknown workflo
assert.equal(resumeCommand({}), "/plan2code-0-pathfinder");
});
test("a hop starts the page clean to or from the dashboard and into Git, and nowhere else", () => {
test("a hop starts the page clean to or from the dashboard, into Git and between skills, but not out of Git or into Review", () => {
assert.equal(startsClean("implement", "dashboard"), true);
assert.equal(startsClean("dashboard", "plan"), true);
assert.equal(startsClean("changelog", "git"), true);
assert.equal(startsClean("finalize", "git"), true);
// A launch from a finished screen (Continue here, Update CHANGELOG first)
assert.equal(startsClean("plan", "document"), true);
assert.equal(startsClean("quick-task", "changelog"), true);
assert.equal(startsClean("finalize", "changelog"), true);
assert.equal(startsClean("git", "changelog"), false);
assert.equal(startsClean("git", "plan"), false);
assert.equal(startsClean("implement", "review"), false);
assert.equal(startsClean("git", "git"), false);
assert.equal(startsClean("dashboard", "dashboard"), false);
@@ -1025,6 +1033,48 @@ test("the commit offer is read from finish.commit and a pause never carries it",
assert.equal(commitOffer(null), false);
});
test("the changelog offer is read from finish.changelog and a pause never carries it", () => {
assert.equal(changelogOffer({ headline: "Done", changelog: true }), true);
assert.equal(changelogOffer({ headline: "Done", changelog: false }), false);
assert.equal(changelogOffer({ headline: "Done" }), false);
assert.equal(changelogOffer({ headline: "Paused here", changelog: true }), false);
assert.equal(changelogOffer(null), false);
});
test("Continue here is offered for a skill command, with the spec it names, and never for a pause or a non-skill", () => {
const offer = (command, rest = {}) => continueOffer({ headline: "Done", command, ...rest });
assert.deepEqual(offer("/plan2code-2-document"), { skill: "plan2code-2-document", workflow: "document", spec: undefined });
assert.deepEqual(offer("/plan2code-2-document --web"), { skill: "plan2code-2-document", workflow: "document", spec: undefined });
assert.deepEqual(offer("/plan2code-3-implement specs/lunch-vote/overview.md --web"), {
skill: "plan2code-3-implement",
workflow: "implement",
spec: "specs/lunch-vote",
});
assert.deepEqual(offer("/plan2code-2-document specs/lunch-vote/PLAN-DRAFT-20261019.md"), {
skill: "plan2code-2-document",
workflow: "document",
spec: "specs/lunch-vote",
});
assert.equal(offer("/plan2code-4-finalize specs--completed/old/overview.md").spec, undefined);
assert.equal(offer("/plan2code-3-implement specs/lunch-vote/overview.md", { headline: "Paused at Phase 2" }), null);
assert.equal(offer("/plan2code"), null);
assert.equal(offer("/plan2code --web"), null);
assert.equal(offer("git add -A && git commit -m x -m y"), null);
assert.equal(offer("/not-a-plan2code-skill"), null);
assert.equal(offer(""), null);
assert.equal(continueOffer(null), null);
});
test("the Continue here reply names the skill and its spec like a dashboard launch, in plain words", () => {
const reply = continueReply({ skill: "plan2code-3-implement", workflow: "implement", spec: "specs/lunch-vote" });
assert.equal(reply, "Start Implement (/plan2code-3-implement) for specs/lunch-vote, right here in this session.");
assert.equal(
continueReply({ skill: "plan2code-2-document", workflow: "document" }),
"Start Document (/plan2code-2-document), right here in this session."
);
assert.doesNotMatch(reply, /(brief|recap|minutes)/i);
});
test("one press on a finish locks every offer button, even after the agent collects it", () => {
// Nothing pressed: live unless a send is still being picked up.
assert.deepEqual(afterFinishButton(null, "commit", false), { asked: false, disabled: false });
+25
View File
@@ -77,6 +77,31 @@ test("a Quick question typed in Ask reaches the agent under chat, and the agent'
assert.match(await textOf(s.page.locator(".ask-counter")), /1/);
});
// What a person sees break: a prompt the agent wrote for a new conversation with no
// Copy button, or one that tells them to "paste it into the Ask tab" as though it
// were a terminal command.
test("an Ask reply with a fenced prompt shows Copy and no run hint, while a command block still gets the hint", async (t) => {
const s = await openSession(await suite.browser(), { t, workflow: "plan", payload: PLAN_QUESTION });
await openAsk(s);
await askQuestion(s, "Give me a prompt for adding the export to the report");
const [asked] = messages(collect(s));
const prompt = "Add the export to the report. Read src/export.js and src/report.js first. Do not touch the importer.";
const fence = "```";
const md = ["That is a separate job. Paste this into a new Quick Task:", "", fence, prompt, fence, "", "Or run this:", "", fence, "npm test", fence].join("\n");
s.post({ chat: { replies: [{ id: "r1", re: asked.seq, conversation: 1, md }] } });
const reply = s.page.locator(".ask-row.agent");
await reply.getByText("That is a separate job").waitFor();
const blocks = reply.locator("pre");
assert.equal(await blocks.count(), 2);
const first = blocks.nth(0).locator("xpath=..");
assert.equal(await first.getByRole("button", { name: "Copy" }).count(), 1, "the prompt block has a Copy button");
assert.equal(await first.locator(".md-run-hint").count(), 0, "a prompt block gets no run hint");
const second = blocks.nth(1).locator("xpath=..");
assert.equal(await second.locator(".md-run-hint").count(), 1, "a command block still gets the hint");
});
// What a person sees break: starters that send for them, or that are missing
// from an empty conversation.
test("an empty Ask offers starters, a click only fills the box, and nothing is sent until Send", async (t) => {
+68
View File
@@ -93,6 +93,74 @@ test("the finished screen shows the next command with --web, copies it, turns Se
);
});
// What a person sees break: no Continue here on a finish that names a skill, one
// beside a git command or a pause, one at the red meter level, or a press that
// reaches the agent as anything but the dashboard's own launch.
test("Continue here shows beside a skill's next step while the meter is not red and sends a launch with the skill and spec", async (t) => {
const browser = await suite.browser();
const next = { headline: "The plan is documented", command: "/plan2code-3-implement specs/audit-export/overview.md", dashboard: true };
const s = await openSession(browser, { t, workflow: "document", payload: { agent: { status: "working", activity: "Writing" } } });
s.post({ finish: next });
const main = s.page.locator("#main");
const go = main.getByRole("button", { name: "Continue here" });
await go.waitFor();
assert.equal(await go.count(), 1);
await go.click();
const got = collect(s);
assert.deepEqual(got.actions, [
{ i: "__launch", type: "launch", skill: "plan2code-3-implement", workflow: "implement", spec: "specs/audit-export" },
]);
assert.equal(got.reply, "Start Implement (/plan2code-3-implement) for specs/audit-export, right here in this session.");
// The hop's resume is the dashboard's: the skill's workflow and the spec.
assert.match(got.resume, /--workflow implement --spec specs\/audit-export$/);
await main.getByRole("button", { name: "Starting the next step…" }).waitFor();
assert.equal(await main.getByRole("button", { name: "Back to the dashboard" }).isDisabled(), true, "one press locks the other buttons");
// No skill to continue into: a git command, or a pause.
const git = await openSession(browser, { t, workflow: "quick-task", payload: { agent: { status: "working", activity: "Task 1 of 1" } } });
git.post({ finish: { headline: "Quick task done", command: "git add -A && git commit -m x -m y", dashboard: true } });
await git.page.locator("#main").getByRole("heading", { name: "Quick task done" }).waitFor();
assert.equal(await git.page.getByRole("button", { name: "Continue here" }).count(), 0, "a git command is not a skill");
const paused = await openSession(browser, { t, workflow: "implement", payload: { agent: { status: "working", activity: "Task 1 of 1" } } });
paused.post({ finish: { headline: "Paused at Phase 2", command: "/plan2code-3-implement specs/audit-export/overview.md" } });
await paused.page.locator("#main").getByRole("heading", { name: "Paused at Phase 2" }).waitFor();
assert.equal(await paused.page.getByRole("button", { name: "Continue here" }).count(), 0, "a pause is not continued");
});
test("Update CHANGELOG first shows beside Commit it now only when the finish asks for it, and sends __changelog", async (t) => {
const browser = await suite.browser();
const base = { headline: "Quick task done", command: "git add -A && git commit -m x -m y", commit: true, dashboard: true };
const plain = await openSession(browser, { t, workflow: "quick-task", payload: { agent: { status: "working", activity: "Task 1 of 1" } } });
plain.post({ finish: base });
await plain.page.locator("#main").getByRole("button", { name: "Commit it now" }).waitFor();
assert.equal(await plain.page.getByRole("button", { name: "Update CHANGELOG first" }).count(), 0, "no flag, no button");
const s = await openSession(browser, { t, workflow: "quick-task", payload: { agent: { status: "working", activity: "Task 1 of 1" } } });
s.post({ finish: { ...base, changelog: true } });
const main = s.page.locator("#main");
const go = main.getByRole("button", { name: "Update CHANGELOG first" });
await go.waitFor();
assert.equal(await main.getByRole("button", { name: "Commit it now" }).count(), 1);
await go.click();
assert.deepEqual(collect(s).actions.map(({ i, type }) => ({ i, type })), [{ i: "__changelog", type: "changelog" }]);
await main.getByRole("button", { name: "Opening Changelog…" }).waitFor();
assert.equal(await main.getByRole("button", { name: "Commit it now" }).isDisabled(), true, "one press locks the other buttons");
});
test("Continue here is hidden once the session meter is red, and the command and fresh-session advice stay", async (t) => {
const s = await openSession(await suite.browser(), { t, workflow: "implement", payload: { agent: { status: "working", activity: "Task 1 of 1" } } });
// Ten points: a thirty-task phase scores ten, the red level.
s.post({ run: { event: "implement-phase", id: "phase-1", tasks: 30 } });
await s.page.locator("#meter-pill[data-level='red']").waitFor();
s.post({ finish: { headline: "Phase 1 is done", command: "/plan2code-3-implement specs/audit-export/overview.md", dashboard: true } });
const main = s.page.locator("#main");
await main.getByRole("heading", { name: "Phase 1 is done" }).waitFor();
assert.equal(await main.getByRole("button", { name: "Continue here" }).count(), 0, "Continue here at red");
assert.ok(await main.locator("code").filter({ hasText: /^\/plan2code-3-implement specs\/audit-export\/overview\.md --web$/ }).count(), "the command stays");
assert.equal(await closeGuide(s).count(), 1, "the fresh-session advice stays");
});
test("Stop session, confirmed, sends __stop with no handoff", async (t) => {
const s = await openSession(await suite.browser(), { t, workflow: "plan", payload: PLAN_QUESTION });
await s.page.click("#btn-stop");
+62 -1
View File
@@ -36,7 +36,7 @@ import { HELP_TABS, helpTabFor, helpKeyTarget } from "../src/web-console/public/
import { RED_AT, YELLOW_AT } from "../src/web-console/public/meter.js";
import { REMOTE_FOLD } from "../src/web-console/public/git-board.js";
import { readLedger, SESSION_MAX_AGE_MS, sweepUploads, UPLOAD_MAX_AGE_MS } from "../src/web-console/sessions.mjs";
import { applyPatch } from "../src/web-console/patches.mjs";
import { applyPatch, validate } from "../src/web-console/patches.mjs";
import { joinedCss } from "./css-helpers.mjs";
import {
ROOT,
@@ -219,6 +219,41 @@ test("a launch request round-trips with the skill the dashboard resumes as", asy
assert.ok(state.items.every((i) => i.id !== "__launch"), "a launch must not become a question");
});
// Continue here sends the same launch from a finished screen, so the hop's
// resume names the next skill's workflow and the spec, and the skill file to read.
test("a launch sent from a finished screen carries the resume for the next skill and spec", async () => {
await post("/submit", {
actions: [{ i: "__launch", type: "launch", skill: "plan2code-2-document", workflow: "document", spec: "specs/lunch-vote" }],
reply: "Start Document (/plan2code-2-document) for specs/lunch-vote, right here in this session.",
});
const res = cli(["wait", "--session", sid, "--seconds", "10"]);
assert.equal(res.status, 0);
assert.equal(res.json.actions[0].i, "__launch");
assert.match(res.json.resume, /--no-open --workflow document --spec specs\/lunch-vote$/);
});
// The page tells the person the hop gives the next skill a clean page: a resume
// into a different workflow drops the finish it was launched from.
test("resuming into another skill after Continue here drops the finish", async () => {
const stateFile = path.join(session, "state.json");
const readState = () => JSON.parse(fs.readFileSync(stateFile, "utf8"));
cli(["post", "--session", sid, "--file", payload("fin-continue.json", {
finish: { headline: "The plan is documented", command: "/plan2code-5-changelog", dashboard: true },
})]);
const snapshot = fs.readFileSync(stateFile, "utf8");
await post("/submit", {
actions: [{ i: "__launch", type: "launch", skill: "plan2code-changelog", workflow: "changelog" }],
reply: "Start Changelog (/plan2code-changelog), right here in this session.",
});
const res = cli(["wait", "--session", sid, "--seconds", "10"]);
assert.equal(res.status, 0);
cli(["open", "--resume", sid, "--no-open", "--workflow", "changelog"]);
const resumed = readState();
assert.equal(resumed.workflow, "changelog");
assert.equal(resumed.finish, undefined, "the old finish is gone");
fs.writeFileSync(stateFile, snapshot);
});
// A delete from the dashboard's picker is a send like a launch, but no hop:
// the agent stays the dashboard, so it carries no resume and no skill file.
test("a delete request round-trips with the spec folder and no resume", async () => {
@@ -1337,6 +1372,32 @@ test("patches merge by id and append threads", () => {
assert.ok(replies[0].at, "the server stamps the time the agent left out");
});
test("finish.changelog is accepted on quick-task and finalize, and refused on implement and on a non-boolean", () => {
const problems = (workflow, changelog, headline = "Done") =>
validate({ workflow, items: [], finish: { headline, command: "git add -A", commit: true, changelog } });
for (const workflow of ["quick-task", "finalize"]) assert.deepEqual(problems(workflow, true), [], workflow);
assert.match(problems("implement", true).join(), /only for a finished quick-task or finalize/);
assert.match(problems("implement-review", true).join(), /only for a finished quick-task or finalize/);
assert.match(problems("quick-task", "yes").join(), /must be true or false/);
// false is always fine, and a pause ignores it
assert.deepEqual(problems("implement", false), []);
assert.deepEqual(problems("implement", true, "Paused at Phase 2"), []);
});
// Update CHANGELOG first is a hop like Commit it now, into Changelog.
test("a changelog request from a finished screen carries the resume into the changelog workflow and its skill file", async () => {
await post("/submit", {
actions: [{ i: "__changelog", type: "changelog" }],
reply: "Update the CHANGELOG before I commit: open Changelog, right here in this session.",
});
const res = cli(["wait", "--session", sid, "--seconds", "10"]);
assert.equal(res.status, 0);
assert.equal(res.json.actions[0].i, "__changelog");
assert.match(res.json.resume, /--no-open --workflow changelog$/);
const state = JSON.parse(fs.readFileSync(path.join(session, "state.json"), "utf8"));
assert.ok(state.items.every((i) => i.id !== "__changelog"), "a changelog request must not become a question");
});
test("a thread reply in another shape is lifted into { who, text }, and an empty one is refused", () => {
const base = { items: [{ id: "n1", kind: "text", title: "Name", status: "open", thread: [{ who: "user", text: "why?", at: "2026-10-05T10:00:00Z" }] }] };
const next = applyPatch(base, {
+2 -1
View File
@@ -380,13 +380,14 @@ test("a pick-up comes with the stored skill's resume command, handoffFile, and f
}
});
test("a launch, a dashboard press and Commit it now each come with their resume command", async () => {
test("a launch, a dashboard press, Commit it now and Update CHANGELOG first each come with their resume command", async () => {
const s = consoleSession(["--workflow", "dashboard"]);
try {
const cases = [
[{ i: "__launch", type: "launch", skill: "plan2code-3-implement", workflow: "implement", spec: "specs/lunch vote" }, "implement", ' --spec "specs/lunch vote"'],
[{ i: "__dashboard", type: "dashboard" }, "dashboard", ""],
[{ i: "__commit", type: "commit" }, "git", ""],
[{ i: "__changelog", type: "changelog" }, "changelog", ""],
];
for (const [action, workflow, spec] of cases) {
assert.equal((await s.send("/submit", { actions: [action], reply: "go" })).status, 200);