invert method
Returns the patch that undoes this one for a value that was before.
Implementations capture whatever prior state they need from before, so
the round-trip invert(x).apply(p.apply(x)) == x holds.
Implementation
@override
AgentSessionDocumentPatch invert(AgentSessionDocument before) {
return AgentSessionDocumentPatch(
id: this.id.isUnchanged
? const PatchValue.unchanged()
: PatchValue.set(before.id),
status: this.status.isUnchanged
? const PatchValue.unchanged()
: PatchValue.set(before.status),
messages: this.messages.isUnchanged
? const PatchValue.unchanged()
: PatchValue.set(before.messages),
toolCalls: this.toolCalls.isUnchanged
? const PatchValue.unchanged()
: PatchValue.set(before.toolCalls),
activeTool: this.activeTool.isUnchanged
? const PatchValue.unchanged()
: PatchValue.set(before.activeTool),
turns: this.turns.isUnchanged
? const PatchValue.unchanged()
: PatchValue.set(before.turns),
);
}