Struct PCPRuntime
Sourcepub struct PCPRuntime {
pub(crate) config: PCPConfig,
pub(crate) checkpoints: Vec<PCPCheckpoint>,
}Expand description
PCP Runtime - the main validation and checkpoint engine.
Fields§
§config: PCPConfig§checkpoints: Vec<PCPCheckpoint>Implementations§
Source§impl PCPRuntime
impl PCPRuntime
Sourcepub fn new(config: PCPConfig) -> Result<PCPRuntime, CellstateError>
pub fn new(config: PCPConfig) -> Result<PCPRuntime, CellstateError>
Create a new PCP runtime with the given configuration.
Source§impl PCPRuntime
impl PCPRuntime
Sourcepub fn validate_context_integrity(
&self,
scope: &Scope,
artifacts: &[Artifact],
current_tokens: i32,
) -> Result<ValidationResult, CellstateError>
pub fn validate_context_integrity( &self, scope: &Scope, artifacts: &[Artifact], current_tokens: i32, ) -> Result<ValidationResult, CellstateError>
Source§impl PCPRuntime
impl PCPRuntime
Sourcepub fn detect_contradictions(
&self,
artifacts: &[Artifact],
) -> Result<Vec<Contradiction>, CellstateError>
pub fn detect_contradictions( &self, artifacts: &[Artifact], ) -> Result<Vec<Contradiction>, CellstateError>
Detect contradictions between artifacts using embedding similarity. Two artifacts are considered potentially contradictory if:
- They have high embedding similarity (similar topic)
- Their content differs significantly
§Arguments
artifacts- Artifacts to check for contradictions
§Returns
Vector of detected contradictions
Source§impl PCPRuntime
impl PCPRuntime
Sourcepub fn apply_dosage_limits(
&self,
artifacts: &[Artifact],
current_tokens: i32,
) -> Result<DosageResult, CellstateError>
pub fn apply_dosage_limits( &self, artifacts: &[Artifact], current_tokens: i32, ) -> Result<DosageResult, CellstateError>
Source§impl PCPRuntime
impl PCPRuntime
Sourcepub fn lint_artifact(
&self,
artifact: &Artifact,
existing_artifacts: &[Artifact],
) -> Result<LintResult, CellstateError>
pub fn lint_artifact( &self, artifact: &Artifact, existing_artifacts: &[Artifact], ) -> Result<LintResult, CellstateError>
Sourcepub fn lint_artifacts(
&self,
artifacts: &[Artifact],
) -> Result<LintResult, CellstateError>
pub fn lint_artifacts( &self, artifacts: &[Artifact], ) -> Result<LintResult, CellstateError>
Source§impl PCPRuntime
impl PCPRuntime
Sourcepub fn create_checkpoint(
&mut self,
scope: &Scope,
artifacts: &[Artifact],
note_ids: &[NoteId],
) -> Result<PCPCheckpoint, CellstateError>
pub fn create_checkpoint( &mut self, scope: &Scope, artifacts: &[Artifact], note_ids: &[NoteId], ) -> Result<PCPCheckpoint, CellstateError>
Sourcepub fn recover_from_checkpoint(
&self,
checkpoint: &PCPCheckpoint,
) -> Result<RecoveryResult, CellstateError>
pub fn recover_from_checkpoint( &self, checkpoint: &PCPCheckpoint, ) -> Result<RecoveryResult, CellstateError>
Sourcepub fn get_latest_checkpoint(&self, scope_id: ScopeId) -> Option<&PCPCheckpoint>
pub fn get_latest_checkpoint(&self, scope_id: ScopeId) -> Option<&PCPCheckpoint>
Sourcepub fn get_checkpoints_for_scope(
&self,
scope_id: ScopeId,
) -> Vec<&PCPCheckpoint>
pub fn get_checkpoints_for_scope( &self, scope_id: ScopeId, ) -> Vec<&PCPCheckpoint>
Sourcepub fn delete_checkpoint(&mut self, checkpoint_id: Uuid) -> bool
pub fn delete_checkpoint(&mut self, checkpoint_id: Uuid) -> bool
Source§impl PCPRuntime
impl PCPRuntime
Sourcepub fn check_summarization_triggers(
&self,
scope: &Scope,
turn_count: i32,
artifact_count: i32,
policies: &[SummarizationPolicy],
) -> Result<Vec<(SummarizationPolicyId, SummarizationTrigger)>, CellstateError>
pub fn check_summarization_triggers( &self, scope: &Scope, turn_count: i32, artifact_count: i32, policies: &[SummarizationPolicy], ) -> Result<Vec<(SummarizationPolicyId, SummarizationTrigger)>, CellstateError>
Check which summarization triggers should fire based on current scope state.
This method evaluates all provided summarization policies against the current state of a scope and returns which triggers should activate. Inspired by EVOLVE-MEM’s self-improvement engine.
§Arguments
scope- The scope to evaluate triggers forturn_count- Number of turns in the scopeartifact_count- Number of artifacts in the scopepolicies- Summarization policies to check
§Returns
Vector of (summarization_policy_id, triggered_trigger) pairs for policies that should fire
§Example
ⓘ
let triggered = runtime.check_summarization_triggers(
&scope,
turns.len() as i32,
artifacts.len() as i32,
&policies,
)?;
for (summarization_policy_id, trigger) in triggered {
// Execute summarization for this policy
}Sourcepub fn get_abstraction_transition(
&self,
policy: &SummarizationPolicy,
) -> (AbstractionLevel, AbstractionLevel)
pub fn get_abstraction_transition( &self, policy: &SummarizationPolicy, ) -> (AbstractionLevel, AbstractionLevel)
Sourcepub fn validate_abstraction_transition(
&self,
source: AbstractionLevel,
target: AbstractionLevel,
) -> bool
pub fn validate_abstraction_transition( &self, source: AbstractionLevel, target: AbstractionLevel, ) -> bool
Validate an abstraction level transition.
Valid transitions are:
- Raw -> Summary (L0 -> L1)
- Summary -> Principle (L1 -> L2)
- Raw -> Principle (L0 -> L2, skipping L1)
Invalid transitions:
- Summary -> Raw (downgrade)
- Principle -> Summary/Raw (downgrade)
- Same level to same level
§Arguments
source- Source abstraction leveltarget- Target abstraction level
§Returns
true if the transition is valid
Trait Implementations§
Source§impl Clone for PCPRuntime
impl Clone for PCPRuntime
Source§fn clone(&self) -> PCPRuntime
fn clone(&self) -> PCPRuntime
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PCPRuntime
impl RefUnwindSafe for PCPRuntime
impl Send for PCPRuntime
impl Sync for PCPRuntime
impl Unpin for PCPRuntime
impl UnwindSafe for PCPRuntime
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more