1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//! eggsact - Deterministic MCP and In-Process Utility Tools for Coding Agents
//!
//! A high-performance Rust crate providing 86 deterministic tools across 23 categories
//! for AI coding agents: math evaluation, text processing, JSON analysis, regex validation,
//! path operations, Unicode safety, shell command preflight, config inspection, and more.
//! Includes a full MCP (Model Context Protocol) server and an in-process agent API.
//!
//! # Quick Start
//!
//! ```
//! use eggsact::{run, evaluate};
//!
//! // Natural language math — returns (result, type)
//! let (result, _typ) = run("thirty plus five").unwrap();
//! assert_eq!(result, "35");
//!
//! // Direct math evaluation
//! let (result, _typ) = evaluate("2 ** 10").unwrap();
//! assert_eq!(result, "1024");
//! ```
//!
//! # In-Process Agent API
//!
//! Call tools directly without starting an MCP server:
//!
//! ```
//! use eggsact::agent::{ToolRegistry, Profile};
//!
//! let registry = ToolRegistry::default();
//! let response = registry.call_json("text_equal", serde_json::json!({
//! "a": "hello",
//! "b": "hello",
//! })).unwrap();
//! assert!(response.ok);
//! ```
//!
//! # Typed Preflight
//!
//! Use typed wrappers for common workflows:
//!
//! ```
//! use eggsact::preflight::{ConfigPreflight, ConfigPreflightInput, ConfigFormat};
//!
//! let input = ConfigPreflightInput {
//! text: r#"{"key": "value"}"#.to_string(),
//! format: ConfigFormat::Json,
//! schema: None,
//! strict: false,
//! };
//! let output = ConfigPreflight::run(&input).unwrap();
//! assert!(output.valid);
//! assert!(!output.machine_code.is_empty());
//! ```
//!
//! Wrappers return `Result<Output, PreflightError>`. Missing mandatory fields
//! produce `ContractViolation` errors instead of silently defaulting.
//!
//! # MCP Server
//!
//! Run as an MCP server via stdio:
//!
//! ```bash
//! eggsact --mcp
//! ```
//!
//! The server accepts JSON-RPC 2.0 requests and provides MCP tools for math,
//! text processing, structured data, paths, Unicode safety, and more.
pub
// Re-export commonly used functions
pub use evaluate;
pub use evaluate_with_context;
pub use run;
pub use run_with_context;
pub use split_at_operators;
pub use EvalContext;