This commit is contained in:
2026-04-13 23:00:05 -04:00
parent d156883a9f
commit f80c943dc3

View File

@@ -734,7 +734,7 @@ export class AgentHarness {
* Yields typed HarnessEvents (chunk, tool_call, image, done) and saves the
* conversation to the store once the done event has been emitted.
*/
async *streamMessage(message: InboundMessage): AsyncGenerator<HarnessEvent> {
async *streamMessage(message: InboundMessage, options?: { saveUserMessage?: boolean }): AsyncGenerator<HarnessEvent> {
this.config.logger.info(
{ messageId: message.messageId, userId: message.userId, content: message.content.substring(0, 100) },
'Processing user message'
@@ -889,9 +889,11 @@ export class AgentHarness {
blobRefs = blobIds.map((id, i) => ({ id, mimeType: collectedImages[i].mimeType, caption: collectedImages[i].caption }));
}
await this.conversationStore.saveMessage(
this.config.userId, this.config.sessionId, 'user', message.content, undefined, channelKey
);
if (options?.saveUserMessage !== false) {
await this.conversationStore.saveMessage(
this.config.userId, this.config.sessionId, 'user', message.content, undefined, channelKey
);
}
await this.conversationStore.saveMessage(
this.config.userId, this.config.sessionId, 'assistant', finalContent,
blobRefs.length > 0 ? { blobs: blobRefs } : undefined,
@@ -914,7 +916,7 @@ export class AgentHarness {
content,
timestamp: new Date(),
};
yield* this.streamMessage(greetingMessage);
yield* this.streamMessage(greetingMessage, { saveUserMessage: false });
}
/**