feat(ai): MEAI Phase 2 — policy, sanitize, audit middleware - #232
Draft
IanFrelinger wants to merge 3 commits into
Draft
feat(ai): MEAI Phase 2 — policy, sanitize, audit middleware#232IanFrelinger wants to merge 3 commits into
IanFrelinger wants to merge 3 commits into
Conversation
Map current model invocation, sanitization, audit, policy packs, RAG, and host DI seams to proposed Microsoft.Extensions.AI concepts for the governed pipeline migration. Co-authored-by: IanFrelinger <IanFrelinger@users.noreply.github.com>
Add Nexo.AI.Pipeline with keyed local:ollama and local:onnx chat clients, wire optional registration through hosting Phase 13b when Nexo:UseMeaiPipeline is enabled (default off), and cover registration with FakeChatClient tests. Legacy IProviderFactory path remains default. Co-authored-by: IanFrelinger <IanFrelinger@users.noreply.github.com>
Introduce UseNexoGovernance with fixed PolicyGate → Sanitizing → Auditing order on every keyed IChatClient, plus unit tests for deny short-circuit, PII redaction, audit outcomes, and composition/architecture guarantees. Co-authored-by: IanFrelinger <IanFrelinger@users.noreply.github.com>
This was referenced Jul 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 2 of the MEAI migration: every keyed
IChatClientregistered viaAddNexoMeaiPipelineis wrapped with the fixed governance stack PolicyGate → Sanitizing → Auditing → provider throughUseNexoGovernance().This branch stacks on Phase 0 + Phase 1 work. Prefer merging #230 → #231 → this PR, or take this PR alone (includes prior phases).
Changes
src/Nexo.AI.Pipeline/Governance/:PolicyGateChatClient,SanitizingChatClient,AuditingChatClientPolicyViolationException, sanitize dispositions, ports + defaultsUseNexoGovernance(targetKey)— enforced composition orderAddNexoMeaiPipelinealways applies governance (raw providers never DI-public)local:*allowed + sanitize Pass;cloud:*denied unless allow-listed; cloud sanitize = block-on-secret / redact-on-PIITesting
Testing strategy (blast radius)
Nexo.Tests.AI.PipelineChecklist
AddNexoMeaiPipelineNext
Phase 3:
RoutingChatClientwith local-first policy × availability matrix.