@babylonjs-toolkit/agent 1.2.14 → 1.2.16

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 CHANGED
@@ -1,4 +1,4 @@
1
- # Babylon Toolkit Desktop Agent (1.2.14)
1
+ # Babylon Toolkit Desktop Agent (1.2.16)
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
 
@@ -84,6 +84,7 @@ newer Reference.
84
84
  ```bash
85
85
  bt-agent diskinfo # print the report and save Desktop/disk-report-YYYY-MM-DD-HHMM.txt
86
86
  bt-agent diskinfo --no-save # print only
87
+ bt-agent diskinfo --folder ~/Documents/Repos # scan just this folder
87
88
  bt-agent diskinfo --out report.txt
88
89
  bt-agent diskinfo --json # machine-readable
89
90
  ```
@@ -95,6 +96,10 @@ npm / Yarn / pnpm / pip / NuGet caches, Docker and WSL disks, VS Code's C++ cach
95
96
  Trash / Recycle Bin), every `node_modules`, the Unity `Library/` and Unreal `Intermediate/` folders
96
97
  that rebuild themselves, the largest files, and suggested cleanup commands. Nothing is deleted or run.
97
98
 
99
+ `--folder <dir>` scans that one folder instead (`~` and relative paths work): its largest items,
100
+ the known space hogs, `node_modules`, Unity / Unreal projects and big files inside it — nothing
101
+ outside it is walked.
102
+
98
103
  ### Freeing ports
99
104
 
100
105
  ```bash
@@ -5,7 +5,7 @@ const os = require('os');
5
5
  const path = require('path');
6
6
 
7
7
  const { buildReport, formatReport, human } = require('./report');
8
- const { prettyPath } = require('../paths');
8
+ const { prettyPath, expandHome } = require('../paths');
9
9
 
10
10
  const USAGE = `
11
11
  bt-agent diskinfo — show where your disk space is going (macOS, Windows, Linux)
@@ -13,12 +13,19 @@ bt-agent diskinfo — show where your disk space is going (macOS, Windows, Linux
13
13
  Read-only: it walks your home folder and the main system folders once, then prints
14
14
  the biggest folders, known space hogs (Unity, Xcode, package caches, Docker ...),
15
15
  node_modules and Unity/Unreal folders that rebuild themselves, the largest files,
16
- and suggested cleanup commands. Nothing is deleted or run.
16
+ and suggested cleanup commands. Nothing is deleted or run. With --folder it walks
17
+ only that folder (and reports only what lies inside it).
17
18
 
18
19
  Usage
19
20
  bt-agent diskinfo [options]
20
21
 
22
+ Examples
23
+ bt-agent diskinfo
24
+ bt-agent diskinfo --folder ~/Documents/Repos
25
+ bt-agent diskinfo --folder D:\\Projects --no-save
26
+
21
27
  Options
28
+ --folder <dir> Scan only this folder instead of your home folder and the system folders
22
29
  --out <file> Save the report here (default: Desktop/disk-report-YYYY-MM-DD-HHMM.txt)
23
30
  --no-save Print only; do not save a copy
24
31
  --json Machine-readable output on stdout (saved only with --out)
@@ -26,7 +33,7 @@ Options
26
33
  `;
27
34
 
28
35
  function parseDiskInfoArgs(argv) {
29
- const opts = { json: false, save: true, out: null, help: false };
36
+ const opts = { json: false, save: true, out: null, folder: null, help: false };
30
37
  for (let i = 0; i < argv.length; i += 1) {
31
38
  const arg = argv[i];
32
39
  if (arg === '-h' || arg === '--help') opts.help = true;
@@ -36,11 +43,31 @@ function parseDiskInfoArgs(argv) {
36
43
  opts.out = argv[++i];
37
44
  if (!opts.out) throw new Error('--out needs a file path');
38
45
  } else if (arg.startsWith('--out=')) opts.out = arg.slice('--out='.length);
46
+ else if (arg === '--folder') {
47
+ opts.folder = argv[++i];
48
+ if (!opts.folder) throw new Error('--folder needs a folder path');
49
+ } else if (arg.startsWith('--folder=')) {
50
+ opts.folder = arg.slice('--folder='.length);
51
+ if (!opts.folder) throw new Error('--folder needs a folder path');
52
+ }
39
53
  else throw new Error(`Unknown option: ${arg}`);
40
54
  }
41
55
  return opts;
42
56
  }
43
57
 
58
+ /** Expand ~, resolve against the working directory, and require an existing folder. */
59
+ function resolveFolder(folder) {
60
+ const resolved = path.resolve(expandHome(folder));
61
+ let st;
62
+ try {
63
+ st = fs.statSync(resolved);
64
+ } catch {
65
+ throw new Error(`--folder: ${resolved} does not exist`);
66
+ }
67
+ if (!st.isDirectory()) throw new Error(`--folder: ${resolved} is not a folder`);
68
+ return resolved;
69
+ }
70
+
44
71
  function defaultReportPath(date = new Date()) {
45
72
  const desktop = path.join(os.homedir(), 'Desktop');
46
73
  const dir = fs.existsSync(desktop) ? desktop : os.homedir();
@@ -74,6 +101,7 @@ async function runDiskInfoCli(argv) {
74
101
  let opts;
75
102
  try {
76
103
  opts = parseDiskInfoArgs(argv);
104
+ if (opts.folder && !opts.help) opts.folder = resolveFolder(opts.folder);
77
105
  } catch (err) {
78
106
  console.error(`${err.message}\n\nRun \`bt-agent diskinfo --help\` for usage.`);
