@agentguard-run/burn 0.6.0 → 0.6.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 CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.6.1 (2026-10-18)
6
+
7
+ - `formatStatusFields` takes an optional `context` (`{tokens, threshold}`) and adds "28% to auto-compact" after the token figure (yellow at 30% of context left, red at 10%; the colour follows the number shown), plus the panel line "Context: 720,000 of 1,000,000 tokens, 28% left before Claude Code compacts the conversation.", in English, Spanish and Portuguese. Hidden without a threshold. The AgentGuard plugin's band supplies the figures; `statusline` has no compaction point to read and is unchanged.
8
+ - Past the session token limit the shared status text says "tokens 24B, past the 5B limit" (with "sub-agents wait for your yes" outside shadow mode) instead of the impossible "24B of 5B". The short forms for narrow widths say "past 5B".
5
9
  ## 0.6.0 (2026-10-10)
6
10
 
7
11
  A simple view by default and a compaction replay, so the first screen answers "how much is left and what do I change".
package/dist/src/cli.js CHANGED
File without changes
@@ -49,6 +49,11 @@ export interface StatusInput extends StatusMetrics {
49
49
  share?: number | null;
50
50
  windows?: UsageWindow[];
51
51
  fields?: string;
52
+ /** The live main-conversation context and the token count where Claude Code auto-compacts. */
53
+ context?: {
54
+ tokens: number;
55
+ threshold: number;
56
+ } | null;
52
57
  width?: number;
53
58
  lang?: keyof typeof STATUS_TEXT;
54
59
  now?: number;
@@ -67,6 +67,9 @@ function formatStatusFields(input) {
67
67
  const elapsed = (input.now ?? Date.now()) - window.observedAt;
68
68
  return elapsed > 60000 ? words.ago.replace('{minutes}', String(Math.floor(elapsed / 60000))) : '';
69
69
  };
70
+ const ctx = input.context && Number.isFinite(input.context.tokens) && input.context.tokens >= 0 &&
71
+ Number.isFinite(input.context.threshold) && input.context.threshold > 0 ? input.context : null;
72
+ const left = ctx ? Math.max(0, Math.round(100 - (100 * ctx.tokens) / ctx.threshold)) : null;
70
73
  const optional = new Map();
71
74
  if (pace !== null)
72
75
  optional.set('pace', { text: `${words.limit} ${duration(pace)}`, color: pace < 30 ? 'yellow' : null });
@@ -92,7 +95,19 @@ function formatStatusFields(input) {
92
95
  const color = statusColor(win.count, win.limit);
93
96
  out.push({ text: ` ${short > 1 ? 'a' : words.agents} ${win.count}${short ? '/' : ` ${words.of} `}${win.limit}`, color, dim: !color });
94
97
  const add = (text, extra = {}) => out.push({ text: ` · ${text}`, dim: !extra.color, ...extra });
95
- add(`${short > 1 ? 't' : words.tokens} ${statusCount(burn.tokens.used)}${short ? '/' : ` ${words.of} `}${statusCount(burn.tokens.limit)}`, { color: statusColor(burn.tokens.used, burn.tokens.limit) });
98
+ const label = short > 1 ? 't' : words.tokens, limit = statusCount(burn.tokens.limit);
99
+ // A session past its ceiling keeps counting. "24B of 5B" reads as broken, so say what the state is.
100
+ if (burn.tokens.limit > 0 && burn.tokens.used >= burn.tokens.limit) {
101
+ const past = (short ? words.pastShort : words.pastLimit).replace('{limit}', limit);
102
+ add(`${label} ${statusCount(burn.tokens.used)}, ${past}${!short && burn.mode !== 'shadow' ? `: ${words.waits}` : ''}`, { color: 'red' });
103
+ }
104
+ else
105
+ add(`${label} ${statusCount(burn.tokens.used)}${short ? '/' : ` ${words.of} `}${limit}`, { color: statusColor(burn.tokens.used, burn.tokens.limit) });
106
+ if (ctx && left !== null) {
107
+ // The colour follows the number shown, so "30%" is always yellow and "10%" always red.
108
+ const color = left <= 10 ? 'red' : left <= 30 ? 'yellow' : null;
109
+ add(short > 1 ? `ac ${left}%` : `${left}% ${short ? words.compactShort : words.compact}`, color ? { color } : {});
110
+ }
96
111
  if (typeof input.share === 'number' && Number.isFinite(input.share))
97
112
  add(`${Math.round(input.share)}% ${short ? words.sub : words.share}`);
98
113
  if (plan)
@@ -123,6 +138,8 @@ function formatStatusFields(input) {
123
138
  const fullText = output.map(part => part.text).join('');
124
139
  const text = [...fullText].slice(0, width).join('');
125
140
  const panel = [
141
+ ...(ctx && left !== null ? [words.contextLine.replace('{used}', Math.round(ctx.tokens).toLocaleString('en-US'))
142
+ .replace('{threshold}', Math.round(ctx.threshold).toLocaleString('en-US')).replace('{left}', String(left))] : []),
126
143
  ...plans.map(window => `${words.plan} ${Math.round(window.usedPercent)}% (${planName(window)}). ${words.reset} ${Number.isFinite(window.resetsAt) ? new Date(window.resetsAt).toISOString() : words.none}.${age(window) ? ` ${words.lastRead} ${age(window)}.` : ''}`),
127
144
  pace !== null ? `${words.limit} ${duration(pace)}.` : words.paceEmpty,
128
145
  input.cost ? `${words.costLead} ≈ ${money(input.cost, words.range)} ${words.costFull}.` : words.costEmpty,
@@ -10,6 +10,12 @@ export declare const STATUS_TEXT: {
10
10
  share: string;
11
11
  sub: string;
12
12
  weekly: string;
13
+ pastLimit: string;
14
+ pastShort: string;
15
+ waits: string;
16
+ compact: string;
17
+ compactShort: string;
18
+ contextLine: string;
13
19
  limit: string;
14
20
  cache: string;
15
21
  spend: string;
@@ -45,6 +51,12 @@ export declare const STATUS_TEXT: {
45
51
  share: string;
46
52
  sub: string;
47
53
  weekly: string;
54
+ pastLimit: string;
55
+ pastShort: string;
56
+ waits: string;
57
+ compact: string;
58
+ compactShort: string;
59
+ contextLine: string;
48
60
  limit: string;
49
61
  cache: string;
50
62
  spend: string;
@@ -80,6 +92,12 @@ export declare const STATUS_TEXT: {
80
92
  share: string;
81
93
  sub: string;
82
94
  weekly: string;
95
+ pastLimit: string;
96
+ pastShort: string;
97
+ waits: string;
98
+ compact: string;
99
+ compactShort: string;
100
+ contextLine: string;
83
101
  limit: string;
84
102
  cache: string;
85
103
  spend: string;
@@ -4,6 +4,8 @@ exports.STATUS_TEXT = void 0;
4
4
  // Display-only words shared with the Claude mod. No environment or I/O here.
5
5
  exports.STATUS_TEXT = {
6
6
  en: { ago: '{minutes}m ago', lastRead: 'Last read', range: 'to', fiveHour: '5-hour', agents: 'sub-agents', tokens: 'tokens', of: 'of', share: 'to sub-agents', sub: 'sub', weekly: 'weekly',
7
+ pastLimit: 'past the {limit} limit', pastShort: 'past {limit}', waits: 'sub-agents wait for your yes', compact: 'to auto-compact', compactShort: 'to compact',
8
+ contextLine: 'Context: {used} of {threshold} tokens, {left}% left before Claude Code compacts the conversation.',
7
9
  limit: 'limit in', cache: 'cache waste', spend: 'spend', today: 'today', list: 'list', watching: 'watching only',
8
10
  unavailable: 'status unavailable', starting: 'starting', costFull: 'at API list price, not a bill',
9
11
  paceEmpty: 'Pace needs two rising plan usage samples and a limit reached before reset.',
@@ -14,6 +16,8 @@ exports.STATUS_TEXT = {
14
16
  enabled: 'Optional status fields on:', none: 'none', change: 'Change status_fields in the AgentGuard plugin settings, or pass the fields flag to Burn statusline.',
15
17
  unknown: 'Ignored unknown status fields:', reset: 'Resets at', plan: 'Plan usage:', hidden: 'Fields hidden to fit this width:' },
16
18
  es: { ago: 'hace {minutes}min', lastRead: 'Última lectura', range: 'a', fiveHour: '5 horas', agents: 'subagentes', tokens: 'tokens', of: 'de', share: 'a subagentes', sub: 'sub', weekly: 'semanal',
19
+ pastLimit: 'pasó el límite de {limit}', pastShort: 'pasó {limit}', waits: 'los subagentes esperan tu sí', compact: 'para autocompactar', compactShort: 'hasta compactar',
20
+ contextLine: 'Contexto: {used} de {threshold} tokens, queda {left}% antes de que Claude Code compacte la conversación.',
17
21
  limit: 'límite en', cache: 'caché reescrita', spend: 'gasto', today: 'hoy', list: 'lista', watching: 'solo observando',
18
22
  unavailable: 'estado no disponible', starting: 'iniciando', costFull: 'a precio de lista de la API, no es una factura',
19
23
  paceEmpty: 'El ritmo necesita dos muestras crecientes del plan y alcanzar el límite antes del reinicio.',
@@ -24,6 +28,8 @@ exports.STATUS_TEXT = {
24
28
  enabled: 'Campos opcionales activos:', none: 'ninguno', change: 'Cambia status_fields en los ajustes del plugin AgentGuard o pasa la opción fields a Burn statusline.',
25
29
  unknown: 'Campos de estado desconocidos ignorados:', reset: 'Se reinicia a las', plan: 'Uso del plan:', hidden: 'Campos ocultos para caber en este ancho:' },
26
30
  pt: { ago: 'há {minutes}min', lastRead: 'Última leitura', range: 'a', fiveHour: '5 horas', agents: 'subagentes', tokens: 'tokens', of: 'de', share: 'para subagentes', sub: 'sub', weekly: 'semanal',
31
+ pastLimit: 'passou do limite de {limit}', pastShort: 'passou {limit}', waits: 'subagentes esperam seu sim', compact: 'até autocompactar', compactShort: 'até compactar',
32
+ contextLine: 'Contexto: {used} de {threshold} tokens, resta {left}% antes de o Claude Code compactar a conversa.',
27
33
  limit: 'limite em', cache: 'cache regravado', spend: 'gasto', today: 'hoje', list: 'lista', watching: 'só observando',
28
34
  unavailable: 'status indisponível', starting: 'iniciando', costFull: 'a preço de lista da API, não é uma fatura',
29
35
  paceEmpty: 'O ritmo precisa de duas amostras crescentes do plano e atingir o limite antes da renovação.',
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@agentguard-run/burn",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
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
  "homepage": "https://agentguard.run/burn",
7
7
  "bugs": {
8
- "url": "https://github.com/MerchantGuard/agentguard-codex-plugin/issues"
8
+ "url": "https://github.com/agentguard-run/agentguard-codex-plugin/issues"
9
9
  },
10
10
  "type": "commonjs",
11
11
  "main": "dist/src/index.js",