feat(adapter-teams): native streaming for DMs via emit#416
Merged
Conversation
Contributor
|
@heyitsaamir is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
4fbde61 to
68dfc05
Compare
b2f63cc to
df792e2
Compare
bensabic
approved these changes
Apr 29, 2026
Use ctx.stream.emit() from the Teams SDK for DM streaming instead of manual post+edit. This sends proper typing activities with streamType channelData, giving the native streaming UI in Teams. - Capture IStreamer from activity context in handleMessageActivity - Block handler with deferred promise so stream stays alive during processing - streamViaEmit() for DMs: uses stream.emit() with incremental text deltas - Group chats: accumulate full response and post as single message (no flicker) - Handle StreamCancelledError and stream.canceled for graceful cancellation Co-Authored-By: Claude <noreply@anthropic.com>
Group chats now accumulate streamed chunks and post as a single message instead of post+edit, so assertions should check sentActivities not updatedActivities.
df792e2 to
151becb
Compare
Merged
4 tasks
patrick-chinchill
added a commit
to Chinchill-AI/chat-sdk-python
that referenced
this pull request
May 28, 2026
Ports vercel/chat#416 — native Teams streaming for DMs via emit. DM threads now use the Bot Framework streaming protocol (typing activities with channelData.streamType=streaming + streamSequence, then a final message activity with streamType=final) instead of Thread._fallback_stream. Group chats accumulate and post a single message, matching upstream's flicker-free behavior. - Wire format: streamId omitted on first chunk, present on both channelData and streaminfo entity for subsequent and final activities - Throttle: configurable native_stream_min_emit_interval_ms (default 1500ms), honors StreamOptions.update_interval_ms - End-of-stream flush ensures buffered text is confirmed-accepted before close - Send-failure mid-stream cancels session and re-raises (keeps Thread.stream history consistent with delivered chunks) - Migration to microsoft-teams-apps SDK tracked as issue #93 (out of scope for 4.27.0)
4 tasks
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.
Summary
ctx.stream.emit()for DM streaming instead of manual post+editstreamType: 'streaming'channelData)stream.canceled+StreamCancelledError)How it works
handleMessageActivitycapturesctx.streamfor DMs and blocks the handler via a deferred promise wired throughwaitUntil— this keeps the Teams SDK from auto-closing the stream before processing completesstreamViaEmit()sends incremental text deltas viastream.emit(), framework auto-closes withstreamType: 'final'IStreameris availableAlso adds missing
@slack/socket-modedep to adapter-slack.Test plan
pnpm --filter @chat-adapter/teams buildpassespnpm --filter @chat-adapter/teams test— 148 tests pass