Skip to main content

oxidized_state/
lib.rs

1//! Oxidized-State: SurrealDB Backend for AIVCS
2//!
3//! This crate provides the persistence layer for the Agent Version Control System.
4//! It handles all I/O with SurrealDB, providing a clean persistence layer for
5//! graph states, runs, and memory.
6//!
7//! ## Layer 0 - Data/Persistence
8//!
9//! Focus: Data integrity, transactionality, and graph traversal.
10//!
11//! ## Key Components
12//!
13//! - `SurrealHandle`: Manages connection and transactions
14//! - `SnapshotRecord`: Schema mapping to the Document Layer (State + Memory)
15//! - `GraphEdge`: Schema mapping to the Graph Layer (Commit -> Parent)
16//! - `RunRecord`, `RunEventRecord`: Schema for execution run ledger
17//! - `ReleaseRecordSchema`: Schema for release management
18//! - `init_schema`: Initialize all tables with constraints and indexes
19
20mod ci;
21mod error;
22pub mod fakes;
23mod handle;
24pub mod migrations;
25mod schema;
26pub mod storage_traits;
27pub mod surreal_ledger;
28pub mod surreal_release_registry;
29
30pub use ci::{
31    CiArtifact, CiCommand, CiPipelineSpec, CiRunRecord, CiRunStatus, CiSnapshot, CiStepResult,
32    CiStepSpec,
33};
34pub use error::{StateError, StorageError};
35pub use handle::{CloudConfig, SurrealHandle};
36pub use migrations::init_schema;
37pub use schema::{
38    AgentRecord, BranchRecord, CommitId, CommitRecord, DecisionRecord, GraphEdge,
39    MemoryProvenanceRecord, MemoryRecord, ProvenanceSourceType, ReleaseRecordSchema,
40    RunEventRecord as DbRunEventRecord, RunRecord as DbRunRecord, SnapshotRecord,
41};
42pub use storage_traits::{
43    CasStore, ContentDigest, ReleaseMetadata, ReleaseRecord, ReleaseRegistry, RunEvent, RunId,
44    RunLedger, RunMetadata, RunRecord, RunStatus, RunSummary, StorageResult,
45};
46pub use surreal_ledger::SurrealRunLedger;
47pub use surreal_release_registry::SurrealDbReleaseRegistry;
48
49/// Result type for oxidized-state operations
50pub type Result<T> = std::result::Result<T, StateError>;