@babylonjs-toolkit/agent 1.1.66 → 1.1.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/package.json +1 -1
- package/skills/bt-execute/SKILL.md +3 -3
- package/skills/bt-execute/templates/dashboard/dashboard.html +96 -21
- package/skills/bt-execute/templates/dashboard/data-schema.md +4 -3
- package/skills/bt-profile/SKILL.md +275 -0
- package/skills/bt-profile/scripts/analyze.mjs +683 -0
- package/skills/bt-profile/scripts/compare.mjs +87 -0
- package/skills/bt-profile/scripts/lib/probe.mjs +225 -0
- package/skills/bt-profile/scripts/lib/progress-panel.mjs +275 -0
- package/skills/bt-profile/scripts/lib/symbolize.mjs +356 -0
- package/skills/bt-profile/scripts/package.json +10 -0
- package/skills/bt-profile/scripts/profile.mjs +517 -0
- package/skills/bt-profile/scripts/progress.mjs +385 -0
- package/skills/bt-profile/scripts/report.mjs +611 -0
- package/skills/bt-profile/templates/census.template.mjs +76 -0
- package/skills/bt-profile/templates/scenario.template.mjs +69 -0
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Babylon Toolkit Desktop Agent (1.1.
|
|
1
|
+
# Babylon Toolkit Desktop Agent (1.1.68)
|
|
2
2
|
|
|
3
3
|
The desktop agent owns the entire pipeline end to end — frontend and UI design, gameplay code, shaders, generated art and audio, 3D models in headless Blender, whole game levels and prefabs in a terminal-driven Unity Editor, the interactive glTF export, the web build, the dev server, and visual QA by screenshotting both Unity and the running browser.
|
|
4
4
|
|
|
@@ -281,6 +281,7 @@ pair or schedule the bridge.
|
|
|
281
281
|
| [`bt-hero`](skills/bt-hero/SKILL.md) | `/bt-hero` | Create smooth cinematic 3D scrolling hero sections. |
|
|
282
282
|
| [`bt-atlas`](skills/bt-atlas/SKILL.md) | `/bt-atlas` | Generate texture atlas skin variations. |
|
|
283
283
|
| [`bt-optimize`](skills/bt-optimize/SKILL.md) | `/bt-optimize` | Make an exported Unity scene run fast in the browser: profile the BabylonJS frame (draw calls per pass, lights, shadows, post-processing, resolution, materials, textures), fix the causes on a copy of the scene — runtime lights, shadows, post, exporter settings, static / lightmap / mirrored unlocks — and merge static meshes and LOD groups (packed lightmap UVs, LOD clusters); then re-bake, export and verify frame rate and look against the original. `--no-combine`, `--combine-only`. |
|
|
284
|
+
| [`bt-profile`](skills/bt-profile/SKILL.md) | `/bt-profile` | Find and fix what makes a BabylonJS / Babylon Toolkit web game slow: drive the running game in Chrome through a repeatable scenario (a cold load, a level start, a countdown), record the CPU profile, allocations and every frame, map each millisecond to its source line and owner (your code, the toolkit runtime, BabylonJS, Havok, React), then fix the bottlenecks one at a time and re-measure each. Writes `.agents/profile/<slug>/dashboard.html`. `--analyze`, `--snapshots`, `--project`, `--slug`. |
|
|
284
285
|
|
|
285
286
|
Every tool derives the slash-command from the **folder name** (`bt-spec/` → `/bt-spec`) and reads
|
|
286
287
|
the frontmatter `name` + `description` to decide when the skill applies. The `allowed-tools`
|
|
@@ -445,7 +446,7 @@ Where each tool looks for PROJECT-LOCAL skills (only when the user explicitly re
|
|
|
445
446
|
> for everything else (Codex, Copilot, Gemini CLI, Antigravity). By default use the
|
|
446
447
|
> GLOBAL (per-user home) locations; use the project-local locations only when the user
|
|
447
448
|
> explicitly asks for a project install. Copy **whole folders** into each — the
|
|
448
|
-
> `bt-atlas/scripts/` and `bt-
|
|
449
|
+
> `bt-atlas/scripts/`, `bt-optimize/scripts/` and `bt-profile/scripts/` + `bt-profile/templates/` assets must be present in every location.
|
|
449
450
|
|
|
450
451
|
|
|
451
452
|
# Babylon Toolkit Loop Engineering (Gauntlet Loop)
|
package/package.json
CHANGED
|
@@ -54,7 +54,7 @@ Work in **phases**: a `### Phase N` group in the plan, or — if the plan has no
|
|
|
54
54
|
4. **Fix loop** for a task that failed: fix the code in the context that wrote it; re-run its tests; re-verify with a **fresh** verifier given only the failed items and the evidence (`--strict`: the whole task). A records-only slip (a stale number or note) is fixed directly and re-checked by you. 3 attempts (`--strict`: 5), each changing something material; stop early if two attempts fail the same way with no new idea. Still failing → leave it unticked, stop and report *(auto-pilot: defer and continue)*.
|
|
55
55
|
5. **Report:** tasks done (for `ALL` / ranges: the range asked for, completed/total, and whether the plan is now finished; if fewer than `n` tasks remained for `NEXT:<n>`, say so), files changed, tests run (`tests: 4 passed (implementer) · verifier-checked`), verifier result (`verified (independent subagent)` or `verified (self)`), the dashboard path (`.agents/specs/<slug>/dashboard.html` — open it in a browser), and the next task id — for reference only.
|
|
56
56
|
|
|
57
|
-
**The verifier is told:** *"Confirm each task's Acceptance is genuinely met and run its `Verify` commands against the stated expected output. Re-run the tests and the relevant suite once; check they really cover the Acceptance and named edge cases and could fail — missing or vacuous tests are a FAIL. Read the diff for real defects: logic errors, broken callers, unhandled edge cases the plan names, a documented behavior dropped or inverted, a sibling-skill template re-implemented instead of copied. Check every code file the task created or changed against the Agent Reference's Coding Practices — ENFORCED: clean, professional TypeScript or JavaScript in the language the project already uses (never converted to the other unasked); strict types with no needless `any` in TypeScript; meaningful full-word names for every class, method, property, variable and parameter (one- or two-letter names, cryptic abbreviations and code-golf tricks are violations, except the allowed loop counters, axis/`uv` names and toolkit aliases, and names that bind to exported data); no dead code, unused imports or leftover `console.log`; well-structured code a developer new to the project can read and maintain. Any violation is a FAIL for that task — quote the offending lines. JSDoc is never a FAIL: missing, thin or stale JSDoc (including JavaScript type tags) never fails a test, a verification or an Acceptance item — list it under a separate non-blocking `JSDoc notes` heading. For any task whose correctness shows only at runtime — rendering, UI, interaction, Unity↔Babylon parity — check it live in the browser (and Unity where relevant) whether or not the plan marks it `live`, and do the plan's final end-to-end check live: look at the running result, beside the reference image when there is one, and judge it as a user would; passing unit tests never substitute. Do all of a phase's live checks in one session on the already-running dev server, and re-export from Unity only if the phase changed that scene's export — then only the project and the scenes the phase works on. Save the frames from your live session that show each visual task's verified result to `[SNAPSHOTS]` as `T<n>-<NN>-<stage>.png` — the same camera or viewport as the implementer's progression frames, plus any angle or comparison (Unity beside browser, before beside after) that proves the Acceptance — and return each path with a one-line caption saying what it shows. Snapshots never add a page session or an export of their own. Keep the dashboard current as you go: set each task `verifying` when you start checking it, and rewrite the live file at each check (what you are checking, on what) — never 15 minutes without a write. Treat an absolute count in the plan as 'named tests pass, no new failures'. [SCOPE] Return PASS/FAIL per task with evidence, listing records-only slips separately."*
|
|
57
|
+
**The verifier is told:** *"Confirm each task's Acceptance is genuinely met and run its `Verify` commands against the stated expected output. Re-run the tests and the relevant suite once; check they really cover the Acceptance and named edge cases and could fail — missing or vacuous tests are a FAIL. Read the diff for real defects: logic errors, broken callers, unhandled edge cases the plan names, a documented behavior dropped or inverted, a sibling-skill template re-implemented instead of copied. Check every code file the task created or changed against the Agent Reference's Coding Practices — ENFORCED: clean, professional TypeScript or JavaScript in the language the project already uses (never converted to the other unasked); strict types with no needless `any` in TypeScript; meaningful full-word names for every class, method, property, variable and parameter (one- or two-letter names, cryptic abbreviations and code-golf tricks are violations, except the allowed loop counters, axis/`uv` names and toolkit aliases, and names that bind to exported data); no dead code, unused imports or leftover `console.log`; well-structured code a developer new to the project can read and maintain. Any violation is a FAIL for that task — quote the offending lines. JSDoc is never a FAIL: missing, thin or stale JSDoc (including JavaScript type tags) never fails a test, a verification or an Acceptance item — list it under a separate non-blocking `JSDoc notes` heading. For any task whose correctness shows only at runtime — rendering, UI, interaction, Unity↔Babylon parity — check it live in the browser (and Unity where relevant) whether or not the plan marks it `live`, and do the plan's final end-to-end check live: look at the running result, beside the reference image when there is one, and judge it as a user would; passing unit tests never substitute. Do all of a phase's live checks in one session on the already-running dev server, and re-export from Unity only if the phase changed that scene's export — then only the project and the scenes the phase works on. Save the frames from your live session that show each visual task's verified result to `[SNAPSHOTS]` as `T<n>-<NN>-<stage>.png` — the same camera or viewport as the implementer's progression frames, plus any angle or comparison (Unity beside browser, before beside after) that proves the Acceptance — and return each path with a one-line caption saying what it shows. Snapshots never add a page session or an export of their own. Keep the dashboard current as you go: set each task `verifying` when you start checking it, and rewrite the live file at each check (what you are checking, on what) — never 15 minutes without a write. Treat an absolute count in the plan as 'named tests pass, no new failures'. [SCOPE] Return PASS/FAIL per task with evidence and one line on what you ran live and where (or `none — tests only`), listing records-only slips separately."*
|
|
58
58
|
|
|
59
59
|
`[SNAPSHOTS]` is the feature folder's `snapshots/` path (`.agents/specs/<slug>/snapshots/`). `[SCOPE]` is one of two sentences. **Standard:** *"Do not add mutation testing, fuzzing, restarts or audits of untouched files unless something you found points there; aim for about 25 tool calls and report rather than expand."* **`--strict`:** *"Be adversarial: actively look for any reason the Acceptance is NOT met, using whatever you judge worthwhile — mutation checks against the tests, randomized inputs, re-deriving values from the plan's Decisions and Design Reference, live QA of every rendered or exported surface."*
|
|
60
60
|
|
|
@@ -91,13 +91,13 @@ Every feature lives in one folder, created by bt-spec (or by bt-plan for a Quick
|
|
|
91
91
|
3. **Long commands are narrated.** Before any command that may run more than a few minutes (a full test chain, an export or bake, a multi-race or multi-scene browser run), write a step saying what it is and roughly how long it takes; run it in the background where the host allows, and write a step at each milestone its output shows ("race 2 of 4 reached results"). A long run is exactly when the user is watching.
|
|
92
92
|
|
|
93
93
|
- **The live file — at every meaningful step.** Rewrite `documents/<slug>_live.js` whole (it is small) when a task starts, at each milestone inside it, before anything slow (a build, an export, a bake, a capture, a test run), at each fix attempt, at the hand-over to the verifier and while it checks each task, and at the commit: the phase, the task, the role, one plain-language sentence on what is happening now, and the task's step log. Never let it go 15 minutes without a write during active work — the page flags a 20-minute silence. Between tasks, `task: ""` and a `title` (`Verifying phase 2`, `Committing phase 2`).
|
|
94
|
-
- **The dashboard data — at every task boundary:** a task becomes `in-progress` when it starts; `built` the moment it is built and its tests are green — with its summary of what was actually done (and anything surprising), files, tests and snapshots filled in **right then**, not at the phase end; `verifying` while the verifier checks it; `done` when it passes (verifier result, attempts, commit, done time, its `DECISION` lines); back to `in-progress` with `attempts` + 1 on a FAIL. Each change also adds an `activity` line and refreshes `updatedAt`.
|
|
94
|
+
- **The dashboard data — at every task boundary:** a task becomes `in-progress` when it starts; `built` the moment it is built and its tests are green — with its summary of what was actually done (and anything surprising), files, tests and snapshots filled in **right then**, not at the phase end; `verifying` while the verifier checks it; `done` when it passes (verifier result, attempts, commit, done time, its `DECISION` lines, and `checkedLive` — one line on what the verifier ran live and where, for every task it checked in the browser or Unity whatever the plan's verify level, `""` when tests alone proved it); back to `in-progress` with `attempts` + 1 on a FAIL. Each change also adds an `activity` line and refreshes `updatedAt`.
|
|
95
95
|
- **Every write goes through this skill's `scripts/dashboard.mjs` — never hand-edited.** Each data file is one `window.… =` prefix and one strict-JSON value (the prefix only lets a page opened from disk load it); the helper parses it, changes it, checks the shapes and writes it back atomically, so the page never sees a half-written or malformed file. Use it, not a one-off script of your own: `node <skills>/bt-execute/scripts/dashboard.mjs live <feature-folder> --task T7 --role implementer --activity "…" --step "…"` · `task <feature-folder> T7 --set '{"status":"built","summary":"…"}'` · `activity <feature-folder> "…"` · `status <feature-folder> in-progress` · `check <feature-folder>` (all options in the script's header). Only where Node cannot run, fall back to the parse-and-write-back recipe in `data-schema.md`. Keep each field its documented shape too — a list stays a list (`updates`, `snapshots`, `files`, `decisions`, `notes` …: append, never assign a string); a helper script you give subagents checks the shapes before it writes.
|
|
96
96
|
|
|
97
97
|
On top of the per-task updates:
|
|
98
98
|
|
|
99
99
|
- **Run start — the first thing the run does** (*Open the run before anything else*): **refresh `dashboard.html`** — copy it again from the template with `{{slug}}` replaced (it is never edited, so this is always safe, and it is how layout fixes reach dashboards created by older versions); then **sync the dashboard with the plan file** — re-read its checklist and add any phase or task (including sub-tasks like `T3.1`) the dashboard lacks, in plan order, as `pending`, with an `updates` note on it (`Added to the plan after <the plan was complete / phase 2 ran> — <why, if the plan says>`); a task the plan no longer has is removed with an `activity` line saying so. Then `status: "in-progress"`, `runs` + 1, the run-log document link, an `activity` line, the first live-file write, and the watchdog launched in the background. In a git repository, check `.gitignore` has `.agents/specs/*/documents/*_live.js` and append it once if not — the live file is never staged or committed; `<slug>_dashboard.js` and `snapshots/` are.
|
|
100
|
-
- **Each phase, after its ticks and before its commit:** the phase's status, times and minutes (from its `⏱` line), its verifier result and a two-or-three-sentence summary of what it delivered; the phase-level snapshots (a progression spanning several tasks — below); `decisions`; `activeTime
|
|
100
|
+
- **Each phase, after its ticks and before its commit:** the phase's status, times and minutes (from its `⏱` line), its verifier result and a two-or-three-sentence summary of what it delivered; the phase-level snapshots (a progression spanning several tasks — below); `decisions`; `activeTime` — the plan's total across **every run so far** (each finished run's `active` from its `⏱ Run <n> end` line, plus this run's so far), never this run alone; an `activity` line; and a current "so far" `outcome` headline.
|
|
101
101
|
- **A deferral:** the task's `status: "deferred"` and `deferredReason`, an `activity` line.
|
|
102
102
|
- **Run end — the After Action Report.** **decide the status by re-reading the plan file's checkboxes, never from memory:** `complete` when every task in the plan is `- [x]`; `incomplete` when every task is either ticked or marked ⏭️ DEFERRED; otherwise `paused` (the run covered only a slice, or tasks were added). The page refuses a `complete` it can see is false — it shows the plan as paused with a warning — but the plan file is the authority; never leave `in-progress` behind, because the status picks the page's top slot: `in-progress` shows *Current run activity* (the live file and the milestones), any other run-ended status shows the After Action Report in its place. Write `followUps` for a human, and `afterAction` — the whole plan's execution, start to finish: a one-sentence headline of what the plan delivered; two to four paragraphs on what was built, how it was proven and what surprised; highlights; and **one before/after for the plan as a whole** (`comparison`) — the plan-wide "before" frame beside a final "after" taken now from the same camera or viewport (the end-to-end check's session supplies it). Add the plan's key progression to `afterAction.snapshots` if one tells the story better than any single phase. Write `afterAction.testing` on every run, not only `--verbose`: run every test suite the plan touched **once more, in full, at run end** and record each as a `suites` entry (name, command, passed, failed, how many tests this plan added, and a `note` for any failure that pre-dates the plan) — never add up the tasks' counts, which re-count the same suite once per task; a `summary` of how the plan was tested (unit tests, the verifier's re-runs, what was checked live and on what, the end-to-end check); and `gaps` — what no test or live check covers. The page builds the task-by-task table and the list of test cases from the tasks. The figures (tasks, tests, retries, time) are computed by the page — never type them in. A run that ends before the plan is finished writes it too; the page marks it *Interim* while `paused`, and the next run revises it with an `updates` entry. **A reopened plan** (tasks added after it was complete) works the same way: the run that finishes the added tasks rewrites the After Action Report to cover them, notes the change in its `updates` (`Revised — T7 added after completion: <why>`), and retakes the plan-wide "after" from the same camera so the comparison shows the plan as it now stands.
|
|
103
103
|
- **`--verbose` — the same work, written up in depth.** It changes what is written, never what is done: tests, the verifier, live checks and snapshot captures are exactly as without it, and TIME MATTERS still holds (the extra cost is writing, not checking). Set `detail: "verbose"` at run start. Each task gets a `details` write-up (fields in `data-schema.md`), filled in by whoever has the facts, at the same per-task moments as everything else:
|
|
@@ -299,10 +299,12 @@
|
|
|
299
299
|
.stat-sub { margin-top: 4px; font-size: 12.5px; color: var(--text-muted); }
|
|
300
300
|
|
|
301
301
|
/* ---------- Phase route ---------- */
|
|
302
|
-
.route { display: flex; gap:
|
|
302
|
+
.route { display: flex; gap: 10px; margin-top: 16px; }
|
|
303
303
|
.route a {
|
|
304
304
|
flex: 1;
|
|
305
305
|
min-width: 0;
|
|
306
|
+
display: flex;
|
|
307
|
+
flex-direction: column;
|
|
306
308
|
text-decoration: none;
|
|
307
309
|
color: inherit;
|
|
308
310
|
}
|
|
@@ -310,11 +312,30 @@
|
|
|
310
312
|
.route-fill { height: 100%; border-radius: 999px; background: var(--done); }
|
|
311
313
|
.route a.is-in-progress .route-fill { background: var(--active); }
|
|
312
314
|
.route a.is-deferred .route-fill, .route a.is-partial .route-fill { background: var(--deferred); }
|
|
315
|
+
/* Each name sits on a panel as wide as its bar; every panel is the row's height, sized for two lines. */
|
|
313
316
|
.route-label {
|
|
317
|
+
flex: 1;
|
|
314
318
|
margin-top: 7px;
|
|
319
|
+
padding: 7px 9px;
|
|
320
|
+
min-height: calc(2 * 1.3em + 14px);
|
|
321
|
+
border: 1px solid var(--line);
|
|
322
|
+
border-radius: var(--radius-small);
|
|
323
|
+
background: var(--bg-raised);
|
|
315
324
|
font: 500 11.5px/1.3 var(--font-mono);
|
|
316
325
|
color: var(--text-muted);
|
|
326
|
+
transition: border-color 0.15s, color 0.15s;
|
|
327
|
+
}
|
|
328
|
+
/* At most two lines, so one long phase name never stretches the row; the full name is the tooltip. */
|
|
329
|
+
.route-name {
|
|
330
|
+
display: -webkit-box;
|
|
331
|
+
-webkit-box-orient: vertical;
|
|
332
|
+
-webkit-line-clamp: 2;
|
|
333
|
+
line-clamp: 2;
|
|
334
|
+
overflow: hidden;
|
|
335
|
+
overflow-wrap: anywhere;
|
|
317
336
|
}
|
|
337
|
+
.route a:hover .route-label { border-color: var(--line-strong); color: var(--text); }
|
|
338
|
+
.route a.is-in-progress .route-label { border-color: color-mix(in srgb, var(--active) 45%, transparent); background: var(--active-soft); color: var(--text); }
|
|
318
339
|
|
|
319
340
|
/* ---------- Summary ---------- */
|
|
320
341
|
.headline { margin: 0 0 12px; font-size: 21px; line-height: 1.35; letter-spacing: -0.01em; }
|
|
@@ -802,6 +823,8 @@
|
|
|
802
823
|
const VERDICT_BADGE_MAX_LENGTH = 16;
|
|
803
824
|
// The report's task-by-task testing table starts open for a short plan and folded for a long one.
|
|
804
825
|
const TESTING_TABLE_OPEN_ROWS = 12;
|
|
826
|
+
// A verifier result that names a live check: "live two-tab race in headless Chrome", "end-to-end on WebGPU".
|
|
827
|
+
const LIVE_CHECK_WORDS = /\blive\b|chrome|browser|webgl|webgpu|unity editor|play ?mode/i;
|
|
805
828
|
/** Where the Babylon Toolkit Desktop Agent, whose skills generate this dashboard, is published. */
|
|
806
829
|
const SKILLS_DOWNLOAD_URL = 'https://www.npmjs.com/package/@babylonjs-toolkit/agent';
|
|
807
830
|
/** Minutes without a live update before the Now banner warns that the run has gone quiet. */
|
|
@@ -863,7 +886,7 @@
|
|
|
863
886
|
|
|
864
887
|
const view = pageView();
|
|
865
888
|
// Stat tiles and phase bars first; then one slot that follows the run: Current run activity while it runs,
|
|
866
|
-
// the plan summary (After Action Report) once it is over.
|
|
889
|
+
// the Final plan summary (the After Action Report) once it is over.
|
|
867
890
|
appRoot.innerHTML = [
|
|
868
891
|
renderMasthead(feature, allTasks.length, doneCount),
|
|
869
892
|
renderNav(allUpdates.length, view),
|
|
@@ -923,7 +946,7 @@
|
|
|
923
946
|
function renderNav(updateCount, view) {
|
|
924
947
|
const links = [
|
|
925
948
|
view === 'running' ? ['current-activity', 'Current run'] : null,
|
|
926
|
-
view === 'finished' ? ['after-action', '
|
|
949
|
+
view === 'finished' ? ['after-action', 'Summary'] : null,
|
|
927
950
|
['phases', 'Phases'],
|
|
928
951
|
['decisions', 'Decisions'],
|
|
929
952
|
['follow-ups', 'Follow ups'],
|
|
@@ -938,19 +961,20 @@
|
|
|
938
961
|
const phases = report.phases || [];
|
|
939
962
|
const donePhases = phases.filter((phase) => phase.status === 'done').length;
|
|
940
963
|
const deferredCount = allTasks.filter((task) => task.status === 'deferred' || task.status === 'failed').length;
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
}
|
|
946
|
-
|
|
947
|
-
|
|
964
|
+
// The final suites are the true count; each task reports the whole suite it ran, so a sum of tasks over-counts.
|
|
965
|
+
const suites = finalSuites();
|
|
966
|
+
const testsTile = suites.length
|
|
967
|
+
? statTile('Tests', `${suites.reduce((total, suite) => total + (Number(suite.passed) || 0), 0)}<small> passed</small>`, sumFailed(suites) ? `${sumFailed(suites)} failing` : 'final suites, all green')
|
|
968
|
+
: statTile('Tests', `${allTasks.filter(hasTests).length}<small> / ${allTasks.length}</small>`, 'tasks with tests');
|
|
969
|
+
const activeTime = shortDuration(report.activeTime);
|
|
970
|
+
const estimate = shortEstimate(report.estimate);
|
|
948
971
|
|
|
949
972
|
const tiles = [
|
|
950
973
|
statTile('Tasks', `${doneCount}<small> / ${allTasks.length}</small>`, 'verified and ticked'),
|
|
951
974
|
statTile('Phases', `${donePhases}<small> / ${phases.length}</small>`, 'independently verified'),
|
|
952
|
-
|
|
953
|
-
statTile('Active time',
|
|
975
|
+
testsTile,
|
|
976
|
+
statTile('Active time', activeTime ? durationHtml(activeTime) : '—', estimate ? `of ${/[–-]/.test(estimate) ? '' : '~'}${escapeHtml(estimate)} estimated` : 'no estimate',
|
|
977
|
+
[report.activeTime, report.estimate && `Estimate: ${report.estimate}`].filter(Boolean).join('\n')),
|
|
954
978
|
statTile('Deferred', String(deferredCount), deferredCount ? 'see Follow ups' : 'nothing deferred'),
|
|
955
979
|
statTile('Runs', String(report.runs || 0), 'bt-execute runs so far'),
|
|
956
980
|
].join('');
|
|
@@ -962,15 +986,52 @@
|
|
|
962
986
|
const fill = tasks.length ? Math.round(((finished + awaitingVerifier / 2) / tasks.length) * 100) : 0;
|
|
963
987
|
return `<a href="#phase-${escapeAttribute(phase.number)}" class="is-${escapeAttribute(phase.status || 'pending')}" title="Phase ${escapeAttribute(phase.number)} — ${escapeAttribute(phase.name || '')}">
|
|
964
988
|
<div class="route-bar"><div class="route-fill" style="width:${fill}%"></div></div>
|
|
965
|
-
<div class="route-label">P${escapeHtml(phase.number)} · ${escapeHtml(phase.name || '')}</div>
|
|
989
|
+
<div class="route-label"><span class="route-name">P${escapeHtml(phase.number)} · ${escapeHtml(phase.name || '')}</span></div>
|
|
966
990
|
</a>`;
|
|
967
991
|
}).join('');
|
|
968
992
|
|
|
969
993
|
return `<div class="stats">${tiles}</div>${route ? `<nav class="route" aria-label="Phase progress">${route}</nav>` : ''}`;
|
|
970
994
|
}
|
|
971
995
|
|
|
972
|
-
function statTile(label, valueHtml, subText) {
|
|
973
|
-
return `<div class="card stat"><div class="stat-label">${label}</div><div class="stat-value">${valueHtml}</div><div class="stat-sub">${subText}</div></div>`;
|
|
996
|
+
function statTile(label, valueHtml, subText, title = '') {
|
|
997
|
+
return `<div class="card stat"${title ? ` title="${escapeAttribute(title)}"` : ''}><div class="stat-label">${label}</div><div class="stat-value">${valueHtml}</div><div class="stat-sub">${subText}</div></div>`;
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
/**
|
|
1001
|
+
* The first duration in a time note — "5 h 54 min (run 5); earlier runs in the run log" → { hours: 5, minutes: 54 }.
|
|
1002
|
+
* The data holds whatever the run log said; the card shows only the time, the full note is its tooltip.
|
|
1003
|
+
*/
|
|
1004
|
+
function shortDuration(text) {
|
|
1005
|
+
const match = /(?:(\d+(?:\.\d+)?)\s*h(?:ours?)?\b)?\s*(?:(\d+)\s*min)?/i;
|
|
1006
|
+
for (const candidate of String(text || '').matchAll(new RegExp(match.source, 'gi'))) {
|
|
1007
|
+
if (candidate[1] || candidate[2]) {
|
|
1008
|
+
const total = Math.round(Number(candidate[1] || 0) * 60) + Number(candidate[2] || 0);
|
|
1009
|
+
return { hours: Math.floor(total / 60), minutes: total % 60 };
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
return null;
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
function durationText({ hours, minutes }) {
|
|
1016
|
+
return hours ? `${hours} h${minutes ? ` ${minutes} min` : ''}` : `${minutes} min`;
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
function durationHtml({ hours, minutes }) {
|
|
1020
|
+
if (!hours) return `${minutes}<small> min</small>`;
|
|
1021
|
+
return `${hours}<small> h</small>${minutes ? ` ${minutes}<small> min</small>` : ''}`;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
/**
|
|
1025
|
+
* The headline figure of an estimate note: "about 944 min ≈ 15.7 h of agent time (range …)" → "15.7 h";
|
|
1026
|
+
* "3–6 h" stays a range. Brackets are detail; after a "≈" comes the rounded figure.
|
|
1027
|
+
*/
|
|
1028
|
+
function shortEstimate(text) {
|
|
1029
|
+
let main = String(text || '').split('(')[0];
|
|
1030
|
+
if (main.includes('≈')) main = main.slice(main.lastIndexOf('≈') + 1);
|
|
1031
|
+
const hours = /(\d+(?:\.\d+)?(?:\s*[–-]\s*\d+(?:\.\d+)?)?)\s*h\b/i.exec(main);
|
|
1032
|
+
if (hours) return `${hours[1].replace(/\s+/g, '')} h`;
|
|
1033
|
+
const duration = shortDuration(main);
|
|
1034
|
+
return duration ? `${duration.hours ? `${duration.hours} h ` : ''}${duration.minutes ? `${duration.minutes} min` : ''}`.trim() : '';
|
|
974
1035
|
}
|
|
975
1036
|
|
|
976
1037
|
/**
|
|
@@ -1011,7 +1072,7 @@
|
|
|
1011
1072
|
}
|
|
1012
1073
|
return `
|
|
1013
1074
|
<section id="after-action">
|
|
1014
|
-
<div class="section-head"><h2>
|
|
1075
|
+
<div class="section-head"><h2>Final plan summary</h2><span class="section-note">The whole plan's execution, start to finish</span></div>
|
|
1015
1076
|
${body}
|
|
1016
1077
|
</section>`;
|
|
1017
1078
|
}
|
|
@@ -1033,8 +1094,8 @@
|
|
|
1033
1094
|
testsFigure,
|
|
1034
1095
|
['Needed a second attempt', String(retried)],
|
|
1035
1096
|
['Deferred', String(deferred)],
|
|
1036
|
-
['Active time', report.activeTime
|
|
1037
|
-
['Estimate', report.estimate || '—'],
|
|
1097
|
+
['Active time', shortDuration(report.activeTime) ? durationText(shortDuration(report.activeTime)) : '—'],
|
|
1098
|
+
['Estimate', shortEstimate(report.estimate) || '—'],
|
|
1038
1099
|
['Runs', String(report.runs || 0)],
|
|
1039
1100
|
];
|
|
1040
1101
|
return `<dl class="figures">${rows.map(([label, value]) => `<div><dt>${label}</dt><dd>${escapeHtml(value)}</dd></div>`).join('')}</dl>`;
|
|
@@ -1097,7 +1158,7 @@
|
|
|
1097
1158
|
const tags = [
|
|
1098
1159
|
snapshotBadge(task.snapshots),
|
|
1099
1160
|
task.kind ?`<span class="tag">${escapeHtml(task.kind)}</span>` : '',
|
|
1100
|
-
task
|
|
1161
|
+
hasLiveCheck(task) ? `<span class="tag" title="${escapeAttribute(liveCheckNote(task))}">live check</span>` : '',
|
|
1101
1162
|
task.attempts > 1 ? `<span class="tag">${escapeHtml(task.attempts)} attempts</span>` : '',
|
|
1102
1163
|
status === 'built' || status === 'verifying' ? `<span class="status status-${status}">${STATUS_LABELS[status]}</span>` : '',
|
|
1103
1164
|
updatedBadge(task.updates),
|
|
@@ -1240,8 +1301,22 @@
|
|
|
1240
1301
|
return Boolean(task.tests && (Number(task.tests.passed) || Number(task.tests.failed)));
|
|
1241
1302
|
}
|
|
1242
1303
|
|
|
1304
|
+
/**
|
|
1305
|
+
* Whether the task was checked by running the real thing. The plan's `verifyLevel` is only the intent — a
|
|
1306
|
+
* verifier often checks a `standard` task live too — so the record of the check counts as well: the
|
|
1307
|
+
* `checkedLive` note, a verbose `liveCheck`, a verifier result that names a live check, or a snapshot
|
|
1308
|
+
* captured in the browser or Unity.
|
|
1309
|
+
*/
|
|
1243
1310
|
function hasLiveCheck(task) {
|
|
1244
|
-
return task.verifyLevel === 'live'
|
|
1311
|
+
return task.verifyLevel === 'live'
|
|
1312
|
+
|| Boolean(task.checkedLive || (task.details && task.details.liveCheck))
|
|
1313
|
+
|| LIVE_CHECK_WORDS.test(task.verifier || '')
|
|
1314
|
+
|| (task.snapshots || []).some((snapshot) => ['browser', 'unity'].includes(snapshot.source));
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
function liveCheckNote(task) {
|
|
1318
|
+
return task.checkedLive || (task.details && task.details.liveCheck) || (LIVE_CHECK_WORDS.test(task.verifier || '') ? task.verifier : '')
|
|
1319
|
+
|| ((task.snapshots || []).length ? 'Snapshots captured from the running result' : 'Checked live');
|
|
1245
1320
|
}
|
|
1246
1321
|
|
|
1247
1322
|
function testCasesOf(task) {
|
|
@@ -1285,7 +1360,7 @@
|
|
|
1285
1360
|
: `<span class="cell-note" title="${escapeAttribute(tests.note || '')}">${tests.note ? escapeHtml(tests.note) : '—'}</span>`,
|
|
1286
1361
|
(tests.files || []).length ? tests.files.map((file) => `<code>${escapeHtml(file)}</code>`).join('<br>') : '—',
|
|
1287
1362
|
cases.length ? `${cases.length}${casesFailed ? `<div class="count count-fail">${casesFailed} failed</div>` : ''}` : '—',
|
|
1288
|
-
hasLiveCheck(task) ? `<span title="${escapeAttribute((task
|
|
1363
|
+
hasLiveCheck(task) ? `<span title="${escapeAttribute(liveCheckNote(task))}">Yes</span>` : '—',
|
|
1289
1364
|
];
|
|
1290
1365
|
}));
|
|
1291
1366
|
|
|
@@ -77,7 +77,7 @@ instead of a blank page if something still cannot render — it keeps checking a
|
|
|
77
77
|
- A task added to the plan after it was complete is added here as `pending`, in plan order, with an `updates`
|
|
78
78
|
note saying why — and `complete` becomes `paused`.
|
|
79
79
|
- The status picks the page's top slot: `in-progress` shows *Current run activity* (the live file and the
|
|
80
|
-
milestones); `paused`, `complete` and `incomplete` show *
|
|
80
|
+
milestones); `paused`, `complete` and `incomplete` show *Final plan summary* (the After Action Report, marked
|
|
81
81
|
*Interim* while paused).
|
|
82
82
|
- **Cadence is per task.** A task's entry changes the moment it starts (`in-progress`), the moment it is built
|
|
83
83
|
(`built` — summary, files, tests and snapshots filled in right then), while the verifier checks it
|
|
@@ -95,8 +95,8 @@ Top level:
|
|
|
95
95
|
| `status` | see *Status* |
|
|
96
96
|
| `detail` | `"normal"`, or `"verbose"` once any run used `bt-execute --verbose` (never set back) |
|
|
97
97
|
| `updatedAt` | last write, `"YYYY-MM-DD HH:MM"` |
|
|
98
|
-
| `estimate` | the plan's Total
|
|
99
|
-
| `activeTime` |
|
|
98
|
+
| `estimate` | the plan's Total, short: `"3–6 h"` or `"about 7 h"` — the card shows its hours; keep ranges and working-out in the plan |
|
|
99
|
+
| `activeTime` | the plan's total active time across **every run so far** — each run's `active` from its `⏱ Run <n> end` line, added up — as the duration only: `"14 h 10 min"`, no notes. The card shows it beside the estimate, so one run's time alone understates the plan |
|
|
100
100
|
| `runs` | number of bt-execute runs so far |
|
|
101
101
|
| `afterAction` | the After Action Report (below) |
|
|
102
102
|
| `phases` | the plan's phases, each with its tasks (below) |
|
|
@@ -154,6 +154,7 @@ Each task:
|
|
|
154
154
|
| `files` | paths changed |
|
|
155
155
|
| `tests` | `{ "passed", "failed", "files": [".agents/specs/<slug>/tests/…"], "note" }` or `null` |
|
|
156
156
|
| `verifier` | `"PASS — independent subagent; live check in Chrome"` |
|
|
157
|
+
| `checkedLive` | every run, not only `--verbose`: one line on what the verifier ran live and where — `"two-tab Shared race in headless Chrome, 150 ms lag"`; `""` when it was proven by tests alone. The page's *live check* badge and column read it (a task the plan marked `live` always counts) |
|
|
157
158
|
| `attempts`, `commit`, `doneAt` | as recorded |
|
|
158
159
|
| `deferredReason` | why it was deferred, if it was |
|
|
159
160
|
| `decisions` | `"DECISION T1: … — source"` lines |
|