fix: preserve structured attachment outputs (#17)

This commit is contained in:
Eyejoker
2026-04-25 14:41:46 +09:00
committed by GitHub
parent a74ea4bad0
commit d52556fd28
5 changed files with 168 additions and 4 deletions

View File

@@ -666,7 +666,10 @@ export class MessageTurnController {
await this.flushPendingProgress(options.flushPendingText);
}
const replaceMessageId = this.consumeProgressForFinalDelivery();
const hasAttachments = (options?.attachments?.length ?? 0) > 0;
const replaceMessageId = hasAttachments
? this.discardProgressForAttachmentFinalDelivery()
: this.consumeProgressForFinalDelivery();
await this.deliverFinalText(text, {
...(options?.attachments?.length
? { attachments: options.attachments }
@@ -690,6 +693,20 @@ export class MessageTurnController {
return replaceMessageId;
}
private discardProgressForAttachmentFinalDelivery(): null {
this.log.info(
{
progressMessageId: this.progressMessageId,
latestProgressText: this.latestProgressText,
},
this.progressMessageId
? 'Discarding tracked progress replacement for final attachment delivery'
: 'Delivering final attachment output without a tracked progress message to replace',
);
this.resetProgressState();
return null;
}
private async deliverFinalText(
text: string,
options?: {