@agentguard-run/burn 0.3.16 → 0.3.18
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 +18 -0
- package/README.md +28 -3
- package/dist/src/adapters/codex.js +4 -3
- package/dist/src/adapters/cursor.js +4 -3
- package/dist/src/cli.js +33 -2
- 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/i18n.d.ts +65 -0
- package/dist/src/insights/i18n.js +152 -0
- package/dist/src/insights/live.d.ts +5 -1
- package/dist/src/insights/live.js +3 -2
- package/dist/src/insights/render.d.ts +5 -2
- package/dist/src/insights/render.js +29 -36
- 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 +37 -0
- package/dist/src/stop-text.js +59 -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,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The words of a STOP, shared by every surface that shows one: the plain box
|
|
3
|
+
* a hook returns, the canvas frame, the permission prompt, the override
|
|
4
|
+
* confirmation and each host adapter. One source keeps them from drifting
|
|
5
|
+
* apart. On Sep 26 2026 the box named the token limit while the override
|
|
6
|
+
* confirmation quoted the first finding in the list, a fan-out warning with
|
|
7
|
+
* a different number, so one refusal showed three different limits.
|
|
8
|
+
*/
|
|
9
|
+
import type { BurnReport } from './types';
|
|
10
|
+
/** Where the person continues from. */
|
|
11
|
+
export type StopHost = 'claude-code' | 'codex' | 'cursor';
|
|
12
|
+
/**
|
|
13
|
+
* The override the person runs. The scoped package name works for everyone,
|
|
14
|
+
* including plugin-only installs that never put `agentguard-burn` on PATH.
|
|
15
|
+
*/
|
|
16
|
+
export declare const OVERRIDE_COMMAND = "npx @agentguard-run/burn resume --once --reason \"...\"";
|
|
17
|
+
/** The one limit that stopped this launch, in its own words and numbers. */
|
|
18
|
+
export declare function stopSummary(report: BurnReport): string;
|
|
19
|
+
/** The finding a one-line message should lead with: the STOP, else the first WARN, else the first finding. */
|
|
20
|
+
export declare function primarySummary(report: BurnReport): string;
|
|
21
|
+
export declare function sessionSoFar(report: BurnReport, subject?: 'spawn' | 'call'): string;
|
|
22
|
+
/**
|
|
23
|
+
* How the person continues once. In Claude Code a command typed with `!` runs
|
|
24
|
+
* in the person's own shell and never passes through a hook, so it is the
|
|
25
|
+
* person's key; the same command attempted by the agent is refused.
|
|
26
|
+
*/
|
|
27
|
+
export declare function continueLines(host: StopHost | undefined, subject?: 'spawn' | 'call'): [string, string];
|
|
28
|
+
/**
|
|
29
|
+
* The text of Claude Code's permission prompt when a STOP holds a launch.
|
|
30
|
+
* Claude Code shows this to the person and not to Claude.
|
|
31
|
+
*/
|
|
32
|
+
export declare function askReason(report: BurnReport): string;
|
|
33
|
+
/** The line after a person-approved override, naming the limit it passed. */
|
|
34
|
+
export declare function overriddenLine(report: BurnReport, override: {
|
|
35
|
+
once: boolean;
|
|
36
|
+
reason: string;
|
|
37
|
+
}): string;
|
|
@@ -0,0 +1,59 @@
|
|
|
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 scoped package name works for everyone,
|
|
12
|
+
* including plugin-only installs that never put `agentguard-burn` on PATH.
|
|
13
|
+
*/
|
|
14
|
+
exports.OVERRIDE_COMMAND = 'npx @agentguard-run/burn resume --once --reason "..."';
|
|
15
|
+
function fmt(n) {
|
|
16
|
+
if (n >= 1e9)
|
|
17
|
+
return `${(n / 1e9).toFixed(2)}B`;
|
|
18
|
+
if (n >= 1e6)
|
|
19
|
+
return `${(n / 1e6).toFixed(1)}M`;
|
|
20
|
+
if (n >= 1e3)
|
|
21
|
+
return `${(n / 1e3).toFixed(0)}K`;
|
|
22
|
+
return String(Math.round(n));
|
|
23
|
+
}
|
|
24
|
+
/** The one limit that stopped this launch, in its own words and numbers. */
|
|
25
|
+
function stopSummary(report) {
|
|
26
|
+
return report.findings.find((f) => f.verdict === 'STOP')?.summary
|
|
27
|
+
?? 'Sub-agents starting right now would pass the fan-out limit.';
|
|
28
|
+
}
|
|
29
|
+
/** The finding a one-line message should lead with: the STOP, else the first WARN, else the first finding. */
|
|
30
|
+
function primarySummary(report) {
|
|
31
|
+
return (report.findings.find((f) => f.verdict === 'STOP') ?? report.findings.find((f) => f.verdict === 'WARN') ?? report.findings[0])?.summary ?? '';
|
|
32
|
+
}
|
|
33
|
+
function sessionSoFar(report, subject = 'spawn') {
|
|
34
|
+
return subject === 'call'
|
|
35
|
+
? `Session so far: ${fmt(report.totals.tokens)} tokens.`
|
|
36
|
+
: `Session so far: ${report.totals.spawns} sub-agents, ${fmt(report.totals.tokens)} tokens.`;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* How the person continues once. In Claude Code a command typed with `!` runs
|
|
40
|
+
* in the person's own shell and never passes through a hook, so it is the
|
|
41
|
+
* person's key; the same command attempted by the agent is refused.
|
|
42
|
+
*/
|
|
43
|
+
function continueLines(host, subject = 'spawn') {
|
|
44
|
+
const what = subject === 'call' ? 'send it' : 'launch it';
|
|
45
|
+
return host === 'claude-code'
|
|
46
|
+
? [`To ${what} anyway, once, type this yourself:`, `! ${exports.OVERRIDE_COMMAND}`]
|
|
47
|
+
: [`To ${what} anyway, once, run this in a terminal:`, exports.OVERRIDE_COMMAND];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The text of Claude Code's permission prompt when a STOP holds a launch.
|
|
51
|
+
* Claude Code shows this to the person and not to Claude.
|
|
52
|
+
*/
|
|
53
|
+
function askReason(report) {
|
|
54
|
+
return `AgentGuard: ${stopSummary(report)}\n${sessionSoFar(report)}\nAllow this one launch? If you say no, nothing starts.`;
|
|
55
|
+
}
|
|
56
|
+
/** The line after a person-approved override, naming the limit it passed. */
|
|
57
|
+
function overriddenLine(report, override) {
|
|
58
|
+
return `AgentGuard STOP overridden${override.once ? ' once' : ''} ("${override.reason}"): ${stopSummary(report)}`;
|
|
59
|
+
}
|
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.18",
|
|
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",
|