The Work Capacity of Channels with Memory: Maximum Extractable Work in Percept-Action Loops