@agentguard-run/burn 0.3.10 → 0.3.12

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.12 (2026-09-24)
4
+
5
+ - `render --playback <rate>` (1 to 4) for both the recorded render and the dashboard: a faster cut of the same recording. Recorded renders divide every frame interval by the rate and the header reads "RECORDED · 1.5x"; the dashboard samples recorded time at the rate and draws "PLAYBACK 1.5x" under the counters on every frame. Frame times in provenance stay in recorded time; provenance records `playback` (and `video_seconds` for the dashboard).
6
+
7
+ ## 0.3.11 (2026-09-23)
8
+
9
+ - `render --label <text>` for both the recorded render and the dashboard: a caller-supplied name for what the recording was (for example "deliberate fan-out test"), drawn in the frame and written to the provenance file. Never inferred.
10
+ - Dashboard: header counters step at the recorded event time, in the same frame as the log row and ring marker (no tween that lags them); the elapsed counter is labelled RECORDED TIME; the rate bar ticks read "warn at 8" and "refuse at 16"; the STOP card reads "window counter 16 of 16 · 15 active min · attempt refused"; the cost panel is titled "list cost after the run · not live", shows the final amount once with a fade (no counting up) and carries its qualifications at body size ("15 copies the gate allowed", "list price · not a bill").
11
+ - Recorded renders: "SPAWN ATTEMPTS IN WINDOW" (was AGENT SPAWNS), "COPIES LAUNCHED" with the tag "attempt refused", "Each copy runs its own context window." and "At the ceiling, the attempt is refused." replace the earlier explainers.
12
+
3
13
  ## 0.3.10 (2026-09-23)
4
14
 
5
15
  - Dashboard render: the COPIES counter and the ring markers now count copies that launched (allowed decisions), not the ledger's spawn-attempt counter, which also counts the attempt that reached the ceiling and was refused. The rate bar is labelled SPAWN ATTEMPTS and keeps the attempt counter. The STOP card reads "attempt 16 of 16 in 15 active min · refused".
package/README.md CHANGED
@@ -509,7 +509,7 @@ agentguard-burn render run.jsonl --mp4 run.mp4 --gif run.gif
509
509
  agentguard-burn render run.jsonl --mp4 run-phone.mp4 --phone
