Skip to main content

lean_ctx/
lib.rs

1#![recursion_limit = "256"]
2// Every `unsafe` block must carry a `// SAFETY:` comment justifying soundness.
3// Enforced so the (mostly libc/Win32 syscall) unsafe surface stays documented.
4#![warn(clippy::undocumented_unsafe_blocks)]
5
6#[cfg(all(feature = "jemalloc", not(windows)))]
7#[global_allocator]
8static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
9
10#[cfg(all(feature = "jemalloc", not(windows)))]
11#[allow(non_upper_case_globals)]
12#[unsafe(export_name = "malloc_conf")]
13pub static malloc_conf: &[u8] = b"background_thread:true,dirty_decay_ms:1000,muzzy_decay_ms:1000\0";
14
15// ---------------------------------------------------------------------------
16// Pillar: Engine — context compression, MCP tools, agent hooks, local UX
17// ---------------------------------------------------------------------------
18pub mod compound_lexer;
19pub mod core;
20pub mod daemon;
21pub mod daemon_autostart;
22pub mod daemon_client;
23pub mod dashboard;
24pub mod dropin;
25pub mod engine;
26pub mod heatmap;
27pub mod hook_handlers;
28pub mod hooks;
29pub mod instructions;
30pub mod lsp;
31pub mod marked_block;
32pub mod mcp_stdio;
33pub mod rewrite_registry;
34pub mod rules_inject;
35pub mod server;
36pub mod shell;
37pub mod shell_hook;
38pub mod terminal_ui;
39pub mod token_report;
40pub mod tool_defs;
41pub mod tools;
42pub mod tui;
43
44// ---------------------------------------------------------------------------
45// Pillar: Gateway — LLM API proxy, org-wide monitoring, budget enforcement
46// ---------------------------------------------------------------------------
47#[cfg(feature = "gateway-server")]
48pub mod gateway_server;
49#[cfg(feature = "http-server")]
50pub mod proxy;
51pub mod proxy_autostart;
52pub mod proxy_setup;
53
54// ---------------------------------------------------------------------------
55// Pillar: Cloud — hosted API, accounts, sync, billing edge
56// ---------------------------------------------------------------------------
57pub mod cloud_client;
58#[cfg(feature = "cloud-server")]
59pub mod cloud_server;
60pub mod cloud_sync;
61#[cfg(feature = "http-server")]
62pub mod http_server;
63
64// ---------------------------------------------------------------------------
65// Shared — CLI, IPC, config, diagnostics, setup
66// ---------------------------------------------------------------------------
67pub mod cli;
68pub mod config_io;
69pub mod doctor;
70pub mod ipc;
71pub mod report;
72pub mod setup;
73pub mod status;
74#[cfg(test)]
75pub(crate) mod test_env;
76pub mod uninstall;
77pub mod wrap;