Are you sure that the black cable goes to the subpanel?
With Romex style wire, you have to follow the 60°C conductor wire ampacity rating.
So, even if the wires are #6, they're limited to 55 amps. If they're #6, you should have a 50 amp breaker and limit the load to 40 amps.
If they're #8 wires, you can use a 40 amp breaker and load at 32 amps.
You definitely should not add a heat pump to that subpanel.
With Romex style wire, you have to follow the 60°C conductor wire ampacity rating.
So, even if the wires are #6, they're limited to 55 amps. If they're #6, you should have a 50 amp breaker and limit the load to 40 amps.
If they're #8 wires, you can use a 40 amp breaker and load at 32 amps.
You definitely should not add a heat pump to that subpanel.