Skip to content

Commit 1fcba4c

Browse files
authored
feat(tarko-agent): add messageId to thinking events for proper session correlation (#1282)
1 parent 7bcff07 commit 1fcba4c

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

multimodal/tarko/agent-interface/src/agent-event-stream.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,12 @@ export namespace AgentEventStream {
154154

155155
/** Whether the thinking process is complete */
156156
isComplete?: boolean;
157+
158+
/**
159+
* Unique message identifier that links thinking messages to their session
160+
* This allows clients to correlate incremental updates with complete thinking
161+
*/
162+
messageId?: string;
157163
}
158164

159165
/**
@@ -186,6 +192,12 @@ export namespace AgentEventStream {
186192

187193
/** Whether this is the final reasoning chunk */
188194
isComplete?: boolean;
195+
196+
/**
197+
* Unique message identifier that links streaming thinking messages to their final thinking
198+
* This allows clients to correlate incremental updates with complete thinking
199+
*/
200+
messageId?: string;
189201
}
190202

191203
/**

multimodal/tarko/agent/src/agent/runner/llm-processor.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ export class LLMProcessor {
337337
{
338338
content: chunkResult.reasoningContent,
339339
isComplete: Boolean(processingState.finishReason),
340+
messageId: messageId,
340341
},
341342
);
342343
this.eventStream.sendEvent(thinkingEvent);
@@ -482,6 +483,7 @@ export class LLMProcessor {
482483
const thinkingEvent = this.eventStream.createEvent('assistant_thinking_message', {
483484
content: reasoningBuffer,
484485
isComplete: true,
486+
messageId: messageId,
485487
});
486488

487489
this.eventStream.sendEvent(thinkingEvent);

0 commit comments

Comments
 (0)