@microsoft/agents-hosting-dialogs 0.2.14 → 0.4.1

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 (161) hide show
  1. package/dist/src/agentComponent.d.ts +18 -4
  2. package/dist/src/agentComponent.js +12 -4
  3. package/dist/src/agentComponent.js.map +1 -1
  4. package/dist/src/agentStateSet.d.ts +2 -2
  5. package/dist/src/agentStateSet.js +2 -2
  6. package/dist/src/choices/choice.d.ts +9 -0
  7. package/dist/src/choices/findChoices.d.ts +12 -0
  8. package/dist/src/choices/findChoices.js.map +1 -1
  9. package/dist/src/choices/findValues.d.ts +27 -0
  10. package/dist/src/choices/findValues.js.map +1 -1
  11. package/dist/src/choices/modelResult.d.ts +20 -0
  12. package/dist/src/choices/modelResult.js +4 -0
  13. package/dist/src/choices/modelResult.js.map +1 -1
  14. package/dist/src/choices/tokenizer.d.ts +15 -0
  15. package/dist/src/choices/tokenizer.js +4 -0
  16. package/dist/src/choices/tokenizer.js.map +1 -1
  17. package/dist/src/configurable.d.ts +1 -0
  18. package/dist/src/configurable.js +1 -0
  19. package/dist/src/configurable.js.map +1 -1
  20. package/dist/src/converter.d.ts +10 -1
  21. package/dist/src/dialog.d.ts +14 -13
  22. package/dist/src/dialog.js +11 -10
  23. package/dist/src/dialog.js.map +1 -1
  24. package/dist/src/dialogContext.d.ts +34 -35
  25. package/dist/src/dialogContext.js +24 -25
  26. package/dist/src/dialogContext.js.map +1 -1
  27. package/dist/src/dialogEvent.d.ts +3 -0
  28. package/dist/src/dialogEvents.d.ts +20 -0
  29. package/dist/src/dialogEvents.js +20 -0
  30. package/dist/src/dialogEvents.js.map +1 -1
  31. package/dist/src/dialogHelper.js +14 -0
  32. package/dist/src/dialogHelper.js.map +1 -1
  33. package/dist/src/dialogManager.d.ts +0 -1
  34. package/dist/src/dialogManager.js +0 -1
  35. package/dist/src/dialogManager.js.map +1 -1
  36. package/dist/src/dialogSet.d.ts +5 -9
  37. package/dist/src/dialogSet.js +5 -9
  38. package/dist/src/dialogSet.js.map +1 -1
  39. package/dist/src/dialogTurnStateConstants.d.ts +13 -1
  40. package/dist/src/dialogTurnStateConstants.js +13 -1
  41. package/dist/src/dialogTurnStateConstants.js.map +1 -1
  42. package/dist/src/intentScore.d.ts +6 -0
  43. package/dist/src/memory/dialogPath.d.ts +40 -8
  44. package/dist/src/memory/dialogPath.js +32 -8
  45. package/dist/src/memory/dialogPath.js.map +1 -1
  46. package/dist/src/memory/dialogStateManager.d.ts +2 -2
  47. package/dist/src/memory/dialogStateManager.js +2 -2
  48. package/dist/src/memory/pathResolvers/aliasPathResolver.d.ts +4 -0
  49. package/dist/src/memory/pathResolvers/aliasPathResolver.js +4 -0
  50. package/dist/src/memory/pathResolvers/aliasPathResolver.js.map +1 -1
  51. package/dist/src/memory/pathResolvers/atAtPathResolver.d.ts +6 -2
  52. package/dist/src/memory/pathResolvers/atAtPathResolver.js +6 -2
  53. package/dist/src/memory/pathResolvers/atAtPathResolver.js.map +1 -1
  54. package/dist/src/memory/pathResolvers/atPathResolver.d.ts +13 -7
  55. package/dist/src/memory/pathResolvers/atPathResolver.js +13 -7
  56. package/dist/src/memory/pathResolvers/atPathResolver.js.map +1 -1
  57. package/dist/src/memory/pathResolvers/dollarPathResolver.d.ts +7 -2
  58. package/dist/src/memory/pathResolvers/dollarPathResolver.js +7 -2
  59. package/dist/src/memory/pathResolvers/dollarPathResolver.js.map +1 -1
  60. package/dist/src/memory/pathResolvers/hashPathResolver.d.ts +7 -2
  61. package/dist/src/memory/pathResolvers/hashPathResolver.js +7 -2
  62. package/dist/src/memory/pathResolvers/hashPathResolver.js.map +1 -1
  63. package/dist/src/memory/pathResolvers/pathResolver.d.ts +10 -5
  64. package/dist/src/memory/pathResolvers/percentPathResolver.d.ts +7 -2
  65. package/dist/src/memory/pathResolvers/percentPathResolver.js +7 -2
  66. package/dist/src/memory/pathResolvers/percentPathResolver.js.map +1 -1
  67. package/dist/src/memory/scopePath.d.ts +27 -0
  68. package/dist/src/memory/scopePath.js +27 -0
  69. package/dist/src/memory/scopePath.js.map +1 -1
  70. package/dist/src/memory/scopes/classMemoryScope.d.ts +18 -14
  71. package/dist/src/memory/scopes/classMemoryScope.js +18 -14
  72. package/dist/src/memory/scopes/classMemoryScope.js.map +1 -1
  73. package/dist/src/memory/scopes/dialogClassMemoryScope.d.ts +12 -6
  74. package/dist/src/memory/scopes/dialogClassMemoryScope.js +12 -6
  75. package/dist/src/memory/scopes/dialogClassMemoryScope.js.map +1 -1
  76. package/dist/src/memory/scopes/dialogContextMemoryScope.d.ts +11 -7
  77. package/dist/src/memory/scopes/dialogContextMemoryScope.js +11 -7
  78. package/dist/src/memory/scopes/dialogContextMemoryScope.js.map +1 -1
  79. package/dist/src/memory/scopes/dialogMemoryScope.d.ts +23 -16
  80. package/dist/src/memory/scopes/dialogMemoryScope.js +23 -16
  81. package/dist/src/memory/scopes/dialogMemoryScope.js.map +1 -1
  82. package/dist/src/memory/scopes/turnMemoryScope.d.ts +14 -13
  83. package/dist/src/memory/scopes/turnMemoryScope.js +14 -13
  84. package/dist/src/memory/scopes/turnMemoryScope.js.map +1 -1
  85. package/dist/src/memory/turnPath.d.ts +61 -13
  86. package/dist/src/memory/turnPath.js +49 -13
  87. package/dist/src/memory/turnPath.js.map +1 -1
  88. package/dist/src/prompts/attachmentPrompt.d.ts +1 -1
  89. package/dist/src/prompts/attachmentPrompt.js +1 -1
  90. package/dist/src/prompts/choicePrompt.d.ts +17 -3
  91. package/dist/src/prompts/choicePrompt.js +1 -1
  92. package/dist/src/prompts/choicePrompt.js.map +1 -1
  93. package/dist/src/prompts/confirmPrompt.d.ts +6 -6
  94. package/dist/src/prompts/confirmPrompt.js +3 -3
  95. package/dist/src/prompts/datetimePrompt.d.ts +6 -6
  96. package/dist/src/prompts/datetimePrompt.js +3 -3
  97. package/dist/src/prompts/numberPrompt.d.ts +6 -6
  98. package/dist/src/prompts/numberPrompt.js +6 -6
  99. package/dist/src/prompts/prompt.d.ts +7 -7
  100. package/dist/src/prompts/prompt.js +2 -2
  101. package/dist/src/prompts/promptCultureModels.d.ts +38 -3
  102. package/dist/src/prompts/promptCultureModels.js +38 -3
  103. package/dist/src/prompts/promptCultureModels.js.map +1 -1
  104. package/dist/src/recognizer.d.ts +8 -1
  105. package/dist/src/recognizer.js +5 -1
  106. package/dist/src/recognizer.js.map +1 -1
  107. package/dist/src/recognizerResult.d.ts +15 -0
  108. package/dist/src/recognizerResult.js.map +1 -1
  109. package/dist/src/serviceCollection.d.ts +22 -22
  110. package/dist/src/serviceCollection.js +11 -11
  111. package/dist/src/waterfallDialog.d.ts +5 -5
  112. package/dist/src/waterfallDialog.js +5 -5
  113. package/dist/src/waterfallStepContext.d.ts +21 -0
  114. package/dist/src/waterfallStepContext.js.map +1 -1
  115. package/package.json +2 -2
  116. package/src/agentComponent.ts +18 -4
  117. package/src/agentStateSet.ts +2 -2
  118. package/src/choices/choice.ts +11 -0
  119. package/src/choices/findChoices.ts +15 -0
  120. package/src/choices/findValues.ts +33 -0
  121. package/src/choices/modelResult.ts +25 -0
  122. package/src/choices/tokenizer.ts +19 -0
  123. package/src/configurable.ts +1 -0
  124. package/src/converter.ts +10 -1
  125. package/src/dialog.ts +14 -13
  126. package/src/dialogContext.ts +42 -43
  127. package/src/dialogEvent.ts +3 -0
  128. package/src/dialogEvents.ts +25 -0
  129. package/src/dialogHelper.ts +14 -1
  130. package/src/dialogManager.ts +0 -1
  131. package/src/dialogSet.ts +5 -9
  132. package/src/dialogTurnStateConstants.ts +15 -1
  133. package/src/intentScore.ts +9 -2
  134. package/src/memory/dialogPath.ts +47 -23
  135. package/src/memory/dialogStateManager.ts +2 -2
  136. package/src/memory/pathResolvers/aliasPathResolver.ts +4 -0
  137. package/src/memory/pathResolvers/atAtPathResolver.ts +6 -2
  138. package/src/memory/pathResolvers/atPathResolver.ts +13 -7
  139. package/src/memory/pathResolvers/dollarPathResolver.ts +7 -2
  140. package/src/memory/pathResolvers/hashPathResolver.ts +7 -2
  141. package/src/memory/pathResolvers/pathResolver.ts +10 -5
  142. package/src/memory/pathResolvers/percentPathResolver.ts +7 -2
  143. package/src/memory/scopePath.ts +35 -0
  144. package/src/memory/scopes/classMemoryScope.ts +18 -14
  145. package/src/memory/scopes/dialogClassMemoryScope.ts +12 -6
  146. package/src/memory/scopes/dialogContextMemoryScope.ts +11 -7
  147. package/src/memory/scopes/dialogMemoryScope.ts +23 -16
  148. package/src/memory/scopes/turnMemoryScope.ts +14 -13
  149. package/src/memory/turnPath.ts +61 -25
  150. package/src/prompts/attachmentPrompt.ts +1 -1
  151. package/src/prompts/choicePrompt.ts +18 -3
  152. package/src/prompts/confirmPrompt.ts +6 -6
  153. package/src/prompts/datetimePrompt.ts +6 -6
  154. package/src/prompts/numberPrompt.ts +6 -6
  155. package/src/prompts/prompt.ts +7 -7
  156. package/src/prompts/promptCultureModels.ts +38 -3
  157. package/src/recognizer.ts +8 -1
  158. package/src/recognizerResult.ts +24 -5
  159. package/src/serviceCollection.ts +22 -22
  160. package/src/waterfallDialog.ts +5 -5
  161. package/src/waterfallStepContext.ts +32 -6
