# Codex runs its sessions in a shared background server unless it starts with
# --no-daemon, and then its hooks can't tell which tab a session is in. In a
# tab that kaeru tracks, this starts Codex's interactive screen with
# --no-daemon, so that the session runs in the tab. Other Codex commands run
# as they are. kaeru adds this when its codex-no-daemon option is on.
if [ -n "${__kaeru_cwd_file:-}" ]; then
    codex() {
        local argument
        for argument in "$@"; do
            case $argument in
            --no-daemon | --remote* | KAERU_ONE_OFF_COMMANDS)
                command codex "$@"
                return
                ;;
            esac
        done
        command codex --no-daemon "$@"
    }
fi