79
107
  return 2;
@@ -84,9 +112,15 @@ async function runDiskInfoCli(argv) {
84
112
  }
85
113
 
86
114
  const ui = progressLine(!opts.json && process.stderr.isTTY);
87
- if (!opts.json) console.error('Scanning disk usage — this can take a few minutes on a full disk.');
115
+ if (!opts.json) {
116
+ console.error(
117
+ opts.folder
118
+ ? `Scanning disk usage in ${prettyPath(opts.folder)} — this can take a while on a big folder.`
119
+ : 'Scanning disk usage — this can take a few minutes on a full disk.'
120
+ );
121
+ }
88
122
 
89
- const report = await buildReport({ onStage: ui.stage, onProgress: ui.progress });
123
+ const report = await buildReport({ folder: opts.folder, onStage: ui.stage, onProgress: ui.progress });
90
124
  ui.done();
91
125
 
92
126
  const text = opts.json ? JSON.stringify(report, null, 2) : formatReport(report);
@@ -101,4 +135,4 @@ async function runDiskInfoCli(argv) {
101
135
  return 0;
102
136
  }
103
137
 
104
- module.exports = { runDiskInfoCli, parseDiskInfoArgs, defaultReportPath };
138
+ module.exports = { runDiskInfoCli, parseDiskInfoArgs, resolveFolder, defaultReportPath };
@@ -89,25 +89,33 @@ const sum = (list) => list.reduce((n, x) => n + x.bytes, 0);
89
89
  * @param {(p: {files:number, bytes:number, dir:string}) => void} [opts.onProgress]
90
90
  * @param {object} [opts.ctx] { platform, home, env } — injectable for tests.
91
91
  * @param {string[]} [opts.roots] Override the system folders to walk (tests).
92
+ * @param {string} [opts.folder] Scan only this folder instead of the home folder and the
93
+ * system folders; hogs and breakdowns outside it are left out.
92
94
  */
