Feat/tui stats dashboard#63
Merged
Merged
Conversation
…deny aggregations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Brings the terminal dashboard (
agentlock dashboard) to feature parity with the web dashboard and adds an operational Stats tab — time-windowed allow/denycounters, a volume-by-deny-rate sparkline, top deny rules, top deny tools, and source breakdown. Adds a
toolfield to ledger entries so top-deny-tool insightscan name actual tools (
Bash,Read) instead of opaque correlation ids.What changed
1h/24h/7d/allwindows, inline counters (total / allow / deny / rate), single-row sparkline (barheight = volume, color = deny rate), per-window time axis with weekday letters on 7d, top-N deny rules + tools, by-source breakdown.
aadd via$EDITOR,eedit via$EDITOR,spacetoggle disabled,Mcycle mode (inherit→monitor→enforce),x xtwo-keydelete confirmation.
fopens filter line-edit (source/verdict/rule),tabcycles fields,cclears,itoggles internal sources,enteropens adetail modal showing every ledger field,
Htoggles full hashes.ishows/hides internal harnesses to match web behavior.seq / count / rootfrom/v1/ledger/root, polled live.GET /v1/ledger/insights?window=1h|24h|7d|all&top=Nendpoint walking the JSONL ledger with time bucketing — 12 × 5min, 24 × 1h, 7 × 24h, orunbounded.
LedgerEntry.Tooladded (omitempty); plumbed through gate-check + 8 hook handlers (claude / codex / cursor / gemini × pre+post).addGate,patchGate,ledgerInsightsmethods +LedgerInsightsResponse/InsightWindowtypes.$EDITORhelper: spawns$VISUAL>$EDITOR>vion a tempfile; renderer suspends so the editor owns the TTY cleanly.Test plan
bun testpasses (cli)cargo testpasses (ledger)go test -race ./...passes (control-plane)./agentlock dashboardagainst a running daemon. Confirm five tabs render. On Stats, hit1/2/3/0to switch windows;sparkline + axis update. Generate denies (
./agentlock fake-hook --tool Bash --command 'rm -rf …') and confirmtop deny rulesandtop deny toolspopulate.On Gates, exercise
a/e/space/M/x x. On Events, exercisef/tab/c/enter/H. Cross-check every change against the web dashboardat
:7879— the two views should agree within the 2s poll window.Notes for reviewers
LedgerEntry.Toolis additive (omitempty). Existing JSONL entries decode withTool == ""and are skipped bytop_tools_denyaggregation rather than mis-attributed. The TUI surfaces a one-line hint when the deny window contains only legacy entries so it doesn't look like a bug.
<text>siblings inside aflexDirection="column"box collapse onto a single row once content widens — this is whyCounterRowis single-line and theFooterwraps each line in its own<box flexDirection="row">. Worth knowing if you touch other column layouts.suspend()isn't available. Tempfile is created with mode0o600and removedin
finally.·so the bucket count stays readable.yamlstack already shipping incli/./v1/ledger/list?since=…) once volume justifies it; today filters apply client-side over the SSE buffer,matching the web dashboard's behavior.
Checklist
CONTRIBUTING.md.envcontent committed