Skip to content

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

Draft
MRayermannMSFT wants to merge 2 commits intomainfrom
mrayermannmsft/elicitation-provider
Draft

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

Conversation

@MRayermannMSFT
Copy link
Contributor

@MRayermannMSFT MRayermannMSFT commented Mar 24, 2026

What

Adds onElicitationRequest to the Node.js SDK's SessionConfig, enabling SDK clients to act as elicitation providers. When a client registers this callback, the SDK negotiates the requestElicitation capability during session create/resume, listens for elicitation.requested broadcast events, invokes the handler, and responds via the handlePendingElicitation RPC. The SDK also automatically updates session.capabilities when capabilities.changed events arrive as providers join or leave. Includes unit tests, E2E tests covering capability reporting, multi-client propagation, and provider disconnect, plus updated README documentation.

Why

The CLI runtime now supports fan-out elicitation — broadcasting 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, limiting these requests to the CLI's own TUI.

@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