#![forbid(unsafe_code)]
#![warn(missing_docs)]
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(feature = "std", doc = include_str!("../README.md"))]
#![cfg_attr(
not(feature = "std"),
doc = "Core cognitive-kernel types and algorithms that can run without the Rust standard library. Enable the `std` feature for persistence, configuration files, and the product-facing `Kernel` API."
)]
#![cfg_attr(docsrs, feature(doc_cfg))]
extern crate alloc;
use core::sync::atomic::{AtomicU32, Ordering};
static UUID_SEQUENCE: AtomicU32 = AtomicU32::new(1);
pub fn new_uuid() -> uuid::Uuid {
let sequence = UUID_SEQUENCE.fetch_add(1, Ordering::Relaxed) as u128;
uuid::Uuid::from_u128(0x4f4d_4547_412d_4b45_524e_454c_0000_0000u128 | sequence)
}
pub fn now_utc() -> crate::types::UtcTimestamp {
crate::types::UtcTimestamp::now()
}
#[cfg(feature = "std")]
pub fn now_utc_string() -> alloc::string::String {
now_utc().to_rfc3339()
}
#[cfg(not(feature = "std"))]
pub fn now_utc_string() -> alloc::string::String {
"1970-01-01T00:00:00+00:00".into()
}
#[doc(hidden)]
pub mod prelude {
pub use alloc::{
boxed::Box,
format,
string::{String, ToString},
vec,
vec::Vec,
};
}
#[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
pub mod api;
#[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
pub mod audit;
#[doc(hidden)]
pub mod body;
#[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
pub mod checkpoint;
#[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
pub mod config;
#[cfg(all(feature = "std", feature = "toml"))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "std", feature = "toml"))))]
pub mod config_toml;
#[doc(hidden)]
pub mod critic;
#[doc(hidden)]
pub mod error;
#[doc(hidden)]
pub mod goals;
#[doc(hidden)]
pub mod introspect;
pub mod l0;
pub mod l1;
pub mod l2;
#[doc(hidden)]
pub mod llm;
pub mod memory;
pub mod orchestrator;
#[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
pub mod persist;
#[doc(hidden)]
pub mod planning;
#[cfg(feature = "std")]
mod private_fs;
#[doc(hidden)]
pub mod reactor;
pub mod safety;
#[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
pub mod task;
pub mod types;
#[cfg(feature = "std")]
pub use api::{
replay_trajectory_file, Kernel, KernelMetricsSnapshot, KernelStatus, RunReport,
TrajectoryReplayRow, TrajectoryReplaySummary, DEFAULT_MAX_TRAJECTORY_BYTES,
};
#[cfg(feature = "std")]
pub use audit::{AuditEvent, AuditLog, AuditRecord, AuditSummary, KernelEvent};
#[cfg(feature = "std")]
pub use config::{
InterventionLevel, InterventionMode, InterventionPolicy, KernelConfig, L2Config, PrivacyConfig,
};
pub use critic::{Critic, ReflectionReport, RewardSignal, TrialBudget};
pub use error::{OmegaError, Result};
pub use orchestrator::{OmegaOrchestrator, StepResult};
#[cfg(all(feature = "std", feature = "async"))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "std", feature = "async"))))]
pub use persist::AsyncStateStore;
#[cfg(feature = "std")]
pub use persist::{KernelSnapshot, CURRENT_SCHEMA_VERSION, DEFAULT_STATE_PATH};
#[cfg(feature = "std")]
pub use task::{
run_bandit_task, run_l1_l2_factorial_benchmark, run_l2_benchmark, run_l2_benchmark_scenario,
run_l2_benchmark_scenario_with_gate, run_l2_gain_matrix, BanditReport, FactorialArm,
FactorialBenchmarkReport, FactorialEffect, FactorialRun, L2BenchmarkAggregate,
L2BenchmarkReport, L2GainAssessment, L2GainMatrixReport, L2GainScenarioAssessment,
L2GainSeedSet, L2PairedRun, PairedMeanDifference, L2_GAIN_DEFAULT_EPISODES,
L2_GAIN_DEFAULT_RUNS, L2_GAIN_DEFAULT_STEPS, L2_GAIN_DISCOVERY_SEED, L2_GAIN_SCENARIOS,
L2_GAIN_VALIDATION_SEED,
};
pub use types::*;
pub use body::{
BodyBus, BodyChannelInfo, BodyCommandProposal, BodyPacket, BodyPacketStatus, BodySummary,
ChannelKind,
};
pub use goals::{
GoalNode, GoalStatus, GoalTree, GoalTreeSummary, IntrinsicMotivation, IntrinsicSignal,
};
pub use introspect::{EntropyReport, EntropyWatchdog};
pub use l0::bandit_decision::{BanditUcbDecisionMaker, BanditUcbSnapshot};
pub use l0::decision::{ConstrainedDecisionMaker, DecisionMaker};
#[cfg(feature = "async")]
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
pub use l0::executor::{AsyncExecutor, AsyncExecutorAdapter, AsyncLoggingExecutor};
pub use l0::executor::{Executor, SandboxedExecutor};
#[cfg(feature = "std")]
pub use l0::executor::{LoggingExecutor, ToolGateExecutor};
pub use l0::hybrid_predictor::{HybridWorldModel, HybridWorldPredictor, TinyAttentionPredictor};
#[cfg(feature = "async")]
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
pub use l0::observer::{
AsyncDirSnapshotObserver, AsyncFileObserver, AsyncHttpObserver, AsyncObserver,
AsyncObserverAdapter,
};
#[cfg(feature = "std")]
pub use l0::observer::{DirSnapshotObserver, FileObserver, HttpObserver};
pub use l0::observer::{MultiModalObserver, Observer};
pub use l0::predictor::{ModelBasedPredictor, Predictor};
pub use l1::{L1SpectralReflector, SpectralBin, SpectralPatch};
pub use l2::{
CognitiveRealm, KernelStepOutput, L2CognitiveGate, L2Decision, L2State, SpectralGateConfig,
};
pub use llm::{parse_suggestion_json, LlmBridge, LlmProposal, SchemaResult};
pub use memory::{
export_weights, migrate_payload, squash_delta_history, verify_weights, WeightsPayload,
WEIGHTS_MAGIC, WEIGHTS_VERSION,
};
pub use planning::{Plan, PlanStep, ShortHorizonPlanner};
pub use reactor::{PriorityReactor, ReactorTask};
pub use safety::{ActionBoundary, AuthorizationToken, TokenBook};
#[cfg(feature = "std")]
pub use safety::{StorageLock, Vault};