microsoft-agents-hosting-dialogs 0.10.0.dev2__py3-none-any.whl

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 (91) hide show
  1. microsoft_agents/hosting/dialogs/__init__.py +76 -0
  2. microsoft_agents/hosting/dialogs/_component_registration.py +30 -0
  3. microsoft_agents/hosting/dialogs/_telemetry_client.py +78 -0
  4. microsoft_agents/hosting/dialogs/choices/__init__.py +38 -0
  5. microsoft_agents/hosting/dialogs/choices/channel.py +121 -0
  6. microsoft_agents/hosting/dialogs/choices/choice_factory.py +262 -0
  7. microsoft_agents/hosting/dialogs/choices/choice_recognizer.py +148 -0
  8. microsoft_agents/hosting/dialogs/choices/find.py +242 -0
  9. microsoft_agents/hosting/dialogs/choices/models/__init__.py +23 -0
  10. microsoft_agents/hosting/dialogs/choices/models/choice.py +14 -0
  11. microsoft_agents/hosting/dialogs/choices/models/choice_factory_options.py +13 -0
  12. microsoft_agents/hosting/dialogs/choices/models/find_choices_options.py +28 -0
  13. microsoft_agents/hosting/dialogs/choices/models/find_values_options.py +31 -0
  14. microsoft_agents/hosting/dialogs/choices/models/found_choice.py +22 -0
  15. microsoft_agents/hosting/dialogs/choices/models/found_value.py +20 -0
  16. microsoft_agents/hosting/dialogs/choices/models/list_style.py +15 -0
  17. microsoft_agents/hosting/dialogs/choices/models/model_result.py +16 -0
  18. microsoft_agents/hosting/dialogs/choices/models/sorted_value.py +16 -0
  19. microsoft_agents/hosting/dialogs/choices/models/token.py +20 -0
  20. microsoft_agents/hosting/dialogs/choices/tokenizer.py +92 -0
  21. microsoft_agents/hosting/dialogs/component_dialog.py +284 -0
  22. microsoft_agents/hosting/dialogs/dialog.py +198 -0
  23. microsoft_agents/hosting/dialogs/dialog_component_registration.py +52 -0
  24. microsoft_agents/hosting/dialogs/dialog_container.py +31 -0
  25. microsoft_agents/hosting/dialogs/dialog_context.py +426 -0
  26. microsoft_agents/hosting/dialogs/dialog_extensions.py +201 -0
  27. microsoft_agents/hosting/dialogs/dialog_manager.py +189 -0
  28. microsoft_agents/hosting/dialogs/dialog_manager_result.py +17 -0
  29. microsoft_agents/hosting/dialogs/dialog_set.py +174 -0
  30. microsoft_agents/hosting/dialogs/dialog_state.py +20 -0
  31. microsoft_agents/hosting/dialogs/memory/__init__.py +24 -0
  32. microsoft_agents/hosting/dialogs/memory/component_memory_scopes_base.py +14 -0
  33. microsoft_agents/hosting/dialogs/memory/component_path_resolvers_base.py +15 -0
  34. microsoft_agents/hosting/dialogs/memory/dialog_path.py +33 -0
  35. microsoft_agents/hosting/dialogs/memory/dialog_state_manager.py +563 -0
  36. microsoft_agents/hosting/dialogs/memory/dialog_state_manager_configuration.py +11 -0
  37. microsoft_agents/hosting/dialogs/memory/path_resolver_base.py +8 -0
  38. microsoft_agents/hosting/dialogs/memory/path_resolvers/__init__.py +19 -0
  39. microsoft_agents/hosting/dialogs/memory/path_resolvers/alias_path_resolver.py +53 -0
  40. microsoft_agents/hosting/dialogs/memory/path_resolvers/at_at_path_resolver.py +9 -0
  41. microsoft_agents/hosting/dialogs/memory/path_resolvers/at_path_resolver.py +44 -0
  42. microsoft_agents/hosting/dialogs/memory/path_resolvers/dollar_path_resolver.py +9 -0
  43. microsoft_agents/hosting/dialogs/memory/path_resolvers/hash_path_resolver.py +9 -0
  44. microsoft_agents/hosting/dialogs/memory/path_resolvers/percent_path_resolver.py +9 -0
  45. microsoft_agents/hosting/dialogs/memory/scope_path.py +38 -0
  46. microsoft_agents/hosting/dialogs/memory/scopes/__init__.py +31 -0
  47. microsoft_agents/hosting/dialogs/memory/scopes/bot_state_memory_scope.py +66 -0
  48. microsoft_agents/hosting/dialogs/memory/scopes/class_memory_scope.py +64 -0
  49. microsoft_agents/hosting/dialogs/memory/scopes/conversation_memory_scope.py +12 -0
  50. microsoft_agents/hosting/dialogs/memory/scopes/dialog_class_memory_scope.py +52 -0
  51. microsoft_agents/hosting/dialogs/memory/scopes/dialog_context_memory_scope.py +68 -0
  52. microsoft_agents/hosting/dialogs/memory/scopes/dialog_memory_scope.py +75 -0
  53. microsoft_agents/hosting/dialogs/memory/scopes/memory_scope.py +91 -0
  54. microsoft_agents/hosting/dialogs/memory/scopes/settings_memory_scope.py +38 -0
  55. microsoft_agents/hosting/dialogs/memory/scopes/this_memory_scope.py +36 -0
  56. microsoft_agents/hosting/dialogs/memory/scopes/turn_memory_scope.py +86 -0
  57. microsoft_agents/hosting/dialogs/memory/scopes/user_memory_scope.py +12 -0
  58. microsoft_agents/hosting/dialogs/models/__init__.py +15 -0
  59. microsoft_agents/hosting/dialogs/models/dialog_event.py +13 -0
  60. microsoft_agents/hosting/dialogs/models/dialog_events.py +12 -0
  61. microsoft_agents/hosting/dialogs/models/dialog_instance.py +28 -0
  62. microsoft_agents/hosting/dialogs/models/dialog_reason.py +34 -0
  63. microsoft_agents/hosting/dialogs/models/dialog_turn_result.py +17 -0
  64. microsoft_agents/hosting/dialogs/models/dialog_turn_status.py +26 -0
  65. microsoft_agents/hosting/dialogs/object_path.py +315 -0
  66. microsoft_agents/hosting/dialogs/persisted_state.py +22 -0
  67. microsoft_agents/hosting/dialogs/persisted_state_keys.py +8 -0
  68. microsoft_agents/hosting/dialogs/prompts/__init__.py +41 -0
  69. microsoft_agents/hosting/dialogs/prompts/activity_prompt.py +203 -0
  70. microsoft_agents/hosting/dialogs/prompts/attachment_prompt.py +87 -0
  71. microsoft_agents/hosting/dialogs/prompts/choice_prompt.py +156 -0
  72. microsoft_agents/hosting/dialogs/prompts/confirm_prompt.py +161 -0
  73. microsoft_agents/hosting/dialogs/prompts/datetime_prompt.py +90 -0
  74. microsoft_agents/hosting/dialogs/prompts/datetime_resolution.py +16 -0
  75. microsoft_agents/hosting/dialogs/prompts/number_prompt.py +81 -0
  76. microsoft_agents/hosting/dialogs/prompts/oauth_prompt.py +569 -0
  77. microsoft_agents/hosting/dialogs/prompts/oauth_prompt_settings.py +43 -0
  78. microsoft_agents/hosting/dialogs/prompts/prompt.py +224 -0
  79. microsoft_agents/hosting/dialogs/prompts/prompt_culture_models.py +222 -0
  80. microsoft_agents/hosting/dialogs/prompts/prompt_options.py +42 -0
  81. microsoft_agents/hosting/dialogs/prompts/prompt_recognizer_result.py +11 -0
  82. microsoft_agents/hosting/dialogs/prompts/prompt_validator.py +0 -0
  83. microsoft_agents/hosting/dialogs/prompts/prompt_validator_context.py +44 -0
  84. microsoft_agents/hosting/dialogs/prompts/text_prompt.py +82 -0
  85. microsoft_agents/hosting/dialogs/waterfall_dialog.py +266 -0
  86. microsoft_agents/hosting/dialogs/waterfall_step_context.py +109 -0
  87. microsoft_agents_hosting_dialogs-0.10.0.dev2.dist-info/METADATA +87 -0
  88. microsoft_agents_hosting_dialogs-0.10.0.dev2.dist-info/RECORD +91 -0
  89. microsoft_agents_hosting_dialogs-0.10.0.dev2.dist-info/WHEEL +5 -0
  90. microsoft_agents_hosting_dialogs-0.10.0.dev2.dist-info/licenses/LICENSE +21 -0
  91. microsoft_agents_hosting_dialogs-0.10.0.dev2.dist-info/top_level.txt +1 -0
