Skip to main content

ijima_server/
lib.rs

1// Copyright (C) 2026 Industrial Algebra
2// SPDX-License-Identifier: Apache-2.0
3
4//! # ijima-server
5//!
6//! HTTP daemon and store backends for the
7//! [Ijima](https://github.com/Industrial-Algebra/Ijima) centralized
8//! agentic memory backend.
9//!
10//! This crate is the Rust successor to the pi-mempalace fork's
11//! `pi-mempalace-server.ts` remote backend. It owns the store backends
12//! (SurrealDB primary — see `docs/DESIGN.md` D6), the embedding/vector
13//! index, the JSON-RPC-style HTTP surface that harnesses speak, and the
14//! systemd-friendly daemon entry point.
15//!
16//! The transport-free type contract — including the [`ijima_core::Store`]
17//! trait this crate implements — lives in [`ijima_core`]; the extraction
18//! engine lives in [`ijima_miner`]; harness adapters live in
19//! [`ijima_client`].
20//!
21//! ## Features
22//!
23//! - `std` (default): Standard library support.
24//! - `http` (default): axum-based HTTP/JSON server + the `ijima` binary.
25//!   Disable to embed the store as a library without spawning a server.
26//! - `backend-surreal`: SurrealDB store backend (primary). Embedded
27//!   `kv-mem` engine; server mode is a future addition.
28//! - `backend-sqlite`: SQLite store backend — **migration only**. Reads
29//!   the live pi-mempalace corpus once during import.
30//! - `embeddings-candle`: candle (Hugging Face Rust ML) embedding backend.
31//!   The IA-standard default, consistent with Quantizon. Builds candle
32//!   on CPU; GPU/CUDA acceleration is a future opt-in.
33//! - `server-auth`: Schubert proof-carrying capability tokens for both
34//!   authentication and authorization on Gr(4,8). Loads
35//!   [`policy/policy.toml`](https://github.com/Industrial-Algebra/Ijima).
36//!   When off, the store runs unauthenticated (embedded/tests).
37//!
38//! ## Status
39//!
40//! Scaffolded — store backends, schema import, and HTTP routes are
41//! filled in test-first. See `docs/HANDOFF.md` and `docs/DESIGN.md`.
42
43#![deny(unsafe_code)]
44#![cfg_attr(not(feature = "std"), no_std)]
45
46#[cfg(feature = "backend-surreal")]
47pub mod backend_surreal;
48
49#[cfg(feature = "backend-surreal")]
50pub use backend_surreal::SurrealStore;
51
52/// One-time corpus migration from legacy SQLite stores. Behind
53/// `backend-sqlite` (migration-only read path, DESIGN D6).
54#[cfg(feature = "backend-sqlite")]
55pub mod migration;
56
57#[cfg(feature = "embeddings-candle")]
58pub mod embeddings_candle;
59
60#[cfg(feature = "server-auth")]
61pub mod auth;
62
63#[cfg(feature = "server-auth")]
64pub mod key_store;
65
66#[cfg(feature = "server-auth")]
67pub use auth::{AuthenticatedPrincipal, IjimaAuth};
68
69#[cfg(feature = "http")]
70pub mod api;
71
72#[cfg(all(feature = "http", feature = "server-auth"))]
73pub mod extractor;
74
75/// Schubert geometric rate limiting (Phase 3.4). Behind `rate-limit`.
76#[cfg(feature = "rate-limit")]
77pub mod rate_limit;
78
79/// Redaction/scrub filter for the personal → shared promotion boundary (D9 §2).
80pub mod redaction;
81
82/// Doctrine seed-pack format parser + ingest client (D9).
83pub mod doctrine;
84
85/// Mining trigger orchestration (ADR M1/M3/M7). Behind `mining`.
86#[cfg(feature = "mining")]
87pub mod mining_pipeline;
88
89#[cfg(feature = "http")]
90pub mod server;