Kept the inputs of assistants when you leave them (#1209)

Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
Peer HogeterpandThorsten Sommer authored and GitHub committed 2026-11-28 11:52:17 +01:00
1 parent 1fbc1f4796
commit 7e2f83b19b
83 files changed
+1924 -347

No files matched your search

@@ -13,9 +13,11 @@ public sealed record AssistantSessionSnapshotField<T> : IAssistantSessionSnapsho
/// Initializes a new typed snapshot field.
/// </summary>
/// <param name="value">The captured value.</param>
public AssistantSessionSnapshotField(T value)
/// <param name="countsAsChange">Whether another value of this field means that the assistant changed, see CountsAsChange.</param>
public AssistantSessionSnapshotField(T value, bool countsAsChange = true)
{
this.Value = value;
this.CountsAsChange = countsAsChange;
}
/// <summary>
@@ -26,6 +28,9 @@ public sealed record AssistantSessionSnapshotField<T> : IAssistantSessionSnapsho
/// <inheritdoc />
public Type ValueType => typeof(T);
/// <inheritdoc />
public bool CountsAsChange { get; }
/// <inheritdoc />
public bool TryRead<TValue>(out TValue? value)
{
@@ -56,6 +61,10 @@ public sealed record AssistantSessionSnapshotField<T> : IAssistantSessionSnapsho
if (value is null || otherValue is null)
return false;
// A value which a snapshot holds as a copy of its own, e.g., the state of an assistant plugin, compares its content itself:
if (value is IAssistantSessionValue sessionValue)
return sessionValue.HasSameValueAs(otherValue);
// Nobody can change a string or a copied value type behind our back:
if (value is string || value.GetType().IsValueType)
return value.Equals(otherValue);