Keep the taskbar dot and tab icon lit while a finished screen still offers a button

AI Assisted
This commit is contained in:
jparkerweb committed 2026-10-27 18:20:32 -07:00
1 parent 03f433043e
commit 5950abb0aa
6 files changed
+86 -16

No files matched your search

+5 -4
View File
@@ -86,9 +86,10 @@ The taskbar entry also shows when Plan2Code needs you, the same states as the co
a browser. On Windows a green dot means it is your move and a red dot means it needs attention, with
one short burst of flashes when the window is not focused; on macOS the dock shows a red `!` badge on
needs attention and bounces once; on Linux a count badge appears where the desktop supports it. There
is no dot while the agent is busy or the step is finished, and it clears when the agent ends or the
page reloads. Turn it off with **Show on the taskbar when Plan2Code needs me** under **User
Preferences → Desktop app** (shown only inside the app). The per-system details are in
is no dot while the agent is busy or once a finished step has nothing left to press (a finished screen
that still offers a button, such as back to the dashboard, keeps the green dot), and it clears when
the agent ends or the page reloads. Turn it off with **Show on the taskbar when Plan2Code needs
me** under **User Preferences → Desktop app** (shown only inside the app). The per-system details are in
[plan2code-app/README.md](../plan2code-app/README.md#agents-and-the-taskbar).
A slim top bar reads, left to right: the project folder's name, a menu holding its full path and
@@ -144,7 +145,7 @@ anyway**.
## Permission checks are off by default, same as the terminal
The launch card's permission-mode tick is **on by default** (checks off), matching `plan2code` run the
plain way: the agent starts with checks off (`--permission-mode bypassPermissions` in Claude Code,
plain way, where the same question defaults to prompts off: the agent starts with checks off (`--permission-mode bypassPermissions` in Claude Code,
`--permission-mode bypass` in Devin, `--dangerously-bypass-approvals-and-sandbox` in Codex), reading,
writing and running commands in your project folder without asking; the agent's amber **checks off** badge in
the top bar says so while that agent runs. Untick it before pressing Start agent to keep the agent's normal approval prompts instead.
+1 -1
View File
@@ -18,7 +18,7 @@ The app is optional. The Node web console and the skills never depend on it, so
| macOS | no badge (the system badge cannot be green), one bounce when not focused | red `!` dock badge, and one bounce when not focused |
| Linux | the urgency hint when not focused | a count badge of 1 where the desktop supports it, and the urgency hint |
There is no dot while busy or finished. The dot clears when the agent ends, the page reloads or the page stops answering, and a lit taskbar button goes back to normal when the window gets focus. **User Preferences → Desktop app** (shown only inside the app) has the switch **Show on the taskbar when Plan2Code needs me**, on by default; off clears the dot and stops flashes. It is saved as `taskbarSignal` in the app's own `~/.plan2code/app.json`.
There is no dot while busy or once a finished step has nothing left to press; a finished screen that still offers a button (back to the dashboard, a review) keeps the green dot. The dot clears when the agent ends, the page reloads or the page stops answering, and a lit taskbar button goes back to normal when the window gets focus. **User Preferences → Desktop app** (shown only inside the app) has the switch **Show on the taskbar when Plan2Code needs me**, on by default; off clears the dot and stops flashes. It is saved as `taskbarSignal` in the app's own `~/.plan2code/app.json`.
## Layout
+1 -1
View File
@@ -117,7 +117,7 @@ Do each of Claude Code, Devin and Codex for a few minutes:
- [ ] Each **Install page** link opens the right page in the default browser (Claude Code, Devin, Codex)
- [ ] Install an agent (or add a custom one), press **Check again**: it appears and Start turns on without restarting the app
- [ ] With only one agent installed and nothing remembered, the launch card starts on that agent, not Claude Code
- [ ] Windows: the taskbar button shows a green dot when it is your move and a red dot when Plan2Code needs attention, and no dot while the agent is busy or after it ends
- [ ] Windows: the taskbar button shows a green dot when it is your move and a red dot when Plan2Code needs attention, a green dot on a finished screen that still offers a button (back to the dashboard, a review), and no dot while the agent is busy, once a finished step has nothing left to press, or after the agent ends
- [ ] Windows: with the window unfocused, the button gives one short burst of flashes when it becomes your move or needs attention (not again on a repeat) and stays lit until the window gets focus
- [ ] macOS: the dock shows a red `!` badge when Plan2Code needs attention (no badge on your move), and bounces once when it becomes your move or needs attention while the app is in the background
- [ ] Linux: where the desktop shows badges, a count of 1 appears on needs attention, and the window is marked as wanting attention while unfocused
+21
View File
@@ -299,6 +299,27 @@ test("framed, the page tells the app its state once per change, never on a redra
assert.deepEqual((await toApp(s, "attention")).at(-1), { plan2code: "attention", state: "plain" });
});
test("framed, a finished screen with a button still to press is the person's move; one with nothing left is plain", async (t) => {
const browser = await pages.browser();
const last = async (s) => (await toApp(s, "attention")).at(-1)?.state;
// The finished screen that waits on a press once told the app plain, so the
// taskbar showed no dot while the person was needed.
// Both start busy, so the state read after the finish's line shows is the
// finish's own (the line and the message come from the same redraw).
const WORKING = { agent: { status: "working", activity: "Task 1 of 2" } };
const offered = await openSession(browser, { t, workflow: "quick-task", payload: WORKING, env: { PLAN2CODE_IN_APP: "1" }, init: FAKE_APP_FRAME });
await until(async () => (await last(offered)) === "busy", 5000);
offered.post({ finish: { headline: "Quick task done", command: "git add -A && git commit -m x -m y", dashboard: true } });
await until(async () => (await offered.page.locator("#agent-text").textContent()).includes("Head back to the dashboard"), 5000);
assert.equal(await last(offered), "ready", "a finish offering the dashboard is the person's move");
const paused = await openSession(browser, { t, workflow: "implement", payload: WORKING, env: { PLAN2CODE_IN_APP: "1" }, init: FAKE_APP_FRAME });
await until(async () => (await last(paused)) === "busy", 5000);
paused.post({ finish: { headline: "Paused at Phase 2", command: "/plan2code-3-implement specs/audit-export/overview.md" } });
await until(async () => (await paused.page.locator("#agent-text").textContent()).startsWith("Paused"), 5000);
assert.equal(await last(paused), "plain", "a paused finish has nothing left to press");
});
test("the Desktop app group shows only in the app's frame, reflects the app's saved switch and tells the app when it changes", async (t) => {
const browser = await pages.browser();
const plain = await openSession(browser, { t, workflow: "implement", payload: ASKING });
+51 -4
View File
@@ -32,15 +32,16 @@ import { joinedCss } from "./css-helpers.mjs";
test("favicon: the dot follows the status line -- busy, ready, attention, plain", () => {
// Anything with the spinning ring is busy, even a finished screen opening the dashboard.
assert.equal(faviconState({ mood: "work", spin: true }), "busy");
assert.equal(faviconState({ mood: "work", spin: true, finished: true }), "busy");
// Pointing is the person's move, a finished screen with a press on offer too.
assert.equal(faviconState({ mood: "point" }), "ready");
// A working mood without the ring is the stale line; adrift and gone need a look too.
// A working mood without the ring is the stale line; adrift (a finished
// screen's stranded press among them) and gone need a look too.
assert.equal(faviconState({ mood: "work" }), "attention");
assert.equal(faviconState({ mood: "adrift" }), "attention");
assert.equal(faviconState({ mood: "gone" }), "attention");
assert.equal(faviconState({ mood: "happy" }), "plain");
assert.equal(faviconState({ mood: "done", finished: true }), "plain");
assert.equal(faviconState({ mood: "point", finished: true }), "plain");
// All done or paused, nothing left to press.
assert.equal(faviconState({ mood: "done" }), "plain");
assert.equal(faviconState(), "plain");
});
@@ -420,3 +421,49 @@ test("getting started: the new help, status and finished-screen strings carry no
const fresh = stuck.slice(0, stuck.indexOf("<h4>Not running, or not connected?</h4>"));
assert.ok(!fresh.includes(EM), "the callout and rows have no em dash");
});
// Every relative module a file pulls in, as `{ file, dynamic, names }`: static
// `import`/`export ... from` lines, and `import("./x")` calls with the names
// destructured from them when the call reads `const { a, b } = await import(...)`.
function relativeImports(file) {
const text = fs.readFileSync(file, "utf8");
const found = [];
for (const m of text.matchAll(/(?:^|[\s;])(?:import|export)\s+(?:[^"';]*?\sfrom\s+)?["'](\.{1,2}\/[^"']+)["']/g)) {
found.push({ file: path.resolve(path.dirname(file), m[1]), dynamic: false, names: null });
}
for (const m of text.matchAll(/(?:const\s*\{([^}]*)\}\s*=\s*await\s+)?import\(\s*["'](\.{1,2}\/[^"']+)["']\s*\)/g)) {
const names = m[1] ? m[1].split(",").map((n) => n.trim().split(/\s*:\s*/)[0]).filter(Boolean) : null;
found.push({ file: path.resolve(path.dirname(file), m[2]), dynamic: true, names, from: file });
}
return found;
}
test("no agent CLI module imports notepads.mjs, directly or through a module it imports", () => {
const dir = path.join(ROOT, "src", "web-console");
const store = path.join(dir, "notepads.mjs");
const starts = ["console.mjs", ...fs.readdirSync(dir).filter((n) => /^cmd-.*\.mjs$/.test(n))].map((n) => path.join(dir, n));
assert.ok(starts.length > 1, "found the agent CLI's modules");
const seen = new Set();
const lazy = [];
const queue = [...starts];
while (queue.length) {
const file = queue.shift();
if (seen.has(file) || !fs.existsSync(file)) continue;
seen.add(file);
for (const dep of relativeImports(file)) {
if (dep.file === store) {
assert.ok(dep.dynamic, `${path.relative(ROOT, file)} imports notepads.mjs at the top`);
lazy.push(dep);
} else queue.push(dep.file);
}
}
assert.ok(seen.size > 5, "walked the import graph");
assert.equal(seen.has(store), false, "the store is never loaded at the top of an agent-side module");
// The one way in is Cleanup (User Preferences, reached only through the
// page's /cleanup route), which lists stale notepads and removes one whole,
// never reading a note's text.
for (const dep of lazy) {
assert.equal(path.basename(dep.from), "sessions.mjs", "only Cleanup loads the store, lazily");
assert.ok(dep.names && dep.names.every((n) => n === "staleNotepads" || n === "removeNotepad"), `Cleanup takes only staleNotepads and removeNotepad, not ${dep.names}`);
}
});
+7 -6
View File
@@ -2,8 +2,8 @@
//
// The favicon follows the status line with a bar along its bottom edge: dashed
// amber while Plan2Code is busy, solid green when it is the person's move,
// solid red when it needs attention, and none (the plain Planny) once the
// session is finished. It reads from the same calls
// solid red when it needs attention, and none (the plain Planny) once nothing
// is left for anyone to do. It reads from the same calls
// renderStatus() already makes for Planny's mood, so the icon and the line
// beside him can never disagree. No DOM access at module scope: `node --test`
// imports this file.
@@ -26,12 +26,13 @@ export const FAVICON_COLORS = Object.freeze({
* handed to say(): `spin` marks something really happening at the other end
* right now, so that is busy. A working mood without the spin is the stale
* line ("has not checked in for a few minutes"), which, like adrift and gone,
* needs attention. `point` is the person's move. A finished session is plain
* unless it is visibly busy again (opening the dashboard, starting a review).
* needs attention. `point` is the person's move. A finished screen follows the
* same moods: it points while a press is still on offer (back to the
* dashboard, a review), is adrift when a press was never collected, and is
* `done` (plain) once nothing is left.
*/
export function faviconState({ mood, spin = false, finished = false } = {}) {
export function faviconState({ mood, spin = false } = {}) {
if (spin) return "busy";
if (finished) return "plain";
if (mood === "adrift" || mood === "gone" || mood === "work") return "attention";
if (mood === "point") return "ready";
return "plain";