feat: make pctx/Code Mode an optional dependency via 'code-mode' feature (#7567)
This commit is contained in:
@@ -15,11 +15,15 @@ path = "src/bin/server.rs"
|
|||||||
name = "generate-acp-schema"
|
name = "generate-acp-schema"
|
||||||
path = "src/bin/generate_acp_schema.rs"
|
path = "src/bin/generate_acp_schema.rs"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["code-mode"]
|
||||||
|
code-mode = ["goose/code-mode"]
|
||||||
|
|
||||||
[lints]
|
[lints]
|
||||||
workspace = true
|
workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
goose = { path = "../goose" }
|
goose = { path = "../goose", default-features = false }
|
||||||
goose-mcp = { path = "../goose-mcp" }
|
goose-mcp = { path = "../goose-mcp" }
|
||||||
rmcp = { workspace = true }
|
rmcp = { workspace = true }
|
||||||
sacp = "10.1.0"
|
sacp = "10.1.0"
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ path = "src/bin/generate_manpages.rs"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap_mangen = "0.2.31"
|
clap_mangen = "0.2.31"
|
||||||
goose = { path = "../goose" }
|
goose = { path = "../goose", default-features = false }
|
||||||
goose-acp = { path = "../goose-acp" }
|
goose-acp = { path = "../goose-acp", default-features = false }
|
||||||
goose-mcp = { path = "../goose-mcp" }
|
goose-mcp = { path = "../goose-mcp" }
|
||||||
rmcp = { workspace = true }
|
rmcp = { workspace = true }
|
||||||
clap = { workspace = true }
|
clap = { workspace = true }
|
||||||
@@ -70,6 +70,8 @@ comfy-table = "7.2.2"
|
|||||||
winapi = { version = "0.3", features = ["wincred"] }
|
winapi = { version = "0.3", features = ["wincred"] }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
default = ["code-mode"]
|
||||||
|
code-mode = ["goose/code-mode", "goose-acp/code-mode"]
|
||||||
# disables the update command
|
# disables the update command
|
||||||
disable-update = []
|
disable-update = []
|
||||||
|
|
||||||
|
|||||||
@@ -11,11 +11,12 @@ description.workspace = true
|
|||||||
workspace = true
|
workspace = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = ["code-mode"]
|
||||||
|
code-mode = ["goose/code-mode"]
|
||||||
cuda = ["goose/cuda"]
|
cuda = ["goose/cuda"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
goose = { path = "../goose" }
|
goose = { path = "../goose", default-features = false }
|
||||||
goose-mcp = { path = "../goose-mcp" }
|
goose-mcp = { path = "../goose-mcp" }
|
||||||
rmcp = { workspace = true }
|
rmcp = { workspace = true }
|
||||||
axum = { workspace = true, features = ["ws", "macros"] }
|
axum = { workspace = true, features = ["ws", "macros"] }
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ repository.workspace = true
|
|||||||
description.workspace = true
|
description.workspace = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = ["code-mode"]
|
||||||
|
code-mode = ["dep:pctx_code_mode"]
|
||||||
cuda = ["candle-core/cuda", "candle-nn/cuda", "llama-cpp-2/cuda"]
|
cuda = ["candle-core/cuda", "candle-nn/cuda", "llama-cpp-2/cuda"]
|
||||||
|
|
||||||
[lints]
|
[lints]
|
||||||
@@ -123,7 +124,7 @@ shellexpand = { workspace = true }
|
|||||||
indexmap = "2.12.0"
|
indexmap = "2.12.0"
|
||||||
ignore = { workspace = true }
|
ignore = { workspace = true }
|
||||||
which = { workspace = true }
|
which = { workspace = true }
|
||||||
pctx_code_mode = "^0.2.3"
|
pctx_code_mode = { version = "^0.2.3", optional = true }
|
||||||
unbinder = "0.1.7"
|
unbinder = "0.1.7"
|
||||||
pulldown-cmark = "0.13.0"
|
pulldown-cmark = "0.13.0"
|
||||||
llama-cpp-2 = { git = "https://github.com/jh-block/llama-cpp-rs.git", branch = "goose-patches", features = ["sampler"] }
|
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 apps;
|
||||||
pub mod chatrecall;
|
pub mod chatrecall;
|
||||||
|
#[cfg(feature = "code-mode")]
|
||||||
pub mod code_execution;
|
pub mod code_execution;
|
||||||
pub mod developer;
|
pub mod developer;
|
||||||
pub mod ext_manager;
|
pub mod ext_manager;
|
||||||
@@ -88,6 +89,7 @@ pub static PLATFORM_EXTENSIONS: Lazy<HashMap<&'static str, PlatformExtensionDef>
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#[cfg(feature = "code-mode")]
|
||||||
map.insert(
|
map.insert(
|
||||||
code_execution::EXTENSION_NAME,
|
code_execution::EXTENSION_NAME,
|
||||||
PlatformExtensionDef {
|
PlatformExtensionDef {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ use serde_json::{json, Value};
|
|||||||
use tracing::debug;
|
use tracing::debug;
|
||||||
|
|
||||||
use super::super::agents::Agent;
|
use super::super::agents::Agent;
|
||||||
|
#[cfg(feature = "code-mode")]
|
||||||
use crate::agents::platform_extensions::code_execution;
|
use crate::agents::platform_extensions::code_execution;
|
||||||
use crate::conversation::message::{Message, MessageContent, ToolRequest};
|
use crate::conversation::message::{Message, MessageContent, ToolRequest};
|
||||||
use crate::conversation::Conversation;
|
use crate::conversation::Conversation;
|
||||||
@@ -146,10 +147,13 @@ impl Agent {
|
|||||||
tools.push(frontend_tool.tool.clone());
|
tools.push(frontend_tool.tool.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "code-mode")]
|
||||||
let code_execution_active = self
|
let code_execution_active = self
|
||||||
.extension_manager
|
.extension_manager
|
||||||
.is_extension_enabled(code_execution::EXTENSION_NAME)
|
.is_extension_enabled(code_execution::EXTENSION_NAME)
|
||||||
.await;
|
.await;
|
||||||
|
#[cfg(not(feature = "code-mode"))]
|
||||||
|
let code_execution_active = false;
|
||||||
if code_execution_active {
|
if code_execution_active {
|
||||||
tools.retain(|tool| {
|
tools.retain(|tool| {
|
||||||
if let Some(owner) = crate::agents::extension_manager::get_tool_owner(tool) {
|
if let Some(owner) = crate::agents::extension_manager::get_tool_owner(tool) {
|
||||||
|
|||||||
Reference in New Issue
Block a user