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
//! Storage layer for Lore.
//!
//! This module provides SQLite-based persistence for sessions, messages,
//! and session-to-commit links. It handles schema migrations and provides
//! query methods for the CLI and future daemon.
//!
//! # Submodules
//!
//! - `db` - Database connection and query operations
//! - `models` - Data structures for sessions, messages, and links
use crateConfig;
/// SQLite database connection and query operations.
/// Data structures representing sessions, messages, and links.
pub use Database;
// DatabaseStats is also available at crate::storage::db::DatabaseStats if needed
pub use ;
// Re-exported for use by integration tests. These types are used through the
// storage module in tests/cli_integration.rs even though they're not directly
// used in the binary crate itself.
pub use ;
/// Returns the machine UUID for the current machine.
///
/// Loads the config and returns the machine_id (UUID), generating one if needed.
/// Used to populate the `machine_id` field on sessions, allowing cloud sync
/// to identify which machine created a session. Returns `None` if the config
/// cannot be loaded or the machine ID cannot be determined.
/// Returns a display-friendly name for a machine ID.
///
/// First queries the machines table to find a registered name. If not found,
/// falls back to checking if this is the current machine and uses the config.
/// Otherwise returns the machine_id truncated to first 8 characters for readability.
///
/// This function is designed for use in session listings to show human-readable
/// machine names instead of UUIDs.