@microsoft/agents-hosting-dialogs 0.1.49

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 (325) hide show
  1. package/dist/index.js +20 -0
  2. package/dist/src/agentComponent.d.ts +18 -0
  3. package/dist/src/agentComponent.js +55 -0
  4. package/dist/src/agentComponent.js.map +1 -0
  5. package/dist/src/agentStateSet.d.ts +48 -0
  6. package/dist/src/agentStateSet.js +66 -0
  7. package/dist/src/agentStateSet.js.map +1 -0
  8. package/dist/src/choices/choice.d.ts +14 -0
  9. package/dist/src/choices/choice.js +7 -0
  10. package/dist/src/choices/choice.js.map +1 -0
  11. package/dist/src/choices/choiceFactory.d.ts +81 -0
  12. package/dist/src/choices/choiceFactory.js +133 -0
  13. package/dist/src/choices/choiceFactory.js.map +1 -0
  14. package/dist/src/choices/findChoices.d.ts +28 -0
  15. package/dist/src/choices/findChoices.js +46 -0
  16. package/dist/src/choices/findChoices.js.map +1 -0
  17. package/dist/src/choices/findValues.d.ts +36 -0
  18. package/dist/src/choices/findValues.js +129 -0
  19. package/dist/src/choices/findValues.js.map +1 -0
  20. package/dist/src/choices/index.d.ts +11 -0
  21. package/dist/src/choices/index.js +28 -0
  22. package/dist/src/choices/index.js.map +1 -0
  23. package/dist/src/choices/modelResult.d.ts +11 -0
  24. package/dist/src/choices/modelResult.js +3 -0
  25. package/dist/src/choices/modelResult.js.map +1 -0
  26. package/dist/src/choices/recognizeChoices.d.ts +16 -0
  27. package/dist/src/choices/recognizeChoices.js +81 -0
  28. package/dist/src/choices/recognizeChoices.js.map +1 -0
  29. package/dist/src/choices/tokenizer.d.ts +25 -0
  30. package/dist/src/choices/tokenizer.js +73 -0
  31. package/dist/src/choices/tokenizer.js.map +1 -0
  32. package/dist/src/componentDialog.d.ts +178 -0
  33. package/dist/src/componentDialog.js +252 -0
  34. package/dist/src/componentDialog.js.map +1 -0
  35. package/dist/src/componentRegistration.d.ts +22 -0
  36. package/dist/src/componentRegistration.js +32 -0
  37. package/dist/src/componentRegistration.js.map +1 -0
  38. package/dist/src/configurable.d.ts +22 -0
  39. package/dist/src/configurable.js +60 -0
  40. package/dist/src/configurable.js.map +1 -0
  41. package/dist/src/configuration.d.ts +11 -0
  42. package/dist/src/configuration.js +17 -0
  43. package/dist/src/configuration.js.map +1 -0
  44. package/dist/src/converter.d.ts +13 -0
  45. package/dist/src/converter.js +7 -0
  46. package/dist/src/converter.js.map +1 -0
  47. package/dist/src/dialog.d.ts +184 -0
  48. package/dist/src/dialog.js +201 -0
  49. package/dist/src/dialog.js.map +1 -0
  50. package/dist/src/dialogContainer.d.ts +61 -0
  51. package/dist/src/dialogContainer.js +82 -0
  52. package/dist/src/dialogContainer.js.map +1 -0
  53. package/dist/src/dialogContext.d.ts +272 -0
  54. package/dist/src/dialogContext.js +444 -0
  55. package/dist/src/dialogContext.js.map +1 -0
  56. package/dist/src/dialogContextError.d.ts +27 -0
  57. package/dist/src/dialogContextError.js +39 -0
  58. package/dist/src/dialogContextError.js.map +1 -0
  59. package/dist/src/dialogEvent.d.ts +20 -0
  60. package/dist/src/dialogEvent.js +3 -0
  61. package/dist/src/dialogEvent.js.map +1 -0
  62. package/dist/src/dialogEvents.d.ts +15 -0
  63. package/dist/src/dialogEvents.js +20 -0
  64. package/dist/src/dialogEvents.js.map +1 -0
  65. package/dist/src/dialogHelper.d.ts +32 -0
  66. package/dist/src/dialogHelper.js +116 -0
  67. package/dist/src/dialogHelper.js.map +1 -0
  68. package/dist/src/dialogInstance.d.ts +30 -0
  69. package/dist/src/dialogInstance.js +3 -0
  70. package/dist/src/dialogInstance.js.map +1 -0
  71. package/dist/src/dialogManager.d.ts +73 -0
  72. package/dist/src/dialogManager.js +156 -0
  73. package/dist/src/dialogManager.js.map +1 -0
  74. package/dist/src/dialogReason.d.ts +35 -0
  75. package/dist/src/dialogReason.js +40 -0
  76. package/dist/src/dialogReason.js.map +1 -0
  77. package/dist/src/dialogSet.d.ts +85 -0
  78. package/dist/src/dialogSet.js +138 -0
  79. package/dist/src/dialogSet.js.map +1 -0
  80. package/dist/src/dialogTurnResult.d.ts +34 -0
  81. package/dist/src/dialogTurnResult.js +3 -0
  82. package/dist/src/dialogTurnResult.js.map +1 -0
  83. package/dist/src/dialogTurnStateConstants.d.ts +12 -0
  84. package/dist/src/dialogTurnStateConstants.js +17 -0
  85. package/dist/src/dialogTurnStateConstants.js.map +1 -0
  86. package/dist/src/dialogTurnStatus.d.ts +34 -0
  87. package/dist/src/dialogTurnStatus.js +39 -0
  88. package/dist/src/dialogTurnStatus.js.map +1 -0
  89. package/dist/src/dialogsAgentComponent.d.ts +17 -0
  90. package/dist/src/dialogsAgentComponent.js +65 -0
  91. package/dist/src/dialogsAgentComponent.js.map +1 -0
  92. package/dist/src/dialogsComponentRegistration.d.ts +28 -0
  93. package/dist/src/dialogsComponentRegistration.js +45 -0
  94. package/dist/src/dialogsComponentRegistration.js.map +1 -0
  95. package/dist/src/i18n.d.ts +15 -0
  96. package/dist/src/i18n.js +28 -0
  97. package/dist/src/i18n.js.map +1 -0
  98. package/dist/src/index.d.ts +29 -0
  99. package/dist/src/index.js +48 -0
  100. package/dist/src/index.js.map +1 -0
  101. package/dist/src/intentScore.d.ts +11 -0
  102. package/dist/src/intentScore.js +3 -0
  103. package/dist/src/intentScore.js.map +1 -0
  104. package/dist/src/memory/componentMemoryScopes.d.ts +18 -0
  105. package/dist/src/memory/componentMemoryScopes.js +54 -0
  106. package/dist/src/memory/componentMemoryScopes.js.map +1 -0
  107. package/dist/src/memory/componentPathResolvers.d.ts +18 -0
  108. package/dist/src/memory/componentPathResolvers.js +52 -0
  109. package/dist/src/memory/componentPathResolvers.js.map +1 -0
  110. package/dist/src/memory/dialogPath.d.ts +17 -0
  111. package/dist/src/memory/dialogPath.js +30 -0
  112. package/dist/src/memory/dialogPath.js.map +1 -0
  113. package/dist/src/memory/dialogStateManager.d.ts +156 -0
  114. package/dist/src/memory/dialogStateManager.js +598 -0
  115. package/dist/src/memory/dialogStateManager.js.map +1 -0
  116. package/dist/src/memory/index.d.ts +12 -0
  117. package/dist/src/memory/index.js +29 -0
  118. package/dist/src/memory/index.js.map +1 -0
  119. package/dist/src/memory/pathResolvers/aliasPathResolver.d.ts +25 -0
  120. package/dist/src/memory/pathResolvers/aliasPathResolver.js +37 -0
  121. package/dist/src/memory/pathResolvers/aliasPathResolver.js.map +1 -0
  122. package/dist/src/memory/pathResolvers/atAtPathResolver.d.ts +11 -0
  123. package/dist/src/memory/pathResolvers/atAtPathResolver.js +18 -0
  124. package/dist/src/memory/pathResolvers/atAtPathResolver.js.map +1 -0
  125. package/dist/src/memory/pathResolvers/atPathResolver.d.ts +20 -0
  126. package/dist/src/memory/pathResolvers/atPathResolver.js +46 -0
  127. package/dist/src/memory/pathResolvers/atPathResolver.js.map +1 -0
  128. package/dist/src/memory/pathResolvers/dollarPathResolver.d.ts +11 -0
  129. package/dist/src/memory/pathResolvers/dollarPathResolver.js +18 -0
  130. package/dist/src/memory/pathResolvers/dollarPathResolver.js.map +1 -0
  131. package/dist/src/memory/pathResolvers/hashPathResolver.d.ts +11 -0
  132. package/dist/src/memory/pathResolvers/hashPathResolver.js +18 -0
  133. package/dist/src/memory/pathResolvers/hashPathResolver.js.map +1 -0
  134. package/dist/src/memory/pathResolvers/index.d.ts +11 -0
  135. package/dist/src/memory/pathResolvers/index.js +28 -0
  136. package/dist/src/memory/pathResolvers/index.js.map +1 -0
  137. package/dist/src/memory/pathResolvers/pathResolver.d.ts +13 -0
  138. package/dist/src/memory/pathResolvers/pathResolver.js +7 -0
  139. package/dist/src/memory/pathResolvers/pathResolver.js.map +1 -0
  140. package/dist/src/memory/pathResolvers/percentPathResolver.d.ts +11 -0
  141. package/dist/src/memory/pathResolvers/percentPathResolver.js +18 -0
  142. package/dist/src/memory/pathResolvers/percentPathResolver.js.map +1 -0
  143. package/dist/src/memory/scopePath.d.ts +18 -0
  144. package/dist/src/memory/scopePath.js +23 -0
  145. package/dist/src/memory/scopePath.js.map +1 -0
  146. package/dist/src/memory/scopes/agentStateMemoryScope.d.ts +53 -0
  147. package/dist/src/memory/scopes/agentStateMemoryScope.js +82 -0
  148. package/dist/src/memory/scopes/agentStateMemoryScope.js.map +1 -0
  149. package/dist/src/memory/scopes/classMemoryScope.d.ts +29 -0
  150. package/dist/src/memory/scopes/classMemoryScope.js +65 -0
  151. package/dist/src/memory/scopes/classMemoryScope.js.map +1 -0
  152. package/dist/src/memory/scopes/conversationMemoryScope.d.ts +15 -0
  153. package/dist/src/memory/scopes/conversationMemoryScope.js +23 -0
  154. package/dist/src/memory/scopes/conversationMemoryScope.js.map +1 -0
  155. package/dist/src/memory/scopes/dialogClassMemoryScope.d.ts +19 -0
  156. package/dist/src/memory/scopes/dialogClassMemoryScope.js +42 -0
  157. package/dist/src/memory/scopes/dialogClassMemoryScope.js.map +1 -0
  158. package/dist/src/memory/scopes/dialogContextMemoryScope.d.ts +19 -0
  159. package/dist/src/memory/scopes/dialogContextMemoryScope.js +48 -0
  160. package/dist/src/memory/scopes/dialogContextMemoryScope.js.map +1 -0
  161. package/dist/src/memory/scopes/dialogMemoryScope.d.ts +32 -0
  162. package/dist/src/memory/scopes/dialogMemoryScope.js +74 -0
  163. package/dist/src/memory/scopes/dialogMemoryScope.js.map +1 -0
  164. package/dist/src/memory/scopes/index.d.ts +15 -0
  165. package/dist/src/memory/scopes/index.js +32 -0
  166. package/dist/src/memory/scopes/index.js.map +1 -0
  167. package/dist/src/memory/scopes/memoryScope.d.ts +52 -0
  168. package/dist/src/memory/scopes/memoryScope.js +54 -0
  169. package/dist/src/memory/scopes/memoryScope.js.map +1 -0
  170. package/dist/src/memory/scopes/settingsMemoryScope.d.ts +68 -0
  171. package/dist/src/memory/scopes/settingsMemoryScope.js +216 -0
  172. package/dist/src/memory/scopes/settingsMemoryScope.js.map +1 -0
  173. package/dist/src/memory/scopes/thisMemoryScope.d.ts +26 -0
  174. package/dist/src/memory/scopes/thisMemoryScope.js +43 -0
  175. package/dist/src/memory/scopes/thisMemoryScope.js.map +1 -0
  176. package/dist/src/memory/scopes/turnMemoryScope.d.ts +29 -0
  177. package/dist/src/memory/scopes/turnMemoryScope.js +52 -0
  178. package/dist/src/memory/scopes/turnMemoryScope.js.map +1 -0
  179. package/dist/src/memory/scopes/userMemoryScope.d.ts +15 -0
  180. package/dist/src/memory/scopes/userMemoryScope.js +23 -0
  181. package/dist/src/memory/scopes/userMemoryScope.js.map +1 -0
  182. package/dist/src/memory/turnPath.d.ts +21 -0
  183. package/dist/src/memory/turnPath.js +38 -0
  184. package/dist/src/memory/turnPath.js.map +1 -0
  185. package/dist/src/prompts/activityPrompt.d.ts +101 -0
  186. package/dist/src/prompts/activityPrompt.js +166 -0
  187. package/dist/src/prompts/activityPrompt.js.map +1 -0
  188. package/dist/src/prompts/attachmentPrompt.d.ts +37 -0
  189. package/dist/src/prompts/attachmentPrompt.js +55 -0
  190. package/dist/src/prompts/attachmentPrompt.js.map +1 -0
  191. package/dist/src/prompts/choicePrompt.d.ts +83 -0
  192. package/dist/src/prompts/choicePrompt.js +116 -0
  193. package/dist/src/prompts/choicePrompt.js.map +1 -0
  194. package/dist/src/prompts/confirmPrompt.d.ts +82 -0
  195. package/dist/src/prompts/confirmPrompt.js +163 -0
  196. package/dist/src/prompts/confirmPrompt.js.map +1 -0
  197. package/dist/src/prompts/datetimePrompt.d.ts +65 -0
  198. package/dist/src/prompts/datetimePrompt.js +109 -0
  199. package/dist/src/prompts/datetimePrompt.js.map +1 -0
  200. package/dist/src/prompts/index.d.ts +13 -0
  201. package/dist/src/prompts/index.js +30 -0
  202. package/dist/src/prompts/index.js.map +1 -0
  203. package/dist/src/prompts/numberPrompt.d.ts +55 -0
  204. package/dist/src/prompts/numberPrompt.js +134 -0
  205. package/dist/src/prompts/numberPrompt.js.map +1 -0
  206. package/dist/src/prompts/prompt.d.ts +256 -0
  207. package/dist/src/prompts/prompt.js +260 -0
  208. package/dist/src/prompts/prompt.js.map +1 -0
  209. package/dist/src/prompts/promptCultureModels.d.ts +72 -0
  210. package/dist/src/prompts/promptCultureModels.js +123 -0
  211. package/dist/src/prompts/promptCultureModels.js.map +1 -0
  212. package/dist/src/prompts/textPrompt.d.ts +54 -0
  213. package/dist/src/prompts/textPrompt.js +72 -0
  214. package/dist/src/prompts/textPrompt.js.map +1 -0
  215. package/dist/src/recognizer.d.ts +43 -0
  216. package/dist/src/recognizer.js +104 -0
  217. package/dist/src/recognizer.js.map +1 -0
  218. package/dist/src/recognizerResult.d.ts +19 -0
  219. package/dist/src/recognizerResult.js +24 -0
  220. package/dist/src/recognizerResult.js.map +1 -0
  221. package/dist/src/serviceCollection.d.ts +112 -0
  222. package/dist/src/serviceCollection.js +209 -0
  223. package/dist/src/serviceCollection.js.map +1 -0
  224. package/dist/src/stringUtils.d.ts +36 -0
  225. package/dist/src/stringUtils.js +62 -0
  226. package/dist/src/stringUtils.js.map +1 -0
  227. package/dist/src/template.d.ts +18 -0
  228. package/dist/src/template.js +7 -0
  229. package/dist/src/template.js.map +1 -0
  230. package/dist/src/waterfallDialog.d.ts +101 -0
  231. package/dist/src/waterfallDialog.js +179 -0
  232. package/dist/src/waterfallDialog.js.map +1 -0
  233. package/dist/src/waterfallStepContext.d.ts +71 -0
  234. package/dist/src/waterfallStepContext.js +78 -0
  235. package/dist/src/waterfallStepContext.js.map +1 -0
  236. package/package.json +49 -0
  237. package/src/agentComponent.ts +23 -0
  238. package/src/agentStateSet.ts +75 -0
  239. package/src/choices/choice.ts +16 -0
  240. package/src/choices/choiceFactory.ts +189 -0
  241. package/src/choices/findChoices.ts +70 -0
  242. package/src/choices/findValues.ts +179 -0
  243. package/src/choices/index.ts +11 -0
  244. package/src/choices/modelResult.ts +11 -0
  245. package/src/choices/recognizeChoices.ts +94 -0
  246. package/src/choices/tokenizer.ts +93 -0
  247. package/src/componentDialog.ts +306 -0
  248. package/src/componentRegistration.ts +30 -0
  249. package/src/configurable.ts +55 -0
  250. package/src/configuration.ts +22 -0
  251. package/src/converter.ts +15 -0
  252. package/src/dialog.ts +243 -0
  253. package/src/dialogContainer.ts +90 -0
  254. package/src/dialogContext.ts +607 -0
  255. package/src/dialogContextError.ts +50 -0
  256. package/src/dialogEvent.ts +23 -0
  257. package/src/dialogEvents.ts +16 -0
  258. package/src/dialogHelper.ts +154 -0
  259. package/src/dialogInstance.ts +32 -0
  260. package/src/dialogManager.ts +202 -0
  261. package/src/dialogReason.ts +40 -0
  262. package/src/dialogSet.ts +168 -0
  263. package/src/dialogTurnResult.ts +37 -0
  264. package/src/dialogTurnStateConstants.ts +13 -0
  265. package/src/dialogTurnStatus.ts +38 -0
  266. package/src/dialogsAgentComponent.ts +71 -0
  267. package/src/dialogsComponentRegistration.ts +49 -0
  268. package/src/i18n.ts +17 -0
  269. package/src/index.ts +31 -0
  270. package/src/intentScore.ts +11 -0
  271. package/src/memory/componentMemoryScopes.ts +28 -0
  272. package/src/memory/componentPathResolvers.ts +29 -0
  273. package/src/memory/dialogPath.ts +33 -0
  274. package/src/memory/dialogStateManager.ts +661 -0
  275. package/src/memory/index.ts +12 -0
  276. package/src/memory/pathResolvers/aliasPathResolver.ts +44 -0
  277. package/src/memory/pathResolvers/atAtPathResolver.ts +14 -0
  278. package/src/memory/pathResolvers/atPathResolver.ts +45 -0
  279. package/src/memory/pathResolvers/dollarPathResolver.ts +14 -0
  280. package/src/memory/pathResolvers/hashPathResolver.ts +14 -0
  281. package/src/memory/pathResolvers/index.ts +11 -0
  282. package/src/memory/pathResolvers/pathResolver.ts +14 -0
  283. package/src/memory/pathResolvers/percentPathResolver.ts +14 -0
  284. package/src/memory/scopePath.ts +19 -0
  285. package/src/memory/scopes/agentStateMemoryScope.ts +92 -0
  286. package/src/memory/scopes/classMemoryScope.ts +71 -0
  287. package/src/memory/scopes/conversationMemoryScope.ts +19 -0
  288. package/src/memory/scopes/dialogClassMemoryScope.ts +43 -0
  289. package/src/memory/scopes/dialogContextMemoryScope.ts +51 -0
  290. package/src/memory/scopes/dialogMemoryScope.ts +79 -0
  291. package/src/memory/scopes/index.ts +15 -0
  292. package/src/memory/scopes/memoryScope.ts +70 -0
  293. package/src/memory/scopes/settingsMemoryScope.ts +239 -0
  294. package/src/memory/scopes/thisMemoryScope.ts +44 -0
  295. package/src/memory/scopes/turnMemoryScope.ts +54 -0
  296. package/src/memory/scopes/userMemoryScope.ts +19 -0
  297. package/src/memory/turnPath.ts +45 -0
  298. package/src/prompts/activityPrompt.ts +202 -0
  299. package/src/prompts/attachmentPrompt.ts +62 -0
  300. package/src/prompts/choicePrompt.ts +176 -0
  301. package/src/prompts/confirmPrompt.ts +182 -0
  302. package/src/prompts/datetimePrompt.ts +110 -0
  303. package/src/prompts/index.ts +13 -0
  304. package/src/prompts/numberPrompt.ts +117 -0
  305. package/src/prompts/prompt.ts +459 -0
  306. package/src/prompts/promptCultureModels.ts +178 -0
  307. package/src/prompts/textPrompt.ts +82 -0
  308. package/src/recognizer.ts +127 -0
  309. package/src/recognizerResult.ts +37 -0
  310. package/src/serviceCollection.ts +305 -0
  311. package/src/stringUtils.ts +62 -0
  312. package/src/template.ts +20 -0
  313. package/src/waterfallDialog.ts +215 -0
  314. package/src/waterfallStepContext.ts +96 -0
  315. package/vendor/cldr-data/README.md +5 -0
  316. package/vendor/cldr-data/main/de/numbers.json +156 -0
  317. package/vendor/cldr-data/main/en/numbers.json +159 -0
  318. package/vendor/cldr-data/main/es/numbers.json +156 -0
  319. package/vendor/cldr-data/main/fr/numbers.json +157 -0
  320. package/vendor/cldr-data/main/ja/numbers.json +120 -0
  321. package/vendor/cldr-data/main/nl/numbers.json +156 -0
  322. package/vendor/cldr-data/main/pt/numbers.json +156 -0
  323. package/vendor/cldr-data/main/zh/numbers.json +214 -0
  324. package/vendor/cldr-data/supplemental/likelySubtags.json +1844 -0
  325. package/vendor/cldr-data/supplemental/numberingSystems.json +343 -0
