Generated the JSON contracts of the stored data at compile time (#1148)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-11-02 18:23:19 +01:00
1 parent fc7399e81b
commit e954881fda
75 files changed
+5437 -298

No files matched your search

+8 -8
View File
@@ -23,7 +23,7 @@ public sealed record ChatThread
/// <summary>
/// The unique identifier of the chat thread.
/// </summary>
public Guid ChatId { get; init; }
public Guid ChatId { get; set; }
/// <summary>
/// The unique identifier of the workspace.
@@ -42,16 +42,16 @@ public sealed record ChatThread
/// Every copy of this thread made with a with expression shares the draft, because such a copy is
/// still the same chat. A copy which becomes another chat needs a draft of its own.
/// </remarks>
public ChatDraft Draft { get; init; } = new();
public ChatDraft Draft { get; set; } = new();
// Compatibility shim: until v26.9.1, a chat stored only the transcripts of its draft, in a list of their own. See documentation/compatibility-shims/2026-10-chat-pending-media-transcripts.md; remove after 2027-04-11.
[JsonInclude]
[JsonPropertyName("pending_media_transcripts")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
private List<ManagedTranscriptAttachment>? LegacyPendingMediaTranscripts
internal List<ManagedTranscriptAttachment>? LegacyPendingMediaTranscripts
{
get => null;
init
set
{
if (value is not null)
this.Draft.AddAttachments(value);
@@ -127,7 +127,7 @@ public sealed record ChatThread
/// continues it must meet the level.
/// </summary>
[JsonInclude]
public ConfidenceLevel RequiredProviderConfidence { get; private set; } = ConfidenceLevel.NONE;
public ConfidenceLevel RequiredProviderConfidence { get; internal set; } = ConfidenceLevel.NONE;
public void RequireProviderConfidence(ConfidenceLevel minimumProviderConfidence)
{
@@ -164,7 +164,7 @@ public sealed record ChatThread
/// internal content demands nothing.
/// </remarks>
[JsonInclude]
public OutboundDataRequirement RequiredOutboundDataRestriction { get; private set; } = OutboundDataRequirement.NONE;
public OutboundDataRequirement RequiredOutboundDataRestriction { get; internal set; } = OutboundDataRequirement.NONE;
/// <summary>
/// Tightens where this chat may still send data to what the data brought in demands, and
@@ -229,7 +229,7 @@ public sealed record ChatThread
/// immutable, so that a copy of the thread never shares a set which grows later.
/// </remarks>
[JsonInclude]
public ImmutableHashSet<string> WebAddressesWrittenByModels { get; private set; } = [];
public ImmutableHashSet<string> WebAddressesWrittenByModels { get; internal set; } = [];
/// <summary>
/// The name of the chat thread. Usually generated by an AI model or manually edited by the user.
@@ -244,7 +244,7 @@ public sealed record ChatThread
/// <summary>
/// The content blocks of the chat thread.
/// </summary>
public List<ContentBlock> Blocks { get; init; } = [];
public List<ContentBlock> Blocks { get; set; } = [];
/// <summary>
/// The component running this thread, which decides the tools it may use and what its requests name.