@microsoft/agents-hosting 1.7.0-beta.1.g8bcd4f11a7 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -0
- package/dist/package.json +3 -3
- package/dist/src/agent-client/agentClient.js +4 -3
- package/dist/src/agent-client/agentClient.js.map +1 -1
- package/dist/src/agent-client/agentResponseHandler.d.ts +25 -6
- package/dist/src/agent-client/agentResponseHandler.js +16 -55
- package/dist/src/agent-client/agentResponseHandler.js.map +1 -1
- package/dist/src/agent-client/createAgentResponseHandler.d.ts +48 -0
- package/dist/src/agent-client/createAgentResponseHandler.js +92 -0
- package/dist/src/agent-client/createAgentResponseHandler.js.map +1 -0
- package/dist/src/agent-client/index.d.ts +1 -0
- package/dist/src/agent-client/index.js +1 -0
- package/dist/src/agent-client/index.js.map +1 -1
- package/dist/src/app/adaptiveCards/activityValueParsers.js +2 -1
- package/dist/src/app/adaptiveCards/activityValueParsers.js.map +1 -1
- package/dist/src/app/adaptiveCards/adaptiveCardsActions.js +13 -12
- package/dist/src/app/adaptiveCards/adaptiveCardsActions.js.map +1 -1
- package/dist/src/app/agentApplication.js +8 -8
- package/dist/src/app/agentApplication.js.map +1 -1
- package/dist/src/app/streaming/streamingResponse.js +2 -2
- package/dist/src/app/streaming/streamingResponse.js.map +1 -1
- package/dist/src/app/turnState.d.ts +0 -1
- package/dist/src/app/turnState.js +15 -14
- package/dist/src/app/turnState.js.map +1 -1
- package/dist/src/app/turnStateProperty.js +4 -2
- package/dist/src/app/turnStateProperty.js.map +1 -1
- package/dist/src/auth/authConfiguration.js +5 -3
- package/dist/src/auth/authConfiguration.js.map +1 -1
- package/dist/src/auth/jwt-middleware.d.ts +2 -2
- package/dist/src/auth/jwt-middleware.js +84 -6
- package/dist/src/auth/jwt-middleware.js.map +1 -1
- package/dist/src/auth/msal/msalTokenProvider.js +16 -16
- package/dist/src/auth/msal/msalTokenProvider.js.map +1 -1
- package/dist/src/baseAdapter.js +3 -1
- package/dist/src/baseAdapter.js.map +1 -1
- package/dist/src/cloudAdapter.d.ts +2 -2
- package/dist/src/cloudAdapter.js +10 -10
- package/dist/src/cloudAdapter.js.map +1 -1
- package/dist/src/createCloudAdapter.d.ts +40 -0
- package/dist/src/createCloudAdapter.js +44 -0
- package/dist/src/createCloudAdapter.js.map +1 -0
- package/dist/src/errorHelper.js +206 -79
- package/dist/src/errorHelper.js.map +1 -1
- package/dist/src/headerPropagation.js +3 -1
- package/dist/src/headerPropagation.js.map +1 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/interfaces/index.d.ts +5 -0
- package/dist/src/interfaces/index.js +22 -0
- package/dist/src/interfaces/index.js.map +1 -0
- package/dist/src/interfaces/webResponse.d.ts +41 -0
- package/dist/src/interfaces/webResponse.js +7 -0
- package/dist/src/interfaces/webResponse.js.map +1 -0
- package/dist/src/middlewareSet.d.ts +0 -1
- package/dist/src/middlewareSet.js +4 -1
- package/dist/src/middlewareSet.js.map +1 -1
- package/dist/src/oauth/userTokenClient.js +2 -1
- package/dist/src/oauth/userTokenClient.js.map +1 -1
- package/dist/src/state/conversationState.js +4 -2
- package/dist/src/state/conversationState.js.map +1 -1
- package/dist/src/state/userState.js +4 -2
- package/dist/src/state/userState.js.map +1 -1
- package/dist/src/storage/memoryStorage.js +5 -3
- package/dist/src/storage/memoryStorage.js.map +1 -1
- package/dist/src/transcript/consoleTranscriptLogger.js +3 -1
- package/dist/src/transcript/consoleTranscriptLogger.js.map +1 -1
- package/dist/src/transcript/fileTranscriptLogger.js +5 -4
- package/dist/src/transcript/fileTranscriptLogger.js.map +1 -1
- package/dist/src/transcript/transcriptLoggerMiddleware.js +2 -1
- package/dist/src/transcript/transcriptLoggerMiddleware.js.map +1 -1
- package/dist/src/turnContext.js +2 -1
- package/dist/src/turnContext.js.map +1 -1
- package/package.json +3 -3
- package/src/agent-client/agentClient.ts +5 -4
- package/src/agent-client/agentResponseHandler.ts +43 -67
- package/src/agent-client/createAgentResponseHandler.ts +133 -0
- package/src/agent-client/index.ts +1 -0
- package/src/app/adaptiveCards/activityValueParsers.ts +3 -2
- package/src/app/adaptiveCards/adaptiveCardsActions.ts +5 -5
- package/src/app/agentApplication.ts +8 -16
- package/src/app/streaming/streamingResponse.ts +2 -2
- package/src/app/turnState.ts +15 -14
- package/src/app/turnStateProperty.ts +4 -2
- package/src/auth/authConfiguration.ts +5 -3
- package/src/auth/jwt-middleware.ts +87 -8
- package/src/auth/msal/msalTokenProvider.ts +16 -16
- package/src/baseAdapter.ts +3 -2
- package/src/cloudAdapter.ts +12 -12
- package/src/createCloudAdapter.ts +56 -0
- package/src/errorHelper.ts +244 -89
- package/src/headerPropagation.ts +4 -1
- package/src/index.ts +2 -0
- package/src/interfaces/index.ts +6 -0
- package/src/interfaces/webResponse.ts +44 -0
- package/src/middlewareSet.ts +3 -1
- package/src/oauth/userTokenClient.ts +3 -2
- package/src/state/conversationState.ts +4 -3
- package/src/state/userState.ts +4 -3
- package/src/storage/memoryStorage.ts +5 -3
- package/src/transcript/consoleTranscriptLogger.ts +3 -2
- package/src/transcript/fileTranscriptLogger.ts +6 -5
- package/src/transcript/transcriptLoggerMiddleware.ts +3 -2
- package/src/turnContext.ts +3 -2
|
@@ -9,7 +9,8 @@ import { TranscriptStore } from './transcriptStore'
|
|
|
9
9
|
import * as fs from 'fs/promises'
|
|
10
10
|
import * as path from 'path'
|
|
11
11
|
import { EOL } from 'os'
|
|
12
|
-
import { Activity, ActivityTypes } from '@microsoft/agents-activity'
|
|
12
|
+
import { Activity, ActivityTypes, ExceptionHelper } from '@microsoft/agents-activity'
|
|
13
|
+
import { Errors } from '../errorHelper'
|
|
13
14
|
|
|
14
15
|
const logger = debug('agents:file-transcript-logger')
|
|
15
16
|
|
|
@@ -47,7 +48,7 @@ export class FileTranscriptLogger implements TranscriptStore {
|
|
|
47
48
|
*/
|
|
48
49
|
async logActivity (activity: Activity): Promise<void> {
|
|
49
50
|
if (!activity) {
|
|
50
|
-
throw
|
|
51
|
+
throw ExceptionHelper.generateException(Error, Errors.ActivityRequired)
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
const transcriptFile = this.getTranscriptFile(activity.channelId!, activity.conversation?.id!)
|
|
@@ -328,11 +329,11 @@ export class FileTranscriptLogger implements TranscriptStore {
|
|
|
328
329
|
*/
|
|
329
330
|
private getTranscriptFile (channelId: string, conversationId: string): string {
|
|
330
331
|
if (!channelId?.trim()) {
|
|
331
|
-
throw
|
|
332
|
+
throw ExceptionHelper.generateException(Error, Errors.ChannelIdRequired)
|
|
332
333
|
}
|
|
333
334
|
|
|
334
335
|
if (!conversationId?.trim()) {
|
|
335
|
-
throw
|
|
336
|
+
throw ExceptionHelper.generateException(Error, Errors.ConversationIdRequired)
|
|
336
337
|
}
|
|
337
338
|
|
|
338
339
|
// Get invalid filename characters (cross-platform)
|
|
@@ -353,7 +354,7 @@ export class FileTranscriptLogger implements TranscriptStore {
|
|
|
353
354
|
*/
|
|
354
355
|
private getChannelFolder (channelId: string): string {
|
|
355
356
|
if (!channelId?.trim()) {
|
|
356
|
-
throw
|
|
357
|
+
throw ExceptionHelper.generateException(Error, Errors.ChannelIdRequired)
|
|
357
358
|
}
|
|
358
359
|
|
|
359
360
|
const invalidChars = this.getInvalidPathChars()
|
|
@@ -2,8 +2,9 @@ import { TurnContext } from '../turnContext'
|
|
|
2
2
|
import { ResourceResponse } from '../connector-client'
|
|
3
3
|
import { Middleware } from '../middlewareSet'
|
|
4
4
|
import { TranscriptLogger } from './transcriptLogger'
|
|
5
|
-
import { Activity, ActivityEventNames, ActivityTypes, ConversationReference, RoleTypes } from '@microsoft/agents-activity'
|
|
5
|
+
import { Activity, ActivityEventNames, ActivityTypes, ConversationReference, ExceptionHelper, RoleTypes } from '@microsoft/agents-activity'
|
|
6
6
|
import { debug } from '@microsoft/agents-telemetry'
|
|
7
|
+
import { Errors } from '../errorHelper'
|
|
7
8
|
|
|
8
9
|
const appLogger = debug('agents:rest-client')
|
|
9
10
|
|
|
@@ -20,7 +21,7 @@ export class TranscriptLoggerMiddleware implements Middleware {
|
|
|
20
21
|
*/
|
|
21
22
|
constructor (logger: TranscriptLogger) {
|
|
22
23
|
if (!logger) {
|
|
23
|
-
throw
|
|
24
|
+
throw ExceptionHelper.generateException(Error, Errors.TranscriptLoggerInstanceRequired)
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
this.logger = logger
|
package/src/turnContext.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */
|
|
2
2
|
import { INVOKE_RESPONSE_KEY } from './activityHandler'
|
|
3
3
|
import { BaseAdapter } from './baseAdapter'
|
|
4
|
-
import { Activity, ActivityTypes, ConversationReference, DeliveryModes, InputHints } from '@microsoft/agents-activity'
|
|
4
|
+
import { Activity, ActivityTypes, ConversationReference, DeliveryModes, ExceptionHelper, InputHints } from '@microsoft/agents-activity'
|
|
5
5
|
import { ResourceResponse } from './connector-client/resourceResponse'
|
|
6
6
|
import { TurnContextStateCollection } from './turnContextStateCollection'
|
|
7
7
|
import { AttachmentInfo } from './connector-client/attachmentInfo'
|
|
@@ -10,6 +10,7 @@ import { StreamingResponse } from './app/streaming/streamingResponse'
|
|
|
10
10
|
import { JwtPayload } from 'jsonwebtoken'
|
|
11
11
|
import { trace } from '@microsoft/agents-telemetry'
|
|
12
12
|
import { TurnContextTraceDefinitions } from './observability'
|
|
13
|
+
import { Errors } from './errorHelper'
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Defines a handler for processing and sending activities.
|
|
@@ -383,7 +384,7 @@ export class TurnContext {
|
|
|
383
384
|
|
|
384
385
|
set responded (value: boolean) {
|
|
385
386
|
if (!value) {
|
|
386
|
-
throw
|
|
387
|
+
throw ExceptionHelper.generateException(Error, Errors.CannotSetRespondedToFalse)
|
|
387
388
|
}
|
|
388
389
|
this._respondedRef.responded = true
|
|
389
390
|
}
|