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), not(target_env = "musl")))]
7#[global_allocator]
8static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
9
10/// jemalloc runtime options, exported by the binary as `_rjem_malloc_conf`
11/// (see `main.rs`). NUL-terminated: jemalloc reads it as a C string.
12#[cfg(all(feature = "jemalloc", not(windows), not(target_env = "musl")))]
13pub const JEMALLOC_CONF: &[u8] = if cfg!(target_os = "linux") {
14    b"background_thread:true,dirty_decay_ms:1000,muzzy_decay_ms:1000\0"
15} else {
16    b"dirty_decay_ms:1000,muzzy_decay_ms:1000\0"
17};
18
19// ---------------------------------------------------------------------------
20// Pillar: Engine — context compression, MCP tools, agent hooks, local UX
21// ---------------------------------------------------------------------------
22pub mod compound_lexer;
23pub mod core;
24pub mod daemon;
25pub mod daemon_autostart;
26pub mod daemon_client;
27pub mod dashboard;
28pub mod dropin;
29/// Low-level Apache in-process tool-execution façade for Engine embedders.
30pub mod engine;
31pub mod heatmap;
32pub mod hook_handlers;
33pub mod hooks;
34pub mod instructions;
35pub mod lsp;
36pub mod marked_block;
37pub mod mcp_stdio;
38pub mod ocla;
39pub mod rewrite_registry;
40pub mod rules_inject;
41pub mod server;
42pub mod shell;
43pub mod shell_hook;
44pub mod terminal_ui;
45pub mod token_report;
46pub mod tool_defs;
47pub mod tools;
48
49#[cfg(feature = "http-server")]
50#[allow(dead_code)]
51pub mod proxy;
52pub mod proxy_autostart;
53pub mod proxy_setup;
54
55// ---------------------------------------------------------------------------
56// Pillar: Cloud — hosted API, accounts, sync, billing edge
57// ---------------------------------------------------------------------------
58pub mod cloud_client;
59pub mod cloud_sync;
60#[cfg(feature = "http-server")]
61pub mod http_server;
62
63// ---------------------------------------------------------------------------
64// Shared — CLI, IPC, config, diagnostics, setup
65// ---------------------------------------------------------------------------
66pub mod cli;
67pub mod config_io;
68pub mod doctor;
69pub mod ipc;
70pub mod kits;
71pub mod report;
72pub mod setup;
73pub mod status;
74#[cfg(test)]
75pub(crate) mod test_env;
76pub mod uninstall;
77pub mod wrap;