@microsoft/agents-hosting-dialogs 1.0.0 → 1.0.3-g444d99f704

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.
Files changed (101) hide show
  1. package/dist/src/agentStateSet.d.ts +30 -27
  2. package/dist/src/agentStateSet.js +30 -27
  3. package/dist/src/agentStateSet.js.map +1 -1
  4. package/dist/src/choices/findValues.d.ts +21 -12
  5. package/dist/src/choices/findValues.js +8 -5
  6. package/dist/src/choices/findValues.js.map +1 -1
  7. package/dist/src/componentDialog.d.ts +117 -95
  8. package/dist/src/componentDialog.js +106 -84
  9. package/dist/src/componentDialog.js.map +1 -1
  10. package/dist/src/dialog.d.ts +15 -10
  11. package/dist/src/dialog.js +15 -10
  12. package/dist/src/dialog.js.map +1 -1
  13. package/dist/src/dialogContainer.d.ts +5 -2
  14. package/dist/src/dialogContainer.js +5 -2
  15. package/dist/src/dialogContainer.js.map +1 -1
  16. package/dist/src/dialogContext.d.ts +30 -9
  17. package/dist/src/dialogContext.js +31 -11
  18. package/dist/src/dialogContext.js.map +1 -1
  19. package/dist/src/dialogInstance.d.ts +11 -11
  20. package/dist/src/dialogReason.d.ts +13 -13
  21. package/dist/src/dialogReason.js +13 -13
  22. package/dist/src/dialogReason.js.map +1 -1
  23. package/dist/src/dialogSet.d.ts +11 -6
  24. package/dist/src/dialogSet.js +9 -4
  25. package/dist/src/dialogSet.js.map +1 -1
  26. package/dist/src/dialogTurnResult.d.ts +1 -0
  27. package/dist/src/dialogTurnStateConstants.d.ts +1 -0
  28. package/dist/src/dialogTurnStateConstants.js +1 -0
  29. package/dist/src/dialogTurnStateConstants.js.map +1 -1
  30. package/dist/src/dialogTurnStatus.d.ts +1 -0
  31. package/dist/src/dialogTurnStatus.js +1 -0
  32. package/dist/src/dialogTurnStatus.js.map +1 -1
  33. package/dist/src/memory/dialogStateManager.d.ts +9 -4
  34. package/dist/src/memory/dialogStateManager.js +9 -4
  35. package/dist/src/memory/dialogStateManager.js.map +1 -1
  36. package/dist/src/prompts/activityPrompt.d.ts +4 -0
  37. package/dist/src/prompts/activityPrompt.js +4 -0
  38. package/dist/src/prompts/activityPrompt.js.map +1 -1
  39. package/dist/src/prompts/attachmentPrompt.d.ts +1 -0
  40. package/dist/src/prompts/attachmentPrompt.js +1 -0
  41. package/dist/src/prompts/attachmentPrompt.js.map +1 -1
  42. package/dist/src/prompts/choicePrompt.d.ts +4 -0
  43. package/dist/src/prompts/choicePrompt.js +1 -0
  44. package/dist/src/prompts/choicePrompt.js.map +1 -1
  45. package/dist/src/prompts/confirmPrompt.d.ts +4 -1
  46. package/dist/src/prompts/confirmPrompt.js +1 -0
  47. package/dist/src/prompts/confirmPrompt.js.map +1 -1
  48. package/dist/src/prompts/datetimePrompt.d.ts +1 -0
  49. package/dist/src/prompts/datetimePrompt.js +1 -0
  50. package/dist/src/prompts/datetimePrompt.js.map +1 -1
  51. package/dist/src/prompts/numberPrompt.d.ts +1 -0
  52. package/dist/src/prompts/numberPrompt.js +1 -0
  53. package/dist/src/prompts/numberPrompt.js.map +1 -1
  54. package/dist/src/prompts/prompt.d.ts +22 -6
  55. package/dist/src/prompts/prompt.js +8 -0
  56. package/dist/src/prompts/prompt.js.map +1 -1
  57. package/dist/src/prompts/promptCultureModels.d.ts +16 -1
  58. package/dist/src/prompts/promptCultureModels.js +4 -1
  59. package/dist/src/prompts/promptCultureModels.js.map +1 -1
  60. package/dist/src/prompts/textPrompt.d.ts +3 -0
  61. package/dist/src/prompts/textPrompt.js +3 -0
  62. package/dist/src/prompts/textPrompt.js.map +1 -1
  63. package/dist/src/recognizer.d.ts +3 -0
  64. package/dist/src/recognizer.js +1 -0
  65. package/dist/src/recognizer.js.map +1 -1
  66. package/dist/src/recognizerResult.d.ts +5 -4
  67. package/dist/src/recognizerResult.js +5 -4
  68. package/dist/src/recognizerResult.js.map +1 -1
  69. package/dist/src/stringUtils.d.ts +4 -3
  70. package/dist/src/stringUtils.js +4 -3
  71. package/dist/src/stringUtils.js.map +1 -1
  72. package/dist/src/waterfallDialog.d.ts +11 -4
  73. package/dist/src/waterfallDialog.js +11 -4
  74. package/dist/src/waterfallDialog.js.map +1 -1
  75. package/package.json +2 -2
  76. package/src/agentStateSet.ts +30 -27
  77. package/src/choices/findValues.ts +21 -12
  78. package/src/componentDialog.ts +127 -97
  79. package/src/dialog.ts +15 -10
  80. package/src/dialogContainer.ts +5 -2
  81. package/src/dialogContext.ts +37 -11
  82. package/src/dialogInstance.ts +11 -11
  83. package/src/dialogReason.ts +13 -13
  84. package/src/dialogSet.ts +11 -6
  85. package/src/dialogTurnResult.ts +1 -0
  86. package/src/dialogTurnStateConstants.ts +1 -0
  87. package/src/dialogTurnStatus.ts +1 -0
  88. package/src/memory/dialogStateManager.ts +9 -4
  89. package/src/prompts/activityPrompt.ts +4 -0
  90. package/src/prompts/attachmentPrompt.ts +1 -0
  91. package/src/prompts/choicePrompt.ts +4 -0
  92. package/src/prompts/confirmPrompt.ts +4 -1
  93. package/src/prompts/datetimePrompt.ts +1 -0
  94. package/src/prompts/numberPrompt.ts +1 -0
  95. package/src/prompts/prompt.ts +22 -6
  96. package/src/prompts/promptCultureModels.ts +16 -1
  97. package/src/prompts/textPrompt.ts +3 -0
  98. package/src/recognizer.ts +3 -0
  99. package/src/recognizerResult.ts +5 -4
  100. package/src/stringUtils.ts +4 -3
  101. package/src/waterfallDialog.ts +11 -4
