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
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
undocumented public items: `EmbeddingStore::with_store`, `EmbeddingStore::health_check`,
`ProviderStats` fields, `EmaTracker::new`, `Extractor::extract`, `CompatibleProvider`
builder methods, `MiningConfig` fields (closes #4483).

- `zeph-memory`, `zeph-common`, `zeph-config`, `zeph-channels`, `zeph-commands`, `zeph-gateway`,
`zeph-a2a`: add `#[non_exhaustive]` to all extensible `pub enum` types — adding new variants
in future releases will not be a breaking change for downstream crates (closes #4513, #4514, #4532).
- `zeph-llm`: mark `StreamChunk`, `ThinkingBlock`, `ChatResponse`, `MessagePart`, and `LlmError`
as `#[non_exhaustive]` — adding new variants in the future will not be a breaking change for
downstream crates (closes #4515, #4517).
Expand Down
1 change: 1 addition & 0 deletions crates/zeph-a2a/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use crate::jsonrpc::JsonRpcError;
/// `-32002` is not-cancelable.
/// - Abort on [`Security`](A2aError::Security) — endpoint rejected by TLS or SSRF policy.
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum A2aError {
/// A `reqwest` HTTP transport error (connection refused, timeout, TLS, etc.).
#[error("HTTP request failed: {0}")]
Expand Down
1 change: 1 addition & 0 deletions crates/zeph-a2a/src/ibct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const CLOCK_SKEW_GRACE_SECS: u64 = 30;

/// Errors produced by [`Ibct::issue`] and [`Ibct::verify`].
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum IbctError {
/// The HMAC-SHA256 signature does not match the token's fields.
/// Indicates tampering or use of a wrong key.
Expand Down
2 changes: 2 additions & 0 deletions crates/zeph-a2a/src/server/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ pub struct AppState {
/// final artifact. [`StatusUpdate`](ProcessorEvent::StatusUpdate) events update the task's
/// state in [`TaskManager`] and, for streaming calls, are forwarded as SSE events.
#[derive(Debug, Clone)]
#[non_exhaustive]
pub enum ProcessorEvent {
/// A task lifecycle state transition. Set `is_final = true` on the terminal state.
StatusUpdate { state: TaskState, is_final: bool },
Expand Down Expand Up @@ -244,6 +245,7 @@ impl Default for TaskManager {

/// Error returned by [`TaskManager::cancel_task`] when cancellation cannot proceed.
#[derive(Debug)]
#[non_exhaustive]
pub enum CancelError {
/// No task with the given ID exists in the store.
NotFound,
Expand Down
6 changes: 2 additions & 4 deletions crates/zeph-acp/src/agent/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1166,10 +1166,8 @@ impl ZephAcpAgentState {
let auth_methods: Vec<acp::schema::AuthMethod> = self
.auth_methods_config
.iter()
.map(|m| match m {
zeph_core::config::AcpAuthMethod::Agent => acp::schema::AuthMethod::Agent(
acp::schema::AuthMethodAgent::new("zeph", "Zeph"),
),
.map(|_m| {
acp::schema::AuthMethod::Agent(acp::schema::AuthMethodAgent::new("zeph", "Zeph"))
})
.collect();

Expand Down
3 changes: 2 additions & 1 deletion crates/zeph-agent-context/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,7 @@ pub async fn fetch_graph_facts_raw(
}
append_graph_facts(&facts, &mut body, &mut tokens_so_far, budget_tokens, tc);
}
_ => {}
}

if body == GRAPH_FACTS_PREFIX {
Expand Down Expand Up @@ -802,7 +803,7 @@ pub async fn fetch_semantic_recall_raw(
}
let entry = match context_format {
ContextFormat::Structured => format_structured_recall_entry(item),
ContextFormat::Plain => format_plain_recall_entry(item),
_ => format_plain_recall_entry(item),
};
let entry_tokens = tc.count_tokens(&entry);
if tokens_used + entry_tokens > token_budget {
Expand Down
6 changes: 3 additions & 3 deletions crates/zeph-agent-context/src/memory_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,9 @@ impl ContextMemoryBackend for SemanticMemoryBackend {
) -> BoxFut<'a, Vec<MemGraphFact>> {
Box::pin(async move {
let mem_view = match params.view {
RecallView::Head => MemRecallView::Head,
RecallView::ZoomIn => MemRecallView::ZoomIn,
RecallView::ZoomOut => MemRecallView::ZoomOut,
_ => MemRecallView::Head,
};
let mem_edge_types: Vec<zeph_memory::EdgeType> = params
.edge_types
Expand All @@ -255,10 +255,10 @@ impl ContextMemoryBackend for SemanticMemoryBackend {
use zeph_common::memory::EdgeType as CE;
use zeph_memory::EdgeType as ME;
match e {
CE::Semantic => ME::Semantic,
CE::Temporal => ME::Temporal,
CE::Causal => ME::Causal,
CE::Entity => ME::Entity,
_ => ME::Semantic,
}
})
.collect();
Expand Down Expand Up @@ -373,7 +373,6 @@ pub fn build_memory_router(
}
let fallback = manager.routing.fallback_route;
match manager.routing.strategy {
StoreRoutingStrategy::Heuristic => Box::new(zeph_memory::HeuristicRouter),
StoreRoutingStrategy::Llm => {
let Some(provider) = manager.store_routing_provider.clone() else {
tracing::warn!(
Expand All @@ -398,6 +397,7 @@ pub fn build_memory_router(
manager.routing.confidence_threshold,
))
}
_ => Box::new(zeph_memory::HeuristicRouter),
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/zeph-agent-context/src/summarization/pruning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub(crate) fn prune_tool_outputs(
PruningStrategy::Mig => prune_tool_outputs_mig(summ, min_to_free),
PruningStrategy::Subgoal => prune_tool_outputs_subgoal(summ, min_to_free),
PruningStrategy::SubgoalMig => prune_tool_outputs_subgoal_mig(summ, min_to_free),
PruningStrategy::Reactive => prune_tool_outputs_oldest_first(summ, min_to_free),
_ => prune_tool_outputs_oldest_first(summ, min_to_free),
}
}

Expand Down
4 changes: 1 addition & 3 deletions crates/zeph-agent-context/src/summarization/scheduling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,8 @@ pub(crate) fn maybe_soft_compact_mid_iteration(summ: &mut ContextSummarizationVi
/// Only runs when a `TaskAware` or `Mig` pruning strategy is active.
pub(crate) fn maybe_refresh_task_goal(summ: &mut ContextSummarizationView<'_>) {
match &summ.context_manager.compression.pruning_strategy {
zeph_config::PruningStrategy::Reactive
| zeph_config::PruningStrategy::Subgoal
| zeph_config::PruningStrategy::SubgoalMig => return,
zeph_config::PruningStrategy::TaskAware | zeph_config::PruningStrategy::Mig => {}
_ => return,
}

// Phase 1: apply completed background result.
Expand Down
1 change: 1 addition & 0 deletions crates/zeph-channels/src/any.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ use crate::telegram::TelegramChannel;
/// # });
/// ```
#[derive(Debug)]
#[non_exhaustive]
pub enum AnyChannel {
Cli(CliChannel),
JsonCli(JsonCliChannel),
Expand Down
1 change: 1 addition & 0 deletions crates/zeph-channels/src/line_editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use crossterm::{
///
/// Both [`read_line`] (TTY) and [`read_line_piped`] (non-TTY) return this type
/// so the caller can handle all three cases uniformly.
#[non_exhaustive]
pub enum ReadLineResult {
/// A complete line was read. The trailing newline is stripped.
Line(String),
Expand Down
2 changes: 2 additions & 0 deletions crates/zeph-channels/src/telegram_api_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ pub struct GuestMessage {
/// unrecognised status string is captured by the `Other` variant.
#[derive(Debug, Clone, PartialEq, Eq, Deserialize)]
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum ChatMemberStatus {
/// The user is the chat creator.
Creator,
Expand Down Expand Up @@ -140,6 +141,7 @@ struct TelegramResponse<T> {

/// Errors returned by [`TelegramApiClient`] methods.
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum TelegramApiError {
/// HTTP transport or status error.
#[error("HTTP error: {0}")]
Expand Down
1 change: 1 addition & 0 deletions crates/zeph-commands/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ pub enum CommandOutput {

/// Category for grouping commands in `/help` output.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum SlashCategory {
/// Session management: `/clear`, `/reset`, `/exit`, etc.
Session,
Expand Down
2 changes: 2 additions & 0 deletions crates/zeph-common/src/audit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
///
/// Variants correspond to the four signal classes defined in spec 004-16, FR-007.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum AuditSignalType {
/// A policy gate denied or flagged an operation.
PolicyViolation,
Expand All @@ -27,6 +28,7 @@ pub enum AuditSignalType {
/// Mapped to a numeric multiplier by `TrajectorySeverityMultipliers`:
/// `Low → 0.5`, `Medium → 1.0`, `High → 2.0` (defaults).
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum Severity {
/// Minor or likely-benign signal.
Low,
Expand Down
2 changes: 2 additions & 0 deletions crates/zeph-common/src/error_taxonomy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
/// ```
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum ErrorDomain {
/// The agent selected the wrong tool or misunderstood the task.
/// Recovery: re-plan, pick a different tool or approach.
Expand Down Expand Up @@ -76,6 +77,7 @@ impl ErrorDomain {
/// Setup → `ParamHandling` → Execution → `ResultInterpretation`.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum ToolInvocationPhase {
/// Tool lookup/registration phase: was the tool name valid?
Setup,
Expand Down
4 changes: 4 additions & 0 deletions crates/zeph-common/src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use serde::{Deserialize, Serialize};
/// Serialises with `snake_case` names (`keyword`, `semantic`, `hybrid`, `graph`, `episodic`).
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum MemoryRoute {
/// Full-text search only (`SQLite` FTS5). Fast, good for keyword/exact queries.
Keyword,
Expand Down Expand Up @@ -79,6 +80,7 @@ pub trait AsyncMemoryRouter: MemoryRouter {
/// assert_eq!(RecallView::default(), RecallView::Head);
/// ```
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
#[non_exhaustive]
pub enum RecallView {
/// Standard retrieval — no enrichment beyond what the base method provides.
#[default]
Expand All @@ -93,6 +95,7 @@ pub enum RecallView {

/// The three abstraction levels in the compression spectrum.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
#[non_exhaustive]
pub enum CompressionLevel {
/// Raw episodic messages — full fidelity, high token cost.
Episodic,
Expand Down Expand Up @@ -270,6 +273,7 @@ pub struct SpreadingActivationParams {
/// MAGMA edge type: the semantic category of a relationship between two entities.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum EdgeType {
#[default]
Semantic,
Expand Down
1 change: 1 addition & 0 deletions crates/zeph-common/src/policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pub struct PolicyMessage {

/// Role for a [`PolicyMessage`].
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum PolicyRole {
/// System-level instruction.
System,
Expand Down
1 change: 1 addition & 0 deletions crates/zeph-common/src/secret.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ impl fmt::Display for Secret {
/// The `Backend(String)` variant is the escape hatch for third-party vault implementations:
/// format the underlying error into the `String` when no more specific variant applies.
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum VaultError {
#[error("secret not found: {0}")]
NotFound(String),
Expand Down
3 changes: 3 additions & 0 deletions crates/zeph-common/src/task_supervisor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ use crate::BlockingSpawner;
///
/// Used in [`TaskDescriptor`] to configure restart behaviour for a task.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum RestartPolicy {
/// Task runs once; normal completion removes it from the registry.
RunOnce,
Expand Down Expand Up @@ -139,6 +140,7 @@ impl TaskHandle {

/// Error returned by [`BlockingHandle::join`].
#[derive(Debug, PartialEq, Eq)]
#[non_exhaustive]
pub enum BlockingError {
/// The task panicked before producing a result.
Panicked,
Expand Down Expand Up @@ -233,6 +235,7 @@ impl<R> BlockingHandle<R> {

/// Point-in-time state of a supervised task.
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub enum TaskStatus {
/// Task is actively running.
Running,
Expand Down
1 change: 1 addition & 0 deletions crates/zeph-common/src/trust_level.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use serde::{Deserialize, Serialize};
/// ```
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "lowercase")]
#[non_exhaustive]
pub enum SkillTrustLevel {
/// Built-in or user-audited skill: full tool access.
Trusted,
Expand Down
3 changes: 3 additions & 0 deletions crates/zeph-config/src/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use crate::subagent::{HookDef, MemoryScope, PermissionMode};
///
/// Used in `SubAgentDef.model` frontmatter field.
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub enum ModelSpec {
/// Use the parent agent's active provider at spawn time.
Inherit,
Expand Down Expand Up @@ -65,6 +66,7 @@ impl<'de> Deserialize<'de> for ModelSpec {
/// ```
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Deserialize, Serialize)]
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum ParentContextPolicy {
/// Pass the parent history verbatim — legacy behaviour, no sanitization.
Inherit,
Expand All @@ -78,6 +80,7 @@ pub enum ParentContextPolicy {
/// Controls how parent agent context is injected into a spawned sub-agent's task prompt.
#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum ContextInjectionMode {
/// No parent context injected.
None,
Expand Down
1 change: 1 addition & 0 deletions crates/zeph-config/src/autonomous.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use serde::{Deserialize, Serialize};
/// - `Running` / `Verifying` → `Failed` (unrecoverable error)
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum AutonomousState {
/// The agent is actively running multi-turn execution.
Running,
Expand Down
3 changes: 3 additions & 0 deletions crates/zeph-config/src/channels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pub use crate::mcp_security::ToolSecurityMeta;
/// Controls SSRF validation, tool filtering, and data-flow policy enforcement.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
#[non_exhaustive]
pub enum McpTrustLevel {
/// Full trust — all tools exposed, SSRF check skipped. Use for operator-controlled servers.
Trusted,
Expand Down Expand Up @@ -643,6 +644,7 @@ impl Default for ToolPruningConfig {
/// circular crate dependency (`zeph-config` → `zeph-mcp`).
#[derive(Debug, Clone, Copy, Default, Deserialize, Serialize, PartialEq, Eq)]
#[serde(rename_all = "lowercase")]
#[non_exhaustive]
pub enum ToolDiscoveryStrategyConfig {
/// Embedding-based cosine similarity retrieval. Fast, no LLM call per turn.
Embedding,
Expand Down Expand Up @@ -999,6 +1001,7 @@ impl Default for McpOAuthConfig {
/// Where OAuth tokens are stored.
#[derive(Debug, Clone, Default, Deserialize, Serialize)]
#[serde(rename_all = "lowercase")]
#[non_exhaustive]
pub enum OAuthTokenStorage {
/// Persisted in the age vault (default).
#[default]
Expand Down
1 change: 1 addition & 0 deletions crates/zeph-config/src/classifiers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ where
/// Only safe for well-calibrated models or when FPR is verified on your workload.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize)]
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum InjectionEnforcementMode {
/// Log + metric only, never block.
Warn,
Expand Down
1 change: 1 addition & 0 deletions crates/zeph-config/src/dump_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use serde::{Deserialize, Serialize};
/// Output format for debug dump files.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
#[non_exhaustive]
pub enum DumpFormat {
/// Write LLM requests as pretty-printed internal zeph-llm JSON (`{id}-request.json`).
#[default]
Expand Down
1 change: 1 addition & 0 deletions crates/zeph-config/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use zeph_common::secret::VaultError;
///
/// Covers file I/O, TOML parsing, validation, and vault resolution.
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum ConfigError {
#[error("failed to read config file: {0}")]
Io(#[from] std::io::Error),
Expand Down
1 change: 1 addition & 0 deletions crates/zeph-config/src/experiment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use serde::{Deserialize, Serialize};
/// ```
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize, JsonSchema)]
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum FailureStrategy {
/// Abort the entire graph and cancel all running tasks.
#[default]
Expand Down
2 changes: 2 additions & 0 deletions crates/zeph-config/src/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ fn default_gateway_webhook_send_timeout_secs() -> u64 {
/// Controls how skills are formatted in the system prompt.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Deserialize, Serialize)]
#[serde(rename_all = "lowercase")]
#[non_exhaustive]
pub enum SkillPromptMode {
Full,
Compact,
Expand Down Expand Up @@ -1028,6 +1029,7 @@ impl Default for SchedulerConfig {
/// Known variants map to built-in handlers; `Custom` accommodates user-defined task types.
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum ScheduledTaskKind {
MemoryCleanup,
SkillRefresh,
Expand Down
1 change: 1 addition & 0 deletions crates/zeph-config/src/learning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ fn default_heuristic_promotion_interval_hours() -> u64 {
/// Strategy for detecting implicit user corrections.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Deserialize, Serialize)]
#[serde(rename_all = "lowercase")]
#[non_exhaustive]
pub enum DetectorMode {
/// Pattern-matching only — zero LLM calls. Default behavior.
#[default]
Expand Down
Loading
Loading