Skip to content

Replay your coding agent sessions as a map and a timeline

feat(viewer): add Home and End shortcuts for replay navigation

OMEE-Ybb7342707d4c
diff --git a/viewer/src/core/playback.test.ts b/viewer/src/core/playback.test.ts
index cfef6a5..4b3c574 100644
--- a/viewer/src/core/playback.test.ts
+++ b/viewer/src/core/playback.test.ts
@@ -103,6 +103,11 @@ describe('replayKeyAction', () => {
});
});
+ it('Home and End seek to start and end', () => {
+ expect(key('Home')).toEqual({ type: 'seek', index: 0 });
+ expect(key('End')).toEqual({ type: 'seek', index: Infinity });
+ });
+
it('E / X / D / O / R jump, either case', () => {
expect(key('e')).toEqual({ type: 'jump', kind: 'edit' });
expect(key('X')).toEqual({ type: 'jump', kind: 'err' });
@@ -118,5 +123,11 @@ describe('replayKeyAction', () => {
expect(key('e', { metaKey: true })).toBeNull();
expect(key(' ', { ctrlKey: true })).toBeNull();
expect(key('ArrowRight', { altKey: true })).toBeNull();
+ expect(key('Home', { ctrlKey: true })).toBeNull();
+ expect(key('Home', { metaKey: true })).toBeNull();
+ expect(key('Home', { altKey: true })).toBeNull();
+ expect(key('End', { ctrlKey: true })).toBeNull();
+ expect(key('End', { metaKey: true })).toBeNull();
+ expect(key('End', { altKey: true })).toBeNull();
});
-});
+});
\ No newline at end of file
diff --git a/viewer/src/core/playback.ts b/viewer/src/core/playback.ts
index d0b849d..740feeb 100644
--- a/viewer/src/core/playback.ts
+++ b/viewer/src/core/playback.ts
@@ -86,6 +86,7 @@ export function playbackReducer(
export type ReplayKeyAction =
| { type: 'toggle' }
| { type: 'step'; delta: number }
+ | { type: 'seek'; index: number }
| { type: 'jump'; kind: JumpKey };
type JumpKey = 'edit' | 'err' | 'delay' | 'out' | 'retry';
@@ -100,9 +101,10 @@ const JUMP_KEYS: Record<string, JumpKey> = {
};
/**
- * Space plays or pauses, the arrow keys step (Shift steps 10), and E / X / D /
- * O / R jump to the next edit / error / delay / output / retry. Any modifier
- * other than Shift means the key belongs to the browser, so it maps to nothing.
+ * Space plays or pauses, the arrow keys step (Shift steps 10), Home and End
+ * jump to the start and end, and E / X / D / O / R jump to the next edit /
+ * error / delay / output / retry. Any modifier other than Shift means the key
+ * belongs to the browser, so it maps to nothing.
*/
export function replayKeyAction(e: {
key: string;
@@ -113,6 +115,8 @@ export function replayKeyAction(e: {
}): ReplayKeyAction | null {
if (e.metaKey || e.ctrlKey || e.altKey) return null;
if (e.key === ' ') return { type: 'toggle' };
+ if (e.key === 'Home') return { type: 'seek', index: 0 };
+ if (e.key === 'End') return { type: 'seek', index: Infinity };
if (e.key === 'ArrowRight' || e.key === 'ArrowLeft') {
const d = (e.shiftKey ? 10 : 1) * (e.key === 'ArrowRight' ? 1 : -1);
return { type: 'step', delta: d };
@@ -121,4 +125,4 @@ export function replayKeyAction(e: {
return Object.hasOwn(JUMP_KEYS, k)
? { type: 'jump', kind: JUMP_KEYS[k] }
: null;
-}
+}
\ No newline at end of file
diff --git a/viewer/src/explorer/SessionExplorer.tsx b/viewer/src/explorer/SessionExplorer.tsx
index 4498a8e..abe8c99 100644
--- a/viewer/src/explorer/SessionExplorer.tsx
+++ b/viewer/src/explorer/SessionExplorer.tsx
@@ -553,7 +553,7 @@ function useScopeActions(x: ExplorerScope) {
}
const REPLAY_LABEL =
- 'Session replay. Space plays or pauses, arrow keys step, Shift steps 10, E jumps to the next edit, X to the next error, D to the next delay, O to the next output, R to the next retry.';
+ 'Session replay. Space plays or pauses, arrow keys step, Shift steps 10, Home and End jump to the first and last event, E jumps to the next edit, X to the next error, D to the next delay, O to the next output, R to the next retry.';
/**
* The fit-viewport replay: sidebar | (header with the filters on its line,
@@ -763,4 +763,4 @@ function MapPlayerBody({
</div>
</>
);
-}
+}
\ No newline at end of file