Fourth step of the virtualization plan. Adds `useVirtualizer` wiring
with a DOM-measured `scrollMargin`, gated behind
`viewport.virtualizationEnabled`. Dormant in this release — no caller
flips the flag yet — so behavior is unchanged.
- Imports `useVirtualizer` from `@tanstack/react-virtual`. Fixed
per-kind estimates (`ROW_SIZE_ESTIMATES`) drive `estimateSize`. Keys
come from `row.key`, so row identity matches the renderRows model.
- `shouldVirtualize` requires all of: contract says enabled, a scroll
element ref is present, and there is at least one row. Otherwise the
render falls back to the direct `renderRows.map(...)` path from PR
#72.
- Measures `scrollMargin` via `ResizeObserver` on both the scroll
element and the timeline root, plus `scroll` and `resize` listeners,
all rAF-batched. Avoids hand-summed heights that drift when
composer/status/padding change.
- Virtualized path renders an absolute-positioned list inside a sized
container (`height = getTotalSize()`). `translateY` subtracts
`scrollMargin` so rows align to the timeline's own origin rather
than the scroll container's top.
This PR intentionally does *not* enable `measureElement` (PR #5) or
flip `virtualizationEnabled` for any layout (PR #6) — both rely on
this wiring landing first.
Third step of the virtualization plan. Pure refactor — no UI change, no
virtualization yet. Prepares the timeline for row-level windowing.
- Introduces `TimelineRow`, a discriminated union of `session-separator`,
`lead-thought-group` (pinned and non-pinned), `compaction-divider`,
and `message-row`. Each row maps 1:1 to a single visual element.
- Adds a `renderRows` useMemo that walks `timelineItems` once and emits
atomic rows, hoisting session separators out of the Fragment bundle
that used to pair them with their owning item. This is the shape a
windowing layer needs: each row measurable and addressable
independently.
- Extracts a `renderTimelineRow(row)` helper that switches on `row.kind`
and returns the same JSX the previous inline render produced. Logic
per kind is identical — keys, memoization, collapse props, pinned
thought "live" semantics — so there is no visual diff.
- The render body collapses from two blocks (pinned + `.slice().map()`)
into a single `renderRows.map(renderTimelineRow)` call.
Follow-ups will virtualize `renderRows` with measured row heights and
tighten observer/animation wiring; pagination, collapse state, zebra
striping, and `groupTimelineItems` are untouched.
Second step of the virtualization plan. No virtualization yet. This PR
makes IntersectionObserver-based visibility tracking correct inside
scroll containers (sidebar, bottom-sheet), which is a prerequisite for
virtualizing the timeline.
- Introduces `TimelineViewport` — a grouped contract passed as a single
`viewport` prop on `ActivityTimeline`. Holds `scrollElementRef`,
`observerRoot`, `scrollMargin`, and `virtualizationEnabled`.
- `MessageRowWithObserver` and `LeadThoughtsGroupRow` now create their
`IntersectionObserver` with `root = observerRoot?.current ?? null`
instead of defaulting to the document viewport. Unread marking now
fires when rows enter their real scroll parent.
- `MessagesPanel` resolves the active scroll owner from `position`
(inline from parent ref, sidebar from `sidebarScrollRef`, bottom-sheet
from `bottomSheetScrollRef`) and passes it into ActivityTimeline.
- Tests: stubs `IntersectionObserver` to capture `options.root` and
asserts null when no viewport is passed, and the provided element when
`viewport.observerRoot` is set.
`scrollMargin` and `virtualizationEnabled` are included in the contract
but not consumed yet — they land in follow-up PRs (#4/#5).
First step toward virtualizing ActivityTimeline. Makes the real scroll
container observable per layout, without changing behavior.
- `TeamDetailView` forwards `contentRef` to `MessagesPanel` as
`inlineScrollContainerRef`. `MessagesPanel` accepts it as an optional
prop (unused in this release) so a follow-up can wire the inline
viewport to virtualization consumers.
- `MessagesPanel` creates `bottomSheetScrollRef` and passes it to
`Sheet.Content scrollRef`. react-modal-sheet merges it with its
internal scroll ref, so the element stays the same DOM node; this
only exposes it to us.
- Sidebar already owns `sidebarScrollRef`; no change there.
Behavior is unchanged — this only exposes refs for the follow-up that
will thread a viewport contract into ActivityTimeline.
- Integrated pending replies state management for team members.
- Updated TeamDetailView to initialize pending replies from state.
- Added logic to refresh team messages and member activity on tab focus.
- Improved UI components by increasing dialog content width for better layout.
- Enhanced member draft rows with avatar support for better visual representation.
- Implemented reconciliation logic for pending replies based on message history.
- Updated tests to cover new functionality and ensure reliability.
- Bumped pnpm version to 10.33.0 in package.json.
- Added existing members to EditTeamDialog for better context.
- Improved buildMemberDraftColorMap to reserve colors for existing members and predict colors for new drafts.
- Added tests to ensure color assignment logic works correctly for existing and new members.
Replace the per-item backward scan that located the most recent session
anchor with a single forward pass via useMemo.
Before: for every timeline item the render loop walked backward until
it found a lead-thought anchor, so N items produced up to N * N anchor
lookups on every render pass.
After: a single O(n) sweep builds previousSessionAnchorByIndex; render
time lookup is O(1). getItemSessionAnchorId is hoisted to module scope
so it is not recreated per render.
Behavior is unchanged. The three existing separator tests still pass,
and four new cases cover three-session transitions, long runs of
non-anchor items between thought groups, consecutive same-session
thoughts, and single-item lists.
- Updated `getClaudeLogs` method to support asynchronous fetching of logs.
- Introduced new interfaces for retained logs and transcript cache entries.
- Added logic to retain and retrieve Claude logs even after cleanup of live runs.
- Implemented fallback mechanism to use persisted transcripts when no live run exists.
- Updated tests to cover new log retention and retrieval scenarios.
Remove the SessionDetail.messages stripping and related cache-size
change per maintainer feedback. The session-detail optimization will
follow separately after PR #58 lands with the right architectural
pattern (lightweight snapshot + separate endpoints).
This PR now contains only:
- progressPayload helpers (buildProgressLogsTail, buildProgressAssistantOutput)
- cap applied to emitLogsProgress, updateProgress, stall warning, retry error
- throttle raised 300ms -> 1000ms
- tests for the progress payload behavior
Autofix-only change. The OOM-fix commit inserted the progressPayload
import into the wrong position relative to AutoResumeService /
idleNotificationMainProcessSemantics, which failed the
simple-import-sort ESLint rule enforced by CI.
Users with long-running teams (37+ tasks, 10+ agents for an hour) were
hitting constant renderer crashes (issue #36). Two hot paths were
serializing unbounded histories across IPC on every tick:
- Provisioning progress: emitLogsProgress and updateProgress both
joined the full provisioningOutputParts array (~20 event-driven call
sites) plus the full CLI log tail, then fanned that out to the
renderer. After an hour, each tick shipped multi-megabyte payloads
and Zustand OOM'd on the immutable state clone.
- Session detail cache: SessionDetail.messages (the raw parsed JSONL)
was being cached and returned over IPC/HTTP even though the renderer
only reads session/chunks/processes/metrics. This roughly doubled
the per-entry cache footprint on large sessions.
Fixes:
- Add progressPayload helpers that cap the log tail to 200 lines and
assistant output to the last 20 parts; empty/whitespace joins
collapse to undefined so the noop guard is explicit rather than
coincidental.
- Apply the cap inside emitLogsProgress, updateProgress, and the two
inline emission paths (stall warning, retry error). Throttle the
log-progress tick 300ms -> 1000ms so Zustand can keep up.
- Add stripSessionDetailMessages and call it at every SessionDetail
production site that crosses IPC/HTTP (both sessions.ts routes,
both cache stores).
- Raise MAX_CACHE_SESSIONS 5 -> 20 now that the per-entry SessionDetail
footprint is bounded. Previously 5 forced constant re-parsing on
every session switch.
Tests: 15 new unit tests covering the helpers (tail slicing, empty
parts, whitespace-only parts, non-mutation of inputs).