Repository navigation
add m365 extension package and sample - #725
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new @microsoft/teams.m365extensions package plus a runnable example that embeds a teams.ts App into a Microsoft Agents SDK AgentApplication, routing Teams turns to teams.ts when a matching route exists and falling back to host handlers otherwise.
Changes:
- Introduces the
packages/m365extensions/package with middleware-based routing, Agents SDK credential/token bridging, and unit tests. - Adds
examples/m365extensions/sample demonstrating Teams-only features alongside host-app fallthrough behavior. - Updates
package-lock.jsonto include the new workspace packages and resolved dependency graph updates.
Reviewed changes
Copilot reviewed 26 out of 29 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/m365extensions/turbo.json | Turbo build wiring for the new package. |
| packages/m365extensions/tsup.config.js | Uses shared tsup config for package builds. |
| packages/m365extensions/tsconfig.json | TypeScript build configuration for the package. |
| packages/m365extensions/src/token.ts | Implements a synthetic IToken for Teams turns. |
| packages/m365extensions/src/middleware.ts | Core routing middleware + Teams channel detection. |
| packages/m365extensions/src/m365extensions.spec.ts | Unit tests for routing, token projection, and token provider behavior. |
| packages/m365extensions/src/install.ts | useTeamsSdk installer that constructs the teams.ts App and installs middleware. |
| packages/m365extensions/src/index.ts | Public exports for the new package. |
| packages/m365extensions/src/credentials.ts | Bridges teams.ts token acquisition to Agents SDK connections. |
| packages/m365extensions/src/context.ts | AsyncLocalStorage context bridge for Agents SDK turns. |
| packages/m365extensions/README.md | Package-level documentation and install instructions. |
| packages/m365extensions/package.json | New package manifest (deps/peers/scripts). |
| packages/m365extensions/jest.config.js | Uses shared Jest config. |
| packages/m365extensions/eslint.config.js | Uses shared ESLint config. |
| packages/m365extensions/CHANGELOG.md | Initial changelog for the package. |
| package-lock.json | Adds new workspace entries and updates lock resolution. |
| examples/m365extensions/turbo.json | Turbo wiring for the example build. |
| examples/m365extensions/tsconfig.json | TypeScript build configuration for the example. |
| examples/m365extensions/src/index.ts | Runnable sample embedding teams.ts into an Agents SDK app. |
| examples/m365extensions/src/cards.ts | Adaptive Card builders used by the sample. |
| examples/m365extensions/README.md | Sample setup/run instructions and scenario walkthrough. |
| examples/m365extensions/package.json | Example package manifest and scripts. |
| examples/m365extensions/eslint.config.js | Uses shared ESLint config. |
| examples/m365extensions/CHANGELOG.md | Initial changelog for the example. |
| examples/m365extensions/appPackage/manifest.json | Teams app manifest for the sample. |
| examples/m365extensions/.gitignore | Ignores local env/dev artifacts for the sample. |
| examples/m365extensions/.env.example | Template env vars for Teams CLI + OAuth handler setup. |
ðĄ Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Kavin (singhk97)
approved these changes
Aug 13, 2026
Merged
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
Adds a new
@microsoft/teams.m365extensionspackage â an M365 extension that lets you run the Teams SDK for TypeScript (teams.ts) inside an existing M365 Agents app. It installs middleware that routes Teams activities to a teams.tsApp, while every other channel â and any Teams turn with no matching teams.ts route â falls through to the host app's existing handlers. This lets you layer rich Teams-native features (Adaptive Cards, task modules, reactions, targeted messages) onto an app without rewriting its current message handling.What's included
Package â
packages/m365extensions/useTeamsSdk(...)â one-call setup that builds the teams.tsAppand installs the routing middleware.TeamsMiddleware/isTeamsChannelâ the middleware and a channel-detection helper.createAgentSdkTokenProvider,TeamsToken) so teams.ts's outbound calls reuse the host app's existing credentials.src/m365extensions.spec.ts).Example â
examples/m365extensions/@microsoft/teams.cardsbuilders.README.md+.env.examplewith Teams CLI-based setup.How it works
For each Teams turn, the middleware checks whether the teams.ts
Apphas a matching route. If it does, teams.ts handles the turn and its response flows back through the host pipeline. If not â or for any non-Teams channel â the turn passes through unchanged to the host app.Screenshots
Direct Line / Webchat:

Email:
