memory: gate staging tools by profile
This commit is contained in:
@@ -646,7 +646,7 @@ where
|
||||
base_url,
|
||||
} = workspace_client
|
||||
{
|
||||
let definitions = if spawner_name == "memory-consolidation" {
|
||||
let definitions = if feature_config.memory.staging {
|
||||
crate::feature::builtin::memory::workspace_http_memory_consolidation_tools(
|
||||
workspace_id,
|
||||
base_url,
|
||||
|
||||
@@ -418,3 +418,44 @@ fn query_schema() -> serde_json::Value {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use llm_engine::tool::ToolDefinition;
|
||||
|
||||
fn tool_names(definitions: Vec<ToolDefinition>) -> Vec<String> {
|
||||
let mut names = definitions
|
||||
.into_iter()
|
||||
.map(|tool| tool().0.name)
|
||||
.collect::<Vec<_>>();
|
||||
names.sort();
|
||||
names
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn normal_workspace_memory_tools_do_not_include_staging_tools() {
|
||||
let names = tool_names(workspace_http_memory_tools(
|
||||
"workspace".to_string(),
|
||||
"http://backend".to_string(),
|
||||
));
|
||||
|
||||
assert!(names.contains(&"MemoryQuery".to_string()));
|
||||
assert!(!names.contains(&"MemoryStagingList".to_string()));
|
||||
assert!(!names.contains(&"MemoryStagingRead".to_string()));
|
||||
assert!(!names.contains(&"MemoryStagingClose".to_string()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn consolidation_workspace_memory_tools_include_staging_tools() {
|
||||
let names = tool_names(workspace_http_memory_consolidation_tools(
|
||||
"workspace".to_string(),
|
||||
"http://backend".to_string(),
|
||||
));
|
||||
|
||||
assert!(names.contains(&"MemoryQuery".to_string()));
|
||||
assert!(names.contains(&"MemoryStagingList".to_string()));
|
||||
assert!(names.contains(&"MemoryStagingRead".to_string()));
|
||||
assert!(names.contains(&"MemoryStagingClose".to_string()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user