perf: rest animations, cheaper chat typing and server polls, async per-tool hooks

UI
- No animation runs forever: Sagi moods, the custom pet sprite, status dots
  (pulse-dot, pulse-slow, ping) and the chat shimmer play a few cycles and
  rest. An infinite animation kept the browser drawing 60 frames a second.
- useSagiBrain: frames that only move lastActivityAt by <1 s keep the old
  state; the 1 s tick re-renders only when the mood changes.
- ConversationView and MessageList are memoized and PaneChat passes stable
  callbacks: typing in the chat box no longer re-renders the conversation.
- The chat's 700 ms menu poll reads plain text first and scans the terminal
  cell by cell (reusing one cell) only when a row could be a menu cursor row.

Server
- GET /sessions/:id/transcript?after=N skips lines <= N before JSON.parse.
- GET /sessions/:id/outline is cached until the session's events change.
- broadcastLane uses the cached tmux.liveSessions(); tmux.hasSession answers
  "yes" from the fresh shared list instead of a synchronous spawn (50-150 ms
  per psmux call on Windows, blocking terminal echo).
- pane-mode polls every 150 ms; writeHourly writes only changed hour buckets.
- /api/metrics: agenthub_event_loop_delay_seconds{quantile}.

Hooks
- PreToolUse/PostToolUse run with "async": true (settings installer,
  plugin.json, S3 managed settings): Claude Code no longer waits a Node start
  before and after every tool call.

Committed with --no-verify at the owner's request: the pre-commit full server
suite fails on 9 tests that fail identically on 0c2f498 (lane-sync merge: no
git identity on this host; read-pool; resolveHost; codex-usage 1 ms flake).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-14 11:55:53 +07:00
parent c3f83d3922
commit 1c5521cf2e
31 changed files with 341 additions and 61 deletions
+10 -4
View File
@@ -530,12 +530,18 @@
}
}
/* A few pulses when the dot appears, then it rests lit. Status dots sit in
always-visible chrome; an infinite animation there makes the browser draw a
frame 60 times a second for as long as the page is open, which made the
whole desktop stutter. A state change re-adds the class and pulses again. */
.animate-pulse-dot {
animation: pulse-dot 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
animation: pulse-dot 2s cubic-bezier(0.4, 0, 0.6, 1) 3;
}
/* The chat's live step, like Claude Code's: a light sweeping over the words.
Reduced motion stops it on the muted colour. */
/* The chat's live step, like Claude Code's: a light sweeping over the words —
a few sweeps, then it rests on the muted colour (a background-position
animation repaints the text every frame; the spinner beside it keeps saying
the step runs). Reduced motion stops it at once. */
.text-shimmer {
background: linear-gradient(
90deg,
@@ -547,7 +553,7 @@
-webkit-background-clip: text;
background-clip: text;
color: transparent;
animation: text-shimmer 2.5s linear infinite;
animation: text-shimmer 2.5s linear 3;
}
@keyframes text-shimmer {