agent2: Port read_file tool (#35840)

Ports the read_file tool from `assistant_tools` to `agent2`. 

Note: Image support not implemented.

Release Notes:

- N/A
This commit is contained in:
Agus Zubiaga 2025-08-07 20:46:47 -03:00 committed by GitHub
parent 7d4d8b8398
commit 3d662ee282
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 1011 additions and 4 deletions

View file

@ -1,5 +1,5 @@
use crate::{templates::Templates, AgentResponseEvent, Thread};
use crate::{FindPathTool, ThinkingTool, ToolCallAuthorization};
use crate::{FindPathTool, ReadFileTool, ThinkingTool, ToolCallAuthorization};
use acp_thread::ModelSelector;
use agent_client_protocol as acp;
use anyhow::{anyhow, Context as _, Result};
@ -413,9 +413,10 @@ impl acp_thread::AgentConnection for NativeAgentConnection {
})?;
let thread = cx.new(|_| {
let mut thread = Thread::new(project.clone(), agent.project_context.clone(), action_log, agent.templates.clone(), default_model);
let mut thread = Thread::new(project.clone(), agent.project_context.clone(), action_log.clone(), agent.templates.clone(), default_model);
thread.add_tool(ThinkingTool);
thread.add_tool(FindPathTool::new(project.clone()));
thread.add_tool(ReadFileTool::new(project.clone(), action_log));
thread
});