@@ -0,0 +1,266 @@
1
+ # Copyright (c) Microsoft Corporation. All rights reserved.
2
+ # Licensed under the MIT License.
3
+
4
+ import uuid
5
+ from typing import Callable
6
+
7
+ from microsoft_agents.hosting.core import TurnContext
8
+ from microsoft_agents.activity import ActivityTypes
9
+
10
+ from .models.dialog_reason import DialogReason
11
+ from .dialog import Dialog
12
+ from .models.dialog_turn_result import DialogTurnResult
13
+ from .dialog_context import DialogContext
14
+ from .models.dialog_instance import DialogInstance
15
+ from .waterfall_step_context import WaterfallStepContext
16
+
17
+
18
+ class WaterfallDialog(Dialog):
19
+ """A dialog composed of a fixed, ordered sequence of steps (a waterfall).
20
+
21
+ Each step receives a :class:`WaterfallStepContext` and must either:
22
+
23
+ * return :attr:`Dialog.end_of_turn` to wait for user input before proceeding
24
+ to the next step, or
25
+ * call ``await step.next(result)`` / ``await step.begin_dialog(...)`` /
26
+ ``await step.end_dialog(...)`` to advance the flow explicitly.
27
+
28
+ Steps are invoked in order. When the last step completes the dialog ends and
29
+ its result is returned to the parent (if any). If the waterfall has *no*
30
+ steps at all, ``begin_dialog`` completes immediately with ``None`` as the
31
+ result.
32
+
33
+ Telemetry events emitted: ``WaterfallStart``, ``WaterfallStep``,
34
+ ``WaterfallComplete``, and ``WaterfallCancel``.
35
+ """
36
+
37
+ PersistedOptions = "options"
38
+ StepIndex = "stepIndex"
39
+ PersistedValues = "values"
40
+ PersistedInstanceId = "instanceId"
41
+
42
+ def __init__(self, dialog_id: str, steps: list | None = None):
43
+ """Creates a new WaterfallDialog.
44
+
45
+ :param dialog_id: Unique ID for this dialog within its parent DialogSet.
46
+ :param steps: Optional list of async callables (step functions). Each callable
47
+ must accept a single :class:`WaterfallStepContext` and return a
48
+ :class:`DialogTurnResult`. Pass ``None`` or omit to start with an empty
49
+ waterfall and add steps later with :meth:`add_step`.
50
+ :raises TypeError: If ``steps`` is not a list.
51
+ """
52
+ super(WaterfallDialog, self).__init__(dialog_id)
53
+ if not steps:
54
+ self._steps = []
55
+ else:
56
+ if not isinstance(steps, list):
57
+ raise TypeError("WaterfallDialog(): steps must be list of steps")
58
+ self._steps = steps
59
+
60
+ def add_step(self, step: Callable):
61
+ """
62
+ Adds a new step to the waterfall.
63
+ :param step: Step to add
64
+ :return: Waterfall dialog for fluent calls to `add_step()`.
65
+ """
66
+ if not step:
67
+ raise TypeError("WaterfallDialog.add_step(): step cannot be None.")
68
+
69
+ self._steps.append(step)
70
+ return self
71
+
72
+ async def begin_dialog(
73
+ self, dialog_context: DialogContext, options: object = None
74
+ ) -> DialogTurnResult:
75
+ """Starts the waterfall from the first step.
76
+
77
+ Initialises persisted state (options, values, step index, instance ID) and
78
+ immediately runs step 0. If the waterfall has no steps the dialog ends at
79
+ once and returns ``None`` to the parent.
80
+
81
+ :param dialog_context: The dialog context for the current turn.
82
+ :param options: Optional argument passed through to every step as
83
+ :attr:`WaterfallStepContext.options`.
84
+ :return: The result of the first step, or a Complete result if there are
85
+ no steps.
86
+ """
87
+ if not dialog_context:
88
+ raise TypeError("WaterfallDialog.begin_dialog(): dc cannot be None.")
89
+
90
+ # Initialize waterfall state
91
+ assert dialog_context.active_dialog is not None
92
+ state = dialog_context.active_dialog.state
93
+
94
+ instance_id = str(uuid.uuid1())
95
+ state[self.PersistedOptions] = options
96
+ state[self.PersistedValues] = {}
97
+ state[self.PersistedInstanceId] = instance_id
98
+
99
+ properties = {}
100
+ properties["DialogId"] = self.id
101
+ properties["InstanceId"] = instance_id
102
+ self.telemetry_client.track_event("WaterfallStart", properties)
103
+
104
+ # Run first step
105
+ return await self.run_step(dialog_context, 0, DialogReason.BeginCalled, None)
106
+
107
+ async def continue_dialog( # pylint: disable=unused-argument,arguments-differ
108
+ self,
109
+ dialog_context: DialogContext | None = None,
110
+ reason: DialogReason | None = None,
111
+ result: object = None,
112
+ ) -> DialogTurnResult:
113
+ """Continues the waterfall on the next incoming activity.
114
+
115
+ Non-message activities are ignored (returns :attr:`Dialog.end_of_turn`).
116
+ For message activities the user's text is forwarded as the result of the
117
+ previous step via :meth:`resume_dialog`.
118
+
119
+ :param dialog_context: The dialog context for the current turn.
120
+ :return: The result of resuming the current step.
121
+ """
122
+ if not dialog_context:
123
+ raise TypeError("WaterfallDialog.continue_dialog(): dc cannot be None.")
124
+
125
+ if dialog_context.context.activity.type != ActivityTypes.message:
126
+ return Dialog.end_of_turn
127
+
128
+ return await self.resume_dialog(
129
+ dialog_context,
130
+ DialogReason.ContinueCalled,
131
+ dialog_context.context.activity.text,
132
+ )
133
+
134
+ async def resume_dialog(
135
+ self, dialog_context: DialogContext, reason: DialogReason, result: object
136
+ ):
137
+ """Advances the waterfall to the next step, passing ``result`` as the previous
138
+ step's output.
139
+
140
+ Called automatically by the dialog system when a child dialog completes or
141
+ when :meth:`WaterfallStepContext.next` is called explicitly.
142
+
143
+ :param dialog_context: The dialog context for the current turn.
144
+ :param reason: Why the dialog is being resumed.
145
+ :param result: Value returned by the child dialog or previous step.
146
+ :return: The result of running the next step.
147
+ """
148
+ if dialog_context is None:
149
+ raise TypeError("WaterfallDialog.resume_dialog(): dc cannot be None.")
150
+
151
+ # Increment step index and run step
152
+ assert dialog_context.active_dialog is not None
153
+ state = dialog_context.active_dialog.state
154
+
155
+ return await self.run_step(
156
+ dialog_context, state[self.StepIndex] + 1, reason, result
157
+ )
158
+
159
+ async def end_dialog( # pylint: disable=unused-argument
160
+ self, context: TurnContext, instance: DialogInstance, reason: DialogReason
161
+ ) -> None:
162
+ """Emits telemetry events when the waterfall is cancelled or completes normally.
163
+
164
+ :param context: The context for the current turn (unused by this implementation).
165
+ :param instance: The dialog instance being ended.
166
+ :param reason: Why the dialog is ending.
167
+ """
168
+ if reason is DialogReason.CancelCalled:
169
+ index = instance.state[self.StepIndex]
170
+ step_name = self.get_step_name(index)
171
+ instance_id = str(instance.state[self.PersistedInstanceId])
172
+ properties = {
173
+ "DialogId": self.id,
174
+ "StepName": step_name,
175
+ "InstanceId": instance_id,
176
+ }
177
+ self.telemetry_client.track_event("WaterfallCancel", properties)
178
+ else:
179
+ if reason is DialogReason.EndCalled:
180
+ instance_id = str(instance.state[self.PersistedInstanceId])
181
+ properties = {"DialogId": self.id, "InstanceId": instance_id}
182
+ self.telemetry_client.track_event("WaterfallComplete", properties)
183
+
184
+ return
185
+
186
+ async def on_step(self, step_context: WaterfallStepContext) -> DialogTurnResult:
187
+ """Invokes a single waterfall step and emits a ``WaterfallStep`` telemetry event.
188
+
189
+ Override this method to add custom logic before or after each step executes.
190
+
191
+ :param step_context: Context for the current step.
192
+ :return: The result of the step function.
193
+ """
194
+ step_name = self.get_step_name(step_context.index)
195
+ assert step_context.active_dialog is not None
196
+ instance_id = str(step_context.active_dialog.state[self.PersistedInstanceId])
197
+ properties = {
198
+ "DialogId": self.id,
199
+ "StepName": step_name,
200
+ "InstanceId": instance_id,
201
+ }
202
+ self.telemetry_client.track_event("WaterfallStep", properties)
203
+ result = await self._steps[step_context.index](step_context)
204
+ if result is None:
205
+ raise TypeError(
206
+ f"WaterfallDialog '{self.id}' step '{step_name}' (index {step_context.index}) "
207
+ "returned None. Each step must return 'Dialog.end_of_turn' or a DialogTurnResult."
208
+ )
209
+ return result
210
+
211
+ async def run_step(
212
+ self,
213
+ dialog_context: DialogContext,
214
+ index: int,
215
+ reason: DialogReason,
216
+ result: object,
217
+ ) -> DialogTurnResult:
218
+ """Executes a specific step by index, or ends the dialog if the index is past the
219
+ last step.
220
+
221
+ Saves the step index into persisted state, constructs a
222
+ :class:`WaterfallStepContext`, and delegates to :meth:`on_step`.
223
+
224
+ :param dialog_context: The dialog context for the current turn.
225
+ :param index: Zero-based index of the step to run.
226
+ :param reason: The reason this step is being executed.
227
+ :param result: Value from the previous step or child dialog.
228
+ :return: The step result, or the dialog completion result if all steps are done.
229
+ """
230
+ if not dialog_context:
231
+ raise TypeError(
232
+ "WaterfallDialog.run_steps(): dialog_context cannot be None."
233
+ )
234
+ if index < len(self._steps):
235
+ # Update persisted step index
236
+ assert dialog_context.active_dialog is not None
237
+ state = dialog_context.active_dialog.state
238
+ state[self.StepIndex] = index
239
+
240
+ # Create step context
241
+ options = state[self.PersistedOptions]
242
+ values = state[self.PersistedValues]
243
+ step_context = WaterfallStepContext(
244
+ self, dialog_context, options, values, index, reason, result
245
+ )
246
+ return await self.on_step(step_context)
247
+
248
+ # End of waterfall so just return any result to parent
249
+ return await dialog_context.end_dialog(result)
250
+
251
+ def get_step_name(self, index: int) -> str:
252
+ """Returns a human-readable name for the step at ``index``.
253
+
254
+ Uses ``__qualname__`` of the step callable. Falls back to
255
+ ``"Step{n}of{total}"`` for anonymous lambdas or callables without a
256
+ meaningful qualified name.
257
+
258
+ :param index: Zero-based step index.
259
+ :return: A descriptive step name suitable for telemetry.
260
+ """
261
+ step_name = self._steps[index].__qualname__
262
+
263
+ if not step_name or step_name.endswith("<lambda>"):
264
+ step_name = f"Step{index + 1}of{len(self._steps)}"
265
+
266
+ return step_name
@@ -0,0 +1,109 @@
1
+ # Copyright (c) Microsoft Corporation. All rights reserved.
2
+ # Licensed under the MIT License.
3
+
4
+ from .dialog_context import DialogContext
5
+ from .models.dialog_reason import DialogReason
6
+ from .models.dialog_turn_result import DialogTurnResult
7
+ from .dialog_state import DialogState
8
+
9
+
10
+ class WaterfallStepContext(DialogContext):
11
+ """Context passed to each step function in a :class:`WaterfallDialog`.
12
+
13
+ Inherits from :class:`DialogContext` so step functions can call
14
+ :meth:`begin_dialog`, :meth:`prompt`, :meth:`end_dialog`, etc. directly on
15
+ the step context.
16
+
17
+ In addition to the standard :class:`DialogContext` interface, a step context
18
+ provides read-only properties for the current step index, the options passed
19
+ to the waterfall, the reason this step is executing, the result from the
20
+ previous step (or child dialog), and a shared ``values`` dict that persists
21
+ across all steps of the same waterfall instance.
22
+
23
+ Call :meth:`next` to skip ahead to the next step without waiting for user
24
+ input. Calling :meth:`next` more than once in the same step raises an
25
+ exception.
26
+ """
27
+
28
+ def __init__(
29
+ self,
30
+ parent,
31
+ dc: DialogContext,
32
+ options: object,
33
+ values: dict[str, object],
34
+ index: int,
35
+ reason: DialogReason,
36
+ result: object = None,
37
+ ):
38
+ super(WaterfallStepContext, self).__init__(
39
+ dc.dialogs, dc.context, DialogState(dc.stack)
40
+ )
41
+ self._wf_parent = parent
42
+ self._next_called = False
43
+ self._index = index
44
+ self._options = options
45
+ self._reason = reason
46
+ self._result = result
47
+ self._values = values
48
+ self.parent = dc.parent
49
+
50
+ @property
51
+ def index(self) -> int:
52
+ """Zero-based index of the currently executing step."""
53
+ return self._index
54
+
55
+ @property
56
+ def options(self) -> object:
57
+ """Options originally passed to :meth:`WaterfallDialog.begin_dialog`.
58
+ Shared across all steps of the same waterfall run.
59
+ """
60
+ return self._options
61
+
62
+ @property
63
+ def reason(self) -> DialogReason:
64
+ """Why this step is executing (e.g. ``BeginCalled``, ``ContinueCalled``,
65
+ ``NextCalled``).
66
+ """
67
+ return self._reason
68
+
69
+ @property
70
+ def result(self) -> object:
71
+ """The value returned by the previous step or a child dialog that was
72
+ started from the previous step. ``None`` for the first step.
73
+ """
74
+ return self._result
75
+
76
+ @property
77
+ def values(self) -> dict[str, object]:
78
+ """A dictionary that persists across every step of the same waterfall
79
+ instance. Use it to accumulate data collected across multiple steps.
80
+
81
+ .. note::
82
+ Values stored here are scoped to the current waterfall run only and
83
+ are lost when the waterfall ends.
84
+ """
85
+ return self._values
86
+
87
+ async def next(self, result: object) -> DialogTurnResult:
88
+ """Skips to the next step of the waterfall, passing ``result`` as the
89
+ previous step's output.
90
+
91
+ This is useful when a step wants to bypass waiting for user input and
92
+ advance immediately (e.g. when data was already available).
93
+
94
+ :param result: Value to pass to the next step as
95
+ :attr:`WaterfallStepContext.result`.
96
+ :raises Exception: If called more than once within the same step.
97
+ :return: The result of running the next step.
98
+ """
99
+ if self._next_called is True:
100
+ raise Exception(
101
+ "WaterfallStepContext.next(): method already called for dialog and step '%s'[%s]."
102
+ % (self._wf_parent.id, self._index)
103
+ )
104
+
105
+ # Trigger next step
106
+ self._next_called = True
107
+ return await self._wf_parent.resume_dialog(
108
+ self, DialogReason.NextCalled, result
109
+ )
@@ -0,0 +1,87 @@
1
+ Metadata-Version: 2.4
2
+ Name: microsoft-agents-hosting-dialogs
3
+ Version: 0.10.0.dev2
4
+ Summary: Dialog system for Microsoft Agents (waterfall dialogs, prompts, choices)
5
+ Author: Microsoft Corporation
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/microsoft/Agents
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: Programming Language :: Python :: 3.14
14
+ Classifier: Operating System :: OS Independent
15
+ Requires-Python: >=3.10
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: microsoft-agents-hosting-core==0.10.0.dev2
19
+ Requires-Dist: recognizers-text-number>=1.0.1a0
20
+ Requires-Dist: recognizers-text-choice>=1.0.1a0
21
+ Requires-Dist: recognizers-text-date-time>=1.0.1a0
22
+ Requires-Dist: babel>=2.9.0
23
+ Requires-Dist: emoji<2.0.0
24
+ Dynamic: license-file
25
+ Dynamic: requires-dist
26
+
27
+ # Microsoft Agents Hosting - Dialogs
28
+
29
+ [![PyPI version](https://img.shields.io/pypi/v/microsoft-agents-hosting-dialogs)](https://pypi.org/project/microsoft-agents-hosting-dialogs/)
30
+
31
+ Dialog system for the Microsoft 365 Agents SDK. Provides waterfall dialogs, prompts, choice recognition, and multi-turn conversation management.
32
+
33
+ This library is a port of the botbuilder-dialogs library to the new Microsoft 365 Agents SDK. It provides the same dialog primitives (WaterfallDialog, ComponentDialog, DialogSet, DialogContext) and prompts (TextPrompt, NumberPrompt, ChoicePrompt, ConfirmPrompt, DateTimePrompt, OAuthPrompt, etc.) with updated imports and patterns for the new SDK.
34
+
35
+ ## What is this?
36
+
37
+ This library is part of the **Microsoft 365 Agents SDK for Python** - a comprehensive framework for building enterprise-grade conversational AI agents. The dialogs library enables developers to structure multi-turn conversations with reusable, composable dialog primitives.
38
+
39
+ ## Key Features
40
+
41
+ - **WaterfallDialog**: Sequential step-by-step conversation flows
42
+ - **ComponentDialog**: Composable, encapsulated dialog components
43
+ - **Prompts**: Built-in prompts for text, numbers, choices, confirmations, dates, attachments, and OAuth
44
+ - **Choice recognition**: Locale-aware choice matching and recognition
45
+ - **Dialog memory**: Scoped memory management (conversation, user, dialog, class, settings)
46
+ - **DialogManager**: High-level dialog orchestration with state management
47
+
48
+ ## Installation
49
+
50
+ ```bash
51
+ pip install microsoft-agents-hosting-dialogs
52
+ ```
53
+
54
+ ## Quick Start
55
+
56
+ ```python
57
+ from microsoft_agents.hosting.dialogs import (
58
+ WaterfallDialog,
59
+ WaterfallStepContext,
60
+ DialogSet,
61
+ DialogTurnStatus,
62
+ )
63
+ from microsoft_agents.hosting.dialogs.prompts import TextPrompt, PromptOptions
64
+ from microsoft_agents.hosting.core import ConversationState, MemoryStorage
65
+
66
+ storage = MemoryStorage()
67
+ conversation_state = ConversationState(storage)
68
+ dialog_state = conversation_state.create_property("DialogState")
69
+ dialogs = DialogSet(dialog_state)
70
+
71
+ async def step1(step: WaterfallStepContext):
72
+ return await step.prompt(
73
+ "text_prompt",
74
+ PromptOptions(prompt=MessageFactory.text("What is your name?"))
75
+ )
76
+
77
+ async def step2(step: WaterfallStepContext):
78
+ await step.context.send_activity(f"Hello, {step.result}!")
79
+ return await step.end_dialog()
80
+
81
+ dialogs.add(TextPrompt("text_prompt"))
82
+ dialogs.add(WaterfallDialog("main", [step1, step2]))
83
+ ```
84
+
85
+ ## Release Notes
86
+
87
+ See [CHANGELOG.md](https://github.com/microsoft/Agents/blob/main/CHANGELOG.md) for release history.
@@ -0,0 +1,91 @@
1
+ microsoft_agents/hosting/dialogs/__init__.py,sha256=ElpqRXx0QBSJcpkHrO-eEXPaS4iRejKiaVYfayrjLrY,2278
2
+ microsoft_agents/hosting/dialogs/_component_registration.py,sha256=ksWwMSwP5HPvfKxzT7E55QK1aOf3U8JHmgYG5rGPmJ0,859
3
+ microsoft_agents/hosting/dialogs/_telemetry_client.py,sha256=TKdNKEhqYXDNiAh2A-E7Sf5vbSEQntP8WDd2wHF29p4,1907
4
+ microsoft_agents/hosting/dialogs/component_dialog.py,sha256=pMe_lLEUdAi3smIiaVdYj-QAhdpKPSbnE7XN0RgHLAw,12543
5
+ microsoft_agents/hosting/dialogs/dialog.py,sha256=HJZhJf1FZ8Dc4XwjTfSGirpZUk-M2BoUMiFVqcW8i4o,8047
6
+ microsoft_agents/hosting/dialogs/dialog_component_registration.py,sha256=VBV6T3NAeO4Xmqo8BlQ5WnE0Px0chhobyyIjsJEXnRE,1459
7
+ microsoft_agents/hosting/dialogs/dialog_container.py,sha256=4AUQpEkW70w6B1ZDYuyl4GKBG4-D0QAbzoNFrKnrVVY,947
8
+ microsoft_agents/hosting/dialogs/dialog_context.py,sha256=Hs2Sc3htYH5Ealg-QHMIcTqTSzjaE-Gokequ2bMmpDg,16041
9
+ microsoft_agents/hosting/dialogs/dialog_extensions.py,sha256=6slEe3JRgEO5DOinymaPLvSugozmU0xTuLNWKQa1MhQ,7789
10
+ microsoft_agents/hosting/dialogs/dialog_manager.py,sha256=eqyCwpcvQpIrgTDtkijJpgAW7S-JdqyPNJxUVZ_6CaU,6856
11
+ microsoft_agents/hosting/dialogs/dialog_manager_result.py,sha256=7hFJioD3-janxy1pgezsqDBnRsnoTyrZjG9N7gS1xzI,485
12
+ microsoft_agents/hosting/dialogs/dialog_set.py,sha256=1K98Ki-Yqk9jbiUA7ZFiuv7pRw94EtHwtBTy-ruRLX8,6350
13
+ microsoft_agents/hosting/dialogs/dialog_state.py,sha256=XBsEWkEsJf1sBDFdealNa4FaPcnwCF_RCXBSWssJsIo,511
14
+ microsoft_agents/hosting/dialogs/object_path.py,sha256=q9xMYzArxU0_tzoqKJVVdOr2Etrs72T9646rHaZeQf8,10120
15
+ microsoft_agents/hosting/dialogs/persisted_state.py,sha256=cRUO_CPbcZiqSqaswaXqBO3RH7jiLJruvJtlNEe6D_8,750
16
+ microsoft_agents/hosting/dialogs/persisted_state_keys.py,sha256=2HNgu7-PDP5moR0j7yi8wSwwJaXO38Ax9WWPTW0jJbU,240
17
+ microsoft_agents/hosting/dialogs/waterfall_dialog.py,sha256=454opr-yLwzcFLLqVax4n0ynM3FZIN2dcVUgxJG3Zqk,10876
18
+ microsoft_agents/hosting/dialogs/waterfall_step_context.py,sha256=LXBEreNC18qYLP8wD8_JZEb9jUl1GNPLt3uAbgzGyFQ,3877
19
+ microsoft_agents/hosting/dialogs/choices/__init__.py,sha256=fRxzQfUfbyLS8dye9wNGoGfulPJpjedE3KennzZT67I,1216
20
+ microsoft_agents/hosting/dialogs/choices/channel.py,sha256=7oXpqeJdSFd6unru9F6V5cEfBIwQawe0hgDsmY--sR4,4261
21
+ microsoft_agents/hosting/dialogs/choices/choice_factory.py,sha256=m8HEqmi77-6WWhgi9uOFkgY-C8evd1ZlCR-jNC-dSsM,9275
22
+ microsoft_agents/hosting/dialogs/choices/choice_recognizer.py,sha256=z2UbaeERM_Vodi3dHzsRh80wuCpn5e7p2P-1oFxCfcs,5318
23
+ microsoft_agents/hosting/dialogs/choices/find.py,sha256=BYhy9NpT1Nu5CXShx7EKJ1fO-eLY_yhsMq-HvCHtQCA,9341
24
+ microsoft_agents/hosting/dialogs/choices/tokenizer.py,sha256=3dmdyvmbV5MvPYWIkvk-kIcgVvK42Lg8by7R3KciazY,3082
25
+ microsoft_agents/hosting/dialogs/choices/models/__init__.py,sha256=HwLK2CZVzcOEmBnwI1rZcpgOdfqZc4QVuliuWj_U8Eg,610
26
+ microsoft_agents/hosting/dialogs/choices/models/choice.py,sha256=vsWz29WBlQwos-oso4vqm48w1LBSiKzIHo_5AIHl0Rs,325
27
+ microsoft_agents/hosting/dialogs/choices/models/choice_factory_options.py,sha256=FV1Nbde8VeFXNhU7V_0Syv-XStZyPj8mQAeRCmroOKE,315
28
+ microsoft_agents/hosting/dialogs/choices/models/find_choices_options.py,sha256=vBrV1fmVmCm_Ul0Cwb2ZTWzK3PYZAQ8LZ_3qK99KIUQ,936
29
+ microsoft_agents/hosting/dialogs/choices/models/find_values_options.py,sha256=vCNnqYdx9ldkrcUyXNxvxFGuHYt6Ft14ZKZAsSYlFTQ,1193
30
+ microsoft_agents/hosting/dialogs/choices/models/found_choice.py,sha256=qW7OuoacbpJL8ai5Zfn5ygL9l0evA_xJ2NU4qKd9vco,651
31
+ microsoft_agents/hosting/dialogs/choices/models/found_value.py,sha256=wrQkyhpsGGIasyZiWoSdABcCZh1hL1V7u7EAte27RqQ,533
32
+ microsoft_agents/hosting/dialogs/choices/models/list_style.py,sha256=K69MrsdX5ffMzptb6RZ1ecS2masr81H_FuDp9H3jcvo,320
33
+ microsoft_agents/hosting/dialogs/choices/models/model_result.py,sha256=vuOKk-W0lfkPvHw3j7Ps7Ui9hqto_aIs10Ccu342e-I,317
34
+ microsoft_agents/hosting/dialogs/choices/models/sorted_value.py,sha256=jJjgUj4e9QQEYBcsErXcCuXc3GbD-sjsQmPkH7k1JlU,407
35
+ microsoft_agents/hosting/dialogs/choices/models/token.py,sha256=gNWDeX09XbuomJZS8xgvfqU9Q45SjPDRtJ8NPjdAHB4,629
36
+ microsoft_agents/hosting/dialogs/memory/__init__.py,sha256=5KI3QWPVUBJRq6NSmDYfEL3AxcyE0Uu6iHGh5_92WMA,915
37
+ microsoft_agents/hosting/dialogs/memory/component_memory_scopes_base.py,sha256=Ois5K0R8pIJIeP8goCPJGftuwzg8Ap5vUxzYhZiFhjM,369
38
+ microsoft_agents/hosting/dialogs/memory/component_path_resolvers_base.py,sha256=dfb89B_U8dZK2izRKqUOv8YQhA4zhS25j4PsD387JLU,381
39
+ microsoft_agents/hosting/dialogs/memory/dialog_path.py,sha256=LZ7Y1Xa8a5j8mjpyfBNWgmCyyQ2MTEDTy4YZyzcuqWM,1044
40
+ microsoft_agents/hosting/dialogs/memory/dialog_state_manager.py,sha256=KTClTmoDa_28G-w2w1SLe8fMOl9uPeF4iqbjc7lA2Ik,19532
41
+ microsoft_agents/hosting/dialogs/memory/dialog_state_manager_configuration.py,sha256=QoDM1NAJbnl5PFD5a8yiOZvJRJrpqBewQgZl7nbxuSg,329
42
+ microsoft_agents/hosting/dialogs/memory/path_resolver_base.py,sha256=RKr3nhATZV94Qu80LaX7EnLtU9o6X-A0gefk7r00p_Y,165
43
+ microsoft_agents/hosting/dialogs/memory/scope_path.py,sha256=NXCy5UYFQfwV0_QUrSoSEcwx52l1UptfEXQ3Qdmc5FU,1242
44
+ microsoft_agents/hosting/dialogs/memory/path_resolvers/__init__.py,sha256=MNkNwMlYcZab8r6lyDk4CCkIJfiOHb0JcmXyB2LPh68,562
45
+ microsoft_agents/hosting/dialogs/memory/path_resolvers/alias_path_resolver.py,sha256=bgk5VmdxdOt-v6GEz9NEGACmyoTZYYdpD51OCCyzTgA,1937
46
+ microsoft_agents/hosting/dialogs/memory/path_resolvers/at_at_path_resolver.py,sha256=FanyfshfGk0r8rpzW1koU0SWAHWGLDPh94cT7V1YSgI,288
47
+ microsoft_agents/hosting/dialogs/memory/path_resolvers/at_path_resolver.py,sha256=GrbmHHB2zEWRCLMo1zuVv7Ecd0HVdxQuWc1IjGwoBhY,1304
48
+ microsoft_agents/hosting/dialogs/memory/path_resolvers/dollar_path_resolver.py,sha256=nwrmNN1wYjxd8xUJM3aKdoV6QO47SrFRXc9lKp-arcA,271
49
+ microsoft_agents/hosting/dialogs/memory/path_resolvers/hash_path_resolver.py,sha256=zd8RI6iWhMpchG7HVZeyn3CUXjOjr4AWnJt46xY53_w,286
50
+ microsoft_agents/hosting/dialogs/memory/path_resolvers/percent_path_resolver.py,sha256=MRMSlYtQJ6UsdNA6u4MIUukq1PleYfaKISq6KIESmsc,271
51
+ microsoft_agents/hosting/dialogs/memory/scopes/__init__.py,sha256=k2WGVIwJsN4-DnFhZ4CokGpodfbdE6FUqkj_FBBXopo,1206
52
+ microsoft_agents/hosting/dialogs/memory/scopes/bot_state_memory_scope.py,sha256=1FyORX9NDyg04Y4Fe9iioPwBoehtkFvtci8W8vw9XO4,2854
53
+ microsoft_agents/hosting/dialogs/memory/scopes/class_memory_scope.py,sha256=3JrAHFZfIOmrkBCYvKbQ91xegB9dWKn37MQnCbHMdOc,2324
54
+ microsoft_agents/hosting/dialogs/memory/scopes/conversation_memory_scope.py,sha256=SOJXg9kIPYhpQxsO0PC57yOYSwL7MakNQQ2FvM_b_6A,422
55
+ microsoft_agents/hosting/dialogs/memory/scopes/dialog_class_memory_scope.py,sha256=5fPyb9ap5A83VZBSGzcQb_gGGkcbv7eWmG6xYGdLHh8,1908
56
+ microsoft_agents/hosting/dialogs/memory/scopes/dialog_context_memory_scope.py,sha256=-YtSEMB4a-bqXKYZfJz0wE1e51V8A5_nWk8nrDPtV7I,2130
57
+ microsoft_agents/hosting/dialogs/memory/scopes/dialog_memory_scope.py,sha256=ScnWUGqabcRSEsAjRlz2rSscKm4uN1Fdl_pcIpQavj0,2940
58
+ microsoft_agents/hosting/dialogs/memory/scopes/memory_scope.py,sha256=xCwlsKqA1j8eh3KKPEbIFeuVJeLt-OEVjf4GkrNbcvs,3550
59
+ microsoft_agents/hosting/dialogs/memory/scopes/settings_memory_scope.py,sha256=olwRltTIuyNyNN7AAqRLJwty30ThzmTtf1X1Al_wVMw,1130
60
+ microsoft_agents/hosting/dialogs/memory/scopes/this_memory_scope.py,sha256=owiYgkoddPe7jATTLrgulRPSY6zr3akwc5bZ-AawxL4,1149
61
+ microsoft_agents/hosting/dialogs/memory/scopes/turn_memory_scope.py,sha256=7dNA7KIXHNuwPoXBFYz7rayMYXxdp4336tZnhk076AM,2787
62
+ microsoft_agents/hosting/dialogs/memory/scopes/user_memory_scope.py,sha256=5cZu_kF1e_y1w58Zrq2NWrGaEFcvglrnzJx6p0sByGI,390
63
+ microsoft_agents/hosting/dialogs/models/__init__.py,sha256=0PujLIRxMG6CDy0rTieXsAIFB7fj9RsPEU9JZmTw8vY,404
64
+ microsoft_agents/hosting/dialogs/models/dialog_event.py,sha256=Xy0DuZoNLa3Xls0AiDKSWpfwXBxb2HSgKSote4DNjJ0,251
65
+ microsoft_agents/hosting/dialogs/models/dialog_events.py,sha256=9e8viT0eeaGwlqO6YppP09hwKG0V38tB2B5VRSFEDds,372
66
+ microsoft_agents/hosting/dialogs/models/dialog_instance.py,sha256=6IBQBqmbBjc1Vumrv6GbQTOlNK8OJK-4DNCEWjreHRo,716
67
+ microsoft_agents/hosting/dialogs/models/dialog_reason.py,sha256=esWciUo1YCn8cGDA_NGTdOBQUzQ0AByBHDEHVVp8Evg,1174
68
+ microsoft_agents/hosting/dialogs/models/dialog_turn_result.py,sha256=WRVYkLMtKOfelhxKwJk32NZMw8ZVQcWFfhA23TjB01Q,392
69
+ microsoft_agents/hosting/dialogs/models/dialog_turn_status.py,sha256=8pZQ4BTIR5Xq2JRhzq_cM_pzIpjJVywtbpSaOcKWJLU,776
70
+ microsoft_agents/hosting/dialogs/prompts/__init__.py,sha256=xF6q9oVmVOOFLKYXHjW_oco7zaornhSr1auoliENjRQ,1414
71
+ microsoft_agents/hosting/dialogs/prompts/activity_prompt.py,sha256=R4aaaQWUcDnLIYlZIPSTnepXgwkLTEDYPWxvEnHBC1k,8207
72
+ microsoft_agents/hosting/dialogs/prompts/attachment_prompt.py,sha256=AxmfKgnEfZF8AHr0gZssNNM4noTI1S20rlvJMLHAdIs,3244
73
+ microsoft_agents/hosting/dialogs/prompts/choice_prompt.py,sha256=O6xbaNdCPX7hcrlO5R3bDeYRZvDbmi6jbmf1qXsTCdk,5563
74
+ microsoft_agents/hosting/dialogs/prompts/confirm_prompt.py,sha256=doS-wJEyRdFsrChIVrQW1Xf6zKIhZnPv-YTPsjjhCPM,6084
75
+ microsoft_agents/hosting/dialogs/prompts/datetime_prompt.py,sha256=0Fdx9NOOooF5DRCj9Osz2yG6l06cKpX3nFjXzpn8OvA,3080
76
+ microsoft_agents/hosting/dialogs/prompts/datetime_resolution.py,sha256=sgEpcpAMVyuu_6GdqpOlPL3NY2CBFHYbQYzFn79I9-U,399
77
+ microsoft_agents/hosting/dialogs/prompts/number_prompt.py,sha256=P_d1C4-rCaSGnXH04FfzrjYeiuI0StZgRV-ls8j0oV4,2680
78
+ microsoft_agents/hosting/dialogs/prompts/oauth_prompt.py,sha256=npyJ3YkHQFQkZvOBVhnblSD2wrcjvj40ifkfNMHs9bM,20915
79
+ microsoft_agents/hosting/dialogs/prompts/oauth_prompt_settings.py,sha256=S4ncnsne7u5C4OSErsCmzc_tDbLWbOdK09hiYUB0meg,2069
80
+ microsoft_agents/hosting/dialogs/prompts/prompt.py,sha256=TEnYY-RXM4555ZNYSzPw-FgXjaExf_4YloUexgPPzFA,7529
81
+ microsoft_agents/hosting/dialogs/prompts/prompt_culture_models.py,sha256=p6cuct2e2CezTy5sv7M0LeJm74YBHyIkyEG0ff7PNYM,6375
82
+ microsoft_agents/hosting/dialogs/prompts/prompt_options.py,sha256=tMempmXKMpMxTbgACqzVtbnAv-L5RvwAlsvz4gfFlbk,1807
83
+ microsoft_agents/hosting/dialogs/prompts/prompt_recognizer_result.py,sha256=iGWBrOuNzH3I1liS8h613ox16W9A5NMgcOnXDMlLcKA,388
84
+ microsoft_agents/hosting/dialogs/prompts/prompt_validator.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
85
+ microsoft_agents/hosting/dialogs/prompts/prompt_validator_context.py,sha256=7ZYjOmkpk321xw0D9CaSrAITrvQzKRWfWh46Pzi8q5s,1617
86
+ microsoft_agents/hosting/dialogs/prompts/text_prompt.py,sha256=nlTa8UjryuB0VwMx79GjUdg9uswCkk9ctYc8x-GDBb0,3356
87
+ microsoft_agents_hosting_dialogs-0.10.0.dev2.dist-info/licenses/LICENSE,sha256=ws_MuBL-SCEBqPBFl9_FqZkaaydIJmxHrJG2parhU4M,1141
88
+ microsoft_agents_hosting_dialogs-0.10.0.dev2.dist-info/METADATA,sha256=HptJhbwv147gFnXorFfBklyjwoRjO9em9ZO4OFP6sEs,3580
89
+ microsoft_agents_hosting_dialogs-0.10.0.dev2.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
90
+ microsoft_agents_hosting_dialogs-0.10.0.dev2.dist-info/top_level.txt,sha256=lWKcT4v6fTA_NgsuHdNvuMjSrkiBMXohn64ApY7Xi8A,17
91
+ microsoft_agents_hosting_dialogs-0.10.0.dev2.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Microsoft Corporation.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE