apply: move 'struct apply_state' to apply.h