pub use crate::domain::{
FileClassification, FileProcessingResult, LanguageId, ReferenceKind, SymbolKind, SymbolRecord,
};
pub use crate::git::GitRepo;
pub use crate::live_index::LiveIndex;
pub use crate::live_index::query::{SearchFilesTier, SearchFilesView};
pub use crate::live_index::search::{
SymbolSearchResult, TextSearchError, TextSearchResult, search_symbols, search_text,
};
pub use crate::live_index::single_file::{ReindexResult, remove_file, update_file_from_disk};
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[non_exhaustive]
pub struct EngineInfo {
pub version: &'static str,
pub snapshot_format_version: u32,
pub secret_policy_version: u32,
pub grammars: &'static [&'static str],
}
pub fn engine_info() -> EngineInfo {
const GRAMMAR_NAMES: [&str; crate::domain::LanguageId::ALL.len()] = {
let mut names = [""; crate::domain::LanguageId::ALL.len()];
let mut i = 0;
while i < crate::domain::LanguageId::ALL.len() {
names[i] = crate::domain::LanguageId::ALL[i].name();
i += 1;
}
names
};
EngineInfo {
version: env!("CARGO_PKG_VERSION"),
snapshot_format_version: crate::live_index::persist::SNAPSHOT_FORMAT_VERSION,
secret_policy_version: crate::knowledge::SECRET_POLICY_VERSION,
grammars: &GRAMMAR_NAMES,
}
}
pub use crate::live_index::store::{
IndexLoadSource, IndexedFile, ParseStatus, PublishedIndexState, PublishedIndexStatus,
SharedIndex, SnapshotVerifyState,
};
pub use crate::parsing::process_file;
pub use crate::domain::StatePlacement;
pub use crate::live_index::persist::{
IndexSnapshot, PortableSnapshotProvenance, import_portable_snapshot, load_snapshot,
load_snapshot_for_root, project_local_state_placement, snapshot_compatible,
snapshot_to_live_index,
};
pub use crate::stel_core::calibration::{
CalibrationVerdict, StelCalibrationSummary, format_calibration_section, summarize_calibration,
};
pub use crate::stel_core::ledger_store::{
LedgerStoreStatus, LedgerSubsystemState, LedgerSummary, StelLedgerStore, StoredLedgerRecord,
};
pub use crate::stel_core::types::{
AdmissionDecision, IntentBucket, RouteConfidence, StelLedgerEvent,
};
pub use crate::{domain, git, live_index, parsing};
#[cfg(test)]
mod contract {
#[allow(unused_imports)]
use crate::embed::{
FileClassification, FileProcessingResult, GitRepo, IndexLoadSource, IndexedFile,
LanguageId, LiveIndex, ParseStatus, PublishedIndexState, PublishedIndexStatus,
ReferenceKind, SearchFilesTier, SearchFilesView, SharedIndex, SnapshotVerifyState,
SymbolKind, SymbolRecord, SymbolSearchResult, TextSearchError, TextSearchResult,
};
#[allow(unused_imports)]
use crate::embed::{
AdmissionDecision, CalibrationVerdict, IntentBucket, LedgerStoreStatus,
LedgerSubsystemState, LedgerSummary, RouteConfidence, StelCalibrationSummary,
StelLedgerEvent, StelLedgerStore, StoredLedgerRecord,
};
#[allow(unused_imports)]
use crate::embed::{
IndexSnapshot, PortableSnapshotProvenance, StatePlacement, import_portable_snapshot,
load_snapshot, load_snapshot_for_root, project_local_state_placement, snapshot_compatible,
snapshot_to_live_index,
};
#[allow(unused_imports)]
use crate::embed::{ReindexResult, remove_file, update_file_from_disk};
#[allow(unused_imports)]
use crate::embed::{EngineInfo, engine_info};
#[allow(unused_imports)]
use crate::embed::{domain, git, live_index, parsing};
use std::path::Path;
#[test]
fn facade_contract_is_stable() {
fn _assert_named<T>() {}
_assert_named::<FileClassification>();
_assert_named::<FileProcessingResult>();
_assert_named::<LanguageId>();
_assert_named::<ReferenceKind>();
_assert_named::<SymbolKind>();
_assert_named::<SymbolRecord>();
_assert_named::<SearchFilesTier>();
_assert_named::<SearchFilesView>();
_assert_named::<SymbolSearchResult>();
_assert_named::<TextSearchResult>();
_assert_named::<TextSearchError>();
_assert_named::<IndexLoadSource>();
_assert_named::<IndexedFile>();
_assert_named::<ParseStatus>();
_assert_named::<PublishedIndexState>();
_assert_named::<PublishedIndexStatus>();
_assert_named::<SharedIndex>();
_assert_named::<SnapshotVerifyState>();
_assert_named::<LiveIndex>();
_assert_named::<GitRepo>();
_assert_named::<IndexSnapshot>();
_assert_named::<StatePlacement>();
let _search_symbols: fn(&LiveIndex, &str, Option<&str>, usize) -> SymbolSearchResult =
crate::embed::search_symbols;
#[allow(clippy::type_complexity)]
let _search_text: fn(
&LiveIndex,
Option<&str>,
Option<&[String]>,
bool,
) -> Result<TextSearchResult, TextSearchError> = crate::embed::search_text;
let _process_file: fn(&str, &[u8], LanguageId) -> FileProcessingResult =
crate::embed::process_file;
let _load_snapshot: fn(&Path, &StatePlacement) -> Option<IndexSnapshot> =
crate::embed::load_snapshot;
let _load_snapshot_for_root: fn(&Path) -> Option<IndexSnapshot> =
crate::embed::load_snapshot_for_root;
let _project_local_state_placement: fn(&Path) -> anyhow::Result<StatePlacement> =
crate::embed::project_local_state_placement;
let _snapshot_compatible: fn(&Path) -> bool = crate::embed::snapshot_compatible;
let _snapshot_to_live_index: fn(IndexSnapshot, &Path) -> LiveIndex =
crate::embed::snapshot_to_live_index;
let _import_portable_snapshot: fn(
&Path,
&StatePlacement,
PortableSnapshotProvenance,
) -> Option<IndexSnapshot> = crate::embed::import_portable_snapshot;
let _update_file_from_disk: fn(&SharedIndex, &Path, &str) -> ReindexResult =
crate::embed::update_file_from_disk;
let _remove_file: fn(&SharedIndex, &str) -> bool = crate::embed::remove_file;
let _engine_info: fn() -> EngineInfo = crate::embed::engine_info;
let _load: fn(&Path) -> anyhow::Result<SharedIndex> = LiveIndex::load;
let _from_indexed_files: fn(
&Path,
Vec<(String, IndexedFile)>,
) -> anyhow::Result<SharedIndex> = LiveIndex::from_indexed_files;
let _from_parse_result: fn(FileProcessingResult, Vec<u8>) -> IndexedFile =
IndexedFile::from_parse_result;
let _from_extension: fn(&str) -> Option<LanguageId> = LanguageId::from_extension;
let _for_code_path: fn(&str) -> FileClassification = FileClassification::for_code_path;
let _git_open: fn(&Path) -> Result<GitRepo, String> = GitRepo::open;
let _git_file_at_ref: fn(&GitRepo, &str, &str) -> Result<Option<String>, String> =
GitRepo::file_at_ref;
let _git_changed_paths: fn(&GitRepo, &str, &str) -> Result<Vec<String>, String> =
GitRepo::changed_paths_between_refs;
let _ = (
_search_symbols,
_search_text,
_process_file,
_load,
_from_indexed_files,
_from_parse_result,
_from_extension,
_for_code_path,
_git_open,
_git_file_at_ref,
_git_changed_paths,
_load_snapshot,
_load_snapshot_for_root,
_project_local_state_placement,
_snapshot_compatible,
_snapshot_to_live_index,
_import_portable_snapshot,
_update_file_from_disk,
_remove_file,
_engine_info,
);
let info = crate::embed::engine_info();
assert!(!info.version.is_empty());
assert_eq!(
info.grammars.len(),
crate::domain::LanguageId::ALL.len(),
"every grammar is reported"
);
assert!(info.grammars.contains(&"rust"));
assert!(info.snapshot_format_version >= 7);
let _deep_process_file: fn(&str, &[u8], LanguageId) -> FileProcessingResult =
parsing::process_file;
let _deep_search_symbols: fn(
&live_index::LiveIndex,
&str,
Option<&str>,
usize,
) -> live_index::search::SymbolSearchResult = live_index::search::search_symbols;
let _deep_git_open: fn(&Path) -> Result<git::GitRepo, String> = git::GitRepo::open;
let _deep_for_code_path: fn(&str) -> domain::FileClassification =
domain::FileClassification::for_code_path;
let _ = (
_deep_process_file,
_deep_search_symbols,
_deep_git_open,
_deep_for_code_path,
);
}
}