use std::ops::Range;
use crate::{CacheScope, PromptModuleId, PromptProvenance, PromptSegmentId, TrustLevel};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum SegmentDisposition {
Included,
Truncated,
Duplicate,
ConflictShadowed,
OmittedForBudget,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct PromptInspectionEntry {
module_id: PromptModuleId,
segment_id: PromptSegmentId,
provenance: PromptProvenance,
trust: TrustLevel,
cache_scope: CacheScope,
disposition: SegmentDisposition,
byte_range: Option<Range<usize>>,
rendered_bytes: usize,
estimated_tokens: usize,
}
impl PromptInspectionEntry {
#[allow(clippy::too_many_arguments)]
pub(crate) const fn new(
module_id: PromptModuleId,
segment_id: PromptSegmentId,
provenance: PromptProvenance,
trust: TrustLevel,
cache_scope: CacheScope,
disposition: SegmentDisposition,
byte_range: Option<Range<usize>>,
rendered_bytes: usize,
estimated_tokens: usize,
) -> Self {
Self {
module_id,
segment_id,
provenance,
trust,
cache_scope,
disposition,
byte_range,
rendered_bytes,
estimated_tokens,
}
}
#[must_use]
pub const fn module_id(&self) -> &PromptModuleId {
&self.module_id
}
#[must_use]
pub const fn segment_id(&self) -> &PromptSegmentId {
&self.segment_id
}
#[must_use]
pub const fn provenance(&self) -> &PromptProvenance {
&self.provenance
}
#[must_use]
pub const fn trust(&self) -> TrustLevel {
self.trust
}
#[must_use]
pub const fn cache_scope(&self) -> CacheScope {
self.cache_scope
}
#[must_use]
pub const fn disposition(&self) -> SegmentDisposition {
self.disposition
}
#[must_use]
pub const fn byte_range(&self) -> Option<&Range<usize>> {
self.byte_range.as_ref()
}
#[must_use]
pub const fn rendered_bytes(&self) -> usize {
self.rendered_bytes
}
#[must_use]
pub const fn estimated_tokens(&self) -> usize {
self.estimated_tokens
}
}