repl: emit 'reset' event when context is reset

Closes #1183.