From 92d4d880bf1ddb5e30924d8d1a014cabcf6a046a Mon Sep 17 00:00:00 2001 From: Justin Parker Date: Mon, 9 Nov 2026 08:08:43 -0800 Subject: [PATCH] Let Diagnose start from a Notebook tab AI Assisted --- .readme/web-console.md | 4 ++-- docs/index.html | 2 +- scripts/test-web-console-logic.mjs | 3 +++ scripts/test-web-console-notepad.mjs | 2 ++ scripts/test-web-console-page-dashboard.mjs | 2 ++ src/web-console/notepads.mjs | 2 +- src/web-console/notes/diagnose.md | 4 ++-- src/web-console/public/answers.js | 8 +++++--- 8 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.readme/web-console.md b/.readme/web-console.md index c68f5b8..1a022e5 100644 --- a/.readme/web-console.md +++ b/.readme/web-console.md @@ -232,7 +232,7 @@ and hides it while *Hide unavailable workflows* is on. Its chip has a visible removes the folder (any other spec also asks you to type its name). Click a card and Planny flies while it gets ready; a few seconds later the same page is that skill's console, already running. No -command names to remember. Pathfinder, Plan, Quick Task and Revise plan can also +command names to remember. Pathfinder, Plan, Quick Task, Diagnose and Revise plan can also start from one of your [Notebook](#your-notebook) tabs: see *Sent from the dashboard* there. @@ -1974,7 +1974,7 @@ origin. | `POST /notepad/tab/delete` | `{ id }`. Removes the tab from the index, then its folder (text and pictures); 404 `no-such-tab`. | | `POST /notepad/tab/order` | `{ order: [id] }`, every current id exactly once; 400 `bad` otherwise. | | `POST /notepad/tab/last` | `{ id }`. Remembers the open tab; 404 `no-such-tab`. | -| `POST /notepad/tab/sent` | `{ id, workflow, spec? }`. Records that the tab was sent (`workflow` one of `pathfinder`, `plan`, `quick-task`, `revise-plan`; `spec` like `specs/`) as `sent: { workflow, spec?, at }` on its `tabs.json` entry, shown back in `GET /notepad`'s `tabs`. The page posts it only after the Send that carried the filled box; 400 `bad-sent`, 404 `no-such-tab`. | +| `POST /notepad/tab/sent` | `{ id, workflow, spec? }`. Records that the tab was sent (`workflow` one of `pathfinder`, `plan`, `quick-task`, `revise-plan`, `diagnose`; `spec` like `specs/`) as `sent: { workflow, spec?, at }` on its `tabs.json` entry, shown back in `GET /notepad`'s `tabs`. The page posts it only after the Send that carried the filled box; 400 `bad-sent`, 404 `no-such-tab`. | | `GET /notepad/images//.jpg`, `.thumb.jpg` | Serves a picture or its thumbnail as `image/jpeg`, only by a tab id and a UUID name, a regular file (never a link) whose real path stays inside `~/.plan2code/notepads/`; anything else is 404. | | `POST /subagents` | `{ on, instruction, max }` (`instruction: null` for the shipped default). Saves the switch for this project and skill and answers `{ ok, setting }`; 400 `not-offered` on a skill without the switch, `bad`, `too-long` (over 2,000 characters) or `max` (outside 1 to 20). | | `GET /agents` | The agents view's data: your custom agents and the shipped built-ins and templates, each entry merged with its lookup result `{ state, path, where, folder }`: `state` is `found` (on PATH), `outside` (saved Windows PATH, npm's global folder or an install folder) or `missing`, and `where` says which search found it. Built-ins carry their `install` lines for the server's OS only. | diff --git a/docs/index.html b/docs/index.html index 46263df..2a8765d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -733,7 +733,7 @@ footer a { color: inherit; }
  • Start from your Notebook

    -

    Start Pathfinder, Plan, Quick Task or Revise plan from a Notebook tab. The agent reads the tab only once you send it.

    +

    Start Pathfinder, Plan, Quick Task, Diagnose or Revise plan from a Notebook tab. The agent reads the tab only once you send it.

  • diff --git a/scripts/test-web-console-logic.mjs b/scripts/test-web-console-logic.mjs index 7a9e051..3fb285d 100644 --- a/scripts/test-web-console-logic.mjs +++ b/scripts/test-web-console-logic.mjs @@ -2416,6 +2416,9 @@ test("noteSwitchShows: Pathfinder, Plan and Quick Task on Start fresh, Revise pl assert.equal(noteSwitchShows(entry(skill), scan, sel("exploring")), false, `${skill} on a picked spec`); assert.equal(noteSwitchShows(entry(skill), scan, sel("exploring", { planChange: true })), false, `${skill} on a picked spec with a brief`); } + const diagnose = entry("plan2code-diagnose"); + assert.equal(noteSwitchShows(diagnose, scan, null), true, "Diagnose on Start fresh"); + assert.equal(noteSwitchShows(diagnose, scan, sel("documented")), true, "Diagnose launches untargeted, so a picked spec does not hide it"); const revise = entry("plan2code-1b-revise-plan"); assert.equal(noteSwitchShows(revise, scan, null), false, "Revise plan is grayed on Start fresh"); for (const state of ["documented", "building", "built"]) { diff --git a/scripts/test-web-console-notepad.mjs b/scripts/test-web-console-notepad.mjs index 3ee67c7..d659c8e 100644 --- a/scripts/test-web-console-notepad.mjs +++ b/scripts/test-web-console-notepad.mjs @@ -973,6 +973,8 @@ test("POST /notepad/tab/sent answers 200, 400 and 404, and GET /notepad carries assert.equal(ok.body.ok, true); assert.equal(ok.body.sent.workflow, "quick-task"); assert.deepEqual((await getJson(s, "/notepad")).body.tabs, [{ id, name: "Idea", sent: ok.body.sent }]); + assert.equal((await post({ id, workflow: "diagnose" })).status, 200, "Diagnose can be sent from a tab"); + assert.equal((await post({ id, workflow: "quick-task" })).status, 200); assert.deepEqual(await post({ id, workflow: "document" }), { status: 400, body: { error: "bad-sent" } }); assert.deepEqual(await post({ id, workflow: "revise-plan", spec: "../x" }), { status: 400, body: { error: "bad-sent" } }); assert.deepEqual(await post({ id: "ffffffffffff", workflow: "plan" }), { status: 404, body: { error: "no-such-tab" } }); diff --git a/scripts/test-web-console-page-dashboard.mjs b/scripts/test-web-console-page-dashboard.mjs index 79d1c35..9e0781c 100644 --- a/scripts/test-web-console-page-dashboard.mjs +++ b/scripts/test-web-console-page-dashboard.mjs @@ -581,6 +581,8 @@ test("the Notebook switch shows on Start fresh for Pathfinder, Plan and Quick Ta assert.equal(await offersNote(main, "paused", "/plan2code-1b-revise-plan"), false, "Revise plan with a brief waiting"); assert.equal(await offersNote(main, "ready", "/plan2code-3-implement"), false, "Implement never"); assert.equal(await offersNote(main, "Start from scratch", "/plan2code-xray"), false, "a utility never"); + assert.equal(await offersNote(main, "Start from scratch", "/plan2code-diagnose"), true, "Diagnose on Start fresh"); + assert.equal(await offersNote(main, "ready", "/plan2code-diagnose"), true, "Diagnose on a picked spec"); }); test("the switch lists the Notebook's tabs beside a preview: an empty tab grayed, five ticks at most, a Long tab note, and + note: on the command", async (t) => { diff --git a/src/web-console/notepads.mjs b/src/web-console/notepads.mjs index 51ce3f4..5450da4 100644 --- a/src/web-console/notepads.mjs +++ b/src/web-console/notepads.mjs @@ -114,7 +114,7 @@ const isFile = (p) => { // The workflows a tab can be sent to from the dashboard, and the spec a Revise // plan send names. -export const SENT_WORKFLOWS = ["pathfinder", "plan", "quick-task", "revise-plan"]; +export const SENT_WORKFLOWS = ["pathfinder", "plan", "quick-task", "revise-plan", "diagnose"]; const SENT_SPEC_RE = /^specs\/[A-Za-z0-9._-]+$/; // A tab's `sent` record as stored, or null when it does not hold up. diff --git a/src/web-console/notes/diagnose.md b/src/web-console/notes/diagnose.md index db615ee..06942e9 100644 --- a/src/web-console/notes/diagnose.md +++ b/src/web-console/notes/diagnose.md @@ -2,10 +2,10 @@ ## The bug -An argument that already describes the bug skips the cards it answers. Otherwise one `--wait` batch, no `templates`: +An argument that already describes the bug skips the cards it answers. Otherwise one `--wait` batch, no `templates`; the first card carries `"fill":"note"` (a Notebook tab fills it): ```jsonc -{"title":"Diagnose a bug","headline":{"stage":"The bug","cleared":0,"total":3},"items":[{"id":"bug","kind":"text","title":"What is wrong","body":"The bug, in a sentence or two."},{"id":"expected","kind":"text","title":"Expected and actual","required":false,"body":"What should happen, and what happens instead."},{"id":"see-it","kind":"text","title":"How to see it","required":false,"body":"The steps, command, page or input that shows it, and since when if known."}]} +{"title":"Diagnose a bug","headline":{"stage":"The bug","cleared":0,"total":3},"items":[{"id":"bug","kind":"text","title":"What is wrong","fill":"note","body":"The bug, in a sentence or two."},{"id":"expected","kind":"text","title":"Expected and actual","required":false,"body":"What should happen, and what happens instead."},{"id":"see-it","kind":"text","title":"How to see it","required":false,"body":"The steps, command, page or input that shows it, and since when if known."}]} ``` A follow-up the answers leave open is a new card with a new id. A skipped card is no answer: work from the rest, never guess the missing steps, and ask again when you cannot show someone else the bug without it. diff --git a/src/web-console/public/answers.js b/src/web-console/public/answers.js index 232a826..0a0ea40 100644 --- a/src/web-console/public/answers.js +++ b/src/web-console/public/answers.js @@ -715,12 +715,14 @@ const NOTE_FRESH_CARDS = new Set(["plan2code-0-pathfinder", "plan2code-1-plan", /** * Whether a lit card's confirm pane offers the Notebook switch: Pathfinder, - * Plan and Quick Task on Start fresh (no spec picked), and Revise plan on a - * picked spec with no plan change brief waiting (a waiting brief is what that - * revision is about). Never on a grayed card, never on any other card. + * Plan and Quick Task on Start fresh (no spec picked), Diagnose whenever it is + * lit (it launches untargeted, so a picked spec does not matter), and Revise + * plan on a picked spec with no plan change brief waiting (a waiting brief is + * what that revision is about). Never on a grayed card, never on any other card. */ export function noteSwitchShows(entry, scan, sel) { if (!entry || !cardAvailability(entry, scan, sel).on) return false; + if (entry.skill === "plan2code-diagnose") return true; if (NOTE_FRESH_CARDS.has(entry.skill)) return !sel; if (entry.skill === "plan2code-1b-revise-plan") return Boolean(sel) && sel.planChange !== true; return false;