Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,27 +103,19 @@ license.workspace = true
repository.workspace = true

[features]
default = ["compatible", "openai", "qdrant", "self-learning", "vault-age"]
full = ["a2a", "compatible", "discord", "gateway", "index", "mcp", "openai", "orchestrator", "qdrant", "router", "self-learning", "slack", "tui", "vault-age"]
default = []
full = ["a2a", "discord", "gateway", "index", "slack", "tui"]
a2a = ["dep:zeph-a2a", "zeph-a2a?/server"]
compatible = ["zeph-llm/compatible", "zeph-core/compatible"]
mcp = ["dep:zeph-mcp", "zeph-core/mcp"]
qdrant = ["zeph-skills/qdrant", "zeph-mcp?/qdrant", "zeph-core/qdrant"]
candle = ["zeph-llm/candle", "zeph-core/candle"]
metal = ["zeph-llm/metal", "zeph-core/metal"]
cuda = ["zeph-llm/cuda", "zeph-core/cuda"]
openai = ["zeph-llm/openai", "zeph-core/openai"]
orchestrator = ["zeph-llm/orchestrator", "zeph-core/orchestrator"]
router = ["zeph-llm/router", "zeph-core/router"]
self-learning = ["zeph-core/self-learning"]
tui = ["dep:zeph-tui"]
discord = ["zeph-channels/discord"]
slack = ["zeph-channels/slack"]
index = ["dep:zeph-index", "zeph-core/index"]
gateway = ["dep:zeph-gateway"]
daemon = ["zeph-core/daemon"]
scheduler = ["dep:zeph-scheduler"]
vault-age = ["zeph-core/vault-age"]
otel = ["dep:opentelemetry", "dep:opentelemetry_sdk", "dep:opentelemetry-otlp", "dep:tracing-opentelemetry"]
mock = ["zeph-llm/mock"]

Expand All @@ -139,7 +131,7 @@ tracing-opentelemetry = { workspace = true, optional = true }
zeph-a2a = { workspace = true, optional = true }
zeph-channels.workspace = true
zeph-index = { workspace = true, optional = true }
zeph-mcp = { workspace = true, optional = true }
zeph-mcp.workspace = true
zeph-core.workspace = true
zeph-llm.workspace = true
zeph-memory.workspace = true
Expand Down
14 changes: 3 additions & 11 deletions crates/zeph-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,13 @@ repository.workspace = true
[features]
default = []
candle = ["zeph-llm/candle"]
compatible = ["zeph-llm/compatible"]
cuda = ["zeph-llm/cuda"]
daemon = []
index = ["dep:zeph-index"]
mcp = ["dep:zeph-mcp"]
metal = ["zeph-llm/metal"]
openai = ["zeph-llm/openai"]
orchestrator = ["zeph-llm/orchestrator"]
qdrant = ["zeph-skills/qdrant", "zeph-mcp?/qdrant"]
router = ["zeph-llm/router"]
self-learning = ["zeph-skills/self-learning"]
vault-age = ["dep:age"]

[dependencies]
age = { workspace = true, optional = true }
age.workspace = true
anyhow.workspace = true
notify.workspace = true
notify-debouncer-mini.workspace = true
Expand All @@ -36,9 +28,9 @@ toml.workspace = true
tracing.workspace = true
zeph-index = { workspace = true, optional = true }
zeph-llm.workspace = true
zeph-mcp = { workspace = true, optional = true, features = ["qdrant"] }
zeph-mcp.workspace = true
zeph-memory.workspace = true
zeph-skills = { workspace = true, features = ["qdrant"] }
zeph-skills.workspace = true
zeph-tools.workspace = true

