Skip to main content

mdx_rust_core/
lib.rs

1//! Core primitives for the `mdx-rust` CLI.
2//!
3//! `mdx-rust-core` contains the optimizer, hardening engine, safety pipeline,
4//! registry, evaluation, ledger, and audit primitives used by the `mdx-rust`
5//! binary.
6//!
7//! ## Stability contract
8//!
9//! The supported product surface for `0.4.x` is the `mdx-rust` CLI. This crate
10//! is published so the CLI can be installed from crates.io and so advanced
11//! users can inspect the internal data structures, but the library API is not
12//! yet stable. Public items may change before `1.0`.
13//!
14//! The intentionally documented facade is the set of `pub use` exports below.
15//! Module paths are left public for the CLI and tests, but most modules are
16//! hidden from rustdoc because they are implementation detail for now.
17
18#[doc(hidden)]
19pub mod config;
20#[doc(hidden)]
21pub mod eval;
22#[doc(hidden)]
23pub mod hardening;
24#[doc(hidden)]
25pub mod hooks;
26#[doc(hidden)]
27pub mod ledger;
28#[doc(hidden)]
29pub mod llm;
30#[doc(hidden)]
31pub mod optimizer;
32#[doc(hidden)]
33pub mod policy;
34#[doc(hidden)]
35pub mod registry;
36#[doc(hidden)]
37pub mod runner;
38#[doc(hidden)]
39pub mod safety_pipeline;
40#[doc(hidden)]
41pub mod security;
42#[doc(hidden)]
43pub mod trace;
44
45/// Configuration loading and defaults used by the CLI.
46pub use config::Config;
47/// Dataset and scorer metadata used by optimizer reports.
48pub use eval::{
49    run_behavior_evals, BehaviorCommand, BehaviorCommandRecord, BehaviorEvalReport,
50    BehaviorEvalSpec, EvaluationDataset, EvaluationSample, ScorerMetadata,
51};
52/// Scoped Rust hardening engine for ordinary Rust modules. Unstable before `1.0`.
53pub use hardening::{
54    run_hardening, HardeningChangeSummary, HardeningConfig, HardeningMode, HardeningOutcome,
55    HardeningPolicyRecord, HardeningRiskSummary, HardeningRun, HardeningStatus, PolicyFindingMatch,
56    WorkspaceSummary,
57};
58/// Built-in lifecycle hook primitives. These are unstable before `1.0`.
59pub use hooks::{
60    evaluate_builtin_hook, HookAction, HookContext, HookDecision, HookPolicy, HookStage,
61};
62/// Experiment budget and ledger records. These are unstable before `1.0`.
63pub use ledger::{
64    split_dataset, DatasetSplit, ExperimentLedger, OptimizationBudget, PromptVariantRecord,
65};
66/// Optimizer entrypoint and run records. These are unstable before `1.0`.
67pub use optimizer::{
68    mechanical_score, run_optimization, AcceptedEditSummary, AuditPacket, AuditProvenance,
69    Candidate, EditStrategy, ModelProvenance, OptimizationRun, OptimizeConfig, ScoreProvenance,
70};
71/// Structured project policy records used by v0.4 hardening reports.
72pub use policy::{load_project_policy, PolicyCategory, PolicyRule, PolicySeverity, ProjectPolicy};
73/// Agent registry types used by CLI commands.
74pub use registry::{AgentContract, RegisteredAgent, Registry};
75/// Agent runner result and trace events. These are unstable before `1.0`.
76pub use runner::{run_agent, AgentRunResult, TraceEvent};
77/// Candidate safety pipeline. Direct use is unstable before `1.0`.
78pub use safety_pipeline::{
79    execute_candidate_edit, CandidateExecutionConfig, CandidateExecutionContext,
80    CandidateExecutionOutcome, SafetyRejection, SafetyRejectionKind,
81};
82/// Deterministic static audit reports.
83pub use security::{audit_agent, AuditFinding, AuditSeverity, SecurityAuditReport};
84/// Trace diagnosis records.
85pub use trace::{diagnose_run, FailureKind, FailureSignal, TraceDiagnosis};