{"id":10586,"library":"botbuilder-dialogs-adaptive-runtime-core","title":"Bot Framework Adaptive Dialogs Runtime Core","description":"The `botbuilder-dialogs-adaptive-runtime-core` package provides the foundational, core components for building and running adaptive dialogs within the Microsoft Bot Framework SDK for JavaScript. As of version 4.23.3, it offers classes and interfaces like `ServiceCollection` and `Configuration` that enable dependency injection and configuration management for dynamic, context-aware conversational bots. It is a critical dependency for `botbuilder-dialogs-adaptive-runtime` and is part of a larger ecosystem designed to simplify bot development by allowing declarative dialog definitions and runtime adaptation to user input. The package is regularly updated with bug fixes, security patches, and support for newer Node.js and TypeScript versions. While this package provides the low-level building blocks, users typically interact with higher-level packages like `botbuilder-dialogs-adaptive-runtime` for complete bot runtime setup.","status":"maintenance","version":"4.23.3-preview","language":"javascript","source_language":"en","source_url":"https://github.com/Microsoft/botbuilder-js","tags":["javascript","botbuilder","botframework","bots","chatbots","typescript"],"install":[{"cmd":"npm install botbuilder-dialogs-adaptive-runtime-core","lang":"bash","label":"npm"},{"cmd":"yarn add botbuilder-dialogs-adaptive-runtime-core","lang":"bash","label":"yarn"},{"cmd":"pnpm add botbuilder-dialogs-adaptive-runtime-core","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Primarily used for registering and resolving services within the adaptive runtime. ES Modules preferred.","wrong":"const ServiceCollection = require('botbuilder-dialogs-adaptive-runtime-core').ServiceCollection;","symbol":"ServiceCollection","correct":"import { ServiceCollection } from 'botbuilder-dialogs-adaptive-runtime-core';"},{"note":"An interface for obtaining configurable values, used for managing application settings. ES Modules preferred.","symbol":"Configuration","correct":"import { Configuration } from 'botbuilder-dialogs-adaptive-runtime-core';"},{"note":"A class for accessing resource files based on configuration, essential for loading adaptive dialog assets. ES Modules preferred.","symbol":"ConfigurationResourceExplorer","correct":"import { ConfigurationResourceExplorer } from 'botbuilder-dialogs-adaptive-runtime-core';"}],"quickstart":{"code":"import { BotFrameworkAdapter, ActivityHandler } from 'botbuilder';\nimport { getRuntimeServices } from 'botbuilder-dialogs-adaptive-runtime';\nimport * as path from 'path';\nimport * as restify from 'restify';\n\n// Basic bot implementation using the adaptive runtime. \n// This demonstrates how 'runtime-core' components are leveraged indirectly \n// through 'botbuilder-dialogs-adaptive-runtime' for a working bot.\n\nclass AdaptiveBot extends ActivityHandler {\n    private dialogManager: any; // In a real app, this would be DialogManager\n\n    constructor(dialogManager: any) {\n        super();\n        this.dialogManager = dialogManager;\n\n        this.onMessage(async (context, next) => {\n            console.log('Activity received:', context.activity.text);\n            // This would trigger the adaptive dialog turn\n            await this.dialogManager.onTurn(context);\n            // By default, if no adaptive dialog handles the turn, echo the message.\n            if (!context.responded) {\n                await context.sendActivity(`You said: '${context.activity.text}'`);\n            }\n            await next();\n        });\n\n        this.onMembersAdded(async (context, next) => {\n            const membersAdded = context.activity.membersAdded;\n            for (const member of membersAdded) {\n                if (member.id !== context.activity.recipient.id) {\n                    await context.sendActivity(`Hello and welcome!`);\n                }\n            }\n            await next();\n        });\n    }\n}\n\nasync function main() {\n    const server = restify.createServer();\n    server.listen(process.env.port || process.env.PORT || 3978, function() {\n        console.log(`\\n${server.name} listening to ${server.url}`);\n        console.log(`\\nGet the Bot Framework Emulator: https://aka.ms/botframework-emulator`);\n        console.log(`\\nTo talk to your bot, open the emulator and connect to: http://localhost:${process.env.port || process.env.PORT || 3978}/api/messages`);\n    });\n\n    // Retrieve runtime services using 'botbuilder-dialogs-adaptive-runtime'\n    // which internally uses 'botbuilder-dialogs-adaptive-runtime-core' components.\n    const [services, configuration] = await getRuntimeServices(path.resolve(__dirname, '..'), path.resolve(__dirname, '..', 'settings'));\n\n    // The services object will contain various components, including the configured bot.\n    const bot = services.get('bot');\n    if (!(bot instanceof ActivityHandler)) {\n        throw new Error('Bot service must be an instance of ActivityHandler.');\n    }\n\n    const adapter = new BotFrameworkAdapter({\n        appId: process.env.MicrosoftAppId ?? '',\n        appPassword: process.env.MicrosoftAppPassword ?? ''\n    });\n\n    server.post('/api/messages', (req, res) => {\n        adapter.processActivity(req, res, async (context) => {\n            await bot.run(context);\n        });\n    });\n}\n\nmain().catch((err) => {\n    console.error('Error starting bot:', err);\n    process.exit(1);\n});\n","lang":"typescript","description":"This quickstart initializes a basic bot using `botbuilder-dialogs-adaptive-runtime`'s `getRuntimeServices` to set up adaptive dialog capabilities, demonstrating how 'runtime-core' elements contribute to the bot's operation."},"warnings":[{"fix":"Upgrade your Node.js environment to version 18 or higher. Node.js 22 is supported since 4.23.2.","message":"As of Bot Framework JS SDK 4.23.0, Node.js versions prior to 18 are no longer supported. This is due to updates in underlying Azure Identity and MSAL.Node packages.","severity":"breaking","affected_versions":">=4.23.0"},{"fix":"Update your project's TypeScript version to 5.9 or newer.","message":"As of Bot Framework JS SDK 4.23.3, support for TypeScript 4.7 has been dropped due to incompatibilities with newer Node.js types. TypeScript 5.9 is now supported.","severity":"breaking","affected_versions":">=4.23.3"},{"fix":"For production environments or multi-instance deployments, configure a durable storage solution such as Azure Blob Storage or Cosmos DB via appropriate Bot Framework storage packages (e.g., `botbuilder-azure`).","message":"The default `MemoryStorage` implementation, often used in examples, is designed for testing purposes with a single bot host and does not provide durable storage. Data will not persist across restarts or scale-out scenarios.","severity":"gotcha","affected_versions":">=4.0"},{"fix":"Ensure your application is configured for single-tenant if using Federated Credentials. For multi-tenant scenarios, alternative authentication methods might be required.","message":"Federated Credentials for bot-to-channel authentication, introduced in Bot Framework JS SDK 4.23.2, are currently only supported for single-tenant applications.","severity":"gotcha","affected_versions":">=4.23.2"},{"fix":"Developers are advised to consider alternatives such as Microsoft Copilot Studio or migrate existing bots to the Agents SDK. Review migration guidance provided by Microsoft for existing Bot Framework SDK bots.","message":"The entire Microsoft Bot Framework SDK for JavaScript project is scheduled for archiving no later than the end of December 2025, with support tickets no longer being serviced as of December 31, 2025.","severity":"deprecated","affected_versions":">=4.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Upgrade your Node.js environment to version 18.x or higher using a version manager like `nvm` (e.g., `nvm install 18 && nvm use 18`).","cause":"Attempting to run the bot with an unsupported Node.js version (e.g., Node.js 16 or earlier).","error":"Error: Node.js version is not supported. Minimum supported version is 18."},{"fix":"Update your TypeScript dependency in `package.json` to `^5.9.0` or newer, then run `npm install` or `yarn install` and rebuild your project.","cause":"Your project is using an older TypeScript version (e.g., 4.7) which is no longer compatible with the SDK's internal dependencies or type definitions.","error":"TypeScript Error: This version of TypeScript is incompatible with the installed Node.js types. Expected >=5.9"},{"fix":"Verify your `appsettings.json` or equivalent configuration to ensure the 'bot' entry correctly points to your bot's implementation that extends `ActivityHandler`. Check for configuration file parsing errors or missing declarative assets.","cause":"The configured bot within the runtime services is not correctly set up as an `ActivityHandler`, or the `getRuntimeServices` function failed to initialize it properly based on configuration.","error":"Error: Bot service must be an instance of ActivityHandler."}],"ecosystem":"npm"}