Skip to content

feat: .NET SDK Feature Parity with Python/JS - #3

Merged
dbhurley merged 5 commits into
mainfrom
feature/parity-update
Feb 18, 2026
Merged

dbhurley merged 5 commits into
mainfrom
feature/parity-update

Conversation

@dbhurley

Copy link
Copy Markdown
Contributor

Summary

Brings the .NET SDK to feature parity with the Python and JavaScript SDKs.

Changes

New Typed Exceptions

  • MeshGuardException - Base exception with TraceId support
  • AuthenticationException - Raised on 401 errors
  • PolicyDeniedException - Raised on 403 with full context (action, policy, rule, reason)
  • RateLimitException - Raised on 429 errors

Core Governance APIs

  • CheckAsync(action, resource) - Returns PolicyDecision (never throws on deny)
  • EnforceAsync(action, resource) - Throws PolicyDeniedException on deny
  • GovernAsync<T>(action, fn) - Execute function only if allowed (lambda pattern)

Admin APIs (require admin token)

  • ListAgentsAsync() - List all agents
  • CreateAgentAsync(options) - Create new agent
  • UpdateAgentAsync(agentId, updates) - Update existing agent
  • RevokeAgentAsync(agentId) - Delete/revoke agent
  • ListPoliciesAsync() - List all policies
  • GetAuditLogAsync(options) - Query audit log entries

Proxy Request Methods

  • GetAsync(path, action)
  • PostAsync(path, action, content)
  • PostJsonAsync<T>(path, action, body)
  • PutAsync(path, action, content)
  • PutJsonAsync<T>(path, action, body)
  • DeleteAsync(path, action)

Health & Info

  • GetHealthAsync() - Get health status
  • IsHealthyAsync() - Quick boolean check

Semantic Kernel Integration

  • MeshGuardFilter - IFunctionInvocationFilter implementation
  • AddMeshGuardGovernance() - DI extension for IKernelBuilder
  • Configurable action format, audit logging, throw-on-deny behavior

Other Improvements

  • TraceId support for request correlation
  • Full XML documentation comments
  • Backward compatibility via [Obsolete] attributes on old types
  • Unit tests for exceptions, models, and client

Testing

Unit tests added (requires dotnet to run):

dotnet test

Breaking Changes

None - all existing APIs preserved with [Obsolete] warnings to guide migration.

Closes #9

Changes:
- Add typed exceptions (AuthenticationException, RateLimitException, PolicyDeniedException)
- Add new governance APIs: CheckAsync, EnforceAsync, GovernAsync
- Add admin APIs: ListAgentsAsync, CreateAgentAsync, UpdateAgentAsync, RevokeAgentAsync
- Add admin APIs: ListPoliciesAsync, GetAuditLogAsync
- Add proxy request methods (GetAsync, PostAsync, PutAsync, DeleteAsync)
- Add IsHealthyAsync health check
- Add TraceId support for request correlation
- Add PolicyDecision model with full field support
- Add full XML documentation comments
- Add unit tests (exception, model, client tests)
- Implement Semantic Kernel integration (MeshGuardFilter)
- Add DI extensions for Semantic Kernel (AddMeshGuardGovernance)
- Mark legacy types as [Obsolete] for backward compatibility
- Bump version to 0.2.0
- Update MeshGuard.csproj TargetFramework -> TargetFrameworks
- Update MeshGuard.Tests.csproj to match
- Enables CI matrix builds across all supported .NET versions
@dbhurley
dbhurley force-pushed the feature/parity-update branch from 0546f35 to d001465 Compare February 18, 2026 15:05
- Replace C# 11 raw string literals with verbatim strings in tests
- Update CI to conditionally build projects per .NET version
- SemanticKernel project only builds on .NET 8.0 (SK requirement)
…upport

SK 1.4.0 didn't have the filter interfaces; they were added in SK 1.9.0+
Ensures each job only builds/tests the matching framework
@dbhurley
dbhurley merged commit 13acb76 into main Feb 18, 2026
4 checks passed
@dbhurley
dbhurley deleted the feature/parity-update branch February 18, 2026 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant