refactor(core): split jcode-app-core into jcode-base + jcode-app-core (Phase B)
Split the 191K-loc application core into two separately-compiled rustc units along its internal library dependency DAG: - jcode-base (foundational layer, ~57K nontest loc / 58 modules): provider, auth, config, session, message, memory, telemetry, prompt, storage, and their supporting leaves. This is the downward-closed set the upper layer depends on (zero non-test edges back up to app-core). - jcode-app-core (upper layer, ~77K nontest loc): the server/tool/agent SCC plus presentation-adjacent leaves (ambient, notifications, channel, external_auth, replay, setup_hints, update, ...). It re-exports jcode-base via , so every existing path keeps resolving across both crates and the root jcode facade. Measured peak rustc VmHWM (selfdev): baseline monolith 3.18 GiB Phase A app-core 2.643 GiB Phase B jcode-base 1.505 GiB Phase B jcode-app-core 1.621 GiB root jcode (cli+tui) 1.407 GiB Largest compilation unit: 3.18 -> 1.62 GiB (-49%), and the three big units are now balanced (1.41-1.62 GiB), well under the 15 GiB/no-swap OOM threshold even with parallel jobs. Mechanics: - New crate crates/jcode-base (deps cloned from app-core; owns the jemalloc + embeddings features since process_memory/embedding moved here; pdf stays in app-core with tool/read.rs). Dev-dependency on jcode-app-core for the single cross-layer test (provider/gemini_tests.rs builds a tool::Registry); Cargo permits dev-dependency cycles and they do not affect the lib build. - app-core forwards jemalloc/embeddings features to jcode-base; keeps pdf. - git mv of 58 base modules (+ their #[path]-included *_tests.rs files, memory_prompt.rs, session_tests/) preserving history. - Promote the cross-boundary provider state cluster (ProviderRuntimeState, ProviderStateEvent, ProviderModelSelectionSource + observed/apply/ selected_model/selection_generation/user_selected_after) and process_title::set_server_title from pub(crate) to pub. - Move the mission-continuation prompt asset's accessor into base's prompt module (pub const MISSION_CONTINUATION_TEMPLATE) since the asset lives with the other prompt templates; mission.rs (app-core) now references it. Build: cargo check/build -p jcode --bin jcode exit 0; binary runs.
J
jeremy committed
4aec863e2481c33ce7eb1beed98a935f92c90d08
Parent: 4dd91a9