Skip to main content

kindling_service/
lib.rs

1//! In-process kindling orchestration.
2//!
3//! [`KindlingService`] exposes capsule lifecycle, observation append,
4//! retrieval, and pin management over the already-ported store, provider, and
5//! filter crates. Consumed in-process by the daemon (`kindling-server`), by the
6//! CLI, and directly by Rust integrators (e.g. anvil headless flows).
7//!
8//! Ports `KindlingService` from
9//! `packages/kindling-core/src/service/kindling-service.ts`. Two deliberate
10//! deviations from the TS service:
11//!
12//! 1. **Result-typed errors.** Every method returns [`ServiceResult`] instead
13//!    of throwing; validation failures and lifecycle violations are structured
14//!    [`ServiceError`] variants.
15//! 2. **Service-boundary secret masking.** [`KindlingService::append_observation`]
16//!    runs observation content through `kindling_filter::mask_secrets` before
17//!    storing, so non-Rust consumers cannot bypass secret filtering. (Masking
18//!    only — content truncation stays a hook-layer concern.)
19//!
20//! Export/import/bundle methods (deferred from PORT-006) are implemented here
21//! by PORT-012; see [`export`]. They are byte-compatible with the TS bundle
22//! format so exports round-trip across the two implementations.
23
24mod context;
25mod error;
26mod export;
27pub mod filter;
28mod service;
29mod validation;
30
31pub use context::{PreCompactContext, ResolvedPin, SessionStartContext};
32pub use error::{ServiceError, ServiceResult};
33pub use export::{
34    ExportBundle, ExportBundleOptions, ExportDataset, ExportStats, ImportOptions, ImportResult,
35    BUNDLE_VERSION,
36};
37pub use service::{
38    AppendObservationOptions, AppendOutcome, CloseCapsuleOptions, CreatePinOptions,
39    KindlingService, OpenCapsuleOptions,
40};