Skip to main content

mockforge_intelligence/
lib.rs

1// Some ai_response helpers are themselves deprecated in favor of
2// mockforge-template-expansion; internal tests still reference them.
3#![allow(deprecated)]
4
5//! AI-powered intelligence for MockForge
6//!
7//! This crate contains modules extracted from `mockforge-core` related to
8//! intelligent behavior, AI response generation, and behavioral cloning.
9//!
10//! Currently migrated:
11//! - `ai_response`: Typed AI response generation helpers
12//! - `behavioral_cloning`: Probability models, sequence learning, edge amplification
13//! - `pr_generation`: GitHub/GitLab PR generation client (Issue #562 phase 1 —
14//!   moved out of `mockforge-core` because it only depends on
15//!   `mockforge_foundation::Error`, no other core internals)
16//! - `intelligent_behavior`: LLM-driven behavior model, persona-aware response
17//!   generation, OpenAPI-backed example/rule generation (Issue #562 phase 2 —
18//!   the AI cluster's leaf module, depends only on `mockforge-openapi` and
19//!   `mockforge-foundation`)
20//! - `threat_modeling`: LLM-driven security analyzer (DoS / PII / schema /
21//!   error / threat / remediation generators) for the contract-drift pillar
22//!   (Issue #562 phase 3). Depends only on sibling `intelligent_behavior` +
23//!   `mockforge-openapi` + `mockforge-foundation`.
24//! - `ai_contract_diff`: LLM-assisted OpenAPI diff with semantic analysis,
25//!   confidence scoring, recommendations, and correction proposals (Issue #562
26//!   phase 4). Records `ai_generation` pillar usage via the now-foundation
27//!   `pillar_tracking` global, so the analytics dashboard keeps reflecting
28//!   contract-diff activity unchanged.
29//! - `contract_validation`: OpenAPI-spec-to-response contract validator (Issue
30//!   #562 phase 5). Single file; depends only on `serde` + `mockforge-openapi`
31//!   + `mockforge-foundation::pillar_tracking`.
32//! - `failure_analysis`: LLM-driven failure context + narrative generator
33//!   (Issue #562 phase 5). Depends only on sibling `intelligent_behavior`.
34//! - `behavioral_economics`: Declarative + scriptable rule engine that makes
35//!   mocks react to pressure, load, pricing, fraud, and customer segments
36//!   (Issue #562 phase 8). Self-contained — the only core-side dep was
37//!   `crate::Result`, now sourced from `mockforge-foundation` directly.
38//! - `incidents`: AI-coupled pieces of drift-incident management — semantic
39//!   incident manager (built on `ai_contract_diff::semantic_analyzer`) and
40//!   Jira/Slack/webhook integrations (Issue #562 phase 9). The structural
41//!   `IncidentManager` and in-memory `IncidentStore` stay in `mockforge-core`;
42//!   the shared types (`DriftIncident`, `IncidentSeverity`, ...) live in
43//!   `mockforge_foundation::incidents_types`. Core re-exports this module so
44//!   the legacy `mockforge_core::incidents::{semantic_manager, integrations,
45//!   slack_formatter, jira_formatter}` paths keep resolving.
46
47pub mod ai_contract_diff;
48pub mod ai_response;
49pub mod ai_studio;
50pub mod behavioral_cloning;
51pub mod behavioral_economics;
52pub mod contract_validation;
53/// Postgres pool wrapper used by HTTP handlers that persist drift
54/// budgets / incidents / consumer contracts. Moved here from
55/// `mockforge_http::database` under #555 (prereq for handler moves —
56/// once handlers leave `mockforge-http`, they pick up this dep without
57/// re-introducing a cycle). Gated by the `database` feature.
58#[cfg(feature = "database")]
59pub mod database;
60pub mod failure_analysis;
61/// HTTP handlers for AI-coupled features. New in #555 phase 2 — see
62/// `handlers/mod.rs` for migration progress.
63pub mod handlers;
64pub mod incidents;
65pub mod intelligent_behavior;
66pub mod pr_generation;
67pub mod reality;
68pub mod threat_modeling;
69pub mod voice;