510
510
  ```
511
511
 
512
- `--phone` renders a 1080 by 1350 frame with a stacked 40 by 36 cell layout (spawn count, spawn attempts against the ceiling, one block per copy that launched, the last three decisions, the STOP card and an explainer), so a recorded run stays readable on a phone screen. The provenance file records the layout and frame size.
512
+ `--phone` renders a 1080 by 1350 frame with a stacked 40 by 36 cell layout (spawn count, spawn attempts against the ceiling, one block per copy that launched, the last three decisions, the STOP card and an explainer), so a recorded run stays readable on a phone screen. The provenance file records the layout and frame size. `--label <text>` (1 to 40 printable characters) names what the recording was, for example `--label "deliberate fan-out test"`; it is drawn in the frame (phone: the explainer row; wide: the header; dashboard: the session line) and recorded in the provenance file. It is never inferred from the recording. `--playback <rate>` (1 to 4) renders a faster cut of the same recording; the frame says the rate ("RECORDED · 1.5x" or "PLAYBACK 1.5x") and provenance records it, while frame times stay in recorded time.
513
513
 
514
514
  `record` writes each decision at its real timestamp, with one frame per second
515
515
  between decisions. Bounds are optional and otherwise use the session's first
package/dist/src/cli.js CHANGED
@@ -162,22 +162,26 @@ async function main(argv) {
162
162
  process.stdout.write('not supported on this platform yet\n');
163
163
  return 0;
164
164
  }
165
- const source = rest[0], mp4 = flag('--mp4'), gif = flag('--gif'), economics = flag('--economics'), fpsFlag = flag('--fps');
166
- const usage = 'Usage: agentguard-burn render <run.jsonl> --mp4 <out.mp4> [--gif <out.gif>] [--phone] | --dashboard [--wide] [--economics <blocks.json>] [--fps <n>]';
165
+ const source = rest[0], mp4 = flag('--mp4'), gif = flag('--gif'), economics = flag('--economics'), fpsFlag = flag('--fps'), label = flag('--label'), playbackFlag = flag('--playback');
166
+ const usage = 'Usage: agentguard-burn render <run.jsonl> --mp4 <out.mp4> [--gif <out.gif>] [--phone] [--label <text>] [--playback <rate>] | --dashboard [--wide] [--economics <blocks.json>] [--fps <n>] [--label <text>] [--playback <rate>]';
167
+ if (has('--label') && (!label || label.startsWith('--')))
168
+ throw new Error(usage);
169
+ if (has('--playback') && !/^[1-4](\.\d{1,2})?$/.test(playbackFlag ?? ''))
170
+ throw new Error(usage);
167
171
  if (!source || source.startsWith('--') || !mp4 || mp4.startsWith('--') || (has('--gif') && (!gif || gif.startsWith('--'))))
168
172
  throw new Error(usage);
169
173
  if (has('--dashboard')) {
170
174
  if (has('--gif') || has('--phone') || (has('--economics') && (!economics || economics.startsWith('--'))) || (has('--fps') && !/^\d{1,2}$/.test(fpsFlag ?? '')))
171
175
  throw new Error(usage);
172
176
  const { renderDashboard } = await Promise.resolve().then(() => __importStar(require('./dashboard-render')));
173
- const result = await renderDashboard(source, { mp4, economics, wide: has('--wide'), ...(fpsFlag ? { fps: Number(fpsFlag) } : {}) });
177
+ const result = await renderDashboard(source, { mp4, economics, wide: has('--wide'), ...(fpsFlag ? { fps: Number(fpsFlag) } : {}), ...(label ? { label } : {}), ...(playbackFlag ? { playback: Number(playbackFlag) } : {}) });
174
178
  show({ kind: 'command', command: 'render', values: { ...result } }, `PNG frames: ${result.framesDir}\n${result.mp4 ? `MP4: ${result.mp4}\n` : `ffmpeg unavailable. Run: ${result.ffmpegCommand}\n`}Provenance: ${result.provenancePath}\n`);
175
179
  return 0;
176
180
  }
177
181
  if (has('--wide') || has('--economics') || has('--fps'))
178
182
  throw new Error(usage);
179
183
  const { renderRecording } = await Promise.resolve().then(() => __importStar(require('./render-recording')));
180
- const result = await renderRecording(source, { mp4, gif, phone: has('--phone') });
184
+ const result = await renderRecording(source, { mp4, gif, phone: has('--phone'), ...(label ? { label } : {}), ...(playbackFlag ? { playback: Number(playbackFlag) } : {}) });
181
185
  show({ kind: 'command', command: 'render', values: { ...result } }, `PNG frames: ${result.framesDir}\n${result.mp4 ? `MP4: ${result.mp4}\n` : `ffmpeg unavailable. Run: ${result.ffmpegCommand}\n`}${result.gif ? `GIF: ${result.gif}\n` : ''}Provenance: ${result.provenancePath}\n`);
182
186
  return 0;
183
187
  }
@@ -55,6 +55,10 @@ export interface DashboardModel {
55
55
  windowActiveMinutes: number | null;
56
56
  /** Spawn decisions the gate allowed (every non-STOP decision). The ledger's `spawns` counter also counts the refused attempt that reached the ceiling. */
57
57
  launched: number;
58
+ /** Caller-supplied name for what the recording was (for example "deliberate fan-out test"); drawn in the header, never inferred. */
59
+ label?: string;
60
+ /** Playback rate of the rendered video relative to recorded time; 1 unless the caller asks for a faster cut. */
61
+ playback?: number;
58
62
  events: DashboardEvent[];
59
63
  samples: DashboardSample[];
60
64
  economics: DashboardEconomics | null;
@@ -30,4 +30,6 @@ export declare function renderDashboard(source: string, options: {
30
30
  ffmpeg?: string | null;
31
31
  fps?: number;
32
32
  seed?: number;
33
+ label?: string;
34
+ playback?: number;
33
35
  }): Promise<DashboardRenderResult>;
@@ -134,14 +134,17 @@ function header(ctx, model, state, g) {
134
134
  const wordSize = Math.round(g.number * 1.15);
135
135
  const agent = text(ctx, 'Agent', g.margin, g.header.y, wordSize, { weight: 600 });
136
136
  text(ctx, 'Guard', g.margin + agent, g.header.y, wordSize, { weight: 600, color: exports.INK.teal });
137
- text(ctx, `session ${model.session} · ${model.startAt.slice(0, 10)} ${model.startAt.slice(11, 16)} UTC · spawn gate`, g.margin, g.header.y + 34, g.small, { color: exports.INK.secondary });
138
- const lastEvent = state.log.at(-1), lastStop = [...state.log].reverse().find(event => event.verdict === 'STOP');
137
+ text(ctx, `session ${model.session} · ${model.startAt.slice(0, 10)} ${model.startAt.slice(11, 16)} UTC · spawn gate${model.label ? ` · ${model.label}` : ''}`, g.margin, g.header.y + 34, g.small, { color: exports.INK.secondary });
138
+ // A faster-than-recorded cut says so in the header, under the counters, on every frame.
139
+ if (model.playback && model.playback !== 1)
140
+ text(ctx, `PLAYBACK ${model.playback}x`, g.width - g.margin, g.header.y + 34 + g.small * 2.1, Math.round(g.small * 1.2), { family: 'mono', weight: 700, color: exports.INK.ink, align: 'right' });
141
+ // Counters step at the recorded event time, in the same frame as the log row and the ring marker, so no frame shows
142
+ // a marker or log row the counters have not yet counted. Copies = allowed decisions; the ledger's attempt counter drives the rate bar.
139
143
  const values = [
140
- // Copies that launched: allowed decisions. The ledger's attempt counter, which also counts the refused attempt, drives the rate bar instead.
141
- ['copies', String(counter(state.previousLaunched, state.launched, state.launchedChangedAt, state.t)), state.warned ? exports.INK.amber : exports.INK.teal],
142
- ['decisions', String(counter(Math.max(0, state.decisions - 1), state.decisions, lastEvent?.offsetMs ?? 0, state.t)), exports.INK.ink],
143
- ['refused', String(counter(Math.max(0, state.refused - 1), state.refused, lastStop?.offsetMs ?? 0, state.t)), state.refused ? exports.INK.red : exports.INK.ink],
144
- ['elapsed', clock(state.elapsedMs), exports.INK.ink],
144
+ ['copies', String(state.launched), state.warned ? exports.INK.amber : exports.INK.teal],
145
+ ['decisions', String(state.decisions), exports.INK.ink],
146
+ ['refused', String(state.refused), state.refused ? exports.INK.red : exports.INK.ink],
147
+ ['recorded time', clock(state.elapsedMs), exports.INK.ink],
145
148
  ];
146
149
  values.forEach(([label, value, color], index) => {
147
150
  const x = g.header.counters.x + index * g.header.counters.step;
@@ -260,9 +263,9 @@ function bar(ctx, model, state, g) {
260
263
  ctx.moveTo(wx, y - 8);
261
264
  ctx.lineTo(wx, y + h + 8);
262
265
  ctx.stroke();
263
- text(ctx, `warn ${model.warnAt}`, wx + 10, y + h + 30, g.small, { color: exports.INK.amber });
266
+ text(ctx, `warn at ${model.warnAt}`, wx + 10, y + h + 30, g.small, { color: exports.INK.amber });
264
267
  }
265
- text(ctx, `ceiling ${ceiling}`, x + w, y + h + 30, g.small, { color: exports.INK.secondary, align: 'right' });
268
+ text(ctx, `refuse at ${ceiling}`, x + w, y + h + 30, g.small, { color: exports.INK.secondary, align: 'right' });
266
269
  }
267
270
  function log(ctx, state, g) {
268
271
  const { x, y, w, h, rows } = g.log;
@@ -281,34 +284,28 @@ function log(ctx, state, g) {
281
284
  }
282
285
  function agents(ctx, model, state, g) {
283
286
  const { x, y, w, h, rows } = g.agents, economics = model.economics;
284
- panel(ctx, x, y, w, h, 'subagents · measured after the run', g);
287
+ panel(ctx, x, y, w, h, 'list cost after the run · not live', g);
285
288
  if (!economics) {
286
289
  text(ctx, 'no subagent economics supplied', x + 20, y + 90, g.body, { color: exports.INK.secondary });
287
290
  return;
288
291
  }
289
- const revealAt = model.firstStopMs ?? model.durationMs, reveal = easeOut((state.t - revealAt) / 1200);
292
+ const revealAt = model.firstStopMs ?? model.durationMs, reveal = easeOut((state.t - revealAt) / 600);
290
293
  // Recording scope: the dollars cover only the copies this recording allowed. Session scope: every child of the session.
291
294
  const recorded = economics.scope === 'recording', found = economics.children.length, launched = economics.launched ?? found;
292
- const noun = recorded ? (found === launched ? `the ${found} copies the gate allowed` : `${found} of the ${launched} copies the gate allowed`) : `${found} subagent transcripts`;
295
+ const who = recorded ? (found === launched ? `${found} copies the gate allowed` : `${found} of the ${launched} copies the gate allowed`) : `${found} subagent transcripts`;
293
296
  if (reveal <= 0) {
294
- text(ctx, noun, x + 20, y + 84, g.body, { color: exports.INK.secondary });
295
- text(ctx, 'priced once the run ends', x + 20, y + 84 + g.body * 1.4, g.body, { color: exports.INK.secondary });
297
+ text(ctx, who, x + 20, y + 84, g.body, { color: exports.INK.secondary });
298
+ text(ctx, 'list price shown after the run', x + 20, y + 84 + g.body * 1.4, g.body, { color: exports.INK.secondary });
296
299
  return;
297
300
  }
298
- const total = { min: economics.totalUsd.min * reveal, max: economics.totalUsd.max * reveal };
299
- text(ctx, (0, live_1.dollars)(total), x + 20, y + 52 + g.bigNumber, g.bigNumber, { family: 'mono', weight: 700, color: exports.INK.ink });
300
- // The caption wraps onto a second line when the panel is narrower than the sentence, so it never crosses the panel edge.
301
- const lead = `list cost of ${noun}`, caption = `${lead} · not a bill`;
302
- ctx.font = `400 ${g.small}px "${TEXT}"`;
303
- const wrapped = ctx.measureText(caption).width > w - 40;
304
- if (!wrapped)
305
- text(ctx, caption, x + 20, y + 76 + g.bigNumber, g.small, { color: exports.INK.secondary });
306
- else {
307
- text(ctx, lead, x + 20, y + 76 + g.bigNumber, g.small, { color: exports.INK.secondary });
308
- text(ctx, 'not a bill', x + 20, y + 76 + g.bigNumber + g.small * 1.15, g.small, { color: exports.INK.secondary });
309
- }
301
+ // The final amount fades in once, at its full value: it never counts up, so it cannot read as a live meter.
302
+ const big = y + 52 + g.bigNumber, cap1 = big + g.body * 1.3, cap2 = cap1 + g.body * 1.25;
303
+ text(ctx, (0, live_1.dollars)(economics.totalUsd), x + 20, big, g.bigNumber, { family: 'mono', weight: 700, color: exports.INK.ink, alpha: reveal });
304
+ // The qualifications are body size, the same size as the decision log, not fine print, and clear of the amount's descenders.
305
+ text(ctx, who, x + 20, cap1, g.body, { color: exports.INK.ink, alpha: reveal });
306
+ text(ctx, 'list price · not a bill', x + 20, cap2, g.body, { color: exports.INK.secondary, alpha: reveal });
310
307
  const sorted = [...economics.children].sort((a, b) => (b.tokens ?? 0) - (a.tokens ?? 0)), top = sorted.slice(0, rows), max = top[0]?.tokens ?? 1;
311
- const first = y + 100 + g.bigNumber + (wrapped ? g.small * 1.15 : 0), pitch = (h - (first - y) - 44) / rows, barW = w - 40 - g.number * 3.6;
308
+ const first = cap2 + g.body * .7, pitch = (h - (first - y) - 44) / rows, barW = w - 40 - g.number * 3.6;
312
309
  top.forEach((child, i) => {
313
310
  const row = first + i * pitch, fill = clamp01((child.tokens ?? 0) / max) * reveal;
314
311
  ctx.fillStyle = exports.INK.line;
@@ -337,11 +334,11 @@ function card(ctx, state, g) {
337
334
  ctx.roundRect(x, y, w, h, 12);
338
335
  ctx.fill();
339
336
  ctx.stroke();
340
- const outcome = state.stop.blocked === true ? 'refused' : state.stop.blocked === false ? 'shadow, copy allowed' : 'outcome not recorded';
337
+ const outcome = state.stop.blocked === true ? 'attempt refused' : state.stop.blocked === false ? 'shadow, copy allowed' : 'outcome not recorded';
341
338
  text(ctx, 'STOP', x + 22, y + h / 2 + g.number * .36, g.number, { family: 'mono', weight: 700, color: exports.INK.red });
342
339
  const ceiling = state.stop.ceiling ?? '?', window = state.stop.windowActiveMinutes ?? '?';
343
- // The attempt that reached the ceiling is the one refused: counted in the window, never launched.
344
- text(ctx, `attempt ${state.stop.copies} of ${ceiling} in ${window} active min · ${outcome}`, x + 22 + g.number * 3, y + h / 2 - 4, g.body, { color: exports.INK.ink });
340
+ // The window counter includes the refused attempt that reached the ceiling; later refusals report the same counter value.
341
+ text(ctx, `window counter ${state.stop.copies} of ${ceiling} · ${window} active min · ${outcome}`, x + 22 + g.number * 3, y + h / 2 - 4, g.body, { color: exports.INK.ink });
345
342
  text(ctx, `${state.stop.reason} · signed on this machine`, x + 22 + g.number * 3, y + h / 2 + g.small + 6, g.small, { color: exports.INK.secondary });
346
343
  ctx.restore();
347
344
  }
@@ -370,6 +367,11 @@ async function renderDashboard(source, options) {
370
367
  const fps = options.fps ?? 30;
371
368
  if (!Number.isInteger(fps) || fps < 1 || fps > 60)
372
369
  throw new Error('Dashboard fps must be an integer from 1 to 60.');
370
+ if (options.label !== undefined && !/^[\x20-\x7e]{1,40}$/.test(options.label))
371
+ throw new Error('Render label must be 1 to 40 printable ASCII characters.');
372
+ const playback = options.playback ?? 1;
373
+ if (!Number.isFinite(playback) || playback < 1 || playback > 4)
374
+ throw new Error('Playback rate must be between 1 and 4.');
373
375
  const sourcePath = (0, node_path_1.resolve)(source), mp4Path = (0, node_path_1.resolve)(options.mp4), provenancePath = `${mp4Path}.provenance.json`;
374
376
  const economicsPath = options.economics ? (0, node_path_1.resolve)(options.economics) : null;
375
377
  const outputs = [mp4Path, provenancePath];
@@ -390,15 +392,16 @@ async function renderDashboard(source, options) {
390
392
  const economics = economicsPath ? (0, dashboard_model_1.readDashboardEconomics)(economicsPath, frames[0].snapshot.session, (0, dashboard_model_1.recordingWindow)(frames)) : null;
391
393
  if (!sourceBytes.equals(await (0, promises_1.readFile)(sourcePath)))
392
394
  throw new Error('Recording changed while it was being read; render the saved file again.');
393
- const model = (0, dashboard_model_1.dashboardModel)(frames, economics, dashboard_model_1.DASHBOARD_HOLD_MS);
395
+ const model = { ...(0, dashboard_model_1.dashboardModel)(frames, economics, dashboard_model_1.DASHBOARD_HOLD_MS), ...(options.label ? { label: options.label } : {}), ...(playback !== 1 ? { playback } : {}) };
394
396
  const layout = options.wide ? 'wide' : 'phone', g = geometry(layout), seed = options.seed ?? exports.DASHBOARD_SEED;
395
397
  const fonts = await registerFonts();
396
- const total = Math.round((model.durationMs + model.holdMs) / 1000 * fps), frameCount = total + 1;
398
+ // Frames sample recorded time at `playback` times the rate they are shown, so the video runs shorter while every frame time stays real.
399
+ const total = Math.round((model.durationMs + model.holdMs) / playback / 1000 * fps), frameCount = total + 1;
397
400
  await (0, promises_1.mkdir)((0, node_path_1.dirname)(mp4Path), { recursive: true });
398
401
  const framesDir = await (0, promises_1.mkdtemp)((0, node_path_1.join)((0, node_path_1.dirname)(mp4Path), `${(0, node_path_1.basename)(mp4Path)}.frames-`));
399
402
  const concatPath = (0, node_path_1.join)(framesDir, 'frames.ffconcat'), lines = ['ffconcat version 1.0'], frameTimes = [];
400
403
  for (let index = 0; index < frameCount; index++) {
401
- const offset = index * 1000 / fps, name = `frame-${String(index).padStart(6, '0')}.png`;
404
+ const offset = index * 1000 / fps * playback, name = `frame-${String(index).padStart(6, '0')}.png`;
402
405
  frameTimes.push(new Date(model.startMs + offset).toISOString());
403
406
  await (0, promises_1.writeFile)((0, node_path_1.join)(framesDir, name), await renderDashboardFrame(model, offset, layout, seed), { flag: 'wx', mode: 0o600 });
404
407
  if (index < total)
@@ -418,6 +421,8 @@ async function renderDashboard(source, options) {
418
421
  rendered_at: new Date().toISOString(),
419
422
  fonts, layout: 'dashboard', frame_size: { width: g.width, height: g.height }, aspect: layout, fps, seed,
420
423
  frame_count: frameCount, frame_times: frameTimes,
424
+ label: options.label ?? null,
425
+ playback, video_seconds: (model.durationMs + model.holdMs) / playback / 1000,
421
426
  recording_span_seconds: model.durationMs / 1000, final_hold_seconds: model.holdMs / 1000,
422
427
  video_timestamp_precision: 'microseconds; fixed 1/fps frame durations from the first recorded timestamp',
423
428
  ffmpeg_command: command,
@@ -41,6 +41,8 @@ export interface FrameOptions {
41
41
  width?: number;
42
42
  height?: number;
43
43
  colour?: boolean;
44
+ label?: string;
45
+ playback?: number;
44
46
  }
45
47
  export declare function auditFrame(command: 'ps' | 'reap', report: AuditReport): BurnFrame;
46
48
  export declare function framePageCount(data: BurnFrame, options?: FrameOptions): number;
@@ -47,12 +47,14 @@ function elapsed(ms) {
47
47
  function renderShowcasePanel(snapshot, options = {}) {
48
48
  const c = new canvas_1.Canvas(options), w = c.width, h = c.height, split = Math.floor(w * .45), right = split + 3, room = w - right;
49
49
  const at = options.at ?? new Date(snapshot.observedAt).toISOString(), color = spawnBarColor(snapshot.spawns, snapshot.spawnCeiling);
50
- c.header('AGENTGUARD / BURN', 'RECORDED RUN · 1x');
50
+ // A render label (for example "deliberate fan-out test") names what the recording was; it is caller-supplied, never inferred.
51
+ const speed = `${options.playback ?? 1}x`;
52
+ c.header('AGENTGUARD / BURN', options.label ? `${options.label.toUpperCase()} · RECORDED · ${speed}` : `RECORDED RUN · ${speed}`);
51
53
  c.footer('local observation only', `elapsed ${snapshot.elapsedMs === null ? 'unknown' : elapsed(snapshot.elapsedMs ?? snapshot.observedAt - snapshot.startedAt)}`);
52
54
  c.put(2, 0, `session ${snapshot.session} · ${at.slice(11, 19)} UTC`, 'slate');
53
55
  for (let y = 3; y < h - 3; y++)
54
56
  c.put(y, split + 1, '│', 'slate');
55
- c.put(4, 0, 'AGENT SPAWNS IN WINDOW', 'slate');
57
+ c.put(4, 0, 'SPAWN ATTEMPTS IN WINDOW', 'slate');
56
58
  c.bigDigits(6, 0, snapshot.spawns === null ? '-' : snapshot.spawns, color);
57
59
  c.put(14, 0, `${snapshot.spawns ?? '?'} of ${snapshot.spawnCeiling ?? '?'} attempts · ${snapshot.windowActiveMinutes ?? '?'} active min`.slice(0, split), 'white');
58
60
  const fraction = snapshot.spawns === null || snapshot.spawnCeiling === null ? 0 : snapshot.spawns / snapshot.spawnCeiling;
@@ -71,7 +73,7 @@ function renderShowcasePanel(snapshot, options = {}) {
71
73
  }
72
74
  if (y + 5 < h - 3) {
73
75
  c.put(y, 0, 'WHAT A SPAWN IS', 'slate');
74
- ['Each spawn is a new agent copy that re-reads', 'the whole context and burns its own tokens.', 'Past the ceiling, the next spawn is refused.', 'Every decision is signed on this machine.']
76
+ ['Each spawn is a new agent copy with its own', 'context window and its own token usage.', 'At the ceiling, the attempt is refused.', 'Every decision is signed on this machine.']
75
77
  .forEach((line, i) => c.put(y + 1 + i, 0, line.slice(0, split), 'white'));
76
78
  }
77
79
  c.put(4, right, 'LAST 8 DECISIONS', 'slate');
@@ -100,10 +102,10 @@ function renderShowcasePanel(snapshot, options = {}) {
100
102
  function renderPhonePanel(snapshot, options = {}) {
101
103
  const c = new canvas_1.Canvas(options), w = c.width;
102
104
  const at = options.at ?? new Date(snapshot.observedAt).toISOString(), color = spawnBarColor(snapshot.spawns, snapshot.spawnCeiling);
103
- c.header('AGENTGUARD / BURN', 'RECORDED · 1x');
105
+ c.header('AGENTGUARD / BURN', `RECORDED · ${options.playback ?? 1}x`);
104
106
  c.footer('signed on this machine', `elapsed ${snapshot.elapsedMs === null ? 'unknown' : elapsed(snapshot.elapsedMs ?? snapshot.observedAt - snapshot.startedAt)}`);
105
107
  c.put(2, 0, `session ${snapshot.session} · ${at.slice(11, 19)} UTC`.slice(0, w), 'slate');
106
- c.put(3, 0, 'AGENT SPAWNS IN WINDOW', 'slate');
108
+ c.put(3, 0, 'SPAWN ATTEMPTS IN WINDOW', 'slate');
107
109
  c.bigDigits(4, 0, snapshot.spawns === null ? '-' : snapshot.spawns, color);
108
110
  c.put(11, 0, `${snapshot.spawns ?? '?'} of ${snapshot.spawnCeiling ?? '?'} attempts · ${snapshot.windowActiveMinutes ?? '?'} active min`.slice(0, w), 'white');
109
111
  const fraction = snapshot.spawns === null || snapshot.spawnCeiling === null ? 0 : snapshot.spawns / snapshot.spawnCeiling;
@@ -117,8 +119,8 @@ function renderPhonePanel(snapshot, options = {}) {
117
119
  const filled = snapshot.stop && attempts >= ceiling ? attempts - 1 : attempts;
118
120
  const perRow = Math.ceil(ceiling / 2), blockWidth = Math.max(1, Math.floor((w + 1) / perRow) - 1);
119
121
  const refused = snapshot.stop !== undefined;
120
- c.put(16, 0, 'AGENT COPIES', 'slate');
121
- const tag = refused ? 'next copy refused' : 'one block per copy';
122
+ c.put(16, 0, 'COPIES LAUNCHED', 'slate');
123
+ const tag = refused ? 'attempt refused' : 'one block per copy';
122
124
  c.put(16, Math.max(13, w - tag.length), tag, refused ? 'red' : 'slate');
123
125
  for (let index = 0; index < ceiling; index++) {
124
126
  const row = 17 + Math.floor(index / perRow) * 2, col = (index % perRow) * (blockWidth + 1);
@@ -135,13 +137,14 @@ function renderPhonePanel(snapshot, options = {}) {
135
137
  });
136
138
  if (!snapshot.decisions.length)
137
139
  c.put(23, 0, 'No recorded decisions yet.', 'slate');
138
- c.put(29, 0, 'Each spawn re-reads all the context.'.slice(0, w), 'white');
140
+ // The caller's label (what this recording was) takes the explainer row when supplied.
141
+ c.put(29, 0, (options.label ? options.label.toUpperCase() : 'Each copy runs its own context window.').slice(0, w), options.label ? 'slate' : 'white');
139
142
  if (snapshot.stop) {
140
143
  c.put(30, 0, '─'.repeat(w), 'red');
141
144
  c.put(31, 0, ('STOP · ' + (snapshot.stop.blocked === true ? 'blocked' : snapshot.stop.blocked === false ? 'shadow / allowed' : 'outcome unknown') + ' · ' + snapshot.stop.reason).slice(0, w), 'red');
142
145
  c.put(32, 0, '─'.repeat(w), 'red');
143
146
  }
144
- c.put(33, 0, 'Past the limit, the next is refused.'.slice(0, w), 'white');
147
+ c.put(33, 0, 'At the ceiling, the attempt is refused.'.slice(0, w), 'white');
145
148
  return c;
146
149
  }
147
150
  function renderLivePanel(snapshot, options = {}) {
@@ -26,4 +26,6 @@ export declare function renderRecording(source: string, options: {
26
26
  gif?: string;
27
27
  ffmpeg?: string | null;
28
28
  phone?: boolean;
29
+ label?: string;
30
+ playback?: number;
29
31
  }): Promise<RenderRecordingResult>;
@@ -117,6 +117,12 @@ async function renderCanvasPng(snapshot, width = 1920, height = 1080, style = 'd
117
117
  return canvas.encode('png');
118
118
  }
119
119
  async function renderRecording(source, options) {
120
+ if (options.label !== undefined && !/^[\x20-\x7e]{1,40}$/.test(options.label))
121
+ throw new Error('Render label must be 1 to 40 printable ASCII characters.');
122
+ // Playback divides every recorded interval; the frame stays labelled with the rate and provenance records it.
123
+ const playback = options.playback ?? 1;
124
+ if (!Number.isFinite(playback) || playback < 1 || playback > 4)
125
+ throw new Error('Playback rate must be between 1 and 4.');
120
126
  const sourcePath = (0, node_path_1.resolve)(source), mp4Path = (0, node_path_1.resolve)(options.mp4);
121
127
  const gifPath = options.gif ? (0, node_path_1.resolve)(options.gif) : null;
122
128
  const provenancePath = `${mp4Path}.provenance.json`;
@@ -160,13 +166,13 @@ async function renderRecording(source, options) {
160
166
  const frame = frames[index];
161
167
  const name = `frame-${String(index).padStart(6, '0')}.png`;
162
168
  const viewport = options.phone ? exports.PHONE_VIEWPORT : { width: frame.viewport?.width ?? 104, height: frame.viewport?.height ?? 35 };
163
- const image = (0, frames_1.renderFrame)(frame.data, { recorded: true, showcase: true, at: frame.at, width: viewport.width, height: viewport.height, colour: true });
169
+ const image = (0, frames_1.renderFrame)(frame.data, { recorded: true, showcase: true, at: frame.at, width: viewport.width, height: viewport.height, colour: true, ...(options.label ? { label: options.label } : {}), ...(playback !== 1 ? { playback } : {}) });
164
170
  const size = options.phone ? exports.PHONE_FRAME : { width: 1920, height: 1080 };
165
171
  await (0, promises_1.writeFile)((0, node_path_1.join)(framesDir, name), await renderCanvasPng(image.toJSON(), size.width, size.height, frame.data.kind !== 'live' ? 'default' : options.phone ? 'phone' : 'showcase'), { flag: 'wx', mode: 0o600 });
166
172
  }
167
173
  for (const [position, index] of videoIndices.entries()) {
168
174
  const next = videoIndices[position + 1];
169
- const seconds = next === undefined ? 1 : Number(times[next] - times[index]) / 1_000_000;
175
+ const seconds = (next === undefined ? 1 : Number(times[next] - times[index]) / 1_000_000) / playback;
170
176
  lines.push(`file 'frame-${String(index).padStart(6, '0')}.png'`, 'option framerate 1000000', `duration ${seconds.toFixed(6)}`);
171
177
  }
172
178
  // The concat demuxer needs a terminal file to honor the final frame hold.
@@ -189,6 +195,8 @@ async function renderRecording(source, options) {
189
195
  frame_times: frames.map(frame => frame.at),
190
196
  frame_viewports: frames.map(frame => options.phone ? { ...exports.PHONE_VIEWPORT } : frame.viewport ?? { width: 104, height: 35 }),
191
197
  layout: options.phone ? 'phone' : 'wide',
198
+ label: options.label ?? null,
199
+ playback,
192
200
  frame_size: options.phone ? { ...exports.PHONE_FRAME } : { width: 1920, height: 1080 },
193
201
  video_frame_indices: videoIndices,
194
202
  video_timestamp_precision: 'microseconds; equal timestamps retain the last frame in video and every PNG',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentguard-run/burn",
3
- "version": "0.3.10",
3
+ "version": "0.3.12",
4
4
  "description": "Local session usage and runaway-agent circuit breaker. Explain tokens, cache rewrites and API list cost, track pace, warn on heavy turns, and gate agent fan-out with signed receipts. Developer command ranking requires explicit --rank.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "commonjs",