package/src/dialog.ts CHANGED
@@ -61,7 +61,7 @@ export abstract class Dialog<O extends object = {}> extends Configurable {
61
61
  * An encoded string used to aid in the detection of agent changes on re-deployment.
62
62
  *
63
63
  * @remarks
64
- * This defaults to returning the dialogs [id](#id) but can be overridden to provide more
64
+ * This defaults to returning the dialog's `id` but can be overridden to provide more
65
65
  * precise change detection logic. Any dialog on the stack that has its version change will
66
66
  * result in a `versionChanged` event will be raised. If this event is not handled by the agent,
67
67
  * an error will be thrown resulting in the agent error handler logic being run.
@@ -82,12 +82,12 @@ export abstract class Dialog<O extends object = {}> extends Configurable {
82
82
  * @remarks
83
83
  * Derived dialogs must override this method.
84
84
  *
85
- * The DialogContext calls this method when it creates
86
- * a new DialogInstance for this dialog, pushes it
85
+ * The {@link DialogContext} calls this method when it creates
86
+ * a new {@link DialogInstance} for this dialog, pushes it
87
87
  * onto the dialog stack, and starts the dialog.
88
88
  *
89
89
  * A dialog that represents a single-turn conversation should await
90
- * DialogContext.endDialog before exiting this method.
90
+ * {@link DialogContext.endDialog} before exiting this method.
91
91
  *
92
92
  */
93
93
  abstract beginDialog (dc: DialogContext, options?: O): Promise<DialogTurnResult>
@@ -101,11 +101,11 @@ export abstract class Dialog<O extends object = {}> extends Configurable {
101
101
  * Derived dialogs that support multiple-turn conversations should override this method.
102
102
  * By default, this method signals that the dialog is complete and returns.
103
103
  *
104
- * The DialogContext calls this method when it continues
104
+ * The {@link DialogContext} calls this method when it continues
105
105
  * the dialog.
106
106
  *
107
107
  * To signal to the dialog context that this dialog has completed, await
108
- * DialogContext.endDialog before exiting this method.
108
+ * {@link DialogContext.endDialog} before exiting this method.
109
109
  *
110
110
  * @returns {Promise<DialogTurnResult>} A promise resolving to the dialog turn result.
111
111
  */
@@ -125,13 +125,13 @@ export abstract class Dialog<O extends object = {}> extends Configurable {
125
125
  * Derived dialogs that support multiple-turn conversations should override this method.
126
126
  * By default, this method signals that the dialog is complete and returns.
127
127
  *
128
- * The DialogContext calls this method when it resumes
128
+ * The {@link DialogContext} calls this method when it resumes
129
129
  * the dialog. If the previous dialog on the stack returned a value, that value is in the `result`
130
130
  * parameter.
131
131
  *
132
- * To start a _child_ dialog, use DialogContext.beginDialog or DialogContext.prompt; however, this dialog will not
132
+ * To start a _child_ dialog, use {@link DialogContext.beginDialog} or {@link DialogContext.prompt}; however, this dialog will not
133
133
  * necessarily be the one that started the child dialog.
134
- * To signal to the dialog context that this dialog has completed, await DialogContext.endDialog before exiting this method.
134
+ * To signal to the dialog context that this dialog has completed, await {@link DialogContext.endDialog} before exiting this method.
135
135
  *
136
136
  * @returns {Promise<DialogTurnResult>} A promise resolving to the dialog turn result.
137
137
  */
@@ -141,7 +141,7 @@ export abstract class Dialog<O extends object = {}> extends Configurable {
141
141
  }
142
142
 
143
143
  /**
144
- * When overridden in a derived class, reprompts the user for input.
144
+ * When overridden in a derived class, prompts the user again for input.
145
145
  *
146
146
  * @param _context The context object for the turn.
147
147
  * @param _instance Current state information for this dialog.
@@ -150,7 +150,7 @@ export abstract class Dialog<O extends object = {}> extends Configurable {
150
150
  * Derived dialogs that support validation and re-prompt logic should override this method.
151
151
  * By default, this method has no effect.
152
152
  *
153
- * The DialogContext calls this method when the current
153
+ * The {@link DialogContext} calls this method when the current
154
154
  * dialog should re-request input from the user. This method is implemented for prompt dialogs.
155
155
  *
156
156
  */
@@ -169,7 +169,7 @@ export abstract class Dialog<O extends object = {}> extends Configurable {
169
169
  * Derived dialogs that need to perform logging or cleanup before ending should override this method.
170
170
  * By default, this method has no effect.
171
171
  *
172
- * The DialogContext calls this method when the current
172
+ * The {@link DialogContext} calls this method when the current
173
173
  * dialog is ending.
174
174
  *
175
175
  */
@@ -178,7 +178,8 @@ export abstract class Dialog<O extends object = {}> extends Configurable {
178
178
  }
179
179
 
180
180
  /**
181
- * Called when an event has been raised, using `DialogContext.emitEvent()`, by either the current dialog or a dialog that the current dialog started.
181
+ * Called when an event has been raised, using {@link DialogContext.emitEvent | DialogContext.emitEvent method },
182
+ * by either the current dialog or a dialog that the current dialog started.
182
183
  *
183
184
  * @param dialogContext - The dialog context for the current turn of conversation.
184
185
  * @param event - The event being raised.
@@ -45,10 +45,10 @@ const wrapErrors = async <T>(dialogContext: DialogContext, promise: Promise<T>):
45
45
  const ACTIVITY_RECEIVED_EMITTED = Symbol('ActivityReceivedEmitted')
46
46
 
47
47
  /**
48
- * Contains dialog state, information about the state of the dialog stack, for a specific DialogSet.
48
+ * Contains dialog state, information about the state of the dialog stack, for a specific {@link DialogSet}.
49
49
  *
50
50
  * @remarks
51
- * State is read from and saved to storage each turn, and state cache for the turn is managed through the TurnContext.
51
+ * State is read from and saved to storage each turn, and state cache for the turn is managed through the {@link @microsoft/agents-hosting.TurnContext}.
52
52
  *
53
53
  * For more information, see the articles on
54
54
  * [Managing state](https://docs.microsoft.com/azure/bot-service/bot-builder-concept-state) and
@@ -56,18 +56,18 @@ const ACTIVITY_RECEIVED_EMITTED = Symbol('ActivityReceivedEmitted')
56
56
  */
57
57
  export interface DialogState {
58
58
  /**
59
- * Contains state information for each Dialog on the stack.
59
+ * Contains state information for each {@link Dialog} on the stack.
60
60
  */
61
61
  dialogStack: DialogInstance[];
62
62
  }
63
63
 
64
64
  /**
65
- * The context for the current dialog turn with respect to a specific DialogSet.
65
+ * The context for the current dialog turn with respect to a specific {@link DialogSet}.
66
66
  *
67
67
  * @remarks
68
68
  * This includes the turn context, information about the dialog set, and the state of the dialog stack.
69
69
  *
70
- * From code outside of a dialog in the set, use DialogSet.createContext
70
+ * From code outside of a dialog in the set, use {@link DialogSet.createContext | DialogSet.createContext method}
71
71
  * to create the dialog context. Then use the methods of the dialog context to manage the progression of dialogs in the set.
72
72
  *
73
73
  * When you implement a dialog, the dialog context is a parameter available to the various methods you override or implement.
@@ -77,32 +77,32 @@ export class DialogContext {
77
77
  /**
78
78
  * Creates an new instance of the DialogContext class.
79
79
  *
80
- * @param dialogs The DialogSet for which to create the dialog context.
81
- * @param contextOrDialogContext The TurnContext object for the current turn.
82
- * @param state The state object to use to read and write DialogState to storage.
80
+ * @param dialogs The `DialogSet` for which to create the dialog context.
81
+ * @param contextOrDialogContext The `TurnContext` object for the current turn.
82
+ * @param state The state object to use to read and write `DialogState` to storage.
83
83
  * @remarks
84
- * Passing in a DialogContext instance will clone the dialog context.
84
+ * Passing in a `DialogContext` instance will clone the dialog context.
85
85
  */
86
86
  constructor (dialogs: DialogSet, contextOrDialogContext: TurnContext, state: DialogState)
87
87
 
88
88
  /**
89
89
  * Creates an new instance of the DialogContext class.
90
90
  *
91
- * @param dialogs The DialogSet for which to create the dialog context.
92
- * @param contextOrDialogContext The DialogContext object for the current turn.
93
- * @param state The state object to use to read and write DialogState to storage.
91
+ * @param dialogs The `DialogSet` for which to create the dialog context.
92
+ * @param contextOrDialogContext The `DialogContext` object for the current turn.
93
+ * @param state The state object to use to read and write `DialogState` to storage.
94
94
  * @remarks
95
- * Passing in a DialogContext instance will clone the dialog context.
95
+ * Passing in a `DialogContext` instance will clone the dialog context.
96
96
  */
97
97
  constructor (dialogs: DialogSet, contextOrDialogContext: DialogContext, state: DialogState)
98
98
 
99
99
  /**
100
- * Creates an new instance of the DialogContext class.
100
+ * Creates an new instance of the `DialogContext` class.
101
101
  *
102
- * @param dialogs The DialogSet for which to create the dialog context.
103
- * @param contextOrDialogContext The TurnContext or DialogContext for the current turn.
104
- * @param state The state object to use to read and write DialogState to storage.
105
- * @remarks Passing in a DialogContext instance will clone the dialog context.
102
+ * @param dialogs The `DialogSet` for which to create the dialog context.
103
+ * @param contextOrDialogContext The `TurnContext` or `DialogContext` for the current turn.
104
+ * @param state The state object to use to read and write `DialogState` to storage.
105
+ * @remarks Passing in a `DialogContext` instance will clone the dialog context.
106
106
  */
107
107
  constructor (dialogs: DialogSet, contextOrDialogContext: TurnContext | DialogContext, state: DialogState) {
108
108
  this.dialogs = dialogs
@@ -144,8 +144,8 @@ export class DialogContext {
144
144
  * The parent dialog context for this dialog context, or `undefined` if this context doesn't have a parent.
145
145
  *
146
146
  * @remarks
147
- * When it attempts to start a dialog, the dialog context searches for the Dialog.id
148
- * in its DialogContext.dialogs. If the dialog to start is not found
147
+ * When it attempts to start a dialog, the dialog context searches for the {@link Dialog.id}
148
+ * in its {@link DialogContext.dialogs}. If the dialog to start is not found
149
149
  * in this dialog context, it searches in its parent dialog context, and so on.
150
150
  */
151
151
  parent: DialogContext | undefined
@@ -175,7 +175,7 @@ export class DialogContext {
175
175
  }
176
176
 
177
177
  /**
178
- * Gets the DialogStateManager which manages view of all memory scopes.
178
+ * Gets the {@link DialogStateManager} which manages view of all memory scopes.
179
179
  */
180
180
  state: DialogStateManager
181
181
 
@@ -185,8 +185,7 @@ export class DialogContext {
185
185
  services: TurnContextStateCollection = new TurnContextStateCollection()
186
186
 
187
187
  /**
188
- * @deprecated This property serves no function.
189
- * @returns The current dialog manager instance. This property is deprecated.
188
+ * @returns The current dialog manager instance.
190
189
  */
191
190
  get dialogManager (): DialogManager {
192
191
  return this.context.turnState.get(DialogTurnStateConstants.dialogManager)
@@ -224,7 +223,7 @@ export class DialogContext {
224
223
  * If there's already an active dialog on the stack, that dialog will be paused until
225
224
  * it is again the top dialog on the stack.
226
225
  *
227
- * The DialogTurnResult.status of returned object describes
226
+ * The {@link DialogTurnResult.status} of returned object describes
228
227
  * the status of the dialog stack after this method completes.
229
228
  *
230
229
  * This method throws an exception if the requested dialog can't be found in this dialog context
@@ -260,12 +259,12 @@ export class DialogContext {
260
259
  * @param eventValue Optional. Value to pass along with custom cancellation event.
261
260
  * @returns {Promise<DialogTurnResult>} a promise resolving to the dialog turn result.
262
261
  * @remarks
263
- * This calls each dialog's .Dialog.endDialog method before
262
+ * This calls each dialog's {@link Dialog.endDialog | endDialog method} before
264
263
  * removing the dialog from the stack.
265
264
  *
266
265
  * If there were any dialogs on the stack initially, the DialogTurnResult.status
267
- * of the return value is DialogTurnStatus.cancelled; otherwise, it's
268
- * DialogTurnStatus.empty.
266
+ * of the return value is {@link DialogTurnStatus.cancelled}; otherwise, it's
267
+ * {@link DialogTurnStatus.empty}.
269
268
  *
270
269
  */
271
270
  async cancelAllDialogs (cancelParents = false, eventName?: string, eventValue?: any): Promise<DialogTurnResult> {
@@ -307,7 +306,7 @@ export class DialogContext {
307
306
  * @param dialogId ID of the dialog to search for.
308
307
  * @returns The dialog for the provided ID.
309
308
  * @remarks
310
- * If the dialog to start is not found in the DialogSet associated
309
+ * If the dialog to start is not found in the {@link DialogSet} associated
311
310
  * with this dialog context, it attempts to find the dialog in its parent dialog context.
312
311
  *
313
312
  */
@@ -329,7 +328,7 @@ export class DialogContext {
329
328
  *
330
329
  * @remarks
331
330
  * This helper method formats the object to use as the `options` parameter, and then calls
332
- * DialogContext.beginDialog to start the specified prompt dialog.
331
+ * {@link DialogContext.beginDialog} to start the specified prompt dialog.
333
332
  *
334
333
  */
335
334
  async prompt (
@@ -342,13 +341,13 @@ export class DialogContext {
342
341
  *
343
342
  * @param dialogId ID of the prompt dialog to start.
344
343
  * @param promptOrOptions The text of the initial prompt to send the user,
345
- * the Activity to send as the initial prompt, or
344
+ * the {@link @microsoft/agents-activity.Activity} to send as the initial prompt, or
346
345
  * the object with which to format the prompt dialog.
347
346
  * @param choices Optional. Array of choices for the user to choose from,
348
- * for use with a ChoicePrompt.
347
+ * for use with a {@link ChoicePrompt}.
349
348
  * @remarks
350
349
  * This helper method formats the object to use as the `options` parameter, and then calls
351
- * DialogContext.beginDialog to start the specified prompt dialog.
350
+ * {@link DialogContext.beginDialog} to start the specified prompt dialog.
352
351
  *
353
352
  */
354
353
  async prompt (
@@ -362,12 +361,12 @@ export class DialogContext {
362
361
  *
363
362
  * @param dialogId ID of the prompt dialog to start.
364
363
  * @param promptOrOptions The text of the initial prompt to send the user,
365
- * or the Activity to send as the initial prompt.
364
+ * or the {@link @microsoft/agents-activity.Activity} to send as the initial prompt.
366
365
  * @param choices Optional. Array of choices for the user to choose from,
367
- * for use with a ChoicePrompt.
366
+ * for use with a {@link ChoicePrompt}.
368
367
  * @returns {Promise<DialogTurnResult>} a promise resolving to the dialog turn result.
369
368
  * @remarks This helper method formats the object to use as the `options` parameter, and then calls
370
- * beginDialog to start the specified prompt dialog.
369
+ * {@link DialogContext.beginDialog} to start the specified prompt dialog.
371
370
  *
372
371
  */
373
372
  async prompt (
@@ -394,14 +393,14 @@ export class DialogContext {
394
393
 
395
394
  /**
396
395
  * Continues execution of the active dialog, if there is one, by passing this dialog context to its
397
- * Dialog.continueDialog method.
396
+ * {@link DialogContext.continueDialog} method.
398
397
  *
399
398
  * @returns {Promise<DialogTurnResult>} a promise resolving to the dialog turn result.
400
399
  * @remarks
401
- * After the call completes, you can check the turn context's TurnContext.responded
400
+ * After the call completes, you can check the turn context's {@link @microsoft/agents-hosting.TurnContext.responded | TurnContext.responded}
402
401
  * property to determine if the dialog sent a reply to the user.
403
402
  *
404
- * The DialogTurnResult.status of returned object describes
403
+ * The {@link DialogTurnResult.status} of returned object describes
405
404
  * the status of the dialog stack after this method completes.
406
405
  *
407
406
  * Typically, you would call this from within your agent's turn handler.
@@ -446,12 +445,12 @@ export class DialogContext {
446
445
  * @returns {Promise<DialogTurnResult>} a promise resolving to the dialog turn result.
447
446
  * @remarks
448
447
  * The _parent_ dialog is the next dialog on the dialog stack, if there is one. This method
449
- * calls the parent's Dialog.resumeDialog method,
448
+ * calls the parent's {@link Dialog.resumeDialog} method,
450
449
  * passing the result returned by the ending dialog. If there is no parent dialog, the turn ends
451
450
  * and the result is available to the agent through the returned object's
452
- * DialogTurnResult.result property.
451
+ * {@link DialogTurnResult.result} property.
453
452
  *
454
- * The DialogTurnResult.status of returned object describes
453
+ * The {@link DialogTurnResult.status} of returned object describes
455
454
  * the status of the dialog stack after this method completes.
456
455
  *
457
456
  * Typically, you would call this from within the logic for a specific dialog to signal back to
@@ -492,7 +491,7 @@ export class DialogContext {
492
491
  * @remarks
493
492
  * This is particularly useful for creating a loop or redirecting to another dialog.
494
493
  *
495
- * The DialogTurnResult.status of returned object describes
494
+ * The {@link DialogTurnResult.status} of returned object describes
496
495
  * the status of the dialog stack after this method completes.
497
496
  *
498
497
  * This method is similar to ending the current dialog and immediately beginning the new one.
@@ -511,7 +510,7 @@ export class DialogContext {
511
510
  * Requests the active dialog to re-prompt the user for input.
512
511
  *
513
512
  * @remarks
514
- * This calls the active dialog's Dialog.repromptDialog method.
513
+ * This calls the active dialog's {@link Dialog.repromptDialog} method.
515
514
  *
516
515
  */
517
516
  async repromptDialog (): Promise<void> {
@@ -1,3 +1,6 @@
1
+ /**
2
+ * Represents an event that occurs within a dialog, providing details such as its name, whether it should bubble to parent contexts, and any associated value.
3
+ */
1
4
  export interface DialogEvent {
2
5
  /**
3
6
  * Flag indicating whether the event will be bubbled to the parent `DialogContext`.
@@ -5,12 +5,37 @@
5
5
 
6
6
  /**
7
7
  * Represents the events related to the "lifecycle" of the dialog.
8
+ *
9
+ * These events are used to signal various stages or actions within a dialog's lifecycle.
8
10
  */
9
11
  export class DialogEvents {
12
+ /**
13
+ * Event triggered when a dialog begins.
14
+ */
10
15
  static readonly beginDialog = 'beginDialog'
16
+
17
+ /**
18
+ * Event triggered to reprompt a dialog.
19
+ */
11
20
  static readonly repromptDialog = 'repromptDialog'
21
+
22
+ /**
23
+ * Event triggered when a dialog is canceled.
24
+ */
12
25
  static readonly cancelDialog = 'cancelDialog'
26
+
27
+ /**
28
+ * Event triggered when an activity is received.
29
+ */
13
30
  static readonly activityReceived = 'activityReceived'
31
+
32
+ /**
33
+ * Event triggered when the dialog version changes.
34
+ */
14
35
  static readonly versionChanged = 'versionChanged'
36
+
37
+ /**
38
+ * Event triggered when an error occurs.
39
+ */
15
40
  static readonly error = 'error'
16
41
  }
@@ -106,6 +106,14 @@ export async function internalRun (
106
106
  return dialogTurnResult
107
107
  }
108
108
 
109
+ /**
110
+ * Executes the dialog by either continuing an existing dialog or starting a new one.
111
+ *
112
+ * @param context The TurnContext for the turn.
113
+ * @param dialogId The ID of the dialog to start or continue.
114
+ * @param dialogContext The DialogContext for the current turn of conversation.
115
+ * @returns A promise resolving to the result of the dialog turn.
116
+ */
109
117
  async function innerRun (
110
118
  context: TurnContext,
111
119
  dialogId: string,
@@ -136,8 +144,13 @@ export function getActiveDialogContext (dialogContext: DialogContext): DialogCon
136
144
 
137
145
  return getActiveDialogContext(child)
138
146
  }
139
-
140
147
  // Helper to send a trace activity with a memory snapshot of the active dialog DC.
148
+ /**
149
+ * Sends a trace activity containing a memory snapshot of the active dialog context.
150
+ *
151
+ * @param dialogContext The DialogContext for the current turn of conversation.
152
+ * @returns A promise that resolves when the trace activity is sent.
153
+ */
141
154
  const sendStateSnapshotTrace = async (dialogContext: DialogContext): Promise<void> => {
142
155
  const traceLabel = 'Agent State'
143
156
 
@@ -40,7 +40,6 @@ export interface DialogManagerConfiguration {
40
40
  /**
41
41
  * Class which runs the dialog system.
42
42
  *
43
- * @deprecated This class will be deprecated.
44
43
  */
45
44
  export class DialogManager extends Configurable {
46
45
  private _rootDialogId: string
package/src/dialogSet.ts CHANGED
@@ -25,8 +25,8 @@ export interface DialogDependencies {
25
25
  * The constructor for the dialog set should be passed a state property that will be used to
26
26
  * persist the dialog stack for the set:
27
27
  *
28
- * To interact with the sets dialogs you can call createcontext with the
29
- * current `TurnContext`. That will create a `DialogContext` that can be used to start or continue
28
+ * To interact with the sets dialogs you can call `createcontext` with the
29
+ * current {@link @microsoft/agents-hosting.TurnContext}. That will create a {@link DialogContext} that can be used to start or continue
30
30
  * execution of the sets dialogs:
31
31
  *
32
32
  */
@@ -39,8 +39,8 @@ export class DialogSet {
39
39
  * Creates a new DialogSet instance.
40
40
  *
41
41
  * @remarks
42
- * If the `dialogState` property is not passed in, calls to createcontext
43
- * will return an error. You will need to create a `DialogContext` for the set manually and
42
+ * If the `dialogState` parameter is not passed in, calls to {@link @microsoft/agents-hosting-dialogs.DialogSet.createcontext | createContext}
43
+ * will return an error. You will need to create a {@link DialogContext} for the set manually and
44
44
  * pass in your own state object for persisting the sets dialog stack:
45
45
  *
46
46
  * @param dialogState (Optional) state property used to persist the sets dialog stack.
@@ -75,7 +75,7 @@ export class DialogSet {
75
75
  * Adds a new dialog or prompt to the set.
76
76
  *
77
77
  * @remarks
78
- * If the `Dialog.id` being added already exists in the set, the dialogs id will be updated to
78
+ * If the {@link Dialog.id} being added already exists in the set, the dialogs id will be updated to
79
79
  * include a suffix which makes it unique. So adding 2 dialogs named "duplicate" to the set
80
80
  * would result in the first one having an id of "duplicate" and the second one having an id
81
81
  * of "duplicate2".
@@ -146,10 +146,6 @@ export class DialogSet {
146
146
 
147
147
  /**
148
148
  * Finds a dialog that was previously added to the set using add.
149
- *
150
- * @remarks
151
- * This example finds a dialog named "greeting":
152
- *
153
149
  * @param dialogId ID of the dialog or prompt to lookup.
154
150
  * @returns The dialog if found; otherwise undefined.
155
151
  */
@@ -4,10 +4,24 @@
4
4
  */
5
5
 
6
6
  /**
7
- * Defines dialog turn state constants.
7
+ * Provides constants used to manage the state of a dialog turn.
8
+ *
9
+ * These constants are used as keys to store and retrieve specific state information
10
+ * during the execution of a dialog turn.
8
11
  */
9
12
  export class DialogTurnStateConstants {
13
+ /**
14
+ * Symbol representing the configuration for the dialog turn.
15
+ */
10
16
  static configuration = Symbol('configuration')
17
+
18
+ /**
19
+ * Symbol representing the dialog manager instance.
20
+ */
11
21
  static dialogManager = Symbol('dialogManager')
22
+
23
+ /**
24
+ * Symbol representing the queue storage for the dialog turn.
25
+ */
12
26
  static queueStorage = Symbol('queueStorage')
13
27
  }
@@ -6,6 +6,13 @@
6
6
  * Score plus any extra information about an intent.
7
7
  */
8
8
  export interface IntentScore {
9
- score?: number;
10
- [key: string]: unknown;
9
+ /**
10
+ * Optional. The confidence score of the intent, ranging from 0.0 to 1.0.
11
+ */
12
+ score?: number
13
+
14
+ /**
15
+ * Additional properties related to the intent.
16
+ */
17
+ [key: string]: unknown
11
18
  }
@@ -7,27 +7,51 @@
7
7
  * Defines path for available dialogs.
8
8
  */
9
9
  export class DialogPath {
10
- /// Counter of emitted events.
11
- static readonly eventCounter = 'dialog.eventCounter'
12
-
13
- /// Currently expected properties.
14
- static readonly expectedProperties = 'dialog.expectedProperties'
15
-
16
- /// Default operation to use for entities where there is no identified operation entity.
17
- static readonly defaultOperation = 'dialog.defaultOperation'
18
-
19
- /// Last surfaced entity ambiguity event.
20
- static readonly lastEvent = 'dialog.lastEvent'
21
-
22
- /// Currently required properties.
23
- static readonly requiredProperties = 'dialog.requiredProperties'
24
-
25
- /// Number of retries for the current Ask.
26
- static readonly retries = 'dialog.retries'
27
-
28
- /// Last intent.
29
- static readonly lastIntent = 'dialog.lastIntent'
30
-
31
- /// Last trigger event: defined in FormEvent, ask, clarifyEntity etc..
32
- static readonly lastTriggerEvent = 'dialog.lastTriggerEvent'
10
+ /**
11
+ * Counter of emitted events.
12
+ * @constant A string key representing the event counter path (`'dialog.eventCounter'`).
13
+ */
14
+ static readonly eventCounter: string = 'dialog.eventCounter'
15
+
16
+ /**
17
+ * Currently expected properties.
18
+ * @constant A string key representing the expected properties path (`'dialog.expectedProperties'`).
19
+ */
20
+ static readonly expectedProperties: string = 'dialog.expectedProperties'
21
+
22
+ /**
23
+ * Default operation to use for entities where there is no identified operation entity.
24
+ * @constant A string key representing the default operation path (`'dialog.defaultOperation'`).
25
+ */
26
+ static readonly defaultOperation: string = 'dialog.defaultOperation'
27
+
28
+ /**
29
+ * Last surfaced entity ambiguity event.
30
+ * @constant A string key representing the last event path (`'dialog.lastEvent'`).
31
+ */
32
+ static readonly lastEvent: string = 'dialog.lastEvent'
33
+
34
+ /**
35
+ * Currently required properties.
36
+ * @constant A string key representing the required properties path (`'dialog.requiredProperties'`).
37
+ */
38
+ static readonly requiredProperties: string = 'dialog.requiredProperties'
39
+
40
+ /**
41
+ * Number of retries for the current Ask.
42
+ * @constant A string key representing the retries path (`'dialog.retries'`).
43
+ */
44
+ static readonly retries: string = 'dialog.retries'
45
+
46
+ /**
47
+ * Last intent.
48
+ * @constant A string key representing the last intent path (`'dialog.lastIntent'`).
49
+ */
50
+ static readonly lastIntent: string = 'dialog.lastIntent'
51
+
52
+ /**
53
+ * Last trigger event: defined in FormEvent, ask, clarifyEntity etc.
54
+ * @constant A string key representing the last trigger event path (`'dialog.lastTriggerEvent'`).
55
+ */
56
+ static readonly lastTriggerEvent: string = 'dialog.lastTriggerEvent'
33
57
  }
@@ -435,7 +435,7 @@ export class DialogStateManager {
435
435
  * Track when specific paths are changed.
436
436
  *
437
437
  * @param paths Paths to track.
438
- * @returns Normalized paths to pass to [anyPathChanged()](#anypathchanged).
438
+ * @returns Normalized paths to pass to `anyPathChanged` method.
439
439
  */
440
440
  trackPaths (paths: string[]): string[] {
441
441
  const allPaths: string[] = []
@@ -459,7 +459,7 @@ export class DialogStateManager {
459
459
  * Check to see if any path has changed since watermark.
460
460
  *
461
461
  * @param counter Time counter to compare to.
462
- * @param paths Paths from [trackPaths()](#trackpaths) to check.
462
+ * @param paths Paths from `trackPaths` method to check.
463
463
  * @returns True if any path has changed since counter.
464
464
  */
465
465
  anyPathChanged (counter: number, paths: string[]): boolean {
@@ -4,6 +4,10 @@
4
4
  */
5
5
  import { PathResolver } from './pathResolver'
6
6
 
7
+ /**
8
+ * A class that resolves paths by replacing an alias with a specified prefix and optional postfix.
9
+ * This is useful for transforming paths that use shorthand aliases into fully qualified paths.
10
+ */
7
11
  export class AliasPathResolver implements PathResolver {
8
12
  private readonly alias: string
9
13
  private readonly prefix: string
@@ -4,10 +4,14 @@
4
4
  */
5
5
  import { AliasPathResolver } from './aliasPathResolver'
6
6
 
7
+ /**
8
+ * A specialized path resolver that replaces the '@@' alias with the prefix 'turn.recognized.entities.'.
9
+ * This is used to resolve paths related to recognized entities in a conversational turn.
10
+ */
7
11
  export class AtAtPathResolver extends AliasPathResolver {
8
12
  /**
9
- * Initializes a new instance of the AtAtPathResolver class.
10
- */
13
+ * Initializes a new instance of the AtAtPathResolver class.
14
+ */
11
15
  constructor () {
12
16
  super('@@', 'turn.recognized.entities.')
13
17
  }
@@ -4,23 +4,29 @@
4
4
  */
5
5
  import { AliasPathResolver } from './aliasPathResolver'
6
6
 
7
+ /**
8
+ * A path resolver that replaces the '@' alias with a specific prefix and transforms paths
9
+ * to access recognized entities in a conversational turn. It ensures that the resolved
10
+ * path includes the 'first()' function for entity properties.
11
+ */
7
12
  export class AtPathResolver extends AliasPathResolver {
8
13
  private readonly _prefix = 'turn.recognized.entities.'
9
14
  private readonly _delims = ['.', '[']
10
15
 
11
16
  /**
12
- * Initializes a new instance of the AtPathResolver class.
13
- */
17
+ * Initializes a new instance of the AtPathResolver class.
18
+ */
14
19
  constructor () {
15
20
  super('@', '')
16
21
  }
17
22
 
18
23
  /**
19
- * Transforms the path.
20
- *
21
- * @param path Path to inspect.
22
- * @returns The transformed path.
23
- */
24
+ * Transforms the path by replacing the '@' alias and appending the 'first()' function
25
+ * to entity properties.
26
+ *
27
+ * @param path The path to inspect and transform.
28
+ * @returns The transformed path.
29
+ */
24
30
  transformPath (path: string): string {
25
31
  path = path.trim()
26
32
  if (path.startsWith('@') && path.length > 1 && !path.startsWith('@@')) {