Skip to content

Implement C# SDK#1

Open
bettercallsaulj wants to merge 8 commits intomainfrom
dev_csharp_sdk
Open

Implement C# SDK#1
bettercallsaulj wants to merge 8 commits intomainfrom
dev_csharp_sdk

Conversation

@bettercallsaulj
Copy link
Copy Markdown
Collaborator

No description provided.

RahulHere added 8 commits January 23, 2026 00:35
- Remove C++ files: .clang-format, cmake/, CMakeLists.txt, Makefile,
  src/, include/, examples/, tests/, build.sh
- Remove C++ CI workflow (pr-format-check.yml)
- Update submodule from gopher-mcp to gopher-orch
- Update .gitignore for C# development
Build script that handles:
- Submodule initialization with SSH URL rewriting
- CMake configuration and compilation of gopher-orch native library
- Installation of shared libraries to native/lib
C# SDK for gopher-orch providing AI agent orchestration with native
C++ performance through P/Invoke bindings.

Features:
- .NET Standard 2.0 compatibility
- dotnet build system with System.Text.Json dependency
- GopherAgent class with builder pattern configuration
- IDisposable support for automatic resource cleanup
- Typed exceptions (AgentException, ApiKeyException, etc.)
- xUnit tests
Example demonstrating GopherAgent usage with local MCP servers:
- ClientExampleJson.cs: Example using JSON server configuration
- client_example_json_run.sh: Script to start MCP servers and run example
- server3001/server3002: Mock MCP servers for testing
Add unit tests to verify that C# can correctly call C++ functions
through P/Invoke FFI bindings.

Tests include:
- GopherOrchLibraryTest: Direct FFI layer tests
  - Library availability check
  - Agent creation functions (by JSON, by API key)
  - Error handling functions
  - Null pointer handling
- GopherAgentIntegrationTest: High-level integration tests
  - Agent lifecycle (create, dispose, using statement)
  - Multiple agent instances
  - Run after dispose throws exception
  - Shutdown and reinit

Integration tests that require agent creation are skipped when
API keys are not available, using Xunit.SkippableFact.
Update gopher-orch submodule to commit 6b45ffbb which includes
the "Fix MCP server connections and clean up logging" fix. This
resolves the issue where the C# SDK would hang indefinitely when
calling agent.Run().

Changes:
- Update gopher-orch submodule from 3a031dab to 6b45ffbb
- Fix path separators in example csproj (Windows -> Unix style)
- Add generated example project directory to .gitignore
The npm run dev command spawns child processes (tsx/node) that were
not being killed when the script exited. This caused the script to
hang indefinitely.

Changes:
- Try to kill process groups first to catch child processes
- Use lsof to find and kill any remaining processes on ports 3001/3002
Add documentation for code formatting and examples:
- Development section with dotnet format, build, and test commands
- Examples section documenting the client_example_json_run.sh script
- Update Project Structure to include examples directory
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