Expand description
nexus-chat-core (lib crate nexus_core): the engine behind the nexus
TUI and (later) the nexus host API. Owns all domain logic — sessions, research pipeline, provider
clients, tools, files, skills, SQLite state — with no knowledge of the
terminal UI. Phase 2e moved every piece of view state (composer, popup
chrome, render caches, theme) into the TUI crate’s AppView.
Doc-lint allows: the domain surface the TUI/CLI/host drive directly
(Db, provider, config, App’s event handlers) is still pub, so the
per-item doc lints would be noise until the Phase 4 host API pass
privatizes it. They’re crate-scoped deliberately — the 2e goal (zero
TUI deps) is unaffected.
Modules§
- app
- app_
templates - Embedded starter scaffolds for the
apptool’sinitaction. - appserver
- Tiny always-on static file server for model-created apps. Serves
GET /<space>/<app>/<path…>fromspaces/<space>/apps/<app>/<path…>, localhost only, GET/HEAD only. Hand-rolled on tokio — no framework dep for ~150 lines of static serving. - citations
- Pure parsing for report citations: the trailing
Sources:(or## Sources) list research/web-mode replies end with (seeWRITER_PROMPT/SEARCHER_PROMPTinapp/research.rsandweb_mode_clauseinapp/chat.rs), and the[n]inline markers that reference it. Parsing is data — it lives here in core. Styling the markers into terminal colors is rendering — it lives in the TUI crate (ui/citations_style.rs). - config
- db
- extract
- Import-time text extraction for space filesets: plain text as-is, PDF via pdf-extract, office formats (pptx/docx/xlsx) by scanning their zipped XML for text tags — same string-scanning style as tools.rs’s DDG HTML parser.
- host
- Phase 4
nexus host— the daemon surface. - markdown
- Plain-text markdown helpers for the core crate:
to_plain(markers stripped, for clipboard copy) and the GFM pipe-table splitter shared with the TUI’s styled renderer (crates/tui/src/ui/markdown.rs). This module is deliberately free of ratatui/tui-markdown — styled rendering lives in the TUI crate. - provider
- skills
- Agent Skills on disk.
- space
- sync
- Phase 3 merge engine: changeset build/apply, per-table sync rules, cursor + ack bookkeeping, and the file blob channel.
- tools
- Tools the model can call mid-response, advertised as nine consolidated
names (
batch,skills,scripts,search,fetch_url,research_lookup,files,app,media) that dispatch onto a larger set of specialized implementations below. Concrete (no trait) — there’s exactly one implementation and no need for one yet. - update
- Startup update check + auto-update: compare the running version against
the latest release on crates.io and, when a newer one exists, install it
via
cargo installin a detached background process so the TUI boots immediately and the new binary is live on the next launch. Best-effort by design — any failure (offline, index hiccup, missing cargo) is silent or falls back to a plain notice; the app never blocks or fails startup on it.NEXUS_NO_UPDATE=1opts out of the auto-install.
Functions§
- boot
- One bootstrap for every frontend (TUI, CLI, Phase 4 host): credentials →
space → db → appserver → toolbox. This is what
main.rsandcli.rs::build_appboth used to hand-roll.