Skip to main content

zeph_common/
lib.rs

1// SPDX-FileCopyrightText: 2026 Andrei G <bug-ops>
2// SPDX-License-Identifier: MIT OR Apache-2.0
3
4//! Shared utility functions and security primitives for Zeph crates.
5//!
6//! This crate provides pure utility functions (text manipulation, network helpers,
7//! sanitization primitives), security primitives (`Secret`, `VaultError`), and
8//! strongly-typed identifiers (`ToolName`, `SessionId`) that are needed by multiple crates.
9//! It has no `zeph-*` dependencies. The optional `treesitter` feature adds tree-sitter
10//! query constants and helpers.
11
12pub mod audit;
13pub mod config;
14#[cfg(feature = "deep-link")]
15pub mod deep_link;
16pub mod error_taxonomy;
17pub mod fidelity;
18pub mod fs_secure;
19pub mod hash;
20#[cfg(feature = "http-middleware")]
21pub mod http_middleware;
22pub mod llm_response;
23pub mod math;
24pub mod memory;
25pub mod net;
26pub mod path_guard;
27pub mod patterns;
28#[cfg(unix)]
29pub mod pidfile;
30pub mod policy;
31pub mod quarantine;
32pub mod sanitize;
33pub mod secret;
34pub mod secrets;
35pub mod security;
36pub mod security_event;
37pub mod spawner;
38pub mod task_supervisor;
39pub mod text;
40pub mod timestamp;
41pub mod trust_level;
42pub mod types;
43
44/// Prefix embedded in tool output bodies when the full output was stored externally.
45///
46/// Format: `[full output stored — ID: {uuid} — {bytes} bytes, use read_overflow tool to retrieve]`
47pub const OVERFLOW_NOTICE_PREFIX: &str = "[full output stored \u{2014} ID: ";
48
49pub use fidelity::{ContextFidelity, PlannedToolHint};
50pub use math::{EmbeddingVector, Normalized, Unnormalized};
51pub use policy::{PolicyLlmClient, PolicyMessage, PolicyRole};
52pub use sanitize::{IdentitySanitizer, OutputSanitizer};
53pub use security_event::SecurityEventCategory;
54pub use spawner::BlockingSpawner;
55pub use task_supervisor::{
56    BlockingError, BlockingHandle, MAX_RESTART_DELAY, RestartPolicy, TaskDescriptor, TaskHandle,
57    TaskSnapshot, TaskStatus, TaskSupervisor,
58};
59pub use text::format_tokens;
60pub use trust_level::SkillTrustLevel;
61pub use types::{ProviderName, SessionId, SkillName, StopHint, ToolDefinition, ToolName};
62
63#[cfg(feature = "treesitter")]
64pub mod treesitter;