Sync upstream v3.2.6: Loop checkboxes, Notes drag handle, US English replies, app update fetch (v3.2.6)

- Implement's and Review's confirm panes carry a Loop checkbox in place of
  the dashboard's loop cards; loop end-screen buttons show a spinner.
- The stacked Notes panel gets a drag handle.
- Every skill prompt and the console contracts say to reply in US English.
- The desktop app offers Update to latest when the skills are newer, and
  plan2code update refetches an app that install.json does not record.
- Devin Balanced maps to Sonnet 5.5 Medium.
This commit is contained in:
jparkerweb committed 2026-12-04 22:35:28 -08:00
1 parent 9629961f36
commit 658c813428
70 files changed
+818 -242

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
# Quick Questions (the Ask tab)
The console points here the first time a Quick question reaches you. The person can ask anything on the Ask tab at any time, about this project's files or in general, without waiting for a card. A message never blocks a card send and a card send never blocks a message.
The console points here the first time a Quick question reaches you. The person can ask anything on the Ask tab at any time, about this project's files or in general, without waiting for a card. A message never blocks a card send and a card send never blocks a message. Answer in US English, even when the question or the project is in another language, unless the person asks for one.
## How they arrive
+1 -1
View File
@@ -1,6 +1,6 @@
# The Web Console (the card)
A local page where the person answers your questions, reads your drafts and approves things. Read this card once per session. Read a topic file only when your workflow notes or the console's `read` output name it.
A local page where the person answers your questions, reads your drafts and approves things. Read this card once per session. Read a topic file only when your workflow notes or the console's `read` output name it. Write everything the person reads in US English unless they ask otherwise.
`<CONSOLE>` is `<SKILL_ROOT>/references/web-console/console.mjs` (globally `~/.agents/skills/<skill-name>/references/web-console/`; `~/.plan2code/console/console-dir` may hold the folder). Always quote the path. `node "<CONSOLE>" help <topic>` prints any topic file.
+18 -15
View File
@@ -738,24 +738,27 @@ export const SKILL_CATALOG = FLOW_SKILLS.filter((s) => s.card).map((s) => ({
command: s.command,
workflow: s.workflow,
...(s.review ? { review: s.review } : {}),
...(s.loop ? { loop: s.loop } : {}),
...s.card,
}));
// The desktop app's Implementation Loop card: not a skill, so not in
// SKILL_CATALOG. The dashboard draws it after its group's other cards, and its
// click opens the setup screen instead of launching anything.
const LOOP_SKILL = SKILLS.find((s) => s.appOnly && s.card);
export const LOOP_ENTRY = LOOP_SKILL
? { skill: LOOP_SKILL.skill, command: "Desktop app only", workflow: null, appOnly: true, ...LOOP_SKILL.card }
: null;
// The Review Loop's card, the second app-only entry: same shape, own setup screen.
const REVIEW_LOOP_SKILL = SKILLS.find((s) => s.appOnly && s.card && s !== LOOP_SKILL);
export const REVIEW_LOOP_ENTRY = REVIEW_LOOP_SKILL
? { skill: REVIEW_LOOP_SKILL.skill, command: "Desktop app only", workflow: null, appOnly: true, ...REVIEW_LOOP_SKILL.card }
: null;
// Every app-only card, in the order the dashboard draws them.
export const APP_ONLY_ENTRIES = Object.freeze([LOOP_ENTRY, REVIEW_LOOP_ENTRY].filter(Boolean));
export const OUTSIDE_APP_LINE = "Runs only in the Plan2Code desktop app.";
export const LOOP_RUNNING_LINE = "A loop is running. Stop it from the banner at the top of the window first.";
// The app-only entry a card's Loop box opens the setup screen for (the
// Implementation Loop on Implement, the Review Loop on Review), or null.
export function loopFor(entry) {
return SKILLS.find((s) => s.appOnly && s.skill === entry.loop) || null;
}
// The Loop box on a confirm pane, as { on, reason }: off with the desktop-app
// line outside the app, off while a loop runs, else the loop entry's own
// availability for the picked spec.
export function loopBoxState(entry, scan, sel, { inApp, driving }) {
if (!inApp) return { on: false, reason: OUTSIDE_APP_LINE };
if (driving) return { on: false, reason: LOOP_RUNNING_LINE };
return cardAvailability({ skill: entry.loop, appOnly: true }, scan, sel);
}
// A workflow by the name its dashboard card gives it ("Implement"), for the
// screens that speak of it as a thing being started rather than as a badge.
@@ -873,7 +876,7 @@ export function cardAvailability(entry, scan, sel, lookup = stateFor) {
const hasAgents = Boolean(scan && scan.hasAgents);
const state = sel && sel.state && sel.state !== "unrecognized" ? sel.state : null;
const next = sel ? Boolean(state) && NEXT_FOR_STATE[state] === entry.skill : entry.skill === "plan2code-0-pathfinder";
const rule = skillByName(entry.skill) || (entry.appOnly ? SKILLS.find((s) => s.appOnly && s.skill === entry.skill) || LOOP_SKILL : null);
const rule = skillByName(entry.skill) || (entry.appOnly ? SKILLS.find((s) => s.appOnly && s.skill === entry.skill) : null);
if (!rule || !rule.states) return ON;
// The three cards whose rules read the scan rather than the spec.
+4 -9
View File
@@ -407,13 +407,6 @@
<path d="m16 18 6-6-6-6" />
<path d="m8 6-6 6 6 6" />
</symbol>
<!-- Implementation Loop: repeat arrows. -->
<symbol id="ci-loop" viewBox="0 0 24 24" fill="none">
<path d="m17 2.5 4 4-4 4" />
<path d="M3 11V9a4 4 0 0 1 4-4h14" />
<path d="m7 21.5-4-4 4-4" />
<path d="M21 13v2a4 4 0 0 1-4 4H3" />
</symbol>
<!-- Finalize: a finish flag. -->
<symbol id="ci-finalize" viewBox="0 0 24 24" fill="none">
<path d="M4 15s1-1 4-1 5 2 8 2 4-1 4-1V4s-1 1-4 1-5-2-8-2-4 1-4 1z" />
@@ -2479,7 +2472,8 @@
<p class="help-lead">
In the desktop app, the Implementation Loop builds every remaining
phase of a documented spec for you, one after another, while you do
something else. The dashboard's Implementation Loop card starts it.
something else. Start it from Implement's confirm pane: tick the
<strong>Loop</strong> checkbox, then <strong>Set up Implementation Loop</strong>.
</p>
<figure class="help-figure" data-figure="loop">
<svg class="help-diagram" viewBox="0 0 560 110" role="img" aria-labelledby="hd-loop-title hd-loop-desc">
@@ -2634,7 +2628,8 @@
<p class="help-lead">
In the desktop app, the Review Loop reviews a finished change and fixes
what it finds, in rounds, on its own. Each round's reviewer starts
fresh. The dashboard's Review Loop card starts it.
fresh. Start it from Review's confirm pane: tick the <strong>Loop</strong>
checkbox, then <strong>Set up Review Loop</strong>.
</p>
<figure class="help-figure" data-figure="review-loop">
<svg class="help-diagram" viewBox="0 0 560 110" role="img" aria-labelledby="hd-review-loop-title hd-review-loop-desc">
+25
View File
@@ -34,6 +34,9 @@ export const DEFAULT_LOOKS = {
width: DEFAULT_CARD_WIDTH,
// The top bar's text size, in percent (palette.js TEXT_SIZES).
textSize: DEFAULT_TEXT_SIZE,
// The Notes panel's height in pixels when it is stacked under the question
// (its drag handle sets it); 0 is the automatic height.
asideHeight: 0,
hideUnavailable: true,
// Skip the wake-up intro: never play the dashboard's first-open wake-up (Planny asleep), off by default.
skipIntro: false,
@@ -64,6 +67,13 @@ export const DEFAULT_LOOKS = {
activityOrder: "recent",
};
// The stacked Notes panel's smallest height; a saved number is a whole count of pixels, or 0 for automatic.
export const ASIDE_MIN_HEIGHT = 96;
export const asideHeightOf = (value) => {
const n = Number(value);
return Number.isFinite(n) && n > 0 ? Math.max(ASIDE_MIN_HEIGHT, Math.round(n)) : 0;
};
export let looks = { ...DEFAULT_LOOKS };
let syncedLooks = null;
@@ -80,6 +90,7 @@ export function adoptLooks(saved) {
if (typeof looks.hideUnavailable !== "boolean") looks.hideUnavailable = DEFAULT_LOOKS.hideUnavailable;
looks.width = cardWidth(looks.width);
looks.textSize = textSize(looks.textSize);
looks.asideHeight = asideHeightOf(looks.asideHeight);
if (typeof looks.skipIntro !== "boolean") looks.skipIntro = DEFAULT_LOOKS.skipIntro;
if (typeof looks.skillLaunched !== "boolean") looks.skillLaunched = DEFAULT_LOOKS.skillLaunched;
if (typeof looks.meterTipSeen !== "boolean") looks.meterTipSeen = DEFAULT_LOOKS.meterTipSeen;
@@ -205,6 +216,19 @@ function paintTextSize() {
$("btn-text-larger").setAttribute("aria-disabled", String(at >= TEXT_SIZES.length - 1));
}
// The stacked Notes panel's height, as a variable the stylesheet reads
// (responsive.css); with none set the panel keeps its automatic height.
export function paintAsideHeight(height = looks.asideHeight) {
const root = document.documentElement;
if (height > 0) {
root.style.setProperty("--aside-h", height + "px");
root.setAttribute("data-aside-h", "");
} else {
root.style.removeProperty("--aside-h");
root.removeAttribute("data-aside-h");
}
}
export function applyLooks() {
const root = document.documentElement;
// The desktop app's shell wears this page's theme and highlight: the resolved
@@ -226,6 +250,7 @@ export function applyLooks() {
if (looks.textSize === DEFAULT_TEXT_SIZE) root.removeAttribute("data-text-size");
else root.dataset.textSize = String(looks.textSize);
paintTextSize();
paintAsideHeight();
// The default lives in the stylesheet, where it is written once per theme.
// Clearing the override is how it gets its own values back.
+22 -11
View File
@@ -40,8 +40,18 @@ function tickKey(end) {
return `review|${end.line}|${end.reason}|${end.signedOff ? "signed" : "open"}`;
}
function button(label, id, cls, disabled, onClick) {
const b = el("button", "btn" + (cls ? " " + cls : ""), label);
// The press the page is waiting on (set each draw), so its button can show work.
let busyWhat = "";
function button(label, id, cls, disabled, onClick, what = "") {
const working = Boolean(what) && busyWhat === what;
const b = el("button", "btn" + (cls ? " " + cls : "") + (working ? " is-busy" : ""), working ? "" : label);
if (working) {
const spin = el("span", "spinner tiny");
spin.setAttribute("aria-hidden", "true");
b.append(spin, document.createTextNode("Working…"));
b.setAttribute("aria-busy", "true");
}
b.type = "button";
b.id = id;
b.disabled = disabled;
@@ -75,6 +85,7 @@ export function renderReviewLoopEnd(end) {
const failed =
page.reviewAction && !page.reviewAction.ok ? page.reviewAction.error : page.loopAction && !page.loopAction.ok ? page.loopAction.error : "";
const busy = pressed.key === key && !failed;
busyWhat = busy ? pressed.what : "";
const press = (what, kind, extra) => {
if (page.gone || busy) return;
pressed = { key, what };
@@ -125,8 +136,8 @@ function drawPartial(card, end, busy, press) {
}
box.appendChild(el("p", "loop-end-hint", "Keep leaves these changes in your files. Discard takes them out and cannot be undone."));
const row = el("div", "btn-row");
row.appendChild(button("Keep these changes", "review-end-keep", "primary", busy, () => press("keep", "review-loop-partial", { keep: true })));
row.appendChild(button("Discard them", "review-end-discard", "", busy, () => press("discard", "review-loop-partial", { keep: false })));
row.appendChild(button("Keep these changes", "review-end-keep", "primary", busy, () => press("keep", "review-loop-partial", { keep: true }), "keep"));
row.appendChild(button("Discard them", "review-end-discard", "", busy, () => press("discard", "review-loop-partial", { keep: false }), "discard"));
box.appendChild(row);
card.appendChild(box);
}
@@ -137,7 +148,7 @@ function drawStop(card, end, busy, press) {
if (end.canContinue && !end.partial) {
const choice = el("div", "loop-end-choice");
const label = end.reason === "cap" ? "Run one more round" : "Continue";
choice.appendChild(button(label, "review-end-continue", "", busy, () => press("continue", "review-loop-continue")));
choice.appendChild(button(label, "review-end-continue", "", busy, () => press("continue", "review-loop-continue"), "continue"));
choice.appendChild(el("p", "loop-end-hint", "Pick the review up again with the same setup."));
card.appendChild(choice);
}
@@ -167,7 +178,7 @@ function drawStop(card, end, busy, press) {
}
const row = el("div", "btn-row");
row.appendChild(
button("Sign off", "review-end-signoff", "primary", busy || Boolean(end.partial), () => press("sign-off", "review-loop-sign-off", { picks: [...ticks.picks], squash: ticks.squash }))
button("Sign off", "review-end-signoff", "primary", busy || Boolean(end.partial), () => press("sign-off", "review-loop-sign-off", { picks: [...ticks.picks], squash: ticks.squash }), "sign-off")
);
card.appendChild(row);
card.appendChild(
@@ -177,19 +188,19 @@ function drawStop(card, end, busy, press) {
function drawFinished(card, end, busy, press) {
const actions = el("div", "loop-end-actions review-end-next");
const add = (label, id, hint, primary, onClick) => {
const add = (label, id, hint, primary, onClick, what) => {
const choice = el("div", "loop-end-choice" + (primary ? " is-recommended" : ""));
choice.appendChild(button(label, id, primary ? "primary" : "", busy, onClick));
choice.appendChild(button(label, id, primary ? "primary" : "", busy, onClick, what));
choice.appendChild(el("p", "loop-end-hint", hint));
actions.appendChild(choice);
};
add("PR Prep", "review-end-pr-prep", "Get the branch ready for a pull request.", true, () => press("pr-prep", "review-loop-next", { next: "pr-prep" }));
add("PR Prep", "review-end-pr-prep", "Get the branch ready for a pull request.", true, () => press("pr-prep", "review-loop-next", { next: "pr-prep" }), "pr-prep");
if (Array.isArray(end.open) && end.open.length) {
add("Fix what's left by hand", "review-end-quick-task", "Start a Quick task with the Critical and Warning findings still open.", false, () =>
press("quick-task", "review-loop-next", { next: "quick-task" })
press("quick-task", "review-loop-next", { next: "quick-task" }), "quick-task"
);
}
add("Back to the dashboard", "review-end-dashboard", "Leave this screen and pick another skill. Your work stays as it is.", false, () => press("dashboard", "loop-dashboard"));
add("Back to the dashboard", "review-end-dashboard", "Leave this screen and pick another skill. Your work stays as it is.", false, () => press("dashboard", "loop-dashboard"), "dashboard");
card.appendChild(actions);
}
+64 -1
View File
@@ -6,7 +6,7 @@ import { chatAnswering, chatOffline, chatView, sendState as chatSendState, newes
import { finish, activity, agentAdrift, isDashboard, selSpec, byId, isOpen, loopAskLocked, loopDriving } from "../selectors.js";
import { el, icon, md, isMac, lightDismiss, shortTime } from "../render.js";
import { startersFor } from "../starters.js";
import { looks } from "../looks.js";
import { looks, saveLooks, paintAsideHeight, ASIDE_MIN_HEIGHT } from "../looks.js";
import { thumbs, uploadUrl, docChip, attachTray, CHAT_IMAGES, attachFiles, incomingFiles, deleteUrl, sentAttachments, noteImages, attachRow, openPicview, refocusThumb } from "../uploads.js";
import { attachMentions } from "../mention-box.js";
import { destroyFields, makeMdField } from "../md-field.js";
@@ -703,6 +703,68 @@ const askOffered = () => {
};
const ASK_HINT = "Press Ask a question to wake an agent, then ask in the Ask tab.";
// The handle on the top edge of the Notes panel while it is stacked under the
// question (responsive.css draws it only then). Dragging it up makes the panel
// taller; the height is kept in the looks, double-click gives the automatic
// height back, and the arrow keys move it a step. The drag listens on the
// window, so a redraw that replaces the handle mid-drag does not end it.
const GRIP_STEP = 24;
function asideGrip(aside) {
const grip = el("div", "aside-grip");
grip.setAttribute("role", "separator");
grip.setAttribute("aria-orientation", "horizontal");
grip.setAttribute("aria-label", "Resize the notes panel");
grip.title = "Drag to resize, double-click to reset";
grip.tabIndex = 0;
// Never past what leaves the question its room (the stylesheet caps it the same way).
const clamp = (h) => (h > 0 ? Math.min(Math.max(ASIDE_MIN_HEIGHT, window.innerHeight - 260), Math.max(ASIDE_MIN_HEIGHT, Math.round(h))) : 0);
const keep = (h) => {
looks.asideHeight = h;
saveLooks();
announce();
};
// A focusable separator tells a screen reader its value: the panel's height in pixels.
// Measured after the next frame, once the panel has the height just set (or, drawn fresh, has its content).
const announce = () =>
requestAnimationFrame(() => {
grip.setAttribute("aria-valuemin", String(ASIDE_MIN_HEIGHT));
grip.setAttribute("aria-valuemax", String(Math.max(ASIDE_MIN_HEIGHT, window.innerHeight - 260)));
grip.setAttribute("aria-valuenow", String(Math.round(aside.getBoundingClientRect().height)));
});
announce();
grip.addEventListener("pointerdown", (e) => {
if (e.button !== 0) return;
e.preventDefault();
const startY = e.clientY;
const startH = Math.round(aside.getBoundingClientRect().height);
let h = startH;
const move = (m) => {
h = clamp(startH + startY - m.clientY);
paintAsideHeight(h);
announce();
};
const up = () => {
window.removeEventListener("pointermove", move);
window.removeEventListener("pointerup", up);
window.removeEventListener("pointercancel", up);
// A plain click (the first half of a double-click) saves nothing.
if (h !== startH) keep(h);
};
window.addEventListener("pointermove", move);
window.addEventListener("pointerup", up);
window.addEventListener("pointercancel", up);
});
grip.addEventListener("dblclick", () => keep(0));
grip.addEventListener("keydown", (e) => {
const dir = e.key === "ArrowUp" ? 1 : e.key === "ArrowDown" ? -1 : 0;
if (!dir) return;
e.preventDefault();
keep(clamp(Math.round(aside.getBoundingClientRect().height) + dir * GRIP_STEP));
});
return grip;
}
export function renderAside() {
const aside = $("aside");
// Redrawing empties the panel, which drops its scroll to the top. An image
@@ -723,6 +785,7 @@ export function renderAside() {
// Off the question's own page (a doc tab, Ask) "this" points at nothing on
// screen, so the pane names the question a note here will go to.
const onQuestion = page.view === "questions" || page.view === "end";
aside.appendChild(asideGrip(aside));
aside.appendChild(el("h2", null, onQuestion ? "Notes on this" : `Notes on “${item.title || "this question"}”`));
const thread = item.thread || [];
+9 -2
View File
@@ -84,7 +84,7 @@ import { openPrefs as openPrefsDialog } from "./prefs-dialog.js";
import { continueButton } from "../continue-button.js";
import { askOfflineFlipped, askState, declineOpen, renderAside, renderAsk, renderSubagents, renderSubagentsButton } from "./ask.js";
import { forgetReviewEnd } from "../review-loop-end.js";
import { renderHandoff, renderLoopEnd, renderHomeButton, renderStopButton, renderStopControls, renderStopping, renderFooterDashboard, stopInProgress, stopWarning } from "./ending.js";
import { forgetLoopEnd, renderHandoff, renderLoopEnd, renderHomeButton, renderStopButton, renderStopControls, renderStopping, renderFooterDashboard, stopInProgress, stopWarning } from "./ending.js";
import { renderNotepadButton } from "./notepad.js";
import { renderActivities } from "./activities.js";
import { renderSetup, setupMoved } from "./setup.js";
@@ -452,6 +452,7 @@ export function adopt(body) {
// or the session ended; either way the menu is not mid-handoff any more.
if (!isDashboard() || finish()) {
page.dashPick = null;
page.dashLoop = false;
page.loopSetup = null;
page.reviewLoopSetup = null;
}
@@ -1685,6 +1686,7 @@ export function renderSidebar() {
// straight to a launch. From the Overview tab too, so the pane shows.
b.addEventListener("click", () => {
page.dashPick = e;
page.dashLoop = false;
page.view = "questions";
render();
});
@@ -1820,6 +1822,7 @@ function paintMain(main) {
if (cardAvailability(page.dashPick, scan(), selSpec()).on) renderConfirm(main, page.dashPick);
else {
page.dashPick = null;
page.dashLoop = false;
renderDashboard(main);
}
} else renderDashboard(main);
@@ -1857,7 +1860,10 @@ function paintMain(main) {
// How the Implementation Loop ended, from the app's `loopEnd`: its own
// screen, ahead of any card the last phase left behind.
if (!page.S.loopEnd) forgetReviewEnd();
if (!page.S.loopEnd) {
forgetReviewEnd();
forgetLoopEnd();
}
if (page.S.loopEnd && !finish()) {
const card = renderLoopEnd(page.S.loopEnd);
card.classList.add("is-primary");
@@ -2612,6 +2618,7 @@ export function wireChrome() {
// same time would be two undos for one press.
if (e.key === "Escape" && (page.dashPick || page.loopSetup || page.reviewLoopSetup) && isDashboard() && !finish() && !document.querySelector("dialog[open]")) {
page.dashPick = null;
page.dashLoop = false;
page.loopSetup = null;
page.reviewLoopSetup = null;
redraw();
+52 -46
View File
@@ -30,9 +30,8 @@ import {
CATALOG_GROUPS,
SKILL_CATALOG,
catalogEntry,
LOOP_ENTRY,
APP_ONLY_ENTRIES,
OUTSIDE_APP_LINE,
loopFor,
loopBoxState,
launchVariant,
SPEC_STATE_LABELS,
chipDetail,
@@ -298,17 +297,12 @@ export function renderDashboard(main) {
let shown = 0;
for (const g of CATALOG_GROUPS) {
const entries = SKILL_CATALOG.filter((e) => e.group === g.id && (!hide || available(e)));
// The desktop app's Implementation Loop and Review Loop cards close their
// group. Outside the app they are always drawn, grayed, so the features can
// be found.
const loopCards = APP_ONLY_ENTRIES.filter((e) => e.group === g.id && (!page.inApp || !hide || available(e)));
if (!entries.length && !loopCards.length) continue;
shown += entries.length + loopCards.length;
if (!entries.length) continue;
shown += entries.length;
const section = el("section", "dash-group");
section.appendChild(el("h3", "dash-group-title", g.title));
const grid = el("div", "dash-grid");
for (const e of entries) grid.appendChild(dashCard(e, menu));
for (const e of loopCards) grid.appendChild(dashCard(e, menu));
section.appendChild(grid);
wrap.appendChild(section);
}
@@ -755,10 +749,8 @@ async function readHandoff(h) {
}
}
const REVIEW_LOOP_SKILL = "plan2code-review-loop";
function dashCard(entry, menu) {
const presentation = entry.appOnly ? loopPresentation(entry, menu) : cardPresentation(entry, scan(), selSpec(), menu);
const presentation = cardPresentation(entry, scan(), selSpec(), menu);
// The agent's `recommend` and detail describe the initially selected spec.
// Other picker choices derive both from the scan, so stale context never
// follows a person to a different spec or to "start from scratch". A grayed
@@ -789,7 +781,7 @@ function dashCard(entry, menu) {
title.appendChild(document.createTextNode(entry.title));
b.appendChild(title);
b.appendChild(el("span", "dash-card-blurb", entry.blurb));
// A line only the desktop app shows (the Review card's pointer to the Review Loop).
// A line only the desktop app shows (a card's `appNote`).
if (entry.appNote && page.inApp) b.appendChild(el("span", "dash-card-detail", entry.appNote));
if (presentation.detail) b.appendChild(el("span", "dash-card-detail", presentation.detail));
if (!presentation.on && presentation.reason) b.appendChild(el("span", "dash-card-off", presentation.reason));
@@ -800,43 +792,13 @@ function dashCard(entry, menu) {
b.appendChild(foot);
b.addEventListener("click", () => {
// A loop card opens its own setup screen instead of a confirm pane.
if (entry.appOnly) return entry.skill === REVIEW_LOOP_SKILL ? hooks.openReviewLoopSetup(selSpec()) : hooks.openLoopSetup(selSpec());
page.dashPick = entry;
page.dashLoop = false;
redraw();
});
// "How the loop works" is a link of its own beside the card, never inside
// the button (a link in a button is not valid and reads badly aloud).
if (entry.appOnly) {
const wrap = el("div", "dash-card-wrap");
wrap.appendChild(b);
wrap.appendChild(loopHelpLink(entry));
return wrap;
}
return b;
}
// The loop card is lit only inside the desktop app and, there, by the same
// rule as Implement (a documented or building spec). Never recommended or
// pre-selected: a person opts into running unattended.
function loopPresentation(entry, menu) {
if (!page.inApp) return { on: false, reason: OUTSIDE_APP_LINE, recommended: false, detail: "" };
if (entry.skill === REVIEW_LOOP_SKILL && loopDriving()) {
return { on: false, reason: "A loop is running. Stop it from the banner at the top of the window first.", recommended: false, detail: "" };
}
return { ...cardPresentation(entry, scan(), selSpec(), menu), recommended: false };
}
// "How the loop works" under the card: a real button styled as a link, a
// sibling of the card button inside its wrapper.
function loopHelpLink(entry) {
const review = entry && entry.skill === REVIEW_LOOP_SKILL;
const a = el("button", "dash-card-link", review ? "How the Review Loop works" : "How the loop works");
a.type = "button";
a.addEventListener("click", () => hooks.openHelpOn(review ? "review-loop" : "loop"));
return a;
}
// "Start with a note from your Notebook": the switch a lit card's confirm
// pane offers when noteSwitchShows() says so. The pane is rebuilt on every
// state frame, so what the person did lives here, keyed to the card and the
@@ -1066,6 +1028,12 @@ function notePreview(picked, state, again) {
return pane;
}
// The Loop box's words on each confirm pane, before the loop's name.
const LOOP_BOX_TEXT = {
"plan2code-loop": "Build every phase unattended",
"plan2code-review-loop": "Review and fix in rounds",
};
// The confirm pane. A card or rail click lands here rather than launching
// straight away: picking a skill is the one irreversible-feeling click on the
// dashboard, and it deserves a beat: what it is, what it will do, and a
@@ -1134,6 +1102,29 @@ export function renderConfirm(main, entry) {
pane.appendChild(label);
}
// Implement's and Review's cards: the Loop box opens the desktop app's
// matching loop setup screen in place of a launch. Outside the app, or while
// a loop runs, it shows grayed with the reason, so the feature can be found.
let loop = null;
const loopEntry = entry.loop ? loopFor(entry) : null;
if (loopEntry) {
const box = loopBoxState(entry, scan(), selSpec(), { inApp: page.inApp, driving: loopDriving() });
if (!review) pane.appendChild(el("hr", "confirm-rule"));
const label = el("label", "confirm-review confirm-loop" + (box.on ? "" : " is-off"));
loop = el("input");
loop.type = "checkbox";
loop.disabled = !box.on;
loop.checked = box.on && page.dashLoop === true;
loop.addEventListener("change", () => {
page.dashLoop = loop.checked;
showLoop();
});
label.append(loop, el("span", null, `${LOOP_BOX_TEXT[loopEntry.skill] || "Run unattended"} (${loopEntry.name})`));
pane.appendChild(label);
if (!box.on && box.reason) pane.appendChild(el("p", "confirm-loop-off", box.reason));
}
const looping = () => Boolean(loop) && !loop.disabled && loop.checked;
// The Notebook switch, on the cards and specs noteSwitchShows() names.
const cmdNote = el("span", "confirm-cmd-note");
cmdNote.hidden = true;
@@ -1163,17 +1154,31 @@ export function renderConfirm(main, entry) {
const start = el("button", "btn primary", "Start " + entry.title);
start.type = "button";
start.disabled = page.gone || page.pendingResult;
start.addEventListener("click", () => launchSkill(launchVariant(entry, Boolean(review) && review.checked)));
start.addEventListener("click", () => {
if (!looping()) return launchSkill(launchVariant(entry, Boolean(review) && review.checked));
if (entry.loop === "plan2code-loop") hooks.openLoopSetup(selSpec());
else hooks.openReviewLoopSetup(selSpec());
});
const back = el("button", "btn ghost", "Back");
back.type = "button";
back.addEventListener("click", () => {
page.dashPick = null;
page.dashLoop = false;
redraw();
});
actions.appendChild(back);
actions.appendChild(start);
tail.appendChild(actions);
pane.appendChild(tail);
// A ticked Loop box hands Start to the loop's setup screen: the Review box
// grays (the loop setup has its own review choice) and the command and
// Start name the loop. Run once here so a re-render keeps the tick's look.
function showLoop() {
if (review) review.disabled = looping();
cmdCode.textContent = looping() ? "Desktop app only" : launchVariant(entry, !review || review.checked).command;
start.textContent = looping() ? "Set up " + loopEntry.name : "Start " + entry.title;
}
if (loopEntry) showLoop();
main.appendChild(pane);
// Focus lands on START after a pick (the clicked control was rebuilt away,
@@ -1200,6 +1205,7 @@ export async function launchSkill(entry) {
return;
}
page.dashPick = null;
page.dashLoop = false;
const action = {
i: "__launch",
type: "launch",
+40 -3
View File
@@ -165,6 +165,24 @@ function closeGuideHeld() {
// Which stop-screen button was pressed and is waiting on the app's answer, so a
// second press cannot send the same request twice.
let loopPressed = null;
// The ending that press was made on, so a later ending never inherits it.
let loopPressedKey = null;
/** The loop's end screen is gone (the loop runs again): its press is over. */
export function forgetLoopEnd() {
loopPressed = null;
loopPressedKey = null;
}
// What a pressed stop-screen button says while its request is under way, and
// the line under it. The app's ok answer only means the request went out: the
// agent still takes seconds to start in its terminal, so the button stays busy.
const LOOP_BUSY = {
resume: ["Continuing…", "Starting the loop again. This page updates when it is running."],
fix: ["Opening…", "Opening a session on this phase. Watch the terminal; this page updates when it is ready."],
finalize: ["Starting Finalize…", "Finalize is starting in the terminal. This can take a few seconds; this page updates when it is ready."],
dashboard: ["Opening the dashboard…", "Leaving this screen. Your work stays as it is."],
};
// The stop screen's Ask agent is up once the app answered a press of Ask a
// question: from then on the button opens the Ask tab, so it can never ask the
@@ -330,14 +348,30 @@ export function renderLoopEnd(end) {
// takes files back out of the index.
if (!finished && can.length) card.appendChild(el("p", "loop-end-safe", "Nothing is lost. Your work stays on disk."));
const mine = loopPressedKey === key ? loopPressed : null;
const actions = el("div", "loop-end-actions");
// A press waits for the app's answer, and then (an ok answer to anything but
// Ask) for the page to move on; only an error frees the buttons again.
const busyKey = LOOP_BUTTONS.map(([k, message]) => {
const waiting = mine === message && !page.loopAction;
const started = mine === message && k !== "ask" && page.loopAction && page.loopAction.ok && page.loopAction.kind === "loop-" + k + "-result";
return waiting || started ? k : null;
}).find(Boolean);
for (const [k, message, label] of LOOP_BUTTONS) {
if (!can.includes(k)) continue;
const choice = el("div", "loop-end-choice" + (k === recommended ? " is-recommended" : ""));
const asked = k === "ask" && askUp;
const b = el("button", "btn" + (k === recommended ? " primary" : ""), asked ? "Open the Ask tab" : label);
const busy = busyKey === k && LOOP_BUSY[k];
const b = el("button", "btn" + (k === recommended ? " primary" : "") + (busy ? " is-busy" : ""), asked ? "Open the Ask tab" : busy ? "" : label);
b.type = "button";
b.disabled = page.gone || (!asked && loopPressed === message && !page.loopAction);
if (busy) {
const spin = el("span", "spinner tiny");
spin.setAttribute("aria-hidden", "true");
b.append(spin, document.createTextNode(busy[0]));
b.setAttribute("aria-busy", "true");
}
// One press at a time: another button waits until this one's request fails.
b.disabled = page.gone || (!asked && Boolean(busyKey) && (busyKey === k || (busyKey !== "ask" && k !== "ask")));
b.addEventListener("click", () => {
if (asked) {
page.view = "ask";
@@ -349,12 +383,15 @@ export function renderLoopEnd(end) {
askUpFor = null;
loopDetailsOpen = null;
loopPressed = message;
loopPressedKey = key;
page.loopAction = null;
tellApp(message);
redraw();
});
choice.appendChild(b);
choice.appendChild(el("p", "loop-end-hint", loopButtonLine(k, stoppedPhase, asked)));
const hint = el("p", "loop-end-hint", busy ? busy[1] : loopButtonLine(k, stoppedPhase, asked));
if (busy) hint.setAttribute("role", "status");
choice.appendChild(hint);
actions.appendChild(choice);
}
if (actions.childElementCount) card.appendChild(actions);
+5 -5
View File
@@ -1,10 +1,10 @@
// Plan2Code Web Console - the Implementation Loop's setup screen, drawn by the page from the console's saved setup and the app's facts; defines only.
//
// The dashboard's loop card opens this in place of the cards. Nothing here
// runs an agent: Start saves the setup through POST /loop-setup, then asks the
// desktop app (`loop-start { spec }`), which reads the setup itself and
// confirms in its own window. The quick check is typed text the page never
// runs or sends to the app.
// The Loop box on Implement's confirm pane opens this in place of an ordinary
// Implement launch. Nothing here runs an agent: Start saves the setup through
// POST /loop-setup, then asks the desktop app (`loop-start { spec }`), which
// reads the setup itself and confirms in its own window. The quick check is
// typed text the page never runs or sends to the app.
import { el } from "../render.js";
import { hooks, page, redraw, saveNow } from "../state.js";
@@ -1,7 +1,7 @@
// Plan2Code Web Console - the Review Loop's setup screen, drawn by the page from the console's saved setup and the app's facts; defines only.
//
// The dashboard's Review Loop card opens this in place of the cards. Nothing
// here runs an agent: Start saves the picks through POST /review-loop-setup,
// The Loop box on Review's confirm pane opens this in place of an ordinary
// Review launch. Nothing here runs an agent: Start saves the picks through POST /review-loop-setup,
// then sends them to the desktop app (`review-loop-start { setup }`), which
// confirms in its own window. Its field builders come from ../loop-parts.js, shared with
// the Implementation Loop's screen. The notification address belongs to the
+18 -30
View File
@@ -39,13 +39,15 @@
// AGENTS.md check, which is a rule on the scan, not on the spec
// review the skill the card launches instead when its Review box is
// ticked (Implement's card, which draws the box), or absent
// loop the app-only entry its Loop box opens the setup screen for, or absent
// card the dashboard card (group, chip, title, blurb, about, and
// `spec: true` when it takes the picked spec), or null; an
// optional `help` is Help's line for the card when it differs
// from `blurb`, `appNote` is a line only the desktop app shows (card and Help), and `icon` names the `ci-*` symbol in
// index.html's card-icons sheet drawn before the title
// appOnly the entry is a card the desktop app alone offers (the
// Implementation Loop and the Review Loop): no workflow, no installed skill, and no
// appOnly the entry is a feature the desktop app alone offers (the
// Implementation Loop and the Review Loop, opened from their
// parent card's Loop box): no workflow, no installed skill, and no
// list derived from the workflows (WORKFLOWS, the meter, the
// resume command, Help's card list) holds it. `skill` is an id
// only; `workflow` is null. Use FLOW_SKILLS for those lists.
@@ -229,6 +231,7 @@ export const SKILLS = Object.freeze([
weight: null, started: null, ran: null, resume: "overview",
subagents: BUILD_HELPERS,
review: "plan2code-3-implement-review",
loop: "plan2code-loop",
states: ["documented", "building"], marksNext: true,
greyed: BUILD_GREYED,
card: {
@@ -256,10 +259,11 @@ export const SKILLS = Object.freeze([
// No card of its own: Implement's card launches it when Review is ticked.
card: null,
}),
// The desktop app's Implementation Loop: a card, not a skill. It has no
// SKILL.md and no console workflow; it drives Implement (or Implement +
// Review) once per phase, each in a fresh agent. Drawn by the dashboard in
// the app only.
// The desktop app's Implementation Loop: not a skill. It has no SKILL.md
// and no console workflow; it drives Implement (or Implement + Review) once
// per phase, each in a fresh agent. No card of its own: the entry exists for
// its availability facts only (`appOnly`, `states`, `greyed`), and
// Implement's Loop box opens its setup screen.
skill({
skill: "plan2code-loop",
workflow: null,
@@ -272,21 +276,13 @@ export const SKILLS = Object.freeze([
subagents: null,
states: ["documented", "building"],
greyed: BUILD_GREYED,
card: {
group: "pipeline",
chip: "Step 3",
spec: true,
title: "Implementation Loop",
icon: "loop",
blurb: "Build every remaining phase unattended, one fresh agent per phase.",
about:
"Builds every remaining phase of the spec without you at the keyboard. Each phase gets a fresh agent that builds it and reviews it. The app checks the result against the spec, runs your quick check, commits, and moves on. It stops at the first phase that goes wrong and tells you why. Desktop app only.",
},
card: null,
}),
// The desktop app's Review Loop, a second app-only card beside the
// Implementation Loop: it runs review and fix rounds over a finished change,
// each round checked by a fresh reviewer. Any project state lights it; the
// setup screen picks the scope.
// The desktop app's Review Loop: review and fix rounds over a finished
// change, each round checked by a fresh reviewer. No card of its own: the
// entry exists for its availability facts only (`appOnly`, `states`,
// `greyed`), and Review's Loop box opens its setup screen, which picks the
// scope.
skill({
skill: "plan2code-review-loop",
workflow: null,
@@ -299,15 +295,7 @@ export const SKILLS = Object.freeze([
subagents: null,
states: "any",
greyed: null,
card: {
group: "pipeline",
chip: "Step 3",
title: "Review Loop",
icon: "loop",
blurb: "Review and fix in rounds on its own, each round checked by a fresh reviewer.",
about:
"Reviews a finished change and fixes what it finds, round after round, without you at the keyboard. The first round reviews everything in scope; each later round reviews only what the last round changed, with a reviewer that never saw the fix being written. It stops on a clean round, at the round cap, or when you say so, then hands back one report and the usual sign-off. Desktop app only.",
},
card: null,
}),
skill({
skill: "plan2code-4-finalize",
@@ -361,6 +349,7 @@ export const SKILLS = Object.freeze([
builds: false, phased: false, metered: true, templates: false,
weight: 2, started: "Review started", ran: "Code review run", resume: null,
subagents: "Run the review's analysis in one fresh helper briefed only with the spec and the change set (references/reviewer-brief.md); verify every finding yourself before you report. At standard strength or above (strongest for branch or full scope), high effort.",
loop: "plan2code-review-loop",
states: "any",
greyed: null,
card: {
@@ -369,7 +358,6 @@ export const SKILLS = Object.freeze([
title: "Review",
icon: "review",
blurb: "A second opinion on the changes. Problems ranked, and you pick what gets fixed.",
appNote: "In the app, the Review Loop runs review and fix rounds on its own.",
about:
"A fresh-eyes pass over what changed: bugs, gaps, and the things the builder was too close to see. Problems come back ranked with a suggestion each, you pick which ones get fixed, and it fixes them.",
},
+3 -1
View File
@@ -127,7 +127,7 @@ export const page = {
// same for the stop screen's Resume, Fix and Finalize; `loopNotifyTest` is
// Send a test's `{ waiting }`, then `{ ok, sent, error }` once the app answered.
loop: null,
// The setup screen the dashboard's Implementation Loop card opened, or null
// The setup screen the Loop box on Implement's confirm pane opened, or null
// (screens/loop-setup.js owns the shape).
loopSetup: null,
// The Review Loop's setup screen (screens/review-loop-setup.js owns the shape), what
@@ -166,6 +166,8 @@ export const page = {
// The dashboard pick being looked at on the confirm pane, before START is
// pressed. Page-local like `view`: a reload simply shows the menu again.
dashPick: null,
// The confirm pane's Loop tick, reset whenever `dashPick` changes.
dashLoop: false,
// The `@name` suggestions popover, owned by whichever box last asked for it.
mentionPop: null,
// The pose pane on screen when a render began, held back from the clear so
+3 -7
View File
@@ -162,7 +162,7 @@
flex-wrap: wrap;
gap: 12px;
}
.dash-grid > .dash-card, .dash-grid > .dash-card-wrap { flex: 0 0 calc((100% - (var(--dash-cols) - 1) * 12px) / var(--dash-cols)); min-width: 0; }
.dash-grid > .dash-card { flex: 0 0 calc((100% - (var(--dash-cols) - 1) * 12px) / var(--dash-cols)); min-width: 0; }
.dash-grid.is-centered { justify-content: center; }
/* A card is a button, so it carries the usual reset; panel look, lifts on hover. */
@@ -390,6 +390,8 @@
.confirm-rule { width: 100%; height: 0; margin: 6px 0 2px; border: 0; border-top: 1px solid var(--accent); }
.confirm-review { display: flex; gap: 8px; align-items: center; margin: 4px 0 8px; color: var(--ink-2); cursor: pointer; }
.confirm-review input { accent-color: var(--accent, currentColor); }
.confirm-loop.is-off { color: var(--ink-3); cursor: default; }
.confirm-loop-off { margin: -6px 0 8px; font-size: var(--fs-xs); color: var(--ink-3); font-style: italic; }
.confirm-cmd { margin: 2px 0 0; }
.confirm-cmd code {
font-family: var(--mono);
@@ -551,12 +553,6 @@
/* --------------------------------------------- the Implementation Loop */
/* A span: a link may not sit inside a button. */
/* The loop card's wrapper: the card button, and its link under it. */
.dash-card-wrap { display: flex; flex-direction: column; gap: 6px; }
.dash-card-wrap > .dash-card { flex: 1 1 auto; }
.dash-card-link { align-self: flex-start; padding: 0; border: 0; background: none; font: inherit; font-size: var(--fs-xs); color: var(--accent); text-decoration: underline; cursor: pointer; }
/* The setup screen: the confirm pane's width, with a left-aligned form. */
.loop-setup { display: grid; justify-items: stretch; text-align: left; gap: 14px; }
.loop-setup .card-kicker, .loop-setup .dash-title, .loop-setup .confirm-spec { justify-self: start; }
@@ -20,11 +20,29 @@
/* ------------------------------------------------------------ responsive */
/* The Notes panel's resize handle exists only while the panel is stacked. */
.aside-grip { display: none; }
@media (max-width: 1080px) {
.layout,
.layout:has(> .aside:empty),
.layout:has(.git-board) { grid-template-columns: 210px minmax(0, 1fr); }
.aside { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--rule); }
/* The grab bar rides the panel's top edge (over its padding) while the notes scroll under it. */
.aside-grip {
display: block; position: sticky; top: 0; z-index: 1; flex: none;
height: 14px; margin: -20px -20px 6px; background: var(--panel-2);
cursor: ns-resize; touch-action: none;
}
.aside-grip::before {
content: ""; position: absolute; left: 50%; top: 5px; width: 44px; height: 4px; margin-left: -22px;
border-radius: 2px; background: var(--ink-3); opacity: 0.6;
}
.aside-grip:hover::before, .aside-grip:focus-visible::before { background: var(--accent); opacity: 1; }
.aside-grip:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
/* A height the person dragged to: the question takes the rest, and it replaces the 30vh cap below 900px. */
html[data-aside-h] .layout { grid-template-rows: minmax(0, 1fr) auto; }
html[data-aside-h] .aside { height: var(--aside-h); min-height: 96px; max-height: calc(100vh - 260px); }
}
/* V20, from a live look at 700 to 1000px: from 900px down the rail beside the