feat(client): add self-hosted orchestrator session support - #921
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
cursor review |
There was a problem hiding this comment.
Pull request overview
Adds an on-premises conversation session path to @elevenlabs/client by allowing callers to provide onPremConfig to route the session WebSocket to a self-hosted orchestrator and send an enclave_setup_config payload before the normal initiation message.
Changes:
- Add
OnPremConfig/OnPremSessionConfigtypes and export them from the client entrypoint. - Update WebSocket session bootstrap to support on-prem URLs and omit WebSocket subprotocol negotiation on that path.
- Add helpers + tests for constructing and sending the
enclave_setup_configwire message, plus WebSocketConnection on-prem tests.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/client/src/utils/WebSocketConnection.ts | Adds on-prem WebSocket URL handling and sends enclave_setup_config before initiation; omits subprotocols on-prem. |
| packages/client/src/utils/WebSocketConnection.test.ts | Adds on-prem connection tests (URL usage, message ordering). |
| packages/client/src/utils/onPrem.ts | Introduces constructEnclaveSetupConfig mapping to wire format. |
| packages/client/src/utils/onPrem.test.ts | Unit tests for on-prem wire mapping and null defaults. |
| packages/client/src/utils/ConnectionFactory.ts | Forces on-prem sessions onto WebSocket and rejects WebRTC. |
| packages/client/src/utils/BaseConnection.ts | Adds exported on-prem config types to the session config union. |
| packages/client/src/index.ts | Re-exports new on-prem types. |
| .changeset/thick-clouds-hang.md | Declares a minor release for on-prem session support. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit be3b753. Configure here.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit ac53cdb. Configure here.
|
I would like to have a conversation about your thoughts around this API. Specially to see if any of these on-prem specifics could be easily expressed in the existing configuration options or if we should instead take these "top-level" and discriminate based on a separate boolean or string-literal field. I also don't particularly like that the In any case these should be marked with the |
| hmacSecret?: string; | ||
| }; | ||
|
|
||
| export type OnPremConfig = { |
There was a problem hiding this comment.
For us to figure out how to generate these automatically with OpenAPI so we don't have to keep updating it with new parameters.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 05417b5. Configure here.
|
@kraenhansen, added @experimental tags (513365a), and went ahead and renamed "onPremConfig" to "orchestratorConfig" (05417b5) so you can see it concretely — the docs define the orchestrator as the gateway exposing the conversation WebSocket, and the wire types here already use ClientToOrchestratorEvent, so it felt like the natural term. also renamed the webhook type to PostCallWebhookConfig to match the Python SDK. happy to change it if you have a different direction in mind re folding the fields into existing options: these fields change the connection itself rather than the conversation config since the URL is used verbatim, no convai subprotocol can be requested (i.e. browsers fail the connection if the server doesn't echo it, and self-hosted orchestrators don't negotiate), and an extra |
|
I'd like some more time to dig into this in detail to see how this could potentially reuse part of the or replace the existing "top-level" config. Wondering if this should be encoded as a new |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Small naming note: since everything in |
|
Could you share more about the expected shape of entries in Same naming note as |
|
One more: what happens if a caller sets both We have a precedent for a similar conflict with |
…ields Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ssages Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit c5c55d2. Configure here.
|
thanks for the thorough review @kraenhansen! all points addressed:
also fixed two Bugbot findings on #922: file upload UI is hard-off for orchestrator sessions so file bytes can't leave the customer network (3c47153), and a |
Adds self-hosted orchestrator session support to
@elevenlabs/client, matching the Python SDK'sOnPremInitiationData(namedorchestratorConfighere to avoid theon*callback-handler naming convention). PassingorchestratortoConversation.startSession(orcreateConnection) routes the conversation WebSocket to a self-hosted orchestrator. The orchestrator is stateless, so the client sends anenclave_setup_configmessage (agent config, tools, optional Bedrock inference profile and post-call webhooks) before the standardconversation_initiation_client_datamessage; after that the protocol matches the cloud path. Orchestrator sessions are websocket-only.Two connection details differ from the cloud path: the configured URL is used verbatim, and no WebSocket subprotocols are requested, because the orchestrator accepts the socket without subprotocol negotiation and browsers fail a connection whose requested subprotocol is not echoed back.
The React SDK picks this up through its session config passthrough with no changes; the widget and React Native can follow separately.
Testing
Note
Medium Risk
New connection path and session bootstrap protocol for private deployments; misconfiguration could fail sessions or expose webhook HMAC secrets in client-visible config (documented as test-only).
Overview
Adds experimental self-hosted orchestrator sessions to
@elevenlabs/clientvia anorchestratoroption onConversation.startSession/createConnection, aligned with the Python SDK’s on-prem initiation flow.Sessions use websocket only: the client opens the configured URL as-is (no
convai/ bearer subprotocols) and, on connect, sends anenclave_setup_configmessage (agent config, overrides, tools, optional Bedrock profile and post-call webhooks) before the usualconversation_initiation_client_data.createConnectionrejects mixingorchestratorwith WebRTC,signedUrl,conversationToken, orauthorization.uploadFileis blocked for orchestrator sessions so file uploads are not sent to the ElevenLabs cloud API.Reviewed by Cursor Bugbot for commit c5c55d2. Bugbot is set up for automated code reviews on this repo. Configure here.