@agentguard-run/burn 0.3.14 → 0.3.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/README.md +3 -1
- package/dist/src/cli.js +19 -2
- package/dist/src/insights/render.d.ts +17 -1
- package/dist/src/insights/render.js +32 -8
- package/dist/src/presentation.js +10 -3
- package/dist/src/upgrade-moments.d.ts +8 -0
- package/dist/src/upgrade-moments.js +31 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.16 (2026-09-27)
|
|
4
|
+
|
|
5
|
+
- `why` ends with at most one tip built from the session's own numbers, first match wins: sub-agent fan-out at 20% or more of session tokens names that share and points at spawn limits (free on one machine, agentguard.run/try); full-prefix rewrites at 15% or more of the session's API list equivalent name both dollar figures and point at `rewrites`, which gives the cause of each one (skipped when either figure is unpriced; a dollar range compares midpoints, as the `rewrites` share does); history re-sent at 30% or more of session tokens names that share and says a fresh session, or `/compact`, starts that history over. The share and dollars are the ones the table prints. When nothing reaches its threshold there is no line, and a Codex session whose inherited history has no verifiable boundary prints none.
|
|
6
|
+
- New `quiet on`, `quiet off` and `quiet`. `quiet on` creates `upgrade-moments/quiet` under `AGENTGUARD_HOME` (default `~/.agentguard`), the same file the AgentGuard plugin's `policy-cli.cjs quiet on` writes, so one switch hides the `why` tip, the monthly summary in `status` and the plugin's upgrade, version and Score lines. `quiet off` removes that one file and nothing else. `quiet` alone prints whether tips are on or off.
|
|
7
|
+
- What changes in output: only the plain `why` report, the same text on a terminal and through a pipe, and only while a tip applies and quiet is off. After the `Usage records de-duplicated` line it gains a blank line, the tip line (starting `Next:`) and `Hide tips like this: npx @agentguard-run/burn quiet on`. Every earlier line is unchanged from 0.3.15. `why json` and the frame `--record` writes for `why` are unchanged and never contain the tip; every other existing command prints what it did in 0.3.15, and the help lists `quiet`.
|
|
8
|
+
|
|
9
|
+
## 0.3.15 (2026-09-26)
|
|
10
|
+
|
|
11
|
+
- `why`, `rewrites`, `ttl`, `pricing` and every other command whose values do not fit one screen now print their plain text on a colour terminal. 0.3.14 paged `why` at a person as 2,247 canvas screens of `prices.N...` rows and never printed its table; the table appeared only when piped or with `--no-color`. Small command frames (`status`, `enforce`) still draw the canvas.
|
|
12
|
+
- `--record` writes one frame for such a command, not one per page (`why --record` had produced a 5 GB recording).
|
|
13
|
+
|
|
3
14
|
## 0.3.14 (2026-09-24)
|
|
4
15
|
|
|
5
16
|
- `rewrites` names the cause of every cache miss, in a fixed precedence: `model_switch` (the model differs from the previous usage turn), `version_upgrade` (Claude Code's recorded `version` differs), `compaction`, `first_spawned_turn`, `idle_ttl_expired`, `image_pruning` (an earlier message re-recorded with fewer image or PDF blocks), then a host-reported `prefix_change`. The remainder is `prefix_change` as a stated residual or `unknown_ttl`. Effort changes, fast mode and tool definition changes are not in any transcript, and Claude Code does not persist image pruning, so the explanation says so instead of guessing. Codex takes the model from `turn_context` and compaction from `compacted`; a Codex rewrite with neither signal is `unknown` with the reason, never prefix change by default.
|
package/README.md
CHANGED
|
@@ -200,6 +200,8 @@ A session argument can also be a transcript path. Without one, Burn uses the ses
|
|
|
200
200
|
|
|
201
201
|
The table covers instruction stack + system, history re-sent, repeated file reads, subagent fan-out, tool output, conversation, full-prefix rewrites, output and unattributed usage. The fixed-prefix baseline is the first assistant response's measured context. It includes the initial user message, so the label is an operational baseline rather than a direct measurement of instruction files. A rewrite classified as prefix change resets that baseline and is counted in the footer; the new baseline can include history already present at that point.
|
|
202
202
|
|
|
203
|
+
The report ends with at most one tip from the session's own numbers, first match wins: subagent fan-out at 20% or more of session tokens, full-prefix rewrites at 15% or more of the session's API list equivalent (skipped when a model is unpriced), history re-sent at 30% or more of session tokens. The tip quotes the share or dollars the table prints and names one next step. When nothing reaches its threshold there is no tip. `agentguard-burn quiet on` hides it, `quiet off` shows it again and `quiet` says which. `why json` never contains it.
|
|
204
|
+
|
|
203
205
|
Later cache reads up to the baseline go to instruction stack + system. Reads above it go to history re-sent. Fresh input plus cache creation is the measured arriving increment. Burn subtracts the previous response's output before assigning that increment to intervening tool results and user messages. Result byte sizes only split that measured total; bytes are never converted into tokens. A result for a previously read Read path goes to re-read files. Mixed user and tool intervals are marked shared and counted in the footer.
|
|
204
206
|
|
|
205
207
|
Rewrite tokens and child transcript usage keep their own buckets. Prior output deducted from an input increment remains in the unattributed residual so every recorded input and output token is counted exactly once. Missing event evidence also remains there. Integer allocation preserves every token, and the Method footer explains each row.
|
|
@@ -590,4 +592,4 @@ output or transcript content. See [the live panel and September 20 evidence](doc
|
|
|
590
592
|
|
|
591
593
|
`agentguard-burn status` shows this UTC month’s recorded spawn stops and blocked shell commands. It reads Burn’s local ledger and plugin ledgers registered by either host, joins mirrored spawn receipts once, and excludes shadow decisions, approval holds and outcomes. Missing command history is unknown. Nothing is uploaded. Free installations see one Team line per UTC month. Counts update on later status calls without repeating that line.
|
|
592
594
|
|
|
593
|
-
Run `node runtime/policy-cli.cjs quiet on` from the AgentGuard plugin directory to
|
|
595
|
+
Run `agentguard-burn quiet on`, or `node runtime/policy-cli.cjs quiet on` from the AgentGuard plugin directory, to dismiss the monthly summary, the `why` tip, the weekly STOP invitation and plugin version announcements on this machine. Both write the same flag file, `upgrade-moments/quiet`, and use `AGENTGUARD_HOME` or the default local AgentGuard home for it. `agentguard-burn quiet off` removes that file.
|
package/dist/src/cli.js
CHANGED
|
@@ -85,6 +85,8 @@ const blocks_1 = require("./insights/blocks");
|
|
|
85
85
|
const cli_1 = require("./idle/cli");
|
|
86
86
|
const HOME = process.env.AGENTGUARD_HOME ?? (0, node_path_1.join)((0, node_os_1.homedir)(), '.agentguard');
|
|
87
87
|
const PROXY_HOSTS = ['ollama', 'vllm', 'lm-studio', 'openai-compatible'];
|
|
88
|
+
/** The same flag file the AgentGuard plugin reads (runtime/upgrade-moments.cjs), so one switch silences both. */
|
|
89
|
+
const quietOn = () => (0, node_fs_1.existsSync)((0, upgrade_moments_1.quietFile)(HOME));
|
|
88
90
|
function readStdinJson() {
|
|
89
91
|
try {
|
|
90
92
|
return JSON.parse((0, node_fs_1.readFileSync)(0, 'utf8'));
|
|
@@ -195,7 +197,21 @@ async function main(argv) {
|
|
|
195
197
|
case 'why': {
|
|
196
198
|
const location = (0, sessions_1.selectInsightTranscript)(rest.find(value => value !== 'json'));
|
|
197
199
|
const transcript = (0, transcript_1.readInsightSession)(location.path, { host: location.host, sessionId: location.sessionId });
|
|
198
|
-
show({ kind: 'command', command, values: { session: transcript.sessionId, observations: transcript.observations, diagnostics: transcript.diagnostics, attribution: (0, attribution_1.attributeTurns)((0, transcript_2.deduplicateTurns)(transcript.turns)).buckets, prices: (0, transcript_2.deduplicateTurns)(transcript.turns).map(turn => (0, pricing_1.priceTurn)(turn, (0, live_1.readPricing)(HOME, (0, pre_tool_use_1.loadPolicy)(HOME)))) } }, rest.includes('json') ? JSON.stringify(transcript, null, 2) + '\n' : (0, render_2.renderWhy)(transcript, (0, live_1.readPricing)(HOME, (0, pre_tool_use_1.loadPolicy)(HOME))) + '\n', rest.includes('json'));
|
|
200
|
+
show({ kind: 'command', command, values: { session: transcript.sessionId, observations: transcript.observations, diagnostics: transcript.diagnostics, attribution: (0, attribution_1.attributeTurns)((0, transcript_2.deduplicateTurns)(transcript.turns)).buckets, prices: (0, transcript_2.deduplicateTurns)(transcript.turns).map(turn => (0, pricing_1.priceTurn)(turn, (0, live_1.readPricing)(HOME, (0, pre_tool_use_1.loadPolicy)(HOME)))) } }, rest.includes('json') ? JSON.stringify(transcript, null, 2) + '\n' : (0, render_2.renderWhy)(transcript, (0, live_1.readPricing)(HOME, (0, pre_tool_use_1.loadPolicy)(HOME)), { tips: !quietOn() }) + '\n', rest.includes('json'));
|
|
201
|
+
return 0;
|
|
202
|
+
}
|
|
203
|
+
case 'quiet': {
|
|
204
|
+
const [state, ...extra] = rest;
|
|
205
|
+
if (extra.length || (state !== undefined && state !== 'on' && state !== 'off')) {
|
|
206
|
+
process.stderr.write('Usage: agentguard-burn quiet [on|off]\n');
|
|
207
|
+
return 64;
|
|
208
|
+
}
|
|
209
|
+
if (state)
|
|
210
|
+
(0, upgrade_moments_1.setQuiet)(HOME, state === 'on');
|
|
211
|
+
const quiet = quietOn();
|
|
212
|
+
show({ kind: 'command', command, values: { tips: quiet ? 'off' : 'on', quiet: quiet ? 'on' : 'off', file: (0, upgrade_moments_1.quietFile)(HOME) } }, quiet
|
|
213
|
+
? 'Tips are off. Quiet is on: the why tip, the monthly summary in status and the AgentGuard plugin\'s upgrade, version and Score lines stay hidden on this machine.\nTurn them back on: npx @agentguard-run/burn quiet off\n'
|
|
214
|
+
: 'Tips are on. The why report ends with one tip when a share of the session stands out.\nHide tips: npx @agentguard-run/burn quiet on\n');
|
|
199
215
|
return 0;
|
|
200
216
|
}
|
|
201
217
|
case 'rewrites':
|
|
@@ -447,7 +463,7 @@ async function main(argv) {
|
|
|
447
463
|
return 0;
|
|
448
464
|
}
|
|
449
465
|
default:
|
|
450
|
-
show({ kind: 'command', command: 'help', values: { commands: ['ps', 'reap', 'live', 'record', 'render', 'blocks', 'limits', 'price-shadow', 'why', 'rewrites', 'ttl', 'pace', 'statusline', 'pricing', 'replay', 'calibrate', 'status', 'init', 'enforce', 'shadow', 'resume', 'proxy', 'conformance'] } }, 'agentguard-burn <ps|reap|live|record|render|blocks|limits|price-shadow|why|rewrites|ttl|pace|statusline|pricing|replay|calibrate|status|init|enforce|shadow|resume|proxy|conformance>\n' +
|
|
466
|
+
show({ kind: 'command', command: 'help', values: { commands: ['ps', 'reap', 'live', 'record', 'render', 'blocks', 'limits', 'price-shadow', 'why', 'rewrites', 'ttl', 'pace', 'statusline', 'pricing', 'replay', 'calibrate', 'status', 'init', 'enforce', 'shadow', 'resume', 'quiet', 'proxy', 'conformance'] } }, 'agentguard-burn <ps|reap|live|record|render|blocks|limits|price-shadow|why|rewrites|ttl|pace|statusline|pricing|replay|calibrate|status|init|enforce|shadow|resume|quiet|proxy|conformance>\n' +
|
|
451
467
|
' ps [--json] local agent processes, held memory and workspace disk\n' +
|
|
452
468
|
' render <run.jsonl> --mp4 <out.mp4> [--gif <out.gif>] [--phone] local recorded-run export\n' +
|
|
453
469
|
' render <run.jsonl> --mp4 <out.mp4> --dashboard [--wide] [--economics <blocks.json>] dashboard export\n' +
|
|
@@ -474,6 +490,7 @@ async function main(argv) {
|
|
|
474
490
|
' shadow enforce -> shadow\n' +
|
|
475
491
|
' resume --once --reason "..." let the next STOP through, once, on any host\n' +
|
|
476
492
|
' resume --reason "..." let STOPs through for 15 minutes; --clear ends it\n' +
|
|
493
|
+
' quiet [on|off] hide or show the why tip and the plugin upgrade lines; alone, says which\n' +
|
|
477
494
|
' proxy --upstream http://127.0.0.1:11434 --host ollama|vllm|lm-studio|openai-compatible [--listen 127.0.0.1:18080] [--session ID]\n' +
|
|
478
495
|
' conformance replay the storm and the grind through every adapter shape\n' +
|
|
479
496
|
'Developer review commands (never installed as hooks):\n' +
|
|
@@ -2,7 +2,23 @@ import { type DollarRange, type PricingTable } from './pricing';
|
|
|
2
2
|
import { type InsightHost, type InsightTranscript, type InsightTurn, type RewriteCause, type RewriteEvidence } from './types';
|
|
3
3
|
export declare function sumPrices(values: Array<DollarRange | null>): DollarRange | null;
|
|
4
4
|
export declare function totalTokens(turn: InsightTurn): number;
|
|
5
|
-
export declare
|
|
5
|
+
export declare const WHY_TIP_HIDE_LINE = "Hide tips like this: npx @agentguard-run/burn quiet on";
|
|
6
|
+
/**
|
|
7
|
+
* One next step from the session's own measured shares, first match wins; null
|
|
8
|
+
* when nothing stands out, never a generic line. Fan-out and history compare
|
|
9
|
+
* session tokens; rewrites compare list USD and are skipped when either figure
|
|
10
|
+
* is unpriced. A dollar range compares midpoints, as the `rewrites` share does.
|
|
11
|
+
*/
|
|
12
|
+
export declare function whyTip(input: {
|
|
13
|
+
totalTokens: number;
|
|
14
|
+
fanoutTokens: number;
|
|
15
|
+
historyTokens: number;
|
|
16
|
+
rewriteUsd: DollarRange | null;
|
|
17
|
+
totalUsd: DollarRange | null;
|
|
18
|
+
}): string | null;
|
|
19
|
+
export declare function renderWhy(transcript: InsightTranscript, rates?: PricingTable, options?: {
|
|
20
|
+
tips?: boolean;
|
|
21
|
+
}): string;
|
|
6
22
|
export interface RewriteRow extends RewriteEvidence {
|
|
7
23
|
sessionId: string;
|
|
8
24
|
host: InsightHost;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WHY_TIP_HIDE_LINE = void 0;
|
|
3
4
|
exports.sumPrices = sumPrices;
|
|
4
5
|
exports.totalTokens = totalTokens;
|
|
6
|
+
exports.whyTip = whyTip;
|
|
5
7
|
exports.renderWhy = renderWhy;
|
|
6
8
|
exports.rewriteReport = rewriteReport;
|
|
7
9
|
exports.rewriteReportJson = rewriteReportJson;
|
|
@@ -37,7 +39,27 @@ function table(headers, rows) {
|
|
|
37
39
|
return [headers, ...rows].map(row => row.map((cell, i) => cell.padEnd(widths[i])).join(' ').trimEnd()).join('\n');
|
|
38
40
|
}
|
|
39
41
|
const count = (n) => n.toLocaleString('en-US');
|
|
40
|
-
|
|
42
|
+
/** The table's share column; the tip prints the same figure. */
|
|
43
|
+
const share = (tokens, total) => `${(total ? tokens / total * 100 : 0).toFixed(1)}%`;
|
|
44
|
+
const midpoint = (value) => (value.min + value.max) / 2;
|
|
45
|
+
exports.WHY_TIP_HIDE_LINE = 'Hide tips like this: npx @agentguard-run/burn quiet on';
|
|
46
|
+
/**
|
|
47
|
+
* One next step from the session's own measured shares, first match wins; null
|
|
48
|
+
* when nothing stands out, never a generic line. Fan-out and history compare
|
|
49
|
+
* session tokens; rewrites compare list USD and are skipped when either figure
|
|
50
|
+
* is unpriced. A dollar range compares midpoints, as the `rewrites` share does.
|
|
51
|
+
*/
|
|
52
|
+
function whyTip(input) {
|
|
53
|
+
const { totalTokens, fanoutTokens, historyTokens, rewriteUsd, totalUsd } = input;
|
|
54
|
+
if (totalTokens > 0 && fanoutTokens / totalTokens >= 0.2)
|
|
55
|
+
return `Next: sub-agent fan-out is ${share(fanoutTokens, totalTokens)} of this session's tokens. Spawn limits refuse the next sub-agent launch past your limit, free on one machine: agentguard.run/try`;
|
|
56
|
+
if (rewriteUsd && totalUsd && midpoint(totalUsd) > 0 && midpoint(rewriteUsd) / midpoint(totalUsd) >= 0.15)
|
|
57
|
+
return `Next: full-prefix rewrites are ${(0, live_1.dollars)(rewriteUsd)} of ${(0, live_1.dollars)(totalUsd)} API list equivalent here. See the cause of each one: npx @agentguard-run/burn rewrites`;
|
|
58
|
+
if (totalTokens > 0 && historyTokens / totalTokens >= 0.3)
|
|
59
|
+
return `Next: history re-sent is ${share(historyTokens, totalTokens)} of this session's tokens. A fresh session, or /compact, starts that history over.`;
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
function renderWhy(transcript, rates = {}, options = {}) {
|
|
41
63
|
if (transcript.state.forkHistoryBoundaryUnknown)
|
|
42
64
|
return [
|
|
43
65
|
`AgentGuard why: ${transcript.sessionId}`,
|
|
@@ -52,17 +74,19 @@ function renderWhy(transcript, rates = {}) {
|
|
|
52
74
|
&& byTurn.get(turn.id).buckets.some(bucket => bucket.categories.cacheCreation > 0 && bucket.categories.cacheCreation < turn.cacheWriteTokens));
|
|
53
75
|
const totals = { input: 0, write: 0, read: 0, output: 0 };
|
|
54
76
|
turns.forEach(turn => { totals.input += turn.inputTokens; totals.write += turn.cacheWriteTokens; totals.read += turn.cacheReadTokens; totals.output += turn.outputTokens; });
|
|
77
|
+
const bucketTokens = (bucket) => attribution.buckets.find(item => item.bucket === bucket).tokens;
|
|
78
|
+
const bucketUsd = (bucket) => sumPrices(turns.map(turn => bucketPrice(turn, byTurn.get(turn.id).buckets.find(item => item.bucket === bucket), rates)));
|
|
79
|
+
const totalUsd = sumPrices(prices.map(price => price.usd));
|
|
55
80
|
const rows = types_1.INSIGHT_BUCKETS.map(bucket => {
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
return [labels[bucket], count(row.tokens), (0, live_1.dollars)(sumPrices(turns.map(turn => bucketPrice(turn, byTurn.get(turn.id).buckets.find(item => item.bucket === bucket), rates)))),
|
|
59
|
-
`${(attribution.totalTokens ? row.tokens / attribution.totalTokens * 100 : 0).toFixed(1)}%`,
|
|
60
|
-
`${(lastAttribution?.totalTokens ? lastTokens / lastAttribution.totalTokens * 100 : 0).toFixed(1)}%`];
|
|
81
|
+
const tokens = bucketTokens(bucket), lastTokens = lastAttribution?.buckets.find(item => item.bucket === bucket).tokens ?? 0;
|
|
82
|
+
return [labels[bucket], count(tokens), (0, live_1.dollars)(bucketUsd(bucket)), share(tokens, attribution.totalTokens), share(lastTokens, lastAttribution?.totalTokens ?? 0)];
|
|
61
83
|
});
|
|
62
84
|
const unknownModels = [...new Set(prices.filter(price => price.usd === null).map(price => price.model ?? 'missing model id'))];
|
|
85
|
+
const tip = options.tips ? whyTip({ totalTokens: attribution.totalTokens, fanoutTokens: bucketTokens('subagent_fanout'),
|
|
86
|
+
historyTokens: bucketTokens('history_resent'), rewriteUsd: bucketUsd('full_prefix_rewrites'), totalUsd }) : null;
|
|
63
87
|
return [
|
|
64
88
|
`AgentGuard why: ${transcript.sessionId}`,
|
|
65
|
-
`${turns.length} assistant responses | ${count(attribution.totalTokens)} tokens | ${(0, live_1.dollars)(
|
|
89
|
+
`${turns.length} assistant responses | ${count(attribution.totalTokens)} tokens | ${(0, live_1.dollars)(totalUsd)} API list equivalent`,
|
|
66
90
|
`Usage: input ${count(totals.input)}, cache creation ${count(totals.write)}, cache read ${count(totals.read)}, output ${count(totals.output)}.`,
|
|
67
91
|
'', table(['Bucket', 'Tokens', 'List USD', 'Session tokens', 'Last turn tokens'], rows), '',
|
|
68
92
|
'Token shares partition recorded usage; byte sizes only split measured token increments and are never converted into tokens.',
|
|
@@ -83,11 +107,11 @@ function renderWhy(transcript, rates = {}) {
|
|
|
83
107
|
...(prices.some(price => price.unknownCacheWriteTokens > 0) ? ['Cache TTL is missing for some writes; their dollars span the verified five-minute and one-hour rates.'] : []),
|
|
84
108
|
...(mixedWriteAllocation ? ['Some bucket cache-write costs are ranges because mixed cache lifetimes are not attributed to individual buckets. Range endpoints are not additive across buckets.'] : []),
|
|
85
109
|
`Usage records de-duplicated: ${transcript.diagnostics.duplicateUsageRecords}. Malformed lines skipped: ${transcript.diagnostics.malformedLines}.`,
|
|
110
|
+
...(tip ? ['', tip, exports.WHY_TIP_HIDE_LINE] : []),
|
|
86
111
|
].join('\n');
|
|
87
112
|
}
|
|
88
113
|
const stamp = (at) => at === undefined ? 'unknown time' : new Date(at).toISOString().replace(/\.\d{3}Z$/, 'Z');
|
|
89
114
|
const idle = (idleMs) => idleMs === undefined ? '-' : (0, attribution_1.idleLabel)(idleMs);
|
|
90
|
-
const midpoint = (value) => (value.min + value.max) / 2;
|
|
91
115
|
function rewriteReport(transcripts, rates = {}) {
|
|
92
116
|
const turns = (0, transcript_1.deduplicateTurns)(transcripts.flatMap(transcript => transcript.turns)).sort((a, b) => (a.at ?? 0) - (b.at ?? 0) || a.id.localeCompare(b.id));
|
|
93
117
|
const grouped = new Map();
|
package/dist/src/presentation.js
CHANGED
|
@@ -7,10 +7,17 @@ const frames_1 = require("./frames");
|
|
|
7
7
|
const recording_1 = require("./recording");
|
|
8
8
|
function present(data, plain, options = {}) {
|
|
9
9
|
const colour = options.colour ?? (Boolean(process.stdout.isTTY) && process.env.NO_COLOR === undefined);
|
|
10
|
-
const
|
|
11
|
-
const grid = new canvas_1.Canvas(
|
|
10
|
+
const wantsScreen = colour && !options.protocol;
|
|
11
|
+
const grid = new canvas_1.Canvas(wantsScreen ? {} : { width: 104, height: 35 });
|
|
12
12
|
const viewport = { width: Math.min(104, grid.width), height: Math.min(35, grid.height) };
|
|
13
|
-
|
|
13
|
+
// A command frame that does not fit one screen is a report, not a screen.
|
|
14
|
+
// 0.3.14 paged `why` at a person as 2,247 canvas screens of price rows and
|
|
15
|
+
// never printed its table (the table only appeared when piped or with
|
|
16
|
+
// --no-color). Such a frame prints its plain text on screen and is
|
|
17
|
+
// recorded once, not once per page (`why --record` had written 5 GB).
|
|
18
|
+
const overflow = data.kind === 'command' && (0, frames_1.framePageCount)(data, viewport) > 1;
|
|
19
|
+
const screen = wantsScreen && !overflow;
|
|
20
|
+
const pages = (screen || (0, recording_1.isRecording)()) && !overflow ? (0, frames_1.framePageCount)(data, viewport) : 1;
|
|
14
21
|
for (let page = 0; page < pages; page++) {
|
|
15
22
|
const frame = data.kind !== 'report' ? { ...data, page } : data;
|
|
16
23
|
const at = new Date().toISOString();
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
export declare const TEAM_LINE = "Using this at work? Team puts one policy on every seat. agentguard.run/pricing";
|
|
2
|
+
/**
|
|
3
|
+
* The quiet flag the AgentGuard plugin writes and reads too
|
|
4
|
+
* (agentguard-codex-plugin/runtime/upgrade-moments.cjs), so one switch hides
|
|
5
|
+
* the `why` tip, this monthly summary and the plugin's upgrade lines.
|
|
6
|
+
*/
|
|
7
|
+
export declare const quietFile: (home: string) => string;
|
|
8
|
+
/** `quiet on` creates the flag (idempotent); `quiet off` removes that one file and nothing else. */
|
|
9
|
+
export declare function setQuiet(home: string, on: boolean): void;
|
|
2
10
|
export interface MonthlySummary {
|
|
3
11
|
month: string;
|
|
4
12
|
spawnsStopped: number;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TEAM_LINE = void 0;
|
|
3
|
+
exports.quietFile = exports.TEAM_LINE = void 0;
|
|
4
|
+
exports.setQuiet = setQuiet;
|
|
4
5
|
exports.pluginDirectories = pluginDirectories;
|
|
5
6
|
exports.monthlySummary = monthlySummary;
|
|
6
7
|
exports.renderMonthlySummary = renderMonthlySummary;
|
|
@@ -9,6 +10,35 @@ const node_fs_1 = require("node:fs");
|
|
|
9
10
|
const node_path_1 = require("node:path");
|
|
10
11
|
const ledger_panel_1 = require("./ledger-panel");
|
|
11
12
|
exports.TEAM_LINE = 'Using this at work? Team puts one policy on every seat. agentguard.run/pricing';
|
|
13
|
+
/**
|
|
14
|
+
* The quiet flag the AgentGuard plugin writes and reads too
|
|
15
|
+
* (agentguard-codex-plugin/runtime/upgrade-moments.cjs), so one switch hides
|
|
16
|
+
* the `why` tip, this monthly summary and the plugin's upgrade lines.
|
|
17
|
+
*/
|
|
18
|
+
const quietFile = (home) => (0, node_path_1.join)(home, 'upgrade-moments', 'quiet');
|
|
19
|
+
exports.quietFile = quietFile;
|
|
20
|
+
/** `quiet on` creates the flag (idempotent); `quiet off` removes that one file and nothing else. */
|
|
21
|
+
function setQuiet(home, on) {
|
|
22
|
+
const file = (0, exports.quietFile)(home);
|
|
23
|
+
if (on) {
|
|
24
|
+
(0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(file), { recursive: true, mode: 0o700 });
|
|
25
|
+
try {
|
|
26
|
+
(0, node_fs_1.writeFileSync)(file, '1\n', { flag: 'wx', mode: 0o600 });
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
if (error.code !== 'EEXIST')
|
|
30
|
+
throw error;
|
|
31
|
+
}
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
(0, node_fs_1.unlinkSync)(file);
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
if (error.code !== 'ENOENT')
|
|
39
|
+
throw error;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
12
42
|
const object = (value) => value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
13
43
|
function read(file, limit = 1024 * 1024 * 64) {
|
|
14
44
|
const fd = (0, node_fs_1.openSync)(file, node_fs_1.constants.O_RDONLY | node_fs_1.constants.O_NOFOLLOW | node_fs_1.constants.O_NONBLOCK);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentguard-run/burn",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.16",
|
|
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",
|