Skip to content

Integrate DevTools into Core#381

Draft
rido-min wants to merge 6 commits intonext/corefrom
devtools-port-no-auth
Draft

Integrate DevTools into Core#381
rido-min wants to merge 6 commits intonext/corefrom
devtools-port-no-auth

Conversation

@rido-min
Copy link
Copy Markdown
Member

This pull request introduces DevTools integration for bot development, enabling enhanced debugging and event tracking in development environments. The main changes add a new Microsoft.Teams.Bot.DevTools project, update sample bots to use DevTools, and refactor bot application setup to support DevTools and improve configuration handling.

DevTools Integration:

  • Added new project Microsoft.Teams.Bot.DevTools to the solution, including the DevToolsConversationClient decorator that emits "sent" events for activities to DevTools UI clients. (core/core.slnx, core/src/Microsoft.Teams.Bot.DevTools/DevToolsConversationClient.cs) [1] [2]
  • Updated sample bots (CoreBot and TeamsBot) to reference and use DevTools, including conditional middleware activation in development environments. (core/samples/CoreBot/CoreBot.csproj, core/samples/CoreBot/Program.cs, core/samples/TeamsBot/TeamsBot.csproj, core/samples/TeamsBot/Program.cs) [1] [2] [3] [4]

Bot Application Setup Refactoring:

  • Refactored AddBotApplicationExtensions.cs to centralize configuration and logger resolution, streamline MSAL setup, and improve client registration logic. This includes new helper methods and improved handling for missing authentication configuration. (core/src/Microsoft.Teams.Bot.Core/Hosting/AddBotApplicationExtensions.cs) [1] [2] [3] [4] [5] [6] [7] [8] [9]

Miscellaneous Improvements:

  • Adjusted error handling in BotConfig.Resolve to return an empty config instead of throwing when ClientID is missing, improving startup resilience. (core/src/Microsoft.Teams.Bot.Core/Hosting/BotConfig.cs)
  • Minor update to BotAuthenticationHandler.cs for improved clarity and maintainability. (core/src/Microsoft.Teams.Bot.Core/Hosting/BotAuthenticationHandler.cs)

rajan-chari and others added 5 commits March 18, 2026 21:56
Port the DevTools debugging UI from main's plugin system to core's middleware
architecture. Provides real-time WebSocket activity monitoring, test message
injection, and app metadata display at /devtools.

Architecture:
- DevToolsMiddleware (ITurnMiddleware) intercepts incoming activities + errors
- DevToolsConversationClient (extends ConversationClient) intercepts outgoing
- DevToolsService holds shared WebSocket state and emit helpers
- Minimal API endpoints replace MVC controllers
- Embedded React UI copied from main (unchanged)

Usage: services.AddDevTools() + app.UseDevTools()

Includes devtools-plan/ docs describing the main→core porting design.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Added Microsoft.Teams.Bot.DevTools to CoreBot and registered its services/middleware.
- Enhanced MSAL configuration logic to only configure when a valid ClientId is present, returning a boolean for success and avoiding exceptions.
- Fixed retrieval of AgenticIdentity in BotAuthenticationHandler.
- Improved DevTools static file serving with correct content types and ensured AppId/AppName are always set in metadata.
- Added a reply endpoint for bot replies in DevTools.
- Updated WebSocketCollection to serialize events with runtime type and added null checks.
- Minor formatting and comment improvements.
Guarantee every activity and response has a distinct ID by assigning a new GUID when missing. Improves traceability and UI handling in DevToolsConversationClient and DevToolsHostingExtensions.
DevTools middleware is now conditionally enabled based on the environment, ensuring it runs only during development and not in production.
Added Microsoft.Teams.Bot.DevTools integration for development and debugging, including conditional middleware activation in Program.cs. Refactored bot client registration in AddBotApplicationExtensions.cs to centralize config and logging, streamline MSAL setup, and ensure shared infrastructure is registered once. Updated DevToolsHostingExtensions.cs for generic UseDevTools support. Improved maintainability and authentication setup.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants