fix: stop a stuck cursor, pick the right Claude session file, skip the Kimi blob walk

A Capacity Dock row that vanishes while hovered fires no hover exit, so the
pushed pointing-hand cursor stuck system-wide; the row now pops it on the way
out. Claude Code writes a fresh sessions/<pid>.json on every resume, so several
files name one session and the first listed was taken; the newest is taken now,
and a newest that fails the recycled-pid guard leaves the row inert.

collectKimicodeInputs recursed the whole Kimi session store to find wire files,
listing ~18k entries for ~2k wires at ~250ms per payload build. It now walks
work dir, session and agent levels only: ~23ms, and a decoy wire.jsonl under
blobs/ or file-history/ no longer reports itself as a session.
This commit is contained in:
iamtoruk 2026-09-14 03:42:39 -07:00
parent dca2db65f9
commit 97ace81fb6
6 changed files with 73 additions and 7 deletions

View file

@ -340,13 +340,24 @@ export async function collectKimicodeInputs(
windowMs: number,
roots: string[] = kimicodeHomes(),
): Promise<LiveSessionInput[]> {
// Walked level by level rather than recursively: an agent directory also
// holds `blobs` and `file-history` trees, and descending into those turns a
// two-thousand-file scan into an eighteen-thousand-entry one.
const subdirectories = async (path: string): Promise<string[]> =>
(await readdir(path, { withFileTypes: true }).catch(() => []))
.filter(entry => entry.isDirectory())
.map(entry => join(path, entry.name))
const paths: string[] = []
for (const root of roots) {
const entries = await readdir(join(root, 'sessions'), { recursive: true, withFileTypes: true }).catch(() => [])
for (const entry of entries) {
if (entry.isFile() && entry.name === 'wire.jsonl') paths.push(join(entry.parentPath, entry.name))
}
}
await Promise.all(roots.map(async root => {
await Promise.all((await subdirectories(join(root, 'sessions'))).map(async workDir => {
await Promise.all((await subdirectories(workDir)).map(async sessionDir => {
for (const agent of await subdirectories(join(sessionDir, 'agents'))) {
paths.push(join(agent, 'wire.jsonl'))
}
}))
}))
}))
const bySession = new Map<string, { mainMs: number; subagentMs: number[] }>()
await Promise.all(paths.map(async path => {