Apply a unified diff to original text, returning modified content.
Pure implementation — no subprocess, no patch binary required.
Only handles patches produced by generate_patch() (unified diff format).
Returns an error if the patch does not apply cleanly.
Generate a unified diff of original → modified. Empty string if identical.
All output lines are guaranteed to end with ‘\n’.
Format: --- a/{label} / +++ b/{label}, 3 lines of context.