Add SDK support for agent selection and session compaction APIs#544
Add SDK support for agent selection and session compaction APIs#544SteveSandersonMS wants to merge 3 commits intomainfrom
Conversation
Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com>
… APIs - Regenerate RPC types for Python, Go, and .NET from updated schema - Add e2e tests for all 3 languages matching Node.js test patterns - Fix C# codegen request class name collisions (use full RPC method path) - Update dotnet/src/Generated/SessionEvents.cs and go/generated_session_events.go Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Cross-SDK Consistency Review ✅I've reviewed PR #544 for consistency across all four SDK implementations (Node.js/TypeScript, Python, Go, and .NET). This PR demonstrates excellent cross-language consistency. SummaryThis PR adds two new RPC API families to all SDKs:
✅ Consistency Findings1. API Structure & Naming — Excellent consistency across all languages:
All naming follows the appropriate language conventions:
2. Test Coverage — Complete parity: All 4 SDKs include identical test scenarios (6 tests per language = 24 total): Agent Selection tests:
Compaction test:
3. Generated Code — Consistent implementation: All SDKs properly:
4. C# Codegen Improvement — Good fix: The change to use 5. Test Infrastructure — Properly maintained:
🎯 ConclusionNo consistency issues found. This PR maintains excellent feature parity across all four SDK implementations. The APIs are semantically identical, with only appropriate language-specific naming adaptations. Great work! 🚀
|
There was a problem hiding this comment.
Pull request overview
Adds cross-SDK support (Node.js, Python, Go, .NET) for new Copilot CLI JSON-RPC APIs covering agent selection (session.agent.*) and session compaction (session.compaction.*), along with replay-proxy normalization and new E2E coverage.
Changes:
- Regenerates RPC types across SDKs and extends session-scoped RPC clients with
agentandcompactionAPIs. - Updates C# codegen to avoid request-type name collisions by using full RPC method paths in request class names.
- Adds/updates replay-proxy normalization and YAML snapshots, plus new E2E tests for agent selection and compaction RPCs.
Reviewed changes
Copilot reviewed 9 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/snapshots/compaction/should_trigger_compaction_with_low_threshold_and_emit_events.yaml | Updates compaction snapshot to use ${compaction_prompt} and refreshes expected conversation flow. |
| test/snapshots/agent_and_compact_rpc/should_compact_session_history_after_messages.yaml | New snapshot covering session.compaction.compact RPC flow. |
| test/harness/replayingCapiProxy.ts | Normalizes the verbose compaction-summary prompt into ${compaction_prompt} for stable snapshots. |
| scripts/codegen/csharp.ts | Uses full RPC method path for generated C# request class names to prevent collisions. |
| python/e2e/test_agent_and_compact_rpc.py | Adds Python E2E tests for agent selection + compaction RPCs. |
| python/copilot/generated/rpc.py | Adds generated Python RPC types + APIs for agent and compaction. |
| nodejs/test/e2e/agent_and_compact_rpc.test.ts | Adds Node.js E2E tests for agent selection + compaction RPCs. |
| nodejs/src/generated/rpc.ts | Adds generated Node session RPC bindings and types for agent and compaction. |
| go/rpc/generated_rpc.go | Adds generated Go RPC types + Agent/Compaction RPC APIs on SessionRpc. |
| go/internal/e2e/agent_and_compact_rpc_test.go | Adds Go E2E tests for agent selection + compaction RPCs. |
| dotnet/test/AgentAndCompactRpcTests.cs | Adds .NET E2E tests for agent selection + compaction RPCs. |
| dotnet/src/Generated/Rpc.cs | Adds generated .NET RPC types + APIs for agent and compaction, and updates request-type names. |
Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com>
✅ Cross-SDK Consistency Review: ExcellentI've reviewed this PR for consistency across all four SDK implementations (Node.js/TypeScript, Python, Go, and .NET), and I'm pleased to report that this change demonstrates exemplary cross-language parity. What I Verified1. API Methods ✅All 4 SDKs expose the same agent selection and session compaction APIs with language-appropriate naming: Agent Selection APIs:
Session Compaction API:
The naming follows each language's conventions (camelCase for JS, snake_case for Python, PascalCase for exported Go/C# identifiers). 2. Type Definitions ✅Generated RPC types are semantically equivalent across all languages:
All types properly handle nullable values (e.g., 3. E2E Test Coverage ✅All 4 SDKs have identical test scenarios (6 tests each, 24 total): Agent Selection Tests:
Compaction Test: Each test verifies the same behavior and assertions, ensuring feature parity. 4. Code Generation Improvements ✅
SummaryThis PR is a model example of maintaining cross-SDK consistency:
No consistency issues found. The implementation maintains the high standard of this multi-language SDK repository. Great work, @SteveSandersonMS! 🎉
|
Summary
Add SDK support for the new agent selection and session compaction JSON-RPC APIs added to the Copilot CLI runtime.
New RPC APIs
Agent selection (
session.agent.*):list— List available custom agentsgetCurrent— Get the currently selected agentselect— Select a custom agent by namedeselect— Deselect the current agentSession compaction (
session.compaction.*):compact— Compact session history to reduce token usageChanges
Test results
All 24 e2e tests pass across all 4 languages:
Companion PR
Cannot merge or pass E2E tests until a corresponding runtime change (3538) is merged and an updated package is shipped.