Support profiles in agent2 (#36034)

We still need a profile selector.

Release Notes:

- N/A

---------

Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
This commit is contained in:
Antonio Scandurra 2025-08-12 14:17:48 +02:00 committed by GitHub
parent 13bf45dd4a
commit 2444321756
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 587 additions and 108 deletions

View file

@ -101,7 +101,7 @@ impl AgentTool for GrepTool {
fn run(
self: Arc<Self>,
input: Self::Input,
event_stream: ToolCallEventStream,
_event_stream: ToolCallEventStream,
cx: &mut App,
) -> Task<Result<Self::Output>> {
const CONTEXT_LINES: u32 = 2;
@ -282,33 +282,22 @@ impl AgentTool for GrepTool {
}
}
event_stream.update_fields(acp::ToolCallUpdateFields {
content: Some(vec![output.clone().into()]),
..Default::default()
});
matches_found += 1;
}
}
let output = if matches_found == 0 {
"No matches found".to_string()
if matches_found == 0 {
Ok("No matches found".into())
} else if has_more_matches {
format!(
Ok(format!(
"Showing matches {}-{} (there were more matches found; use offset: {} to see next page):\n{output}",
input.offset + 1,
input.offset + matches_found,
input.offset + RESULTS_PER_PAGE,
)
))
} else {
format!("Found {matches_found} matches:\n{output}")
};
event_stream.update_fields(acp::ToolCallUpdateFields {
content: Some(vec![output.clone().into()]),
..Default::default()
});
Ok(output)
Ok(format!("Found {matches_found} matches:\n{output}"))
}
})
}
}