@agentguard-run/burn 0.3.11 → 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,9 @@
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
+
3
7
  ## 0.3.11 (2026-09-23)
4
8
 
5
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.
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. `--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.
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,24 +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'), label = flag('--label');
166
- const usage = 'Usage: agentguard-burn render <run.jsonl> --mp4 <out.mp4> [--gif <out.gif>] [--phone] [--label <text>] | --dashboard [--wide] [--economics <blocks.json>] [--fps <n>] [--label <text>]';
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
167
  if (has('--label') && (!label || label.startsWith('--')))
168
168
  throw new Error(usage);
169
+ if (has('--playback') && !/^[1-4](\.\d{1,2})?$/.test(playbackFlag ?? ''))
170
+ throw new Error(usage);
169
171
  if (!source || source.startsWith('--') || !mp4 || mp4.startsWith('--') || (has('--gif') && (!gif || gif.startsWith('--'))))
170
172
  throw new Error(usage);
171
173
  if (has('--dashboard')) {
172
174
  if (has('--gif') || has('--phone') || (has('--economics') && (!economics || economics.startsWith('--'))) || (has('--fps') && !/^\d{1,2}$/.test(fpsFlag ?? '')))
173
175
  throw new Error(usage);
174
176
  const { renderDashboard } = await Promise.resolve().then(() => __importStar(require('./dashboard-render')));
175
- const result = await renderDashboard(source, { mp4, economics, wide: has('--wide'), ...(fpsFlag ? { fps: Number(fpsFlag) } : {}), ...(label ? { label } : {}) });
177
+ const result = await renderDashboard(source, { mp4, economics, wide: has('--wide'), ...(fpsFlag ? { fps: Number(fpsFlag) } : {}), ...(label ? { label } : {}), ...(playbackFlag ? { playback: Number(playbackFlag) } : {}) });
176
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`);
177
179
  return 0;
178
180
  }
179
181
  if (has('--wide') || has('--economics') || has('--fps'))
180
182
  throw new Error(usage);
181
183
  const { renderRecording } = await Promise.resolve().then(() => __importStar(require('./render-recording')));
182
- const result = await renderRecording(source, { mp4, gif, phone: has('--phone'), ...(label ? { label } : {}) });
184
+ const result = await renderRecording(source, { mp4, gif, phone: has('--phone'), ...(label ? { label } : {}), ...(playbackFlag ? { playback: Number(playbackFlag) } : {}) });
183
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`);
184
186
  return 0;
185
187
  }
@@ -57,6 +57,8 @@ export interface DashboardModel {
57
57
  launched: number;
58
58
  /** Caller-supplied name for what the recording was (for example "deliberate fan-out test"); drawn in the header, never inferred. */
59
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;
60
62
  events: DashboardEvent[];
61
63
  samples: DashboardSample[];
62
64
  economics: DashboardEconomics | null;
@@ -31,4 +31,5 @@ export declare function renderDashboard(source: string, options: {
31
31
  fps?: number;
32
32
  seed?: number;
33
33
  label?: string;
34
+ playback?: number;
34
35
  }): Promise<DashboardRenderResult>;
@@ -135,6 +135,9 @@ function header(ctx, model, state, g) {
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
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' });
138
141
  // Counters step at the recorded event time, in the same frame as the log row and the ring marker, so no frame shows
139
142
  // a marker or log row the counters have not yet counted. Copies = allowed decisions; the ledger's attempt counter drives the rate bar.
140
143
  const values = [
@@ -366,6 +369,9 @@ async function renderDashboard(source, options) {
366
369
  throw new Error('Dashboard fps must be an integer from 1 to 60.');
367
370
  if (options.label !== undefined && !/^[\x20-\x7e]{1,40}$/.test(options.label))
368
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.');
369
375
  const sourcePath = (0, node_path_1.resolve)(source), mp4Path = (0, node_path_1.resolve)(options.mp4), provenancePath = `${mp4Path}.provenance.json`;
370
376
  const economicsPath = options.economics ? (0, node_path_1.resolve)(options.economics) : null;
371
377
  const outputs = [mp4Path, provenancePath];
@@ -386,15 +392,16 @@ async function renderDashboard(source, options) {
386
392
  const economics = economicsPath ? (0, dashboard_model_1.readDashboardEconomics)(economicsPath, frames[0].snapshot.session, (0, dashboard_model_1.recordingWindow)(frames)) : null;
387
393
  if (!sourceBytes.equals(await (0, promises_1.readFile)(sourcePath)))
388
394
  throw new Error('Recording changed while it was being read; render the saved file again.');
389
- const model = { ...(0, dashboard_model_1.dashboardModel)(frames, economics, dashboard_model_1.DASHBOARD_HOLD_MS), ...(options.label ? { label: options.label } : {}) };
395
+ const model = { ...(0, dashboard_model_1.dashboardModel)(frames, economics, dashboard_model_1.DASHBOARD_HOLD_MS), ...(options.label ? { label: options.label } : {}), ...(playback !== 1 ? { playback } : {}) };
390
396
  const layout = options.wide ? 'wide' : 'phone', g = geometry(layout), seed = options.seed ?? exports.DASHBOARD_SEED;
391
397
  const fonts = await registerFonts();
392
- 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;
393
400
  await (0, promises_1.mkdir)((0, node_path_1.dirname)(mp4Path), { recursive: true });
394
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-`));
395
402
  const concatPath = (0, node_path_1.join)(framesDir, 'frames.ffconcat'), lines = ['ffconcat version 1.0'], frameTimes = [];
