There a few additional things to consider.
1) A pile with different cards in them can ultimately contain them in any order. With Ambassador you could get a split pile like Encampment/Plunder in reverse order or in alternating order or something similar. In addition, for the split piles this is open information. So ultimately, when you implement an interface that allows a player to inspect any pile, you will need to come up with a way to show that this pile has for example 2 Encampments on top, followed by 3 Plunders, followed by 2 Encampments and one final Plunder.
2) For Knights and Ruins the order the cards are in is not open information. For Knights it is at least known what cards the pile started with, but for Ruins even that is not known if you play with less than 6 players.
So I think there are 2 distinct questions a player can ask the game, and they need to be answered differently, although they can share UI:
A) What is the contents of a pile (not Knights/Ruins/Black Market pile) right now (with possible answers as easy as "2 Provinces" or as complicated as I indicated in 1) above)?
B) What cards where in this pile (not Black Market pile) at the beginning of the game? This should indicate the original composition with the exception that for the Ruins pile the 5 possible Ruins should be shown, not taking into account that a given Ruin may not actually be in the game.
1) A pile with different cards in them can ultimately contain them in any order. With Ambassador you could get a split pile like Encampment/Plunder in reverse order or in alternating order or something similar. In addition, for the split piles this is open information. So ultimately, when you implement an interface that allows a player to inspect any pile, you will need to come up with a way to show that this pile has for example 2 Encampments on top, followed by 3 Plunders, followed by 2 Encampments and one final Plunder.
2) For Knights and Ruins the order the cards are in is not open information. For Knights it is at least known what cards the pile started with, but for Ruins even that is not known if you play with less than 6 players.
So I think there are 2 distinct questions a player can ask the game, and they need to be answered differently, although they can share UI:
A) What is the contents of a pile (not Knights/Ruins/Black Market pile) right now (with possible answers as easy as "2 Provinces" or as complicated as I indicated in 1) above)?
B) What cards where in this pile (not Black Market pile) at the beginning of the game? This should indicate the original composition with the exception that for the Ruins pile the 5 possible Ruins should be shown, not taking into account that a given Ruin may not actually be in the game.