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
+5 -1
View File
@@ -15,11 +15,15 @@ path = "src/bin/server.rs"
name = "generate-acp-schema"
path = "src/bin/generate_acp_schema.rs"
[features]
default = ["code-mode"]
code-mode = ["goose/code-mode"]
[lints]
workspace = true
[dependencies]
goose = { path = "../goose" }
goose = { path = "../goose", default-features = false }
goose-mcp = { path = "../goose-mcp" }
rmcp = { workspace = true }
sacp = "10.1.0"
+4 -2
View File
@@ -20,8 +20,8 @@ path = "src/bin/generate_manpages.rs"
[dependencies]
clap_mangen = "0.2.31"
goose = { path = "../goose" }
goose-acp = { path = "../goose-acp" }
goose = { path = "../goose", default-features = false }
goose-acp = { path = "../goose-acp", default-features = false }
goose-mcp = { path = "../goose-mcp" }
rmcp = { workspace = true }
clap = { workspace = true }
@@ -70,6 +70,8 @@ comfy-table = "7.2.2"
winapi = { version = "0.3", features = ["wincred"] }
[features]
default = ["code-mode"]
code-mode = ["goose/code-mode", "goose-acp/code-mode"]
# disables the update command
disable-update = []
+3 -2
View File
@@ -11,11 +11,12 @@ description.workspace = true
workspace = true
[features]
default = []
default = ["code-mode"]
code-mode = ["goose/code-mode"]
cuda = ["goose/cuda"]
[dependencies]
goose = { path = "../goose" }
goose = { path = "../goose", default-features = false }
goose-mcp = { path = "../goose-mcp" }
rmcp = { workspace = true }
axum = { workspace = true, features = ["ws", "macros"] }
+3 -2
View File
@@ -8,7 +8,8 @@ repository.workspace = true
description.workspace = true
[features]
default = []
default = ["code-mode"]
code-mode = ["dep:pctx_code_mode"]
cuda = ["candle-core/cuda", "candle-nn/cuda", "llama-cpp-2/cuda"]
[lints]
@@ -123,7 +124,7 @@ shellexpand = { workspace = true }
indexmap = "2.12.0"
ignore = { workspace = true }
which = { workspace = true }
pctx_code_mode = "^0.2.3"
pctx_code_mode = { version = "^0.2.3", optional = true }
unbinder = "0.1.7"
pulldown-cmark = "0.13.0"
llama-cpp-2 = { git = "https://github.com/jh-block/llama-cpp-rs.git", branch = "goose-patches", features = ["sampler"] }
@@ -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) {