fix confirmation widget appearing inside reasoning (#288494)

* double check if our tool has confirmations after streaming

* fix package.json

* fix again
This commit is contained in:
Justin Chen
2026-01-17 06:06:58 +08:00
committed by GitHub
parent e394995282
commit 5ebbcae8ff
@@ -1315,6 +1315,10 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
}
if (part.kind === 'toolInvocation') {
// pin when streaming since we don't know if we have confirmation yet or not
if (IChatToolInvocation.isStreaming(part)) {
return true;
}
return !IChatToolInvocation.getConfirmationMessages(part);
}
@@ -1693,6 +1697,27 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
if (lastThinking && part?.domNode && toolInvocation.presentation !== 'hidden') {
lastThinking.appendItem(part?.domNode, toolInvocation.toolId, toolInvocation, templateData.value);
lastThinking.addDisposable(part);
// watch for streaming -> confirmation transition to finalize thinking
if (toolInvocation.kind === 'toolInvocation' && IChatToolInvocation.isStreaming(toolInvocation)) {
let wasStreaming = true;
part.addDisposable(autorun(reader => {
const state = toolInvocation.state.read(reader);
if (wasStreaming && state.type !== IChatToolInvocation.StateKind.Streaming) {
wasStreaming = false;
if (state.type === IChatToolInvocation.StateKind.WaitingForConfirmation) {
if (part.domNode) {
const wrapper = part.domNode.parentElement;
if (wrapper?.classList.contains('chat-thinking-tool-wrapper')) {
wrapper.remove();
}
templateData.value.appendChild(part.domNode);
}
this.finalizeCurrentThinkingPart(context, templateData);
}
}
}));
}
}
} else {
this.finalizeCurrentThinkingPart(context, templateData);