Skip to main content

talon_core/
lib.rs

1//! Core types and contracts for Talon.
2//!
3//! The scaffold keeps parsing, configuration, constants, and response contracts
4//! in the library so the CLI remains a thin process boundary.
5
6pub mod ask;
7pub mod cache;
8pub mod config;
9pub mod constants;
10pub mod contracts;
11pub mod embed;
12pub mod error;
13pub mod expansion;
14pub mod glob_matcher;
15pub mod graph;
16pub mod indexer;
17pub mod indexing;
18pub mod inference;
19pub mod links;
20pub mod llm;
21mod numeric;
22pub mod query;
23pub mod runtime;
24pub mod search;
25pub mod store;
26pub mod sync;
27pub mod text;
28pub mod vec_ext;
29
30pub use ask::{AskClient, AskError, AskPlan, AskSynthesis};
31pub use config::{
32    ChatAdapter, ChatAskConfig, ChatExpansionConfig, ChatSection, ChunkerConfig, CredentialEntry,
33    CredentialsConfig, EmbeddingAdapter, EmbeddingConfig, EndpointAuthConfig, InspectConfig,
34    McpConfig, McpHooksConfig, RerankAdapter, RerankConfig, RerankScoreScale, Scope, ScopeFilter,
35    ScopeGlob, ScopePriority, ScopeResolution, ScopesConfig, SearchConfig, TalonConfig,
36};
37pub use contracts::{
38    ContainerPath, ErrorEnvelope, PositiveCount, ResponseMeta, TalonEnvelope, TalonInput,
39    TalonResponseData, TalonResponseTrait, VaultPath,
40};
41pub use error::{ErrorCode, TalonError, TalonResult};
42pub use expansion::{ExpansionClient, ExpansionError, LlmCache};
43pub use glob_matcher::glob_match_case_insensitive;
44pub use graph::GraphBuildStats;
45pub use indexer::{
46    IndexNoteOutcome, IndexerConfig, IndexerStats, NoteIndexConfig, build_ignore_globset,
47    build_include_globset, extract_title, file_matches_ignore, file_matches_include,
48    hash_file_content, index_one_note, index_one_note_with_config, load_notes_for_linking,
49    matches_ignore_patterns, matches_include_patterns, reconcile_deletions,
50    reconcile_ignored_notes, run_full_scan, run_full_scan_with_chunker, scan_vault_markdown,
51};
52pub use indexing::{
53    ChangeFeed, ChangeIndex, ChangeTrackingEntry, ChangeTrackingTombstoneEntry, ChunkUpsertRow,
54    DB_VERSION_KEY, FileChangeState, FileState, IndexMetadata, IndexStats, InspectCheck,
55    InspectFinding, InspectInput, InspectResponse, NoteUpsertResult, REBUILD_MIGRATIONS,
56    SCHEMA_MIGRATIONS, ScopeReport, StatusInput, StatusResponse, StatusState, SyncInput,
57    SyncResponse, SyncStatus, TALON_SQLITE_BUSY_TIMEOUT_MS, TOMBSTONE_RETENTION_MS,
58    TRIGGER_MIGRATIONS, UpsertNoteParams, bump_db_version, now_ms, parse_since,
59    perform_note_deletion, read_db_version, run_migrations, upsert_aliases, upsert_chunks,
60    upsert_frontmatter_fields, upsert_links, upsert_note, upsert_tags,
61};
62pub use inference::{EmbeddingClient, InferenceError, RerankClient};
63pub use links::{
64    LinkEdge, LinkGraphStats, NoteReference, ResolvedLink, build_link_edges, compute_backlinks,
65    compute_link_stats, find_unresolved_links, resolve_wiki_link_target, resolve_wiki_links,
66};
67pub use llm::{ChatClient, ChatError, ChatMessage, ReasoningEffort};
68pub use query::{
69    AskDiagnostics, AskLlmStageDiagnostics, AskResponse, AskSearchDiagnostics, AskSource,
70    ChangeEntry, ChangesInput, ChangesResponse, LinkedNote, MetaEntry, MetaInput, MetaResponse,
71    NoteExcerpt, ReadInput, ReadResponse, ReadResult, ReadSection, RecallFormat, RecallInput,
72    RecallResponse, RecallRuntimeMode, RelatedInput, RelatedResponse, RelatedResult, RelationKind,
73    TombstoneEntry, VaultRecall, find_related, query_changes, query_inspect, query_meta,
74    query_status, run_read, run_recall, run_recall_with_mode, run_search,
75    run_search_with_expanded_queries,
76};
77pub use runtime::{TalonClients, build_ask_chat_client, build_expansion_client};
78pub use rusqlite::Connection;
79pub use search::{
80    AnchorKind, Direction, FrontmatterFilter, GraphSearchDiagnostics, MatchAnchor, MatchKind,
81    SearchDiagnostics, SearchHooks, SearchInput, SearchMode, SearchResponse, SearchResult,
82    WhereClause, WhereOperator,
83};
84pub use store::{open_database, open_database_read_only};
85pub use sync::{
86    SyncError, SyncLock, SyncLockError, acquire_sync_lock, is_sync_lock_held_by_live_process,
87    refresh_index, refresh_index_locked, relink_unresolved, remove_index_files, run_sync,
88    run_sync_with_chunker, run_sync_with_chunker_locked,
89};
90pub use text::chunker::{
91    NoteChunk, build_embedding_text, build_heading_path, chunk_markdown, make_chunk_hash,
92};
93pub use text::frontmatter::{
94    FrontmatterEntry, FrontmatterExtract, FrontmatterReverseIndex, FrontmatterValue,
95    FrontmatterValueType, ReverseSourceIndex, WikiLink, extract_wikilinks, normalize_keyword,
96    normalize_vault_path, parse_frontmatter,
97};
98
99pub use text::nfd::normalize as normalize_text_nfd;
100pub use text::{
101    LineSpan, ParsedWikiLink, TOKEN_CHAR_RATIO, estimate_tokens, is_fence_line, is_heading_line,
102    parse_wikilink, split_lines, strip_heading_text, strip_outer_quotes,
103};