Skip to main content

coreason_engine/
lib.rs

1#![allow(
2
3// Copyright (c) 2026 CoReason, Inc. All Rights Reserved
4// This software is proprietary and dual-licensed
5// Licensed under the Prosperity Public License 3.0 (the "License")
6// A copy of the license is available at <https://prosperitylicense.com/versions/3.0.0>
7// For details, see the LICENSE file
8// Commercial use beyond a 30-day trial requires a separate license
9// SPDX-License-Identifier: LicenseRef-Prosperity-3.0
10
11    clippy::empty_line_after_outer_attr,
12    clippy::empty_line_after_doc_comments,
13    clippy::new_without_default,
14    clippy::suspicious_open_options,
15    clippy::unnecessary_map_or,
16    clippy::to_string_in_format_args,
17    clippy::needless_borrow
18)]
19
20use manifest_types::{
21    calculate_latent_alignment, EpistemicOntologicalAlignmentPolicy, VectorEmbeddingState,
22};
23use thiserror::Error;
24
25#[derive(Error, Debug)]
26pub enum AlignmentEngineError {
27    #[error("Algebra layer error: {0}")]
28    AlgebraError(#[from] manifest_types::algebra::AlgebraError),
29}
30
31pub struct LatentAlignmentEngine {
32    policy: EpistemicOntologicalAlignmentPolicy,
33}
34
35impl LatentAlignmentEngine {
36    pub fn new(policy: EpistemicOntologicalAlignmentPolicy) -> Self {
37        Self { policy }
38    }
39
40    pub fn check_alignment(
41        &self,
42        v1: &VectorEmbeddingState,
43        v2: &VectorEmbeddingState,
44    ) -> Result<f64, AlignmentEngineError> {
45        Ok(calculate_latent_alignment(v1, v2, &self.policy)?)
46    }
47}
48
49pub mod dlp_scanner;
50pub mod epistemic_math;
51pub mod thermodynamics;
52
53pub mod blast_radius;
54pub mod capability_allocator;
55pub mod embeddings;
56pub mod federated_query;
57pub mod governance;
58pub mod isv_provisioning;
59pub mod license;
60pub mod lmsr_consensus;
61pub mod local_simulator;
62pub mod ontological_solver;
63pub mod policy_tree;
64pub mod sovereign_etl;
65pub mod wasm_dispatcher;