@@ -31,7 +31,7 @@ export interface FindValuesOptions {
31
31
  }
32
32
 
33
33
  /**
34
- * @summary Represents a value that was successfully found and matched during a search operation.
34
+ * Represents a value that was successfully found and matched during a search operation.
35
35
  *
36
36
  * @remarks
37
37
  * This interface contains the matched value along with metadata about the match quality
@@ -49,7 +49,8 @@ export interface FindValuesOptions {
49
49
  */
50
50
  export interface FoundValue {
51
51
  /**
52
- * @summary The exact value that was matched from the original search list.
52
+ * The exact value that was matched from the original search list.
53
+ *
53
54
  * @remarks
54
55
  * This is the original string value, not the user's input that matched it.
55
56
  *
@@ -58,7 +59,8 @@ export interface FoundValue {
58
59
  value: string;
59
60
 
60
61
  /**
61
- * @summary The zero-based index position of this value in the original list that was searched.
62
+ * The zero-based index position of this value in the original list that was searched.
63
+ *
62
64
  * @remarks
63
65
  * This allows you to correlate the found value back to its position in the source array.
64
66
  *
@@ -67,7 +69,8 @@ export interface FoundValue {
67
69
  index: number;
68
70
 
69
71
  /**
70
- * @summary A confidence score between 0 and 1 indicating the quality of the match.
72
+ * A confidence score between 0 and 1 indicating the quality of the match.
73
+ *
71
74
  * @remarks
72
75
  * - 1.0 indicates a perfect exact match
73
76
  * - Lower values indicate partial or fuzzy matches
@@ -79,7 +82,8 @@ export interface FoundValue {
79
82
  }
80
83
 
81
84
  /**
82
- * @summary Represents a value with its original position that can be used in search operations.
85
+ * Represents a value with its original position that can be used in search operations.
86
+ *
83
87
  * @remarks
84
88
  * This interface is used internally by the search algorithm to maintain the relationship
85
89
  * between search values and their original positions in the source array.
@@ -102,7 +106,8 @@ export interface FoundValue {
102
106
  */
103
107
  export interface SortedValue {
104
108
  /**
105
- * @summary The string value to be searched for during matching operations.
109
+ * The string value to be searched for during matching operations.
110
+ *
106
111
  * @remarks
107
112
  * This is the actual text content that will be compared against user input.
108
113
  *
@@ -111,7 +116,8 @@ export interface SortedValue {
111
116
  value: string;
112
117
 
113
118
  /**
114
- * @summary The zero-based index position of this value in the original source array.
119
+ * The zero-based index position of this value in the original source array.
120
+ *
115
121
  * @remarks
116
122
  * This allows the search algorithm to correlate found matches back to their
117
123
  * original positions, which is essential for maintaining proper choice selection.
@@ -122,17 +128,20 @@ export interface SortedValue {
122
128
  }
123
129
 
124
130
  /**
125
- * @summary Low-level function that searches for a set of values within an utterance.
131
+ * Low-level function that searches for a set of values within an utterance.
132
+ *
133
+ * @param utterance The text or user utterance to search over.
134
+ * @param values List of values to search over.
135
+ * @param options (Optional) options used to tweak the search that's performed.
136
+ * @returns A list of found values.
137
+ *
126
138
  * @remarks
127
139
  * Higher level functions like `findChoices()` and `recognizeChoices()` are layered above this function. In most
128
140
  * cases its easier to just call one of the higher level functions instead but this function contains
129
141
  * the fuzzy search algorithm that drives choice recognition.
130
142
  *
131
143
  * @internal
132
- * @param utterance The text or user utterance to search over.
133
- * @param values List of values to search over.
134
- * @param options (Optional) options used to tweak the search that's performed.
135
- * @returns A list of found values.
144
+
136
145
  */
137
146
  export function findValues (
138
147
  utterance: string,
@@ -16,36 +16,39 @@ const PERSISTED_DIALOG_STATE = 'dialogs'
16
16
  /**
17
17
  * Base class for a dialog that contains other child dialogs.
18
18
  *
19
+ * @param O (Optional) options that can be passed into the `DialogContext.beginDialog()` method.
20
+ *
19
21
  * @remarks
20
22
  * Component dialogs let you break your agent's logic up into components that can themselves be added
21
23
  * as a dialog to another `ComponentDialog` or `DialogSet`. Components can also be exported as part
22
24
  * of a node package and used within other agents.
23
25
  *
24
- * @param O (Optional) options that can be passed into the `DialogContext.beginDialog()` method.
25
26
  */
26
27
  export class ComponentDialog<O extends object = {}> extends DialogContainer<O> {
27
28
  /**
28
- * ID of the child dialog that should be started anytime the component is started.
29
- *
30
- * @remarks
31
- * This defaults to the ID of the first child dialog added using [addDialog()](#adddialog).
32
- */
29
+ * ID of the child dialog that should be started anytime the component is started.
30
+ *
31
+ * @remarks
32
+ * This defaults to the ID of the first child dialog added using [addDialog()](#adddialog).
33
+ */
33
34
  protected initialDialogId: string
34
35
 
35
36
  /**
36
- * Called when the dialog is started and pushed onto the parent's dialog stack.
37
- * By default, this calls the
38
- * Dialog.BeginDialogAsync(DialogContext, object, CancellationToken) method
39
- * of the component dialog's initial dialog, as defined by InitialDialogId.
40
- * Override this method in a derived class to implement interrupt logic.
41
- *
42
- * @param outerDialogContext The parent DialogContext for the current turn of conversation.
43
- * @param options Optional, initial information to pass to the dialog.
44
- * @returns A Promise representing the asynchronous operation.
45
- * @remarks
46
- * If the task is successful, the result indicates whether the dialog is still
47
- * active after the turn has been processed by the dialog.
48
- */
37
+ * Called when the dialog is started and pushed onto the parent's dialog stack.
38
+ *
39
+ * @param outerDialogContext The parent DialogContext for the current turn of conversation.
40
+ * @param options Optional, initial information to pass to the dialog.
41
+ * @returns A Promise representing the asynchronous operation.
42
+ *
43
+ * @remarks
44
+ * If the task is successful, the result indicates whether the dialog is still
45
+ * active after the turn has been processed by the dialog.
46
+ * By default, this calls the
47
+ * Dialog.BeginDialogAsync(DialogContext, object, CancellationToken) method
48
+ * of the component dialog's initial dialog, as defined by InitialDialogId.
49
+ * Override this method in a derived class to implement interrupt logic.
50
+ *
51
+ */
49
52
  async beginDialog (outerDialogContext: DialogContext, options?: O): Promise<DialogTurnResult> {
50
53
  await this.checkForVersionChange(outerDialogContext)
51
54
 
@@ -73,14 +76,16 @@ export class ComponentDialog<O extends object = {}> extends DialogContainer<O> {
73
76
  /**
74
77
  * Called when the dialog is _continued_, where it is the active dialog and the
75
78
  * user replies with a new Activity.
76
- * If this method is *not* overridden, the dialog automatically ends when the user replies.
77
79
  *
78
80
  * @param outerDialogContext The parent DialogContext for the current turn of conversation.
79
81
  * @returns A Promise representing the asynchronous operation.
82
+ *
80
83
  * @remarks
84
+ * If this method is *not* overridden, the dialog automatically ends when the user replies.
81
85
  * If the task is successful, the result indicates whether the dialog is still
82
86
  * active after the turn has been processed by the dialog. The result may also contain a
83
87
  * return value.
88
+ *
84
89
  */
85
90
  async continueDialog (outerDialogContext: DialogContext): Promise<DialogTurnResult> {
86
91
  await this.checkForVersionChange(outerDialogContext)
@@ -108,6 +113,7 @@ export class ComponentDialog<O extends object = {}> extends DialogContainer<O> {
108
113
  * @param _result Optional, value returned from the dialog that was called. The type
109
114
  * of the value returned is dependent on the child dialog.
110
115
  * @returns A Promise representing the asynchronous operation.
116
+ *
111
117
  * @remarks
112
118
  * If the task is successful, the result indicates whether this dialog is still
113
119
  * active after this dialog turn has been processed.
@@ -132,12 +138,12 @@ export class ComponentDialog<O extends object = {}> extends DialogContainer<O> {
132
138
  }
133
139
 
134
140
  /**
135
- * Called when the dialog should re-prompt the user for input.
136
- *
137
- * @param context The TurnContext object for this turn.
138
- * @param instance State information for this dialog.
139
- * @returns A Promise representing the asynchronous operation.
140
- */
141
+ * Called when the dialog should re-prompt the user for input.
142
+ *
143
+ * @param context The TurnContext object for this turn.
144
+ * @param instance State information for this dialog.
145
+ * @returns A Promise representing the asynchronous operation.
146
+ */
141
147
  async repromptDialog (context: TurnContext, instance: DialogInstance): Promise<void> {
142
148
  // Forward to inner dialogs
143
149
  const innerDC: DialogContext = this.createInnerDC(context, instance)
@@ -148,15 +154,18 @@ export class ComponentDialog<O extends object = {}> extends DialogContainer<O> {
148
154
  }
149
155
 
150
156
  /**
151
- * Called when the Dialog is ending.
152
- *
153
- * @param context The TurnContext object for this turn.
154
- * @param instance State information associated with the instance of this component Dialog on its parent's dialog stack.
155
- * @param reason Reason why the Dialog ended.
156
- * @returns A Promise representing the asynchronous operation.
157
- * @remarks When this method is called from the parent dialog's context, the component Dialog
158
- * cancels all of the dialogs on its inner dialog stack before ending.
159
- */
157
+ * Called when the Dialog is ending.
158
+ *
159
+ * @param context The TurnContext object for this turn.
160
+ * @param instance State information associated with the instance of this component Dialog on its parent's dialog stack.
161
+ * @param reason Reason why the Dialog ended.
162
+ * @returns A Promise representing the asynchronous operation.
163
+ *
164
+ * @remarks
165
+ * When this method is called from the parent dialog's context, the component Dialog
166
+ * cancels all of the dialogs on its inner dialog stack before ending.
167
+ *
168
+ */
160
169
  async endDialog (context: TurnContext, instance: DialogInstance, reason: DialogReason): Promise<void> {
161
170
  // Forward cancel to inner dialogs
162
171
  if (reason === DialogReason.cancelCalled) {
@@ -169,13 +178,14 @@ export class ComponentDialog<O extends object = {}> extends DialogContainer<O> {
169
178
  }
170
179
 
171
180
  /**
172
- * Adds a child Dialog or prompt to the components internal DialogSet.
173
- *
174
- * @param dialog The child Dialog or prompt to add.
175
- * @returns The ComponentDialog after the operation is complete.
176
- * @remarks
177
- * The Dialog.id of the first child added to the component will be assigned to the initialDialogId property.
178
- */
181
+ * Adds a child Dialog or prompt to the components internal DialogSet.
182
+ *
183
+ * @param dialog The child Dialog or prompt to add.
184
+ * @returns The ComponentDialog after the operation is complete.
185
+ *
186
+ * @remarks
187
+ * The Dialog.id of the first child added to the component will be assigned to the initialDialogId property.
188
+ */
179
189
  addDialog (dialog: Dialog): this {
180
190
  this.dialogs.add(dialog)
181
191
  if (this.initialDialogId === undefined) {
@@ -196,101 +206,121 @@ export class ComponentDialog<O extends object = {}> extends DialogContainer<O> {
196
206
  }
197
207
 
198
208
  /**
199
- * Called anytime an instance of the component has been started.
200
- *
201
- * @remarks
202
- * SHOULD be overridden by components that wish to perform custom interruption logic. The
203
- * default implementation calls `innerDC.beginDialog()` with the dialog assigned to
204
- * initialdialogid.
205
- * @param innerDialogContext Dialog context for the components internal `DialogSet`.
206
- * @param options (Optional) options that were passed to the component by its parent.
207
- * @returns {Promise<DialogTurnResult>} A promise resolving to the dialog turn result.
208
- */
209
+ * Called anytime an instance of the component has been started.
210
+ *
211
+ * @param innerDialogContext Dialog context for the components internal `DialogSet`.
212
+ * @param options (Optional) options that were passed to the component by its parent.
213
+ * @returns {Promise<DialogTurnResult>} A promise resolving to the dialog turn result.
214
+ *
215
+ * @remarks
216
+ * SHOULD be overridden by components that wish to perform custom interruption logic. The
217
+ * default implementation calls `innerDC.beginDialog()` with the dialog assigned to
218
+ * `initialDialogId`.
219
+ *
220
+ */
209
221
  protected onBeginDialog (innerDialogContext: DialogContext, options?: O): Promise<DialogTurnResult> {
210
222
  return innerDialogContext.beginDialog(this.initialDialogId, options)
211
223
  }
212
224
 
213
225
  /**
214
- * Called anytime a multi-turn component receives additional activities.
215
- *
216
- * @remarks
217
- * SHOULD be overridden by components that wish to perform custom interruption logic. The
218
- * default implementation calls `innerDC.continueDialog()`.
219
- * @param innerDC Dialog context for the components internal `DialogSet`.
220
- * @returns {Promise<DialogTurnResult>} A promise resolving to the dialog turn result.
221
- */
226
+ * Called anytime a multi-turn component receives additional activities.
227
+ *
228
+ * @param innerDC Dialog context for the components internal `DialogSet`.
229
+ * @returns {Promise<DialogTurnResult>} A promise resolving to the dialog turn result.
230
+ *
231
+ * @remarks
232
+ * SHOULD be overridden by components that wish to perform custom interruption logic. The
233
+ * default implementation calls `innerDC.continueDialog()`.
234
+ */
222
235
  protected onContinueDialog (innerDC: DialogContext): Promise<DialogTurnResult> {
223
236
  return innerDC.continueDialog()
224
237
  }
225
238
 
226
239
  /**
227
- * Called when the component is ending.
228
- *
229
- * @remarks
230
- * If the `reason` code is equal to `DialogReason.cancelCalled`, then any active child dialogs
231
- * will be cancelled before this method is called.
232
- * @param _context Context for the current turn of conversation.
233
- * @param _instance The components instance data within its parents dialog stack.
234
- * @param _reason The reason the component is ending.
235
- * @returns A promise representing the asynchronous operation.
236
- */
240
+ * Called when the component is ending.
241
+ *
242
+ * @param _context Context for the current turn of conversation.
243
+ * @param _instance The components instance data within its parents dialog stack.
244
+ * @param _reason The reason the component is ending.
245
+ * @returns A promise representing the asynchronous operation.
246
+ *
247
+ * @remarks
248
+ * If the `reason` code is equal to `DialogReason.cancelCalled`, then any active child dialogs
249
+ * will be cancelled before this method is called.
250
+ *
251
+ */
237
252
  protected onEndDialog (_context: TurnContext, _instance: DialogInstance, _reason: DialogReason): Promise<void> {
238
253
  return Promise.resolve()
239
254
  }
240
255
 
241
256
  /**
242
- * Called when the component has been requested to re-prompt the user for input.
243
- *
244
- * @remarks
245
- * The active child dialog will have already been asked to reprompt before this method is called.
246
- * @param _context Context for the current turn of conversation.
247
- * @param _instance The instance of the current dialog.
248
- * @returns A promise representing the asynchronous operation.
249
- */
257
+ * Called when the component has been requested to re-prompt the user for input.
258
+ *
259
+ * @param _context Context for the current turn of conversation.
260
+ * @param _instance The instance of the current dialog.
261
+ * @returns A promise representing the asynchronous operation.
262
+ *
263
+ * @remarks
264
+ * The active child dialog will have already been asked to reprompt before this method is called.
265
+ *
266
+ */
250
267
  protected onRepromptDialog (_context: TurnContext, _instance: DialogInstance): Promise<void> {
251
268
  return Promise.resolve()
252
269
  }
253
270
 
254
271
  /**
255
- * Called when the components last active child dialog ends and the component is ending.
256
- *
257
- * @remarks
258
- * SHOULD be overridden by components that wish to perform custom logic before the component
259
- * ends. The default implementation calls `outerDC.endDialog()` with the `result` returned
260
- * from the last active child dialog.
261
- * @param outerDC Dialog context for the parents `DialogSet`.
262
- * @param result Result returned by the last active child dialog. Can be a value of `undefined`.
263
- * @returns {Promise<DialogTurnResult>} A promise resolving to the dialog turn result.
264
- */
272
+ * Called when the components last active child dialog ends and the component is ending.
273
+ *
274
+ * @param outerDC Dialog context for the parents `DialogSet`.
275
+ * @param result Result returned by the last active child dialog. Can be a value of `undefined`.
276
+ * @returns {Promise<DialogTurnResult>} A promise resolving to the dialog turn result.
277
+ *
278
+ * @remarks
279
+ * SHOULD be overridden by components that wish to perform custom logic before the component
280
+ * ends. The default implementation calls `outerDC.endDialog()` with the `result` returned
281
+ * from the last active child dialog.
282
+ */
265
283
  protected endComponent (outerDC: DialogContext, result: any): Promise<DialogTurnResult> {
266
284
  return outerDC.endDialog(result)
267
285
  }
268
286
 
269
287
  /**
270
- * @private
271
- * @param context DialogContext for the current turn of conversation with the user.
272
- * @param instance DialogInstance which contains the current state information for this dialog.
273
- * @returns A new DialogContext instance.
274
- * @remarks
275
- * You should only call this if you don't have a dialogContext to work with (such as OnResume())
276
- */
288
+ * Creates a new DialogContext instance for the current turn of conversation.
289
+ *
290
+ * @param context DialogContext for the current turn of conversation with the user.
291
+ * @param instance DialogInstance which contains the current state information for this dialog.
292
+ * @returns A new DialogContext instance.
293
+ *
294
+ * @remarks
295
+ * You should only call this if you don't have a dialogContext to work with (such as OnResume())
296
+ *
297
+ * @private
298
+ */
277
299
  private createInnerDC (context: DialogContext, instance: DialogInstance): DialogContext
278
300
  /**
279
- * @private
301
+ * Creates a new DialogContext instance for the current turn of conversation.
302
+ *
280
303
  * @param context TurnContext for the current turn of conversation with the user.
281
304
  * @param instance DialogInstance which contains the current state information for this dialog.
282
305
  * @returns A new DialogContext instance.
306
+ *
283
307
  * @remarks
284
308
  * You should only call this if you don't have a dc to work with (such as OnResume())
309
+ *
310
+ * @private
285
311
  */
286
312
  private createInnerDC (context: TurnContext, instance: DialogInstance): DialogContext
287
313
  /**
288
- * @private
314
+ * Creates a new DialogContext instance for the current turn of conversation.
315
+ *
289
316
  * @param context TurnContext or DialogContext for the current turn of conversation with the user.
290
317
  * @param instance DialogInstance which contains the current state information for this dialog.
291
318
  * @returns A new DialogContext instance.
319
+ *
292
320
  * @remarks
293
321
  * You should only call this if you don't have a dc to work with (such as OnResume())
322
+ *
323
+ * @private
294
324
  */
295
325
  private createInnerDC (context: TurnContext | DialogContext, instance: DialogInstance): DialogContext {
296
326
  if (!instance) {
package/src/dialog.ts CHANGED
@@ -39,9 +39,10 @@ export abstract class Dialog<O extends object = {}> extends Configurable {
39
39
  /**
40
40
  * Unique ID of the dialog.
41
41
  *
42
+ * @returns The Id for the dialog.
43
+ *
42
44
  * @remarks
43
45
  * This will be automatically generated if not specified.
44
- * @returns The Id for the dialog.
45
46
  */
46
47
  get id (): string {
47
48
  if (this._id === undefined) {
@@ -60,6 +61,8 @@ export abstract class Dialog<O extends object = {}> extends Configurable {
60
61
  /**
61
62
  * An encoded string used to aid in the detection of agent changes on re-deployment.
62
63
  *
64
+ * @returns Unique string which should only change when dialog has changed in a way that should restart the dialog.
65
+ *
63
66
  * @remarks
64
67
  * This defaults to returning the dialog's `id` but can be overridden to provide more
65
68
  * precise change detection logic. Any dialog on the stack that has its version change will
@@ -67,7 +70,7 @@ export abstract class Dialog<O extends object = {}> extends Configurable {
67
70
  * an error will be thrown resulting in the agent error handler logic being run.
68
71
  *
69
72
  * Returning an empty string will disable version tracking for the component all together.
70
- * @returns Unique string which should only change when dialog has changed in a way that should restart the dialog.
73
+ *
71
74
  */
72
75
  getVersion (): string {
73
76
  return this.id
@@ -96,6 +99,7 @@ export abstract class Dialog<O extends object = {}> extends Configurable {
96
99
  * When overridden in a derived class, continues the dialog.
97
100
  *
98
101
  * @param dc The context for the current dialog turn.
102
+ * @returns {Promise<DialogTurnResult>} A promise resolving to the dialog turn result.
99
103
  *
100
104
  * @remarks
101
105
  * Derived dialogs that support multiple-turn conversations should override this method.
@@ -107,7 +111,6 @@ export abstract class Dialog<O extends object = {}> extends Configurable {
107
111
  * To signal to the dialog context that this dialog has completed, await
108
112
  * {@link DialogContext.endDialog} before exiting this method.
109
113
  *
110
- * @returns {Promise<DialogTurnResult>} A promise resolving to the dialog turn result.
111
114
  */
112
115
  async continueDialog (dc: DialogContext): Promise<DialogTurnResult> {
113
116
  // By default just end the current dialog.
@@ -120,6 +123,7 @@ export abstract class Dialog<O extends object = {}> extends Configurable {
120
123
  * @param dc The context for the current dialog turn.
121
124
  * @param reason The reason the dialog is resuming. This will typically be DialogReason.endCalled
122
125
  * @param result Optional. The return value, if any, from the dialog that ended.
126
+ * @returns {Promise<DialogTurnResult>} A promise resolving to the dialog turn result.
123
127
  *
124
128
  * @remarks
125
129
  * Derived dialogs that support multiple-turn conversations should override this method.
@@ -133,7 +137,6 @@ export abstract class Dialog<O extends object = {}> extends Configurable {
133
137
  * necessarily be the one that started the child dialog.
134
138
  * To signal to the dialog context that this dialog has completed, await {@link DialogContext.endDialog} before exiting this method.
135
139
  *
136
- * @returns {Promise<DialogTurnResult>} A promise resolving to the dialog turn result.
137
140
  */
138
141
  async resumeDialog (dc: DialogContext, reason: DialogReason, result?: any): Promise<DialogTurnResult> {
139
142
  // By default just end the current dialog and return result to parent.
@@ -205,13 +208,14 @@ export abstract class Dialog<O extends object = {}> extends Configurable {
205
208
  /**
206
209
  * Called before an event is bubbled to its parent.
207
210
  *
211
+ * @param _dc The dialog context for the current turn of conversation.
212
+ * @param _e The event being raised.
213
+ * @returns Whether the event is handled by the current dialog and further processing should stop.
214
+ *
208
215
  * @remarks
209
216
  * This is a good place to perform interception of an event as returning `true` will prevent
210
217
  * any further bubbling of the event to the dialogs parents and will also prevent any child
211
218
  * dialogs from performing their default processing.
212
- * @param _dc The dialog context for the current turn of conversation.
213
- * @param _e The event being raised.
214
- * @returns Whether the event is handled by the current dialog and further processing should stop.
215
219
  */
216
220
  protected async onPreBubbleEvent (_dc: DialogContext, _e: DialogEvent): Promise<boolean> {
217
221
  return false
@@ -220,12 +224,13 @@ export abstract class Dialog<O extends object = {}> extends Configurable {
220
224
  /**
221
225
  * Called after an event was bubbled to all parents and wasn't handled.
222
226
  *
223
- * @remarks
224
- * This is a good place to perform default processing logic for an event. Returning `true` will
225
- * prevent any processing of the event by child dialogs.
226
227
  * @param _dc The dialog context for the current turn of conversation.
227
228
  * @param _e The event being raised.
228
229
  * @returns Whether the event is handled by the current dialog and further processing should stop.
230
+ *
231
+ * @remarks
232
+ * This is a good place to perform default processing logic for an event. Returning `true` will
233
+ * prevent any processing of the event by child dialogs.
229
234
  */
230
235
  protected async onPostBubbleEvent (_dc: DialogContext, _e: DialogEvent): Promise<boolean> {
231
236
  return false
@@ -55,13 +55,14 @@ export abstract class DialogContainer<O extends object = {}> extends Dialog<O> {
55
55
  /**
56
56
  * Returns internal version identifier for this container.
57
57
  *
58
+ * @returns Version which represents the change of the internals of this container.
59
+ *
58
60
  * @remarks
59
61
  * DialogContainers detect changes of all sub-components in the container and map that to a `versionChanged` event.
60
62
  * Because they do this, DialogContainers "hide" the internal changes and just have the .id. This isolates changes
61
63
  * to the container level unless a container doesn't handle it. To support this DialogContainers define a
62
64
  * protected method getInternalVersion() which computes if this dialog or child dialogs have changed
63
65
  * which is then examined via calls to checkForVersionChange().
64
- * @returns Version which represents the change of the internals of this container.
65
66
  */
66
67
  protected getInternalVersion (): string {
67
68
  return this.dialogs.getVersion()
@@ -71,9 +72,11 @@ export abstract class DialogContainer<O extends object = {}> extends Dialog<O> {
71
72
  * Checks to see if a containers child dialogs have changed since the current dialog instance
72
73
  * was started.
73
74
  *
75
+ * @param dialogContext Current dialog context.
76
+ *
74
77
  * @remarks
75
78
  * This should be called at the start of `beginDialog()`, `continueDialog()`, and `resumeDialog()`.
76
- * @param dialogContext Current dialog context.
79
+ *
77
80
  */
78
81
  protected async checkForVersionChange (dialogContext: DialogContext): Promise<void> {
79
82
  const current = dialogContext.activeDialog.version