mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-21 05:11:18 -08:00
Compare commits
3
Commits
ea51026864
...
e4d58d07c9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e4d58d07c9 | ||
|
|
6830f685d6 | ||
|
|
c1fe99b01b |
No files matched your search
@@ -352,6 +352,10 @@ Review, Init and Init update 2; Revise plan, Quick task and Finalize 1; a
|
||||
Pathfinder map 2 and each question its research subagents settle 1; a built phase by its size,
|
||||
one point per 3 tasks it completed (rounded up), plus 1 for Implement + Review
|
||||
(a flat 2, or 3, if the agent did not report a task count); Handoff and the dashboard 0.
|
||||
A build counts while it runs: each task the progress bar ticks off adds to the
|
||||
build's row (*Implement + Review: 9 tasks built so far*), Implement + Review's
|
||||
review stage adds its 1 as it starts, and the approved phase takes the row over
|
||||
with its final score, so the meter never waits for the sign-off to catch up.
|
||||
On top of that, every 2 questions you answer on the page add 1 point to the
|
||||
skill run you answered them in (`ANSWERS_PER_POINT`), so a long Pathfinder or a
|
||||
Plan with many clarifying questions weighs more than a short one. A review run on the
|
||||
|
||||
@@ -19,6 +19,7 @@ All notable changes to Plan2Code will be documented in this file.
|
||||
- **commit-msg.mjs**, **review-scope.mjs**, **agents-md.mjs**, **agent-files.mjs**, **handoff-path.mjs**: the commit command from the branch's ticket, Review's git scope and doc share, AGENTS.md's structure and orphans, the AI agent file sync, and the handoff's timestamped path and git ignore check.
|
||||
- **tests**: `scripts/test-skill-scripts.mjs` and `scripts/test-script-<skill>.mjs`, run by `npm test` against the built `skills/` tree. One test fails if a `SKILL.md` names a script its skill does not ship.
|
||||
- **web console**: the Workspace dialog's folders are remembered across console sessions, in `~/.plan2code/console/workspaces.json` beside `looks.json` (never in the project), keyed by the folder a session runs in and then by spec. Every change is saved. *Start from scratch* on the dashboard shows the project's list; picking a spec loads its own, which starts as a copy of the project's and is separate after that, and a spec created mid-run takes the list in force with it. The dialog says whose list it is. New `console.mjs forget --spec specs/<name>`, which Finalize's Spec Cleanup runs after archiving a spec.
|
||||
- **web-console**: the Questions and Ask tabs show a small spinner left of their name while Plan2Code is on it. Questions (Dashboard on the dashboard) spins from Send until the answers are picked up, the same wait as *Sent. Waiting for Plan2Code.*; Ask spins while a question the agent picked up has no answer yet, exactly when the conversation's own ring does. Neither turns once the agent goes quiet or offline, so a dead session never reads as a slow one.
|
||||
|
||||
### 🔧 Changed
|
||||
|
||||
@@ -37,6 +38,7 @@ All notable changes to Plan2Code will be documented in this file.
|
||||
- **finalize**: `feedback-payload.mjs` counts the same phase files `specs.mjs` does, `submit` refuses an oversize URL when `gh` is unavailable (`oversize`), and a bare spec name present in both `specs/` and `specs--completed/` is refused as ambiguous.
|
||||
- Every script was checked against real specs and Pathfinder maps in other repositories and by four independent reviews; each issue found has a regression test.
|
||||
|
||||
- **document**: `overview.md` puts the Phase Checklist and Parallel Execution Groups directly under the Summary, ahead of the Tech Stack, Architecture, Risks and Success Criteria, so the phases are found without scrolling. Every script finds these sections by heading, so specs written in the old order keep working.
|
||||
- **install.js**: the closing message beside Planny now names the dashboard first: `plan2code` from any project, or `/plan2code` in your agent when the command could not be installed. The docs link moves to the line under it.
|
||||
- **web-console**: User Preferences opens from a gear button instead of the three swatches, and the default highlight color is now ocean blue instead of rust.
|
||||
- **web-console**: the dashboard rail marks the suggested next step with a small dot, since the center pane's Suggested pill can scroll out of view. Send pulses only while it is the primary button.
|
||||
@@ -47,9 +49,11 @@ All notable changes to Plan2Code will be documented in this file.
|
||||
- **Launcher**: before asking which CLI to use, `plan2code` says what it is about to do and that running `/plan2code` inside your agent works too.
|
||||
- **web-console**: the session meter now weighs the work a session actually did instead of a flat amount per step. A built phase scores one point per 3 tasks it completed (rounded up), plus 1 for Implement + Review, so a twelve-task phase weighs four times a three-task one; the agent reports the count as `run.tasks`. Every 2 questions you answer on the page add a point to the skill you answered them in, so a long back-and-forth in Plan or Pathfinder counts for more than a short one. Each Pathfinder research question adds 1 through a new `pathfinder-research` event, since research fills the context with nobody answering anything. The levels move to match: yellow from 5 points, red from 10, and the ring is full at 15.
|
||||
- **web-console**: while a build runs, the waiting screen's pointer to the tasks list is now clickable. **Task** and the tab's own name (say **Phase 6 tasks**) show bold in the highlight color, and either one opens that phase's tasks tab.
|
||||
- **web-console**: the session meter counts a build while it runs instead of only once the phase is approved. `console.mjs` writes a `progress` ledger entry whenever an Implement or Implement + Review post raises `headline.cleared`, and the build's row (*Implement + Review: 9 tasks built so far*) scores one point per 3 tasks done. The phase's final `run` takes that row over in place, so nothing counts twice and the meter never drops. A second phase in the same run starts its own count once its headline is back at `cleared: 0`.
|
||||
|
||||
### 🐛 Fixed
|
||||
|
||||
- **web-console**: Implement + Review's built-in review no longer scores twice on the session meter. Its `review` run now scores the phase's 1-point review bonus as the review starts (not a standalone Review's 2), and the phase's final `run` leaves that point out. A 17-task phase now ends at 7 points, not 9. The breakdown also stops repeating the unit in "Code review run: review".
|
||||
- **pathfinder**: charting no longer ends the session, or shows "Session ended" in the web console, while its research subagents are still running. They live in the terminal's process, so closing it on a "done" page killed them mid-write. The session now waits for every one (the page shows a running count), each subagent ends `## Evidence` with a `**Research complete:**` line, and Work Step 2 re-fires any research question missing it. `console.md` makes the same rule general: no `finish` while any subagent or background job is still out.
|
||||
- **web-console**: reusing a settled question id for a different kind of question (say a multi-select turned confirm) now opens it as a new question instead of keeping the old answer.
|
||||
- **web-console**: Send no longer stays disabled when an agent posts a question mid-build while still marked `working` (seen on Implement + Review, where the question said "I'm carrying on while you decide"). Once an open question has an answer or a note staged, Send unlocks at once with "Still working · it reads this next", instead of waiting out the agent's `quietMinutes` (up to an hour); the server holds the send until the agent next looks. `building.md` now says a question stops the build: set `waiting` in the same post as the question and wait, never keep working with a question open.
|
||||
|
||||
@@ -140,6 +140,7 @@ import {
|
||||
breakdownFrom,
|
||||
meterView,
|
||||
pointsFrom,
|
||||
progressEntry,
|
||||
RED_AT,
|
||||
ANSWERS_PER_POINT,
|
||||
ringFraction,
|
||||
@@ -4646,6 +4647,65 @@ test("meter: a built phase scores by the tasks it completed", () => {
|
||||
assert.equal(levelFor(pointsFrom(entries)), "yellow", "one big phase can yellow a session alone");
|
||||
});
|
||||
|
||||
test("meter: a build scores its tasks as it goes, and the approved phase takes the row over", () => {
|
||||
const run = (event, id, extra = {}) => ({ kind: "run", id: `L1:${id}`, event, workflow: "implement-review", ...extra });
|
||||
const ledger = [{ kind: "launch", id: "L1", workflow: "implement-review" }];
|
||||
const tick = (cleared) => {
|
||||
const e = progressEntry(ledger, "L1", "implement-review", cleared);
|
||||
if (e) ledger.push(e);
|
||||
return e;
|
||||
};
|
||||
assert.equal(tick(0), null, "the first build needs no reset");
|
||||
for (let n = 1; n <= 17; n++) tick(n);
|
||||
assert.equal(tick(17), null, "the same count posted again adds nothing");
|
||||
assert.equal(tick(9), null, "a lower count adds nothing");
|
||||
assert.deepEqual(breakdownFrom(ledger), [{ label: "Implement + Review: 17 tasks built so far", points: 6 }]);
|
||||
|
||||
ledger.push(run("review", "review"));
|
||||
ledger.push(run("review", "review-again"));
|
||||
assert.equal(pointsFrom(ledger), 7, "the built-in review scores its 1 once, not a Review's 2");
|
||||
ledger.push(run("implement-review-phase", "phase-6", { tasks: 17 }));
|
||||
assert.deepEqual(breakdownFrom(ledger), [
|
||||
{ label: "Implement + Review phase built: phase-6 (17 tasks)", points: 6 },
|
||||
{ label: "Implement + Review: code review run", points: 1 },
|
||||
], "the phase took its build's row over and left the review's point out");
|
||||
assert.equal(pointsFrom(ledger), 7);
|
||||
|
||||
assert.equal(tick(17), null, "the finished phase's count posted again opens nothing");
|
||||
assert.equal(tick(2), null, "nor does a count before the next phase resets to 0");
|
||||
assert.equal(tick(0).tasks, 0);
|
||||
tick(2);
|
||||
assert.equal(pointsFrom(ledger), 8, "the next phase in the same run counts afresh");
|
||||
|
||||
assert.equal(progressEntry([], "L1", "plan", 3), null, "only builds count progress");
|
||||
assert.equal(progressEntry([], "L1", "implement", 2.5), null);
|
||||
assert.equal(progressEntry([], "L1", "implement", 1000), null);
|
||||
// A phase that ends below its progress (blocked tasks) never takes points back.
|
||||
assert.equal(pointsFrom([
|
||||
{ kind: "progress", id: "L1:b0:9", build: "L1:b0", workflow: "implement", tasks: 9 },
|
||||
{ kind: "run", id: "L1:phase-1", event: "implement-phase", workflow: "implement", tasks: 5 },
|
||||
]), 3);
|
||||
// Implement's own review verdict is an extra review and still scores 2.
|
||||
assert.equal(pointsFrom([{ kind: "run", id: "L1:review", event: "review", workflow: "implement" }]), 2);
|
||||
});
|
||||
|
||||
test("meter: a build post's headline.cleared reaches the ledger as progress", () => {
|
||||
const res = cli(["open", "--workflow", "implement", "--title", "Meter: Phase 1", "--no-open"]);
|
||||
const s = { sid: res.json.sid, session: res.json.session };
|
||||
try {
|
||||
const points = () => meterView(readLedger(s.session)).points;
|
||||
assert.equal(postPatch(s, { headline: { stage: "Phase 1", cleared: 0, total: 7 } }).status, 0);
|
||||
assert.equal(postPatch(s, { headline: { cleared: 4 } }).status, 0);
|
||||
assert.equal(points(), 2, "4 tasks built so far");
|
||||
assert.equal(postPatch(s, { headline: { cleared: 4 } }).status, 0);
|
||||
assert.equal(readLedger(s.session).filter((e) => e.kind === "progress").length, 1, "a repeat writes nothing");
|
||||
assert.equal(postPatch(s, { headline: { cleared: 7 }, run: { event: "implement-phase", id: "phase-1", tasks: 7 } }).status, 0);
|
||||
assert.equal(points(), 3, "the phase's run took over: 7 tasks score 3, not 3 + 3");
|
||||
} finally {
|
||||
cli(["stop", "--session", s.sid]);
|
||||
}
|
||||
});
|
||||
|
||||
test("meter: answers score per skill run, one point per two, rounded down", () => {
|
||||
assert.equal(ANSWERS_PER_POINT, 2);
|
||||
const answer = (launch, i, workflow) => ({ kind: "answer", id: `${launch}:answer:t:${i}`, workflow });
|
||||
|
||||
@@ -60,7 +60,9 @@ The first payload for a phase you are about to build:
|
||||
```
|
||||
|
||||
`headline.cleared` / `total` are tasks done out of tasks in the phase: the
|
||||
progress bar is the first thing someone watching a build looks at.
|
||||
progress bar is the first thing someone watching a build looks at. The session
|
||||
meter counts the build's tasks from `cleared` as it rises, so keep it current,
|
||||
and start every phase (a second one in the same run too) at `"cleared": 0`.
|
||||
|
||||
`phasefile` is the whole `phase-X.md`, verbatim from disk, as its own tab —
|
||||
the person can read the prerequisites and task specs while you build. Re-post
|
||||
@@ -233,8 +235,9 @@ sign-off card, and approving past it was the answer. `implement-review` ends
|
||||
the same way; that phase was reviewed already. Only a finished `quick-task`
|
||||
still offers the review on its finish — see below.
|
||||
|
||||
`run` scores the approved phase on the session meter (console.md → Posting an
|
||||
update → Session meter), in the same post that records the approval:
|
||||
`run` gives the approved phase its final score on the session meter (console.md →
|
||||
Posting an update → Session meter), in the same post that records the approval;
|
||||
it takes over what the build already counted from `cleared`, never adds to it:
|
||||
`implement-phase` for Implement, `implement-review-phase` for Implement +
|
||||
Review, id `phase-N`, and `tasks`: how many of the phase's tasks were
|
||||
completed (`[x]`, not blocked `[!]`). The phase scores by its size, so a
|
||||
@@ -392,7 +395,10 @@ a question still owed, above the ending itself:
|
||||
|
||||
The same build, then Stage 2 publishes the findings exactly as above (the
|
||||
`review` doc and the `fixes` item). Stage 3 fixes, with no "Check the fixes"
|
||||
item: Stage 4 is the only gate. Stage 4 is the sign-off above **without the
|
||||
item: Stage 4 is the only gate. The post that starts Stage 2's review carries
|
||||
`"run": { "event": "review", "id": "review" }`, as above: in this workflow it
|
||||
scores the review stage's 1 point on the meter as it begins, and the phase's
|
||||
final `run` leaves that point out. Stage 4 is the sign-off above **without the
|
||||
review verdict** — the phase was already reviewed — with the review results
|
||||
and unresolved findings in the report doc, header "Reviewed and ready for
|
||||
sign-off" in the item's `body`. The finish never carries `review`, and its
|
||||
|
||||
@@ -901,7 +901,9 @@ Per-unit work is yours to report, with `run` in any post:
|
||||
not count), a whole number from 1 to 999. A built phase scores by its size,
|
||||
one point per 3 tasks rounded up, and Implement + Review one more for the
|
||||
review. Always send it: without it a phase scores a flat 2 (or 3), however
|
||||
big it was. On any other event it is exit `3`.
|
||||
big it was. On any other event it is exit `3`. The console already counts a
|
||||
build's tasks from `headline.cleared` as they are ticked off; the phase's
|
||||
`run` takes that count over with the final score, so it never counts twice.
|
||||
- One `run` per post. Which events a workflow reports is in its own notes
|
||||
(Workflow notes → Pathfinder; `building.md` for Implement and for the
|
||||
review run on the page after a build).
|
||||
|
||||
@@ -90,7 +90,7 @@ import {
|
||||
writeJsonAtomic,
|
||||
writeWorkspaceCursor,
|
||||
} from "./lib.mjs";
|
||||
import { RUN_EVENTS, TASK_EVENTS, MAX_TASKS, isTaskCount } from "./public/meter.js";
|
||||
import { RUN_EVENTS, TASK_EVENTS, MAX_TASKS, isTaskCount, progressEntry } from "./public/meter.js";
|
||||
import { changeLine } from "./public/workspace.js";
|
||||
|
||||
// Mirrors the server's absolute lifetime cap: a handle older than this cannot
|
||||
@@ -593,6 +593,13 @@ function cmdPost() {
|
||||
const next = written.state;
|
||||
|
||||
for (const line of ledgerLines) appendLedger(dir, line);
|
||||
// A build scores its tasks as it clears them (meter.js, PROGRESS_WORKFLOWS),
|
||||
// after any `run` in the same post, so a phase finished here ends its count.
|
||||
if (patch.headline && typeof patch.headline === "object") {
|
||||
const ledger = readLedger(dir);
|
||||
const progress = progressEntry(ledger, lastLaunchId(ledger), next.workflow, patch.headline.cleared);
|
||||
if (progress) appendLedger(dir, progress);
|
||||
}
|
||||
appendEvent(dir, { type: "post", items: (patch.items || []).length });
|
||||
|
||||
const open = next.items.filter((i) => isOpen(i) && i.required !== false).length;
|
||||
|
||||
@@ -1096,6 +1096,14 @@ h1 {
|
||||
.ask-disabled-note.is-limit, .ask-disabled-note.is-waiting { color: var(--ink-2); background: var(--panel-2); border: 1px solid var(--rule); }
|
||||
.ask-disabled-note.is-offline { color: var(--warn); background: var(--warn-soft); border: 1px solid var(--warn); }
|
||||
|
||||
/* Waiting on Plan2Code (an Ask answer, or answers sent from Questions):
|
||||
the tiny ring, left of the label. */
|
||||
.view-tab .tab-spin {
|
||||
display: inline-block;
|
||||
margin-right: 6px;
|
||||
vertical-align: -1px;
|
||||
}
|
||||
|
||||
/* A reply landed while another tab was open. */
|
||||
.view-tab .tab-dot {
|
||||
display: inline-block;
|
||||
@@ -3144,11 +3152,6 @@ a.icon-btn { box-sizing: border-box; text-decoration: none; }
|
||||
0%, 15%, 75%, 100% { transform: scale(1); opacity: 0.16; }
|
||||
45% { transform: scale(0.7); opacity: 0.08; }
|
||||
}
|
||||
.pose .fz-halo { opacity: 0.25; animation: fz-halo 1.6s ease-in-out infinite; }
|
||||
@keyframes fz-halo {
|
||||
0%, 100% { transform: scale(1); opacity: 0.2; }
|
||||
45% { transform: scale(1.3); opacity: 0.4; }
|
||||
}
|
||||
.pose .fz-tick { stroke: var(--accent-ink); }
|
||||
.pose .fz-flag { transform-origin: 0% 50%; animation: fz-wave 1.2s ease-in-out infinite; }
|
||||
@keyframes fz-wave {
|
||||
|
||||
@@ -1825,8 +1825,11 @@ function renderBriefButton() {
|
||||
function renderViews() {
|
||||
const nav = $("views");
|
||||
nav.replaceChildren();
|
||||
// Sent and not yet picked up: the same ring as Ask, until Plan2Code moves on
|
||||
// or goes quiet (a turning ring would pass a dead session for a slow one).
|
||||
const sentBusy = pendingResult && !gone && !agentAdrift();
|
||||
const tabs = [
|
||||
{ id: "questions", label: isDashboard() ? "Dashboard" : "Questions", count: myTurn().length },
|
||||
{ id: "questions", label: isDashboard() ? "Dashboard" : "Questions", count: myTurn().length, busy: sentBusy },
|
||||
];
|
||||
// Built in rather than posted: present exactly while the spec in view has
|
||||
// an overview.md. A tab that vanishes under the person sends them home.
|
||||
@@ -1835,11 +1838,21 @@ function renderViews() {
|
||||
else if (view === "overview") view = "questions";
|
||||
for (const d of docs()) tabs.push({ id: "doc:" + d.id, label: d.title || "Document", count: 0 });
|
||||
// Always last, on every workflow and after a finish: the Quick question chat.
|
||||
tabs.push({ id: "ask", label: "Ask", count: 0, dot: chatDot });
|
||||
// The ring left of "Ask" shows exactly when the conversation's own ring does:
|
||||
// a question the agent picked up and has not answered yet.
|
||||
const ask = askState();
|
||||
const askBusy = ask.view.rows.some((r) => r.working) && ask.send.state !== "offline" && !agentAdrift();
|
||||
tabs.push({ id: "ask", label: "Ask", count: 0, dot: chatDot, busy: askBusy });
|
||||
|
||||
for (const t of tabs) {
|
||||
const b = el("button", "view-tab", t.label);
|
||||
b.type = "button";
|
||||
if (t.busy) {
|
||||
const spin = el("span", "spinner tiny tab-spin");
|
||||
spin.setAttribute("aria-hidden", "true");
|
||||
b.prepend(spin);
|
||||
b.title = t.id === "ask" ? "Plan2Code is working on an answer" : "Sent. Waiting for Plan2Code";
|
||||
}
|
||||
b.setAttribute("aria-current", String(view === t.id || (t.id === "questions" && view === "end")));
|
||||
if (t.count) {
|
||||
const c = el("span", "tab-count", String(t.count));
|
||||
|
||||
@@ -405,7 +405,7 @@
|
||||
</svg>
|
||||
|
||||
<!-- 4 Finalize: hopping for joy, both arms up, beside the checkmark
|
||||
flag, confetti drifting down and his star glowing. -->
|
||||
flag, confetti drifting down. -->
|
||||
<svg class="pose pose-finalize" data-pose="finalize" viewBox="0 4 240 216" aria-hidden="true" focusable="false">
|
||||
<ellipse class="shadow fz-shadow" cx="120" cy="198" rx="34" ry="5" />
|
||||
<g class="fz-hop">
|
||||
@@ -415,7 +415,6 @@
|
||||
<rect class="sh" x="80" y="72" width="80" height="108" rx="16" />
|
||||
<path class="ln" d="M80 116 L60 90" /><circle class="fl" cx="60" cy="90" r="5.5" />
|
||||
<path class="ln" d="M160 116 L180 90" /><circle class="fl" cx="180" cy="90" r="5.5" />
|
||||
<circle class="ac fz-halo" cx="120" cy="98" r="23" />
|
||||
<path class="ey blink" d="M120 84 L123.64 92.98 L133.31 93.67 L125.9 99.92 L128.23 109.33 L120 104.2 L111.77 109.33 L114.1 99.92 L106.69 93.67 L116.36 92.98 Z" />
|
||||
<path class="ey" d="M106 118 Q120 134 134 118 Z" />
|
||||
</g>
|
||||
|
||||
@@ -53,16 +53,55 @@ export const TASK_EVENTS = Object.freeze(new Set(Object.keys(TASK_BONUS)));
|
||||
// The most tasks one run may report: past this it is a typo, not a phase.
|
||||
export const MAX_TASKS = 999;
|
||||
|
||||
// A build scores while it runs, not only once it is approved: console.mjs
|
||||
// writes a `progress` ledger entry whenever a build's `headline.cleared`
|
||||
// rises, and the build's row scores those tasks at TASKS_PER_POINT with no
|
||||
// bonus. The phase's `run` then takes the row over with its final score, so
|
||||
// the total only ever climbs. Workflows whose headline counts tasks:
|
||||
export const PROGRESS_WORKFLOWS = Object.freeze(new Set(["implement", "implement-review"]));
|
||||
|
||||
// Implement + Review reviews every phase as a stage of the build. A `review`
|
||||
// run inside it is that stage, so it scores the phase's TASK_BONUS when it
|
||||
// starts, and the phase's own run leaves the bonus out after it.
|
||||
const BUILT_IN_REVIEW = Object.freeze({ "implement-review": "implement-review-phase" });
|
||||
|
||||
/**
|
||||
* The ledger entry a build's progress post stands for, or null when it adds
|
||||
* nothing: not a task-counting workflow, no whole `cleared`, or no more tasks
|
||||
* than this build already has. `seg` is how many phases this skill run has
|
||||
* finished, so a second phase in the same run starts its own count, but only
|
||||
* once its headline is back at 0: until then a `cleared` is the finished
|
||||
* phase's, posted again, and opening a build on it would count it twice.
|
||||
*/
|
||||
export function progressEntry(entries, launch, workflow, cleared) {
|
||||
if (!PROGRESS_WORKFLOWS.has(workflow)) return null;
|
||||
if (cleared !== 0 && !isTaskCount(cleared)) return null;
|
||||
const list = Array.isArray(entries) ? entries : [];
|
||||
const seg = list.filter((e) => e && e.kind === "run" && TASK_EVENTS.has(e.event) && launchOf(e.id) === launch).length;
|
||||
const build = `${launch}:b${seg}`;
|
||||
const mine = list.filter((e) => e && e.kind === "progress" && e.build === build);
|
||||
const entry = (tasks) => ({ kind: "progress", id: `${build}:${tasks}`, build, workflow, tasks });
|
||||
if (cleared === 0) return seg > 0 && !mine.length ? entry(0) : null;
|
||||
if (seg > 0 && !mine.length) return null;
|
||||
const most = mine.reduce((n, e) => Math.max(n, e.tasks), 0);
|
||||
return cleared > most ? entry(cleared) : null;
|
||||
}
|
||||
|
||||
/** A valid `run.tasks`: a whole number from 1 to MAX_TASKS. */
|
||||
export function isTaskCount(tasks) {
|
||||
return Number.isInteger(tasks) && tasks >= 1 && tasks <= MAX_TASKS;
|
||||
}
|
||||
|
||||
/** What one `run` scores, from its event and (for a built phase) its tasks. */
|
||||
export function runPoints(event, tasks) {
|
||||
/**
|
||||
* What one `run` scores, from its event and (for a built phase) its tasks.
|
||||
* `bonus: false` leaves the review bonus out, for a phase whose review
|
||||
* already scored.
|
||||
*/
|
||||
export function runPoints(event, tasks, { bonus = true } = {}) {
|
||||
if (TASK_EVENTS.has(event) && isTaskCount(tasks)) {
|
||||
return Math.ceil(tasks / TASKS_PER_POINT) + TASK_BONUS[event];
|
||||
return Math.ceil(tasks / TASKS_PER_POINT) + (bonus ? TASK_BONUS[event] : 0);
|
||||
}
|
||||
if (TASK_EVENTS.has(event) && !bonus) return weightOf(event) - TASK_BONUS[event];
|
||||
return weightOf(event);
|
||||
}
|
||||
|
||||
@@ -133,6 +172,8 @@ export function breakdownFrom(entries) {
|
||||
const seen = new Set();
|
||||
const rows = [];
|
||||
const answers = new Map(); // launch id -> { row, count, workflow }
|
||||
const builds = new Map(); // launch id -> the row of the build in progress
|
||||
const reviewed = new Set(); // launch ids whose built-in review has scored
|
||||
for (const entry of Array.isArray(entries) ? entries : []) {
|
||||
if (!entry || typeof entry !== "object") continue;
|
||||
if (entry.id !== undefined) {
|
||||
@@ -150,17 +191,54 @@ export function breakdownFrom(entries) {
|
||||
tally.count += 1;
|
||||
continue;
|
||||
}
|
||||
if (entry.kind === "progress") {
|
||||
if (!isTaskCount(entry.tasks)) continue;
|
||||
const launch = launchOf(entry.id);
|
||||
let row = builds.get(launch);
|
||||
if (!row || row.build !== entry.build) {
|
||||
row = { label: "", points: 0, build: entry.build, tasks: 0 };
|
||||
builds.set(launch, row);
|
||||
rows.push(row);
|
||||
}
|
||||
if (entry.tasks > row.tasks) {
|
||||
row.tasks = entry.tasks;
|
||||
row.points = Math.ceil(entry.tasks / TASKS_PER_POINT);
|
||||
const where = WORKFLOW_NAMES[entry.workflow] || "Build";
|
||||
row.label = `${where}: ${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"} built so far`;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
let points = 0;
|
||||
let label = "";
|
||||
if (entry.kind === "launch" && LAUNCH_COUNTED.has(entry.workflow)) {
|
||||
points = weightOf(entry.workflow);
|
||||
label = LAUNCH_LABELS[entry.workflow] || entry.workflow;
|
||||
} else if (entry.kind === "run") {
|
||||
points = runPoints(entry.event, entry.tasks);
|
||||
const unit = unitOf(entry.id);
|
||||
const counted = TASK_EVENTS.has(entry.event) && isTaskCount(entry.tasks);
|
||||
const size = counted ? ` (${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"})` : "";
|
||||
label = (RUN_LABELS[entry.event] || entry.event) + (unit ? `: ${unit}` : "") + size;
|
||||
const launch = launchOf(entry.id);
|
||||
const builtIn = BUILT_IN_REVIEW[entry.workflow];
|
||||
if (entry.event === "review" && builtIn) {
|
||||
// The review stage of Implement + Review: it scores the bonus its
|
||||
// phase would otherwise carry, once per skill run.
|
||||
if (reviewed.has(launch)) continue;
|
||||
reviewed.add(launch);
|
||||
points = TASK_BONUS[builtIn];
|
||||
label = `${WORKFLOW_NAMES[entry.workflow]}: code review run`;
|
||||
} else {
|
||||
const bonus = !(TASK_EVENTS.has(entry.event) && reviewed.has(launch));
|
||||
points = runPoints(entry.event, entry.tasks, { bonus });
|
||||
const unit = unitOf(entry.id);
|
||||
const counted = TASK_EVENTS.has(entry.event) && isTaskCount(entry.tasks);
|
||||
const size = counted ? ` (${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"})` : "";
|
||||
label = (RUN_LABELS[entry.event] || entry.event) + (unit && unit !== entry.event ? `: ${unit}` : "") + size;
|
||||
}
|
||||
// A finished phase takes over its build's progress row, in place.
|
||||
if (TASK_EVENTS.has(entry.event) && builds.has(launch)) {
|
||||
const row = builds.get(launch);
|
||||
builds.delete(launch);
|
||||
row.label = label;
|
||||
row.points = Math.max(points, row.points);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (points > 0) rows.push({ label, points });
|
||||
}
|
||||
@@ -169,7 +247,7 @@ export function breakdownFrom(entries) {
|
||||
const where = WORKFLOW_NAMES[workflow] ? ` in ${WORKFLOW_NAMES[workflow]}` : "";
|
||||
row.label = `${count} ${count === 1 ? "answer" : "answers"}${where}`;
|
||||
}
|
||||
return rows.filter((row) => row.points > 0);
|
||||
return rows.filter((row) => row.points > 0).map(({ label, points }) => ({ label, points }));
|
||||
}
|
||||
|
||||
/** The session's points, folded from ledger entries in order. */
|
||||
|
||||
@@ -60,7 +60,9 @@ The first payload for a phase you are about to build:
|
||||
```
|
||||
|
||||
`headline.cleared` / `total` are tasks done out of tasks in the phase: the
|
||||
progress bar is the first thing someone watching a build looks at.
|
||||
progress bar is the first thing someone watching a build looks at. The session
|
||||
meter counts the build's tasks from `cleared` as it rises, so keep it current,
|
||||
and start every phase (a second one in the same run too) at `"cleared": 0`.
|
||||
|
||||
`phasefile` is the whole `phase-X.md`, verbatim from disk, as its own tab —
|
||||
the person can read the prerequisites and task specs while you build. Re-post
|
||||
@@ -233,8 +235,9 @@ sign-off card, and approving past it was the answer. `implement-review` ends
|
||||
the same way; that phase was reviewed already. Only a finished `quick-task`
|
||||
still offers the review on its finish — see below.
|
||||
|
||||
`run` scores the approved phase on the session meter (console.md → Posting an
|
||||
update → Session meter), in the same post that records the approval:
|
||||
`run` gives the approved phase its final score on the session meter (console.md →
|
||||
Posting an update → Session meter), in the same post that records the approval;
|
||||
it takes over what the build already counted from `cleared`, never adds to it:
|
||||
`implement-phase` for Implement, `implement-review-phase` for Implement +
|
||||
Review, id `phase-N`, and `tasks`: how many of the phase's tasks were
|
||||
completed (`[x]`, not blocked `[!]`). The phase scores by its size, so a
|
||||
@@ -392,7 +395,10 @@ a question still owed, above the ending itself:
|
||||
|
||||
The same build, then Stage 2 publishes the findings exactly as above (the
|
||||
`review` doc and the `fixes` item). Stage 3 fixes, with no "Check the fixes"
|
||||
item: Stage 4 is the only gate. Stage 4 is the sign-off above **without the
|
||||
item: Stage 4 is the only gate. The post that starts Stage 2's review carries
|
||||
`"run": { "event": "review", "id": "review" }`, as above: in this workflow it
|
||||
scores the review stage's 1 point on the meter as it begins, and the phase's
|
||||
final `run` leaves that point out. Stage 4 is the sign-off above **without the
|
||||
review verdict** — the phase was already reviewed — with the review results
|
||||
and unresolved findings in the report doc, header "Reviewed and ready for
|
||||
sign-off" in the item's `body`. The finish never carries `review`, and its
|
||||
|
||||
@@ -901,7 +901,9 @@ Per-unit work is yours to report, with `run` in any post:
|
||||
not count), a whole number from 1 to 999. A built phase scores by its size,
|
||||
one point per 3 tasks rounded up, and Implement + Review one more for the
|
||||
review. Always send it: without it a phase scores a flat 2 (or 3), however
|
||||
big it was. On any other event it is exit `3`.
|
||||
big it was. On any other event it is exit `3`. The console already counts a
|
||||
build's tasks from `headline.cleared` as they are ticked off; the phase's
|
||||
`run` takes that count over with the final score, so it never counts twice.
|
||||
- One `run` per post. Which events a workflow reports is in its own notes
|
||||
(Workflow notes → Pathfinder; `building.md` for Implement and for the
|
||||
review run on the page after a build).
|
||||
|
||||
@@ -90,7 +90,7 @@ import {
|
||||
writeJsonAtomic,
|
||||
writeWorkspaceCursor,
|
||||
} from "./lib.mjs";
|
||||
import { RUN_EVENTS, TASK_EVENTS, MAX_TASKS, isTaskCount } from "./public/meter.js";
|
||||
import { RUN_EVENTS, TASK_EVENTS, MAX_TASKS, isTaskCount, progressEntry } from "./public/meter.js";
|
||||
import { changeLine } from "./public/workspace.js";
|
||||
|
||||
// Mirrors the server's absolute lifetime cap: a handle older than this cannot
|
||||
@@ -593,6 +593,13 @@ function cmdPost() {
|
||||
const next = written.state;
|
||||
|
||||
for (const line of ledgerLines) appendLedger(dir, line);
|
||||
// A build scores its tasks as it clears them (meter.js, PROGRESS_WORKFLOWS),
|
||||
// after any `run` in the same post, so a phase finished here ends its count.
|
||||
if (patch.headline && typeof patch.headline === "object") {
|
||||
const ledger = readLedger(dir);
|
||||
const progress = progressEntry(ledger, lastLaunchId(ledger), next.workflow, patch.headline.cleared);
|
||||
if (progress) appendLedger(dir, progress);
|
||||
}
|
||||
appendEvent(dir, { type: "post", items: (patch.items || []).length });
|
||||
|
||||
const open = next.items.filter((i) => isOpen(i) && i.required !== false).length;
|
||||
|
||||
@@ -1096,6 +1096,14 @@ h1 {
|
||||
.ask-disabled-note.is-limit, .ask-disabled-note.is-waiting { color: var(--ink-2); background: var(--panel-2); border: 1px solid var(--rule); }
|
||||
.ask-disabled-note.is-offline { color: var(--warn); background: var(--warn-soft); border: 1px solid var(--warn); }
|
||||
|
||||
/* Waiting on Plan2Code (an Ask answer, or answers sent from Questions):
|
||||
the tiny ring, left of the label. */
|
||||
.view-tab .tab-spin {
|
||||
display: inline-block;
|
||||
margin-right: 6px;
|
||||
vertical-align: -1px;
|
||||
}
|
||||
|
||||
/* A reply landed while another tab was open. */
|
||||
.view-tab .tab-dot {
|
||||
display: inline-block;
|
||||
@@ -3144,11 +3152,6 @@ a.icon-btn { box-sizing: border-box; text-decoration: none; }
|
||||
0%, 15%, 75%, 100% { transform: scale(1); opacity: 0.16; }
|
||||
45% { transform: scale(0.7); opacity: 0.08; }
|
||||
}
|
||||
.pose .fz-halo { opacity: 0.25; animation: fz-halo 1.6s ease-in-out infinite; }
|
||||
@keyframes fz-halo {
|
||||
0%, 100% { transform: scale(1); opacity: 0.2; }
|
||||
45% { transform: scale(1.3); opacity: 0.4; }
|
||||
}
|
||||
.pose .fz-tick { stroke: var(--accent-ink); }
|
||||
.pose .fz-flag { transform-origin: 0% 50%; animation: fz-wave 1.2s ease-in-out infinite; }
|
||||
@keyframes fz-wave {
|
||||
|
||||
@@ -1825,8 +1825,11 @@ function renderBriefButton() {
|
||||
function renderViews() {
|
||||
const nav = $("views");
|
||||
nav.replaceChildren();
|
||||
// Sent and not yet picked up: the same ring as Ask, until Plan2Code moves on
|
||||
// or goes quiet (a turning ring would pass a dead session for a slow one).
|
||||
const sentBusy = pendingResult && !gone && !agentAdrift();
|
||||
const tabs = [
|
||||
{ id: "questions", label: isDashboard() ? "Dashboard" : "Questions", count: myTurn().length },
|
||||
{ id: "questions", label: isDashboard() ? "Dashboard" : "Questions", count: myTurn().length, busy: sentBusy },
|
||||
];
|
||||
// Built in rather than posted: present exactly while the spec in view has
|
||||
// an overview.md. A tab that vanishes under the person sends them home.
|
||||
@@ -1835,11 +1838,21 @@ function renderViews() {
|
||||
else if (view === "overview") view = "questions";
|
||||
for (const d of docs()) tabs.push({ id: "doc:" + d.id, label: d.title || "Document", count: 0 });
|
||||
// Always last, on every workflow and after a finish: the Quick question chat.
|
||||
tabs.push({ id: "ask", label: "Ask", count: 0, dot: chatDot });
|
||||
// The ring left of "Ask" shows exactly when the conversation's own ring does:
|
||||
// a question the agent picked up and has not answered yet.
|
||||
const ask = askState();
|
||||
const askBusy = ask.view.rows.some((r) => r.working) && ask.send.state !== "offline" && !agentAdrift();
|
||||
tabs.push({ id: "ask", label: "Ask", count: 0, dot: chatDot, busy: askBusy });
|
||||
|
||||
for (const t of tabs) {
|
||||
const b = el("button", "view-tab", t.label);
|
||||
b.type = "button";
|
||||
if (t.busy) {
|
||||
const spin = el("span", "spinner tiny tab-spin");
|
||||
spin.setAttribute("aria-hidden", "true");
|
||||
b.prepend(spin);
|
||||
b.title = t.id === "ask" ? "Plan2Code is working on an answer" : "Sent. Waiting for Plan2Code";
|
||||
}
|
||||
b.setAttribute("aria-current", String(view === t.id || (t.id === "questions" && view === "end")));
|
||||
if (t.count) {
|
||||
const c = el("span", "tab-count", String(t.count));
|
||||
|
||||
@@ -405,7 +405,7 @@
|
||||
</svg>
|
||||
|
||||
<!-- 4 Finalize: hopping for joy, both arms up, beside the checkmark
|
||||
flag, confetti drifting down and his star glowing. -->
|
||||
flag, confetti drifting down. -->
|
||||
<svg class="pose pose-finalize" data-pose="finalize" viewBox="0 4 240 216" aria-hidden="true" focusable="false">
|
||||
<ellipse class="shadow fz-shadow" cx="120" cy="198" rx="34" ry="5" />
|
||||
<g class="fz-hop">
|
||||
@@ -415,7 +415,6 @@
|
||||
<rect class="sh" x="80" y="72" width="80" height="108" rx="16" />
|
||||
<path class="ln" d="M80 116 L60 90" /><circle class="fl" cx="60" cy="90" r="5.5" />
|
||||
<path class="ln" d="M160 116 L180 90" /><circle class="fl" cx="180" cy="90" r="5.5" />
|
||||
<circle class="ac fz-halo" cx="120" cy="98" r="23" />
|
||||
<path class="ey blink" d="M120 84 L123.64 92.98 L133.31 93.67 L125.9 99.92 L128.23 109.33 L120 104.2 L111.77 109.33 L114.1 99.92 L106.69 93.67 L116.36 92.98 Z" />
|
||||
<path class="ey" d="M106 118 Q120 134 134 118 Z" />
|
||||
</g>
|
||||
|
||||
@@ -53,16 +53,55 @@ export const TASK_EVENTS = Object.freeze(new Set(Object.keys(TASK_BONUS)));
|
||||
// The most tasks one run may report: past this it is a typo, not a phase.
|
||||
export const MAX_TASKS = 999;
|
||||
|
||||
// A build scores while it runs, not only once it is approved: console.mjs
|
||||
// writes a `progress` ledger entry whenever a build's `headline.cleared`
|
||||
// rises, and the build's row scores those tasks at TASKS_PER_POINT with no
|
||||
// bonus. The phase's `run` then takes the row over with its final score, so
|
||||
// the total only ever climbs. Workflows whose headline counts tasks:
|
||||
export const PROGRESS_WORKFLOWS = Object.freeze(new Set(["implement", "implement-review"]));
|
||||
|
||||
// Implement + Review reviews every phase as a stage of the build. A `review`
|
||||
// run inside it is that stage, so it scores the phase's TASK_BONUS when it
|
||||
// starts, and the phase's own run leaves the bonus out after it.
|
||||
const BUILT_IN_REVIEW = Object.freeze({ "implement-review": "implement-review-phase" });
|
||||
|
||||
/**
|
||||
* The ledger entry a build's progress post stands for, or null when it adds
|
||||
* nothing: not a task-counting workflow, no whole `cleared`, or no more tasks
|
||||
* than this build already has. `seg` is how many phases this skill run has
|
||||
* finished, so a second phase in the same run starts its own count, but only
|
||||
* once its headline is back at 0: until then a `cleared` is the finished
|
||||
* phase's, posted again, and opening a build on it would count it twice.
|
||||
*/
|
||||
export function progressEntry(entries, launch, workflow, cleared) {
|
||||
if (!PROGRESS_WORKFLOWS.has(workflow)) return null;
|
||||
if (cleared !== 0 && !isTaskCount(cleared)) return null;
|
||||
const list = Array.isArray(entries) ? entries : [];
|
||||
const seg = list.filter((e) => e && e.kind === "run" && TASK_EVENTS.has(e.event) && launchOf(e.id) === launch).length;
|
||||
const build = `${launch}:b${seg}`;
|
||||
const mine = list.filter((e) => e && e.kind === "progress" && e.build === build);
|
||||
const entry = (tasks) => ({ kind: "progress", id: `${build}:${tasks}`, build, workflow, tasks });
|
||||
if (cleared === 0) return seg > 0 && !mine.length ? entry(0) : null;
|
||||
if (seg > 0 && !mine.length) return null;
|
||||
const most = mine.reduce((n, e) => Math.max(n, e.tasks), 0);
|
||||
return cleared > most ? entry(cleared) : null;
|
||||
}
|
||||
|
||||
/** A valid `run.tasks`: a whole number from 1 to MAX_TASKS. */
|
||||
export function isTaskCount(tasks) {
|
||||
return Number.isInteger(tasks) && tasks >= 1 && tasks <= MAX_TASKS;
|
||||
}
|
||||
|
||||
/** What one `run` scores, from its event and (for a built phase) its tasks. */
|
||||
export function runPoints(event, tasks) {
|
||||
/**
|
||||
* What one `run` scores, from its event and (for a built phase) its tasks.
|
||||
* `bonus: false` leaves the review bonus out, for a phase whose review
|
||||
* already scored.
|
||||
*/
|
||||
export function runPoints(event, tasks, { bonus = true } = {}) {
|
||||
if (TASK_EVENTS.has(event) && isTaskCount(tasks)) {
|
||||
return Math.ceil(tasks / TASKS_PER_POINT) + TASK_BONUS[event];
|
||||
return Math.ceil(tasks / TASKS_PER_POINT) + (bonus ? TASK_BONUS[event] : 0);
|
||||
}
|
||||
if (TASK_EVENTS.has(event) && !bonus) return weightOf(event) - TASK_BONUS[event];
|
||||
return weightOf(event);
|
||||
}
|
||||
|
||||
@@ -133,6 +172,8 @@ export function breakdownFrom(entries) {
|
||||
const seen = new Set();
|
||||
const rows = [];
|
||||
const answers = new Map(); // launch id -> { row, count, workflow }
|
||||
const builds = new Map(); // launch id -> the row of the build in progress
|
||||
const reviewed = new Set(); // launch ids whose built-in review has scored
|
||||
for (const entry of Array.isArray(entries) ? entries : []) {
|
||||
if (!entry || typeof entry !== "object") continue;
|
||||
if (entry.id !== undefined) {
|
||||
@@ -150,17 +191,54 @@ export function breakdownFrom(entries) {
|
||||
tally.count += 1;
|
||||
continue;
|
||||
}
|
||||
if (entry.kind === "progress") {
|
||||
if (!isTaskCount(entry.tasks)) continue;
|
||||
const launch = launchOf(entry.id);
|
||||
let row = builds.get(launch);
|
||||
if (!row || row.build !== entry.build) {
|
||||
row = { label: "", points: 0, build: entry.build, tasks: 0 };
|
||||
builds.set(launch, row);
|
||||
rows.push(row);
|
||||
}
|
||||
if (entry.tasks > row.tasks) {
|
||||
row.tasks = entry.tasks;
|
||||
row.points = Math.ceil(entry.tasks / TASKS_PER_POINT);
|
||||
const where = WORKFLOW_NAMES[entry.workflow] || "Build";
|
||||
row.label = `${where}: ${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"} built so far`;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
let points = 0;
|
||||
let label = "";
|
||||
if (entry.kind === "launch" && LAUNCH_COUNTED.has(entry.workflow)) {
|
||||
points = weightOf(entry.workflow);
|
||||
label = LAUNCH_LABELS[entry.workflow] || entry.workflow;
|
||||
} else if (entry.kind === "run") {
|
||||
points = runPoints(entry.event, entry.tasks);
|
||||
const unit = unitOf(entry.id);
|
||||
const counted = TASK_EVENTS.has(entry.event) && isTaskCount(entry.tasks);
|
||||
const size = counted ? ` (${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"})` : "";
|
||||
label = (RUN_LABELS[entry.event] || entry.event) + (unit ? `: ${unit}` : "") + size;
|
||||
const launch = launchOf(entry.id);
|
||||
const builtIn = BUILT_IN_REVIEW[entry.workflow];
|
||||
if (entry.event === "review" && builtIn) {
|
||||
// The review stage of Implement + Review: it scores the bonus its
|
||||
// phase would otherwise carry, once per skill run.
|
||||
if (reviewed.has(launch)) continue;
|
||||
reviewed.add(launch);
|
||||
points = TASK_BONUS[builtIn];
|
||||
label = `${WORKFLOW_NAMES[entry.workflow]}: code review run`;
|
||||
} else {
|
||||
const bonus = !(TASK_EVENTS.has(entry.event) && reviewed.has(launch));
|
||||
points = runPoints(entry.event, entry.tasks, { bonus });
|
||||
const unit = unitOf(entry.id);
|
||||
const counted = TASK_EVENTS.has(entry.event) && isTaskCount(entry.tasks);
|
||||
const size = counted ? ` (${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"})` : "";
|
||||
label = (RUN_LABELS[entry.event] || entry.event) + (unit && unit !== entry.event ? `: ${unit}` : "") + size;
|
||||
}
|
||||
// A finished phase takes over its build's progress row, in place.
|
||||
if (TASK_EVENTS.has(entry.event) && builds.has(launch)) {
|
||||
const row = builds.get(launch);
|
||||
builds.delete(launch);
|
||||
row.label = label;
|
||||
row.points = Math.max(points, row.points);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (points > 0) rows.push({ label, points });
|
||||
}
|
||||
@@ -169,7 +247,7 @@ export function breakdownFrom(entries) {
|
||||
const where = WORKFLOW_NAMES[workflow] ? ` in ${WORKFLOW_NAMES[workflow]}` : "";
|
||||
row.label = `${count} ${count === 1 ? "answer" : "answers"}${where}`;
|
||||
}
|
||||
return rows.filter((row) => row.points > 0);
|
||||
return rows.filter((row) => row.points > 0).map(({ label, points }) => ({ label, points }));
|
||||
}
|
||||
|
||||
/** The session's points, folded from ledger entries in order. */
|
||||
|
||||
@@ -60,7 +60,9 @@ The first payload for a phase you are about to build:
|
||||
```
|
||||
|
||||
`headline.cleared` / `total` are tasks done out of tasks in the phase: the
|
||||
progress bar is the first thing someone watching a build looks at.
|
||||
progress bar is the first thing someone watching a build looks at. The session
|
||||
meter counts the build's tasks from `cleared` as it rises, so keep it current,
|
||||
and start every phase (a second one in the same run too) at `"cleared": 0`.
|
||||
|
||||
`phasefile` is the whole `phase-X.md`, verbatim from disk, as its own tab —
|
||||
the person can read the prerequisites and task specs while you build. Re-post
|
||||
@@ -233,8 +235,9 @@ sign-off card, and approving past it was the answer. `implement-review` ends
|
||||
the same way; that phase was reviewed already. Only a finished `quick-task`
|
||||
still offers the review on its finish — see below.
|
||||
|
||||
`run` scores the approved phase on the session meter (console.md → Posting an
|
||||
update → Session meter), in the same post that records the approval:
|
||||
`run` gives the approved phase its final score on the session meter (console.md →
|
||||
Posting an update → Session meter), in the same post that records the approval;
|
||||
it takes over what the build already counted from `cleared`, never adds to it:
|
||||
`implement-phase` for Implement, `implement-review-phase` for Implement +
|
||||
Review, id `phase-N`, and `tasks`: how many of the phase's tasks were
|
||||
completed (`[x]`, not blocked `[!]`). The phase scores by its size, so a
|
||||
@@ -392,7 +395,10 @@ a question still owed, above the ending itself:
|
||||
|
||||
The same build, then Stage 2 publishes the findings exactly as above (the
|
||||
`review` doc and the `fixes` item). Stage 3 fixes, with no "Check the fixes"
|
||||
item: Stage 4 is the only gate. Stage 4 is the sign-off above **without the
|
||||
item: Stage 4 is the only gate. The post that starts Stage 2's review carries
|
||||
`"run": { "event": "review", "id": "review" }`, as above: in this workflow it
|
||||
scores the review stage's 1 point on the meter as it begins, and the phase's
|
||||
final `run` leaves that point out. Stage 4 is the sign-off above **without the
|
||||
review verdict** — the phase was already reviewed — with the review results
|
||||
and unresolved findings in the report doc, header "Reviewed and ready for
|
||||
sign-off" in the item's `body`. The finish never carries `review`, and its
|
||||
|
||||
@@ -901,7 +901,9 @@ Per-unit work is yours to report, with `run` in any post:
|
||||
not count), a whole number from 1 to 999. A built phase scores by its size,
|
||||
one point per 3 tasks rounded up, and Implement + Review one more for the
|
||||
review. Always send it: without it a phase scores a flat 2 (or 3), however
|
||||
big it was. On any other event it is exit `3`.
|
||||
big it was. On any other event it is exit `3`. The console already counts a
|
||||
build's tasks from `headline.cleared` as they are ticked off; the phase's
|
||||
`run` takes that count over with the final score, so it never counts twice.
|
||||
- One `run` per post. Which events a workflow reports is in its own notes
|
||||
(Workflow notes → Pathfinder; `building.md` for Implement and for the
|
||||
review run on the page after a build).
|
||||
|
||||
@@ -90,7 +90,7 @@ import {
|
||||
writeJsonAtomic,
|
||||
writeWorkspaceCursor,
|
||||
} from "./lib.mjs";
|
||||
import { RUN_EVENTS, TASK_EVENTS, MAX_TASKS, isTaskCount } from "./public/meter.js";
|
||||
import { RUN_EVENTS, TASK_EVENTS, MAX_TASKS, isTaskCount, progressEntry } from "./public/meter.js";
|
||||
import { changeLine } from "./public/workspace.js";
|
||||
|
||||
// Mirrors the server's absolute lifetime cap: a handle older than this cannot
|
||||
@@ -593,6 +593,13 @@ function cmdPost() {
|
||||
const next = written.state;
|
||||
|
||||
for (const line of ledgerLines) appendLedger(dir, line);
|
||||
// A build scores its tasks as it clears them (meter.js, PROGRESS_WORKFLOWS),
|
||||
// after any `run` in the same post, so a phase finished here ends its count.
|
||||
if (patch.headline && typeof patch.headline === "object") {
|
||||
const ledger = readLedger(dir);
|
||||
const progress = progressEntry(ledger, lastLaunchId(ledger), next.workflow, patch.headline.cleared);
|
||||
if (progress) appendLedger(dir, progress);
|
||||
}
|
||||
appendEvent(dir, { type: "post", items: (patch.items || []).length });
|
||||
|
||||
const open = next.items.filter((i) => isOpen(i) && i.required !== false).length;
|
||||
|
||||
@@ -1096,6 +1096,14 @@ h1 {
|
||||
.ask-disabled-note.is-limit, .ask-disabled-note.is-waiting { color: var(--ink-2); background: var(--panel-2); border: 1px solid var(--rule); }
|
||||
.ask-disabled-note.is-offline { color: var(--warn); background: var(--warn-soft); border: 1px solid var(--warn); }
|
||||
|
||||
/* Waiting on Plan2Code (an Ask answer, or answers sent from Questions):
|
||||
the tiny ring, left of the label. */
|
||||
.view-tab .tab-spin {
|
||||
display: inline-block;
|
||||
margin-right: 6px;
|
||||
vertical-align: -1px;
|
||||
}
|
||||
|
||||
/* A reply landed while another tab was open. */
|
||||
.view-tab .tab-dot {
|
||||
display: inline-block;
|
||||
@@ -3144,11 +3152,6 @@ a.icon-btn { box-sizing: border-box; text-decoration: none; }
|
||||
0%, 15%, 75%, 100% { transform: scale(1); opacity: 0.16; }
|
||||
45% { transform: scale(0.7); opacity: 0.08; }
|
||||
}
|
||||
.pose .fz-halo { opacity: 0.25; animation: fz-halo 1.6s ease-in-out infinite; }
|
||||
@keyframes fz-halo {
|
||||
0%, 100% { transform: scale(1); opacity: 0.2; }
|
||||
45% { transform: scale(1.3); opacity: 0.4; }
|
||||
}
|
||||
.pose .fz-tick { stroke: var(--accent-ink); }
|
||||
.pose .fz-flag { transform-origin: 0% 50%; animation: fz-wave 1.2s ease-in-out infinite; }
|
||||
@keyframes fz-wave {
|
||||
|
||||
@@ -1825,8 +1825,11 @@ function renderBriefButton() {
|
||||
function renderViews() {
|
||||
const nav = $("views");
|
||||
nav.replaceChildren();
|
||||
// Sent and not yet picked up: the same ring as Ask, until Plan2Code moves on
|
||||
// or goes quiet (a turning ring would pass a dead session for a slow one).
|
||||
const sentBusy = pendingResult && !gone && !agentAdrift();
|
||||
const tabs = [
|
||||
{ id: "questions", label: isDashboard() ? "Dashboard" : "Questions", count: myTurn().length },
|
||||
{ id: "questions", label: isDashboard() ? "Dashboard" : "Questions", count: myTurn().length, busy: sentBusy },
|
||||
];
|
||||
// Built in rather than posted: present exactly while the spec in view has
|
||||
// an overview.md. A tab that vanishes under the person sends them home.
|
||||
@@ -1835,11 +1838,21 @@ function renderViews() {
|
||||
else if (view === "overview") view = "questions";
|
||||
for (const d of docs()) tabs.push({ id: "doc:" + d.id, label: d.title || "Document", count: 0 });
|
||||
// Always last, on every workflow and after a finish: the Quick question chat.
|
||||
tabs.push({ id: "ask", label: "Ask", count: 0, dot: chatDot });
|
||||
// The ring left of "Ask" shows exactly when the conversation's own ring does:
|
||||
// a question the agent picked up and has not answered yet.
|
||||
const ask = askState();
|
||||
const askBusy = ask.view.rows.some((r) => r.working) && ask.send.state !== "offline" && !agentAdrift();
|
||||
tabs.push({ id: "ask", label: "Ask", count: 0, dot: chatDot, busy: askBusy });
|
||||
|
||||
for (const t of tabs) {
|
||||
const b = el("button", "view-tab", t.label);
|
||||
b.type = "button";
|
||||
if (t.busy) {
|
||||
const spin = el("span", "spinner tiny tab-spin");
|
||||
spin.setAttribute("aria-hidden", "true");
|
||||
b.prepend(spin);
|
||||
b.title = t.id === "ask" ? "Plan2Code is working on an answer" : "Sent. Waiting for Plan2Code";
|
||||
}
|
||||
b.setAttribute("aria-current", String(view === t.id || (t.id === "questions" && view === "end")));
|
||||
if (t.count) {
|
||||
const c = el("span", "tab-count", String(t.count));
|
||||
|
||||
@@ -405,7 +405,7 @@
|
||||
</svg>
|
||||
|
||||
<!-- 4 Finalize: hopping for joy, both arms up, beside the checkmark
|
||||
flag, confetti drifting down and his star glowing. -->
|
||||
flag, confetti drifting down. -->
|
||||
<svg class="pose pose-finalize" data-pose="finalize" viewBox="0 4 240 216" aria-hidden="true" focusable="false">
|
||||
<ellipse class="shadow fz-shadow" cx="120" cy="198" rx="34" ry="5" />
|
||||
<g class="fz-hop">
|
||||
@@ -415,7 +415,6 @@
|
||||
<rect class="sh" x="80" y="72" width="80" height="108" rx="16" />
|
||||
<path class="ln" d="M80 116 L60 90" /><circle class="fl" cx="60" cy="90" r="5.5" />
|
||||
<path class="ln" d="M160 116 L180 90" /><circle class="fl" cx="180" cy="90" r="5.5" />
|
||||
<circle class="ac fz-halo" cx="120" cy="98" r="23" />
|
||||
<path class="ey blink" d="M120 84 L123.64 92.98 L133.31 93.67 L125.9 99.92 L128.23 109.33 L120 104.2 L111.77 109.33 L114.1 99.92 L106.69 93.67 L116.36 92.98 Z" />
|
||||
<path class="ey" d="M106 118 Q120 134 134 118 Z" />
|
||||
</g>
|
||||
|
||||
@@ -53,16 +53,55 @@ export const TASK_EVENTS = Object.freeze(new Set(Object.keys(TASK_BONUS)));
|
||||
// The most tasks one run may report: past this it is a typo, not a phase.
|
||||
export const MAX_TASKS = 999;
|
||||
|
||||
// A build scores while it runs, not only once it is approved: console.mjs
|
||||
// writes a `progress` ledger entry whenever a build's `headline.cleared`
|
||||
// rises, and the build's row scores those tasks at TASKS_PER_POINT with no
|
||||
// bonus. The phase's `run` then takes the row over with its final score, so
|
||||
// the total only ever climbs. Workflows whose headline counts tasks:
|
||||
export const PROGRESS_WORKFLOWS = Object.freeze(new Set(["implement", "implement-review"]));
|
||||
|
||||
// Implement + Review reviews every phase as a stage of the build. A `review`
|
||||
// run inside it is that stage, so it scores the phase's TASK_BONUS when it
|
||||
// starts, and the phase's own run leaves the bonus out after it.
|
||||
const BUILT_IN_REVIEW = Object.freeze({ "implement-review": "implement-review-phase" });
|
||||
|
||||
/**
|
||||
* The ledger entry a build's progress post stands for, or null when it adds
|
||||
* nothing: not a task-counting workflow, no whole `cleared`, or no more tasks
|
||||
* than this build already has. `seg` is how many phases this skill run has
|
||||
* finished, so a second phase in the same run starts its own count, but only
|
||||
* once its headline is back at 0: until then a `cleared` is the finished
|
||||
* phase's, posted again, and opening a build on it would count it twice.
|
||||
*/
|
||||
export function progressEntry(entries, launch, workflow, cleared) {
|
||||
if (!PROGRESS_WORKFLOWS.has(workflow)) return null;
|
||||
if (cleared !== 0 && !isTaskCount(cleared)) return null;
|
||||
const list = Array.isArray(entries) ? entries : [];
|
||||
const seg = list.filter((e) => e && e.kind === "run" && TASK_EVENTS.has(e.event) && launchOf(e.id) === launch).length;
|
||||
const build = `${launch}:b${seg}`;
|
||||
const mine = list.filter((e) => e && e.kind === "progress" && e.build === build);
|
||||
const entry = (tasks) => ({ kind: "progress", id: `${build}:${tasks}`, build, workflow, tasks });
|
||||
if (cleared === 0) return seg > 0 && !mine.length ? entry(0) : null;
|
||||
if (seg > 0 && !mine.length) return null;
|
||||
const most = mine.reduce((n, e) => Math.max(n, e.tasks), 0);
|
||||
return cleared > most ? entry(cleared) : null;
|
||||
}
|
||||
|
||||
/** A valid `run.tasks`: a whole number from 1 to MAX_TASKS. */
|
||||
export function isTaskCount(tasks) {
|
||||
return Number.isInteger(tasks) && tasks >= 1 && tasks <= MAX_TASKS;
|
||||
}
|
||||
|
||||
/** What one `run` scores, from its event and (for a built phase) its tasks. */
|
||||
export function runPoints(event, tasks) {
|
||||
/**
|
||||
* What one `run` scores, from its event and (for a built phase) its tasks.
|
||||
* `bonus: false` leaves the review bonus out, for a phase whose review
|
||||
* already scored.
|
||||
*/
|
||||
export function runPoints(event, tasks, { bonus = true } = {}) {
|
||||
if (TASK_EVENTS.has(event) && isTaskCount(tasks)) {
|
||||
return Math.ceil(tasks / TASKS_PER_POINT) + TASK_BONUS[event];
|
||||
return Math.ceil(tasks / TASKS_PER_POINT) + (bonus ? TASK_BONUS[event] : 0);
|
||||
}
|
||||
if (TASK_EVENTS.has(event) && !bonus) return weightOf(event) - TASK_BONUS[event];
|
||||
return weightOf(event);
|
||||
}
|
||||
|
||||
@@ -133,6 +172,8 @@ export function breakdownFrom(entries) {
|
||||
const seen = new Set();
|
||||
const rows = [];
|
||||
const answers = new Map(); // launch id -> { row, count, workflow }
|
||||
const builds = new Map(); // launch id -> the row of the build in progress
|
||||
const reviewed = new Set(); // launch ids whose built-in review has scored
|
||||
for (const entry of Array.isArray(entries) ? entries : []) {
|
||||
if (!entry || typeof entry !== "object") continue;
|
||||
if (entry.id !== undefined) {
|
||||
@@ -150,17 +191,54 @@ export function breakdownFrom(entries) {
|
||||
tally.count += 1;
|
||||
continue;
|
||||
}
|
||||
if (entry.kind === "progress") {
|
||||
if (!isTaskCount(entry.tasks)) continue;
|
||||
const launch = launchOf(entry.id);
|
||||
let row = builds.get(launch);
|
||||
if (!row || row.build !== entry.build) {
|
||||
row = { label: "", points: 0, build: entry.build, tasks: 0 };
|
||||
builds.set(launch, row);
|
||||
rows.push(row);
|
||||
}
|
||||
if (entry.tasks > row.tasks) {
|
||||
row.tasks = entry.tasks;
|
||||
row.points = Math.ceil(entry.tasks / TASKS_PER_POINT);
|
||||
const where = WORKFLOW_NAMES[entry.workflow] || "Build";
|
||||
row.label = `${where}: ${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"} built so far`;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
let points = 0;
|
||||
let label = "";
|
||||
if (entry.kind === "launch" && LAUNCH_COUNTED.has(entry.workflow)) {
|
||||
points = weightOf(entry.workflow);
|
||||
label = LAUNCH_LABELS[entry.workflow] || entry.workflow;
|
||||
} else if (entry.kind === "run") {
|
||||
points = runPoints(entry.event, entry.tasks);
|
||||
const unit = unitOf(entry.id);
|
||||
const counted = TASK_EVENTS.has(entry.event) && isTaskCount(entry.tasks);
|
||||
const size = counted ? ` (${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"})` : "";
|
||||
label = (RUN_LABELS[entry.event] || entry.event) + (unit ? `: ${unit}` : "") + size;
|
||||
const launch = launchOf(entry.id);
|
||||
const builtIn = BUILT_IN_REVIEW[entry.workflow];
|
||||
if (entry.event === "review" && builtIn) {
|
||||
// The review stage of Implement + Review: it scores the bonus its
|
||||
// phase would otherwise carry, once per skill run.
|
||||
if (reviewed.has(launch)) continue;
|
||||
reviewed.add(launch);
|
||||
points = TASK_BONUS[builtIn];
|
||||
label = `${WORKFLOW_NAMES[entry.workflow]}: code review run`;
|
||||
} else {
|
||||
const bonus = !(TASK_EVENTS.has(entry.event) && reviewed.has(launch));
|
||||
points = runPoints(entry.event, entry.tasks, { bonus });
|
||||
const unit = unitOf(entry.id);
|
||||
const counted = TASK_EVENTS.has(entry.event) && isTaskCount(entry.tasks);
|
||||
const size = counted ? ` (${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"})` : "";
|
||||
label = (RUN_LABELS[entry.event] || entry.event) + (unit && unit !== entry.event ? `: ${unit}` : "") + size;
|
||||
}
|
||||
// A finished phase takes over its build's progress row, in place.
|
||||
if (TASK_EVENTS.has(entry.event) && builds.has(launch)) {
|
||||
const row = builds.get(launch);
|
||||
builds.delete(launch);
|
||||
row.label = label;
|
||||
row.points = Math.max(points, row.points);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (points > 0) rows.push({ label, points });
|
||||
}
|
||||
@@ -169,7 +247,7 @@ export function breakdownFrom(entries) {
|
||||
const where = WORKFLOW_NAMES[workflow] ? ` in ${WORKFLOW_NAMES[workflow]}` : "";
|
||||
row.label = `${count} ${count === 1 ? "answer" : "answers"}${where}`;
|
||||
}
|
||||
return rows.filter((row) => row.points > 0);
|
||||
return rows.filter((row) => row.points > 0).map(({ label, points }) => ({ label, points }));
|
||||
}
|
||||
|
||||
/** The session's points, folded from ledger entries in order. */
|
||||
|
||||
@@ -107,11 +107,12 @@ Line numbers may only appear as SUPPLEMENTAL context alongside a semantic refere
|
||||
5. **Use existing** `specs/<feature-name>/` directory
|
||||
6. **Write** `overview.md` first, copying from PLAN-DRAFT:
|
||||
- Summary (from Executive Summary)
|
||||
- Phase Checklist (Implementation Phases), directly under Summary
|
||||
- Parallel Execution Groups (filled in step 8)
|
||||
- Tech Stack table (exact copy)
|
||||
- Architecture Pattern and Component Overview (section 4)
|
||||
- Risks and Mitigations table (section 6)
|
||||
- Success Criteria (plain bullet list, no checkboxes) (section 7)
|
||||
- Phase Checklist (Implementation Phases)
|
||||
- Quick Reference (Key Files, Environment Variables, External Dependencies)
|
||||
7. **Write** each `phase-X.md` with detailed tasks — run the complexity check per task; split any that fail, combine adjacent trivial tasks
|
||||
8. **Analyze** parallel execution eligibility
|
||||
@@ -187,7 +188,7 @@ Use kebab-case for feature name (e.g., `user-authentication`).
|
||||
|
||||
Header: Title, Created date, Source (PLAN-DRAFT path), Status on its own line as `**Status:** <value>` (Not Started | In Progress | Complete).
|
||||
|
||||
Sections: Summary (from Executive Summary), Tech Stack table (exact copy from PLAN-DRAFT), Architecture (Pattern + Component Overview table), Risks and Mitigations table, Success Criteria checklist, Phase Checklist, Parallel Execution Groups table (from analysis), Quick Reference (Key Files, Environment Variables, External Dependencies), Completion Summary (filled during finalization).
|
||||
Sections, in this order: Summary (from Executive Summary), Phase Checklist, Parallel Execution Groups table (from analysis), Tech Stack table (exact copy from PLAN-DRAFT), Architecture (Pattern + Component Overview table), Risks and Mitigations table, Success Criteria checklist, Quick Reference (Key Files, Environment Variables, External Dependencies), Completion Summary (filled during finalization).
|
||||
|
||||
### phase-X.md
|
||||
|
||||
|
||||
@@ -60,7 +60,9 @@ The first payload for a phase you are about to build:
|
||||
```
|
||||
|
||||
`headline.cleared` / `total` are tasks done out of tasks in the phase: the
|
||||
progress bar is the first thing someone watching a build looks at.
|
||||
progress bar is the first thing someone watching a build looks at. The session
|
||||
meter counts the build's tasks from `cleared` as it rises, so keep it current,
|
||||
and start every phase (a second one in the same run too) at `"cleared": 0`.
|
||||
|
||||
`phasefile` is the whole `phase-X.md`, verbatim from disk, as its own tab —
|
||||
the person can read the prerequisites and task specs while you build. Re-post
|
||||
@@ -233,8 +235,9 @@ sign-off card, and approving past it was the answer. `implement-review` ends
|
||||
the same way; that phase was reviewed already. Only a finished `quick-task`
|
||||
still offers the review on its finish — see below.
|
||||
|
||||
`run` scores the approved phase on the session meter (console.md → Posting an
|
||||
update → Session meter), in the same post that records the approval:
|
||||
`run` gives the approved phase its final score on the session meter (console.md →
|
||||
Posting an update → Session meter), in the same post that records the approval;
|
||||
it takes over what the build already counted from `cleared`, never adds to it:
|
||||
`implement-phase` for Implement, `implement-review-phase` for Implement +
|
||||
Review, id `phase-N`, and `tasks`: how many of the phase's tasks were
|
||||
completed (`[x]`, not blocked `[!]`). The phase scores by its size, so a
|
||||
@@ -392,7 +395,10 @@ a question still owed, above the ending itself:
|
||||
|
||||
The same build, then Stage 2 publishes the findings exactly as above (the
|
||||
`review` doc and the `fixes` item). Stage 3 fixes, with no "Check the fixes"
|
||||
item: Stage 4 is the only gate. Stage 4 is the sign-off above **without the
|
||||
item: Stage 4 is the only gate. The post that starts Stage 2's review carries
|
||||
`"run": { "event": "review", "id": "review" }`, as above: in this workflow it
|
||||
scores the review stage's 1 point on the meter as it begins, and the phase's
|
||||
final `run` leaves that point out. Stage 4 is the sign-off above **without the
|
||||
review verdict** — the phase was already reviewed — with the review results
|
||||
and unresolved findings in the report doc, header "Reviewed and ready for
|
||||
sign-off" in the item's `body`. The finish never carries `review`, and its
|
||||
|
||||
@@ -901,7 +901,9 @@ Per-unit work is yours to report, with `run` in any post:
|
||||
not count), a whole number from 1 to 999. A built phase scores by its size,
|
||||
one point per 3 tasks rounded up, and Implement + Review one more for the
|
||||
review. Always send it: without it a phase scores a flat 2 (or 3), however
|
||||
big it was. On any other event it is exit `3`.
|
||||
big it was. On any other event it is exit `3`. The console already counts a
|
||||
build's tasks from `headline.cleared` as they are ticked off; the phase's
|
||||
`run` takes that count over with the final score, so it never counts twice.
|
||||
- One `run` per post. Which events a workflow reports is in its own notes
|
||||
(Workflow notes → Pathfinder; `building.md` for Implement and for the
|
||||
review run on the page after a build).
|
||||
|
||||
@@ -90,7 +90,7 @@ import {
|
||||
writeJsonAtomic,
|
||||
writeWorkspaceCursor,
|
||||
} from "./lib.mjs";
|
||||
import { RUN_EVENTS, TASK_EVENTS, MAX_TASKS, isTaskCount } from "./public/meter.js";
|
||||
import { RUN_EVENTS, TASK_EVENTS, MAX_TASKS, isTaskCount, progressEntry } from "./public/meter.js";
|
||||
import { changeLine } from "./public/workspace.js";
|
||||
|
||||
// Mirrors the server's absolute lifetime cap: a handle older than this cannot
|
||||
@@ -593,6 +593,13 @@ function cmdPost() {
|
||||
const next = written.state;
|
||||
|
||||
for (const line of ledgerLines) appendLedger(dir, line);
|
||||
// A build scores its tasks as it clears them (meter.js, PROGRESS_WORKFLOWS),
|
||||
// after any `run` in the same post, so a phase finished here ends its count.
|
||||
if (patch.headline && typeof patch.headline === "object") {
|
||||
const ledger = readLedger(dir);
|
||||
const progress = progressEntry(ledger, lastLaunchId(ledger), next.workflow, patch.headline.cleared);
|
||||
if (progress) appendLedger(dir, progress);
|
||||
}
|
||||
appendEvent(dir, { type: "post", items: (patch.items || []).length });
|
||||
|
||||
const open = next.items.filter((i) => isOpen(i) && i.required !== false).length;
|
||||
|
||||
@@ -1096,6 +1096,14 @@ h1 {
|
||||
.ask-disabled-note.is-limit, .ask-disabled-note.is-waiting { color: var(--ink-2); background: var(--panel-2); border: 1px solid var(--rule); }
|
||||
.ask-disabled-note.is-offline { color: var(--warn); background: var(--warn-soft); border: 1px solid var(--warn); }
|
||||
|
||||
/* Waiting on Plan2Code (an Ask answer, or answers sent from Questions):
|
||||
the tiny ring, left of the label. */
|
||||
.view-tab .tab-spin {
|
||||
display: inline-block;
|
||||
margin-right: 6px;
|
||||
vertical-align: -1px;
|
||||
}
|
||||
|
||||
/* A reply landed while another tab was open. */
|
||||
.view-tab .tab-dot {
|
||||
display: inline-block;
|
||||
@@ -3144,11 +3152,6 @@ a.icon-btn { box-sizing: border-box; text-decoration: none; }
|
||||
0%, 15%, 75%, 100% { transform: scale(1); opacity: 0.16; }
|
||||
45% { transform: scale(0.7); opacity: 0.08; }
|
||||
}
|
||||
.pose .fz-halo { opacity: 0.25; animation: fz-halo 1.6s ease-in-out infinite; }
|
||||
@keyframes fz-halo {
|
||||
0%, 100% { transform: scale(1); opacity: 0.2; }
|
||||
45% { transform: scale(1.3); opacity: 0.4; }
|
||||
}
|
||||
.pose .fz-tick { stroke: var(--accent-ink); }
|
||||
.pose .fz-flag { transform-origin: 0% 50%; animation: fz-wave 1.2s ease-in-out infinite; }
|
||||
@keyframes fz-wave {
|
||||
|
||||
@@ -1825,8 +1825,11 @@ function renderBriefButton() {
|
||||
function renderViews() {
|
||||
const nav = $("views");
|
||||
nav.replaceChildren();
|
||||
// Sent and not yet picked up: the same ring as Ask, until Plan2Code moves on
|
||||
// or goes quiet (a turning ring would pass a dead session for a slow one).
|
||||
const sentBusy = pendingResult && !gone && !agentAdrift();
|
||||
const tabs = [
|
||||
{ id: "questions", label: isDashboard() ? "Dashboard" : "Questions", count: myTurn().length },
|
||||
{ id: "questions", label: isDashboard() ? "Dashboard" : "Questions", count: myTurn().length, busy: sentBusy },
|
||||
];
|
||||
// Built in rather than posted: present exactly while the spec in view has
|
||||
// an overview.md. A tab that vanishes under the person sends them home.
|
||||
@@ -1835,11 +1838,21 @@ function renderViews() {
|
||||
else if (view === "overview") view = "questions";
|
||||
for (const d of docs()) tabs.push({ id: "doc:" + d.id, label: d.title || "Document", count: 0 });
|
||||
// Always last, on every workflow and after a finish: the Quick question chat.
|
||||
tabs.push({ id: "ask", label: "Ask", count: 0, dot: chatDot });
|
||||
// The ring left of "Ask" shows exactly when the conversation's own ring does:
|
||||
// a question the agent picked up and has not answered yet.
|
||||
const ask = askState();
|
||||
const askBusy = ask.view.rows.some((r) => r.working) && ask.send.state !== "offline" && !agentAdrift();
|
||||
tabs.push({ id: "ask", label: "Ask", count: 0, dot: chatDot, busy: askBusy });
|
||||
|
||||
for (const t of tabs) {
|
||||
const b = el("button", "view-tab", t.label);
|
||||
b.type = "button";
|
||||
if (t.busy) {
|
||||
const spin = el("span", "spinner tiny tab-spin");
|
||||
spin.setAttribute("aria-hidden", "true");
|
||||
b.prepend(spin);
|
||||
b.title = t.id === "ask" ? "Plan2Code is working on an answer" : "Sent. Waiting for Plan2Code";
|
||||
}
|
||||
b.setAttribute("aria-current", String(view === t.id || (t.id === "questions" && view === "end")));
|
||||
if (t.count) {
|
||||
const c = el("span", "tab-count", String(t.count));
|
||||
|
||||
@@ -405,7 +405,7 @@
|
||||
</svg>
|
||||
|
||||
<!-- 4 Finalize: hopping for joy, both arms up, beside the checkmark
|
||||
flag, confetti drifting down and his star glowing. -->
|
||||
flag, confetti drifting down. -->
|
||||
<svg class="pose pose-finalize" data-pose="finalize" viewBox="0 4 240 216" aria-hidden="true" focusable="false">
|
||||
<ellipse class="shadow fz-shadow" cx="120" cy="198" rx="34" ry="5" />
|
||||
<g class="fz-hop">
|
||||
@@ -415,7 +415,6 @@
|
||||
<rect class="sh" x="80" y="72" width="80" height="108" rx="16" />
|
||||
<path class="ln" d="M80 116 L60 90" /><circle class="fl" cx="60" cy="90" r="5.5" />
|
||||
<path class="ln" d="M160 116 L180 90" /><circle class="fl" cx="180" cy="90" r="5.5" />
|
||||
<circle class="ac fz-halo" cx="120" cy="98" r="23" />
|
||||
<path class="ey blink" d="M120 84 L123.64 92.98 L133.31 93.67 L125.9 99.92 L128.23 109.33 L120 104.2 L111.77 109.33 L114.1 99.92 L106.69 93.67 L116.36 92.98 Z" />
|
||||
<path class="ey" d="M106 118 Q120 134 134 118 Z" />
|
||||
</g>
|
||||
|
||||
@@ -53,16 +53,55 @@ export const TASK_EVENTS = Object.freeze(new Set(Object.keys(TASK_BONUS)));
|
||||
// The most tasks one run may report: past this it is a typo, not a phase.
|
||||
export const MAX_TASKS = 999;
|
||||
|
||||
// A build scores while it runs, not only once it is approved: console.mjs
|
||||
// writes a `progress` ledger entry whenever a build's `headline.cleared`
|
||||
// rises, and the build's row scores those tasks at TASKS_PER_POINT with no
|
||||
// bonus. The phase's `run` then takes the row over with its final score, so
|
||||
// the total only ever climbs. Workflows whose headline counts tasks:
|
||||
export const PROGRESS_WORKFLOWS = Object.freeze(new Set(["implement", "implement-review"]));
|
||||
|
||||
// Implement + Review reviews every phase as a stage of the build. A `review`
|
||||
// run inside it is that stage, so it scores the phase's TASK_BONUS when it
|
||||
// starts, and the phase's own run leaves the bonus out after it.
|
||||
const BUILT_IN_REVIEW = Object.freeze({ "implement-review": "implement-review-phase" });
|
||||
|
||||
/**
|
||||
* The ledger entry a build's progress post stands for, or null when it adds
|
||||
* nothing: not a task-counting workflow, no whole `cleared`, or no more tasks
|
||||
* than this build already has. `seg` is how many phases this skill run has
|
||||
* finished, so a second phase in the same run starts its own count, but only
|
||||
* once its headline is back at 0: until then a `cleared` is the finished
|
||||
* phase's, posted again, and opening a build on it would count it twice.
|
||||
*/
|
||||
export function progressEntry(entries, launch, workflow, cleared) {
|
||||
if (!PROGRESS_WORKFLOWS.has(workflow)) return null;
|
||||
if (cleared !== 0 && !isTaskCount(cleared)) return null;
|
||||
const list = Array.isArray(entries) ? entries : [];
|
||||
const seg = list.filter((e) => e && e.kind === "run" && TASK_EVENTS.has(e.event) && launchOf(e.id) === launch).length;
|
||||
const build = `${launch}:b${seg}`;
|
||||
const mine = list.filter((e) => e && e.kind === "progress" && e.build === build);
|
||||
const entry = (tasks) => ({ kind: "progress", id: `${build}:${tasks}`, build, workflow, tasks });
|
||||
if (cleared === 0) return seg > 0 && !mine.length ? entry(0) : null;
|
||||
if (seg > 0 && !mine.length) return null;
|
||||
const most = mine.reduce((n, e) => Math.max(n, e.tasks), 0);
|
||||
return cleared > most ? entry(cleared) : null;
|
||||
}
|
||||
|
||||
/** A valid `run.tasks`: a whole number from 1 to MAX_TASKS. */
|
||||
export function isTaskCount(tasks) {
|
||||
return Number.isInteger(tasks) && tasks >= 1 && tasks <= MAX_TASKS;
|
||||
}
|
||||
|
||||
/** What one `run` scores, from its event and (for a built phase) its tasks. */
|
||||
export function runPoints(event, tasks) {
|
||||
/**
|
||||
* What one `run` scores, from its event and (for a built phase) its tasks.
|
||||
* `bonus: false` leaves the review bonus out, for a phase whose review
|
||||
* already scored.
|
||||
*/
|
||||
export function runPoints(event, tasks, { bonus = true } = {}) {
|
||||
if (TASK_EVENTS.has(event) && isTaskCount(tasks)) {
|
||||
return Math.ceil(tasks / TASKS_PER_POINT) + TASK_BONUS[event];
|
||||
return Math.ceil(tasks / TASKS_PER_POINT) + (bonus ? TASK_BONUS[event] : 0);
|
||||
}
|
||||
if (TASK_EVENTS.has(event) && !bonus) return weightOf(event) - TASK_BONUS[event];
|
||||
return weightOf(event);
|
||||
}
|
||||
|
||||
@@ -133,6 +172,8 @@ export function breakdownFrom(entries) {
|
||||
const seen = new Set();
|
||||
const rows = [];
|
||||
const answers = new Map(); // launch id -> { row, count, workflow }
|
||||
const builds = new Map(); // launch id -> the row of the build in progress
|
||||
const reviewed = new Set(); // launch ids whose built-in review has scored
|
||||
for (const entry of Array.isArray(entries) ? entries : []) {
|
||||
if (!entry || typeof entry !== "object") continue;
|
||||
if (entry.id !== undefined) {
|
||||
@@ -150,17 +191,54 @@ export function breakdownFrom(entries) {
|
||||
tally.count += 1;
|
||||
continue;
|
||||
}
|
||||
if (entry.kind === "progress") {
|
||||
if (!isTaskCount(entry.tasks)) continue;
|
||||
const launch = launchOf(entry.id);
|
||||
let row = builds.get(launch);
|
||||
if (!row || row.build !== entry.build) {
|
||||
row = { label: "", points: 0, build: entry.build, tasks: 0 };
|
||||
builds.set(launch, row);
|
||||
rows.push(row);
|
||||
}
|
||||
if (entry.tasks > row.tasks) {
|
||||
row.tasks = entry.tasks;
|
||||
row.points = Math.ceil(entry.tasks / TASKS_PER_POINT);
|
||||
const where = WORKFLOW_NAMES[entry.workflow] || "Build";
|
||||
row.label = `${where}: ${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"} built so far`;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
let points = 0;
|
||||
let label = "";
|
||||
if (entry.kind === "launch" && LAUNCH_COUNTED.has(entry.workflow)) {
|
||||
points = weightOf(entry.workflow);
|
||||
label = LAUNCH_LABELS[entry.workflow] || entry.workflow;
|
||||
} else if (entry.kind === "run") {
|
||||
points = runPoints(entry.event, entry.tasks);
|
||||
const unit = unitOf(entry.id);
|
||||
const counted = TASK_EVENTS.has(entry.event) && isTaskCount(entry.tasks);
|
||||
const size = counted ? ` (${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"})` : "";
|
||||
label = (RUN_LABELS[entry.event] || entry.event) + (unit ? `: ${unit}` : "") + size;
|
||||
const launch = launchOf(entry.id);
|
||||
const builtIn = BUILT_IN_REVIEW[entry.workflow];
|
||||
if (entry.event === "review" && builtIn) {
|
||||
// The review stage of Implement + Review: it scores the bonus its
|
||||
// phase would otherwise carry, once per skill run.
|
||||
if (reviewed.has(launch)) continue;
|
||||
reviewed.add(launch);
|
||||
points = TASK_BONUS[builtIn];
|
||||
label = `${WORKFLOW_NAMES[entry.workflow]}: code review run`;
|
||||
} else {
|
||||
const bonus = !(TASK_EVENTS.has(entry.event) && reviewed.has(launch));
|
||||
points = runPoints(entry.event, entry.tasks, { bonus });
|
||||
const unit = unitOf(entry.id);
|
||||
const counted = TASK_EVENTS.has(entry.event) && isTaskCount(entry.tasks);
|
||||
const size = counted ? ` (${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"})` : "";
|
||||
label = (RUN_LABELS[entry.event] || entry.event) + (unit && unit !== entry.event ? `: ${unit}` : "") + size;
|
||||
}
|
||||
// A finished phase takes over its build's progress row, in place.
|
||||
if (TASK_EVENTS.has(entry.event) && builds.has(launch)) {
|
||||
const row = builds.get(launch);
|
||||
builds.delete(launch);
|
||||
row.label = label;
|
||||
row.points = Math.max(points, row.points);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (points > 0) rows.push({ label, points });
|
||||
}
|
||||
@@ -169,7 +247,7 @@ export function breakdownFrom(entries) {
|
||||
const where = WORKFLOW_NAMES[workflow] ? ` in ${WORKFLOW_NAMES[workflow]}` : "";
|
||||
row.label = `${count} ${count === 1 ? "answer" : "answers"}${where}`;
|
||||
}
|
||||
return rows.filter((row) => row.points > 0);
|
||||
return rows.filter((row) => row.points > 0).map(({ label, points }) => ({ label, points }));
|
||||
}
|
||||
|
||||
/** The session's points, folded from ledger entries in order. */
|
||||
|
||||
@@ -60,7 +60,9 @@ The first payload for a phase you are about to build:
|
||||
```
|
||||
|
||||
`headline.cleared` / `total` are tasks done out of tasks in the phase: the
|
||||
progress bar is the first thing someone watching a build looks at.
|
||||
progress bar is the first thing someone watching a build looks at. The session
|
||||
meter counts the build's tasks from `cleared` as it rises, so keep it current,
|
||||
and start every phase (a second one in the same run too) at `"cleared": 0`.
|
||||
|
||||
`phasefile` is the whole `phase-X.md`, verbatim from disk, as its own tab —
|
||||
the person can read the prerequisites and task specs while you build. Re-post
|
||||
@@ -233,8 +235,9 @@ sign-off card, and approving past it was the answer. `implement-review` ends
|
||||
the same way; that phase was reviewed already. Only a finished `quick-task`
|
||||
still offers the review on its finish — see below.
|
||||
|
||||
`run` scores the approved phase on the session meter (console.md → Posting an
|
||||
update → Session meter), in the same post that records the approval:
|
||||
`run` gives the approved phase its final score on the session meter (console.md →
|
||||
Posting an update → Session meter), in the same post that records the approval;
|
||||
it takes over what the build already counted from `cleared`, never adds to it:
|
||||
`implement-phase` for Implement, `implement-review-phase` for Implement +
|
||||
Review, id `phase-N`, and `tasks`: how many of the phase's tasks were
|
||||
completed (`[x]`, not blocked `[!]`). The phase scores by its size, so a
|
||||
@@ -392,7 +395,10 @@ a question still owed, above the ending itself:
|
||||
|
||||
The same build, then Stage 2 publishes the findings exactly as above (the
|
||||
`review` doc and the `fixes` item). Stage 3 fixes, with no "Check the fixes"
|
||||
item: Stage 4 is the only gate. Stage 4 is the sign-off above **without the
|
||||
item: Stage 4 is the only gate. The post that starts Stage 2's review carries
|
||||
`"run": { "event": "review", "id": "review" }`, as above: in this workflow it
|
||||
scores the review stage's 1 point on the meter as it begins, and the phase's
|
||||
final `run` leaves that point out. Stage 4 is the sign-off above **without the
|
||||
review verdict** — the phase was already reviewed — with the review results
|
||||
and unresolved findings in the report doc, header "Reviewed and ready for
|
||||
sign-off" in the item's `body`. The finish never carries `review`, and its
|
||||
|
||||
@@ -901,7 +901,9 @@ Per-unit work is yours to report, with `run` in any post:
|
||||
not count), a whole number from 1 to 999. A built phase scores by its size,
|
||||
one point per 3 tasks rounded up, and Implement + Review one more for the
|
||||
review. Always send it: without it a phase scores a flat 2 (or 3), however
|
||||
big it was. On any other event it is exit `3`.
|
||||
big it was. On any other event it is exit `3`. The console already counts a
|
||||
build's tasks from `headline.cleared` as they are ticked off; the phase's
|
||||
`run` takes that count over with the final score, so it never counts twice.
|
||||
- One `run` per post. Which events a workflow reports is in its own notes
|
||||
(Workflow notes → Pathfinder; `building.md` for Implement and for the
|
||||
review run on the page after a build).
|
||||
|
||||
@@ -90,7 +90,7 @@ import {
|
||||
writeJsonAtomic,
|
||||
writeWorkspaceCursor,
|
||||
} from "./lib.mjs";
|
||||
import { RUN_EVENTS, TASK_EVENTS, MAX_TASKS, isTaskCount } from "./public/meter.js";
|
||||
import { RUN_EVENTS, TASK_EVENTS, MAX_TASKS, isTaskCount, progressEntry } from "./public/meter.js";
|
||||
import { changeLine } from "./public/workspace.js";
|
||||
|
||||
// Mirrors the server's absolute lifetime cap: a handle older than this cannot
|
||||
@@ -593,6 +593,13 @@ function cmdPost() {
|
||||
const next = written.state;
|
||||
|
||||
for (const line of ledgerLines) appendLedger(dir, line);
|
||||
// A build scores its tasks as it clears them (meter.js, PROGRESS_WORKFLOWS),
|
||||
// after any `run` in the same post, so a phase finished here ends its count.
|
||||
if (patch.headline && typeof patch.headline === "object") {
|
||||
const ledger = readLedger(dir);
|
||||
const progress = progressEntry(ledger, lastLaunchId(ledger), next.workflow, patch.headline.cleared);
|
||||
if (progress) appendLedger(dir, progress);
|
||||
}
|
||||
appendEvent(dir, { type: "post", items: (patch.items || []).length });
|
||||
|
||||
const open = next.items.filter((i) => isOpen(i) && i.required !== false).length;
|
||||
|
||||
@@ -1096,6 +1096,14 @@ h1 {
|
||||
.ask-disabled-note.is-limit, .ask-disabled-note.is-waiting { color: var(--ink-2); background: var(--panel-2); border: 1px solid var(--rule); }
|
||||
.ask-disabled-note.is-offline { color: var(--warn); background: var(--warn-soft); border: 1px solid var(--warn); }
|
||||
|
||||
/* Waiting on Plan2Code (an Ask answer, or answers sent from Questions):
|
||||
the tiny ring, left of the label. */
|
||||
.view-tab .tab-spin {
|
||||
display: inline-block;
|
||||
margin-right: 6px;
|
||||
vertical-align: -1px;
|
||||
}
|
||||
|
||||
/* A reply landed while another tab was open. */
|
||||
.view-tab .tab-dot {
|
||||
display: inline-block;
|
||||
@@ -3144,11 +3152,6 @@ a.icon-btn { box-sizing: border-box; text-decoration: none; }
|
||||
0%, 15%, 75%, 100% { transform: scale(1); opacity: 0.16; }
|
||||
45% { transform: scale(0.7); opacity: 0.08; }
|
||||
}
|
||||
.pose .fz-halo { opacity: 0.25; animation: fz-halo 1.6s ease-in-out infinite; }
|
||||
@keyframes fz-halo {
|
||||
0%, 100% { transform: scale(1); opacity: 0.2; }
|
||||
45% { transform: scale(1.3); opacity: 0.4; }
|
||||
}
|
||||
.pose .fz-tick { stroke: var(--accent-ink); }
|
||||
.pose .fz-flag { transform-origin: 0% 50%; animation: fz-wave 1.2s ease-in-out infinite; }
|
||||
@keyframes fz-wave {
|
||||
|
||||
@@ -1825,8 +1825,11 @@ function renderBriefButton() {
|
||||
function renderViews() {
|
||||
const nav = $("views");
|
||||
nav.replaceChildren();
|
||||
// Sent and not yet picked up: the same ring as Ask, until Plan2Code moves on
|
||||
// or goes quiet (a turning ring would pass a dead session for a slow one).
|
||||
const sentBusy = pendingResult && !gone && !agentAdrift();
|
||||
const tabs = [
|
||||
{ id: "questions", label: isDashboard() ? "Dashboard" : "Questions", count: myTurn().length },
|
||||
{ id: "questions", label: isDashboard() ? "Dashboard" : "Questions", count: myTurn().length, busy: sentBusy },
|
||||
];
|
||||
// Built in rather than posted: present exactly while the spec in view has
|
||||
// an overview.md. A tab that vanishes under the person sends them home.
|
||||
@@ -1835,11 +1838,21 @@ function renderViews() {
|
||||
else if (view === "overview") view = "questions";
|
||||
for (const d of docs()) tabs.push({ id: "doc:" + d.id, label: d.title || "Document", count: 0 });
|
||||
// Always last, on every workflow and after a finish: the Quick question chat.
|
||||
tabs.push({ id: "ask", label: "Ask", count: 0, dot: chatDot });
|
||||
// The ring left of "Ask" shows exactly when the conversation's own ring does:
|
||||
// a question the agent picked up and has not answered yet.
|
||||
const ask = askState();
|
||||
const askBusy = ask.view.rows.some((r) => r.working) && ask.send.state !== "offline" && !agentAdrift();
|
||||
tabs.push({ id: "ask", label: "Ask", count: 0, dot: chatDot, busy: askBusy });
|
||||
|
||||
for (const t of tabs) {
|
||||
const b = el("button", "view-tab", t.label);
|
||||
b.type = "button";
|
||||
if (t.busy) {
|
||||
const spin = el("span", "spinner tiny tab-spin");
|
||||
spin.setAttribute("aria-hidden", "true");
|
||||
b.prepend(spin);
|
||||
b.title = t.id === "ask" ? "Plan2Code is working on an answer" : "Sent. Waiting for Plan2Code";
|
||||
}
|
||||
b.setAttribute("aria-current", String(view === t.id || (t.id === "questions" && view === "end")));
|
||||
if (t.count) {
|
||||
const c = el("span", "tab-count", String(t.count));
|
||||
|
||||
@@ -405,7 +405,7 @@
|
||||
</svg>
|
||||
|
||||
<!-- 4 Finalize: hopping for joy, both arms up, beside the checkmark
|
||||
flag, confetti drifting down and his star glowing. -->
|
||||
flag, confetti drifting down. -->
|
||||
<svg class="pose pose-finalize" data-pose="finalize" viewBox="0 4 240 216" aria-hidden="true" focusable="false">
|
||||
<ellipse class="shadow fz-shadow" cx="120" cy="198" rx="34" ry="5" />
|
||||
<g class="fz-hop">
|
||||
@@ -415,7 +415,6 @@
|
||||
<rect class="sh" x="80" y="72" width="80" height="108" rx="16" />
|
||||
<path class="ln" d="M80 116 L60 90" /><circle class="fl" cx="60" cy="90" r="5.5" />
|
||||
<path class="ln" d="M160 116 L180 90" /><circle class="fl" cx="180" cy="90" r="5.5" />
|
||||
<circle class="ac fz-halo" cx="120" cy="98" r="23" />
|
||||
<path class="ey blink" d="M120 84 L123.64 92.98 L133.31 93.67 L125.9 99.92 L128.23 109.33 L120 104.2 L111.77 109.33 L114.1 99.92 L106.69 93.67 L116.36 92.98 Z" />
|
||||
<path class="ey" d="M106 118 Q120 134 134 118 Z" />
|
||||
</g>
|
||||
|
||||
@@ -53,16 +53,55 @@ export const TASK_EVENTS = Object.freeze(new Set(Object.keys(TASK_BONUS)));
|
||||
// The most tasks one run may report: past this it is a typo, not a phase.
|
||||
export const MAX_TASKS = 999;
|
||||
|
||||
// A build scores while it runs, not only once it is approved: console.mjs
|
||||
// writes a `progress` ledger entry whenever a build's `headline.cleared`
|
||||
// rises, and the build's row scores those tasks at TASKS_PER_POINT with no
|
||||
// bonus. The phase's `run` then takes the row over with its final score, so
|
||||
// the total only ever climbs. Workflows whose headline counts tasks:
|
||||
export const PROGRESS_WORKFLOWS = Object.freeze(new Set(["implement", "implement-review"]));
|
||||
|
||||
// Implement + Review reviews every phase as a stage of the build. A `review`
|
||||
// run inside it is that stage, so it scores the phase's TASK_BONUS when it
|
||||
// starts, and the phase's own run leaves the bonus out after it.
|
||||
const BUILT_IN_REVIEW = Object.freeze({ "implement-review": "implement-review-phase" });
|
||||
|
||||
/**
|
||||
* The ledger entry a build's progress post stands for, or null when it adds
|
||||
* nothing: not a task-counting workflow, no whole `cleared`, or no more tasks
|
||||
* than this build already has. `seg` is how many phases this skill run has
|
||||
* finished, so a second phase in the same run starts its own count, but only
|
||||
* once its headline is back at 0: until then a `cleared` is the finished
|
||||
* phase's, posted again, and opening a build on it would count it twice.
|
||||
*/
|
||||
export function progressEntry(entries, launch, workflow, cleared) {
|
||||
if (!PROGRESS_WORKFLOWS.has(workflow)) return null;
|
||||
if (cleared !== 0 && !isTaskCount(cleared)) return null;
|
||||
const list = Array.isArray(entries) ? entries : [];
|
||||
const seg = list.filter((e) => e && e.kind === "run" && TASK_EVENTS.has(e.event) && launchOf(e.id) === launch).length;
|
||||
const build = `${launch}:b${seg}`;
|
||||
const mine = list.filter((e) => e && e.kind === "progress" && e.build === build);
|
||||
const entry = (tasks) => ({ kind: "progress", id: `${build}:${tasks}`, build, workflow, tasks });
|
||||
if (cleared === 0) return seg > 0 && !mine.length ? entry(0) : null;
|
||||
if (seg > 0 && !mine.length) return null;
|
||||
const most = mine.reduce((n, e) => Math.max(n, e.tasks), 0);
|
||||
return cleared > most ? entry(cleared) : null;
|
||||
}
|
||||
|
||||
/** A valid `run.tasks`: a whole number from 1 to MAX_TASKS. */
|
||||
export function isTaskCount(tasks) {
|
||||
return Number.isInteger(tasks) && tasks >= 1 && tasks <= MAX_TASKS;
|
||||
}
|
||||
|
||||
/** What one `run` scores, from its event and (for a built phase) its tasks. */
|
||||
export function runPoints(event, tasks) {
|
||||
/**
|
||||
* What one `run` scores, from its event and (for a built phase) its tasks.
|
||||
* `bonus: false` leaves the review bonus out, for a phase whose review
|
||||
* already scored.
|
||||
*/
|
||||
export function runPoints(event, tasks, { bonus = true } = {}) {
|
||||
if (TASK_EVENTS.has(event) && isTaskCount(tasks)) {
|
||||
return Math.ceil(tasks / TASKS_PER_POINT) + TASK_BONUS[event];
|
||||
return Math.ceil(tasks / TASKS_PER_POINT) + (bonus ? TASK_BONUS[event] : 0);
|
||||
}
|
||||
if (TASK_EVENTS.has(event) && !bonus) return weightOf(event) - TASK_BONUS[event];
|
||||
return weightOf(event);
|
||||
}
|
||||
|
||||
@@ -133,6 +172,8 @@ export function breakdownFrom(entries) {
|
||||
const seen = new Set();
|
||||
const rows = [];
|
||||
const answers = new Map(); // launch id -> { row, count, workflow }
|
||||
const builds = new Map(); // launch id -> the row of the build in progress
|
||||
const reviewed = new Set(); // launch ids whose built-in review has scored
|
||||
for (const entry of Array.isArray(entries) ? entries : []) {
|
||||
if (!entry || typeof entry !== "object") continue;
|
||||
if (entry.id !== undefined) {
|
||||
@@ -150,17 +191,54 @@ export function breakdownFrom(entries) {
|
||||
tally.count += 1;
|
||||
continue;
|
||||
}
|
||||
if (entry.kind === "progress") {
|
||||
if (!isTaskCount(entry.tasks)) continue;
|
||||
const launch = launchOf(entry.id);
|
||||
let row = builds.get(launch);
|
||||
if (!row || row.build !== entry.build) {
|
||||
row = { label: "", points: 0, build: entry.build, tasks: 0 };
|
||||
builds.set(launch, row);
|
||||
rows.push(row);
|
||||
}
|
||||
if (entry.tasks > row.tasks) {
|
||||
row.tasks = entry.tasks;
|
||||
row.points = Math.ceil(entry.tasks / TASKS_PER_POINT);
|
||||
const where = WORKFLOW_NAMES[entry.workflow] || "Build";
|
||||
row.label = `${where}: ${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"} built so far`;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
let points = 0;
|
||||
let label = "";
|
||||
if (entry.kind === "launch" && LAUNCH_COUNTED.has(entry.workflow)) {
|
||||
points = weightOf(entry.workflow);
|
||||
label = LAUNCH_LABELS[entry.workflow] || entry.workflow;
|
||||
} else if (entry.kind === "run") {
|
||||
points = runPoints(entry.event, entry.tasks);
|
||||
const unit = unitOf(entry.id);
|
||||
const counted = TASK_EVENTS.has(entry.event) && isTaskCount(entry.tasks);
|
||||
const size = counted ? ` (${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"})` : "";
|
||||
label = (RUN_LABELS[entry.event] || entry.event) + (unit ? `: ${unit}` : "") + size;
|
||||
const launch = launchOf(entry.id);
|
||||
const builtIn = BUILT_IN_REVIEW[entry.workflow];
|
||||
if (entry.event === "review" && builtIn) {
|
||||
// The review stage of Implement + Review: it scores the bonus its
|
||||
// phase would otherwise carry, once per skill run.
|
||||
if (reviewed.has(launch)) continue;
|
||||
reviewed.add(launch);
|
||||
points = TASK_BONUS[builtIn];
|
||||
label = `${WORKFLOW_NAMES[entry.workflow]}: code review run`;
|
||||
} else {
|
||||
const bonus = !(TASK_EVENTS.has(entry.event) && reviewed.has(launch));
|
||||
points = runPoints(entry.event, entry.tasks, { bonus });
|
||||
const unit = unitOf(entry.id);
|
||||
const counted = TASK_EVENTS.has(entry.event) && isTaskCount(entry.tasks);
|
||||
const size = counted ? ` (${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"})` : "";
|
||||
label = (RUN_LABELS[entry.event] || entry.event) + (unit && unit !== entry.event ? `: ${unit}` : "") + size;
|
||||
}
|
||||
// A finished phase takes over its build's progress row, in place.
|
||||
if (TASK_EVENTS.has(entry.event) && builds.has(launch)) {
|
||||
const row = builds.get(launch);
|
||||
builds.delete(launch);
|
||||
row.label = label;
|
||||
row.points = Math.max(points, row.points);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (points > 0) rows.push({ label, points });
|
||||
}
|
||||
@@ -169,7 +247,7 @@ export function breakdownFrom(entries) {
|
||||
const where = WORKFLOW_NAMES[workflow] ? ` in ${WORKFLOW_NAMES[workflow]}` : "";
|
||||
row.label = `${count} ${count === 1 ? "answer" : "answers"}${where}`;
|
||||
}
|
||||
return rows.filter((row) => row.points > 0);
|
||||
return rows.filter((row) => row.points > 0).map(({ label, points }) => ({ label, points }));
|
||||
}
|
||||
|
||||
/** The session's points, folded from ledger entries in order. */
|
||||
|
||||
@@ -60,7 +60,9 @@ The first payload for a phase you are about to build:
|
||||
```
|
||||
|
||||
`headline.cleared` / `total` are tasks done out of tasks in the phase: the
|
||||
progress bar is the first thing someone watching a build looks at.
|
||||
progress bar is the first thing someone watching a build looks at. The session
|
||||
meter counts the build's tasks from `cleared` as it rises, so keep it current,
|
||||
and start every phase (a second one in the same run too) at `"cleared": 0`.
|
||||
|
||||
`phasefile` is the whole `phase-X.md`, verbatim from disk, as its own tab —
|
||||
the person can read the prerequisites and task specs while you build. Re-post
|
||||
@@ -233,8 +235,9 @@ sign-off card, and approving past it was the answer. `implement-review` ends
|
||||
the same way; that phase was reviewed already. Only a finished `quick-task`
|
||||
still offers the review on its finish — see below.
|
||||
|
||||
`run` scores the approved phase on the session meter (console.md → Posting an
|
||||
update → Session meter), in the same post that records the approval:
|
||||
`run` gives the approved phase its final score on the session meter (console.md →
|
||||
Posting an update → Session meter), in the same post that records the approval;
|
||||
it takes over what the build already counted from `cleared`, never adds to it:
|
||||
`implement-phase` for Implement, `implement-review-phase` for Implement +
|
||||
Review, id `phase-N`, and `tasks`: how many of the phase's tasks were
|
||||
completed (`[x]`, not blocked `[!]`). The phase scores by its size, so a
|
||||
@@ -392,7 +395,10 @@ a question still owed, above the ending itself:
|
||||
|
||||
The same build, then Stage 2 publishes the findings exactly as above (the
|
||||
`review` doc and the `fixes` item). Stage 3 fixes, with no "Check the fixes"
|
||||
item: Stage 4 is the only gate. Stage 4 is the sign-off above **without the
|
||||
item: Stage 4 is the only gate. The post that starts Stage 2's review carries
|
||||
`"run": { "event": "review", "id": "review" }`, as above: in this workflow it
|
||||
scores the review stage's 1 point on the meter as it begins, and the phase's
|
||||
final `run` leaves that point out. Stage 4 is the sign-off above **without the
|
||||
review verdict** — the phase was already reviewed — with the review results
|
||||
and unresolved findings in the report doc, header "Reviewed and ready for
|
||||
sign-off" in the item's `body`. The finish never carries `review`, and its
|
||||
|
||||
@@ -901,7 +901,9 @@ Per-unit work is yours to report, with `run` in any post:
|
||||
not count), a whole number from 1 to 999. A built phase scores by its size,
|
||||
one point per 3 tasks rounded up, and Implement + Review one more for the
|
||||
review. Always send it: without it a phase scores a flat 2 (or 3), however
|
||||
big it was. On any other event it is exit `3`.
|
||||
big it was. On any other event it is exit `3`. The console already counts a
|
||||
build's tasks from `headline.cleared` as they are ticked off; the phase's
|
||||
`run` takes that count over with the final score, so it never counts twice.
|
||||
- One `run` per post. Which events a workflow reports is in its own notes
|
||||
(Workflow notes → Pathfinder; `building.md` for Implement and for the
|
||||
review run on the page after a build).
|
||||
|
||||
@@ -90,7 +90,7 @@ import {
|
||||
writeJsonAtomic,
|
||||
writeWorkspaceCursor,
|
||||
} from "./lib.mjs";
|
||||
import { RUN_EVENTS, TASK_EVENTS, MAX_TASKS, isTaskCount } from "./public/meter.js";
|
||||
import { RUN_EVENTS, TASK_EVENTS, MAX_TASKS, isTaskCount, progressEntry } from "./public/meter.js";
|
||||
import { changeLine } from "./public/workspace.js";
|
||||
|
||||
// Mirrors the server's absolute lifetime cap: a handle older than this cannot
|
||||
@@ -593,6 +593,13 @@ function cmdPost() {
|
||||
const next = written.state;
|
||||
|
||||
for (const line of ledgerLines) appendLedger(dir, line);
|
||||
// A build scores its tasks as it clears them (meter.js, PROGRESS_WORKFLOWS),
|
||||
// after any `run` in the same post, so a phase finished here ends its count.
|
||||
if (patch.headline && typeof patch.headline === "object") {
|
||||
const ledger = readLedger(dir);
|
||||
const progress = progressEntry(ledger, lastLaunchId(ledger), next.workflow, patch.headline.cleared);
|
||||
if (progress) appendLedger(dir, progress);
|
||||
}
|
||||
appendEvent(dir, { type: "post", items: (patch.items || []).length });
|
||||
|
||||
const open = next.items.filter((i) => isOpen(i) && i.required !== false).length;
|
||||
|
||||
@@ -1096,6 +1096,14 @@ h1 {
|
||||
.ask-disabled-note.is-limit, .ask-disabled-note.is-waiting { color: var(--ink-2); background: var(--panel-2); border: 1px solid var(--rule); }
|
||||
.ask-disabled-note.is-offline { color: var(--warn); background: var(--warn-soft); border: 1px solid var(--warn); }
|
||||
|
||||
/* Waiting on Plan2Code (an Ask answer, or answers sent from Questions):
|
||||
the tiny ring, left of the label. */
|
||||
.view-tab .tab-spin {
|
||||
display: inline-block;
|
||||
margin-right: 6px;
|
||||
vertical-align: -1px;
|
||||
}
|
||||
|
||||
/* A reply landed while another tab was open. */
|
||||
.view-tab .tab-dot {
|
||||
display: inline-block;
|
||||
@@ -3144,11 +3152,6 @@ a.icon-btn { box-sizing: border-box; text-decoration: none; }
|
||||
0%, 15%, 75%, 100% { transform: scale(1); opacity: 0.16; }
|
||||
45% { transform: scale(0.7); opacity: 0.08; }
|
||||
}
|
||||
.pose .fz-halo { opacity: 0.25; animation: fz-halo 1.6s ease-in-out infinite; }
|
||||
@keyframes fz-halo {
|
||||
0%, 100% { transform: scale(1); opacity: 0.2; }
|
||||
45% { transform: scale(1.3); opacity: 0.4; }
|
||||
}
|
||||
.pose .fz-tick { stroke: var(--accent-ink); }
|
||||
.pose .fz-flag { transform-origin: 0% 50%; animation: fz-wave 1.2s ease-in-out infinite; }
|
||||
@keyframes fz-wave {
|
||||
|
||||
@@ -1825,8 +1825,11 @@ function renderBriefButton() {
|
||||
function renderViews() {
|
||||
const nav = $("views");
|
||||
nav.replaceChildren();
|
||||
// Sent and not yet picked up: the same ring as Ask, until Plan2Code moves on
|
||||
// or goes quiet (a turning ring would pass a dead session for a slow one).
|
||||
const sentBusy = pendingResult && !gone && !agentAdrift();
|
||||
const tabs = [
|
||||
{ id: "questions", label: isDashboard() ? "Dashboard" : "Questions", count: myTurn().length },
|
||||
{ id: "questions", label: isDashboard() ? "Dashboard" : "Questions", count: myTurn().length, busy: sentBusy },
|
||||
];
|
||||
// Built in rather than posted: present exactly while the spec in view has
|
||||
// an overview.md. A tab that vanishes under the person sends them home.
|
||||
@@ -1835,11 +1838,21 @@ function renderViews() {
|
||||
else if (view === "overview") view = "questions";
|
||||
for (const d of docs()) tabs.push({ id: "doc:" + d.id, label: d.title || "Document", count: 0 });
|
||||
// Always last, on every workflow and after a finish: the Quick question chat.
|
||||
tabs.push({ id: "ask", label: "Ask", count: 0, dot: chatDot });
|
||||
// The ring left of "Ask" shows exactly when the conversation's own ring does:
|
||||
// a question the agent picked up and has not answered yet.
|
||||
const ask = askState();
|
||||
const askBusy = ask.view.rows.some((r) => r.working) && ask.send.state !== "offline" && !agentAdrift();
|
||||
tabs.push({ id: "ask", label: "Ask", count: 0, dot: chatDot, busy: askBusy });
|
||||
|
||||
for (const t of tabs) {
|
||||
const b = el("button", "view-tab", t.label);
|
||||
b.type = "button";
|
||||
if (t.busy) {
|
||||
const spin = el("span", "spinner tiny tab-spin");
|
||||
spin.setAttribute("aria-hidden", "true");
|
||||
b.prepend(spin);
|
||||
b.title = t.id === "ask" ? "Plan2Code is working on an answer" : "Sent. Waiting for Plan2Code";
|
||||
}
|
||||
b.setAttribute("aria-current", String(view === t.id || (t.id === "questions" && view === "end")));
|
||||
if (t.count) {
|
||||
const c = el("span", "tab-count", String(t.count));
|
||||
|
||||
@@ -405,7 +405,7 @@
|
||||
</svg>
|
||||
|
||||
<!-- 4 Finalize: hopping for joy, both arms up, beside the checkmark
|
||||
flag, confetti drifting down and his star glowing. -->
|
||||
flag, confetti drifting down. -->
|
||||
<svg class="pose pose-finalize" data-pose="finalize" viewBox="0 4 240 216" aria-hidden="true" focusable="false">
|
||||
<ellipse class="shadow fz-shadow" cx="120" cy="198" rx="34" ry="5" />
|
||||
<g class="fz-hop">
|
||||
@@ -415,7 +415,6 @@
|
||||
<rect class="sh" x="80" y="72" width="80" height="108" rx="16" />
|
||||
<path class="ln" d="M80 116 L60 90" /><circle class="fl" cx="60" cy="90" r="5.5" />
|
||||
<path class="ln" d="M160 116 L180 90" /><circle class="fl" cx="180" cy="90" r="5.5" />
|
||||
<circle class="ac fz-halo" cx="120" cy="98" r="23" />
|
||||
<path class="ey blink" d="M120 84 L123.64 92.98 L133.31 93.67 L125.9 99.92 L128.23 109.33 L120 104.2 L111.77 109.33 L114.1 99.92 L106.69 93.67 L116.36 92.98 Z" />
|
||||
<path class="ey" d="M106 118 Q120 134 134 118 Z" />
|
||||
</g>
|
||||
|
||||
@@ -53,16 +53,55 @@ export const TASK_EVENTS = Object.freeze(new Set(Object.keys(TASK_BONUS)));
|
||||
// The most tasks one run may report: past this it is a typo, not a phase.
|
||||
export const MAX_TASKS = 999;
|
||||
|
||||
// A build scores while it runs, not only once it is approved: console.mjs
|
||||
// writes a `progress` ledger entry whenever a build's `headline.cleared`
|
||||
// rises, and the build's row scores those tasks at TASKS_PER_POINT with no
|
||||
// bonus. The phase's `run` then takes the row over with its final score, so
|
||||
// the total only ever climbs. Workflows whose headline counts tasks:
|
||||
export const PROGRESS_WORKFLOWS = Object.freeze(new Set(["implement", "implement-review"]));
|
||||
|
||||
// Implement + Review reviews every phase as a stage of the build. A `review`
|
||||
// run inside it is that stage, so it scores the phase's TASK_BONUS when it
|
||||
// starts, and the phase's own run leaves the bonus out after it.
|
||||
const BUILT_IN_REVIEW = Object.freeze({ "implement-review": "implement-review-phase" });
|
||||
|
||||
/**
|
||||
* The ledger entry a build's progress post stands for, or null when it adds
|
||||
* nothing: not a task-counting workflow, no whole `cleared`, or no more tasks
|
||||
* than this build already has. `seg` is how many phases this skill run has
|
||||
* finished, so a second phase in the same run starts its own count, but only
|
||||
* once its headline is back at 0: until then a `cleared` is the finished
|
||||
* phase's, posted again, and opening a build on it would count it twice.
|
||||
*/
|
||||
export function progressEntry(entries, launch, workflow, cleared) {
|
||||
if (!PROGRESS_WORKFLOWS.has(workflow)) return null;
|
||||
if (cleared !== 0 && !isTaskCount(cleared)) return null;
|
||||
const list = Array.isArray(entries) ? entries : [];
|
||||
const seg = list.filter((e) => e && e.kind === "run" && TASK_EVENTS.has(e.event) && launchOf(e.id) === launch).length;
|
||||
const build = `${launch}:b${seg}`;
|
||||
const mine = list.filter((e) => e && e.kind === "progress" && e.build === build);
|
||||
const entry = (tasks) => ({ kind: "progress", id: `${build}:${tasks}`, build, workflow, tasks });
|
||||
if (cleared === 0) return seg > 0 && !mine.length ? entry(0) : null;
|
||||
if (seg > 0 && !mine.length) return null;
|
||||
const most = mine.reduce((n, e) => Math.max(n, e.tasks), 0);
|
||||
return cleared > most ? entry(cleared) : null;
|
||||
}
|
||||
|
||||
/** A valid `run.tasks`: a whole number from 1 to MAX_TASKS. */
|
||||
export function isTaskCount(tasks) {
|
||||
return Number.isInteger(tasks) && tasks >= 1 && tasks <= MAX_TASKS;
|
||||
}
|
||||
|
||||
/** What one `run` scores, from its event and (for a built phase) its tasks. */
|
||||
export function runPoints(event, tasks) {
|
||||
/**
|
||||
* What one `run` scores, from its event and (for a built phase) its tasks.
|
||||
* `bonus: false` leaves the review bonus out, for a phase whose review
|
||||
* already scored.
|
||||
*/
|
||||
export function runPoints(event, tasks, { bonus = true } = {}) {
|
||||
if (TASK_EVENTS.has(event) && isTaskCount(tasks)) {
|
||||
return Math.ceil(tasks / TASKS_PER_POINT) + TASK_BONUS[event];
|
||||
return Math.ceil(tasks / TASKS_PER_POINT) + (bonus ? TASK_BONUS[event] : 0);
|
||||
}
|
||||
if (TASK_EVENTS.has(event) && !bonus) return weightOf(event) - TASK_BONUS[event];
|
||||
return weightOf(event);
|
||||
}
|
||||
|
||||
@@ -133,6 +172,8 @@ export function breakdownFrom(entries) {
|
||||
const seen = new Set();
|
||||
const rows = [];
|
||||
const answers = new Map(); // launch id -> { row, count, workflow }
|
||||
const builds = new Map(); // launch id -> the row of the build in progress
|
||||
const reviewed = new Set(); // launch ids whose built-in review has scored
|
||||
for (const entry of Array.isArray(entries) ? entries : []) {
|
||||
if (!entry || typeof entry !== "object") continue;
|
||||
if (entry.id !== undefined) {
|
||||
@@ -150,17 +191,54 @@ export function breakdownFrom(entries) {
|
||||
tally.count += 1;
|
||||
continue;
|
||||
}
|
||||
if (entry.kind === "progress") {
|
||||
if (!isTaskCount(entry.tasks)) continue;
|
||||
const launch = launchOf(entry.id);
|
||||
let row = builds.get(launch);
|
||||
if (!row || row.build !== entry.build) {
|
||||
row = { label: "", points: 0, build: entry.build, tasks: 0 };
|
||||
builds.set(launch, row);
|
||||
rows.push(row);
|
||||
}
|
||||
if (entry.tasks > row.tasks) {
|
||||
row.tasks = entry.tasks;
|
||||
row.points = Math.ceil(entry.tasks / TASKS_PER_POINT);
|
||||
const where = WORKFLOW_NAMES[entry.workflow] || "Build";
|
||||
row.label = `${where}: ${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"} built so far`;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
let points = 0;
|
||||
let label = "";
|
||||
if (entry.kind === "launch" && LAUNCH_COUNTED.has(entry.workflow)) {
|
||||
points = weightOf(entry.workflow);
|
||||
label = LAUNCH_LABELS[entry.workflow] || entry.workflow;
|
||||
} else if (entry.kind === "run") {
|
||||
points = runPoints(entry.event, entry.tasks);
|
||||
const unit = unitOf(entry.id);
|
||||
const counted = TASK_EVENTS.has(entry.event) && isTaskCount(entry.tasks);
|
||||
const size = counted ? ` (${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"})` : "";
|
||||
label = (RUN_LABELS[entry.event] || entry.event) + (unit ? `: ${unit}` : "") + size;
|
||||
const launch = launchOf(entry.id);
|
||||
const builtIn = BUILT_IN_REVIEW[entry.workflow];
|
||||
if (entry.event === "review" && builtIn) {
|
||||
// The review stage of Implement + Review: it scores the bonus its
|
||||
// phase would otherwise carry, once per skill run.
|
||||
if (reviewed.has(launch)) continue;
|
||||
reviewed.add(launch);
|
||||
points = TASK_BONUS[builtIn];
|
||||
label = `${WORKFLOW_NAMES[entry.workflow]}: code review run`;
|
||||
} else {
|
||||
const bonus = !(TASK_EVENTS.has(entry.event) && reviewed.has(launch));
|
||||
points = runPoints(entry.event, entry.tasks, { bonus });
|
||||
const unit = unitOf(entry.id);
|
||||
const counted = TASK_EVENTS.has(entry.event) && isTaskCount(entry.tasks);
|
||||
const size = counted ? ` (${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"})` : "";
|
||||
label = (RUN_LABELS[entry.event] || entry.event) + (unit && unit !== entry.event ? `: ${unit}` : "") + size;
|
||||
}
|
||||
// A finished phase takes over its build's progress row, in place.
|
||||
if (TASK_EVENTS.has(entry.event) && builds.has(launch)) {
|
||||
const row = builds.get(launch);
|
||||
builds.delete(launch);
|
||||
row.label = label;
|
||||
row.points = Math.max(points, row.points);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (points > 0) rows.push({ label, points });
|
||||
}
|
||||
@@ -169,7 +247,7 @@ export function breakdownFrom(entries) {
|
||||
const where = WORKFLOW_NAMES[workflow] ? ` in ${WORKFLOW_NAMES[workflow]}` : "";
|
||||
row.label = `${count} ${count === 1 ? "answer" : "answers"}${where}`;
|
||||
}
|
||||
return rows.filter((row) => row.points > 0);
|
||||
return rows.filter((row) => row.points > 0).map(({ label, points }) => ({ label, points }));
|
||||
}
|
||||
|
||||
/** The session's points, folded from ledger entries in order. */
|
||||
|
||||
@@ -60,7 +60,9 @@ The first payload for a phase you are about to build:
|
||||
```
|
||||
|
||||
`headline.cleared` / `total` are tasks done out of tasks in the phase: the
|
||||
progress bar is the first thing someone watching a build looks at.
|
||||
progress bar is the first thing someone watching a build looks at. The session
|
||||
meter counts the build's tasks from `cleared` as it rises, so keep it current,
|
||||
and start every phase (a second one in the same run too) at `"cleared": 0`.
|
||||
|
||||
`phasefile` is the whole `phase-X.md`, verbatim from disk, as its own tab —
|
||||
the person can read the prerequisites and task specs while you build. Re-post
|
||||
@@ -233,8 +235,9 @@ sign-off card, and approving past it was the answer. `implement-review` ends
|
||||
the same way; that phase was reviewed already. Only a finished `quick-task`
|
||||
still offers the review on its finish — see below.
|
||||
|
||||
`run` scores the approved phase on the session meter (console.md → Posting an
|
||||
update → Session meter), in the same post that records the approval:
|
||||
`run` gives the approved phase its final score on the session meter (console.md →
|
||||
Posting an update → Session meter), in the same post that records the approval;
|
||||
it takes over what the build already counted from `cleared`, never adds to it:
|
||||
`implement-phase` for Implement, `implement-review-phase` for Implement +
|
||||
Review, id `phase-N`, and `tasks`: how many of the phase's tasks were
|
||||
completed (`[x]`, not blocked `[!]`). The phase scores by its size, so a
|
||||
@@ -392,7 +395,10 @@ a question still owed, above the ending itself:
|
||||
|
||||
The same build, then Stage 2 publishes the findings exactly as above (the
|
||||
`review` doc and the `fixes` item). Stage 3 fixes, with no "Check the fixes"
|
||||
item: Stage 4 is the only gate. Stage 4 is the sign-off above **without the
|
||||
item: Stage 4 is the only gate. The post that starts Stage 2's review carries
|
||||
`"run": { "event": "review", "id": "review" }`, as above: in this workflow it
|
||||
scores the review stage's 1 point on the meter as it begins, and the phase's
|
||||
final `run` leaves that point out. Stage 4 is the sign-off above **without the
|
||||
review verdict** — the phase was already reviewed — with the review results
|
||||
and unresolved findings in the report doc, header "Reviewed and ready for
|
||||
sign-off" in the item's `body`. The finish never carries `review`, and its
|
||||
|
||||
@@ -901,7 +901,9 @@ Per-unit work is yours to report, with `run` in any post:
|
||||
not count), a whole number from 1 to 999. A built phase scores by its size,
|
||||
one point per 3 tasks rounded up, and Implement + Review one more for the
|
||||
review. Always send it: without it a phase scores a flat 2 (or 3), however
|
||||
big it was. On any other event it is exit `3`.
|
||||
big it was. On any other event it is exit `3`. The console already counts a
|
||||
build's tasks from `headline.cleared` as they are ticked off; the phase's
|
||||
`run` takes that count over with the final score, so it never counts twice.
|
||||
- One `run` per post. Which events a workflow reports is in its own notes
|
||||
(Workflow notes → Pathfinder; `building.md` for Implement and for the
|
||||
review run on the page after a build).
|
||||
|
||||
@@ -90,7 +90,7 @@ import {
|
||||
writeJsonAtomic,
|
||||
writeWorkspaceCursor,
|
||||
} from "./lib.mjs";
|
||||
import { RUN_EVENTS, TASK_EVENTS, MAX_TASKS, isTaskCount } from "./public/meter.js";
|
||||
import { RUN_EVENTS, TASK_EVENTS, MAX_TASKS, isTaskCount, progressEntry } from "./public/meter.js";
|
||||
import { changeLine } from "./public/workspace.js";
|
||||
|
||||
// Mirrors the server's absolute lifetime cap: a handle older than this cannot
|
||||
@@ -593,6 +593,13 @@ function cmdPost() {
|
||||
const next = written.state;
|
||||
|
||||
for (const line of ledgerLines) appendLedger(dir, line);
|
||||
// A build scores its tasks as it clears them (meter.js, PROGRESS_WORKFLOWS),
|
||||
// after any `run` in the same post, so a phase finished here ends its count.
|
||||
if (patch.headline && typeof patch.headline === "object") {
|
||||
const ledger = readLedger(dir);
|
||||
const progress = progressEntry(ledger, lastLaunchId(ledger), next.workflow, patch.headline.cleared);
|
||||
if (progress) appendLedger(dir, progress);
|
||||
}
|
||||
appendEvent(dir, { type: "post", items: (patch.items || []).length });
|
||||
|
||||
const open = next.items.filter((i) => isOpen(i) && i.required !== false).length;
|
||||
|
||||
@@ -1096,6 +1096,14 @@ h1 {
|
||||
.ask-disabled-note.is-limit, .ask-disabled-note.is-waiting { color: var(--ink-2); background: var(--panel-2); border: 1px solid var(--rule); }
|
||||
.ask-disabled-note.is-offline { color: var(--warn); background: var(--warn-soft); border: 1px solid var(--warn); }
|
||||
|
||||
/* Waiting on Plan2Code (an Ask answer, or answers sent from Questions):
|
||||
the tiny ring, left of the label. */
|
||||
.view-tab .tab-spin {
|
||||
display: inline-block;
|
||||
margin-right: 6px;
|
||||
vertical-align: -1px;
|
||||
}
|
||||
|
||||
/* A reply landed while another tab was open. */
|
||||
.view-tab .tab-dot {
|
||||
display: inline-block;
|
||||
@@ -3144,11 +3152,6 @@ a.icon-btn { box-sizing: border-box; text-decoration: none; }
|
||||
0%, 15%, 75%, 100% { transform: scale(1); opacity: 0.16; }
|
||||
45% { transform: scale(0.7); opacity: 0.08; }
|
||||
}
|
||||
.pose .fz-halo { opacity: 0.25; animation: fz-halo 1.6s ease-in-out infinite; }
|
||||
@keyframes fz-halo {
|
||||
0%, 100% { transform: scale(1); opacity: 0.2; }
|
||||
45% { transform: scale(1.3); opacity: 0.4; }
|
||||
}
|
||||
.pose .fz-tick { stroke: var(--accent-ink); }
|
||||
.pose .fz-flag { transform-origin: 0% 50%; animation: fz-wave 1.2s ease-in-out infinite; }
|
||||
@keyframes fz-wave {
|
||||
|
||||
@@ -1825,8 +1825,11 @@ function renderBriefButton() {
|
||||
function renderViews() {
|
||||
const nav = $("views");
|
||||
nav.replaceChildren();
|
||||
// Sent and not yet picked up: the same ring as Ask, until Plan2Code moves on
|
||||
// or goes quiet (a turning ring would pass a dead session for a slow one).
|
||||
const sentBusy = pendingResult && !gone && !agentAdrift();
|
||||
const tabs = [
|
||||
{ id: "questions", label: isDashboard() ? "Dashboard" : "Questions", count: myTurn().length },
|
||||
{ id: "questions", label: isDashboard() ? "Dashboard" : "Questions", count: myTurn().length, busy: sentBusy },
|
||||
];
|
||||
// Built in rather than posted: present exactly while the spec in view has
|
||||
// an overview.md. A tab that vanishes under the person sends them home.
|
||||
@@ -1835,11 +1838,21 @@ function renderViews() {
|
||||
else if (view === "overview") view = "questions";
|
||||
for (const d of docs()) tabs.push({ id: "doc:" + d.id, label: d.title || "Document", count: 0 });
|
||||
// Always last, on every workflow and after a finish: the Quick question chat.
|
||||
tabs.push({ id: "ask", label: "Ask", count: 0, dot: chatDot });
|
||||
// The ring left of "Ask" shows exactly when the conversation's own ring does:
|
||||
// a question the agent picked up and has not answered yet.
|
||||
const ask = askState();
|
||||
const askBusy = ask.view.rows.some((r) => r.working) && ask.send.state !== "offline" && !agentAdrift();
|
||||
tabs.push({ id: "ask", label: "Ask", count: 0, dot: chatDot, busy: askBusy });
|
||||
|
||||
for (const t of tabs) {
|
||||
const b = el("button", "view-tab", t.label);
|
||||
b.type = "button";
|
||||
if (t.busy) {
|
||||
const spin = el("span", "spinner tiny tab-spin");
|
||||
spin.setAttribute("aria-hidden", "true");
|
||||
b.prepend(spin);
|
||||
b.title = t.id === "ask" ? "Plan2Code is working on an answer" : "Sent. Waiting for Plan2Code";
|
||||
}
|
||||
b.setAttribute("aria-current", String(view === t.id || (t.id === "questions" && view === "end")));
|
||||
if (t.count) {
|
||||
const c = el("span", "tab-count", String(t.count));
|
||||
|
||||
@@ -405,7 +405,7 @@
|
||||
</svg>
|
||||
|
||||
<!-- 4 Finalize: hopping for joy, both arms up, beside the checkmark
|
||||
flag, confetti drifting down and his star glowing. -->
|
||||
flag, confetti drifting down. -->
|
||||
<svg class="pose pose-finalize" data-pose="finalize" viewBox="0 4 240 216" aria-hidden="true" focusable="false">
|
||||
<ellipse class="shadow fz-shadow" cx="120" cy="198" rx="34" ry="5" />
|
||||
<g class="fz-hop">
|
||||
@@ -415,7 +415,6 @@
|
||||
<rect class="sh" x="80" y="72" width="80" height="108" rx="16" />
|
||||
<path class="ln" d="M80 116 L60 90" /><circle class="fl" cx="60" cy="90" r="5.5" />
|
||||
<path class="ln" d="M160 116 L180 90" /><circle class="fl" cx="180" cy="90" r="5.5" />
|
||||
<circle class="ac fz-halo" cx="120" cy="98" r="23" />
|
||||
<path class="ey blink" d="M120 84 L123.64 92.98 L133.31 93.67 L125.9 99.92 L128.23 109.33 L120 104.2 L111.77 109.33 L114.1 99.92 L106.69 93.67 L116.36 92.98 Z" />
|
||||
<path class="ey" d="M106 118 Q120 134 134 118 Z" />
|
||||
</g>
|
||||
|
||||
@@ -53,16 +53,55 @@ export const TASK_EVENTS = Object.freeze(new Set(Object.keys(TASK_BONUS)));
|
||||
// The most tasks one run may report: past this it is a typo, not a phase.
|
||||
export const MAX_TASKS = 999;
|
||||
|
||||
// A build scores while it runs, not only once it is approved: console.mjs
|
||||
// writes a `progress` ledger entry whenever a build's `headline.cleared`
|
||||
// rises, and the build's row scores those tasks at TASKS_PER_POINT with no
|
||||
// bonus. The phase's `run` then takes the row over with its final score, so
|
||||
// the total only ever climbs. Workflows whose headline counts tasks:
|
||||
export const PROGRESS_WORKFLOWS = Object.freeze(new Set(["implement", "implement-review"]));
|
||||
|
||||
// Implement + Review reviews every phase as a stage of the build. A `review`
|
||||
// run inside it is that stage, so it scores the phase's TASK_BONUS when it
|
||||
// starts, and the phase's own run leaves the bonus out after it.
|
||||
const BUILT_IN_REVIEW = Object.freeze({ "implement-review": "implement-review-phase" });
|
||||
|
||||
/**
|
||||
* The ledger entry a build's progress post stands for, or null when it adds
|
||||
* nothing: not a task-counting workflow, no whole `cleared`, or no more tasks
|
||||
* than this build already has. `seg` is how many phases this skill run has
|
||||
* finished, so a second phase in the same run starts its own count, but only
|
||||
* once its headline is back at 0: until then a `cleared` is the finished
|
||||
* phase's, posted again, and opening a build on it would count it twice.
|
||||
*/
|
||||
export function progressEntry(entries, launch, workflow, cleared) {
|
||||
if (!PROGRESS_WORKFLOWS.has(workflow)) return null;
|
||||
if (cleared !== 0 && !isTaskCount(cleared)) return null;
|
||||
const list = Array.isArray(entries) ? entries : [];
|
||||
const seg = list.filter((e) => e && e.kind === "run" && TASK_EVENTS.has(e.event) && launchOf(e.id) === launch).length;
|
||||
const build = `${launch}:b${seg}`;
|
||||
const mine = list.filter((e) => e && e.kind === "progress" && e.build === build);
|
||||
const entry = (tasks) => ({ kind: "progress", id: `${build}:${tasks}`, build, workflow, tasks });
|
||||
if (cleared === 0) return seg > 0 && !mine.length ? entry(0) : null;
|
||||
if (seg > 0 && !mine.length) return null;
|
||||
const most = mine.reduce((n, e) => Math.max(n, e.tasks), 0);
|
||||
return cleared > most ? entry(cleared) : null;
|
||||
}
|
||||
|
||||
/** A valid `run.tasks`: a whole number from 1 to MAX_TASKS. */
|
||||
export function isTaskCount(tasks) {
|
||||
return Number.isInteger(tasks) && tasks >= 1 && tasks <= MAX_TASKS;
|
||||
}
|
||||
|
||||
/** What one `run` scores, from its event and (for a built phase) its tasks. */
|
||||
export function runPoints(event, tasks) {
|
||||
/**
|
||||
* What one `run` scores, from its event and (for a built phase) its tasks.
|
||||
* `bonus: false` leaves the review bonus out, for a phase whose review
|
||||
* already scored.
|
||||
*/
|
||||
export function runPoints(event, tasks, { bonus = true } = {}) {
|
||||
if (TASK_EVENTS.has(event) && isTaskCount(tasks)) {
|
||||
return Math.ceil(tasks / TASKS_PER_POINT) + TASK_BONUS[event];
|
||||
return Math.ceil(tasks / TASKS_PER_POINT) + (bonus ? TASK_BONUS[event] : 0);
|
||||
}
|
||||
if (TASK_EVENTS.has(event) && !bonus) return weightOf(event) - TASK_BONUS[event];
|
||||
return weightOf(event);
|
||||
}
|
||||
|
||||
@@ -133,6 +172,8 @@ export function breakdownFrom(entries) {
|
||||
const seen = new Set();
|
||||
const rows = [];
|
||||
const answers = new Map(); // launch id -> { row, count, workflow }
|
||||
const builds = new Map(); // launch id -> the row of the build in progress
|
||||
const reviewed = new Set(); // launch ids whose built-in review has scored
|
||||
for (const entry of Array.isArray(entries) ? entries : []) {
|
||||
if (!entry || typeof entry !== "object") continue;
|
||||
if (entry.id !== undefined) {
|
||||
@@ -150,17 +191,54 @@ export function breakdownFrom(entries) {
|
||||
tally.count += 1;
|
||||
continue;
|
||||
}
|
||||
if (entry.kind === "progress") {
|
||||
if (!isTaskCount(entry.tasks)) continue;
|
||||
const launch = launchOf(entry.id);
|
||||
let row = builds.get(launch);
|
||||
if (!row || row.build !== entry.build) {
|
||||
row = { label: "", points: 0, build: entry.build, tasks: 0 };
|
||||
builds.set(launch, row);
|
||||
rows.push(row);
|
||||
}
|
||||
if (entry.tasks > row.tasks) {
|
||||
row.tasks = entry.tasks;
|
||||
row.points = Math.ceil(entry.tasks / TASKS_PER_POINT);
|
||||
const where = WORKFLOW_NAMES[entry.workflow] || "Build";
|
||||
row.label = `${where}: ${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"} built so far`;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
let points = 0;
|
||||
let label = "";
|
||||
if (entry.kind === "launch" && LAUNCH_COUNTED.has(entry.workflow)) {
|
||||
points = weightOf(entry.workflow);
|
||||
label = LAUNCH_LABELS[entry.workflow] || entry.workflow;
|
||||
} else if (entry.kind === "run") {
|
||||
points = runPoints(entry.event, entry.tasks);
|
||||
const unit = unitOf(entry.id);
|
||||
const counted = TASK_EVENTS.has(entry.event) && isTaskCount(entry.tasks);
|
||||
const size = counted ? ` (${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"})` : "";
|
||||
label = (RUN_LABELS[entry.event] || entry.event) + (unit ? `: ${unit}` : "") + size;
|
||||
const launch = launchOf(entry.id);
|
||||
const builtIn = BUILT_IN_REVIEW[entry.workflow];
|
||||
if (entry.event === "review" && builtIn) {
|
||||
// The review stage of Implement + Review: it scores the bonus its
|
||||
// phase would otherwise carry, once per skill run.
|
||||
if (reviewed.has(launch)) continue;
|
||||
reviewed.add(launch);
|
||||
points = TASK_BONUS[builtIn];
|
||||
label = `${WORKFLOW_NAMES[entry.workflow]}: code review run`;
|
||||
} else {
|
||||
const bonus = !(TASK_EVENTS.has(entry.event) && reviewed.has(launch));
|
||||
points = runPoints(entry.event, entry.tasks, { bonus });
|
||||
const unit = unitOf(entry.id);
|
||||
const counted = TASK_EVENTS.has(entry.event) && isTaskCount(entry.tasks);
|
||||
const size = counted ? ` (${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"})` : "";
|
||||
label = (RUN_LABELS[entry.event] || entry.event) + (unit && unit !== entry.event ? `: ${unit}` : "") + size;
|
||||
}
|
||||
// A finished phase takes over its build's progress row, in place.
|
||||
if (TASK_EVENTS.has(entry.event) && builds.has(launch)) {
|
||||
const row = builds.get(launch);
|
||||
builds.delete(launch);
|
||||
row.label = label;
|
||||
row.points = Math.max(points, row.points);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (points > 0) rows.push({ label, points });
|
||||
}
|
||||
@@ -169,7 +247,7 @@ export function breakdownFrom(entries) {
|
||||
const where = WORKFLOW_NAMES[workflow] ? ` in ${WORKFLOW_NAMES[workflow]}` : "";
|
||||
row.label = `${count} ${count === 1 ? "answer" : "answers"}${where}`;
|
||||
}
|
||||
return rows.filter((row) => row.points > 0);
|
||||
return rows.filter((row) => row.points > 0).map(({ label, points }) => ({ label, points }));
|
||||
}
|
||||
|
||||
/** The session's points, folded from ledger entries in order. */
|
||||
|
||||
@@ -60,7 +60,9 @@ The first payload for a phase you are about to build:
|
||||
```
|
||||
|
||||
`headline.cleared` / `total` are tasks done out of tasks in the phase: the
|
||||
progress bar is the first thing someone watching a build looks at.
|
||||
progress bar is the first thing someone watching a build looks at. The session
|
||||
meter counts the build's tasks from `cleared` as it rises, so keep it current,
|
||||
and start every phase (a second one in the same run too) at `"cleared": 0`.
|
||||
|
||||
`phasefile` is the whole `phase-X.md`, verbatim from disk, as its own tab —
|
||||
the person can read the prerequisites and task specs while you build. Re-post
|
||||
@@ -233,8 +235,9 @@ sign-off card, and approving past it was the answer. `implement-review` ends
|
||||
the same way; that phase was reviewed already. Only a finished `quick-task`
|
||||
still offers the review on its finish — see below.
|
||||
|
||||
`run` scores the approved phase on the session meter (console.md → Posting an
|
||||
update → Session meter), in the same post that records the approval:
|
||||
`run` gives the approved phase its final score on the session meter (console.md →
|
||||
Posting an update → Session meter), in the same post that records the approval;
|
||||
it takes over what the build already counted from `cleared`, never adds to it:
|
||||
`implement-phase` for Implement, `implement-review-phase` for Implement +
|
||||
Review, id `phase-N`, and `tasks`: how many of the phase's tasks were
|
||||
completed (`[x]`, not blocked `[!]`). The phase scores by its size, so a
|
||||
@@ -392,7 +395,10 @@ a question still owed, above the ending itself:
|
||||
|
||||
The same build, then Stage 2 publishes the findings exactly as above (the
|
||||
`review` doc and the `fixes` item). Stage 3 fixes, with no "Check the fixes"
|
||||
item: Stage 4 is the only gate. Stage 4 is the sign-off above **without the
|
||||
item: Stage 4 is the only gate. The post that starts Stage 2's review carries
|
||||
`"run": { "event": "review", "id": "review" }`, as above: in this workflow it
|
||||
scores the review stage's 1 point on the meter as it begins, and the phase's
|
||||
final `run` leaves that point out. Stage 4 is the sign-off above **without the
|
||||
review verdict** — the phase was already reviewed — with the review results
|
||||
and unresolved findings in the report doc, header "Reviewed and ready for
|
||||
sign-off" in the item's `body`. The finish never carries `review`, and its
|
||||
|
||||
@@ -901,7 +901,9 @@ Per-unit work is yours to report, with `run` in any post:
|
||||
not count), a whole number from 1 to 999. A built phase scores by its size,
|
||||
one point per 3 tasks rounded up, and Implement + Review one more for the
|
||||
review. Always send it: without it a phase scores a flat 2 (or 3), however
|
||||
big it was. On any other event it is exit `3`.
|
||||
big it was. On any other event it is exit `3`. The console already counts a
|
||||
build's tasks from `headline.cleared` as they are ticked off; the phase's
|
||||
`run` takes that count over with the final score, so it never counts twice.
|
||||
- One `run` per post. Which events a workflow reports is in its own notes
|
||||
(Workflow notes → Pathfinder; `building.md` for Implement and for the
|
||||
review run on the page after a build).
|
||||
|
||||
@@ -90,7 +90,7 @@ import {
|
||||
writeJsonAtomic,
|
||||
writeWorkspaceCursor,
|
||||
} from "./lib.mjs";
|
||||
import { RUN_EVENTS, TASK_EVENTS, MAX_TASKS, isTaskCount } from "./public/meter.js";
|
||||
import { RUN_EVENTS, TASK_EVENTS, MAX_TASKS, isTaskCount, progressEntry } from "./public/meter.js";
|
||||
import { changeLine } from "./public/workspace.js";
|
||||
|
||||
// Mirrors the server's absolute lifetime cap: a handle older than this cannot
|
||||
@@ -593,6 +593,13 @@ function cmdPost() {
|
||||
const next = written.state;
|
||||
|
||||
for (const line of ledgerLines) appendLedger(dir, line);
|
||||
// A build scores its tasks as it clears them (meter.js, PROGRESS_WORKFLOWS),
|
||||
// after any `run` in the same post, so a phase finished here ends its count.
|
||||
if (patch.headline && typeof patch.headline === "object") {
|
||||
const ledger = readLedger(dir);
|
||||
const progress = progressEntry(ledger, lastLaunchId(ledger), next.workflow, patch.headline.cleared);
|
||||
if (progress) appendLedger(dir, progress);
|
||||
}
|
||||
appendEvent(dir, { type: "post", items: (patch.items || []).length });
|
||||
|
||||
const open = next.items.filter((i) => isOpen(i) && i.required !== false).length;
|
||||
|
||||
@@ -1096,6 +1096,14 @@ h1 {
|
||||
.ask-disabled-note.is-limit, .ask-disabled-note.is-waiting { color: var(--ink-2); background: var(--panel-2); border: 1px solid var(--rule); }
|
||||
.ask-disabled-note.is-offline { color: var(--warn); background: var(--warn-soft); border: 1px solid var(--warn); }
|
||||
|
||||
/* Waiting on Plan2Code (an Ask answer, or answers sent from Questions):
|
||||
the tiny ring, left of the label. */
|
||||
.view-tab .tab-spin {
|
||||
display: inline-block;
|
||||
margin-right: 6px;
|
||||
vertical-align: -1px;
|
||||
}
|
||||
|
||||
/* A reply landed while another tab was open. */
|
||||
.view-tab .tab-dot {
|
||||
display: inline-block;
|
||||
@@ -3144,11 +3152,6 @@ a.icon-btn { box-sizing: border-box; text-decoration: none; }
|
||||
0%, 15%, 75%, 100% { transform: scale(1); opacity: 0.16; }
|
||||
45% { transform: scale(0.7); opacity: 0.08; }
|
||||
}
|
||||
.pose .fz-halo { opacity: 0.25; animation: fz-halo 1.6s ease-in-out infinite; }
|
||||
@keyframes fz-halo {
|
||||
0%, 100% { transform: scale(1); opacity: 0.2; }
|
||||
45% { transform: scale(1.3); opacity: 0.4; }
|
||||
}
|
||||
.pose .fz-tick { stroke: var(--accent-ink); }
|
||||
.pose .fz-flag { transform-origin: 0% 50%; animation: fz-wave 1.2s ease-in-out infinite; }
|
||||
@keyframes fz-wave {
|
||||
|
||||
@@ -1825,8 +1825,11 @@ function renderBriefButton() {
|
||||
function renderViews() {
|
||||
const nav = $("views");
|
||||
nav.replaceChildren();
|
||||
// Sent and not yet picked up: the same ring as Ask, until Plan2Code moves on
|
||||
// or goes quiet (a turning ring would pass a dead session for a slow one).
|
||||
const sentBusy = pendingResult && !gone && !agentAdrift();
|
||||
const tabs = [
|
||||
{ id: "questions", label: isDashboard() ? "Dashboard" : "Questions", count: myTurn().length },
|
||||
{ id: "questions", label: isDashboard() ? "Dashboard" : "Questions", count: myTurn().length, busy: sentBusy },
|
||||
];
|
||||
// Built in rather than posted: present exactly while the spec in view has
|
||||
// an overview.md. A tab that vanishes under the person sends them home.
|
||||
@@ -1835,11 +1838,21 @@ function renderViews() {
|
||||
else if (view === "overview") view = "questions";
|
||||
for (const d of docs()) tabs.push({ id: "doc:" + d.id, label: d.title || "Document", count: 0 });
|
||||
// Always last, on every workflow and after a finish: the Quick question chat.
|
||||
tabs.push({ id: "ask", label: "Ask", count: 0, dot: chatDot });
|
||||
// The ring left of "Ask" shows exactly when the conversation's own ring does:
|
||||
// a question the agent picked up and has not answered yet.
|
||||
const ask = askState();
|
||||
const askBusy = ask.view.rows.some((r) => r.working) && ask.send.state !== "offline" && !agentAdrift();
|
||||
tabs.push({ id: "ask", label: "Ask", count: 0, dot: chatDot, busy: askBusy });
|
||||
|
||||
for (const t of tabs) {
|
||||
const b = el("button", "view-tab", t.label);
|
||||
b.type = "button";
|
||||
if (t.busy) {
|
||||
const spin = el("span", "spinner tiny tab-spin");
|
||||
spin.setAttribute("aria-hidden", "true");
|
||||
b.prepend(spin);
|
||||
b.title = t.id === "ask" ? "Plan2Code is working on an answer" : "Sent. Waiting for Plan2Code";
|
||||
}
|
||||
b.setAttribute("aria-current", String(view === t.id || (t.id === "questions" && view === "end")));
|
||||
if (t.count) {
|
||||
const c = el("span", "tab-count", String(t.count));
|
||||
|
||||
@@ -405,7 +405,7 @@
|
||||
</svg>
|
||||
|
||||
<!-- 4 Finalize: hopping for joy, both arms up, beside the checkmark
|
||||
flag, confetti drifting down and his star glowing. -->
|
||||
flag, confetti drifting down. -->
|
||||
<svg class="pose pose-finalize" data-pose="finalize" viewBox="0 4 240 216" aria-hidden="true" focusable="false">
|
||||
<ellipse class="shadow fz-shadow" cx="120" cy="198" rx="34" ry="5" />
|
||||
<g class="fz-hop">
|
||||
@@ -415,7 +415,6 @@
|
||||
<rect class="sh" x="80" y="72" width="80" height="108" rx="16" />
|
||||
<path class="ln" d="M80 116 L60 90" /><circle class="fl" cx="60" cy="90" r="5.5" />
|
||||
<path class="ln" d="M160 116 L180 90" /><circle class="fl" cx="180" cy="90" r="5.5" />
|
||||
<circle class="ac fz-halo" cx="120" cy="98" r="23" />
|
||||
<path class="ey blink" d="M120 84 L123.64 92.98 L133.31 93.67 L125.9 99.92 L128.23 109.33 L120 104.2 L111.77 109.33 L114.1 99.92 L106.69 93.67 L116.36 92.98 Z" />
|
||||
<path class="ey" d="M106 118 Q120 134 134 118 Z" />
|
||||
</g>
|
||||
|
||||
@@ -53,16 +53,55 @@ export const TASK_EVENTS = Object.freeze(new Set(Object.keys(TASK_BONUS)));
|
||||
// The most tasks one run may report: past this it is a typo, not a phase.
|
||||
export const MAX_TASKS = 999;
|
||||
|
||||
// A build scores while it runs, not only once it is approved: console.mjs
|
||||
// writes a `progress` ledger entry whenever a build's `headline.cleared`
|
||||
// rises, and the build's row scores those tasks at TASKS_PER_POINT with no
|
||||
// bonus. The phase's `run` then takes the row over with its final score, so
|
||||
// the total only ever climbs. Workflows whose headline counts tasks:
|
||||
export const PROGRESS_WORKFLOWS = Object.freeze(new Set(["implement", "implement-review"]));
|
||||
|
||||
// Implement + Review reviews every phase as a stage of the build. A `review`
|
||||
// run inside it is that stage, so it scores the phase's TASK_BONUS when it
|
||||
// starts, and the phase's own run leaves the bonus out after it.
|
||||
const BUILT_IN_REVIEW = Object.freeze({ "implement-review": "implement-review-phase" });
|
||||
|
||||
/**
|
||||
* The ledger entry a build's progress post stands for, or null when it adds
|
||||
* nothing: not a task-counting workflow, no whole `cleared`, or no more tasks
|
||||
* than this build already has. `seg` is how many phases this skill run has
|
||||
* finished, so a second phase in the same run starts its own count, but only
|
||||
* once its headline is back at 0: until then a `cleared` is the finished
|
||||
* phase's, posted again, and opening a build on it would count it twice.
|
||||
*/
|
||||
export function progressEntry(entries, launch, workflow, cleared) {
|
||||
if (!PROGRESS_WORKFLOWS.has(workflow)) return null;
|
||||
if (cleared !== 0 && !isTaskCount(cleared)) return null;
|
||||
const list = Array.isArray(entries) ? entries : [];
|
||||
const seg = list.filter((e) => e && e.kind === "run" && TASK_EVENTS.has(e.event) && launchOf(e.id) === launch).length;
|
||||
const build = `${launch}:b${seg}`;
|
||||
const mine = list.filter((e) => e && e.kind === "progress" && e.build === build);
|
||||
const entry = (tasks) => ({ kind: "progress", id: `${build}:${tasks}`, build, workflow, tasks });
|
||||
if (cleared === 0) return seg > 0 && !mine.length ? entry(0) : null;
|
||||
if (seg > 0 && !mine.length) return null;
|
||||
const most = mine.reduce((n, e) => Math.max(n, e.tasks), 0);
|
||||
return cleared > most ? entry(cleared) : null;
|
||||
}
|
||||
|
||||
/** A valid `run.tasks`: a whole number from 1 to MAX_TASKS. */
|
||||
export function isTaskCount(tasks) {
|
||||
return Number.isInteger(tasks) && tasks >= 1 && tasks <= MAX_TASKS;
|
||||
}
|
||||
|
||||
/** What one `run` scores, from its event and (for a built phase) its tasks. */
|
||||
export function runPoints(event, tasks) {
|
||||
/**
|
||||
* What one `run` scores, from its event and (for a built phase) its tasks.
|
||||
* `bonus: false` leaves the review bonus out, for a phase whose review
|
||||
* already scored.
|
||||
*/
|
||||
export function runPoints(event, tasks, { bonus = true } = {}) {
|
||||
if (TASK_EVENTS.has(event) && isTaskCount(tasks)) {
|
||||
return Math.ceil(tasks / TASKS_PER_POINT) + TASK_BONUS[event];
|
||||
return Math.ceil(tasks / TASKS_PER_POINT) + (bonus ? TASK_BONUS[event] : 0);
|
||||
}
|
||||
if (TASK_EVENTS.has(event) && !bonus) return weightOf(event) - TASK_BONUS[event];
|
||||
return weightOf(event);
|
||||
}
|
||||
|
||||
@@ -133,6 +172,8 @@ export function breakdownFrom(entries) {
|
||||
const seen = new Set();
|
||||
const rows = [];
|
||||
const answers = new Map(); // launch id -> { row, count, workflow }
|
||||
const builds = new Map(); // launch id -> the row of the build in progress
|
||||
const reviewed = new Set(); // launch ids whose built-in review has scored
|
||||
for (const entry of Array.isArray(entries) ? entries : []) {
|
||||
if (!entry || typeof entry !== "object") continue;
|
||||
if (entry.id !== undefined) {
|
||||
@@ -150,17 +191,54 @@ export function breakdownFrom(entries) {
|
||||
tally.count += 1;
|
||||
continue;
|
||||
}
|
||||
if (entry.kind === "progress") {
|
||||
if (!isTaskCount(entry.tasks)) continue;
|
||||
const launch = launchOf(entry.id);
|
||||
let row = builds.get(launch);
|
||||
if (!row || row.build !== entry.build) {
|
||||
row = { label: "", points: 0, build: entry.build, tasks: 0 };
|
||||
builds.set(launch, row);
|
||||
rows.push(row);
|
||||
}
|
||||
if (entry.tasks > row.tasks) {
|
||||
row.tasks = entry.tasks;
|
||||
row.points = Math.ceil(entry.tasks / TASKS_PER_POINT);
|
||||
const where = WORKFLOW_NAMES[entry.workflow] || "Build";
|
||||
row.label = `${where}: ${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"} built so far`;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
let points = 0;
|
||||
let label = "";
|
||||
if (entry.kind === "launch" && LAUNCH_COUNTED.has(entry.workflow)) {
|
||||
points = weightOf(entry.workflow);
|
||||
label = LAUNCH_LABELS[entry.workflow] || entry.workflow;
|
||||
} else if (entry.kind === "run") {
|
||||
points = runPoints(entry.event, entry.tasks);
|
||||
const unit = unitOf(entry.id);
|
||||
const counted = TASK_EVENTS.has(entry.event) && isTaskCount(entry.tasks);
|
||||
const size = counted ? ` (${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"})` : "";
|
||||
label = (RUN_LABELS[entry.event] || entry.event) + (unit ? `: ${unit}` : "") + size;
|
||||
const launch = launchOf(entry.id);
|
||||
const builtIn = BUILT_IN_REVIEW[entry.workflow];
|
||||
if (entry.event === "review" && builtIn) {
|
||||
// The review stage of Implement + Review: it scores the bonus its
|
||||
// phase would otherwise carry, once per skill run.
|
||||
if (reviewed.has(launch)) continue;
|
||||
reviewed.add(launch);
|
||||
points = TASK_BONUS[builtIn];
|
||||
label = `${WORKFLOW_NAMES[entry.workflow]}: code review run`;
|
||||
} else {
|
||||
const bonus = !(TASK_EVENTS.has(entry.event) && reviewed.has(launch));
|
||||
points = runPoints(entry.event, entry.tasks, { bonus });
|
||||
const unit = unitOf(entry.id);
|
||||
const counted = TASK_EVENTS.has(entry.event) && isTaskCount(entry.tasks);
|
||||
const size = counted ? ` (${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"})` : "";
|
||||
label = (RUN_LABELS[entry.event] || entry.event) + (unit && unit !== entry.event ? `: ${unit}` : "") + size;
|
||||
}
|
||||
// A finished phase takes over its build's progress row, in place.
|
||||
if (TASK_EVENTS.has(entry.event) && builds.has(launch)) {
|
||||
const row = builds.get(launch);
|
||||
builds.delete(launch);
|
||||
row.label = label;
|
||||
row.points = Math.max(points, row.points);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (points > 0) rows.push({ label, points });
|
||||
}
|
||||
@@ -169,7 +247,7 @@ export function breakdownFrom(entries) {
|
||||
const where = WORKFLOW_NAMES[workflow] ? ` in ${WORKFLOW_NAMES[workflow]}` : "";
|
||||
row.label = `${count} ${count === 1 ? "answer" : "answers"}${where}`;
|
||||
}
|
||||
return rows.filter((row) => row.points > 0);
|
||||
return rows.filter((row) => row.points > 0).map(({ label, points }) => ({ label, points }));
|
||||
}
|
||||
|
||||
/** The session's points, folded from ledger entries in order. */
|
||||
|
||||
@@ -60,7 +60,9 @@ The first payload for a phase you are about to build:
|
||||
```
|
||||
|
||||
`headline.cleared` / `total` are tasks done out of tasks in the phase: the
|
||||
progress bar is the first thing someone watching a build looks at.
|
||||
progress bar is the first thing someone watching a build looks at. The session
|
||||
meter counts the build's tasks from `cleared` as it rises, so keep it current,
|
||||
and start every phase (a second one in the same run too) at `"cleared": 0`.
|
||||
|
||||
`phasefile` is the whole `phase-X.md`, verbatim from disk, as its own tab —
|
||||
the person can read the prerequisites and task specs while you build. Re-post
|
||||
@@ -233,8 +235,9 @@ sign-off card, and approving past it was the answer. `implement-review` ends
|
||||
the same way; that phase was reviewed already. Only a finished `quick-task`
|
||||
still offers the review on its finish — see below.
|
||||
|
||||
`run` scores the approved phase on the session meter (console.md → Posting an
|
||||
update → Session meter), in the same post that records the approval:
|
||||
`run` gives the approved phase its final score on the session meter (console.md →
|
||||
Posting an update → Session meter), in the same post that records the approval;
|
||||
it takes over what the build already counted from `cleared`, never adds to it:
|
||||
`implement-phase` for Implement, `implement-review-phase` for Implement +
|
||||
Review, id `phase-N`, and `tasks`: how many of the phase's tasks were
|
||||
completed (`[x]`, not blocked `[!]`). The phase scores by its size, so a
|
||||
@@ -392,7 +395,10 @@ a question still owed, above the ending itself:
|
||||
|
||||
The same build, then Stage 2 publishes the findings exactly as above (the
|
||||
`review` doc and the `fixes` item). Stage 3 fixes, with no "Check the fixes"
|
||||
item: Stage 4 is the only gate. Stage 4 is the sign-off above **without the
|
||||
item: Stage 4 is the only gate. The post that starts Stage 2's review carries
|
||||
`"run": { "event": "review", "id": "review" }`, as above: in this workflow it
|
||||
scores the review stage's 1 point on the meter as it begins, and the phase's
|
||||
final `run` leaves that point out. Stage 4 is the sign-off above **without the
|
||||
review verdict** — the phase was already reviewed — with the review results
|
||||
and unresolved findings in the report doc, header "Reviewed and ready for
|
||||
sign-off" in the item's `body`. The finish never carries `review`, and its
|
||||
|
||||
@@ -901,7 +901,9 @@ Per-unit work is yours to report, with `run` in any post:
|
||||
not count), a whole number from 1 to 999. A built phase scores by its size,
|
||||
one point per 3 tasks rounded up, and Implement + Review one more for the
|
||||
review. Always send it: without it a phase scores a flat 2 (or 3), however
|
||||
big it was. On any other event it is exit `3`.
|
||||
big it was. On any other event it is exit `3`. The console already counts a
|
||||
build's tasks from `headline.cleared` as they are ticked off; the phase's
|
||||
`run` takes that count over with the final score, so it never counts twice.
|
||||
- One `run` per post. Which events a workflow reports is in its own notes
|
||||
(Workflow notes → Pathfinder; `building.md` for Implement and for the
|
||||
review run on the page after a build).
|
||||
|
||||
@@ -90,7 +90,7 @@ import {
|
||||
writeJsonAtomic,
|
||||
writeWorkspaceCursor,
|
||||
} from "./lib.mjs";
|
||||
import { RUN_EVENTS, TASK_EVENTS, MAX_TASKS, isTaskCount } from "./public/meter.js";
|
||||
import { RUN_EVENTS, TASK_EVENTS, MAX_TASKS, isTaskCount, progressEntry } from "./public/meter.js";
|
||||
import { changeLine } from "./public/workspace.js";
|
||||
|
||||
// Mirrors the server's absolute lifetime cap: a handle older than this cannot
|
||||
@@ -593,6 +593,13 @@ function cmdPost() {
|
||||
const next = written.state;
|
||||
|
||||
for (const line of ledgerLines) appendLedger(dir, line);
|
||||
// A build scores its tasks as it clears them (meter.js, PROGRESS_WORKFLOWS),
|
||||
// after any `run` in the same post, so a phase finished here ends its count.
|
||||
if (patch.headline && typeof patch.headline === "object") {
|
||||
const ledger = readLedger(dir);
|
||||
const progress = progressEntry(ledger, lastLaunchId(ledger), next.workflow, patch.headline.cleared);
|
||||
if (progress) appendLedger(dir, progress);
|
||||
}
|
||||
appendEvent(dir, { type: "post", items: (patch.items || []).length });
|
||||
|
||||
const open = next.items.filter((i) => isOpen(i) && i.required !== false).length;
|
||||
|
||||
@@ -1096,6 +1096,14 @@ h1 {
|
||||
.ask-disabled-note.is-limit, .ask-disabled-note.is-waiting { color: var(--ink-2); background: var(--panel-2); border: 1px solid var(--rule); }
|
||||
.ask-disabled-note.is-offline { color: var(--warn); background: var(--warn-soft); border: 1px solid var(--warn); }
|
||||
|
||||
/* Waiting on Plan2Code (an Ask answer, or answers sent from Questions):
|
||||
the tiny ring, left of the label. */
|
||||
.view-tab .tab-spin {
|
||||
display: inline-block;
|
||||
margin-right: 6px;
|
||||
vertical-align: -1px;
|
||||
}
|
||||
|
||||
/* A reply landed while another tab was open. */
|
||||
.view-tab .tab-dot {
|
||||
display: inline-block;
|
||||
@@ -3144,11 +3152,6 @@ a.icon-btn { box-sizing: border-box; text-decoration: none; }
|
||||
0%, 15%, 75%, 100% { transform: scale(1); opacity: 0.16; }
|
||||
45% { transform: scale(0.7); opacity: 0.08; }
|
||||
}
|
||||
.pose .fz-halo { opacity: 0.25; animation: fz-halo 1.6s ease-in-out infinite; }
|
||||
@keyframes fz-halo {
|
||||
0%, 100% { transform: scale(1); opacity: 0.2; }
|
||||
45% { transform: scale(1.3); opacity: 0.4; }
|
||||
}
|
||||
.pose .fz-tick { stroke: var(--accent-ink); }
|
||||
.pose .fz-flag { transform-origin: 0% 50%; animation: fz-wave 1.2s ease-in-out infinite; }
|
||||
@keyframes fz-wave {
|
||||
|
||||
@@ -1825,8 +1825,11 @@ function renderBriefButton() {
|
||||
function renderViews() {
|
||||
const nav = $("views");
|
||||
nav.replaceChildren();
|
||||
// Sent and not yet picked up: the same ring as Ask, until Plan2Code moves on
|
||||
// or goes quiet (a turning ring would pass a dead session for a slow one).
|
||||
const sentBusy = pendingResult && !gone && !agentAdrift();
|
||||
const tabs = [
|
||||
{ id: "questions", label: isDashboard() ? "Dashboard" : "Questions", count: myTurn().length },
|
||||
{ id: "questions", label: isDashboard() ? "Dashboard" : "Questions", count: myTurn().length, busy: sentBusy },
|
||||
];
|
||||
// Built in rather than posted: present exactly while the spec in view has
|
||||
// an overview.md. A tab that vanishes under the person sends them home.
|
||||
@@ -1835,11 +1838,21 @@ function renderViews() {
|
||||
else if (view === "overview") view = "questions";
|
||||
for (const d of docs()) tabs.push({ id: "doc:" + d.id, label: d.title || "Document", count: 0 });
|
||||
// Always last, on every workflow and after a finish: the Quick question chat.
|
||||
tabs.push({ id: "ask", label: "Ask", count: 0, dot: chatDot });
|
||||
// The ring left of "Ask" shows exactly when the conversation's own ring does:
|
||||
// a question the agent picked up and has not answered yet.
|
||||
const ask = askState();
|
||||
const askBusy = ask.view.rows.some((r) => r.working) && ask.send.state !== "offline" && !agentAdrift();
|
||||
tabs.push({ id: "ask", label: "Ask", count: 0, dot: chatDot, busy: askBusy });
|
||||
|
||||
for (const t of tabs) {
|
||||
const b = el("button", "view-tab", t.label);
|
||||
b.type = "button";
|
||||
if (t.busy) {
|
||||
const spin = el("span", "spinner tiny tab-spin");
|
||||
spin.setAttribute("aria-hidden", "true");
|
||||
b.prepend(spin);
|
||||
b.title = t.id === "ask" ? "Plan2Code is working on an answer" : "Sent. Waiting for Plan2Code";
|
||||
}
|
||||
b.setAttribute("aria-current", String(view === t.id || (t.id === "questions" && view === "end")));
|
||||
if (t.count) {
|
||||
const c = el("span", "tab-count", String(t.count));
|
||||
|
||||
@@ -405,7 +405,7 @@
|
||||
</svg>
|
||||
|
||||
<!-- 4 Finalize: hopping for joy, both arms up, beside the checkmark
|
||||
flag, confetti drifting down and his star glowing. -->
|
||||
flag, confetti drifting down. -->
|
||||
<svg class="pose pose-finalize" data-pose="finalize" viewBox="0 4 240 216" aria-hidden="true" focusable="false">
|
||||
<ellipse class="shadow fz-shadow" cx="120" cy="198" rx="34" ry="5" />
|
||||
<g class="fz-hop">
|
||||
@@ -415,7 +415,6 @@
|
||||
<rect class="sh" x="80" y="72" width="80" height="108" rx="16" />
|
||||
<path class="ln" d="M80 116 L60 90" /><circle class="fl" cx="60" cy="90" r="5.5" />
|
||||
<path class="ln" d="M160 116 L180 90" /><circle class="fl" cx="180" cy="90" r="5.5" />
|
||||
<circle class="ac fz-halo" cx="120" cy="98" r="23" />
|
||||
<path class="ey blink" d="M120 84 L123.64 92.98 L133.31 93.67 L125.9 99.92 L128.23 109.33 L120 104.2 L111.77 109.33 L114.1 99.92 L106.69 93.67 L116.36 92.98 Z" />
|
||||
<path class="ey" d="M106 118 Q120 134 134 118 Z" />
|
||||
</g>
|
||||
|
||||
@@ -53,16 +53,55 @@ export const TASK_EVENTS = Object.freeze(new Set(Object.keys(TASK_BONUS)));
|
||||
// The most tasks one run may report: past this it is a typo, not a phase.
|
||||
export const MAX_TASKS = 999;
|
||||
|
||||
// A build scores while it runs, not only once it is approved: console.mjs
|
||||
// writes a `progress` ledger entry whenever a build's `headline.cleared`
|
||||
// rises, and the build's row scores those tasks at TASKS_PER_POINT with no
|
||||
// bonus. The phase's `run` then takes the row over with its final score, so
|
||||
// the total only ever climbs. Workflows whose headline counts tasks:
|
||||
export const PROGRESS_WORKFLOWS = Object.freeze(new Set(["implement", "implement-review"]));
|
||||
|
||||
// Implement + Review reviews every phase as a stage of the build. A `review`
|
||||
// run inside it is that stage, so it scores the phase's TASK_BONUS when it
|
||||
// starts, and the phase's own run leaves the bonus out after it.
|
||||
const BUILT_IN_REVIEW = Object.freeze({ "implement-review": "implement-review-phase" });
|
||||
|
||||
/**
|
||||
* The ledger entry a build's progress post stands for, or null when it adds
|
||||
* nothing: not a task-counting workflow, no whole `cleared`, or no more tasks
|
||||
* than this build already has. `seg` is how many phases this skill run has
|
||||
* finished, so a second phase in the same run starts its own count, but only
|
||||
* once its headline is back at 0: until then a `cleared` is the finished
|
||||
* phase's, posted again, and opening a build on it would count it twice.
|
||||
*/
|
||||
export function progressEntry(entries, launch, workflow, cleared) {
|
||||
if (!PROGRESS_WORKFLOWS.has(workflow)) return null;
|
||||
if (cleared !== 0 && !isTaskCount(cleared)) return null;
|
||||
const list = Array.isArray(entries) ? entries : [];
|
||||
const seg = list.filter((e) => e && e.kind === "run" && TASK_EVENTS.has(e.event) && launchOf(e.id) === launch).length;
|
||||
const build = `${launch}:b${seg}`;
|
||||
const mine = list.filter((e) => e && e.kind === "progress" && e.build === build);
|
||||
const entry = (tasks) => ({ kind: "progress", id: `${build}:${tasks}`, build, workflow, tasks });
|
||||
if (cleared === 0) return seg > 0 && !mine.length ? entry(0) : null;
|
||||
if (seg > 0 && !mine.length) return null;
|
||||
const most = mine.reduce((n, e) => Math.max(n, e.tasks), 0);
|
||||
return cleared > most ? entry(cleared) : null;
|
||||
}
|
||||
|
||||
/** A valid `run.tasks`: a whole number from 1 to MAX_TASKS. */
|
||||
export function isTaskCount(tasks) {
|
||||
return Number.isInteger(tasks) && tasks >= 1 && tasks <= MAX_TASKS;
|
||||
}
|
||||
|
||||
/** What one `run` scores, from its event and (for a built phase) its tasks. */
|
||||
export function runPoints(event, tasks) {
|
||||
/**
|
||||
* What one `run` scores, from its event and (for a built phase) its tasks.
|
||||
* `bonus: false` leaves the review bonus out, for a phase whose review
|
||||
* already scored.
|
||||
*/
|
||||
export function runPoints(event, tasks, { bonus = true } = {}) {
|
||||
if (TASK_EVENTS.has(event) && isTaskCount(tasks)) {
|
||||
return Math.ceil(tasks / TASKS_PER_POINT) + TASK_BONUS[event];
|
||||
return Math.ceil(tasks / TASKS_PER_POINT) + (bonus ? TASK_BONUS[event] : 0);
|
||||
}
|
||||
if (TASK_EVENTS.has(event) && !bonus) return weightOf(event) - TASK_BONUS[event];
|
||||
return weightOf(event);
|
||||
}
|
||||
|
||||
@@ -133,6 +172,8 @@ export function breakdownFrom(entries) {
|
||||
const seen = new Set();
|
||||
const rows = [];
|
||||
const answers = new Map(); // launch id -> { row, count, workflow }
|
||||
const builds = new Map(); // launch id -> the row of the build in progress
|
||||
const reviewed = new Set(); // launch ids whose built-in review has scored
|
||||
for (const entry of Array.isArray(entries) ? entries : []) {
|
||||
if (!entry || typeof entry !== "object") continue;
|
||||
if (entry.id !== undefined) {
|
||||
@@ -150,17 +191,54 @@ export function breakdownFrom(entries) {
|
||||
tally.count += 1;
|
||||
continue;
|
||||
}
|
||||
if (entry.kind === "progress") {
|
||||
if (!isTaskCount(entry.tasks)) continue;
|
||||
const launch = launchOf(entry.id);
|
||||
let row = builds.get(launch);
|
||||
if (!row || row.build !== entry.build) {
|
||||
row = { label: "", points: 0, build: entry.build, tasks: 0 };
|
||||
builds.set(launch, row);
|
||||
rows.push(row);
|
||||
}
|
||||
if (entry.tasks > row.tasks) {
|
||||
row.tasks = entry.tasks;
|
||||
row.points = Math.ceil(entry.tasks / TASKS_PER_POINT);
|
||||
const where = WORKFLOW_NAMES[entry.workflow] || "Build";
|
||||
row.label = `${where}: ${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"} built so far`;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
let points = 0;
|
||||
let label = "";
|
||||
if (entry.kind === "launch" && LAUNCH_COUNTED.has(entry.workflow)) {
|
||||
points = weightOf(entry.workflow);
|
||||
label = LAUNCH_LABELS[entry.workflow] || entry.workflow;
|
||||
} else if (entry.kind === "run") {
|
||||
points = runPoints(entry.event, entry.tasks);
|
||||
const unit = unitOf(entry.id);
|
||||
const counted = TASK_EVENTS.has(entry.event) && isTaskCount(entry.tasks);
|
||||
const size = counted ? ` (${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"})` : "";
|
||||
label = (RUN_LABELS[entry.event] || entry.event) + (unit ? `: ${unit}` : "") + size;
|
||||
const launch = launchOf(entry.id);
|
||||
const builtIn = BUILT_IN_REVIEW[entry.workflow];
|
||||
if (entry.event === "review" && builtIn) {
|
||||
// The review stage of Implement + Review: it scores the bonus its
|
||||
// phase would otherwise carry, once per skill run.
|
||||
if (reviewed.has(launch)) continue;
|
||||
reviewed.add(launch);
|
||||
points = TASK_BONUS[builtIn];
|
||||
label = `${WORKFLOW_NAMES[entry.workflow]}: code review run`;
|
||||
} else {
|
||||
const bonus = !(TASK_EVENTS.has(entry.event) && reviewed.has(launch));
|
||||
points = runPoints(entry.event, entry.tasks, { bonus });
|
||||
const unit = unitOf(entry.id);
|
||||
const counted = TASK_EVENTS.has(entry.event) && isTaskCount(entry.tasks);
|
||||
const size = counted ? ` (${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"})` : "";
|
||||
label = (RUN_LABELS[entry.event] || entry.event) + (unit && unit !== entry.event ? `: ${unit}` : "") + size;
|
||||
}
|
||||
// A finished phase takes over its build's progress row, in place.
|
||||
if (TASK_EVENTS.has(entry.event) && builds.has(launch)) {
|
||||
const row = builds.get(launch);
|
||||
builds.delete(launch);
|
||||
row.label = label;
|
||||
row.points = Math.max(points, row.points);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (points > 0) rows.push({ label, points });
|
||||
}
|
||||
@@ -169,7 +247,7 @@ export function breakdownFrom(entries) {
|
||||
const where = WORKFLOW_NAMES[workflow] ? ` in ${WORKFLOW_NAMES[workflow]}` : "";
|
||||
row.label = `${count} ${count === 1 ? "answer" : "answers"}${where}`;
|
||||
}
|
||||
return rows.filter((row) => row.points > 0);
|
||||
return rows.filter((row) => row.points > 0).map(({ label, points }) => ({ label, points }));
|
||||
}
|
||||
|
||||
/** The session's points, folded from ledger entries in order. */
|
||||
|
||||
@@ -60,7 +60,9 @@ The first payload for a phase you are about to build:
|
||||
```
|
||||
|
||||
`headline.cleared` / `total` are tasks done out of tasks in the phase: the
|
||||
progress bar is the first thing someone watching a build looks at.
|
||||
progress bar is the first thing someone watching a build looks at. The session
|
||||
meter counts the build's tasks from `cleared` as it rises, so keep it current,
|
||||
and start every phase (a second one in the same run too) at `"cleared": 0`.
|
||||
|
||||
`phasefile` is the whole `phase-X.md`, verbatim from disk, as its own tab —
|
||||
the person can read the prerequisites and task specs while you build. Re-post
|
||||
@@ -233,8 +235,9 @@ sign-off card, and approving past it was the answer. `implement-review` ends
|
||||
the same way; that phase was reviewed already. Only a finished `quick-task`
|
||||
still offers the review on its finish — see below.
|
||||
|
||||
`run` scores the approved phase on the session meter (console.md → Posting an
|
||||
update → Session meter), in the same post that records the approval:
|
||||
`run` gives the approved phase its final score on the session meter (console.md →
|
||||
Posting an update → Session meter), in the same post that records the approval;
|
||||
it takes over what the build already counted from `cleared`, never adds to it:
|
||||
`implement-phase` for Implement, `implement-review-phase` for Implement +
|
||||
Review, id `phase-N`, and `tasks`: how many of the phase's tasks were
|
||||
completed (`[x]`, not blocked `[!]`). The phase scores by its size, so a
|
||||
@@ -392,7 +395,10 @@ a question still owed, above the ending itself:
|
||||
|
||||
The same build, then Stage 2 publishes the findings exactly as above (the
|
||||
`review` doc and the `fixes` item). Stage 3 fixes, with no "Check the fixes"
|
||||
item: Stage 4 is the only gate. Stage 4 is the sign-off above **without the
|
||||
item: Stage 4 is the only gate. The post that starts Stage 2's review carries
|
||||
`"run": { "event": "review", "id": "review" }`, as above: in this workflow it
|
||||
scores the review stage's 1 point on the meter as it begins, and the phase's
|
||||
final `run` leaves that point out. Stage 4 is the sign-off above **without the
|
||||
review verdict** — the phase was already reviewed — with the review results
|
||||
and unresolved findings in the report doc, header "Reviewed and ready for
|
||||
sign-off" in the item's `body`. The finish never carries `review`, and its
|
||||
|
||||
@@ -901,7 +901,9 @@ Per-unit work is yours to report, with `run` in any post:
|
||||
not count), a whole number from 1 to 999. A built phase scores by its size,
|
||||
one point per 3 tasks rounded up, and Implement + Review one more for the
|
||||
review. Always send it: without it a phase scores a flat 2 (or 3), however
|
||||
big it was. On any other event it is exit `3`.
|
||||
big it was. On any other event it is exit `3`. The console already counts a
|
||||
build's tasks from `headline.cleared` as they are ticked off; the phase's
|
||||
`run` takes that count over with the final score, so it never counts twice.
|
||||
- One `run` per post. Which events a workflow reports is in its own notes
|
||||
(Workflow notes → Pathfinder; `building.md` for Implement and for the
|
||||
review run on the page after a build).
|
||||
|
||||
@@ -90,7 +90,7 @@ import {
|
||||
writeJsonAtomic,
|
||||
writeWorkspaceCursor,
|
||||
} from "./lib.mjs";
|
||||
import { RUN_EVENTS, TASK_EVENTS, MAX_TASKS, isTaskCount } from "./public/meter.js";
|
||||
import { RUN_EVENTS, TASK_EVENTS, MAX_TASKS, isTaskCount, progressEntry } from "./public/meter.js";
|
||||
import { changeLine } from "./public/workspace.js";
|
||||
|
||||
// Mirrors the server's absolute lifetime cap: a handle older than this cannot
|
||||
@@ -593,6 +593,13 @@ function cmdPost() {
|
||||
const next = written.state;
|
||||
|
||||
for (const line of ledgerLines) appendLedger(dir, line);
|
||||
// A build scores its tasks as it clears them (meter.js, PROGRESS_WORKFLOWS),
|
||||
// after any `run` in the same post, so a phase finished here ends its count.
|
||||
if (patch.headline && typeof patch.headline === "object") {
|
||||
const ledger = readLedger(dir);
|
||||
const progress = progressEntry(ledger, lastLaunchId(ledger), next.workflow, patch.headline.cleared);
|
||||
if (progress) appendLedger(dir, progress);
|
||||
}
|
||||
appendEvent(dir, { type: "post", items: (patch.items || []).length });
|
||||
|
||||
const open = next.items.filter((i) => isOpen(i) && i.required !== false).length;
|
||||
|
||||
@@ -1096,6 +1096,14 @@ h1 {
|
||||
.ask-disabled-note.is-limit, .ask-disabled-note.is-waiting { color: var(--ink-2); background: var(--panel-2); border: 1px solid var(--rule); }
|
||||
.ask-disabled-note.is-offline { color: var(--warn); background: var(--warn-soft); border: 1px solid var(--warn); }
|
||||
|
||||
/* Waiting on Plan2Code (an Ask answer, or answers sent from Questions):
|
||||
the tiny ring, left of the label. */
|
||||
.view-tab .tab-spin {
|
||||
display: inline-block;
|
||||
margin-right: 6px;
|
||||
vertical-align: -1px;
|
||||
}
|
||||
|
||||
/* A reply landed while another tab was open. */
|
||||
.view-tab .tab-dot {
|
||||
display: inline-block;
|
||||
@@ -3144,11 +3152,6 @@ a.icon-btn { box-sizing: border-box; text-decoration: none; }
|
||||
0%, 15%, 75%, 100% { transform: scale(1); opacity: 0.16; }
|
||||
45% { transform: scale(0.7); opacity: 0.08; }
|
||||
}
|
||||
.pose .fz-halo { opacity: 0.25; animation: fz-halo 1.6s ease-in-out infinite; }
|
||||
@keyframes fz-halo {
|
||||
0%, 100% { transform: scale(1); opacity: 0.2; }
|
||||
45% { transform: scale(1.3); opacity: 0.4; }
|
||||
}
|
||||
.pose .fz-tick { stroke: var(--accent-ink); }
|
||||
.pose .fz-flag { transform-origin: 0% 50%; animation: fz-wave 1.2s ease-in-out infinite; }
|
||||
@keyframes fz-wave {
|
||||
|
||||
@@ -1825,8 +1825,11 @@ function renderBriefButton() {
|
||||
function renderViews() {
|
||||
const nav = $("views");
|
||||
nav.replaceChildren();
|
||||
// Sent and not yet picked up: the same ring as Ask, until Plan2Code moves on
|
||||
// or goes quiet (a turning ring would pass a dead session for a slow one).
|
||||
const sentBusy = pendingResult && !gone && !agentAdrift();
|
||||
const tabs = [
|
||||
{ id: "questions", label: isDashboard() ? "Dashboard" : "Questions", count: myTurn().length },
|
||||
{ id: "questions", label: isDashboard() ? "Dashboard" : "Questions", count: myTurn().length, busy: sentBusy },
|
||||
];
|
||||
// Built in rather than posted: present exactly while the spec in view has
|
||||
// an overview.md. A tab that vanishes under the person sends them home.
|
||||
@@ -1835,11 +1838,21 @@ function renderViews() {
|
||||
else if (view === "overview") view = "questions";
|
||||
for (const d of docs()) tabs.push({ id: "doc:" + d.id, label: d.title || "Document", count: 0 });
|
||||
// Always last, on every workflow and after a finish: the Quick question chat.
|
||||
tabs.push({ id: "ask", label: "Ask", count: 0, dot: chatDot });
|
||||
// The ring left of "Ask" shows exactly when the conversation's own ring does:
|
||||
// a question the agent picked up and has not answered yet.
|
||||
const ask = askState();
|
||||
const askBusy = ask.view.rows.some((r) => r.working) && ask.send.state !== "offline" && !agentAdrift();
|
||||
tabs.push({ id: "ask", label: "Ask", count: 0, dot: chatDot, busy: askBusy });
|
||||
|
||||
for (const t of tabs) {
|
||||
const b = el("button", "view-tab", t.label);
|
||||
b.type = "button";
|
||||
if (t.busy) {
|
||||
const spin = el("span", "spinner tiny tab-spin");
|
||||
spin.setAttribute("aria-hidden", "true");
|
||||
b.prepend(spin);
|
||||
b.title = t.id === "ask" ? "Plan2Code is working on an answer" : "Sent. Waiting for Plan2Code";
|
||||
}
|
||||
b.setAttribute("aria-current", String(view === t.id || (t.id === "questions" && view === "end")));
|
||||
if (t.count) {
|
||||
const c = el("span", "tab-count", String(t.count));
|
||||
|
||||
@@ -405,7 +405,7 @@
|
||||
</svg>
|
||||
|
||||
<!-- 4 Finalize: hopping for joy, both arms up, beside the checkmark
|
||||
flag, confetti drifting down and his star glowing. -->
|
||||
flag, confetti drifting down. -->
|
||||
<svg class="pose pose-finalize" data-pose="finalize" viewBox="0 4 240 216" aria-hidden="true" focusable="false">
|
||||
<ellipse class="shadow fz-shadow" cx="120" cy="198" rx="34" ry="5" />
|
||||
<g class="fz-hop">
|
||||
@@ -415,7 +415,6 @@
|
||||
<rect class="sh" x="80" y="72" width="80" height="108" rx="16" />
|
||||
<path class="ln" d="M80 116 L60 90" /><circle class="fl" cx="60" cy="90" r="5.5" />
|
||||
<path class="ln" d="M160 116 L180 90" /><circle class="fl" cx="180" cy="90" r="5.5" />
|
||||
<circle class="ac fz-halo" cx="120" cy="98" r="23" />
|
||||
<path class="ey blink" d="M120 84 L123.64 92.98 L133.31 93.67 L125.9 99.92 L128.23 109.33 L120 104.2 L111.77 109.33 L114.1 99.92 L106.69 93.67 L116.36 92.98 Z" />
|
||||
<path class="ey" d="M106 118 Q120 134 134 118 Z" />
|
||||
</g>
|
||||
|
||||
@@ -53,16 +53,55 @@ export const TASK_EVENTS = Object.freeze(new Set(Object.keys(TASK_BONUS)));
|
||||
// The most tasks one run may report: past this it is a typo, not a phase.
|
||||
export const MAX_TASKS = 999;
|
||||
|
||||
// A build scores while it runs, not only once it is approved: console.mjs
|
||||
// writes a `progress` ledger entry whenever a build's `headline.cleared`
|
||||
// rises, and the build's row scores those tasks at TASKS_PER_POINT with no
|
||||
// bonus. The phase's `run` then takes the row over with its final score, so
|
||||
// the total only ever climbs. Workflows whose headline counts tasks:
|
||||
export const PROGRESS_WORKFLOWS = Object.freeze(new Set(["implement", "implement-review"]));
|
||||
|
||||
// Implement + Review reviews every phase as a stage of the build. A `review`
|
||||
// run inside it is that stage, so it scores the phase's TASK_BONUS when it
|
||||
// starts, and the phase's own run leaves the bonus out after it.
|
||||
const BUILT_IN_REVIEW = Object.freeze({ "implement-review": "implement-review-phase" });
|
||||
|
||||
/**
|
||||
* The ledger entry a build's progress post stands for, or null when it adds
|
||||
* nothing: not a task-counting workflow, no whole `cleared`, or no more tasks
|
||||
* than this build already has. `seg` is how many phases this skill run has
|
||||
* finished, so a second phase in the same run starts its own count, but only
|
||||
* once its headline is back at 0: until then a `cleared` is the finished
|
||||
* phase's, posted again, and opening a build on it would count it twice.
|
||||
*/
|
||||
export function progressEntry(entries, launch, workflow, cleared) {
|
||||
if (!PROGRESS_WORKFLOWS.has(workflow)) return null;
|
||||
if (cleared !== 0 && !isTaskCount(cleared)) return null;
|
||||
const list = Array.isArray(entries) ? entries : [];
|
||||
const seg = list.filter((e) => e && e.kind === "run" && TASK_EVENTS.has(e.event) && launchOf(e.id) === launch).length;
|
||||
const build = `${launch}:b${seg}`;
|
||||
const mine = list.filter((e) => e && e.kind === "progress" && e.build === build);
|
||||
const entry = (tasks) => ({ kind: "progress", id: `${build}:${tasks}`, build, workflow, tasks });
|
||||
if (cleared === 0) return seg > 0 && !mine.length ? entry(0) : null;
|
||||
if (seg > 0 && !mine.length) return null;
|
||||
const most = mine.reduce((n, e) => Math.max(n, e.tasks), 0);
|
||||
return cleared > most ? entry(cleared) : null;
|
||||
}
|
||||
|
||||
/** A valid `run.tasks`: a whole number from 1 to MAX_TASKS. */
|
||||
export function isTaskCount(tasks) {
|
||||
return Number.isInteger(tasks) && tasks >= 1 && tasks <= MAX_TASKS;
|
||||
}
|
||||
|
||||
/** What one `run` scores, from its event and (for a built phase) its tasks. */
|
||||
export function runPoints(event, tasks) {
|
||||
/**
|
||||
* What one `run` scores, from its event and (for a built phase) its tasks.
|
||||
* `bonus: false` leaves the review bonus out, for a phase whose review
|
||||
* already scored.
|
||||
*/
|
||||
export function runPoints(event, tasks, { bonus = true } = {}) {
|
||||
if (TASK_EVENTS.has(event) && isTaskCount(tasks)) {
|
||||
return Math.ceil(tasks / TASKS_PER_POINT) + TASK_BONUS[event];
|
||||
return Math.ceil(tasks / TASKS_PER_POINT) + (bonus ? TASK_BONUS[event] : 0);
|
||||
}
|
||||
if (TASK_EVENTS.has(event) && !bonus) return weightOf(event) - TASK_BONUS[event];
|
||||
return weightOf(event);
|
||||
}
|
||||
|
||||
@@ -133,6 +172,8 @@ export function breakdownFrom(entries) {
|
||||
const seen = new Set();
|
||||
const rows = [];
|
||||
const answers = new Map(); // launch id -> { row, count, workflow }
|
||||
const builds = new Map(); // launch id -> the row of the build in progress
|
||||
const reviewed = new Set(); // launch ids whose built-in review has scored
|
||||
for (const entry of Array.isArray(entries) ? entries : []) {
|
||||
if (!entry || typeof entry !== "object") continue;
|
||||
if (entry.id !== undefined) {
|
||||
@@ -150,17 +191,54 @@ export function breakdownFrom(entries) {
|
||||
tally.count += 1;
|
||||
continue;
|
||||
}
|
||||
if (entry.kind === "progress") {
|
||||
if (!isTaskCount(entry.tasks)) continue;
|
||||
const launch = launchOf(entry.id);
|
||||
let row = builds.get(launch);
|
||||
if (!row || row.build !== entry.build) {
|
||||
row = { label: "", points: 0, build: entry.build, tasks: 0 };
|
||||
builds.set(launch, row);
|
||||
rows.push(row);
|
||||
}
|
||||
if (entry.tasks > row.tasks) {
|
||||
row.tasks = entry.tasks;
|
||||
row.points = Math.ceil(entry.tasks / TASKS_PER_POINT);
|
||||
const where = WORKFLOW_NAMES[entry.workflow] || "Build";
|
||||
row.label = `${where}: ${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"} built so far`;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
let points = 0;
|
||||
let label = "";
|
||||
if (entry.kind === "launch" && LAUNCH_COUNTED.has(entry.workflow)) {
|
||||
points = weightOf(entry.workflow);
|
||||
label = LAUNCH_LABELS[entry.workflow] || entry.workflow;
|
||||
} else if (entry.kind === "run") {
|
||||
points = runPoints(entry.event, entry.tasks);
|
||||
const unit = unitOf(entry.id);
|
||||
const counted = TASK_EVENTS.has(entry.event) && isTaskCount(entry.tasks);
|
||||
const size = counted ? ` (${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"})` : "";
|
||||
label = (RUN_LABELS[entry.event] || entry.event) + (unit ? `: ${unit}` : "") + size;
|
||||
const launch = launchOf(entry.id);
|
||||
const builtIn = BUILT_IN_REVIEW[entry.workflow];
|
||||
if (entry.event === "review" && builtIn) {
|
||||
// The review stage of Implement + Review: it scores the bonus its
|
||||
// phase would otherwise carry, once per skill run.
|
||||
if (reviewed.has(launch)) continue;
|
||||
reviewed.add(launch);
|
||||
points = TASK_BONUS[builtIn];
|
||||
label = `${WORKFLOW_NAMES[entry.workflow]}: code review run`;
|
||||
} else {
|
||||
const bonus = !(TASK_EVENTS.has(entry.event) && reviewed.has(launch));
|
||||
points = runPoints(entry.event, entry.tasks, { bonus });
|
||||
const unit = unitOf(entry.id);
|
||||
const counted = TASK_EVENTS.has(entry.event) && isTaskCount(entry.tasks);
|
||||
const size = counted ? ` (${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"})` : "";
|
||||
label = (RUN_LABELS[entry.event] || entry.event) + (unit && unit !== entry.event ? `: ${unit}` : "") + size;
|
||||
}
|
||||
// A finished phase takes over its build's progress row, in place.
|
||||
if (TASK_EVENTS.has(entry.event) && builds.has(launch)) {
|
||||
const row = builds.get(launch);
|
||||
builds.delete(launch);
|
||||
row.label = label;
|
||||
row.points = Math.max(points, row.points);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (points > 0) rows.push({ label, points });
|
||||
}
|
||||
@@ -169,7 +247,7 @@ export function breakdownFrom(entries) {
|
||||
const where = WORKFLOW_NAMES[workflow] ? ` in ${WORKFLOW_NAMES[workflow]}` : "";
|
||||
row.label = `${count} ${count === 1 ? "answer" : "answers"}${where}`;
|
||||
}
|
||||
return rows.filter((row) => row.points > 0);
|
||||
return rows.filter((row) => row.points > 0).map(({ label, points }) => ({ label, points }));
|
||||
}
|
||||
|
||||
/** The session's points, folded from ledger entries in order. */
|
||||
|
||||
@@ -60,7 +60,9 @@ The first payload for a phase you are about to build:
|
||||
```
|
||||
|
||||
`headline.cleared` / `total` are tasks done out of tasks in the phase: the
|
||||
progress bar is the first thing someone watching a build looks at.
|
||||
progress bar is the first thing someone watching a build looks at. The session
|
||||
meter counts the build's tasks from `cleared` as it rises, so keep it current,
|
||||
and start every phase (a second one in the same run too) at `"cleared": 0`.
|
||||
|
||||
`phasefile` is the whole `phase-X.md`, verbatim from disk, as its own tab —
|
||||
the person can read the prerequisites and task specs while you build. Re-post
|
||||
@@ -233,8 +235,9 @@ sign-off card, and approving past it was the answer. `implement-review` ends
|
||||
the same way; that phase was reviewed already. Only a finished `quick-task`
|
||||
still offers the review on its finish — see below.
|
||||
|
||||
`run` scores the approved phase on the session meter (console.md → Posting an
|
||||
update → Session meter), in the same post that records the approval:
|
||||
`run` gives the approved phase its final score on the session meter (console.md →
|
||||
Posting an update → Session meter), in the same post that records the approval;
|
||||
it takes over what the build already counted from `cleared`, never adds to it:
|
||||
`implement-phase` for Implement, `implement-review-phase` for Implement +
|
||||
Review, id `phase-N`, and `tasks`: how many of the phase's tasks were
|
||||
completed (`[x]`, not blocked `[!]`). The phase scores by its size, so a
|
||||
@@ -392,7 +395,10 @@ a question still owed, above the ending itself:
|
||||
|
||||
The same build, then Stage 2 publishes the findings exactly as above (the
|
||||
`review` doc and the `fixes` item). Stage 3 fixes, with no "Check the fixes"
|
||||
item: Stage 4 is the only gate. Stage 4 is the sign-off above **without the
|
||||
item: Stage 4 is the only gate. The post that starts Stage 2's review carries
|
||||
`"run": { "event": "review", "id": "review" }`, as above: in this workflow it
|
||||
scores the review stage's 1 point on the meter as it begins, and the phase's
|
||||
final `run` leaves that point out. Stage 4 is the sign-off above **without the
|
||||
review verdict** — the phase was already reviewed — with the review results
|
||||
and unresolved findings in the report doc, header "Reviewed and ready for
|
||||
sign-off" in the item's `body`. The finish never carries `review`, and its
|
||||
|
||||
@@ -901,7 +901,9 @@ Per-unit work is yours to report, with `run` in any post:
|
||||
not count), a whole number from 1 to 999. A built phase scores by its size,
|
||||
one point per 3 tasks rounded up, and Implement + Review one more for the
|
||||
review. Always send it: without it a phase scores a flat 2 (or 3), however
|
||||
big it was. On any other event it is exit `3`.
|
||||
big it was. On any other event it is exit `3`. The console already counts a
|
||||
build's tasks from `headline.cleared` as they are ticked off; the phase's
|
||||
`run` takes that count over with the final score, so it never counts twice.
|
||||
- One `run` per post. Which events a workflow reports is in its own notes
|
||||
(Workflow notes → Pathfinder; `building.md` for Implement and for the
|
||||
review run on the page after a build).
|
||||
|
||||
@@ -90,7 +90,7 @@ import {
|
||||
writeJsonAtomic,
|
||||
writeWorkspaceCursor,
|
||||
} from "./lib.mjs";
|
||||
import { RUN_EVENTS, TASK_EVENTS, MAX_TASKS, isTaskCount } from "./public/meter.js";
|
||||
import { RUN_EVENTS, TASK_EVENTS, MAX_TASKS, isTaskCount, progressEntry } from "./public/meter.js";
|
||||
import { changeLine } from "./public/workspace.js";
|
||||
|
||||
// Mirrors the server's absolute lifetime cap: a handle older than this cannot
|
||||
@@ -593,6 +593,13 @@ function cmdPost() {
|
||||
const next = written.state;
|
||||
|
||||
for (const line of ledgerLines) appendLedger(dir, line);
|
||||
// A build scores its tasks as it clears them (meter.js, PROGRESS_WORKFLOWS),
|
||||
// after any `run` in the same post, so a phase finished here ends its count.
|
||||
if (patch.headline && typeof patch.headline === "object") {
|
||||
const ledger = readLedger(dir);
|
||||
const progress = progressEntry(ledger, lastLaunchId(ledger), next.workflow, patch.headline.cleared);
|
||||
if (progress) appendLedger(dir, progress);
|
||||
}
|
||||
appendEvent(dir, { type: "post", items: (patch.items || []).length });
|
||||
|
||||
const open = next.items.filter((i) => isOpen(i) && i.required !== false).length;
|
||||
|
||||
@@ -1096,6 +1096,14 @@ h1 {
|
||||
.ask-disabled-note.is-limit, .ask-disabled-note.is-waiting { color: var(--ink-2); background: var(--panel-2); border: 1px solid var(--rule); }
|
||||
.ask-disabled-note.is-offline { color: var(--warn); background: var(--warn-soft); border: 1px solid var(--warn); }
|
||||
|
||||
/* Waiting on Plan2Code (an Ask answer, or answers sent from Questions):
|
||||
the tiny ring, left of the label. */
|
||||
.view-tab .tab-spin {
|
||||
display: inline-block;
|
||||
margin-right: 6px;
|
||||
vertical-align: -1px;
|
||||
}
|
||||
|
||||
/* A reply landed while another tab was open. */
|
||||
.view-tab .tab-dot {
|
||||
display: inline-block;
|
||||
@@ -3144,11 +3152,6 @@ a.icon-btn { box-sizing: border-box; text-decoration: none; }
|
||||
0%, 15%, 75%, 100% { transform: scale(1); opacity: 0.16; }
|
||||
45% { transform: scale(0.7); opacity: 0.08; }
|
||||
}
|
||||
.pose .fz-halo { opacity: 0.25; animation: fz-halo 1.6s ease-in-out infinite; }
|
||||
@keyframes fz-halo {
|
||||
0%, 100% { transform: scale(1); opacity: 0.2; }
|
||||
45% { transform: scale(1.3); opacity: 0.4; }
|
||||
}
|
||||
.pose .fz-tick { stroke: var(--accent-ink); }
|
||||
.pose .fz-flag { transform-origin: 0% 50%; animation: fz-wave 1.2s ease-in-out infinite; }
|
||||
@keyframes fz-wave {
|
||||
|
||||
@@ -1825,8 +1825,11 @@ function renderBriefButton() {
|
||||
function renderViews() {
|
||||
const nav = $("views");
|
||||
nav.replaceChildren();
|
||||
// Sent and not yet picked up: the same ring as Ask, until Plan2Code moves on
|
||||
// or goes quiet (a turning ring would pass a dead session for a slow one).
|
||||
const sentBusy = pendingResult && !gone && !agentAdrift();
|
||||
const tabs = [
|
||||
{ id: "questions", label: isDashboard() ? "Dashboard" : "Questions", count: myTurn().length },
|
||||
{ id: "questions", label: isDashboard() ? "Dashboard" : "Questions", count: myTurn().length, busy: sentBusy },
|
||||
];
|
||||
// Built in rather than posted: present exactly while the spec in view has
|
||||
// an overview.md. A tab that vanishes under the person sends them home.
|
||||
@@ -1835,11 +1838,21 @@ function renderViews() {
|
||||
else if (view === "overview") view = "questions";
|
||||
for (const d of docs()) tabs.push({ id: "doc:" + d.id, label: d.title || "Document", count: 0 });
|
||||
// Always last, on every workflow and after a finish: the Quick question chat.
|
||||
tabs.push({ id: "ask", label: "Ask", count: 0, dot: chatDot });
|
||||
// The ring left of "Ask" shows exactly when the conversation's own ring does:
|
||||
// a question the agent picked up and has not answered yet.
|
||||
const ask = askState();
|
||||
const askBusy = ask.view.rows.some((r) => r.working) && ask.send.state !== "offline" && !agentAdrift();
|
||||
tabs.push({ id: "ask", label: "Ask", count: 0, dot: chatDot, busy: askBusy });
|
||||
|
||||
for (const t of tabs) {
|
||||
const b = el("button", "view-tab", t.label);
|
||||
b.type = "button";
|
||||
if (t.busy) {
|
||||
const spin = el("span", "spinner tiny tab-spin");
|
||||
spin.setAttribute("aria-hidden", "true");
|
||||
b.prepend(spin);
|
||||
b.title = t.id === "ask" ? "Plan2Code is working on an answer" : "Sent. Waiting for Plan2Code";
|
||||
}
|
||||
b.setAttribute("aria-current", String(view === t.id || (t.id === "questions" && view === "end")));
|
||||
if (t.count) {
|
||||
const c = el("span", "tab-count", String(t.count));
|
||||
|
||||
@@ -405,7 +405,7 @@
|
||||
</svg>
|
||||
|
||||
<!-- 4 Finalize: hopping for joy, both arms up, beside the checkmark
|
||||
flag, confetti drifting down and his star glowing. -->
|
||||
flag, confetti drifting down. -->
|
||||
<svg class="pose pose-finalize" data-pose="finalize" viewBox="0 4 240 216" aria-hidden="true" focusable="false">
|
||||
<ellipse class="shadow fz-shadow" cx="120" cy="198" rx="34" ry="5" />
|
||||
<g class="fz-hop">
|
||||
@@ -415,7 +415,6 @@
|
||||
<rect class="sh" x="80" y="72" width="80" height="108" rx="16" />
|
||||
<path class="ln" d="M80 116 L60 90" /><circle class="fl" cx="60" cy="90" r="5.5" />
|
||||
<path class="ln" d="M160 116 L180 90" /><circle class="fl" cx="180" cy="90" r="5.5" />
|
||||
<circle class="ac fz-halo" cx="120" cy="98" r="23" />
|
||||
<path class="ey blink" d="M120 84 L123.64 92.98 L133.31 93.67 L125.9 99.92 L128.23 109.33 L120 104.2 L111.77 109.33 L114.1 99.92 L106.69 93.67 L116.36 92.98 Z" />
|
||||
<path class="ey" d="M106 118 Q120 134 134 118 Z" />
|
||||
</g>
|
||||
|
||||
@@ -53,16 +53,55 @@ export const TASK_EVENTS = Object.freeze(new Set(Object.keys(TASK_BONUS)));
|
||||
// The most tasks one run may report: past this it is a typo, not a phase.
|
||||
export const MAX_TASKS = 999;
|
||||
|
||||
// A build scores while it runs, not only once it is approved: console.mjs
|
||||
// writes a `progress` ledger entry whenever a build's `headline.cleared`
|
||||
// rises, and the build's row scores those tasks at TASKS_PER_POINT with no
|
||||
// bonus. The phase's `run` then takes the row over with its final score, so
|
||||
// the total only ever climbs. Workflows whose headline counts tasks:
|
||||
export const PROGRESS_WORKFLOWS = Object.freeze(new Set(["implement", "implement-review"]));
|
||||
|
||||
// Implement + Review reviews every phase as a stage of the build. A `review`
|
||||
// run inside it is that stage, so it scores the phase's TASK_BONUS when it
|
||||
// starts, and the phase's own run leaves the bonus out after it.
|
||||
const BUILT_IN_REVIEW = Object.freeze({ "implement-review": "implement-review-phase" });
|
||||
|
||||
/**
|
||||
* The ledger entry a build's progress post stands for, or null when it adds
|
||||
* nothing: not a task-counting workflow, no whole `cleared`, or no more tasks
|
||||
* than this build already has. `seg` is how many phases this skill run has
|
||||
* finished, so a second phase in the same run starts its own count, but only
|
||||
* once its headline is back at 0: until then a `cleared` is the finished
|
||||
* phase's, posted again, and opening a build on it would count it twice.
|
||||
*/
|
||||
export function progressEntry(entries, launch, workflow, cleared) {
|
||||
if (!PROGRESS_WORKFLOWS.has(workflow)) return null;
|
||||
if (cleared !== 0 && !isTaskCount(cleared)) return null;
|
||||
const list = Array.isArray(entries) ? entries : [];
|
||||
const seg = list.filter((e) => e && e.kind === "run" && TASK_EVENTS.has(e.event) && launchOf(e.id) === launch).length;
|
||||
const build = `${launch}:b${seg}`;
|
||||
const mine = list.filter((e) => e && e.kind === "progress" && e.build === build);
|
||||
const entry = (tasks) => ({ kind: "progress", id: `${build}:${tasks}`, build, workflow, tasks });
|
||||
if (cleared === 0) return seg > 0 && !mine.length ? entry(0) : null;
|
||||
if (seg > 0 && !mine.length) return null;
|
||||
const most = mine.reduce((n, e) => Math.max(n, e.tasks), 0);
|
||||
return cleared > most ? entry(cleared) : null;
|
||||
}
|
||||
|
||||
/** A valid `run.tasks`: a whole number from 1 to MAX_TASKS. */
|
||||
export function isTaskCount(tasks) {
|
||||
return Number.isInteger(tasks) && tasks >= 1 && tasks <= MAX_TASKS;
|
||||
}
|
||||
|
||||
/** What one `run` scores, from its event and (for a built phase) its tasks. */
|
||||
export function runPoints(event, tasks) {
|
||||
/**
|
||||
* What one `run` scores, from its event and (for a built phase) its tasks.
|
||||
* `bonus: false` leaves the review bonus out, for a phase whose review
|
||||
* already scored.
|
||||
*/
|
||||
export function runPoints(event, tasks, { bonus = true } = {}) {
|
||||
if (TASK_EVENTS.has(event) && isTaskCount(tasks)) {
|
||||
return Math.ceil(tasks / TASKS_PER_POINT) + TASK_BONUS[event];
|
||||
return Math.ceil(tasks / TASKS_PER_POINT) + (bonus ? TASK_BONUS[event] : 0);
|
||||
}
|
||||
if (TASK_EVENTS.has(event) && !bonus) return weightOf(event) - TASK_BONUS[event];
|
||||
return weightOf(event);
|
||||
}
|
||||
|
||||
@@ -133,6 +172,8 @@ export function breakdownFrom(entries) {
|
||||
const seen = new Set();
|
||||
const rows = [];
|
||||
const answers = new Map(); // launch id -> { row, count, workflow }
|
||||
const builds = new Map(); // launch id -> the row of the build in progress
|
||||
const reviewed = new Set(); // launch ids whose built-in review has scored
|
||||
for (const entry of Array.isArray(entries) ? entries : []) {
|
||||
if (!entry || typeof entry !== "object") continue;
|
||||
if (entry.id !== undefined) {
|
||||
@@ -150,17 +191,54 @@ export function breakdownFrom(entries) {
|
||||
tally.count += 1;
|
||||
continue;
|
||||
}
|
||||
if (entry.kind === "progress") {
|
||||
if (!isTaskCount(entry.tasks)) continue;
|
||||
const launch = launchOf(entry.id);
|
||||
let row = builds.get(launch);
|
||||
if (!row || row.build !== entry.build) {
|
||||
row = { label: "", points: 0, build: entry.build, tasks: 0 };
|
||||
builds.set(launch, row);
|
||||
rows.push(row);
|
||||
}
|
||||
if (entry.tasks > row.tasks) {
|
||||
row.tasks = entry.tasks;
|
||||
row.points = Math.ceil(entry.tasks / TASKS_PER_POINT);
|
||||
const where = WORKFLOW_NAMES[entry.workflow] || "Build";
|
||||
row.label = `${where}: ${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"} built so far`;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
let points = 0;
|
||||
let label = "";
|
||||
if (entry.kind === "launch" && LAUNCH_COUNTED.has(entry.workflow)) {
|
||||
points = weightOf(entry.workflow);
|
||||
label = LAUNCH_LABELS[entry.workflow] || entry.workflow;
|
||||
} else if (entry.kind === "run") {
|
||||
points = runPoints(entry.event, entry.tasks);
|
||||
const unit = unitOf(entry.id);
|
||||
const counted = TASK_EVENTS.has(entry.event) && isTaskCount(entry.tasks);
|
||||
const size = counted ? ` (${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"})` : "";
|
||||
label = (RUN_LABELS[entry.event] || entry.event) + (unit ? `: ${unit}` : "") + size;
|
||||
const launch = launchOf(entry.id);
|
||||
const builtIn = BUILT_IN_REVIEW[entry.workflow];
|
||||
if (entry.event === "review" && builtIn) {
|
||||
// The review stage of Implement + Review: it scores the bonus its
|
||||
// phase would otherwise carry, once per skill run.
|
||||
if (reviewed.has(launch)) continue;
|
||||
reviewed.add(launch);
|
||||
points = TASK_BONUS[builtIn];
|
||||
label = `${WORKFLOW_NAMES[entry.workflow]}: code review run`;
|
||||
} else {
|
||||
const bonus = !(TASK_EVENTS.has(entry.event) && reviewed.has(launch));
|
||||
points = runPoints(entry.event, entry.tasks, { bonus });
|
||||
const unit = unitOf(entry.id);
|
||||
const counted = TASK_EVENTS.has(entry.event) && isTaskCount(entry.tasks);
|
||||
const size = counted ? ` (${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"})` : "";
|
||||
label = (RUN_LABELS[entry.event] || entry.event) + (unit && unit !== entry.event ? `: ${unit}` : "") + size;
|
||||
}
|
||||
// A finished phase takes over its build's progress row, in place.
|
||||
if (TASK_EVENTS.has(entry.event) && builds.has(launch)) {
|
||||
const row = builds.get(launch);
|
||||
builds.delete(launch);
|
||||
row.label = label;
|
||||
row.points = Math.max(points, row.points);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (points > 0) rows.push({ label, points });
|
||||
}
|
||||
@@ -169,7 +247,7 @@ export function breakdownFrom(entries) {
|
||||
const where = WORKFLOW_NAMES[workflow] ? ` in ${WORKFLOW_NAMES[workflow]}` : "";
|
||||
row.label = `${count} ${count === 1 ? "answer" : "answers"}${where}`;
|
||||
}
|
||||
return rows.filter((row) => row.points > 0);
|
||||
return rows.filter((row) => row.points > 0).map(({ label, points }) => ({ label, points }));
|
||||
}
|
||||
|
||||
/** The session's points, folded from ledger entries in order. */
|
||||
|
||||
@@ -60,7 +60,9 @@ The first payload for a phase you are about to build:
|
||||
```
|
||||
|
||||
`headline.cleared` / `total` are tasks done out of tasks in the phase: the
|
||||
progress bar is the first thing someone watching a build looks at.
|
||||
progress bar is the first thing someone watching a build looks at. The session
|
||||
meter counts the build's tasks from `cleared` as it rises, so keep it current,
|
||||
and start every phase (a second one in the same run too) at `"cleared": 0`.
|
||||
|
||||
`phasefile` is the whole `phase-X.md`, verbatim from disk, as its own tab —
|
||||
the person can read the prerequisites and task specs while you build. Re-post
|
||||
@@ -233,8 +235,9 @@ sign-off card, and approving past it was the answer. `implement-review` ends
|
||||
the same way; that phase was reviewed already. Only a finished `quick-task`
|
||||
still offers the review on its finish — see below.
|
||||
|
||||
`run` scores the approved phase on the session meter (console.md → Posting an
|
||||
update → Session meter), in the same post that records the approval:
|
||||
`run` gives the approved phase its final score on the session meter (console.md →
|
||||
Posting an update → Session meter), in the same post that records the approval;
|
||||
it takes over what the build already counted from `cleared`, never adds to it:
|
||||
`implement-phase` for Implement, `implement-review-phase` for Implement +
|
||||
Review, id `phase-N`, and `tasks`: how many of the phase's tasks were
|
||||
completed (`[x]`, not blocked `[!]`). The phase scores by its size, so a
|
||||
@@ -392,7 +395,10 @@ a question still owed, above the ending itself:
|
||||
|
||||
The same build, then Stage 2 publishes the findings exactly as above (the
|
||||
`review` doc and the `fixes` item). Stage 3 fixes, with no "Check the fixes"
|
||||
item: Stage 4 is the only gate. Stage 4 is the sign-off above **without the
|
||||
item: Stage 4 is the only gate. The post that starts Stage 2's review carries
|
||||
`"run": { "event": "review", "id": "review" }`, as above: in this workflow it
|
||||
scores the review stage's 1 point on the meter as it begins, and the phase's
|
||||
final `run` leaves that point out. Stage 4 is the sign-off above **without the
|
||||
review verdict** — the phase was already reviewed — with the review results
|
||||
and unresolved findings in the report doc, header "Reviewed and ready for
|
||||
sign-off" in the item's `body`. The finish never carries `review`, and its
|
||||
|
||||
@@ -901,7 +901,9 @@ Per-unit work is yours to report, with `run` in any post:
|
||||
not count), a whole number from 1 to 999. A built phase scores by its size,
|
||||
one point per 3 tasks rounded up, and Implement + Review one more for the
|
||||
review. Always send it: without it a phase scores a flat 2 (or 3), however
|
||||
big it was. On any other event it is exit `3`.
|
||||
big it was. On any other event it is exit `3`. The console already counts a
|
||||
build's tasks from `headline.cleared` as they are ticked off; the phase's
|
||||
`run` takes that count over with the final score, so it never counts twice.
|
||||
- One `run` per post. Which events a workflow reports is in its own notes
|
||||
(Workflow notes → Pathfinder; `building.md` for Implement and for the
|
||||
review run on the page after a build).
|
||||
|
||||
@@ -90,7 +90,7 @@ import {
|
||||
writeJsonAtomic,
|
||||
writeWorkspaceCursor,
|
||||
} from "./lib.mjs";
|
||||
import { RUN_EVENTS, TASK_EVENTS, MAX_TASKS, isTaskCount } from "./public/meter.js";
|
||||
import { RUN_EVENTS, TASK_EVENTS, MAX_TASKS, isTaskCount, progressEntry } from "./public/meter.js";
|
||||
import { changeLine } from "./public/workspace.js";
|
||||
|
||||
// Mirrors the server's absolute lifetime cap: a handle older than this cannot
|
||||
@@ -593,6 +593,13 @@ function cmdPost() {
|
||||
const next = written.state;
|
||||
|
||||
for (const line of ledgerLines) appendLedger(dir, line);
|
||||
// A build scores its tasks as it clears them (meter.js, PROGRESS_WORKFLOWS),
|
||||
// after any `run` in the same post, so a phase finished here ends its count.
|
||||
if (patch.headline && typeof patch.headline === "object") {
|
||||
const ledger = readLedger(dir);
|
||||
const progress = progressEntry(ledger, lastLaunchId(ledger), next.workflow, patch.headline.cleared);
|
||||
if (progress) appendLedger(dir, progress);
|
||||
}
|
||||
appendEvent(dir, { type: "post", items: (patch.items || []).length });
|
||||
|
||||
const open = next.items.filter((i) => isOpen(i) && i.required !== false).length;
|
||||
|
||||
@@ -1096,6 +1096,14 @@ h1 {
|
||||
.ask-disabled-note.is-limit, .ask-disabled-note.is-waiting { color: var(--ink-2); background: var(--panel-2); border: 1px solid var(--rule); }
|
||||
.ask-disabled-note.is-offline { color: var(--warn); background: var(--warn-soft); border: 1px solid var(--warn); }
|
||||
|
||||
/* Waiting on Plan2Code (an Ask answer, or answers sent from Questions):
|
||||
the tiny ring, left of the label. */
|
||||
.view-tab .tab-spin {
|
||||
display: inline-block;
|
||||
margin-right: 6px;
|
||||
vertical-align: -1px;
|
||||
}
|
||||
|
||||
/* A reply landed while another tab was open. */
|
||||
.view-tab .tab-dot {
|
||||
display: inline-block;
|
||||
@@ -3144,11 +3152,6 @@ a.icon-btn { box-sizing: border-box; text-decoration: none; }
|
||||
0%, 15%, 75%, 100% { transform: scale(1); opacity: 0.16; }
|
||||
45% { transform: scale(0.7); opacity: 0.08; }
|
||||
}
|
||||
.pose .fz-halo { opacity: 0.25; animation: fz-halo 1.6s ease-in-out infinite; }
|
||||
@keyframes fz-halo {
|
||||
0%, 100% { transform: scale(1); opacity: 0.2; }
|
||||
45% { transform: scale(1.3); opacity: 0.4; }
|
||||
}
|
||||
.pose .fz-tick { stroke: var(--accent-ink); }
|
||||
.pose .fz-flag { transform-origin: 0% 50%; animation: fz-wave 1.2s ease-in-out infinite; }
|
||||
@keyframes fz-wave {
|
||||
|
||||
@@ -1825,8 +1825,11 @@ function renderBriefButton() {
|
||||
function renderViews() {
|
||||
const nav = $("views");
|
||||
nav.replaceChildren();
|
||||
// Sent and not yet picked up: the same ring as Ask, until Plan2Code moves on
|
||||
// or goes quiet (a turning ring would pass a dead session for a slow one).
|
||||
const sentBusy = pendingResult && !gone && !agentAdrift();
|
||||
const tabs = [
|
||||
{ id: "questions", label: isDashboard() ? "Dashboard" : "Questions", count: myTurn().length },
|
||||
{ id: "questions", label: isDashboard() ? "Dashboard" : "Questions", count: myTurn().length, busy: sentBusy },
|
||||
];
|
||||
// Built in rather than posted: present exactly while the spec in view has
|
||||
// an overview.md. A tab that vanishes under the person sends them home.
|
||||
@@ -1835,11 +1838,21 @@ function renderViews() {
|
||||
else if (view === "overview") view = "questions";
|
||||
for (const d of docs()) tabs.push({ id: "doc:" + d.id, label: d.title || "Document", count: 0 });
|
||||
// Always last, on every workflow and after a finish: the Quick question chat.
|
||||
tabs.push({ id: "ask", label: "Ask", count: 0, dot: chatDot });
|
||||
// The ring left of "Ask" shows exactly when the conversation's own ring does:
|
||||
// a question the agent picked up and has not answered yet.
|
||||
const ask = askState();
|
||||
const askBusy = ask.view.rows.some((r) => r.working) && ask.send.state !== "offline" && !agentAdrift();
|
||||
tabs.push({ id: "ask", label: "Ask", count: 0, dot: chatDot, busy: askBusy });
|
||||
|
||||
for (const t of tabs) {
|
||||
const b = el("button", "view-tab", t.label);
|
||||
b.type = "button";
|
||||
if (t.busy) {
|
||||
const spin = el("span", "spinner tiny tab-spin");
|
||||
spin.setAttribute("aria-hidden", "true");
|
||||
b.prepend(spin);
|
||||
b.title = t.id === "ask" ? "Plan2Code is working on an answer" : "Sent. Waiting for Plan2Code";
|
||||
}
|
||||
b.setAttribute("aria-current", String(view === t.id || (t.id === "questions" && view === "end")));
|
||||
if (t.count) {
|
||||
const c = el("span", "tab-count", String(t.count));
|
||||
|
||||
@@ -405,7 +405,7 @@
|
||||
</svg>
|
||||
|
||||
<!-- 4 Finalize: hopping for joy, both arms up, beside the checkmark
|
||||
flag, confetti drifting down and his star glowing. -->
|
||||
flag, confetti drifting down. -->
|
||||
<svg class="pose pose-finalize" data-pose="finalize" viewBox="0 4 240 216" aria-hidden="true" focusable="false">
|
||||
<ellipse class="shadow fz-shadow" cx="120" cy="198" rx="34" ry="5" />
|
||||
<g class="fz-hop">
|
||||
@@ -415,7 +415,6 @@
|
||||
<rect class="sh" x="80" y="72" width="80" height="108" rx="16" />
|
||||
<path class="ln" d="M80 116 L60 90" /><circle class="fl" cx="60" cy="90" r="5.5" />
|
||||
<path class="ln" d="M160 116 L180 90" /><circle class="fl" cx="180" cy="90" r="5.5" />
|
||||
<circle class="ac fz-halo" cx="120" cy="98" r="23" />
|
||||
<path class="ey blink" d="M120 84 L123.64 92.98 L133.31 93.67 L125.9 99.92 L128.23 109.33 L120 104.2 L111.77 109.33 L114.1 99.92 L106.69 93.67 L116.36 92.98 Z" />
|
||||
<path class="ey" d="M106 118 Q120 134 134 118 Z" />
|
||||
</g>
|
||||
|
||||
@@ -53,16 +53,55 @@ export const TASK_EVENTS = Object.freeze(new Set(Object.keys(TASK_BONUS)));
|
||||
// The most tasks one run may report: past this it is a typo, not a phase.
|
||||
export const MAX_TASKS = 999;
|
||||
|
||||
// A build scores while it runs, not only once it is approved: console.mjs
|
||||
// writes a `progress` ledger entry whenever a build's `headline.cleared`
|
||||
// rises, and the build's row scores those tasks at TASKS_PER_POINT with no
|
||||
// bonus. The phase's `run` then takes the row over with its final score, so
|
||||
// the total only ever climbs. Workflows whose headline counts tasks:
|
||||
export const PROGRESS_WORKFLOWS = Object.freeze(new Set(["implement", "implement-review"]));
|
||||
|
||||
// Implement + Review reviews every phase as a stage of the build. A `review`
|
||||
// run inside it is that stage, so it scores the phase's TASK_BONUS when it
|
||||
// starts, and the phase's own run leaves the bonus out after it.
|
||||
const BUILT_IN_REVIEW = Object.freeze({ "implement-review": "implement-review-phase" });
|
||||
|
||||
/**
|
||||
* The ledger entry a build's progress post stands for, or null when it adds
|
||||
* nothing: not a task-counting workflow, no whole `cleared`, or no more tasks
|
||||
* than this build already has. `seg` is how many phases this skill run has
|
||||
* finished, so a second phase in the same run starts its own count, but only
|
||||
* once its headline is back at 0: until then a `cleared` is the finished
|
||||
* phase's, posted again, and opening a build on it would count it twice.
|
||||
*/
|
||||
export function progressEntry(entries, launch, workflow, cleared) {
|
||||
if (!PROGRESS_WORKFLOWS.has(workflow)) return null;
|
||||
if (cleared !== 0 && !isTaskCount(cleared)) return null;
|
||||
const list = Array.isArray(entries) ? entries : [];
|
||||
const seg = list.filter((e) => e && e.kind === "run" && TASK_EVENTS.has(e.event) && launchOf(e.id) === launch).length;
|
||||
const build = `${launch}:b${seg}`;
|
||||
const mine = list.filter((e) => e && e.kind === "progress" && e.build === build);
|
||||
const entry = (tasks) => ({ kind: "progress", id: `${build}:${tasks}`, build, workflow, tasks });
|
||||
if (cleared === 0) return seg > 0 && !mine.length ? entry(0) : null;
|
||||
if (seg > 0 && !mine.length) return null;
|
||||
const most = mine.reduce((n, e) => Math.max(n, e.tasks), 0);
|
||||
return cleared > most ? entry(cleared) : null;
|
||||
}
|
||||
|
||||
/** A valid `run.tasks`: a whole number from 1 to MAX_TASKS. */
|
||||
export function isTaskCount(tasks) {
|
||||
return Number.isInteger(tasks) && tasks >= 1 && tasks <= MAX_TASKS;
|
||||
}
|
||||
|
||||
/** What one `run` scores, from its event and (for a built phase) its tasks. */
|
||||
export function runPoints(event, tasks) {
|
||||
/**
|
||||
* What one `run` scores, from its event and (for a built phase) its tasks.
|
||||
* `bonus: false` leaves the review bonus out, for a phase whose review
|
||||
* already scored.
|
||||
*/
|
||||
export function runPoints(event, tasks, { bonus = true } = {}) {
|
||||
if (TASK_EVENTS.has(event) && isTaskCount(tasks)) {
|
||||
return Math.ceil(tasks / TASKS_PER_POINT) + TASK_BONUS[event];
|
||||
return Math.ceil(tasks / TASKS_PER_POINT) + (bonus ? TASK_BONUS[event] : 0);
|
||||
}
|
||||
if (TASK_EVENTS.has(event) && !bonus) return weightOf(event) - TASK_BONUS[event];
|
||||
return weightOf(event);
|
||||
}
|
||||
|
||||
@@ -133,6 +172,8 @@ export function breakdownFrom(entries) {
|
||||
const seen = new Set();
|
||||
const rows = [];
|
||||
const answers = new Map(); // launch id -> { row, count, workflow }
|
||||
const builds = new Map(); // launch id -> the row of the build in progress
|
||||
const reviewed = new Set(); // launch ids whose built-in review has scored
|
||||
for (const entry of Array.isArray(entries) ? entries : []) {
|
||||
if (!entry || typeof entry !== "object") continue;
|
||||
if (entry.id !== undefined) {
|
||||
@@ -150,17 +191,54 @@ export function breakdownFrom(entries) {
|
||||
tally.count += 1;
|
||||
continue;
|
||||
}
|
||||
if (entry.kind === "progress") {
|
||||
if (!isTaskCount(entry.tasks)) continue;
|
||||
const launch = launchOf(entry.id);
|
||||
let row = builds.get(launch);
|
||||
if (!row || row.build !== entry.build) {
|
||||
row = { label: "", points: 0, build: entry.build, tasks: 0 };
|
||||
builds.set(launch, row);
|
||||
rows.push(row);
|
||||
}
|
||||
if (entry.tasks > row.tasks) {
|
||||
row.tasks = entry.tasks;
|
||||
row.points = Math.ceil(entry.tasks / TASKS_PER_POINT);
|
||||
const where = WORKFLOW_NAMES[entry.workflow] || "Build";
|
||||
row.label = `${where}: ${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"} built so far`;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
let points = 0;
|
||||
let label = "";
|
||||
if (entry.kind === "launch" && LAUNCH_COUNTED.has(entry.workflow)) {
|
||||
points = weightOf(entry.workflow);
|
||||
label = LAUNCH_LABELS[entry.workflow] || entry.workflow;
|
||||
} else if (entry.kind === "run") {
|
||||
points = runPoints(entry.event, entry.tasks);
|
||||
const unit = unitOf(entry.id);
|
||||
const counted = TASK_EVENTS.has(entry.event) && isTaskCount(entry.tasks);
|
||||
const size = counted ? ` (${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"})` : "";
|
||||
label = (RUN_LABELS[entry.event] || entry.event) + (unit ? `: ${unit}` : "") + size;
|
||||
const launch = launchOf(entry.id);
|
||||
const builtIn = BUILT_IN_REVIEW[entry.workflow];
|
||||
if (entry.event === "review" && builtIn) {
|
||||
// The review stage of Implement + Review: it scores the bonus its
|
||||
// phase would otherwise carry, once per skill run.
|
||||
if (reviewed.has(launch)) continue;
|
||||
reviewed.add(launch);
|
||||
points = TASK_BONUS[builtIn];
|
||||
label = `${WORKFLOW_NAMES[entry.workflow]}: code review run`;
|
||||
} else {
|
||||
const bonus = !(TASK_EVENTS.has(entry.event) && reviewed.has(launch));
|
||||
points = runPoints(entry.event, entry.tasks, { bonus });
|
||||
const unit = unitOf(entry.id);
|
||||
const counted = TASK_EVENTS.has(entry.event) && isTaskCount(entry.tasks);
|
||||
const size = counted ? ` (${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"})` : "";
|
||||
label = (RUN_LABELS[entry.event] || entry.event) + (unit && unit !== entry.event ? `: ${unit}` : "") + size;
|
||||
}
|
||||
// A finished phase takes over its build's progress row, in place.
|
||||
if (TASK_EVENTS.has(entry.event) && builds.has(launch)) {
|
||||
const row = builds.get(launch);
|
||||
builds.delete(launch);
|
||||
row.label = label;
|
||||
row.points = Math.max(points, row.points);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (points > 0) rows.push({ label, points });
|
||||
}
|
||||
@@ -169,7 +247,7 @@ export function breakdownFrom(entries) {
|
||||
const where = WORKFLOW_NAMES[workflow] ? ` in ${WORKFLOW_NAMES[workflow]}` : "";
|
||||
row.label = `${count} ${count === 1 ? "answer" : "answers"}${where}`;
|
||||
}
|
||||
return rows.filter((row) => row.points > 0);
|
||||
return rows.filter((row) => row.points > 0).map(({ label, points }) => ({ label, points }));
|
||||
}
|
||||
|
||||
/** The session's points, folded from ledger entries in order. */
|
||||
|
||||
@@ -60,7 +60,9 @@ The first payload for a phase you are about to build:
|
||||
```
|
||||
|
||||
`headline.cleared` / `total` are tasks done out of tasks in the phase: the
|
||||
progress bar is the first thing someone watching a build looks at.
|
||||
progress bar is the first thing someone watching a build looks at. The session
|
||||
meter counts the build's tasks from `cleared` as it rises, so keep it current,
|
||||
and start every phase (a second one in the same run too) at `"cleared": 0`.
|
||||
|
||||
`phasefile` is the whole `phase-X.md`, verbatim from disk, as its own tab —
|
||||
the person can read the prerequisites and task specs while you build. Re-post
|
||||
@@ -233,8 +235,9 @@ sign-off card, and approving past it was the answer. `implement-review` ends
|
||||
the same way; that phase was reviewed already. Only a finished `quick-task`
|
||||
still offers the review on its finish — see below.
|
||||
|
||||
`run` scores the approved phase on the session meter (console.md → Posting an
|
||||
update → Session meter), in the same post that records the approval:
|
||||
`run` gives the approved phase its final score on the session meter (console.md →
|
||||
Posting an update → Session meter), in the same post that records the approval;
|
||||
it takes over what the build already counted from `cleared`, never adds to it:
|
||||
`implement-phase` for Implement, `implement-review-phase` for Implement +
|
||||
Review, id `phase-N`, and `tasks`: how many of the phase's tasks were
|
||||
completed (`[x]`, not blocked `[!]`). The phase scores by its size, so a
|
||||
@@ -392,7 +395,10 @@ a question still owed, above the ending itself:
|
||||
|
||||
The same build, then Stage 2 publishes the findings exactly as above (the
|
||||
`review` doc and the `fixes` item). Stage 3 fixes, with no "Check the fixes"
|
||||
item: Stage 4 is the only gate. Stage 4 is the sign-off above **without the
|
||||
item: Stage 4 is the only gate. The post that starts Stage 2's review carries
|
||||
`"run": { "event": "review", "id": "review" }`, as above: in this workflow it
|
||||
scores the review stage's 1 point on the meter as it begins, and the phase's
|
||||
final `run` leaves that point out. Stage 4 is the sign-off above **without the
|
||||
review verdict** — the phase was already reviewed — with the review results
|
||||
and unresolved findings in the report doc, header "Reviewed and ready for
|
||||
sign-off" in the item's `body`. The finish never carries `review`, and its
|
||||
|
||||
@@ -901,7 +901,9 @@ Per-unit work is yours to report, with `run` in any post:
|
||||
not count), a whole number from 1 to 999. A built phase scores by its size,
|
||||
one point per 3 tasks rounded up, and Implement + Review one more for the
|
||||
review. Always send it: without it a phase scores a flat 2 (or 3), however
|
||||
big it was. On any other event it is exit `3`.
|
||||
big it was. On any other event it is exit `3`. The console already counts a
|
||||
build's tasks from `headline.cleared` as they are ticked off; the phase's
|
||||
`run` takes that count over with the final score, so it never counts twice.
|
||||
- One `run` per post. Which events a workflow reports is in its own notes
|
||||
(Workflow notes → Pathfinder; `building.md` for Implement and for the
|
||||
review run on the page after a build).
|
||||
|
||||
@@ -90,7 +90,7 @@ import {
|
||||
writeJsonAtomic,
|
||||
writeWorkspaceCursor,
|
||||
} from "./lib.mjs";
|
||||
import { RUN_EVENTS, TASK_EVENTS, MAX_TASKS, isTaskCount } from "./public/meter.js";
|
||||
import { RUN_EVENTS, TASK_EVENTS, MAX_TASKS, isTaskCount, progressEntry } from "./public/meter.js";
|
||||
import { changeLine } from "./public/workspace.js";
|
||||
|
||||
// Mirrors the server's absolute lifetime cap: a handle older than this cannot
|
||||
@@ -593,6 +593,13 @@ function cmdPost() {
|
||||
const next = written.state;
|
||||
|
||||
for (const line of ledgerLines) appendLedger(dir, line);
|
||||
// A build scores its tasks as it clears them (meter.js, PROGRESS_WORKFLOWS),
|
||||
// after any `run` in the same post, so a phase finished here ends its count.
|
||||
if (patch.headline && typeof patch.headline === "object") {
|
||||
const ledger = readLedger(dir);
|
||||
const progress = progressEntry(ledger, lastLaunchId(ledger), next.workflow, patch.headline.cleared);
|
||||
if (progress) appendLedger(dir, progress);
|
||||
}
|
||||
appendEvent(dir, { type: "post", items: (patch.items || []).length });
|
||||
|
||||
const open = next.items.filter((i) => isOpen(i) && i.required !== false).length;
|
||||
|
||||
@@ -1096,6 +1096,14 @@ h1 {
|
||||
.ask-disabled-note.is-limit, .ask-disabled-note.is-waiting { color: var(--ink-2); background: var(--panel-2); border: 1px solid var(--rule); }
|
||||
.ask-disabled-note.is-offline { color: var(--warn); background: var(--warn-soft); border: 1px solid var(--warn); }
|
||||
|
||||
/* Waiting on Plan2Code (an Ask answer, or answers sent from Questions):
|
||||
the tiny ring, left of the label. */
|
||||
.view-tab .tab-spin {
|
||||
display: inline-block;
|
||||
margin-right: 6px;
|
||||
vertical-align: -1px;
|
||||
}
|
||||
|
||||
/* A reply landed while another tab was open. */
|
||||
.view-tab .tab-dot {
|
||||
display: inline-block;
|
||||
@@ -3144,11 +3152,6 @@ a.icon-btn { box-sizing: border-box; text-decoration: none; }
|
||||
0%, 15%, 75%, 100% { transform: scale(1); opacity: 0.16; }
|
||||
45% { transform: scale(0.7); opacity: 0.08; }
|
||||
}
|
||||
.pose .fz-halo { opacity: 0.25; animation: fz-halo 1.6s ease-in-out infinite; }
|
||||
@keyframes fz-halo {
|
||||
0%, 100% { transform: scale(1); opacity: 0.2; }
|
||||
45% { transform: scale(1.3); opacity: 0.4; }
|
||||
}
|
||||
.pose .fz-tick { stroke: var(--accent-ink); }
|
||||
.pose .fz-flag { transform-origin: 0% 50%; animation: fz-wave 1.2s ease-in-out infinite; }
|
||||
@keyframes fz-wave {
|
||||
|
||||
@@ -1825,8 +1825,11 @@ function renderBriefButton() {
|
||||
function renderViews() {
|
||||
const nav = $("views");
|
||||
nav.replaceChildren();
|
||||
// Sent and not yet picked up: the same ring as Ask, until Plan2Code moves on
|
||||
// or goes quiet (a turning ring would pass a dead session for a slow one).
|
||||
const sentBusy = pendingResult && !gone && !agentAdrift();
|
||||
const tabs = [
|
||||
{ id: "questions", label: isDashboard() ? "Dashboard" : "Questions", count: myTurn().length },
|
||||
{ id: "questions", label: isDashboard() ? "Dashboard" : "Questions", count: myTurn().length, busy: sentBusy },
|
||||
];
|
||||
// Built in rather than posted: present exactly while the spec in view has
|
||||
// an overview.md. A tab that vanishes under the person sends them home.
|
||||
@@ -1835,11 +1838,21 @@ function renderViews() {
|
||||
else if (view === "overview") view = "questions";
|
||||
for (const d of docs()) tabs.push({ id: "doc:" + d.id, label: d.title || "Document", count: 0 });
|
||||
// Always last, on every workflow and after a finish: the Quick question chat.
|
||||
tabs.push({ id: "ask", label: "Ask", count: 0, dot: chatDot });
|
||||
// The ring left of "Ask" shows exactly when the conversation's own ring does:
|
||||
// a question the agent picked up and has not answered yet.
|
||||
const ask = askState();
|
||||
const askBusy = ask.view.rows.some((r) => r.working) && ask.send.state !== "offline" && !agentAdrift();
|
||||
tabs.push({ id: "ask", label: "Ask", count: 0, dot: chatDot, busy: askBusy });
|
||||
|
||||
for (const t of tabs) {
|
||||
const b = el("button", "view-tab", t.label);
|
||||
b.type = "button";
|
||||
if (t.busy) {
|
||||
const spin = el("span", "spinner tiny tab-spin");
|
||||
spin.setAttribute("aria-hidden", "true");
|
||||
b.prepend(spin);
|
||||
b.title = t.id === "ask" ? "Plan2Code is working on an answer" : "Sent. Waiting for Plan2Code";
|
||||
}
|
||||
b.setAttribute("aria-current", String(view === t.id || (t.id === "questions" && view === "end")));
|
||||
if (t.count) {
|
||||
const c = el("span", "tab-count", String(t.count));
|
||||
|
||||
@@ -405,7 +405,7 @@
|
||||
</svg>
|
||||
|
||||
<!-- 4 Finalize: hopping for joy, both arms up, beside the checkmark
|
||||
flag, confetti drifting down and his star glowing. -->
|
||||
flag, confetti drifting down. -->
|
||||
<svg class="pose pose-finalize" data-pose="finalize" viewBox="0 4 240 216" aria-hidden="true" focusable="false">
|
||||
<ellipse class="shadow fz-shadow" cx="120" cy="198" rx="34" ry="5" />
|
||||
<g class="fz-hop">
|
||||
@@ -415,7 +415,6 @@
|
||||
<rect class="sh" x="80" y="72" width="80" height="108" rx="16" />
|
||||
<path class="ln" d="M80 116 L60 90" /><circle class="fl" cx="60" cy="90" r="5.5" />
|
||||
<path class="ln" d="M160 116 L180 90" /><circle class="fl" cx="180" cy="90" r="5.5" />
|
||||
<circle class="ac fz-halo" cx="120" cy="98" r="23" />
|
||||
<path class="ey blink" d="M120 84 L123.64 92.98 L133.31 93.67 L125.9 99.92 L128.23 109.33 L120 104.2 L111.77 109.33 L114.1 99.92 L106.69 93.67 L116.36 92.98 Z" />
|
||||
<path class="ey" d="M106 118 Q120 134 134 118 Z" />
|
||||
</g>
|
||||
|
||||
@@ -53,16 +53,55 @@ export const TASK_EVENTS = Object.freeze(new Set(Object.keys(TASK_BONUS)));
|
||||
// The most tasks one run may report: past this it is a typo, not a phase.
|
||||
export const MAX_TASKS = 999;
|
||||
|
||||
// A build scores while it runs, not only once it is approved: console.mjs
|
||||
// writes a `progress` ledger entry whenever a build's `headline.cleared`
|
||||
// rises, and the build's row scores those tasks at TASKS_PER_POINT with no
|
||||
// bonus. The phase's `run` then takes the row over with its final score, so
|
||||
// the total only ever climbs. Workflows whose headline counts tasks:
|
||||
export const PROGRESS_WORKFLOWS = Object.freeze(new Set(["implement", "implement-review"]));
|
||||
|
||||
// Implement + Review reviews every phase as a stage of the build. A `review`
|
||||
// run inside it is that stage, so it scores the phase's TASK_BONUS when it
|
||||
// starts, and the phase's own run leaves the bonus out after it.
|
||||
const BUILT_IN_REVIEW = Object.freeze({ "implement-review": "implement-review-phase" });
|
||||
|
||||
/**
|
||||
* The ledger entry a build's progress post stands for, or null when it adds
|
||||
* nothing: not a task-counting workflow, no whole `cleared`, or no more tasks
|
||||
* than this build already has. `seg` is how many phases this skill run has
|
||||
* finished, so a second phase in the same run starts its own count, but only
|
||||
* once its headline is back at 0: until then a `cleared` is the finished
|
||||
* phase's, posted again, and opening a build on it would count it twice.
|
||||
*/
|
||||
export function progressEntry(entries, launch, workflow, cleared) {
|
||||
if (!PROGRESS_WORKFLOWS.has(workflow)) return null;
|
||||
if (cleared !== 0 && !isTaskCount(cleared)) return null;
|
||||
const list = Array.isArray(entries) ? entries : [];
|
||||
const seg = list.filter((e) => e && e.kind === "run" && TASK_EVENTS.has(e.event) && launchOf(e.id) === launch).length;
|
||||
const build = `${launch}:b${seg}`;
|
||||
const mine = list.filter((e) => e && e.kind === "progress" && e.build === build);
|
||||
const entry = (tasks) => ({ kind: "progress", id: `${build}:${tasks}`, build, workflow, tasks });
|
||||
if (cleared === 0) return seg > 0 && !mine.length ? entry(0) : null;
|
||||
if (seg > 0 && !mine.length) return null;
|
||||
const most = mine.reduce((n, e) => Math.max(n, e.tasks), 0);
|
||||
return cleared > most ? entry(cleared) : null;
|
||||
}
|
||||
|
||||
/** A valid `run.tasks`: a whole number from 1 to MAX_TASKS. */
|
||||
export function isTaskCount(tasks) {
|
||||
return Number.isInteger(tasks) && tasks >= 1 && tasks <= MAX_TASKS;
|
||||
}
|
||||
|
||||
/** What one `run` scores, from its event and (for a built phase) its tasks. */
|
||||
export function runPoints(event, tasks) {
|
||||
/**
|
||||
* What one `run` scores, from its event and (for a built phase) its tasks.
|
||||
* `bonus: false` leaves the review bonus out, for a phase whose review
|
||||
* already scored.
|
||||
*/
|
||||
export function runPoints(event, tasks, { bonus = true } = {}) {
|
||||
if (TASK_EVENTS.has(event) && isTaskCount(tasks)) {
|
||||
return Math.ceil(tasks / TASKS_PER_POINT) + TASK_BONUS[event];
|
||||
return Math.ceil(tasks / TASKS_PER_POINT) + (bonus ? TASK_BONUS[event] : 0);
|
||||
}
|
||||
if (TASK_EVENTS.has(event) && !bonus) return weightOf(event) - TASK_BONUS[event];
|
||||
return weightOf(event);
|
||||
}
|
||||
|
||||
@@ -133,6 +172,8 @@ export function breakdownFrom(entries) {
|
||||
const seen = new Set();
|
||||
const rows = [];
|
||||
const answers = new Map(); // launch id -> { row, count, workflow }
|
||||
const builds = new Map(); // launch id -> the row of the build in progress
|
||||
const reviewed = new Set(); // launch ids whose built-in review has scored
|
||||
for (const entry of Array.isArray(entries) ? entries : []) {
|
||||
if (!entry || typeof entry !== "object") continue;
|
||||
if (entry.id !== undefined) {
|
||||
@@ -150,17 +191,54 @@ export function breakdownFrom(entries) {
|
||||
tally.count += 1;
|
||||
continue;
|
||||
}
|
||||
if (entry.kind === "progress") {
|
||||
if (!isTaskCount(entry.tasks)) continue;
|
||||
const launch = launchOf(entry.id);
|
||||
let row = builds.get(launch);
|
||||
if (!row || row.build !== entry.build) {
|
||||
row = { label: "", points: 0, build: entry.build, tasks: 0 };
|
||||
builds.set(launch, row);
|
||||
rows.push(row);
|
||||
}
|
||||
if (entry.tasks > row.tasks) {
|
||||
row.tasks = entry.tasks;
|
||||
row.points = Math.ceil(entry.tasks / TASKS_PER_POINT);
|
||||
const where = WORKFLOW_NAMES[entry.workflow] || "Build";
|
||||
row.label = `${where}: ${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"} built so far`;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
let points = 0;
|
||||
let label = "";
|
||||
if (entry.kind === "launch" && LAUNCH_COUNTED.has(entry.workflow)) {
|
||||
points = weightOf(entry.workflow);
|
||||
label = LAUNCH_LABELS[entry.workflow] || entry.workflow;
|
||||
} else if (entry.kind === "run") {
|
||||
points = runPoints(entry.event, entry.tasks);
|
||||
const unit = unitOf(entry.id);
|
||||
const counted = TASK_EVENTS.has(entry.event) && isTaskCount(entry.tasks);
|
||||
const size = counted ? ` (${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"})` : "";
|
||||
label = (RUN_LABELS[entry.event] || entry.event) + (unit ? `: ${unit}` : "") + size;
|
||||
const launch = launchOf(entry.id);
|
||||
const builtIn = BUILT_IN_REVIEW[entry.workflow];
|
||||
if (entry.event === "review" && builtIn) {
|
||||
// The review stage of Implement + Review: it scores the bonus its
|
||||
// phase would otherwise carry, once per skill run.
|
||||
if (reviewed.has(launch)) continue;
|
||||
reviewed.add(launch);
|
||||
points = TASK_BONUS[builtIn];
|
||||
label = `${WORKFLOW_NAMES[entry.workflow]}: code review run`;
|
||||
} else {
|
||||
const bonus = !(TASK_EVENTS.has(entry.event) && reviewed.has(launch));
|
||||
points = runPoints(entry.event, entry.tasks, { bonus });
|
||||
const unit = unitOf(entry.id);
|
||||
const counted = TASK_EVENTS.has(entry.event) && isTaskCount(entry.tasks);
|
||||
const size = counted ? ` (${entry.tasks} ${entry.tasks === 1 ? "task" : "tasks"})` : "";
|
||||
label = (RUN_LABELS[entry.event] || entry.event) + (unit && unit !== entry.event ? `: ${unit}` : "") + size;
|
||||
}
|
||||
// A finished phase takes over its build's progress row, in place.
|
||||
if (TASK_EVENTS.has(entry.event) && builds.has(launch)) {
|
||||
const row = builds.get(launch);
|
||||
builds.delete(launch);
|
||||
row.label = label;
|
||||
row.points = Math.max(points, row.points);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (points > 0) rows.push({ label, points });
|
||||
}
|
||||
@@ -169,7 +247,7 @@ export function breakdownFrom(entries) {
|
||||
const where = WORKFLOW_NAMES[workflow] ? ` in ${WORKFLOW_NAMES[workflow]}` : "";
|
||||
row.label = `${count} ${count === 1 ? "answer" : "answers"}${where}`;
|
||||
}
|
||||
return rows.filter((row) => row.points > 0);
|
||||
return rows.filter((row) => row.points > 0).map(({ label, points }) => ({ label, points }));
|
||||
}
|
||||
|
||||
/** The session's points, folded from ledger entries in order. */
|
||||
|
||||
@@ -101,11 +101,12 @@ Line numbers may only appear as SUPPLEMENTAL context alongside a semantic refere
|
||||
5. **Use existing** `specs/<feature-name>/` directory
|
||||
6. **Write** `overview.md` first, copying from PLAN-DRAFT:
|
||||
- Summary (from Executive Summary)
|
||||
- Phase Checklist (Implementation Phases), directly under Summary
|
||||
- Parallel Execution Groups (filled in step 8)
|
||||
- Tech Stack table (exact copy)
|
||||
- Architecture Pattern and Component Overview (section 4)
|
||||
- Risks and Mitigations table (section 6)
|
||||
- Success Criteria (plain bullet list, no checkboxes) (section 7)
|
||||
- Phase Checklist (Implementation Phases)
|
||||
- Quick Reference (Key Files, Environment Variables, External Dependencies)
|
||||
7. **Write** each `phase-X.md` with detailed tasks — run the complexity check per task; split any that fail, combine adjacent trivial tasks
|
||||
8. **Analyze** parallel execution eligibility
|
||||
@@ -181,7 +182,7 @@ Use kebab-case for feature name (e.g., `user-authentication`).
|
||||
|
||||
Header: Title, Created date, Source (PLAN-DRAFT path), Status on its own line as `**Status:** <value>` (Not Started | In Progress | Complete).
|
||||
|
||||
Sections: Summary (from Executive Summary), Tech Stack table (exact copy from PLAN-DRAFT), Architecture (Pattern + Component Overview table), Risks and Mitigations table, Success Criteria checklist, Phase Checklist, Parallel Execution Groups table (from analysis), Quick Reference (Key Files, Environment Variables, External Dependencies), Completion Summary (filled during finalization).
|
||||
Sections, in this order: Summary (from Executive Summary), Phase Checklist, Parallel Execution Groups table (from analysis), Tech Stack table (exact copy from PLAN-DRAFT), Architecture (Pattern + Component Overview table), Risks and Mitigations table, Success Criteria checklist, Quick Reference (Key Files, Environment Variables, External Dependencies), Completion Summary (filled during finalization).
|
||||
|
||||
### phase-X.md
|
||||
|
||||
|
||||
@@ -60,7 +60,9 @@ The first payload for a phase you are about to build:
|
||||
```
|
||||
|
||||
`headline.cleared` / `total` are tasks done out of tasks in the phase: the
|
||||
progress bar is the first thing someone watching a build looks at.
|
||||
progress bar is the first thing someone watching a build looks at. The session
|
||||
meter counts the build's tasks from `cleared` as it rises, so keep it current,
|
||||
and start every phase (a second one in the same run too) at `"cleared": 0`.
|
||||
|
||||
`phasefile` is the whole `phase-X.md`, verbatim from disk, as its own tab —
|
||||
the person can read the prerequisites and task specs while you build. Re-post
|
||||
@@ -233,8 +235,9 @@ sign-off card, and approving past it was the answer. `implement-review` ends
|
||||
the same way; that phase was reviewed already. Only a finished `quick-task`
|
||||
still offers the review on its finish — see below.
|
||||
|
||||
`run` scores the approved phase on the session meter (console.md → Posting an
|
||||
update → Session meter), in the same post that records the approval:
|
||||
`run` gives the approved phase its final score on the session meter (console.md →
|
||||
Posting an update → Session meter), in the same post that records the approval;
|
||||
it takes over what the build already counted from `cleared`, never adds to it:
|
||||
`implement-phase` for Implement, `implement-review-phase` for Implement +
|
||||
Review, id `phase-N`, and `tasks`: how many of the phase's tasks were
|
||||
completed (`[x]`, not blocked `[!]`). The phase scores by its size, so a
|
||||
@@ -392,7 +395,10 @@ a question still owed, above the ending itself:
|
||||
|
||||
The same build, then Stage 2 publishes the findings exactly as above (the
|
||||
`review` doc and the `fixes` item). Stage 3 fixes, with no "Check the fixes"
|
||||
item: Stage 4 is the only gate. Stage 4 is the sign-off above **without the
|
||||
item: Stage 4 is the only gate. The post that starts Stage 2's review carries
|
||||
`"run": { "event": "review", "id": "review" }`, as above: in this workflow it
|
||||
scores the review stage's 1 point on the meter as it begins, and the phase's
|
||||
final `run` leaves that point out. Stage 4 is the sign-off above **without the
|
||||
review verdict** — the phase was already reviewed — with the review results
|
||||
and unresolved findings in the report doc, header "Reviewed and ready for
|
||||
sign-off" in the item's `body`. The finish never carries `review`, and its
|
||||
|
||||
@@ -901,7 +901,9 @@ Per-unit work is yours to report, with `run` in any post:
|
||||
not count), a whole number from 1 to 999. A built phase scores by its size,
|
||||
one point per 3 tasks rounded up, and Implement + Review one more for the
|
||||
review. Always send it: without it a phase scores a flat 2 (or 3), however
|
||||
big it was. On any other event it is exit `3`.
|
||||
big it was. On any other event it is exit `3`. The console already counts a
|
||||
build's tasks from `headline.cleared` as they are ticked off; the phase's
|
||||
`run` takes that count over with the final score, so it never counts twice.
|
||||
- One `run` per post. Which events a workflow reports is in its own notes
|
||||
(Workflow notes → Pathfinder; `building.md` for Implement and for the
|
||||
review run on the page after a build).
|
||||
|
||||
@@ -90,7 +90,7 @@ import {
|
||||
writeJsonAtomic,
|
||||
writeWorkspaceCursor,
|
||||
} from "./lib.mjs";
|
||||
import { RUN_EVENTS, TASK_EVENTS, MAX_TASKS, isTaskCount } from "./public/meter.js";
|
||||
import { RUN_EVENTS, TASK_EVENTS, MAX_TASKS, isTaskCount, progressEntry } from "./public/meter.js";
|
||||
import { changeLine } from "./public/workspace.js";
|
||||
|
||||
// Mirrors the server's absolute lifetime cap: a handle older than this cannot
|
||||
@@ -593,6 +593,13 @@ function cmdPost() {
|
||||
const next = written.state;
|
||||
|
||||
for (const line of ledgerLines) appendLedger(dir, line);
|
||||
// A build scores its tasks as it clears them (meter.js, PROGRESS_WORKFLOWS),
|
||||
// after any `run` in the same post, so a phase finished here ends its count.
|
||||
if (patch.headline && typeof patch.headline === "object") {
|
||||
const ledger = readLedger(dir);
|
||||
const progress = progressEntry(ledger, lastLaunchId(ledger), next.workflow, patch.headline.cleared);
|
||||
if (progress) appendLedger(dir, progress);
|
||||
}
|
||||
appendEvent(dir, { type: "post", items: (patch.items || []).length });
|
||||
|
||||
const open = next.items.filter((i) => isOpen(i) && i.required !== false).length;
|
||||
|
||||
@@ -1096,6 +1096,14 @@ h1 {
|
||||
.ask-disabled-note.is-limit, .ask-disabled-note.is-waiting { color: var(--ink-2); background: var(--panel-2); border: 1px solid var(--rule); }
|
||||
.ask-disabled-note.is-offline { color: var(--warn); background: var(--warn-soft); border: 1px solid var(--warn); }
|
||||
|
||||
/* Waiting on Plan2Code (an Ask answer, or answers sent from Questions):
|
||||
the tiny ring, left of the label. */
|
||||
.view-tab .tab-spin {
|
||||
display: inline-block;
|
||||
margin-right: 6px;
|
||||
vertical-align: -1px;
|
||||
}
|
||||
|
||||
/* A reply landed while another tab was open. */
|
||||
.view-tab .tab-dot {
|
||||
display: inline-block;
|
||||
@@ -3144,11 +3152,6 @@ a.icon-btn { box-sizing: border-box; text-decoration: none; }
|
||||
0%, 15%, 75%, 100% { transform: scale(1); opacity: 0.16; }
|
||||
45% { transform: scale(0.7); opacity: 0.08; }
|
||||
}
|
||||
.pose .fz-halo { opacity: 0.25; animation: fz-halo 1.6s ease-in-out infinite; }
|
||||
@keyframes fz-halo {
|
||||
0%, 100% { transform: scale(1); opacity: 0.2; }
|
||||
45% { transform: scale(1.3); opacity: 0.4; }
|
||||
}
|
||||
.pose .fz-tick { stroke: var(--accent-ink); }
|
||||
.pose .fz-flag { transform-origin: 0% 50%; animation: fz-wave 1.2s ease-in-out infinite; }
|
||||
@keyframes fz-wave {
|
||||
|
||||
Loaded 100 of 103 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user