agent: Review edits in single-file editors (#29820)

Enables reviewing agent edits from single-file editors in addition to
the multibuffer experience we already had.


https://github.com/user-attachments/assets/a2c287f0-51d6-43a1-8537-821498b91983


This feature can be turned off by setting `assistant.single_file_review:
false`.

Release Notes:

- agent: Review edits in single-file editors
This commit is contained in:
Agus Zubiaga 2025-05-02 17:57:16 -03:00 committed by GitHub
parent 04772bf17d
commit 64316309aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 1396 additions and 254 deletions

View file

@ -1338,13 +1338,14 @@ impl Thread {
let mut stop_reason = StopReason::EndTurn;
let mut current_token_usage = TokenUsage::default();
if let Some(usage) = usage {
thread
.update(cx, |_thread, cx| {
thread
.update(cx, |_thread, cx| {
if let Some(usage) = usage {
cx.emit(ThreadEvent::UsageUpdated(usage));
})
.ok();
}
}
cx.emit(ThreadEvent::NewRequest);
})
.ok();
let mut request_assistant_message_id = None;
@ -1990,6 +1991,11 @@ impl Thread {
}
self.finalize_pending_checkpoint(cx);
if canceled {
cx.emit(ThreadEvent::CompletionCanceled);
}
canceled
}
@ -2491,6 +2497,7 @@ pub enum ThreadEvent {
UsageUpdated(RequestUsage),
StreamedCompletion,
ReceivedTextChunk,
NewRequest,
StreamedAssistantText(MessageId, String),
StreamedAssistantThinking(MessageId, String),
StreamedToolUse {
@ -2521,6 +2528,7 @@ pub enum ThreadEvent {
CheckpointChanged,
ToolConfirmationNeeded,
CancelEditing,
CompletionCanceled,
}
impl EventEmitter<ThreadEvent> for Thread {}