Add a first-party .NET client (proposal)#206
Draft
joshmouch wants to merge 2 commits into
Draft
Conversation
Adds a first-party-style `Microsoft.AgentHostProtocol*` client for the Agent
Host Protocol, matching the existing Rust / Kotlin / Swift / TypeScript / Go
clients in layout, generation model, and conformance coverage:
- The wire types are generated from the canonical TypeScript protocol
definitions by `scripts/generate-csharp.ts` (wired in as `npm run
generate:dotnet`), so adding a protocol field is one regen, not N
hand-edits. CI fails if the committed generated sources drift.
- The runtime ships the async JSON-RPC `AhpClient`, the pure state reducers,
the default System.Text.Json serializer, a `ClientWebSocket` transport, and
the `MultiHostClient` for talking to two or more hosts at once. The
`Microsoft.AgentHostProtocol.Abstractions` package carries the wire types +
transport/serializer interfaces alone.
- The client implements the per-session annotations channel
(`ahp-session:/<uuid>/annotations`) at full cross-language conformance
parity. The generator emits the `AnnotationsState`, `Annotation`,
`AnnotationEntry`, and `AnnotationsSummary` wire types, the four
`annotations/{set,removed,entrySet,entryRemoved}` actions, the
`MessageAnnotationsAttachment` attachment variant, and the
`SessionSummary.annotations` summary; `Reducers.ApplyToAnnotations` is a
faithful port of the canonical reducer (append-or-replace an annotation by
id, drop a matching annotation, append-or-replace an entry within an
annotation, drop a matching entry; unknown target ids are no-ops).
- The shared `types/test-cases/reducers/*` and round-trip fixtures drive the
.NET implementation through the same fixture-parity theories the other
clients use. 332 reducer / round-trip / client / transport tests pass on
net8.0 and net9.0. The client keeps its own test-parity gate
(`clients/dotnet/scripts/check-test-parity.sh` + `parity-manifest.txt` +
`MIN_TEST_COUNT`) so coverage can't silently regress.
- `scripts/verify-changelog.ts` now gates `clients/dotnet/CHANGELOG.md` for
every PR, the same way it does for the other five clients.
Publishing is intentionally left to the maintainers. The package ids use the
`Microsoft.AgentHostProtocol` namespace, but this change wires up no NuGet
publish automation — the maintainers can plug `dotnet pack` + `dotnet nuget
push` into whichever signed release pipeline they already use (the Kotlin and
TypeScript packages publish through Azure DevOps / ESRP rather than a GitHub
Actions registry push). The per-PR CI build/test job validates the code.
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.
A complete .NET / NuGet client for AHP 0.3.0, at full cross-language parity with the Rust / Kotlin / Swift / TypeScript / Go clients — including the new annotations channel (#195).
Opening as a draft: a 6th first-party client is a maintenance + ownership commitment only you can sign off on, so I'd love a scope decision before you spend review time. I'm happy to keep it updated as the protocol evolves.
What's here
Microsoft.AgentHostProtocol.Abstractions(generated wire types + transport/serializer interfaces),Microsoft.AgentHostProtocol(reducers +AhpClient+MultiHostClient),Microsoft.AgentHostProtocol.WebSockets.scripts/generate-csharp.ts(wired intogenerate.ts+ the CI generated-source-freshness check) — a protocol change is one regen, not N hand-edits.Notes for review
Microsoft.AgentHostProtocol.*publishing your way if you adopt this.check-test-parity.sh+ a method-count floor) — happy to slim or drop it if you'd rather not carry per-client gate infra.Your call: do you want a first-party .NET client? If yes — who owns/maintains it, and should it publish via your ESRP pipeline under
Microsoft.AgentHostProtocol.*?