We should support the JS API for replacement so that the engine can be used to modify streams on the fly.