ac4af582301a4e8a29245dbba767eba31334ddf9
6
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
5ebceee2da |
usage: the tool legend keeps each spelling's own kind (#2969)
Follow-up to ggbdpq's b2a8b74c7 (the tool list grouped case-blind).
That change put every spelling's calls in the legend under the kind of
the spelling seen first, so where two spellings have different kinds
("task" is Other, "Task" is Task) the Categories legend changed with
the order sessions were read in, and no longer matched the weeks
(pd.tools), which count each spelling under its own kind. The legend
now counts each call under ToolCategory of the name it was called by,
as before b2a8b74c7; only the Top rows merge. The tie-break comment
said "the shorter name", where the code takes the first in byte order.
TestToolUseMergesSpellings gains "the legend keeps each spelling's own
kind" ("task" 3 then "Task" 5: legend Task 5, Other 3). Broken by hand:
with b2a8b74c7's stats.go it is red ("categories [{Name:Other Calls:8
Sessions:2}]"), green with this.
Run at the pushed head on mote: go test ./... -timeout 45m on mote with this branch on
|
||
|
|
1c76095e97 |
usage: the tool list groups tools case-insensitively, as its summary does (#2969)
What changed
- toolUse now folds a tool's spellings into one row of the sessions'
"Tool use" detail list: its calls and sessions are summed under one
case-insensitive name, the row is shown by the summary's own spelling
when the tool is its kind save for the case ("bash" as "Bash"), and by
its most called spelling otherwise. A session that called both ways
counts once.
- The summary's per-kind list ("Bash 2.2K") already merged the spellings,
via ToolCategory; the detail list keyed its rows by the raw name, so
the same tool read as two.
Why (issue #2969)
The card's left list split `bash` (1.4K calls, 20 sessions) from `Bash`
(779, 2), `read` (192, 15) from `Read` (123, 1) and `write` (64, 13) from
`Write` (56, 1), while the right legend showed one Bash 2.2K, Read 315,
Write 120 - the sums of each pair. Same card, two answers. The detail
rows now answer with the summary.
Run
- go test ./internal/sessions/ -run TestToolUseMergesSpellings: fails on
the old code (the split above), passes on the new; a session that
called `read` and `Read` counts once, and tools that only share a kind
(two mcp__ tools) stay apart.
- go test ./internal/sessions/: ok.
- gofmt -l on the touched files: clean; go vet ./internal/sessions/: clean;
go build ./...: ok.
Landed (yetone), at the pushed head on mote: go test ./... -timeout 45m on mote with this branch on
|
||
|
|
3ec9babe7d |
sessions: the overview points to the sessions it sums up, not copies (#2278)
Stats.Overview copied every Summary (~400 bytes) into its working slice, then cloned that slice once per Top ranking. Over 34k sessions the Sessions page's poll allocated ~1.5 GB in two minutes this way while an agent worked (alloc profile of v0.1.1928 on mote: `in = append` 958 MB, slices.Clone 557 MB). It now ranks pointers into st.Sessions and copies only the k sessions each ranking keeps. shapes, toolUse and skillUse take the pointers. TestOverviewCopiesOnlyItsTop: a second Overview over 5000 sessions allocates at most half of their Summaries' size, and its count and rankings are what they were. Red on the old code (14,923,144 bytes over a 1,020,000 bar), green on the new. A/B on mote (34,040 session files, 240k-row usage.jsonl, the feed run of run2278c.sh: 230s, feed from 60s, Usage and Sessions pages polled), v0.1.1928 code vs this change. mote's load was 47 to 66 from other runs throughout, so the numbers are noisy: avg CPU after the feed starts 122.8% -> 69.4% heatmap poll mean 6.97s -> 4.84s all polls mean 3.11s -> 2.16s footprint peak 685.6M -> 626.1M footprint at the end 402.8M -> 337.5M Run on mote, at base |
||
|
|
3393e61d00 |
sessions: a summary's tools, skills and days are sorted slices, not maps
Each range statsFor keeps (all days, and 30, warmed at start) holds a Summary for every session, and each had four maps (tools, skills, skillLast, perDay) plus a tools map in every day. Most hold one or two names, and a Go map of one is a few hundred bytes. They are now counts (name, calls, a skill's last date) in the names' order, and perDay a slice of days in order; the build still sums into maps and hands those over once. Run at this head ( |
||
|
|
317bc70875 |
sessions: one index run a page shows once, a spinner, a session-shape chart that reads, and every session counted in it (Image #9–#13: 排版不对…土土的; 这个原点的动画可以换成别的吗; 这个图我着实没看懂; 出现之后又消失又出现…跑完之后突然又出现; 为什么只有5个会话)
- The index hero flickered and ran again: the sessions list, the stats and a
range change each started their own refresh of just the files they wanted,
and the page showed a fallback hero after 700 ms whether or not anything was
being read. List and stats now refresh every changed file in one run, so the
read after it has nothing to do and a wider range finds the files read; the
hero shows only while the server says it is indexing, and once it is done it
stays at 100% ("Indexed · putting the page together…") and never starts over.
- The hero: a dot field in the accent alone, a big percentage, a hairline bar;
a thin spinning ring in place of the pulsing dot, still when done or for
reduced motion.
- Session shape: bars stand on a baseline with no grey column behind them,
an empty bin is "0" over a stub, the busiest bin is in full accent (only
when one is busiest), "Autonomy" is "Tool calls" (工具调用), and a line says
what each axis is (横轴:… · 柱高:会话数).
- Only 5 sessions in the shape: parses kept by an early cacheVersion 4 had no
prompts or replies, and were never read again, so the chart skipped them.
cacheVersion 5 reads them again (on real data 385 of 462 sessions over 30
days, rather than 5). Sessions of agents that tell no messages (pi, grok…)
now count by their minutes at work.
Tested: TestShapesMinutesWithoutMessages; sessions-overview.test.cjs in Chromium
and WebKit, en and zh (the bars, zero stub, peak, both footers, the tool-calls
label); go test -tags nogui ./..., builds for darwin, linux, windows. Two GUI
files failing in the parallel run (click-scroll WebKit, login-import chromium
zh) pass alone.
|
||
|
|
41841997d6 |
sessions: a fast index with an animated first run, searchable model and folder pickers, and the overview's session shape, tool use, top skills and heatmap by messages or output tokens (v: 感觉我们的Session可观测性页面也要做的这么的丰富、优雅、简洁…; 顶多第一次打开顶多需要个1分钟,然后之后都是靠索引能够极快的打开; 一定一定要特别炫酷的一个动画; Image #6/#7/#8)
The index: session files are read in parallel and each line told from its first bytes (a Claude line's type, message head and usage; a Codex line's type and payload), so tool results, attachments and compactions are never decoded; a cold index of this machine's sessions takes about 32 s, then the page opens from ~/.cache/magpie/sessions.json (version 4, which re-indexes once) and only changed files are read again. The page keeps showing the last answer while a fresh one is computed, and GET /api/sessions/progress says how far a first run is, which the page shows in an animated hero instead of a spinner (reduced motion respected). All models and All folders are searchable combo boxes that draw only the rows in sight, so 13k folders open at once. Each day now counts the prompts typed, replies, tool calls by name and skills called (a subagent's calls and tokens count, its messages don't). The overview adds: - Session shape (会话形态): sessions by messages (1–5 … 121+), minutes at work, or autonomy (tool calls a prompt, <1 … 21+), toggled and remembered; - Tool use (Tool 使用): calls and sessions, the top tools with their kind's dot, calls, sessions and share, the kinds (Bash, Edit, Read, Write, Grep, Glob, Task, MCP tools, other) as a stacked bar and by week; - Top skills (常用 Skills): each skill's calls, sessions, last use, agents' share and projects; - the activity heatmap by Output tokens (输出 Token) and Messages (消息) beside Tokens, Sessions, Cost and Active. No border stripes; a toggle leaves the page where it was. Tested with TestStatsToolsAndSkills (Claude reply blocks laid out both ways, a Skill call, an MCP tool, /clear, an interrupt, a subagent; a Codex rollout's function and custom tool calls) and the stats tests, and internal/gui/tests/sessions-overview.test.cjs in Chromium and WebKit, en and zh: the new metrics and their tips, the shape's buckets and toggles (the page not moved), the tools' rows, kinds and weeks, the skills' lines, nothing overflowing at 1100 and 560 px. go vet, go build -tags nogui (and GOOS=linux, GOOS=windows), go test -tags nogui ./... and the GUI suite pass (panel-fold flaked once in the parallel run, passes alone). |