Replay your coding agent sessions as a map and a timeline
Python agent-observabilityai-agentsclaudeclaude-codecodexcoding-agentscursordeveloper-toolsdevtoolsgithub-copilotkirollmobservabilityopencodeprivacypythonsession-replaytypescriptvisualization
Merge upstream/main and resolve conflicts
OMEE-Yb93e8bd33d7b
diff --cc viewer/src/core/playback.test.tsindex 4b3c574,e3555d5..6d43f6f--- a/viewer/src/core/playback.test.ts+++ b/viewer/src/core/playback.test.ts@@@ -123,11 -189,54 +194,64 @@@ 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();});- });+++});+++++ it('the replay region, a map dot and the page body get every shortcut', () => {+ for (const target of [+ focused('<div role="region" tabindex="-1" data-t><p>map</p></div>'),+ focused('<svg role="img"><circle tabindex="0" data-t></circle></svg>'),+ focused('<div contenteditable="false" data-t>14:05</div>'),+ document.body,+ ])+ expect(keysOn(target)).toEqual(['toggle', 'step', 'jump']);+ });++ it('Space presses a focused button, link or summary instead of playing', () => {+ for (const html of [+ '<button data-t>4×</button>',+ '<a href="#" data-t>PR #12</a>',+ '<details><summary data-t>Tool categories</summary></details>',+ '<svg><text role="button" tabindex="0" data-t>index.ts</text></svg>',+ ])+ expect(keysOn(focused(html)), html).toEqual([null, 'step', 'jump']);+ });++ it('tabs and radios keep Space and the arrows', () => {+ for (const html of [+ '<div role="tablist"><button role="tab" data-t>Details</button></div>',+ '<div role="radiogroup"><button role="radio" data-t>PR</button></div>',+ ])+ expect(keysOn(focused(html)), html).toEqual([null, null, 'jump']);+ });++ it('text fields, lists, menus and popups keep every key', () => {+ for (const html of [+ '<input data-t>',+ '<textarea data-t></textarea>',+ '<select data-t></select>',+ '<div contenteditable data-t></div>',+ '<div contenteditable="plaintext-only" data-t></div>',+ '<input role="combobox" data-t>',+ '<div role="listbox"><button role="option" data-t>14:05</button></div>',+ '<div role="menu"><div role="menuitem" tabindex="-1" data-t>Next</div></div>',+ '<div role="dialog" tabindex="-1" data-t><p>All models</p></div>',+ '<div role="dialog"><button data-t>claude-opus</button></div>',+ ])+ expect(keysOn(focused(html)), html).toEqual([null, null, null]);+ });++ it('a key a control already handled maps to nothing', () => {+ expect(key(' ', { defaultPrevented: true })).toBeNull();+ expect(key('ArrowRight', { defaultPrevented: true })).toBeNull();+ });+ });++diff --cc viewer/src/core/playback.tsindex 740feeb,594435e..d4fbce9--- a/viewer/src/core/playback.ts+++ b/viewer/src/core/playback.ts@@@ -100,11 -115,21 +116,27 @@@ const JUMP_KEYS: Record<string, JumpKeyr: 'retry',};+ const TAKES_EVERY_KEY =+ 'input, textarea, select, [contenteditable]:not([contenteditable="false"]), [role="combobox"], [role="listbox"], [role="option"], [role="menu"], [role="dialog"]';+ const TAKES_ARROWS = `${TAKES_EVERY_KEY}, [role="tab"], [role="radio"]`;+ const KEPT_BY: Record<ReplayKeyAction['type'], string> = {+ jump: TAKES_EVERY_KEY,+ step: TAKES_ARROWS,+ toggle: `${TAKES_ARROWS}, button, summary, a[href], [role="button"]`,+ };+/**+++ * 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.+ * 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. A key the focused+ * control uses, or already handled, belongs to that control. Both map to+ * nothing.++*/export function replayKeyAction(e: {key: string;@@@ -112,16 -137,24 +144,33 @@@metaKey: boolean;ctrlKey: boolean;altKey: boolean;+ defaultPrevented: boolean;+ target: EventTarget | null;}): 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);+++ if (e.metaKey || e.ctrlKey || e.altKey || e.defaultPrevented) return null;+ const action = actionForKey(e.key, e.shiftKey);+ if (!action) return null;+ const kept =+ e.target instanceof Element && e.target.closest(KEPT_BY[action.type]);+ return kept ? null : action;+ }++ function actionForKey(key: string, shift: boolean): ReplayKeyAction | null {+ if (key === ' ') return { type: 'toggle' };+ if (key === 'ArrowRight' || key === 'ArrowLeft') {+ const d = (shift ? 10 : 1) * (key === 'ArrowRight' ? 1 : -1);++>>>>>>> upstream/mainreturn { type: 'step', delta: d };}- const k = e.key.toLowerCase();+ const k = key.toLowerCase();return Object.hasOwn(JUMP_KEYS, k)? { type: 'jump', kind: JUMP_KEYS[k] }: null;