Skip to content

[upstream-sync] Port onElicitationRequest handler from upstream copilot-sdk PR #908#78

Closed
github-actions[bot] wants to merge 1 commit intomainfrom
upstream-sync/2026-03-31-f2c088d3987ffa3d
Closed

[upstream-sync] Port onElicitationRequest handler from upstream copilot-sdk PR #908#78
github-actions[bot] wants to merge 1 commit intomainfrom
upstream-sync/2026-03-31-f2c088d3987ffa3d

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Summary

Ports the onElicitationRequest callback from upstream Node.js SDK PR #908 (Add onElicitationRequest Callback for Elicitation Provider Support).

Upstream Changes Ported

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

What it adds:

  • New onElicitationRequest handler in SessionConfig and ResumeSessionConfig
  • When provided, client advertises requestElicitation capability on session create/resume
  • Handles elicitation.requested broadcast events from server → invokes handler → responds via session.ui.handlePendingElicitation RPC
  • Handles capabilities.changed broadcast events to dynamically update session capabilities
  • New event types: capabilities.changed, sampling.requested, sampling.completed, session.remote_steerable_changed

❌ PR #957 — doc: Add OnPermissionRequest handler to .NET / Getting Started code

Skipped — .NET documentation only, no relevance to Clojure port.

Clojure Implementation

session.clj

  • Added :elicitation-handler to session state storage
  • Added handle-elicitation-request! function following the same pattern as handle-user-input-request! and handle-permission-request!

client.clj

  • Added handle-v3-elicitation-requested! — processes elicitation.requested events, invokes handler, sends session.ui.handlePendingElicitation RPC response; on failure sends cancel to avoid hanging requests
  • Added handle-v3-capabilities-changed! — merges incoming capabilities.changed data into session capabilities atom (so (capabilities session) stays current as providers join/leave)
  • Extended handle-v3-broadcast-event! with cases for :copilot/elicitation.requested and :copilot/capabilities.changed
  • Added :request-elicitation boolean flag to both build-create-session-params and build-resume-session-params
  • Added :on-elicitation-request to pre-register-session
  • Updated docstrings for create-session and resume-session

specs.clj

  • Added ::on-elicitation-request fn? spec
  • Added :on-elicitation-request to session-config-keys, ::session-config, ::resume-session-config, ::join-session-config
  • Added new event types: :copilot/capabilities.changed, :copilot/sampling.requested, :copilot/sampling.completed, :copilot/session.remote_steerable_changed

Testing

Tests could not be run in this environment (Maven repository not available in sandbox). The implementation follows established patterns (handle-user-input-request!, handle-v3-permission-requested!) and should be verified by CI.

Handler Contract

;; Handler receives request map and invocation context
(defn my-elicitation-handler [request {:keys [session-id]}]
  ;; request has: :message, :requested-schema, :mode, :elicitation-source, :url
  {:action "accept"
   :content {:field-name "value"}})

(copilot/create-session client
  {:on-permission-request copilot/approve-all
   :on-elicitation-request my-elicitation-handler})

Generated by Upstream Sync Agent ·

  • expires on Apr 7, 2026, 2:38 PM UTC

- Add :on-elicitation-request option to create-session and resume-session
- Registers client as elicitation provider (requestElicitation on wire)
- Handle elicitation.requested broadcast events in v3 protocol router
- Auto-merge capabilities.changed events into session capabilities
- Add handle-elicitation-request! in session.clj following same pattern
  as handle-user-input-request! and handle-permission-request!
- Add new event types: capabilities.changed, sampling.requested,
  sampling.completed, session.remote_steerable_changed
- Update session-config, resume-session-config, join-session-config
  specs to include ::on-elicitation-request

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant