@microsoft/agents-hosting-dialogs 0.2.10-g3ac88ff25e → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) 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 +31 -32
  25. package/dist/src/dialogContext.js +22 -23
  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 +4 -8
  37. package/dist/src/dialogSet.js +4 -8
  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/index.d.ts +5 -0
  43. package/dist/src/index.js +5 -0
  44. package/dist/src/index.js.map +1 -1
  45. package/dist/src/intentScore.d.ts +6 -0
  46. package/dist/src/memory/dialogPath.d.ts +40 -8
  47. package/dist/src/memory/dialogPath.js +32 -8
  48. package/dist/src/memory/dialogPath.js.map +1 -1
  49. package/dist/src/memory/dialogStateManager.d.ts +2 -2
  50. package/dist/src/memory/dialogStateManager.js +2 -2
  51. package/dist/src/memory/pathResolvers/aliasPathResolver.d.ts +4 -0
  52. package/dist/src/memory/pathResolvers/aliasPathResolver.js +4 -0
  53. package/dist/src/memory/pathResolvers/aliasPathResolver.js.map +1 -1
  54. package/dist/src/memory/pathResolvers/atAtPathResolver.d.ts +6 -2
  55. package/dist/src/memory/pathResolvers/atAtPathResolver.js +6 -2
  56. package/dist/src/memory/pathResolvers/atAtPathResolver.js.map +1 -1
  57. package/dist/src/memory/pathResolvers/atPathResolver.d.ts +13 -7
  58. package/dist/src/memory/pathResolvers/atPathResolver.js +13 -7
  59. package/dist/src/memory/pathResolvers/atPathResolver.js.map +1 -1
  60. package/dist/src/memory/pathResolvers/dollarPathResolver.d.ts +7 -2
  61. package/dist/src/memory/pathResolvers/dollarPathResolver.js +7 -2
  62. package/dist/src/memory/pathResolvers/dollarPathResolver.js.map +1 -1
  63. package/dist/src/memory/pathResolvers/hashPathResolver.d.ts +7 -2
  64. package/dist/src/memory/pathResolvers/hashPathResolver.js +7 -2
  65. package/dist/src/memory/pathResolvers/hashPathResolver.js.map +1 -1
  66. package/dist/src/memory/pathResolvers/pathResolver.d.ts +10 -5
  67. package/dist/src/memory/pathResolvers/percentPathResolver.d.ts +7 -2
  68. package/dist/src/memory/pathResolvers/percentPathResolver.js +7 -2
  69. package/dist/src/memory/pathResolvers/percentPathResolver.js.map +1 -1
  70. package/dist/src/memory/scopePath.d.ts +27 -0
  71. package/dist/src/memory/scopePath.js +27 -0
  72. package/dist/src/memory/scopePath.js.map +1 -1
  73. package/dist/src/memory/scopes/classMemoryScope.d.ts +18 -14
  74. package/dist/src/memory/scopes/classMemoryScope.js +18 -14
  75. package/dist/src/memory/scopes/classMemoryScope.js.map +1 -1
  76. package/dist/src/memory/scopes/dialogClassMemoryScope.d.ts +12 -6
  77. package/dist/src/memory/scopes/dialogClassMemoryScope.js +12 -6
  78. package/dist/src/memory/scopes/dialogClassMemoryScope.js.map +1 -1
  79. package/dist/src/memory/scopes/dialogContextMemoryScope.d.ts +11 -7
  80. package/dist/src/memory/scopes/dialogContextMemoryScope.js +11 -7
  81. package/dist/src/memory/scopes/dialogContextMemoryScope.js.map +1 -1
  82. package/dist/src/memory/scopes/dialogMemoryScope.d.ts +23 -16
  83. package/dist/src/memory/scopes/dialogMemoryScope.js +23 -16
  84. package/dist/src/memory/scopes/dialogMemoryScope.js.map +1 -1
  85. package/dist/src/memory/scopes/turnMemoryScope.d.ts +14 -13
  86. package/dist/src/memory/scopes/turnMemoryScope.js +14 -13
  87. package/dist/src/memory/scopes/turnMemoryScope.js.map +1 -1
  88. package/dist/src/memory/turnPath.d.ts +61 -13
  89. package/dist/src/memory/turnPath.js +49 -13
  90. package/dist/src/memory/turnPath.js.map +1 -1
  91. package/dist/src/prompts/attachmentPrompt.d.ts +1 -1
  92. package/dist/src/prompts/attachmentPrompt.js +1 -1
  93. package/dist/src/prompts/choicePrompt.d.ts +18 -5
  94. package/dist/src/prompts/choicePrompt.js +1 -1
  95. package/dist/src/prompts/choicePrompt.js.map +1 -1
  96. package/dist/src/prompts/confirmPrompt.d.ts +7 -8
  97. package/dist/src/prompts/confirmPrompt.js +3 -3
  98. package/dist/src/prompts/datetimePrompt.d.ts +6 -6
  99. package/dist/src/prompts/datetimePrompt.js +3 -3
  100. package/dist/src/prompts/numberPrompt.d.ts +6 -6
  101. package/dist/src/prompts/numberPrompt.js +6 -6
  102. package/dist/src/prompts/prompt.d.ts +7 -7
  103. package/dist/src/prompts/prompt.js +2 -2
  104. package/dist/src/prompts/promptCultureModels.d.ts +38 -3
  105. package/dist/src/prompts/promptCultureModels.js +38 -3
  106. package/dist/src/prompts/promptCultureModels.js.map +1 -1
  107. package/dist/src/recognizer.d.ts +8 -1
  108. package/dist/src/recognizer.js +5 -1
  109. package/dist/src/recognizer.js.map +1 -1
  110. package/dist/src/recognizerResult.d.ts +15 -0
  111. package/dist/src/recognizerResult.js.map +1 -1
  112. package/dist/src/serviceCollection.d.ts +22 -23
  113. package/dist/src/serviceCollection.js +11 -11
  114. package/dist/src/serviceCollection.js.map +1 -1
  115. package/dist/src/waterfallDialog.d.ts +5 -5
  116. package/dist/src/waterfallDialog.js +5 -5
  117. package/dist/src/waterfallStepContext.d.ts +21 -0
  118. package/dist/src/waterfallStepContext.js.map +1 -1
  119. package/package.json +2 -2
  120. package/src/agentComponent.ts +18 -4
  121. package/src/agentStateSet.ts +2 -2
  122. package/src/choices/choice.ts +11 -0
  123. package/src/choices/findChoices.ts +15 -0
  124. package/src/choices/findValues.ts +33 -0
  125. package/src/choices/modelResult.ts +25 -0
  126. package/src/choices/tokenizer.ts +19 -0
  127. package/src/configurable.ts +1 -0
  128. package/src/converter.ts +10 -1
  129. package/src/dialog.ts +14 -13
  130. package/src/dialogContext.ts +37 -38
  131. package/src/dialogEvent.ts +3 -0
  132. package/src/dialogEvents.ts +25 -0
  133. package/src/dialogHelper.ts +14 -1
  134. package/src/dialogManager.ts +0 -1
  135. package/src/dialogSet.ts +4 -8
  136. package/src/dialogTurnStateConstants.ts +15 -1
  137. package/src/index.ts +5 -0
  138. package/src/intentScore.ts +9 -2
  139. package/src/memory/dialogPath.ts +47 -23
  140. package/src/memory/dialogStateManager.ts +2 -2
  141. package/src/memory/pathResolvers/aliasPathResolver.ts +4 -0
  142. package/src/memory/pathResolvers/atAtPathResolver.ts +6 -2
  143. package/src/memory/pathResolvers/atPathResolver.ts +13 -7
  144. package/src/memory/pathResolvers/dollarPathResolver.ts +7 -2
  145. package/src/memory/pathResolvers/hashPathResolver.ts +7 -2
  146. package/src/memory/pathResolvers/pathResolver.ts +10 -5
  147. package/src/memory/pathResolvers/percentPathResolver.ts +7 -2
  148. package/src/memory/scopePath.ts +35 -0
  149. package/src/memory/scopes/classMemoryScope.ts +18 -14
  150. package/src/memory/scopes/dialogClassMemoryScope.ts +12 -6
  151. package/src/memory/scopes/dialogContextMemoryScope.ts +11 -7
  152. package/src/memory/scopes/dialogMemoryScope.ts +23 -16
  153. package/src/memory/scopes/turnMemoryScope.ts +14 -13
  154. package/src/memory/turnPath.ts +61 -25
  155. package/src/prompts/attachmentPrompt.ts +1 -1
  156. package/src/prompts/choicePrompt.ts +19 -4
  157. package/src/prompts/confirmPrompt.ts +7 -7
  158. package/src/prompts/datetimePrompt.ts +6 -6
  159. package/src/prompts/numberPrompt.ts +6 -6
  160. package/src/prompts/prompt.ts +7 -7
  161. package/src/prompts/promptCultureModels.ts +38 -3
  162. package/src/recognizer.ts +8 -1
  163. package/src/recognizerResult.ts +24 -5
  164. package/src/serviceCollection.ts +22 -23
  165. package/src/waterfallDialog.ts +5 -5
  166. package/src/waterfallStepContext.ts +32 -6
  167. package/dist/index.js +0 -20
