@agentguard-run/burn 0.3.9 → 0.3.10
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 +7 -0
- package/README.md +1 -1
- package/dist/src/dashboard-model.d.ts +24 -2
- package/dist/src/dashboard-model.js +32 -6
- package/dist/src/dashboard-render.js +16 -9
- package/dist/src/insights/blocks.d.ts +2 -0
- package/dist/src/insights/blocks.js +6 -0
- package/dist/src/live-panel.js +6 -4
- package/docs/assets/burn-real-stop-sep20.blocks.json +17 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.10 (2026-09-23)
|
|
4
|
+
|
|
5
|
+
- 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".
|
|
6
|
+
- Dashboard economics: `--economics` now prices only the copies the recording allowed: the earliest children, one per allowed decision, that started within a minute of the first frame. Children spawned later in the same session stay out of the dollars, and the caption says "list cost of the N copies the gate allowed · not a bill". A blocks file without child start times is refused with a message to regenerate it.
|
|
7
|
+
- `blocks --json`: every child row carries `startedAt`, the epoch milliseconds of its earliest timed usage row.
|
|
8
|
+
- Phone and wide recorded renders: the spawn line reads "16 of 16 attempts", never "allowed"; the copies grid fills one block per copy that launched, so a refused attempt leaves its block empty.
|
|
9
|
+
|
|
3
10
|
## 0.3.9 (2026-09-23)
|
|
4
11
|
|
|
5
12
|
- Dashboard render: the subagents caption wraps inside its panel on the 4:5 frame instead of crossing the panel edge.
|
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
|
|
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.
|
|
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
|
|
@@ -9,17 +9,26 @@ export interface DashboardFrame {
|
|
|
9
9
|
export interface DashboardChild {
|
|
10
10
|
child: string;
|
|
11
11
|
kind: 'fork' | 'fresh';
|
|
12
|
+
startedAt: number | null;
|
|
12
13
|
tokens: number | null;
|
|
13
14
|
usd: DollarRange | null;
|
|
14
15
|
}
|
|
16
|
+
/** `scope` says which children the dollars cover: the copies one recording allowed, or every child of the session. */
|
|
15
17
|
export interface DashboardEconomics {
|
|
16
18
|
session: string;
|
|
19
|
+
scope: 'recording' | 'session';
|
|
20
|
+
launched: number | null;
|
|
17
21
|
children: DashboardChild[];
|
|
18
22
|
measuredCount: number;
|
|
19
23
|
pricedCount: number;
|
|
20
24
|
totalTokens: number;
|
|
21
25
|
totalUsd: DollarRange;
|
|
22
26
|
}
|
|
27
|
+
/** A recording's own window: its first frame time and how many spawn decisions it allowed. */
|
|
28
|
+
export interface RecordingWindow {
|
|
29
|
+
fromMs: number;
|
|
30
|
+
launched: number;
|
|
31
|
+
}
|
|
23
32
|
export interface DashboardEvent {
|
|
24
33
|
id: string;
|
|
25
34
|
atMs: number;
|
|
@@ -44,6 +53,8 @@ export interface DashboardModel {
|
|
|
44
53
|
ceiling: number | null;
|
|
45
54
|
warnAt: number | null;
|
|
46
55
|
windowActiveMinutes: number | null;
|
|
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
|
+
launched: number;
|
|
47
58
|
events: DashboardEvent[];
|
|
48
59
|
samples: DashboardSample[];
|
|
49
60
|
economics: DashboardEconomics | null;
|
|
@@ -60,9 +71,14 @@ export interface DashboardStop {
|
|
|
60
71
|
export interface DashboardState {
|
|
61
72
|
t: number;
|
|
62
73
|
phase: 'run' | 'hold';
|
|
74
|
+
/** The ledger's spawn-attempt counter in the window, the number the rate rule compares with the ceiling. */
|
|
63
75
|
copies: number;
|
|
64
76
|
copiesChangedAt: number;
|
|
65
77
|
previousCopies: number;
|
|
78
|
+
/** Copies that actually launched: allowed decisions so far. */
|
|
79
|
+
launched: number;
|
|
80
|
+
launchedChangedAt: number;
|
|
81
|
+
previousLaunched: number;
|
|
66
82
|
decisions: number;
|
|
67
83
|
refused: number;
|
|
68
84
|
elapsedMs: number;
|
|
@@ -72,9 +88,15 @@ export interface DashboardState {
|
|
|
72
88
|
}
|
|
73
89
|
/** Live frames only, every field known. Unknown fields fail the render instead of being ignored. */
|
|
74
90
|
export declare function readDashboardRecording(file: string): DashboardFrame[];
|
|
75
|
-
/**
|
|
76
|
-
|
|
91
|
+
/**
|
|
92
|
+
* The blocks JSON is the output of `agentguard-burn blocks <session> --json`; only the recorded session's children are used.
|
|
93
|
+
* With a `window`, only the copies that recording allowed are kept: the `launched` earliest children that started at or after
|
|
94
|
+
* the first frame (one minute of slack for hook approval). Children spawned later in the same session stay out of the dollars.
|
|
95
|
+
*/
|
|
96
|
+
export declare function readDashboardEconomics(file: string, session: string, window?: RecordingWindow): DashboardEconomics;
|
|
77
97
|
/** Distinct decisions in time order; each carries the spawn count of the first frame that showed it. */
|
|
78
98
|
export declare function dashboardModel(frames: DashboardFrame[], economics?: DashboardEconomics | null, holdMs?: number): DashboardModel;
|
|
99
|
+
/** The window a recording defines for its own child economics: first frame time and the spawn decisions it allowed. */
|
|
100
|
+
export declare function recordingWindow(frames: DashboardFrame[]): RecordingWindow;
|
|
79
101
|
/** The dashboard at offset t (ms from the first frame): the latest sample and every decision up to t. */
|
|
80
102
|
export declare function dashboardState(model: DashboardModel, t: number): DashboardState;
|
|
@@ -4,6 +4,7 @@ exports.DASHBOARD_HOLD_MS = void 0;
|
|
|
4
4
|
exports.readDashboardRecording = readDashboardRecording;
|
|
5
5
|
exports.readDashboardEconomics = readDashboardEconomics;
|
|
6
6
|
exports.dashboardModel = dashboardModel;
|
|
7
|
+
exports.recordingWindow = recordingWindow;
|
|
7
8
|
exports.dashboardState = dashboardState;
|
|
8
9
|
/** Dashboard data model: a strict reading of a live recording plus the child economics of the same session. */
|
|
9
10
|
const node_fs_1 = require("node:fs");
|
|
@@ -49,22 +50,39 @@ function dollarRange(value) {
|
|
|
49
50
|
throw new Error('Blocks JSON has a child price that is not a dollar range.');
|
|
50
51
|
return { min: range.min, max: range.max };
|
|
51
52
|
}
|
|
52
|
-
/**
|
|
53
|
-
|
|
53
|
+
/**
|
|
54
|
+
* The blocks JSON is the output of `agentguard-burn blocks <session> --json`; only the recorded session's children are used.
|
|
55
|
+
* With a `window`, only the copies that recording allowed are kept: the `launched` earliest children that started at or after
|
|
56
|
+
* the first frame (one minute of slack for hook approval). Children spawned later in the same session stay out of the dollars.
|
|
57
|
+
*/
|
|
58
|
+
function readDashboardEconomics(file, session, window) {
|
|
54
59
|
const report = JSON.parse((0, node_fs_1.readFileSync)(file, 'utf8'));
|
|
55
60
|
const sessions = Array.isArray(report.sessions) ? report.sessions : [];
|
|
56
61
|
const match = sessions.find(entry => typeof entry.session === 'string' && (entry.session === session || entry.session.startsWith(session)));
|
|
57
62
|
const children = match?.economics?.available === true && Array.isArray(match.economics.children) ? match.economics.children : [];
|
|
58
63
|
if (!match || !children.length)
|
|
59
64
|
throw new Error(`Blocks JSON has no child economics for session ${session}.`);
|
|
60
|
-
const
|
|
65
|
+
const all = children.map(child => {
|
|
61
66
|
if (typeof child.child !== 'string' || (child.kind !== 'fork' && child.kind !== 'fresh') || !(child.tokens === null || finite(child.tokens)))
|
|
62
67
|
throw new Error('Blocks JSON has a malformed child row.');
|
|
63
|
-
|
|
68
|
+
// Start times are epoch milliseconds from `blocks --json`; an ISO string is accepted for hand-edited files.
|
|
69
|
+
const startedAt = child.startedAt === undefined || child.startedAt === null ? null
|
|
70
|
+
: typeof child.startedAt === 'number' && Number.isFinite(child.startedAt) && child.startedAt > 0 ? child.startedAt
|
|
71
|
+
: typeof child.startedAt === 'string' && Number.isFinite(Date.parse(child.startedAt)) ? Date.parse(child.startedAt) : NaN;
|
|
72
|
+
if (Number.isNaN(startedAt))
|
|
73
|
+
throw new Error('Blocks JSON has a child start time that is neither epoch milliseconds nor an ISO timestamp.');
|
|
74
|
+
return { child: child.child, kind: child.kind, startedAt, tokens: child.tokens, usd: dollarRange(child.usd) };
|
|
64
75
|
});
|
|
76
|
+
let rows = all;
|
|
77
|
+
if (window) {
|
|
78
|
+
if (all.some(row => row.startedAt === null))
|
|
79
|
+
throw new Error('Blocks JSON has children without start times; regenerate it with agentguard-burn 0.3.10 or later so the dashboard can keep only the copies this recording allowed.');
|
|
80
|
+
rows = all.filter(row => row.startedAt >= window.fromMs - 60_000).sort((a, b) => a.startedAt - b.startedAt || a.child.localeCompare(b.child)).slice(0, window.launched);
|
|
81
|
+
}
|
|
65
82
|
const measured = rows.filter(row => row.tokens !== null), priced = rows.filter(row => row.usd !== null);
|
|
66
83
|
return {
|
|
67
|
-
session: match.session,
|
|
84
|
+
session: match.session, scope: window ? 'recording' : 'session', launched: window ? window.launched : null,
|
|
85
|
+
children: rows, measuredCount: measured.length, pricedCount: priced.length,
|
|
68
86
|
totalTokens: measured.reduce((sum, row) => sum + row.tokens, 0),
|
|
69
87
|
totalUsd: { min: priced.reduce((sum, row) => sum + row.usd.min, 0), max: priced.reduce((sum, row) => sum + row.usd.max, 0) },
|
|
70
88
|
};
|
|
@@ -89,9 +107,15 @@ function dashboardModel(frames, economics = null, holdMs = exports.DASHBOARD_HOL
|
|
|
89
107
|
const firstWarn = events.find(event => event.verdict === 'WARN'), firstStop = events.find(event => event.verdict === 'STOP');
|
|
90
108
|
return {
|
|
91
109
|
session: first.snapshot.session, startAt: first.at, startMs: first.atMs, durationMs: last.atMs - first.atMs, holdMs,
|
|
92
|
-
ceiling, warnAt: firstWarn ? firstWarn.copies : null, windowActiveMinutes,
|
|
110
|
+
ceiling, warnAt: firstWarn ? firstWarn.copies : null, windowActiveMinutes, launched: events.filter(event => event.verdict !== 'STOP').length,
|
|
111
|
+
events, samples, economics, firstStopMs: firstStop ? firstStop.offsetMs : null,
|
|
93
112
|
};
|
|
94
113
|
}
|
|
114
|
+
/** The window a recording defines for its own child economics: first frame time and the spawn decisions it allowed. */
|
|
115
|
+
function recordingWindow(frames) {
|
|
116
|
+
const model = dashboardModel(frames, null);
|
|
117
|
+
return { fromMs: model.startMs, launched: model.launched };
|
|
118
|
+
}
|
|
95
119
|
/** The dashboard at offset t (ms from the first frame): the latest sample and every decision up to t. */
|
|
96
120
|
function dashboardState(model, t) {
|
|
97
121
|
const clamped = Math.max(0, Math.min(t, model.durationMs + model.holdMs));
|
|
@@ -107,9 +131,11 @@ function dashboardState(model, t) {
|
|
|
107
131
|
}
|
|
108
132
|
const log = model.events.filter(event => event.offsetMs <= clamped);
|
|
109
133
|
const stop = log.find(event => event.verdict === 'STOP');
|
|
134
|
+
const allowed = log.filter(event => event.verdict !== 'STOP'), lastAllowed = allowed.at(-1);
|
|
110
135
|
return {
|
|
111
136
|
t: clamped, phase: clamped > model.durationMs ? 'hold' : 'run',
|
|
112
137
|
copies: sample.copies, copiesChangedAt: changedAt, previousCopies: previous.copies,
|
|
138
|
+
launched: allowed.length, launchedChangedAt: lastAllowed?.offsetMs ?? 0, previousLaunched: Math.max(0, allowed.length - 1),
|
|
113
139
|
decisions: log.length, refused: log.filter(event => event.verdict === 'STOP').length,
|
|
114
140
|
elapsedMs: sample.elapsedMs, log,
|
|
115
141
|
stop: stop ? { copies: stop.copies, ceiling: model.ceiling, windowActiveMinutes: model.windowActiveMinutes, offsetMs: stop.offsetMs, reason: stop.reason, blocked: stop.blocked } : null,
|
|
@@ -137,7 +137,8 @@ function header(ctx, model, state, g) {
|
|
|
137
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
138
|
const lastEvent = state.log.at(-1), lastStop = [...state.log].reverse().find(event => event.verdict === 'STOP');
|
|
139
139
|
const values = [
|
|
140
|
-
|
|
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],
|
|
141
142
|
['decisions', String(counter(Math.max(0, state.decisions - 1), state.decisions, lastEvent?.offsetMs ?? 0, state.t)), exports.INK.ink],
|
|
142
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],
|
|
143
144
|
['elapsed', clock(state.elapsedMs), exports.INK.ink],
|
|
@@ -157,7 +158,8 @@ function ring(ctx, model, state, g, phases) {
|
|
|
157
158
|
ctx.beginPath();
|
|
158
159
|
ctx.arc(cx, cy, r, 0, Math.PI * 2);
|
|
159
160
|
ctx.stroke();
|
|
160
|
-
|
|
161
|
+
// One marker per copy that launched; refused attempts are the red X marks above the gate, never a marker.
|
|
162
|
+
const shown = Math.min(state.launched, slots);
|
|
161
163
|
if (shown > 0) {
|
|
162
164
|
ctx.strokeStyle = state.warned ? exports.INK.amber : exports.INK.teal;
|
|
163
165
|
ctx.lineWidth = 4;
|
|
@@ -238,7 +240,7 @@ function ring(ctx, model, state, g, phases) {
|
|
|
238
240
|
function bar(ctx, model, state, g) {
|
|
239
241
|
const { x, y, w, h } = g.bar, ceiling = model.ceiling ?? 16, fraction = clamp01(counter(state.previousCopies * 100, state.copies * 100, state.copiesChangedAt, state.t) / 100 / ceiling);
|
|
240
242
|
const color = state.refused ? exports.INK.red : state.warned ? exports.INK.amber : exports.INK.teal;
|
|
241
|
-
text(ctx, `SPAWN
|
|
243
|
+
text(ctx, `SPAWN ATTEMPTS · ${model.windowActiveMinutes ?? '?'} ACTIVE MIN`, x, y - 22, g.label, { color: exports.INK.secondary, weight: 600 });
|
|
242
244
|
text(ctx, `${state.copies} / ${ceiling}`, x + w, y - 12, g.number, { family: 'mono', weight: 700, color, align: 'right' });
|
|
243
245
|
ctx.fillStyle = exports.INK.line;
|
|
244
246
|
ctx.beginPath();
|
|
@@ -285,21 +287,24 @@ function agents(ctx, model, state, g) {
|
|
|
285
287
|
return;
|
|
286
288
|
}
|
|
287
289
|
const revealAt = model.firstStopMs ?? model.durationMs, reveal = easeOut((state.t - revealAt) / 1200);
|
|
290
|
+
// Recording scope: the dollars cover only the copies this recording allowed. Session scope: every child of the session.
|
|
291
|
+
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`;
|
|
288
293
|
if (reveal <= 0) {
|
|
289
|
-
text(ctx,
|
|
294
|
+
text(ctx, noun, x + 20, y + 84, g.body, { color: exports.INK.secondary });
|
|
290
295
|
text(ctx, 'priced once the run ends', x + 20, y + 84 + g.body * 1.4, g.body, { color: exports.INK.secondary });
|
|
291
296
|
return;
|
|
292
297
|
}
|
|
293
298
|
const total = { min: economics.totalUsd.min * reveal, max: economics.totalUsd.max * reveal };
|
|
294
299
|
text(ctx, (0, live_1.dollars)(total), x + 20, y + 52 + g.bigNumber, g.bigNumber, { family: 'mono', weight: 700, color: exports.INK.ink });
|
|
295
300
|
// The caption wraps onto a second line when the panel is narrower than the sentence, so it never crosses the panel edge.
|
|
296
|
-
const
|
|
301
|
+
const lead = `list cost of ${noun}`, caption = `${lead} · not a bill`;
|
|
297
302
|
ctx.font = `400 ${g.small}px "${TEXT}"`;
|
|
298
303
|
const wrapped = ctx.measureText(caption).width > w - 40;
|
|
299
304
|
if (!wrapped)
|
|
300
305
|
text(ctx, caption, x + 20, y + 76 + g.bigNumber, g.small, { color: exports.INK.secondary });
|
|
301
306
|
else {
|
|
302
|
-
text(ctx,
|
|
307
|
+
text(ctx, lead, x + 20, y + 76 + g.bigNumber, g.small, { color: exports.INK.secondary });
|
|
303
308
|
text(ctx, 'not a bill', x + 20, y + 76 + g.bigNumber + g.small * 1.15, g.small, { color: exports.INK.secondary });
|
|
304
309
|
}
|
|
305
310
|
const sorted = [...economics.children].sort((a, b) => (b.tokens ?? 0) - (a.tokens ?? 0)), top = sorted.slice(0, rows), max = top[0]?.tokens ?? 1;
|
|
@@ -332,10 +337,11 @@ function card(ctx, state, g) {
|
|
|
332
337
|
ctx.roundRect(x, y, w, h, 12);
|
|
333
338
|
ctx.fill();
|
|
334
339
|
ctx.stroke();
|
|
335
|
-
const outcome = state.stop.blocked === true ? '
|
|
340
|
+
const outcome = state.stop.blocked === true ? 'refused' : state.stop.blocked === false ? 'shadow, copy allowed' : 'outcome not recorded';
|
|
336
341
|
text(ctx, 'STOP', x + 22, y + h / 2 + g.number * .36, g.number, { family: 'mono', weight: 700, color: exports.INK.red });
|
|
337
342
|
const ceiling = state.stop.ceiling ?? '?', window = state.stop.windowActiveMinutes ?? '?';
|
|
338
|
-
|
|
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 });
|
|
339
345
|
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 });
|
|
340
346
|
ctx.restore();
|
|
341
347
|
}
|
|
@@ -380,7 +386,8 @@ async function renderDashboard(source, options) {
|
|
|
380
386
|
const sourceBytes = await (0, promises_1.readFile)(sourcePath);
|
|
381
387
|
const frames = (0, dashboard_model_1.readDashboardRecording)(sourcePath);
|
|
382
388
|
const economicsBytes = economicsPath ? await (0, promises_1.readFile)(economicsPath) : null;
|
|
383
|
-
|
|
389
|
+
// Only the copies this recording allowed are priced; later children of the same session stay out of the dollars.
|
|
390
|
+
const economics = economicsPath ? (0, dashboard_model_1.readDashboardEconomics)(economicsPath, frames[0].snapshot.session, (0, dashboard_model_1.recordingWindow)(frames)) : null;
|
|
384
391
|
if (!sourceBytes.equals(await (0, promises_1.readFile)(sourcePath)))
|
|
385
392
|
throw new Error('Recording changed while it was being read; render the saved file again.');
|
|
386
393
|
const model = (0, dashboard_model_1.dashboardModel)(frames, economics, dashboard_model_1.DASHBOARD_HOLD_MS);
|
|
@@ -15,6 +15,8 @@ export interface ChildEconomics {
|
|
|
15
15
|
child: string;
|
|
16
16
|
kind: 'fork' | 'fresh';
|
|
17
17
|
forkContextRef: boolean;
|
|
18
|
+
/** Epoch milliseconds of the child's earliest timed usage row; null when the transcript carries none. */
|
|
19
|
+
startedAt: number | null;
|
|
18
20
|
tokens: number | null;
|
|
19
21
|
usd: DollarRange | null;
|
|
20
22
|
unknownModels: string[];
|
|
@@ -77,6 +77,11 @@ function childStatistics(children) {
|
|
|
77
77
|
medianUsd: children.length && priced.length === children.length ? { min: median(priced.map(child => child.usd.min)), max: median(priced.map(child => child.usd.max)) } : null,
|
|
78
78
|
maxUsd: children.length && priced.length === children.length ? { min: Math.max(...priced.map(child => child.usd.min)), max: Math.max(...priced.map(child => child.usd.max)) } : null };
|
|
79
79
|
}
|
|
80
|
+
/** The child's earliest timed usage row, so a dashboard can keep only the copies one recording allowed. */
|
|
81
|
+
const earliestTurnAt = (turns) => {
|
|
82
|
+
const times = turns.map(turn => turn.at).filter((value) => typeof value === 'number' && Number.isFinite(value));
|
|
83
|
+
return times.length ? Math.min(...times) : null;
|
|
84
|
+
};
|
|
80
85
|
const unavailable = (note) => ({ available: false, children: [], all: childStatistics([]), forks: childStatistics([]), fresh: childStatistics([]), notes: [note] });
|
|
81
86
|
const locationId = (location) => location.host === 'codex'
|
|
82
87
|
? /([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})$/i.exec(location.sessionId)?.[1] ?? location.sessionId
|
|
@@ -151,6 +156,7 @@ function readSessionEconomics(location, locations, rates = {}, cache = new Map()
|
|
|
151
156
|
const unknownBoundary = transcript.state.forkHistoryBoundaryUnknown === true;
|
|
152
157
|
const prices = turns.map(turn => (0, pricing_1.priceTurn)(turn, rates));
|
|
153
158
|
return { child: id, kind: transcript.state.lineage?.forked ? 'fork' : 'fresh', forkContextRef: transcript.state.lineage?.forkContextRef === true,
|
|
159
|
+
startedAt: earliestTurnAt(transcript.turns),
|
|
154
160
|
tokens: unknownBoundary || !turns.length ? null : turns.reduce((sum, turn) => sum + (0, render_1.totalTokens)(turn), 0),
|
|
155
161
|
usd: unknownBoundary || !turns.length ? null : (0, render_1.sumPrices)(prices.map(price => price.usd)),
|
|
156
162
|
unknownModels: [...new Set(prices.filter(price => price.usd === null).map(price => price.model ?? 'missing model id'))] };
|
package/dist/src/live-panel.js
CHANGED
|
@@ -54,7 +54,7 @@ function renderShowcasePanel(snapshot, options = {}) {
|
|
|
54
54
|
c.put(y, split + 1, '│', 'slate');
|
|
55
55
|
c.put(4, 0, 'AGENT SPAWNS IN WINDOW', 'slate');
|
|
56
56
|
c.bigDigits(6, 0, snapshot.spawns === null ? '-' : snapshot.spawns, color);
|
|
57
|
-
c.put(14, 0, `${snapshot.spawns ?? '?'} of ${snapshot.spawnCeiling ?? '?'}
|
|
57
|
+
c.put(14, 0, `${snapshot.spawns ?? '?'} of ${snapshot.spawnCeiling ?? '?'} attempts · ${snapshot.windowActiveMinutes ?? '?'} active min`.slice(0, split), 'white');
|
|
58
58
|
const fraction = snapshot.spawns === null || snapshot.spawnCeiling === null ? 0 : snapshot.spawns / snapshot.spawnCeiling;
|
|
59
59
|
const rate = `${snapshot.spawns ?? '?'} / ${snapshot.spawnCeiling ?? '?'}`;
|
|
60
60
|
c.put(16, 0, 'SPAWN RATE', 'slate').put(16, Math.max(11, split - rate.length), rate, color);
|
|
@@ -105,14 +105,16 @@ function renderPhonePanel(snapshot, options = {}) {
|
|
|
105
105
|
c.put(2, 0, `session ${snapshot.session} · ${at.slice(11, 19)} UTC`.slice(0, w), 'slate');
|
|
106
106
|
c.put(3, 0, 'AGENT SPAWNS IN WINDOW', 'slate');
|
|
107
107
|
c.bigDigits(4, 0, snapshot.spawns === null ? '-' : snapshot.spawns, color);
|
|
108
|
-
c.put(11, 0, `${snapshot.spawns ?? '?'} of ${snapshot.spawnCeiling ?? '?'}
|
|
108
|
+
c.put(11, 0, `${snapshot.spawns ?? '?'} of ${snapshot.spawnCeiling ?? '?'} attempts · ${snapshot.windowActiveMinutes ?? '?'} active min`.slice(0, w), 'white');
|
|
109
109
|
const fraction = snapshot.spawns === null || snapshot.spawnCeiling === null ? 0 : snapshot.spawns / snapshot.spawnCeiling;
|
|
110
110
|
const rate = `${snapshot.spawns ?? '?'} / ${snapshot.spawnCeiling ?? '?'}`;
|
|
111
111
|
c.put(12, 0, 'SPAWN RATE', 'slate').put(12, Math.max(11, w - rate.length), rate, color);
|
|
112
112
|
c.bar(13, 0, w, fraction, color).bar(14, 0, w, fraction, color);
|
|
113
|
-
// One block per
|
|
113
|
+
// One block per copy that launched. The spawn-rate counter also counts the attempt that reached the ceiling and was refused,
|
|
114
|
+
// so once a STOP is shown the copies that ran are one fewer than the counter. The grid only exists when the ceiling was recorded.
|
|
114
115
|
if (snapshot.spawnCeiling !== null && snapshot.spawnCeiling > 0) {
|
|
115
|
-
const ceiling = snapshot.spawnCeiling,
|
|
116
|
+
const ceiling = snapshot.spawnCeiling, attempts = Math.min(ceiling, Math.max(0, snapshot.spawns ?? 0));
|
|
117
|
+
const filled = snapshot.stop && attempts >= ceiling ? attempts - 1 : attempts;
|
|
116
118
|
const perRow = Math.ceil(ceiling / 2), blockWidth = Math.max(1, Math.floor((w + 1) / perRow) - 1);
|
|
117
119
|
const refused = snapshot.stop !== undefined;
|
|
118
120
|
c.put(16, 0, 'AGENT COPIES', 'slate');
|
|
@@ -143,6 +143,7 @@
|
|
|
143
143
|
"child": "agent-a06a56e09ed61463a",
|
|
144
144
|
"kind": "fresh",
|
|
145
145
|
"forkContextRef": false,
|
|
146
|
+
"startedAt": 1789935679527,
|
|
146
147
|
"tokens": 176765,
|
|
147
148
|
"usd": {
|
|
148
149
|
"min": 0.074071,
|
|
@@ -154,6 +155,7 @@
|
|
|
154
155
|
"child": "agent-a0dc643d58a882fa1",
|
|
155
156
|
"kind": "fresh",
|
|
156
157
|
"forkContextRef": false,
|
|
158
|
+
"startedAt": 1790129337848,
|
|
157
159
|
"tokens": 9849353,
|
|
158
160
|
"usd": {
|
|
159
161
|
"min": 3.3955916,
|
|
@@ -165,6 +167,7 @@
|
|
|
165
167
|
"child": "agent-a16fb6132cdb0f967",
|
|
166
168
|
"kind": "fresh",
|
|
167
169
|
"forkContextRef": false,
|
|
170
|
+
"startedAt": 1789935679631,
|
|
168
171
|
"tokens": 176770,
|
|
169
172
|
"usd": {
|
|
170
173
|
"min": 0.07384284999999999,
|
|
@@ -176,6 +179,7 @@
|
|
|
176
179
|
"child": "agent-a17094fd82226f147",
|
|
177
180
|
"kind": "fresh",
|
|
178
181
|
"forkContextRef": false,
|
|
182
|
+
"startedAt": 1789935679660,
|
|
179
183
|
"tokens": 176908,
|
|
180
184
|
"usd": {
|
|
181
185
|
"min": 0.0739548,
|
|
@@ -187,6 +191,7 @@
|
|
|
187
191
|
"child": "agent-a2121a2540058aa0d",
|
|
188
192
|
"kind": "fresh",
|
|
189
193
|
"forkContextRef": false,
|
|
194
|
+
"startedAt": 1789935679510,
|
|
190
195
|
"tokens": 177009,
|
|
191
196
|
"usd": {
|
|
192
197
|
"min": 0.07452144999999999,
|
|
@@ -198,6 +203,7 @@
|
|
|
198
203
|
"child": "agent-a3f64c75d51f26a8c",
|
|
199
204
|
"kind": "fresh",
|
|
200
205
|
"forkContextRef": false,
|
|
206
|
+
"startedAt": 1789935679669,
|
|
201
207
|
"tokens": 177213,
|
|
202
208
|
"usd": {
|
|
203
209
|
"min": 0.0752782,
|
|
@@ -209,6 +215,7 @@
|
|
|
209
215
|
"child": "agent-a3fbb3e8e2652554f",
|
|
210
216
|
"kind": "fresh",
|
|
211
217
|
"forkContextRef": false,
|
|
218
|
+
"startedAt": 1789935679621,
|
|
212
219
|
"tokens": 176808,
|
|
213
220
|
"usd": {
|
|
214
221
|
"min": 0.0739135,
|
|
@@ -220,6 +227,7 @@
|
|
|
220
227
|
"child": "agent-a453ae1ee034514f5",
|
|
221
228
|
"kind": "fresh",
|
|
222
229
|
"forkContextRef": false,
|
|
230
|
+
"startedAt": 1789935679946,
|
|
223
231
|
"tokens": 176868,
|
|
224
232
|
"usd": {
|
|
225
233
|
"min": 0.07442170000000001,
|
|
@@ -231,6 +239,7 @@
|
|
|
231
239
|
"child": "agent-a67fd6744054cbcfb",
|
|
232
240
|
"kind": "fresh",
|
|
233
241
|
"forkContextRef": false,
|
|
242
|
+
"startedAt": 1789935679499,
|
|
234
243
|
"tokens": 176783,
|
|
235
244
|
"usd": {
|
|
236
245
|
"min": 0.07375100000000001,
|
|
@@ -242,6 +251,7 @@
|
|
|
242
251
|
"child": "agent-a6fc6a81b7cc1fb77",
|
|
243
252
|
"kind": "fresh",
|
|
244
253
|
"forkContextRef": false,
|
|
254
|
+
"startedAt": 1789935680792,
|
|
245
255
|
"tokens": 177329,
|
|
246
256
|
"usd": {
|
|
247
257
|
"min": 0.07525835,
|
|
@@ -253,6 +263,7 @@
|
|
|
253
263
|
"child": "agent-a8a896a8c52bc7509",
|
|
254
264
|
"kind": "fresh",
|
|
255
265
|
"forkContextRef": false,
|
|
266
|
+
"startedAt": 1789935679378,
|
|
256
267
|
"tokens": 177025,
|
|
257
268
|
"usd": {
|
|
258
269
|
"min": 0.07456165,
|
|
@@ -264,6 +275,7 @@
|
|
|
264
275
|
"child": "agent-ac3dfb54b036f4002",
|
|
265
276
|
"kind": "fresh",
|
|
266
277
|
"forkContextRef": false,
|
|
278
|
+
"startedAt": 1789935679467,
|
|
267
279
|
"tokens": 176847,
|
|
268
280
|
"usd": {
|
|
269
281
|
"min": 0.07439969999999999,
|
|
@@ -275,6 +287,7 @@
|
|
|
275
287
|
"child": "agent-ac658891544a74c52",
|
|
276
288
|
"kind": "fresh",
|
|
277
289
|
"forkContextRef": false,
|
|
290
|
+
"startedAt": 1789935679617,
|
|
278
291
|
"tokens": 176689,
|
|
279
292
|
"usd": {
|
|
280
293
|
"min": 0.0735927,
|
|
@@ -286,6 +299,7 @@
|
|
|
286
299
|
"child": "agent-ae1791bbb5ac64267",
|
|
287
300
|
"kind": "fresh",
|
|
288
301
|
"forkContextRef": false,
|
|
302
|
+
"startedAt": 1789935679713,
|
|
289
303
|
"tokens": 129435,
|
|
290
304
|
"usd": {
|
|
291
305
|
"min": 0.0684502,
|
|
@@ -297,6 +311,7 @@
|
|
|
297
311
|
"child": "agent-ae3f1bfbc22e5a169",
|
|
298
312
|
"kind": "fresh",
|
|
299
313
|
"forkContextRef": false,
|
|
314
|
+
"startedAt": 1789935679712,
|
|
300
315
|
"tokens": 176730,
|
|
301
316
|
"usd": {
|
|
302
317
|
"min": 0.0734944,
|
|
@@ -308,6 +323,7 @@
|
|
|
308
323
|
"child": "agent-af2a48f4fad800227",
|
|
309
324
|
"kind": "fresh",
|
|
310
325
|
"forkContextRef": false,
|
|
326
|
+
"startedAt": 1789935680088,
|
|
311
327
|
"tokens": 176803,
|
|
312
328
|
"usd": {
|
|
313
329
|
"min": 0.07378154999999999,
|
|
@@ -319,6 +335,7 @@
|
|
|
319
335
|
"child": "agent-afffbfa53dcc4d022",
|
|
320
336
|
"kind": "fresh",
|
|
321
337
|
"forkContextRef": false,
|
|
338
|
+
"startedAt": 1790133308566,
|
|
322
339
|
"tokens": 442258,
|
|
323
340
|
"usd": {
|
|
324
341
|
"min": 0.14556865,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentguard-run/burn",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.10",
|
|
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",
|