Makes the new sidebar/thread-list testable against existing unupgraded
servers by removing every backend dependency of the settled feature:
- apps/server, contracts orchestration schemas, and client-runtime
command/reducer plumbing revert to main baseline (no thread.settle
commands, no settled events/fields, no migration 033)
- effectiveSettled() is now archive-based: archivedAt is the explicit
settled signal; PR merged/closed and inactivity auto-settle keep
working client-side. Blocked work (pending approval/input, live
session) still never settles
- settle/unsettle actions ride threadEnvironment.archive/unarchive on
web and mobile — UI and UX unchanged
- Archived threads stay visible as the settled tail: the live shell
stream drops archived threads (thread.archived → thread-removed), so
both clients merge them back from the archived shell snapshot and
refresh it after settle/unsettle/archive actions
- Client settings (sidebarV2Enabled, sidebarAutoSettleAfterDays) are
kept — they persist client-side only
Trade-offs vs the event-sourced model (still on t3code/sidebar-v2-mobile):
no activity-driven auto-un-settle for archived threads, and no "keep
active" override distinct from unarchiving.
Co-Authored-By: Claude Fable 5 <[email protected]>
CI: add settledOverride/settledAt + new client settings to desktop and
mobile test fixtures and the mobile threadDetailToShell mapping.
Review fixes (cursor bugbot + macroscope):
- failed status now requires session.status === "error" instead of any
lingering lastError on a stopped/ready session
- effectiveSettled: pending approvals or user input always win — blocked
work can never collapse into the settled tail, even manually settled
- decider unsettle-on-activity guards check settledOverride === "settled"
so activity no longer erases a user's explicit keep-active override
- repeat thread.settle re-emits with updatedAt = original settledAt, so
double-settles no longer bump recency ordering
- sidebarAutoSettleAfterDays bounded 1..90 in schema and patch
- approval wait sort/label use shell.updatedAt (bumped by the approval
activity in the projection pipeline) instead of latestUserMessageAt /
turn start, with the approximation documented
- v2 rows: Enter/Space keyboard activation; double-click inline rename
ported from v1 plus a context-menu Rename entry
- new-thread picker: cross-project creation no longer inherits the active
thread's branch/worktree; preselection consults the active draft via
resolveThreadActionProjectRef; stale project scope resets to All
- settle worktree prompt: vcs status checked before offering (and again
at click time) — dirty or ahead worktrees are never offered
Co-Authored-By: Claude Fable 5 <[email protected]>
A new thread sidebar behind a Settings → Beta toggle (sidebarV2Enabled,
default off). One flat recency-sorted list across projects: active threads
render as two-line cards (favicon, title, time, status word · branch ·
provider glyph + model · machine), settled threads collapse to slim
one-liners. Approval-blocked threads pin to the top with wait time; failed
sessions (session.lastError) finally get a visible state.
Settled is an event-sourced lifecycle state mirroring the archived pattern:
- settledOverride ("settled" | "active" | null) + settledAt on the thread,
thread.settle/thread.unsettle commands, thread.settled/thread.unsettled
events, projection columns via migration 033.
- effectiveSettled() computes the visible state: manual override beats
auto rules (PR merged/closed, N days of inactivity — client setting,
default 3, nullable). Idempotency is by event re-emission since the
engine rejects zero-event commands.
- Activity auto-unsettles server-side: turn start, live session start,
approval/user-input requests. Session stop/error status writes do not.
Manually settling a thread whose worktree is orphaned offers a one-click
worktree removal (re-validated at click time, never forced).
The v2 component is a sibling swapped at the single AppSidebarLayout mount
point; shared chrome moved to sidebar/SidebarChrome.tsx. The data model is
flag-independent and ships dark for v1 users, so toggling is a pure view
swap.
Plan: .plans/21-sidebar-v2-beta.md
Co-Authored-By: Claude Fable 5 <[email protected]>
- Replace attachment and favicon routes with signed asset URLs
- Harden workspace and attachment asset resolution
- Update browser preview components and shared contracts
Adds a desktop-only browser preview that lives in the right panel slot
alongside plan/diff. Lets the user point an Electron <webview> at any
URL — typed into a chrome-style URL bar, clicked from the empty-state
list of detected localhost dev servers, or auto-opened by a project
script with `previewUrl` set. Single-tab per thread.
Server (Effect/Layers):
- PreviewManager: per-(thread, tab) session metadata via SynchronizedRef
+ PubSub<PreviewEvent>; survives WS reconnect via `list`/replay.
- PreviewPortScanner: lsof on macOS/Linux, TCP probe fallback on
Windows; reference-counted polling so we only scan when subscribed.
- WS RPC + streams (`preview.open|navigate|refresh|close|list|reportStatus`,
`subscribePreviewEvents`, `subscribeDiscoveredLocalServers`).
Desktop:
- PreviewViewManager owns Chromium WebContents per tab, mediates
navigation/zoom/devtools/clear-storage. registerWebview gates by
webContents.getType() === "webview" and host-window match.
- IPC channels for create/close/register/navigate/back/forward/refresh/
zoom/hardReload/openDevTools/clearCookies/clearCache/getBrowserPartition.
- Forwards app-level shortcuts (mod+shift+J, mod+K, mod+,, mod+W) from
the webview back to the main window.
- Persisted browser session partition (cookies, cache).
Web:
- PreviewPanel/PreviewView/PreviewWebview render the surface; chrome row
with back/forward/refresh + URL input + Open-in-browser + 3-dot menu
(Hard reload, DevTools, Zoom −/+/reset, Clear cookies/cache).
- usePreviewSession subscribes to server events; usePreviewBridge
mirrors desktop state into the store and forwards Loading→Success/
LoadFailed back to the server.
- previewStateStore: per-thread snapshot + desktopOverlay + recently-
seen URLs (Zustand).
- rightPanelStore arbitrates plan vs. preview vs. diff; ChatView's
toggles strip the `?diff=1` URL hint when switching to preview and
vice versa so the panels are mutually exclusive.
- Top-nav Globe toggle in ChatHeader (desktop builds only) and a
`mod+shift+J` keybinding routed via a typed previewActionBus.
- PreviewEmptyState lists detected localhost servers (scanner +
configured project URLs + recently-seen) with live "listening" pulse.
- PreviewUnreachable: theme-aware port of Chromium's "site can't be
reached" page.
- Resizable inline panel (RightPanelResizeHandle + useResizableWidth);
width persists to localStorage on drag-end.
- Terminal link "Open in preview" context-menu integration for loopback
URLs.
Contracts:
- preview.ts schemas (PreviewSessionSnapshot, PreviewNavStatus,
PreviewEvent, RPC inputs/results, DiscoveredLocalServer).
- ProjectScript schema gains optional `previewUrl` + `autoOpenPreview`.
- New keybinding commands: preview.toggle/refresh/focusUrl/zoomIn/Out/
resetZoom; new `when:` contexts `previewFocus` / `previewOpen`.
Shared:
- @t3tools/shared/preview: normalizePreviewUrl, isPreviewableUrl,
isLoopbackHost, newPreviewTabId, LSOF_LOCAL_HOST_TOKENS.
Tests:
- contracts: schema decode tests for all preview events/snapshots/inputs.
- shared: URL normalization coverage.
- server: PreviewManager (open/navigate/reportStatus/refresh/close,
multi-subscriber isolation, idempotency); PortScanner (lsof parsing
including IPv6, TCP probe, reference-counted polling).
- web: previewStateStore (per-tab event application, dedupe,
reconnect recovery); rightPanelStore arbitration.