@agentguard-run/burn 0.3.23 → 0.3.25

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,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.25 (2026-10-01)
4
+
5
+ - `card` draws the calendar's totals as one 1200 by 675 PNG to post: tokens with the Claude Code and Codex split, dollars at API list price (not a bill), the sub-agent share, the busiest day, the launches AgentGuard held, and one bar per day in whole weeks. `--weeks N` (1 to 53, default 4) and `--out file.png` (default `agentguard-burn-card.png`). It is drawn locally from the figures `calendar` prints; no project, prompt or file name appears on it, and nothing is uploaded.
6
+
7
+ ## 0.3.24 (2026-09-29)
8
+
9
+ - `calendar` ends with one next step, so it never stops at a number with nothing to do about it. The rule is the one `why` uses for its tip: sub-agents at a fifth or more of the tokens point at the free plugin, or at giving related work to one sub-agent once AgentGuard has held launches on this machine; anything else points at `why`, which names the change for one session. In English, Spanish and Portuguese, and short enough that the command never wraps at 80 columns.
10
+
3
11
  ## 0.3.23 (2026-09-29)
4
12
 
5
13
  - Prices GPT-6.1 Sol (`gpt-6.1-sol`), released on September 29, 2026, at the rates on OpenAI's price list, checked the same day: 2, 0.1, 2.5 and 10 USD per million tokens for fresh input, cached input, cache write and output, with the same 272K long-context tier as GPT-6 Sol. Before this row its turns were unpriced in Codex sessions, so a session that used it showed no dollar total.
package/README.md CHANGED
@@ -314,12 +314,25 @@ Days marked H: AgentGuard held a launch that day.
314
314
  From Claude Code and Codex sessions on this machine, sub-agents included.
315
315
  Claude Code deletes sessions older than 30 days by default.
316
316
  Burn keeps each day's count whenever you run this, so the calendar grows.
