1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// crates/kglite/src/graph/mod.rs
//
// Pure-Rust core of the graph engine. The `KnowledgeGraph` /
// `Transaction` / `ResultView` / `ResultIter` Python-facing structs
// + PyO3 helpers stay in the kglite-py wrapper crate (workspace
// root pre-G.4) because they carry `#[pyclass]` / `#[pymethods]`
// attributes. This module declares the engine submodules + a few
// shared types those wrappers reference.
pub mod algorithms;
pub mod blueprint;
pub mod cdc;
pub mod constraints;
pub mod core;
pub(crate) mod cow;
pub mod dir_graph;
pub mod durability;
pub(crate) mod edge_embedding_generation;
pub(crate) mod edge_embeddings;
pub mod embedder;
pub mod embedding_carry;
pub(crate) mod embedding_hints;
pub mod embedding_inventory;
pub(crate) mod embedding_validation;
pub mod embeddings;
pub mod explore;
pub mod features;
pub mod handle;
pub mod index_freshness;
pub mod introspection;
pub mod io;
pub mod languages;
pub mod mutation;
pub mod ontology;
pub(crate) mod parallel;
pub mod property_types;
pub mod recipes;
pub mod schema;
pub mod schema_json;
pub mod session;
pub mod skills;
pub mod storage;
pub mod tables;
pub mod text_indexes;
pub mod wal;
#[cfg(test)]
#[path = "value_byte_identity_tests.rs"]
mod value_byte_identity_tests;
// Declared here rather than beside the other edge-embedding test modules in
// `edge_embeddings.rs`: these cases drive `Session::open_durable` and the WAL,
// not the embedding store's own seam, so nothing in them is `super::`-scoped.
#[cfg(test)]
#[path = "edge_embedding_durable_recovery_tests.rs"]
mod edge_embedding_durable_recovery_tests;
// Re-export DirGraph at the graph-mod top level — matches the
// path the executor / planner / blueprint code uses
// (`crate::graph::DirGraph`). Actual definition lives in
// `dir_graph` and is re-exported by `schema` too.
pub use dir_graph::DirGraph;
/// Temporal context for automatic date filtering on select /
/// traverse / collect. Set via `KnowledgeGraph::date()` (Python:
/// `g.date(...)`). Carried through clone (fluent API chaining).
#[derive(Clone, Debug, Default)]
pub enum TemporalContext {
/// Use today's date (default). Resolved at query time.
#[default]
Today,
/// Point-in-time: valid_from <= date AND (valid_to IS NULL OR valid_to >= date).
At(chrono::NaiveDate),
/// Range overlap: valid_from <= end AND (valid_to IS NULL OR valid_to >= start).
During(chrono::NaiveDate, chrono::NaiveDate),
/// No temporal filtering — show everything regardless of
/// validity dates.
All,
}
impl TemporalContext {
pub fn is_all(&self) -> bool {
matches!(self, TemporalContext::All)
}
}
/// Resolved code-entity location returned by
/// `KnowledgeGraph::source_location`. All optional fields mirror
/// what code-graph builders (e.g. codingest) store on the node — graphs built from
/// non-code-tree sources may have fewer populated.
#[derive(Debug, Clone)]
pub struct SourceLocation {
pub type_name: String,
pub name: String,
pub qualified_name: String,
pub file_path: Option<String>,
pub line_number: Option<i64>,
pub end_line: Option<i64>,
pub signature: Option<String>,
}
/// Outcome of a `KnowledgeGraph::source_location` lookup.
#[derive(Debug, Clone)]
pub enum SourceLookup {
Found(SourceLocation),
/// Multiple code entities matched the given (name, node_type).
/// The payload lists each match's qualified_name so the caller
/// can ask the agent to disambiguate.
Ambiguous(Vec<String>),
NotFound,
}
// (The canonical `resolve_noderefs` lives in `graph::session`; it is the
// one re-exported as `kglite::api::session::resolve_noderefs`. A dead
// duplicate here was removed when the hard seal surfaced it.)