@microsoft/agents-hosting 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.
- package/README.md +57 -0
- package/dist/src/activityHandler.d.ts +108 -0
- package/dist/src/activityHandler.js +395 -0
- package/dist/src/activityHandler.js.map +1 -0
- package/dist/src/agent-client/agentClient.d.ts +13 -0
- package/dist/src/agent-client/agentClient.js +75 -0
- package/dist/src/agent-client/agentClient.js.map +1 -0
- package/dist/src/agent-client/expressApi.d.ts +4 -0
- package/dist/src/agent-client/expressApi.js +50 -0
- package/dist/src/agent-client/expressApi.js.map +1 -0
- package/dist/src/agent-client/index.d.ts +2 -0
- package/dist/src/agent-client/index.js +19 -0
- package/dist/src/agent-client/index.js.map +1 -0
- package/dist/src/app/agentApplication.d.ts +47 -0
- package/dist/src/app/agentApplication.js +317 -0
- package/dist/src/app/agentApplication.js.map +1 -0
- package/dist/src/app/appRoute.d.ts +11 -0
- package/dist/src/app/appRoute.js +7 -0
- package/dist/src/app/appRoute.js.map +1 -0
- package/dist/src/app/applicationBuilder.d.ts +18 -0
- package/dist/src/app/applicationBuilder.js +37 -0
- package/dist/src/app/applicationBuilder.js.map +1 -0
- package/dist/src/app/applicationOptions.d.ts +19 -0
- package/dist/src/app/applicationOptions.js +7 -0
- package/dist/src/app/applicationOptions.js.map +1 -0
- package/dist/src/app/attachmentDownloader.d.ts +13 -0
- package/dist/src/app/attachmentDownloader.js +72 -0
- package/dist/src/app/attachmentDownloader.js.map +1 -0
- package/dist/src/app/conversationUpdateEvents.d.ts +5 -0
- package/dist/src/app/conversationUpdateEvents.js +7 -0
- package/dist/src/app/conversationUpdateEvents.js.map +1 -0
- package/dist/src/app/index.d.ts +10 -0
- package/dist/src/app/index.js +27 -0
- package/dist/src/app/index.js.map +1 -0
- package/dist/src/app/inputFileDownloader.d.ts +14 -0
- package/dist/src/app/inputFileDownloader.js +7 -0
- package/dist/src/app/inputFileDownloader.js.map +1 -0
- package/dist/src/app/memory.d.ts +10 -0
- package/dist/src/app/memory.js +7 -0
- package/dist/src/app/memory.js.map +1 -0
- package/dist/src/app/oauth/authenticationOptions.d.ts +7 -0
- package/dist/src/app/oauth/authenticationOptions.js +7 -0
- package/dist/src/app/oauth/authenticationOptions.js.map +1 -0
- package/dist/src/app/oauth/webChatOAuthFlowAppStyle.d.ts +11 -0
- package/dist/src/app/oauth/webChatOAuthFlowAppStyle.js +85 -0
- package/dist/src/app/oauth/webChatOAuthFlowAppStyle.js.map +1 -0
- package/dist/src/app/routeHandler.d.ts +7 -0
- package/dist/src/app/routeHandler.js +7 -0
- package/dist/src/app/routeHandler.js.map +1 -0
- package/dist/src/app/routeSelector.d.ts +7 -0
- package/dist/src/app/routeSelector.js +7 -0
- package/dist/src/app/routeSelector.js.map +1 -0
- package/dist/src/app/turnEvents.d.ts +5 -0
- package/dist/src/app/turnEvents.js +7 -0
- package/dist/src/app/turnEvents.js.map +1 -0
- package/dist/src/app/turnState.d.ts +85 -0
- package/dist/src/app/turnState.js +274 -0
- package/dist/src/app/turnState.js.map +1 -0
- package/dist/src/app/turnStateEntry.d.ts +17 -0
- package/dist/src/app/turnStateEntry.js +39 -0
- package/dist/src/app/turnStateEntry.js.map +1 -0
- package/dist/src/auth/authConfiguration.d.ts +29 -0
- package/dist/src/auth/authConfiguration.js +58 -0
- package/dist/src/auth/authConfiguration.js.map +1 -0
- package/dist/src/auth/authProvider.d.ts +17 -0
- package/dist/src/auth/authProvider.js +7 -0
- package/dist/src/auth/authProvider.js.map +1 -0
- package/dist/src/auth/index.d.ts +4 -0
- package/dist/src/auth/index.js +21 -0
- package/dist/src/auth/index.js.map +1 -0
- package/dist/src/auth/jwt-middleware.d.ts +13 -0
- package/dist/src/auth/jwt-middleware.js +97 -0
- package/dist/src/auth/jwt-middleware.js.map +1 -0
- package/dist/src/auth/msalTokenProvider.d.ts +53 -0
- package/dist/src/auth/msalTokenProvider.js +198 -0
- package/dist/src/auth/msalTokenProvider.js.map +1 -0
- package/dist/src/auth/request.d.ts +15 -0
- package/dist/src/auth/request.js +7 -0
- package/dist/src/auth/request.js.map +1 -0
- package/dist/src/baseAdapter.d.ts +88 -0
- package/dist/src/baseAdapter.js +94 -0
- package/dist/src/baseAdapter.js.map +1 -0
- package/dist/src/cards/animationCard.d.ts +36 -0
- package/dist/src/cards/animationCard.js +7 -0
- package/dist/src/cards/animationCard.js.map +1 -0
- package/dist/src/cards/audioCard.d.ts +36 -0
- package/dist/src/cards/audioCard.js +7 -0
- package/dist/src/cards/audioCard.js.map +1 -0
- package/dist/src/cards/cardFactory.d.ts +123 -0
- package/dist/src/cards/cardFactory.js +225 -0
- package/dist/src/cards/cardFactory.js.map +1 -0
- package/dist/src/cards/cardImage.d.ts +16 -0
- package/dist/src/cards/cardImage.js +7 -0
- package/dist/src/cards/cardImage.js.map +1 -0
- package/dist/src/cards/fact.d.ts +13 -0
- package/dist/src/cards/fact.js +7 -0
- package/dist/src/cards/fact.js.map +1 -0
- package/dist/src/cards/heroCard.d.ts +23 -0
- package/dist/src/cards/heroCard.js +7 -0
- package/dist/src/cards/heroCard.js.map +1 -0
- package/dist/src/cards/index.d.ts +17 -0
- package/dist/src/cards/index.js +34 -0
- package/dist/src/cards/index.js.map +1 -0
- package/dist/src/cards/mediaUrl.d.ts +17 -0
- package/dist/src/cards/mediaUrl.js +7 -0
- package/dist/src/cards/mediaUrl.js.map +1 -0
- package/dist/src/cards/o365ConnectorCard.d.ts +35 -0
- package/dist/src/cards/o365ConnectorCard.js +7 -0
- package/dist/src/cards/o365ConnectorCard.js.map +1 -0
- package/dist/src/cards/o365ConnectorCardActionBase.d.ts +22 -0
- package/dist/src/cards/o365ConnectorCardActionBase.js +7 -0
- package/dist/src/cards/o365ConnectorCardActionBase.js.map +1 -0
- package/dist/src/cards/o365ConnectorCardFact.d.ts +17 -0
- package/dist/src/cards/o365ConnectorCardFact.js +7 -0
- package/dist/src/cards/o365ConnectorCardFact.js.map +1 -0
- package/dist/src/cards/o365ConnectorCardImage.d.ts +17 -0
- package/dist/src/cards/o365ConnectorCardImage.js +7 -0
- package/dist/src/cards/o365ConnectorCardImage.js.map +1 -0
- package/dist/src/cards/o365ConnectorCardSection.d.ts +57 -0
- package/dist/src/cards/o365ConnectorCardSection.js +7 -0
- package/dist/src/cards/o365ConnectorCardSection.js.map +1 -0
- package/dist/src/cards/receiptCard.d.ts +44 -0
- package/dist/src/cards/receiptCard.js +7 -0
- package/dist/src/cards/receiptCard.js.map +1 -0
- package/dist/src/cards/receiptItem.d.ts +39 -0
- package/dist/src/cards/receiptItem.js +7 -0
- package/dist/src/cards/receiptItem.js.map +1 -0
- package/dist/src/cards/signinCard.d.ts +14 -0
- package/dist/src/cards/signinCard.js +5 -0
- package/dist/src/cards/signinCard.js.map +1 -0
- package/dist/src/cards/taskModuleAction.d.ts +43 -0
- package/dist/src/cards/taskModuleAction.js +30 -0
- package/dist/src/cards/taskModuleAction.js.map +1 -0
- package/dist/src/cards/thumbnailCard.d.ts +35 -0
- package/dist/src/cards/thumbnailCard.js +7 -0
- package/dist/src/cards/thumbnailCard.js.map +1 -0
- package/dist/src/cards/thumbnailUrl.d.ts +17 -0
- package/dist/src/cards/thumbnailUrl.js +7 -0
- package/dist/src/cards/thumbnailUrl.js.map +1 -0
- package/dist/src/cards/videoCard.d.ts +60 -0
- package/dist/src/cards/videoCard.js +7 -0
- package/dist/src/cards/videoCard.js.map +1 -0
- package/dist/src/claimsIdentity.d.ts +35 -0
- package/dist/src/claimsIdentity.js +43 -0
- package/dist/src/claimsIdentity.js.map +1 -0
- package/dist/src/cloudAdapter.d.ts +128 -0
- package/dist/src/cloudAdapter.js +376 -0
- package/dist/src/cloudAdapter.js.map +1 -0
- package/dist/src/connector-client/attachmentData.d.ts +25 -0
- package/dist/src/connector-client/attachmentData.js +7 -0
- package/dist/src/connector-client/attachmentData.js.map +1 -0
- package/dist/src/connector-client/attachmentInfo.d.ts +22 -0
- package/dist/src/connector-client/attachmentInfo.js +7 -0
- package/dist/src/connector-client/attachmentInfo.js.map +1 -0
- package/dist/src/connector-client/attachmentView.d.ts +17 -0
- package/dist/src/connector-client/attachmentView.js +7 -0
- package/dist/src/connector-client/attachmentView.js.map +1 -0
- package/dist/src/connector-client/connectorClient.d.ts +93 -0
- package/dist/src/connector-client/connectorClient.js +249 -0
- package/dist/src/connector-client/connectorClient.js.map +1 -0
- package/dist/src/connector-client/conversationMembers.d.ts +18 -0
- package/dist/src/connector-client/conversationMembers.js +7 -0
- package/dist/src/connector-client/conversationMembers.js.map +1 -0
- package/dist/src/connector-client/conversationParameters.d.ts +38 -0
- package/dist/src/connector-client/conversationParameters.js +7 -0
- package/dist/src/connector-client/conversationParameters.js.map +1 -0
- package/dist/src/connector-client/conversationResourceResponse.d.ts +21 -0
- package/dist/src/connector-client/conversationResourceResponse.js +7 -0
- package/dist/src/connector-client/conversationResourceResponse.js.map +1 -0
- package/dist/src/connector-client/conversationsResult.d.ts +18 -0
- package/dist/src/connector-client/conversationsResult.js +7 -0
- package/dist/src/connector-client/conversationsResult.js.map +1 -0
- package/dist/src/connector-client/index.d.ts +9 -0
- package/dist/src/connector-client/index.js +26 -0
- package/dist/src/connector-client/index.js.map +1 -0
- package/dist/src/connector-client/resourceResponse.d.ts +13 -0
- package/dist/src/connector-client/resourceResponse.js +7 -0
- package/dist/src/connector-client/resourceResponse.js.map +1 -0
- package/dist/src/index.d.ts +26 -0
- package/dist/src/index.js +45 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/invoke/adaptiveCardAuthentication.d.ts +10 -0
- package/dist/src/invoke/adaptiveCardAuthentication.js +7 -0
- package/dist/src/invoke/adaptiveCardAuthentication.js.map +1 -0
- package/dist/src/invoke/adaptiveCardInvokeResponse.d.ts +21 -0
- package/dist/src/invoke/adaptiveCardInvokeResponse.js +7 -0
- package/dist/src/invoke/adaptiveCardInvokeResponse.js.map +1 -0
- package/dist/src/invoke/adaptiveCardInvokeValue.d.ts +23 -0
- package/dist/src/invoke/adaptiveCardInvokeValue.js +7 -0
- package/dist/src/invoke/adaptiveCardInvokeValue.js.map +1 -0
- package/dist/src/invoke/index.d.ts +9 -0
- package/dist/src/invoke/index.js +26 -0
- package/dist/src/invoke/index.js.map +1 -0
- package/dist/src/invoke/invokeException.d.ts +24 -0
- package/dist/src/invoke/invokeException.js +35 -0
- package/dist/src/invoke/invokeException.js.map +1 -0
- package/dist/src/invoke/invokeResponse.d.ts +17 -0
- package/dist/src/invoke/invokeResponse.js +7 -0
- package/dist/src/invoke/invokeResponse.js.map +1 -0
- package/dist/src/invoke/searchInvokeOptions.d.ts +17 -0
- package/dist/src/invoke/searchInvokeOptions.js +7 -0
- package/dist/src/invoke/searchInvokeOptions.js.map +1 -0
- package/dist/src/invoke/searchInvokeResponse.d.ts +10 -0
- package/dist/src/invoke/searchInvokeResponse.js +7 -0
- package/dist/src/invoke/searchInvokeResponse.js.map +1 -0
- package/dist/src/invoke/searchInvokeValue.d.ts +26 -0
- package/dist/src/invoke/searchInvokeValue.js +7 -0
- package/dist/src/invoke/searchInvokeValue.js.map +1 -0
- package/dist/src/invoke/tokenExchangeInvokeRequest.d.ts +21 -0
- package/dist/src/invoke/tokenExchangeInvokeRequest.js +7 -0
- package/dist/src/invoke/tokenExchangeInvokeRequest.js.map +1 -0
- package/dist/src/logger.d.ts +12 -0
- package/dist/src/logger.js +42 -0
- package/dist/src/logger.js.map +1 -0
- package/dist/src/messageFactory.d.ts +62 -0
- package/dist/src/messageFactory.js +143 -0
- package/dist/src/messageFactory.js.map +1 -0
- package/dist/src/middlewareSet.d.ts +43 -0
- package/dist/src/middlewareSet.js +57 -0
- package/dist/src/middlewareSet.js.map +1 -0
- package/dist/src/oauth/index.d.ts +7 -0
- package/dist/src/oauth/index.js +24 -0
- package/dist/src/oauth/index.js.map +1 -0
- package/dist/src/oauth/oauthCard.d.ts +28 -0
- package/dist/src/oauth/oauthCard.js +5 -0
- package/dist/src/oauth/oauthCard.js.map +1 -0
- package/dist/src/oauth/signingResource.d.ts +19 -0
- package/dist/src/oauth/signingResource.js +5 -0
- package/dist/src/oauth/signingResource.js.map +1 -0
- package/dist/src/oauth/tokenExchangeRequest.d.ts +17 -0
- package/dist/src/oauth/tokenExchangeRequest.js +5 -0
- package/dist/src/oauth/tokenExchangeRequest.js.map +1 -0
- package/dist/src/oauth/tokenExchangeResource.d.ts +17 -0
- package/dist/src/oauth/tokenExchangeResource.js +5 -0
- package/dist/src/oauth/tokenExchangeResource.js.map +1 -0
- package/dist/src/oauth/tokenPostResource.d.ts +9 -0
- package/dist/src/oauth/tokenPostResource.js +5 -0
- package/dist/src/oauth/tokenPostResource.js.map +1 -0
- package/dist/src/oauth/userTokenClient.d.ts +49 -0
- package/dist/src/oauth/userTokenClient.js +117 -0
- package/dist/src/oauth/userTokenClient.js.map +1 -0
- package/dist/src/oauth/webChatOAuthFlow.d.ts +41 -0
- package/dist/src/oauth/webChatOAuthFlow.js +117 -0
- package/dist/src/oauth/webChatOAuthFlow.js.map +1 -0
- package/dist/src/state/agentState.d.ts +71 -0
- package/dist/src/state/agentState.js +122 -0
- package/dist/src/state/agentState.js.map +1 -0
- package/dist/src/state/agentStatePropertyAccesor.d.ts +39 -0
- package/dist/src/state/agentStatePropertyAccesor.js +60 -0
- package/dist/src/state/agentStatePropertyAccesor.js.map +1 -0
- package/dist/src/state/conversationState.d.ts +18 -0
- package/dist/src/state/conversationState.js +38 -0
- package/dist/src/state/conversationState.js.map +1 -0
- package/dist/src/state/index.d.ts +4 -0
- package/dist/src/state/index.js +21 -0
- package/dist/src/state/index.js.map +1 -0
- package/dist/src/state/userState.d.ts +18 -0
- package/dist/src/state/userState.js +38 -0
- package/dist/src/state/userState.js.map +1 -0
- package/dist/src/statusCodes.d.ts +19 -0
- package/dist/src/statusCodes.js +24 -0
- package/dist/src/statusCodes.js.map +1 -0
- package/dist/src/storage/index.d.ts +2 -0
- package/dist/src/storage/index.js +19 -0
- package/dist/src/storage/index.js.map +1 -0
- package/dist/src/storage/memoryStorage.d.ts +50 -0
- package/dist/src/storage/memoryStorage.js +100 -0
- package/dist/src/storage/memoryStorage.js.map +1 -0
- package/dist/src/storage/storage.d.ts +47 -0
- package/dist/src/storage/storage.js +7 -0
- package/dist/src/storage/storage.js.map +1 -0
- package/dist/src/tokenResponseEventName.d.ts +5 -0
- package/dist/src/tokenResponseEventName.js +9 -0
- package/dist/src/tokenResponseEventName.js.map +1 -0
- package/dist/src/transcript/consoleTranscriptLogger.d.ts +13 -0
- package/dist/src/transcript/consoleTranscriptLogger.js +21 -0
- package/dist/src/transcript/consoleTranscriptLogger.js.map +1 -0
- package/dist/src/transcript/index.d.ts +4 -0
- package/dist/src/transcript/index.js +21 -0
- package/dist/src/transcript/index.js.map +1 -0
- package/dist/src/transcript/transcriptLogger.d.ts +42 -0
- package/dist/src/transcript/transcriptLogger.js +3 -0
- package/dist/src/transcript/transcriptLogger.js.map +1 -0
- package/dist/src/transcript/transcriptLoggerMiddleware.d.ts +38 -0
- package/dist/src/transcript/transcriptLoggerMiddleware.js +126 -0
- package/dist/src/transcript/transcriptLoggerMiddleware.js.map +1 -0
- package/dist/src/transcript/transcriptStore.d.ts +30 -0
- package/dist/src/transcript/transcriptStore.js +3 -0
- package/dist/src/transcript/transcriptStore.js.map +1 -0
- package/dist/src/turnContext.d.ts +160 -0
- package/dist/src/turnContext.js +286 -0
- package/dist/src/turnContext.js.map +1 -0
- package/dist/src/turnContextStateCollection.d.ts +29 -0
- package/dist/src/turnContextStateCollection.js +56 -0
- package/dist/src/turnContextStateCollection.js.map +1 -0
- package/package.json +48 -0
- package/src/activityHandler.ts +461 -0
- package/src/agent-client/agentClient.ts +84 -0
- package/src/agent-client/expressApi.ts +59 -0
- package/src/agent-client/index.ts +2 -0
- package/src/app/agentApplication.ts +401 -0
- package/src/app/appRoute.ts +13 -0
- package/src/app/applicationBuilder.ts +42 -0
- package/src/app/applicationOptions.ts +21 -0
- package/src/app/attachmentDownloader.ts +83 -0
- package/src/app/conversationUpdateEvents.ts +8 -0
- package/src/app/index.ts +10 -0
- package/src/app/inputFileDownloader.ts +17 -0
- package/src/app/memory.ts +14 -0
- package/src/app/oauth/authenticationOptions.ts +8 -0
- package/src/app/oauth/webChatOAuthFlowAppStyle.ts +90 -0
- package/src/app/routeHandler.ts +9 -0
- package/src/app/routeSelector.ts +10 -0
- package/src/app/turnEvents.ts +6 -0
- package/src/app/turnState.ts +338 -0
- package/src/app/turnStateEntry.ts +46 -0
- package/src/auth/authConfiguration.ts +68 -0
- package/src/auth/authProvider.ts +19 -0
- package/src/auth/index.ts +4 -0
- package/src/auth/jwt-middleware.ts +99 -0
- package/src/auth/msalTokenProvider.ts +202 -0
- package/src/auth/request.ts +20 -0
- package/src/baseAdapter.ts +174 -0
- package/src/cards/animationCard.ts +38 -0
- package/src/cards/audioCard.ts +38 -0
- package/src/cards/cardFactory.ts +276 -0
- package/src/cards/cardImage.ts +18 -0
- package/src/cards/fact.ts +14 -0
- package/src/cards/heroCard.ts +25 -0
- package/src/cards/index.ts +17 -0
- package/src/cards/mediaUrl.ts +18 -0
- package/src/cards/o365ConnectorCard.ts +37 -0
- package/src/cards/o365ConnectorCardActionBase.ts +24 -0
- package/src/cards/o365ConnectorCardFact.ts +18 -0
- package/src/cards/o365ConnectorCardImage.ts +18 -0
- package/src/cards/o365ConnectorCardSection.ts +60 -0
- package/src/cards/receiptCard.ts +46 -0
- package/src/cards/receiptItem.ts +41 -0
- package/src/cards/signinCard.ts +18 -0
- package/src/cards/taskModuleAction.ts +61 -0
- package/src/cards/thumbnailCard.ts +37 -0
- package/src/cards/thumbnailUrl.ts +18 -0
- package/src/cards/videoCard.ts +62 -0
- package/src/claimsIdentity.ts +47 -0
- package/src/cloudAdapter.ts +431 -0
- package/src/connector-client/attachmentData.ts +26 -0
- package/src/connector-client/attachmentInfo.ts +24 -0
- package/src/connector-client/attachmentView.ts +18 -0
- package/src/connector-client/connectorClient.ts +295 -0
- package/src/connector-client/conversationMembers.ts +20 -0
- package/src/connector-client/conversationParameters.ts +40 -0
- package/src/connector-client/conversationResourceResponse.ts +22 -0
- package/src/connector-client/conversationsResult.ts +20 -0
- package/src/connector-client/index.ts +9 -0
- package/src/connector-client/resourceResponse.ts +14 -0
- package/src/index.ts +31 -0
- package/src/invoke/adaptiveCardAuthentication.ts +13 -0
- package/src/invoke/adaptiveCardInvokeResponse.ts +22 -0
- package/src/invoke/adaptiveCardInvokeValue.ts +25 -0
- package/src/invoke/index.ts +9 -0
- package/src/invoke/invokeException.ts +33 -0
- package/src/invoke/invokeResponse.ts +18 -0
- package/src/invoke/searchInvokeOptions.ts +18 -0
- package/src/invoke/searchInvokeResponse.ts +11 -0
- package/src/invoke/searchInvokeValue.ts +28 -0
- package/src/invoke/tokenExchangeInvokeRequest.ts +22 -0
- package/src/logger.ts +43 -0
- package/src/messageFactory.ts +177 -0
- package/src/middlewareSet.ts +76 -0
- package/src/oauth/index.ts +7 -0
- package/src/oauth/oauthCard.ts +32 -0
- package/src/oauth/signingResource.ts +23 -0
- package/src/oauth/tokenExchangeRequest.ts +20 -0
- package/src/oauth/tokenExchangeResource.ts +20 -0
- package/src/oauth/tokenPostResource.ts +12 -0
- package/src/oauth/userTokenClient.ts +116 -0
- package/src/oauth/webChatOAuthFlow.ts +123 -0
- package/src/state/agentState.ts +142 -0
- package/src/state/agentStatePropertyAccesor.ts +61 -0
- package/src/state/conversationState.ts +42 -0
- package/src/state/index.ts +4 -0
- package/src/state/userState.ts +43 -0
- package/src/statusCodes.ts +20 -0
- package/src/storage/index.ts +2 -0
- package/src/storage/memoryStorage.ts +105 -0
- package/src/storage/storage.ts +52 -0
- package/src/tokenResponseEventName.ts +6 -0
- package/src/transcript/consoleTranscriptLogger.ts +20 -0
- package/src/transcript/index.ts +4 -0
- package/src/transcript/transcriptLogger.ts +45 -0
- package/src/transcript/transcriptLoggerMiddleware.ts +151 -0
- package/src/transcript/transcriptStore.ts +38 -0
- package/src/turnContext.ts +335 -0
- package/src/turnContextStateCollection.ts +69 -0
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# microsoft/agents-hosting
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The `@microsoft/agents-hosting` package provides the necessary tools and components to create and host Microsoft Agents. This package includes a compatible API to migrate a bot using `botbuilder` from the BotFramework SDK.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
To install the package:
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm install @microsoft/agents-hosting
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Example Usage
|
|
16
|
+
|
|
17
|
+
Create an Echo bot using the ActivityHandler
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
// myHandler.ts
|
|
21
|
+
import { ActivityHandler, MessageFactory } from '@microsoft/agents-hosting'
|
|
22
|
+
|
|
23
|
+
export class MyHandler extends ActivityHandler {
|
|
24
|
+
constructor () {
|
|
25
|
+
super()
|
|
26
|
+
this.onMessage(async (context, next) => {
|
|
27
|
+
const replyText = `Agent: ${context.activity.text}`
|
|
28
|
+
await context.sendActivity(MessageFactory.text(replyText))
|
|
29
|
+
await next()
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Host the bot with express
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
// index.ts
|
|
39
|
+
import express, { Response } from 'express'
|
|
40
|
+
import { Request, CloudAdapter, authorizeJWT, AuthConfiguration, loadAuthConfigFromEnv } from '@microsoft/agents-hosting'
|
|
41
|
+
import { EchoBot } from './myHandler'
|
|
42
|
+
|
|
43
|
+
const authConfig: AuthConfiguration = loadAuthConfigFromEnv()
|
|
44
|
+
|
|
45
|
+
const adapter = new CloudAdapter(authConfig)
|
|
46
|
+
const myHandler = new MyHandler()
|
|
47
|
+
|
|
48
|
+
const app = express()
|
|
49
|
+
|
|
50
|
+
app.use(express.json())
|
|
51
|
+
app.use(authorizeJWT(authConfig))
|
|
52
|
+
|
|
53
|
+
app.post('/api/messages', async (req: Request, res: Response) => {
|
|
54
|
+
await adapter.process(req, res, async (context) => await myHandler.run(context))
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
```
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { TurnContext } from './turnContext';
|
|
2
|
+
import { InvokeResponse } from './invoke/invokeResponse';
|
|
3
|
+
import { AdaptiveCardInvokeValue } from './invoke/adaptiveCardInvokeValue';
|
|
4
|
+
import { SearchInvokeValue } from './invoke/searchInvokeValue';
|
|
5
|
+
import { SearchInvokeResponse } from './invoke/searchInvokeResponse';
|
|
6
|
+
import { AdaptiveCardInvokeResponse } from './invoke/adaptiveCardInvokeResponse';
|
|
7
|
+
/** Symbol key for invoke response */
|
|
8
|
+
export declare const INVOKE_RESPONSE_KEY: unique symbol;
|
|
9
|
+
/** Type definition for agent handler function */
|
|
10
|
+
export type AgentHandler = (context: TurnContext, next: () => Promise<void>) => Promise<any>;
|
|
11
|
+
/** * Handles various activity types and dispatches them to the appropriate handlers. */
|
|
12
|
+
export declare class ActivityHandler {
|
|
13
|
+
protected readonly handlers: {
|
|
14
|
+
[type: string]: AgentHandler[];
|
|
15
|
+
};
|
|
16
|
+
/** * Registers a handler for the Turn activity type. */
|
|
17
|
+
onTurn(handler: AgentHandler): this;
|
|
18
|
+
/** * Registers a handler for the MembersAdded activity type. */
|
|
19
|
+
onMembersAdded(handler: AgentHandler): this;
|
|
20
|
+
/** * Registers a handler for the MembersRemoved activity type. */
|
|
21
|
+
onMembersRemoved(handler: AgentHandler): this;
|
|
22
|
+
/** * Registers a handler for the Message activity type. */
|
|
23
|
+
onMessage(handler: AgentHandler): this;
|
|
24
|
+
/** * Registers a handler for the MessageUpdate activity type. */
|
|
25
|
+
onMessageUpdate(handler: AgentHandler): this;
|
|
26
|
+
/** * Registers a handler for the MessageDelete activity type. */
|
|
27
|
+
onMessageDelete(handler: AgentHandler): this;
|
|
28
|
+
/** * Registers a handler for the ConversationUpdate activity type. */
|
|
29
|
+
onConversationUpdate(handler: AgentHandler): this;
|
|
30
|
+
/** * Registers a handler for the MessageReaction activity type. */
|
|
31
|
+
onMessageReaction(handler: AgentHandler): this;
|
|
32
|
+
/** * Registers a handler for the ReactionsAdded activity type. */
|
|
33
|
+
onReactionsAdded(handler: AgentHandler): this;
|
|
34
|
+
/** * Registers a handler for the ReactionsRemoved activity type. */
|
|
35
|
+
onReactionsRemoved(handler: AgentHandler): this;
|
|
36
|
+
/** * Registers a handler for the Typing activity type. */
|
|
37
|
+
onTyping(handler: AgentHandler): this;
|
|
38
|
+
/** * Registers a handler for the InstallationUpdate activity type. */
|
|
39
|
+
onInstallationUpdate(handler: AgentHandler): this;
|
|
40
|
+
/** * Registers a handler for the InstallationUpdateAdd activity type. */
|
|
41
|
+
onInstallationUpdateAdd(handler: AgentHandler): this;
|
|
42
|
+
/** * Registers a handler for the InstallationUpdateRemove activity type. */
|
|
43
|
+
onInstallationUpdateRemove(handler: AgentHandler): this;
|
|
44
|
+
/** * Registers a handler for the EndOfConversation activity type. */
|
|
45
|
+
onEndOfConversation(handler: AgentHandler): this;
|
|
46
|
+
/** * Registers a handler for the SignInInvoke activity type. */
|
|
47
|
+
onSignInInvoke(handler: AgentHandler): this;
|
|
48
|
+
/** * Registers a handler for unrecognized activity types. */
|
|
49
|
+
onUnrecognizedActivityType(handler: AgentHandler): this;
|
|
50
|
+
/** * Registers an activity event handler for the _dialog_ event, emitted as the last event for an incoming activity. */
|
|
51
|
+
onDialog(handler: AgentHandler): this;
|
|
52
|
+
/** * Runs the activity handler pipeline. */
|
|
53
|
+
run(context: TurnContext): Promise<void>;
|
|
54
|
+
/** * Handles the Turn activity. */
|
|
55
|
+
protected onTurnActivity(context: TurnContext): Promise<void>;
|
|
56
|
+
/** * Handles the Message activity. */
|
|
57
|
+
protected onMessageActivity(context: TurnContext): Promise<void>;
|
|
58
|
+
/** * Handles the MessageUpdate activity. */
|
|
59
|
+
protected onMessageUpdateActivity(context: TurnContext): Promise<void>;
|
|
60
|
+
/** * Handles the MessageDelete activity. */
|
|
61
|
+
protected onMessageDeleteActivity(context: TurnContext): Promise<void>;
|
|
62
|
+
/** * Handles the ConversationUpdate activity. */
|
|
63
|
+
protected onConversationUpdateActivity(context: TurnContext): Promise<void>;
|
|
64
|
+
/** * Handles the SignInInvoke activity. */
|
|
65
|
+
protected onSigninInvokeActivity(context: TurnContext): Promise<void>;
|
|
66
|
+
/** * Handles the Invoke activity. */
|
|
67
|
+
protected onInvokeActivity(context: TurnContext): Promise<InvokeResponse>;
|
|
68
|
+
/** * Handles the AdaptiveCardInvoke activity. */
|
|
69
|
+
protected onAdaptiveCardInvoke(_context: TurnContext, _invokeValue: AdaptiveCardInvokeValue): Promise<AdaptiveCardInvokeResponse>;
|
|
70
|
+
/** * Handles the SearchInvoke activity. */
|
|
71
|
+
protected onSearchInvoke(_context: TurnContext, _invokeValue: SearchInvokeValue): Promise<SearchInvokeResponse>;
|
|
72
|
+
/** * Retrieves the SearchInvoke value from the activity. */
|
|
73
|
+
private getSearchInvokeValue;
|
|
74
|
+
/** * Retrieves the AdaptiveCardInvoke value from the activity. */
|
|
75
|
+
private getAdaptiveCardInvokeValue;
|
|
76
|
+
/** * Creates an error response for AdaptiveCardInvoke. */
|
|
77
|
+
private createAdaptiveCardInvokeErrorResponse;
|
|
78
|
+
/** * Handles the MessageReaction activity. */
|
|
79
|
+
protected onMessageReactionActivity(context: TurnContext): Promise<void>;
|
|
80
|
+
/** * Handles the EndOfConversation activity. */
|
|
81
|
+
protected onEndOfConversationActivity(context: TurnContext): Promise<void>;
|
|
82
|
+
/** * Handles the Typing activity. */
|
|
83
|
+
protected onTypingActivity(context: TurnContext): Promise<void>;
|
|
84
|
+
/** * Handles the InstallationUpdate activity. */
|
|
85
|
+
protected onInstallationUpdateActivity(context: TurnContext): Promise<void>;
|
|
86
|
+
/** * Handles unrecognized activity types. */
|
|
87
|
+
protected onUnrecognizedActivity(context: TurnContext): Promise<void>;
|
|
88
|
+
/** * Dispatches the ConversationUpdate activity. */
|
|
89
|
+
protected dispatchConversationUpdateActivity(context: TurnContext): Promise<void>;
|
|
90
|
+
/** * Dispatches the MessageReaction activity. */
|
|
91
|
+
protected dispatchMessageReactionActivity(context: TurnContext): Promise<void>;
|
|
92
|
+
/** * Dispatches the MessageUpdate activity. */
|
|
93
|
+
protected dispatchMessageUpdateActivity(context: TurnContext): Promise<void>;
|
|
94
|
+
/** * Dispatches the MessageDelete activity. */
|
|
95
|
+
protected dispatchMessageDeleteActivity(context: TurnContext): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Returns the default next event handler.
|
|
98
|
+
*/
|
|
99
|
+
protected defaultNextEvent(context: TurnContext): () => Promise<void>;
|
|
100
|
+
/** * Registers a handler for a specific activity type. */
|
|
101
|
+
protected on(type: string, handler: AgentHandler): this;
|
|
102
|
+
/** * Executes the handlers for a specific activity type. */
|
|
103
|
+
protected handle(context: TurnContext, type: string, onNext: () => Promise<void>): Promise<any>;
|
|
104
|
+
/** * Creates an InvokeResponse object. */
|
|
105
|
+
protected static createInvokeResponse(body?: any): InvokeResponse;
|
|
106
|
+
/** * Dispatches the Event activity. */
|
|
107
|
+
protected dispatchEventActivity(context: TurnContext): Promise<void>;
|
|
108
|
+
}
|
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActivityHandler = exports.INVOKE_RESPONSE_KEY = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6
|
+
* Licensed under the MIT License.
|
|
7
|
+
*/
|
|
8
|
+
const logger_1 = require("./logger");
|
|
9
|
+
const agents_activity_1 = require("@microsoft/agents-activity");
|
|
10
|
+
const statusCodes_1 = require("./statusCodes");
|
|
11
|
+
const invokeException_1 = require("./invoke/invokeException");
|
|
12
|
+
const tokenResponseEventName_1 = require("./tokenResponseEventName");
|
|
13
|
+
/** Symbol key for invoke response */
|
|
14
|
+
exports.INVOKE_RESPONSE_KEY = Symbol('invokeResponse');
|
|
15
|
+
const logger = (0, logger_1.debug)('agents:activity-handler');
|
|
16
|
+
/** * Handles various activity types and dispatches them to the appropriate handlers. */
|
|
17
|
+
class ActivityHandler {
|
|
18
|
+
constructor() {
|
|
19
|
+
this.handlers = {};
|
|
20
|
+
}
|
|
21
|
+
/** * Registers a handler for the Turn activity type. */
|
|
22
|
+
onTurn(handler) {
|
|
23
|
+
return this.on('Turn', handler);
|
|
24
|
+
}
|
|
25
|
+
/** * Registers a handler for the MembersAdded activity type. */
|
|
26
|
+
onMembersAdded(handler) {
|
|
27
|
+
return this.on('MembersAdded', handler);
|
|
28
|
+
}
|
|
29
|
+
/** * Registers a handler for the MembersRemoved activity type. */
|
|
30
|
+
onMembersRemoved(handler) {
|
|
31
|
+
return this.on('MembersRemoved', handler);
|
|
32
|
+
}
|
|
33
|
+
/** * Registers a handler for the Message activity type. */
|
|
34
|
+
onMessage(handler) {
|
|
35
|
+
return this.on('Message', handler);
|
|
36
|
+
}
|
|
37
|
+
/** * Registers a handler for the MessageUpdate activity type. */
|
|
38
|
+
onMessageUpdate(handler) {
|
|
39
|
+
return this.on('MessageUpdate', handler);
|
|
40
|
+
}
|
|
41
|
+
/** * Registers a handler for the MessageDelete activity type. */
|
|
42
|
+
onMessageDelete(handler) {
|
|
43
|
+
return this.on('MessageDelete', handler);
|
|
44
|
+
}
|
|
45
|
+
/** * Registers a handler for the ConversationUpdate activity type. */
|
|
46
|
+
onConversationUpdate(handler) {
|
|
47
|
+
return this.on('ConversationUpdate', handler);
|
|
48
|
+
}
|
|
49
|
+
/** * Registers a handler for the MessageReaction activity type. */
|
|
50
|
+
onMessageReaction(handler) {
|
|
51
|
+
return this.on('MessageReaction', handler);
|
|
52
|
+
}
|
|
53
|
+
/** * Registers a handler for the ReactionsAdded activity type. */
|
|
54
|
+
onReactionsAdded(handler) {
|
|
55
|
+
return this.on('ReactionsAdded', handler);
|
|
56
|
+
}
|
|
57
|
+
/** * Registers a handler for the ReactionsRemoved activity type. */
|
|
58
|
+
onReactionsRemoved(handler) {
|
|
59
|
+
return this.on('ReactionsRemoved', handler);
|
|
60
|
+
}
|
|
61
|
+
/** * Registers a handler for the Typing activity type. */
|
|
62
|
+
onTyping(handler) {
|
|
63
|
+
return this.on('Typing', handler);
|
|
64
|
+
}
|
|
65
|
+
/** * Registers a handler for the InstallationUpdate activity type. */
|
|
66
|
+
onInstallationUpdate(handler) {
|
|
67
|
+
return this.on('InstallationUpdate', handler);
|
|
68
|
+
}
|
|
69
|
+
/** * Registers a handler for the InstallationUpdateAdd activity type. */
|
|
70
|
+
onInstallationUpdateAdd(handler) {
|
|
71
|
+
return this.on('InstallationUpdateAdd', handler);
|
|
72
|
+
}
|
|
73
|
+
/** * Registers a handler for the InstallationUpdateRemove activity type. */
|
|
74
|
+
onInstallationUpdateRemove(handler) {
|
|
75
|
+
return this.on('InstallationUpdateRemove', handler);
|
|
76
|
+
}
|
|
77
|
+
/** * Registers a handler for the EndOfConversation activity type. */
|
|
78
|
+
onEndOfConversation(handler) {
|
|
79
|
+
return this.on('EndOfConversation', handler);
|
|
80
|
+
}
|
|
81
|
+
/** * Registers a handler for the SignInInvoke activity type. */
|
|
82
|
+
onSignInInvoke(handler) {
|
|
83
|
+
return this.on('SignInInvoke', handler);
|
|
84
|
+
}
|
|
85
|
+
/** * Registers a handler for unrecognized activity types. */
|
|
86
|
+
onUnrecognizedActivityType(handler) {
|
|
87
|
+
return this.on('UnrecognizedActivityType', handler);
|
|
88
|
+
}
|
|
89
|
+
/** * Registers an activity event handler for the _dialog_ event, emitted as the last event for an incoming activity. */
|
|
90
|
+
onDialog(handler) {
|
|
91
|
+
return this.on('Default', handler);
|
|
92
|
+
}
|
|
93
|
+
/** * Runs the activity handler pipeline. */
|
|
94
|
+
async run(context) {
|
|
95
|
+
if (!context)
|
|
96
|
+
throw new Error('Missing TurnContext parameter');
|
|
97
|
+
if (!context.activity)
|
|
98
|
+
throw new Error('TurnContext does not include an activity');
|
|
99
|
+
if (!context.activity.type)
|
|
100
|
+
throw new Error('Activity is missing its type');
|
|
101
|
+
await this.onTurnActivity(context);
|
|
102
|
+
}
|
|
103
|
+
/** * Handles the Turn activity. */
|
|
104
|
+
async onTurnActivity(context) {
|
|
105
|
+
switch (context.activity.type) {
|
|
106
|
+
case agents_activity_1.ActivityTypes.Message:
|
|
107
|
+
await this.onMessageActivity(context);
|
|
108
|
+
break;
|
|
109
|
+
case agents_activity_1.ActivityTypes.MessageUpdate:
|
|
110
|
+
await this.onMessageUpdateActivity(context);
|
|
111
|
+
break;
|
|
112
|
+
case agents_activity_1.ActivityTypes.MessageDelete:
|
|
113
|
+
await this.onMessageDeleteActivity(context);
|
|
114
|
+
break;
|
|
115
|
+
case agents_activity_1.ActivityTypes.ConversationUpdate:
|
|
116
|
+
await this.onConversationUpdateActivity(context);
|
|
117
|
+
break;
|
|
118
|
+
case agents_activity_1.ActivityTypes.Invoke: {
|
|
119
|
+
const invokeResponse = await this.onInvokeActivity(context);
|
|
120
|
+
if (invokeResponse && !context.turnState.get(exports.INVOKE_RESPONSE_KEY)) {
|
|
121
|
+
const activity = agents_activity_1.Activity.fromObject({ value: invokeResponse, type: 'invokeResponse' });
|
|
122
|
+
await context.sendActivity(activity);
|
|
123
|
+
}
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
case agents_activity_1.ActivityTypes.MessageReaction:
|
|
127
|
+
await this.onMessageReactionActivity(context);
|
|
128
|
+
break;
|
|
129
|
+
case agents_activity_1.ActivityTypes.Typing:
|
|
130
|
+
await this.onTypingActivity(context);
|
|
131
|
+
break;
|
|
132
|
+
case agents_activity_1.ActivityTypes.InstallationUpdate:
|
|
133
|
+
await this.onInstallationUpdateActivity(context);
|
|
134
|
+
break;
|
|
135
|
+
case agents_activity_1.ActivityTypes.EndOfConversation:
|
|
136
|
+
await this.onEndOfConversationActivity(context);
|
|
137
|
+
break;
|
|
138
|
+
default:
|
|
139
|
+
await this.onUnrecognizedActivity(context);
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/** * Handles the Message activity. */
|
|
144
|
+
async onMessageActivity(context) {
|
|
145
|
+
await this.handle(context, 'Message', this.defaultNextEvent(context));
|
|
146
|
+
}
|
|
147
|
+
/** * Handles the MessageUpdate activity. */
|
|
148
|
+
async onMessageUpdateActivity(context) {
|
|
149
|
+
await this.handle(context, 'MessageUpdate', async () => {
|
|
150
|
+
await this.dispatchMessageUpdateActivity(context);
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
/** * Handles the MessageDelete activity. */
|
|
154
|
+
async onMessageDeleteActivity(context) {
|
|
155
|
+
await this.handle(context, 'MessageDelete', async () => {
|
|
156
|
+
await this.dispatchMessageDeleteActivity(context);
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
/** * Handles the ConversationUpdate activity. */
|
|
160
|
+
async onConversationUpdateActivity(context) {
|
|
161
|
+
await this.handle(context, 'ConversationUpdate', async () => {
|
|
162
|
+
await this.dispatchConversationUpdateActivity(context);
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
/** * Handles the SignInInvoke activity. */
|
|
166
|
+
async onSigninInvokeActivity(context) {
|
|
167
|
+
await this.handle(context, 'SignInInvoke', this.defaultNextEvent(context));
|
|
168
|
+
}
|
|
169
|
+
/** * Handles the Invoke activity. */
|
|
170
|
+
async onInvokeActivity(context) {
|
|
171
|
+
try {
|
|
172
|
+
switch (context.activity.name) {
|
|
173
|
+
case 'application/search': {
|
|
174
|
+
const invokeValue = this.getSearchInvokeValue(context.activity);
|
|
175
|
+
const response = await this.onSearchInvoke(context, invokeValue);
|
|
176
|
+
return { status: response.statusCode, body: response };
|
|
177
|
+
}
|
|
178
|
+
case 'adaptiveCard/action': {
|
|
179
|
+
const invokeValue = this.getAdaptiveCardInvokeValue(context.activity);
|
|
180
|
+
const response = await this.onAdaptiveCardInvoke(context, invokeValue);
|
|
181
|
+
return { status: response.statusCode, body: response };
|
|
182
|
+
}
|
|
183
|
+
case 'signin/verifyState':
|
|
184
|
+
case 'signin/tokenExchange':
|
|
185
|
+
await this.onSigninInvokeActivity(context);
|
|
186
|
+
return { status: statusCodes_1.StatusCodes.OK };
|
|
187
|
+
default:
|
|
188
|
+
throw new invokeException_1.InvokeException(statusCodes_1.StatusCodes.NOT_IMPLEMENTED);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
catch (err) {
|
|
192
|
+
const error = err;
|
|
193
|
+
if (error.message === 'NotImplemented') {
|
|
194
|
+
return { status: statusCodes_1.StatusCodes.NOT_IMPLEMENTED };
|
|
195
|
+
}
|
|
196
|
+
if (err instanceof invokeException_1.InvokeException) {
|
|
197
|
+
return err.createInvokeResponse();
|
|
198
|
+
}
|
|
199
|
+
throw err;
|
|
200
|
+
}
|
|
201
|
+
finally {
|
|
202
|
+
this.defaultNextEvent(context)();
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/** * Handles the AdaptiveCardInvoke activity. */
|
|
206
|
+
async onAdaptiveCardInvoke(_context, _invokeValue) {
|
|
207
|
+
return await Promise.reject(new invokeException_1.InvokeException(statusCodes_1.StatusCodes.NOT_IMPLEMENTED));
|
|
208
|
+
}
|
|
209
|
+
/** * Handles the SearchInvoke activity. */
|
|
210
|
+
async onSearchInvoke(_context, _invokeValue) {
|
|
211
|
+
return await Promise.reject(new invokeException_1.InvokeException(statusCodes_1.StatusCodes.NOT_IMPLEMENTED));
|
|
212
|
+
}
|
|
213
|
+
/** * Retrieves the SearchInvoke value from the activity. */
|
|
214
|
+
getSearchInvokeValue(activity) {
|
|
215
|
+
const value = activity.value;
|
|
216
|
+
if (!value) {
|
|
217
|
+
const response = this.createAdaptiveCardInvokeErrorResponse(statusCodes_1.StatusCodes.BAD_REQUEST, 'BadRequest', 'Missing value property for search');
|
|
218
|
+
throw new invokeException_1.InvokeException(statusCodes_1.StatusCodes.BAD_REQUEST, response);
|
|
219
|
+
}
|
|
220
|
+
if (!value.kind) {
|
|
221
|
+
if (activity.channelId === agents_activity_1.Channels.Msteams) {
|
|
222
|
+
value.kind = 'search';
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
const response = this.createAdaptiveCardInvokeErrorResponse(statusCodes_1.StatusCodes.BAD_REQUEST, 'BadRequest', 'Missing kind property for search.');
|
|
226
|
+
throw new invokeException_1.InvokeException(statusCodes_1.StatusCodes.BAD_REQUEST, response);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
if (!value.queryText) {
|
|
230
|
+
const response = this.createAdaptiveCardInvokeErrorResponse(statusCodes_1.StatusCodes.BAD_REQUEST, 'BadRequest', 'Missing queryText for search.');
|
|
231
|
+
throw new invokeException_1.InvokeException(statusCodes_1.StatusCodes.BAD_REQUEST, response);
|
|
232
|
+
}
|
|
233
|
+
return value;
|
|
234
|
+
}
|
|
235
|
+
/** * Retrieves the AdaptiveCardInvoke value from the activity. */
|
|
236
|
+
getAdaptiveCardInvokeValue(activity) {
|
|
237
|
+
const value = activity.value;
|
|
238
|
+
if (!value) {
|
|
239
|
+
const response = this.createAdaptiveCardInvokeErrorResponse(statusCodes_1.StatusCodes.BAD_REQUEST, 'BadRequest', 'Missing value property');
|
|
240
|
+
throw new invokeException_1.InvokeException(statusCodes_1.StatusCodes.BAD_REQUEST, response);
|
|
241
|
+
}
|
|
242
|
+
if (value.action.type !== 'Action.Execute') {
|
|
243
|
+
const response = this.createAdaptiveCardInvokeErrorResponse(statusCodes_1.StatusCodes.BAD_REQUEST, 'NotSupported', `The action '${value.action.type}' is not supported.`);
|
|
244
|
+
throw new invokeException_1.InvokeException(statusCodes_1.StatusCodes.BAD_REQUEST, response);
|
|
245
|
+
}
|
|
246
|
+
const { action, authentication, state } = value;
|
|
247
|
+
const { data, id: actionId, type, verb } = action !== null && action !== void 0 ? action : {};
|
|
248
|
+
const { connectionName, id: authenticationId, token } = authentication !== null && authentication !== void 0 ? authentication : {};
|
|
249
|
+
return {
|
|
250
|
+
action: {
|
|
251
|
+
data,
|
|
252
|
+
id: actionId,
|
|
253
|
+
type,
|
|
254
|
+
verb
|
|
255
|
+
},
|
|
256
|
+
authentication: {
|
|
257
|
+
connectionName,
|
|
258
|
+
id: authenticationId,
|
|
259
|
+
token
|
|
260
|
+
},
|
|
261
|
+
state
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
/** * Creates an error response for AdaptiveCardInvoke. */
|
|
265
|
+
createAdaptiveCardInvokeErrorResponse(statusCode, code, message) {
|
|
266
|
+
return {
|
|
267
|
+
statusCode,
|
|
268
|
+
type: 'application/vnd.microsoft.error',
|
|
269
|
+
value: { code, message }
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
/** * Handles the MessageReaction activity. */
|
|
273
|
+
async onMessageReactionActivity(context) {
|
|
274
|
+
await this.handle(context, 'MessageReaction', async () => {
|
|
275
|
+
await this.dispatchMessageReactionActivity(context);
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
/** * Handles the EndOfConversation activity. */
|
|
279
|
+
async onEndOfConversationActivity(context) {
|
|
280
|
+
await this.handle(context, 'EndOfConversation', this.defaultNextEvent(context));
|
|
281
|
+
}
|
|
282
|
+
/** * Handles the Typing activity. */
|
|
283
|
+
async onTypingActivity(context) {
|
|
284
|
+
await this.handle(context, 'Typing', this.defaultNextEvent(context));
|
|
285
|
+
}
|
|
286
|
+
/** * Handles the InstallationUpdate activity. */
|
|
287
|
+
async onInstallationUpdateActivity(context) {
|
|
288
|
+
switch (context.activity.action) {
|
|
289
|
+
case 'add':
|
|
290
|
+
case 'add-upgrade':
|
|
291
|
+
await this.handle(context, 'InstallationUpdateAdd', this.defaultNextEvent(context));
|
|
292
|
+
return;
|
|
293
|
+
case 'remove':
|
|
294
|
+
case 'remove-upgrade':
|
|
295
|
+
await this.handle(context, 'InstallationUpdateRemove', this.defaultNextEvent(context));
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
/** * Handles unrecognized activity types. */
|
|
299
|
+
async onUnrecognizedActivity(context) {
|
|
300
|
+
await this.handle(context, 'UnrecognizedActivityType', this.defaultNextEvent(context));
|
|
301
|
+
}
|
|
302
|
+
/** * Dispatches the ConversationUpdate activity. */
|
|
303
|
+
async dispatchConversationUpdateActivity(context) {
|
|
304
|
+
if ((context.activity.membersAdded != null) && context.activity.membersAdded.length > 0) {
|
|
305
|
+
await this.handle(context, 'MembersAdded', this.defaultNextEvent(context));
|
|
306
|
+
}
|
|
307
|
+
else if ((context.activity.membersRemoved != null) && context.activity.membersRemoved.length > 0) {
|
|
308
|
+
await this.handle(context, 'MembersRemoved', this.defaultNextEvent(context));
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
await this.defaultNextEvent(context)();
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
/** * Dispatches the MessageReaction activity. */
|
|
315
|
+
async dispatchMessageReactionActivity(context) {
|
|
316
|
+
var _a, _b;
|
|
317
|
+
if ((context.activity.reactionsAdded != null) || (context.activity.reactionsRemoved != null)) {
|
|
318
|
+
if ((_a = context.activity.reactionsAdded) === null || _a === void 0 ? void 0 : _a.length) {
|
|
319
|
+
await this.handle(context, 'ReactionsAdded', this.defaultNextEvent(context));
|
|
320
|
+
}
|
|
321
|
+
if ((_b = context.activity.reactionsRemoved) === null || _b === void 0 ? void 0 : _b.length) {
|
|
322
|
+
await this.handle(context, 'ReactionsRemoved', this.defaultNextEvent(context));
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
await this.defaultNextEvent(context)();
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
/** * Dispatches the MessageUpdate activity. */
|
|
330
|
+
async dispatchMessageUpdateActivity(context) {
|
|
331
|
+
await this.defaultNextEvent(context)();
|
|
332
|
+
}
|
|
333
|
+
/** * Dispatches the MessageDelete activity. */
|
|
334
|
+
async dispatchMessageDeleteActivity(context) {
|
|
335
|
+
await this.defaultNextEvent(context)();
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Returns the default next event handler.
|
|
339
|
+
*/
|
|
340
|
+
defaultNextEvent(context) {
|
|
341
|
+
const defaultHandler = async () => {
|
|
342
|
+
await this.handle(context, 'Default', async () => {
|
|
343
|
+
// noop
|
|
344
|
+
});
|
|
345
|
+
};
|
|
346
|
+
return defaultHandler;
|
|
347
|
+
}
|
|
348
|
+
/** * Registers a handler for a specific activity type. */
|
|
349
|
+
on(type, handler) {
|
|
350
|
+
if (!this.handlers[type]) {
|
|
351
|
+
this.handlers[type] = [handler];
|
|
352
|
+
}
|
|
353
|
+
else {
|
|
354
|
+
this.handlers[type].push(handler);
|
|
355
|
+
}
|
|
356
|
+
return this;
|
|
357
|
+
}
|
|
358
|
+
/** * Executes the handlers for a specific activity type. */
|
|
359
|
+
async handle(context, type, onNext) {
|
|
360
|
+
let returnValue = null;
|
|
361
|
+
async function runHandler(index) {
|
|
362
|
+
if (index < handlers.length) {
|
|
363
|
+
const val = await handlers[index](context, async () => await runHandler(index + 1));
|
|
364
|
+
if (typeof val !== 'undefined' && returnValue === null) {
|
|
365
|
+
returnValue = val;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
else {
|
|
369
|
+
const val = await onNext();
|
|
370
|
+
if (typeof val !== 'undefined') {
|
|
371
|
+
returnValue = val;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
logger.info(`${type} handler called`);
|
|
376
|
+
const handlers = this.handlers[type] || [];
|
|
377
|
+
await runHandler(0);
|
|
378
|
+
return returnValue;
|
|
379
|
+
}
|
|
380
|
+
/** * Creates an InvokeResponse object. */
|
|
381
|
+
static createInvokeResponse(body) {
|
|
382
|
+
return { status: 200, body };
|
|
383
|
+
}
|
|
384
|
+
/** * Dispatches the Event activity. */
|
|
385
|
+
async dispatchEventActivity(context) {
|
|
386
|
+
if (context.activity.name === tokenResponseEventName_1.tokenResponseEventName) {
|
|
387
|
+
await this.handle(context, 'TokenResponseEvent', this.defaultNextEvent(context));
|
|
388
|
+
}
|
|
389
|
+
else {
|
|
390
|
+
await this.defaultNextEvent(context)();
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
exports.ActivityHandler = ActivityHandler;
|
|
395
|
+
//# sourceMappingURL=activityHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activityHandler.js","sourceRoot":"","sources":["../../src/activityHandler.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,qCAAgC;AAEhC,gEAA8E;AAC9E,+CAA2C;AAE3C,8DAA0D;AAK1D,qEAAiE;AAEjE,qCAAqC;AACxB,QAAA,mBAAmB,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAA;AAK3D,MAAM,MAAM,GAAG,IAAA,cAAK,EAAC,yBAAyB,CAAC,CAAA;AAE/C,wFAAwF;AACxF,MAAa,eAAe;IAA5B;QACqB,aAAQ,GAAuC,EAAE,CAAA;IAkbtE,CAAC;IAhbC,wDAAwD;IACxD,MAAM,CAAE,OAAqB;QAC3B,OAAO,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACjC,CAAC;IAED,gEAAgE;IAChE,cAAc,CAAE,OAAqB;QACnC,OAAO,IAAI,CAAC,EAAE,CAAC,cAAc,EAAE,OAAO,CAAC,CAAA;IACzC,CAAC;IAED,kEAAkE;IAClE,gBAAgB,CAAE,OAAqB;QACrC,OAAO,IAAI,CAAC,EAAE,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAA;IAC3C,CAAC;IAED,2DAA2D;IAC3D,SAAS,CAAE,OAAqB;QAC9B,OAAO,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;IACpC,CAAC;IAED,iEAAiE;IACjE,eAAe,CAAE,OAAqB;QACpC,OAAO,IAAI,CAAC,EAAE,CAAC,eAAe,EAAE,OAAO,CAAC,CAAA;I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ft/agents-activity';
|
|
3
|
+
export interface AgentClientConfig {
|
|
4
|
+
endPoint: string;
|
|
5
|
+
clientId: string;
|
|
6
|
+
serviceUrl: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class AgentClient {
|
|
9
|
+
agentClientConfig: AgentClientConfig;
|
|
10
|
+
constructor(agentConfigKey: string);
|
|
11
|
+
postActivity(activity: Activity, authConfig: AuthConfiguration): Promise<string>;
|
|
12
|
+
private loadAgentClientConfig;
|
|
13
|
+
}
|