feat(sdk): add Telnyx relay voice context and examples - #155
Merged
Merged
Conversation
danielblignaut
marked this pull request as ready for review
September 8, 2026 21:08
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Outcome
Expose agent-owned voice through
@trytilde/sdkand@trytilde/sdk-vercel-ai-node, including Telnyx Conversation Relay, OpenAI pipeline/native modes, and a manual browser/phone agent example. Companion API: https://github.com/trytilde/api/pull/277. Public guide: trytilde/docs#37.Key implementation choices
client.chatkit.audioconfigures/reads speech settings, starts browser admission, and binds Telnyx routes. The normal endpoint receives validatedcontext.audio/context.telnyx; only the latest user message supplies that context. Generated text/UI history retains interruption and carrier-reported spoken-prefix annotations. Native model transcripts do not invoke a duplicate text callback.The example uses current SDK names, AI SDK 7, and
responseMode: "agentLoop". It registers three agents; the browser tests the two OpenAI modes and Telnyx calls use the relay agent. Managed setup updates an existing customer's application webhook; it does not purchase or assign numbers.Repository context
Validation
pnpm openbot sdk refresh: generated full contract, built all SDK packages, and passed 327 tests.pnpm check/pnpm buildnot run: this contribution is confined to public SDK packages and an isolated integration example.The complete schema contains 732 operations. Seven voice operations added, zero existing operations removed, and all 22 wallet/payment operations retained. Generated code was regenerated, never hand-edited. API tests prove the text/control relay through HTTP/Postgres and live OpenAI inference; real Telnyx and browser microphone checks remain manual.
Contracts, state, deployment, and security
No new internal metadata keys. Negative tests reject metadata-derived speech context and stale speech context on a subsequent typed turn. Example registrations remain ignored and use restrictive file permissions.
Configuration ownership
Targets
trytilde/dispatch; trackedconfiguration/contains only the canonical.gitignoresentinel. Fork initialization rules are not applicable.Cross-client parity
No shipped client capability changed. The standalone example is a public SDK consumer, not a voice feature in the shared web/Electron client runtime.
Architecture and ADR review
ADR 0030 documents SDK ownership and the relay contract; API ADR 0027 governs speech orchestration. ADR 0038 is preserved. No second speech worker or OpenBot CLI is introduced.
Package documentation and provider contracts
Changeset
.changeset/chatkit-realtime-voice.mdcovers the two public SDK additions and generated-client update.PR update record
Frontend evidence
Shipped frontend: not applicable. The example typechecks; no actual microphone/carrier test or deployment is claimed.
Known limitations and follow-ups
Direct WebRTC/SIP, ElevenLabs, voice notes, recordings, native endpoint-tool bridging, and browser personal-tool federation are outside this slice. Native mode uses separately configured instructions.
Owner: ChatKit API and SDK Trigger: before enabling production carrier traffic Work: perform a real Telnyx call and browser microphone test with dedicated resources; verify interruption, final transcripts, and call teardown.Final diff review
no-greptilelabel retained; Greptile was requested only on API PR 277.Documentation
Release order: deploy API/migrations → release SDK packages → publish docs PR 37. Source records and companion PR links above are current; the public docs repository now keeps engineering records in source repositories only.