-
Notifications
You must be signed in to change notification settings - Fork 27
/
IMessageStream.cs
56 lines (46 loc) · 1.54 KB
/
IMessageStream.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright (c) Microsoft. All rights reserved.
namespace Microsoft.TypeChat.Dialog;
/// <summary>
/// An append stream of messages between Agents
/// </summary>
public interface IMessageStream : IContextProvider
{
/// <summary>
/// Append a message to the stream
/// </summary>
/// <param name="message">message to append</param>
void Append(Message message);
/// <summary>
/// Append a message to the stream
/// </summary>
/// <param name="message">message to append</param>
Task AppendAsync(Message message);
/// <summary>
/// Return all messages in the stream
/// </summary>
/// <returns>an enumeration of messages</returns>
IEnumerable<Message> All();
/// <summary>
/// Return all messages in the stream
/// </summary>
/// <returns>An async enumeration of messages</returns>
IAsyncEnumerable<Message> AllAsync(CancellationToken cancelToken);
/// <summary>
/// Return the newest messages in the stream in order - most recent messages first
/// </summary>
/// <returns>an enumeration of messages</returns>
IEnumerable<Message> Newest();
/// <summary>
/// Return the newest messages in the stream in order - most recent messages first
/// </summary>
/// <returns>An async enumeration of messages</returns>
IAsyncEnumerable<Message> NewestAsync(CancellationToken cancelToken);
/// <summary>
/// Clear the stream
/// </summary>
void Clear();
/// <summary>
/// Close the stream
/// </summary>
void Close();
}