UNPKG

botbuilder-dialogs

Version:

A dialog stack based conversation manager for Microsoft BotBuilder.

106 lines (103 loc) 3.69 kB
/** * @module botbuilder-dialogs */ /** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ import { TurnContext, BotState, ConversationState, UserState, TurnContextStateCollection } from 'botbuilder-core'; import { Configurable } from './configurable'; import { DialogSet } from './dialogSet'; import { Dialog, DialogTurnResult } from './dialog'; import { DialogStateManagerConfiguration } from './memory'; export interface DialogManagerResult { turnResult: DialogTurnResult; } export interface DialogManagerConfiguration { /** * State property used to persist the bots dialog stack. */ conversationState: BotState; /** * Root dialog to start from [onTurn()](#onturn) method. */ rootDialog: Dialog; /** * Optional. Bots persisted user state. */ userState?: UserState; /** * Optional. Number of milliseconds to expire the bots conversation state after. */ expireAfter?: number; /** * Optional. Path resolvers and memory scopes used for conversations with the bot. */ stateConfiguration?: DialogStateManagerConfiguration; } /** * Class which runs the dialog system. * * @deprecated This class will be deprecated. */ export declare class DialogManager extends Configurable { private _rootDialogId; private readonly _dialogStateProperty; private readonly _initialTurnState; /** * Creates an instance of the [DialogSet](xref:botbuilder-dialogs.DialogManager) class. * * @param rootDialog Optional, root [Dialog](xref:botbuilder-dialogs.Dialog) to use. * @param dialogStateProperty Optional, alternate name for the dialogState property. (Default is "DialogStateProperty") */ constructor(rootDialog?: Dialog, dialogStateProperty?: string); /** * Bots persisted conversation state. */ conversationState: ConversationState; /** * Optional. Bots persisted user state. */ userState?: UserState; /* * Values that will be copied to the `TurnContext.turnState` at the beginning of each turn. * * @returns The turn state collection. */ readonly initialTurnState: TurnContextStateCollection; /* * Gets the root [Dialog](xref:botbuilder-dialogs.Dialog) ID. * * @returns The root [Dialog](xref:botbuilder-dialogs.Dialog) ID. * Root dialog to start from [onTurn()](#onturn) method. */ rootDialog: Dialog; /** * Global dialogs that you want to have be callable. */ dialogs: DialogSet; /** * Optional. Path resolvers and memory scopes used for conversations with the bot. */ stateConfiguration?: DialogStateManagerConfiguration; /** * Optional. Number of milliseconds to expire the bots conversation state after. */ expireAfter?: number; /** * Set configuration settings. * * @param config Configuration settings to apply. * @returns The cofigured [DialogManager](xref:botbuilder-dialogs.DialogManager) context. */ configure(config: Partial<DialogManagerConfiguration>): this; /** * Runs dialog system in the context of a [TurnContext](xref:botbuilder-core.TurnContext). * * @param context [TurnContext](xref:botbuilder-core.TurnContext) for the current turn of conversation with the user. * @returns Result of running the logic against the activity. */ onTurn(context: TurnContext): Promise<DialogManagerResult>; private registerContainerDialogs; } //# sourceMappingURL=dialogManager.d.ts.map