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 security_event;
35pub mod spawner;
36pub mod task_supervisor;
37pub mod text;
38pub mod timestamp;
39pub mod trust_level;
40pub mod types;
41
42/// Prefix embedded in tool output bodies when the full output was stored externally.
43///
44/// Format: `[full output stored — ID: {uuid} — {bytes} bytes, use read_overflow tool to retrieve]`
45pub const OVERFLOW_NOTICE_PREFIX: &str = "[full output stored \u{2014} ID: ";
46
47pub use fidelity::{ContextFidelity, PlannedToolHint};
48pub use math::{EmbeddingVector, Normalized, Unnormalized};
49pub use policy::{PolicyLlmClient, PolicyMessage, PolicyRole};
50pub use sanitize::{IdentitySanitizer, OutputSanitizer};
51pub use security_event::SecurityEventCategory;
52pub use spawner::BlockingSpawner;
53pub use task_supervisor::{
54    BlockingError, BlockingHandle, MAX_RESTART_DELAY, RestartPolicy, TaskDescriptor, TaskHandle,
55    TaskSnapshot, TaskStatus, TaskSupervisor,
56};
57pub use text::format_tokens;
58pub use trust_level::SkillTrustLevel;
59pub use types::{ProviderName, SessionId, SkillName, StopHint, ToolDefinition, ToolName};
60
61#[cfg(feature = "treesitter")]
62pub mod treesitter;