Pular para o conteúdo
#0971
TerminalCron

The lab bot never types over a student's editor

Forty students, one lab, and a cron pass every five minutes that pushes the next step into each terminal once the previous one passes. The danger: make test pushed into a terminal where the student is mid-vim lands in the file.

Before touching a session, the bot reads GET /api/v1/terminal/snapshot and checks is_fullscreen. True means a TUI owns the screen; skip that student until the next pass. False means a shell prompt. It pastes, presses Enter, and POST /api/v1/terminal/wait in either mode returns on the prompt regex or two seconds of quiet, with the screen it resolved on. If the wait comes back exited, the student closed the shell, and the seat is marked empty instead of retried.

The old lab script typed blind. This one looks first.

The lab bot never types over a student's editor.