fix(coding-agent): preserve shared live tools across rebuilds
This commit is contained in:
@@ -76,6 +76,8 @@ type RenderSessionContextOptions = {
|
||||
updateFooter?: boolean;
|
||||
populateHistory?: boolean;
|
||||
reuseSettledComponents?: boolean;
|
||||
/** Tool calls whose existing live component remains the sole render owner across a rebuild. */
|
||||
preservedLiveToolCallIds?: ReadonlySet<string>;
|
||||
};
|
||||
|
||||
function imageLinksForMessage(
|
||||
@@ -422,8 +424,12 @@ export class UiHelpers {
|
||||
if (content.type !== "toolCall") {
|
||||
continue;
|
||||
}
|
||||
resolveWaitingPoll(content.name);
|
||||
const afterToolSegment = timeline.afterToolCalls.get(content.id);
|
||||
if (options.preservedLiveToolCallIds?.has(content.id)) {
|
||||
appendAssistantSegment(afterToolSegment);
|
||||
continue;
|
||||
}
|
||||
resolveWaitingPoll(content.name);
|
||||
|
||||
if (content.name === "read" && readArgsCollapseIntoGroup(content.arguments)) {
|
||||
if (hasErrorStop && errorMessage) {
|
||||
@@ -538,6 +544,7 @@ export class UiHelpers {
|
||||
pendingUsageTtft = message.ttft;
|
||||
pendingUsageTimestamp = message.timestamp;
|
||||
} else if (message.role === "toolResult") {
|
||||
if (options.preservedLiveToolCallIds?.has(message.toolCallId)) continue;
|
||||
const pendingReadComponent = this.ctx.pendingTools.get(message.toolCallId);
|
||||
const isReadGroupResult =
|
||||
message.toolName === "read" &&
|
||||
|
||||
Reference in New Issue
Block a user