From f5369df09014320aab2045ce7b87947bc0c76adc Mon Sep 17 00:00:00 2001 From: Justin Parker Date: Sun, 8 Nov 2026 21:57:09 -0800 Subject: [PATCH] Draw the loop's strength picker as a stepped grid and release 3.0.5 AI Assisted --- .../AGENTS-architecture-console-page.md | 2 +- CHANGELOG.md | 6 ++ README.md | 2 +- docs/desktop-app.md | 2 +- package.json | 2 +- plan2code-app/Cargo.lock | 4 +- plan2code-app/fake-agent/Cargo.toml | 2 +- plan2code-app/package-lock.json | 4 +- plan2code-app/package.json | 2 +- plan2code-app/src-tauri/Cargo.toml | 2 +- plan2code-app/src-tauri/tauri.conf.json | 2 +- scripts/test-web-console-page-loop.mjs | 69 +++++++++++++++++++ src/web-console/public/index.html | 4 ++ src/web-console/public/screens/loop-setup.js | 6 +- version.json | 2 +- 15 files changed, 97 insertions(+), 14 deletions(-) diff --git a/.agents-docs/AGENTS-architecture-console-page.md b/.agents-docs/AGENTS-architecture-console-page.md index 1ad33d0..d900359 100644 --- a/.agents-docs/AGENTS-architecture-console-page.md +++ b/.agents-docs/AGENTS-architecture-console-page.md @@ -28,7 +28,7 @@ One row per file under `src/web-console/public/` (the games and their sound are | `public/screens/cleanup.js` | User Preferences' Cleanup section, on the System tab | | `public/screens/core.js` | the core every screen sits inside: connection, the render loop, the page chrome and Send; the only file that imports the screens, and only `app.js` imports it | | `public/screens/dashboard.js` | the dashboard: cards, the spec picker, handoff chips, delete, and the first-open wake-up | -| `public/screens/loop-setup.js` | the Implementation Loop's setup screen on the dashboard (app only): the fields, their defaults and read-only facts, the Start checks, and the request to the app. The page locks while `state.loop.driving` is set (`loopDriving()` in `selectors.js`) until the app posts `loopEnd`; Activities, Notebook, Help and Preferences stay usable. `loopEnd.can` accepts `ask` (`LOOP_CAN` in `patches.mjs`); the app adds it first to every stop that offers `resume`, and the stopped screen's **Ask a question** wakes an ordinary agent on the same session | +| `public/screens/loop-setup.js` | the Implementation Loop's setup screen on the dashboard (app only): the fields, their defaults and read-only facts, the Start checks, and the request to the app. The **Strength per phase** field (`strengthField`) is a grid: four headed columns (Match my session, Thrifty, Balanced, Best; level 0 to 3) and one `radiogroup` row per phase left, one radio per column (`#loop-strength--`, `match` for Match my session; an unmapped word's radio is disabled and its header says "(not mapped)"), the cell's dot (`strengthBars`) over the hidden radio, and the model the pick becomes at the row's end. **Set all to** stays a select (`#loop-strength-all`, blank again after use). `drawStrengthLine(grid)` draws the grid's SVG from the checked nodes' measured positions, never from state: a very light dashed `line.col` per column and a thick square-step `path.step` from each row's node to the next (one path fewer than rows, none under two rows or with the toggle off). It redraws on the window's resize, a `ResizeObserver` on the grid (Preferences' page width), fonts loading and every redraw of the section, and stops once the grid is gone. The colors are the `--lvl-0` to `--lvl-3` tokens (`--lvl-0` is the neutral gray of Match my session); tests wait for the drawn state before reading the line. The page locks while `state.loop.driving` is set (`loopDriving()` in `selectors.js`) until the app posts `loopEnd`; Activities, Notebook, Help and Preferences stay usable. `loopEnd.can` accepts `ask` (`LOOP_CAN` in `patches.mjs`); the app adds it first to every stop that offers `resume`, and the stopped screen's **Ask a question** wakes an ordinary agent on the same session | | `public/screens/docs.js` | documents: tabs, blocks, print and download, and the brief button | | `public/screens/ending.js` | how a session ends: the finished screen, its offers, Stop and the way home | | `public/screens/git-host.js` | hosts the git board: tabs, panels and what each click sends | diff --git a/CHANGELOG.md b/CHANGELOG.md index 3016170..a085b7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to Plan2Code will be documented in this file. +## v3.0.5 + +### 🔧 Changed + +- **web console**: the Implementation Loop's **Strength per phase** setting is now a grid instead of a dropdown per phase: one row per phase, a column each for Match my session, Thrifty, Balanced and Best, and a thick stepped line through each row's pick so the choices read at a glance. The saved picks and the loop's behavior are unchanged. + ## v3.0.4 ### ✨ Added diff --git a/README.md b/README.md index dc5da86..632faef 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ the next engineer all start from the same specs. One command opens it, every step is a card, and the terminal is always there if you prefer it. -Version 3.0.4 · MIT · 📖 [plan2code.jparkerweb.com](https://plan2code.jparkerweb.com) +Version 3.0.5 · MIT · 📖 [plan2code.jparkerweb.com](https://plan2code.jparkerweb.com) --- diff --git a/docs/desktop-app.md b/docs/desktop-app.md index f1b0aa7..3823b77 100644 --- a/docs/desktop-app.md +++ b/docs/desktop-app.md @@ -146,7 +146,7 @@ not), so your own edits never end up inside a phase's commit. - **Fix findings**: **Smart pick** (the default) has a fresh agent read the findings and fix only the ones worth fixing, recording every skip. A skipped Critical stops the phase. **By level** fixes the Critical, Warning and Suggestion findings you tick (all three start ticked). -- **Strength per phase** (off): turn on **Set strength per phase** to pick **Thrifty**, **Balanced**, **Best** or **Match my session** for each phase still to build (or **Set all to** one pick). A phase you leave untouched runs on the model the app was launched with, as before. A phase whose agent crashes or goes quiet gets its one retry (when the retry tick is on) one step up (Thrifty to Balanced, Balanced to Best; Best stays Best; **Match my session** runs on the launch model and its retry stays there), and the phase's helpers follow the same strength. Which model each word means for your agent is set in User Preferences, **Agents & models**, under **Strengths in the loop**; an agent with nothing mapped shows the toggle off with a link there. The picks are remembered per project and spec, and a pick for a phase that is done or gone is dropped. +- **Strength per phase** (off): turn on **Set strength per phase** to see one row per phase still to build under four headed columns, **Match my session**, **Thrifty**, **Balanced** and **Best**, and click a dot in a row to pick (the arrow keys move along a row), or use **Set all to** for one pick. A thick line steps through each row's picked dot, so the choices read at a glance, and the model each pick becomes shows at the end of its row. A phase you leave untouched runs on the model the app was launched with, as before. A phase whose agent crashes or goes quiet gets its one retry (when the retry tick is on) one step up (Thrifty to Balanced, Balanced to Best; Best stays Best; **Match my session** runs on the launch model and its retry stays there), and the phase's helpers follow the same strength. Which model each word means for your agent is set in User Preferences, **Agents & models**, under **Strengths in the loop**; an agent with nothing mapped shows the toggle off with a link there. The picks are remembered per project and spec, and a pick for a phase that is done or gone is dropped. - **When a phase asks something**: **Take the agent's best guess** (the default), which records the assumption as a `[?]` task, **Pause and wait for me**, or **Stop the loop**. - **After the last phase**: **Stop and offer Finalize** (the default) or **Run Finalize automatically**. diff --git a/package.json b/package.json index 56476cb..1053f50 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "plan2code", - "version": "3.0.4", + "version": "3.0.5", "private": true, "bin": { "plan2code-install": "./install.js" diff --git a/plan2code-app/Cargo.lock b/plan2code-app/Cargo.lock index 3c1b864..7daa247 100644 --- a/plan2code-app/Cargo.lock +++ b/plan2code-app/Cargo.lock @@ -757,7 +757,7 @@ dependencies = [ [[package]] name = "fake-agent" -version = "3.0.4" +version = "3.0.5" dependencies = [ "serde_json", "terminal_size", @@ -2371,7 +2371,7 @@ checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" [[package]] name = "plan2code-app" -version = "3.0.4" +version = "3.0.5" dependencies = [ "chrono", "libc", diff --git a/plan2code-app/fake-agent/Cargo.toml b/plan2code-app/fake-agent/Cargo.toml index db62051..db713f1 100644 --- a/plan2code-app/fake-agent/Cargo.toml +++ b/plan2code-app/fake-agent/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fake-agent" -version = "3.0.4" +version = "3.0.5" description = "A stand-in agent program for the Plan2Code app's tests" edition = "2021" publish = false diff --git a/plan2code-app/package-lock.json b/plan2code-app/package-lock.json index 881059e..18da707 100644 --- a/plan2code-app/package-lock.json +++ b/plan2code-app/package-lock.json @@ -1,12 +1,12 @@ { "name": "plan2code-app", - "version": "3.0.4", + "version": "3.0.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "plan2code-app", - "version": "3.0.4", + "version": "3.0.5", "dependencies": { "@tauri-apps/api": "2.12.4", "@xterm/addon-fit": "0.11.0", diff --git a/plan2code-app/package.json b/plan2code-app/package.json index 5ef7efe..c9d4b1b 100644 --- a/plan2code-app/package.json +++ b/plan2code-app/package.json @@ -1,6 +1,6 @@ { "name": "plan2code-app", - "version": "3.0.4", + "version": "3.0.5", "private": true, "description": "Plan2Code desktop app (Tauri). Separate from the repo root so the root and the web console stay dependency-free.", "scripts": { diff --git a/plan2code-app/src-tauri/Cargo.toml b/plan2code-app/src-tauri/Cargo.toml index fb61c36..0724ae4 100644 --- a/plan2code-app/src-tauri/Cargo.toml +++ b/plan2code-app/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "plan2code-app" -version = "3.0.4" +version = "3.0.5" description = "Plan2Code desktop app" edition = "2021" publish = false diff --git a/plan2code-app/src-tauri/tauri.conf.json b/plan2code-app/src-tauri/tauri.conf.json index 71ace5a..7288254 100644 --- a/plan2code-app/src-tauri/tauri.conf.json +++ b/plan2code-app/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "Plan2Code", - "version": "3.0.4", + "version": "3.0.5", "identifier": "com.plan2code.desktop", "build": { "frontendDist": "../ui", diff --git a/scripts/test-web-console-page-loop.mjs b/scripts/test-web-console-page-loop.mjs index f020f5e..234ae9d 100644 --- a/scripts/test-web-console-page-loop.mjs +++ b/scripts/test-web-console-page-loop.mjs @@ -492,6 +492,75 @@ test("turning it on shows one row per phase left with the model each pick become assert.deepEqual((await strengthRows(s)).map((r) => r.pick), ["", ""], "Match my session fills every row too"); }); +test("the arrow keys move the checked radio inside a row, and only that row", async (t) => { + const s = await openStrengthSetup(t); + await s.page.locator("#loop-phase-strength").check(); + await s.page.locator(".loop-strength-row").first().waitFor(); + // Focus once: every change redraws the section, and the page must put focus back on the new radio by itself. + await s.page.locator("#loop-strength-1-match").focus(); + await s.page.keyboard.press("ArrowRight"); + await s.page.locator("#loop-strength-1-thrifty:checked").waitFor({ state: "attached" }); + await s.page.keyboard.press("ArrowRight"); + await s.page.locator("#loop-strength-1-balanced:checked").waitFor({ state: "attached" }); + await s.page.keyboard.press("ArrowLeft"); + await s.page.locator("#loop-strength-1-thrifty:checked").waitFor({ state: "attached" }); + assert.deepEqual((await strengthRows(s)).map((r) => r.pick), ["thrifty", ""], "the other row did not move"); +}); + +// The step path starts on the first row's checked node and ends on the last one's, within a pixel; +// a corner (Q) only when the two nodes sit in different columns. Waits, then asserts, so a redraw cannot race it. +async function waitLineOnNodes(s, corner) { + const read = () => + s.page.evaluate(() => { + const grid = document.querySelector(".loop-strength-grid"); + const gr = grid.getBoundingClientRect(); + const nodes = [...grid.querySelectorAll(".loop-strength-row input:checked + .loop-strength-node")]; + const centers = nodes.map((n) => { + const b = n.getBoundingClientRect(); + return { x: b.left - gr.left + b.width / 2, y: b.top - gr.top + b.height / 2 }; + }); + const d = grid.querySelector(".loop-strength-line path.step")?.getAttribute("d") || ""; + const nums = (d.match(/-?\d+(?:\.\d+)?/g) || []).map(Number); + return { d, centers, nums }; + }); + const onNodes = ({ d, centers, nums }) => + centers.length === 2 && + nums.length >= 3 && + d.includes("Q") === corner && + Math.abs(nums[0] - centers[0].x) <= 1 && + Math.abs(nums[1] - centers[0].y) <= 1 && + Math.abs(nums[nums.length - 3] - centers[1].x) <= 1 && + Math.abs(nums[nums.length - 1] - centers[1].y) <= 1; + const deadline = Date.now() + 5000; + let got = await read(); + while (!onNodes(got) && Date.now() < deadline) { + await new Promise((r) => setTimeout(r, 50)); + got = await read(); + } + assert.ok(onNodes(got), `the step path should run node to node (corner: ${corner}); got ${JSON.stringify(got)}`); +} + +test("the strength line has one path fewer than there are rows, and none with the toggle off", async (t) => { + const s = await openStrengthSetup(t); + const paths = s.page.locator(".loop-strength-line path.step"); + assert.equal(await paths.count(), 0, "no line while the toggle is off"); + await s.page.locator("#loop-phase-strength").check(); + await s.page.locator(".loop-strength-row").first().waitFor(); + // The line is drawn a frame after the rows exist: wait for it, never read straight after a click. + await s.page.waitForFunction(() => document.querySelectorAll(".loop-strength-line path.step").length === 1); + assert.equal(await s.page.locator(".loop-strength-row").count(), 2); + assert.equal(await paths.count(), 1, "two rows, one path between them"); + assert.equal(await s.page.locator(".loop-strength-line line.col").count(), 4, "a dashed column line per strength, Match my session included"); + + // Both rows start on Match my session: one column, so a straight path with no corner. + await waitLineOnNodes(s, false); + await pickStrength(s, 2, "best"); + await waitLineOnNodes(s, true); + await s.page.locator("#loop-phase-strength").uncheck(); + await s.page.locator(".loop-strength-row").first().waitFor({ state: "detached" }); + assert.equal(await paths.count(), 0, "the toggle off draws no line"); +}); + test("an agent with nothing mapped grays the section and links to Agents & models", async (t) => { const s = await openStrengthSetup(t, { ...LAUNCH, agent: "codex", agentLabel: "Codex" }); const note = s.page.locator(".loop-strength-none"); diff --git a/src/web-console/public/index.html b/src/web-console/public/index.html index fc6e5a5..71656aa 100644 --- a/src/web-console/public/index.html +++ b/src/web-console/public/index.html @@ -2262,6 +2262,10 @@ is on) goes one step up (Match my session stays on the launch model), and the phase's helpers follow.

+

+ Click a dot in a phase's row to pick (the arrow keys move along a row); + a line steps through each row's pick so the choices read at a glance. +

What is locked while it runs

Answers, sign-offs, launches, Workspace, Helpers and diff --git a/src/web-console/public/screens/loop-setup.js b/src/web-console/public/screens/loop-setup.js index f3b8018..71c8492 100644 --- a/src/web-console/public/screens/loop-setup.js +++ b/src/web-console/public/screens/loop-setup.js @@ -378,6 +378,8 @@ function strengthBars(level) { const SVG_NS = "http://www.w3.org/2000/svg"; let lineGrid = null; let lineWatching = false; +// The grid can change width with no window resize (Preferences' page width): watch the grid itself too. +const lineObserver = typeof ResizeObserver === "function" ? new ResizeObserver(() => redrawLine()) : null; function svgPart(name, attrs) { const part = document.createElementNS(SVG_NS, name); @@ -432,14 +434,16 @@ function redrawLine() { function stopWatchingLine() { lineGrid = null; if (lineWatching) window.removeEventListener("resize", redrawLine); + if (lineObserver) lineObserver.disconnect(); lineWatching = false; } -/** Draw once layout exists, and again on resize and when fonts load; stop once the grid is gone. */ +/** Draw once layout exists, and again on resize (the window's or the grid's) and when fonts load; stop once the grid is gone. */ function watchStrengthLine(grid) { lineGrid = grid; if (!lineWatching) window.addEventListener("resize", redrawLine); lineWatching = true; + if (lineObserver) lineObserver.observe(grid); requestAnimationFrame(redrawLine); if (document.fonts && document.fonts.ready) document.fonts.ready.then(redrawLine); } diff --git a/version.json b/version.json index 67d2325..9ec7f20 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "name": "Plan2Code", - "version": "3.0.4", + "version": "3.0.5", "description": "A structured 4-step workflow methodology for AI-assisted software development", "keywords": [ "ai",