93
95
  async function buildReport(opts = {}) {
94
96
  const started = Date.now();
95
97
  const ctx = opts.ctx || { platform: process.platform, home: os.homedir(), env: process.env };
96
98
  const stage = opts.onStage || (() => {});
97
99
  const scanner = new Scanner({ onProgress: opts.onProgress });
100
+ const folder = opts.folder ? path.resolve(opts.folder) : null;
101
+ const base = folder || ctx.home;
102
+ const baseKey = keyOf(base);
103
+ const basePrefix = baseKey.endsWith(path.sep) ? baseKey : baseKey + path.sep;
104
+ // In folder mode every lookup stays inside the folder, so nothing else on the disk is walked.
105
+ const inScope = (p) => !folder || keyOf(p) === baseKey || keyOf(p).startsWith(basePrefix);
98
106
 
99
107
  stage('volume overview');
100
108
  const vols = volumes(ctx);
101
- const mac = ctx.platform === 'darwin' && !opts.ctx;
109
+ const mac = ctx.platform === 'darwin' && !opts.ctx && !folder;
102
110
  const apfs = mac ? apfsVolumes() : [];
103
111
  const snapshots = mac ? snapshotCount() : 0;
104
112
 
105
- stage(`home folder ${prettyPath(ctx.home)}`);
106
- const homeBytes = scanner.measure(ctx.home) || 0;
113
+ stage(folder ? `folder ${prettyPath(folder)}` : `home folder ${prettyPath(ctx.home)}`);
114
+ const baseBytes = scanner.measure(base) || 0;
107
115
 
108
- const roots = [{ path: ctx.home, bytes: homeBytes, home: true }];
116
+ const roots = [folder ? { path: folder, bytes: baseBytes, folder: true } : { path: ctx.home, bytes: baseBytes, home: true }];
109
117
  const homeKey = keyOf(ctx.home);
110
- for (const root of opts.roots || systemRoots(ctx)) {
118
+ for (const root of folder ? [] : opts.roots || systemRoots(ctx)) {
111
119
  const k = keyOf(root);
112
120
  if (k === homeKey || k.startsWith(homeKey + path.sep) || homeKey.startsWith(k + path.sep)) continue;
113
121
  if (!fs.existsSync(root)) continue;
@@ -120,7 +128,8 @@ async function buildReport(opts = {}) {
120
128
  const hogRows = [];
121
129
  const hogTotals = {};
122
130
  for (const hog of hogs(ctx)) {
123
- const found = hog.paths.flatMap(glob).filter((p) => fs.existsSync(p));
131
+ const found = hog.paths.flatMap(glob).filter((p) => inScope(p) && fs.existsSync(p));
132
+ if (!found.length) continue;
124
133
  const rows = hog.each ? found.map((p) => ({ paths: [p], label: `${hog.label} ${path.basename(p)}` })) : [{ paths: found, label: hog.label }];
125
134
  for (const row of rows) {
126
135
  let bytes = 0;
@@ -137,11 +146,12 @@ async function buildReport(opts = {}) {
137
146
  hogTotals['unity-projects'] = unity.reduce((n, p) => n + p.regenerable, 0);
138
147
  hogTotals['unreal-projects'] = unreal.reduce((n, p) => n + p.regenerable, 0);
139
148
  hogTotals.snapshots = snapshots;
140
- hogTotals.always = 0;
149
+ if (!folder) hogTotals.always = 0; // the system-wide tip only fits a whole-disk scan
141
150
 
142
- const vol = vols.find((v) => keyOf(ctx.home).startsWith(keyOf(v.mount))) || vols[0] || null;
151
+ const vol = vols.find((v) => baseKey.startsWith(keyOf(v.mount))) || vols[0] || null;
143
152
  const measured = sum(roots);
144
- const other = vol ? Math.max(0, vol.used - measured) : null;
153
+ const other = vol && !folder ? Math.max(0, vol.used - measured) : null;
154
+ const breakdownDirs = breakdowns(ctx).filter((d) => inScope(d) && keyOf(d) !== baseKey);
145
155
 
146
156
  return {
147
157
  generatedAt: new Date().toISOString(),
@@ -152,10 +162,11 @@ async function buildReport(opts = {}) {
152
162
  volumes: vols,
153
163
  apfs,
154
164
  snapshots,
165
+ folder,
155
166
  roots: top(roots, roots.length),
156
167
  other,
157
- home: { path: ctx.home, children: top(scanner.children(ctx.home), 25) },
158
- breakdowns: breakdowns(ctx)
168
+ home: { path: base, children: top(scanner.children(base), 25) },
169
+ breakdowns: breakdownDirs
159
170
  .filter((d) => scanner.lookup(d) !== null)
160
171
  .map((d) => ({ path: d, bytes: scanner.lookup(d), children: top(scanner.children(d), d === breakdowns(ctx)[0] ? 15 : 10) })),
161
172
  hogs: hogRows,
@@ -182,7 +193,7 @@ function formatReport(r) {
182
193
  const win = r.platform === 'win32';
183
194
 
184
195
  line(`Disk space report — ${r.localTime} — ${r.computer}`);
185
- line('(read-only scan; nothing was deleted)');
196
+ line(r.folder ? `(read-only scan of ${prettyPath(r.folder)} only; nothing was deleted)` : '(read-only scan; nothing was deleted)');
186
197
 
187
198
  header('1. VOLUMES');
188
199
  for (const v of r.volumes) {
@@ -194,18 +205,20 @@ function formatReport(r) {
194
205
  line(' APFS volumes on this Mac (space consumed):');
195
206
  for (const a of r.apfs) line(` ${human(a.bytes).padStart(10)} ${a.name}`);
196
207
  }
197
- if (r.platform === 'darwin') {
208
+ if (r.platform === 'darwin' && !r.folder) {
198
209
  line();
199
210
  line(` Local Time Machine snapshots: ${r.snapshots}`);
200
211
  }
201
212
 
202
213
  header('2. TOP-LEVEL BREAKDOWN (largest first)');
203
- for (const root of r.roots) row(root.bytes, root.home ? `${prettyPath(root.path)} (your home folder)` : root.path);
214
+ for (const root of r.roots) {
215
+ row(root.bytes, root.home ? `${prettyPath(root.path)} (your home folder)` : root.folder ? `${prettyPath(root.path)} (scanned folder)` : root.path);
216
+ }
204
217
  if (r.other !== null) {
205
218
  row(r.other, win ? 'Everything else (Windows, page file, restore points, unreadable folders)' : 'Everything else (system files, snapshots, unreadable folders)');
206
219
  }
207
220
 
208
- header(`3. HOME FOLDER — ${r.home.children.length} largest items`);
221
+ header(`3. ${r.folder ? `FOLDER ${prettyPath(r.folder)}` : 'HOME FOLDER'} — ${r.home.children.length} largest items`);
209
222
  for (const c of r.home.children) row(c.bytes, prettyPath(c.path));
210
223
  for (const b of r.breakdowns) {
211
224
  line();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babylonjs-toolkit/agent",
3
- "version": "1.2.14",
3
+ "version": "1.2.16",
4
4
  "description": "Installs the Babylon Toolkit Desktop Agent for Claude Code, Codex, GitHub Copilot, Gemini CLI and Antigravity.",
5
5
  "keywords": [
6
6
  "babylonjs",
@@ -29,6 +29,10 @@
29
29
  * agents write `live` at each meaningful step (before anything slow, at each fix attempt), and `watch` — the
30
30
  * watchdog bt-execute launches in the background at run start — writes a heartbeat after 10 quiet minutes.
31
31
  *
32
+ * A task's `tests` keeps its documented shape: `task --set` refuses a `tests.files` that is not a list of path strings
33
+ * and a `passed` / `failed` that is not a number, and every write and `check` repairs one already in the file (the
34
+ * old value moves into `tests.note`), because a count written into `files` once stopped a dashboard drawing.
35
+ *
32
36
  * Snapshots go in only through `snapshot`. `task --set` and `check` refuse any snapshot entry the page cannot show —
33
37
  * an image under `path` (or `file`, `image`, …) instead of `src`, or a `src` that is not a file under the feature
34
38
  * folder — because such an entry renders as "No snapshot".
@@ -100,6 +104,13 @@ const MAXIMUM_SCAN_DEPTH = 5;
100
104
  const TASK_LIST_FIELDS = ['files', 'decisions', 'snapshots', 'updates'];
101
105
  /** Task fields that are an object or null. */
102
106
  const TASK_OBJECT_FIELDS = ['tests', 'details'];
107
+ /** Counts inside a task's `tests` that must be numbers when present. */
108
+ const TESTS_COUNT_FIELDS = ['passed', 'failed'];
109
+ /** The `tests` shape from data-schema.md, quoted in every refusal so the writer can fix the entry in one go. */
110
+ const TESTS_SHAPE_HELP = [
111
+ '"tests" is { "passed": <number>, "failed": <number>, "files": ["<test path from the project root>", …], "note": "<counts, suite names, commands>" } or null.',
112
+ '"files" holds paths only (the page links each one); a count, a suite name or a command goes in "note".',
113
+ ].join('\n');
103
114
  /** Statuses that mean a task is being worked on right now. */
104
115
  const ACTIVE_TASK_STATUSES = new Set(['in-progress', 'built', 'verifying']);
105
116
  /** Where a snapshot's image may come from. */
@@ -168,6 +179,7 @@ function writeData(path, prefix, data) {
168
179
  // Every dashboard write repairs snapshot entries first, so an image filed under `path` (or any key the page never
169
180
  // reads) can never reach the page as "No snapshot", whoever wrote it.
170
181
  if (data && Array.isArray(data.phases)) repairSnapshots(data);
182
+ if (data && Array.isArray(data.phases)) repairTaskTests(data);
171
183
  if (data && Array.isArray(data.decisions)) repairDecisions(data);
172
184
  if (data && Array.isArray(data.followUps)) repairFollowUps(data);
173
185
  const temporaryPath = `${path}.${process.pid}.tmp`;
@@ -479,6 +491,61 @@ function checkTaskShape(changes) {
479
491
  const value = changes[field];
480
492
  if (field in changes && value !== null && (typeof value !== 'object' || Array.isArray(value))) throw new Error(`"${field}" must be an object or null`);
481
493
  }
494
+ if (changes.tests) checkTestsShape(changes.tests);
495
+ }
496
+
497
+ /**
498
+ * Refuses a `tests` object the page cannot draw: a `files` that is not a list of path strings (a count written there
499
+ * once stopped a dashboard drawing), or a `passed` / `failed` that is present but not a number.
500
+ * @param {Record<string, any>} tests The task's `tests` object.
501
+ * @throws {Error} Naming the field and quoting the `tests` shape.
502
+ */
503
+ function checkTestsShape(tests) {
504
+ const hasFiles = tests.files !== undefined;
505
+ if (hasFiles && !isPathList(tests.files)) {
506
+ throw new Error(`"tests.files" must be a list of path strings, not ${JSON.stringify(tests.files)}\n${TESTS_SHAPE_HELP}`);
507
+ }
508
+ for (const field of TESTS_COUNT_FIELDS) {
509
+ const count = tests[field];
510
+ if (count !== undefined && typeof count !== 'number') {
511
+ throw new Error(`"tests.${field}" must be a number, not ${JSON.stringify(count)}\n${TESTS_SHAPE_HELP}`);
512
+ }
513
+ }
514
+ }
515
+
516
+ /**
517
+ * Whether a value is a list whose every entry is a string — the only `tests.files` the page can link.
518
+ * @param {any} value The value to test.
519
+ * @returns {boolean} True for an array of strings (an empty array included).
520
+ */
521
+ function isPathList(value) {
522
+ return Array.isArray(value) && value.every((entry) => typeof entry === 'string');
523
+ }
524
+
525
+ /**
526
+ * Repairs every task's `tests.files` in place so the page can draw it: a value that is not a list of path strings
527
+ * moves into `tests.note` (`files: 46`), and `files` keeps only the string entries of a mixed list, else becomes `[]`.
528
+ * @param {any} dashboard The dashboard data.
529
+ * @returns {string[]} One line per repair made.
530
+ */
531
+ function repairTaskTests(dashboard) {
532
+ const repairs = [];
533
+ for (const phase of dashboard.phases || []) {
534
+ for (const task of phase.tasks || []) {
535
+ const tests = task && task.tests;
536
+ if (!tests || typeof tests !== 'object' || Array.isArray(tests)) continue;
537
+ if (tests.files === undefined || isPathList(tests.files)) continue;
538
+ const oldFiles = tests.files;
539
+ const keptPaths = Array.isArray(oldFiles) ? oldFiles.filter((entry) => typeof entry === 'string') : [];
540
+ const movedValue = Array.isArray(oldFiles) ? oldFiles.filter((entry) => typeof entry !== 'string') : oldFiles;
541
+ const movedText = `files: ${typeof movedValue === 'string' ? movedValue : JSON.stringify(movedValue)}`;
542
+ const existingNote = typeof tests.note === 'string' ? tests.note.trim() : '';
543
+ tests.note = existingNote ? `${existingNote}; ${movedText}` : movedText;
544
+ tests.files = keptPaths;
545
+ repairs.push(`${task.id}.tests.files: ${JSON.stringify(oldFiles)} is not a list of paths → moved into tests.note, files ${JSON.stringify(keptPaths)}`);
546
+ }
547
+ }
548
+ return repairs;
482
549
  }
483
550
 
484
551
  /**
@@ -1377,17 +1444,21 @@ function checkData(folder) {
1377
1444
  const { prefix, data } = readData(dashboardPath);
1378
1445
  if (existsSync(livePath)) readData(livePath);
1379
1446
  const repairs = repairSnapshots(data);
1447
+ const testsRepairs = repairTaskTests(data);
1380
1448
  const decisionRepairs = repairDecisions(data);
1381
1449
  const followUpRepairs = repairFollowUps(data);
1382
1450
  const hasFollowUps = Array.isArray(data.followUps) && data.followUps.length > 0;
1383
1451
  const linkedFollowUps = hasFollowUps && linkFollowUpsDocument(folder, data);
1384
1452
  const linkedFromPlan = linkCitedFollowUps(folder, data);
1385
1453
  const sourceMoved = syncAddressedFollowUps(folder, data);
1386
- if (repairs.length || decisionRepairs.length || followUpRepairs.length || linkedFollowUps || linkedFromPlan || sourceMoved) writeData(dashboardPath, prefix, data);
1454
+ if (repairs.length || testsRepairs.length || decisionRepairs.length || followUpRepairs.length || linkedFollowUps || linkedFromPlan || sourceMoved) writeData(dashboardPath, prefix, data);
1387
1455
  if (hasFollowUps) writeFollowUpsDocument(folder, data);
1388
1456
  if (repairs.length) {
1389
1457
  console.log(`repaired ${repairs.length} snapshot entr${repairs.length === 1 ? 'y' : 'ies'} the page could not show:\n ${repairs.join('\n ')}`);
1390
1458
  }
1459
+ if (testsRepairs.length) {
1460
+ console.log(`repaired ${testsRepairs.length} task test record${testsRepairs.length === 1 ? '' : 's'} the page could not draw:\n ${testsRepairs.join('\n ')}`);
1461
+ }
1391
1462
  if (decisionRepairs.length) {
1392
1463
  console.log(`repaired ${decisionRepairs.length} decision${decisionRepairs.length === 1 ? '' : 's'} written as plain text:\n ${decisionRepairs.join('\n ')}`);
1393
1464
  }
@@ -1502,14 +1573,14 @@ async function watch(folder, argumentList) {
1502
1573
  }
1503
1574
 
1504
1575
  /**
1505
- * Watchdog repair: a snapshot or decision an agent wrote around the helper (a hand edit, its own script) is repaired
1576
+ * Watchdog repair: a snapshot, task test record or decision an agent wrote around the helper (a hand edit, its own script) is repaired
1506
1577
  * within a minute, re-read just before the write so nothing the agent wrote meanwhile is lost.
1507
1578
  * @param {string} dashboardPath The dashboard data file.
1508
1579
  */
1509
1580
  function repairWrittenSnapshots(dashboardPath) {
1510
1581
  try {
1511
1582
  const { prefix, data } = readData(dashboardPath);
1512
- const repairs = [...repairSnapshots(data), ...repairDecisions(data)];
1583
+ const repairs = [...repairSnapshots(data), ...repairTaskTests(data), ...repairDecisions(data)];
1513
1584
  if (!repairs.length) return;
1514
1585
  writeData(dashboardPath, prefix, data);
1515
1586
  console.log(`watchdog: repaired ${repairs.length} entr${repairs.length === 1 ? 'y' : 'ies'} — ${repairs.join('; ')}`);
@@ -1472,7 +1472,7 @@
1472
1472
  hasTests(task)
1473
1473
  ? `<span class="count count-pass">${escapeHtml(tests.passed ?? 0)} passed</span>${Number(tests.failed) ? `<div class="count count-fail">${escapeHtml(tests.failed)} failed</div>` : ''}`
1474
1474
  : `<span class="cell-note" title="${escapeAttribute(tests.note || '')}">${tests.note ? escapeHtml(tests.note) : '—'}</span>`,
1475
- (tests.files || []).length ? tests.files.map(fileLink).join('<br>') : '—',
1475
+ testFilesOf(tests).length ? testFilesOf(tests).map(fileLink).join('<br>') : '—',
1476
1476
  cases.length ? `${cases.length}${casesFailed ? `<div class="count count-fail">${casesFailed} failed</div>` : ''}` : '—',
1477
1477
  hasLiveCheck(task) ? `<span title="${escapeAttribute(liveCheckNote(task))}">Yes</span>` : '—',
1478
1478
  ];
@@ -1572,11 +1572,21 @@
1572
1572
  tests.passed != null ? `${escapeHtml(tests.passed)} passed` : '',
1573
1573
  tests.failed ? `${escapeHtml(tests.failed)} failed` : '',
1574
1574
  ].filter(Boolean).join(' · ');
1575
- const files = (tests.files || []).map(fileLink).join(' ');
1575
+ const files = testFilesOf(tests).map(fileLink).join(' ');
1576
1576
  const note = tests.note ? formatInline(tests.note) : '';
1577
1577
  return [counts, files, note].filter(Boolean).join('<br>');
1578
1578
  }
1579
1579
 
1580
+ /**
1581
+ * The test file paths of a task's tests record, read only when `files` is a list: a count or text written there
1582
+ * by hand (the helper refuses and repairs it) must never stop the page drawing.
1583
+ * @param {object} tests The task's `tests` record.
1584
+ * @returns {string[]} Its path entries; empty when `files` is not a list.
1585
+ */
1586
+ function testFilesOf(tests) {
1587
+ return Array.isArray(tests.files) ? tests.files.filter((entry) => typeof entry === 'string') : [];
1588
+ }
1589
+
1580
1590
  /**
1581
1591
  * Three snapshot shapes: a progression (`frames`) renders as a storyboard of the build stage by stage;
1582
1592
  * a before/after pair renders as a drag-to-compare slider; a single image renders as a zoomable still.