@microsoft/agents-hosting-dialogs 0.2.14 → 0.3.5
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/agentComponent.d.ts +18 -4
- package/dist/src/agentComponent.js +12 -4
- package/dist/src/agentComponent.js.map +1 -1
- package/dist/src/agentStateSet.d.ts +2 -2
- package/dist/src/agentStateSet.js +2 -2
- package/dist/src/choices/choice.d.ts +9 -0
- package/dist/src/choices/findChoices.d.ts +12 -0
- package/dist/src/choices/findChoices.js.map +1 -1
- package/dist/src/choices/findValues.d.ts +27 -0
- package/dist/src/choices/findValues.js.map +1 -1
- package/dist/src/choices/modelResult.d.ts +20 -0
- package/dist/src/choices/modelResult.js +4 -0
- package/dist/src/choices/modelResult.js.map +1 -1
- package/dist/src/choices/tokenizer.d.ts +15 -0
- package/dist/src/choices/tokenizer.js +4 -0
- package/dist/src/choices/tokenizer.js.map +1 -1
- package/dist/src/configurable.d.ts +1 -0
- package/dist/src/configurable.js +1 -0
- package/dist/src/configurable.js.map +1 -1
- package/dist/src/converter.d.ts +10 -1
- package/dist/src/dialog.d.ts +14 -13
- package/dist/src/dialog.js +11 -10
- package/dist/src/dialog.js.map +1 -1
- package/dist/src/dialogContext.d.ts +31 -32
- package/dist/src/dialogContext.js +22 -23
- package/dist/src/dialogContext.js.map +1 -1
- package/dist/src/dialogEvent.d.ts +3 -0
- package/dist/src/dialogEvents.d.ts +20 -0
- package/dist/src/dialogEvents.js +20 -0
- package/dist/src/dialogEvents.js.map +1 -1
- package/dist/src/dialogHelper.js +14 -0
- package/dist/src/dialogHelper.js.map +1 -1
- package/dist/src/dialogManager.d.ts +0 -1
- package/dist/src/dialogManager.js +0 -1
- package/dist/src/dialogManager.js.map +1 -1
- package/dist/src/dialogSet.d.ts +4 -8
- package/dist/src/dialogSet.js +4 -8
- package/dist/src/dialogSet.js.map +1 -1
- package/dist/src/dialogTurnStateConstants.d.ts +13 -1
- package/dist/src/dialogTurnStateConstants.js +13 -1
- package/dist/src/dialogTurnStateConstants.js.map +1 -1
- package/dist/src/intentScore.d.ts +6 -0
- package/dist/src/memory/dialogPath.d.ts +40 -8
- package/dist/src/memory/dialogPath.js +32 -8
- package/dist/src/memory/dialogPath.js.map +1 -1
- package/dist/src/memory/dialogStateManager.d.ts +2 -2
- package/dist/src/memory/dialogStateManager.js +2 -2
- package/dist/src/memory/pathResolvers/aliasPathResolver.d.ts +4 -0
- package/dist/src/memory/pathResolvers/aliasPathResolver.js +4 -0
- package/dist/src/memory/pathResolvers/aliasPathResolver.js.map +1 -1
- package/dist/src/memory/pathResolvers/atAtPathResolver.d.ts +6 -2
- package/dist/src/memory/pathResolvers/atAtPathResolver.js +6 -2
- package/dist/src/memory/pathResolvers/atAtPathResolver.js.map +1 -1
- package/dist/src/memory/pathResolvers/atPathResolver.d.ts +13 -7
- package/dist/src/memory/pathResolvers/atPathResolver.js +13 -7
- package/dist/src/memory/pathResolvers/atPathResolver.js.map +1 -1
- package/dist/src/memory/pathResolvers/dollarPathResolver.d.ts +7 -2
- package/dist/src/memory/pathResolvers/dollarPathResolver.js +7 -2
- package/dist/src/memory/pathResolvers/dollarPathResolver.js.map +1 -1
- package/dist/src/memory/pathResolvers/hashPathResolver.d.ts +7 -2
- package/dist/src/memory/pathResolvers/hashPathResolver.js +7 -2
- package/dist/src/memory/pathResolvers/hashPathResolver.js.map +1 -1
- package/dist/src/memory/pathResolvers/pathResolver.d.ts +10 -5
- package/dist/src/memory/pathResolvers/percentPathResolver.d.ts +7 -2
- package/dist/src/memory/pathResolvers/percentPathResolver.js +7 -2
- package/dist/src/memory/pathResolvers/percentPathResolver.js.map +1 -1
- package/dist/src/memory/scopePath.d.ts +27 -0
- package/dist/src/memory/scopePath.js +27 -0
- package/dist/src/memory/scopePath.js.map +1 -1
- package/dist/src/memory/scopes/classMemoryScope.d.ts +18 -14
- package/dist/src/memory/scopes/classMemoryScope.js +18 -14
- package/dist/src/memory/scopes/classMemoryScope.js.map +1 -1
- package/dist/src/memory/scopes/dialogClassMemoryScope.d.ts +12 -6
- package/dist/src/memory/scopes/dialogClassMemoryScope.js +12 -6
- package/dist/src/memory/scopes/dialogClassMemoryScope.js.map +1 -1
- package/dist/src/memory/scopes/dialogContextMemoryScope.d.ts +11 -7
- package/dist/src/memory/scopes/dialogContextMemoryScope.js +11 -7
- package/dist/src/memory/scopes/dialogContextMemoryScope.js.map +1 -1
- package/dist/src/memory/scopes/dialogMemoryScope.d.ts +23 -16
- package/dist/src/memory/scopes/dialogMemoryScope.js +23 -16
- package/dist/src/memory/scopes/dialogMemoryScope.js.map +1 -1
- package/dist/src/memory/scopes/turnMemoryScope.d.ts +14 -13
- package/dist/src/memory/scopes/turnMemoryScope.js +14 -13
- package/dist/src/memory/scopes/turnMemoryScope.js.map +1 -1
- package/dist/src/memory/turnPath.d.ts +61 -13
- package/dist/src/memory/turnPath.js +49 -13
- package/dist/src/memory/turnPath.js.map +1 -1
- package/dist/src/prompts/attachmentPrompt.d.ts +1 -1
- package/dist/src/prompts/attachmentPrompt.js +1 -1
- package/dist/src/prompts/choicePrompt.d.ts +17 -3
- package/dist/src/prompts/choicePrompt.js +1 -1
- package/dist/src/prompts/choicePrompt.js.map +1 -1
- package/dist/src/prompts/confirmPrompt.d.ts +6 -6
- package/dist/src/prompts/confirmPrompt.js +3 -3
- package/dist/src/prompts/datetimePrompt.d.ts +6 -6
- package/dist/src/prompts/datetimePrompt.js +3 -3
- package/dist/src/prompts/numberPrompt.d.ts +6 -6
- package/dist/src/prompts/numberPrompt.js +6 -6
- package/dist/src/prompts/prompt.d.ts +7 -7
- package/dist/src/prompts/prompt.js +2 -2
- package/dist/src/prompts/promptCultureModels.d.ts +38 -3
- package/dist/src/prompts/promptCultureModels.js +38 -3
- package/dist/src/prompts/promptCultureModels.js.map +1 -1
- package/dist/src/recognizer.d.ts +8 -1
- package/dist/src/recognizer.js +5 -1
- package/dist/src/recognizer.js.map +1 -1
- package/dist/src/recognizerResult.d.ts +15 -0
- package/dist/src/recognizerResult.js.map +1 -1
- package/dist/src/serviceCollection.d.ts +22 -22
- package/dist/src/serviceCollection.js +11 -11
- package/dist/src/waterfallDialog.d.ts +5 -5
- package/dist/src/waterfallDialog.js +5 -5
- package/dist/src/waterfallStepContext.d.ts +21 -0
- package/dist/src/waterfallStepContext.js.map +1 -1
- package/package.json +2 -2
- package/src/agentComponent.ts +18 -4
- package/src/agentStateSet.ts +2 -2
- package/src/choices/choice.ts +11 -0
- package/src/choices/findChoices.ts +15 -0
- package/src/choices/findValues.ts +33 -0
- package/src/choices/modelResult.ts +25 -0
- package/src/choices/tokenizer.ts +19 -0
- package/src/configurable.ts +1 -0
- package/src/converter.ts +10 -1
- package/src/dialog.ts +14 -13
- package/src/dialogContext.ts +37 -38
- package/src/dialogEvent.ts +3 -0
- package/src/dialogEvents.ts +25 -0
- package/src/dialogHelper.ts +14 -1
- package/src/dialogManager.ts +0 -1
- package/src/dialogSet.ts +4 -8
- package/src/dialogTurnStateConstants.ts +15 -1
- package/src/intentScore.ts +9 -2
- package/src/memory/dialogPath.ts +47 -23
- package/src/memory/dialogStateManager.ts +2 -2
- package/src/memory/pathResolvers/aliasPathResolver.ts +4 -0
- package/src/memory/pathResolvers/atAtPathResolver.ts +6 -2
- package/src/memory/pathResolvers/atPathResolver.ts +13 -7
- package/src/memory/pathResolvers/dollarPathResolver.ts +7 -2
- package/src/memory/pathResolvers/hashPathResolver.ts +7 -2
- package/src/memory/pathResolvers/pathResolver.ts +10 -5
- package/src/memory/pathResolvers/percentPathResolver.ts +7 -2
- package/src/memory/scopePath.ts +35 -0
- package/src/memory/scopes/classMemoryScope.ts +18 -14
- package/src/memory/scopes/dialogClassMemoryScope.ts +12 -6
- package/src/memory/scopes/dialogContextMemoryScope.ts +11 -7
- package/src/memory/scopes/dialogMemoryScope.ts +23 -16
- package/src/memory/scopes/turnMemoryScope.ts +14 -13
- package/src/memory/turnPath.ts +61 -25
- package/src/prompts/attachmentPrompt.ts +1 -1
- package/src/prompts/choicePrompt.ts +18 -3
- package/src/prompts/confirmPrompt.ts +6 -6
- package/src/prompts/datetimePrompt.ts +6 -6
- package/src/prompts/numberPrompt.ts +6 -6
- package/src/prompts/prompt.ts +7 -7
- package/src/prompts/promptCultureModels.ts +38 -3
- package/src/recognizer.ts +8 -1
- package/src/recognizerResult.ts +24 -5
- package/src/serviceCollection.ts +22 -22
- package/src/waterfallDialog.ts +5 -5
- package/src/waterfallStepContext.ts +32 -6
|
@@ -7,10 +7,25 @@ import { IntentScore } from './intentScore';
|
|
|
7
7
|
* Value returned from a recognizer.
|
|
8
8
|
*/
|
|
9
9
|
export interface RecognizerResult {
|
|
10
|
+
/**
|
|
11
|
+
* The original text input provided by the user.
|
|
12
|
+
*/
|
|
10
13
|
text: string;
|
|
14
|
+
/**
|
|
15
|
+
* Optional. The modified version of the text input, if applicable.
|
|
16
|
+
*/
|
|
11
17
|
alteredText?: string;
|
|
18
|
+
/**
|
|
19
|
+
* A mapping of intent names to their corresponding confidence scores.
|
|
20
|
+
*/
|
|
12
21
|
intents: Record<string, IntentScore>;
|
|
22
|
+
/**
|
|
23
|
+
* Optional. Entities recognized in the input, if any.
|
|
24
|
+
*/
|
|
13
25
|
entities?: any;
|
|
26
|
+
/**
|
|
27
|
+
* Additional properties that may be included in the recognizer result.
|
|
28
|
+
*/
|
|
14
29
|
[propName: string]: any;
|
|
15
30
|
}
|
|
16
31
|
export declare const getTopScoringIntent: (result: RecognizerResult) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recognizerResult.js","sourceRoot":"","sources":["../../src/recognizerResult.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"recognizerResult.js","sourceRoot":"","sources":["../../src/recognizerResult.ts"],"names":[],"mappings":";;;AAoCO,MAAM,mBAAmB,GAAG,CAAC,MAAwB,EAAqC,EAAE;;IACjG,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAA;IACpC,CAAC;IAED,IAAI,SAAS,GAAG,EAAE,CAAA;IAClB,IAAI,QAAQ,GAAG,CAAC,CAAC,CAAA;IACjB,KAAK,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;QAClE,MAAM,KAAK,GAAG,MAAA,MAAM,CAAC,KAAK,mCAAI,CAAC,CAAC,CAAA;QAChC,IAAI,CAAC,SAAS,IAAI,KAAK,GAAG,QAAQ,EAAE,CAAC;YACnC,SAAS,GAAG,UAAU,CAAA;YACtB,QAAQ,GAAG,KAAK,CAAA;QAClB,CAAC;IACH,CAAC;IAED,OAAO;QACL,MAAM,EAAE,SAAS;QACjB,KAAK,EAAE,QAAQ;KAChB,CAAA;AACH,CAAC,CAAA;AAnBY,QAAA,mBAAmB,uBAmB/B"}
|
|
@@ -39,26 +39,26 @@ export declare class ServiceCollection {
|
|
|
39
39
|
/**
|
|
40
40
|
* Register an instance by key. This will overwrite existing instances.
|
|
41
41
|
*
|
|
42
|
-
* @param key
|
|
43
|
-
* @param instance
|
|
44
|
-
* @returns this for chaining
|
|
42
|
+
* @param key Key of the instance being provided.
|
|
43
|
+
* @param instance Instance to provide.
|
|
44
|
+
* @returns `this` for chaining.
|
|
45
45
|
*/
|
|
46
46
|
addInstance<InstanceType>(key: string, instance: InstanceType): this;
|
|
47
47
|
/**
|
|
48
48
|
* Register a factory for a key.
|
|
49
49
|
*
|
|
50
|
-
* @param key
|
|
51
|
-
* @param factory
|
|
52
|
-
* @returns this for chaining
|
|
50
|
+
* @param key Key that factory will provide.
|
|
51
|
+
* @param factory Function that creates an instance to provide.
|
|
52
|
+
* @returns `this` for chaining.
|
|
53
53
|
*/
|
|
54
54
|
addFactory<InstanceType>(key: string, factory: Factory<InstanceType, false>): this;
|
|
55
55
|
/**
|
|
56
56
|
* Register a factory for a key with a set of dependencies.
|
|
57
57
|
*
|
|
58
|
-
* @param key
|
|
59
|
-
* @param dependencies
|
|
60
|
-
* @param factory
|
|
61
|
-
* @returns this for chaining
|
|
58
|
+
* @param key Key that factory will provide.
|
|
59
|
+
* @param dependencies Set of things this instance depends on. Will be provided to factory function via `services`.
|
|
60
|
+
* @param factory Function that creates an instance to provide.
|
|
61
|
+
* @returns `this` for chaining.
|
|
62
62
|
*/
|
|
63
63
|
addFactory<InstanceType, Dependencies>(key: string, dependencies: string[], factory: DependencyFactory<InstanceType, Dependencies, false>): this;
|
|
64
64
|
/**
|
|
@@ -72,27 +72,27 @@ export declare class ServiceCollection {
|
|
|
72
72
|
* Register a factory (that expects an initial value that is not undefined) for a key
|
|
73
73
|
* with a set of dependencies.
|
|
74
74
|
*
|
|
75
|
-
* @param key
|
|
76
|
-
* @param dependencies
|
|
77
|
-
* @param factory
|
|
78
|
-
* @returns this for chaining
|
|
75
|
+
* @param key Key that factory will provide.
|
|
76
|
+
* @param dependencies Set of things this instance depends on. Will be provided to factory function via `services`.
|
|
77
|
+
* @param factory Function that creates an instance to provide.
|
|
78
|
+
* @returns `this` for chaining.
|
|
79
79
|
*/
|
|
80
80
|
composeFactory<InstanceType, Dependencies>(key: string, dependencies: string[], factory: DependencyFactory<InstanceType, Dependencies, true>): this;
|
|
81
81
|
private buildNodes;
|
|
82
82
|
/**
|
|
83
83
|
* Build a single service.
|
|
84
84
|
*
|
|
85
|
-
* @param key
|
|
86
|
-
* @param deep reconstruct all dependencies
|
|
87
|
-
* @returns
|
|
85
|
+
* @param key Service to build.
|
|
86
|
+
* @param deep Whether to reconstruct all dependencies.
|
|
87
|
+
* @returns The service instance, or undefined.
|
|
88
88
|
*/
|
|
89
89
|
makeInstance<InstanceType = unknown>(key: string, deep?: boolean): InstanceType | undefined;
|
|
90
90
|
/**
|
|
91
91
|
* Build a single service and assert that it is not undefined.
|
|
92
92
|
*
|
|
93
|
-
* @param key
|
|
94
|
-
* @param deep reconstruct all dependencies
|
|
95
|
-
* @returns
|
|
93
|
+
* @param key Service to build.
|
|
94
|
+
* @param deep Wheter to reconstruct all dependencies.
|
|
95
|
+
* @returns The service instance
|
|
96
96
|
*/
|
|
97
97
|
mustMakeInstance<InstanceType = unknown>(key: string, deep?: boolean): InstanceType;
|
|
98
98
|
/**
|
|
@@ -104,8 +104,8 @@ export declare class ServiceCollection {
|
|
|
104
104
|
/**
|
|
105
105
|
* Build the full set of services, asserting that the specified keys are not undefined.
|
|
106
106
|
*
|
|
107
|
-
* @param keys
|
|
108
|
-
* @returns
|
|
107
|
+
* @param keys Instances that must be not undefined
|
|
108
|
+
* @returns All resolve services
|
|
109
109
|
*/
|
|
110
110
|
mustMakeInstances<InstancesType extends Record<string, unknown> = Record<string, unknown>>(...keys: string[]): InstancesType;
|
|
111
111
|
}
|
|
@@ -69,9 +69,9 @@ class ServiceCollection {
|
|
|
69
69
|
/**
|
|
70
70
|
* Register an instance by key. This will overwrite existing instances.
|
|
71
71
|
*
|
|
72
|
-
* @param key
|
|
73
|
-
* @param instance
|
|
74
|
-
* @returns this for chaining
|
|
72
|
+
* @param key Key of the instance being provided.
|
|
73
|
+
* @param instance Instance to provide.
|
|
74
|
+
* @returns `this` for chaining.
|
|
75
75
|
*/
|
|
76
76
|
addInstance(key, instance) {
|
|
77
77
|
if (this.graph.hasNode(key)) {
|
|
@@ -157,9 +157,9 @@ class ServiceCollection {
|
|
|
157
157
|
/**
|
|
158
158
|
* Build a single service.
|
|
159
159
|
*
|
|
160
|
-
* @param key
|
|
161
|
-
* @param deep reconstruct all dependencies
|
|
162
|
-
* @returns
|
|
160
|
+
* @param key Service to build.
|
|
161
|
+
* @param deep Whether to reconstruct all dependencies.
|
|
162
|
+
* @returns The service instance, or undefined.
|
|
163
163
|
*/
|
|
164
164
|
makeInstance(key, deep = false) {
|
|
165
165
|
// If this is not a deep reconstruction, reuse any services that `key` depends on
|
|
@@ -174,9 +174,9 @@ class ServiceCollection {
|
|
|
174
174
|
/**
|
|
175
175
|
* Build a single service and assert that it is not undefined.
|
|
176
176
|
*
|
|
177
|
-
* @param key
|
|
178
|
-
* @param deep reconstruct all dependencies
|
|
179
|
-
* @returns
|
|
177
|
+
* @param key Service to build.
|
|
178
|
+
* @param deep Wheter to reconstruct all dependencies.
|
|
179
|
+
* @returns The service instance
|
|
180
180
|
*/
|
|
181
181
|
mustMakeInstance(key, deep = false) {
|
|
182
182
|
const instance = this.makeInstance(key, deep);
|
|
@@ -194,8 +194,8 @@ class ServiceCollection {
|
|
|
194
194
|
/**
|
|
195
195
|
* Build the full set of services, asserting that the specified keys are not undefined.
|
|
196
196
|
*
|
|
197
|
-
* @param keys
|
|
198
|
-
* @returns
|
|
197
|
+
* @param keys Instances that must be not undefined
|
|
198
|
+
* @returns All resolve services
|
|
199
199
|
*/
|
|
200
200
|
mustMakeInstances(...keys) {
|
|
201
201
|
const instances = this.makeInstances();
|
|
@@ -20,7 +20,7 @@ export declare class WaterfallDialog<O extends object = {}> extends Dialog<O> {
|
|
|
20
20
|
* Creates a new waterfall dialog containing the given array of steps.
|
|
21
21
|
*
|
|
22
22
|
* @remarks
|
|
23
|
-
* See the
|
|
23
|
+
* See the {@link WaterfallDialog.addStep | addStep function} for details on creating a valid step function.
|
|
24
24
|
* @param dialogId Unique ID of the dialog within the component or set its being added to.
|
|
25
25
|
* @param steps (Optional) array of asynchronous waterfall step functions.
|
|
26
26
|
*/
|
|
@@ -41,7 +41,7 @@ export declare class WaterfallDialog<O extends object = {}> extends Dialog<O> {
|
|
|
41
41
|
/**
|
|
42
42
|
* Called when the WaterfallDialog is started and pushed onto the dialog stack.
|
|
43
43
|
*
|
|
44
|
-
* @param dialogContext The DialogContext for the current turn of conversation.
|
|
44
|
+
* @param dialogContext The {@link DialogContext} for the current turn of conversation.
|
|
45
45
|
* @param options Optional, initial information to pass to the Dialog.
|
|
46
46
|
* @returns A Promise representing the asynchronous operation.
|
|
47
47
|
* @remarks
|
|
@@ -53,7 +53,7 @@ export declare class WaterfallDialog<O extends object = {}> extends Dialog<O> {
|
|
|
53
53
|
* Called when the WaterfallDialog is _continued_, where it is the active dialog and the
|
|
54
54
|
* user replies with a new Activity.
|
|
55
55
|
*
|
|
56
|
-
* @param dialogContext The DialogContext for the current turn of conversation.
|
|
56
|
+
* @param dialogContext The {@link DialogContext} for the current turn of conversation.
|
|
57
57
|
* @returns A Promise representing the asynchronous operation.
|
|
58
58
|
* @remarks
|
|
59
59
|
* If the task is successful, the result indicates whether the dialog is still
|
|
@@ -64,7 +64,7 @@ export declare class WaterfallDialog<O extends object = {}> extends Dialog<O> {
|
|
|
64
64
|
/**
|
|
65
65
|
* Called when a child WaterfallDialog completed its turn, returning control to this dialog.
|
|
66
66
|
*
|
|
67
|
-
* @param dc The DialogContext for the current turn of the conversation.
|
|
67
|
+
* @param dc The {@link DialogContext} for the current turn of the conversation.
|
|
68
68
|
* @param reason DialogReason why the dialog resumed.
|
|
69
69
|
* @param result Optional, value returned from the dialog that was called. The type
|
|
70
70
|
* of the value returned is dependent on the child dialog.
|
|
@@ -84,7 +84,7 @@ export declare class WaterfallDialog<O extends object = {}> extends Dialog<O> {
|
|
|
84
84
|
/**
|
|
85
85
|
* Executes a step of the WaterfallDialog.
|
|
86
86
|
*
|
|
87
|
-
* @param dc The DialogContext for the current turn of conversation.
|
|
87
|
+
* @param dc The {@link DialogContext} for the current turn of conversation.
|
|
88
88
|
* @param index The index of the current waterfall step to execute.
|
|
89
89
|
* @param reason The DialogReason the waterfall step is being executed.
|
|
90
90
|
* @param result Optional, result returned by a dialog called in the previous waterfall step.
|
|
@@ -19,7 +19,7 @@ class WaterfallDialog extends dialog_1.Dialog {
|
|
|
19
19
|
* Creates a new waterfall dialog containing the given array of steps.
|
|
20
20
|
*
|
|
21
21
|
* @remarks
|
|
22
|
-
* See the
|
|
22
|
+
* See the {@link WaterfallDialog.addStep | addStep function} for details on creating a valid step function.
|
|
23
23
|
* @param dialogId Unique ID of the dialog within the component or set its being added to.
|
|
24
24
|
* @param steps (Optional) array of asynchronous waterfall step functions.
|
|
25
25
|
*/
|
|
@@ -53,7 +53,7 @@ class WaterfallDialog extends dialog_1.Dialog {
|
|
|
53
53
|
/**
|
|
54
54
|
* Called when the WaterfallDialog is started and pushed onto the dialog stack.
|
|
55
55
|
*
|
|
56
|
-
* @param dialogContext The DialogContext for the current turn of conversation.
|
|
56
|
+
* @param dialogContext The {@link DialogContext} for the current turn of conversation.
|
|
57
57
|
* @param options Optional, initial information to pass to the Dialog.
|
|
58
58
|
* @returns A Promise representing the asynchronous operation.
|
|
59
59
|
* @remarks
|
|
@@ -73,7 +73,7 @@ class WaterfallDialog extends dialog_1.Dialog {
|
|
|
73
73
|
* Called when the WaterfallDialog is _continued_, where it is the active dialog and the
|
|
74
74
|
* user replies with a new Activity.
|
|
75
75
|
*
|
|
76
|
-
* @param dialogContext The DialogContext for the current turn of conversation.
|
|
76
|
+
* @param dialogContext The {@link DialogContext} for the current turn of conversation.
|
|
77
77
|
* @returns A Promise representing the asynchronous operation.
|
|
78
78
|
* @remarks
|
|
79
79
|
* If the task is successful, the result indicates whether the dialog is still
|
|
@@ -91,7 +91,7 @@ class WaterfallDialog extends dialog_1.Dialog {
|
|
|
91
91
|
/**
|
|
92
92
|
* Called when a child WaterfallDialog completed its turn, returning control to this dialog.
|
|
93
93
|
*
|
|
94
|
-
* @param dc The DialogContext for the current turn of the conversation.
|
|
94
|
+
* @param dc The {@link DialogContext} for the current turn of the conversation.
|
|
95
95
|
* @param reason DialogReason why the dialog resumed.
|
|
96
96
|
* @param result Optional, value returned from the dialog that was called. The type
|
|
97
97
|
* of the value returned is dependent on the child dialog.
|
|
@@ -117,7 +117,7 @@ class WaterfallDialog extends dialog_1.Dialog {
|
|
|
117
117
|
/**
|
|
118
118
|
* Executes a step of the WaterfallDialog.
|
|
119
119
|
*
|
|
120
|
-
* @param dc The DialogContext for the current turn of conversation.
|
|
120
|
+
* @param dc The {@link DialogContext} for the current turn of conversation.
|
|
121
121
|
* @param index The index of the current waterfall step to execute.
|
|
122
122
|
* @param reason The DialogReason the waterfall step is being executed.
|
|
123
123
|
* @param result Optional, result returned by a dialog called in the previous waterfall step.
|
|
@@ -9,11 +9,32 @@ import { DialogTurnResult } from './dialogTurnResult';
|
|
|
9
9
|
* Values passed to the `WaterfallStepContext` constructor.
|
|
10
10
|
*/
|
|
11
11
|
export interface WaterfallStepInfo<O extends object> {
|
|
12
|
+
/**
|
|
13
|
+
* The index of the current step in the waterfall dialog.
|
|
14
|
+
*/
|
|
12
15
|
index: number;
|
|
16
|
+
/**
|
|
17
|
+
* The options passed to the waterfall dialog when it was started.
|
|
18
|
+
*/
|
|
13
19
|
options: O;
|
|
20
|
+
/**
|
|
21
|
+
* The reason the current step is being executed.
|
|
22
|
+
*/
|
|
14
23
|
reason: DialogReason;
|
|
24
|
+
/**
|
|
25
|
+
* The result returned by the previous step or dialog.
|
|
26
|
+
*/
|
|
15
27
|
result: any;
|
|
28
|
+
/**
|
|
29
|
+
* A dictionary of values shared across all steps in the waterfall dialog.
|
|
30
|
+
*/
|
|
16
31
|
values: object;
|
|
32
|
+
/**
|
|
33
|
+
* A function to proceed to the next step in the waterfall dialog.
|
|
34
|
+
*
|
|
35
|
+
* @param result Optional result to pass to the next step.
|
|
36
|
+
* @returns A promise resolving to the result of the next dialog turn.
|
|
37
|
+
*/
|
|
17
38
|
onNext(result?: any): Promise<DialogTurnResult>;
|
|
18
39
|
}
|
|
19
40
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"waterfallStepContext.js","sourceRoot":"","sources":["../../src/waterfallStepContext.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,mDAA+C;
|
|
1
|
+
{"version":3,"file":"waterfallStepContext.js","sourceRoot":"","sources":["../../src/waterfallStepContext.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,mDAA+C;AA0C/C;;;;GAIG;AACH,MAAa,oBAA4C,SAAQ,6BAAa;IAG5E;;;;;SAKK;IACL,YAAa,aAA4B,EAAE,QAA8B;QACvE,KAAK,CAAC,aAAa,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,WAAW,EAAE,aAAa,CAAC,KAAK,EAAE,CAAC,CAAA;QACjF,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAA;QACzB,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,CAAA;IACpC,CAAC;IAED;;;;SAIK;IACL,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAA;IAC7B,CAAC;IAED;;;;;SAKK;IACL,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAA;IAC/B,CAAC;IAED;;;;SAIK;IACL,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAA;IAC9B,CAAC;IAED;;;;SAIK;IACL,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAA;IAC9B,CAAC;IAED;;;;SAIK;IACL,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAA;IAC9B,CAAC;IAED;;;;;SAKK;IACL,KAAK,CAAC,IAAI,CAAE,MAAY;QACtB,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAC5C,CAAC;CACF;AAtED,oDAsEC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@microsoft/agents-hosting-dialogs",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.3.5",
|
|
5
5
|
"homepage": "https://github.com/microsoft/Agents-for-js",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"main": "dist/index.js",
|
|
17
17
|
"types": "dist/src/index.d.ts",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@microsoft/agents-hosting": "0.
|
|
19
|
+
"@microsoft/agents-hosting": "0.3.5",
|
|
20
20
|
"@types/lodash": "^4.17.16",
|
|
21
21
|
"dependency-graph": "^1.0.0",
|
|
22
22
|
"@microsoft/recognizers-text-suite": "^1.3.1",
|
package/src/agentComponent.ts
CHANGED
|
@@ -8,16 +8,30 @@ import { ServiceCollection } from './serviceCollection'
|
|
|
8
8
|
import { Configuration } from './configuration'
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Abstract base class for defining an AgentComponent.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* An `AgentComponent` allows the registration of services, custom actions, memory scopes, and adapters.
|
|
15
|
+
* To make components available to the system, derive from this class and implement the `configureServices` method.
|
|
16
|
+
* These components are consumed by the system in appropriate places. When using Composer, the `configureServices`
|
|
17
|
+
* method is called automatically by the agent runtime, provided the components are registered in the configuration.
|
|
16
18
|
*/
|
|
17
19
|
export abstract class AgentComponent {
|
|
20
|
+
/**
|
|
21
|
+
* A Zod schema for validating that an object is an `AgentComponent`.
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* This schema checks if the object has a `configureServices` method.
|
|
25
|
+
*/
|
|
18
26
|
static z = z.custom<AgentComponent>((val: any) => typeof val.configureServices === 'function', {
|
|
19
27
|
message: 'AgentComponent',
|
|
20
28
|
})
|
|
21
29
|
|
|
30
|
+
/**
|
|
31
|
+
* Configures the services, custom actions, memory scopes, and adapters for the component.
|
|
32
|
+
*
|
|
33
|
+
* @param services - The service collection to which services can be added.
|
|
34
|
+
* @param configuration - The configuration object for accessing settings.
|
|
35
|
+
*/
|
|
22
36
|
abstract configureServices (services: ServiceCollection, configuration: Configuration): void
|
|
23
37
|
}
|
package/src/agentStateSet.ts
CHANGED
|
@@ -42,7 +42,7 @@ export class AgentStateSet {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
|
-
* Calls
|
|
45
|
+
* Calls the {@link AgentState.load | AgentState.load method} on all of the AgentState plugins in the set.
|
|
46
46
|
*
|
|
47
47
|
* @remarks
|
|
48
48
|
* This will trigger all of the plugins to read in their state in parallel.
|
|
@@ -57,7 +57,7 @@ export class AgentStateSet {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
|
-
* Calls
|
|
60
|
+
* Calls {@link AgentState.saveChanges | AgentState.saveChanges method} on all of the AgentState plugins in the set.
|
|
61
61
|
*
|
|
62
62
|
* @remarks
|
|
63
63
|
* This will trigger all of the plugins to write out their state in parallel.
|
package/src/choices/choice.ts
CHANGED
|
@@ -10,7 +10,18 @@ import { CardAction } from '@microsoft/agents-activity'
|
|
|
10
10
|
* user picked.
|
|
11
11
|
*/
|
|
12
12
|
export interface Choice {
|
|
13
|
+
/**
|
|
14
|
+
* The value of the choice, which is used to identify the choice.
|
|
15
|
+
*/
|
|
13
16
|
value: string;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* An optional action associated with the choice, such as a button click.
|
|
20
|
+
*/
|
|
14
21
|
action?: CardAction;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Optional synonyms that can be used to recognize the choice.
|
|
25
|
+
*/
|
|
15
26
|
synonyms?: string[];
|
|
16
27
|
}
|
|
@@ -8,9 +8,24 @@ import { ModelResult } from './modelResult'
|
|
|
8
8
|
import { Choice } from './choice'
|
|
9
9
|
|
|
10
10
|
export interface FindChoicesOptions extends FindValuesOptions {
|
|
11
|
+
/**
|
|
12
|
+
* If true, the value of the choice will not be included in the search.
|
|
13
|
+
*/
|
|
11
14
|
noValue?: boolean;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* If true, the action title of the choice will not be included in the search.
|
|
18
|
+
*/
|
|
12
19
|
noAction?: boolean;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* If true, numbers will be recognized as choices.
|
|
23
|
+
*/
|
|
13
24
|
recognizeNumbers?: boolean;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* If true, ordinals (e.g., first, second) will be recognized as choices.
|
|
28
|
+
*/
|
|
14
29
|
recognizeOrdinals?: boolean;
|
|
15
30
|
}
|
|
16
31
|
|
|
@@ -9,20 +9,53 @@ import { defaultTokenizer, Token, TokenizerFunction } from './tokenizer'
|
|
|
9
9
|
* Basic search options used to control how choices are recognized in a users utterance.
|
|
10
10
|
*/
|
|
11
11
|
export interface FindValuesOptions {
|
|
12
|
+
/**
|
|
13
|
+
* If true, allows partial matches of values in the search.
|
|
14
|
+
*/
|
|
12
15
|
allowPartialMatches?: boolean;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The locale to use for tokenization and comparison.
|
|
19
|
+
*/
|
|
13
20
|
locale?: string;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The maximum token distance allowed between matches.
|
|
24
|
+
*/
|
|
14
25
|
maxTokenDistance?: number;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The tokenizer function to use for breaking the utterance into tokens.
|
|
29
|
+
*/
|
|
15
30
|
tokenizer?: TokenizerFunction;
|
|
16
31
|
}
|
|
17
32
|
|
|
18
33
|
export interface FoundValue {
|
|
34
|
+
/**
|
|
35
|
+
* The value that was found in the search.
|
|
36
|
+
*/
|
|
19
37
|
value: string;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The index of the value in the original list.
|
|
41
|
+
*/
|
|
20
42
|
index: number;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The confidence score of the match.
|
|
46
|
+
*/
|
|
21
47
|
score: number;
|
|
22
48
|
}
|
|
23
49
|
|
|
24
50
|
export interface SortedValue {
|
|
51
|
+
/**
|
|
52
|
+
* The value to be searched for.
|
|
53
|
+
*/
|
|
25
54
|
value: string;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The index of the value in the original list.
|
|
58
|
+
*/
|
|
26
59
|
index: number;
|
|
27
60
|
}
|
|
28
61
|
|
|
@@ -2,10 +2,35 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents the result of a model recognition process.
|
|
8
|
+
*
|
|
9
|
+
* @template T - The type of the resolution containing additional details about the match.
|
|
10
|
+
*/
|
|
5
11
|
export interface ModelResult<T extends Record<string, any> = {}> {
|
|
12
|
+
/**
|
|
13
|
+
* The text that was matched.
|
|
14
|
+
*/
|
|
6
15
|
text: string;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The start index of the match in the input text.
|
|
19
|
+
*/
|
|
7
20
|
start: number;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The end index of the match in the input text.
|
|
24
|
+
*/
|
|
8
25
|
end: number;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The type of the recognized model result.
|
|
29
|
+
*/
|
|
9
30
|
typeName: string;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The resolution containing additional details about the match.
|
|
34
|
+
*/
|
|
10
35
|
resolution: T;
|
|
11
36
|
}
|
package/src/choices/tokenizer.ts
CHANGED
|
@@ -2,10 +2,29 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents a token extracted from a text string.
|
|
8
|
+
*/
|
|
5
9
|
export interface Token {
|
|
10
|
+
/**
|
|
11
|
+
* The start index of the token in the original text.
|
|
12
|
+
*/
|
|
6
13
|
start: number;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The end index of the token in the original text.
|
|
17
|
+
*/
|
|
7
18
|
end: number;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The original text of the token.
|
|
22
|
+
*/
|
|
8
23
|
text: string;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The normalized (lowercase) version of the token text.
|
|
27
|
+
*/
|
|
9
28
|
normalized: string;
|
|
10
29
|
}
|
|
11
30
|
|
package/src/configurable.ts
CHANGED
package/src/converter.ts
CHANGED
|
@@ -4,12 +4,21 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* The converter converts
|
|
7
|
+
* The converter converts objects from one type to another.
|
|
8
|
+
*
|
|
9
|
+
* @typeParam From - The type of the input value to be converted.
|
|
10
|
+
* @typeParam To - The type of the output value after conversion.
|
|
8
11
|
*/
|
|
9
12
|
export interface Converter<From = unknown, To = unknown> {
|
|
10
13
|
convert(value: From | To): To;
|
|
11
14
|
}
|
|
12
15
|
|
|
16
|
+
/**
|
|
17
|
+
* A factory type for creating instances of a `Converter`.
|
|
18
|
+
*
|
|
19
|
+
* @typeParam From - The type of the input value to be converted.
|
|
20
|
+
* @typeParam To - The type of the output value after conversion.
|
|
21
|
+
*/
|
|
13
22
|
export type ConverterFactory<From = unknown, To = unknown> = {
|
|
14
23
|
new (...args: unknown[]): Converter<From, To>;
|
|
15
24
|
}
|