tanuki-telemetry 1.4.1 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: |
|
|
3
|
+
Record an agent-browser session as MP4 video. Start recording, perform actions, stop to encode.
|
|
4
|
+
Videos can be uploaded to telemetry as artifacts.
|
|
5
|
+
allowed-tools: Bash, mcp__telemetry__log_artifact
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# /record — Record Agent Browser Session
|
|
9
|
+
|
|
10
|
+
Records agent-browser screenshots at regular intervals and encodes them into an MP4 video.
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
- `/record` or `/record start` — Start recording (1 frame/sec)
|
|
15
|
+
- `/record start 500` — Start recording at 2 fps (500ms interval)
|
|
16
|
+
- `/record stop` — Stop and encode to MP4
|
|
17
|
+
- `/record stop --upload` — Stop, encode, and upload to telemetry
|
|
18
|
+
- `/record status` — Check recording status
|
|
19
|
+
|
|
20
|
+
## On Invoke
|
|
21
|
+
|
|
22
|
+
Parse the argument. Default action is "start".
|
|
23
|
+
|
|
24
|
+
### Start
|
|
25
|
+
```bash
|
|
26
|
+
~/.claude/scripts/record-browser.sh start "/tmp/browser-recording-$(date +%Y%m%d-%H%M%S).mp4" ${INTERVAL:-1000}
|
|
27
|
+
```
|
|
28
|
+
Then tell the user: "Recording started. Perform your actions, then run `/record stop` when done."
|
|
29
|
+
|
|
30
|
+
### Stop
|
|
31
|
+
```bash
|
|
32
|
+
~/.claude/scripts/record-browser.sh stop
|
|
33
|
+
```
|
|
34
|
+
The script outputs the path to the MP4 file.
|
|
35
|
+
|
|
36
|
+
If `--upload` flag is present and a telemetry session is active, upload as artifact:
|
|
37
|
+
```
|
|
38
|
+
mcp__telemetry__log_artifact({
|
|
39
|
+
session_id: current_session_id,
|
|
40
|
+
file_path: "/tmp/browser-recording-*.mp4",
|
|
41
|
+
artifact_type: "recording",
|
|
42
|
+
description: "Agent browser session recording"
|
|
43
|
+
})
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Status
|
|
47
|
+
```bash
|
|
48
|
+
~/.claude/scripts/record-browser.sh status
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Tips
|
|
52
|
+
- Start recording BEFORE navigating to the page you want to capture
|
|
53
|
+
- Higher fps (lower interval) = smoother video but larger file
|
|
54
|
+
- Default 1fps is good for demos, use 500ms for smoother action
|
|
55
|
+
- Videos are saved to /tmp/ by default — upload to telemetry for persistence
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Record agent-browser session as MP4 video
|
|
3
|
+
# Usage: record-browser.sh start [output.mp4] [interval_ms]
|
|
4
|
+
# record-browser.sh stop
|
|
5
|
+
# record-browser.sh status
|
|
6
|
+
|
|
7
|
+
PIDFILE="/tmp/browser-recorder.pid"
|
|
8
|
+
FRAMEDIR="/tmp/browser-recording-frames"
|
|
9
|
+
DEFAULT_OUTPUT="/tmp/browser-recording-$(date +%Y%m%d-%H%M%S).mp4"
|
|
10
|
+
DEFAULT_INTERVAL=1000 # 1 screenshot per second
|
|
11
|
+
|
|
12
|
+
case "${1:-status}" in
|
|
13
|
+
start)
|
|
14
|
+
OUTPUT="${2:-$DEFAULT_OUTPUT}"
|
|
15
|
+
INTERVAL="${3:-$DEFAULT_INTERVAL}"
|
|
16
|
+
|
|
17
|
+
if [ -f "$PIDFILE" ] && kill -0 "$(cat "$PIDFILE")" 2>/dev/null; then
|
|
18
|
+
echo "Recording already in progress (PID $(cat "$PIDFILE"))"
|
|
19
|
+
exit 0
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
rm -rf "$FRAMEDIR"
|
|
23
|
+
mkdir -p "$FRAMEDIR"
|
|
24
|
+
|
|
25
|
+
# Background process: take screenshots at interval
|
|
26
|
+
(
|
|
27
|
+
FRAME=0
|
|
28
|
+
while true; do
|
|
29
|
+
PADDED=$(printf "%06d" $FRAME)
|
|
30
|
+
agent-browser screenshot "$FRAMEDIR/frame-${PADDED}.png" 2>/dev/null
|
|
31
|
+
if [ $? -ne 0 ]; then
|
|
32
|
+
sleep 1
|
|
33
|
+
continue
|
|
34
|
+
fi
|
|
35
|
+
FRAME=$((FRAME + 1))
|
|
36
|
+
sleep "$(echo "scale=3; $INTERVAL/1000" | bc)"
|
|
37
|
+
done
|
|
38
|
+
) &
|
|
39
|
+
|
|
40
|
+
echo $! > "$PIDFILE"
|
|
41
|
+
echo "$OUTPUT" > /tmp/browser-recording-output
|
|
42
|
+
echo "Recording started (PID $!) → $OUTPUT"
|
|
43
|
+
echo "Taking screenshots every ${INTERVAL}ms"
|
|
44
|
+
echo "Run: record-browser.sh stop — to finish and create video"
|
|
45
|
+
;;
|
|
46
|
+
|
|
47
|
+
stop)
|
|
48
|
+
if [ ! -f "$PIDFILE" ]; then
|
|
49
|
+
echo "No recording in progress"
|
|
50
|
+
exit 1
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
PID=$(cat "$PIDFILE")
|
|
54
|
+
kill "$PID" 2>/dev/null
|
|
55
|
+
wait "$PID" 2>/dev/null
|
|
56
|
+
rm -f "$PIDFILE"
|
|
57
|
+
|
|
58
|
+
OUTPUT=$(cat /tmp/browser-recording-output 2>/dev/null || echo "$DEFAULT_OUTPUT")
|
|
59
|
+
FRAME_COUNT=$(ls "$FRAMEDIR"/frame-*.png 2>/dev/null | wc -l | tr -d ' ')
|
|
60
|
+
|
|
61
|
+
if [ "$FRAME_COUNT" -eq 0 ]; then
|
|
62
|
+
echo "No frames captured — nothing to encode"
|
|
63
|
+
exit 1
|
|
64
|
+
fi
|
|
65
|
+
|
|
66
|
+
echo "Encoding $FRAME_COUNT frames → $OUTPUT"
|
|
67
|
+
|
|
68
|
+
# Use ffmpeg to create video from frames
|
|
69
|
+
ffmpeg -y -framerate 1 -i "$FRAMEDIR/frame-%06d.png" \
|
|
70
|
+
-c:v libx264 -pix_fmt yuv420p -preset fast \
|
|
71
|
+
-vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" \
|
|
72
|
+
"$OUTPUT" 2>/dev/null
|
|
73
|
+
|
|
74
|
+
if [ $? -eq 0 ]; then
|
|
75
|
+
SIZE=$(du -h "$OUTPUT" | cut -f1)
|
|
76
|
+
echo "✓ Recording saved: $OUTPUT ($SIZE, $FRAME_COUNT frames)"
|
|
77
|
+
rm -rf "$FRAMEDIR"
|
|
78
|
+
else
|
|
79
|
+
echo "✗ ffmpeg encoding failed"
|
|
80
|
+
exit 1
|
|
81
|
+
fi
|
|
82
|
+
;;
|
|
83
|
+
|
|
84
|
+
status)
|
|
85
|
+
if [ -f "$PIDFILE" ] && kill -0 "$(cat "$PIDFILE")" 2>/dev/null; then
|
|
86
|
+
FRAME_COUNT=$(ls "$FRAMEDIR"/frame-*.png 2>/dev/null | wc -l | tr -d ' ')
|
|
87
|
+
OUTPUT=$(cat /tmp/browser-recording-output 2>/dev/null)
|
|
88
|
+
echo "Recording in progress (PID $(cat "$PIDFILE"))"
|
|
89
|
+
echo " Frames captured: $FRAME_COUNT"
|
|
90
|
+
echo " Output: $OUTPUT"
|
|
91
|
+
else
|
|
92
|
+
echo "Not recording"
|
|
93
|
+
rm -f "$PIDFILE" 2>/dev/null
|
|
94
|
+
fi
|
|
95
|
+
;;
|
|
96
|
+
|
|
97
|
+
*)
|
|
98
|
+
echo "Usage: record-browser.sh [start|stop|status] [output.mp4] [interval_ms]"
|
|
99
|
+
;;
|
|
100
|
+
esac
|