@agentguard-run/burn 0.3.12 → 0.3.13
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 +5 -0
- package/README.md +8 -0
- package/dist/src/cli.js +2 -0
- package/dist/src/defaults.js +1 -0
- package/dist/src/detectors/evaluate.js +10 -1
- package/dist/src/insights/sessions.d.ts +2 -0
- package/dist/src/insights/sessions.js +12 -1
- package/dist/src/types.d.ts +8 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.13 (2026-09-24)
|
|
4
|
+
|
|
5
|
+
- `why`, `blocks` and the other insight commands: with no session given, the newest top-level transcript is selected. A subagent's own transcript (`<session>/subagents/agent-*.jsonl`) was often the newest file on disk and, read alone, reported 100% fan-out and nothing else. Subagent transcripts stay selectable by id.
|
|
6
|
+
- `account.stopConcurrentSessions` (default `null`): a hard ceiling on live sessions for the machine. Above it, every spawn proposal on the machine is refused with an `account` STOP until a session finishes; other tool calls are untouched and a plain status evaluation only warns. For hosts that start sessions on their own, such as Claude Code Projects running threads locally. `calibrate` and `policy` print the machine line beside the spawn-rate line.
|
|
7
|
+
|
|
3
8
|
## 0.3.12 (2026-09-24)
|
|
4
9
|
|
|
5
10
|
- `render --playback <rate>` (1 to 4) for both the recorded render and the dashboard: a faster cut of the same recording. Recorded renders divide every frame interval by the rate and the header reads "RECORDED · 1.5x"; the dashboard samples recorded time at the rate and draws "PLAYBACK 1.5x" under the counters on every frame. Frame times in provenance stay in recorded time; provenance records `playback` (and `video_seconds` for the dashboard).
|
package/README.md
CHANGED
|
@@ -462,6 +462,14 @@ Both token limits default to `null`. Closed gateway sessions are excluded;
|
|
|
462
462
|
hook and gateway session files are both read. WARN never blocks. STOP records
|
|
463
463
|
a would-block decision in shadow and blocks new work only in enforce mode.
|
|
464
464
|
|
|
465
|
+
`account.stopConcurrentSessions` (default `null`) is a hard ceiling on live
|
|
466
|
+
sessions for the machine. Above it, every spawn proposal on the machine is
|
|
467
|
+
refused until a session finishes; other tool calls are untouched, and a plain
|
|
468
|
+
status evaluation only warns. It is meant for hosts that start sessions on
|
|
469
|
+
their own, such as Claude Code Projects running threads locally: the project
|
|
470
|
+
can run as many threads as it likes, but none of them may add copies while
|
|
471
|
+
the machine is over your number.
|
|
472
|
+
|
|
465
473
|
## Terminal canvas and local recordings
|
|
466
474
|
|
|
467
475
|
Interactive screens use a fixed 104 by 35 cell canvas, with mint for good, slate for neutral, amber for WARN and red for STOP. Smaller terminals drop side detail and paginate rows without wrapping. Use --no-color for the existing plain-text commands and hook cards. Hook JSON and the one-line statusline remain host protocols, with no canvas control sequences inserted.
|
package/dist/src/cli.js
CHANGED
|
@@ -278,6 +278,7 @@ async function main(argv) {
|
|
|
278
278
|
` sustained WARN ${(t.sustained.warnTokens / 1e9).toFixed(2)}B STOP ${(t.sustained.stopTokens / 1e9).toFixed(2)}B`,
|
|
279
279
|
` fan-out lifetime WARN ${t.fanout.warn}; STOP above ${t.fanout.stop} spawns in ${t.fanout.windowActiveMinutes ?? 120} active minutes; depth above ${t.fanout.maxDepth}`,
|
|
280
280
|
` spawn-rate WARN ${t.spawnRate?.warn ?? 8}; STOP ${t.spawnRate?.stop ?? 16} in ${t.spawnRate?.windowActiveMinutes ?? 15} active minutes; ${t.spawnRate?.enforce === false ? 'shadow only' : 'enforcing in enforce mode'}`,
|
|
281
|
+
` machine WARN above ${t.account?.warnConcurrentSessions ?? 4} live sessions; ${t.account?.stopConcurrentSessions != null ? `no new copies above ${t.account.stopConcurrentSessions}` : 'no concurrency ceiling (account.stopConcurrentSessions is null)'}`,
|
|
281
282
|
` burn-debt ${t.burnDebt.enabled ? `ON, baseline ${Math.round(t.burnDebt.baselinePerActiveMinute / 1e6)}M/active-min` : 'off'}`,
|
|
282
283
|
...result.notes.map((n) => ` note: ${n}`),
|
|
283
284
|
`Policy written to ${(0, node_path_1.join)(HOME, 'burn-policy.json')} in SHADOW mode.`,
|
|
@@ -295,6 +296,7 @@ async function main(argv) {
|
|
|
295
296
|
`mode: ${policy.mode}${policy.mode === 'enforce' ? ' (the next STOP blocks)' : ' (recording only; nothing is blocked)'}`,
|
|
296
297
|
`thresholds: fan-out lifetime WARN ${policy.thresholds.fanout.warn}; STOP above ${policy.thresholds.fanout.stop} spawns in ${policy.thresholds.fanout.windowActiveMinutes ?? 120} active minutes; depth above ${policy.thresholds.fanout.maxDepth}`,
|
|
297
298
|
`spawn-rate: WARN ${policy.thresholds.spawnRate?.warn ?? 8}; STOP ${policy.thresholds.spawnRate?.stop ?? 16} in ${policy.thresholds.spawnRate?.windowActiveMinutes ?? 15} active minutes; ${policy.thresholds.spawnRate?.enforce === false ? 'shadow only' : 'enforcing in enforce mode'}`,
|
|
299
|
+
`machine: WARN above ${policy.thresholds.account?.warnConcurrentSessions ?? 4} live sessions; ${policy.thresholds.account?.stopConcurrentSessions != null ? `no new copies above ${policy.thresholds.account.stopConcurrentSessions}` : 'no concurrency ceiling (account.stopConcurrentSessions is null)'}`,
|
|
298
300
|
`sustained: ${(policy.thresholds.sustained.warnTokens / 1e9).toFixed(1)}B/${(policy.thresholds.sustained.stopTokens / 1e9).toFixed(1)}B local-compute warn at ${lc?.warnConcurrent ?? 4} concurrent${lc?.stopConcurrent ? `, stop at ${lc.stopConcurrent}` : ' (no stop set)'}`,
|
|
299
301
|
policy.calibration ? `calibrated from ${policy.calibration.sessionsSampled} sessions` : 'using shipped defaults (run: agentguard-burn calibrate)',
|
|
300
302
|
`shadow observation: ${e.decisions} decisions over ${e.days.toFixed(1)} days`,
|
package/dist/src/defaults.js
CHANGED
|
@@ -44,6 +44,7 @@ exports.DEFAULT_THRESHOLDS = {
|
|
|
44
44
|
warnTokens: null,
|
|
45
45
|
windowActiveMinutes: 300,
|
|
46
46
|
warnConcurrentSessions: 4,
|
|
47
|
+
stopConcurrentSessions: null,
|
|
47
48
|
},
|
|
48
49
|
// Local model runtimes. Elapsed request time is not GPU utilisation (it
|
|
49
50
|
// includes queueing and transport), so it is called occupied time and it
|
|
@@ -140,7 +140,16 @@ function evaluate(state, thresholds, proposedSpawnDepth = null, account) {
|
|
|
140
140
|
if (account && thresholds.account) {
|
|
141
141
|
const t = thresholds.account;
|
|
142
142
|
const live = account.sessions.filter((s) => account.now - s.lastEventAt <= account_1.ACTIVE_SESSION_WINDOW_MS);
|
|
143
|
-
if (live.length > t.
|
|
143
|
+
if (t.stopConcurrentSessions != null && live.length > t.stopConcurrentSessions) {
|
|
144
|
+
// The machine is over its concurrency ceiling. A spawn proposal is refused;
|
|
145
|
+
// a plain session evaluation only reports it, since nothing is being added.
|
|
146
|
+
const severity = proposedSpawnDepth !== null ? 'STOP' : 'WARN';
|
|
147
|
+
findings.push({ detector: 'account', verdict: severity,
|
|
148
|
+
summary: `${live.length} concurrent active sessions on this machine; ceiling is ${t.stopConcurrentSessions}. ${proposedSpawnDepth !== null ? 'No session may add a copy until one finishes.' : 'New copies are refused until one finishes.'}`,
|
|
149
|
+
observed: live.length, threshold: t.stopConcurrentSessions });
|
|
150
|
+
verdict = worst(verdict, severity);
|
|
151
|
+
}
|
|
152
|
+
else if (live.length > t.warnConcurrentSessions) {
|
|
144
153
|
findings.push({ detector: 'account', verdict: 'WARN',
|
|
145
154
|
summary: `${live.length} concurrent active sessions on this machine; warning threshold is ${t.warnConcurrentSessions}.`,
|
|
146
155
|
observed: live.length, threshold: t.warnConcurrentSessions });
|
|
@@ -10,3 +10,5 @@ export declare function discoverInsightTranscripts(roots?: {
|
|
|
10
10
|
codex: string;
|
|
11
11
|
}): TranscriptLocation[];
|
|
12
12
|
export declare function selectInsightTranscript(session?: string, locations?: TranscriptLocation[]): TranscriptLocation;
|
|
13
|
+
/** Claude Code stores each subagent's transcript beside its parent under `subagents/`. */
|
|
14
|
+
export declare function isSubagentTranscript(location: Pick<TranscriptLocation, 'path' | 'sessionId'>): boolean;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.discoverInsightTranscripts = discoverInsightTranscripts;
|
|
4
4
|
exports.selectInsightTranscript = selectInsightTranscript;
|
|
5
|
+
exports.isSubagentTranscript = isSubagentTranscript;
|
|
5
6
|
const node_fs_1 = require("node:fs");
|
|
6
7
|
const node_path_1 = require("node:path");
|
|
7
8
|
const node_os_1 = require("node:os");
|
|
@@ -44,8 +45,18 @@ function selectInsightTranscript(session, locations) {
|
|
|
44
45
|
return { path, host: /(?:rollout-|[\\/]\.codex[\\/])/.test(path) ? 'codex' : 'claude', sessionId: (0, node_path_1.basename)(path, '.jsonl'), modifiedAt: (0, node_fs_1.statSync)(path).mtimeMs };
|
|
45
46
|
}
|
|
46
47
|
const candidates = locations ?? discoverInsightTranscripts();
|
|
47
|
-
|
|
48
|
+
// With nothing requested, the newest top-level session wins. A subagent's own
|
|
49
|
+
// transcript (Claude Code keeps them under <session>/subagents/agent-*.jsonl) is
|
|
50
|
+
// often the newest file on disk, and read alone it reports 100% fan-out and
|
|
51
|
+
// nothing else, which tells the operator nothing. It stays reachable by id.
|
|
52
|
+
const selected = requested
|
|
53
|
+
? candidates.find(item => item.sessionId === requested || item.sessionId.endsWith(`-${requested}`))
|
|
54
|
+
: candidates.find(item => !isSubagentTranscript(item)) ?? candidates[0];
|
|
48
55
|
if (!selected)
|
|
49
56
|
throw new Error(requested ? 'Session transcript not found. Pass its local JSONL path.' : 'No local Claude Code or Codex transcript found.');
|
|
50
57
|
return selected;
|
|
51
58
|
}
|
|
59
|
+
/** Claude Code stores each subagent's transcript beside its parent under `subagents/`. */
|
|
60
|
+
function isSubagentTranscript(location) {
|
|
61
|
+
return (0, node_path_1.basename)((0, node_path_1.dirname)(location.path)) === 'subagents' || location.sessionId.startsWith('agent-');
|
|
62
|
+
}
|
package/dist/src/types.d.ts
CHANGED
|
@@ -118,6 +118,14 @@ export interface Thresholds {
|
|
|
118
118
|
warnTokens: number | null;
|
|
119
119
|
windowActiveMinutes: number;
|
|
120
120
|
warnConcurrentSessions: number;
|
|
121
|
+
/**
|
|
122
|
+
* Hard ceiling on live sessions for this machine. Above it, no session may
|
|
123
|
+
* add a copy until one finishes (a spawn proposal is refused; other tool
|
|
124
|
+
* calls are untouched). `null` keeps the WARN-only default. Meant for
|
|
125
|
+
* hosts that start sessions on their own, such as Claude Code Projects
|
|
126
|
+
* running threads locally.
|
|
127
|
+
*/
|
|
128
|
+
stopConcurrentSessions: number | null;
|
|
121
129
|
};
|
|
122
130
|
/**
|
|
123
131
|
* Local inference plane (Ollama, vLLM, LM Studio). Token dollars are close
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentguard-run/burn",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.13",
|
|
4
4
|
"description": "Local session usage and runaway-agent circuit breaker. Explain tokens, cache rewrites and API list cost, track pace, warn on heavy turns, and gate agent fan-out with signed receipts. Developer command ranking requires explicit --rank.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"type": "commonjs",
|