396
403
  for (let index = 0; index < frameCount; index++) {
397
- 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`;
398
405
  frameTimes.push(new Date(model.startMs + offset).toISOString());
399
406
  await (0, promises_1.writeFile)((0, node_path_1.join)(framesDir, name), await renderDashboardFrame(model, offset, layout, seed), { flag: 'wx', mode: 0o600 });
400
407
  if (index < total)
@@ -415,6 +422,7 @@ async function renderDashboard(source, options) {
415
422
  fonts, layout: 'dashboard', frame_size: { width: g.width, height: g.height }, aspect: layout, fps, seed,
416
423
  frame_count: frameCount, frame_times: frameTimes,
417
424
  label: options.label ?? null,
425
+ playback, video_seconds: (model.durationMs + model.holdMs) / playback / 1000,
418
426
  recording_span_seconds: model.durationMs / 1000, final_hold_seconds: model.holdMs / 1000,
419
427
  video_timestamp_precision: 'microseconds; fixed 1/fps frame durations from the first recorded timestamp',
420
428
  ffmpeg_command: command,
@@ -42,6 +42,7 @@ export interface FrameOptions {
42
42
  height?: number;
43
43
  colour?: boolean;
44
44
  label?: string;
45
+ playback?: number;
45
46
  }
46
47
  export declare function auditFrame(command: 'ps' | 'reap', report: AuditReport): BurnFrame;
47
48
  export declare function framePageCount(data: BurnFrame, options?: FrameOptions): number;
@@ -48,7 +48,8 @@ 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
50
  // A render label (for example "deliberate fan-out test") names what the recording was; it is caller-supplied, never inferred.
51
- c.header('AGENTGUARD / BURN', options.label ? `${options.label.toUpperCase()} · RECORDED · 1x` : 'RECORDED RUN · 1x');
51
+ const speed = `${options.playback ?? 1}x`;
52
+ c.header('AGENTGUARD / BURN', options.label ? `${options.label.toUpperCase()} · RECORDED · ${speed}` : `RECORDED RUN · ${speed}`);
52
53
  c.footer('local observation only', `elapsed ${snapshot.elapsedMs === null ? 'unknown' : elapsed(snapshot.elapsedMs ?? snapshot.observedAt - snapshot.startedAt)}`);
53
54
  c.put(2, 0, `session ${snapshot.session} · ${at.slice(11, 19)} UTC`, 'slate');
54
55
  for (let y = 3; y < h - 3; y++)
@@ -101,7 +102,7 @@ function renderShowcasePanel(snapshot, options = {}) {
101
102
  function renderPhonePanel(snapshot, options = {}) {
102
103
  const c = new canvas_1.Canvas(options), w = c.width;
103
104
  const at = options.at ?? new Date(snapshot.observedAt).toISOString(), color = spawnBarColor(snapshot.spawns, snapshot.spawnCeiling);
104
- c.header('AGENTGUARD / BURN', 'RECORDED · 1x');
105
+ c.header('AGENTGUARD / BURN', `RECORDED · ${options.playback ?? 1}x`);
105
106
  c.footer('signed on this machine', `elapsed ${snapshot.elapsedMs === null ? 'unknown' : elapsed(snapshot.elapsedMs ?? snapshot.observedAt - snapshot.startedAt)}`);
106
107
  c.put(2, 0, `session ${snapshot.session} · ${at.slice(11, 19)} UTC`.slice(0, w), 'slate');
107
108
  c.put(3, 0, 'SPAWN ATTEMPTS IN WINDOW', 'slate');
@@ -27,4 +27,5 @@ export declare function renderRecording(source: string, options: {
27
27
  ffmpeg?: string | null;
28
28
  phone?: boolean;
29
29
  label?: string;
30
+ playback?: number;
30
31
  }): Promise<RenderRecordingResult>;
@@ -119,6 +119,10 @@ async function renderCanvasPng(snapshot, width = 1920, height = 1080, style = 'd
119
119
  async function renderRecording(source, options) {
120
120
  if (options.label !== undefined && !/^[\x20-\x7e]{1,40}$/.test(options.label))
121
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.');
122
126
  const sourcePath = (0, node_path_1.resolve)(source), mp4Path = (0, node_path_1.resolve)(options.mp4);
123
127
  const gifPath = options.gif ? (0, node_path_1.resolve)(options.gif) : null;
124
128
  const provenancePath = `${mp4Path}.provenance.json`;
@@ -162,13 +166,13 @@ async function renderRecording(source, options) {
162
166
  const frame = frames[index];
163
167
  const name = `frame-${String(index).padStart(6, '0')}.png`;
164
168
  const viewport = options.phone ? exports.PHONE_VIEWPORT : { width: frame.viewport?.width ?? 104, height: frame.viewport?.height ?? 35 };
165
- 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 } : {}) });
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 } : {}) });
166
170
  const size = options.phone ? exports.PHONE_FRAME : { width: 1920, height: 1080 };
167
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 });
168
172
  }
169
173
  for (const [position, index] of videoIndices.entries()) {
170
174
  const next = videoIndices[position + 1];
171
- 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;
172
176
  lines.push(`file 'frame-${String(index).padStart(6, '0')}.png'`, 'option framerate 1000000', `duration ${seconds.toFixed(6)}`);
173
177
  }
174
178
  // The concat demuxer needs a terminal file to honor the final frame hold.
@@ -192,6 +196,7 @@ async function renderRecording(source, options) {
192
196
  frame_viewports: frames.map(frame => options.phone ? { ...exports.PHONE_VIEWPORT } : frame.viewport ?? { width: 104, height: 35 }),
193
197
  layout: options.phone ? 'phone' : 'wide',
194
198
  label: options.label ?? null,
199
+ playback,
195
200
  frame_size: options.phone ? { ...exports.PHONE_FRAME } : { width: 1920, height: 1080 },
196
201
  video_frame_indices: videoIndices,
197
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.11",
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",