pub struct ContextRetriever { /* private fields */ }Expand description
Context retriever for gathering relevant code context
Implementations§
Source§impl ContextRetriever
impl ContextRetriever
Sourcepub fn with_max_file_bytes(self, bytes: usize) -> Self
pub fn with_max_file_bytes(self, bytes: usize) -> Self
Set max bytes per file
Sourcepub fn with_max_context_bytes(self, bytes: usize) -> Self
pub fn with_max_context_bytes(self, bytes: usize) -> Self
Set max total context bytes
Sourcepub fn search(&self, pattern: &str, max_results: usize) -> Vec<SearchHit>
pub fn search(&self, pattern: &str, max_results: usize) -> Vec<SearchHit>
Search for a pattern in the workspace using ripgrep Respects .gitignore and common ignore patterns
Sourcepub fn read_file_truncated(&self, path: &Path) -> Result<String>
pub fn read_file_truncated(&self, path: &Path) -> Result<String>
Read a file with truncation if it exceeds max bytes
Sourcepub fn get_task_context(
&self,
context_files: &[PathBuf],
output_files: &[PathBuf],
) -> String
pub fn get_task_context( &self, context_files: &[PathBuf], output_files: &[PathBuf], ) -> String
Get context for a task based on its context_files and output_files Returns a formatted string suitable for LLM prompts
Sourcepub fn search_for_context(&self, query: &str, max_results: usize) -> String
pub fn search_for_context(&self, query: &str, max_results: usize) -> String
Search for relevant code based on a query (e.g., function name, class name) Returns formatted context for LLM
Sourcepub fn build_restriction_map(
&self,
node: &SRBNNode,
manifest: &OwnershipManifest,
) -> RestrictionMap
pub fn build_restriction_map( &self, node: &SRBNNode, manifest: &OwnershipManifest, ) -> RestrictionMap
PSP-5 Phase 3: Build a restriction map for a node
The restriction map defines the context boundary: what files, digests, and summaries a node is allowed to see. Built from the ownership manifest, task graph, and parent scope.
Sourcepub fn assemble_context_package(
&self,
node: &SRBNNode,
restriction_map: &RestrictionMap,
) -> ContextPackage
pub fn assemble_context_package( &self, node: &SRBNNode, restriction_map: &RestrictionMap, ) -> ContextPackage
PSP-5 Phase 3: Assemble a reproducible context package for a node
Builds a complete, bounded context package from the restriction map. Prioritizes: owned files (full content) > sealed interfaces (digest or content) > summaries.
Sourcepub fn compute_structural_digest(
&self,
path: &str,
artifact_kind: ArtifactKind,
source_node_id: &str,
) -> Result<StructuralDigest>
pub fn compute_structural_digest( &self, path: &str, artifact_kind: ArtifactKind, source_node_id: &str, ) -> Result<StructuralDigest>
PSP-5 Phase 3: Compute a structural digest for a file
Sourcepub fn format_context_package(&self, package: &ContextPackage) -> String
pub fn format_context_package(&self, package: &ContextPackage) -> String
PSP-5 Phase 3: Format a context package as text for LLM prompts
Sourcepub fn validate_provenance_record(
&self,
record: &ContextProvenanceRecord,
) -> Vec<String>
pub fn validate_provenance_record( &self, record: &ContextProvenanceRecord, ) -> Vec<String>
PSP-5 Phase 3: Validate a persisted provenance record against the current workspace.
Parses structural digest references from the provenance record and checks whether the referenced source files still exist on disk. Returns a list of missing file paths — empty means no drift detected.
Sourcepub fn get_project_summary(&self) -> String
pub fn get_project_summary(&self) -> String
Gather a structured project summary for injection into sheafification prompts.
Returns a formatted string describing: detected language plugins, dependency manifests, entry points, test locations, and build system. Uses the plugin registry and file-system inspection; zero LLM calls.
Auto Trait Implementations§
impl Freeze for ContextRetriever
impl RefUnwindSafe for ContextRetriever
impl Send for ContextRetriever
impl Sync for ContextRetriever
impl Unpin for ContextRetriever
impl UnsafeUnpin for ContextRetriever
impl UnwindSafe for ContextRetriever
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more