Skip to main content

nika_engine/
lib.rs

1//! Nika Engine — Embeddable workflow execution engine
2//!
3//! ## Module Architecture
4//!
5//! ```text
6//! ┌──────────────────────────────────────────────────────────────┐
7//! │                        DOMAIN MODEL                          │
8//! │  ast/       YAML → Rust types (Workflow, Task, TaskAction)   │
9//! └──────────────────────────────────────────────────────────────┘
10//!                              │
11//!                              ▼
12//! ┌──────────────────────────────────────────────────────────────┐
13//! │                      APPLICATION LAYER                       │
14//! │  runtime/   DAG execution (Runner, TaskExecutor)             │
15//! │  dag/       DAG structure (Dag, validate)                    │
16//! │  binding/   Data binding (WithSpec, ResolvedBindings)        │
17//! └──────────────────────────────────────────────────────────────┘
18//!                              │
19//!                              ▼
20//! ┌──────────────────────────────────────────────────────────────┐
21//! │                    INFRASTRUCTURE LAYER                      │
22//! │  store/     State management (RunContext, TaskResult)         │
23//! │  event/     Event sourcing (EventLog, EventKind)             │
24//! │  provider/  LLM abstraction (rig-core wrapper)               │
25//! └──────────────────────────────────────────────────────────────┘
26//! ```
27
28// YAML parsing alias (serde-saphyr)
29pub use serde_saphyr as serde_yaml;
30
31// Source tracking for precise error locations
32pub mod source;
33
34// Public modules (used by main.rs, tests, or benches)
35pub mod ast;
36pub mod binding;
37pub mod config;
38pub mod core;
39pub mod dag;
40pub mod display;
41pub mod error;
42pub mod error_domains;
43pub mod event;
44pub use nika_init as init;
45pub mod mcp;
46pub mod media;
47pub mod new;
48pub mod provider;
49pub mod registry;
50pub mod runtime;
51pub mod store;
52pub mod tools;
53
54// Shared internal modules (pub for cross-crate access by nika-tui)
55pub mod io;
56pub mod util;
57
58// Feature-gated modules
59pub mod secrets;
60
61#[cfg(feature = "lsp")]
62pub mod lsp;
63
64// ── Public API re-exports ────────────────────────────────────
65
66// Source tracking
67pub use source::{ByteOffset, FileId, SourceFile, SourceRegistry, Span, Spanned};
68
69// Error types
70pub use error::NikaError;
71
72// AST types
73pub use ast::{
74    AgentParams, ExecParams, FetchParams, InferParams, InvokeParams, Task, TaskAction, Workflow,
75};
76
77// Runtime
78pub use runtime::{Runner, TaskExecutor};
79
80// DAG
81pub use dag::{validate_bindings, Dag, StableDag};
82
83// Binding
84pub use binding::{validate_task_id, BindingEntry, BindingSpec, ResolvedBindings};
85
86// Events
87pub use event::{list_traces, prune_traces, Event, EventKind, EventLog};
88
89// Store
90pub use store::{RunContext, TaskResult};
91
92// MCP
93pub use mcp::{McpClient, McpConfig};