@@ -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('@@')) {
@@ -4,10 +4,15 @@
4
4
  */
5
5
  import { AliasPathResolver } from './aliasPathResolver'
6
6
 
7
+ /**
8
+ * A path resolver that resolves paths starting with a dollar sign ('$')
9
+ * to the 'dialog.' namespace.
10
+ */
7
11
  export class DollarPathResolver extends AliasPathResolver {
8
12
  /**
9
- * Initializes a new instance of the DollarPathResolver class.
10
- */
13
+ * Initializes a new instance of the DollarPathResolver class.
14
+ * This resolver maps paths starting with '$' to the 'dialog.' namespace.
15
+ */
11
16
  constructor () {
12
17
  super('$', 'dialog.')
13
18
  }
@@ -4,10 +4,15 @@
4
4
  */
5
5
  import { AliasPathResolver } from './aliasPathResolver'
6
6
 
7
+ /**
8
+ * A path resolver that resolves paths starting with a hash sign ('#')
9
+ * to the 'turn.recognized.intents.' namespace.
10
+ */
7
11
  export class HashPathResolver extends AliasPathResolver {
8
12
  /**
9
- * Initializes a new instance of the HashPathResolver class.
10
- */
13
+ * Initializes a new instance of the HashPathResolver class.
14
+ * This resolver maps paths starting with '#' to the 'turn.recognized.intents.' namespace.
15
+ */
11
16
  constructor () {
12
17
  super('#', 'turn.recognized.intents.')
13
18
  }
@@ -3,12 +3,17 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
+ /**
7
+ * Interface for resolving and transforming paths.
8
+ * Implementations of this interface define how specific path patterns
9
+ * should be transformed into other formats or namespaces.
10
+ */
6
11
  export interface PathResolver {
7
12
  /**
8
- * Transform the path
9
- *
10
- * @param path Path to inspect.
11
- * @returns Transformed path
12
- */
13
+ * Transforms the given path into a new format or namespace.
14
+ *
15
+ * @param path - The path to inspect and transform.
16
+ * @returns The transformed path.
17
+ */
13
18
  transformPath(path: string): string;
14
19
  }
@@ -4,10 +4,15 @@
4
4
  */
5
5
  import { AliasPathResolver } from './aliasPathResolver'
6
6
 
7
+ /**
8
+ * A path resolver that resolves paths starting with a percent sign ('%')
9
+ * to the 'class.' namespace.
10
+ */
7
11
  export class PercentPathResolver extends AliasPathResolver {
8
12
  /**
9
- * Initializes a new instance of the PercentPathResolver class.
10
- */
13
+ * Initializes a new instance of the PercentPathResolver class.
14
+ * This resolver maps paths starting with '%' to the 'class.' namespace.
15
+ */
11
16
  constructor () {
12
17
  super('%', 'class.')
13
18
  }
@@ -7,13 +7,48 @@
7
7
  * Defines paths for the available scopes.
8
8
  */
9
9
  export class ScopePath {
10
+ /**
11
+ * Path for user-specific data.
12
+ */
10
13
  static readonly user = 'user'
14
+
15
+ /**
16
+ * Path for conversation-specific data.
17
+ */
11
18
  static readonly conversation = 'conversation'
19
+
20
+ /**
21
+ * Path for dialog-specific data.
22
+ */
12
23
  static readonly dialog = 'dialog'
24
+
25
+ /**
26
+ * Path for dialog class-specific data.
27
+ */
13
28
  static readonly dialogClass = 'dialogClass'
29
+
30
+ /**
31
+ * Path for dialog context-specific data.
32
+ */
14
33
  static readonly dialogContext = 'dialogContext'
34
+
35
+ /**
36
+ * Path for the current dialog instance data.
37
+ */
15
38
  static readonly this = 'this'
39
+
40
+ /**
41
+ * Path for class-specific data.
42
+ */
16
43
  static readonly class = 'class'
44
+
45
+ /**
46
+ * Path for settings-specific data.
47
+ */
17
48
  static readonly settings = 'settings'
49
+
50
+ /**
51
+ * Path for turn-specific data.
52
+ */
18
53
  static readonly turn = 'turn'
19
54
  }
@@ -7,22 +7,26 @@ import { ScopePath } from '../scopePath'
7
7
  import { DialogContext } from '../../dialogContext'
8
8
  import { Dialog } from '../../dialog'
9
9
 
10
+ /**
11
+ * A memory scope that provides access to the properties of the active dialog.
12
+ * This scope binds to the active dialog and clones its properties for use in memory.
13
+ */
10
14
  export class ClassMemoryScope extends MemoryScope {
11
15
  /**
12
- * Initializes a new instance of the ClassMemoryScope class.
13
- *
14
- * @param name Name of the scope class.
15
- */
16
+ * Initializes a new instance of the ClassMemoryScope class.
17
+ *
18
+ * @param name - Name of the scope class. Defaults to `ScopePath.class`.
19
+ */
16
20
  constructor (name = ScopePath.class) {
17
21
  super(name, false)
18
22
  }
19
23
 
20
24
  /**
21
- * Gets the backing memory for this scope.
22
- *
23
- * @param dialogContext The DialogContext object for this turn.
24
- * @returns The memory for the scope.
25
- */
25
+ * Gets the backing memory for this scope.
26
+ *
27
+ * @param dialogContext - The DialogContext object for this turn.
28
+ * @returns The memory for the scope, containing cloned properties of the active dialog.
29
+ */
26
30
  getMemory (dialogContext: DialogContext): object {
27
31
  // if active dialog is a container dialog then "dialog" binds to it
28
32
  if (dialogContext.activeDialog) {
@@ -52,11 +56,11 @@ export class ClassMemoryScope extends MemoryScope {
52
56
  }
53
57
 
54
58
  /**
55
- * Override to find the dialog instance referenced by the scope.
56
- *
57
- * @param dialogContext Current dialog context.
58
- * @returns The dialog instance referenced by the scope.
59
- */
59
+ * Override to find the dialog instance referenced by the scope.
60
+ *
61
+ * @param dialogContext - Current dialog context.
62
+ * @returns The dialog instance referenced by the scope, or undefined if not found.
63
+ */
60
64
  protected onFindDialog (dialogContext: DialogContext): Dialog | undefined {
61
65
  return dialogContext.findDialog(dialogContext.activeDialog.id)
62
66
  }
@@ -8,19 +8,25 @@ import { DialogContext } from '../../dialogContext'
8
8
  import { Dialog } from '../../dialog'
9
9
  import { DialogContainer } from '../../dialogContainer'
10
10
 
11
+ /**
12
+ * A memory scope that provides access to the properties of the active dialog class.
13
+ * This scope resolves to the active dialog if it is a container, or to its parent dialog.
14
+ */
11
15
  export class DialogClassMemoryScope extends ClassMemoryScope {
12
16
  /**
13
- * Initializes a new instance of the DialogClassMemoryScope class.
14
- */
17
+ * Initializes a new instance of the DialogClassMemoryScope class.
18
+ */
15
19
  constructor () {
16
20
  super(ScopePath.dialogClass)
17
21
  }
18
22
 
19
23
  /**
20
- * @protected
21
- * @param dialogContext The DialogContext object for this turn.
22
- * @returns The current Dialog.
23
- */
24
+ * @protected
25
+ * Finds the dialog instance referenced by the scope.
26
+ *
27
+ * @param dialogContext - The DialogContext object for this turn.
28
+ * @returns The current dialog, or its parent dialog if applicable.
29
+ */
24
30
  protected onFindDialog (dialogContext: DialogContext): Dialog | undefined {
25
31
  // Is the active dialog a container?
26
32
  const dialog = dialogContext.findDialog(dialogContext.activeDialog.id)
@@ -7,20 +7,24 @@ import { DialogContext } from '../../dialogContext'
7
7
  import { MemoryScope } from './memoryScope'
8
8
  import { ScopePath } from '../scopePath'
9
9
 
10
+ /**
11
+ * A memory scope that provides access to the dialog context.
12
+ * This scope includes information about the active dialog, its parent, and the dialog stack.
13
+ */
10
14
  export class DialogContextMemoryScope extends MemoryScope {
11
15
  /**
12
- * Initializes a new instance of the `DialogContextMemoryScope` class.
13
- */
16
+ * Initializes a new instance of the `DialogContextMemoryScope` class.
17
+ */
14
18
  constructor () {
15
19
  super(ScopePath.dialogContext, false)
16
20
  }
17
21
 
18
22
  /**
19
- * Gets the backing memory for this scope.
20
- *
21
- * @param dialogContext The `DialogContext` object for this turn.
22
- * @returns Memory for the scope.
23
- */
23
+ * Gets the backing memory for this scope.
24
+ *
25
+ * @param dialogContext - The `DialogContext` object for this turn.
26
+ * @returns An object containing the dialog stack, active dialog ID, and parent dialog ID.
27
+ */
24
28
  getMemory (dialogContext: DialogContext): Record<'stack' | 'activeDialog' | 'parent', unknown> {
25
29
  const stack = []
26
30
  let currentDialogContext: DialogContext | undefined = dialogContext
@@ -7,20 +7,24 @@ import { ScopePath } from '../scopePath'
7
7
  import { DialogContext } from '../../dialogContext'
8
8
  import { DialogContainer } from '../../dialogContainer'
9
9
 
10
+ /**
11
+ * A memory scope that provides access to the active dialog's state.
12
+ * This scope binds to the active dialog if it is a container, or to its parent dialog if applicable.
13
+ */
10
14
  export class DialogMemoryScope extends MemoryScope {
11
15
  /**
12
- * Initializes a new instance of the DialogMemoryScope class.
13
- */
16
+ * Initializes a new instance of the DialogMemoryScope class.
17
+ */
14
18
  constructor () {
15
19
  super(ScopePath.dialog)
16
20
  }
17
21
 
18
22
  /**
19
- * Gets the backing memory for this scope.
20
- *
21
- * @param dialogContext The DialogContext object for this turn.
22
- * @returns The memory for the scope.
23
- */
23
+ * Gets the backing memory for this scope.
24
+ *
25
+ * @param dialogContext - The DialogContext object for this turn.
26
+ * @returns The memory for the scope.
27
+ */
24
28
  getMemory (dialogContext: DialogContext): object {
25
29
  // If active dialog is a container dialog then "dialog" binds to it.
26
30
  // Otherwise the "dialog" will bind to the dialogs parent assuming it
@@ -35,11 +39,12 @@ export class DialogMemoryScope extends MemoryScope {
35
39
  }
36
40
 
37
41
  /**
38
- * Changes the backing object for the memory scope.
39
- *
40
- * @param dialogContext The DialogContext object for this turn.
41
- * @param memory Memory object to set for the scope.
42
- */
42
+ * Changes the backing object for the memory scope.
43
+ *
44
+ * @param dialogContext - The DialogContext object for this turn.
45
+ * @param memory - Memory object to set for the scope.
46
+ * @throws Will throw an error if the memory object is undefined or if no active dialog is found.
47
+ */
43
48
  setMemory (dialogContext: DialogContext, memory: object): void {
44
49
  if (memory === undefined) {
45
50
  throw new Error('DialogMemoryScope.setMemory: undefined memory object passed in.')
@@ -62,10 +67,12 @@ export class DialogMemoryScope extends MemoryScope {
62
67
  }
63
68
 
64
69
  /**
65
- * @private
66
- * @param dialogContext The DialogContext object for this turn.
67
- * @returns A boolean indicating whether is a cointainer or not.
68
- */
70
+ * Determines if the given dialog context is a container.
71
+ *
72
+ * @private
73
+ * @param dialogContext - The DialogContext object for this turn.
74
+ * @returns A boolean indicating whether the dialog context is a container.
75
+ */
69
76
  private isContainer (dialogContext: DialogContext): boolean {
70
77
  if (dialogContext !== undefined && dialogContext.activeDialog !== undefined) {
71
78
  const dialog = dialogContext.findDialog(dialogContext.activeDialog.id)
@@ -12,22 +12,23 @@ import { DialogContext } from '../../dialogContext'
12
12
  const TURN_STATE = 'turn'
13
13
 
14
14
  /**
15
- * TurnMemoryScope represents memory scoped to the current turn.
15
+ * A memory scope that provides access to the turn's state.
16
+ * This scope is used to store and retrieve information specific to the current turn.
16
17
  */
17
18
  export class TurnMemoryScope extends MemoryScope {
18
19
  /**
19
- * Initializes a new instance of the TurnMemoryScope class.
20
- */
20
+ * Initializes a new instance of the TurnMemoryScope class.
21
+ */
21
22
  constructor () {
22
23
  super(ScopePath.turn, true)
23
24
  }
24
25
 
25
26
  /**
26
- * Get the backing memory for this scope.
27
- *
28
- * @param dialogContext The DialogContext for this turn.
29
- * @returns The memory for the scope.
30
- */
27
+ * Gets the backing memory for this scope.
28
+ *
29
+ * @param dialogContext - The DialogContext object for this turn.
30
+ * @returns The memory for the scope.
31
+ */
31
32
  getMemory (dialogContext: DialogContext): object {
32
33
  let memory = dialogContext.context.turnState.get(TURN_STATE)
33
34
  if (typeof memory !== 'object') {
@@ -39,11 +40,11 @@ export class TurnMemoryScope extends MemoryScope {
39
40
  }
40
41
 
41
42
  /**
42
- * Changes the backing object for the memory scope.
43
- *
44
- * @param dialogContext The DialogContext for this turn.
45
- * @param memory Memory object to set for the scope.
46
- */
43
+ * Changes the backing object for the memory scope.
44
+ *
45
+ * @param dialogContext - The DialogContext object for this turn.
46
+ * @param memory - Memory object to set for the scope.
47
+ */
47
48
  setMemory (dialogContext: DialogContext, memory: object): void {
48
49
  if (memory === undefined) {
49
50
  throw new Error('TurnMemoryScope.setMemory: undefined memory object passed in.')
@@ -4,42 +4,78 @@
4
4
  */
5
5
 
6
6
  /**
7
- * Defines path for avaiable turns.
7
+ * Defines path for available turns.
8
8
  */
9
9
  export class TurnPath {
10
- /// The result from the last dialog that was called.
11
- static readonly lastResult = 'turn.lastresult'
10
+ /**
11
+ * The result from the last dialog that was called.
12
+ * @constant A string key representing the last result path (`'turn.lastresult'`).
13
+ */
14
+ static readonly lastResult: string = 'turn.lastresult'
12
15
 
13
- /// The current activity for the turn.
14
- static readonly activity = 'turn.activity'
16
+ /**
17
+ * The current activity for the turn.
18
+ * @constant A string key representing the activity path (`'turn.activity'`).
19
+ */
20
+ static readonly activity: string = 'turn.activity'
15
21
 
16
- /// The recognized result for the current turn.
17
- static readonly recognized = 'turn.recognized'
22
+ /**
23
+ * The recognized result for the current turn.
24
+ * @constant A string key representing the recognized result path (`'turn.recognized'`).
25
+ */
26
+ static readonly recognized: string = 'turn.recognized'
18
27
 
19
- /// Path to the top intent.
20
- static readonly topIntent = 'turn.recognized.intent'
28
+ /**
29
+ * Path to the top intent.
30
+ * @constant A string key representing the top intent path (`'turn.recognized.intent'`).
31
+ */
32
+ static readonly topIntent: string = 'turn.recognized.intent'
21
33
 
22
- /// Path to the top score.
23
- static readonly topScore = 'turn.recognized.score'
34
+ /**
35
+ * Path to the top score.
36
+ * @constant A string key representing the top score path (`'turn.recognized.score'`).
37
+ */
38
+ static readonly topScore: string = 'turn.recognized.score'
24
39
 
25
- /// Original text.
26
- static readonly text = 'turn.recognized.text'
40
+ /**
41
+ * Original text.
42
+ * @constant A string key representing the original text path (`'turn.recognized.text'`).
43
+ */
44
+ static readonly text: string = 'turn.recognized.text'
27
45
 
28
- /// Original utterance split into unrecognized strings.
29
- static readonly unrecognizedText = 'turn.unrecognizedText'
46
+ /**
47
+ * Original utterance split into unrecognized strings.
48
+ * @constant A string key representing the unrecognized text path (`'turn.unrecognizedText'`).
49
+ */
50
+ static readonly unrecognizedText: string = 'turn.unrecognizedText'
30
51
 
31
- /// Entities that were recognized from text.
32
- static readonly recognizedEntities = 'turn.recognizedEntities'
52
+ /**
53
+ * Entities that were recognized from text.
54
+ * @constant A string key representing the recognized entities path (`'turn.recognizedEntities'`).
55
+ */
56
+ static readonly recognizedEntities: string = 'turn.recognizedEntities'
33
57
 
34
- /// If true an interruption has occured.
35
- static readonly interrupted = 'turn.interrupted'
58
+ /**
59
+ * If true, an interruption has occurred.
60
+ * @constant A string key representing the interrupted path (`'turn.interrupted'`).
61
+ */
62
+ static readonly interrupted: string = 'turn.interrupted'
36
63
 
37
- /// The current dialog event (set during event processings).
38
- static readonly dialogEvent = 'turn.dialogEvent'
64
+ /**
65
+ * The current dialog event (set during event processing).
66
+ * @constant A string key representing the dialog event path (`'turn.dialogEvent'`).
67
+ */
68
+ static readonly dialogEvent: string = 'turn.dialogEvent'
39
69
 
40
- /// Used to track that we don't end up in infinite loop of RepeatDialogs().
41
- static readonly repeatedIds = 'turn.repeatedIds'
70
+ /**
71
+ * Used to track that we don't end up in an infinite loop of RepeatDialogs().
72
+ * @constant A string key representing the repeated IDs path (`'turn.repeatedIds'`).
73
+ */
74
+ static readonly repeatedIds: string = 'turn.repeatedIds'
42
75
 
43
- /// This is a bool which if set means that the turncontext.activity has been consumed by some component in the system.
44
- static readonly activityProcessed = 'turn.activityProcessed'
76
+ /**
77
+ * Indicates whether the turncontext.activity has been consumed by some component in the system.
78
+ * @constant A string key representing the activity processed path (`'turn.activityProcessed'`).
79
+ */
80
+ static readonly activityProcessed: string = 'turn.activityProcessed'
45
81
  }
@@ -10,7 +10,7 @@ import { Attachment, InputHints } from '@microsoft/agents-activity'
10
10
  * Prompts a user to upload attachments like images.
11
11
  *
12
12
  * @remarks
13
- * By default the prompt will return to the calling dialog an `Attachment[]`.
13
+ * By default the prompt will return to the calling dialog an {@link Attachment[]}.
14
14
  */
15
15
  export class AttachmentPrompt extends Prompt<Attachment[]> {
16
16
  // eslint-disable-next-line @typescript-eslint/no-useless-constructor