@agentguard-run/burn 0.5.0 → 0.5.1
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 +31 -8
- package/dist/src/cli.js +56 -18
- package/dist/src/insights/calendar-render.js +2 -1
- package/dist/src/insights/first-run.d.ts +12 -0
- package/dist/src/insights/first-run.js +17 -0
- package/dist/src/insights/render.js +3 -2
- package/dist/src/insights/sessions.d.ts +4 -0
- package/dist/src/insights/sessions.js +18 -2
- package/dist/src/version.d.ts +2 -0
- package/dist/src/version.js +5 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.5.1 (2026-10-08)
|
|
4
|
+
|
|
5
|
+
First-run fixes, so the first command a new user runs gives a clear answer.
|
|
6
|
+
|
|
7
|
+
- No sessions yet: with no Claude Code or Codex sessions on the computer, `why`, `calendar` and `card` print the same friendly message, name the folders Burn checked, say what to do next and exit with code 0. No card image is created.
|
|
8
|
+
- `why --json` (and `why json`) always prints JSON to stdout. With no sessions it returns `found: false` with `looked_in`, `message`, `next` and `version`. A usage error or a missing session also returns JSON, with `found: false` and an `error` field, and keeps its exit code (64 or 4). A full report includes `version` and `found: true`, and `calendar --json` includes `version` too.
|
|
9
|
+
- Burn honors `CLAUDE_CONFIG_DIR` and `CODEX_HOME`: it reads `CLAUDE_CONFIG_DIR/projects` and `CODEX_HOME/sessions`, and falls back to `~/.claude/projects` and `~/.codex/sessions` when a variable is unset or empty.
|
|
10
|
+
- `why` and `calendar` text reports print the Burn version on the first line, for example `Burn 0.5.1 | AgentGuard why: <session>`.
|
|
11
|
+
- Shorter help: plain `npx agentguard-burn`, `help`, `--help` or `-h` shows three starting points (`why`, `calendar` and `card`). `--help all` lists every command.
|
|
12
|
+
- The `agentguard-burn` wrapper (0.5.1) now runs Burn as a child process, so Burn's exit codes pass through to your shell. It requires `@agentguard-run/burn` ^0.5.1, so `npx agentguard-burn` gets these fixes.
|
|
13
|
+
|
|
3
14
|
## 0.5.0 (2026-10-07)
|
|
4
15
|
|
|
5
16
|
- Price Claude Haiku 5.5 (`claude-haiku-5-5`), released on October 7, 2026: 0.1, 0.01, 0.125, 0.2 and 0.5 USD per million tokens for fresh input, cache read, five-minute write, one-hour write and output on prompts up to 100,000 tokens, and five times each above that. Before this row its turns were unpriced.
|
package/README.md
CHANGED
|
@@ -1,20 +1,37 @@
|
|
|
1
1
|
# @agentguard-run/burn
|
|
2
2
|
|
|
3
|
+
```sh
|
|
4
|
+
npx agentguard-burn why
|
|
5
|
+
```
|
|
6
|
+
|
|
3
7
|
See where a coding session's tokens went and what the next heavy turn could cost in time and limits. Burn explains recorded usage, warns about large cache rewrites and keeps its existing runaway-session circuit breaker. Runtime observation and enforcement stay on this machine. The developer review command below has an explicit external-ranking option.
|
|
4
8
|
|
|
5
|
-
##
|
|
9
|
+
## Start here
|
|
6
10
|
|
|
7
11
|
```sh
|
|
8
|
-
|
|
9
|
-
agentguard-burn
|
|
10
|
-
agentguard-burn
|
|
11
|
-
agentguard-burn statusline
|
|
12
|
-
agentguard-burn why
|
|
12
|
+
npx agentguard-burn why # your last session
|
|
13
|
+
npx agentguard-burn calendar # every day
|
|
14
|
+
npx agentguard-burn card # an image to share
|
|
13
15
|
```
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
Press y if npm asks to install Burn. Plain `npx agentguard-burn` shows these three starting points. Use `npx agentguard-burn --help all` for every command and option.
|
|
18
|
+
|
|
19
|
+
Burn prints its installed version on the first line of every `why` and `calendar` text report, including the empty message. JSON reports include a `version` field. `npx agentguard-burn --version` (or `-v`) prints only the installed version.
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
### No sessions yet
|
|
22
|
+
|
|
23
|
+
With no sessions, `why`, `calendar` and `card` print the same guidance to stdout and exit 0. This is a normal first run. No card image is created. Burn lists the actual folders it checked, then prints:
|
|
24
|
+
|
|
25
|
+
```text
|
|
26
|
+
No Claude Code or Codex sessions found on this computer yet.
|
|
27
|
+
Burn looked in <the actual folders it checked>.
|
|
28
|
+
Next: if you use Claude Code on another computer, run this there.
|
|
29
|
+
If Claude Code is new here, use it for a few minutes, then run npx agentguard-burn why again.
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
By default Burn checks `~/.claude/projects` and `~/.codex/sessions`. When `CLAUDE_CONFIG_DIR` is set, it checks `CLAUDE_CONFIG_DIR/projects` instead of the Claude default. When `CODEX_HOME` is set, it checks `CODEX_HOME/sessions` instead of the Codex default. Unset or empty variables keep the home-folder defaults.
|
|
33
|
+
|
|
34
|
+
`npx agentguard-burn why --json` always writes JSON to stdout. No sessions gives `found: false`, `looked_in`, `message`, `next` and `version`, with exit 0. A successful session report includes `found: true` and `version`. Invalid arguments exit 64; a missing requested session or a read failure exits 4. Both errors include an `error` field in JSON mode. `calendar` also returns the empty JSON object when asked for JSON on a machine with no sessions.
|
|
18
35
|
|
|
19
36
|
## Launch tree and signed approval tally
|
|
20
37
|
|
|
@@ -491,6 +508,10 @@ Runs the detectors over your existing history and shows what enforcement would
|
|
|
491
508
|
have intercepted, when, and the observed tail after each stop. It is an upper
|
|
492
509
|
bound, labelled as such. Nobody installs a blocker cold.
|
|
493
510
|
|
|
511
|
+
### Optional global install and hooks
|
|
512
|
+
|
|
513
|
+
A global install pins an old version: `npx agentguard-burn why` can keep using that global command instead of downloading a newer Burn. To run the latest release explicitly, use `npx agentguard-burn@latest why`. If you previously installed the scoped package globally, remove it with `npm rm -g @agentguard-run/burn`; for the wrapper, use `npm rm -g agentguard-burn`.
|
|
514
|
+
|
|
494
515
|
```
|
|
495
516
|
npm i -g @agentguard-run/burn
|
|
496
517
|
agentguard-burn init --write # merge the hook into ~/.claude/settings.json (backup taken)
|
|
@@ -499,6 +520,8 @@ agentguard-burn status # hook health, shadow observations, every
|
|
|
499
520
|
agentguard-burn enforce # after 7 days and 50 decisions
|
|
500
521
|
```
|
|
501
522
|
|
|
523
|
+
Without the write flag, `agentguard-burn init claude` and `agentguard-burn init codex` print hook configuration for review. Merge the relevant snippet into your host configuration. For Codex, review and trust the hook through `/hooks`. Upgrading an existing hook requires the new snippet: it matches every tool so pace can update on ordinary tool calls, while admission still gates spawns.
|
|
524
|
+
|
|
502
525
|
The hook installs in **shadow mode**: every decision is recorded, nothing is
|
|
503
526
|
blocked, until you have seen it be right. `status` shows what it would have
|
|
504
527
|
done so far, which sessions are live on every host, and whether each hook's
|
package/dist/src/cli.js
CHANGED
|
@@ -77,6 +77,8 @@ const eligibility_1 = require("./eligibility");
|
|
|
77
77
|
const tree_1 = require("./insights/tree");
|
|
78
78
|
const tally_1 = require("./insights/tally");
|
|
79
79
|
const sessions_1 = require("./insights/sessions");
|
|
80
|
+
const first_run_1 = require("./insights/first-run");
|
|
81
|
+
const version_1 = require("./version");
|
|
80
82
|
const transcript_1 = require("./insights/transcript");
|
|
81
83
|
const live_1 = require("./insights/live");
|
|
82
84
|
const attribution_1 = require("./insights/attribution");
|
|
@@ -142,6 +144,11 @@ async function main(argv) {
|
|
|
142
144
|
const noColor = rawRest.includes('--no-color');
|
|
143
145
|
const rest = rawRest.filter(value => value !== '--no-color');
|
|
144
146
|
const show = (data, plain, protocol = false) => (0, presentation_1.present)(data, plain, { colour: Boolean(process.stdout.isTTY) && !noColor && process.env.NO_COLOR === undefined, protocol });
|
|
147
|
+
const showNoSessions = (lookedIn, json = false) => {
|
|
148
|
+
const report = (0, first_run_1.noSessionsReport)(lookedIn);
|
|
149
|
+
show({ kind: 'command', command: command, values: report }, json ? JSON.stringify(report) + '\n' : (0, first_run_1.renderNoSessions)(lookedIn), true);
|
|
150
|
+
return first_run_1.NO_SESSIONS_EXIT_CODE;
|
|
151
|
+
};
|
|
145
152
|
const flag = (name) => {
|
|
146
153
|
const i = rest.indexOf(name);
|
|
147
154
|
return i >= 0 ? rest[i + 1] : undefined;
|
|
@@ -151,7 +158,7 @@ async function main(argv) {
|
|
|
151
158
|
case '--version':
|
|
152
159
|
case '-v':
|
|
153
160
|
// The version of this install, from the package that ships it, and nothing else.
|
|
154
|
-
process.stdout.write(`${
|
|
161
|
+
process.stdout.write(`${version_1.BURN_VERSION}\n`);
|
|
155
162
|
return 0;
|
|
156
163
|
case 'live': {
|
|
157
164
|
const { runLivePanel } = await Promise.resolve().then(() => __importStar(require('./live-panel')));
|
|
@@ -241,6 +248,7 @@ async function main(argv) {
|
|
|
241
248
|
return 0;
|
|
242
249
|
}
|
|
243
250
|
case 'why': {
|
|
251
|
+
const json = rest.includes('json') || rest.includes('--json');
|
|
244
252
|
// `--lang en|es|pt` (or --lang=es) picks the report's language and is never a session selector.
|
|
245
253
|
// `--commits` adds the commits that landed while the session ran. It is the only way `why` runs git.
|
|
246
254
|
const args = [];
|
|
@@ -259,23 +267,36 @@ async function main(argv) {
|
|
|
259
267
|
else
|
|
260
268
|
args.push(rest[i]);
|
|
261
269
|
}
|
|
262
|
-
|
|
263
|
-
|
|
270
|
+
const selectors = args.filter(value => value !== 'json' && value !== '--json');
|
|
271
|
+
if ((langGiven && (0, i18n_1.whyLangOf)(lang) === null) || selectors.length > 1 || selectors.some(value => !value.trim() || value.startsWith('--'))) {
|
|
272
|
+
const error = 'Usage: agentguard-burn why [session] [json] [--lang en|es|pt]';
|
|
273
|
+
if (json)
|
|
274
|
+
process.stdout.write(JSON.stringify({ version: version_1.BURN_VERSION, found: false, error }) + '\n');
|
|
275
|
+
else
|
|
276
|
+
process.stderr.write(error + '\n');
|
|
264
277
|
return 64;
|
|
265
278
|
}
|
|
266
|
-
|
|
279
|
+
let location;
|
|
280
|
+
try {
|
|
281
|
+
location = (0, sessions_1.selectInsightTranscript)(selectors[0]);
|
|
282
|
+
}
|
|
283
|
+
catch (error) {
|
|
284
|
+
if (error instanceof sessions_1.NoSessionsFoundError)
|
|
285
|
+
return showNoSessions(error.lookedIn, json);
|
|
286
|
+
throw error;
|
|
287
|
+
}
|
|
267
288
|
const transcript = (0, transcript_1.readInsightSession)(location.path, { host: location.host, sessionId: location.sessionId });
|
|
268
|
-
const json = args.includes('json') || args.includes('--json');
|
|
269
289
|
// The commits reader is loaded only with the flag, so a plain `why` never reaches it.
|
|
270
290
|
const commits = withCommits ? await (await Promise.resolve().then(() => __importStar(require('./insights/commits')))).sessionCommits({ path: location.path }) : undefined;
|
|
271
291
|
const launchTree = (0, tree_1.readLaunchTree)(location);
|
|
272
292
|
const treeSection = launchTree.root.children.length || launchTree.unlinked.length ? '\n\n' + (0, tree_1.renderLaunchTree)(launchTree, true) : '';
|
|
273
293
|
const commitsValue = commits ? (0, render_2.commitsJson)(commits, transcript.state.forkHistoryBoundaryUnknown ? null : (0, render_2.sessionFigures)(transcript).attribution.totalTokens) : undefined;
|
|
274
|
-
|
|
275
|
-
|
|
294
|
+
const humanReport = json ? '' : (0, render_2.renderWhy)(transcript, (0, live_1.readPricing)(HOME, (0, pre_tool_use_1.loadPolicy)(HOME)), { tips: !quietOn(), lang: (0, i18n_1.detectWhyLang)({ flag: lang, env: process.env, intlLocale: intlLocale() }), ...(commits ? { commits } : {}) });
|
|
295
|
+
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)))), ...(commitsValue ? { commits: commitsValue } : {}) } }, json ? JSON.stringify({ version: version_1.BURN_VERSION, found: true, ...transcript, ...(treeSection ? { launchTree } : {}), ...(commitsValue ? { commits: commitsValue } : {}) }, null, 2) + '\n'
|
|
296
|
+
: (treeSection ? humanReport.replace('\n', treeSection + '\n\n') : humanReport) + '\n', true);
|
|
276
297
|
if (require.main === module && !json && transcript.turns.length) {
|
|
277
298
|
finishReportNaturally = true;
|
|
278
|
-
await (0, telemetry_cli_1.countFirstReport)(
|
|
299
|
+
await (0, telemetry_cli_1.countFirstReport)(version_1.BURN_VERSION);
|
|
279
300
|
}
|
|
280
301
|
return 0;
|
|
281
302
|
}
|
|
@@ -347,11 +368,14 @@ async function main(argv) {
|
|
|
347
368
|
const { renderCalendar } = await Promise.resolve().then(() => __importStar(require('./insights/calendar-render')));
|
|
348
369
|
// The span fits the terminal: its columns on a TTY, 80 when piped.
|
|
349
370
|
const columns = process.stdout.isTTY && (process.stdout.columns ?? 0) > 0 ? process.stdout.columns : 80;
|
|
350
|
-
const
|
|
371
|
+
const roots = (0, sessions_1.transcriptRoots)();
|
|
372
|
+
const data = collectCalendar({ home: HOME, roots, rates: (0, live_1.readPricing)(HOME, (0, pre_tool_use_1.loadPolicy)(HOME)) });
|
|
373
|
+
if (data.sources.transcripts + data.sources.rollupFiles + data.sources.unreadable === 0)
|
|
374
|
+
return showNoSessions(Object.values(roots), json);
|
|
351
375
|
if (!data.saved)
|
|
352
376
|
process.stderr.write(i18n_1.CALENDAR_TEXT[language].saveFailed + '\n');
|
|
353
377
|
const report = calendarReport(data, { now: Date.now(), columns, ...(weeks ? { weeks } : {}) });
|
|
354
|
-
show({ kind: 'calendar', report, lang: language, columns }, json ? JSON.stringify(report, null, 2) + '\n' : renderCalendar(report, language, columns) + '\n', json);
|
|
378
|
+
show({ kind: 'calendar', report, lang: language, columns }, json ? JSON.stringify({ version: version_1.BURN_VERSION, ...report }, null, 2) + '\n' : renderCalendar(report, language, columns) + '\n', json);
|
|
355
379
|
return 0;
|
|
356
380
|
}
|
|
357
381
|
case 'card': {
|
|
@@ -375,13 +399,16 @@ async function main(argv) {
|
|
|
375
399
|
return 64;
|
|
376
400
|
}
|
|
377
401
|
const { calendarReport, collectCalendar } = await Promise.resolve().then(() => __importStar(require('./insights/calendar')));
|
|
378
|
-
const
|
|
379
|
-
const data = collectCalendar({ home: HOME, rates: (0, live_1.readPricing)(HOME, (0, pre_tool_use_1.loadPolicy)(HOME)) });
|
|
402
|
+
const roots = (0, sessions_1.transcriptRoots)();
|
|
403
|
+
const data = collectCalendar({ home: HOME, roots, rates: (0, live_1.readPricing)(HOME, (0, pre_tool_use_1.loadPolicy)(HOME)) });
|
|
404
|
+
if (data.sources.transcripts + data.sources.rollupFiles + data.sources.unreadable === 0)
|
|
405
|
+
return showNoSessions(Object.values(roots));
|
|
380
406
|
const report = calendarReport(data, { now: Date.now(), weeks });
|
|
381
407
|
if (!(report.totals.tokens > 0)) {
|
|
382
408
|
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');
|
|
383
409
|
return 1;
|
|
384
410
|
}
|
|
411
|
+
const { cardModel, renderCard } = await Promise.resolve().then(() => __importStar(require('./insights/card')));
|
|
385
412
|
(0, node_fs_1.writeFileSync)(out, await renderCard(cardModel(report)));
|
|
386
413
|
process.stdout.write(`Card saved: ${out} (1200x675). Dollars on it are API list prices, not a bill; nothing was uploaded.\n`);
|
|
387
414
|
return 0;
|
|
@@ -693,8 +720,13 @@ async function main(argv) {
|
|
|
693
720
|
: `Override recorded for the next ${override_1.OVERRIDE_WINDOW_MS / 60000} minutes, on any host: "${reason}"\n (agentguard-burn resume --clear to end it early)\n`);
|
|
694
721
|
return 0;
|
|
695
722
|
}
|
|
696
|
-
default:
|
|
697
|
-
|
|
723
|
+
default: {
|
|
724
|
+
const starter = ' why: your last session\n calendar: every day\n card: an image to share\n';
|
|
725
|
+
if (!(command === 'help' || command === '--help' || command === '-h') || rest[0] !== 'all') {
|
|
726
|
+
show({ kind: 'command', command: 'help', values: { commands: ['why', 'calendar', 'card'] } }, starter + '\nStart here: npx agentguard-burn why\nAll commands: npx agentguard-burn --help all\n', true);
|
|
727
|
+
return !command || command === 'help' || command === '--help' || command === '-h' ? 0 : 64;
|
|
728
|
+
}
|
|
729
|
+
show({ kind: 'command', command: 'help', values: { commands: ['tree', 'tally', 'ps', 'reap', 'live', 'record', 'render', 'blocks', 'limits', 'price-shadow', 'calendar', 'why', 'compare', 'rewrites', 'ttl', 'pace', 'statusline', 'pricing', 'telemetry', 'replay', 'calibrate', 'status', 'init', 'enforce', 'shadow', 'resume', 'quiet', 'proxy', 'conformance'] } }, starter + '\nAll commands\n' +
|
|
698
730
|
' ps [--json] local agent processes, held memory and workspace disk\n' +
|
|
699
731
|
' render <run.jsonl> --mp4 <out.mp4> [--gif <out.gif>] [--phone] local recorded-run export\n' +
|
|
700
732
|
' render <run.jsonl> --mp4 <out.mp4> --dashboard [--wide] [--economics <blocks.json>] dashboard export\n' +
|
|
@@ -721,7 +753,7 @@ async function main(argv) {
|
|
|
721
753
|
' pricing verified model rates and local overrides\n' +
|
|
722
754
|
' replay [files...] [--json] [--top N] [--min-tokens N]\n' +
|
|
723
755
|
' import-bench <run-dir> [--out <directory>] [--publisher-key-id ID] verify and convert a signed bundle\n' +
|
|
724
|
-
' replay <replay.json> --pricing <snapshot.json> [--json]
|
|
756
|
+
' replay <replay.json> --pricing <snapshot.json> [--json] replay a saved run with its original prices\n' +
|
|
725
757
|
' calibrate fit thresholds to your history (writes shadow policy)\n' +
|
|
726
758
|
' status mode, shadow observations, eligibility, hook health, every host\n' +
|
|
727
759
|
' init [claude|cursor|codex] [--write] print the hook snippet, or merge it into the config (with a backup)\n' +
|
|
@@ -731,11 +763,12 @@ async function main(argv) {
|
|
|
731
763
|
' resume --reason "..." let STOPs through for 15 minutes; --clear ends it\n' +
|
|
732
764
|
' quiet [on|off] hide or show the why tip and the plugin upgrade lines; alone, says which\n' +
|
|
733
765
|
' proxy --upstream http://127.0.0.1:11434 --host ollama|vllm|lm-studio|openai-compatible [--listen 127.0.0.1:18080] [--session ID]\n' +
|
|
734
|
-
' conformance
|
|
766
|
+
' conformance check that each host stops the same runaway patterns\n' +
|
|
735
767
|
'Developer review commands (never installed as hooks):\n' +
|
|
736
768
|
' guard-candidates [--ledger <local.ndjson>] [--out <name.review.json>] [--rank]\n' +
|
|
737
|
-
'
|
|
769
|
+
' group recorded commands; --rank sends them to an external ranking service\n', true);
|
|
738
770
|
return !command || command === 'help' || command === '--help' || command === '-h' ? 0 : 64;
|
|
771
|
+
}
|
|
739
772
|
}
|
|
740
773
|
}
|
|
741
774
|
async function run() {
|
|
@@ -801,6 +834,11 @@ if (require.main === module)
|
|
|
801
834
|
process.exitCode = code;
|
|
802
835
|
else
|
|
803
836
|
exit(code); }, (error) => {
|
|
804
|
-
|
|
837
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
838
|
+
if (process.argv[2] === 'why' && process.argv.slice(3).some(arg => arg === 'json' || arg === '--json')) {
|
|
839
|
+
process.stdout.write(JSON.stringify({ version: version_1.BURN_VERSION, found: false, error: message }) + '\n');
|
|
840
|
+
}
|
|
841
|
+
else
|
|
842
|
+
process.stderr.write(message + '\n');
|
|
805
843
|
exit(4);
|
|
806
844
|
});
|
|
@@ -26,6 +26,7 @@ exports.drawCalendar = drawCalendar;
|
|
|
26
26
|
* bar, while ▇ leaves a thin gap above each day and the grid reads as squares.
|
|
27
27
|
*/
|
|
28
28
|
const canvas_1 = require("../canvas");
|
|
29
|
+
const version_1 = require("../version");
|
|
29
30
|
const calendar_1 = require("./calendar");
|
|
30
31
|
const i18n_1 = require("./i18n");
|
|
31
32
|
const live_1 = require("./live");
|
|
@@ -144,7 +145,7 @@ function calendarLines(report, lang, columns, skin) {
|
|
|
144
145
|
const lines = [];
|
|
145
146
|
const paragraph = (value, color, indent = '') => { for (const line of wrap(value, width, indent))
|
|
146
147
|
lines.push([segment(line, color)]); };
|
|
147
|
-
paragraph(text.title(text.span(dateOf(report.from, text), dateOf(report.to, text)))
|
|
148
|
+
paragraph(`Burn ${version_1.BURN_VERSION} | ${text.title(text.span(dateOf(report.from, text), dateOf(report.to, text)))}`, 'mint');
|
|
148
149
|
if (report.firstRecordedDay === null) {
|
|
149
150
|
paragraph(text.noData, 'white');
|
|
150
151
|
return lines;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** No sessions is a successful first-run report, not a command failure. */
|
|
2
|
+
export declare const NO_SESSIONS_EXIT_CODE = 0;
|
|
3
|
+
export declare const NO_SESSIONS_MESSAGE = "No Claude Code or Codex sessions found on this computer yet.";
|
|
4
|
+
export declare const NO_SESSIONS_NEXT: string;
|
|
5
|
+
export declare function noSessionsReport(lookedIn: string[]): {
|
|
6
|
+
version: string;
|
|
7
|
+
found: false;
|
|
8
|
+
looked_in: string[];
|
|
9
|
+
message: string;
|
|
10
|
+
next: string;
|
|
11
|
+
};
|
|
12
|
+
export declare function renderNoSessions(lookedIn: string[]): string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NO_SESSIONS_NEXT = exports.NO_SESSIONS_MESSAGE = exports.NO_SESSIONS_EXIT_CODE = void 0;
|
|
4
|
+
exports.noSessionsReport = noSessionsReport;
|
|
5
|
+
exports.renderNoSessions = renderNoSessions;
|
|
6
|
+
const version_1 = require("../version");
|
|
7
|
+
/** No sessions is a successful first-run report, not a command failure. */
|
|
8
|
+
exports.NO_SESSIONS_EXIT_CODE = 0;
|
|
9
|
+
exports.NO_SESSIONS_MESSAGE = 'No Claude Code or Codex sessions found on this computer yet.';
|
|
10
|
+
exports.NO_SESSIONS_NEXT = 'Next: if you use Claude Code on another computer, run this there.\n'
|
|
11
|
+
+ 'If Claude Code is new here, use it for a few minutes, then run npx agentguard-burn why again.';
|
|
12
|
+
function noSessionsReport(lookedIn) {
|
|
13
|
+
return { version: version_1.BURN_VERSION, found: false, looked_in: lookedIn, message: exports.NO_SESSIONS_MESSAGE, next: exports.NO_SESSIONS_NEXT };
|
|
14
|
+
}
|
|
15
|
+
function renderNoSessions(lookedIn) {
|
|
16
|
+
return `Burn ${version_1.BURN_VERSION}\n${exports.NO_SESSIONS_MESSAGE}\nBurn looked in ${lookedIn.join(' and ')}.\n${exports.NO_SESSIONS_NEXT}\n`;
|
|
17
|
+
}
|
|
@@ -26,6 +26,7 @@ const attribution_1 = require("./attribution");
|
|
|
26
26
|
const pricing_1 = require("./pricing");
|
|
27
27
|
const live_1 = require("./live");
|
|
28
28
|
const transcript_1 = require("./transcript");
|
|
29
|
+
const version_1 = require("../version");
|
|
29
30
|
const types_1 = require("./types");
|
|
30
31
|
const i18n_1 = require("./i18n");
|
|
31
32
|
const stop_text_1 = require("../stop-text");
|
|
@@ -329,7 +330,7 @@ function renderWhy(transcript, rates = {}, options = {}) {
|
|
|
329
330
|
const money = (value) => (0, live_1.dollars)(value, text);
|
|
330
331
|
if (transcript.state.forkHistoryBoundaryUnknown)
|
|
331
332
|
return [
|
|
332
|
-
`AgentGuard why: ${transcript.sessionId}`,
|
|
333
|
+
`Burn ${version_1.BURN_VERSION} | AgentGuard why: ${transcript.sessionId}`,
|
|
333
334
|
text.forkUnavailable,
|
|
334
335
|
table(text.headers, types_1.INSIGHT_BUCKETS.map(bucket => [text.labels[bucket], text.unattributed, text.unattributed, text.unattributed, text.unattributed])),
|
|
335
336
|
...(options.commits ? ['', text.bought(options.commits, transcript.host, null)] : []),
|
|
@@ -354,7 +355,7 @@ function renderWhy(transcript, rates = {}, options = {}) {
|
|
|
354
355
|
const perCommit = options.commits ? tokensPerCommit(attribution.totalTokens, options.commits) : null;
|
|
355
356
|
const bought = options.commits ? text.bought(options.commits, transcript.host, perCommit === null ? null : (0, exports.count)(perCommit)) : null;
|
|
356
357
|
return [
|
|
357
|
-
`AgentGuard why: ${transcript.sessionId}`,
|
|
358
|
+
`Burn ${version_1.BURN_VERSION} | AgentGuard why: ${transcript.sessionId}`,
|
|
358
359
|
text.summary(turns.length, (0, exports.count)(attribution.totalTokens), totalUsd === null ? null : money(totalUsd)),
|
|
359
360
|
text.usage((0, exports.count)(totals.input), (0, exports.count)(totals.write), (0, exports.count)(totals.read), (0, exports.count)(totals.output)),
|
|
360
361
|
'', table(text.headers, rows), '',
|
|
@@ -9,6 +9,10 @@ export declare function transcriptRoots(): {
|
|
|
9
9
|
claude: string;
|
|
10
10
|
codex: string;
|
|
11
11
|
};
|
|
12
|
+
export declare class NoSessionsFoundError extends Error {
|
|
13
|
+
readonly lookedIn: string[];
|
|
14
|
+
constructor(lookedIn: string[]);
|
|
15
|
+
}
|
|
12
16
|
/** Local locators only. Never follows directory symlinks or reads message content. */
|
|
13
17
|
export declare function discoverInsightTranscripts(roots?: {
|
|
14
18
|
claude: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NoSessionsFoundError = void 0;
|
|
3
4
|
exports.transcriptRoots = transcriptRoots;
|
|
4
5
|
exports.discoverInsightTranscripts = discoverInsightTranscripts;
|
|
5
6
|
exports.transcriptFileLocation = transcriptFileLocation;
|
|
@@ -11,10 +12,22 @@ const node_fs_1 = require("node:fs");
|
|
|
11
12
|
const node_path_1 = require("node:path");
|
|
12
13
|
const node_os_1 = require("node:os");
|
|
13
14
|
const transcript_1 = require("./transcript");
|
|
15
|
+
const first_run_1 = require("./first-run");
|
|
14
16
|
/** Claude Code keeps one directory per project here, each session a JSONL file directly inside it; Codex keeps dated rollouts. */
|
|
15
17
|
function transcriptRoots() {
|
|
16
|
-
return {
|
|
18
|
+
return {
|
|
19
|
+
claude: (0, node_path_1.resolve)(process.env.CLAUDE_CONFIG_DIR || (0, node_path_1.join)((0, node_os_1.homedir)(), '.claude'), 'projects'),
|
|
20
|
+
codex: (0, node_path_1.resolve)(process.env.CODEX_HOME || (0, node_path_1.join)((0, node_os_1.homedir)(), '.codex'), 'sessions'),
|
|
21
|
+
};
|
|
17
22
|
}
|
|
23
|
+
class NoSessionsFoundError extends Error {
|
|
24
|
+
lookedIn;
|
|
25
|
+
constructor(lookedIn) {
|
|
26
|
+
super(first_run_1.NO_SESSIONS_MESSAGE);
|
|
27
|
+
this.lookedIn = lookedIn;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.NoSessionsFoundError = NoSessionsFoundError;
|
|
18
31
|
/** Local locators only. Never follows directory symlinks or reads message content. */
|
|
19
32
|
function discoverInsightTranscripts(roots = transcriptRoots()) {
|
|
20
33
|
const found = [];
|
|
@@ -60,7 +73,10 @@ function selectInsightTranscript(session, locations) {
|
|
|
60
73
|
const file = requested ? transcriptFileLocation(requested) : null;
|
|
61
74
|
if (file)
|
|
62
75
|
return file;
|
|
63
|
-
const
|
|
76
|
+
const roots = transcriptRoots();
|
|
77
|
+
const candidates = locations ?? discoverInsightTranscripts(roots);
|
|
78
|
+
if (!session && candidates.length === 0)
|
|
79
|
+
throw new NoSessionsFoundError(Object.values(roots));
|
|
64
80
|
// With nothing requested, the newest top-level session wins. A subagent's own
|
|
65
81
|
// transcript (Claude Code keeps them under <session>/subagents/agent-*.jsonl) is
|
|
66
82
|
// often the newest file on disk, and read alone it reports 100% fan-out and
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentguard-run/burn",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
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",
|