Skip to main content

rskit/
lib.rs

1//! `rskit` — production Rust toolkit.
2//!
3//! This crate is a pure facade that re-exports `rskit-*` sub-crates from a
4//! single namespace. It contains no implementation logic.
5//!
6//! Always-on foundation crates:
7//!
8//! | Module | Extra crate |
9//! |--------|-------------|
10//! | `util` | `rskit-util` (domain-free foundation utilities) |
11//! | `errors` | `rskit-errors` (error types and result aliases) |
12//! | `fs` | `rskit-fs` (local filesystem primitives) |
13//! | `config` | `rskit-config` (adapter-oriented config loading) |
14//! | `logging` | `rskit-logging` (`tracing` subscriber setup) |
15//! | `resilience` | `rskit-resilience` (retry, timeout, circuit breaker) |
16//! | `provider` | `rskit-provider` (provider traits and tower bridge) |
17//! | `stream` | `rskit-stream` (broadcaster, sources, tasks, stream operators) |
18//! | `bootstrap` | `rskit-bootstrap` (app lifecycle orchestration) |
19//! | `component` | `rskit-component` (component lifecycle primitives) |
20//! | `worker` | `rskit-worker` (worker pools and typed events) |
21//! | `validation` | `rskit-validation` (field-level validation) |
22//!
23//! Optional feature flags control higher-level modules and adapters:
24//!
25//! | Feature | Extra crate |
26//! |---------|-------------|
27//! | `server` | `rskit-server` (service-facing server abstractions) |
28//! | `grpc`   | `rskit-grpc` (aligned gRPC client/server transport) |
29//! | `encryption` | `rskit-encryption` (encryption helpers) |
30//! | `http`   | `rskit-http` (framework-neutral HTTP abstractions) |
31//! | `httpclient` | `rskit-httpclient` (bounded HTTP client) |
32//! | `auth`   | `rskit-auth` (JWT, OIDC, password) |
33//! | `auth-jwt` | JWT support in `rskit-auth` |
34//! | `auth-oidc` | OIDC support in `rskit-auth` |
35//! | `di`     | `rskit-di` (dependency injection) |
36//! | `database` | `rskit-database` (core + memory backend) |
37//! | `cache`  | `rskit-cache` (core + memory adapter) |
38//! | `cache-fs` | Filesystem cache adapter in `rskit-cache` |
39//! | `cache-redis` | Redis cache adapter |
40//! | `messaging` | `rskit-messaging` (core abstractions + in-memory backend) |
41//! | `messaging-kafka` | `Kafka` messaging adapter |
42//! | `messaging-nats` | NATS messaging adapter |
43//! | `messaging-rabbitmq` | `RabbitMQ` messaging adapter |
44//! | `vectorstore` | `rskit-vectorstore` (core + memory backend) |
45//! | `vectorstore-qdrant` | Qdrant vector store adapter |
46//! | `observability` | `rskit-observability` (OpenTelemetry) |
47//! | `authz`  | `rskit-authz` (RBAC/ABAC) |
48//! | `security` | `rskit-security` (TLS/security configuration) |
49//! | `discovery` | `rskit-discovery` (service discovery) |
50//! | `sse`    | `rskit-sse` (Server-Sent Events) |
51//! | `dag`    | `rskit-dag` (DAG orchestration) |
52//! | `chain`  | `rskit-chain` (sequential execution) |
53//! | `process` | `rskit-process` (subprocess execution) |
54//! | `fs-watch` | Recursive filesystem change watching (`rskit-fs::watch`, `FsWatcher`) |
55//! | `stateful` | `rskit-stateful` (stateful accumulators) |
56//! | `version` | `rskit-version` (build metadata) |
57//! | `schema` | `rskit-schema` (JSON Schema generation/validation) |
58//! | `hook` | `rskit-hook` (typed event hooks) |
59//! | `genai` | `rskit-ai` (shared `GenAI` vocabulary) |
60//! | `llm`    | `rskit-llm` (LLM providers) |
61//! | `llm-openai` | `OpenAI` LLM adapter |
62//! | `llm-anthropic` | `Anthropic` LLM adapter |
63//! | `llm-ollama` | `Ollama` LLM adapter |
64//! | `llm-gemini` | `Gemini` LLM adapter |
65//! | `embedding` | `rskit-embedding` (embedding abstractions) |
66//! | `inference` | `rskit-inference` (model-serving abstractions) |
67//! | `inference-triton` | Triton inference adapter |
68//! | `inference-vllm` | vLLM inference adapter |
69//! | `inference-tgi` | Hugging Face TGI inference adapter |
70//! | `prompt` | Prompt schema helpers from `rskit-ai` |
71//! | `skill` | `rskit-skill` (skill manifests and registries) |
72//! | `tool` | `rskit-tool` (tool contracts) |
73//! | `agent` | `rskit-agent` (agentic turn-loop engine) |
74//! | `mcp` | `rskit-mcp` (tool registry to Model Context Protocol bridge) |
75//! | `storage` | `rskit-storage` (File I/O, storage) |
76//! | `media`  | `rskit-media` (media types, pipeline) |
77//! | `media-ffmpeg` | `rskit-media-ffmpeg` (`FFmpeg` backend) |
78//! | `media-image`  | `rskit-media-image` (image processing) |
79//! | `media-audio`  | `rskit-media-audio` (pure Rust audio analysis) |
80//! | `media-full` | `FFmpeg` + image + audio backends |
81//! | `storage-s3` | `S3` storage backend |
82//! | `storage-gcs` | GCS storage backend |
83//! | `cli`    | `rskit-cli` (CLI helpers) |
84//! | `git`    | `rskit-git` (Git automation) |
85//! | `dataset` | `rskit-dataset` (dataset collection) |
86//! | `bench`  | `rskit-bench` (ML benchmarking) |
87//! | `full`   | all features |
88//!
89//! Test helpers live in `rskit-testutil` and should be added directly as a
90//! `dev-dependency`; they are intentionally not part of this production facade.
91//!
92//! # Quick start
93//!
94//! ```toml
95//! [dependencies]
96//! rskit-suite = { version = "0.2.0-alpha.2", features = ["full"] }
97//! ```
98//!
99//! Or enable only the optional modules you need — for example recursive,
100//! debounced filesystem-tree change watching:
101//!
102//! ```toml
103//! [dependencies]
104//! rskit-suite = { version = "0.2.0-alpha.2", features = ["fs-watch"] }
105//! ```
106
107#![warn(missing_docs)]
108
109// ── Always-on sub-crate facades ──────────────────────────────────────────────
110
111/// Decoupled, domain-free utilities (strings, collections, env, etc).
112pub use rskit_util as util;
113
114/// Error types, `ErrorCode`, `AppError`, `AppResult`.
115pub use rskit_errors as errors;
116
117/// Local filesystem primitives.
118pub use rskit_fs as fs;
119
120/// Adapter-oriented config loading.
121pub use rskit_config as config;
122
123/// `tracing` subscriber setup.
124pub use rskit_logging as logging;
125
126/// Retry, circuit breaker, bulkhead, rate limiter — and tower layers.
127pub use rskit_resilience as resilience;
128
129/// Provider traits + tower bridge.
130pub use rskit_provider as provider;
131
132/// `futures::Stream` extension operators, broadcaster, sources, cancellable tasks.
133pub use rskit_stream as stream;
134
135/// App lifecycle orchestration.
136pub use rskit_bootstrap as bootstrap;
137
138/// Component lifecycle primitives: `Component`, `Registry`, health, and state.
139pub use rskit_component as component;
140
141/// Worker pool, `Handler` trait, typed events.
142pub use rskit_worker as worker;
143
144/// Fluent field-level validation.
145pub use rskit_validation as validation;
146
147/// Sequential chain execution utilities.
148#[cfg(feature = "chain")]
149pub use rskit_chain as chain;
150
151/// Safe subprocess execution helpers.
152#[cfg(feature = "process")]
153pub use rskit_process as process;
154
155/// Stateful accumulators and keyed managers.
156#[cfg(feature = "stateful")]
157pub use rskit_stateful as stateful;
158
159/// Build-time version and git metadata.
160#[cfg(feature = "version")]
161pub use rskit_version as version;
162
163/// JSON Schema generation and validation helpers.
164#[cfg(feature = "schema")]
165pub use rskit_schema as schema;
166
167/// Typed event hook registry and event bus primitives.
168#[cfg(feature = "hook")]
169pub use rskit_hook as hook;
170
171// ── Feature-gated sub-crate facades ──────────────────────────────────────────
172
173/// Service-facing server abstractions and lifecycle-managed transports.
174#[cfg(feature = "server")]
175pub use rskit_server as server;
176
177/// Aligned gRPC transport namespace (opt-in via `grpc` feature).
178#[cfg(feature = "grpc")]
179pub use rskit_grpc as grpc;
180
181/// Encryption helpers (opt-in via `encryption` feature).
182#[cfg(feature = "encryption")]
183pub use rskit_encryption as encryption;
184
185/// Framework-neutral HTTP abstractions and Tower adapters.
186#[cfg(feature = "http")]
187pub use rskit_http as http;
188
189/// Async HTTP client with auth, retries, and error handling.
190#[cfg(feature = "httpclient")]
191pub use rskit_httpclient as httpclient;
192
193/// JWT, OIDC, password hashing, and request-context auth helpers.
194#[cfg(feature = "auth")]
195pub use rskit_auth as auth;
196
197/// Lightweight runtime dependency injection container.
198#[cfg(feature = "di")]
199pub use rskit_di as di;
200
201/// Database contracts with in-memory default and adapter registry.
202#[cfg(feature = "database")]
203pub use rskit_database as database;
204
205/// Cache contracts with in-memory default and adapter registry.
206#[cfg(feature = "cache")]
207pub use rskit_cache as cache;
208
209/// Redis cache adapter.
210#[cfg(feature = "cache-redis")]
211pub use rskit_cache_redis as cache_redis;
212
213/// Message broker abstractions and in-memory backend.
214#[cfg(feature = "messaging")]
215pub use rskit_messaging as messaging;
216
217/// Kafka messaging adapter.
218#[cfg(feature = "messaging-kafka")]
219pub use rskit_messaging_kafka as messaging_kafka;
220
221/// NATS messaging adapter.
222#[cfg(feature = "messaging-nats")]
223pub use rskit_messaging_nats as messaging_nats;
224
225/// `RabbitMQ` messaging adapter.
226#[cfg(feature = "messaging-rabbitmq")]
227pub use rskit_messaging_rabbitmq as messaging_rabbitmq;
228
229/// OpenTelemetry tracing, metrics, and context propagation.
230#[cfg(feature = "observability")]
231pub use rskit_observability as observability;
232
233/// RBAC and ABAC authorization engine.
234#[cfg(feature = "authz")]
235pub use rskit_authz as authz;
236
237/// Shared TLS and security configuration.
238#[cfg(feature = "security")]
239pub use rskit_security as security;
240
241/// Service discovery with load balancing strategies.
242#[cfg(feature = "discovery")]
243pub use rskit_discovery as discovery;
244
245/// Server-Sent Events bus with axum integration.
246#[cfg(feature = "sse")]
247pub use rskit_sse as sse;
248
249/// DAG task orchestrator with parallel execution.
250#[cfg(feature = "dag")]
251pub use rskit_dag as dag;
252
253/// Shared `GenAI` vocabulary.
254#[cfg(feature = "genai")]
255pub use rskit_ai as genai;
256
257/// LLM provider abstractions and shared chat/completion contracts.
258#[cfg(feature = "llm")]
259pub use rskit_llm as llm;
260
261/// `OpenAI` LLM adapter.
262#[cfg(feature = "llm-openai")]
263pub use rskit_llm_openai as llm_openai;
264
265/// Anthropic LLM adapter.
266#[cfg(feature = "llm-anthropic")]
267pub use rskit_llm_anthropic as llm_anthropic;
268
269/// Ollama LLM adapter.
270#[cfg(feature = "llm-ollama")]
271pub use rskit_llm_ollama as llm_ollama;
272
273/// Gemini LLM adapter.
274#[cfg(feature = "llm-gemini")]
275pub use rskit_llm_gemini as llm_gemini;
276
277/// Embedding provider abstractions and types.
278#[cfg(feature = "embedding")]
279pub use rskit_embedding as embedding;
280
281/// Model-serving runtime inference abstractions.
282#[cfg(feature = "inference")]
283pub use rskit_inference as inference;
284
285/// Triton `KServe` v2 HTTP inference adapter.
286#[cfg(feature = "inference-triton")]
287pub use rskit_inference_triton as inference_triton;
288
289/// vLLM REST inference adapter.
290#[cfg(feature = "inference-vllm")]
291pub use rskit_inference_vllm as inference_vllm;
292
293/// Hugging Face TGI REST inference adapter.
294#[cfg(feature = "inference-tgi")]
295pub use rskit_inference_tgi as inference_tgi;
296
297/// Prompt templates and output schema contracts.
298#[cfg(feature = "prompt")]
299pub use rskit_ai::prompt;
300
301/// Skill manifests, loaders, registries, and verification contracts.
302#[cfg(feature = "skill")]
303pub use rskit_skill as skill;
304
305/// Tool schemas, callable contracts, and metadata wrappers.
306#[cfg(feature = "tool")]
307pub use rskit_tool as tool;
308
309/// Agentic loop orchestration over providers, tools, and hooks.
310#[cfg(feature = "agent")]
311pub use rskit_agent as agent;
312
313/// Bridge between the rskit tool registry and Model Context Protocol.
314#[cfg(feature = "mcp")]
315pub use rskit_mcp as mcp;
316
317/// File I/O, storage backends, MIME detection, temp files.
318#[cfg(feature = "storage")]
319pub use rskit_storage as storage;
320
321/// Amazon S3 and S3-compatible (`MinIO`, `LocalStack`) storage backend.
322#[cfg(feature = "storage-s3")]
323pub use rskit_storage_s3 as storage_s3;
324
325/// Google Cloud Storage backend.
326#[cfg(feature = "storage-gcs")]
327pub use rskit_storage_gcs as storage_gcs;
328
329/// Vector store contracts with in-memory default and adapter registry.
330#[cfg(feature = "vectorstore")]
331pub use rskit_vectorstore as vectorstore;
332
333/// Qdrant vector store adapter.
334#[cfg(feature = "vectorstore-qdrant")]
335pub use rskit_vectorstore_qdrant as vectorstore_qdrant;
336
337/// Media types, codec/format registry, pipeline builder.
338#[cfg(feature = "media")]
339pub use rskit_media as media;
340
341/// `FFmpeg` CLI backend for video/audio processing.
342#[cfg(feature = "media-ffmpeg")]
343pub use rskit_media_ffmpeg as media_ffmpeg;
344
345/// Native image processing backend using the `image` crate.
346#[cfg(feature = "media-image")]
347pub use rskit_media_image as media_image;
348
349/// Pure Rust audio analysis backend.
350#[cfg(feature = "media-audio")]
351pub use rskit_media_audio as media_audio;
352
353/// CLI helpers: progress bars, cancellation tokens, output formatting.
354#[cfg(feature = "cli")]
355pub use rskit_cli as cli;
356
357/// Git operations: repository management, commits, branches, tags, diffs.
358#[cfg(feature = "git")]
359pub use rskit_git as git;
360
361/// Dataset collection: sources, transforms, targets, manifest caching.
362#[cfg(feature = "dataset")]
363pub use rskit_dataset as dataset;
364
365/// ML benchmarking: evaluators, metrics, reports, visualization.
366#[cfg(feature = "bench")]
367pub use rskit_bench as bench;
368
369// ── Convenience re-exports at root ──────────────────────────────────────────
370
371pub use rskit_bootstrap::{App, AppBuilder};
372pub use rskit_component::{
373    Component, Health, HealthStatus, LazyComponent, Registry, RegistryConfig, State, StopResult,
374};
375pub use rskit_config::{AppConfig, ConfigLoader, ServiceConfig};
376pub use rskit_errors::{AppError, AppResult, ErrorCode};
377pub use rskit_logging::{LoggingGuard, init_logging, init_logging_env};
378pub use rskit_provider::traits::{Provider, RequestResponse, Sink};
379pub use rskit_resilience::{CircuitBreaker, RateLimiter, RetryPolicy};
380pub use rskit_worker::{Handler, Pool, PoolConfig, TaskHandle};