Commit c58e880
feat: conditional window capture + recording profiling with auto-wormhole (#12)
* feat: disable window capture by default, add recording profiling with auto-wormhole
- Make window reader/writer conditional on RECORD_WINDOW_DATA (defaults to False),
eliminating unnecessary thread + process + expensive platform API calls
- Add throttle to read_window_events (0.1s) and memory_writer (1s) loops
- Add profiling summary at end of record() with duration, event counts/rates,
config flags, main thread check, and thread count
- Auto-send profiling.json via Magic Wormhole after recording stops
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: skip window requirement when RECORD_WINDOW_DATA=False, set log level to WARNING
- When window capture is disabled, skip the window timestamp requirement
in process_events instead of discarding all action events
- Set loguru log level to WARNING by default (was DEBUG) to reduce noise
during recording
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: set log level to INFO not WARNING
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: guard window event save when capture disabled, fix PyAV pict_type compat
- Second reference to prev_window_event in process_events was unguarded,
causing AttributeError when RECORD_WINDOW_DATA=False
- PyAV pict_type="I" raises TypeError on newer versions; fall back to
integer constant
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: use PictureType.I enum for PyAV pict_type, add video tests
- Use av.video.frame.PictureType.I instead of string "I" which is
unsupported in current PyAV versions
- Add test_video.py with tests for frame writing, key frames, and
PictureType enum compatibility
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: use Agg backend for matplotlib, improve wormhole-not-found message
- Set matplotlib to non-interactive Agg backend so plotting works from
background threads (fixes RuntimeError when Recorder runs record()
in a non-main thread)
- Improve wormhole-not-found message with install instructions
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add per-screenshot timing to profiling, fix stop sequence IndexError
- Track screenshot duration (avg/max/min ms) and total iteration duration
per screen reader loop iteration in profiling.json
- Reset stop sequence index after match to prevent IndexError on extra
keypresses
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: make send_profile opt-in CLI flag, add magic-wormhole as regular dep
Profiling data is no longer auto-sent via wormhole after every recording.
Use --send_profile flag to opt in. Also promotes magic-wormhole from
optional [share] extra to a regular dependency since sharing is core
functionality.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: address PR #12 review feedback (5 issues)
- Move magic-wormhole back to optional [share] extra (was accidentally
made a required dependency; recorder.py already handles ImportError)
- Remove module-level logger.remove() that destroyed global loguru config
for all library consumers; configure inside record() instead
- Replace duplicate wormhole-finding logic with _find_wormhole() from
share.py to eliminate code duplication
- Add 60s timeout to _send_profiling_via_wormhole to prevent blocking
indefinitely waiting for a receiver
- Replace unbounded _screen_timing list with _ScreenTimingStats class
that computes running stats (count/sum/min/max) in constant memory
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 6b9282c commit c58e880
2 files changed
Lines changed: 64 additions & 33 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | | - | |
62 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
63 | 67 | | |
64 | 68 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
| 69 | + | |
69 | 70 | | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
| 71 | + | |
75 | 72 | | |
76 | 73 | | |
77 | | - | |
| 74 | + | |
78 | 75 | | |
79 | 76 | | |
80 | 77 | | |
81 | | - | |
| 78 | + | |
82 | 79 | | |
83 | 80 | | |
84 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
85 | 84 | | |
86 | 85 | | |
87 | 86 | | |
| |||
93 | 92 | | |
94 | 93 | | |
95 | 94 | | |
96 | | - | |
97 | | - | |
98 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
99 | 132 | | |
100 | 133 | | |
101 | 134 | | |
| |||
762 | 795 | | |
763 | 796 | | |
764 | 797 | | |
765 | | - | |
| 798 | + | |
766 | 799 | | |
767 | 800 | | |
768 | 801 | | |
| |||
774 | 807 | | |
775 | 808 | | |
776 | 809 | | |
777 | | - | |
| 810 | + | |
778 | 811 | | |
779 | 812 | | |
780 | 813 | | |
| |||
1389 | 1422 | | |
1390 | 1423 | | |
1391 | 1424 | | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
1392 | 1428 | | |
1393 | 1429 | | |
1394 | 1430 | | |
| |||
1417 | 1453 | | |
1418 | 1454 | | |
1419 | 1455 | | |
1420 | | - | |
| 1456 | + | |
1421 | 1457 | | |
1422 | 1458 | | |
1423 | 1459 | | |
| |||
1783 | 1819 | | |
1784 | 1820 | | |
1785 | 1821 | | |
1786 | | - | |
1787 | | - | |
1788 | | - | |
1789 | | - | |
1790 | | - | |
1791 | | - | |
1792 | | - | |
1793 | | - | |
1794 | | - | |
1795 | | - | |
| 1822 | + | |
1796 | 1823 | | |
1797 | 1824 | | |
1798 | 1825 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | 44 | | |
46 | 45 | | |
47 | 46 | | |
| |||
60 | 59 | | |
61 | 60 | | |
62 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
63 | 67 | | |
64 | 68 | | |
65 | | - | |
| 69 | + | |
66 | 70 | | |
67 | 71 | | |
68 | 72 | | |
| |||
0 commit comments