1const _: () = assert!(
8 libsqlite3_sys::SQLITE_VERSION_NUMBER >= 3_051_003,
9 "bundled SQLite must include the WAL-reset corruption fix",
10);
11
12mod audit;
13mod extract;
14pub mod log_db;
15mod migrations;
16mod model;
17mod paths;
18mod runtime;
19mod sqlite;
20mod telemetry;
21
22pub use model::LogEntry;
23pub use model::LogQuery;
24pub use model::LogRow;
25pub use model::Phase2JobClaimOutcome;
26pub use runtime::StateRuntime;
28pub use sqlite::SqliteConfig;
29
30pub use audit::ThreadStateAuditRow;
31pub use audit::read_thread_state_audit_rows;
32pub use extract::apply_rollout_item;
36pub use extract::rollout_item_affects_thread_metadata;
37pub use model::Anchor;
38pub use model::BackfillState;
39pub use model::BackfillStats;
40pub use model::BackfillStatus;
41pub use model::DirectionalThreadSpawnEdgeStatus;
42pub use model::ExtractionOutcome;
43pub use model::SortDirection;
44pub use model::SortKey;
45pub use model::Stage1JobClaim;
46pub use model::Stage1JobClaimOutcome;
47pub use model::Stage1Output;
48pub use model::Stage1StartupClaimParams;
49pub use model::ThreadGoal;
50pub use model::ThreadGoalStatus;
51pub use model::ThreadMetadata;
52pub use model::ThreadMetadataBuilder;
53pub use model::ThreadRelationFilter;
54pub use model::ThreadsPage;
55pub use runtime::ExternalAgentConfigImportDetailsRecord;
56pub use runtime::ExternalAgentConfigImportFailureRecord;
57pub use runtime::ExternalAgentConfigImportHistoryRecord;
58pub use runtime::ExternalAgentConfigImportSuccessRecord;
59pub use runtime::GoalAccountingMode;
60pub use runtime::GoalAccountingOutcome;
61pub use runtime::GoalStore;
62pub use runtime::GoalUpdate;
63pub use runtime::MemoryStore;
64pub use runtime::RemoteControlEnrollmentRecord;
65pub use runtime::RuntimeDbBackup;
66pub use runtime::RuntimeDbPath;
67pub use runtime::ThreadFilterOptions;
68pub use runtime::backup_runtime_db_for_fresh_start;
69pub use runtime::goals_db_filename;
70pub use runtime::goals_db_path;
71pub use runtime::is_sqlite_corruption_error;
72pub use runtime::logs_db_filename;
73pub use runtime::logs_db_path;
74pub use runtime::memories_db_filename;
75pub use runtime::memories_db_path;
76pub use runtime::open_thread_history_db;
77pub use runtime::runtime_db_path_for_corruption_error;
78pub use runtime::runtime_db_paths;
79pub use runtime::sqlite_error_detail_is_corruption;
80pub use runtime::sqlite_error_detail_is_lock;
81pub use runtime::sqlite_integrity_check;
82pub use runtime::state_db_filename;
83pub use runtime::state_db_path;
84pub use runtime::thread_history_db_filename;
85pub use runtime::thread_history_db_path;
86pub use telemetry::DbTelemetry;
87pub use telemetry::DbTelemetryHandle;
88pub use telemetry::install_process_db_telemetry;
89pub use telemetry::record_backfill_gate;
90pub use telemetry::record_fallback;
91
92pub const SQLITE_HOME_ENV: &str = "CODEX_SQLITE_HOME";
94
95pub const LOGS_DB_FILENAME: &str = "logs_2.sqlite";
96pub const GOALS_DB_FILENAME: &str = "goals_1.sqlite";
97pub const MEMORIES_DB_FILENAME: &str = "memories_1.sqlite";
98pub const STATE_DB_FILENAME: &str = "state_5.sqlite";
99pub const THREAD_HISTORY_DB_FILENAME: &str = "thread_history_1.sqlite";
100
101pub const DB_ERROR_METRIC: &str = "codex.db.error";
103pub const DB_METRIC_BACKFILL: &str = "codex.db.backfill";
105pub const DB_METRIC_BACKFILL_DURATION_MS: &str = "codex.db.backfill.duration_ms";
107pub const DB_INIT_METRIC: &str = "codex.sqlite.init.count";
109pub const DB_INIT_DURATION_METRIC: &str = "codex.sqlite.init.duration_ms";
111pub const DB_FALLBACK_METRIC: &str = "codex.sqlite.fallback.count";