Skip to content

Commit f0a30bc

Browse files
committed
[sidecar] move properties to tool use agent
1 parent ff46e83 commit f0a30bc

File tree

8 files changed

+59
-25
lines changed

8 files changed

+59
-25
lines changed

sidecar/src/agentic/tool/session/service.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,11 +390,10 @@ impl SessionService {
390390
tool_box: Arc<ToolBox>,
391391
llm_broker: Arc<LLMBroker>,
392392
user_context: UserContext,
393-
aide_rules: Option<String>,
394393
reasoning: bool,
395394
running_in_editor: bool,
396395
mcts_log_directory: Option<String>,
397-
repo_name: Option<String>,
396+
tool_use_agent_properties: ToolUseAgentProperties,
398397
message_properties: SymbolEventMessageProperties,
399398
context_crunching_llm: Option<LLMProperties>,
400399
) -> Result<(), SymbolError> {
@@ -431,8 +430,7 @@ impl SessionService {
431430
// close to the vscode server
432431
// we should ideally get this information from the vscode-server side setting
433432
std::env::consts::OS.to_owned(),
434-
shell.to_owned(),
435-
ToolUseAgentProperties::new(running_in_editor, repo_name, aide_rules),
433+
tool_use_agent_properties,
436434
)
437435
.set_context_crunching_llm(context_crunching_llm.clone());
438436

sidecar/src/agentic/tool/session/tool_use_agent.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -337,14 +337,21 @@ pub enum ToolUseAgentOutputType {
337337
#[derive(Clone)]
338338
pub struct ToolUseAgentProperties {
339339
in_editor: bool,
340+
shell: String,
340341
repo_name: Option<String>,
341342
aide_rules: Option<String>,
342343
}
343344

344345
impl ToolUseAgentProperties {
345-
pub fn new(in_editor: bool, repo_name: Option<String>, aide_rules: Option<String>) -> Self {
346+
pub fn new(
347+
in_editor: bool,
348+
shell: String,
349+
repo_name: Option<String>,
350+
aide_rules: Option<String>,
351+
) -> Self {
346352
Self {
347353
in_editor,
354+
shell,
348355
repo_name,
349356
aide_rules,
350357
}
@@ -356,7 +363,6 @@ pub struct ToolUseAgent {
356363
llm_client: Arc<LLMBroker>,
357364
working_directory: String,
358365
operating_system: String,
359-
shell: String,
360366
properties: ToolUseAgentProperties,
361367
temperature: f32,
362368
context_crunching_llm: Option<LLMProperties>,
@@ -367,14 +373,12 @@ impl ToolUseAgent {
367373
llm_client: Arc<LLMBroker>,
368374
working_directory: String,
369375
operating_system: String,
370-
shell: String,
371376
properties: ToolUseAgentProperties,
372377
) -> Self {
373378
Self {
374379
llm_client,
375380
working_directory,
376381
operating_system,
377-
shell,
378382
properties,
379383
// we always default to 0.2 temp to start with
380384
temperature: 0.2,
@@ -732,7 +736,7 @@ You are NOT ALLOWED to install any new packages. The dev environment has already
732736
fn system_message_for_context_crunching(&self) -> String {
733737
let working_directory = self.working_directory.to_owned();
734738
let operating_system = self.operating_system.to_owned();
735-
let default_shell = self.shell.to_owned();
739+
let default_shell = self.properties.shell.to_owned();
736740
let repo_name = self
737741
.properties
738742
.repo_name
@@ -886,7 +890,7 @@ Additional guildelines and rules the user has provided which must be followed:
886890
}
887891
None => "".to_owned(),
888892
};
889-
let default_shell = self.shell.to_owned();
893+
let default_shell = self.properties.shell.to_owned();
890894
format!(
891895
r#"You are SOTA-agent, a highly skilled AI software engineer with extensive knowledge in all programming languages, frameworks, design patterns, and best practices. Your primary goal is to accomplish tasks related to software development, file manipulation, and system operations within the specified project directory.
892896

sidecar/src/agentic/tool/type.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ pub enum ToolType {
158158
RequestScreenshot,
159159
// Context crunching
160160
ContextCrunching,
161+
// Think tool
162+
ThinkTool,
161163
// dynamically configured MCP servers
162164
McpTool(String),
163165
}
@@ -264,6 +266,7 @@ impl std::fmt::Display for ToolType {
264266
ToolType::FindFiles => write!(f, "find_file"),
265267
ToolType::RequestScreenshot => write!(f, "request_screenshot"),
266268
ToolType::ContextCrunching => write!(f, "context_crunching"),
269+
ToolType::ThinkTool => write!(f, "think_tool"),
267270
ToolType::McpTool(name) => write!(f, "{}", name),
268271
}
269272
}

sidecar/src/bin/agent_bin.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use sidecar::{
1414
events::{input::SymbolEventRequestId, message_event::SymbolEventMessageProperties},
1515
identifier::LLMProperties,
1616
},
17-
tool::r#type::ToolType,
17+
tool::{r#type::ToolType, session::tool_use_agent::ToolUseAgentProperties},
1818
},
1919
application::{application::Application, config::configuration::Configuration},
2020
repo::types::RepoRef,
@@ -201,6 +201,13 @@ Your thinking should be thorough and so it's fine if it's very long."#,
201201
ToolType::FindFiles,
202202
];
203203

204+
let tool_use_agent_properties = ToolUseAgentProperties::new(
205+
false,
206+
"bash".to_owned(),
207+
Some(args.repo_name.clone()),
208+
aide_rules,
209+
);
210+
204211
// wait for the agent to finish over here while busy looping
205212
println!("agent::tool_use::start");
206213
let _ = session_service
@@ -219,11 +226,10 @@ Your thinking should be thorough and so it's fine if it's very long."#,
219226
tool_box,
220227
llm_broker,
221228
UserContext::default(),
222-
aide_rules,
223229
false,
224230
false,
225231
Some(args.log_directory.clone()),
226-
Some(args.repo_name.clone()),
232+
tool_use_agent_properties,
227233
message_properties,
228234
None, // No context crunching LLM for agent_bin
229235
)

sidecar/src/bin/agent_bin_reasoning.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use sidecar::{
1414
events::{input::SymbolEventRequestId, message_event::SymbolEventMessageProperties},
1515
identifier::LLMProperties,
1616
},
17-
tool::r#type::ToolType,
17+
tool::{r#type::ToolType, session::tool_use_agent::ToolUseAgentProperties},
1818
},
1919
application::{application::Application, config::configuration::Configuration},
2020
repo::types::RepoRef,
@@ -194,6 +194,13 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
194194
ToolType::FindFiles,
195195
];
196196

197+
let tool_use_agent_properties = ToolUseAgentProperties::new(
198+
false,
199+
"bash".to_owned(),
200+
Some(args.repo_name.to_owned()),
201+
None,
202+
);
203+
197204
// wait for the agent to finish over here while busy looping
198205
println!("agent::tool_use::start");
199206
let _ = session_service
@@ -212,11 +219,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
212219
tool_box,
213220
llm_broker,
214221
UserContext::default(),
215-
None,
216222
true, // turn on reasoning
217223
false,
218224
Some(args.log_directory.clone()),
219-
Some(args.repo_name.clone()),
225+
tool_use_agent_properties,
220226
message_properties,
221227
None, // No context crunching LLM for agent_bin_reasoning
222228
)

sidecar/src/bin/swe_bench_agent_bin.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use sidecar::{
1414
events::{input::SymbolEventRequestId, message_event::SymbolEventMessageProperties},
1515
identifier::LLMProperties,
1616
},
17-
tool::r#type::ToolType,
17+
tool::{r#type::ToolType, session::tool_use_agent::ToolUseAgentProperties},
1818
},
1919
application::{application::Application, config::configuration::Configuration},
2020
repo::types::RepoRef,
@@ -203,6 +203,13 @@ Your thinking should be thorough and so it's fine if it's very long."#,
203203
ToolType::FindFiles,
204204
];
205205

206+
let tool_use_agent_properties = ToolUseAgentProperties::new(
207+
false,
208+
"bash".to_owned(),
209+
Some(args.repo_name.to_owned()),
210+
aide_rules.clone(),
211+
);
212+
206213
// wait for the agent to finish over here while busy looping
207214
println!("agent::tool_use::start");
208215
let _ = session_service
@@ -221,11 +228,10 @@ Your thinking should be thorough and so it's fine if it's very long."#,
221228
tool_box,
222229
llm_broker,
223230
UserContext::default(),
224-
aide_rules,
225231
false,
226232
false,
227233
Some(args.log_directory.clone()),
228-
Some(args.repo_name.clone()),
234+
tool_use_agent_properties,
229235
message_properties,
230236
None, // No context crunching LLM for agent_bin
231237
)

sidecar/src/mcts/execution/inference.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,12 @@ impl InferenceEngine {
257257
search_tree.llm_client(),
258258
search_tree.root_directory(),
259259
"linux".to_owned(),
260-
"bash".to_owned(),
261-
ToolUseAgentProperties::new(true, Some(search_tree.repo_name()), None),
260+
ToolUseAgentProperties::new(
261+
true,
262+
"bash".to_owned(),
263+
Some(search_tree.repo_name()),
264+
None,
265+
),
262266
);
263267

264268
let session_messages = messages
@@ -441,8 +445,12 @@ impl InferenceEngine {
441445
search_tree.llm_client(),
442446
search_tree.root_directory(),
443447
"linux".to_owned(),
444-
"bash".to_owned(),
445-
ToolUseAgentProperties::new(true, Some(search_tree.repo_name()), None),
448+
ToolUseAgentProperties::new(
449+
true,
450+
"bash".to_owned(),
451+
Some(search_tree.repo_name()),
452+
None,
453+
),
446454
);
447455

448456
let mut session_messages = messages

sidecar/src/webserver/agentic.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ use crate::agentic::tool::errors::ToolError;
3535
use crate::agentic::tool::lsp::open_file::OpenFileResponse;
3636
use crate::agentic::tool::plan::service::PlanService;
3737
use crate::agentic::tool::session::session::AideAgentMode;
38+
use crate::agentic::tool::session::tool_use_agent::ToolUseAgentProperties;
3839
use crate::chunking::text_document::Range;
3940
use crate::repo::types::RepoRef;
4041
use crate::webserver::plan::{
@@ -1783,6 +1784,9 @@ pub async fn agent_tool_use(
17831784
vec![]
17841785
})
17851786
.collect();
1787+
1788+
let tool_use_agent_properties =
1789+
ToolUseAgentProperties::new(true, shell.to_owned(), Some(repo_name), aide_rules);
17861790
let _ = tokio::spawn({
17871791
let sender = sender.clone();
17881792
let session_id = session_id.clone();
@@ -1804,11 +1808,10 @@ pub async fn agent_tool_use(
18041808
tool_box,
18051809
llm_broker,
18061810
user_context,
1807-
aide_rules,
18081811
reasoning,
18091812
true, // we are running inside the editor over here
18101813
mcts_log_directory,
1811-
Some(repo_name),
1814+
tool_use_agent_properties,
18121815
message_properties,
18131816
None, // No context crunching LLM for web requests
18141817
)

0 commit comments

Comments
 (0)