#!/bin/bash
# Clear the ouija block_interactive flag when the user types directly.
# This means the user is at the terminal, so interactive prompts are safe.

cat > /dev/null

PANE="${TMUX_PANE:-}"
[ -z "$PANE" ] && exit 0

PORT="${OUIJA_PORT:-7880}"
PANE_NUM="${PANE#%}"

# Tell the daemon to clear the block_interactive flag for this pane
curl -sf -X DELETE "http://localhost:${PORT}/api/pane/${PANE_NUM}/block-interactive" >/dev/null 2>&1
exit 0
