apply method
Returns target with this patch applied.
The target is never mutated.
Implementation
@override
AgentSessionDocument apply(covariant AgentSessionDocument target) {
if (isEmpty) return target;
return target.copyWith(
id: this.id.isUnchanged ? target.id : this.id.valueOrNull,
status: this.status.isUnchanged ? target.status : this.status.valueOrNull,
messages: this.messages.isUnchanged
? target.messages
: this.messages.valueOrNull,
toolCalls: this.toolCalls.isUnchanged
? target.toolCalls
: this.toolCalls.valueOrNull,
activeTool: this.activeTool.isUnchanged
? target.activeTool
: this.activeTool.valueOrNull,
turns: this.turns.isUnchanged ? target.turns : this.turns.valueOrNull,
);
}