fix: resolve post-merge compilation errors

- Add TOOL_CHOICE_OVERRIDE task_local to agent/loop_.rs (used by anthropic provider)
- Gate create_board_info_tools behind hardware feature in peripherals/mod.rs
- Add missing tool_choice field to NativeChatRequest test in anthropic.rs
This commit is contained in:
ehushubhamshaw 2026-03-14 17:07:59 -04:00
parent 0aade407fa
commit 87ec6022fa
3 changed files with 11 additions and 0 deletions

View File

@ -336,6 +336,10 @@ tokio::task_local! {
static TOOL_LOOP_CANARY_TOKENS_ENABLED: bool;
}
tokio::task_local! {
pub(crate) static TOOL_CHOICE_OVERRIDE: Option<String>;
}
const AUTO_CRON_DELIVERY_CHANNELS: &[&str] = &[
"telegram",
"discord",

View File

@ -236,6 +236,7 @@ pub async fn create_peripheral_tools(_config: &PeripheralsConfig) -> Result<Vec<
/// Create probe-rs / static board info tools (hardware_board_info, hardware_memory_map,
/// hardware_memory_read). These use USB/probe-rs or static datasheet data — they never
/// open a serial port, so they are safe to register regardless of the `hardware` feature.
#[cfg(feature = "hardware")]
pub fn create_board_info_tools(config: &PeripheralsConfig) -> Vec<Box<dyn Tool>> {
if !config.enabled || config.boards.is_empty() {
return Vec::new();
@ -248,6 +249,11 @@ pub fn create_board_info_tools(config: &PeripheralsConfig) -> Vec<Box<dyn Tool>>
]
}
#[cfg(not(feature = "hardware"))]
pub fn create_board_info_tools(_config: &PeripheralsConfig) -> Vec<Box<dyn Tool>> {
Vec::new()
}
#[cfg(test)]
mod tests {
use super::*;

View File

@ -1239,6 +1239,7 @@ mod tests {
}],
temperature: 0.7,
tools: None,
tool_choice: None,
};
let json = serde_json::to_string(&req).unwrap();