mirror of
https://github.com/openai/codex.git
synced 2026-11-20 22:40:37 +00:00
28 lines
646 B
Rust
28 lines
646 B
Rust
use codex_extension_api::ExtensionData;
|
|
use codex_extension_api::ToolContribution;
|
|
use codex_extension_api::ToolContributor;
|
|
|
|
use crate::ctx::read_surface_enabled;
|
|
use crate::tools::MemoriesTools;
|
|
|
|
#[derive(Debug)]
|
|
pub(crate) struct ToolsContributor {
|
|
tools: MemoriesTools,
|
|
}
|
|
|
|
impl ToolsContributor {
|
|
pub(crate) fn new(tools: MemoriesTools) -> Self {
|
|
Self { tools }
|
|
}
|
|
}
|
|
|
|
impl ToolContributor for ToolsContributor {
|
|
fn tools(&self, thread_store: &ExtensionData) -> Vec<ToolContribution> {
|
|
if !read_surface_enabled(thread_store) {
|
|
return Vec::new();
|
|
}
|
|
|
|
self.tools.contributions()
|
|
}
|
|
}
|