feat: make pctx/Code Mode an optional dependency via 'code-mode' feature (#7567)

This commit is contained in:
jh-block
2026-02-27 16:51:13 +01:00
committed by GitHub
parent e37ac4a517
commit 69ad519373
6 changed files with 21 additions and 7 deletions
@@ -1,5 +1,6 @@
pub mod apps;
pub mod chatrecall;
#[cfg(feature = "code-mode")]
pub mod code_execution;
pub mod developer;
pub mod ext_manager;
@@ -88,6 +89,7 @@ pub static PLATFORM_EXTENSIONS: Lazy<HashMap<&'static str, PlatformExtensionDef>
},
);
#[cfg(feature = "code-mode")]
map.insert(
code_execution::EXTENSION_NAME,
PlatformExtensionDef {
+4
View File
@@ -8,6 +8,7 @@ use serde_json::{json, Value};
use tracing::debug;
use super::super::agents::Agent;
#[cfg(feature = "code-mode")]
use crate::agents::platform_extensions::code_execution;
use crate::conversation::message::{Message, MessageContent, ToolRequest};
use crate::conversation::Conversation;
@@ -146,10 +147,13 @@ impl Agent {
tools.push(frontend_tool.tool.clone());
}
#[cfg(feature = "code-mode")]
let code_execution_active = self
.extension_manager
.is_extension_enabled(code_execution::EXTENSION_NAME)
.await;
#[cfg(not(feature = "code-mode"))]
let code_execution_active = false;
if code_execution_active {
tools.retain(|tool| {
if let Some(owner) = crate::agents::extension_manager::get_tool_owner(tool) {