cellstate_core/
lib.rs

1// Copyright 2024-2026 CELLSTATE Contributors
2// SPDX-License-Identifier: Apache-2.0
3
4//! CELLSTATE Core - Entity Types
5//!
6//! Core domain types and shared logic. All other crates depend on this.
7//! Contains domain types, scoring, decay, drift detection, and event-sourcing primitives.
8//!
9//! # Type Dictionary
10//!
11//! This crate serves as the "type dictionary" for CELLSTATE. All types visible
12//! here form the vocabulary of the system:
13//!
14//! - **Identity**: Type-safe ID newtypes (`TenantId`, `TrajectoryId`, etc.), `Timestamp`, `ContentHash`
15//! - **Enums**: Status types, entity types, categories. DB enum values use snake_case when
16//!   writing; reading accepts legacy PascalCase/mixed-case via `from_db_str` (see `enums`).
17//! - **Entities**: Core domain entities (Trajectory, Scope, Artifact, Note, Turn)
18//! - **Typestate**: Compile-time safe Lock, Handoff, Delegation lifecycles
19//! - **Events**: Event DAG types (EventHeader, DagPosition, EventKind)
20//! - **Effects**: Error-as-effects pattern (Effect<T>, ErrorEffect)
21
22// Core modules
23mod agent;
24pub mod agent_state;
25mod battle_intel;
26mod config;
27pub mod decay;
28mod embedding;
29mod entities;
30mod enums;
31mod error;
32pub mod filter;
33mod health;
34mod identity;
35pub mod intent;
36mod llm;
37pub mod prompt_template;
38pub mod redaction;
39pub mod scoring;
40mod secret;
41
42// Typestate modules (compile-time safety for critical paths)
43mod delegation;
44mod handoff;
45mod lock;
46mod session;
47
48// Verifiable Credentials (agent identity)
49pub mod credentials;
50
51// Event DAG modules
52mod effect;
53mod event;
54
55// Event sourcing module
56pub mod event_sourcing;
57
58// Context assembly module
59mod context;
60
61// Drift detection module
62pub mod drift;
63
64// Synchronization pulse module
65pub mod sync_pulse;
66
67// Model discovery types
68pub mod models;
69
70// WebMCP types (browser-native agent tool discovery)
71pub mod web_mcp;
72
73// Re-export identity types
74pub use identity::*;
75
76// Re-export all enums
77pub use enums::*;
78
79// Re-export embedding types
80pub use embedding::*;
81
82// Re-export entity structs
83pub use entities::*;
84
85// Re-export Battle Intel types
86pub use battle_intel::*;
87
88// Re-export error types
89pub use error::*;
90
91// Re-export config types
92pub use config::*;
93
94// Re-export filter types
95pub use filter::*;
96
97// Re-export health types
98pub use health::*;
99
100// Re-export typestate types (Lock, Handoff, Delegation)
101pub use delegation::*;
102pub use handoff::*;
103pub use lock::*;
104pub use session::*;
105
106// Re-export event DAG types
107pub use event::*;
108
109// Re-export effect types
110pub use effect::*;
111
112// Re-export event sourcing trait
113pub use event_sourcing::EventSourced;
114
115// Re-export context assembly types
116pub use context::*;
117
118// Re-export drift detection types
119pub use drift::*;
120
121// Re-export sync pulse types
122pub use sync_pulse::*;
123
124// Re-export agent types (consolidated from cellstate-agents)
125pub use agent::*;
126
127// Re-export agent state types
128pub use agent_state::*;
129
130// Re-export WebMCP types
131pub use web_mcp::*;
132
133// Re-export scoring types
134pub use scoring::*;
135
136// Re-export decay types
137pub use decay::*;
138
139// Re-export intent engineering types
140pub use intent::*;
141// Re-export secret wrappers
142pub use secret::*;
143
144// Re-export LLM primitive types (consolidated from cellstate-llm)
145pub use llm::*;