Fix execute in Terminal with iTerm Nightly

iTerm Nightly has a new scripting bridge which breaks the execute in Terminal feature in DTerm. This PR fixes those issues by supporting both, the new and the old scripting bridge.