mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-16 04:45:33 -08:00
Show each helper's strength and effort as colored level badges
AI Assisted
This commit is contained in:
1 parent
b99a1a701f
commit
765d2b3536
7 files changed
+100
-7
No files matched your search
+1
-1
@@ -11,7 +11,7 @@ All notable changes to Plan2Code will be documented in this file.
|
||||
- **desktop app**: the window's own title (and so its taskbar entry) now reads **Plan2Code - <folder name>** once a project is open, instead of a plain **Plan2Code** every window shares; two or more windows on different projects read apart without opening each one to check.
|
||||
- **helpers**: a helper (subagent) no longer has to run on the session's own model and effort. A new shared reference, `helper-strength.md`, shipped in Pathfinder, Quick Task, Implement, Implement + Review and Review, matches each helper job to a strength (`light`, `standard`, `strongest` or `inherit`) and an effort (`low`, `medium` or `high`) from signals that can be checked, with floors, one-step escalation and a fallback order for tools that cannot set either, and never names a model or vendor. Review, Implement + Review and Pathfinder name the strength for the helpers they start, and the rules apply in terminal sessions too.
|
||||
- **helpers**: Plan and Revise Plan now offer helpers (subagents), with the web console's **Subagents** button in the top bar, on by default like the other opted-in skills. Each skill has its own rule for what is independent enough to hand off. Plan uses helpers for reading the sources the person names, mapping separate areas of the codebase in Phase 2, gathering evidence on each open tech choice in Phase 4, and one fresh cross-check of the PLAN-DRAFT against the conversation in Phase 7; questions, decisions, sign-offs and the writing of the PLAN-DRAFT stay with the session. Revise Plan uses read-only lookups on the code behind affected and at-risk completed tasks at Steps 1 and 2 and, only after approval and when a revision touches 3 or more phase files, one helper per phase file to apply the approved edits under `specs/`. The rules live in each skill's Helpers section, so they apply in terminal sessions too. `helper-strength.md` now ships in both, with a row for each new kind of helper job (Plan's recon reuses the lookups row) and the PLAN-DRAFT cross-check held at `standard` or above, like a review.
|
||||
- **web console**: the Subagents dialog has a **Helper strength** choice under Helpers: **Balanced** (the default), **Thrifty**, **Best** or **Match my session**, saved per project and skill and delivered to the agent as a `Helper strength:` line. Helper reports may say what each helper ran with (`strength`, `effort`), and the Subagents tab shows it as one quiet line, such as "Standard, medium effort".
|
||||
- **web console**: the Subagents dialog has a **Helper strength** choice under Helpers: **Balanced** (the default), **Thrifty**, **Best** or **Match my session**, saved per project and skill and delivered to the agent as a `Helper strength:` line. Helper reports may say what each helper ran with (`strength`, `effort`), and the Subagents tab shows each as a colored badge with a small three-bar level mark (teal for low, amber for medium, violet for high; the session's own model in plain grey), while screen readers still hear one line, such as "Standard, medium effort".
|
||||
- `plan2code` opens the app automatically when a desktop is available; `plan2code --classic` (or no desktop, e.g. over SSH) keeps today's terminal-only flow unchanged, and the installer brings the app in alongside the skills and the command.
|
||||
|
||||
### 🔧 Changed
|
||||
|
||||
@@ -2164,7 +2164,7 @@ test("subagents: helperRows turns a reported strength and effort into one line,
|
||||
}
|
||||
for (const extra of [{}, { strength: "huge", effort: "max" }]) {
|
||||
const row = line(extra);
|
||||
for (const key of ["strengthLine", "strength", "effort"]) assert.equal(key in row, false, `${JSON.stringify(extra)}: no ${key}`);
|
||||
for (const key of ["strengthLine", "badges", "strength", "effort"]) assert.equal(key in row, false, `${JSON.stringify(extra)}: no ${key}`);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -2180,6 +2180,20 @@ test("page: the Subagents button sits right after Write a brief, and its dialog
|
||||
assert.ok(dialog, "index.html has the Subagents dialog");
|
||||
for (const id of ["subagents-instruction", "subagents-default", "subagents-max", "subagents-checkin", "subagents-research", "subagents-status", "subagents-cancel", "subagents-save"]) {
|
||||
assert.ok(dialog[1].includes(`id="${id}"`), `the dialog carries #${id}`);
|
||||
test("subagents: helperRows gives each reported strength and effort a badge ranked 1-3, and the session's own model rank 0", () => {
|
||||
const badges = (extra) => helperRows([{ id: "h1", title: "One", ask: "a", state: "running", ...extra }]).rows[0].badges;
|
||||
assert.deepEqual(badges({ strength: "standard", effort: "high" }), [
|
||||
{ kind: "strength", label: "Standard", level: 2 },
|
||||
{ kind: "effort", label: "High effort", level: 3 },
|
||||
]);
|
||||
assert.deepEqual(badges({ strength: "light" }), [{ kind: "strength", label: "Light", level: 1 }]);
|
||||
assert.deepEqual(badges({ strength: "strongest", effort: "low" }).map((b) => b.level), [3, 1]);
|
||||
assert.deepEqual(badges({ strength: "inherit", effort: "medium" }), [
|
||||
{ kind: "strength", label: "Session model", level: 0 },
|
||||
{ kind: "effort", label: "Medium effort", level: 2 },
|
||||
]);
|
||||
});
|
||||
|
||||
}
|
||||
assert.doesNotMatch(dialog[1], /\sstyle=/);
|
||||
assert.doesNotMatch(dialog[1], /<script/i);
|
||||
|
||||
@@ -269,6 +269,11 @@ test("the Subagents tab shows a reported helper's strength line and none for a h
|
||||
await tab.click();
|
||||
const rows = s.page.locator("#main .sa-card .sa-row");
|
||||
await rows.first().waitFor();
|
||||
assert.equal(await textOf(rows.filter({ hasText: "Read the store helpers" }).locator(".sa-strength")), "Standard, medium effort");
|
||||
const strength = rows.filter({ hasText: "Read the store helpers" }).locator(".sa-strength");
|
||||
assert.equal(await strength.getAttribute("aria-label"), "Standard, medium effort");
|
||||
const badges = strength.locator(".sa-badge");
|
||||
assert.deepEqual(await badges.allTextContents(), ["Standard", "Medium effort"]);
|
||||
assert.deepEqual(await badges.evaluateAll((els) => els.map((e) => e.className)), ["sa-badge is-strength lvl-2", "sa-badge is-effort lvl-2"]);
|
||||
assert.equal(await badges.first().locator(".sa-bars i.on").count(), 2);
|
||||
assert.equal(await rows.filter({ hasText: "Check the tests" }).locator(".sa-strength").count(), 0);
|
||||
});
|
||||
@@ -724,7 +724,24 @@ export function renderSubagents(main) {
|
||||
head.appendChild(pill);
|
||||
item.appendChild(head);
|
||||
item.appendChild(el("p", "sa-ask", row.ask));
|
||||
if (row.strengthLine) item.appendChild(el("p", "sa-strength", row.strengthLine));
|
||||
if (row.strengthLine) {
|
||||
// Badges for the eye, the plain line for screen readers and the tooltip.
|
||||
const strength = el("p", "sa-strength");
|
||||
strength.setAttribute("aria-label", row.strengthLine);
|
||||
strength.title = row.strengthLine;
|
||||
for (const badge of row.badges) {
|
||||
const chip = el("span", `sa-badge is-${badge.kind} lvl-${badge.level}`);
|
||||
chip.setAttribute("aria-hidden", "true");
|
||||
if (badge.level) {
|
||||
const bars = el("span", "sa-bars");
|
||||
for (let i = 1; i <= 3; i++) bars.appendChild(el("i", i <= badge.level ? "on" : null));
|
||||
chip.appendChild(bars);
|
||||
}
|
||||
chip.appendChild(document.createTextNode(badge.label));
|
||||
strength.appendChild(chip);
|
||||
}
|
||||
item.appendChild(strength);
|
||||
}
|
||||
if (row.result) item.appendChild(el("p", "sa-result", row.result));
|
||||
list.appendChild(item);
|
||||
}
|
||||
|
||||
@@ -161,7 +161,33 @@
|
||||
margin: 4px 0 0; color: var(--ink-2); font-size: 13.5px;
|
||||
display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
|
||||
}
|
||||
.sa-strength { margin: 4px 0 0; color: var(--ink-3); font-size: 12.5px; }
|
||||
.sa-strength { margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
|
||||
/* A helper's strength and effort, coloured by rank: calm teal, amber, violet. */
|
||||
.sa-badge {
|
||||
--b: var(--ink-2);
|
||||
--b-soft: var(--panel);
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 11.5px;
|
||||
font-weight: 600;
|
||||
line-height: 1;
|
||||
padding: 4px 8px;
|
||||
border-radius: 99px;
|
||||
border: 1px solid color-mix(in srgb, var(--b) 35%, transparent);
|
||||
background: var(--b-soft);
|
||||
color: var(--b);
|
||||
white-space: nowrap;
|
||||
}
|
||||
.sa-badge.lvl-1 { --b: var(--lvl-1); --b-soft: var(--lvl-1-soft); }
|
||||
.sa-badge.lvl-2 { --b: var(--lvl-2); --b-soft: var(--lvl-2-soft); }
|
||||
.sa-badge.lvl-3 { --b: var(--lvl-3); --b-soft: var(--lvl-3-soft); }
|
||||
.sa-bars { display: inline-flex; align-items: flex-end; gap: 1.5px; height: 9px; }
|
||||
.sa-bars i { width: 2.5px; border-radius: 1px; background: currentColor; opacity: 0.25; }
|
||||
.sa-bars i:nth-child(1) { height: 4px; }
|
||||
.sa-bars i:nth-child(2) { height: 6.5px; }
|
||||
.sa-bars i:nth-child(3) { height: 9px; }
|
||||
.sa-bars i.on { opacity: 1; }
|
||||
.sa-result { margin: 8px 0 0; padding-top: 8px; border-top: 1px solid var(--rule); font-size: 13.5px; }
|
||||
.sa-pill { display: inline-flex; align-items: center; gap: 6px; flex: none; }
|
||||
.sa-pill.is-running { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
|
||||
|
||||
@@ -24,6 +24,13 @@
|
||||
--warn: #9c3327;
|
||||
--warn-soft: #fbe7e3;
|
||||
--focus: #1f6feb;
|
||||
/* Rank colours for low / mid / high badges (a helper's strength and effort). */
|
||||
--lvl-1: #23716a;
|
||||
--lvl-1-soft: #e1f1ee;
|
||||
--lvl-2: #9a6a12;
|
||||
--lvl-2-soft: #fbf0d8;
|
||||
--lvl-3: #7a3fa8;
|
||||
--lvl-3-soft: #f1e7f8;
|
||||
--shadow: 0 1px 2px rgba(29, 26, 23, 0.05), 0 8px 24px rgba(29, 26, 23, 0.06);
|
||||
/* A soft accent halo for the things that want noticing: the update banner
|
||||
and an enabled Send. Built from --accent, so a picked accent glows too. */
|
||||
@@ -64,6 +71,12 @@
|
||||
--stage-soft: #332a17;
|
||||
--warn: #f0897a;
|
||||
--warn-soft: #34201d;
|
||||
--lvl-1: #6cc4b8;
|
||||
--lvl-1-soft: #172b28;
|
||||
--lvl-2: #e0ab4c;
|
||||
--lvl-2-soft: #332a17;
|
||||
--lvl-3: #c49bea;
|
||||
--lvl-3-soft: #2a2035;
|
||||
--focus: #6aa3ff;
|
||||
--shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
|
||||
--glow: 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent), 0 0 14px color-mix(in srgb, var(--accent) 45%, transparent);
|
||||
@@ -89,6 +102,12 @@
|
||||
--stage-soft: #332a17;
|
||||
--warn: #f0897a;
|
||||
--warn-soft: #34201d;
|
||||
--lvl-1: #6cc4b8;
|
||||
--lvl-1-soft: #172b28;
|
||||
--lvl-2: #e0ab4c;
|
||||
--lvl-2-soft: #332a17;
|
||||
--lvl-3: #c49bea;
|
||||
--lvl-3-soft: #2a2035;
|
||||
--focus: #6aa3ff;
|
||||
--shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
|
||||
--glow: 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent), 0 0 14px color-mix(in srgb, var(--accent) 45%, transparent);
|
||||
|
||||
@@ -221,7 +221,8 @@ export function switchLabel(frame) {
|
||||
// in the order the agent reported them. A real helper supersedes the
|
||||
// working-alone marker, so the note only draws when no helper was ever
|
||||
// reported. A result shows once the helper ended, and a reported strength or
|
||||
// effort as one line ("Standard, medium effort").
|
||||
// effort as one line ("Standard, medium effort") plus a badge each, ranked 1-3
|
||||
// so the page can colour them (0 for the session's own model, which has no rank).
|
||||
export function helperRows(helpers) {
|
||||
const list = Array.isArray(helpers) ? helpers.filter(isPlainObject) : [];
|
||||
const real = list.filter((h) => h.alone !== true);
|
||||
@@ -240,13 +241,24 @@ export function helperRows(helpers) {
|
||||
stateLabel: STATE_LABELS[state] || STATE_LABELS.running,
|
||||
...((state === "done" || state === "failed") && typeof result === "string" && result ? { result } : {}),
|
||||
...ran,
|
||||
...(line ? { strengthLine: line } : {}),
|
||||
...(line ? { strengthLine: line, badges: strengthBadges(ran.strength, ran.effort) } : {}),
|
||||
};
|
||||
});
|
||||
return { alone: false, rows };
|
||||
}
|
||||
|
||||
const HELPER_STRENGTH_WORDS = Object.freeze({ light: "Light", standard: "Standard", strongest: "Strongest", inherit: "Session model" });
|
||||
// Each value's rank for its badge colour; the session's own model has none.
|
||||
const HELPER_STRENGTH_LEVELS = Object.freeze({ light: 1, standard: 2, strongest: 3, inherit: 0 });
|
||||
const HELPER_EFFORT_LEVELS = Object.freeze({ low: 1, medium: 2, high: 3 });
|
||||
|
||||
// One badge per reported value: its kind, its words and its rank.
|
||||
function strengthBadges(strength, effort) {
|
||||
const badges = [];
|
||||
if (strength) badges.push({ kind: "strength", label: HELPER_STRENGTH_WORDS[strength], level: HELPER_STRENGTH_LEVELS[strength] });
|
||||
if (effort) badges.push({ kind: "effort", label: `${effort[0].toUpperCase()}${effort.slice(1)} effort`, level: HELPER_EFFORT_LEVELS[effort] });
|
||||
return badges;
|
||||
}
|
||||
|
||||
// "Standard, medium effort", "Light", "Medium effort", or "" when neither was reported.
|
||||
function strengthLine(strength, effort) {
|
||||
|
||||
Reference in new issue
Block a user