rework Gate to be a more generic State primitive; preserve piping kung-fu with State