Skip to content

armgit / xerj

Public Imported from GitHub
0

AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.

2.5 KB
Raw Blame
//! Xerj Console backend API.
//!
//! Mounted at `/_xerj-console/api/v1/*` from the bundled xerj binary. Implements
//! the surface designed in `engine/docs/xerj-console-backend/API_DESIGN_v1.md` —
//! authentication (passkeys, magic links), cluster awareness, preferences,
//! dashboards, saved views, and the pluggable data-source layer.
//!
//! ## Module layout
//!
//! Boot + cluster info:
//! - [`error`], [`response`], [`time`] — primitives.
//! - [`state`] — `ConsoleState` shared into every handler.
//! - [`indices`] — `.xerj_*` system index names + schemas.
//! - [`bootstrap`] — first-launch detection, master-key persistence,
//!   magic-link printout.
//! - [`cluster`] — `/cluster/info`.
//!
//! Auth:
//! - [`auth`] — magic-link redeem, passkey enrol, login, sessions,
//!   audit, rate limits, `/me`, passkey CRUD.
//!
//! User-state (drop the localStorage hacks):
//! - [`prefs`] — `GET/PUT /prefs`.
//! - [`dashboards`] — full CRUD with If-Match etag concurrency.
//! - [`seed`] — first-launch materialisation of the built-in dashboards
//!   ([`seed::BUILTIN_DASHBOARD_COUNT`] of them) as editable backend data
//!   (idempotent, revisioned).
//! - [`views`] — saved views CRUD.
//! - [`data_sources`] — `/data-sources/connections` + descendants
//!   (read-only MVP backed by an auto-provisioned `built-in` adapter).
//! - [`graph`] — session-authorized Second-Brain graph reads (`/graph/*`,
//!   issue #936): brains discovery, `ego`, `overview`, brain-scoped edges and
//!   nodes searches.
//!
//! Coming after RC: `/auth/magic/issue`, `/auth/api-tokens`, `/users`
//! admin surface, `/cluster/raft*`, dashboards/views SSE streams, write
//! paths for /data-sources/connections (alongside encryption-at-rest
//! for connection secrets).
//!
//! ## Why this is a separate crate
//!
//! Xerj Console is its own product. xerj is one possible backend (the default
//! in v1.0); the crate must extract cleanly post-v1.0 to target ES,
//! OpenSearch, Prometheus, Postgres, or remote xerj.

#![allow(clippy::module_name_repetitions)]

pub mod auth;
pub mod bootstrap;
pub mod client_ip;
pub mod cluster;
pub mod dashboards;
pub mod data_sources;
pub mod error;
pub mod graph;
pub mod indices;
pub mod knowledge;
pub mod prefs;
pub mod response;
pub mod router;
pub mod seed;
pub mod spa;
pub mod state;
pub mod time;
pub mod views;

pub use client_ip::ClientIp;
pub use error::{ConsoleApiError, ConsoleResult};
pub use router::xerj_console_router;
pub use state::{public_bind_host, ConsoleState, RpConfig};