317
+
318
+ Next: see where one session's tokens went: npx agentguard-burn why
317
319
  ```
318
320
 
321
+ The last line is the one next step, chosen the way `why` chooses its tip: when sub-agents took a fifth or more of the tokens it points at the free plugin (or, once AgentGuard has held launches on this machine, at giving related work to one sub-agent); otherwise it points at `why`, which names the change for one session.
322
+
319
323
  Claude Code deletes transcripts after 30 days by default (`cleanupPeriodDays`), so each run keeps a daily count per transcript file in `calendar/daily.json` under the Burn home (`AGENTGUARD_HOME`, default `~/.agentguard`): tokens, sub-agent tokens and dollars per day, with no paths and no content, owner-only and written atomically. A transcript still on disk is always counted from the transcript; a deleted transcript's days come from the daily count; no file-day is counted from both. Run `calendar` at least once within Claude Code's retention period to keep every day. `calendar/cache.json` keeps each response's counts, keyed by the transcript's path digest, size and modification time, so a later run re-reads only the transcripts that changed; a new Burn version or a pricing override recounts everything once.
320
324
 
321
325
  `calendar json` is never translated: every day of the span with its figures and level, the totals, the busiest day and where the figures came from. `--lang es|pt` and your locale choose the language exactly as for `why`. Nothing in the calendar compares you with anyone else.
322
326
 
327
+ ## Share card
328
+
329
+ ```sh
330
+ agentguard-burn card
331
+ agentguard-burn card --weeks 1 --out this-week.png
332
+ ```
333
+
334
+ One 1200 by 675 PNG with the calendar's totals, made to post: the token total with the Claude Code and Codex split, the dollars at API prices (not a bill), the share sub-agents used, the busiest day, the sub-agent launches AgentGuard held (or the transcripts read, when it held none) and one bar per day in whole weeks. `--weeks N` takes 1 to 53 and defaults to 4. The image is saved as `agentguard-burn-card.png` in the current folder unless `--out` names another file. It is drawn on your machine from the same figures `calendar` prints; no project, prompt or file name appears on it, and nothing is uploaded. A span with no recorded usage is refused.
335
+
323
336
  ## Two safety planes
324
337
 
325
338
  Structural limits use active time rather than the age of the session. The
package/dist/src/cli.js CHANGED
@@ -311,6 +311,38 @@ async function main(argv) {
311
311
  show({ kind: 'calendar', report, lang: language, columns }, json ? JSON.stringify(report, null, 2) + '\n' : renderCalendar(report, language, columns) + '\n', json);
312
312
  return 0;
313
313
  }
314
+ case 'card': {
315
+ // `--weeks N` (1 to 53, default 4, also --weeks=N) and `--out file.png` (default agentguard-burn-card.png here).
316
+ let weeksText, out = 'agentguard-burn-card.png', bad = false;
317
+ for (let i = 0; i < rest.length; i++) {
318
+ if (rest[i] === '--weeks')
319
+ weeksText = rest[++i];
320
+ else if (rest[i].startsWith('--weeks='))
321
+ weeksText = rest[i].slice('--weeks='.length);
322
+ else if (rest[i] === '--out')
323
+ out = rest[++i] ?? '';
324
+ else if (rest[i].startsWith('--out='))
325
+ out = rest[i].slice('--out='.length);
326
+ else
327
+ bad = true;
328
+ }
329
+ const weeks = weeksText === undefined ? 4 : /^\d{1,2}$/.test(weeksText) ? Number(weeksText) : 0;
330
+ if (bad || !(weeks >= 1 && weeks <= 53) || !out.trim()) {
331
+ process.stderr.write('Usage: agentguard-burn card [--weeks N] [--out file.png]\n');
332
+ return 64;
333
+ }
334
+ const { calendarReport, collectCalendar } = await Promise.resolve().then(() => __importStar(require('./insights/calendar')));
335
+ const { cardModel, renderCard } = await Promise.resolve().then(() => __importStar(require('./insights/card')));
336
+ const data = collectCalendar({ home: HOME, rates: (0, live_1.readPricing)(HOME, (0, pre_tool_use_1.loadPolicy)(HOME)) });
337
+ const report = calendarReport(data, { now: Date.now(), weeks });
338
+ if (!(report.totals.tokens > 0)) {
339
+ process.stderr.write('No Claude Code or Codex usage is recorded on this machine for that span, so there is nothing to put on a card.\n');
340
+ return 1;
341
+ }
342
+ (0, node_fs_1.writeFileSync)(out, await renderCard(cardModel(report)));
343
+ process.stdout.write(`Card saved: ${out} (1200x675). Dollars on it are API list prices, not a bill; nothing was uploaded.\n`);
344
+ return 0;
345
+ }
314
346
  case 'quiet': {
315
347
  const [state, ...extra] = rest;
316
348
  if (extra.length || (state !== undefined && state !== 'on' && state !== 'off')) {
@@ -592,6 +624,7 @@ async function main(argv) {
592
624
  ' --lang es|pt the why report in Latin American Spanish or Brazilian Portuguese; your locale picks it by default\n' +
593
625
  ' compare [sessionA] [sessionB] two sessions side by side: tokens, cache, sub-agents, rewrites, list USD; json and --lang as for why\n' +
594
626
  ' calendar [--weeks N] tokens per day, Claude Code and Codex together: sub-agent days, launches AgentGuard held, dollars at API prices; json and --lang as for why\n' +
627
+ ' card [--weeks N] [--out file.png] the calendar\'s totals as one 1200x675 image to share (default 4 weeks); written locally, nothing uploaded\n' +
595
628
  ' rewrites [session|all] every full-prefix cache write with its cause, idle gap and list price\n' +
596
629
  ' ttl [session|all] one-hour cache lifetime counterfactual from your own idle gaps\n' +
597
630
  ' pace [session] ten-minute pace and next-hour projection\n' +
@@ -18,7 +18,7 @@
18
18
  */
19
19
  import { Canvas, type CanvasColor } from '../canvas';
20
20
  import { type CalendarReport } from './calendar';
21
- import { type WhyLang } from './i18n';
21
+ import { type CalendarText, type WhyLang } from './i18n';
22
22
  import type { DollarRange } from './pricing';
23
23
  export type CalendarSkin = 'plain' | 'colour';
24
24
  /** `big`: two characters a day; `compact`: one. Both put one space between weeks. */
@@ -65,6 +65,14 @@ export declare function wrap(text: string, width: number, indent?: string): stri
65
65
  * size (calendarCells); the span was already chosen to fit it.
66
66
  */
67
67
  export declare function calendarLines(report: CalendarReport, lang: WhyLang, columns: number, skin: CalendarSkin): CalendarLine[];
68
+ /** The calendar's closing line, by the rule `why` uses for its own tip: sub-agents at a fifth or more of the
69
+ * tokens point at the free plugin, or at one sub-agent for related work when AgentGuard already held launches
70
+ * here (the plugin is installed); anything else points at `why`, which names the change for one session. */
71
+ export declare function calendarNext(totals: {
72
+ tokens: number;
73
+ subagentTokens: number;
74
+ heldLaunches: number;
75
+ }, text: CalendarText): string;
68
76
  /** Plain text: shade characters and day letters, no control sequences, trailing spaces trimmed. */
69
77
  export declare function renderCalendar(report: CalendarReport, lang?: WhyLang, columns?: number): string;
70
78
  /** The colour face on a canvas sized to the report, never paged: a calendar is one block. */
@@ -4,6 +4,7 @@ exports.calendarCells = exports.calendarGridWidth = exports.CALENDAR_MARKERS = e
4
4
  exports.calendarDollars = calendarDollars;
5
5
  exports.wrap = wrap;
6
6
  exports.calendarLines = calendarLines;
7
+ exports.calendarNext = calendarNext;
7
8
  exports.renderCalendar = renderCalendar;
8
9
  exports.drawCalendar = drawCalendar;
9
10
  /**
@@ -229,8 +230,19 @@ function calendarLines(report, lang, columns, skin) {
229
230
  if (report.historyShort)
230
231
  for (const sentence of text.shortHistory)
231
232
  paragraph(sentence, 'slate');
233
+ // The one next step, last, so the calendar never ends on a number with nothing to do about it.
234
+ lines.push([]);
235
+ paragraph(calendarNext(totals, text), 'white');
232
236
  return lines;
233
237
  }
238
+ /** The calendar's closing line, by the rule `why` uses for its own tip: sub-agents at a fifth or more of the
239
+ * tokens point at the free plugin, or at one sub-agent for related work when AgentGuard already held launches
240
+ * here (the plugin is installed); anything else points at `why`, which names the change for one session. */
241
+ function calendarNext(totals, text) {
242
+ if (totals.tokens <= 0 || totals.subagentTokens / totals.tokens < 0.2)
243
+ return text.next.why;
244
+ return (totals.heldLaunches > 0 ? text.next.fanoutPlugin : text.next.fanout)((0, render_1.share)(totals.subagentTokens, totals.tokens));
245
+ }
234
246
  /** Plain text: shade characters and day letters, no control sequences, trailing spaces trimmed. */
235
247
  function renderCalendar(report, lang = 'en', columns = 80) {
236
248
  return calendarLines(report, lang, columns, 'plain').map(line => line.map(part => part.text).join('').trimEnd()).join('\n');
@@ -0,0 +1,34 @@
1
+ import type { CalendarReport } from './calendar';
2
+ import type { DollarRange } from './pricing';
3
+ export declare const CARD_WIDTH = 1200;
4
+ export declare const CARD_HEIGHT = 675;
5
+ export declare const CARD_SITE = "agentguard.run/burn";
6
+ export interface CardTile {
7
+ value: string;
8
+ label: string;
9
+ tone: 'teal' | 'ink' | 'amber';
10
+ }
11
+ export interface CardBar {
12
+ date: string;
13
+ tokens: number;
14
+ held: boolean;
15
+ busiest: boolean;
16
+ }
17
+ export interface CardModel {
18
+ heading: string;
19
+ range: string;
20
+ hero: string;
21
+ heroLabel: string;
22
+ /** Claude and Codex tokens side by side; null when one host carries every token. */
23
+ split: string | null;
24
+ tiles: CardTile[];
25
+ bars: CardBar[];
26
+ footnote: string;
27
+ site: string;
28
+ }
29
+ /** Three significant digits and a unit: 28.8B, 4.39B, 738M, 12.3K, 999. */
30
+ export declare function compact(value: number): string;
31
+ /** A dollar range for the card: one figure when both ends round alike, null when nothing is priced. */
32
+ export declare function compactDollars(range: DollarRange | null): string | null;
33
+ export declare function cardModel(report: CalendarReport): CardModel;
34
+ export declare function renderCard(model: CardModel): Promise<Buffer>;
@@ -0,0 +1,225 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CARD_SITE = exports.CARD_HEIGHT = exports.CARD_WIDTH = void 0;
4
+ exports.compact = compact;
5
+ exports.compactDollars = compactDollars;
6
+ exports.cardModel = cardModel;
7
+ exports.renderCard = renderCard;
8
+ /**
9
+ * `agentguard-burn card`: the calendar's totals as one image made to be shared, 1200x675 (the
10
+ * X/Twitter large-card ratio). Everything on it comes from `calendarReport`, the same figures the
11
+ * calendar prints; dollars carry the calendar's basis (API list price, not a bill); nothing
12
+ * about a project, prompt or file is drawn, and the image is written locally, never uploaded.
13
+ */
14
+ const promises_1 = require("node:fs/promises");
15
+ const node_path_1 = require("node:path");
16
+ const canvas_1 = require("@napi-rs/canvas");
17
+ exports.CARD_WIDTH = 1200;
18
+ exports.CARD_HEIGHT = 675;
19
+ exports.CARD_SITE = 'agentguard.run/burn';
20
+ const UNITS = [[1e12, 'T'], [1e9, 'B'], [1e6, 'M'], [1e3, 'K']];
21
+ /** Three significant digits and a unit: 28.8B, 4.39B, 738M, 12.3K, 999. */
22
+ function compact(value) {
23
+ for (const [size, unit] of UNITS) {
24
+ if (Math.abs(value) >= size)
25
+ return `${Number((value / size).toPrecision(3))}${unit}`;
26
+ }
27
+ return String(Math.round(value));
28
+ }
29
+ /** A dollar range for the card: one figure when both ends round alike, null when nothing is priced. */
30
+ function compactDollars(range) {
31
+ if (!range || !(Math.max(range.min, range.max) > 0))
32
+ return null;
33
+ const low = dollarFigure(range.min), high = dollarFigure(range.max);
34
+ return low === high ? low : `${low} to ${high}`;
35
+ }
36
+ function dollarFigure(value) {
37
+ return value >= 1000 ? `$${compact(value)}` : `$${Math.round(value)}`;
38
+ }
39
+ const MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
40
+ const monthDay = (day) => `${MONTHS[Number(day.slice(5, 7)) - 1]} ${Number(day.slice(8, 10))}`;
41
+ function spanText(from, to) {
42
+ const fromYear = from.slice(0, 4), toYear = to.slice(0, 4);
43
+ return fromYear === toYear
44
+ ? `${monthDay(from)} to ${monthDay(to)}, ${toYear}`
45
+ : `${monthDay(from)}, ${fromYear} to ${monthDay(to)}, ${toYear}`;
46
+ }
47
+ /** The span starts on a Sunday; the days after today stay as empty slots so the week reads as a week. */
48
+ function wholeWeeks(bars) {
49
+ const padded = [...bars];
50
+ while (padded.length % 7 !== 0)
51
+ padded.push({ date: '', tokens: 0, held: false, busiest: false });
52
+ return padded;
53
+ }
54
+ function cardModel(report) {
55
+ const { totals } = report;
56
+ const both = totals.claudeTokens > 0 && totals.codexTokens > 0;
57
+ const host = both ? 'Claude Code and Codex' : totals.codexTokens > 0 ? 'Codex' : 'Claude Code';
58
+ const tiles = [];
59
+ const dollars = compactDollars(totals.usd);
60
+ if (dollars)
61
+ tiles.push({ value: dollars, label: 'at API prices, not a bill', tone: 'teal' });
62
+ if (totals.subagentShare !== null) {
63
+ tiles.push({ value: `${Math.round(totals.subagentShare * 100)}%`, label: 'by sub-agents', tone: 'ink' });
64
+ }
65
+ if (report.busiest) {
66
+ tiles.push({ value: compact(report.busiest.tokens), label: `busiest day, ${monthDay(report.busiest.date)}`, tone: 'ink' });
67
+ }
68
+ tiles.push(totals.heldLaunches > 0
69
+ ? { value: totals.heldLaunches.toLocaleString('en-US'), label: 'sub-agent launches AgentGuard held', tone: 'amber' }
70
+ : { value: report.sources.transcripts.toLocaleString('en-US'), label: 'transcripts read on this machine', tone: 'ink' });
71
+ return {
72
+ heading: report.weeks === 1 ? 'My week of AI coding' : `My last ${report.weeks} weeks of AI coding`,
73
+ range: spanText(report.from, report.to),
74
+ hero: compact(totals.tokens),
75
+ heroLabel: `tokens through ${host}`,
76
+ split: both ? `Claude ${compact(totals.claudeTokens)} · Codex ${compact(totals.codexTokens)}` : null,
77
+ tiles,
78
+ bars: wholeWeeks(report.days.map(day => ({
79
+ date: day.date, tokens: day.tokens, held: day.heldLaunches > 0,
80
+ busiest: report.busiest?.date === day.date,
81
+ }))),
82
+ footnote: 'Counted from this machine’s transcripts. Dollars are API list prices, not a bill. Nothing was uploaded.',
83
+ site: exports.CARD_SITE,
84
+ };
85
+ }
86
+ /* ---------------------------------------------------------------- drawing */
87
+ const FONT_DIR = (0, node_path_1.join)(__dirname, '../../../fonts');
88
+ const TEXT = 'AgentGuardCardText', MONO = 'AgentGuardCardMono';
89
+ const FONT_FILES = [
90
+ ['Inter-Regular.ttf', TEXT], ['Inter-SemiBold.ttf', TEXT],
91
+ ['JetBrainsMono-Regular.ttf', MONO], ['JetBrainsMono-Bold.ttf', MONO],
92
+ ];
93
+ const INK = {
94
+ paper: '#0B1117', ink: '#FFFFFF', secondary: '#B4BECF', faint: '#6B7686', teal: '#2ABCB4',
95
+ tealSoft: 'rgba(42,188,180,0.38)', amber: '#F59E0B', panel: 'rgba(255,255,255,0.04)', line: 'rgba(255,255,255,0.10)',
96
+ };
97
+ const TONE = { teal: INK.teal, ink: INK.ink, amber: INK.amber };
98
+ let fontsReady = false;
99
+ async function registerFonts() {
100
+ if (fontsReady)
101
+ return;
102
+ for (const [file, alias] of FONT_FILES) {
103
+ const path = (0, node_path_1.join)(FONT_DIR, file);
104
+ await (0, promises_1.access)(path, promises_1.constants.R_OK);
105
+ canvas_1.GlobalFonts.registerFromPath(path, alias);
106
+ }
107
+ if (!canvas_1.GlobalFonts.has(TEXT) || !canvas_1.GlobalFonts.has(MONO))
108
+ throw new Error('Card fonts did not register from the package fonts directory.');
109
+ fontsReady = true;
110
+ }
111
+ function wrapLines(ctx, text, width) {
112
+ const lines = [];
113
+ let line = '';
114
+ for (const word of text.split(' ')) {
115
+ const next = line ? `${line} ${word}` : word;
116
+ if (line && ctx.measureText(next).width > width) {
117
+ lines.push(line);
118
+ line = word;
119
+ }
120
+ else
121
+ line = next;
122
+ }
123
+ if (line)
124
+ lines.push(line);
125
+ return lines;
126
+ }
127
+ function roundedRect(ctx, x, y, w, h, r) {
128
+ ctx.beginPath();
129
+ ctx.moveTo(x + r, y);
130
+ ctx.arcTo(x + w, y, x + w, y + h, r);
131
+ ctx.arcTo(x + w, y + h, x, y + h, r);
132
+ ctx.arcTo(x, y + h, x, y, r);
133
+ ctx.arcTo(x, y, x + w, y, r);
134
+ ctx.closePath();
135
+ }
136
+ async function renderCard(model) {
137
+ await registerFonts();
138
+ const canvas = (0, canvas_1.createCanvas)(exports.CARD_WIDTH, exports.CARD_HEIGHT);
139
+ const ctx = canvas.getContext('2d');
140
+ const pad = 64;
141
+ ctx.fillStyle = INK.paper;
142
+ ctx.fillRect(0, 0, exports.CARD_WIDTH, exports.CARD_HEIGHT);
143
+ ctx.textBaseline = 'alphabetic';
144
+ // Header: wordmark left, date span right.
145
+ ctx.font = `600 26px ${TEXT}`;
146
+ ctx.fillStyle = INK.ink;
147
+ // No registration symbol: the card is a social image, and the registration's services do not list Burn.
148
+ ctx.fillText('AgentGuard', pad, 88);
149
+ const markWidth = ctx.measureText('AgentGuard ').width;
150
+ ctx.fillStyle = INK.teal;
151
+ ctx.fillText('Burn', pad + markWidth, 88);
152
+ ctx.font = `22px ${TEXT}`;
153
+ ctx.fillStyle = INK.secondary;
154
+ ctx.textAlign = 'right';
155
+ ctx.fillText(model.range, exports.CARD_WIDTH - pad, 88);
156
+ ctx.textAlign = 'left';
157
+ // Hero: the token total.
158
+ ctx.font = `30px ${TEXT}`;
159
+ ctx.fillStyle = INK.secondary;
160
+ ctx.fillText(model.heading, pad, 158);
161
+ ctx.font = `600 150px ${TEXT}`;
162
+ ctx.fillStyle = INK.ink;
163
+ ctx.fillText(model.hero, pad - 6, 292);
164
+ ctx.font = `26px ${TEXT}`;
165
+ ctx.fillStyle = INK.secondary;
166
+ ctx.fillText(model.heroLabel, pad, 336);
167
+ if (model.split) {
168
+ ctx.font = `22px ${TEXT}`;
169
+ ctx.fillStyle = INK.faint;
170
+ ctx.fillText(model.split, pad, 372);
171
+ }
172
+ // Tiles: a 2x2 grid on the right.
173
+ const gridX = 668, gridY = 126, tileW = 226, tileH = 118, gap = 16;
174
+ model.tiles.slice(0, 4).forEach((tile, index) => {
175
+ const x = gridX + (index % 2) * (tileW + gap), y = gridY + Math.floor(index / 2) * (tileH + gap);
176
+ roundedRect(ctx, x, y, tileW, tileH, 14);
177
+ ctx.fillStyle = INK.panel;
178
+ ctx.fill();
179
+ ctx.strokeStyle = INK.line;
180
+ ctx.lineWidth = 1;
181
+ ctx.stroke();
182
+ ctx.font = `600 40px ${TEXT}`;
183
+ ctx.fillStyle = TONE[tile.tone];
184
+ ctx.fillText(tile.value, x + 20, y + 56);
185
+ ctx.font = `17px ${TEXT}`;
186
+ ctx.fillStyle = INK.secondary;
187
+ wrapLines(ctx, tile.label, tileW - 40).slice(0, 2).forEach((line, row) => ctx.fillText(line, x + 20, y + 84 + row * 21));
188
+ });
189
+ // Daily bars: one per day of the span, the busiest in full teal, a dot where AgentGuard held a launch.
190
+ const barsTop = 420, barsBottom = 566, barsLeft = pad, barsRight = exports.CARD_WIDTH - pad;
191
+ const count = Math.max(model.bars.length, 1);
192
+ const slot = (barsRight - barsLeft) / count;
193
+ const barWidth = Math.max(2, Math.min(28, slot * 0.72));
194
+ const peak = Math.max(...model.bars.map(bar => bar.tokens), 1);
195
+ ctx.strokeStyle = INK.line;
196
+ ctx.beginPath();
197
+ ctx.moveTo(barsLeft, barsBottom + 0.5);
198
+ ctx.lineTo(barsRight, barsBottom + 0.5);
199
+ ctx.stroke();
200
+ model.bars.forEach((bar, index) => {
201
+ const x = barsLeft + index * slot + (slot - barWidth) / 2;
202
+ const height = bar.tokens > 0 ? Math.max(3, (bar.tokens / peak) * (barsBottom - barsTop - 18)) : 0;
203
+ if (height > 0) {
204
+ roundedRect(ctx, x, barsBottom - height, barWidth, height, Math.min(4, barWidth / 2));
205
+ ctx.fillStyle = bar.busiest ? INK.teal : INK.tealSoft;
206
+ ctx.fill();
207
+ }
208
+ if (bar.held) {
209
+ ctx.beginPath();
210
+ ctx.arc(x + barWidth / 2, barsBottom - height - 9, 3.5, 0, Math.PI * 2);
211
+ ctx.fillStyle = INK.amber;
212
+ ctx.fill();
213
+ }
214
+ });
215
+ // Footer: the basis, then the site.
216
+ ctx.font = `16px ${TEXT}`;
217
+ ctx.fillStyle = INK.faint;
218
+ ctx.fillText(model.footnote, pad, 616);
219
+ ctx.font = `600 20px ${TEXT}`;
220
+ ctx.fillStyle = INK.teal;
221
+ ctx.textAlign = 'right';
222
+ ctx.fillText(model.site, exports.CARD_WIDTH - pad, 616);
223
+ ctx.textAlign = 'left';
224
+ return canvas.encode('png');
225
+ }
@@ -189,5 +189,12 @@ export interface CalendarText {
189
189
  shortHistory: readonly [string, string];
190
190
  /** Stderr when the daily counts cannot be written. */
191
191
  saveFailed: string;
192
+ /** The one next step, printed last, by the rule `why` uses: sub-agents at a fifth or more of the tokens get the
193
+ * plugin (or, when AgentGuard already held launches here, one sub-agent for related work); otherwise `why`. */
194
+ next: {
195
+ fanout: (share: string) => string;
196
+ fanoutPlugin: (share: string) => string;
197
+ why: string;
198
+ };
192
199
  }
193
200
  export declare const CALENDAR_TEXT: Readonly<Record<WhyLang, CalendarText>>;
@@ -288,6 +288,11 @@ const calendarEn = {
288
288
  noData: 'No Claude Code or Codex sessions found on this machine yet.',
289
289
  shortHistory: ['Claude Code deletes sessions older than 30 days by default.', 'Burn keeps each day\'s count whenever you run this, so the calendar grows.'],
290
290
  saveFailed: 'Burn could not store the counts from this run.',
291
+ next: {
292
+ fanout: share => `Next: sub-agents used ${share} of these tokens. AgentGuard's free plugin asks you before the next sub-agent past your limit starts: agentguard.run/try`,
293
+ fanoutPlugin: share => `Next: sub-agents used ${share} of these tokens. Give related work to one sub-agent instead of several.`,
294
+ why: 'Next: see where one session\'s tokens went: npx agentguard-burn why',
295
+ },
291
296
  };
