Skip to content

[Node] Add onElicitationRequest Callback for Elicitation Provider Support#908

Draft
MRayermannMSFT wants to merge 1 commit intomainfrom
mrayermannmsft/elicitation-provider
Draft

[Node] Add onElicitationRequest Callback for Elicitation Provider Support#908
MRayermannMSFT wants to merge 1 commit intomainfrom
mrayermannmsft/elicitation-provider

Conversation

@MRayermannMSFT
Copy link
Contributor

REQUIRES CHANGES FROM TO BE RELEASED: https://github.com/github/copilot-agent-runtime/pull/5267

What

Adds onElicitationRequest to the Node.js SDK's SessionConfig, enabling SDK clients to act as elicitation providers — receiving and responding to form-based UI dialog requests from the agent runtime. The SDK automatically negotiates the requestElicitation capability during session create/resume, handles elicitation.request RPC callbacks, and keeps session.capabilities up to date via capabilities.changed events as providers join or leave. Includes E2E tests covering capability reporting, multi-client capability propagation, and provider disconnect cleanup, along with updated README documentation.

Why

The CLI runtime now supports fan-out elicitation — dispatching structured input requests to all connected clients that advertise elicitation support, with the first response winning. Without this SDK-side change, Node.js clients had no way to register as elicitation providers, meaning these requests could only be served by the CLI's own TUI.


const rpcSpy = vi.spyOn((client as any).connection!, "sendRequest");

const session = await client.createSession({

const rpcSpy = vi.spyOn((client as any).connection!, "sendRequest");

const session = await client.createSession({
@github-actions
Copy link
Contributor

Cross-SDK Consistency Review

This PR adds onElicitationRequest callback support to the Node.js/TypeScript SDK, enabling clients to act as elicitation providers. While this is a valuable feature addition, it creates a feature parity gap across the SDK implementations.

Summary of Changes (Node.js Only)

The PR adds:

  1. onElicitationRequest handler in SessionConfig and ResumeSessionConfig
  2. ElicitationHandler and ElicitationRequest types
  3. requestElicitation flag sent during session create/resume
  4. RPC handler registration for elicitation.request callbacks
  5. Automatic capabilities.changed event handling to update session.capabilities dynamically
  6. Comprehensive documentation in README with examples
  7. E2E tests covering single-client and multi-client scenarios

Feature Parity Status

SDK OnUserInputRequest OnElicitationRequest capabilities.changed handling
Node.js ✅ Supported Added in this PR Added in this PR
Python ✅ Supported ❌ Missing ❌ Missing
Go ✅ Supported ❌ Missing ❌ Missing
.NET ✅ Supported ❌ Missing ❌ Missing

Recommendation

The Python, Go, and .NET SDKs should receive equivalent implementations to maintain feature parity. Based on the Node.js changes, each SDK would need:

Python (python/copilot/)

  • Add on_elicitation_request: ElicitationHandler to SessionConfig and ResumeSessionConfig (similar to on_user_input_request)
  • Define ElicitationHandler type alias following the existing UserInputHandler pattern
  • Add request_elicitation flag to create/resume RPC calls
  • Register RPC handler for elicitation.request in client.py
  • Implement _register_elicitation_handler() method in CopilotSession
  • Handle capabilities.changed events to update session.capabilities dynamically
  • Add README documentation and E2E tests

Go (go/)

  • Add OnElicitationRequest ElicitationHandler to SessionConfig and ResumeSessionConfig
  • Define ElicitationHandler func(request ElicitationRequest, invocation ElicitationInvocation) (ElicitationResponse, error)
  • Add RequestElicitation bool to create/resume RPC params
  • Register RPC method handler for elicitation.request in client.go
  • Implement registerElicitationHandler() and handleElicitationRequest() in session.go
  • Handle capabilities.changed events in session event processing
  • Add README documentation and E2E tests

.NET (dotnet/src/)

  • Add OnElicitationRequest property to SessionConfig and ResumeSessionConfig
  • Define ElicitationHandler delegate following the UserInputHandler pattern
  • Add RequestElicitation to create/resume RPC parameters
  • Register RPC handler for elicitation.request in Client.cs
  • Implement RegisterElicitationHandler() and handle callbacks in Session.cs
  • Handle capabilities.changed events to update session capabilities
  • Add README documentation and E2E tests

Note on Blocking

This should not block the Node.js PR from merging, but I recommend:

  1. Creating follow-up issues/PRs to track implementation in other SDKs
  2. Documenting this as a Node.js-only feature temporarily in the main README
  3. Prioritizing Python/Go/.NET implementations to minimize the feature gap duration

The implementation pattern is consistent and well-tested in Node.js, making it straightforward to port to the other SDKs following their respective language idioms.

Generated by SDK Consistency Review Agent for issue #908 ·

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