@agentguard-run/burn 0.3.17 → 0.3.19
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 +21 -0
- package/README.md +67 -3
- package/dist/src/adapters/codex.js +4 -3
- package/dist/src/adapters/cursor.js +4 -3
- package/dist/src/cli.js +38 -4
- package/dist/src/conformance.js +2 -2
- package/dist/src/detectors/evaluate.js +36 -36
- package/dist/src/frames.d.ts +3 -1
- package/dist/src/frames.js +5 -4
- package/dist/src/hook/pre-tool-use.d.ts +20 -2
- package/dist/src/hook/pre-tool-use.js +84 -13
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.js +13 -2
- package/dist/src/insights/compare.d.ts +104 -0
- package/dist/src/insights/compare.js +210 -0
- package/dist/src/insights/i18n.d.ts +38 -7
- package/dist/src/insights/i18n.js +81 -7
- package/dist/src/insights/render.d.ts +24 -2
- package/dist/src/insights/render.js +25 -16
- package/dist/src/insights/sessions.d.ts +25 -0
- package/dist/src/insights/sessions.js +72 -5
- package/dist/src/insights/types.d.ts +3 -0
- package/dist/src/insights/types.js +3 -1
- package/dist/src/live-panel.d.ts +1 -1
- package/dist/src/live-panel.js +8 -7
- package/dist/src/replay/render.d.ts +2 -0
- package/dist/src/replay/render.js +15 -12
- package/dist/src/stop-text.d.ts +39 -0
- package/dist/src/stop-text.js +61 -0
- package/dist/src/types.d.ts +9 -0
- package/fixtures/live-sep20-stop-104x35.txt +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OVERRIDE_COMMAND = void 0;
|
|
4
|
+
exports.stopSummary = stopSummary;
|
|
5
|
+
exports.primarySummary = primarySummary;
|
|
6
|
+
exports.sessionSoFar = sessionSoFar;
|
|
7
|
+
exports.continueLines = continueLines;
|
|
8
|
+
exports.askReason = askReason;
|
|
9
|
+
exports.overriddenLine = overriddenLine;
|
|
10
|
+
/**
|
|
11
|
+
* The override the person runs. The unscoped `agentguard-burn` launcher runs
|
|
12
|
+
* the latest Burn through npx, so it works for everyone, including plugin-only
|
|
13
|
+
* installs that never put a Burn binary on PATH, and it has no "@" for X to
|
|
14
|
+
* turn into a mention link when it is quoted in a post.
|
|
15
|
+
*/
|
|
16
|
+
exports.OVERRIDE_COMMAND = 'npx agentguard-burn resume --once --reason "..."';
|
|
17
|
+
function fmt(n) {
|
|
18
|
+
if (n >= 1e9)
|
|
19
|
+
return `${(n / 1e9).toFixed(2)}B`;
|
|
20
|
+
if (n >= 1e6)
|
|
21
|
+
return `${(n / 1e6).toFixed(1)}M`;
|
|
22
|
+
if (n >= 1e3)
|
|
23
|
+
return `${(n / 1e3).toFixed(0)}K`;
|
|
24
|
+
return String(Math.round(n));
|
|
25
|
+
}
|
|
26
|
+
/** The one limit that stopped this launch, in its own words and numbers. */
|
|
27
|
+
function stopSummary(report) {
|
|
28
|
+
return report.findings.find((f) => f.verdict === 'STOP')?.summary
|
|
29
|
+
?? 'Sub-agents starting right now would pass the fan-out limit.';
|
|
30
|
+
}
|
|
31
|
+
/** The finding a one-line message should lead with: the STOP, else the first WARN, else the first finding. */
|
|
32
|
+
function primarySummary(report) {
|
|
33
|
+
return (report.findings.find((f) => f.verdict === 'STOP') ?? report.findings.find((f) => f.verdict === 'WARN') ?? report.findings[0])?.summary ?? '';
|
|
34
|
+
}
|
|
35
|
+
function sessionSoFar(report, subject = 'spawn') {
|
|
36
|
+
return subject === 'call'
|
|
37
|
+
? `Session so far: ${fmt(report.totals.tokens)} tokens.`
|
|
38
|
+
: `Session so far: ${report.totals.spawns} sub-agents, ${fmt(report.totals.tokens)} tokens.`;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* How the person continues once. In Claude Code a command typed with `!` runs
|
|
42
|
+
* in the person's own shell and never passes through a hook, so it is the
|
|
43
|
+
* person's key; the same command attempted by the agent is refused.
|
|
44
|
+
*/
|
|
45
|
+
function continueLines(host, subject = 'spawn') {
|
|
46
|
+
const what = subject === 'call' ? 'send it' : 'launch it';
|
|
47
|
+
return host === 'claude-code'
|
|
48
|
+
? [`To ${what} anyway, once, type this yourself:`, `! ${exports.OVERRIDE_COMMAND}`]
|
|
49
|
+
: [`To ${what} anyway, once, run this in a terminal:`, exports.OVERRIDE_COMMAND];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The text of Claude Code's permission prompt when a STOP holds a launch.
|
|
53
|
+
* Claude Code shows this to the person and not to Claude.
|
|
54
|
+
*/
|
|
55
|
+
function askReason(report) {
|
|
56
|
+
return `AgentGuard: ${stopSummary(report)}\n${sessionSoFar(report)}\nAllow this one launch? If you say no, nothing starts.`;
|
|
57
|
+
}
|
|
58
|
+
/** The line after a person-approved override, naming the limit it passed. */
|
|
59
|
+
function overriddenLine(report, override) {
|
|
60
|
+
return `AgentGuard STOP overridden${override.once ? ' once' : ''} ("${override.reason}"): ${stopSummary(report)}`;
|
|
61
|
+
}
|
package/dist/src/types.d.ts
CHANGED
|
@@ -147,6 +147,15 @@ export interface Policy {
|
|
|
147
147
|
teamPolicyFile?: string;
|
|
148
148
|
mode: Mode;
|
|
149
149
|
thresholds: Thresholds;
|
|
150
|
+
/**
|
|
151
|
+
* How an enforced STOP reaches the person in an interactive Claude Code
|
|
152
|
+
* session. "ask" (the default) holds the launch behind Claude Code's own
|
|
153
|
+
* permission prompt: the person answers with one keypress, Claude never sees
|
|
154
|
+
* the reason, and auto mode cannot approve it silently. "deny" refuses
|
|
155
|
+
* outright everywhere. Hosts and modes that cannot show a prompt (print
|
|
156
|
+
* mode, bypassPermissions, dontAsk, Codex, Cursor) always refuse.
|
|
157
|
+
*/
|
|
158
|
+
stopStyle?: 'ask' | 'deny';
|
|
150
159
|
/** Additive local usage advisories. Older policy files use these defaults. */
|
|
151
160
|
insights?: {
|
|
152
161
|
rewriteWarnDollarsPerHour?: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentguard-run/burn",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.19",
|
|
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",
|