ContextValidator

Struct ContextValidator 

Source
pub struct ContextValidator {
    config: PCPConfig,
    checkpoints: Vec<PCPCheckpoint>,
}
Expand description

The main validation and checkpoint engine (formerly PCPRuntime).

Fields§

§config: PCPConfig§checkpoints: Vec<PCPCheckpoint>

Implementations§

Source§

impl ContextValidator

Source

pub fn new(config: PCPConfig) -> CellstateResult<Self>

Create a new context validator with the given configuration.

Source

pub fn config(&self) -> &PCPConfig

Get the configuration.

Source§

impl ContextValidator

Source

pub fn validate_context_integrity( &self, scope: &Scope, artifacts: &[Artifact], current_tokens: i32, ) -> CellstateResult<ValidationResult>

Validate context integrity.

Source

fn check_dosage_limits( &self, result: &mut ValidationResult, artifact_count: i32, token_count: i32, )

Source

fn check_stale_scope(&self, result: &mut ValidationResult, scope: &Scope)

Source

fn check_artifact_integrity( &self, result: &mut ValidationResult, artifact: &Artifact, )

Source§

impl ContextValidator

Source

pub fn detect_contradictions( &self, artifacts: &[Artifact], ) -> CellstateResult<Vec<Contradiction>>

Detect contradictions between artifacts using embedding similarity.

Source§

impl ContextValidator

Source

pub fn apply_dosage_limits( &self, artifacts: &[Artifact], current_tokens: i32, ) -> CellstateResult<DosageResult>

Apply dosage limits to artifacts and tokens.

Source

pub fn would_exceed_limits( &self, current_artifacts: i32, current_tokens: i32, additional_artifacts: i32, additional_tokens: i32, ) -> bool

Check if adding more content would exceed dosage limits.

Source§

impl ContextValidator

Source

pub fn lint_artifact( &self, artifact: &Artifact, existing_artifacts: &[Artifact], ) -> CellstateResult<LintResult>

Lint an artifact for quality issues.

Source

fn check_artifact_size(&self, result: &mut LintResult, artifact: &Artifact)

Source

fn check_artifact_duplicates( &self, result: &mut LintResult, artifact: &Artifact, existing_artifacts: &[Artifact], )

Source

fn check_artifact_embedding(&self, result: &mut LintResult, artifact: &Artifact)

Source

fn check_artifact_confidence( &self, result: &mut LintResult, artifact: &Artifact, )

Source

fn check_artifact_semantics(&self, result: &mut LintResult, artifact: &Artifact)

Source

pub fn lint_artifacts( &self, artifacts: &[Artifact], ) -> CellstateResult<LintResult>

Lint multiple artifacts at once.

Source§

impl ContextValidator

Source

pub fn create_checkpoint( &mut self, scope: &Scope, artifacts: &[Artifact], note_ids: &[NoteId], ) -> CellstateResult<PCPCheckpoint>

Create a checkpoint for a scope.

Source

fn enforce_checkpoint_limit(&mut self)

Source

pub fn recover_from_checkpoint( &self, checkpoint: &PCPCheckpoint, ) -> CellstateResult<RecoveryResult>

Recover a scope from a checkpoint.

Source

pub fn get_latest_checkpoint(&self, scope_id: ScopeId) -> Option<&PCPCheckpoint>

Get the latest checkpoint for a scope.

Source

pub fn get_checkpoints_for_scope( &self, scope_id: ScopeId, ) -> Vec<&PCPCheckpoint>

Get all checkpoints for a scope.

Source

pub fn delete_checkpoint(&mut self, checkpoint_id: Uuid) -> bool

Delete a checkpoint.

Source

pub fn clear_checkpoints_for_scope(&mut self, scope_id: ScopeId) -> usize

Clear all checkpoints for a scope.

Source§

impl ContextValidator

Source

pub fn check_summarization_triggers( &self, scope: &Scope, turn_count: i32, artifact_count: i32, policies: &[SummarizationPolicy], ) -> CellstateResult<Vec<(SummarizationPolicyId, SummarizationTrigger)>>

Check which summarization triggers should fire based on current scope state.

Source

pub fn get_abstraction_transition( &self, policy: &SummarizationPolicy, ) -> (AbstractionLevel, AbstractionLevel)

Calculate what abstraction level transition should occur for a policy.

Source

pub fn validate_abstraction_transition( &self, source: AbstractionLevel, target: AbstractionLevel, ) -> bool

Validate an abstraction level transition.

Trait Implementations§

Source§

impl Clone for ContextValidator

Source§

fn clone(&self) -> ContextValidator

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ContextValidator

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.