tea_context/
inspection.rs1use std::ops::Range;
2
3use crate::{CacheScope, PromptModuleId, PromptProvenance, PromptSegmentId, TrustLevel};
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq)]
7pub enum SegmentDisposition {
8 Included,
10 Truncated,
12 Duplicate,
14 ConflictShadowed,
16 OmittedForBudget,
18}
19
20#[derive(Debug, Clone, PartialEq, Eq)]
22pub struct PromptInspectionEntry {
23 module_id: PromptModuleId,
24 segment_id: PromptSegmentId,
25 provenance: PromptProvenance,
26 trust: TrustLevel,
27 cache_scope: CacheScope,
28 disposition: SegmentDisposition,
29 byte_range: Option<Range<usize>>,
30 rendered_bytes: usize,
31 estimated_tokens: usize,
32}
33
34impl PromptInspectionEntry {
35 #[allow(clippy::too_many_arguments)]
36 pub(crate) const fn new(
37 module_id: PromptModuleId,
38 segment_id: PromptSegmentId,
39 provenance: PromptProvenance,
40 trust: TrustLevel,
41 cache_scope: CacheScope,
42 disposition: SegmentDisposition,
43 byte_range: Option<Range<usize>>,
44 rendered_bytes: usize,
45 estimated_tokens: usize,
46 ) -> Self {
47 Self {
48 module_id,
49 segment_id,
50 provenance,
51 trust,
52 cache_scope,
53 disposition,
54 byte_range,
55 rendered_bytes,
56 estimated_tokens,
57 }
58 }
59 #[must_use]
61 pub const fn module_id(&self) -> &PromptModuleId {
62 &self.module_id
63 }
64 #[must_use]
66 pub const fn segment_id(&self) -> &PromptSegmentId {
67 &self.segment_id
68 }
69 #[must_use]
71 pub const fn provenance(&self) -> &PromptProvenance {
72 &self.provenance
73 }
74 #[must_use]
76 pub const fn trust(&self) -> TrustLevel {
77 self.trust
78 }
79 #[must_use]
81 pub const fn cache_scope(&self) -> CacheScope {
82 self.cache_scope
83 }
84 #[must_use]
86 pub const fn disposition(&self) -> SegmentDisposition {
87 self.disposition
88 }
89 #[must_use]
91 pub const fn byte_range(&self) -> Option<&Range<usize>> {
92 self.byte_range.as_ref()
93 }
94 #[must_use]
96 pub const fn rendered_bytes(&self) -> usize {
97 self.rendered_bytes
98 }
99 #[must_use]
101 pub const fn estimated_tokens(&self) -> usize {
102 self.estimated_tokens
103 }
104}