There's nothing in the books (pretty much everything in Season 7 is beyond any books currently written).
There's not much in the actual script, either: for shock value, it cuts straight from the Casterly Rock montage to Jaime's army approaching, Jaime walking past Lannister troops piling corpses inside Highgarden, then Jaime and Olenna talking. The closest to a mention in dialogue is this:
Olenna: And now the rains weep o'er our halls. Did we fight well?
Jaime: Uh, as well as could be expected.
Olenna: It was never our forte. Golden roses, indeed. Your brother and his new queen thought you would be defending Casterly Rock.
It implies there was some sort of short regular battle, but is unclear about where or how. Whatever happened, the Tyrell garrison doesn't seem to have used their defensive advantage (maybe foreshadowing other season 7/8 howlers, like the infamous cavalry charge into the dark). The disparaging comments about Tyrell fighting ability (like "it was never our forte") are also surprising, given how they've been hyped as one of the most powerful factions for the entire show, with Loras was famed as one of the greatest swordsmen. Maybe it could be read as implying their strength was largely on paper: resources, showing off in tournaments etc, rather than being actually effective in real battles ("golden roses"), multiplied by typical Olenna cynicism. It's left unclear 🤷.
So why not at least attempt a siege defense? It's not addressed directly but there's some implication:
- Militarily, they appear to have been taken by surprise and to be fair, it's been discussed a lot in the show how defending a siege requires a lot of preparation, such as stockpiling provisions (though there should have been decent stockpiles anyway, due to winter and war).
- But how did the Lannister army appear as if by magic without being spotted by any scouts? 🤷 I guess they borrowed Euron's teleporter and invisibility machine.
- Olenna was tired of fighting and didn't want her people to suffer, and to be fair, it's been shown a lot in the show how painful defending a siege is (remember the diseased Iron Islanders, the wavering Tullys, and Stannis eating rats, cats and dogs, even though he did like dogs, good animals, loyal). The Tyrells also have history of taking the easy option (even before Olenna lost her entire family and most motivation beyond spite): during Robert's rebellion they'd been happy to spend the whole war camped outside Storm's End, then switched sides at the last minute (maybe this is what the writers had in mind with the "golden roses" comments)
- But, as you say, it didn't need to be a long siege, so couldn't they just sit it out for long enough for a dragon to turn up? 🤷 I guess the dragons' randomised power levels were low that week.
Then there's the question of, if she lacked the will to fight and just wanted to just get it over with, why fight whatever this doomed battle was at all? Why not negotiate, leading more naturally to this exact same scene with Jaime? It would seem in character, both for Olenna and the historically fickle Tyrells. 🤷.
It's not the worst of Season 7 and 8's sloppy inconsistencies, but it probably would deserve a mention if someone attempted to list them all.
In conclusion, 🤷.
They could probably have justified this outcome with a short scene in which Olenna argues with one of her generals, before doing a managed surrender (rather than an illogical and doomed pitched battle). Something like this:
General: A huge Lannister army has been seen heading this way! Led by Jaime himself. They will be here in three days.
Olenna: Abandoning Casterly Rock? ...damnation. Who let that oaf grow a brain?
General: In the time we have, we can prepare a siege defense that can last six weeks, maybe eight. That should be enough time. We can send ravens today, and if Daenerys sends a dragon, the siege camps should be defenseless. Even our small remaining garrisons could then rout the survivors.
Olenna: He's a silly boy but he's his father's son and he won't sit pretty in a camp. They'll maraud the land, massacre villagers, burn fields, just like they did in the Riverlands. I won't see my people suffer like that. We've all suffered enough.
General: Then what should we do?
Olenna: Tell him we'll open the gates, on one condition: I speak with him here, in this room, alone.
But they didn't. 🤷.