Terminate AI packages when target is disabled or deleted (Fixes #1910)