@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,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { PathResolver } from './pathResolver';
|
|
6
|
+
export declare class AliasPathResolver implements PathResolver {
|
|
7
|
+
private readonly alias;
|
|
8
|
+
private readonly prefix;
|
|
9
|
+
private readonly postfix;
|
|
10
|
+
/**
|
|
11
|
+
* Initializes a new instance of the AliasPathResolver class.
|
|
12
|
+
*
|
|
13
|
+
* @param alias Alias name.
|
|
14
|
+
* @param prefix Prefix name.
|
|
15
|
+
* @param postfix Postfix name.
|
|
16
|
+
*/
|
|
17
|
+
constructor(alias: string, prefix: string, postfix?: string);
|
|
18
|
+
/**
|
|
19
|
+
* Transforms the path.
|
|
20
|
+
*
|
|
21
|
+
* @param path Path to inspect.
|
|
22
|
+
* @returns The transformed path.
|
|
23
|
+
*/
|
|
24
|
+
transformPath(path: string): string;
|
|
25
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AliasPathResolver = void 0;
|
|
4
|
+
class AliasPathResolver {
|
|
5
|
+
/**
|
|
6
|
+
* Initializes a new instance of the AliasPathResolver class.
|
|
7
|
+
*
|
|
8
|
+
* @param alias Alias name.
|
|
9
|
+
* @param prefix Prefix name.
|
|
10
|
+
* @param postfix Postfix name.
|
|
11
|
+
*/
|
|
12
|
+
constructor(alias, prefix, postfix) {
|
|
13
|
+
this.alias = alias.trim();
|
|
14
|
+
this.prefix = prefix.trim();
|
|
15
|
+
this.postfix = postfix ? postfix.trim() : '';
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Transforms the path.
|
|
19
|
+
*
|
|
20
|
+
* @param path Path to inspect.
|
|
21
|
+
* @returns The transformed path.
|
|
22
|
+
*/
|
|
23
|
+
transformPath(path) {
|
|
24
|
+
const start = path.indexOf(this.alias);
|
|
25
|
+
if (start === 0) {
|
|
26
|
+
// here we only deals with trailing alias, alias in middle be handled in further breakdown
|
|
27
|
+
// $xxx -> path.xxx
|
|
28
|
+
path = `${this.prefix}${path.substr(start + this.alias.length)}${this.postfix}`;
|
|
29
|
+
if (path.endsWith('.')) {
|
|
30
|
+
path = path.substr(0, path.length - 1);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return path;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.AliasPathResolver = AliasPathResolver;
|
|
37
|
+
//# sourceMappingURL=aliasPathResolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aliasPathResolver.js","sourceRoot":"","sources":["../../../../src/memory/pathResolvers/aliasPathResolver.ts"],"names":[],"mappings":";;;AAMA,MAAa,iBAAiB;IAK5B;;;;;;SAMK;IACL,YAAa,KAAa,EAAE,MAAc,EAAE,OAAgB;QAC1D,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,CAAA;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,CAAA;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;IAC9C,CAAC;IAED;;;;;SAKK;IACL,aAAa,CAAE,IAAY;QACzB,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACtC,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;YAChB,0FAA0F;YAC1F,mBAAmB;YACnB,IAAI,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,CAAA;YAC/E,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBACvB,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;YACxC,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AArCD,8CAqCC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { AliasPathResolver } from './aliasPathResolver';
|
|
6
|
+
export declare class AtAtPathResolver extends AliasPathResolver {
|
|
7
|
+
/**
|
|
8
|
+
* Initializes a new instance of the AtAtPathResolver class.
|
|
9
|
+
*/
|
|
10
|
+
constructor();
|
|
11
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AtAtPathResolver = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6
|
+
* Licensed under the MIT License.
|
|
7
|
+
*/
|
|
8
|
+
const aliasPathResolver_1 = require("./aliasPathResolver");
|
|
9
|
+
class AtAtPathResolver extends aliasPathResolver_1.AliasPathResolver {
|
|
10
|
+
/**
|
|
11
|
+
* Initializes a new instance of the AtAtPathResolver class.
|
|
12
|
+
*/
|
|
13
|
+
constructor() {
|
|
14
|
+
super('@@', 'turn.recognized.entities.');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.AtAtPathResolver = AtAtPathResolver;
|
|
18
|
+
//# sourceMappingURL=atAtPathResolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atAtPathResolver.js","sourceRoot":"","sources":["../../../../src/memory/pathResolvers/atAtPathResolver.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,2DAAuD;AAEvD,MAAa,gBAAiB,SAAQ,qCAAiB;IACrD;;SAEK;IACL;QACE,KAAK,CAAC,IAAI,EAAE,2BAA2B,CAAC,CAAA;IAC1C,CAAC;CACF;AAPD,4CAOC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { AliasPathResolver } from './aliasPathResolver';
|
|
6
|
+
export declare class AtPathResolver extends AliasPathResolver {
|
|
7
|
+
private readonly _prefix;
|
|
8
|
+
private readonly _delims;
|
|
9
|
+
/**
|
|
10
|
+
* Initializes a new instance of the AtPathResolver class.
|
|
11
|
+
*/
|
|
12
|
+
constructor();
|
|
13
|
+
/**
|
|
14
|
+
* Transforms the path.
|
|
15
|
+
*
|
|
16
|
+
* @param path Path to inspect.
|
|
17
|
+
* @returns The transformed path.
|
|
18
|
+
*/
|
|
19
|
+
transformPath(path: string): string;
|
|
20
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AtPathResolver = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6
|
+
* Licensed under the MIT License.
|
|
7
|
+
*/
|
|
8
|
+
const aliasPathResolver_1 = require("./aliasPathResolver");
|
|
9
|
+
class AtPathResolver extends aliasPathResolver_1.AliasPathResolver {
|
|
10
|
+
/**
|
|
11
|
+
* Initializes a new instance of the AtPathResolver class.
|
|
12
|
+
*/
|
|
13
|
+
constructor() {
|
|
14
|
+
super('@', '');
|
|
15
|
+
this._prefix = 'turn.recognized.entities.';
|
|
16
|
+
this._delims = ['.', '['];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Transforms the path.
|
|
20
|
+
*
|
|
21
|
+
* @param path Path to inspect.
|
|
22
|
+
* @returns The transformed path.
|
|
23
|
+
*/
|
|
24
|
+
transformPath(path) {
|
|
25
|
+
path = path.trim();
|
|
26
|
+
if (path.startsWith('@') && path.length > 1 && !path.startsWith('@@')) {
|
|
27
|
+
let end = -1;
|
|
28
|
+
for (let i = 0; i < this._delims.length; i++) {
|
|
29
|
+
const indexOfDelim = path.indexOf(this._delims[i]);
|
|
30
|
+
if (indexOfDelim >= 0) {
|
|
31
|
+
end = indexOfDelim;
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (end === -1) {
|
|
36
|
+
end = path.length;
|
|
37
|
+
}
|
|
38
|
+
const property = path.substr(1, end - 1);
|
|
39
|
+
const suffix = path.substr(end);
|
|
40
|
+
path = `${this._prefix}${property}.first()${suffix}`;
|
|
41
|
+
}
|
|
42
|
+
return path;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.AtPathResolver = AtPathResolver;
|
|
46
|
+
//# sourceMappingURL=atPathResolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atPathResolver.js","sourceRoot":"","sources":["../../../../src/memory/pathResolvers/atPathResolver.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,2DAAuD;AAEvD,MAAa,cAAe,SAAQ,qCAAiB;IAInD;;SAEK;IACL;QACE,KAAK,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;QAPC,YAAO,GAAG,2BAA2B,CAAA;QACrC,YAAO,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAOrC,CAAC;IAED;;;;;SAKK;IACL,aAAa,CAAE,IAAY;QACzB,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;QAClB,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACtE,IAAI,GAAG,GAAG,CAAC,CAAC,CAAA;YACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC7C,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAA;gBAClD,IAAI,YAAY,IAAI,CAAC,EAAE,CAAC;oBACtB,GAAG,GAAG,YAAY,CAAA;oBAClB,MAAK;gBACP,CAAC;YACH,CAAC;YACD,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC;gBACf,GAAG,GAAG,IAAI,CAAC,MAAM,CAAA;YACnB,CAAC;YACD,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,CAAA;YACxC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;YAC/B,IAAI,GAAG,GAAG,IAAI,CAAC,OAAO,GAAG,QAAQ,WAAW,MAAM,EAAE,CAAA;QACtD,CAAC;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAtCD,wCAsCC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { AliasPathResolver } from './aliasPathResolver';
|
|
6
|
+
export declare class DollarPathResolver extends AliasPathResolver {
|
|
7
|
+
/**
|
|
8
|
+
* Initializes a new instance of the DollarPathResolver class.
|
|
9
|
+
*/
|
|
10
|
+
constructor();
|
|
11
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DollarPathResolver = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6
|
+
* Licensed under the MIT License.
|
|
7
|
+
*/
|
|
8
|
+
const aliasPathResolver_1 = require("./aliasPathResolver");
|
|
9
|
+
class DollarPathResolver extends aliasPathResolver_1.AliasPathResolver {
|
|
10
|
+
/**
|
|
11
|
+
* Initializes a new instance of the DollarPathResolver class.
|
|
12
|
+
*/
|
|
13
|
+
constructor() {
|
|
14
|
+
super('$', 'dialog.');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.DollarPathResolver = DollarPathResolver;
|
|
18
|
+
//# sourceMappingURL=dollarPathResolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dollarPathResolver.js","sourceRoot":"","sources":["../../../../src/memory/pathResolvers/dollarPathResolver.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,2DAAuD;AAEvD,MAAa,kBAAmB,SAAQ,qCAAiB;IACvD;;SAEK;IACL;QACE,KAAK,CAAC,GAAG,EAAE,SAAS,CAAC,CAAA;IACvB,CAAC;CACF;AAPD,gDAOC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { AliasPathResolver } from './aliasPathResolver';
|
|
6
|
+
export declare class HashPathResolver extends AliasPathResolver {
|
|
7
|
+
/**
|
|
8
|
+
* Initializes a new instance of the HashPathResolver class.
|
|
9
|
+
*/
|
|
10
|
+
constructor();
|
|
11
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HashPathResolver = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6
|
+
* Licensed under the MIT License.
|
|
7
|
+
*/
|
|
8
|
+
const aliasPathResolver_1 = require("./aliasPathResolver");
|
|
9
|
+
class HashPathResolver extends aliasPathResolver_1.AliasPathResolver {
|
|
10
|
+
/**
|
|
11
|
+
* Initializes a new instance of the HashPathResolver class.
|
|
12
|
+
*/
|
|
13
|
+
constructor() {
|
|
14
|
+
super('#', 'turn.recognized.intents.');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.HashPathResolver = HashPathResolver;
|
|
18
|
+
//# sourceMappingURL=hashPathResolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hashPathResolver.js","sourceRoot":"","sources":["../../../../src/memory/pathResolvers/hashPathResolver.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,2DAAuD;AAEvD,MAAa,gBAAiB,SAAQ,qCAAiB;IACrD;;SAEK;IACL;QACE,KAAK,CAAC,GAAG,EAAE,0BAA0B,CAAC,CAAA;IACxC,CAAC;CACF;AAPD,4CAOC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
export * from './aliasPathResolver';
|
|
6
|
+
export * from './atAtPathResolver';
|
|
7
|
+
export * from './atPathResolver';
|
|
8
|
+
export * from './dollarPathResolver';
|
|
9
|
+
export * from './hashPathResolver';
|
|
10
|
+
export * from './pathResolver';
|
|
11
|
+
export * from './percentPathResolver';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/**
|
|
18
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
19
|
+
* Licensed under the MIT License.
|
|
20
|
+
*/
|
|
21
|
+
__exportStar(require("./aliasPathResolver"), exports);
|
|
22
|
+
__exportStar(require("./atAtPathResolver"), exports);
|
|
23
|
+
__exportStar(require("./atPathResolver"), exports);
|
|
24
|
+
__exportStar(require("./dollarPathResolver"), exports);
|
|
25
|
+
__exportStar(require("./hashPathResolver"), exports);
|
|
26
|
+
__exportStar(require("./pathResolver"), exports);
|
|
27
|
+
__exportStar(require("./percentPathResolver"), exports);
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/memory/pathResolvers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;GAGG;AACH,sDAAmC;AACnC,qDAAkC;AAClC,mDAAgC;AAChC,uDAAoC;AACpC,qDAAkC;AAClC,iDAA8B;AAC9B,wDAAqC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
export interface PathResolver {
|
|
6
|
+
/**
|
|
7
|
+
* Transform the path
|
|
8
|
+
*
|
|
9
|
+
* @param path Path to inspect.
|
|
10
|
+
* @returns Transformed path
|
|
11
|
+
*/
|
|
12
|
+
transformPath(path: string): string;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pathResolver.js","sourceRoot":"","sources":["../../../../src/memory/pathResolvers/pathResolver.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { AliasPathResolver } from './aliasPathResolver';
|
|
6
|
+
export declare class PercentPathResolver extends AliasPathResolver {
|
|
7
|
+
/**
|
|
8
|
+
* Initializes a new instance of the PercentPathResolver class.
|
|
9
|
+
*/
|
|
10
|
+
constructor();
|
|
11
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PercentPathResolver = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6
|
+
* Licensed under the MIT License.
|
|
7
|
+
*/
|
|
8
|
+
const aliasPathResolver_1 = require("./aliasPathResolver");
|
|
9
|
+
class PercentPathResolver extends aliasPathResolver_1.AliasPathResolver {
|
|
10
|
+
/**
|
|
11
|
+
* Initializes a new instance of the PercentPathResolver class.
|
|
12
|
+
*/
|
|
13
|
+
constructor() {
|
|
14
|
+
super('%', 'class.');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.PercentPathResolver = PercentPathResolver;
|
|
18
|
+
//# sourceMappingURL=percentPathResolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"percentPathResolver.js","sourceRoot":"","sources":["../../../../src/memory/pathResolvers/percentPathResolver.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,2DAAuD;AAEvD,MAAa,mBAAoB,SAAQ,qCAAiB;IACxD;;SAEK;IACL;QACE,KAAK,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IACtB,CAAC;CACF;AAPD,kDAOC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Defines paths for the available scopes.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ScopePath {
|
|
9
|
+
static readonly user = "user";
|
|
10
|
+
static readonly conversation = "conversation";
|
|
11
|
+
static readonly dialog = "dialog";
|
|
12
|
+
static readonly dialogClass = "dialogClass";
|
|
13
|
+
static readonly dialogContext = "dialogContext";
|
|
14
|
+
static readonly this = "this";
|
|
15
|
+
static readonly class = "class";
|
|
16
|
+
static readonly settings = "settings";
|
|
17
|
+
static readonly turn = "turn";
|
|
18
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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.ScopePath = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* Defines paths for the available scopes.
|
|
10
|
+
*/
|
|
11
|
+
class ScopePath {
|
|
12
|
+
}
|
|
13
|
+
exports.ScopePath = ScopePath;
|
|
14
|
+
ScopePath.user = 'user';
|
|
15
|
+
ScopePath.conversation = 'conversation';
|
|
16
|
+
ScopePath.dialog = 'dialog';
|
|
17
|
+
ScopePath.dialogClass = 'dialogClass';
|
|
18
|
+
ScopePath.dialogContext = 'dialogContext';
|
|
19
|
+
ScopePath.this = 'this';
|
|
20
|
+
ScopePath.class = 'class';
|
|
21
|
+
ScopePath.settings = 'settings';
|
|
22
|
+
ScopePath.turn = 'turn';
|
|
23
|
+
//# sourceMappingURL=scopePath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scopePath.js","sourceRoot":"","sources":["../../../src/memory/scopePath.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;GAEG;AACH,MAAa,SAAS;;AAAtB,8BAUC;AATiB,cAAI,GAAG,MAAM,CAAA;AACb,sBAAY,GAAG,cAAc,CAAA;AAC7B,gBAAM,GAAG,QAAQ,CAAA;AACjB,qBAAW,GAAG,aAAa,CAAA;AAC3B,uBAAa,GAAG,eAAe,CAAA;AAC/B,cAAI,GAAG,MAAM,CAAA;AACb,eAAK,GAAG,OAAO,CAAA;AACf,kBAAQ,GAAG,UAAU,CAAA;AACrB,cAAI,GAAG,MAAM,CAAA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { MemoryScope } from './memoryScope';
|
|
2
|
+
import { DialogContext } from '../../dialogContext';
|
|
3
|
+
/**
|
|
4
|
+
* Base class for memory scopes based on AgentState.
|
|
5
|
+
*/
|
|
6
|
+
export declare class AgentStateMemoryScope extends MemoryScope {
|
|
7
|
+
protected stateKey: string;
|
|
8
|
+
/**
|
|
9
|
+
* Initializes a new instance of the AgentStateMemoryScope class.
|
|
10
|
+
*
|
|
11
|
+
* @param name name of the property.
|
|
12
|
+
*/
|
|
13
|
+
constructor(name: string);
|
|
14
|
+
/**
|
|
15
|
+
* Get the backing memory for this scope.
|
|
16
|
+
*
|
|
17
|
+
* @param dialogContext current dialog context.
|
|
18
|
+
* @returns Memory for the scope.
|
|
19
|
+
*/
|
|
20
|
+
getMemory(dialogContext: DialogContext): object;
|
|
21
|
+
/**
|
|
22
|
+
* Changes the backing object for the memory scope.
|
|
23
|
+
*
|
|
24
|
+
* @param dialogContext current dialog context
|
|
25
|
+
* @param _memory memory
|
|
26
|
+
*/
|
|
27
|
+
setMemory(dialogContext: DialogContext, _memory: object): void;
|
|
28
|
+
/**
|
|
29
|
+
* Populates the state cache for this AgentState from the storage layer.
|
|
30
|
+
*
|
|
31
|
+
* @param dialogContext The DialogContext object for this turn.
|
|
32
|
+
* @param force Optional, `true` to overwrite any existing state cache;
|
|
33
|
+
* or `false` to load state from storage only if the cache doesn't already exist.
|
|
34
|
+
* @returns A Promise that represents the work queued to execute.
|
|
35
|
+
*/
|
|
36
|
+
load(dialogContext: DialogContext, force?: boolean): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Writes the state cache for this AgentState to the storage layer.
|
|
39
|
+
*
|
|
40
|
+
* @param dialogContext The DialogContext object for this turn.
|
|
41
|
+
* @param force Optional, `true` to save the state cache to storage;
|
|
42
|
+
* or `false` to save state to storage only if a property in the cache has changed.
|
|
43
|
+
* @returns A Promise that represents the work queued to execute.
|
|
44
|
+
*/
|
|
45
|
+
saveChanges(dialogContext: DialogContext, force?: boolean): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Deletes any state in storage and the cache for this AgentState.
|
|
48
|
+
*
|
|
49
|
+
* @param _dialogContext The DialogContext object for this turn.
|
|
50
|
+
* @returns A Promise that represents the work queued to execute.
|
|
51
|
+
*/
|
|
52
|
+
delete(_dialogContext: DialogContext): Promise<void>;
|
|
53
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AgentStateMemoryScope = void 0;
|
|
4
|
+
const memoryScope_1 = require("./memoryScope");
|
|
5
|
+
/**
|
|
6
|
+
* Base class for memory scopes based on AgentState.
|
|
7
|
+
*/
|
|
8
|
+
class AgentStateMemoryScope extends memoryScope_1.MemoryScope {
|
|
9
|
+
/**
|
|
10
|
+
* Initializes a new instance of the AgentStateMemoryScope class.
|
|
11
|
+
*
|
|
12
|
+
* @param name name of the property.
|
|
13
|
+
*/
|
|
14
|
+
constructor(name) {
|
|
15
|
+
super(name, true);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Get the backing memory for this scope.
|
|
19
|
+
*
|
|
20
|
+
* @param dialogContext current dialog context.
|
|
21
|
+
* @returns Memory for the scope.
|
|
22
|
+
*/
|
|
23
|
+
getMemory(dialogContext) {
|
|
24
|
+
const agentState = dialogContext.context.turnState.get(this.stateKey);
|
|
25
|
+
if (agentState) {
|
|
26
|
+
return agentState.get(dialogContext.context);
|
|
27
|
+
}
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Changes the backing object for the memory scope.
|
|
32
|
+
*
|
|
33
|
+
* @param dialogContext current dialog context
|
|
34
|
+
* @param _memory memory
|
|
35
|
+
*/
|
|
36
|
+
setMemory(dialogContext, _memory) {
|
|
37
|
+
const agentState = dialogContext.context.turnState.get(this.stateKey);
|
|
38
|
+
if (!agentState) {
|
|
39
|
+
throw new Error(`${this.stateKey} is not available.`);
|
|
40
|
+
}
|
|
41
|
+
throw new Error('You cannot replace the root AgentState object.');
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Populates the state cache for this AgentState from the storage layer.
|
|
45
|
+
*
|
|
46
|
+
* @param dialogContext The DialogContext object for this turn.
|
|
47
|
+
* @param force Optional, `true` to overwrite any existing state cache;
|
|
48
|
+
* or `false` to load state from storage only if the cache doesn't already exist.
|
|
49
|
+
* @returns A Promise that represents the work queued to execute.
|
|
50
|
+
*/
|
|
51
|
+
async load(dialogContext, force = false) {
|
|
52
|
+
const agentState = dialogContext.context.turnState.get(this.stateKey);
|
|
53
|
+
if (agentState) {
|
|
54
|
+
await agentState.load(dialogContext.context, force);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Writes the state cache for this AgentState to the storage layer.
|
|
59
|
+
*
|
|
60
|
+
* @param dialogContext The DialogContext object for this turn.
|
|
61
|
+
* @param force Optional, `true` to save the state cache to storage;
|
|
62
|
+
* or `false` to save state to storage only if a property in the cache has changed.
|
|
63
|
+
* @returns A Promise that represents the work queued to execute.
|
|
64
|
+
*/
|
|
65
|
+
async saveChanges(dialogContext, force = false) {
|
|
66
|
+
const agentState = dialogContext.context.turnState.get(this.stateKey);
|
|
67
|
+
if (agentState) {
|
|
68
|
+
await agentState.saveChanges(dialogContext.context, force);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Deletes any state in storage and the cache for this AgentState.
|
|
73
|
+
*
|
|
74
|
+
* @param _dialogContext The DialogContext object for this turn.
|
|
75
|
+
* @returns A Promise that represents the work queued to execute.
|
|
76
|
+
*/
|
|
77
|
+
async delete(_dialogContext) {
|
|
78
|
+
return Promise.resolve();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.AgentStateMemoryScope = AgentStateMemoryScope;
|
|
82
|
+
//# sourceMappingURL=agentStateMemoryScope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agentStateMemoryScope.js","sourceRoot":"","sources":["../../../../src/memory/scopes/agentStateMemoryScope.ts"],"names":[],"mappings":";;;AAKA,+CAA2C;AAG3C;;GAEG;AACH,MAAa,qBAAsB,SAAQ,yBAAW;IAGpD;;;;SAIK;IACL,YAAa,IAAY;QACvB,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;IACnB,CAAC;IAED;;;;;SAKK;IACL,SAAS,CAAE,aAA4B;QACrC,MAAM,UAAU,GAAe,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACjF,IAAI,UAAU,EAAE,CAAC;YACf,OAAO,UAAU,CAAC,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;QAC9C,CAAC;QAED,OAAO,SAAS,CAAA;IAClB,CAAC;IAED;;;;;SAKK;IACL,SAAS,CAAE,aAA4B,EAAE,OAAe;QACtD,MAAM,UAAU,GAAG,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACrE,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,QAAQ,oBAAoB,CAAC,CAAA;QACvD,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAA;IACnE,CAAC;IAED;;;;;;;SAOK;IACL,KAAK,CAAC,IAAI,CAAE,aAA4B,EAAE,KAAK,GAAG,KAAK;QACrD,MAAM,UAAU,GAAe,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACjF,IAAI,UAAU,EAAE,CAAC;YACf,MAAM,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;QACrD,CAAC;IACH,CAAC;IAED;;;;;;;SAOK;IACL,KAAK,CAAC,WAAW,CAAE,aAA4B,EAAE,KAAK,GAAG,KAAK;QAC5D,MAAM,UAAU,GAAe,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACjF,IAAI,UAAU,EAAE,CAAC;YACf,MAAM,UAAU,CAAC,WAAW,CAAC,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;QAC5D,CAAC;IACH,CAAC;IAED;;;;;SAKK;IACL,KAAK,CAAC,MAAM,CAAE,cAA6B;QACzC,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;IAC1B,CAAC;CACF;AAhFD,sDAgFC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { MemoryScope } from './memoryScope';
|
|
6
|
+
import { DialogContext } from '../../dialogContext';
|
|
7
|
+
import { Dialog } from '../../dialog';
|
|
8
|
+
export declare class ClassMemoryScope extends MemoryScope {
|
|
9
|
+
/**
|
|
10
|
+
* Initializes a new instance of the ClassMemoryScope class.
|
|
11
|
+
*
|
|
12
|
+
* @param name Name of the scope class.
|
|
13
|
+
*/
|
|
14
|
+
constructor(name?: string);
|
|
15
|
+
/**
|
|
16
|
+
* Gets the backing memory for this scope.
|
|
17
|
+
*
|
|
18
|
+
* @param dialogContext The DialogContext object for this turn.
|
|
19
|
+
* @returns The memory for the scope.
|
|
20
|
+
*/
|
|
21
|
+
getMemory(dialogContext: DialogContext): object;
|
|
22
|
+
/**
|
|
23
|
+
* Override to find the dialog instance referenced by the scope.
|
|
24
|
+
*
|
|
25
|
+
* @param dialogContext Current dialog context.
|
|
26
|
+
* @returns The dialog instance referenced by the scope.
|
|
27
|
+
*/
|
|
28
|
+
protected onFindDialog(dialogContext: DialogContext): Dialog | undefined;
|
|
29
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClassMemoryScope = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6
|
+
* Licensed under the MIT License.
|
|
7
|
+
*/
|
|
8
|
+
const memoryScope_1 = require("./memoryScope");
|
|
9
|
+
const scopePath_1 = require("../scopePath");
|
|
10
|
+
class ClassMemoryScope extends memoryScope_1.MemoryScope {
|
|
11
|
+
/**
|
|
12
|
+
* Initializes a new instance of the ClassMemoryScope class.
|
|
13
|
+
*
|
|
14
|
+
* @param name Name of the scope class.
|
|
15
|
+
*/
|
|
16
|
+
constructor(name = scopePath_1.ScopePath.class) {
|
|
17
|
+
super(name, false);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Gets the backing memory for this scope.
|
|
21
|
+
*
|
|
22
|
+
* @param dialogContext The DialogContext object for this turn.
|
|
23
|
+
* @returns The memory for the scope.
|
|
24
|
+
*/
|
|
25
|
+
getMemory(dialogContext) {
|
|
26
|
+
// if active dialog is a container dialog then "dialog" binds to it
|
|
27
|
+
if (dialogContext.activeDialog) {
|
|
28
|
+
const dialog = this.onFindDialog(dialogContext);
|
|
29
|
+
if (dialog !== undefined) {
|
|
30
|
+
// Clone properties
|
|
31
|
+
const clone = {};
|
|
32
|
+
for (const key in dialog) {
|
|
33
|
+
const prop = dialog[key];
|
|
34
|
+
if (Object.prototype.hasOwnProperty.call(dialog, key) && typeof prop !== 'function') {
|
|
35
|
+
if (isExpression(prop)) {
|
|
36
|
+
const { value, error } = prop.tryGetValue(dialogContext.state);
|
|
37
|
+
if (!error) {
|
|
38
|
+
clone[key] = value;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
clone[key] = prop;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return clone;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return {};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Override to find the dialog instance referenced by the scope.
|
|
53
|
+
*
|
|
54
|
+
* @param dialogContext Current dialog context.
|
|
55
|
+
* @returns The dialog instance referenced by the scope.
|
|
56
|
+
*/
|
|
57
|
+
onFindDialog(dialogContext) {
|
|
58
|
+
return dialogContext.findDialog(dialogContext.activeDialog.id);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.ClassMemoryScope = ClassMemoryScope;
|
|
62
|
+
function isExpression(prop) {
|
|
63
|
+
return typeof prop === 'object' && typeof prop['tryGetValue'] === 'function';
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=classMemoryScope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classMemoryScope.js","sourceRoot":"","sources":["../../../../src/memory/scopes/classMemoryScope.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,+CAA2C;AAC3C,4CAAwC;AAIxC,MAAa,gBAAiB,SAAQ,yBAAW;IAC/C;;;;SAIK;IACL,YAAa,IAAI,GAAG,qBAAS,CAAC,KAAK;QACjC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IACpB,CAAC;IAED;;;;;SAKK;IACL,SAAS,CAAE,aAA4B;QACrC,mEAAmE;QACnE,IAAI,aAAa,CAAC,YAAY,EAAE,CAAC;YAC/B,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,CAAA;YAC/C,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;gBACzB,mBAAmB;gBACnB,MAAM,KAAK,GAAW,EAAE,CAAA;gBACxB,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;oBACzB,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;oBACxB,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;wBACpF,IAAI,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;4BACvB,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;4BAC9D,IAAI,CAAC,KAAK,EAAE,CAAC;gCACX,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;4BACpB,CAAC;wBACH,CAAC;6BAAM,CAAC;4BACN,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;wBACnB,CAAC;oBACH,CAAC;gBACH,CAAC;gBAED,OAAO,KAAK,CAAA;YACd,CAAC;QACH,CAAC;QAED,OAAO,EAAE,CAAA;IACX,CAAC;IAED;;;;;SAKK;IACK,YAAY,CAAE,aAA4B;QAClD,OAAO,aAAa,CAAC,UAAU,CAAC,aAAa,CAAC,YAAY,CAAC,EAAE,CAAC,CAAA;IAChE,CAAC;CACF;AArDD,4CAqDC;AAED,SAAS,YAAY,CAAE,IAAS;IAC9B,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,UAAU,CAAA;AAC9E,CAAC"}
|