perf: make streaming projection and activity appends incremental (#9152)
Takes over #6608 by @x1xhlol.
Server: thread.message-sent updates the projection row directly and folds latestUserMessageAt in as a running maximum instead of running refreshThreadShellSummary. Client: thread.activity-appended takes an O(1) append path for in-order, unseen activities on reducer-produced arrays, with a WeakMap id index, and falls back to filter and sort for out-of-order, re-delivered, context-window, and snapshot-loaded cases.
Reducer benchmark: 10,000 in-order appends went from 1,180 ms to 70 ms.
Change authored by Claude Fable 5.1 running in Claude Code, based on work by @x1xhlol.
Co-authored-by: Lucas Valbuena <lucknitelol@proton.me>
c2283ce146Theo Browne committed on 9/2/2026, 1:07:26 AM· committed by GitHubparentfeb3ea7