# vhs tape — show the mechanism behind pi-simocracy's inline graphics:
# terminal capability detection, the actual Kitty escape sequence on the
# wire, and the env-var override. Rendered in xterm.js (no inline-image
# support) so the visible output is the text and protocol data — the
# *real* image render lives in the Ghostty screenshot at 01-…hero.png.
#
# Run with:  vhs assets/03-mechanism.tape

Output assets/03-mechanism.webm

Set FontSize 14
Set Width 1400
Set Height 760
Set TypingSpeed 30ms
Set Theme "Dracula"

# `cd` into pi-simocracy so jiti finds @mariozechner/pi-tui via the
# project's own node_modules. The screenshot at 01-…hero.png shows
# what the user actually sees in Ghostty; this tape is the wire-level
# evidence (xterm.js can't render Kitty graphics inline).
# Run from inside pi-simocracy and point NODE_PATH at its node_modules
# so jiti can resolve `@mariozechner/pi-tui` from the asset script.
Type "cd /Users/david/Projects/pi-simocracy && export NODE_PATH=$PWD/node_modules"
Enter
Sleep 600ms

Type "# 1. terminal capability detection — driven by TERM_PROGRAM"
Enter
Sleep 400ms
Type `node --input-type=module -e "import('@mariozechner/pi-tui').then(({detectCapabilities})=>console.log(detectCapabilities()))"`
Enter
Sleep 3s

Type "# 2. emit one Duo idle frame and inspect the wire (Kitty graphics)"
Enter
Sleep 400ms
Type "npx jiti ../pi-eval/reports/pi-simocracy/kitty-graphics-render/assets/03-emit-once.ts 2>/dev/null | head -c 180 | xxd"
Enter
Sleep 6s

Type "# 3. SIMOCRACY_INLINE_GRAPHICS=ansi — same call, half-block fallback path"
Enter
Sleep 400ms
Type "SIMOCRACY_INLINE_GRAPHICS=ansi npx jiti ../pi-eval/reports/pi-simocracy/kitty-graphics-render/assets/03-emit-once.ts 2>/dev/null | head -c 180 | xxd"
Enter
Sleep 6s

Type "# 4. configurable display size (defaults to 10 cells)"
Enter
Sleep 400ms
Type "grep -nA 2 'SIMOCRACY_SPRITE_WIDTH' src/index.ts | head -12"
Enter
Sleep 4s

Sleep 2s
