@agentguard-run/burn 0.4.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 +19 -0
- package/README.md +85 -9
- package/dist/src/cli.js +120 -24
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +10 -1
- 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/i18n.d.ts +1 -0
- package/dist/src/insights/i18n.js +9 -7
- package/dist/src/insights/pricing.js +8 -2
- 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/insights/status-data.d.ts +6 -0
- package/dist/src/insights/status-data.js +65 -0
- package/dist/src/insights/status-fields.d.ts +74 -0
- package/dist/src/insights/status-fields.js +136 -0
- package/dist/src/insights/status-text.d.ts +107 -0
- package/dist/src/insights/status-text.js +36 -0
- package/dist/src/insights/tally.d.ts +3 -1
- package/dist/src/insights/tally.js +2 -2
- package/dist/src/telemetry-cli.d.ts +5 -0
- package/dist/src/telemetry-cli.js +57 -0
- package/dist/src/version.d.ts +2 -0
- package/dist/src/version.js +5 -0
- package/docs/USAGE_AND_PRICING.md +4 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
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
|
+
|
|
14
|
+
## 0.5.0 (2026-10-07)
|
|
15
|
+
|
|
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.
|
|
17
|
+
- Claude Sonnet 5.5 cache reads drop to 0.1 USD per million tokens (0.05x base input), per Anthropic's October 7, 2026 change. Burn prices sessions at the current list price, so earlier Sonnet 5.5 sessions are repriced too.
|
|
18
|
+
- Offer one optional anonymous count after a successful interactive why report, sharing Spend consent and install ID; add telemetry controls and a query-free Next link.
|
|
19
|
+
|
|
20
|
+
- Add optional pace, API list cost, prefix rewrite and daily Spend status fields with a shared formatter, width fitting, panel details and localized Burn labels.
|
|
21
|
+
|
|
3
22
|
## 0.4.0 (2026-10-05)
|
|
4
23
|
|
|
5
24
|
- Add recorded launch trees and signed approval tallies. Tree shows active time
|
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
|
-
|
|
12
|
-
|
|
12
|
+
npx agentguard-burn why # your last session
|
|
13
|
+
npx agentguard-burn calendar # every day
|
|
14
|
+
npx agentguard-burn card # an image to share
|
|
15
|
+
```
|
|
16
|
+
|
|
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.
|
|
20
|
+
|
|
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.
|
|
13
30
|
```
|
|
14
31
|
|
|
15
|
-
|
|
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.
|
|
16
33
|
|
|
17
|
-
`agentguard-burn --version`
|
|
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
|
|
@@ -749,7 +772,7 @@ A provenance JSON beside the requested MP4 records the source recording's SHA256
|
|
|
749
772
|
|
|
750
773
|
Runtime observation and enforcement do not persist or render prompts, responses, file contents or tool inputs. The explicit developer `guard-candidates` command copies shell text already present in a ledger into a private review; only its `--rank` option can send that text to the selected provider.
|
|
751
774
|
`why` runs git only with `--commits`, and then reads commit hashes, times and co-author trailers on this computer and prints counts alone.
|
|
752
|
-
|
|
775
|
+
Status and pace make no telemetry calls. No provider-quota guesses. Account forecasts use only observed host percentages, never an invented allowance or cache weighting.
|
|
753
776
|
|
|
754
777
|
### Local live panel
|
|
755
778
|
|
|
@@ -787,3 +810,56 @@ output or transcript content. See [the live panel and September 20 evidence](doc
|
|
|
787
810
|
`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.
|
|
788
811
|
|
|
789
812
|
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.
|
|
813
|
+
|
|
814
|
+
## Status line fields
|
|
815
|
+
|
|
816
|
+
The status line always starts with AgentGuard. Its default items remain sub-agent launches, session tokens, the token share sent to sub-agents when known, and plan usage when the host reports it. Optional fields use the same formatter in Burn and the Claude Code plugin. They read local transcripts, host usage and signed Spend files only. Codex has no external status slot.
|
|
817
|
+
|
|
818
|
+
Set `status_fields` to `pace,cost,cache,spend` in the plugin settings. Burn accepts the same comma list in `AGENTGUARD_STATUS_FIELDS`, or through the fields flag, which takes precedence even when empty. Unknown names are ignored, with one warning in the plugin panel. The default is empty.
|
|
819
|
+
|
|
820
|
+
- `pace` projects the time until the reported plan limit, using at least two rising samples from the last ten minutes, only when that limit would be reached before reset.
|
|
821
|
+
- `cost` estimates this session at Burn's API list prices, including recorded child sessions, and remains opt-in even without host plan limits.
|
|
822
|
+
- `cache` shows cache-write tokens attributed by Burn to large prefix rewrites in this session and their API list price estimate when available.
|
|
823
|
+
- `spend` shows today's signed local spend against an unscoped daily policy cap, only when both the local JSON policy and its verified ledger can be read.
|
|
824
|
+
|
|
825
|
+
Examples on a wide terminal:
|
|
826
|
+
|
|
827
|
+
```text
|
|
828
|
+
AgentGuard sub-agents 2 of 40 · tokens 686M of 5B · 33% to sub-agents · 5-hour 44% · limit in ~1h40m · /agentguard
|
|
829
|
+
AgentGuard sub-agents 2 of 40 · tokens 686M of 5B · 33% to sub-agents · 5-hour 44% · ≈$12.40 list · /agentguard
|
|
830
|
+
AgentGuard sub-agents 2 of 40 · tokens 686M of 5B · 33% to sub-agents · 5-hour 44% · cache waste 42M (≈$9.00 list) · /agentguard
|
|
831
|
+
AgentGuard sub-agents 2 of 40 · tokens 686M of 5B · 33% to sub-agents · 5-hour 44% · spend $3.20 of $10.00 list today · /agentguard
|
|
832
|
+
```
|
|
833
|
+
|
|
834
|
+
Dollar figures are API list price estimates, not a bill. Spend displays the cents recorded by the local policy, which may use configured unit prices. Pace rounds to ten minutes, always starts with `~`, and turns yellow below thirty minutes. Usage turns yellow at 70% and red at 90%, including daily spend. Optional fields are removed in this order when space runs out: pace, cost, cache, spend. Default labels then shorten so the line fits without wrapping. Open `/agentguard` for full values, reset times, enabled fields and any unknown-name warning. Extremely narrow slots clip the row; all values remain in the panel.
|
|
835
|
+
|
|
836
|
+
The Claude usage API reports context, rate-limit windows and a host cost value. Its API-key window behavior is not guaranteed by the reference or the installed host implementation, so cost does not become an automatic default. The cost field uses Burn's local price table, not that host cost value. Daily spend reads a local scope-wide JSON policy, verifies its signed ledger and uses UTC day boundaries. Selector-only caps, unreadable ledgers or failed signature checks and policies held only by a remote or in-memory application stay unavailable.
|
|
837
|
+
|
|
838
|
+
## Anonymous count (opt-in)
|
|
839
|
+
|
|
840
|
+
After the first successful interactive `why` report, Burn can ask once:
|
|
841
|
+
|
|
842
|
+
```text
|
|
843
|
+
Help us count real users? Sends one anonymous ping (random ID, Burn version, OS). Never your prompts, files or usage. [y/N]
|
|
844
|
+
```
|
|
845
|
+
|
|
846
|
+
Only `y` or `yes` enables counting. Enter, anything else or fifteen seconds without an answer records no. The report prints before the question. CI, noninteractive terminals, library imports and hooks never ask or send a Burn count. Consent and the anonymous install ID share Spend's local `install.json` under `AGENTGUARD_HOME` or the usual AgentGuard home. An existing shared consent decision or explicit environment switch is respected without another question.
|
|
847
|
+
|
|
848
|
+
A yes permits one best-effort attempt per install to `https://agentguard.run/api/beacon`, with a one-second timeout and ignored errors. It sends exactly these fields:
|
|
849
|
+
|
|
850
|
+
```json
|
|
851
|
+
{
|
|
852
|
+
"event": "burn_first_report",
|
|
853
|
+
"sdk_name": "@agentguard-run/burn",
|
|
854
|
+
"sdk_version": "<Burn version>",
|
|
855
|
+
"runtime": "<Node version>",
|
|
856
|
+
"os_family": "<OS family>",
|
|
857
|
+
"anonymous_install_id": "<random UUID shared with Spend>",
|
|
858
|
+
"ci_env_detected": false,
|
|
859
|
+
"tty": true
|
|
860
|
+
}
|
|
861
|
+
```
|
|
862
|
+
|
|
863
|
+
No prompts, files, paths, session IDs, model names or token counts are sent. Run `agentguard-burn telemetry status`, `agentguard-burn telemetry on` or `agentguard-burn telemetry off` to inspect or change the shared choice. `AGENTGUARD_TELEMETRY=1` enables it; `AGENTGUARD_NO_BEACON=1` always disables it, overriding every other setting. An attempted event stays marked so a network failure never causes repeated pings. Failed or missing local state makes counting best effort, never a requirement to use Burn.
|
|
864
|
+
|
|
865
|
+
The Next link is `https://agentguard.run/burn/next`, without query strings or an install ID. Opening it is an ordinary website visit and needs no CLI ping. See the [privacy page](https://agentguard.run/legal/privacy#anonymous-count) for server counting and retention.
|
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");
|
|
@@ -87,7 +89,11 @@ const i18n_1 = require("./insights/i18n");
|
|
|
87
89
|
const ttl_1 = require("./insights/ttl");
|
|
88
90
|
const blocks_1 = require("./insights/blocks");
|
|
89
91
|
const cli_1 = require("./idle/cli");
|
|
92
|
+
const telemetry_cli_1 = require("./telemetry-cli");
|
|
93
|
+
const status_fields_1 = require("./insights/status-fields");
|
|
94
|
+
const status_data_1 = require("./insights/status-data");
|
|
90
95
|
const HOME = process.env.AGENTGUARD_HOME ?? (0, node_path_1.join)((0, node_os_1.homedir)(), '.agentguard');
|
|
96
|
+
let finishReportNaturally = false;
|
|
91
97
|
const PROXY_HOSTS = ['ollama', 'vllm', 'lm-studio', 'openai-compatible'];
|
|
92
98
|
/** The same flag file the AgentGuard plugin reads (runtime/upgrade-moments.cjs), so one switch silences both. */
|
|
93
99
|
const quietOn = () => (0, node_fs_1.existsSync)((0, upgrade_moments_1.quietFile)(HOME));
|
|
@@ -138,6 +144,11 @@ async function main(argv) {
|
|
|
138
144
|
const noColor = rawRest.includes('--no-color');
|
|
139
145
|
const rest = rawRest.filter(value => value !== '--no-color');
|
|
140
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
|
+
};
|
|
141
152
|
const flag = (name) => {
|
|
142
153
|
const i = rest.indexOf(name);
|
|
143
154
|
return i >= 0 ? rest[i + 1] : undefined;
|
|
@@ -147,7 +158,7 @@ async function main(argv) {
|
|
|
147
158
|
case '--version':
|
|
148
159
|
case '-v':
|
|
149
160
|
// The version of this install, from the package that ships it, and nothing else.
|
|
150
|
-
process.stdout.write(`${
|
|
161
|
+
process.stdout.write(`${version_1.BURN_VERSION}\n`);
|
|
151
162
|
return 0;
|
|
152
163
|
case 'live': {
|
|
153
164
|
const { runLivePanel } = await Promise.resolve().then(() => __importStar(require('./live-panel')));
|
|
@@ -237,6 +248,7 @@ async function main(argv) {
|
|
|
237
248
|
return 0;
|
|
238
249
|
}
|
|
239
250
|
case 'why': {
|
|
251
|
+
const json = rest.includes('json') || rest.includes('--json');
|
|
240
252
|
// `--lang en|es|pt` (or --lang=es) picks the report's language and is never a session selector.
|
|
241
253
|
// `--commits` adds the commits that landed while the session ran. It is the only way `why` runs git.
|
|
242
254
|
const args = [];
|
|
@@ -255,20 +267,37 @@ async function main(argv) {
|
|
|
255
267
|
else
|
|
256
268
|
args.push(rest[i]);
|
|
257
269
|
}
|
|
258
|
-
|
|
259
|
-
|
|
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');
|
|
260
277
|
return 64;
|
|
261
278
|
}
|
|
262
|
-
|
|
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
|
+
}
|
|
263
288
|
const transcript = (0, transcript_1.readInsightSession)(location.path, { host: location.host, sessionId: location.sessionId });
|
|
264
|
-
const json = args.includes('json') || args.includes('--json');
|
|
265
289
|
// The commits reader is loaded only with the flag, so a plain `why` never reaches it.
|
|
266
290
|
const commits = withCommits ? await (await Promise.resolve().then(() => __importStar(require('./insights/commits')))).sessionCommits({ path: location.path }) : undefined;
|
|
267
291
|
const launchTree = (0, tree_1.readLaunchTree)(location);
|
|
268
292
|
const treeSection = launchTree.root.children.length || launchTree.unlinked.length ? '\n\n' + (0, tree_1.renderLaunchTree)(launchTree, true) : '';
|
|
269
293
|
const commitsValue = commits ? (0, render_2.commitsJson)(commits, transcript.state.forkHistoryBoundaryUnknown ? null : (0, render_2.sessionFigures)(transcript).attribution.totalTokens) : undefined;
|
|
270
|
-
|
|
271
|
-
|
|
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);
|
|
297
|
+
if (require.main === module && !json && transcript.turns.length) {
|
|
298
|
+
finishReportNaturally = true;
|
|
299
|
+
await (0, telemetry_cli_1.countFirstReport)(version_1.BURN_VERSION);
|
|
300
|
+
}
|
|
272
301
|
return 0;
|
|
273
302
|
}
|
|
274
303
|
case 'compare': {
|
|
@@ -339,11 +368,14 @@ async function main(argv) {
|
|
|
339
368
|
const { renderCalendar } = await Promise.resolve().then(() => __importStar(require('./insights/calendar-render')));
|
|
340
369
|
// The span fits the terminal: its columns on a TTY, 80 when piped.
|
|
341
370
|
const columns = process.stdout.isTTY && (process.stdout.columns ?? 0) > 0 ? process.stdout.columns : 80;
|
|
342
|
-
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);
|
|
343
375
|
if (!data.saved)
|
|
344
376
|
process.stderr.write(i18n_1.CALENDAR_TEXT[language].saveFailed + '\n');
|
|
345
377
|
const report = calendarReport(data, { now: Date.now(), columns, ...(weeks ? { weeks } : {}) });
|
|
346
|
-
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);
|
|
347
379
|
return 0;
|
|
348
380
|
}
|
|
349
381
|
case 'card': {
|
|
@@ -367,13 +399,16 @@ async function main(argv) {
|
|
|
367
399
|
return 64;
|
|
368
400
|
}
|
|
369
401
|
const { calendarReport, collectCalendar } = await Promise.resolve().then(() => __importStar(require('./insights/calendar')));
|
|
370
|
-
const
|
|
371
|
-
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));
|
|
372
406
|
const report = calendarReport(data, { now: Date.now(), weeks });
|
|
373
407
|
if (!(report.totals.tokens > 0)) {
|
|
374
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');
|
|
375
409
|
return 1;
|
|
376
410
|
}
|
|
411
|
+
const { cardModel, renderCard } = await Promise.resolve().then(() => __importStar(require('./insights/card')));
|
|
377
412
|
(0, node_fs_1.writeFileSync)(out, await renderCard(cardModel(report)));
|
|
378
413
|
process.stdout.write(`Card saved: ${out} (1200x675). Dollars on it are API list prices, not a bill; nothing was uploaded.\n`);
|
|
379
414
|
return 0;
|
|
@@ -411,13 +446,55 @@ async function main(argv) {
|
|
|
411
446
|
show({ kind: 'command', command, values: { rates: { ...pricing_1.MODEL_PRICING, ...rates } } }, (0, render_2.renderPricing)(rates) + '\n');
|
|
412
447
|
return 0;
|
|
413
448
|
}
|
|
414
|
-
case '
|
|
449
|
+
case 'telemetry': return (0, telemetry_cli_1.telemetryCommand)(rest);
|
|
450
|
+
case 'statusline': {
|
|
451
|
+
let fields = process.env.AGENTGUARD_STATUS_FIELDS ?? '', lang;
|
|
452
|
+
const selectors = [];
|
|
453
|
+
for (let i = 0; i < rest.length; i++) {
|
|
454
|
+
if (rest[i] === '--fields')
|
|
455
|
+
fields = rest[++i] ?? '';
|
|
456
|
+
else if (rest[i].startsWith('--fields='))
|
|
457
|
+
fields = rest[i].slice(9);
|
|
458
|
+
else if (rest[i] === '--lang')
|
|
459
|
+
lang = rest[++i];
|
|
460
|
+
else if (rest[i].startsWith('--lang='))
|
|
461
|
+
lang = rest[i].slice(7);
|
|
462
|
+
else
|
|
463
|
+
selectors.push(rest[i]);
|
|
464
|
+
}
|
|
465
|
+
const raw = !process.stdin.isTTY ? readStdinJson() : null;
|
|
466
|
+
const payload = (raw && typeof raw === 'object' ? raw : {});
|
|
467
|
+
const width = payload.columns ?? payload.terminal_width ?? process.stdout.columns ?? Number(process.env.COLUMNS || 80);
|
|
468
|
+
let location;
|
|
469
|
+
try {
|
|
470
|
+
location = (0, sessions_1.selectInsightTranscript)(payload.transcript_path || selectors[0] || payload.session_id);
|
|
471
|
+
}
|
|
472
|
+
catch {
|
|
473
|
+
process.stdout.write((0, status_fields_1.formatStatusFields)({ fields, width, failed: true }).text + '\n');
|
|
474
|
+
return 0;
|
|
475
|
+
}
|
|
476
|
+
const session = payload.session_id || location.sessionId;
|
|
477
|
+
const observation = (0, live_1.observeTool)(HOME, { ...payload, session_id: session, transcript_path: location.path }, location.host, (0, pre_tool_use_1.loadPolicy)(HOME));
|
|
478
|
+
const metrics = await (0, status_data_1.readStatusMetrics)(HOME, location.path, fields, process.env.PLUGIN_DATA || process.env.CLAUDE_PLUGIN_DATA, true);
|
|
479
|
+
const burn = (0, status_data_1.readStatusBurn)(HOME, session);
|
|
480
|
+
if (!(0, node_fs_1.existsSync)((0, node_path_1.join)(HOME, 'sessions')) && metrics.totalTokens !== undefined)
|
|
481
|
+
burn.tokens.used = metrics.totalTokens;
|
|
482
|
+
const formatted = (0, status_fields_1.formatStatusFields)({ ...metrics, burn, fields, windows: observation.snapshot?.windows,
|
|
483
|
+
width,
|
|
484
|
+
lang: (0, i18n_1.detectWhyLang)({ flag: lang, env: process.env, intlLocale: intlLocale() }) });
|
|
485
|
+
const line = process.env.NO_COLOR !== undefined || noColor || formatted.clipped ? formatted.text : formatted.parts.map(part => {
|
|
486
|
+
const code = part.color === 'red' ? 31 : part.color === 'yellow' ? 33 : part.dim ? 2 : 0;
|
|
487
|
+
return code ? `\x1b[${code}m${part.text}\x1b[0m` : part.text;
|
|
488
|
+
}).join('');
|
|
489
|
+
show({ kind: 'command', command, values: { fields: formatted.enabled } }, line + '\n', true);
|
|
490
|
+
return 0;
|
|
491
|
+
}
|
|
415
492
|
case 'pace': {
|
|
416
|
-
const raw =
|
|
493
|
+
const raw = null;
|
|
417
494
|
const payload = raw && typeof raw === 'object' ? raw : {};
|
|
418
495
|
const location = (0, sessions_1.selectInsightTranscript)(payload.transcript_path || rest[0] || payload.session_id);
|
|
419
496
|
const observation = (0, live_1.observeTool)(HOME, { ...payload, session_id: payload.session_id || location.sessionId, transcript_path: location.path }, location.host, (0, pre_tool_use_1.loadPolicy)(HOME));
|
|
420
|
-
show({ kind: 'command', command, values: { snapshot: observation.snapshot ? { host: observation.snapshot.host, session: observation.snapshot.sessionId, pace: observation.snapshot.pace, forecast: observation.snapshot.forecast, lastTurnTokens: observation.snapshot.lastTurnTokens, windows: observation.snapshot.windows } : null } }, (observation.snapshot ? (0, live_1.renderStatusLine)(observation.snapshot) : 'AgentGuard pace unavailable: local usage metadata is not readable.') + '\n'
|
|
497
|
+
show({ kind: 'command', command, values: { snapshot: observation.snapshot ? { host: observation.snapshot.host, session: observation.snapshot.sessionId, pace: observation.snapshot.pace, forecast: observation.snapshot.forecast, lastTurnTokens: observation.snapshot.lastTurnTokens, windows: observation.snapshot.windows } : null } }, (observation.snapshot ? (0, live_1.renderStatusLine)(observation.snapshot) : 'AgentGuard pace unavailable: local usage metadata is not readable.') + '\n');
|
|
421
498
|
return observation.snapshot ? 0 : 1;
|
|
422
499
|
}
|
|
423
500
|
case 'hook': {
|
|
@@ -643,8 +720,13 @@ async function main(argv) {
|
|
|
643
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`);
|
|
644
721
|
return 0;
|
|
645
722
|
}
|
|
646
|
-
default:
|
|
647
|
-
|
|
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' +
|
|
648
730
|
' ps [--json] local agent processes, held memory and workspace disk\n' +
|
|
649
731
|
' render <run.jsonl> --mp4 <out.mp4> [--gif <out.gif>] [--phone] local recorded-run export\n' +
|
|
650
732
|
' render <run.jsonl> --mp4 <out.mp4> --dashboard [--wide] [--economics <blocks.json>] dashboard export\n' +
|
|
@@ -666,11 +748,12 @@ async function main(argv) {
|
|
|
666
748
|
' rewrites [session|all] every full-prefix cache write with its cause, idle gap and list price\n' +
|
|
667
749
|
' ttl [session|all] one-hour cache lifetime counterfactual from your own idle gaps\n' +
|
|
668
750
|
' pace [session] ten-minute pace and next-hour projection\n' +
|
|
669
|
-
' statusline [session] one
|
|
751
|
+
' statusline [session] one local status line; fields via AGENTGUARD_STATUS_FIELDS or the fields flag\n' +
|
|
752
|
+
' telemetry status|on|off shared anonymous count preference\n' +
|
|
670
753
|
' pricing verified model rates and local overrides\n' +
|
|
671
754
|
' replay [files...] [--json] [--top N] [--min-tokens N]\n' +
|
|
672
755
|
' import-bench <run-dir> [--out <directory>] [--publisher-key-id ID] verify and convert a signed bundle\n' +
|
|
673
|
-
' replay <replay.json> --pricing <snapshot.json> [--json]
|
|
756
|
+
' replay <replay.json> --pricing <snapshot.json> [--json] replay a saved run with its original prices\n' +
|
|
674
757
|
' calibrate fit thresholds to your history (writes shadow policy)\n' +
|
|
675
758
|
' status mode, shadow observations, eligibility, hook health, every host\n' +
|
|
676
759
|
' init [claude|cursor|codex] [--write] print the hook snippet, or merge it into the config (with a backup)\n' +
|
|
@@ -680,11 +763,12 @@ async function main(argv) {
|
|
|
680
763
|
' resume --reason "..." let STOPs through for 15 minutes; --clear ends it\n' +
|
|
681
764
|
' quiet [on|off] hide or show the why tip and the plugin upgrade lines; alone, says which\n' +
|
|
682
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' +
|
|
683
|
-
' conformance
|
|
766
|
+
' conformance check that each host stops the same runaway patterns\n' +
|
|
684
767
|
'Developer review commands (never installed as hooks):\n' +
|
|
685
768
|
' guard-candidates [--ledger <local.ndjson>] [--out <name.review.json>] [--rank]\n' +
|
|
686
|
-
'
|
|
769
|
+
' group recorded commands; --rank sends them to an external ranking service\n', true);
|
|
687
770
|
return !command || command === 'help' || command === '--help' || command === '-h' ? 0 : 64;
|
|
771
|
+
}
|
|
688
772
|
}
|
|
689
773
|
}
|
|
690
774
|
async function run() {
|
|
@@ -742,7 +826,19 @@ function exit(code) {
|
|
|
742
826
|
process.stdout.write('', done);
|
|
743
827
|
process.stderr.write('', done);
|
|
744
828
|
}
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
829
|
+
if (require.main === module)
|
|
830
|
+
run().then(
|
|
831
|
+
// Let the best-effort count request finish within its one-second deadline.
|
|
832
|
+
// The report has already been printed, and Node drains stdout on natural exit.
|
|
833
|
+
(code) => { if (finishReportNaturally)
|
|
834
|
+
process.exitCode = code;
|
|
835
|
+
else
|
|
836
|
+
exit(code); }, (error) => {
|
|
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');
|
|
843
|
+
exit(4);
|
|
844
|
+
});
|
package/dist/src/index.d.ts
CHANGED
|
@@ -30,3 +30,5 @@ export { readHookSessions, renderHostHealth } from './status';
|
|
|
30
30
|
export { findingSignature, inflateHookSession, type PersistedSession } from './hook/pre-tool-use';
|
|
31
31
|
export { readLaunchTree, readLaunchTreeWithReceipts, buildLaunchTree, renderLaunchTree } from './insights/tree';
|
|
32
32
|
export { sessionTally, tallyEntries, readLedgerTallies, readLedgerDailyTallies, renderSessionTally, pluginLedgerDirectories, sessionLaunchReceipts, type SessionTally, type TallyCounts } from './insights/tally';
|
|
33
|
+
export { formatStatusFields, parseStatusFields, statusPace, statusColor, type StatusInput, type StatusMetrics } from './insights/status-fields';
|
|
34
|
+
export { readStatusBurn, readStatusMetrics } from './insights/status-data';
|
package/dist/src/index.js
CHANGED
|
@@ -15,7 +15,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.agentOverrideAttempt = exports.asksPerson = exports.settingsSnippet = exports.loadPolicy = exports.refreshSession = exports.handlePreToolUse = exports.calibrate = exports.OVERRIDE_COMMAND = exports.stopSummary = exports.sessionSoFar = exports.primarySummary = exports.overriddenLine = exports.continueLines = exports.askReason = exports.renderStop = exports.renderReplay = exports.discoverTranscripts = exports.replayEvents = exports.replaySession = exports.replayAll = exports.RESERVATION_TTL_MS = exports.Transaction = exports.ReservationStore = exports.cacheReadRatio = exports.medianCompletedMinute = exports.windowSum = exports.newSessionState = exports.applyCorrection = exports.applyEvent = exports.checkPolicyFile = exports.sessionTip = exports.MIN_FINISHED_SUBAGENTS = exports.decisionCostLine = exports.subagentCostLine = exports.finishedSubagents = exports.cloneReaderCursor = exports.restoreReaderCursor = exports.saveReaderCursor = exports.readSessionIncremental = exports.normaliseLine = exports.newCursor = exports.readAll = exports.readIncremental = exports.evaluateLocalCompute = exports.fmt = exports.evaluate = exports.CALL_RESERVATION_TTL_MS = exports.DEFAULT_LOCAL_COMPUTE = exports.DEFAULT_THRESHOLDS = exports.DEFAULT_POLICY = void 0;
|
|
18
|
-
exports.sessionLaunchReceipts = exports.pluginLedgerDirectories = exports.renderSessionTally = exports.readLedgerDailyTallies = exports.readLedgerTallies = exports.tallyEntries = exports.sessionTally = exports.renderLaunchTree = exports.buildLaunchTree = exports.readLaunchTreeWithReceipts = exports.readLaunchTree = exports.inflateHookSession = exports.findingSignature = exports.renderHostHealth = exports.readHookSessions = exports.configPath = exports.health = exports.install = exports.OVERRIDE_WINDOW_MS = exports.clearOverride = exports.consumeOverride = exports.readOverride = exports.writeOverride = exports.runConformance = exports.renderMachineStatus = exports.UsageObserver = exports.profileFor = exports.startProxy = exports.LAUNCH_TOOLS = exports.isLaunchTool = exports.CODEX_FORBIDDEN_FIELDS = exports.readCodexTranscriptUsage = exports.parseCodexTranscript = exports.codexHooksSnippet = exports.handleCodexHook = exports.cursorHooksSnippet = exports.handleCursorHook = exports.BurnStopError = exports.createRawApiGuard = exports.sha256 = exports.canonical = exports.readSpawnAdmission = exports.receiptDigest = exports.verifyReceipt = exports.ReceiptSigner = exports.mergeCapabilities = exports.Gateway = exports.AGENT_OVERRIDE_REASON = void 0;
|
|
18
|
+
exports.parseStatusFields = exports.formatStatusFields = exports.sessionLaunchReceipts = exports.pluginLedgerDirectories = exports.renderSessionTally = exports.readLedgerDailyTallies = exports.readLedgerTallies = exports.tallyEntries = exports.sessionTally = exports.renderLaunchTree = exports.buildLaunchTree = exports.readLaunchTreeWithReceipts = exports.readLaunchTree = exports.inflateHookSession = exports.findingSignature = exports.renderHostHealth = exports.readHookSessions = exports.configPath = exports.health = exports.install = exports.OVERRIDE_WINDOW_MS = exports.clearOverride = exports.consumeOverride = exports.readOverride = exports.writeOverride = exports.runConformance = exports.renderMachineStatus = exports.UsageObserver = exports.profileFor = exports.startProxy = exports.LAUNCH_TOOLS = exports.isLaunchTool = exports.CODEX_FORBIDDEN_FIELDS = exports.readCodexTranscriptUsage = exports.parseCodexTranscript = exports.codexHooksSnippet = exports.handleCodexHook = exports.cursorHooksSnippet = exports.handleCursorHook = exports.BurnStopError = exports.createRawApiGuard = exports.sha256 = exports.canonical = exports.readSpawnAdmission = exports.receiptDigest = exports.verifyReceipt = exports.ReceiptSigner = exports.mergeCapabilities = exports.Gateway = exports.AGENT_OVERRIDE_REASON = void 0;
|
|
19
|
+
exports.readStatusMetrics = exports.readStatusBurn = exports.statusColor = exports.statusPace = void 0;
|
|
19
20
|
__exportStar(require("./types"), exports);
|
|
20
21
|
var defaults_1 = require("./defaults");
|
|
21
22
|
Object.defineProperty(exports, "DEFAULT_POLICY", { enumerable: true, get: function () { return defaults_1.DEFAULT_POLICY; } });
|
|
@@ -150,3 +151,11 @@ Object.defineProperty(exports, "readLedgerDailyTallies", { enumerable: true, get
|
|
|
150
151
|
Object.defineProperty(exports, "renderSessionTally", { enumerable: true, get: function () { return tally_1.renderSessionTally; } });
|
|
151
152
|
Object.defineProperty(exports, "pluginLedgerDirectories", { enumerable: true, get: function () { return tally_1.pluginLedgerDirectories; } });
|
|
152
153
|
Object.defineProperty(exports, "sessionLaunchReceipts", { enumerable: true, get: function () { return tally_1.sessionLaunchReceipts; } });
|
|
154
|
+
var status_fields_1 = require("./insights/status-fields");
|
|
155
|
+
Object.defineProperty(exports, "formatStatusFields", { enumerable: true, get: function () { return status_fields_1.formatStatusFields; } });
|
|
156
|
+
Object.defineProperty(exports, "parseStatusFields", { enumerable: true, get: function () { return status_fields_1.parseStatusFields; } });
|
|
157
|
+
Object.defineProperty(exports, "statusPace", { enumerable: true, get: function () { return status_fields_1.statusPace; } });
|
|
158
|
+
Object.defineProperty(exports, "statusColor", { enumerable: true, get: function () { return status_fields_1.statusColor; } });
|
|
159
|
+
var status_data_1 = require("./insights/status-data");
|
|
160
|
+
Object.defineProperty(exports, "readStatusBurn", { enumerable: true, get: function () { return status_data_1.readStatusBurn; } });
|
|
161
|
+
Object.defineProperty(exports, "readStatusMetrics", { enumerable: true, get: function () { return status_data_1.readStatusMetrics; } });
|
|
@@ -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
|
+
}
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { type CompareMetric, type InsightBucket, type InsightHost, type InsightObservations, type SessionCommits } from './types';
|
|
13
13
|
export type WhyLang = 'en' | 'es' | 'pt';
|
|
14
|
+
export { STATUS_TEXT } from './status-text';
|
|
14
15
|
/**
|
|
15
16
|
* The language of a flag value or locale: the part before '_', '-', '.' or '@',
|
|
16
17
|
* in any case, so es_MX.UTF-8, es-419 and ES are Spanish and pt_BR and pt-PT are
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CALENDAR_TEXT = exports.COMPARE_TEXT = exports.DECISION_TEXT = exports.WHY_TEXT = void 0;
|
|
3
|
+
exports.CALENDAR_TEXT = exports.COMPARE_TEXT = exports.DECISION_TEXT = exports.WHY_TEXT = exports.STATUS_TEXT = void 0;
|
|
4
4
|
exports.whyLangOf = whyLangOf;
|
|
5
5
|
exports.detectWhyLang = detectWhyLang;
|
|
6
6
|
/**
|
|
@@ -15,6 +15,8 @@ exports.detectWhyLang = detectWhyLang;
|
|
|
15
15
|
* locale, and each renderer receives the chosen language as an argument.
|
|
16
16
|
*/
|
|
17
17
|
const types_1 = require("./types");
|
|
18
|
+
var status_text_1 = require("./status-text");
|
|
19
|
+
Object.defineProperty(exports, "STATUS_TEXT", { enumerable: true, get: function () { return status_text_1.STATUS_TEXT; } });
|
|
18
20
|
/**
|
|
19
21
|
* The language of a flag value or locale: the part before '_', '-', '.' or '@',
|
|
20
22
|
* in any case, so es_MX.UTF-8, es-419 and ES are Spanish and pt_BR and pt-PT are
|
|
@@ -89,7 +91,7 @@ const en = {
|
|
|
89
91
|
missingTtl: 'Cache TTL is missing for some writes; their dollars span the verified five-minute and one-hour rates.',
|
|
90
92
|
mixedRanges: 'Some bucket cache-write costs are ranges because mixed cache lifetimes are not attributed to individual buckets. Range endpoints are not additive across buckets.',
|
|
91
93
|
diagnostics: (duplicates, malformed) => `Usage records de-duplicated: ${duplicates}. Malformed lines skipped: ${malformed}.`,
|
|
92
|
-
tipFanout: share => `Next: sub-agents used ${share} of this session's tokens. AgentGuard's free plugin asks you before the next sub-agent past your limit starts: agentguard.run/
|
|
94
|
+
tipFanout: share => `Next: sub-agents used ${share} of this session's tokens. AgentGuard's free plugin asks you before the next sub-agent past your limit starts: https://agentguard.run/burn/next`,
|
|
93
95
|
tipFanoutPlugin: share => `Next: sub-agents used ${share} of this session's tokens. Give related work to one sub-agent instead of several.`,
|
|
94
96
|
tipRewrites: (rewrites, total) => `Next: full-prefix rewrites are ${rewrites} of ${total} API list equivalent here. See the cause of each one: npx agentguard-burn rewrites`,
|
|
95
97
|
tipSubagentModel: (count, model) => `Next: ${count} ${count === 1 ? 'sub-agent' : 'sub-agents'} ran on ${model}. For searching and reading logs, a smaller model does the job: set CLAUDE_CODE_SUBAGENT_MODEL=haiku, or put model: haiku in the sub-agent's definition.`,
|
|
@@ -159,7 +161,7 @@ const es = {
|
|
|
159
161
|
missingTtl: 'Algunas escrituras no tienen TTL de caché; su costo en dólares va de la tarifa verificada de cinco minutos a la de una hora.',
|
|
160
162
|
mixedRanges: 'Algunos costos de escritura en caché por categoría son rangos, porque las duraciones de caché mixtas no se atribuyen a categorías individuales. Los extremos de los rangos no se suman entre categorías.',
|
|
161
163
|
diagnostics: (duplicates, malformed) => `Registros de uso deduplicados: ${duplicates}. Líneas mal formadas omitidas: ${malformed}.`,
|
|
162
|
-
tipFanout: share => `Próximo paso: los subagentes usaron el ${share} de los tokens de esta sesión. El plugin gratuito de AgentGuard te pregunta antes de que empiece el siguiente subagente por encima de tu límite: agentguard.run/
|
|
164
|
+
tipFanout: share => `Próximo paso: los subagentes usaron el ${share} de los tokens de esta sesión. El plugin gratuito de AgentGuard te pregunta antes de que empiece el siguiente subagente por encima de tu límite: https://agentguard.run/burn/next`,
|
|
163
165
|
tipFanoutPlugin: share => `Próximo paso: los subagentes usaron el ${share} de los tokens de esta sesión. Da el trabajo relacionado a un solo subagente en lugar de a varios.`,
|
|
164
166
|
tipRewrites: (rewrites, total) => `Próximo paso: las reescrituras de prefijo completo suman ${rewrites} de ${total} (equivalente a precio de lista de la API) en esta sesión. Mira la causa de cada una: npx agentguard-burn rewrites`,
|
|
165
167
|
tipSubagentModel: (count, model) => `Próximo paso: ${plural(count, 'subagente usó', 'subagentes usaron')} ${model}. Para buscar y leer logs, un modelo más pequeño basta: define CLAUDE_CODE_SUBAGENT_MODEL=haiku, o pon model: haiku en la definición del subagente.`,
|
|
@@ -229,7 +231,7 @@ const pt = {
|
|
|
229
231
|
missingTtl: 'Algumas gravações não têm TTL de cache; o valor delas em dólares vai da tarifa verificada de cinco minutos à de uma hora.',
|
|
230
232
|
mixedRanges: 'Alguns custos de gravação em cache por categoria aparecem como faixas, porque durações de cache mistas não são atribuídas a categorias individuais. Os extremos das faixas não se somam entre categorias.',
|
|
231
233
|
diagnostics: (duplicates, malformed) => `Registros de uso deduplicados: ${duplicates}. Linhas malformadas ignoradas: ${malformed}.`,
|
|
232
|
-
tipFanout: share => `Próximo passo: os subagentes usaram ${share} dos tokens desta sessão. O plugin gratuito do AgentGuard pergunta a você antes que o próximo subagente acima do seu limite comece: agentguard.run/
|
|
234
|
+
tipFanout: share => `Próximo passo: os subagentes usaram ${share} dos tokens desta sessão. O plugin gratuito do AgentGuard pergunta a você antes que o próximo subagente acima do seu limite comece: https://agentguard.run/burn/next`,
|
|
233
235
|
tipFanoutPlugin: share => `Próximo passo: os subagentes usaram ${share} dos tokens desta sessão. Dê o trabalho relacionado a um único subagente em vez de vários.`,
|
|
234
236
|
tipRewrites: (rewrites, total) => `Próximo passo: as reescritas de prefixo completo somam ${rewrites} de ${total} (equivalente ao preço de tabela da API) nesta sessão. Veja a causa de cada uma: npx agentguard-burn rewrites`,
|
|
235
237
|
tipSubagentModel: (count, model) => `Próximo passo: ${plural(count, 'subagente usou', 'subagentes usaram')} o ${model}. Para buscar e ler logs, um modelo menor dá conta: defina CLAUDE_CODE_SUBAGENT_MODEL=haiku, ou coloque model: haiku na definição do subagente.`,
|
|
@@ -371,7 +373,7 @@ const calendarEn = {
|
|
|
371
373
|
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.'],
|
|
372
374
|
saveFailed: 'Burn could not store the counts from this run.',
|
|
373
375
|
next: {
|
|
374
|
-
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/
|
|
376
|
+
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: https://agentguard.run/burn/next`,
|
|
375
377
|
fanoutPlugin: share => `Next: sub-agents used ${share} of these tokens. Give related work to one sub-agent instead of several.`,
|
|
376
378
|
why: 'Next: see where one session\'s tokens went: npx agentguard-burn why',
|
|
377
379
|
},
|
|
@@ -402,7 +404,7 @@ const calendarEs = {
|
|
|
402
404
|
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.'],
|
|
403
405
|
saveFailed: 'Burn no pudo guardar los conteos de esta ejecución.',
|
|
404
406
|
next: {
|
|
405
|
-
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/
|
|
407
|
+
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: https://agentguard.run/burn/next`,
|
|
406
408
|
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.`,
|
|
407
409
|
why: 'Próximo paso: a dónde fue cada token de una sesión: npx agentguard-burn why',
|
|
408
410
|
},
|
|
@@ -433,7 +435,7 @@ const calendarPt = {
|
|
|
433
435
|
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.'],
|
|
434
436
|
saveFailed: 'O Burn não conseguiu salvar as contagens desta execução.',
|
|
435
437
|
next: {
|
|
436
|
-
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/
|
|
438
|
+
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: https://agentguard.run/burn/next`,
|
|
437
439
|
fanoutPlugin: share => `Próximo passo: os subagentes usaram ${share} destes tokens. Dê o trabalho relacionado a um só subagente em vez de vários.`,
|
|
438
440
|
why: 'Próximo passo: para onde foi cada token de uma sessão: npx agentguard-burn why',
|
|
439
441
|
},
|