Skip to content

Commit b361085

Browse files
committed
Implementation
1 parent 78e3f2e commit b361085

File tree

4 files changed

+43
-0
lines changed

4 files changed

+43
-0
lines changed

lib/src/core/room.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,6 +1329,19 @@ extension DataStreamRoomMethods on Room {
13291329
topic: streamHeader.topic,
13301330
timestamp: streamHeader.timestamp.toInt(),
13311331
attributes: streamHeader.attributes,
1332+
replyToStreamId: streamHeader.textHeader.hasReplyToStreamId()
1333+
? streamHeader.textHeader.replyToStreamId
1334+
: null,
1335+
attachedStreamIds: streamHeader.textHeader.attachedStreamIds.toList(),
1336+
version: streamHeader.textHeader.hasVersion()
1337+
? streamHeader.textHeader.version
1338+
: null,
1339+
generated: streamHeader.textHeader.hasGenerated()
1340+
? streamHeader.textHeader.generated
1341+
: false,
1342+
operationType: streamHeader.textHeader.hasOperationType()
1343+
? streamHeader.textHeader.operationType.name
1344+
: null,
13321345
);
13331346

13341347
final streamController = DataStreamController<lk_models.DataStream_Chunk>(

lib/src/participant/local.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,6 +1239,11 @@ extension DataStreamParticipantMethods on LocalParticipant {
12391239
timestamp: DateTime.timestamp().millisecondsSinceEpoch,
12401240
topic: options?.topic ?? '',
12411241
size: options?.totalSize ?? 0,
1242+
replyToStreamId: options?.replyToStreamId,
1243+
attachedStreamIds: options?.attachedStreamIds ?? [],
1244+
version: options?.version,
1245+
generated: options?.generated ?? false,
1246+
operationType: options?.type,
12421247
);
12431248

12441249
final header = lk_models.DataStream_Header(

lib/src/types/data_stream.dart

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,33 @@ class ByteStreamInfo extends BaseStreamInfo {
166166
}
167167

168168
class TextStreamInfo extends BaseStreamInfo {
169+
/// The stream ID this message is replying to, if any
170+
final String? replyToStreamId;
171+
172+
/// List of stream IDs that are attached to this stream
173+
final List<String> attachedStreamIds;
174+
175+
/// Version of the stream
176+
final int? version;
177+
178+
/// Whether this text was generated by an agent
179+
final bool generated;
180+
181+
/// Operation type for the stream
182+
final String? operationType;
183+
169184
TextStreamInfo({
170185
required String id,
171186
required String mimeType,
172187
required String topic,
173188
required int timestamp,
174189
required int size,
175190
Map<String, String> attributes = const {},
191+
this.replyToStreamId,
192+
this.attachedStreamIds = const [],
193+
this.version,
194+
this.generated = false,
195+
this.operationType,
176196
}) : super(
177197
id: id,
178198
mimeType: mimeType,

test/core/data_stream_test.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,11 @@ void main() {
219219
final text = await reader.readAll();
220220
print('received reply message: ${text}');
221221
expect(text, 'This is a reply to the original message');
222+
223+
// Verify that reply metadata is accessible
224+
expect(reader.info?.replyToStreamId, originalStreamId);
225+
expect(reader.info?.version, 1);
226+
expect(reader.info?.operationType, 'CREATE');
222227
});
223228

224229
// Send a reply to an existing stream

0 commit comments

Comments
 (0)