[[bench]]
Expand Down
1 change: 0 additions & 1 deletion crates/zeph-core/src/agent/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,6 @@ impl<C: Channel, T: ToolExecutor> Agent<C, T> {
system_prompt.push_str("\n<!-- cache:stable -->");
system_prompt.push_str("\n<!-- cache:volatile -->");

#[cfg(feature = "mcp")]
self.append_mcp_prompt(query, &mut system_prompt).await;

let cwd = std::env::current_dir().unwrap_or_default();
Expand Down
53 changes: 3 additions & 50 deletions crates/zeph-core/src/agent/learning.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
use super::{Agent, Channel, LlmProvider, ToolExecutor};
#[cfg(feature = "self-learning")]

use super::{LearningConfig, Message, Role, SemanticMemory};
#[cfg(feature = "self-learning")]

use std::path::PathBuf;

impl<C: Channel, T: ToolExecutor> Agent<C, T> {
#[cfg(feature = "self-learning")]
pub(super) fn is_learning_enabled(&self) -> bool {
self.learning_config.as_ref().is_some_and(|c| c.enabled)
}

#[cfg(feature = "self-learning")]
async fn is_skill_trusted_for_learning(&self, skill_name: &str) -> bool {
let Some(memory) = &self.memory_state.memory else {
return true;
Expand All @@ -21,13 +19,6 @@ impl<C: Channel, T: ToolExecutor> Agent<C, T> {
matches!(row.trust_level.as_str(), "trusted" | "verified")
}

#[cfg(not(feature = "self-learning"))]
#[allow(dead_code, clippy::unused_self)]
pub(super) fn is_learning_enabled(&self) -> bool {
false
}

#[cfg(feature = "self-learning")]
pub(super) async fn record_skill_outcomes(&self, outcome: &str, error_context: Option<&str>) {
if self.skill_state.active_skill_names.is_empty() {
return;
Expand Down Expand Up @@ -55,12 +46,6 @@ impl<C: Channel, T: ToolExecutor> Agent<C, T> {
}
}

#[cfg(not(feature = "self-learning"))]
#[allow(clippy::unused_async)]
pub(super) async fn record_skill_outcomes(&self, _outcome: &str, _error_context: Option<&str>) {
}

#[cfg(feature = "self-learning")]
pub(super) async fn attempt_self_reflection(
&mut self,
error_context: &str,
Expand Down Expand Up @@ -120,7 +105,6 @@ impl<C: Channel, T: ToolExecutor> Agent<C, T> {
Ok(retry_succeeded)
}

#[cfg(feature = "self-learning")]
#[allow(clippy::cast_precision_loss)]
pub(super) async fn generate_improved_skill(
&self,
Expand Down Expand Up @@ -186,7 +170,6 @@ impl<C: Channel, T: ToolExecutor> Agent<C, T> {
.await
}

#[cfg(feature = "self-learning")]
#[allow(clippy::cast_precision_loss)]
async fn check_improvement_allowed(
&self,
Expand Down Expand Up @@ -231,7 +214,6 @@ impl<C: Channel, T: ToolExecutor> Agent<C, T> {
Ok(true)
}

#[cfg(feature = "self-learning")]
async fn call_improvement_llm(
&self,
skill_name: &str,
Expand Down Expand Up @@ -266,7 +248,6 @@ impl<C: Channel, T: ToolExecutor> Agent<C, T> {
self.provider.chat(&messages).await.map_err(Into::into)
}

#[cfg(feature = "self-learning")]
async fn store_improved_version(
&self,
memory: &SemanticMemory,
Expand Down Expand Up @@ -318,7 +299,6 @@ impl<C: Channel, T: ToolExecutor> Agent<C, T> {
Ok(())
}

#[cfg(feature = "self-learning")]
#[allow(clippy::cast_precision_loss)]
async fn check_rollback(&self, skill_name: &str) {
if !self.is_learning_enabled() {
Expand Down Expand Up @@ -381,7 +361,6 @@ impl<C: Channel, T: ToolExecutor> Agent<C, T> {
}
}

#[cfg(feature = "self-learning")]
pub(super) async fn handle_skill_command(
&mut self,
args: &str,
Expand All @@ -408,26 +387,6 @@ impl<C: Channel, T: ToolExecutor> Agent<C, T> {
}
}

#[cfg(not(feature = "self-learning"))]
pub(super) async fn handle_skill_command(
&mut self,
args: &str,
) -> Result<(), super::error::AgentError> {
let parts: Vec<&str> = args.split_whitespace().collect();
match parts.first().copied() {
Some("trust") => self.handle_skill_trust_command(&parts[1..]).await,
Some("block") => self.handle_skill_block(parts.get(1).copied()).await,
Some("unblock") => self.handle_skill_unblock(parts.get(1).copied()).await,
_ => {
self.channel
.send("Available /skill subcommands: trust, block, unblock")
.await?;
Ok(())
}
}
}

#[cfg(feature = "self-learning")]
async fn handle_skill_stats(&mut self) -> Result<(), super::error::AgentError> {
use std::fmt::Write;

Expand Down Expand Up @@ -461,7 +420,6 @@ impl<C: Channel, T: ToolExecutor> Agent<C, T> {
Ok(())
}

#[cfg(feature = "self-learning")]
async fn handle_skill_versions(
&mut self,
name: Option<&str>,
Expand Down Expand Up @@ -499,7 +457,6 @@ impl<C: Channel, T: ToolExecutor> Agent<C, T> {
Ok(())
}

#[cfg(feature = "self-learning")]
async fn handle_skill_activate(
&mut self,
name: Option<&str>,
Expand Down Expand Up @@ -547,7 +504,6 @@ impl<C: Channel, T: ToolExecutor> Agent<C, T> {
Ok(())
}

#[cfg(feature = "self-learning")]
async fn handle_skill_approve(
&mut self,
name: Option<&str>,
Expand Down Expand Up @@ -595,7 +551,6 @@ impl<C: Channel, T: ToolExecutor> Agent<C, T> {
Ok(())
}

#[cfg(feature = "self-learning")]
async fn handle_skill_reset(
&mut self,
name: Option<&str>,
Expand Down Expand Up @@ -634,7 +589,6 @@ impl<C: Channel, T: ToolExecutor> Agent<C, T> {
}
}

#[cfg(feature = "self-learning")]
pub(super) async fn write_skill_file(
skill_paths: &[PathBuf],
skill_name: &str,
Expand Down Expand Up @@ -662,7 +616,6 @@ pub(super) async fn write_skill_file(
}

/// Naive parser for `SQLite` datetime strings (e.g. "2024-01-15 10:30:00") to Unix seconds.
#[cfg(feature = "self-learning")]
pub(super) fn chrono_parse_sqlite(s: &str) -> Result<u64, ()> {
// Format: "YYYY-MM-DD HH:MM:SS"
let parts: Vec<&str> = s.split(&['-', ' ', ':'][..]).collect();
Expand All @@ -682,7 +635,7 @@ pub(super) fn chrono_parse_sqlite(s: &str) -> Result<u64, ()> {
}

#[cfg(test)]
#[cfg(feature = "self-learning")]

mod tests {
#[allow(clippy::wildcard_imports)]
use super::*;
Expand Down
Loading
Loading