292
297
  const calendarEs = {
293
298
  weekdays: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sá'],
@@ -313,6 +318,11 @@ const calendarEs = {
313
318
  noData: 'Todavía no hay sesiones de Claude Code ni de Codex en esta máquina.',
314
319
  shortHistory: ['Claude Code borra las sesiones de más de 30 días de forma predeterminada.', 'Burn guarda el conteo diario cada vez que lo ejecutas, y el calendario crece.'],
315
320
  saveFailed: 'Burn no pudo guardar los conteos de esta ejecución.',
321
+ next: {
322
+ fanout: share => `Próximo paso: los subagentes usaron el ${share} de estos tokens. El plugin gratuito de AgentGuard te pregunta antes de que empiece el siguiente subagente por encima de tu límite: agentguard.run/try`,
323
+ fanoutPlugin: share => `Próximo paso: los subagentes usaron el ${share} de estos tokens. Dale el trabajo relacionado a un solo subagente en vez de varios.`,
324
+ why: 'Próximo paso: a dónde fue cada token de una sesión: npx agentguard-burn why',
325
+ },
316
326
  };
317
327
  const calendarPt = {
318
328
  weekdays: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'],
@@ -338,5 +348,10 @@ const calendarPt = {
338
348
  noData: 'Ainda não há sessões do Claude Code nem do Codex nesta máquina.',
339
349
  shortHistory: ['O Claude Code apaga as sessões com mais de 30 dias por padrão.', 'O Burn salva a contagem diária a cada execução, então o calendário cresce.'],
340
350
  saveFailed: 'O Burn não conseguiu salvar as contagens desta execução.',
351
+ next: {
352
+ fanout: share => `Próximo passo: os subagentes usaram ${share} destes tokens. O plugin gratuito do AgentGuard pergunta a você antes que o próximo subagente acima do seu limite comece: agentguard.run/try`,
353
+ fanoutPlugin: share => `Próximo passo: os subagentes usaram ${share} destes tokens. Dê o trabalho relacionado a um só subagente em vez de vários.`,
354
+ why: 'Próximo passo: para onde foi cada token de uma sessão: npx agentguard-burn why',
355
+ },
341
356
  };
342
357
  exports.CALENDAR_TEXT = { en: calendarEn, es: calendarEs, pt: calendarPt };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentguard-run/burn",
3
- "version": "0.3.23",
3
+ "version": "0.3.25",
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
  "homepage": "https://agentguard.run/burn",