Skip to content

Add activity timeline replay mode#10

Open
AbdullahSAhmad wants to merge 1 commit intomasterfrom
strata/wi-1-5aec
Open

Add activity timeline replay mode#10
AbdullahSAhmad wants to merge 1 commit intomasterfrom
strata/wi-1-5aec

Conversation

@AbdullahSAhmad
Copy link
Collaborator

Summary

  • Add replay mode that lets users watch recorded agent sessions play back through the existing timeline UI
  • Server stores stripped AgentState snapshots per timeline event in SQLite (schema v3 migration) and exposes a new /api/sessions/:id/replay-events REST endpoint
  • Client ReplayManager orchestrates the full replay lifecycle: pause WebSocket, load events, drive Timeline playback, then reconnect on exit
  • Session history panel shows a Replay button on each recorded session; timeline shows REPLAY badge and Exit button during playback

Files Changed (15)

  • shared: ReplayTimelineEvent type, exported from index
  • server: Schema migration v2->v3, SessionRecorder stores agent_state_json, SessionStore.getReplayEvents(), replay-events API route
  • client: ReplayManager, StateStore.enterReplayMode/exitReplayMode, WsClient.pause/reconnect, Timeline recording replay mode, Session history Replay button, Escape key exit, CSS for replay UI

Test plan

  • Build passes (npm run build for all 3 packages)
  • Type check passes (npx tsc -b)
  • Start server, let an agent session complete and finalize
  • Open Sessions tab, verify Replay button appears on recorded sessions
  • Click Replay: WebSocket disconnects, REPLAY badge shown, agents animate through recorded events
  • Play/pause, speed controls work during replay
  • Click Exit Replay or press Escape: returns to live view, WebSocket reconnects
  • Existing live monitoring unaffected after exiting replay
  • Schema migration is backward-compatible: old sessions show but lack replay data

🤖 Generated with Claude Code

Implement the ability to replay recorded agent sessions through the existing
timeline UI. Sessions are enriched with AgentState snapshots stored in SQLite
(schema v3 migration), and a new REST endpoint serves replay events. The client
orchestrates replay via ReplayManager which pauses the live WebSocket, loads
recorded events into StateStore, and drives the Timeline's existing playback
controls.

Changes:
- Shared: Add ReplayTimelineEvent type extending RecordedTimelineEvent with AgentState
- Server: Schema v2->v3 migration adding agent_state_json column to timeline tables
- Server: SessionRecorder now serializes stripped AgentState per event
- Server: GET /api/sessions/:id/replay-events endpoint
- Client: ReplayManager orchestrates enter/exit replay flow
- Client: StateStore.enterReplayMode/exitReplayMode for state isolation
- Client: WsClient.pause/reconnect for non-destructive WS lifecycle
- Client: Timeline recording replay mode with REPLAY badge and exit button
- Client: Session history panel Replay button per session row
- Client: Escape key exits replay mode

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant