@agentguard-run/burn 0.7.1 → 0.7.3
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 +16 -0
- package/README.md +18 -0
- package/dist/src/cli.js +44 -2
- package/dist/src/idle/hook.js +7 -0
- package/dist/src/idle/memory.d.ts +38 -0
- package/dist/src/idle/memory.js +225 -0
- package/dist/src/idle/render.js +1 -1
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.js +20 -1
- package/dist/src/insights/i18n.d.ts +39 -0
- package/dist/src/insights/i18n.js +80 -1
- package/dist/src/insights/models.d.ts +169 -0
- package/dist/src/insights/models.js +280 -0
- package/dist/src/insights/pricing.js +2 -0
- package/dist/src/insights/status-fields.d.ts +19 -0
- package/dist/src/insights/status-fields.js +46 -0
- package/dist/src/insights/status-machine.d.ts +21 -0
- package/dist/src/insights/status-machine.js +53 -0
- package/dist/src/insights/status-text.d.ts +30 -0
- package/dist/src/insights/status-text.js +9 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.7.3 (2026-12-04)
|
|
4
|
+
|
|
5
|
+
- The status line shows this machine: `N% memory free` always (macOS and Linux), `swap N GB` when swap is heavy (half of physical memory or more, or 4 GB beside a low disk), and `disk N GB free` first when free disk is low. Memory turns yellow at 15% available (or 20% while the macOS kernel reports a warning) and red at 10% or a kernel critical level. These parts are never dropped before the optional fields on a narrow terminal.
|
|
6
|
+
- Available memory is the operating system's own figure (macOS `kern.memorystatus_level`, Linux `MemAvailable`), never `os.freemem()`, read at most once every five seconds across all open sessions through a small private cache file. A figure that cannot be read shows as `memory ?` or not at all, never as fine. Limits: the macOS figure can sit near 20% while the machine swaps hard, which is why swap and disk sit beside it; the Linux figure is the host's and ignores a container's memory ceiling; Windows shows no memory part.
|
|
7
|
+
- The package exports `readStatusMachine(home)`, `swapIsHeavy`, `readMemory` and `memoryLevel`, so the AgentGuard plugin can draw the same parts where the installed Burn has them (`typeof readStatusMachine === 'function'`).
|
|
8
|
+
- Display only: nothing here denies a launch, signals a process or deletes a file.
|
|
9
|
+
- The SessionStart advisory no longer reads "0 idle agent sessions holding 0.0 GB" when only an idle browser or an orphan workspace is past its threshold; it names what was found.
|
|
10
|
+
- `ps` no longer says swap is released only on reboot: swap shrinks when the processes holding memory stop.
|
|
11
|
+
|
|
12
|
+
## 0.7.2 (2026-11-13)
|
|
13
|
+
|
|
14
|
+
- Add `models [--days N] [--limit N] [--max-mb N] [json] [--lang en|es|pt]`: the top-level Claude Code and Codex sessions that started in the last N days (default 30, up to 365), each under its dominant model, models ordered by first session so the report reads as before, then after a switch. Per model: sessions, first and last session date, and per-session medians and totals of input tokens, output tokens, cache share, sub-agents launched, sub-agents that ended without finishing, and the API list-price equivalent. Every session's figures are the ones `compare` and `why` print for it, child transcripts included. Unpriced stays unpriced. How sub-agents ended is counted only where a sub-agent transcript records it; elsewhere it is unknown, left out of that row and counted, never 0. Measurement only: it never says which model did better.
|
|
15
|
+
- `models` reads at most the 300 most recently changed sessions in the window (`--limit`, up to 2000) and skips any session whose transcript plus sub-agent transcripts pass 256 MB (`--max-mb`, up to 4096), reading files in 16 MB pieces. Each session it does not count is counted by reason (over the size cap, unreadable, Codex usage unavailable, past the limit, started before the window, no timed response) and printed, never dropped.
|
|
16
|
+
- The package exports `modelsReport(options)`, `renderModels(report, lang)` and `modelGroups(sessions)`, so the AgentGuard plugin can offer `agentguard-burn models` where the installed Burn has it (`typeof modelsReport === 'function'`).
|
|
17
|
+
- Price Claude Fable 5.2 (`claude-fable-5-2`): $8 input, $10 five-minute and $16 one-hour cache writes, $0.20 cache hits, $40 output per million tokens, verified on Anthropic's pricing page on 2026-11-13. Its sessions were unpriced in `why`, `compare` and `models` before.
|
|
18
|
+
|
|
3
19
|
## 0.7.1 (2026-10-29)
|
|
4
20
|
|
|
5
21
|
- Brand ramp for the copies of a recorded run (`src/copy-ramp.ts`): fifteen oklch hues from teal 185 to violet 300 at chroma 0.105, chips at lightness 0.76, token cells at 0.63 with alpha 0.88, ledger text at 0.78, with the sRGB conversion and the nearest xterm index for 256-colour terminals. The canvas palette carries them as `copy01` to `copy15`, and showcase and phone frames use the same values. Teal stays for OK, red for STOP and every refused attempt, amber for WARN, and the done tick stays ink; no copy colour comes near any of them, so copy 1 no longer reads as allowed and copy 15 no longer reads as refused.
|
package/README.md
CHANGED
|
@@ -463,6 +463,24 @@ AgentGuard cannot tell whether these sessions did the same task. Compare runs of
|
|
|
463
463
|
|
|
464
464
|
`compare` measures and does not rank models. `--lang es|pt` and your locale choose the language exactly as for `why`. `compare json` is never translated: both sessions with ids, paths, project, models and every metric, and each change as an unrounded fraction of A.
|
|
465
465
|
|
|
466
|
+
## Sessions by model
|
|
467
|
+
|
|
468
|
+
```sh
|
|
469
|
+
agentguard-burn models
|
|
470
|
+
agentguard-burn models --days 14
|
|
471
|
+
agentguard-burn models --days 90 --limit 1000 json
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
After you switch models (Fable 5.2 to Opus 5.5, or one Codex model to another), `models` shows how your own sessions on each model differ. It reads the top-level Claude Code and Codex sessions that started in the last 30 days (`--days N`, 1 to 365), puts each one under its dominant model (the model with the most of its output tokens, as `compare` names it), and lists the models by their first session, oldest first, so the report reads as before, then after. Sessions whose responses carry no model id form their own `unknown model` group.
|
|
475
|
+
|
|
476
|
+
For each model it prints the number of sessions, the first and last session date (UTC), and per-session medians and totals of: input tokens (cache reads, cache writes and fresh input), output tokens, cache share (a median of each session's share, and in the totals the group's cache reads over its input), sub-agents launched, sub-agents that ended without finishing, and the API list-price equivalent. Each session's figures are the ones `compare` and `why` print for it, child transcripts included, so a Codex rollout's spawned sub-agents (separate rollouts that Burn does not add to their parent) are not in it. A dollar range's median runs from the median low end to the median high end. A model without a verified rate prints `unpriced`, and so does any group with one unpriced session: it never prints as $0.00.
|
|
477
|
+
|
|
478
|
+
Sub-agents that ended without finishing are the ones `why` counts: recorded as failed, killed or stopped and never as completed or resumed, read from the sub-agent transcripts Claude Code keeps beside a session. A session that launched none counts 0. A session that launched some with no such transcripts (every Codex session with a launch, and a Claude Code session without the files) is unknown: it is left out of that row, never counted as 0, and a line says for how many sessions of each model it is unknown.
|
|
479
|
+
|
|
480
|
+
The work is bounded. Only files changed in the window are candidates; the 300 most recently changed are read (`--limit N`, up to 2000); and a session whose transcript plus sub-agent transcripts pass 256 MB (`--max-mb N`, up to 4096) is skipped without being read. Nothing is dropped silently: the report ends with one line per reason for every session it did not count, for example `Skipped 2 sessions over 256 MB (transcript plus sub-agent transcripts). Run why on one to see it alone, or raise the cap with --max-mb.` The other reasons are an unreadable file, inherited Codex history with no verifiable boundary (its usage is unavailable, as in `compare`), sessions past the limit, a session changed in the window that started before it, and a session with no timed response.
|
|
481
|
+
|
|
482
|
+
`models` measures and does not rank models: sessions on two models may have done different work. `--lang es|pt` and your locale choose the language exactly as for `why`. `models json` is never translated: the window, each model's figures (medians, totals, known and unknown sub-agent outcomes, unpriced sessions), every counted session with the same fields as `compare json` plus `subagentsUnfinished` and `bytes`, the counts by skip reason, and the path and size of each session skipped for its size, an unreadable file or unavailable usage. The library export is `modelsReport(options)` with `renderModels(report, lang)`.
|
|
483
|
+
|
|
466
484
|
## Tokens per day
|
|
467
485
|
|
|
468
486
|
```sh
|
package/dist/src/cli.js
CHANGED
|
@@ -94,6 +94,7 @@ const disk_1 = require("./idle/disk");
|
|
|
94
94
|
const telemetry_cli_1 = require("./telemetry-cli");
|
|
95
95
|
const status_fields_1 = require("./insights/status-fields");
|
|
96
96
|
const status_data_1 = require("./insights/status-data");
|
|
97
|
+
const status_machine_1 = require("./insights/status-machine");
|
|
97
98
|
const display_mode_1 = require("./display-mode");
|
|
98
99
|
const i18n_2 = require("./insights/i18n");
|
|
99
100
|
const simple_data_1 = require("./insights/simple-data");
|
|
@@ -389,6 +390,46 @@ async function main(argv) {
|
|
|
389
390
|
show({ kind: 'command', command, values: { ...report } }, json ? JSON.stringify(report, null, 2) + '\n' : renderCompare(report, language) + '\n', json);
|
|
390
391
|
return 0;
|
|
391
392
|
}
|
|
393
|
+
case 'models': {
|
|
394
|
+
// `--days N` (1 to 365), `--limit N` (1 to 2000), `--max-mb N` (1 to 4096), each also as --name=N; `json`, and `--lang` exactly as `why` takes it.
|
|
395
|
+
const { MODELS_DEFAULT_DAYS, MODELS_DEFAULT_LIMIT, MODELS_DEFAULT_MAX_SESSION_BYTES, MODELS_MAX_DAYS, MODELS_MAX_LIMIT, MODELS_MAX_SESSION_MEGABYTES, modelsReport, renderModels } = await Promise.resolve().then(() => __importStar(require('./insights/models')));
|
|
396
|
+
const numbers = { '--days': undefined, '--limit': undefined, '--max-mb': undefined };
|
|
397
|
+
const args = [];
|
|
398
|
+
let lang, langGiven = false, invalid = false;
|
|
399
|
+
for (let i = 0; i < rest.length; i++) {
|
|
400
|
+
const arg = rest[i], name = Object.keys(numbers).find(key => arg === key || arg.startsWith(`${key}=`));
|
|
401
|
+
if (arg === '--lang') {
|
|
402
|
+
langGiven = true;
|
|
403
|
+
lang = rest[++i];
|
|
404
|
+
}
|
|
405
|
+
else if (arg.startsWith('--lang=')) {
|
|
406
|
+
langGiven = true;
|
|
407
|
+
lang = arg.slice('--lang='.length);
|
|
408
|
+
}
|
|
409
|
+
else if (name) {
|
|
410
|
+
if (numbers[name] !== undefined)
|
|
411
|
+
invalid = true;
|
|
412
|
+
numbers[name] = arg === name ? rest[++i] ?? '' : arg.slice(name.length + 1);
|
|
413
|
+
}
|
|
414
|
+
else
|
|
415
|
+
args.push(arg);
|
|
416
|
+
}
|
|
417
|
+
const whole = (value, fallback, high) => value === undefined ? fallback : /^\d{1,4}$/.test(value) && Number(value) >= 1 && Number(value) <= high ? Number(value) : null;
|
|
418
|
+
const days = whole(numbers['--days'], MODELS_DEFAULT_DAYS, MODELS_MAX_DAYS), limit = whole(numbers['--limit'], MODELS_DEFAULT_LIMIT, MODELS_MAX_LIMIT);
|
|
419
|
+
const megabytes = whole(numbers['--max-mb'], MODELS_DEFAULT_MAX_SESSION_BYTES / 1024 / 1024, MODELS_MAX_SESSION_MEGABYTES);
|
|
420
|
+
const json = args.includes('json') || args.includes('--json');
|
|
421
|
+
if (invalid || (langGiven && (0, i18n_1.whyLangOf)(lang) === null) || days === null || limit === null || megabytes === null || args.some(value => value !== 'json' && value !== '--json')) {
|
|
422
|
+
process.stderr.write('Usage: agentguard-burn models [--days N] [--limit N] [--max-mb N] [json] [--lang en|es|pt]\n');
|
|
423
|
+
return 64;
|
|
424
|
+
}
|
|
425
|
+
const roots = (0, sessions_1.transcriptRoots)(), locations = (0, sessions_1.discoverInsightTranscripts)(roots);
|
|
426
|
+
if (!locations.length)
|
|
427
|
+
return showNoSessions(Object.values(roots), json);
|
|
428
|
+
const language = (0, i18n_1.detectWhyLang)({ flag: lang, env: process.env, intlLocale: intlLocale() });
|
|
429
|
+
const report = modelsReport({ days, limit, maxSessionBytes: megabytes * 1024 * 1024, roots, locations, rates: (0, live_1.readPricing)(HOME, (0, pre_tool_use_1.loadPolicy)(HOME)) });
|
|
430
|
+
show({ kind: 'command', command, values: { ...report } }, json ? JSON.stringify(report, null, 2) + '\n' : renderModels(report, language) + '\n', true);
|
|
431
|
+
return 0;
|
|
432
|
+
}
|
|
392
433
|
case 'week': {
|
|
393
434
|
let lang, weekStart, invalid = false;
|
|
394
435
|
const json = rest.includes('json') || rest.includes('--json');
|
|
@@ -624,7 +665,7 @@ async function main(argv) {
|
|
|
624
665
|
const burn = (0, status_data_1.readStatusBurn)(HOME, session);
|
|
625
666
|
if (!(0, node_fs_1.existsSync)((0, node_path_1.join)(HOME, 'sessions')) && metrics.totalTokens !== undefined)
|
|
626
667
|
burn.tokens.used = metrics.totalTokens;
|
|
627
|
-
const formatted = (0, status_fields_1.formatStatusFields)({ ...metrics, burn, fields, windows: observation.snapshot?.windows,
|
|
668
|
+
const formatted = (0, status_fields_1.formatStatusFields)({ ...metrics, burn, fields, windows: observation.snapshot?.windows, machine: await (0, status_machine_1.readStatusMachine)(HOME),
|
|
628
669
|
width,
|
|
629
670
|
lang: (0, i18n_1.detectWhyLang)({ flag: lang, env: process.env, intlLocale: intlLocale() }) });
|
|
630
671
|
const line = process.env.NO_COLOR !== undefined || noColor || formatted.clipped ? formatted.text : formatted.parts.map(part => {
|
|
@@ -893,7 +934,7 @@ async function main(argv) {
|
|
|
893
934
|
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);
|
|
894
935
|
return !command || command === 'help' || command === '--help' || command === '-h' ? 0 : 64;
|
|
895
936
|
}
|
|
896
|
-
show({ kind: 'command', command: 'help', values: { commands: ['tree', 'tally', 'ps', 'reap', 'live', 'record', 'render', 'blocks', 'limits', 'price-shadow', 'calendar', 'week', 'why', 'compare', 'rewrites', 'compact-replay', 'ttl', 'pace', 'statusline', 'pricing', 'telemetry', 'replay', 'calibrate', 'status', 'install', 'init', 'enforce', 'shadow', 'resume', 'quiet', 'proxy', 'conformance'] } }, starter + '\nAll commands\n' +
|
|
937
|
+
show({ kind: 'command', command: 'help', values: { commands: ['tree', 'tally', 'ps', 'reap', 'live', 'record', 'render', 'blocks', 'limits', 'price-shadow', 'calendar', 'week', 'why', 'compare', 'models', 'rewrites', 'compact-replay', 'ttl', 'pace', 'statusline', 'pricing', 'telemetry', 'replay', 'calibrate', 'status', 'install', 'init', 'enforce', 'shadow', 'resume', 'quiet', 'proxy', 'conformance'] } }, starter + '\nAll commands\n' +
|
|
897
938
|
' ps [--json] local agent processes, held memory and workspace disk\n' +
|
|
898
939
|
' render <run.jsonl> --mp4 <out.mp4> [--gif <out.gif>] [--phone] local recorded-run export\n' +
|
|
899
940
|
' render <run.jsonl> --mp4 <out.mp4> --dashboard [--wide] [--economics <blocks.json>] dashboard export\n' +
|
|
@@ -910,6 +951,7 @@ async function main(argv) {
|
|
|
910
951
|
' --lang es|pt the why report in Latin American Spanish or Brazilian Portuguese; your locale picks it by default\n' +
|
|
911
952
|
' --commits count the commits that landed in its git repository while it ran (runs git on this computer; off by default)\n' +
|
|
912
953
|
' compare [sessionA] [sessionB] two sessions side by side: tokens, cache, sub-agents, rewrites, list USD; json and --lang as for why\n' +
|
|
954
|
+
' models [--days N] [--limit N] [--max-mb N] your sessions grouped by model, oldest first: per-session medians and totals of tokens, cache, sub-agents, list USD; json and --lang as for why\n' +
|
|
913
955
|
' calendar [--weeks N] tokens per day, Claude Code and Codex together: sub-agent days, launches AgentGuard held, dollars at API prices; json and --lang as for why\n' +
|
|
914
956
|
' week [--week YYYY-MM-DD] [json] [--lang en|es|pt] your last completed UTC week: useful work, waste causes and one fix\n' +
|
|
915
957
|
' card [--weeks N] [--out file.png] the calendar\'s totals as one 1200x675 image to share (default 4 weeks); written locally, nothing uploaded\n' +
|
package/dist/src/idle/hook.js
CHANGED
|
@@ -25,6 +25,13 @@ function warningForAudit(report, policy, now = Date.now()) {
|
|
|
25
25
|
if (!warnings.length)
|
|
26
26
|
return null;
|
|
27
27
|
const sessions = warnings.filter(row => row.kind === 'session');
|
|
28
|
+
// An idle browser or an orphan workspace alone still points to ps, in its own words:
|
|
29
|
+
// "0 idle agent sessions holding 0.0 GB" reads as a broken count.
|
|
30
|
+
if (!sessions.length) {
|
|
31
|
+
const browsers = warnings.filter(row => row.kind === 'browser').length, workspaces = warnings.filter(row => row.kind === 'workspace').length;
|
|
32
|
+
const parts = [browsers ? `${browsers} idle agent browser${browsers === 1 ? '' : 's'}` : '', workspaces ? `${workspaces} orphan workspace${workspaces === 1 ? '' : 's'}` : ''].filter(Boolean);
|
|
33
|
+
return parts.length ? `${parts.join(' and ')}, run agentguard-burn ps` : null;
|
|
34
|
+
}
|
|
28
35
|
const gb = sessions.reduce((sum, row) => sum + row.rssBytes, 0) / 1_000_000_000;
|
|
29
36
|
return `${sessions.length} idle agent sessions holding ${gb.toFixed(1)} GB, run agentguard-burn ps`;
|
|
30
37
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { PressureLevel } from './disk';
|
|
2
|
+
import { type CommandRunner } from './platform';
|
|
3
|
+
/** At or under this share available, memory is short whatever the kernel says. */
|
|
4
|
+
export declare const MEMORY_WARN_PERCENT = 15;
|
|
5
|
+
/** The kernel's own warning counts once available memory is also at or under this. */
|
|
6
|
+
export declare const MEMORY_WARN_PRESSURE_PERCENT = 20;
|
|
7
|
+
export declare const MEMORY_CRIT_PERCENT = 10;
|
|
8
|
+
export type MemorySource = 'darwin-sysctl' | 'linux-meminfo' | 'none';
|
|
9
|
+
export interface MemoryReading {
|
|
10
|
+
/** Whole percent of memory the system reports as available, 0 to 100. Null when unknown. */
|
|
11
|
+
availablePercent: number | null;
|
|
12
|
+
/** The macOS kernel's pressure level (1, 2 or 4). Null elsewhere or when unread. */
|
|
13
|
+
kernelPressure: 1 | 2 | 4 | null;
|
|
14
|
+
level: PressureLevel;
|
|
15
|
+
/** Swap in use and allocated, when the same read reported them. Null when unknown. */
|
|
16
|
+
swapUsedBytes: number | null;
|
|
17
|
+
swapTotalBytes: number | null;
|
|
18
|
+
source: MemorySource;
|
|
19
|
+
}
|
|
20
|
+
export declare const UNKNOWN_MEMORY: MemoryReading;
|
|
21
|
+
export declare function memoryLevel(availablePercent: number | null, kernelPressure?: 1 | 2 | 4 | null): PressureLevel;
|
|
22
|
+
/** Reads `sysctl kern.memorystatus_level kern.memorystatus_vm_pressure_level vm.swapusage` output, one "name: value" per line. */
|
|
23
|
+
export declare function parseDarwinMemory(text: string): MemoryReading;
|
|
24
|
+
/** Reads /proc/meminfo. A kernel without MemAvailable is unknown: MemFree alone would under-report. */
|
|
25
|
+
export declare function parseLinuxMemory(text: string): MemoryReading;
|
|
26
|
+
export type MemoryProbe = () => Promise<MemoryReading>;
|
|
27
|
+
export declare const MEMORY_PROBE_TIMEOUT_MS = 200;
|
|
28
|
+
/** One bounded read. Any failure is unknown. */
|
|
29
|
+
export declare function systemMemoryProbe(platform?: string, runner?: CommandRunner, meminfo?: string): MemoryProbe;
|
|
30
|
+
export declare const MEMORY_CHECK_TTL_MS = 5000;
|
|
31
|
+
export declare const memoryCheckPath: (home: string) => string;
|
|
32
|
+
/**
|
|
33
|
+
* The reading every status line shares: one system read at most every five
|
|
34
|
+
* seconds across all open sessions, kept in a small file in the Burn home.
|
|
35
|
+
* A cache that cannot be written (a full disk) still returns the fresh
|
|
36
|
+
* reading. Never throws.
|
|
37
|
+
*/
|
|
38
|
+
export declare function readMemory(home: string, now: number, probe?: MemoryProbe): Promise<MemoryReading>;
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.memoryCheckPath = exports.MEMORY_CHECK_TTL_MS = exports.MEMORY_PROBE_TIMEOUT_MS = exports.UNKNOWN_MEMORY = exports.MEMORY_CRIT_PERCENT = exports.MEMORY_WARN_PRESSURE_PERCENT = exports.MEMORY_WARN_PERCENT = void 0;
|
|
4
|
+
exports.memoryLevel = memoryLevel;
|
|
5
|
+
exports.parseDarwinMemory = parseDarwinMemory;
|
|
6
|
+
exports.parseLinuxMemory = parseLinuxMemory;
|
|
7
|
+
exports.systemMemoryProbe = systemMemoryProbe;
|
|
8
|
+
exports.readMemory = readMemory;
|
|
9
|
+
/**
|
|
10
|
+
* Available memory on this machine.
|
|
11
|
+
*
|
|
12
|
+
* Many agent sessions and sub-agents on one laptop use memory until the
|
|
13
|
+
* system swaps, and swap then fills the disk. This reads what the operating
|
|
14
|
+
* system itself calls available, never Node's os.freemem(): on macOS that
|
|
15
|
+
* counts only free pages and reads near zero on a healthy machine.
|
|
16
|
+
*
|
|
17
|
+
* macOS: kern.memorystatus_level (percent available, the figure
|
|
18
|
+
* `memory_pressure` prints) and kern.memorystatus_vm_pressure_level
|
|
19
|
+
* (1 normal, 2 warn, 4 critical).
|
|
20
|
+
* Linux: MemAvailable over MemTotal from /proc/meminfo.
|
|
21
|
+
*
|
|
22
|
+
* Limits, stated: the macOS figure is an undocumented kernel value and can
|
|
23
|
+
* sit near 20% while the machine swaps hard; the Linux figure is the host's
|
|
24
|
+
* and ignores a container's own memory ceiling. A source that cannot be read
|
|
25
|
+
* is reported as unknown, never as zero and never as fine.
|
|
26
|
+
*
|
|
27
|
+
* Reported only. Nothing here denies, signals or deletes.
|
|
28
|
+
*/
|
|
29
|
+
const node_crypto_1 = require("node:crypto");
|
|
30
|
+
const node_fs_1 = require("node:fs");
|
|
31
|
+
const node_fs_2 = require("node:fs");
|
|
32
|
+
const node_path_1 = require("node:path");
|
|
33
|
+
const platform_1 = require("./platform");
|
|
34
|
+
/** At or under this share available, memory is short whatever the kernel says. */
|
|
35
|
+
exports.MEMORY_WARN_PERCENT = 15;
|
|
36
|
+
/** The kernel's own warning counts once available memory is also at or under this. */
|
|
37
|
+
exports.MEMORY_WARN_PRESSURE_PERCENT = 20;
|
|
38
|
+
exports.MEMORY_CRIT_PERCENT = 10;
|
|
39
|
+
exports.UNKNOWN_MEMORY = { availablePercent: null, kernelPressure: null, level: 'unknown', swapUsedBytes: null, swapTotalBytes: null, source: 'none' };
|
|
40
|
+
function memoryLevel(availablePercent, kernelPressure = null) {
|
|
41
|
+
if (availablePercent === null)
|
|
42
|
+
return 'unknown';
|
|
43
|
+
if (kernelPressure === 4 || availablePercent <= exports.MEMORY_CRIT_PERCENT)
|
|
44
|
+
return 'crit';
|
|
45
|
+
if (availablePercent <= exports.MEMORY_WARN_PERCENT)
|
|
46
|
+
return 'warn';
|
|
47
|
+
return kernelPressure === 2 && availablePercent <= exports.MEMORY_WARN_PRESSURE_PERCENT ? 'warn' : 'ok';
|
|
48
|
+
}
|
|
49
|
+
/** A garbled swap figure is unknown swap. It never costs the memory percent read beside it. */
|
|
50
|
+
function finiteSwap(swap) {
|
|
51
|
+
return swap && Number.isFinite(swap.usedBytes) && Number.isFinite(swap.totalBytes) && swap.usedBytes >= 0 && swap.totalBytes >= 0 ? swap : null;
|
|
52
|
+
}
|
|
53
|
+
const percent = (value) => Number.isFinite(value) && value >= 0 && value <= 100 ? Math.round(value) : null;
|
|
54
|
+
/** Reads `sysctl kern.memorystatus_level kern.memorystatus_vm_pressure_level vm.swapusage` output, one "name: value" per line. */
|
|
55
|
+
function parseDarwinMemory(text) {
|
|
56
|
+
const level = /^kern\.memorystatus_level:\s*(\d{1,3})\s*$/m.exec(text);
|
|
57
|
+
const available = level ? percent(Number(level[1])) : null;
|
|
58
|
+
if (available === null)
|
|
59
|
+
return exports.UNKNOWN_MEMORY;
|
|
60
|
+
const pressure = /^kern\.memorystatus_vm_pressure_level:\s*(\d)\s*$/m.exec(text);
|
|
61
|
+
const kernelPressure = pressure && ['1', '2', '4'].includes(pressure[1]) ? Number(pressure[1]) : null;
|
|
62
|
+
const swap = finiteSwap((0, platform_1.parseSwapUsage)(text, 'darwin'));
|
|
63
|
+
return { availablePercent: available, kernelPressure, level: memoryLevel(available, kernelPressure),
|
|
64
|
+
swapUsedBytes: swap?.usedBytes ?? null, swapTotalBytes: swap?.totalBytes ?? null, source: 'darwin-sysctl' };
|
|
65
|
+
}
|
|
66
|
+
/** Reads /proc/meminfo. A kernel without MemAvailable is unknown: MemFree alone would under-report. */
|
|
67
|
+
function parseLinuxMemory(text) {
|
|
68
|
+
const total = /^MemTotal:\s+(\d+)\s+kB$/m.exec(text), free = /^MemAvailable:\s+(\d+)\s+kB$/m.exec(text);
|
|
69
|
+
if (!total || !free || Number(total[1]) <= 0)
|
|
70
|
+
return exports.UNKNOWN_MEMORY;
|
|
71
|
+
const available = percent(100 * Number(free[1]) / Number(total[1]));
|
|
72
|
+
if (available === null)
|
|
73
|
+
return exports.UNKNOWN_MEMORY;
|
|
74
|
+
const swap = finiteSwap((0, platform_1.parseSwapUsage)(text, 'linux'));
|
|
75
|
+
return { availablePercent: available, kernelPressure: null, level: memoryLevel(available),
|
|
76
|
+
swapUsedBytes: swap?.usedBytes ?? null, swapTotalBytes: swap?.totalBytes ?? null, source: 'linux-meminfo' };
|
|
77
|
+
}
|
|
78
|
+
exports.MEMORY_PROBE_TIMEOUT_MS = 200;
|
|
79
|
+
/** One bounded read. Any failure is unknown. */
|
|
80
|
+
function systemMemoryProbe(platform = process.platform, runner = platform_1.runLocal, meminfo = '/proc/meminfo') {
|
|
81
|
+
return async () => {
|
|
82
|
+
try {
|
|
83
|
+
if (platform === 'darwin') {
|
|
84
|
+
const result = await runner('/usr/sbin/sysctl', ['kern.memorystatus_level', 'kern.memorystatus_vm_pressure_level', 'vm.swapusage'], { timeoutMs: exports.MEMORY_PROBE_TIMEOUT_MS });
|
|
85
|
+
// A missing key makes sysctl exit non-zero but still print the others.
|
|
86
|
+
return parseDarwinMemory(result.stdout || '');
|
|
87
|
+
}
|
|
88
|
+
if (platform === 'linux')
|
|
89
|
+
return parseLinuxMemory(await node_fs_2.promises.readFile(meminfo, 'utf8'));
|
|
90
|
+
return exports.UNKNOWN_MEMORY;
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
return exports.UNKNOWN_MEMORY;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
exports.MEMORY_CHECK_TTL_MS = 5_000;
|
|
98
|
+
const MEMORY_CHECK_MAX_BYTES = 4 * 1024;
|
|
99
|
+
const memoryCheckPath = (home) => (0, node_path_1.join)(home, 'memory-check.json');
|
|
100
|
+
exports.memoryCheckPath = memoryCheckPath;
|
|
101
|
+
/**
|
|
102
|
+
* The one way a reading enters from outside (a probe's answer, the cache file):
|
|
103
|
+
* each field is read once, checked, and copied into a fresh object holding
|
|
104
|
+
* exactly these six fields. The level is never taken from the source: it is
|
|
105
|
+
* judged from the numbers, so neither a tampered file nor a careless probe can
|
|
106
|
+
* claim "ok". Anything that does not fit is unknown.
|
|
107
|
+
*/
|
|
108
|
+
function sound(value) {
|
|
109
|
+
try {
|
|
110
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
111
|
+
return exports.UNKNOWN_MEMORY;
|
|
112
|
+
const raw = value;
|
|
113
|
+
const available = raw.availablePercent, pressure = raw.kernelPressure, used = raw.swapUsedBytes, total = raw.swapTotalBytes, source = raw.source;
|
|
114
|
+
if (typeof available !== 'number' || percent(available) !== available)
|
|
115
|
+
return exports.UNKNOWN_MEMORY;
|
|
116
|
+
if (source !== 'darwin-sysctl' && source !== 'linux-meminfo')
|
|
117
|
+
return exports.UNKNOWN_MEMORY;
|
|
118
|
+
if (pressure !== null && pressure !== 1 && pressure !== 2 && pressure !== 4)
|
|
119
|
+
return exports.UNKNOWN_MEMORY;
|
|
120
|
+
const bytes = (n) => n === null || (typeof n === 'number' && Number.isFinite(n) && n >= 0);
|
|
121
|
+
if (!bytes(used) || !bytes(total))
|
|
122
|
+
return exports.UNKNOWN_MEMORY;
|
|
123
|
+
return { availablePercent: available, kernelPressure: pressure, level: memoryLevel(available, pressure), swapUsedBytes: used, swapTotalBytes: total, source };
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
return exports.UNKNOWN_MEMORY;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* One open, never following a link and never waiting (a pipe at this path
|
|
131
|
+
* must not hang the status line), then every check on that same open file:
|
|
132
|
+
* a file swapped in between a check and a read cannot be the one that is read.
|
|
133
|
+
* Where the system has no no-follow open (Windows), a link is refused by a
|
|
134
|
+
* check before the open instead.
|
|
135
|
+
*/
|
|
136
|
+
function readMemoryCheck(home) {
|
|
137
|
+
let fd = null;
|
|
138
|
+
try {
|
|
139
|
+
const file = (0, exports.memoryCheckPath)(home), noFollow = node_fs_1.constants.O_NOFOLLOW, noWait = node_fs_1.constants.O_NONBLOCK;
|
|
140
|
+
if (typeof noFollow !== 'number' || typeof noWait !== 'number') {
|
|
141
|
+
const before = (0, node_fs_1.lstatSync)(file);
|
|
142
|
+
if (!before.isFile() || before.isSymbolicLink())
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
fd = (0, node_fs_1.openSync)(file, node_fs_1.constants.O_RDONLY | (typeof noFollow === 'number' ? noFollow : 0) | (typeof noWait === 'number' ? noWait : 0));
|
|
146
|
+
const stat = (0, node_fs_1.fstatSync)(fd);
|
|
147
|
+
if (!stat.isFile() || stat.size > MEMORY_CHECK_MAX_BYTES)
|
|
148
|
+
return null;
|
|
149
|
+
const buffer = Buffer.alloc(MEMORY_CHECK_MAX_BYTES + 1), length = (0, node_fs_1.readSync)(fd, buffer, 0, buffer.length, 0);
|
|
150
|
+
if (length > MEMORY_CHECK_MAX_BYTES)
|
|
151
|
+
return null;
|
|
152
|
+
const value = JSON.parse(buffer.toString('utf8', 0, length));
|
|
153
|
+
if (!value || value.version !== 1 || typeof value.checkedAt !== 'number' || !Number.isFinite(value.checkedAt))
|
|
154
|
+
return null;
|
|
155
|
+
const reading = sound(value.reading);
|
|
156
|
+
// An honest "could not read" is stored with source none and is kept for its
|
|
157
|
+
// five seconds. Anything else that does not fit is a corrupt file: read afresh.
|
|
158
|
+
if (reading.availablePercent === null && value.reading?.source !== 'none')
|
|
159
|
+
return null;
|
|
160
|
+
return { version: 1, checkedAt: value.checkedAt, reading };
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
finally {
|
|
166
|
+
if (fd !== null)
|
|
167
|
+
try {
|
|
168
|
+
(0, node_fs_1.closeSync)(fd);
|
|
169
|
+
}
|
|
170
|
+
catch { }
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
function writeMemoryCheck(home, check) {
|
|
174
|
+
(0, node_fs_1.mkdirSync)(home, { recursive: true, mode: 0o700 });
|
|
175
|
+
const file = (0, exports.memoryCheckPath)(home), temporary = `${file}.${process.pid}.${(0, node_crypto_1.randomUUID)()}`;
|
|
176
|
+
try {
|
|
177
|
+
(0, node_fs_1.writeFileSync)(temporary, JSON.stringify(check) + '\n', { mode: 0o600, flag: 'wx' });
|
|
178
|
+
(0, node_fs_1.renameSync)(temporary, file);
|
|
179
|
+
}
|
|
180
|
+
finally {
|
|
181
|
+
try {
|
|
182
|
+
(0, node_fs_1.unlinkSync)(temporary);
|
|
183
|
+
}
|
|
184
|
+
catch { }
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* The reading every status line shares: one system read at most every five
|
|
189
|
+
* seconds across all open sessions, kept in a small file in the Burn home.
|
|
190
|
+
* A cache that cannot be written (a full disk) still returns the fresh
|
|
191
|
+
* reading. Never throws.
|
|
192
|
+
*/
|
|
193
|
+
async function readMemory(home, now, probe = systemMemoryProbe()) {
|
|
194
|
+
try {
|
|
195
|
+
const cached = readMemoryCheck(home);
|
|
196
|
+
if (cached && now >= cached.checkedAt && now - cached.checkedAt < exports.MEMORY_CHECK_TTL_MS)
|
|
197
|
+
return cached.reading;
|
|
198
|
+
let reading;
|
|
199
|
+
try {
|
|
200
|
+
reading = sound(await probe());
|
|
201
|
+
}
|
|
202
|
+
catch {
|
|
203
|
+
reading = exports.UNKNOWN_MEMORY;
|
|
204
|
+
}
|
|
205
|
+
let written = false;
|
|
206
|
+
try {
|
|
207
|
+
writeMemoryCheck(home, { version: 1, checkedAt: now, reading });
|
|
208
|
+
written = true;
|
|
209
|
+
}
|
|
210
|
+
catch { /* best effort */ }
|
|
211
|
+
// A cache dated ahead of now that could not be replaced (a full disk) must not
|
|
212
|
+
// wait there to be believed once the clock reaches it. Removing needs no space.
|
|
213
|
+
// Limit, stated: in a home folder that cannot be changed at all, it stays.
|
|
214
|
+
if (!written && cached && cached.checkedAt > now) {
|
|
215
|
+
try {
|
|
216
|
+
(0, node_fs_1.unlinkSync)((0, exports.memoryCheckPath)(home));
|
|
217
|
+
}
|
|
218
|
+
catch { }
|
|
219
|
+
}
|
|
220
|
+
return reading;
|
|
221
|
+
}
|
|
222
|
+
catch {
|
|
223
|
+
return exports.UNKNOWN_MEMORY;
|
|
224
|
+
}
|
|
225
|
+
}
|
package/dist/src/idle/render.js
CHANGED
|
@@ -119,7 +119,7 @@ function renderAudit(report, options = {}) {
|
|
|
119
119
|
line(`Idle agent held memory: ${memory(report.totals.idleAgentMemoryBytes)}`);
|
|
120
120
|
line(`Orphan workspace disk: ${memory(report.totals.orphanWorkspaceBytes)}`);
|
|
121
121
|
line(`Swap in use: ${memory(report.swapUsedBytes)}`);
|
|
122
|
-
wrap('Swap
|
|
122
|
+
wrap('Swap shrinks when the processes holding memory stop. Burn does not touch it.');
|
|
123
123
|
wrap('RSS is resident memory, not a bill. Shared pages can be counted in more than one process.');
|
|
124
124
|
wrap('Idle methods: terminal device access time; transcript file writes; profile file writes; unknown.');
|
|
125
125
|
for (const skipped of report.skipped)
|
package/dist/src/index.d.ts
CHANGED
|
@@ -32,5 +32,8 @@ export { readLaunchTree, readLaunchTreeWithReceipts, buildLaunchTree, renderLaun
|
|
|
32
32
|
export { sessionTally, tallyEntries, readLedgerTallies, readLedgerDailyTallies, renderSessionTally, pluginLedgerDirectories, sessionLaunchReceipts, type SessionTally, type TallyCounts } from './insights/tally';
|
|
33
33
|
export { formatStatusFields, parseStatusFields, statusPace, statusColor, type StatusInput, type StatusMetrics } from './insights/status-fields';
|
|
34
34
|
export { readStatusBurn, readStatusMetrics } from './insights/status-data';
|
|
35
|
+
export { readStatusMachine, swapIsHeavy, type MachineSources } from './insights/status-machine';
|
|
36
|
+
export { readMemory, memoryLevel, type MemoryReading } from './idle/memory';
|
|
35
37
|
export { collectWeek, saveWeek, weekFigures, weekStartOf, lastCompletedWeekStart, isMonday, WEEK_SCHEMA, SMALLER_MODEL, type WeekFigures, type WeekReport, type WeekAmount, type WeekCause, type WeekTopCause, type BurnWeekFile, type CollectWeekOptions, type SaveWeekResult } from './insights/week';
|
|
36
38
|
export { renderWeek } from './insights/week-render';
|
|
39
|
+
export { modelsReport, renderModels, modelGroups, subagentsUnfinished, sessionBytes, MODELS_DEFAULT_DAYS, MODELS_MAX_DAYS, MODELS_DEFAULT_LIMIT, MODELS_MAX_LIMIT, MODELS_DEFAULT_MAX_SESSION_BYTES, MODELS_MAX_SESSION_MEGABYTES, type ModelsReport, type ModelsGroup, type ModelsSession, type ModelsSessionInput, type ModelsSkipped, type ModelsSkippedSession, type ModelsOptions } from './insights/models';
|
package/dist/src/index.js
CHANGED
|
@@ -16,7 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
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
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.renderWeek = exports.SMALLER_MODEL = exports.WEEK_SCHEMA = exports.isMonday = exports.lastCompletedWeekStart = exports.weekStartOf = exports.weekFigures = exports.saveWeek = exports.collectWeek = exports.readStatusMetrics = exports.readStatusBurn = exports.statusColor = exports.statusPace = void 0;
|
|
19
|
+
exports.MODELS_MAX_SESSION_MEGABYTES = exports.MODELS_DEFAULT_MAX_SESSION_BYTES = exports.MODELS_MAX_LIMIT = exports.MODELS_DEFAULT_LIMIT = exports.MODELS_MAX_DAYS = exports.MODELS_DEFAULT_DAYS = exports.sessionBytes = exports.subagentsUnfinished = exports.modelGroups = exports.renderModels = exports.modelsReport = exports.renderWeek = exports.SMALLER_MODEL = exports.WEEK_SCHEMA = exports.isMonday = exports.lastCompletedWeekStart = exports.weekStartOf = exports.weekFigures = exports.saveWeek = exports.collectWeek = exports.memoryLevel = exports.readMemory = exports.swapIsHeavy = exports.readStatusMachine = exports.readStatusMetrics = exports.readStatusBurn = exports.statusColor = exports.statusPace = void 0;
|
|
20
20
|
__exportStar(require("./types"), exports);
|
|
21
21
|
var defaults_1 = require("./defaults");
|
|
22
22
|
Object.defineProperty(exports, "DEFAULT_POLICY", { enumerable: true, get: function () { return defaults_1.DEFAULT_POLICY; } });
|
|
@@ -159,6 +159,12 @@ Object.defineProperty(exports, "statusColor", { enumerable: true, get: function
|
|
|
159
159
|
var status_data_1 = require("./insights/status-data");
|
|
160
160
|
Object.defineProperty(exports, "readStatusBurn", { enumerable: true, get: function () { return status_data_1.readStatusBurn; } });
|
|
161
161
|
Object.defineProperty(exports, "readStatusMetrics", { enumerable: true, get: function () { return status_data_1.readStatusMetrics; } });
|
|
162
|
+
var status_machine_1 = require("./insights/status-machine");
|
|
163
|
+
Object.defineProperty(exports, "readStatusMachine", { enumerable: true, get: function () { return status_machine_1.readStatusMachine; } });
|
|
164
|
+
Object.defineProperty(exports, "swapIsHeavy", { enumerable: true, get: function () { return status_machine_1.swapIsHeavy; } });
|
|
165
|
+
var memory_1 = require("./idle/memory");
|
|
166
|
+
Object.defineProperty(exports, "readMemory", { enumerable: true, get: function () { return memory_1.readMemory; } });
|
|
167
|
+
Object.defineProperty(exports, "memoryLevel", { enumerable: true, get: function () { return memory_1.memoryLevel; } });
|
|
162
168
|
var week_1 = require("./insights/week");
|
|
163
169
|
Object.defineProperty(exports, "collectWeek", { enumerable: true, get: function () { return week_1.collectWeek; } });
|
|
164
170
|
Object.defineProperty(exports, "saveWeek", { enumerable: true, get: function () { return week_1.saveWeek; } });
|
|
@@ -170,3 +176,16 @@ Object.defineProperty(exports, "WEEK_SCHEMA", { enumerable: true, get: function
|
|
|
170
176
|
Object.defineProperty(exports, "SMALLER_MODEL", { enumerable: true, get: function () { return week_1.SMALLER_MODEL; } });
|
|
171
177
|
var week_render_1 = require("./insights/week-render");
|
|
172
178
|
Object.defineProperty(exports, "renderWeek", { enumerable: true, get: function () { return week_render_1.renderWeek; } });
|
|
179
|
+
// Sessions grouped by dominant model over a window, for a before and after across a model switch. The plugin detects it by `typeof modelsReport === 'function'`.
|
|
180
|
+
var models_1 = require("./insights/models");
|
|
181
|
+
Object.defineProperty(exports, "modelsReport", { enumerable: true, get: function () { return models_1.modelsReport; } });
|
|
182
|
+
Object.defineProperty(exports, "renderModels", { enumerable: true, get: function () { return models_1.renderModels; } });
|
|
183
|
+
Object.defineProperty(exports, "modelGroups", { enumerable: true, get: function () { return models_1.modelGroups; } });
|
|
184
|
+
Object.defineProperty(exports, "subagentsUnfinished", { enumerable: true, get: function () { return models_1.subagentsUnfinished; } });
|
|
185
|
+
Object.defineProperty(exports, "sessionBytes", { enumerable: true, get: function () { return models_1.sessionBytes; } });
|
|
186
|
+
Object.defineProperty(exports, "MODELS_DEFAULT_DAYS", { enumerable: true, get: function () { return models_1.MODELS_DEFAULT_DAYS; } });
|
|
187
|
+
Object.defineProperty(exports, "MODELS_MAX_DAYS", { enumerable: true, get: function () { return models_1.MODELS_MAX_DAYS; } });
|
|
188
|
+
Object.defineProperty(exports, "MODELS_DEFAULT_LIMIT", { enumerable: true, get: function () { return models_1.MODELS_DEFAULT_LIMIT; } });
|
|
189
|
+
Object.defineProperty(exports, "MODELS_MAX_LIMIT", { enumerable: true, get: function () { return models_1.MODELS_MAX_LIMIT; } });
|
|
190
|
+
Object.defineProperty(exports, "MODELS_DEFAULT_MAX_SESSION_BYTES", { enumerable: true, get: function () { return models_1.MODELS_DEFAULT_MAX_SESSION_BYTES; } });
|
|
191
|
+
Object.defineProperty(exports, "MODELS_MAX_SESSION_MEGABYTES", { enumerable: true, get: function () { return models_1.MODELS_MAX_SESSION_MEGABYTES; } });
|
|
@@ -161,6 +161,45 @@ export interface CompareText {
|
|
|
161
161
|
fewerThanTwo: (found: number, project: string | null) => string;
|
|
162
162
|
}
|
|
163
163
|
export declare const COMPARE_TEXT: Readonly<Record<WhyLang, CompareText>>;
|
|
164
|
+
/**
|
|
165
|
+
* Every line of the plain `models` report, under the rules of `compare`: words
|
|
166
|
+
* change, figures, ids, model ids, dates and commands do not. The metric labels,
|
|
167
|
+
* the sub-agent note and the list-price line are `compare`'s own, and the
|
|
168
|
+
* unpriced, missing-lifetime and fork wording is `why`'s, so the three reports
|
|
169
|
+
* use one vocabulary. A label (1, 2, 3) names a model group as A and B name a
|
|
170
|
+
* session in `compare`.
|
|
171
|
+
*/
|
|
172
|
+
export interface ModelsText {
|
|
173
|
+
/** `days` is the window the report covers, 1 to 365. */
|
|
174
|
+
title: (days: number) => string;
|
|
175
|
+
/** `since` is `YYYY-MM-DD HH:MM UTC`. */
|
|
176
|
+
scope: (sessions: number, since: string) => string;
|
|
177
|
+
none: (days: number) => string;
|
|
178
|
+
/** The group of sessions whose responses carry no model id. */
|
|
179
|
+
unknownModel: string;
|
|
180
|
+
sessions: (count: number) => string;
|
|
181
|
+
/** First and last session date, `YYYY-MM-DD`; one date when they are the same day. */
|
|
182
|
+
dates: (first: string, last: string) => string;
|
|
183
|
+
medianHeader: string;
|
|
184
|
+
totalHeader: string;
|
|
185
|
+
/** The row under Sub-agents launched. */
|
|
186
|
+
unfinished: string;
|
|
187
|
+
/** A cell no session of the group can fill. */
|
|
188
|
+
unknown: string;
|
|
189
|
+
/** How sub-agents ended is unknown for `unknown` of the group's `sessions`; the row covers the rest. */
|
|
190
|
+
unfinishedUnknown: (label: string, unknown: number, sessions: number) => string;
|
|
191
|
+
unfinishedSource: string;
|
|
192
|
+
/** `unpriced` of the group's `sessions` used a model without a verified rate, so the group's dollars are unpriced. */
|
|
193
|
+
unpricedGroup: (label: string, unpriced: number, sessions: number) => string;
|
|
194
|
+
overSize: (count: number, megabytes: number) => string;
|
|
195
|
+
unreadable: (count: number) => string;
|
|
196
|
+
usageUnavailable: (count: number) => string;
|
|
197
|
+
overLimit: (count: number, limit: number, maxLimit: number) => string;
|
|
198
|
+
startedBefore: (count: number) => string;
|
|
199
|
+
noResponseTime: (count: number) => string;
|
|
200
|
+
sameWork: string;
|
|
201
|
+
}
|
|
202
|
+
export declare const MODELS_TEXT: Readonly<Record<WhyLang, ModelsText>>;
|
|
164
203
|
/** A calendar date as the report names it: the month's short name, the day of the month and the year. */
|
|
165
204
|
export interface CalendarDate {
|
|
166
205
|
month: string;
|