@@ -0,0 +1,201 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Dialog = void 0;
4
+ const configurable_1 = require("./configurable");
5
+ const dialogTurnStatus_1 = require("./dialogTurnStatus");
6
+ /**
7
+ * Defines the core behavior for all dialogs.
8
+ */
9
+ class Dialog extends configurable_1.Configurable {
10
+ /**
11
+ * Creates a new instance of the Dialog class.
12
+ *
13
+ * @param dialogId Optional. unique ID of the dialog.
14
+ */
15
+ constructor(dialogId) {
16
+ super();
17
+ this.id = dialogId;
18
+ }
19
+ /**
20
+ * Unique ID of the dialog.
21
+ *
22
+ * @remarks
23
+ * This will be automatically generated if not specified.
24
+ * @returns The Id for the dialog.
25
+ */
26
+ get id() {
27
+ if (this._id === undefined) {
28
+ this._id = this.onComputeId();
29
+ }
30
+ return this._id;
31
+ }
32
+ /**
33
+ * Sets the unique ID of the dialog.
34
+ */
35
+ set id(value) {
36
+ this._id = value;
37
+ }
38
+ /**
39
+ * An encoded string used to aid in the detection of agent changes on re-deployment.
40
+ *
41
+ * @remarks
42
+ * This defaults to returning the dialogs [id](#id) but can be overridden to provide more
43
+ * precise change detection logic. Any dialog on the stack that has its version change will
44
+ * result in a `versionChanged` event will be raised. If this event is not handled by the agent,
45
+ * an error will be thrown resulting in the agent error handler logic being run.
46
+ *
47
+ * Returning an empty string will disable version tracking for the component all together.
48
+ * @returns Unique string which should only change when dialog has changed in a way that should restart the dialog.
49
+ */
50
+ getVersion() {
51
+ return this.id;
52
+ }
53
+ /**
54
+ * When overridden in a derived class, continues the dialog.
55
+ *
56
+ * @param dc The context for the current dialog turn.
57
+ *
58
+ * @remarks
59
+ * Derived dialogs that support multiple-turn conversations should override this method.
60
+ * By default, this method signals that the dialog is complete and returns.
61
+ *
62
+ * The DialogContext calls this method when it continues
63
+ * the dialog.
64
+ *
65
+ * To signal to the dialog context that this dialog has completed, await
66
+ * DialogContext.endDialog before exiting this method.
67
+ *
68
+ * @returns {Promise<DialogTurnResult>} A promise resolving to the dialog turn result.
69
+ */
70
+ async continueDialog(dc) {
71
+ // By default just end the current dialog.
72
+ return dc.endDialog();
73
+ }
74
+ /**
75
+ * When overridden in a derived class, resumes the dialog after the dialog above it on the stack completes.
76
+ *
77
+ * @param dc The context for the current dialog turn.
78
+ * @param reason The reason the dialog is resuming. This will typically be DialogReason.endCalled
79
+ * @param result Optional. The return value, if any, from the dialog that ended.
80
+ *
81
+ * @remarks
82
+ * Derived dialogs that support multiple-turn conversations should override this method.
83
+ * By default, this method signals that the dialog is complete and returns.
84
+ *
85
+ * The DialogContext calls this method when it resumes
86
+ * the dialog. If the previous dialog on the stack returned a value, that value is in the `result`
87
+ * parameter.
88
+ *
89
+ * To start a _child_ dialog, use DialogContext.beginDialog or DialogContext.prompt; however, this dialog will not
90
+ * necessarily be the one that started the child dialog.
91
+ * To signal to the dialog context that this dialog has completed, await DialogContext.endDialog before exiting this method.
92
+ *
93
+ * @returns {Promise<DialogTurnResult>} A promise resolving to the dialog turn result.
94
+ */
95
+ async resumeDialog(dc, reason, result) {
96
+ // By default just end the current dialog and return result to parent.
97
+ return dc.endDialog(result);
98
+ }
99
+ /**
100
+ * When overridden in a derived class, reprompts the user for input.
101
+ *
102
+ * @param _context The context object for the turn.
103
+ * @param _instance Current state information for this dialog.
104
+ *
105
+ * @remarks
106
+ * Derived dialogs that support validation and re-prompt logic should override this method.
107
+ * By default, this method has no effect.
108
+ *
109
+ * The DialogContext calls this method when the current
110
+ * dialog should re-request input from the user. This method is implemented for prompt dialogs.
111
+ *
112
+ */
113
+ async repromptDialog(_context, _instance) {
114
+ // No-op by default
115
+ }
116
+ /**
117
+ * When overridden in a derived class, performs clean up for the dialog before it ends.
118
+ *
119
+ * @param _context The context object for the turn.
120
+ * @param _instance Current state information for this dialog.
121
+ * @param _reason The reason the dialog is ending.
122
+ *
123
+ * @remarks
124
+ * Derived dialogs that need to perform logging or cleanup before ending should override this method.
125
+ * By default, this method has no effect.
126
+ *
127
+ * The DialogContext calls this method when the current
128
+ * dialog is ending.
129
+ *
130
+ */
131
+ async endDialog(_context, _instance, _reason) {
132
+ // No-op by default
133
+ }
134
+ /**
135
+ * Called when an event has been raised, using `DialogContext.emitEvent()`, by either the current dialog or a dialog that the current dialog started.
136
+ *
137
+ * @param dialogContext - The dialog context for the current turn of conversation.
138
+ * @param event - The event being raised.
139
+ * @returns True if the event is handled by the current dialog and bubbling should stop.
140
+ */
141
+ async onDialogEvent(dialogContext, event) {
142
+ // Before bubble
143
+ let handled = await this.onPreBubbleEvent(dialogContext, event);
144
+ // Bubble as needed
145
+ if (!handled && event.bubble && dialogContext.parent !== undefined) {
146
+ handled = await dialogContext.parent.emitEvent(event.name, event.value, true, false);
147
+ }
148
+ // Post bubble
149
+ if (!handled) {
150
+ handled = await this.onPostBubbleEvent(dialogContext, event);
151
+ }
152
+ return handled;
153
+ }
154
+ /**
155
+ * Called before an event is bubbled to its parent.
156
+ *
157
+ * @remarks
158
+ * This is a good place to perform interception of an event as returning `true` will prevent
159
+ * any further bubbling of the event to the dialogs parents and will also prevent any child
160
+ * dialogs from performing their default processing.
161
+ * @param _dc The dialog context for the current turn of conversation.
162
+ * @param _e The event being raised.
163
+ * @returns Whether the event is handled by the current dialog and further processing should stop.
164
+ */
165
+ async onPreBubbleEvent(_dc, _e) {
166
+ return false;
167
+ }
168
+ /**
169
+ * Called after an event was bubbled to all parents and wasn't handled.
170
+ *
171
+ * @remarks
172
+ * This is a good place to perform default processing logic for an event. Returning `true` will
173
+ * prevent any processing of the event by child dialogs.
174
+ * @param _dc The dialog context for the current turn of conversation.
175
+ * @param _e The event being raised.
176
+ * @returns Whether the event is handled by the current dialog and further processing should stop.
177
+ */
178
+ async onPostBubbleEvent(_dc, _e) {
179
+ return false;
180
+ }
181
+ /**
182
+ * Called when a unique ID needs to be computed for a dialog.
183
+ *
184
+ * @remarks
185
+ * SHOULD be overridden to provide a more contextually relevant ID. The preferred pattern for
186
+ * ID's is `<dialog type>(this.hashedLabel('<dialog args>'))`.
187
+ */
188
+ onComputeId() {
189
+ throw new Error('Dialog.onComputeId(): not implemented.');
190
+ }
191
+ }
192
+ exports.Dialog = Dialog;
193
+ /**
194
+ * Gets a default end-of-turn result.
195
+ *
196
+ * @remarks
197
+ * This result indicates that a dialog (or a logical step within a dialog) has completed
198
+ * processing for the current turn, is still active, and is waiting for more input.
199
+ */
200
+ Dialog.EndOfTurn = { status: dialogTurnStatus_1.DialogTurnStatus.waiting };
201
+ //# sourceMappingURL=dialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../src/dialog.ts"],"names":[],"mappings":";;;AAMA,iDAA6C;AAK7C,yDAAqD;AAErD;;GAEG;AACH,MAAsB,MAA8B,SAAQ,2BAAY;IAYtE;;;;SAIK;IACL,YAAa,QAAiB;QAC5B,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,EAAE,GAAG,QAAQ,CAAA;IACpB,CAAC;IAED;;;;;;SAMK;IACL,IAAI,EAAE;QACJ,IAAI,IAAI,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;YAC3B,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,WAAW,EAAE,CAAA;QAC/B,CAAC;QACD,OAAO,IAAI,CAAC,GAAG,CAAA;IACjB,CAAC;IAED;;SAEK;IACL,IAAI,EAAE,CAAE,KAAa;QACnB,IAAI,CAAC,GAAG,GAAG,KAAK,CAAA;IAClB,CAAC;IAED;;;;;;;;;;;SAWK;IACL,UAAU;QACR,OAAO,IAAI,CAAC,EAAE,CAAA;IAChB,CAAC;IAqBD;;;;;;;;;;;;;;;;SAgBK;IACL,KAAK,CAAC,cAAc,CAAE,EAAiB;QACrC,0CAA0C;QAC1C,OAAO,EAAE,CAAC,SAAS,EAAE,CAAA;IACvB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;SAoBK;IACL,KAAK,CAAC,YAAY,CAAE,EAAiB,EAAE,MAAoB,EAAE,MAAY;QACvE,sEAAsE;QACtE,OAAO,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;IAC7B,CAAC;IAED;;;;;;;;;;;;;SAaK;IACL,KAAK,CAAC,cAAc,CAAE,QAAqB,EAAE,SAAyB;QACpE,mBAAmB;IACrB,CAAC;IAED;;;;;;;;;;;;;;SAcK;IACL,KAAK,CAAC,SAAS,CAAE,QAAqB,EAAE,SAAyB,EAAE,OAAqB;QACtF,mBAAmB;IACrB,CAAC;IAED;;;;;;SAMK;IACL,KAAK,CAAC,aAAa,CAAE,aAA4B,EAAE,KAAkB;QACnE,gBAAgB;QAChB,IAAI,OAAO,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,aAAa,EAAE,KAAK,CAAC,CAAA;QAE/D,mBAAmB;QACnB,IAAI,CAAC,OAAO,IAAI,KAAK,CAAC,MAAM,IAAI,aAAa,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YACnE,OAAO,GAAG,MAAM,aAAa,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,CAAA;QACtF,CAAC;QAED,cAAc;QACd,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,aAAa,EAAE,KAAK,CAAC,CAAA;QAC9D,CAAC;QAED,OAAO,OAAO,CAAA;IAChB,CAAC;IAED;;;;;;;;;;SAUK;IACK,KAAK,CAAC,gBAAgB,CAAE,GAAkB,EAAE,EAAe;QACnE,OAAO,KAAK,CAAA;IACd,CAAC;IAED;;;;;;;;;SASK;IACK,KAAK,CAAC,iBAAiB,CAAE,GAAkB,EAAE,EAAe;QACpE,OAAO,KAAK,CAAA;IACd,CAAC;IAED;;;;;;SAMK;IACK,WAAW;QACnB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAA;IAC3D,CAAC;;AAjOH,wBAkOC;AA/NC;;;;;;KAMK;AACE,gBAAS,GAAqB,EAAE,MAAM,EAAE,mCAAgB,CAAC,OAAO,EAAE,CAAA"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { Dialog } from './dialog';
6
+ import { DialogSet } from './dialogSet';
7
+ import { DialogContext } from './dialogContext';
8
+ import { DialogEvent } from './dialogEvent';
9
+ /**
10
+ * A container for a set of Dialogs.
11
+ */
12
+ export declare abstract class DialogContainer<O extends object = {}> extends Dialog<O> {
13
+ /**
14
+ * The containers dialog set.
15
+ */
16
+ readonly dialogs: DialogSet;
17
+ /**
18
+ * Creates an inner dialog context for the containers active child.
19
+ *
20
+ * @param dialogContext Parents dialog context.
21
+ * @returns A new dialog context for the active child or `undefined` if there is no active child.
22
+ */
23
+ abstract createChildContext(dialogContext: DialogContext): DialogContext | undefined;
24
+ /**
25
+ * Finds a child dialog that was previously added to the container.
26
+ *
27
+ * @param dialogId ID of the dialog to lookup.
28
+ * @returns The Dialog if found; otherwise null.
29
+ */
30
+ findDialog(dialogId: string): Dialog | undefined;
31
+ /**
32
+ * Called when an event has been raised, using `DialogContext.emitEvent()`,
33
+ * by either the current dialog or a dialog that the current dialog started.
34
+ *
35
+ * @param dialogContext The dialog context for the current turn of conversation.
36
+ * @param event The event being raised.
37
+ * @returns True if the event is handled by the current dialog and bubbling should stop.
38
+ */
39
+ onDialogEvent(dialogContext: DialogContext, event: DialogEvent): Promise<boolean>;
40
+ /**
41
+ * Returns internal version identifier for this container.
42
+ *
43
+ * @remarks
44
+ * DialogContainers detect changes of all sub-components in the container and map that to a `versionChanged` event.
45
+ * Because they do this, DialogContainers "hide" the internal changes and just have the .id. This isolates changes
46
+ * to the container level unless a container doesn't handle it. To support this DialogContainers define a
47
+ * protected method getInternalVersion() which computes if this dialog or child dialogs have changed
48
+ * which is then examined via calls to checkForVersionChange().
49
+ * @returns Version which represents the change of the internals of this container.
50
+ */
51
+ protected getInternalVersion(): string;
52
+ /**
53
+ * Checks to see if a containers child dialogs have changed since the current dialog instance
54
+ * was started.
55
+ *
56
+ * @remarks
57
+ * This should be called at the start of `beginDialog()`, `continueDialog()`, and `resumeDialog()`.
58
+ * @param dialogContext Current dialog context.
59
+ */
60
+ protected checkForVersionChange(dialogContext: DialogContext): Promise<void>;
61
+ }
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DialogContainer = void 0;
4
+ /**
5
+ * Copyright (c) Microsoft Corporation. All rights reserved.
6
+ * Licensed under the MIT License.
7
+ */
8
+ const dialog_1 = require("./dialog");
9
+ const dialogSet_1 = require("./dialogSet");
10
+ const dialogEvents_1 = require("./dialogEvents");
11
+ /**
12
+ * A container for a set of Dialogs.
13
+ */
14
+ class DialogContainer extends dialog_1.Dialog {
15
+ constructor() {
16
+ super(...arguments);
17
+ /**
18
+ * The containers dialog set.
19
+ */
20
+ this.dialogs = new dialogSet_1.DialogSet(undefined);
21
+ }
22
+ /**
23
+ * Finds a child dialog that was previously added to the container.
24
+ *
25
+ * @param dialogId ID of the dialog to lookup.
26
+ * @returns The Dialog if found; otherwise null.
27
+ */
28
+ findDialog(dialogId) {
29
+ return this.dialogs.find(dialogId);
30
+ }
31
+ /**
32
+ * Called when an event has been raised, using `DialogContext.emitEvent()`,
33
+ * by either the current dialog or a dialog that the current dialog started.
34
+ *
35
+ * @param dialogContext The dialog context for the current turn of conversation.
36
+ * @param event The event being raised.
37
+ * @returns True if the event is handled by the current dialog and bubbling should stop.
38
+ */
39
+ async onDialogEvent(dialogContext, event) {
40
+ const handled = await super.onDialogEvent(dialogContext, event);
41
+ if (!handled && event.name === dialogEvents_1.DialogEvents.versionChanged) {
42
+ const traceMessage = `Unhandled dialog event: ${event.name}. Active Dialog: ${dialogContext.activeDialog.id}`;
43
+ await dialogContext.context.sendTraceActivity(traceMessage);
44
+ }
45
+ return handled;
46
+ }
47
+ /**
48
+ * Returns internal version identifier for this container.
49
+ *
50
+ * @remarks
51
+ * DialogContainers detect changes of all sub-components in the container and map that to a `versionChanged` event.
52
+ * Because they do this, DialogContainers "hide" the internal changes and just have the .id. This isolates changes
53
+ * to the container level unless a container doesn't handle it. To support this DialogContainers define a
54
+ * protected method getInternalVersion() which computes if this dialog or child dialogs have changed
55
+ * which is then examined via calls to checkForVersionChange().
56
+ * @returns Version which represents the change of the internals of this container.
57
+ */
58
+ getInternalVersion() {
59
+ return this.dialogs.getVersion();
60
+ }
61
+ /**
62
+ * Checks to see if a containers child dialogs have changed since the current dialog instance
63
+ * was started.
64
+ *
65
+ * @remarks
66
+ * This should be called at the start of `beginDialog()`, `continueDialog()`, and `resumeDialog()`.
67
+ * @param dialogContext Current dialog context.
68
+ */
69
+ async checkForVersionChange(dialogContext) {
70
+ const current = dialogContext.activeDialog.version;
71
+ dialogContext.activeDialog.version = this.getInternalVersion();
72
+ // Check for change of previously stored hash
73
+ if (current && current !== dialogContext.activeDialog.version) {
74
+ // Give agent an opportunity to handle the change.
75
+ // - If agent handles it the changeHash will have been updated as to avoid triggering the
76
+ // change again.
77
+ await dialogContext.emitEvent(dialogEvents_1.DialogEvents.versionChanged, this.id, true, false);
78
+ }
79
+ }
80
+ }
81
+ exports.DialogContainer = DialogContainer;
82
+ //# sourceMappingURL=dialogContainer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialogContainer.js","sourceRoot":"","sources":["../../src/dialogContainer.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,qCAAiC;AACjC,2CAAuC;AAEvC,iDAA6C;AAG7C;;GAEG;AACH,MAAsB,eAAuC,SAAQ,eAAS;IAA9E;;QACE;;aAEK;QACI,YAAO,GAAG,IAAI,qBAAS,CAAC,SAAS,CAAC,CAAA;IAwE7C,CAAC;IA9DC;;;;;SAKK;IACL,UAAU,CAAE,QAAgB;QAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IACpC,CAAC;IAED;;;;;;;SAOK;IACL,KAAK,CAAC,aAAa,CAAE,aAA4B,EAAE,KAAkB;QACnE,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,aAAa,CAAC,aAAa,EAAE,KAAK,CAAC,CAAA;QAC/D,IAAI,CAAC,OAAO,IAAI,KAAK,CAAC,IAAI,KAAK,2BAAY,CAAC,cAAc,EAAE,CAAC;YAC3D,MAAM,YAAY,GAAG,2BAA2B,KAAK,CAAC,IAAI,oBAAoB,aAAa,CAAC,YAAY,CAAC,EAAE,EAAE,CAAA;YAC7G,MAAM,aAAa,CAAC,OAAO,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAA;QAC7D,CAAC;QACD,OAAO,OAAO,CAAA;IAChB,CAAC;IAED;;;;;;;;;;SAUK;IACK,kBAAkB;QAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAA;IAClC,CAAC;IAED;;;;;;;SAOK;IACK,KAAK,CAAC,qBAAqB,CAAE,aAA4B;QACjE,MAAM,OAAO,GAAG,aAAa,CAAC,YAAY,CAAC,OAAO,CAAA;QAClD,aAAa,CAAC,YAAY,CAAC,OAAO,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAA;QAE9D,6CAA6C;QAC7C,IAAI,OAAO,IAAI,OAAO,KAAK,aAAa,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;YAC9D,kDAAkD;YAClD,yFAAyF;YACzF,kBAAkB;YAClB,MAAM,aAAa,CAAC,SAAS,CAAC,2BAAY,CAAC,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,CAAA;QAClF,CAAC;IACH,CAAC;CACF;AA5ED,0CA4EC"}
@@ -0,0 +1,272 @@
1
+ /**
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { Activity, TurnContext, TurnContextStateCollection } from '@microsoft/agents-hosting';
6
+ import { Dialog } from './dialog';
7
+ import { DialogSet } from './dialogSet';
8
+ import { PromptOptions } from './prompts';
9
+ import { DialogStateManager } from './memory';
10
+ import { DialogManager } from './dialogManager';
11
+ import { DialogInstance } from './dialogInstance';
12
+ import { DialogTurnResult } from './dialogTurnResult';
13
+ import { Choice } from './choices';
14
+ /**
15
+ * Contains dialog state, information about the state of the dialog stack, for a specific DialogSet.
16
+ *
17
+ * @remarks
18
+ * State is read from and saved to storage each turn, and state cache for the turn is managed through the TurnContext.
19
+ *
20
+ * For more information, see the articles on
21
+ * [Managing state](https://docs.microsoft.com/azure/bot-service/bot-builder-concept-state) and
22
+ * [Dialogs library](https://docs.microsoft.com/azure/bot-service/bot-builder-concept-dialog).
23
+ */
24
+ export interface DialogState {
25
+ /**
26
+ * Contains state information for each Dialog on the stack.
27
+ */
28
+ dialogStack: DialogInstance[];
29
+ }
30
+ /**
31
+ * The context for the current dialog turn with respect to a specific DialogSet.
32
+ *
33
+ * @remarks
34
+ * This includes the turn context, information about the dialog set, and the state of the dialog stack.
35
+ *
36
+ * From code outside of a dialog in the set, use DialogSet.createContext
37
+ * to create the dialog context. Then use the methods of the dialog context to manage the progression of dialogs in the set.
38
+ *
39
+ * When you implement a dialog, the dialog context is a parameter available to the various methods you override or implement.
40
+ *
41
+ */
42
+ export declare class DialogContext {
43
+ /**
44
+ * Creates an new instance of the DialogContext class.
45
+ *
46
+ * @param dialogs The DialogSet for which to create the dialog context.
47
+ * @param contextOrDialogContext The TurnContext object for the current turn.
48
+ * @param state The state object to use to read and write DialogState to storage.
49
+ * @remarks
50
+ * Passing in a DialogContext instance will clone the dialog context.
51
+ */
52
+ constructor(dialogs: DialogSet, contextOrDialogContext: TurnContext, state: DialogState);
53
+ /**
54
+ * Creates an new instance of the DialogContext class.
55
+ *
56
+ * @param dialogs The DialogSet for which to create the dialog context.
57
+ * @param contextOrDialogContext The DialogContext object for the current turn.
58
+ * @param state The state object to use to read and write DialogState to storage.
59
+ * @remarks
60
+ * Passing in a DialogContext instance will clone the dialog context.
61
+ */
62
+ constructor(dialogs: DialogSet, contextOrDialogContext: DialogContext, state: DialogState);
63
+ /**
64
+ * Gets the dialogs that can be called directly from this context.
65
+ */
66
+ dialogs: DialogSet;
67
+ /**
68
+ * Gets the context object for the turn.
69
+ */
70
+ context: TurnContext;
71
+ /**
72
+ * Gets the current dialog stack.
73
+ */
74
+ stack: DialogInstance[];
75
+ /**
76
+ * The parent dialog context for this dialog context, or `undefined` if this context doesn't have a parent.
77
+ *
78
+ * @remarks
79
+ * When it attempts to start a dialog, the dialog context searches for the Dialog.id
80
+ * in its DialogContext.dialogs. If the dialog to start is not found
81
+ * in this dialog context, it searches in its parent dialog context, and so on.
82
+ */
83
+ parent: DialogContext | undefined;
84
+ /**
85
+ * @returns Dialog context for child if the active dialog is a container.
86
+ */
87
+ get child(): DialogContext | undefined;
88
+ /**
89
+ * @returns The state information for the dialog on the top of the dialog stack, or `undefined` if
90
+ * the stack is empty.
91
+ */
92
+ get activeDialog(): DialogInstance | undefined;
93
+ /**
94
+ * Gets the DialogStateManager which manages view of all memory scopes.
95
+ */
96
+ state: DialogStateManager;
97
+ /**
98
+ * Gets the services collection which is contextual to this dialog context.
99
+ */
100
+ services: TurnContextStateCollection;
101
+ /**
102
+ * @deprecated This property serves no function.
103
+ * @returns The current dialog manager instance. This property is deprecated.
104
+ */
105
+ get dialogManager(): DialogManager;
106
+ /**
107
+ * Obtain the CultureInfo in DialogContext.
108
+ *
109
+ * @returns a locale string.
110
+ */
111
+ getLocale(): string;
112
+ /**
113
+ * Starts a dialog instance and pushes it onto the dialog stack.
114
+ * Creates a new instance of the dialog and pushes it onto the stack.
115
+ *
116
+ * @param dialogId ID of the dialog to start.
117
+ * @param options Optional. Arguments to pass into the dialog when it starts.
118
+ * @returns {Promise<DialogTurnResult>} a promise resolving to the dialog turn result.
119
+ * @remarks
120
+ * If there's already an active dialog on the stack, that dialog will be paused until
121
+ * it is again the top dialog on the stack.
122
+ *
123
+ * The DialogTurnResult.status of returned object describes
124
+ * the status of the dialog stack after this method completes.
125
+ *
126
+ * This method throws an exception if the requested dialog can't be found in this dialog context
127
+ * or any of its ancestors.
128
+ *
129
+ */
130
+ beginDialog(dialogId: string, options?: object): Promise<DialogTurnResult>;
131
+ /**
132
+ * Cancels all dialogs on the dialog stack, and clears stack.
133
+ *
134
+ * @param cancelParents Optional. If `true` all parent dialogs will be cancelled as well.
135
+ * @param eventName Optional. Name of a custom event to raise as dialogs are cancelled. This defaults to DialogEvents.cancelDialog.
136
+ * @param eventValue Optional. Value to pass along with custom cancellation event.
137
+ * @returns {Promise<DialogTurnResult>} a promise resolving to the dialog turn result.
138
+ * @remarks
139
+ * This calls each dialog's .Dialog.endDialog method before
140
+ * removing the dialog from the stack.
141
+ *
142
+ * If there were any dialogs on the stack initially, the DialogTurnResult.status
143
+ * of the return value is DialogTurnStatus.cancelled; otherwise, it's
144
+ * DialogTurnStatus.empty.
145
+ *
146
+ */
147
+ cancelAllDialogs(cancelParents?: boolean, eventName?: string, eventValue?: any): Promise<DialogTurnResult>;
148
+ /**
149
+ * Searches for a dialog with a given ID.
150
+ *
151
+ * @param dialogId ID of the dialog to search for.
152
+ * @returns The dialog for the provided ID.
153
+ * @remarks
154
+ * If the dialog to start is not found in the DialogSet associated
155
+ * with this dialog context, it attempts to find the dialog in its parent dialog context.
156
+ *
157
+ */
158
+ findDialog(dialogId: string): Dialog | undefined;
159
+ /**
160
+ * Helper function to simplify formatting the options for calling a prompt dialog.
161
+ *
162
+ * @param dialogId ID of the prompt dialog to start.
163
+ * @param promptOrOptions The text of the initial prompt to send the user,
164
+ * the activity to send as the initial prompt, or
165
+ * the object with which to format the prompt dialog.
166
+ * @param choices Optional. Array of choices for the user to choose from,
167
+ * for use with a ChoicePrompt.
168
+ *
169
+ * @remarks
170
+ * This helper method formats the object to use as the `options` parameter, and then calls
171
+ * DialogContext.beginDialog to start the specified prompt dialog.
172
+ *
173
+ */
174
+ prompt(dialogId: string, promptOrOptions: string | Partial<Activity> | PromptOptions): Promise<DialogTurnResult>;
175
+ /**
176
+ * Helper function to simplify formatting the options for calling a prompt dialog.
177
+ *
178
+ * @param dialogId ID of the prompt dialog to start.
179
+ * @param promptOrOptions The text of the initial prompt to send the user,
180
+ * the Activity to send as the initial prompt, or
181
+ * the object with which to format the prompt dialog.
182
+ * @param choices Optional. Array of choices for the user to choose from,
183
+ * for use with a ChoicePrompt.
184
+ * @remarks
185
+ * This helper method formats the object to use as the `options` parameter, and then calls
186
+ * DialogContext.beginDialog to start the specified prompt dialog.
187
+ *
188
+ */
189
+ prompt(dialogId: string, promptOrOptions: string | Partial<Activity> | PromptOptions, choices: (string | Choice)[]): Promise<DialogTurnResult>;
190
+ /**
191
+ * Continues execution of the active dialog, if there is one, by passing this dialog context to its
192
+ * Dialog.continueDialog method.
193
+ *
194
+ * @returns {Promise<DialogTurnResult>} a promise resolving to the dialog turn result.
195
+ * @remarks
196
+ * After the call completes, you can check the turn context's TurnContext.responded
197
+ * property to determine if the dialog sent a reply to the user.
198
+ *
199
+ * The DialogTurnResult.status of returned object describes
200
+ * the status of the dialog stack after this method completes.
201
+ *
202
+ * Typically, you would call this from within your agent's turn handler.
203
+ *
204
+ */
205
+ continueDialog(): Promise<DialogTurnResult>;
206
+ /**
207
+ * Ends a dialog and pops it off the stack. Returns an optional result to the dialog's parent.
208
+ *
209
+ * @param result Optional. A result to pass to the parent logic. This might be the next dialog
210
+ * on the stack, or if this was the last dialog on the stack, a parent dialog context or
211
+ * the agent's turn handler.
212
+ * @returns {Promise<DialogTurnResult>} a promise resolving to the dialog turn result.
213
+ * @remarks
214
+ * The _parent_ dialog is the next dialog on the dialog stack, if there is one. This method
215
+ * calls the parent's Dialog.resumeDialog method,
216
+ * passing the result returned by the ending dialog. If there is no parent dialog, the turn ends
217
+ * and the result is available to the agent through the returned object's
218
+ * DialogTurnResult.result property.
219
+ *
220
+ * The DialogTurnResult.status of returned object describes
221
+ * the status of the dialog stack after this method completes.
222
+ *
223
+ * Typically, you would call this from within the logic for a specific dialog to signal back to
224
+ * the dialog context that the dialog has completed, the dialog should be removed from the stack,
225
+ * and the parent dialog should resume.
226
+ *
227
+ */
228
+ endDialog(result?: any): Promise<DialogTurnResult>;
229
+ /**
230
+ * Ends the active dialog and starts a new dialog in its place.
231
+ *
232
+ * @param dialogId ID of the dialog to start.
233
+ * @param options Optional. Arguments to pass into the new dialog when it starts.
234
+ * @returns {Promise<DialogTurnResult>} a promise resolving to the dialog turn result.
235
+ * @remarks
236
+ * This is particularly useful for creating a loop or redirecting to another dialog.
237
+ *
238
+ * The DialogTurnResult.status of returned object describes
239
+ * the status of the dialog stack after this method completes.
240
+ *
241
+ * This method is similar to ending the current dialog and immediately beginning the new one.
242
+ * However, the parent dialog is neither resumed nor otherwise notified.
243
+ *
244
+ */
245
+ replaceDialog(dialogId: string, options?: object): Promise<DialogTurnResult>;
246
+ /**
247
+ * Requests the active dialog to re-prompt the user for input.
248
+ *
249
+ * @remarks
250
+ * This calls the active dialog's Dialog.repromptDialog method.
251
+ *
252
+ */
253
+ repromptDialog(): Promise<void>;
254
+ /**
255
+ * Searches for a dialog with a given ID.
256
+ *
257
+ * @remarks
258
+ * Emits a named event for the current dialog, or someone who started it, to handle.
259
+ * @param name Name of the event to raise.
260
+ * @param value Optional. Value to send along with the event.
261
+ * @param bubble Optional. Flag to control whether the event should be bubbled to its parent if not handled locally. Defaults to a value of `true`.
262
+ * @param fromLeaf Optional. Whether the event is emitted from a leaf node.
263
+ * @returns `true` if the event was handled.
264
+ */
265
+ emitEvent(name: string, value?: any, bubble?: boolean, fromLeaf?: boolean): Promise<boolean>;
266
+ /**
267
+ * @private
268
+ * @param reason
269
+ * @param result
270
+ */
271
+ private endActiveDialog;
272
+ }