[wip] Make the website agent support merge events

Work in progress.

I'm refactoring the website agent so that it can merge events.