@microsoft/agents-hosting 1.0.0 → 1.0.3-g444d99f704
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/package.json +2 -2
- package/dist/src/activityHandler.d.ts +0 -1
- package/dist/src/activityHandler.js +0 -1
- package/dist/src/activityHandler.js.map +1 -1
- package/dist/src/agent-client/agentResponseHandler.d.ts +6 -6
- package/dist/src/agent-client/agentResponseHandler.js +6 -6
- package/dist/src/app/adaptiveCards/adaptiveCardsActions.d.ts +12 -4
- package/dist/src/app/adaptiveCards/adaptiveCardsActions.js +5 -1
- package/dist/src/app/adaptiveCards/adaptiveCardsActions.js.map +1 -1
- package/dist/src/app/agentApplication.d.ts +24 -7
- package/dist/src/app/agentApplication.js +24 -7
- package/dist/src/app/agentApplication.js.map +1 -1
- package/dist/src/app/appRoute.d.ts +8 -4
- package/dist/src/app/attachmentDownloader.d.ts +3 -1
- package/dist/src/app/attachmentDownloader.js +3 -1
- package/dist/src/app/attachmentDownloader.js.map +1 -1
- package/dist/src/app/authorization.d.ts +26 -18
- package/dist/src/app/authorization.js +26 -18
- package/dist/src/app/authorization.js.map +1 -1
- package/dist/src/app/routeRank.d.ts +10 -3
- package/dist/src/app/routeRank.js +10 -3
- package/dist/src/app/routeRank.js.map +1 -1
- package/dist/src/app/streaming/streamingResponse.d.ts +23 -2
- package/dist/src/app/streaming/streamingResponse.js +23 -2
- package/dist/src/app/streaming/streamingResponse.js.map +1 -1
- package/dist/src/app/turnState.d.ts +69 -19
- package/dist/src/app/turnState.js +69 -19
- package/dist/src/app/turnState.js.map +1 -1
- package/dist/src/auth/authConfiguration.d.ts +16 -9
- package/dist/src/auth/authConfiguration.js +11 -6
- package/dist/src/auth/authConfiguration.js.map +1 -1
- package/dist/src/auth/jwt-middleware.js +26 -18
- package/dist/src/auth/jwt-middleware.js.map +1 -1
- package/dist/src/cards/adaptiveCard.d.ts +1 -1
- package/dist/src/headerPropagation.d.ts +18 -6
- package/dist/src/state/agentState.d.ts +23 -7
- package/dist/src/state/agentState.js +19 -7
- package/dist/src/state/agentState.js.map +1 -1
- package/dist/src/state/agentStatePropertyAccesor.d.ts +63 -41
- package/dist/src/state/agentStatePropertyAccesor.js +43 -32
- package/dist/src/state/agentStatePropertyAccesor.js.map +1 -1
- package/dist/src/storage/fileStorage.d.ts +8 -6
- package/dist/src/storage/fileStorage.js +8 -6
- package/dist/src/storage/fileStorage.js.map +1 -1
- package/dist/src/storage/memoryStorage.d.ts +12 -7
- package/dist/src/storage/memoryStorage.js +12 -7
- package/dist/src/storage/memoryStorage.js.map +1 -1
- package/dist/src/storage/storage.d.ts +18 -1
- package/dist/src/turnContext.d.ts +31 -20
- package/dist/src/turnContext.js +31 -20
- package/dist/src/turnContext.js.map +1 -1
- package/package.json +2 -2
- package/src/activityHandler.ts +0 -1
- package/src/agent-client/agentResponseHandler.ts +6 -6
- package/src/app/adaptiveCards/adaptiveCardsActions.ts +12 -4
- package/src/app/agentApplication.ts +24 -7
- package/src/app/appRoute.ts +8 -4
- package/src/app/attachmentDownloader.ts +3 -1
- package/src/app/authorization.ts +26 -18
- package/src/app/routeRank.ts +10 -3
- package/src/app/streaming/streamingResponse.ts +23 -2
- package/src/app/turnState.ts +69 -19
- package/src/auth/authConfiguration.ts +16 -9
- package/src/auth/jwt-middleware.ts +24 -17
- package/src/cards/adaptiveCard.ts +1 -1
- package/src/headerPropagation.ts +18 -6
- package/src/state/agentState.ts +23 -7
- package/src/state/agentStatePropertyAccesor.ts +63 -41
- package/src/storage/fileStorage.ts +8 -6
- package/src/storage/memoryStorage.ts +12 -7
- package/src/storage/storage.ts +18 -1
- package/src/turnContext.ts +31 -20
package/src/turnContext.ts
CHANGED
|
@@ -105,14 +105,15 @@ export class TurnContext {
|
|
|
105
105
|
/**
|
|
106
106
|
* Sends a trace activity for debugging purposes.
|
|
107
107
|
*
|
|
108
|
-
* Trace activities are typically used for debugging and are only visible in
|
|
109
|
-
* channels that support them, like the Bot Framework Emulator.
|
|
110
|
-
*
|
|
111
108
|
* @param name The name/category of the trace
|
|
112
109
|
* @param value The value/data to include in the trace
|
|
113
110
|
* @param valueType Optional type name for the value
|
|
114
111
|
* @param label Optional descriptive label for the trace
|
|
115
112
|
* @returns A promise that resolves to the resource response or undefined
|
|
113
|
+
*
|
|
114
|
+
* @remarks
|
|
115
|
+
* Trace activities are typically used for debugging and are only visible in
|
|
116
|
+
* channels that support them, like the Bot Framework Emulator.
|
|
116
117
|
*/
|
|
117
118
|
async sendTraceActivity (name: string, value?: any, valueType?: string, label?: string): Promise<ResourceResponse | undefined> {
|
|
118
119
|
const traceActivityObj = {
|
|
@@ -130,14 +131,15 @@ export class TurnContext {
|
|
|
130
131
|
/**
|
|
131
132
|
* Sends an activity to the sender of the incoming activity.
|
|
132
133
|
*
|
|
133
|
-
* This is the primary method used to respond to the user. It automatically
|
|
134
|
-
* addresses the response to the correct conversation and recipient using
|
|
135
|
-
* information from the incoming activity.
|
|
136
|
-
*
|
|
137
134
|
* @param activityOrText The activity to send or a string for a simple message
|
|
138
135
|
* @param speak Optional text to be spoken by the agent
|
|
139
136
|
* @param inputHint Optional input hint to indicate if the agent is expecting input
|
|
140
137
|
* @returns A promise that resolves to the resource response or undefined
|
|
138
|
+
*
|
|
139
|
+
* @remarks
|
|
140
|
+
* This is the primary method used to respond to the user. It automatically
|
|
141
|
+
* addresses the response to the correct conversation and recipient using
|
|
142
|
+
* information from the incoming activity.
|
|
141
143
|
*/
|
|
142
144
|
async sendActivity (activityOrText: string | Activity, speak?: string, inputHint?: string): Promise<ResourceResponse | undefined> {
|
|
143
145
|
let activityObject: {}
|
|
@@ -158,12 +160,13 @@ export class TurnContext {
|
|
|
158
160
|
/**
|
|
159
161
|
* Sends multiple activities to the sender of the incoming activity.
|
|
160
162
|
*
|
|
163
|
+
* @param activities The array of activities to send
|
|
164
|
+
* @returns A promise that resolves to an array of resource responses
|
|
165
|
+
*
|
|
166
|
+
* @remarks
|
|
161
167
|
* This method applies conversation references to each activity and
|
|
162
168
|
* emits them through the middleware chain before sending them to
|
|
163
169
|
* the adapter.
|
|
164
|
-
*
|
|
165
|
-
* @param activities The array of activities to send
|
|
166
|
-
* @returns A promise that resolves to an array of resource responses
|
|
167
170
|
*/
|
|
168
171
|
async sendActivities (activities: Activity[]): Promise<ResourceResponse[]> {
|
|
169
172
|
let sentNonTraceActivity = false
|
|
@@ -215,11 +218,12 @@ export class TurnContext {
|
|
|
215
218
|
/**
|
|
216
219
|
* Updates an existing activity in the conversation.
|
|
217
220
|
*
|
|
218
|
-
* This can be used to edit previously sent activities, for example to
|
|
219
|
-
* update the content of an adaptive card or change a message.
|
|
220
|
-
*
|
|
221
221
|
* @param activity The activity to update with its ID specified
|
|
222
222
|
* @returns A promise that resolves when the activity has been updated
|
|
223
|
+
*
|
|
224
|
+
* @remarks
|
|
225
|
+
* This can be used to edit previously sent activities, for example to
|
|
226
|
+
* update the content of an adaptive card or change a message.
|
|
223
227
|
*/
|
|
224
228
|
async updateActivity (activity: Activity): Promise<void> {
|
|
225
229
|
const ref: ConversationReference = this.activity.getConversationReference()
|
|
@@ -281,11 +285,12 @@ export class TurnContext {
|
|
|
281
285
|
/**
|
|
282
286
|
* Registers a handler for intercepting and processing activities being sent.
|
|
283
287
|
*
|
|
284
|
-
* This method follows a middleware pattern, allowing multiple handlers to
|
|
285
|
-
* be chained together. Handlers can modify activities or inject new ones.
|
|
286
|
-
*
|
|
287
288
|
* @param handler The handler to register
|
|
288
289
|
* @returns The current TurnContext instance for chaining
|
|
290
|
+
*
|
|
291
|
+
* @remarks
|
|
292
|
+
* This method follows a middleware pattern, allowing multiple handlers to
|
|
293
|
+
* be chained together. Handlers can modify activities or inject new ones.
|
|
289
294
|
*/
|
|
290
295
|
onSendActivities (handler: SendActivitiesHandler): this {
|
|
291
296
|
this._onSendActivities.push(handler)
|
|
@@ -329,6 +334,7 @@ export class TurnContext {
|
|
|
329
334
|
/**
|
|
330
335
|
* Gets the adapter that created this context.
|
|
331
336
|
*
|
|
337
|
+
* @remarks
|
|
332
338
|
* The adapter is responsible for sending and receiving activities
|
|
333
339
|
* to and from the user's channel.
|
|
334
340
|
*/
|
|
@@ -339,6 +345,7 @@ export class TurnContext {
|
|
|
339
345
|
/**
|
|
340
346
|
* Gets the incoming activity that started this turn.
|
|
341
347
|
*
|
|
348
|
+
* @remarks
|
|
342
349
|
* This is the activity that was received from the user or channel
|
|
343
350
|
* and triggered the creation of this context.
|
|
344
351
|
*/
|
|
@@ -349,6 +356,7 @@ export class TurnContext {
|
|
|
349
356
|
/**
|
|
350
357
|
* Gets or sets whether the turn has sent a response to the user.
|
|
351
358
|
*
|
|
359
|
+
* @remarks
|
|
352
360
|
* This is used to track whether the agent has responded to the user's
|
|
353
361
|
* activity. Once set to true, it cannot be set back to false.
|
|
354
362
|
*/
|
|
@@ -366,6 +374,7 @@ export class TurnContext {
|
|
|
366
374
|
/**
|
|
367
375
|
* Gets or sets the locale for the turn.
|
|
368
376
|
*
|
|
377
|
+
* @remarks
|
|
369
378
|
* The locale affects language-dependent operations like
|
|
370
379
|
* formatting dates or numbers.
|
|
371
380
|
*/
|
|
@@ -390,6 +399,7 @@ export class TurnContext {
|
|
|
390
399
|
/**
|
|
391
400
|
* Gets the turn state collection for storing data during the turn.
|
|
392
401
|
*
|
|
402
|
+
* @remarks
|
|
393
403
|
* The turn state collection provides a dictionary-like interface
|
|
394
404
|
* for storing arbitrary data that needs to be accessible during
|
|
395
405
|
* the processing of the current turn.
|
|
@@ -405,15 +415,16 @@ export class TurnContext {
|
|
|
405
415
|
/**
|
|
406
416
|
* Emits events to registered middleware handlers.
|
|
407
417
|
*
|
|
408
|
-
* This internal method implements the middleware pattern, allowing
|
|
409
|
-
* handlers to be chained together with each having the option to
|
|
410
|
-
* short-circuit the chain.
|
|
411
|
-
*
|
|
412
418
|
* @param handlers Array of handlers to execute
|
|
413
419
|
* @param arg The argument to pass to each handler
|
|
414
420
|
* @param next The function to execute at the end of the middleware chain
|
|
415
421
|
* @returns A promise that resolves to the result from the handlers or next function
|
|
416
422
|
* @private
|
|
423
|
+
*
|
|
424
|
+
* @remarks
|
|
425
|
+
* This internal method implements the middleware pattern, allowing
|
|
426
|
+
* handlers to be chained together with each having the option to
|
|
427
|
+
* short-circuit the chain.
|
|
417
428
|
*/
|
|
418
429
|
private async emit<A, T>(handlers: Array<(context: TurnContext, arg: A, next: () => Promise<T>) => Promise<T>>, arg: A, next: () => Promise<T>): Promise<T> {
|
|
419
430
|
const runHandlers = async ([handler, ...remaining]: typeof handlers): Promise<T> => {
|