@agentguard-run/burn 0.6.2 → 0.7.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 +14 -0
- package/README.md +26 -0
- package/dist/src/canvas.d.ts +7 -1
- package/dist/src/canvas.js +17 -1
- package/dist/src/cli.d.ts +1 -0
- package/dist/src/cli.js +25 -1
- package/dist/src/copy-ramp.d.ts +73 -0
- package/dist/src/copy-ramp.js +118 -0
- package/dist/src/dashboard-render.js +8 -4
- package/dist/src/hook-edit.d.ts +28 -0
- package/dist/src/hook-edit.js +232 -0
- package/dist/src/install-all.d.ts +209 -0
- package/dist/src/install-all.js +877 -0
- package/dist/src/live-panel.js +5 -2
- package/dist/src/render-recording.js +3 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.7.1 (2026-10-29)
|
|
4
|
+
|
|
5
|
+
- 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.
|
|
6
|
+
- The phone panel paints one ramp colour per launched copy instead of the spawn bar's state colour, which at the ceiling painted every copy red. The dashboard's ring markers and child cost bars carry the ramp too; the warn state stays on the arc, the bar and the counters.
|
|
7
|
+
- `ajv` moves to 8.18.0 (still an exact pin, was 8.17.1), which carries the upstream fix for GHSA-2g4f-4pwh-qvx6. The lockfile resolves `fast-uri` 3.1.9 (was 3.1.8), which carries the upstream fixes for GHSA-w74x-v6f9-j3xg and GHSA-wjr9-j795-jxcr.
|
|
8
|
+
- The `agentguard-burn` wrapper (0.7.1) requires `@agentguard-run/burn` ^0.7.1, so `npx agentguard-burn` gets this release.
|
|
9
|
+
|
|
10
|
+
## 0.7.0 (2026-10-28)
|
|
11
|
+
|
|
12
|
+
- Add `install`: one command for every agent host on this computer. It finds Claude Code, Codex, Cursor and Hermes by their command on PATH and their config folder, reading files only, and prints the plan: each host, the exact commands and the files they change. `--yes` carries it out: the AgentGuard plugin through Claude Code's and Codex's own plugin commands (with `npm ci` in Codex's plugin folder, and in Claude Code's only when it left the dependencies out), Burn's hook merged into `~/.cursor/hooks.json`, and `agentguard-spend-hermes` installed with uv into the Python environment Hermes runs from, then enabled. It then reads each host again and prints one line per host (installed, already installed, skipped, or failed with the reason) with the mode AgentGuard runs in and the status command that confirms the effective mode. `--only` and `--skip` choose hosts; `--json` gives an agent the plan and the results. A second run changes nothing. A failed host does not stop the others, and the exit code is 1. It never runs a downloaded script, never uses sudo, never installs a host itself, never asks for a key and never writes `burn-policy.json`, so the plugin's enforce default still applies to a fresh install.
|
|
13
|
+
- `install` updates an installed AgentGuard plugin that is older than what is available (the newer of the host's local marketplace copy and plugin 0.5.0, as that copy can be stale) through the host's own plugin commands: `claude plugin marketplace update agentguard` and `claude plugin update agentguard@agentguard`, or `codex plugin marketplace upgrade agentguard` and `codex plugin add agentguard@agentguard --json`, adding the agentguard-run marketplace first when none is configured. A marketplace still added from MerchantGuard/agentguard-codex-plugin stays in place, since both hosts refuse the new source under the same name and GitHub forwards the old one.
|
|
14
|
+
- Where the plugin is installed and enabled, `install` removes a standalone Burn hook from `~/.codex/hooks.json` or `~/.claude/settings.json` after the plugin steps succeed, with a timestamped backup, taking out only the Burn gate entries and keeping every other byte of the file.
|
|
15
|
+
- The `agentguard-burn` wrapper passes `install` through unchanged. Its `^0.6.1` range does not reach 0.7.0, so `npx agentguard-burn install` needs a wrapper release on `^0.7.0`.
|
|
16
|
+
|
|
3
17
|
## 0.6.2 (2026-10-22)
|
|
4
18
|
|
|
5
19
|
- `ps` opens with free disk on the volume holding your home folder and swap use. [WARN] under 10 GB or 10% free, [CRIT] under 5 GB, swap [WARN] above 80% used. Unknown readings say unknown. `ps --json` adds `disk` (`freeBytes`, `totalBytes`, `level`, `swapUsedBytes`, `swapTotalBytes`, `swapLevel`).
|
package/README.md
CHANGED
|
@@ -18,6 +18,32 @@ Press y if npm asks to install Burn. Plain `npx agentguard-burn` shows these thr
|
|
|
18
18
|
|
|
19
19
|
Burn prints its installed version on the first line of every `why` and `calendar` text report, including the empty message. JSON reports include a `version` field. `npx agentguard-burn --version` (or `-v`) prints only the installed version.
|
|
20
20
|
|
|
21
|
+
## Install AgentGuard on every agent host
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
npx agentguard-burn install # the plan; nothing changes
|
|
25
|
+
npx agentguard-burn install --yes # carry it out
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`install` finds Claude Code, Codex, Cursor and Hermes on this computer by their command on PATH and their config folder. It decides by reading files and starts nothing to look. Without `--yes` it prints the plan: each host it found, the exact commands it would run and the files they change. With `--yes` it runs them, reads each host again, and prints one line per host: installed, already installed, skipped, or failed with the reason, with the mode AgentGuard runs in there.
|
|
29
|
+
|
|
30
|
+
| Host | What `--yes` does |
|
|
31
|
+
|---|---|
|
|
32
|
+
| Claude Code | `claude plugin marketplace add agentguard-run/agentguard-codex-plugin` (unless an agentguard marketplace is already added), `claude plugin install agentguard@agentguard`, and `npm ci` in the plugin folder only if the dependencies are missing. An older plugin: `claude plugin marketplace update agentguard`, then `claude plugin update agentguard@agentguard` |
|
|
33
|
+
| Codex | `codex plugin marketplace add agentguard-run/agentguard-codex-plugin` (unless already added), `codex plugin add agentguard@agentguard --json`, then `npm ci` in the plugin folder Codex reports if the dependencies are missing. An older plugin: `codex plugin marketplace upgrade agentguard`, then the same `plugin add` and `npm ci` |
|
|
34
|
+
| Cursor | merges the AgentGuard hook into `~/.cursor/hooks.json` after a timestamped backup: the same entry as `init cursor --write` |
|
|
35
|
+
| Hermes | `uv pip install --python <the Python environment Hermes runs from> agentguard-spend-hermes`, then `hermes plugins enable agentguard-spend` |
|
|
36
|
+
|
|
37
|
+
- `--only claude,codex` or `--skip hermes` chooses hosts (claude, codex, cursor, hermes).
|
|
38
|
+
- `--json` prints the plan, and after `--yes` each host's result, for an agent to read. An agent shows the plan to its person and runs `--yes` only after they agree.
|
|
39
|
+
- Run it again at any time. A host that already has AgentGuard is reported as already installed and nothing runs for it; a host that failed is tried again.
|
|
40
|
+
- An installed plugin older than what is available shows as "update available" and is updated through the host's own plugin commands; plugin files are never edited by hand. Available means the newer of what the host's local copy of the marketplace lists and plugin 0.5.0, since that local copy refreshes only when asked. A marketplace still added from the plugin's old repository (MerchantGuard/agentguard-codex-plugin, which GitHub forwards to agentguard-run/agentguard-codex-plugin) is left in place: Claude Code and Codex refuse to add the new source under the same name while it exists, and updates come through it.
|
|
41
|
+
- Where the plugin is installed (or being installed) and enabled, a standalone Burn hook in `~/.codex/hooks.json` or `~/.claude/settings.json` is removed after the plugin steps succeed: a timestamped backup first, then only the Burn gate entries go and every other hook and setting keeps its exact bytes. The plugin includes the same gate; in Codex it does not hand launch checks to a standalone hook, so both would check every launch. With the plugin turned off, or its install failed, the standalone hook stays.
|
|
42
|
+
- A failed host command does not stop the other hosts, and the exit code is 1. A host that is present but missing something it needs (its command on PATH, npm, uv, a readable `hooks.json`) shows in the plan with the reason and is reported as failed. A usage error exits 64.
|
|
43
|
+
- It never pipes a downloaded script to a shell, never uses sudo, never installs a host itself, never asks for or stores a key, and never writes `burn-policy.json`: the plugin writes enforce into a fresh one, and a file written first would keep a new install in shadow.
|
|
44
|
+
- Afterwards: start a new session in each host. In Codex, open `/hooks`, review the AgentGuard hooks and trust them yourself; an agent must never approve its own hooks. Restart Hermes. Then check the effective mode: `agentguard-status` in a Claude Code or Codex session, `agentguard-burn status` for Cursor, `/agentguard status` in Hermes. The mode `install` prints is read from local files; a paid license whose check fails falls back to shadow, which only `agentguard-status` can see.
|
|
45
|
+
- Run through `npx`, the Cursor hook points into the npx cache, which npm can clear. For a lasting hook, install Burn globally first (see "Optional global install and hooks" below), then run `agentguard-burn install`.
|
|
46
|
+
|
|
21
47
|
## Simple and detailed views
|
|
22
48
|
|
|
23
49
|
`statusline`, `why` and `live` default to simple; `compact-replay` defaults to detailed so its table shows. Save a preference with `agentguard-burn mode simple` or `agentguard-burn mode detailed`. It lives in `AGENTGUARD_HOME/burn-config.json`, normally under `~/.agentguard`. `AGENTGUARD_BURN_MODE` overrides it. Per-command `simple` and `detailed` flags, prefixed by two hyphens, override both. Detailed output and JSON stay unchanged.
|
package/dist/src/canvas.d.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
+
import { type CopyRampName } from './copy-ramp';
|
|
1
2
|
/**
|
|
2
3
|
* Heat ramps for calendar cells: `shade0` is a day with no tokens; `teal1` to
|
|
3
4
|
* `teal4` and `amber1` to `amber4` are the four token levels, mixed from the
|
|
4
5
|
* canvas background toward mint and amber, so the top level is the brand colour.
|
|
5
6
|
*/
|
|
6
7
|
export type CanvasHeatColor = 'shade0' | 'teal1' | 'teal2' | 'teal3' | 'teal4' | 'amber1' | 'amber2' | 'amber3' | 'amber4';
|
|
7
|
-
|
|
8
|
+
/**
|
|
9
|
+
* `copy01` to `copy15` are the brand ramp for the copies of a recorded run (see copy-ramp.ts): one hue per copy from
|
|
10
|
+
* teal into violet at one lightness, so no copy reads as allowed (mint) or refused (red). The values below are the
|
|
11
|
+
* chip colours of that ramp; tests/copy-ramp.test.ts checks them against the conversion.
|
|
12
|
+
*/
|
|
13
|
+
export type CanvasColor = 'mint' | 'slate' | 'amber' | 'red' | 'white' | 'none' | CanvasHeatColor | CopyRampName;
|
|
8
14
|
export type CanvasColorMode = 'truecolor' | '256' | 'none';
|
|
9
15
|
export interface CanvasCell {
|
|
10
16
|
char: string;
|
package/dist/src/canvas.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Canvas = exports.CANVAS_PALETTE = void 0;
|
|
4
4
|
/** A clipped grid of terminal cells. Rendering adds only palette-owned ANSI. */
|
|
5
5
|
const node_util_1 = require("node:util");
|
|
6
|
+
const copy_ramp_1 = require("./copy-ramp");
|
|
6
7
|
exports.CANVAS_PALETTE = {
|
|
7
8
|
mint: { hex: '#2ABCB4', rgb: [42, 188, 180], ansi256: 37 },
|
|
8
9
|
slate: { hex: '#64748B', rgb: [100, 116, 139], ansi256: 66 },
|
|
@@ -18,6 +19,21 @@ exports.CANVAS_PALETTE = {
|
|
|
18
19
|
amber2: { hex: '#8C5F10', rgb: [140, 95, 16], ansi256: 136 },
|
|
19
20
|
amber3: { hex: '#C27F0E', rgb: [194, 127, 14], ansi256: 172 },
|
|
20
21
|
amber4: { hex: '#F59E0B', rgb: [245, 158, 11], ansi256: 214 },
|
|
22
|
+
copy01: { hex: '#55C7BA', rgb: [85, 199, 186], ansi256: 79 },
|
|
23
|
+
copy02: { hex: '#50C6C4', rgb: [80, 198, 196], ansi256: 80 },
|
|
24
|
+
copy03: { hex: '#4FC5CD', rgb: [79, 197, 205], ansi256: 80 },
|
|
25
|
+
copy04: { hex: '#51C3D5', rgb: [81, 195, 213], ansi256: 74 },
|
|
26
|
+
copy05: { hex: '#57C1DD', rgb: [87, 193, 221], ansi256: 74 },
|
|
27
|
+
copy06: { hex: '#5EBFE4', rgb: [94, 191, 228], ansi256: 74 },
|
|
28
|
+
copy07: { hex: '#68BCEA', rgb: [104, 188, 234], ansi256: 74 },
|
|
29
|
+
copy08: { hex: '#72B9EE', rgb: [114, 185, 238], ansi256: 75 },
|
|
30
|
+
copy09: { hex: '#7DB6F2', rgb: [125, 182, 242], ansi256: 111 },
|
|
31
|
+
copy10: { hex: '#88B2F4', rgb: [136, 178, 244], ansi256: 111 },
|
|
32
|
+
copy11: { hex: '#93AFF4', rgb: [147, 175, 244], ansi256: 111 },
|
|
33
|
+
copy12: { hex: '#9EACF4', rgb: [158, 172, 244], ansi256: 147 },
|
|
34
|
+
copy13: { hex: '#A8A8F2', rgb: [168, 168, 242], ansi256: 147 },
|
|
35
|
+
copy14: { hex: '#B2A5EF', rgb: [178, 165, 239], ansi256: 147 },
|
|
36
|
+
copy15: { hex: '#BBA2EA', rgb: [187, 162, 234], ansi256: 146 },
|
|
21
37
|
};
|
|
22
38
|
const GLYPHS = {
|
|
23
39
|
'0': ['█▀█', '█ █', '█▄█'], '1': [' ▀█', ' █', ' █'],
|
|
@@ -40,7 +56,7 @@ const BIG_GLYPHS = {
|
|
|
40
56
|
'9': [' ### ', '# #', '# #', ' ####', ' #', ' #', ' ### '],
|
|
41
57
|
'-': [' ', ' ', ' ', '#####', ' ', ' ', ' '],
|
|
42
58
|
};
|
|
43
|
-
const colors = new Set(['mint', 'slate', 'amber', 'red', 'white', 'none', 'shade0', 'teal1', 'teal2', 'teal3', 'teal4', 'amber1', 'amber2', 'amber3', 'amber4']);
|
|
59
|
+
const colors = new Set(['mint', 'slate', 'amber', 'red', 'white', 'none', 'shade0', 'teal1', 'teal2', 'teal3', 'teal4', 'amber1', 'amber2', 'amber3', 'amber4', ...copy_ramp_1.COPY_RAMP_NAMES]);
|
|
44
60
|
function dimension(value, fallback, limit) {
|
|
45
61
|
return Math.max(1, Math.min(limit, Math.floor(typeof value === 'number' && Number.isFinite(value) ? value : fallback)));
|
|
46
62
|
}
|
package/dist/src/cli.d.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* replay what enforcement would have stopped, on your history
|
|
9
9
|
* calibrate fit thresholds to your own usage, write shadow policy
|
|
10
10
|
* status mode, shadow decisions, eligibility, every host's sessions
|
|
11
|
+
* install find every agent host here, print the plan, install with --yes
|
|
11
12
|
* init [host] hook snippet for claude (default), cursor or codex
|
|
12
13
|
* enforce promote shadow -> enforce, once eligible
|
|
13
14
|
* shadow demote back to shadow
|
package/dist/src/cli.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* replay what enforcement would have stopped, on your history
|
|
10
10
|
* calibrate fit thresholds to your own usage, write shadow policy
|
|
11
11
|
* status mode, shadow decisions, eligibility, every host's sessions
|
|
12
|
+
* install find every agent host here, print the plan, install with --yes
|
|
12
13
|
* init [host] hook snippet for claude (default), cursor or codex
|
|
13
14
|
* enforce promote shadow -> enforce, once eligible
|
|
14
15
|
* shadow demote back to shadow
|
|
@@ -742,6 +743,28 @@ async function main(argv) {
|
|
|
742
743
|
.replace(/\n\n\n/g, '\n\n') + '\n');
|
|
743
744
|
return 0;
|
|
744
745
|
}
|
|
746
|
+
case 'install': {
|
|
747
|
+
// Loaded only here, so hooks and reports never load it.
|
|
748
|
+
const { defaultRunner, installJson, parseInstallArgs, planInstall, renderPlan, renderReport, runInstall } = await Promise.resolve().then(() => __importStar(require('./install-all')));
|
|
749
|
+
const options = parseInstallArgs(rest);
|
|
750
|
+
if ('error' in options) {
|
|
751
|
+
process.stderr.write(`${options.error}\n`);
|
|
752
|
+
return 64;
|
|
753
|
+
}
|
|
754
|
+
const context = { home: (0, node_os_1.homedir)(), env: process.env, platform: process.platform, cliPath: (0, node_path_1.join)(__dirname, 'cli.js') };
|
|
755
|
+
const plan = planInstall(context, options);
|
|
756
|
+
if (!options.yes) {
|
|
757
|
+
const values = installJson(version_1.BURN_VERSION, plan, null);
|
|
758
|
+
show({ kind: 'command', command, values }, options.json ? `${JSON.stringify(values, null, 2)}\n` : renderPlan(plan, context), true);
|
|
759
|
+
return 0;
|
|
760
|
+
}
|
|
761
|
+
if (!options.json && plan.next)
|
|
762
|
+
process.stdout.write('Installing AgentGuard\n');
|
|
763
|
+
const report = runInstall(plan, context, defaultRunner(context), options.json ? undefined : (line) => process.stdout.write(` ${line}\n`));
|
|
764
|
+
const values = installJson(version_1.BURN_VERSION, plan, report);
|
|
765
|
+
show({ kind: 'command', command, values }, options.json ? `${JSON.stringify(values, null, 2)}\n` : `${plan.next ? '\n' : ''}${renderReport(report)}`, true);
|
|
766
|
+
return report.ok ? 0 : 1;
|
|
767
|
+
}
|
|
745
768
|
case 'init': {
|
|
746
769
|
const policy = (0, pre_tool_use_1.loadPolicy)(HOME);
|
|
747
770
|
savePolicy(policy);
|
|
@@ -870,7 +893,7 @@ async function main(argv) {
|
|
|
870
893
|
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);
|
|
871
894
|
return !command || command === 'help' || command === '--help' || command === '-h' ? 0 : 64;
|
|
872
895
|
}
|
|
873
|
-
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', 'init', 'enforce', 'shadow', 'resume', 'quiet', 'proxy', 'conformance'] } }, starter + '\nAll commands\n' +
|
|
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' +
|
|
874
897
|
' ps [--json] local agent processes, held memory and workspace disk\n' +
|
|
875
898
|
' render <run.jsonl> --mp4 <out.mp4> [--gif <out.gif>] [--phone] local recorded-run export\n' +
|
|
876
899
|
' render <run.jsonl> --mp4 <out.mp4> --dashboard [--wide] [--economics <blocks.json>] dashboard export\n' +
|
|
@@ -902,6 +925,7 @@ async function main(argv) {
|
|
|
902
925
|
' replay <replay.json> --pricing <snapshot.json> [--json] replay a saved run with its original prices\n' +
|
|
903
926
|
' calibrate fit thresholds to your history (writes shadow policy)\n' +
|
|
904
927
|
' status mode, shadow observations, eligibility, hook health, every host\n' +
|
|
928
|
+
' install [--yes] [--only <hosts>] [--skip <hosts>] [--json] find Claude Code, Codex, Cursor and Hermes here, print the plan; --yes installs AgentGuard on each\n' +
|
|
905
929
|
' init [claude|cursor|codex] [--write] print the hook snippet, or merge it into the config (with a backup)\n' +
|
|
906
930
|
' enforce [--force] shadow -> enforce\n' +
|
|
907
931
|
' shadow enforce -> shadow\n' +
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brand ramp for the copies of a recorded run: fifteen hues from teal (185) through blue into violet (300) in oklch,
|
|
3
|
+
* at one lightness and one chroma, so copy 1 and copy 15 read as the same kind of thing. Teal stays reserved for OK,
|
|
4
|
+
* red for refusals and STOP, amber for WARN, and the done tick stays ink; no copy colour comes near any of them.
|
|
5
|
+
* Token sheet: oklch lightness 0.76 chroma 0.105 for chips, lightness 0.63 at alpha 0.88 for token cells,
|
|
6
|
+
* lightness 0.78 for ledger text in the copy's hue (Claude Design, Oct 28 2026).
|
|
7
|
+
*/
|
|
8
|
+
export declare const COPY_RAMP_SIZE = 15;
|
|
9
|
+
export declare const COPY_RAMP_HUE: Readonly<{
|
|
10
|
+
from: 185;
|
|
11
|
+
to: 300;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const COPY_RAMP_CHROMA = 0.105;
|
|
14
|
+
export declare const COPY_RAMP_LIGHTNESS: Readonly<{
|
|
15
|
+
chip: 0.76;
|
|
16
|
+
cell: 0.63;
|
|
17
|
+
ledger: 0.78;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const COPY_CELL_ALPHA = 0.88;
|
|
20
|
+
export type CopyRole = 'chip' | 'cell' | 'ledger';
|
|
21
|
+
export type Rgb = readonly [number, number, number];
|
|
22
|
+
export interface CopyRampEntry {
|
|
23
|
+
index: number;
|
|
24
|
+
name: CopyRampName;
|
|
25
|
+
hue: number;
|
|
26
|
+
chip: string;
|
|
27
|
+
cell: string;
|
|
28
|
+
ledger: string;
|
|
29
|
+
rgb: Rgb;
|
|
30
|
+
ansi256: number;
|
|
31
|
+
}
|
|
32
|
+
export type CopyRampName = 'copy01' | 'copy02' | 'copy03' | 'copy04' | 'copy05' | 'copy06' | 'copy07' | 'copy08' | 'copy09' | 'copy10' | 'copy11' | 'copy12' | 'copy13' | 'copy14' | 'copy15';
|
|
33
|
+
export declare const COPY_RAMP_NAMES: readonly CopyRampName[];
|
|
34
|
+
/** Copy k of 15 (0-based) sits at an even step from the first hue to the last, both inclusive. */
|
|
35
|
+
export declare function copyHue(index: number): number;
|
|
36
|
+
/** oklch to sRGB, the Ottosson matrices, gamma encoded and clipped to the sRGB cube. */
|
|
37
|
+
export declare function oklchToRgb(lightness: number, chroma: number, hue: number): [number, number, number];
|
|
38
|
+
export declare function rgbToHex(rgb: Rgb): string;
|
|
39
|
+
export declare function hexToRgb(hex: string): [number, number, number];
|
|
40
|
+
/** Nearest of the 240 xterm colours (the 6x6x6 cube and the grey ramp) by sRGB distance, for 256-colour terminals. */
|
|
41
|
+
export declare function nearestAnsi256(rgb: Rgb): number;
|
|
42
|
+
/** The fifteen ramp entries, computed once from the token sheet. */
|
|
43
|
+
export declare const COPY_RAMP: readonly CopyRampEntry[];
|
|
44
|
+
/** Copy k (0-based, wrapping past 15) in one role: the chip fill, the token cell fill, or the ledger line text. */
|
|
45
|
+
export declare function copyColor(index: number, role?: CopyRole): string;
|
|
46
|
+
/** Palette name of copy k, for terminal cells. */
|
|
47
|
+
export declare function copyName(index: number): CopyRampName;
|
|
48
|
+
/**
|
|
49
|
+
* Fixed meanings the ramp never borrows: OK is the brand teal, WARN amber, STOP and every refusal red. The done tick on a
|
|
50
|
+
* chip is drawn in the panel's ink, the same as the copy number, as the Claude Design sample keeps it; it is never a ramp colour.
|
|
51
|
+
*/
|
|
52
|
+
export declare const ROLE_COLORS: Readonly<{
|
|
53
|
+
ok: "#2ABCB4";
|
|
54
|
+
done: "#0B1117";
|
|
55
|
+
warn: "#F59E0B";
|
|
56
|
+
stop: "#FF5A4E";
|
|
57
|
+
}>;
|
|
58
|
+
export type Verdict = 'OK' | 'WARN' | 'STOP';
|
|
59
|
+
export declare function verdictColor(verdict: Verdict): string;
|
|
60
|
+
/**
|
|
61
|
+
* One rule for every mark that stands for a copy or a decision. A refused attempt is red whatever its position;
|
|
62
|
+
* a finished copy keeps its ramp colour and earns an ink tick; a copy that is running is simply its ramp colour.
|
|
63
|
+
*/
|
|
64
|
+
export declare function copyPaint(input: {
|
|
65
|
+
index: number;
|
|
66
|
+
role?: CopyRole;
|
|
67
|
+
refused?: boolean;
|
|
68
|
+
done?: boolean;
|
|
69
|
+
}): {
|
|
70
|
+
color: string;
|
|
71
|
+
tick: string | null;
|
|
72
|
+
alpha: number;
|
|
73
|
+
};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ROLE_COLORS = exports.COPY_RAMP = exports.COPY_RAMP_NAMES = exports.COPY_CELL_ALPHA = exports.COPY_RAMP_LIGHTNESS = exports.COPY_RAMP_CHROMA = exports.COPY_RAMP_HUE = exports.COPY_RAMP_SIZE = void 0;
|
|
4
|
+
exports.copyHue = copyHue;
|
|
5
|
+
exports.oklchToRgb = oklchToRgb;
|
|
6
|
+
exports.rgbToHex = rgbToHex;
|
|
7
|
+
exports.hexToRgb = hexToRgb;
|
|
8
|
+
exports.nearestAnsi256 = nearestAnsi256;
|
|
9
|
+
exports.copyColor = copyColor;
|
|
10
|
+
exports.copyName = copyName;
|
|
11
|
+
exports.verdictColor = verdictColor;
|
|
12
|
+
exports.copyPaint = copyPaint;
|
|
13
|
+
/**
|
|
14
|
+
* Brand ramp for the copies of a recorded run: fifteen hues from teal (185) through blue into violet (300) in oklch,
|
|
15
|
+
* at one lightness and one chroma, so copy 1 and copy 15 read as the same kind of thing. Teal stays reserved for OK,
|
|
16
|
+
* red for refusals and STOP, amber for WARN, and the done tick stays ink; no copy colour comes near any of them.
|
|
17
|
+
* Token sheet: oklch lightness 0.76 chroma 0.105 for chips, lightness 0.63 at alpha 0.88 for token cells,
|
|
18
|
+
* lightness 0.78 for ledger text in the copy's hue (Claude Design, Oct 28 2026).
|
|
19
|
+
*/
|
|
20
|
+
exports.COPY_RAMP_SIZE = 15;
|
|
21
|
+
exports.COPY_RAMP_HUE = Object.freeze({ from: 185, to: 300 });
|
|
22
|
+
exports.COPY_RAMP_CHROMA = 0.105;
|
|
23
|
+
exports.COPY_RAMP_LIGHTNESS = Object.freeze({ chip: 0.76, cell: 0.63, ledger: 0.78 });
|
|
24
|
+
exports.COPY_CELL_ALPHA = 0.88;
|
|
25
|
+
exports.COPY_RAMP_NAMES = Object.freeze(['copy01', 'copy02', 'copy03', 'copy04', 'copy05', 'copy06', 'copy07', 'copy08', 'copy09', 'copy10', 'copy11', 'copy12', 'copy13', 'copy14', 'copy15']);
|
|
26
|
+
/** Copy k of 15 (0-based) sits at an even step from the first hue to the last, both inclusive. */
|
|
27
|
+
function copyHue(index) {
|
|
28
|
+
const k = ((Math.floor(index) % exports.COPY_RAMP_SIZE) + exports.COPY_RAMP_SIZE) % exports.COPY_RAMP_SIZE;
|
|
29
|
+
return exports.COPY_RAMP_HUE.from + k * (exports.COPY_RAMP_HUE.to - exports.COPY_RAMP_HUE.from) / (exports.COPY_RAMP_SIZE - 1);
|
|
30
|
+
}
|
|
31
|
+
/** oklch to sRGB, the Ottosson matrices, gamma encoded and clipped to the sRGB cube. */
|
|
32
|
+
function oklchToRgb(lightness, chroma, hue) {
|
|
33
|
+
const radians = hue * Math.PI / 180, a = chroma * Math.cos(radians), b = chroma * Math.sin(radians);
|
|
34
|
+
const l = Math.pow(lightness + 0.3963377774 * a + 0.2158037573 * b, 3);
|
|
35
|
+
const m = Math.pow(lightness - 0.1055613458 * a - 0.0638541728 * b, 3);
|
|
36
|
+
const s = Math.pow(lightness - 0.0894841775 * a - 1.2914855480 * b, 3);
|
|
37
|
+
const linear = [
|
|
38
|
+
4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s,
|
|
39
|
+
-1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s,
|
|
40
|
+
-0.0041960863 * l - 0.7034186147 * m + 1.7076147010 * s,
|
|
41
|
+
];
|
|
42
|
+
return linear.map(value => {
|
|
43
|
+
const clipped = Math.max(0, Math.min(1, value));
|
|
44
|
+
const encoded = clipped <= 0.0031308 ? 12.92 * clipped : 1.055 * Math.pow(clipped, 1 / 2.4) - 0.055;
|
|
45
|
+
return Math.round(encoded * 255);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function rgbToHex(rgb) {
|
|
49
|
+
return `#${rgb.map(channel => Math.max(0, Math.min(255, Math.round(channel))).toString(16).padStart(2, '0').toUpperCase()).join('')}`;
|
|
50
|
+
}
|
|
51
|
+
function hexToRgb(hex) {
|
|
52
|
+
const match = /^#?([0-9a-f]{6})$/i.exec(hex);
|
|
53
|
+
if (!match)
|
|
54
|
+
throw new Error(`Not a six digit hex colour: ${hex}`);
|
|
55
|
+
const value = parseInt(match[1], 16);
|
|
56
|
+
return [value >> 16 & 255, value >> 8 & 255, value & 255];
|
|
57
|
+
}
|
|
58
|
+
const CUBE_LEVELS = [0, 95, 135, 175, 215, 255];
|
|
59
|
+
/** Nearest of the 240 xterm colours (the 6x6x6 cube and the grey ramp) by sRGB distance, for 256-colour terminals. */
|
|
60
|
+
function nearestAnsi256(rgb) {
|
|
61
|
+
let best = 16, bestDistance = Infinity;
|
|
62
|
+
const consider = (index, candidate) => {
|
|
63
|
+
const distance = (rgb[0] - candidate[0]) ** 2 + (rgb[1] - candidate[1]) ** 2 + (rgb[2] - candidate[2]) ** 2;
|
|
64
|
+
if (distance < bestDistance) {
|
|
65
|
+
best = index;
|
|
66
|
+
bestDistance = distance;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
for (let r = 0; r < 6; r++)
|
|
70
|
+
for (let g = 0; g < 6; g++)
|
|
71
|
+
for (let b = 0; b < 6; b++)
|
|
72
|
+
consider(16 + 36 * r + 6 * g + b, [CUBE_LEVELS[r], CUBE_LEVELS[g], CUBE_LEVELS[b]]);
|
|
73
|
+
for (let i = 0; i < 24; i++) {
|
|
74
|
+
const grey = 8 + 10 * i;
|
|
75
|
+
consider(232 + i, [grey, grey, grey]);
|
|
76
|
+
}
|
|
77
|
+
return best;
|
|
78
|
+
}
|
|
79
|
+
function entry(index) {
|
|
80
|
+
const hue = copyHue(index), rgb = oklchToRgb(exports.COPY_RAMP_LIGHTNESS.chip, exports.COPY_RAMP_CHROMA, hue);
|
|
81
|
+
return {
|
|
82
|
+
index, name: exports.COPY_RAMP_NAMES[index], hue,
|
|
83
|
+
chip: rgbToHex(rgb),
|
|
84
|
+
cell: rgbToHex(oklchToRgb(exports.COPY_RAMP_LIGHTNESS.cell, exports.COPY_RAMP_CHROMA, hue)),
|
|
85
|
+
ledger: rgbToHex(oklchToRgb(exports.COPY_RAMP_LIGHTNESS.ledger, exports.COPY_RAMP_CHROMA, hue)),
|
|
86
|
+
rgb, ansi256: nearestAnsi256(rgb),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/** The fifteen ramp entries, computed once from the token sheet. */
|
|
90
|
+
exports.COPY_RAMP = Object.freeze(Array.from({ length: exports.COPY_RAMP_SIZE }, (_, index) => Object.freeze(entry(index))));
|
|
91
|
+
/** Copy k (0-based, wrapping past 15) in one role: the chip fill, the token cell fill, or the ledger line text. */
|
|
92
|
+
function copyColor(index, role = 'chip') {
|
|
93
|
+
const k = ((Math.floor(index) % exports.COPY_RAMP_SIZE) + exports.COPY_RAMP_SIZE) % exports.COPY_RAMP_SIZE;
|
|
94
|
+
return exports.COPY_RAMP[k][role];
|
|
95
|
+
}
|
|
96
|
+
/** Palette name of copy k, for terminal cells. */
|
|
97
|
+
function copyName(index) {
|
|
98
|
+
const k = ((Math.floor(index) % exports.COPY_RAMP_SIZE) + exports.COPY_RAMP_SIZE) % exports.COPY_RAMP_SIZE;
|
|
99
|
+
return exports.COPY_RAMP_NAMES[k];
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Fixed meanings the ramp never borrows: OK is the brand teal, WARN amber, STOP and every refusal red. The done tick on a
|
|
103
|
+
* chip is drawn in the panel's ink, the same as the copy number, as the Claude Design sample keeps it; it is never a ramp colour.
|
|
104
|
+
*/
|
|
105
|
+
exports.ROLE_COLORS = Object.freeze({ ok: '#2ABCB4', done: '#0B1117', warn: '#F59E0B', stop: '#FF5A4E' });
|
|
106
|
+
function verdictColor(verdict) {
|
|
107
|
+
return verdict === 'STOP' ? exports.ROLE_COLORS.stop : verdict === 'WARN' ? exports.ROLE_COLORS.warn : exports.ROLE_COLORS.ok;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* One rule for every mark that stands for a copy or a decision. A refused attempt is red whatever its position;
|
|
111
|
+
* a finished copy keeps its ramp colour and earns an ink tick; a copy that is running is simply its ramp colour.
|
|
112
|
+
*/
|
|
113
|
+
function copyPaint(input) {
|
|
114
|
+
if (input.refused)
|
|
115
|
+
return { color: exports.ROLE_COLORS.stop, tick: null, alpha: 1 };
|
|
116
|
+
const role = input.role ?? 'chip';
|
|
117
|
+
return { color: copyColor(input.index, role), tick: input.done ? exports.ROLE_COLORS.done : null, alpha: role === 'cell' ? exports.COPY_CELL_ALPHA : 1 };
|
|
118
|
+
}
|
|
@@ -25,6 +25,7 @@ const node_child_process_1 = require("node:child_process");
|
|
|
25
25
|
const node_util_1 = require("node:util");
|
|
26
26
|
const node_path_1 = require("node:path");
|
|
27
27
|
const canvas_1 = require("@napi-rs/canvas");
|
|
28
|
+
const copy_ramp_1 = require("./copy-ramp");
|
|
28
29
|
const live_1 = require("./insights/live");
|
|
29
30
|
const render_recording_1 = require("./render-recording");
|
|
30
31
|
const dashboard_model_1 = require("./dashboard-model");
|
|
@@ -195,18 +196,19 @@ function ring(ctx, model, state, g, phases) {
|
|
|
195
196
|
ctx.lineTo(cx + gateW, cy - r);
|
|
196
197
|
ctx.stroke();
|
|
197
198
|
text(ctx, 'gate', cx - gateW - 14, cy - r + 8, g.small, { color: exports.INK.secondary, align: 'right' });
|
|
198
|
-
// One marker per recorded spawn, popping in at its decision time
|
|
199
|
+
// One marker per recorded spawn, popping in at its decision time, in its copy's ramp colour (teal into violet, copy 1 to 15).
|
|
200
|
+
// The warn state stays on the arc, the bar and the counters; a copy is never drawn amber or red, only the attempts are.
|
|
199
201
|
for (let k = 1; k <= shown; k++) {
|
|
200
202
|
const event = model.events.filter(event => event.verdict !== 'STOP')[k - 1];
|
|
201
203
|
const born = event ? event.offsetMs : 0, scale = easeOut((state.t - born) / 320);
|
|
202
204
|
if (scale <= 0)
|
|
203
205
|
continue;
|
|
204
|
-
const a = angle(k), x = cx + Math.cos(a) * r, y = cy + Math.sin(a) * r
|
|
206
|
+
const a = angle(k), x = cx + Math.cos(a) * r, y = cy + Math.sin(a) * r;
|
|
205
207
|
ctx.fillStyle = exports.INK.paper;
|
|
206
208
|
ctx.beginPath();
|
|
207
209
|
ctx.arc(x, y, 19 * scale, 0, Math.PI * 2);
|
|
208
210
|
ctx.fill();
|
|
209
|
-
ctx.fillStyle =
|
|
211
|
+
ctx.fillStyle = (0, copy_ramp_1.copyColor)(k - 1);
|
|
210
212
|
ctx.beginPath();
|
|
211
213
|
ctx.arc(x, y, 14 * scale, 0, Math.PI * 2);
|
|
212
214
|
ctx.fill();
|
|
@@ -305,6 +307,8 @@ function agents(ctx, model, state, g) {
|
|
|
305
307
|
text(ctx, who, x + 20, cap1, g.body, { color: exports.INK.ink, alpha: reveal });
|
|
306
308
|
text(ctx, 'list price · not a bill', x + 20, cap2, g.body, { color: exports.INK.secondary, alpha: reveal });
|
|
307
309
|
const sorted = [...economics.children].sort((a, b) => (b.tokens ?? 0) - (a.tokens ?? 0)), top = sorted.slice(0, rows), max = top[0]?.tokens ?? 1;
|
|
310
|
+
// A child's bar keeps the ramp colour of its launch position (the economics rows are in start order), so the same copy is the same colour everywhere.
|
|
311
|
+
const launchOrder = new Map(economics.children.map((child, index) => [child.child, index]));
|
|
308
312
|
const first = cap2 + g.body * .7, pitch = (h - (first - y) - 44) / rows, barW = w - 40 - g.number * 3.6;
|
|
309
313
|
top.forEach((child, i) => {
|
|
310
314
|
const row = first + i * pitch, fill = clamp01((child.tokens ?? 0) / max) * reveal;
|
|
@@ -312,7 +316,7 @@ function agents(ctx, model, state, g) {
|
|
|
312
316
|
ctx.beginPath();
|
|
313
317
|
ctx.roundRect(x + 20, row + pitch * .3, barW, 10, 5);
|
|
314
318
|
ctx.fill();
|
|
315
|
-
ctx.fillStyle =
|
|
319
|
+
ctx.fillStyle = (0, copy_ramp_1.copyColor)(launchOrder.get(child.child) ?? i);
|
|
316
320
|
ctx.beginPath();
|
|
317
321
|
ctx.roundRect(x + 20, row + pitch * .3, Math.max(10, barW * fill), 10, 5);
|
|
318
322
|
ctx.fill();
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Removing AgentGuard's standalone Burn hook from a host's hooks file
|
|
3
|
+
* (~/.codex/hooks.json, ~/.claude/settings.json) once the AgentGuard plugin,
|
|
4
|
+
* which includes the same gate, is installed there.
|
|
5
|
+
*
|
|
6
|
+
* The file is the person's. Other hooks, other settings, their spacing and
|
|
7
|
+
* their key order stay exactly as written: instead of parsing and
|
|
8
|
+
* re-serializing, the file is parsed with byte positions and only the arrays
|
|
9
|
+
* and objects that lose an entry are rebuilt, from the original bytes of the
|
|
10
|
+
* entries they keep. A backup is taken first and the write is atomic.
|
|
11
|
+
*/
|
|
12
|
+
export declare function isStandaloneBurnGate(command: unknown): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Removes the standalone Burn gate entries under "hooks". A matcher group
|
|
15
|
+
* holding only Burn entries goes with them, and an event left with no group
|
|
16
|
+
* goes too; a group that also holds other hooks keeps them.
|
|
17
|
+
*/
|
|
18
|
+
export declare function removeStandaloneBurnHooks(text: string): {
|
|
19
|
+
text: string;
|
|
20
|
+
removed: number;
|
|
21
|
+
};
|
|
22
|
+
/** How many standalone Burn gate entries a hooks file holds (0 when it is missing or not valid JSON). */
|
|
23
|
+
export declare function countStandaloneBurnHooks(file: string): number;
|
|
24
|
+
/** Removes the Burn gate entries from a file: a timestamped backup first, then an atomic write that keeps the file's mode. */
|
|
25
|
+
export declare function removeStandaloneBurnHooksFromFile(file: string): {
|
|
26
|
+
removed: number;
|
|
27
|
+
backup: string | null;
|
|
28
|
+
};
|