@microsoft/agents-hosting-dialogs 0.1.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +20 -0
- package/dist/src/agentComponent.d.ts +18 -0
- package/dist/src/agentComponent.js +55 -0
- package/dist/src/agentComponent.js.map +1 -0
- package/dist/src/agentStateSet.d.ts +48 -0
- package/dist/src/agentStateSet.js +66 -0
- package/dist/src/agentStateSet.js.map +1 -0
- package/dist/src/choices/choice.d.ts +14 -0
- package/dist/src/choices/choice.js +7 -0
- package/dist/src/choices/choice.js.map +1 -0
- package/dist/src/choices/choiceFactory.d.ts +81 -0
- package/dist/src/choices/choiceFactory.js +133 -0
- package/dist/src/choices/choiceFactory.js.map +1 -0
- package/dist/src/choices/findChoices.d.ts +28 -0
- package/dist/src/choices/findChoices.js +46 -0
- package/dist/src/choices/findChoices.js.map +1 -0
- package/dist/src/choices/findValues.d.ts +36 -0
- package/dist/src/choices/findValues.js +129 -0
- package/dist/src/choices/findValues.js.map +1 -0
- package/dist/src/choices/index.d.ts +11 -0
- package/dist/src/choices/index.js +28 -0
- package/dist/src/choices/index.js.map +1 -0
- package/dist/src/choices/modelResult.d.ts +11 -0
- package/dist/src/choices/modelResult.js +3 -0
- package/dist/src/choices/modelResult.js.map +1 -0
- package/dist/src/choices/recognizeChoices.d.ts +16 -0
- package/dist/src/choices/recognizeChoices.js +81 -0
- package/dist/src/choices/recognizeChoices.js.map +1 -0
- package/dist/src/choices/tokenizer.d.ts +25 -0
- package/dist/src/choices/tokenizer.js +73 -0
- package/dist/src/choices/tokenizer.js.map +1 -0
- package/dist/src/componentDialog.d.ts +178 -0
- package/dist/src/componentDialog.js +252 -0
- package/dist/src/componentDialog.js.map +1 -0
- package/dist/src/componentRegistration.d.ts +22 -0
- package/dist/src/componentRegistration.js +32 -0
- package/dist/src/componentRegistration.js.map +1 -0
- package/dist/src/configurable.d.ts +22 -0
- package/dist/src/configurable.js +60 -0
- package/dist/src/configurable.js.map +1 -0
- package/dist/src/configuration.d.ts +11 -0
- package/dist/src/configuration.js +17 -0
- package/dist/src/configuration.js.map +1 -0
- package/dist/src/converter.d.ts +13 -0
- package/dist/src/converter.js +7 -0
- package/dist/src/converter.js.map +1 -0
- package/dist/src/dialog.d.ts +184 -0
- package/dist/src/dialog.js +201 -0
- package/dist/src/dialog.js.map +1 -0
- package/dist/src/dialogContainer.d.ts +61 -0
- package/dist/src/dialogContainer.js +82 -0
- package/dist/src/dialogContainer.js.map +1 -0
- package/dist/src/dialogContext.d.ts +272 -0
- package/dist/src/dialogContext.js +444 -0
- package/dist/src/dialogContext.js.map +1 -0
- package/dist/src/dialogContextError.d.ts +27 -0
- package/dist/src/dialogContextError.js +39 -0
- package/dist/src/dialogContextError.js.map +1 -0
- package/dist/src/dialogEvent.d.ts +20 -0
- package/dist/src/dialogEvent.js +3 -0
- package/dist/src/dialogEvent.js.map +1 -0
- package/dist/src/dialogEvents.d.ts +15 -0
- package/dist/src/dialogEvents.js +20 -0
- package/dist/src/dialogEvents.js.map +1 -0
- package/dist/src/dialogHelper.d.ts +32 -0
- package/dist/src/dialogHelper.js +116 -0
- package/dist/src/dialogHelper.js.map +1 -0
- package/dist/src/dialogInstance.d.ts +30 -0
- package/dist/src/dialogInstance.js +3 -0
- package/dist/src/dialogInstance.js.map +1 -0
- package/dist/src/dialogManager.d.ts +73 -0
- package/dist/src/dialogManager.js +156 -0
- package/dist/src/dialogManager.js.map +1 -0
- package/dist/src/dialogReason.d.ts +35 -0
- package/dist/src/dialogReason.js +40 -0
- package/dist/src/dialogReason.js.map +1 -0
- package/dist/src/dialogSet.d.ts +85 -0
- package/dist/src/dialogSet.js +138 -0
- package/dist/src/dialogSet.js.map +1 -0
- package/dist/src/dialogTurnResult.d.ts +34 -0
- package/dist/src/dialogTurnResult.js +3 -0
- package/dist/src/dialogTurnResult.js.map +1 -0
- package/dist/src/dialogTurnStateConstants.d.ts +12 -0
- package/dist/src/dialogTurnStateConstants.js +17 -0
- package/dist/src/dialogTurnStateConstants.js.map +1 -0
- package/dist/src/dialogTurnStatus.d.ts +34 -0
- package/dist/src/dialogTurnStatus.js +39 -0
- package/dist/src/dialogTurnStatus.js.map +1 -0
- package/dist/src/dialogsAgentComponent.d.ts +17 -0
- package/dist/src/dialogsAgentComponent.js +65 -0
- package/dist/src/dialogsAgentComponent.js.map +1 -0
- package/dist/src/dialogsComponentRegistration.d.ts +28 -0
- package/dist/src/dialogsComponentRegistration.js +45 -0
- package/dist/src/dialogsComponentRegistration.js.map +1 -0
- package/dist/src/i18n.d.ts +15 -0
- package/dist/src/i18n.js +28 -0
- package/dist/src/i18n.js.map +1 -0
- package/dist/src/index.d.ts +29 -0
- package/dist/src/index.js +48 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/intentScore.d.ts +11 -0
- package/dist/src/intentScore.js +3 -0
- package/dist/src/intentScore.js.map +1 -0
- package/dist/src/memory/componentMemoryScopes.d.ts +18 -0
- package/dist/src/memory/componentMemoryScopes.js +54 -0
- package/dist/src/memory/componentMemoryScopes.js.map +1 -0
- package/dist/src/memory/componentPathResolvers.d.ts +18 -0
- package/dist/src/memory/componentPathResolvers.js +52 -0
- package/dist/src/memory/componentPathResolvers.js.map +1 -0
- package/dist/src/memory/dialogPath.d.ts +17 -0
- package/dist/src/memory/dialogPath.js +30 -0
- package/dist/src/memory/dialogPath.js.map +1 -0
- package/dist/src/memory/dialogStateManager.d.ts +156 -0
- package/dist/src/memory/dialogStateManager.js +598 -0
- package/dist/src/memory/dialogStateManager.js.map +1 -0
- package/dist/src/memory/index.d.ts +12 -0
- package/dist/src/memory/index.js +29 -0
- package/dist/src/memory/index.js.map +1 -0
- package/dist/src/memory/pathResolvers/aliasPathResolver.d.ts +25 -0
- package/dist/src/memory/pathResolvers/aliasPathResolver.js +37 -0
- package/dist/src/memory/pathResolvers/aliasPathResolver.js.map +1 -0
- package/dist/src/memory/pathResolvers/atAtPathResolver.d.ts +11 -0
- package/dist/src/memory/pathResolvers/atAtPathResolver.js +18 -0
- package/dist/src/memory/pathResolvers/atAtPathResolver.js.map +1 -0
- package/dist/src/memory/pathResolvers/atPathResolver.d.ts +20 -0
- package/dist/src/memory/pathResolvers/atPathResolver.js +46 -0
- package/dist/src/memory/pathResolvers/atPathResolver.js.map +1 -0
- package/dist/src/memory/pathResolvers/dollarPathResolver.d.ts +11 -0
- package/dist/src/memory/pathResolvers/dollarPathResolver.js +18 -0
- package/dist/src/memory/pathResolvers/dollarPathResolver.js.map +1 -0
- package/dist/src/memory/pathResolvers/hashPathResolver.d.ts +11 -0
- package/dist/src/memory/pathResolvers/hashPathResolver.js +18 -0
- package/dist/src/memory/pathResolvers/hashPathResolver.js.map +1 -0
- package/dist/src/memory/pathResolvers/index.d.ts +11 -0
- package/dist/src/memory/pathResolvers/index.js +28 -0
- package/dist/src/memory/pathResolvers/index.js.map +1 -0
- package/dist/src/memory/pathResolvers/pathResolver.d.ts +13 -0
- package/dist/src/memory/pathResolvers/pathResolver.js +7 -0
- package/dist/src/memory/pathResolvers/pathResolver.js.map +1 -0
- package/dist/src/memory/pathResolvers/percentPathResolver.d.ts +11 -0
- package/dist/src/memory/pathResolvers/percentPathResolver.js +18 -0
- package/dist/src/memory/pathResolvers/percentPathResolver.js.map +1 -0
- package/dist/src/memory/scopePath.d.ts +18 -0
- package/dist/src/memory/scopePath.js +23 -0
- package/dist/src/memory/scopePath.js.map +1 -0
- package/dist/src/memory/scopes/agentStateMemoryScope.d.ts +53 -0
- package/dist/src/memory/scopes/agentStateMemoryScope.js +82 -0
- package/dist/src/memory/scopes/agentStateMemoryScope.js.map +1 -0
- package/dist/src/memory/scopes/classMemoryScope.d.ts +29 -0
- package/dist/src/memory/scopes/classMemoryScope.js +65 -0
- package/dist/src/memory/scopes/classMemoryScope.js.map +1 -0
- package/dist/src/memory/scopes/conversationMemoryScope.d.ts +15 -0
- package/dist/src/memory/scopes/conversationMemoryScope.js +23 -0
- package/dist/src/memory/scopes/conversationMemoryScope.js.map +1 -0
- package/dist/src/memory/scopes/dialogClassMemoryScope.d.ts +19 -0
- package/dist/src/memory/scopes/dialogClassMemoryScope.js +42 -0
- package/dist/src/memory/scopes/dialogClassMemoryScope.js.map +1 -0
- package/dist/src/memory/scopes/dialogContextMemoryScope.d.ts +19 -0
- package/dist/src/memory/scopes/dialogContextMemoryScope.js +48 -0
- package/dist/src/memory/scopes/dialogContextMemoryScope.js.map +1 -0
- package/dist/src/memory/scopes/dialogMemoryScope.d.ts +32 -0
- package/dist/src/memory/scopes/dialogMemoryScope.js +74 -0
- package/dist/src/memory/scopes/dialogMemoryScope.js.map +1 -0
- package/dist/src/memory/scopes/index.d.ts +15 -0
- package/dist/src/memory/scopes/index.js +32 -0
- package/dist/src/memory/scopes/index.js.map +1 -0
- package/dist/src/memory/scopes/memoryScope.d.ts +52 -0
- package/dist/src/memory/scopes/memoryScope.js +54 -0
- package/dist/src/memory/scopes/memoryScope.js.map +1 -0
- package/dist/src/memory/scopes/settingsMemoryScope.d.ts +68 -0
- package/dist/src/memory/scopes/settingsMemoryScope.js +216 -0
- package/dist/src/memory/scopes/settingsMemoryScope.js.map +1 -0
- package/dist/src/memory/scopes/thisMemoryScope.d.ts +26 -0
- package/dist/src/memory/scopes/thisMemoryScope.js +43 -0
- package/dist/src/memory/scopes/thisMemoryScope.js.map +1 -0
- package/dist/src/memory/scopes/turnMemoryScope.d.ts +29 -0
- package/dist/src/memory/scopes/turnMemoryScope.js +52 -0
- package/dist/src/memory/scopes/turnMemoryScope.js.map +1 -0
- package/dist/src/memory/scopes/userMemoryScope.d.ts +15 -0
- package/dist/src/memory/scopes/userMemoryScope.js +23 -0
- package/dist/src/memory/scopes/userMemoryScope.js.map +1 -0
- package/dist/src/memory/turnPath.d.ts +21 -0
- package/dist/src/memory/turnPath.js +38 -0
- package/dist/src/memory/turnPath.js.map +1 -0
- package/dist/src/prompts/activityPrompt.d.ts +101 -0
- package/dist/src/prompts/activityPrompt.js +166 -0
- package/dist/src/prompts/activityPrompt.js.map +1 -0
- package/dist/src/prompts/attachmentPrompt.d.ts +37 -0
- package/dist/src/prompts/attachmentPrompt.js +55 -0
- package/dist/src/prompts/attachmentPrompt.js.map +1 -0
- package/dist/src/prompts/choicePrompt.d.ts +83 -0
- package/dist/src/prompts/choicePrompt.js +116 -0
- package/dist/src/prompts/choicePrompt.js.map +1 -0
- package/dist/src/prompts/confirmPrompt.d.ts +82 -0
- package/dist/src/prompts/confirmPrompt.js +163 -0
- package/dist/src/prompts/confirmPrompt.js.map +1 -0
- package/dist/src/prompts/datetimePrompt.d.ts +65 -0
- package/dist/src/prompts/datetimePrompt.js +109 -0
- package/dist/src/prompts/datetimePrompt.js.map +1 -0
- package/dist/src/prompts/index.d.ts +13 -0
- package/dist/src/prompts/index.js +30 -0
- package/dist/src/prompts/index.js.map +1 -0
- package/dist/src/prompts/numberPrompt.d.ts +55 -0
- package/dist/src/prompts/numberPrompt.js +134 -0
- package/dist/src/prompts/numberPrompt.js.map +1 -0
- package/dist/src/prompts/prompt.d.ts +256 -0
- package/dist/src/prompts/prompt.js +260 -0
- package/dist/src/prompts/prompt.js.map +1 -0
- package/dist/src/prompts/promptCultureModels.d.ts +72 -0
- package/dist/src/prompts/promptCultureModels.js +123 -0
- package/dist/src/prompts/promptCultureModels.js.map +1 -0
- package/dist/src/prompts/textPrompt.d.ts +54 -0
- package/dist/src/prompts/textPrompt.js +72 -0
- package/dist/src/prompts/textPrompt.js.map +1 -0
- package/dist/src/recognizer.d.ts +43 -0
- package/dist/src/recognizer.js +104 -0
- package/dist/src/recognizer.js.map +1 -0
- package/dist/src/recognizerResult.d.ts +19 -0
- package/dist/src/recognizerResult.js +24 -0
- package/dist/src/recognizerResult.js.map +1 -0
- package/dist/src/serviceCollection.d.ts +112 -0
- package/dist/src/serviceCollection.js +209 -0
- package/dist/src/serviceCollection.js.map +1 -0
- package/dist/src/stringUtils.d.ts +36 -0
- package/dist/src/stringUtils.js +62 -0
- package/dist/src/stringUtils.js.map +1 -0
- package/dist/src/template.d.ts +18 -0
- package/dist/src/template.js +7 -0
- package/dist/src/template.js.map +1 -0
- package/dist/src/waterfallDialog.d.ts +101 -0
- package/dist/src/waterfallDialog.js +179 -0
- package/dist/src/waterfallDialog.js.map +1 -0
- package/dist/src/waterfallStepContext.d.ts +71 -0
- package/dist/src/waterfallStepContext.js +78 -0
- package/dist/src/waterfallStepContext.js.map +1 -0
- package/package.json +49 -0
- package/src/agentComponent.ts +23 -0
- package/src/agentStateSet.ts +75 -0
- package/src/choices/choice.ts +16 -0
- package/src/choices/choiceFactory.ts +189 -0
- package/src/choices/findChoices.ts +70 -0
- package/src/choices/findValues.ts +179 -0
- package/src/choices/index.ts +11 -0
- package/src/choices/modelResult.ts +11 -0
- package/src/choices/recognizeChoices.ts +94 -0
- package/src/choices/tokenizer.ts +93 -0
- package/src/componentDialog.ts +306 -0
- package/src/componentRegistration.ts +30 -0
- package/src/configurable.ts +55 -0
- package/src/configuration.ts +22 -0
- package/src/converter.ts +15 -0
- package/src/dialog.ts +243 -0
- package/src/dialogContainer.ts +90 -0
- package/src/dialogContext.ts +607 -0
- package/src/dialogContextError.ts +50 -0
- package/src/dialogEvent.ts +23 -0
- package/src/dialogEvents.ts +16 -0
- package/src/dialogHelper.ts +154 -0
- package/src/dialogInstance.ts +32 -0
- package/src/dialogManager.ts +202 -0
- package/src/dialogReason.ts +40 -0
- package/src/dialogSet.ts +168 -0
- package/src/dialogTurnResult.ts +37 -0
- package/src/dialogTurnStateConstants.ts +13 -0
- package/src/dialogTurnStatus.ts +38 -0
- package/src/dialogsAgentComponent.ts +71 -0
- package/src/dialogsComponentRegistration.ts +49 -0
- package/src/i18n.ts +17 -0
- package/src/index.ts +31 -0
- package/src/intentScore.ts +11 -0
- package/src/memory/componentMemoryScopes.ts +28 -0
- package/src/memory/componentPathResolvers.ts +29 -0
- package/src/memory/dialogPath.ts +33 -0
- package/src/memory/dialogStateManager.ts +661 -0
- package/src/memory/index.ts +12 -0
- package/src/memory/pathResolvers/aliasPathResolver.ts +44 -0
- package/src/memory/pathResolvers/atAtPathResolver.ts +14 -0
- package/src/memory/pathResolvers/atPathResolver.ts +45 -0
- package/src/memory/pathResolvers/dollarPathResolver.ts +14 -0
- package/src/memory/pathResolvers/hashPathResolver.ts +14 -0
- package/src/memory/pathResolvers/index.ts +11 -0
- package/src/memory/pathResolvers/pathResolver.ts +14 -0
- package/src/memory/pathResolvers/percentPathResolver.ts +14 -0
- package/src/memory/scopePath.ts +19 -0
- package/src/memory/scopes/agentStateMemoryScope.ts +92 -0
- package/src/memory/scopes/classMemoryScope.ts +71 -0
- package/src/memory/scopes/conversationMemoryScope.ts +19 -0
- package/src/memory/scopes/dialogClassMemoryScope.ts +43 -0
- package/src/memory/scopes/dialogContextMemoryScope.ts +51 -0
- package/src/memory/scopes/dialogMemoryScope.ts +79 -0
- package/src/memory/scopes/index.ts +15 -0
- package/src/memory/scopes/memoryScope.ts +70 -0
- package/src/memory/scopes/settingsMemoryScope.ts +239 -0
- package/src/memory/scopes/thisMemoryScope.ts +44 -0
- package/src/memory/scopes/turnMemoryScope.ts +54 -0
- package/src/memory/scopes/userMemoryScope.ts +19 -0
- package/src/memory/turnPath.ts +45 -0
- package/src/prompts/activityPrompt.ts +202 -0
- package/src/prompts/attachmentPrompt.ts +62 -0
- package/src/prompts/choicePrompt.ts +176 -0
- package/src/prompts/confirmPrompt.ts +182 -0
- package/src/prompts/datetimePrompt.ts +110 -0
- package/src/prompts/index.ts +13 -0
- package/src/prompts/numberPrompt.ts +117 -0
- package/src/prompts/prompt.ts +459 -0
- package/src/prompts/promptCultureModels.ts +178 -0
- package/src/prompts/textPrompt.ts +82 -0
- package/src/recognizer.ts +127 -0
- package/src/recognizerResult.ts +37 -0
- package/src/serviceCollection.ts +305 -0
- package/src/stringUtils.ts +62 -0
- package/src/template.ts +20 -0
- package/src/waterfallDialog.ts +215 -0
- package/src/waterfallStepContext.ts +96 -0
- package/vendor/cldr-data/README.md +5 -0
- package/vendor/cldr-data/main/de/numbers.json +156 -0
- package/vendor/cldr-data/main/en/numbers.json +159 -0
- package/vendor/cldr-data/main/es/numbers.json +156 -0
- package/vendor/cldr-data/main/fr/numbers.json +157 -0
- package/vendor/cldr-data/main/ja/numbers.json +120 -0
- package/vendor/cldr-data/main/nl/numbers.json +156 -0
- package/vendor/cldr-data/main/pt/numbers.json +156 -0
- package/vendor/cldr-data/main/zh/numbers.json +214 -0
- package/vendor/cldr-data/supplemental/likelySubtags.json +1844 -0
- package/vendor/cldr-data/supplemental/numberingSystems.json +343 -0
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DialogContext = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6
|
+
* Licensed under the MIT License.
|
|
7
|
+
*/
|
|
8
|
+
const agents_hosting_1 = require("@microsoft/agents-hosting");
|
|
9
|
+
const memory_1 = require("./memory");
|
|
10
|
+
const dialogContainer_1 = require("./dialogContainer");
|
|
11
|
+
const dialogEvents_1 = require("./dialogEvents");
|
|
12
|
+
const dialogTurnStateConstants_1 = require("./dialogTurnStateConstants");
|
|
13
|
+
const dialogContextError_1 = require("./dialogContextError");
|
|
14
|
+
const dialogReason_1 = require("./dialogReason");
|
|
15
|
+
const dialogTurnStatus_1 = require("./dialogTurnStatus");
|
|
16
|
+
/**
|
|
17
|
+
* Wraps a promise in a try-catch that automatically enriches errors with extra dialog context.
|
|
18
|
+
*
|
|
19
|
+
* @param dialogContext source dialog context from which enriched error properties are sourced
|
|
20
|
+
* @param promise a promise to await inside a try-catch for error enrichment
|
|
21
|
+
* @returns A promise representing the asynchronous operation.
|
|
22
|
+
*/
|
|
23
|
+
const wrapErrors = async (dialogContext, promise) => {
|
|
24
|
+
try {
|
|
25
|
+
return await promise;
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
if (err instanceof dialogContextError_1.DialogContextError) {
|
|
29
|
+
throw err;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
throw new dialogContextError_1.DialogContextError(err, dialogContext);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* @private
|
|
38
|
+
*/
|
|
39
|
+
const ACTIVITY_RECEIVED_EMITTED = Symbol('ActivityReceivedEmitted');
|
|
40
|
+
/**
|
|
41
|
+
* The context for the current dialog turn with respect to a specific DialogSet.
|
|
42
|
+
*
|
|
43
|
+
* @remarks
|
|
44
|
+
* This includes the turn context, information about the dialog set, and the state of the dialog stack.
|
|
45
|
+
*
|
|
46
|
+
* From code outside of a dialog in the set, use DialogSet.createContext
|
|
47
|
+
* to create the dialog context. Then use the methods of the dialog context to manage the progression of dialogs in the set.
|
|
48
|
+
*
|
|
49
|
+
* When you implement a dialog, the dialog context is a parameter available to the various methods you override or implement.
|
|
50
|
+
*
|
|
51
|
+
*/
|
|
52
|
+
class DialogContext {
|
|
53
|
+
/**
|
|
54
|
+
* Creates an new instance of the DialogContext class.
|
|
55
|
+
*
|
|
56
|
+
* @param dialogs The DialogSet for which to create the dialog context.
|
|
57
|
+
* @param contextOrDialogContext The TurnContext or DialogContext for the current turn.
|
|
58
|
+
* @param state The state object to use to read and write DialogState to storage.
|
|
59
|
+
* @remarks Passing in a DialogContext instance will clone the dialog context.
|
|
60
|
+
*/
|
|
61
|
+
constructor(dialogs, contextOrDialogContext, state) {
|
|
62
|
+
/**
|
|
63
|
+
* Gets the services collection which is contextual to this dialog context.
|
|
64
|
+
*/
|
|
65
|
+
this.services = new agents_hosting_1.TurnContextStateCollection();
|
|
66
|
+
this.dialogs = dialogs;
|
|
67
|
+
if (contextOrDialogContext instanceof DialogContext) {
|
|
68
|
+
this.context = contextOrDialogContext.context;
|
|
69
|
+
this.parent = contextOrDialogContext;
|
|
70
|
+
if (this.parent.services) {
|
|
71
|
+
this.parent.services.forEach((value, key) => {
|
|
72
|
+
this.services.set(key, value);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
this.context = contextOrDialogContext;
|
|
78
|
+
}
|
|
79
|
+
if (!Array.isArray(state.dialogStack)) {
|
|
80
|
+
state.dialogStack = [];
|
|
81
|
+
}
|
|
82
|
+
this.stack = state.dialogStack;
|
|
83
|
+
this.state = new memory_1.DialogStateManager(this);
|
|
84
|
+
this.state.setValue(memory_1.TurnPath.activity, this.context.activity);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* @returns Dialog context for child if the active dialog is a container.
|
|
88
|
+
*/
|
|
89
|
+
get child() {
|
|
90
|
+
const instance = this.activeDialog;
|
|
91
|
+
if (instance !== undefined) {
|
|
92
|
+
// Is active dialog a container?
|
|
93
|
+
const dialog = this.findDialog(instance.id);
|
|
94
|
+
if (dialog instanceof dialogContainer_1.DialogContainer) {
|
|
95
|
+
return dialog.createChildContext(this);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* @returns The state information for the dialog on the top of the dialog stack, or `undefined` if
|
|
102
|
+
* the stack is empty.
|
|
103
|
+
*/
|
|
104
|
+
get activeDialog() {
|
|
105
|
+
return this.stack.length > 0 ? this.stack[this.stack.length - 1] : undefined;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* @deprecated This property serves no function.
|
|
109
|
+
* @returns The current dialog manager instance. This property is deprecated.
|
|
110
|
+
*/
|
|
111
|
+
get dialogManager() {
|
|
112
|
+
return this.context.turnState.get(dialogTurnStateConstants_1.DialogTurnStateConstants.dialogManager);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Obtain the CultureInfo in DialogContext.
|
|
116
|
+
*
|
|
117
|
+
* @returns a locale string.
|
|
118
|
+
*/
|
|
119
|
+
getLocale() {
|
|
120
|
+
var _a;
|
|
121
|
+
const _turnLocaleProperty = 'turn.locale';
|
|
122
|
+
const turnLocaleValue = this.state.getValue(_turnLocaleProperty);
|
|
123
|
+
if (turnLocaleValue) {
|
|
124
|
+
return turnLocaleValue;
|
|
125
|
+
}
|
|
126
|
+
const locale = (_a = this.context.activity) === null || _a === void 0 ? void 0 : _a.locale;
|
|
127
|
+
if (locale !== undefined) {
|
|
128
|
+
return locale;
|
|
129
|
+
}
|
|
130
|
+
return Intl.DateTimeFormat().resolvedOptions().locale;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Starts a dialog instance and pushes it onto the dialog stack.
|
|
134
|
+
* Creates a new instance of the dialog and pushes it onto the stack.
|
|
135
|
+
*
|
|
136
|
+
* @param dialogId ID of the dialog to start.
|
|
137
|
+
* @param options Optional. Arguments to pass into the dialog when it starts.
|
|
138
|
+
* @returns {Promise<DialogTurnResult>} a promise resolving to the dialog turn result.
|
|
139
|
+
* @remarks
|
|
140
|
+
* If there's already an active dialog on the stack, that dialog will be paused until
|
|
141
|
+
* it is again the top dialog on the stack.
|
|
142
|
+
*
|
|
143
|
+
* The DialogTurnResult.status of returned object describes
|
|
144
|
+
* the status of the dialog stack after this method completes.
|
|
145
|
+
*
|
|
146
|
+
* This method throws an exception if the requested dialog can't be found in this dialog context
|
|
147
|
+
* or any of its ancestors.
|
|
148
|
+
*
|
|
149
|
+
*/
|
|
150
|
+
async beginDialog(dialogId, options) {
|
|
151
|
+
// Lookup dialog
|
|
152
|
+
const dialog = this.findDialog(dialogId);
|
|
153
|
+
if (!dialog) {
|
|
154
|
+
throw new dialogContextError_1.DialogContextError(`DialogContext.beginDialog(): A dialog with an id of '${dialogId}' wasn't found.`, this);
|
|
155
|
+
}
|
|
156
|
+
// Push new instance onto stack.
|
|
157
|
+
const instance = {
|
|
158
|
+
id: dialogId,
|
|
159
|
+
state: {},
|
|
160
|
+
};
|
|
161
|
+
this.stack.push(instance);
|
|
162
|
+
// Call dialogs begin() method.
|
|
163
|
+
return wrapErrors(this, dialog.beginDialog(this, options));
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Cancels all dialogs on the dialog stack, and clears stack.
|
|
167
|
+
*
|
|
168
|
+
* @param cancelParents Optional. If `true` all parent dialogs will be cancelled as well.
|
|
169
|
+
* @param eventName Optional. Name of a custom event to raise as dialogs are cancelled. This defaults to DialogEvents.cancelDialog.
|
|
170
|
+
* @param eventValue Optional. Value to pass along with custom cancellation event.
|
|
171
|
+
* @returns {Promise<DialogTurnResult>} a promise resolving to the dialog turn result.
|
|
172
|
+
* @remarks
|
|
173
|
+
* This calls each dialog's .Dialog.endDialog method before
|
|
174
|
+
* removing the dialog from the stack.
|
|
175
|
+
*
|
|
176
|
+
* If there were any dialogs on the stack initially, the DialogTurnResult.status
|
|
177
|
+
* of the return value is DialogTurnStatus.cancelled; otherwise, it's
|
|
178
|
+
* DialogTurnStatus.empty.
|
|
179
|
+
*
|
|
180
|
+
*/
|
|
181
|
+
async cancelAllDialogs(cancelParents = false, eventName, eventValue) {
|
|
182
|
+
eventName = eventName || dialogEvents_1.DialogEvents.cancelDialog;
|
|
183
|
+
if (this.stack.length > 0 || this.parent !== undefined) {
|
|
184
|
+
// Cancel all local and parent dialogs while checking for interception
|
|
185
|
+
let notify = false;
|
|
186
|
+
let dialogContext = this;
|
|
187
|
+
while (dialogContext !== undefined) {
|
|
188
|
+
if (dialogContext.stack.length > 0) {
|
|
189
|
+
// Check to see if the dialog wants to handle the event
|
|
190
|
+
// - We skip notifying the first dialog which actually called cancelAllDialogs()
|
|
191
|
+
if (notify) {
|
|
192
|
+
const handled = await dialogContext.emitEvent(eventName, eventValue, false, false);
|
|
193
|
+
if (handled) {
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
// End the active dialog
|
|
198
|
+
await dialogContext.endActiveDialog(dialogReason_1.DialogReason.cancelCalled);
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
dialogContext = cancelParents ? dialogContext.parent : undefined;
|
|
202
|
+
}
|
|
203
|
+
notify = true;
|
|
204
|
+
}
|
|
205
|
+
return { status: dialogTurnStatus_1.DialogTurnStatus.cancelled };
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
return { status: dialogTurnStatus_1.DialogTurnStatus.empty };
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Searches for a dialog with a given ID.
|
|
213
|
+
*
|
|
214
|
+
* @param dialogId ID of the dialog to search for.
|
|
215
|
+
* @returns The dialog for the provided ID.
|
|
216
|
+
* @remarks
|
|
217
|
+
* If the dialog to start is not found in the DialogSet associated
|
|
218
|
+
* with this dialog context, it attempts to find the dialog in its parent dialog context.
|
|
219
|
+
*
|
|
220
|
+
*/
|
|
221
|
+
findDialog(dialogId) {
|
|
222
|
+
let dialog = this.dialogs.find(dialogId);
|
|
223
|
+
if (!dialog && this.parent) {
|
|
224
|
+
dialog = this.parent.findDialog(dialogId);
|
|
225
|
+
}
|
|
226
|
+
return dialog;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Helper function to simplify formatting the options for calling a prompt dialog.
|
|
230
|
+
*
|
|
231
|
+
* @param dialogId ID of the prompt dialog to start.
|
|
232
|
+
* @param promptOrOptions The text of the initial prompt to send the user,
|
|
233
|
+
* or the Activity to send as the initial prompt.
|
|
234
|
+
* @param choices Optional. Array of choices for the user to choose from,
|
|
235
|
+
* for use with a ChoicePrompt.
|
|
236
|
+
* @returns {Promise<DialogTurnResult>} a promise resolving to the dialog turn result.
|
|
237
|
+
* @remarks This helper method formats the object to use as the `options` parameter, and then calls
|
|
238
|
+
* beginDialog to start the specified prompt dialog.
|
|
239
|
+
*
|
|
240
|
+
*/
|
|
241
|
+
async prompt(dialogId, promptOrOptions, choices) {
|
|
242
|
+
let options;
|
|
243
|
+
if ((typeof promptOrOptions === 'object' && promptOrOptions.type !== undefined) ||
|
|
244
|
+
typeof promptOrOptions === 'string') {
|
|
245
|
+
options = { prompt: promptOrOptions };
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
options = { ...promptOrOptions };
|
|
249
|
+
}
|
|
250
|
+
if (choices) {
|
|
251
|
+
options.choices = choices;
|
|
252
|
+
}
|
|
253
|
+
return wrapErrors(this, this.beginDialog(dialogId, options));
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Continues execution of the active dialog, if there is one, by passing this dialog context to its
|
|
257
|
+
* Dialog.continueDialog method.
|
|
258
|
+
*
|
|
259
|
+
* @returns {Promise<DialogTurnResult>} a promise resolving to the dialog turn result.
|
|
260
|
+
* @remarks
|
|
261
|
+
* After the call completes, you can check the turn context's TurnContext.responded
|
|
262
|
+
* property to determine if the dialog sent a reply to the user.
|
|
263
|
+
*
|
|
264
|
+
* The DialogTurnResult.status of returned object describes
|
|
265
|
+
* the status of the dialog stack after this method completes.
|
|
266
|
+
*
|
|
267
|
+
* Typically, you would call this from within your agent's turn handler.
|
|
268
|
+
*
|
|
269
|
+
*/
|
|
270
|
+
async continueDialog() {
|
|
271
|
+
// if we are continuing and haven't emitted the activityReceived event, emit it
|
|
272
|
+
// NOTE: This is backward compatible way for activity received to be fired even if you have legacy dialog loop
|
|
273
|
+
if (!this.context.turnState.has(ACTIVITY_RECEIVED_EMITTED)) {
|
|
274
|
+
this.context.turnState.set(ACTIVITY_RECEIVED_EMITTED, true);
|
|
275
|
+
// Dispatch "activityReceived" event
|
|
276
|
+
// - This fired from teh leaf and will queue up any interruptions.
|
|
277
|
+
await this.emitEvent(dialogEvents_1.DialogEvents.activityReceived, this.context.activity, true, true);
|
|
278
|
+
}
|
|
279
|
+
// Check for a dialog on the stack
|
|
280
|
+
const instance = this.activeDialog;
|
|
281
|
+
if (instance) {
|
|
282
|
+
// Lookup dialog
|
|
283
|
+
const dialog = this.findDialog(instance.id);
|
|
284
|
+
if (!dialog) {
|
|
285
|
+
throw new dialogContextError_1.DialogContextError(`DialogContext.continueDialog(): Can't continue dialog. A dialog with an id of '${instance.id}' wasn't found.`, this);
|
|
286
|
+
}
|
|
287
|
+
// Continue execution of dialog
|
|
288
|
+
return wrapErrors(this, dialog.continueDialog(this));
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
return { status: dialogTurnStatus_1.DialogTurnStatus.empty };
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Ends a dialog and pops it off the stack. Returns an optional result to the dialog's parent.
|
|
296
|
+
*
|
|
297
|
+
* @param result Optional. A result to pass to the parent logic. This might be the next dialog
|
|
298
|
+
* on the stack, or if this was the last dialog on the stack, a parent dialog context or
|
|
299
|
+
* the agent's turn handler.
|
|
300
|
+
* @returns {Promise<DialogTurnResult>} a promise resolving to the dialog turn result.
|
|
301
|
+
* @remarks
|
|
302
|
+
* The _parent_ dialog is the next dialog on the dialog stack, if there is one. This method
|
|
303
|
+
* calls the parent's Dialog.resumeDialog method,
|
|
304
|
+
* passing the result returned by the ending dialog. If there is no parent dialog, the turn ends
|
|
305
|
+
* and the result is available to the agent through the returned object's
|
|
306
|
+
* DialogTurnResult.result property.
|
|
307
|
+
*
|
|
308
|
+
* The DialogTurnResult.status of returned object describes
|
|
309
|
+
* the status of the dialog stack after this method completes.
|
|
310
|
+
*
|
|
311
|
+
* Typically, you would call this from within the logic for a specific dialog to signal back to
|
|
312
|
+
* the dialog context that the dialog has completed, the dialog should be removed from the stack,
|
|
313
|
+
* and the parent dialog should resume.
|
|
314
|
+
*
|
|
315
|
+
*/
|
|
316
|
+
async endDialog(result) {
|
|
317
|
+
// End the active dialog
|
|
318
|
+
await this.endActiveDialog(dialogReason_1.DialogReason.endCalled, result);
|
|
319
|
+
// Resume parent dialog
|
|
320
|
+
const instance = this.activeDialog;
|
|
321
|
+
if (instance) {
|
|
322
|
+
// Lookup dialog
|
|
323
|
+
const dialog = this.findDialog(instance.id);
|
|
324
|
+
if (!dialog) {
|
|
325
|
+
throw new dialogContextError_1.DialogContextError(`DialogContext.endDialog(): Can't resume previous dialog. A dialog with an id of '${instance.id}' wasn't found.`, this);
|
|
326
|
+
}
|
|
327
|
+
// Return result to previous dialog
|
|
328
|
+
return wrapErrors(this, dialog.resumeDialog(this, dialogReason_1.DialogReason.endCalled, result));
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
// Signal completion
|
|
332
|
+
return { status: dialogTurnStatus_1.DialogTurnStatus.complete, result };
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Ends the active dialog and starts a new dialog in its place.
|
|
337
|
+
*
|
|
338
|
+
* @param dialogId ID of the dialog to start.
|
|
339
|
+
* @param options Optional. Arguments to pass into the new dialog when it starts.
|
|
340
|
+
* @returns {Promise<DialogTurnResult>} a promise resolving to the dialog turn result.
|
|
341
|
+
* @remarks
|
|
342
|
+
* This is particularly useful for creating a loop or redirecting to another dialog.
|
|
343
|
+
*
|
|
344
|
+
* The DialogTurnResult.status of returned object describes
|
|
345
|
+
* the status of the dialog stack after this method completes.
|
|
346
|
+
*
|
|
347
|
+
* This method is similar to ending the current dialog and immediately beginning the new one.
|
|
348
|
+
* However, the parent dialog is neither resumed nor otherwise notified.
|
|
349
|
+
*
|
|
350
|
+
*/
|
|
351
|
+
async replaceDialog(dialogId, options) {
|
|
352
|
+
// End the active dialog
|
|
353
|
+
await this.endActiveDialog(dialogReason_1.DialogReason.replaceCalled);
|
|
354
|
+
// Start replacement dialog
|
|
355
|
+
return this.beginDialog(dialogId, options);
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Requests the active dialog to re-prompt the user for input.
|
|
359
|
+
*
|
|
360
|
+
* @remarks
|
|
361
|
+
* This calls the active dialog's Dialog.repromptDialog method.
|
|
362
|
+
*
|
|
363
|
+
*/
|
|
364
|
+
async repromptDialog() {
|
|
365
|
+
// Try raising event first
|
|
366
|
+
const handled = await this.emitEvent(dialogEvents_1.DialogEvents.repromptDialog, undefined, false, false);
|
|
367
|
+
if (!handled) {
|
|
368
|
+
// Check for a dialog on the stack
|
|
369
|
+
const instance = this.activeDialog;
|
|
370
|
+
if (instance) {
|
|
371
|
+
// Lookup dialog
|
|
372
|
+
const dialog = this.findDialog(instance.id);
|
|
373
|
+
if (!dialog) {
|
|
374
|
+
throw new dialogContextError_1.DialogContextError(`DialogContext.repromptDialog(): Can't find a dialog with an id of '${instance.id}'.`, this);
|
|
375
|
+
}
|
|
376
|
+
// Ask dialog to re-prompt if supported
|
|
377
|
+
await wrapErrors(this, dialog.repromptDialog(this.context, instance));
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Searches for a dialog with a given ID.
|
|
383
|
+
*
|
|
384
|
+
* @remarks
|
|
385
|
+
* Emits a named event for the current dialog, or someone who started it, to handle.
|
|
386
|
+
* @param name Name of the event to raise.
|
|
387
|
+
* @param value Optional. Value to send along with the event.
|
|
388
|
+
* @param bubble Optional. Flag to control whether the event should be bubbled to its parent if not handled locally. Defaults to a value of `true`.
|
|
389
|
+
* @param fromLeaf Optional. Whether the event is emitted from a leaf node.
|
|
390
|
+
* @returns `true` if the event was handled.
|
|
391
|
+
*/
|
|
392
|
+
async emitEvent(name, value, bubble = true, fromLeaf = false) {
|
|
393
|
+
// Initialize event
|
|
394
|
+
const dialogEvent = {
|
|
395
|
+
bubble,
|
|
396
|
+
name,
|
|
397
|
+
value,
|
|
398
|
+
};
|
|
399
|
+
// Find starting dialog
|
|
400
|
+
let dialogContext = this;
|
|
401
|
+
if (fromLeaf) {
|
|
402
|
+
while (true) {
|
|
403
|
+
const childDialogContext = dialogContext.child;
|
|
404
|
+
if (childDialogContext !== undefined) {
|
|
405
|
+
dialogContext = childDialogContext;
|
|
406
|
+
}
|
|
407
|
+
else {
|
|
408
|
+
break;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
// Dispatch to active dialog first
|
|
413
|
+
// - The active dialog will decide if it should bubble the event to its parent.
|
|
414
|
+
const instance = dialogContext.activeDialog;
|
|
415
|
+
if (instance !== undefined) {
|
|
416
|
+
const dialog = dialogContext.findDialog(instance.id);
|
|
417
|
+
if (dialog !== undefined) {
|
|
418
|
+
return wrapErrors(this, dialog.onDialogEvent(dialogContext, dialogEvent));
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
return false;
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* @private
|
|
425
|
+
* @param reason
|
|
426
|
+
* @param result
|
|
427
|
+
*/
|
|
428
|
+
async endActiveDialog(reason, result) {
|
|
429
|
+
const instance = this.activeDialog;
|
|
430
|
+
if (instance) {
|
|
431
|
+
// Lookup dialog
|
|
432
|
+
const dialog = this.findDialog(instance.id);
|
|
433
|
+
if (dialog) {
|
|
434
|
+
// Notify dialog of end
|
|
435
|
+
await wrapErrors(this, dialog.endDialog(this.context, instance, reason));
|
|
436
|
+
}
|
|
437
|
+
// Pop dialog off stack
|
|
438
|
+
this.stack.pop();
|
|
439
|
+
this.state.setValue(memory_1.TurnPath.lastResult, result);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
exports.DialogContext = DialogContext;
|
|
444
|
+
//# sourceMappingURL=dialogContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialogContext.js","sourceRoot":"","sources":["../../src/dialogContext.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,8DAA6F;AAI7F,qCAAuD;AACvD,uDAAmD;AACnD,iDAA6C;AAE7C,yEAAqE;AACrE,6DAAyD;AAEzD,iDAA6C;AAG7C,yDAAqD;AAGrD;;;;;;GAMG;AACH,MAAM,UAAU,GAAG,KAAK,EAAK,aAA4B,EAAE,OAAmB,EAAc,EAAE;IAC5F,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,CAAA;IACtB,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QAClB,IAAI,GAAG,YAAY,uCAAkB,EAAE,CAAC;YACtC,MAAM,GAAG,CAAA;QACX,CAAC;aAAM,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KAAK,CAAA;IACd,CAAC;IAED;;;;SAIK;IACG,KAAK,CAAC,eAAe,CAAE,MAAoB,EAAE,MAAY;QAC/D,MAAM,QAAQ,GAAwB,IAAI,CAAC,YAAY,CAAA;QACvD,IAAI,QAAQ,EAAE,CAAC;YACb,gBAAgB;YAChB,MAAM,MAAM,GAAe,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;YACvD,IAAI,MAAM,EAAE,CAAC;gBACX,uBAAuB;gBACvB,MAAM,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAA;YAC1E,CAAC;YAED,uBAAuB;YACvB,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAA;YAEhB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,iBAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;QAClD,CAAC;IACH,CAAC;CACF;AAphBD,sCAohBC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { DialogContext } from './dialogContext';
|
|
6
|
+
import { DialogInstance } from './dialogInstance';
|
|
7
|
+
/**
|
|
8
|
+
* An Error that includes extra dialog context, including the dialog stack.
|
|
9
|
+
*/
|
|
10
|
+
export declare class DialogContextError extends Error {
|
|
11
|
+
readonly error: Error | string;
|
|
12
|
+
/**
|
|
13
|
+
* Represents the state of a dialog when an error occurred.
|
|
14
|
+
*/
|
|
15
|
+
readonly dialogContext: {
|
|
16
|
+
activeDialog?: string;
|
|
17
|
+
parent?: string;
|
|
18
|
+
stack: DialogInstance[];
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Construct a DialogError.
|
|
22
|
+
*
|
|
23
|
+
* @param {Error | string} error Source error or error message.
|
|
24
|
+
* @param {DialogContext} dialogContext Dialog context that is the source of the error.
|
|
25
|
+
*/
|
|
26
|
+
constructor(error: Error | string, dialogContext: DialogContext);
|
|
27
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DialogContextError = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6
|
+
* Licensed under the MIT License.
|
|
7
|
+
*/
|
|
8
|
+
const dialogContext_1 = require("./dialogContext");
|
|
9
|
+
/**
|
|
10
|
+
* An Error that includes extra dialog context, including the dialog stack.
|
|
11
|
+
*/
|
|
12
|
+
class DialogContextError extends Error {
|
|
13
|
+
/**
|
|
14
|
+
* Construct a DialogError.
|
|
15
|
+
*
|
|
16
|
+
* @param {Error | string} error Source error or error message.
|
|
17
|
+
* @param {DialogContext} dialogContext Dialog context that is the source of the error.
|
|
18
|
+
*/
|
|
19
|
+
constructor(error, dialogContext) {
|
|
20
|
+
var _a, _b, _c;
|
|
21
|
+
super();
|
|
22
|
+
this.error = error;
|
|
23
|
+
if (!(error instanceof Error) && typeof error !== 'string') {
|
|
24
|
+
throw new Error('`error` argument must be an Error or a string');
|
|
25
|
+
}
|
|
26
|
+
if (!(dialogContext instanceof dialogContext_1.DialogContext)) {
|
|
27
|
+
throw new Error('`dialogContext` argument must be of type DialogContext');
|
|
28
|
+
}
|
|
29
|
+
this.name = 'DialogContextError';
|
|
30
|
+
this.message = error instanceof Error ? error.message : error;
|
|
31
|
+
this.dialogContext = {
|
|
32
|
+
activeDialog: (_a = dialogContext.activeDialog) === null || _a === void 0 ? void 0 : _a.id,
|
|
33
|
+
parent: (_c = (_b = dialogContext.parent) === null || _b === void 0 ? void 0 : _b.activeDialog) === null || _c === void 0 ? void 0 : _c.id,
|
|
34
|
+
stack: dialogContext.stack,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.DialogContextError = DialogContextError;
|
|
39
|
+
//# sourceMappingURL=dialogContextError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialogContextError.js","sourceRoot":"","sources":["../../src/dialogContextError.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,mDAA+C;AAG/C;;GAEG;AACH,MAAa,kBAAmB,SAAQ,KAAK;IAU3C;;;;;SAKK;IACL,YACW,KAAqB,EAC9B,aAA4B;;QAE5B,KAAK,EAAE,CAAA;QAHE,UAAK,GAAL,KAAK,CAAgB;QAK9B,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC3D,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAA;QAClE,CAAC;QAED,IAAI,CAAC,CAAC,aAAa,YAAY,6BAAa,CAAC,EAAE,CAAC;YAC9C,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAA;QAC3E,CAAC;QAED,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAA;QAChC,IAAI,CAAC,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAA;QAE7D,IAAI,CAAC,aAAa,GAAG;YACnB,YAAY,EAAE,MAAA,aAAa,CAAC,YAAY,0CAAE,EAAE;YAC5C,MAAM,EAAE,MAAA,MAAA,aAAa,CAAC,MAAM,0CAAE,YAAY,0CAAE,EAAE;YAC9C,KAAK,EAAE,aAAa,CAAC,KAAK;SAC3B,CAAA;IACH,CAAC;CACF;AAvCD,gDAuCC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface DialogEvent {
|
|
2
|
+
/**
|
|
3
|
+
* Flag indicating whether the event will be bubbled to the parent `DialogContext`.
|
|
4
|
+
*/
|
|
5
|
+
bubble: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Name of the event being raised.
|
|
8
|
+
*/
|
|
9
|
+
name: string;
|
|
10
|
+
/**
|
|
11
|
+
* Optional. Value associated with the event.
|
|
12
|
+
*/
|
|
13
|
+
value?: any;
|
|
14
|
+
}
|
|
15
|
+
export interface DialogConfiguration {
|
|
16
|
+
/**
|
|
17
|
+
* Static id of the dialog.
|
|
18
|
+
*/
|
|
19
|
+
id?: string;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialogEvent.js","sourceRoot":"","sources":["../../src/dialogEvent.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Represents the events related to the "lifecycle" of the dialog.
|
|
7
|
+
*/
|
|
8
|
+
export declare class DialogEvents {
|
|
9
|
+
static readonly beginDialog = "beginDialog";
|
|
10
|
+
static readonly repromptDialog = "repromptDialog";
|
|
11
|
+
static readonly cancelDialog = "cancelDialog";
|
|
12
|
+
static readonly activityReceived = "activityReceived";
|
|
13
|
+
static readonly versionChanged = "versionChanged";
|
|
14
|
+
static readonly error = "error";
|
|
15
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.DialogEvents = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* Represents the events related to the "lifecycle" of the dialog.
|
|
10
|
+
*/
|
|
11
|
+
class DialogEvents {
|
|
12
|
+
}
|
|
13
|
+
exports.DialogEvents = DialogEvents;
|
|
14
|
+
DialogEvents.beginDialog = 'beginDialog';
|
|
15
|
+
DialogEvents.repromptDialog = 'repromptDialog';
|
|
16
|
+
DialogEvents.cancelDialog = 'cancelDialog';
|
|
17
|
+
DialogEvents.activityReceived = 'activityReceived';
|
|
18
|
+
DialogEvents.versionChanged = 'versionChanged';
|
|
19
|
+
DialogEvents.error = 'error';
|
|
20
|
+
//# sourceMappingURL=dialogEvents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialogEvents.js","sourceRoot":"","sources":["../../src/dialogEvents.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;GAEG;AACH,MAAa,YAAY;;AAAzB,oCAOC;AANiB,wBAAW,GAAG,aAAa,CAAA;AAC3B,2BAAc,GAAG,gBAAgB,CAAA;AACjC,yBAAY,GAAG,cAAc,CAAA;AAC7B,6BAAgB,GAAG,kBAAkB,CAAA;AACrC,2BAAc,GAAG,gBAAgB,CAAA;AACjC,kBAAK,GAAG,OAAO,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { AgentStatePropertyAccessor, TurnContext } from '@microsoft/agents-hosting';
|
|
6
|
+
import { Dialog } from './dialog';
|
|
7
|
+
import { DialogContext, DialogState } from './dialogContext';
|
|
8
|
+
import { DialogStateManagerConfiguration } from './memory';
|
|
9
|
+
import { DialogTurnResult } from './dialogTurnResult';
|
|
10
|
+
/**
|
|
11
|
+
* Runs a dialog from a given context and accessor.
|
|
12
|
+
*
|
|
13
|
+
* @param dialog The Dialog to run.
|
|
14
|
+
* @param context TurnContext object for the current turn of conversation with the user.
|
|
15
|
+
* @param accessor Defined methods for accessing the state property created in a State object.
|
|
16
|
+
*/
|
|
17
|
+
export declare function runDialog(dialog: Dialog, context: TurnContext, accessor: AgentStatePropertyAccessor<DialogState>): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* @param context The TurnContext for the turn.
|
|
20
|
+
* @param dialogId The dialog ID.
|
|
21
|
+
* @param dialogContext The DialogContext for the current turn of conversation.
|
|
22
|
+
* @param dialogStateManagerConfiguration Configuration for the dialog state manager.
|
|
23
|
+
* @returns {Promise<DialogTurnResult>} a promise resolving to the dialog turn result.
|
|
24
|
+
*/
|
|
25
|
+
export declare function internalRun(context: TurnContext, dialogId: string, dialogContext: DialogContext, dialogStateManagerConfiguration?: DialogStateManagerConfiguration): Promise<DialogTurnResult>;
|
|
26
|
+
/**
|
|
27
|
+
* Recursively walk up the dialog context stack to find the active DC.
|
|
28
|
+
*
|
|
29
|
+
* @param dialogContext DialogContext for the current turn of conversation with the user.
|
|
30
|
+
* @returns Active DialogContext.
|
|
31
|
+
*/
|
|
32
|
+
export declare function getActiveDialogContext(dialogContext: DialogContext): DialogContext;
|