@microsoft/agents-hosting-dialogs 1.0.0 → 1.0.7-g73d3d58001
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/src/agentStateSet.d.ts +30 -27
- package/dist/src/agentStateSet.js +30 -27
- package/dist/src/agentStateSet.js.map +1 -1
- package/dist/src/choices/findValues.d.ts +21 -12
- package/dist/src/choices/findValues.js +8 -5
- package/dist/src/choices/findValues.js.map +1 -1
- package/dist/src/componentDialog.d.ts +117 -95
- package/dist/src/componentDialog.js +106 -84
- package/dist/src/componentDialog.js.map +1 -1
- package/dist/src/dialog.d.ts +15 -10
- package/dist/src/dialog.js +15 -10
- package/dist/src/dialog.js.map +1 -1
- package/dist/src/dialogContainer.d.ts +5 -2
- package/dist/src/dialogContainer.js +5 -2
- package/dist/src/dialogContainer.js.map +1 -1
- package/dist/src/dialogContext.d.ts +33 -12
- package/dist/src/dialogContext.js +33 -13
- package/dist/src/dialogContext.js.map +1 -1
- package/dist/src/dialogInstance.d.ts +11 -11
- package/dist/src/dialogReason.d.ts +13 -13
- package/dist/src/dialogReason.js +13 -13
- package/dist/src/dialogReason.js.map +1 -1
- package/dist/src/dialogSet.d.ts +12 -7
- package/dist/src/dialogSet.js +10 -5
- package/dist/src/dialogSet.js.map +1 -1
- package/dist/src/dialogTurnResult.d.ts +1 -0
- package/dist/src/dialogTurnStateConstants.d.ts +1 -0
- package/dist/src/dialogTurnStateConstants.js +1 -0
- package/dist/src/dialogTurnStateConstants.js.map +1 -1
- package/dist/src/dialogTurnStatus.d.ts +1 -0
- package/dist/src/dialogTurnStatus.js +1 -0
- package/dist/src/dialogTurnStatus.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/memory/dialogPath.d.ts +8 -8
- package/dist/src/memory/dialogPath.js +8 -8
- package/dist/src/memory/dialogStateManager.d.ts +9 -4
- package/dist/src/memory/dialogStateManager.js +9 -4
- package/dist/src/memory/dialogStateManager.js.map +1 -1
- package/dist/src/memory/turnPath.d.ts +12 -12
- package/dist/src/memory/turnPath.js +12 -12
- package/dist/src/prompts/activityPrompt.d.ts +4 -0
- package/dist/src/prompts/activityPrompt.js +4 -0
- package/dist/src/prompts/activityPrompt.js.map +1 -1
- package/dist/src/prompts/attachmentPrompt.d.ts +1 -0
- package/dist/src/prompts/attachmentPrompt.js +1 -0
- package/dist/src/prompts/attachmentPrompt.js.map +1 -1
- package/dist/src/prompts/choicePrompt.d.ts +4 -0
- package/dist/src/prompts/choicePrompt.js +1 -0
- package/dist/src/prompts/choicePrompt.js.map +1 -1
- package/dist/src/prompts/confirmPrompt.d.ts +4 -1
- package/dist/src/prompts/confirmPrompt.js +1 -0
- package/dist/src/prompts/confirmPrompt.js.map +1 -1
- package/dist/src/prompts/datetimePrompt.d.ts +1 -0
- package/dist/src/prompts/datetimePrompt.js +1 -0
- package/dist/src/prompts/datetimePrompt.js.map +1 -1
- package/dist/src/prompts/numberPrompt.d.ts +1 -0
- package/dist/src/prompts/numberPrompt.js +1 -0
- package/dist/src/prompts/numberPrompt.js.map +1 -1
- package/dist/src/prompts/prompt.d.ts +24 -8
- package/dist/src/prompts/prompt.js +8 -0
- package/dist/src/prompts/prompt.js.map +1 -1
- package/dist/src/prompts/promptCultureModels.d.ts +16 -1
- package/dist/src/prompts/promptCultureModels.js +4 -1
- package/dist/src/prompts/promptCultureModels.js.map +1 -1
- package/dist/src/prompts/textPrompt.d.ts +3 -0
- package/dist/src/prompts/textPrompt.js +3 -0
- package/dist/src/prompts/textPrompt.js.map +1 -1
- package/dist/src/recognizer.d.ts +3 -0
- package/dist/src/recognizer.js +1 -0
- package/dist/src/recognizer.js.map +1 -1
- package/dist/src/recognizerResult.d.ts +5 -4
- package/dist/src/recognizerResult.js +5 -4
- package/dist/src/recognizerResult.js.map +1 -1
- package/dist/src/stringUtils.d.ts +4 -3
- package/dist/src/stringUtils.js +4 -3
- package/dist/src/stringUtils.js.map +1 -1
- package/dist/src/waterfallDialog.d.ts +11 -4
- package/dist/src/waterfallDialog.js +11 -4
- package/dist/src/waterfallDialog.js.map +1 -1
- package/package.json +2 -2
- package/src/agentStateSet.ts +30 -27
- package/src/choices/findValues.ts +21 -12
- package/src/componentDialog.ts +127 -97
- package/src/dialog.ts +15 -10
- package/src/dialogContainer.ts +5 -2
- package/src/dialogContext.ts +41 -15
- package/src/dialogInstance.ts +11 -11
- package/src/dialogReason.ts +13 -13
- package/src/dialogSet.ts +12 -7
- package/src/dialogTurnResult.ts +1 -0
- package/src/dialogTurnStateConstants.ts +1 -0
- package/src/dialogTurnStatus.ts +1 -0
- package/src/index.ts +3 -0
- package/src/memory/dialogPath.ts +8 -8
- package/src/memory/dialogStateManager.ts +9 -4
- package/src/memory/turnPath.ts +12 -12
- package/src/prompts/activityPrompt.ts +4 -0
- package/src/prompts/attachmentPrompt.ts +1 -0
- package/src/prompts/choicePrompt.ts +4 -0
- package/src/prompts/confirmPrompt.ts +4 -1
- package/src/prompts/datetimePrompt.ts +1 -0
- package/src/prompts/numberPrompt.ts +1 -0
- package/src/prompts/prompt.ts +24 -8
- package/src/prompts/promptCultureModels.ts +16 -1
- package/src/prompts/textPrompt.ts +3 -0
- package/src/recognizer.ts +3 -0
- package/src/recognizerResult.ts +5 -4
- package/src/stringUtils.ts +4 -3
- package/src/waterfallDialog.ts +11 -4
|
@@ -5,44 +5,47 @@
|
|
|
5
5
|
import { AgentState, TurnContext } from '@microsoft/agents-hosting';
|
|
6
6
|
/**
|
|
7
7
|
* A collection of `AgentState` plugins that should be loaded or saved in parallel as a single unit.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
8
10
|
* See `AutoSaveStateMiddleware` for an implementation of this class.
|
|
9
11
|
*/
|
|
10
12
|
export declare class AgentStateSet {
|
|
11
13
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
* Array of the sets `AgentState` plugins.
|
|
15
|
+
*/
|
|
14
16
|
readonly agentStates: AgentState[];
|
|
15
17
|
/**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
* Creates a new AgentStateSet instance.
|
|
19
|
+
*
|
|
20
|
+
* @param agentStates One or more AgentState plugins to register.
|
|
21
|
+
*/
|
|
20
22
|
constructor(...agentStates: AgentState[]);
|
|
21
23
|
/**
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
* Registers one or more `AgentState` plugins with the set.
|
|
25
|
+
*
|
|
26
|
+
* @param agentStates One or more AgentState plugins to register.
|
|
27
|
+
* @returns The updated AgentStateSet.
|
|
28
|
+
*/
|
|
27
29
|
add(...agentStates: AgentState[]): this;
|
|
28
30
|
/**
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
* Calls the {@link AgentState.load | AgentState.load method} on all of the AgentState plugins in the set.
|
|
32
|
+
*
|
|
33
|
+
* @param context Context for current turn of conversation with the user.
|
|
34
|
+
* @param force (Optional) If `true` the cache will be bypassed and the state will always be read in directly from storage. Defaults to `false`.
|
|
35
|
+
*
|
|
36
|
+
* @remarks
|
|
37
|
+
* This will trigger all of the plugins to read in their state in parallel.
|
|
38
|
+
*
|
|
39
|
+
*/
|
|
37
40
|
loadAll(context: TurnContext, force?: boolean): Promise<void>;
|
|
38
41
|
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
* Calls {@link AgentState.saveChanges | AgentState.saveChanges method} on all of the AgentState plugins in the set.
|
|
43
|
+
*
|
|
44
|
+
* @param context Context for current turn of conversation with the user.
|
|
45
|
+
* @param force (Optional) if `true` the state will always be written out regardless of its change state. Defaults to `false`.
|
|
46
|
+
*
|
|
47
|
+
* @remarks
|
|
48
|
+
* This will trigger all of the plugins to write out their state in parallel.
|
|
49
|
+
*/
|
|
47
50
|
saveAllChanges(context: TurnContext, force?: boolean): Promise<void>;
|
|
48
51
|
}
|
|
@@ -3,27 +3,29 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AgentStateSet = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* A collection of `AgentState` plugins that should be loaded or saved in parallel as a single unit.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
6
8
|
* See `AutoSaveStateMiddleware` for an implementation of this class.
|
|
7
9
|
*/
|
|
8
10
|
class AgentStateSet {
|
|
9
11
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
* Creates a new AgentStateSet instance.
|
|
13
|
+
*
|
|
14
|
+
* @param agentStates One or more AgentState plugins to register.
|
|
15
|
+
*/
|
|
14
16
|
constructor(...agentStates) {
|
|
15
17
|
/**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
* Array of the sets `AgentState` plugins.
|
|
19
|
+
*/
|
|
18
20
|
this.agentStates = [];
|
|
19
21
|
AgentStateSet.prototype.add.apply(this, agentStates);
|
|
20
22
|
}
|
|
21
23
|
/**
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
* Registers one or more `AgentState` plugins with the set.
|
|
25
|
+
*
|
|
26
|
+
* @param agentStates One or more AgentState plugins to register.
|
|
27
|
+
* @returns The updated AgentStateSet.
|
|
28
|
+
*/
|
|
27
29
|
add(...agentStates) {
|
|
28
30
|
agentStates.forEach((agentstate) => {
|
|
29
31
|
if (typeof agentstate.load === 'function' && typeof agentstate.saveChanges === 'function') {
|
|
@@ -36,27 +38,28 @@ class AgentStateSet {
|
|
|
36
38
|
return this;
|
|
37
39
|
}
|
|
38
40
|
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
* Calls the {@link AgentState.load | AgentState.load method} on all of the AgentState plugins in the set.
|
|
42
|
+
*
|
|
43
|
+
* @param context Context for current turn of conversation with the user.
|
|
44
|
+
* @param force (Optional) If `true` the cache will be bypassed and the state will always be read in directly from storage. Defaults to `false`.
|
|
45
|
+
*
|
|
46
|
+
* @remarks
|
|
47
|
+
* This will trigger all of the plugins to read in their state in parallel.
|
|
48
|
+
*
|
|
49
|
+
*/
|
|
47
50
|
async loadAll(context, force = false) {
|
|
48
51
|
const promises = this.agentStates.map((agentstate) => agentstate.load(context, force));
|
|
49
52
|
await Promise.all(promises);
|
|
50
53
|
}
|
|
51
54
|
/**
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
* Calls {@link AgentState.saveChanges | AgentState.saveChanges method} on all of the AgentState plugins in the set.
|
|
56
|
+
*
|
|
57
|
+
* @param context Context for current turn of conversation with the user.
|
|
58
|
+
* @param force (Optional) if `true` the state will always be written out regardless of its change state. Defaults to `false`.
|
|
59
|
+
*
|
|
60
|
+
* @remarks
|
|
61
|
+
* This will trigger all of the plugins to write out their state in parallel.
|
|
62
|
+
*/
|
|
60
63
|
async saveAllChanges(context, force = false) {
|
|
61
64
|
const promises = this.agentStates.map((agentstate) => agentstate.saveChanges(context, force));
|
|
62
65
|
await Promise.all(promises);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentStateSet.js","sourceRoot":"","sources":["../../src/agentStateSet.ts"],"names":[],"mappings":";;;AAMA
|
|
1
|
+
{"version":3,"file":"agentStateSet.js","sourceRoot":"","sources":["../../src/agentStateSet.ts"],"names":[],"mappings":";;;AAMA;;;;;GAKG;AACH,MAAa,aAAa;IAMxB;;;;QAII;IACJ,YAAa,GAAG,WAAyB;QAVzC;;YAEI;QACK,gBAAW,GAAiB,EAAE,CAAA;QAQrC,aAAa,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,WAAW,CAAC,CAAA;IACtD,CAAC;IAED;;;;;QAKI;IACJ,GAAG,CAAE,GAAG,WAAyB;QAC/B,WAAW,CAAC,OAAO,CAAC,CAAC,UAAsB,EAAE,EAAE;YAC7C,IAAI,OAAO,UAAU,CAAC,IAAI,KAAK,UAAU,IAAI,OAAO,UAAU,CAAC,WAAW,KAAK,UAAU,EAAE,CAAC;gBAC1F,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;YACnC,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CAAC,4EAA4E,CAAC,CAAA;YAC/F,CAAC;QACH,CAAC,CAAC,CAAA;QAEF,OAAO,IAAI,CAAA;IACb,CAAC;IAED;;;;;;;;;QASI;IACJ,KAAK,CAAC,OAAO,CAAE,OAAoB,EAAE,KAAK,GAAG,KAAK;QAChD,MAAM,QAAQ,GAAmB,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,UAAsB,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAA;QAElH,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IAC7B,CAAC;IAED;;;;;;;;QAQI;IACJ,KAAK,CAAC,cAAc,CAAE,OAAoB,EAAE,KAAK,GAAG,KAAK;QACvD,MAAM,QAAQ,GAAoB,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,UAAsB,EAAE,EAAE,CAChF,UAAU,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CACvC,CAAA;QAED,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IAC7B,CAAC;CACF;AAjED,sCAiEC"}
|
|
@@ -26,7 +26,7 @@ export interface FindValuesOptions {
|
|
|
26
26
|
tokenizer?: TokenizerFunction;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* Represents a value that was successfully found and matched during a search operation.
|
|
30
30
|
*
|
|
31
31
|
* @remarks
|
|
32
32
|
* This interface contains the matched value along with metadata about the match quality
|
|
@@ -44,7 +44,8 @@ export interface FindValuesOptions {
|
|
|
44
44
|
*/
|
|
45
45
|
export interface FoundValue {
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
47
|
+
* The exact value that was matched from the original search list.
|
|
48
|
+
*
|
|
48
49
|
* @remarks
|
|
49
50
|
* This is the original string value, not the user's input that matched it.
|
|
50
51
|
*
|
|
@@ -52,7 +53,8 @@ export interface FoundValue {
|
|
|
52
53
|
*/
|
|
53
54
|
value: string;
|
|
54
55
|
/**
|
|
55
|
-
*
|
|
56
|
+
* The zero-based index position of this value in the original list that was searched.
|
|
57
|
+
*
|
|
56
58
|
* @remarks
|
|
57
59
|
* This allows you to correlate the found value back to its position in the source array.
|
|
58
60
|
*
|
|
@@ -60,7 +62,8 @@ export interface FoundValue {
|
|
|
60
62
|
*/
|
|
61
63
|
index: number;
|
|
62
64
|
/**
|
|
63
|
-
*
|
|
65
|
+
* A confidence score between 0 and 1 indicating the quality of the match.
|
|
66
|
+
*
|
|
64
67
|
* @remarks
|
|
65
68
|
* - 1.0 indicates a perfect exact match
|
|
66
69
|
* - Lower values indicate partial or fuzzy matches
|
|
@@ -71,7 +74,8 @@ export interface FoundValue {
|
|
|
71
74
|
score: number;
|
|
72
75
|
}
|
|
73
76
|
/**
|
|
74
|
-
*
|
|
77
|
+
* Represents a value with its original position that can be used in search operations.
|
|
78
|
+
*
|
|
75
79
|
* @remarks
|
|
76
80
|
* This interface is used internally by the search algorithm to maintain the relationship
|
|
77
81
|
* between search values and their original positions in the source array.
|
|
@@ -94,7 +98,8 @@ export interface FoundValue {
|
|
|
94
98
|
*/
|
|
95
99
|
export interface SortedValue {
|
|
96
100
|
/**
|
|
97
|
-
*
|
|
101
|
+
* The string value to be searched for during matching operations.
|
|
102
|
+
*
|
|
98
103
|
* @remarks
|
|
99
104
|
* This is the actual text content that will be compared against user input.
|
|
100
105
|
*
|
|
@@ -102,7 +107,8 @@ export interface SortedValue {
|
|
|
102
107
|
*/
|
|
103
108
|
value: string;
|
|
104
109
|
/**
|
|
105
|
-
*
|
|
110
|
+
* The zero-based index position of this value in the original source array.
|
|
111
|
+
*
|
|
106
112
|
* @remarks
|
|
107
113
|
* This allows the search algorithm to correlate found matches back to their
|
|
108
114
|
* original positions, which is essential for maintaining proper choice selection.
|
|
@@ -112,16 +118,19 @@ export interface SortedValue {
|
|
|
112
118
|
index: number;
|
|
113
119
|
}
|
|
114
120
|
/**
|
|
115
|
-
*
|
|
121
|
+
* Low-level function that searches for a set of values within an utterance.
|
|
122
|
+
*
|
|
123
|
+
* @param utterance The text or user utterance to search over.
|
|
124
|
+
* @param values List of values to search over.
|
|
125
|
+
* @param options (Optional) options used to tweak the search that's performed.
|
|
126
|
+
* @returns A list of found values.
|
|
127
|
+
*
|
|
116
128
|
* @remarks
|
|
117
129
|
* Higher level functions like `findChoices()` and `recognizeChoices()` are layered above this function. In most
|
|
118
130
|
* cases its easier to just call one of the higher level functions instead but this function contains
|
|
119
131
|
* the fuzzy search algorithm that drives choice recognition.
|
|
120
132
|
*
|
|
121
133
|
* @internal
|
|
122
|
-
|
|
123
|
-
* @param values List of values to search over.
|
|
124
|
-
* @param options (Optional) options used to tweak the search that's performed.
|
|
125
|
-
* @returns A list of found values.
|
|
134
|
+
|
|
126
135
|
*/
|
|
127
136
|
export declare function findValues(utterance: string, values: SortedValue[], options?: FindValuesOptions): ModelResult<FoundValue>[];
|
|
@@ -3,17 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.findValues = findValues;
|
|
4
4
|
const tokenizer_1 = require("./tokenizer");
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Low-level function that searches for a set of values within an utterance.
|
|
7
|
+
*
|
|
8
|
+
* @param utterance The text or user utterance to search over.
|
|
9
|
+
* @param values List of values to search over.
|
|
10
|
+
* @param options (Optional) options used to tweak the search that's performed.
|
|
11
|
+
* @returns A list of found values.
|
|
12
|
+
*
|
|
7
13
|
* @remarks
|
|
8
14
|
* Higher level functions like `findChoices()` and `recognizeChoices()` are layered above this function. In most
|
|
9
15
|
* cases its easier to just call one of the higher level functions instead but this function contains
|
|
10
16
|
* the fuzzy search algorithm that drives choice recognition.
|
|
11
17
|
*
|
|
12
18
|
* @internal
|
|
13
|
-
|
|
14
|
-
* @param values List of values to search over.
|
|
15
|
-
* @param options (Optional) options used to tweak the search that's performed.
|
|
16
|
-
* @returns A list of found values.
|
|
19
|
+
|
|
17
20
|
*/
|
|
18
21
|
function findValues(utterance, values, options) {
|
|
19
22
|
function indexOfToken(token, startPos) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findValues.js","sourceRoot":"","sources":["../../../src/choices/findValues.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"findValues.js","sourceRoot":"","sources":["../../../src/choices/findValues.ts"],"names":[],"mappings":";;AAiJA,gCA2IC;AAvRD,2CAAwE;AA4HxE;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,UAAU,CACxB,SAAiB,EACjB,MAAqB,EACrB,OAA2B;IAE3B,SAAS,YAAY,CAAE,KAAY,EAAE,QAAgB;QACnD,KAAK,IAAI,CAAC,GAAW,QAAQ,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACtD,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,KAAK,KAAK,CAAC,UAAU,EAAE,CAAC;gBAC9C,OAAO,CAAC,CAAA;YACV,CAAC;QACH,CAAC;QAED,OAAO,CAAC,CAAC,CAAA;IACX,CAAC;IAED,SAAS,cAAc,CAAE,SAAiB,EAAE,MAAqB;QAC/D,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,SAAS,CAAC,WAAW,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AC,KAAK,CAAC,GAAG,IAAI,CAAA;YAC3C,KAAK,IAAI,CAAC,GAAW,KAAK,CAAC,KAAK,EAAE,CAAC,IAAI,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;gBACtD,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;YACtB,CAAC;YAED,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,CAAA;YACvC,KAAK,CAAC,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAA;YACjC,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAA;YAC5D,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACrB,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAA0B,EAAE,CAA0B,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAA;AACpG,CAAC"}
|
|
@@ -12,47 +12,52 @@ import { DialogInstance } from './dialogInstance';
|
|
|
12
12
|
/**
|
|
13
13
|
* Base class for a dialog that contains other child dialogs.
|
|
14
14
|
*
|
|
15
|
+
* @param O (Optional) options that can be passed into the `DialogContext.beginDialog()` method.
|
|
16
|
+
*
|
|
15
17
|
* @remarks
|
|
16
18
|
* Component dialogs let you break your agent's logic up into components that can themselves be added
|
|
17
19
|
* as a dialog to another `ComponentDialog` or `DialogSet`. Components can also be exported as part
|
|
18
20
|
* of a node package and used within other agents.
|
|
19
21
|
*
|
|
20
|
-
* @param O (Optional) options that can be passed into the `DialogContext.beginDialog()` method.
|
|
21
22
|
*/
|
|
22
23
|
export declare class ComponentDialog<O extends object = {}> extends DialogContainer<O> {
|
|
23
24
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
* ID of the child dialog that should be started anytime the component is started.
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* This defaults to the ID of the first child dialog added using [addDialog()](#adddialog).
|
|
29
|
+
*/
|
|
29
30
|
protected initialDialogId: string;
|
|
30
31
|
/**
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
32
|
+
* Called when the dialog is started and pushed onto the parent's dialog stack.
|
|
33
|
+
*
|
|
34
|
+
* @param outerDialogContext The parent DialogContext for the current turn of conversation.
|
|
35
|
+
* @param options Optional, initial information to pass to the dialog.
|
|
36
|
+
* @returns A Promise representing the asynchronous operation.
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* If the task is successful, the result indicates whether the dialog is still
|
|
40
|
+
* active after the turn has been processed by the dialog.
|
|
41
|
+
* By default, this calls the
|
|
42
|
+
* Dialog.BeginDialogAsync(DialogContext, object, CancellationToken) method
|
|
43
|
+
* of the component dialog's initial dialog, as defined by InitialDialogId.
|
|
44
|
+
* Override this method in a derived class to implement interrupt logic.
|
|
45
|
+
*
|
|
46
|
+
*/
|
|
44
47
|
beginDialog(outerDialogContext: DialogContext, options?: O): Promise<DialogTurnResult>;
|
|
45
48
|
/**
|
|
46
49
|
* Called when the dialog is _continued_, where it is the active dialog and the
|
|
47
50
|
* user replies with a new Activity.
|
|
48
|
-
* If this method is *not* overridden, the dialog automatically ends when the user replies.
|
|
49
51
|
*
|
|
50
52
|
* @param outerDialogContext The parent DialogContext for the current turn of conversation.
|
|
51
53
|
* @returns A Promise representing the asynchronous operation.
|
|
54
|
+
*
|
|
52
55
|
* @remarks
|
|
56
|
+
* If this method is *not* overridden, the dialog automatically ends when the user replies.
|
|
53
57
|
* If the task is successful, the result indicates whether the dialog is still
|
|
54
58
|
* active after the turn has been processed by the dialog. The result may also contain a
|
|
55
59
|
* return value.
|
|
60
|
+
*
|
|
56
61
|
*/
|
|
57
62
|
continueDialog(outerDialogContext: DialogContext): Promise<DialogTurnResult>;
|
|
58
63
|
/**
|
|
@@ -64,6 +69,7 @@ export declare class ComponentDialog<O extends object = {}> extends DialogContai
|
|
|
64
69
|
* @param _result Optional, value returned from the dialog that was called. The type
|
|
65
70
|
* of the value returned is dependent on the child dialog.
|
|
66
71
|
* @returns A Promise representing the asynchronous operation.
|
|
72
|
+
*
|
|
67
73
|
* @remarks
|
|
68
74
|
* If the task is successful, the result indicates whether this dialog is still
|
|
69
75
|
* active after this dialog turn has been processed.
|
|
@@ -76,32 +82,36 @@ export declare class ComponentDialog<O extends object = {}> extends DialogContai
|
|
|
76
82
|
*/
|
|
77
83
|
resumeDialog(outerDialogContext: DialogContext, _reason: DialogReason, _result?: any): Promise<DialogTurnResult>;
|
|
78
84
|
/**
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
+
* Called when the dialog should re-prompt the user for input.
|
|
86
|
+
*
|
|
87
|
+
* @param context The TurnContext object for this turn.
|
|
88
|
+
* @param instance State information for this dialog.
|
|
89
|
+
* @returns A Promise representing the asynchronous operation.
|
|
90
|
+
*/
|
|
85
91
|
repromptDialog(context: TurnContext, instance: DialogInstance): Promise<void>;
|
|
86
92
|
/**
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
* Called when the Dialog is ending.
|
|
94
|
+
*
|
|
95
|
+
* @param context The TurnContext object for this turn.
|
|
96
|
+
* @param instance State information associated with the instance of this component Dialog on its parent's dialog stack.
|
|
97
|
+
* @param reason Reason why the Dialog ended.
|
|
98
|
+
* @returns A Promise representing the asynchronous operation.
|
|
99
|
+
*
|
|
100
|
+
* @remarks
|
|
101
|
+
* When this method is called from the parent dialog's context, the component Dialog
|
|
102
|
+
* cancels all of the dialogs on its inner dialog stack before ending.
|
|
103
|
+
*
|
|
104
|
+
*/
|
|
96
105
|
endDialog(context: TurnContext, instance: DialogInstance, reason: DialogReason): Promise<void>;
|
|
97
106
|
/**
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
107
|
+
* Adds a child Dialog or prompt to the components internal DialogSet.
|
|
108
|
+
*
|
|
109
|
+
* @param dialog The child Dialog or prompt to add.
|
|
110
|
+
* @returns The ComponentDialog after the operation is complete.
|
|
111
|
+
*
|
|
112
|
+
* @remarks
|
|
113
|
+
* The Dialog.id of the first child added to the component will be assigned to the initialDialogId property.
|
|
114
|
+
*/
|
|
105
115
|
addDialog(dialog: Dialog): this;
|
|
106
116
|
/**
|
|
107
117
|
* Creates the inner dialog context
|
|
@@ -111,68 +121,80 @@ export declare class ComponentDialog<O extends object = {}> extends DialogContai
|
|
|
111
121
|
*/
|
|
112
122
|
createChildContext(outerDialogContext: DialogContext): DialogContext;
|
|
113
123
|
/**
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
+
* Called anytime an instance of the component has been started.
|
|
125
|
+
*
|
|
126
|
+
* @param innerDialogContext Dialog context for the components internal `DialogSet`.
|
|
127
|
+
* @param options (Optional) options that were passed to the component by its parent.
|
|
128
|
+
* @returns {Promise<DialogTurnResult>} A promise resolving to the dialog turn result.
|
|
129
|
+
*
|
|
130
|
+
* @remarks
|
|
131
|
+
* SHOULD be overridden by components that wish to perform custom interruption logic. The
|
|
132
|
+
* default implementation calls `innerDC.beginDialog()` with the dialog assigned to
|
|
133
|
+
* `initialDialogId`.
|
|
134
|
+
*
|
|
135
|
+
*/
|
|
124
136
|
protected onBeginDialog(innerDialogContext: DialogContext, options?: O): Promise<DialogTurnResult>;
|
|
125
137
|
/**
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
138
|
+
* Called anytime a multi-turn component receives additional activities.
|
|
139
|
+
*
|
|
140
|
+
* @param innerDC Dialog context for the components internal `DialogSet`.
|
|
141
|
+
* @returns {Promise<DialogTurnResult>} A promise resolving to the dialog turn result.
|
|
142
|
+
*
|
|
143
|
+
* @remarks
|
|
144
|
+
* SHOULD be overridden by components that wish to perform custom interruption logic. The
|
|
145
|
+
* default implementation calls `innerDC.continueDialog()`.
|
|
146
|
+
*/
|
|
134
147
|
protected onContinueDialog(innerDC: DialogContext): Promise<DialogTurnResult>;
|
|
135
148
|
/**
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
149
|
+
* Called when the component is ending.
|
|
150
|
+
*
|
|
151
|
+
* @param _context Context for the current turn of conversation.
|
|
152
|
+
* @param _instance The components instance data within its parents dialog stack.
|
|
153
|
+
* @param _reason The reason the component is ending.
|
|
154
|
+
* @returns A promise representing the asynchronous operation.
|
|
155
|
+
*
|
|
156
|
+
* @remarks
|
|
157
|
+
* If the `reason` code is equal to `DialogReason.cancelCalled`, then any active child dialogs
|
|
158
|
+
* will be cancelled before this method is called.
|
|
159
|
+
*
|
|
160
|
+
*/
|
|
146
161
|
protected onEndDialog(_context: TurnContext, _instance: DialogInstance, _reason: DialogReason): Promise<void>;
|
|
147
162
|
/**
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
163
|
+
* Called when the component has been requested to re-prompt the user for input.
|
|
164
|
+
*
|
|
165
|
+
* @param _context Context for the current turn of conversation.
|
|
166
|
+
* @param _instance The instance of the current dialog.
|
|
167
|
+
* @returns A promise representing the asynchronous operation.
|
|
168
|
+
*
|
|
169
|
+
* @remarks
|
|
170
|
+
* The active child dialog will have already been asked to reprompt before this method is called.
|
|
171
|
+
*
|
|
172
|
+
*/
|
|
156
173
|
protected onRepromptDialog(_context: TurnContext, _instance: DialogInstance): Promise<void>;
|
|
157
174
|
/**
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
175
|
+
* Called when the components last active child dialog ends and the component is ending.
|
|
176
|
+
*
|
|
177
|
+
* @param outerDC Dialog context for the parents `DialogSet`.
|
|
178
|
+
* @param result Result returned by the last active child dialog. Can be a value of `undefined`.
|
|
179
|
+
* @returns {Promise<DialogTurnResult>} A promise resolving to the dialog turn result.
|
|
180
|
+
*
|
|
181
|
+
* @remarks
|
|
182
|
+
* SHOULD be overridden by components that wish to perform custom logic before the component
|
|
183
|
+
* ends. The default implementation calls `outerDC.endDialog()` with the `result` returned
|
|
184
|
+
* from the last active child dialog.
|
|
185
|
+
*/
|
|
168
186
|
protected endComponent(outerDC: DialogContext, result: any): Promise<DialogTurnResult>;
|
|
169
187
|
/**
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
188
|
+
* Creates a new DialogContext instance for the current turn of conversation.
|
|
189
|
+
*
|
|
190
|
+
* @param context DialogContext for the current turn of conversation with the user.
|
|
191
|
+
* @param instance DialogInstance which contains the current state information for this dialog.
|
|
192
|
+
* @returns A new DialogContext instance.
|
|
193
|
+
*
|
|
194
|
+
* @remarks
|
|
195
|
+
* You should only call this if you don't have a dialogContext to work with (such as OnResume())
|
|
196
|
+
*
|
|
197
|
+
* @private
|
|
198
|
+
*/
|
|
177
199
|
private createInnerDC;
|
|
178
200
|
}
|