Skip to main content

codetether_rlm/context_index/
types.rs

1//! Core typed evidence structures.
2
3use serde::{Deserialize, Serialize};
4
5/// Cached index for one source blob.
6#[derive(Debug, Clone, Serialize, Deserialize)]
7pub struct ContextIndex {
8    pub source: String,
9    pub hash: u64,
10    pub symbols: Vec<String>,
11    pub records: Vec<EvidenceRecord>,
12}
13
14/// Kind of evidence represented by a record.
15#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
16pub enum EvidenceKind {
17    Symbol,
18    Import,
19    Error,
20    Text,
21}
22
23/// High-level retrieval intent.
24#[derive(Debug, Clone, Copy, PartialEq, Eq)]
25pub enum PlanIntent {
26    Debug,
27    Symbol,
28    Summary,
29}
30
31/// Auditable retrieval unit passed to synthesis.
32#[derive(Debug, Clone, Serialize, Deserialize)]
33pub struct EvidenceRecord {
34    pub id: usize,
35    pub source: String,
36    pub kind: EvidenceKind,
37    pub span: (usize, usize),
38    pub symbols: Vec<String>,
39    pub score: f32,
40    pub reason: String,
41    pub text: String,
42}
43
44/// Query plan used by the retriever.
45#[derive(Debug, Clone)]
46pub struct RetrievalPlan {
47    pub terms: Vec<String>,
48    pub budget_tokens: usize,
49    pub intent: PlanIntent,
50}