@babylonjs-toolkit/agent 1.1.86 → 1.1.99
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 +5 -6
- package/package.json +1 -1
- package/skills/bt-execute/SKILL.md +17 -15
- package/skills/bt-execute/scripts/dashboard.mjs +297 -5
- package/skills/bt-execute/templates/dashboard/dashboard.html +29 -3
- package/skills/bt-execute/templates/dashboard/dashboard.template.js +1 -2
- package/skills/bt-execute/templates/dashboard/data-schema.md +8 -6
- package/skills/bt-gauntlet/references/spec-composition.md +3 -1
- package/skills/bt-plan/SKILL.md +2 -2
- package/skills/bt-profile/SKILL.md +21 -1
- package/skills/bt-profile/scripts/analyze.mjs +160 -0
- package/skills/bt-profile/scripts/lib/probe.mjs +119 -2
- package/skills/bt-profile/scripts/report.mjs +46 -1
- package/skills/bt-spec/SKILL.md +7 -7
|
@@ -108,6 +108,7 @@ function pageData(analysis, reportDir, captureDir) {
|
|
|
108
108
|
timeline,
|
|
109
109
|
marks: analysis.marks,
|
|
110
110
|
worstFrames: analysis.worstFrames,
|
|
111
|
+
lateStutter: analysis.lateStutter || null,
|
|
111
112
|
hotLines: analysis.hotLines,
|
|
112
113
|
excerpts: analysis.excerpts,
|
|
113
114
|
heap: analysis.heap,
|
|
@@ -565,6 +566,46 @@ function renderWorst() {
|
|
|
565
566
|
$("#worst").innerHTML = "<div class='scroll'><table><thead><tr><th class='num'>at</th><th>Phase</th><th>Kind</th><th class='num'>CPU ms</th><th class='num'>gap ms</th><th class='num'>script ms</th><th class='num'>new pipelines</th><th>Filled by</th><th>Your code in it</th></tr></thead><tbody>" + run.worstFrames.map((f) => "<tr><td class='num'>" + fmt(f.t) + "s</td><td class='nw'>" + esc(f.phase || "") + "</td><td class='nw'>" + esc(kindLabel[f.kind] || "–") + "</td><td class='num'>" + fmt(f.cpuMs) + "</td><td class='num'>" + fmt(f.intervalMs) + "</td><td class='num'>" + fmt(f.scriptMs) + "</td><td class='num'>" + fmt(f.pipelinesNear) + "</td><td class='where'>" + esc(f.top.map((e) => e.name + " " + e.ms).join(" · ")) + "</td><td class='where'>" + (f.yours.map((e) => link(e.file, e.line, e.name + " " + e.ms + " ms")).join(" · ") || "–") + "</td></tr>").join("") + "</tbody></table></div>";
|
|
566
567
|
}
|
|
567
568
|
|
|
569
|
+
/**
|
|
570
|
+
* Late stutter: what happened for the first time after the reveal, and the hitches it lined up with. Late compiles are
|
|
571
|
+
* grouped by cause, each with the fix that usually removes it (the Babylon Toolkit's pre-warm rules).
|
|
572
|
+
*/
|
|
573
|
+
function renderLate() {
|
|
574
|
+
const late = run.lateStutter;
|
|
575
|
+
const wrap = $("#late-wrap");
|
|
576
|
+
if (!late || (!late.hitchCount && !late.lateCompileCount && !late.pipelinesAfterReveal)) { wrap.style.display = "none"; return; }
|
|
577
|
+
const kindFix = {
|
|
578
|
+
particles: "Particles: pre-warm the system with TOOLKIT.SceneShaderWarmup.WarmParticleSystem(system), or register the prefab that spawns it with WarmPrefab.",
|
|
579
|
+
postprocess: "Post processes: create them at load and toggle them; never create one during play.",
|
|
580
|
+
renderpass: "Render passes: create render targets, mirrors, probes and cameras at load; stop their refresh instead of creating them later.",
|
|
581
|
+
mesh: "Meshes: spawned during play → register the prefab with WarmPrefab before the reveal. Already in the scene → a variant change during play (a light added, fog or clip planes toggled, a first instance, a texture transform moved, a look-alike material) — or a pass the pre-warm never drew (see the passes above).",
|
|
582
|
+
unknown: "Unknown cause: re-run on a development build so the toolkit's detector names it.",
|
|
583
|
+
};
|
|
584
|
+
const isMainPass = (name) => /^main$/i.test(name);
|
|
585
|
+
const summary = '<p class="meta">Revealed at ' + (late.revealT != null ? fmt(late.revealT) + " s (" + esc(late.revealSource) + ")" : "— no reveal found") +
|
|
586
|
+
" · " + fmt(late.hitchCount, 0) + " hitch(es) over " + fmt(late.hitchThresholdMs, 0) + " ms (" + fmt(late.hitchMs, 0) + " ms in all) · " + fmt(late.lateCompileCount, 0) + " late compile(s) · " +
|
|
587
|
+
fmt(late.pipelinesAfterReveal, 0) + " pipelines · " + fmt(late.texturesAfterReveal, 0) + " textures · " + fmt(late.audioDecodesAfterReveal, 0) + " audio decodes · " + fmt((late.downloadsAfterReveal || []).length, 0) + " downloads after the reveal" +
|
|
588
|
+
(late.toolkit && late.toolkit.safetyNet ? ". The WebGPU safety net is on: a late pipeline skips its draw for a frame or two, so it shows as pop-in rather than a freeze." : ".") + "</p>";
|
|
589
|
+
const suspects = (h) => [
|
|
590
|
+
h.lateCompileCount ? h.lateCompileCount + " late compile(s): " + h.lateCompiles.slice(0, 2).join("; ") : "",
|
|
591
|
+
h.pipelines ? h.pipelines + " pipelines" : "", h.gcMs ? "GC " + fmt(h.gcMs) + " ms" : "", h.textures ? h.textures + " textures" : "",
|
|
592
|
+
h.downloads.length ? "downloads " + h.downloads.map((d) => d.name).join(", ") : "", h.audioDecodes ? h.audioDecodes + " audio decode(s)" : "",
|
|
593
|
+
Object.keys(h.growth).length ? "new " + Object.keys(h.growth).map((k) => h.growth[k] + " " + k).join(", ") : "",
|
|
594
|
+
].filter(Boolean).join(" · ");
|
|
595
|
+
const hitches = late.hitches.length ? "<div class='scroll'><table><thead><tr><th class='num'>at</th><th class='num'>after reveal</th><th>Phase</th><th class='num'>frame ms</th><th>Likely cause</th><th class='num'>script ms</th><th>Suspects</th><th>Your code in it</th></tr></thead><tbody>" +
|
|
596
|
+
late.hitches.map((h) => "<tr><td class='num'>" + fmt(h.t) + "s</td><td class='num'>" + (h.msAfterReveal != null ? fmt(h.msAfterReveal / 1000) + "s" : "–") + "</td><td class='nw'>" + esc(h.phase || "") + "</td><td class='num'>" + fmt(h.intervalMs) + "</td><td>" + esc(h.likely) + "</td><td class='num'>" + fmt(h.scriptMs) + "</td><td class='where'>" + esc(suspects(h) || "–") + "</td><td class='where'>" + (h.yours.map((e) => link(e.file, e.line, e.name + " " + e.ms + " ms")).join(" · ") || "–") + "</td></tr>").join("") + "</tbody></table></div>" : "<p class='meta'>No hitches after the reveal.</p>";
|
|
597
|
+
const passes = (late.lateCompilePasses || []).length ? "<h3>Late compiles by render pass</h3><div class='scroll'><table><thead><tr><th class='num'>count</th><th>Render pass</th><th class='num'>causes</th><th class='num'>first after reveal</th><th>What it means</th></tr></thead><tbody>" +
|
|
598
|
+
late.lateCompilePasses.map((p) => "<tr><td class='num'>" + fmt(p.count, 0) + "</td><td class='where'>" + esc(p.pass) + "</td><td class='num'>" + fmt(p.causes, 0) + "</td><td class='num'>" + fmt(p.firstMsAfterReveal / 1000) + "s</td><td>" +
|
|
599
|
+
esc(isMainPass(p.pass) ? "The main pass: see the causes below." : "A camera or render target the pre-warm never drew: one created after the reveal (create it at load), or WarmAllCamerasOnReveal turned off. Toolkit 1.1.88+ warms every screen camera in the scene at the reveal; an older toolkit warms only the camera active while it runs.") + "</td></tr>").join("") + "</tbody></table></div>" : "";
|
|
600
|
+
const kinds = [...new Set(late.lateCompiles.map((g) => g.causeKind || "unknown"))];
|
|
601
|
+
const compiles = late.lateCompiles.length ? "<h3>Late compiles by cause</h3><div class='scroll'><table><thead><tr><th class='num'>count</th><th>Cause</th><th>Shader</th><th class='num'>first after reveal</th></tr></thead><tbody>" +
|
|
602
|
+
late.lateCompiles.map((g) => "<tr><td class='num'>" + fmt(g.count, 0) + "</td><td class='where'>" + esc(g.cause) + "</td><td class='nw'>" + esc(g.effects.join(", ") || "–") + "</td><td class='num'>" + fmt(g.firstMsAfterReveal / 1000) + "s</td></tr>").join("") + "</tbody></table></div>" +
|
|
603
|
+
"<p class='meta'><strong>What usually fixes them.</strong></p><ul class='meta'>" + kinds.map((k) => "<li>" + esc(kindFix[k] || kindFix.unknown) + "</li>").join("") + "</ul>" : "";
|
|
604
|
+
const downloads = (late.downloadsAfterReveal || []).length ? "<h3>Downloads that finished after the reveal</h3><div class='scroll'><table><thead><tr><th class='num'>at</th><th>File</th><th>Type</th><th class='num'>KB</th><th class='num'>ms</th></tr></thead><tbody>" +
|
|
605
|
+
late.downloadsAfterReveal.map((d) => "<tr><td class='num'>" + fmt(d.t) + "s</td><td class='where'>" + esc(d.name) + "</td><td class='nw'>" + esc(d.type) + "</td><td class='num'>" + fmt(d.kb, 0) + "</td><td class='num'>" + fmt(d.ms, 0) + "</td></tr>").join("") + "</tbody></table></div>" : "";
|
|
606
|
+
$("#late").innerHTML = summary + hitches + passes + compiles + downloads;
|
|
607
|
+
}
|
|
608
|
+
|
|
568
609
|
function renderShots() {
|
|
569
610
|
if (!run.shots.length) { $("#shots-wrap").style.display = "none"; return; }
|
|
570
611
|
$("#shots").innerHTML = run.shots.map((s) => {
|
|
@@ -606,7 +647,7 @@ $("#theme").addEventListener("click", () => {
|
|
|
606
647
|
const dark = root.dataset.theme ? root.dataset.theme === "dark" : !matchMedia("(prefers-color-scheme: light)").matches;
|
|
607
648
|
root.dataset.theme = dark ? "light" : "dark";
|
|
608
649
|
});
|
|
609
|
-
renderTiles(); renderFindings(); renderFixes(); renderTimeline(); renderPhases(); renderOwners(); renderFunctions(); renderHeap(); renderWorst(); renderShots(); renderWarm(); renderMeta();
|
|
650
|
+
renderTiles(); renderFindings(); renderFixes(); renderTimeline(); renderPhases(); renderOwners(); renderFunctions(); renderHeap(); renderWorst(); renderLate(); renderShots(); renderWarm(); renderMeta();
|
|
610
651
|
let resizeTimer; addEventListener("resize", () => { clearTimeout(resizeTimer); resizeTimer = setTimeout(renderTimeline, 150); });
|
|
611
652
|
`;
|
|
612
653
|
|
|
@@ -649,6 +690,10 @@ function buildPage({ title, verdict, data, pdfName }) {
|
|
|
649
690
|
<section class="panel"><div class="legend" id="owner-legend"></div><div id="chart-owners"></div>
|
|
650
691
|
<div id="film-wrap"><div class="film" id="film"></div></div></section>
|
|
651
692
|
|
|
693
|
+
<div id="late-wrap"><h2>Late stutter — after the reveal</h2>
|
|
694
|
+
<p class="meta">What happened for the first time after the loading screen lifted, and the hitches it lined up with. A finished game drives the late compiles to zero: everything it draws is compiled behind the splash.</p>
|
|
695
|
+
<section class="panel" id="late"></section></div>
|
|
696
|
+
|
|
652
697
|
<h2>Phases</h2>
|
|
653
698
|
<section class="phases" id="phases"></section>
|
|
654
699
|
|
package/skills/bt-spec/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: bt-spec
|
|
3
|
-
description: "The Babylon Toolkit Spec Skill creates a feature spec file
|
|
3
|
+
description: "The Babylon Toolkit Spec Skill creates a feature spec file from a short idea, plus the feature's dashboard (`.agents/specs/<slug>/dashboard.html`), which shows the bt-plan commands to copy until the feature is planned. Use when asked to spec, spec out, plan, or scaffold a new feature (\"spec out a mute toggle\", \"let's spec this\")."
|
|
4
4
|
allowed-tools: Read, Grep, Glob, Write, WebFetch(domain:raw.githubusercontent.com), Bash(git switch:*), AskUserQuestion, Agent, Task
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -28,11 +28,11 @@ Turn a short feature idea into a spec file that `bt-plan` can plan from. Follow
|
|
|
28
28
|
- **Say what you are doing.** Before any step that takes more than a few seconds (a fetch, a big read, subagents) print one short line — `🔎 [bt-spec] <what> …` — and one line when it returns. A silent run looks like a hang and gets cancelled.
|
|
29
29
|
- **Subagents:** running this skill is the user's request to use them where this skill says so. Use whatever subagent tool your host provides (its name varies by host — e.g. `Agent` or `Task`); if there is none, do the work inline and say so. Tell research subagents they need not read the Agent Reference.
|
|
30
30
|
|
|
31
|
-
## Step 1. Arguments
|
|
31
|
+
## Step 1. Arguments and name
|
|
32
32
|
|
|
33
|
-
From the flag-stripped brief derive `feature_title` (Title Case), `feature_slug` (lowercase kebab-case, `a-z 0-9 -` only, max 40 chars) and `branch_name` = `
|
|
33
|
+
From the flag-stripped brief derive `feature_title` (Title Case), `feature_slug` (lowercase kebab-case, `a-z 0-9 -` only, max 40 chars) and `branch_name` = the branch currently checked out (`git rev-parse --abbrev-ref HEAD`; empty without git), recorded for reference only. If a folder of that name already exists in `.agents/specs/`, `.agents/complete/` or anywhere under `.agents/archived/` (the user moves finished features from `specs/` to `complete/` for review, and later on to `archived/`), append `-02`, `-03` … to the slug, so any of them can be moved back. If you cannot infer a sensible title, ask. Make a first estimate of the feature's `size` (defined in Step 5) — it sizes the research in Step 2.
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
**Never touch git.** Do not create, switch or delete a branch, and never commit, stage, stash or discard anything: the spec is written on whatever branch is checked out, and uncommitted or untracked files are the user's, left exactly as they are. The user creates branches and commits when they choose. Without git (no binary, a sandboxed host such as the Babylon Toolkit App Builder), leave `branch_name` empty and do not mention git.
|
|
36
36
|
|
|
37
37
|
## Step 2. Read the project
|
|
38
38
|
|
|
@@ -84,7 +84,7 @@ Print `✍️ [bt-spec] Drafting .agents/specs/<feature_slug>/documents/<feature
|
|
|
84
84
|
```markdown
|
|
85
85
|
# Spec for <feature-name>
|
|
86
86
|
|
|
87
|
-
branch:
|
|
87
|
+
branch: <the branch checked out when the spec was written, or none>
|
|
88
88
|
design_system: DESIGN.md
|
|
89
89
|
spec_impact: <yes|no>
|
|
90
90
|
size: <small|medium|large>
|
|
@@ -135,7 +135,7 @@ Write the dashboard **straight after its spec, before anything else** — a spec
|
|
|
135
135
|
Print `🗂️ [bt-spec] Writing the feature dashboard …`. The feature's dashboard exists from the spec on: until a plan is written it shows the `bt-plan` commands that plan this spec — a standard plan, `--heavy`, `--parity`, `--no-time-limit` — each with a copy button, and a *Build your own* with those options and a brief. From bt-execute's `templates/dashboard/` *(where skills load through a tool: `load_skill('bt-execute')` + `read_skill_resource`; where they are files: the sibling `bt-execute/` folder in the skills directory this skill was loaded from)*:
|
|
136
136
|
|
|
137
137
|
- copy `dashboard.html` to `.agents/specs/<feature_slug>/dashboard.html`, replacing `{{slug}}` with the slug and changing nothing else;
|
|
138
|
-
- write `.agents/specs/<feature_slug>/documents/<feature_slug>_dashboard.js` from the starter `dashboard.template.js`, written whole as strict JSON behind its `window.FEATURE_DASHBOARD =` prefix — double-quoted keys, no comments, no trailing commas (`data-schema.md` documents every field): `feature` (title, slug, branch, `origin: "spec"`, size, proof, a plain-language summary from the spec's Summary), `documents` (the Spec alone), **`status: "specified"`**, `updatedAt` (the current local time, `YYYY-MM-DD HH:MM`), `estimate` empty, **no phases**, an empty `afterAction`, the spec
|
|
138
|
+
- write `.agents/specs/<feature_slug>/documents/<feature_slug>_dashboard.js` from the starter `dashboard.template.js`, written whole as strict JSON behind its `window.FEATURE_DASHBOARD =` prefix — double-quoted keys, no comments, no trailing commas (`data-schema.md` documents every field): `feature` (title, slug, branch, `origin: "spec"`, size, proof, a plain-language summary from the spec's Summary), `documents` (the Spec alone), **`status: "specified"`**, `updatedAt` (the current local time, `YYYY-MM-DD HH:MM`), `estimate` empty, **no phases**, an empty `afterAction`, the spec’s Decisions as `decisions` when it has any, each an object `{ "id": "D1", "text": "…", "updates": [] }` (never a plain `"D1 — …"` string, which shows as an empty row), no follow ups, and one `activity` line: `Spec written — <size>, <proof> proof`;
|
|
139
139
|
- write `.agents/specs/<feature_slug>/documents/<feature_slug>_live.js` from `live.template.js`, the same way: no task, `role: "orchestrator"`, `title: "Spec written — waiting for bt-plan"`, no steps;
|
|
140
140
|
- in a git repository, make sure `.gitignore` (at the repository root) contains the line `.agents/*/*/documents/*_live.js` — append it once if missing.
|
|
141
141
|
|
|
@@ -144,7 +144,7 @@ If the template cannot be found, skip the dashboard and say so — bt-plan creat
|
|
|
144
144
|
## Step 7. Report
|
|
145
145
|
|
|
146
146
|
```
|
|
147
|
-
Branch: <branch_name>
|
|
147
|
+
Branch: <branch_name> (unchanged — the spec was written on the branch you had checked out)
|
|
148
148
|
Spec file: .agents/specs/<feature_slug>/documents/<feature_slug>_spec.md
|
|
149
149
|
Dashboard: .agents/specs/<feature_slug>/dashboard.html (open it in a browser to copy a bt-plan command)
|
|
150
150
|
Title: <feature_title>
|