Table of Contents

Method Compose

Namespace
MailFathom.Application.Agent.Conversations
Assembly
MailFathom.Application.dll

Compose(AgentConversationId, string?, DateTimeOffset, IReadOnlyList<AgentConversationEntry>)

Reads a conversation out of the entries it was written as.

public static AgentConversation Compose(AgentConversationId id, string? title, DateTimeOffset startedAt, IReadOnlyList<AgentConversationEntry> entries)

Parameters

id AgentConversationId

The conversation the entries belong to.

title string

What the conversation is called, or null while nothing has named it.

startedAt DateTimeOffset

When the conversation was started, in UTC.

entries IReadOnlyList<AgentConversationEntry>

The entries, from the conversation's beginning, in the order they were written.

Returns

AgentConversation

What the entries say when they are read together.

Remarks

It takes the conversation from its beginning, which a bounded read of one also gives: a turn is opened before anything is written into it and an offer is made before it is answered, so any leading part of the order is a conversation this can read.

What it refuses is an entry naming a turn or an offer that nothing earlier in the same entries opened — which is what a part taken from the middle of a conversation usually looks like, and is the whole of the guarantee. A part that happens to begin exactly where a turn does carries no such entry, so it composes as a conversation of its own with everything before it absent, and nothing here can tell that from a conversation that short. Reading from the beginning is therefore the caller's to arrange rather than this method's to verify; what a client watching an answer being composed reads is the entries themselves, which is the next paragraph.

It is the reading the composition uses, where what a turn said matters more than the order the parts of it arrived in. A client watching an answer being composed reads the entries themselves, because what it is drawing is exactly their arrival.

It is a reading of the visible history: an entry of the technical history alone — a tool call, a tool's answer, a charge, a summary — is passed over wherever it stands, so the same entries read the same way whether or not the record they came from held them.

Exceptions

ArgumentNullException

Thrown when entries is null.

ArgumentException

Thrown when an entry writes into a turn the entries before it never opened, answers an offer they never made, opens a turn they had already opened, or is of a kind this reading does not know.