@microsoft/agents-hosting-dialogs 0.6.21-g3c2261b2fc → 0.6.22
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/choices/findValues.d.ts +18 -9
- package/dist/src/choices/findValues.js +3 -2
- package/dist/src/choices/findValues.js.map +1 -1
- package/dist/src/choices/modelResult.d.ts +1 -1
- package/dist/src/dialogInstance.d.ts +1 -1
- package/dist/src/dialogSet.d.ts +4 -3
- package/dist/src/dialogSet.js.map +1 -1
- package/dist/src/dialogTurnResult.d.ts +1 -1
- package/dist/src/memory/dialogStateManager.d.ts +1 -1
- package/dist/src/memory/dialogStateManager.js +1 -1
- package/dist/src/prompts/confirmPrompt.d.ts +1 -1
- package/dist/src/prompts/prompt.d.ts +6 -6
- package/dist/src/recognizerResult.d.ts +6 -5
- package/dist/src/recognizerResult.js +6 -5
- package/dist/src/recognizerResult.js.map +1 -1
- package/dist/src/serviceCollection.d.ts +6 -6
- package/dist/src/serviceCollection.js +1 -1
- package/package.json +2 -2
- package/src/choices/findValues.ts +18 -9
- package/src/choices/modelResult.ts +1 -1
- package/src/dialogInstance.ts +1 -1
- package/src/dialogSet.ts +4 -3
- package/src/dialogTurnResult.ts +1 -1
- package/src/memory/dialogStateManager.ts +1 -1
- package/src/prompts/confirmPrompt.ts +1 -1
- package/src/prompts/prompt.ts +6 -6
- package/src/recognizerResult.ts +6 -5
- package/src/serviceCollection.ts +6 -6
|
@@ -26,7 +26,9 @@ export interface FindValuesOptions {
|
|
|
26
26
|
tokenizer?: TokenizerFunction;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
* Represents a value that was successfully found and matched during a search operation.
|
|
29
|
+
* @summary Represents a value that was successfully found and matched during a search operation.
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
30
32
|
* This interface contains the matched value along with metadata about the match quality
|
|
31
33
|
* and its position in the original search list.
|
|
32
34
|
*
|
|
@@ -42,21 +44,24 @@ export interface FindValuesOptions {
|
|
|
42
44
|
*/
|
|
43
45
|
export interface FoundValue {
|
|
44
46
|
/**
|
|
45
|
-
* The exact value that was matched from the original search list.
|
|
47
|
+
* @summary The exact value that was matched from the original search list.
|
|
48
|
+
* @remarks
|
|
46
49
|
* This is the original string value, not the user's input that matched it.
|
|
47
50
|
*
|
|
48
51
|
* @example "red" (when user typed "rd" and it matched "red")
|
|
49
52
|
*/
|
|
50
53
|
value: string;
|
|
51
54
|
/**
|
|
52
|
-
* The zero-based index position of this value in the original list that was searched.
|
|
55
|
+
* @summary The zero-based index position of this value in the original list that was searched.
|
|
56
|
+
* @remarks
|
|
53
57
|
* This allows you to correlate the found value back to its position in the source array.
|
|
54
58
|
*
|
|
55
59
|
* @example 0 (if "red" was the first item in the original choices array)
|
|
56
60
|
*/
|
|
57
61
|
index: number;
|
|
58
62
|
/**
|
|
59
|
-
* A confidence score between 0 and 1 indicating the quality of the match.
|
|
63
|
+
* @summary A confidence score between 0 and 1 indicating the quality of the match.
|
|
64
|
+
* @remarks
|
|
60
65
|
* - 1.0 indicates a perfect exact match
|
|
61
66
|
* - Lower values indicate partial or fuzzy matches
|
|
62
67
|
* - Calculated based on completeness (how much of the value matched) and accuracy (token distance)
|
|
@@ -66,7 +71,8 @@ export interface FoundValue {
|
|
|
66
71
|
score: number;
|
|
67
72
|
}
|
|
68
73
|
/**
|
|
69
|
-
* Represents a value with its original position that can be used in search operations.
|
|
74
|
+
* @summary Represents a value with its original position that can be used in search operations.
|
|
75
|
+
* @remarks
|
|
70
76
|
* This interface is used internally by the search algorithm to maintain the relationship
|
|
71
77
|
* between search values and their original positions in the source array.
|
|
72
78
|
*
|
|
@@ -88,14 +94,16 @@ export interface FoundValue {
|
|
|
88
94
|
*/
|
|
89
95
|
export interface SortedValue {
|
|
90
96
|
/**
|
|
91
|
-
* The string value to be searched for during matching operations.
|
|
97
|
+
* @summary The string value to be searched for during matching operations.
|
|
98
|
+
* @remarks
|
|
92
99
|
* This is the actual text content that will be compared against user input.
|
|
93
100
|
*
|
|
94
101
|
* @example "red", "green", "blue" when searching color choices
|
|
95
102
|
*/
|
|
96
103
|
value: string;
|
|
97
104
|
/**
|
|
98
|
-
* The zero-based index position of this value in the original source array.
|
|
105
|
+
* @summary The zero-based index position of this value in the original source array.
|
|
106
|
+
* @remarks
|
|
99
107
|
* This allows the search algorithm to correlate found matches back to their
|
|
100
108
|
* original positions, which is essential for maintaining proper choice selection.
|
|
101
109
|
*
|
|
@@ -104,8 +112,9 @@ export interface SortedValue {
|
|
|
104
112
|
index: number;
|
|
105
113
|
}
|
|
106
114
|
/**
|
|
107
|
-
* Low-level function that searches for a set of values within an utterance.
|
|
108
|
-
*
|
|
115
|
+
* @summary Low-level function that searches for a set of values within an utterance.
|
|
116
|
+
* @remarks
|
|
117
|
+
* Higher level functions like `findChoices()` and `recognizeChoices()` are layered above this function. In most
|
|
109
118
|
* cases its easier to just call one of the higher level functions instead but this function contains
|
|
110
119
|
* the fuzzy search algorithm that drives choice recognition.
|
|
111
120
|
*
|
|
@@ -3,8 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.findValues = findValues;
|
|
4
4
|
const tokenizer_1 = require("./tokenizer");
|
|
5
5
|
/**
|
|
6
|
-
* Low-level function that searches for a set of values within an utterance.
|
|
7
|
-
*
|
|
6
|
+
* @summary Low-level function that searches for a set of values within an utterance.
|
|
7
|
+
* @remarks
|
|
8
|
+
* Higher level functions like `findChoices()` and `recognizeChoices()` are layered above this function. In most
|
|
8
9
|
* cases its easier to just call one of the higher level functions instead but this function contains
|
|
9
10
|
* the fuzzy search algorithm that drives choice recognition.
|
|
10
11
|
*
|
|
@@ -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":";;AAwIA,gCA2I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AA0B,EAAE,CAA0B,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAA;AACpG,CAAC"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* Represents the result of a model recognition process.
|
|
7
7
|
*
|
|
8
|
-
* @
|
|
8
|
+
* @typeParam T - The type of the resolution containing additional details about the match.
|
|
9
9
|
*/
|
|
10
10
|
export interface ModelResult<T extends Record<string, any> = {}> {
|
|
11
11
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Contains state information for an instance of a dialog on the stack.
|
|
3
3
|
*
|
|
4
|
-
* @
|
|
4
|
+
* @typeParam T Optional. The type that represents state information for the dialog.
|
|
5
5
|
*
|
|
6
6
|
* @remarks
|
|
7
7
|
* This contains information for a specific instance of a dialog on a dialog stack.
|
package/dist/src/dialogSet.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { AgentStatePropertyAccessor, TurnContext } from '@microsoft/agents-hosti
|
|
|
6
6
|
import { Dialog } from './dialog';
|
|
7
7
|
import { DialogContext, DialogState } from './dialogContext';
|
|
8
8
|
/**
|
|
9
|
-
* Interface for dialogs that have child dialog dependencies.
|
|
9
|
+
* @summary Interface for dialogs that have child dialog dependencies.
|
|
10
10
|
*
|
|
11
11
|
* @remarks
|
|
12
12
|
* Implement this interface on dialog classes that need to register child dialogs
|
|
@@ -32,9 +32,8 @@ import { DialogContext, DialogState } from './dialogContext';
|
|
|
32
32
|
*/
|
|
33
33
|
export interface DialogDependencies {
|
|
34
34
|
/**
|
|
35
|
-
* Returns an array of child dialogs that this dialog depends on.
|
|
35
|
+
* @summary Returns an array of child dialogs that this dialog depends on.
|
|
36
36
|
*
|
|
37
|
-
* @returns An array of Dialog instances that should be added to the parent DialogSet.
|
|
38
37
|
*
|
|
39
38
|
* @remarks
|
|
40
39
|
* This method is called automatically by DialogSet.add() when a dialog implementing
|
|
@@ -45,6 +44,8 @@ export interface DialogDependencies {
|
|
|
45
44
|
* The returned dialogs should be the actual Dialog instances that will be called
|
|
46
45
|
* by this dialog, not new instances. This ensures proper dialog lifecycle management
|
|
47
46
|
* and state consistency.
|
|
47
|
+
*
|
|
48
|
+
* @returns An array of Dialog instances that should be added to the parent DialogSet.
|
|
48
49
|
*/
|
|
49
50
|
getDependencies(): Dialog[];
|
|
50
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialogSet.js","sourceRoot":"","sources":["../../src/dialogSet.ts"],"names":[],"mappings":";;;AASA,qCAAiC;AACjC,mDAA4D;AAC5D,+CAA2C;
|
|
1
|
+
{"version":3,"file":"dialogSet.js","sourceRoot":"","sources":["../../src/dialogSet.ts"],"names":[],"mappings":";;;AASA,qCAAiC;AACjC,mDAA4D;AAC5D,+CAA2C;AA+C3C;;;;;;;;;;;GAWG;AACH,MAAa,SAAS;IAKpB;;;;;;;;;SASK;IACL,YAAa,WAAqD;QAdjD,YAAO,GAA6B,EAAE,CAAA;QAerD,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;IAChC,CAAC;IAED;;;;;;SAMK;IACL,UAAU;QACR,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,IAAI,QAAQ,GAAG,EAAE,CAAA;YACjB,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;gBAC9B,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,UAAU,EAAE,CAAA;gBACvC,IAAI,CAAC,EAAE,CAAC;oBACN,QAAQ,IAAI,IAAI,CAAC,EAAE,CAAA;gBACrB,CAAC;YACH,CAAC;YACD,IAAI,CAAC,QAAQ,GAAG,yBAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAC5C,CAAC;QAED,OAAO,IAAI,CAAC,QAAQ,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;SAWK;IACL,GAAG,CAAmB,MAA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AED,OAAO,IAAI,CAAA;IACb,CAAC;IAED;;;;;SAKK;IACL,KAAK,CAAC,aAAa,CAAE,OAAoB;QACvC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CACb,8FAA8F,CAC/F,CAAA;QACH,CAAC;QACD,MAAM,KAAK,GAAgB,MAAM,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,EAAE,EAAiB,CAAC,CAAA;QAElG,OAAO,IAAI,6BAAa,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAA;IAChD,CAAC;IAED;;;;SAIK;IACL,IAAI,CAAE,QAAgB;QACpB,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAC1G,CAAC;IAED;;;;SAIK;IACL,UAAU;QACR,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACpC,CAAC;CACF;AAnID,8BAmIC"}
|
|
@@ -3,7 +3,7 @@ import { DialogTurnStatus } from './dialogTurnStatus';
|
|
|
3
3
|
* Represents the result of a dialog context's attempt to begin, continue,
|
|
4
4
|
* or otherwise manipulate one or more dialogs.
|
|
5
5
|
*
|
|
6
|
-
* @
|
|
6
|
+
* @typeParam T Optional. The type that represents a result returned by the active dialog when it
|
|
7
7
|
* successfully completes.
|
|
8
8
|
*
|
|
9
9
|
* @remarks
|
|
@@ -81,7 +81,7 @@ export declare class DialogStateManager {
|
|
|
81
81
|
*
|
|
82
82
|
* @remarks
|
|
83
83
|
* This always returns a CLONE of the memory, any modifications to the result will not affect memory.
|
|
84
|
-
* @
|
|
84
|
+
* @typeParam T The value type to return.
|
|
85
85
|
* @param pathExpression Path expression to use.
|
|
86
86
|
* @param defaultValue (Optional) default value to use if the path isn't found. May be a function that returns the default value to use.
|
|
87
87
|
* @returns The found value or undefined if not found and no `defaultValue` specified.
|
|
@@ -61,7 +61,7 @@ class DialogStateManager {
|
|
|
61
61
|
*
|
|
62
62
|
* @remarks
|
|
63
63
|
* This always returns a CLONE of the memory, any modifications to the result will not affect memory.
|
|
64
|
-
* @
|
|
64
|
+
* @typeParam T The value type to return.
|
|
65
65
|
* @param pathExpression Path expression to use.
|
|
66
66
|
* @param defaultValue (Optional) default value to use if the path isn't found. May be a function that returns the default value to use.
|
|
67
67
|
* @returns The found value or undefined if not found and no `defaultValue` specified.
|
|
@@ -2,7 +2,7 @@ import { TurnContext } from '@microsoft/agents-hosting';
|
|
|
2
2
|
import { Choice, ChoiceFactoryOptions } from '../choices';
|
|
3
3
|
import { ListStyle, Prompt, PromptOptions, PromptRecognizerResult, PromptValidator } from './prompt';
|
|
4
4
|
/**
|
|
5
|
-
* Defines locale-specific choice defaults for confirmation prompts.
|
|
5
|
+
* @summary Defines locale-specific choice defaults for confirmation prompts.
|
|
6
6
|
*
|
|
7
7
|
* @remarks
|
|
8
8
|
* This interface represents a dictionary that maps locale strings to their corresponding
|
|
@@ -88,12 +88,7 @@ export interface PromptRecognizerResult<T> {
|
|
|
88
88
|
value?: T;
|
|
89
89
|
}
|
|
90
90
|
/**
|
|
91
|
-
* Function signature for providing a custom prompt validator.
|
|
92
|
-
*
|
|
93
|
-
* @example
|
|
94
|
-
* ```typescript
|
|
95
|
-
* type PromptValidator<T> = (prompt: PromptValidatorContext<T>) => Promise<boolean>;
|
|
96
|
-
* ```
|
|
91
|
+
* @summary Function signature for providing a custom prompt validator.
|
|
97
92
|
*
|
|
98
93
|
* @remarks
|
|
99
94
|
* The validator should be an asynchronous function that returns `true` if
|
|
@@ -103,6 +98,11 @@ export interface PromptRecognizerResult<T> {
|
|
|
103
98
|
* > If the validator returns `false` the prompts default re-prompt logic will be run unless the
|
|
104
99
|
* > validator sends a custom re-prompt to the user using `prompt.context.sendActivity()`. In that
|
|
105
100
|
* > case the prompts default re-prompt logic will not be run.
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```typescript
|
|
104
|
+
* type PromptValidator<T> = (prompt: PromptValidatorContext<T>) => Promise<boolean>;
|
|
105
|
+
* ```
|
|
106
106
|
* @param T Type of recognizer result being validated.
|
|
107
107
|
* @param prompt Contextual information containing the recognizer result and original options passed to the prompt.
|
|
108
108
|
*/
|
|
@@ -29,16 +29,13 @@ export interface RecognizerResult {
|
|
|
29
29
|
[propName: string]: any;
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
|
-
* Finds the intent with the highest confidence score from a recognizer result.
|
|
32
|
+
* @summary Finds the intent with the highest confidence score from a recognizer result.
|
|
33
33
|
*
|
|
34
|
+
* @remarks
|
|
34
35
|
* This function iterates through all intents in the recognizer result and returns
|
|
35
36
|
* the intent name and score for the intent with the highest confidence score.
|
|
36
37
|
* If multiple intents have the same highest score, the last one encountered is returned.
|
|
37
38
|
*
|
|
38
|
-
* @param result - The recognizer result containing intents and their scores
|
|
39
|
-
* @returns An object containing the top-scoring intent name and its confidence score
|
|
40
|
-
* @throws {Error} Throws an error if the result is empty or doesn't contain intents
|
|
41
|
-
*
|
|
42
39
|
* @example
|
|
43
40
|
* ```typescript
|
|
44
41
|
* const result: RecognizerResult = {
|
|
@@ -53,6 +50,10 @@ export interface RecognizerResult {
|
|
|
53
50
|
* const topIntent = getTopScoringIntent(result);
|
|
54
51
|
* // Returns: { intent: "BookFlight", score: 0.95 }
|
|
55
52
|
* ```
|
|
53
|
+
*
|
|
54
|
+
* @param result - The recognizer result containing intents and their scores
|
|
55
|
+
* @returns An object containing the top-scoring intent name and its confidence score
|
|
56
|
+
* @throws {Error} Throws an error if the result is empty or doesn't contain intents
|
|
56
57
|
*/
|
|
57
58
|
export declare const getTopScoringIntent: (result: RecognizerResult) => {
|
|
58
59
|
intent: string;
|
|
@@ -2,16 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getTopScoringIntent = void 0;
|
|
4
4
|
/**
|
|
5
|
-
* Finds the intent with the highest confidence score from a recognizer result.
|
|
5
|
+
* @summary Finds the intent with the highest confidence score from a recognizer result.
|
|
6
6
|
*
|
|
7
|
+
* @remarks
|
|
7
8
|
* This function iterates through all intents in the recognizer result and returns
|
|
8
9
|
* the intent name and score for the intent with the highest confidence score.
|
|
9
10
|
* If multiple intents have the same highest score, the last one encountered is returned.
|
|
10
11
|
*
|
|
11
|
-
* @param result - The recognizer result containing intents and their scores
|
|
12
|
-
* @returns An object containing the top-scoring intent name and its confidence score
|
|
13
|
-
* @throws {Error} Throws an error if the result is empty or doesn't contain intents
|
|
14
|
-
*
|
|
15
12
|
* @example
|
|
16
13
|
* ```typescript
|
|
17
14
|
* const result: RecognizerResult = {
|
|
@@ -26,6 +23,10 @@ exports.getTopScoringIntent = void 0;
|
|
|
26
23
|
* const topIntent = getTopScoringIntent(result);
|
|
27
24
|
* // Returns: { intent: "BookFlight", score: 0.95 }
|
|
28
25
|
* ```
|
|
26
|
+
*
|
|
27
|
+
* @param result - The recognizer result containing intents and their scores
|
|
28
|
+
* @returns An object containing the top-scoring intent name and its confidence score
|
|
29
|
+
* @throws {Error} Throws an error if the result is empty or doesn't contain intents
|
|
29
30
|
*/
|
|
30
31
|
const getTopScoringIntent = (result) => {
|
|
31
32
|
var _a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recognizerResult.js","sourceRoot":"","sources":["../../src/recognizerResult.ts"],"names":[],"mappings":";;;AAoCA
|
|
1
|
+
{"version":3,"file":"recognizerResult.js","sourceRoot":"","sources":["../../src/recognizerResult.ts"],"names":[],"mappings":";;;AAoCA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACI,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"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Factory describes a generic factory function signature. The type is generic over a few parameters:
|
|
3
3
|
*
|
|
4
|
-
* @
|
|
5
|
-
* @
|
|
4
|
+
* @typeParam Type type the factory produces
|
|
5
|
+
* @typeParam Initial true if the `initialValue` passed to the factory must be defined
|
|
6
6
|
*/
|
|
7
7
|
export type Factory<Type, Initial extends boolean> = (initialValue: Initial extends true ? Type : Type | undefined) => Type;
|
|
8
8
|
/**
|
|
9
9
|
* DependencyFactory is a function signature that produces an instance that depends on a set of
|
|
10
10
|
* other services. The type is generic over a few parameters:
|
|
11
11
|
*
|
|
12
|
-
* @
|
|
13
|
-
* @
|
|
14
|
-
* @
|
|
12
|
+
* @typeParam Type type the factory produces
|
|
13
|
+
* @typeParam Dependencies the services this factory function depends on
|
|
14
|
+
* @typeParam Initial true if the `initialValue` passed to the factory must be defined
|
|
15
15
|
*/
|
|
16
16
|
export type DependencyFactory<Type, Dependencies, Initial extends boolean> = (dependencies: Dependencies, initialValue: Initial extends true ? Type : Type | undefined) => Type;
|
|
17
17
|
/**
|
|
@@ -32,7 +32,7 @@ export declare class ServiceCollection {
|
|
|
32
32
|
/**
|
|
33
33
|
* Construct a Providers instance
|
|
34
34
|
*
|
|
35
|
-
* @
|
|
35
|
+
* @typeParam S services interface
|
|
36
36
|
* @param defaultServices default set of services
|
|
37
37
|
*/
|
|
38
38
|
constructor(defaultServices?: Record<string, unknown>);
|
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.6.
|
|
4
|
+
"version": "0.6.22",
|
|
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.6.
|
|
19
|
+
"@microsoft/agents-hosting": "0.6.22",
|
|
20
20
|
"@types/lodash": "^4.17.16",
|
|
21
21
|
"dependency-graph": "^1.0.0",
|
|
22
22
|
"@microsoft/recognizers-text-suite": "^1.3.1",
|
|
@@ -31,7 +31,9 @@ export interface FindValuesOptions {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
* Represents a value that was successfully found and matched during a search operation.
|
|
34
|
+
* @summary Represents a value that was successfully found and matched during a search operation.
|
|
35
|
+
*
|
|
36
|
+
* @remarks
|
|
35
37
|
* This interface contains the matched value along with metadata about the match quality
|
|
36
38
|
* and its position in the original search list.
|
|
37
39
|
*
|
|
@@ -47,7 +49,8 @@ export interface FindValuesOptions {
|
|
|
47
49
|
*/
|
|
48
50
|
export interface FoundValue {
|
|
49
51
|
/**
|
|
50
|
-
* The exact value that was matched from the original search list.
|
|
52
|
+
* @summary The exact value that was matched from the original search list.
|
|
53
|
+
* @remarks
|
|
51
54
|
* This is the original string value, not the user's input that matched it.
|
|
52
55
|
*
|
|
53
56
|
* @example "red" (when user typed "rd" and it matched "red")
|
|
@@ -55,7 +58,8 @@ export interface FoundValue {
|
|
|
55
58
|
value: string;
|
|
56
59
|
|
|
57
60
|
/**
|
|
58
|
-
* The zero-based index position of this value in the original list that was searched.
|
|
61
|
+
* @summary The zero-based index position of this value in the original list that was searched.
|
|
62
|
+
* @remarks
|
|
59
63
|
* This allows you to correlate the found value back to its position in the source array.
|
|
60
64
|
*
|
|
61
65
|
* @example 0 (if "red" was the first item in the original choices array)
|
|
@@ -63,7 +67,8 @@ export interface FoundValue {
|
|
|
63
67
|
index: number;
|
|
64
68
|
|
|
65
69
|
/**
|
|
66
|
-
* A confidence score between 0 and 1 indicating the quality of the match.
|
|
70
|
+
* @summary A confidence score between 0 and 1 indicating the quality of the match.
|
|
71
|
+
* @remarks
|
|
67
72
|
* - 1.0 indicates a perfect exact match
|
|
68
73
|
* - Lower values indicate partial or fuzzy matches
|
|
69
74
|
* - Calculated based on completeness (how much of the value matched) and accuracy (token distance)
|
|
@@ -74,7 +79,8 @@ export interface FoundValue {
|
|
|
74
79
|
}
|
|
75
80
|
|
|
76
81
|
/**
|
|
77
|
-
* Represents a value with its original position that can be used in search operations.
|
|
82
|
+
* @summary Represents a value with its original position that can be used in search operations.
|
|
83
|
+
* @remarks
|
|
78
84
|
* This interface is used internally by the search algorithm to maintain the relationship
|
|
79
85
|
* between search values and their original positions in the source array.
|
|
80
86
|
*
|
|
@@ -96,7 +102,8 @@ export interface FoundValue {
|
|
|
96
102
|
*/
|
|
97
103
|
export interface SortedValue {
|
|
98
104
|
/**
|
|
99
|
-
* The string value to be searched for during matching operations.
|
|
105
|
+
* @summary The string value to be searched for during matching operations.
|
|
106
|
+
* @remarks
|
|
100
107
|
* This is the actual text content that will be compared against user input.
|
|
101
108
|
*
|
|
102
109
|
* @example "red", "green", "blue" when searching color choices
|
|
@@ -104,7 +111,8 @@ export interface SortedValue {
|
|
|
104
111
|
value: string;
|
|
105
112
|
|
|
106
113
|
/**
|
|
107
|
-
* The zero-based index position of this value in the original source array.
|
|
114
|
+
* @summary The zero-based index position of this value in the original source array.
|
|
115
|
+
* @remarks
|
|
108
116
|
* This allows the search algorithm to correlate found matches back to their
|
|
109
117
|
* original positions, which is essential for maintaining proper choice selection.
|
|
110
118
|
*
|
|
@@ -114,8 +122,9 @@ export interface SortedValue {
|
|
|
114
122
|
}
|
|
115
123
|
|
|
116
124
|
/**
|
|
117
|
-
* Low-level function that searches for a set of values within an utterance.
|
|
118
|
-
*
|
|
125
|
+
* @summary Low-level function that searches for a set of values within an utterance.
|
|
126
|
+
* @remarks
|
|
127
|
+
* Higher level functions like `findChoices()` and `recognizeChoices()` are layered above this function. In most
|
|
119
128
|
* cases its easier to just call one of the higher level functions instead but this function contains
|
|
120
129
|
* the fuzzy search algorithm that drives choice recognition.
|
|
121
130
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* Represents the result of a model recognition process.
|
|
8
8
|
*
|
|
9
|
-
* @
|
|
9
|
+
* @typeParam T - The type of the resolution containing additional details about the match.
|
|
10
10
|
*/
|
|
11
11
|
export interface ModelResult<T extends Record<string, any> = {}> {
|
|
12
12
|
/**
|
package/src/dialogInstance.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Contains state information for an instance of a dialog on the stack.
|
|
3
3
|
*
|
|
4
|
-
* @
|
|
4
|
+
* @typeParam T Optional. The type that represents state information for the dialog.
|
|
5
5
|
*
|
|
6
6
|
* @remarks
|
|
7
7
|
* This contains information for a specific instance of a dialog on a dialog stack.
|
package/src/dialogSet.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { DialogContext, DialogState } from './dialogContext'
|
|
|
12
12
|
import { StringUtils } from './stringUtils'
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* Interface for dialogs that have child dialog dependencies.
|
|
15
|
+
* @summary Interface for dialogs that have child dialog dependencies.
|
|
16
16
|
*
|
|
17
17
|
* @remarks
|
|
18
18
|
* Implement this interface on dialog classes that need to register child dialogs
|
|
@@ -38,9 +38,8 @@ import { StringUtils } from './stringUtils'
|
|
|
38
38
|
*/
|
|
39
39
|
export interface DialogDependencies {
|
|
40
40
|
/**
|
|
41
|
-
* Returns an array of child dialogs that this dialog depends on.
|
|
41
|
+
* @summary Returns an array of child dialogs that this dialog depends on.
|
|
42
42
|
*
|
|
43
|
-
* @returns An array of Dialog instances that should be added to the parent DialogSet.
|
|
44
43
|
*
|
|
45
44
|
* @remarks
|
|
46
45
|
* This method is called automatically by DialogSet.add() when a dialog implementing
|
|
@@ -51,6 +50,8 @@ export interface DialogDependencies {
|
|
|
51
50
|
* The returned dialogs should be the actual Dialog instances that will be called
|
|
52
51
|
* by this dialog, not new instances. This ensures proper dialog lifecycle management
|
|
53
52
|
* and state consistency.
|
|
53
|
+
*
|
|
54
|
+
* @returns An array of Dialog instances that should be added to the parent DialogSet.
|
|
54
55
|
*/
|
|
55
56
|
getDependencies(): Dialog[];
|
|
56
57
|
}
|
package/src/dialogTurnResult.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { DialogTurnStatus } from './dialogTurnStatus'
|
|
|
4
4
|
* Represents the result of a dialog context's attempt to begin, continue,
|
|
5
5
|
* or otherwise manipulate one or more dialogs.
|
|
6
6
|
*
|
|
7
|
-
* @
|
|
7
|
+
* @typeParam T Optional. The type that represents a result returned by the active dialog when it
|
|
8
8
|
* successfully completes.
|
|
9
9
|
*
|
|
10
10
|
* @remarks
|
|
@@ -131,7 +131,7 @@ export class DialogStateManager {
|
|
|
131
131
|
*
|
|
132
132
|
* @remarks
|
|
133
133
|
* This always returns a CLONE of the memory, any modifications to the result will not affect memory.
|
|
134
|
-
* @
|
|
134
|
+
* @typeParam T The value type to return.
|
|
135
135
|
* @param pathExpression Path expression to use.
|
|
136
136
|
* @param defaultValue (Optional) default value to use if the path isn't found. May be a function that returns the default value to use.
|
|
137
137
|
* @returns The found value or undefined if not found and no `defaultValue` specified.
|
|
@@ -10,7 +10,7 @@ import { PromptCultureModels } from './promptCultureModels'
|
|
|
10
10
|
import { Activity } from '@microsoft/agents-activity'
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* Defines locale-specific choice defaults for confirmation prompts.
|
|
13
|
+
* @summary Defines locale-specific choice defaults for confirmation prompts.
|
|
14
14
|
*
|
|
15
15
|
* @remarks
|
|
16
16
|
* This interface represents a dictionary that maps locale strings to their corresponding
|
package/src/prompts/prompt.ts
CHANGED
|
@@ -103,12 +103,7 @@ export interface PromptRecognizerResult<T> {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
/**
|
|
106
|
-
* Function signature for providing a custom prompt validator.
|
|
107
|
-
*
|
|
108
|
-
* @example
|
|
109
|
-
* ```typescript
|
|
110
|
-
* type PromptValidator<T> = (prompt: PromptValidatorContext<T>) => Promise<boolean>;
|
|
111
|
-
* ```
|
|
106
|
+
* @summary Function signature for providing a custom prompt validator.
|
|
112
107
|
*
|
|
113
108
|
* @remarks
|
|
114
109
|
* The validator should be an asynchronous function that returns `true` if
|
|
@@ -118,6 +113,11 @@ export interface PromptRecognizerResult<T> {
|
|
|
118
113
|
* > If the validator returns `false` the prompts default re-prompt logic will be run unless the
|
|
119
114
|
* > validator sends a custom re-prompt to the user using `prompt.context.sendActivity()`. In that
|
|
120
115
|
* > case the prompts default re-prompt logic will not be run.
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```typescript
|
|
119
|
+
* type PromptValidator<T> = (prompt: PromptValidatorContext<T>) => Promise<boolean>;
|
|
120
|
+
* ```
|
|
121
121
|
* @param T Type of recognizer result being validated.
|
|
122
122
|
* @param prompt Contextual information containing the recognizer result and original options passed to the prompt.
|
|
123
123
|
*/
|
package/src/recognizerResult.ts
CHANGED
|
@@ -35,16 +35,13 @@ export interface RecognizerResult {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
|
-
* Finds the intent with the highest confidence score from a recognizer result.
|
|
38
|
+
* @summary Finds the intent with the highest confidence score from a recognizer result.
|
|
39
39
|
*
|
|
40
|
+
* @remarks
|
|
40
41
|
* This function iterates through all intents in the recognizer result and returns
|
|
41
42
|
* the intent name and score for the intent with the highest confidence score.
|
|
42
43
|
* If multiple intents have the same highest score, the last one encountered is returned.
|
|
43
44
|
*
|
|
44
|
-
* @param result - The recognizer result containing intents and their scores
|
|
45
|
-
* @returns An object containing the top-scoring intent name and its confidence score
|
|
46
|
-
* @throws {Error} Throws an error if the result is empty or doesn't contain intents
|
|
47
|
-
*
|
|
48
45
|
* @example
|
|
49
46
|
* ```typescript
|
|
50
47
|
* const result: RecognizerResult = {
|
|
@@ -59,6 +56,10 @@ export interface RecognizerResult {
|
|
|
59
56
|
* const topIntent = getTopScoringIntent(result);
|
|
60
57
|
* // Returns: { intent: "BookFlight", score: 0.95 }
|
|
61
58
|
* ```
|
|
59
|
+
*
|
|
60
|
+
* @param result - The recognizer result containing intents and their scores
|
|
61
|
+
* @returns An object containing the top-scoring intent name and its confidence score
|
|
62
|
+
* @throws {Error} Throws an error if the result is empty or doesn't contain intents
|
|
62
63
|
*/
|
|
63
64
|
export const getTopScoringIntent = (result: RecognizerResult): { intent: string; score: number } => {
|
|
64
65
|
if (!result || !result.intents) {
|
package/src/serviceCollection.ts
CHANGED
|
@@ -7,8 +7,8 @@ import { DepGraph } from 'dependency-graph'
|
|
|
7
7
|
/**
|
|
8
8
|
* Factory describes a generic factory function signature. The type is generic over a few parameters:
|
|
9
9
|
*
|
|
10
|
-
* @
|
|
11
|
-
* @
|
|
10
|
+
* @typeParam Type type the factory produces
|
|
11
|
+
* @typeParam Initial true if the `initialValue` passed to the factory must be defined
|
|
12
12
|
*/
|
|
13
13
|
export type Factory<Type, Initial extends boolean> = (
|
|
14
14
|
initialValue: Initial extends true ? Type : Type | undefined,
|
|
@@ -18,9 +18,9 @@ export type Factory<Type, Initial extends boolean> = (
|
|
|
18
18
|
* DependencyFactory is a function signature that produces an instance that depends on a set of
|
|
19
19
|
* other services. The type is generic over a few parameters:
|
|
20
20
|
*
|
|
21
|
-
* @
|
|
22
|
-
* @
|
|
23
|
-
* @
|
|
21
|
+
* @typeParam Type type the factory produces
|
|
22
|
+
* @typeParam Dependencies the services this factory function depends on
|
|
23
|
+
* @typeParam Initial true if the `initialValue` passed to the factory must be defined
|
|
24
24
|
*/
|
|
25
25
|
export type DependencyFactory<Type, Dependencies, Initial extends boolean> = (
|
|
26
26
|
dependencies: Dependencies,
|
|
@@ -50,7 +50,7 @@ export class ServiceCollection {
|
|
|
50
50
|
/**
|
|
51
51
|
* Construct a Providers instance
|
|
52
52
|
*
|
|
53
|
-
* @
|
|
53
|
+
* @typeParam S services interface
|
|
54
54
|
* @param defaultServices default set of services
|
|
55
55
|
*/
|
|
56
56
|
constructor (defaultServices: Record<string, unknown> = {}) {
|