@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
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { AgentHandler } from './activityHandler';
|
|
6
|
+
import { BaseAdapter } from './baseAdapter';
|
|
7
|
+
import { TurnContext } from './turnContext';
|
|
8
|
+
import { Response } from 'express';
|
|
9
|
+
import { Request } from './auth/request';
|
|
10
|
+
import { ConnectorClient } from './connector-client/connectorClient';
|
|
11
|
+
import { AuthConfiguration } from './auth/authConfiguration';
|
|
12
|
+
import { AuthProvider } from './auth/authProvider';
|
|
13
|
+
import { Activity, ConversationReference } from '@microsoft/agents-activity';
|
|
14
|
+
import { ResourceResponse } from './connector-client/resourceResponse';
|
|
15
|
+
import { ConversationParameters } from './connector-client/conversationParameters';
|
|
16
|
+
import { InvokeResponse } from './invoke/invokeResponse';
|
|
17
|
+
import { AttachmentInfo } from './connector-client/attachmentInfo';
|
|
18
|
+
import { AttachmentData } from './connector-client/attachmentData';
|
|
19
|
+
/**
|
|
20
|
+
* Adapter for handling agent interactions.
|
|
21
|
+
*/
|
|
22
|
+
export declare class CloudAdapter extends BaseAdapter {
|
|
23
|
+
connectorClient: ConnectorClient;
|
|
24
|
+
/**
|
|
25
|
+
* Creates an instance of CloudAdapter.
|
|
26
|
+
* @param authConfig - The authentication configuration.
|
|
27
|
+
* @param authProvider - The authentication provider.
|
|
28
|
+
*/
|
|
29
|
+
constructor(authConfig: AuthConfiguration, authProvider?: AuthProvider);
|
|
30
|
+
protected createConnectorClient(serviceUrl: string, scope: string): Promise<ConnectorClient>;
|
|
31
|
+
protected setConnectorClient(context: TurnContext): void;
|
|
32
|
+
/**
|
|
33
|
+
* Creates a TurnContext for the given activity and logic.
|
|
34
|
+
* @param activity - The activity to process.
|
|
35
|
+
* @param logic - The logic to execute.
|
|
36
|
+
* @returns The created TurnContext.
|
|
37
|
+
*/
|
|
38
|
+
createTurnContext(activity: Activity, logic: AgentHandler): TurnContext;
|
|
39
|
+
createTurnContextWithScope(activity: Activity, logic: AgentHandler, scope: string): Promise<TurnContext>;
|
|
40
|
+
/**
|
|
41
|
+
* Sends multiple activities to the conversation.
|
|
42
|
+
* @param context - The TurnContext for the current turn.
|
|
43
|
+
* @param activities - The activities to send.
|
|
44
|
+
* @returns A promise representing the array of ResourceResponses for the sent activities.
|
|
45
|
+
*/
|
|
46
|
+
sendActivities(context: TurnContext, activities: Activity[]): Promise<ResourceResponse[]>;
|
|
47
|
+
/**
|
|
48
|
+
* Replies to an activity.
|
|
49
|
+
* @param activity - The activity to reply to.
|
|
50
|
+
* @returns A promise representing the ResourceResponse for the sent activity.
|
|
51
|
+
*/
|
|
52
|
+
replyToActivity(activity: Activity): Promise<ResourceResponse>;
|
|
53
|
+
/**
|
|
54
|
+
* Processes an incoming request and sends the response.
|
|
55
|
+
* @param request - The incoming request.
|
|
56
|
+
* @param res - The response to send.
|
|
57
|
+
* @param logic - The logic to execute.
|
|
58
|
+
*/
|
|
59
|
+
process(request: Request, res: Response, logic: (context: TurnContext) => Promise<void>): Promise<void>;
|
|
60
|
+
private isValidChannelActivity;
|
|
61
|
+
/**
|
|
62
|
+
* Updates an activity.
|
|
63
|
+
* @param context - The TurnContext for the current turn.
|
|
64
|
+
* @param activity - The activity to update.
|
|
65
|
+
* @returns A promise representing the ResourceResponse for the updated activity.
|
|
66
|
+
*/
|
|
67
|
+
updateActivity(context: TurnContext, activity: Activity): Promise<ResourceResponse | void>;
|
|
68
|
+
/**
|
|
69
|
+
* Deletes an activity.
|
|
70
|
+
* @param context - The TurnContext for the current turn.
|
|
71
|
+
* @param reference - The conversation reference of the activity to delete.
|
|
72
|
+
* @returns A promise representing the completion of the delete operation.
|
|
73
|
+
*/
|
|
74
|
+
deleteActivity(context: TurnContext, reference: Partial<ConversationReference>): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Continues a conversation.
|
|
77
|
+
* @param reference - The conversation reference to continue.
|
|
78
|
+
* @param logic - The logic to execute.
|
|
79
|
+
* @returns A promise representing the completion of the continue operation.
|
|
80
|
+
*/
|
|
81
|
+
continueConversation(reference: ConversationReference, logic: (revocableContext: TurnContext) => Promise<void>, isResponse?: Boolean): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Processes the turn results and returns an InvokeResponse if applicable.
|
|
84
|
+
* @param context - The TurnContext for the current turn.
|
|
85
|
+
* @returns The InvokeResponse if applicable, otherwise undefined.
|
|
86
|
+
*/
|
|
87
|
+
protected processTurnResults(context: TurnContext): InvokeResponse | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* Creates an activity to represent the result of creating a conversation.
|
|
90
|
+
* @param createdConversationId - The ID of the created conversation.
|
|
91
|
+
* @param channelId - The channel ID.
|
|
92
|
+
* @param serviceUrl - The service URL.
|
|
93
|
+
* @param conversationParameters - The conversation parameters.
|
|
94
|
+
* @returns The created activity.
|
|
95
|
+
*/
|
|
96
|
+
protected createCreateActivity(createdConversationId: string | undefined, channelId: string, serviceUrl: string, conversationParameters: ConversationParameters): Activity;
|
|
97
|
+
/**
|
|
98
|
+
* Creates a conversation.
|
|
99
|
+
* @param agentAppId - The agent application ID.
|
|
100
|
+
* @param channelId - The channel ID.
|
|
101
|
+
* @param serviceUrl - The service URL.
|
|
102
|
+
* @param audience - The audience.
|
|
103
|
+
* @param conversationParameters - The conversation parameters.
|
|
104
|
+
* @param logic - The logic to execute.
|
|
105
|
+
* @returns A promise representing the completion of the create operation.
|
|
106
|
+
*/
|
|
107
|
+
createConversationAsync(agentAppId: string, channelId: string, serviceUrl: string, audience: string, conversationParameters: ConversationParameters, logic: (context: TurnContext) => Promise<void>): Promise<void>;
|
|
108
|
+
/**
|
|
109
|
+
* Uploads an attachment.
|
|
110
|
+
* @param conversationId - The conversation ID.
|
|
111
|
+
* @param attachmentData - The attachment data.
|
|
112
|
+
* @returns A promise representing the ResourceResponse for the uploaded attachment.
|
|
113
|
+
*/
|
|
114
|
+
uploadAttachment(conversationId: string, attachmentData: AttachmentData): Promise<ResourceResponse>;
|
|
115
|
+
/**
|
|
116
|
+
* Gets attachment information.
|
|
117
|
+
* @param attachmentId - The attachment ID.
|
|
118
|
+
* @returns A promise representing the AttachmentInfo for the requested attachment.
|
|
119
|
+
*/
|
|
120
|
+
getAttachmentInfo(attachmentId: string): Promise<AttachmentInfo>;
|
|
121
|
+
/**
|
|
122
|
+
* Gets an attachment.
|
|
123
|
+
* @param attachmentId - The attachment ID.
|
|
124
|
+
* @param viewId - The view ID.
|
|
125
|
+
* @returns A promise representing the NodeJS.ReadableStream for the requested attachment.
|
|
126
|
+
*/
|
|
127
|
+
getAttachment(attachmentId: string, viewId: string): Promise<NodeJS.ReadableStream>;
|
|
128
|
+
}
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
+
var ownKeys = function(o) {
|
|
24
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
+
var ar = [];
|
|
26
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
return ownKeys(o);
|
|
30
|
+
};
|
|
31
|
+
return function (mod) {
|
|
32
|
+
if (mod && mod.__esModule) return mod;
|
|
33
|
+
var result = {};
|
|
34
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
+
__setModuleDefault(result, mod);
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.CloudAdapter = void 0;
|
|
41
|
+
const activityHandler_1 = require("./activityHandler");
|
|
42
|
+
const baseAdapter_1 = require("./baseAdapter");
|
|
43
|
+
const turnContext_1 = require("./turnContext");
|
|
44
|
+
const connectorClient_1 = require("./connector-client/connectorClient");
|
|
45
|
+
const agents_activity_1 = require("@microsoft/agents-activity");
|
|
46
|
+
const msalTokenProvider_1 = require("./auth/msalTokenProvider");
|
|
47
|
+
const uuid = __importStar(require("uuid"));
|
|
48
|
+
const logger_1 = require("./logger");
|
|
49
|
+
const statusCodes_1 = require("./statusCodes");
|
|
50
|
+
const logger = (0, logger_1.debug)('agents:cloud-adapter');
|
|
51
|
+
/**
|
|
52
|
+
* Adapter for handling agent interactions.
|
|
53
|
+
*/
|
|
54
|
+
class CloudAdapter extends baseAdapter_1.BaseAdapter {
|
|
55
|
+
/**
|
|
56
|
+
* Creates an instance of CloudAdapter.
|
|
57
|
+
* @param authConfig - The authentication configuration.
|
|
58
|
+
* @param authProvider - The authentication provider.
|
|
59
|
+
*/
|
|
60
|
+
constructor(authConfig, authProvider) {
|
|
61
|
+
super();
|
|
62
|
+
this.authConfig = authConfig;
|
|
63
|
+
if (authProvider === undefined) {
|
|
64
|
+
this.authProvider = new msalTokenProvider_1.MsalTokenProvider();
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
this.authProvider = authProvider;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async createConnectorClient(serviceUrl, scope) {
|
|
71
|
+
return connectorClient_1.ConnectorClient.createClientWithAuthAsync(serviceUrl, this.authConfig, this.authProvider, scope);
|
|
72
|
+
}
|
|
73
|
+
setConnectorClient(context) {
|
|
74
|
+
context.turnState.set('connectorClient', this.connectorClient);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Creates a TurnContext for the given activity and logic.
|
|
78
|
+
* @param activity - The activity to process.
|
|
79
|
+
* @param logic - The logic to execute.
|
|
80
|
+
* @returns The created TurnContext.
|
|
81
|
+
*/
|
|
82
|
+
createTurnContext(activity, logic) {
|
|
83
|
+
return new turnContext_1.TurnContext(this, activity);
|
|
84
|
+
}
|
|
85
|
+
async createTurnContextWithScope(activity, logic, scope) {
|
|
86
|
+
this.connectorClient = await connectorClient_1.ConnectorClient.createClientWithAuthAsync(activity.serviceUrl, this.authConfig, this.authProvider, scope);
|
|
87
|
+
return new turnContext_1.TurnContext(this, activity);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Sends multiple activities to the conversation.
|
|
91
|
+
* @param context - The TurnContext for the current turn.
|
|
92
|
+
* @param activities - The activities to send.
|
|
93
|
+
* @returns A promise representing the array of ResourceResponses for the sent activities.
|
|
94
|
+
*/
|
|
95
|
+
async sendActivities(context, activities) {
|
|
96
|
+
var _a;
|
|
97
|
+
if (!context) {
|
|
98
|
+
throw new TypeError('`context` parameter required');
|
|
99
|
+
}
|
|
100
|
+
if (!activities) {
|
|
101
|
+
throw new TypeError('`activities` parameter required');
|
|
102
|
+
}
|
|
103
|
+
if (activities.length === 0) {
|
|
104
|
+
throw new Error('Expecting one or more activities, but the array was empty.');
|
|
105
|
+
}
|
|
106
|
+
const responses = [];
|
|
107
|
+
for (const activity of activities) {
|
|
108
|
+
delete activity.id;
|
|
109
|
+
let response = { id: '' };
|
|
110
|
+
if (activity.type === agents_activity_1.ActivityTypes.Delay) {
|
|
111
|
+
await setTimeout(() => { }, typeof activity.value === 'number' ? activity.value : 1000);
|
|
112
|
+
}
|
|
113
|
+
else if (activity.type === agents_activity_1.ActivityTypes.InvokeResponse) {
|
|
114
|
+
context.turnState.set(activityHandler_1.INVOKE_RESPONSE_KEY, activity);
|
|
115
|
+
}
|
|
116
|
+
else if (activity.type === agents_activity_1.ActivityTypes.Trace && activity.channelId !== agents_activity_1.Channels.Emulator) {
|
|
117
|
+
// no-op
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
if (!activity.serviceUrl || (activity.conversation == null) || !activity.conversation.id) {
|
|
121
|
+
throw new Error('Invalid activity object');
|
|
122
|
+
}
|
|
123
|
+
if (activity.replyToId) {
|
|
124
|
+
response = await this.connectorClient.replyToActivityAsync(activity.conversation.id, activity.replyToId, activity);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
response = await this.connectorClient.sendToConversationAsync(activity.conversation.id, activity);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (!response) {
|
|
131
|
+
response = { id: (_a = activity.id) !== null && _a !== void 0 ? _a : '' };
|
|
132
|
+
}
|
|
133
|
+
responses.push(response);
|
|
134
|
+
}
|
|
135
|
+
return responses;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Replies to an activity.
|
|
139
|
+
* @param activity - The activity to reply to.
|
|
140
|
+
* @returns A promise representing the ResourceResponse for the sent activity.
|
|
141
|
+
*/
|
|
142
|
+
async replyToActivity(activity) {
|
|
143
|
+
if (!activity.serviceUrl || (activity.conversation == null) || !activity.conversation.id || !activity.id) {
|
|
144
|
+
throw new Error('Invalid activity object');
|
|
145
|
+
}
|
|
146
|
+
return await this.connectorClient.replyToActivityAsync(activity.conversation.id, activity.id, activity);
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Processes an incoming request and sends the response.
|
|
150
|
+
* @param request - The incoming request.
|
|
151
|
+
* @param res - The response to send.
|
|
152
|
+
* @param logic - The logic to execute.
|
|
153
|
+
*/
|
|
154
|
+
async process(request, res, logic) {
|
|
155
|
+
var _a, _b, _c, _d, _e, _f;
|
|
156
|
+
const end = (status, body, isInvokeResponseOrExpectReplies = false) => {
|
|
157
|
+
res.status(status);
|
|
158
|
+
if (isInvokeResponseOrExpectReplies) {
|
|
159
|
+
res.setHeader('content-type', 'application/json');
|
|
160
|
+
}
|
|
161
|
+
if (body) {
|
|
162
|
+
res.send(body);
|
|
163
|
+
}
|
|
164
|
+
res.end();
|
|
165
|
+
};
|
|
166
|
+
const activity = agents_activity_1.Activity.fromObject(request.body);
|
|
167
|
+
if (!this.isValidChannelActivity(activity)) {
|
|
168
|
+
return end(statusCodes_1.StatusCodes.BAD_REQUEST);
|
|
169
|
+
}
|
|
170
|
+
logger.debug('Received activity: ', activity);
|
|
171
|
+
if ((activity === null || activity === void 0 ? void 0 : activity.type) === agents_activity_1.ActivityTypes.InvokeResponse ||
|
|
172
|
+
(activity === null || activity === void 0 ? void 0 : activity.type) === agents_activity_1.ActivityTypes.Invoke ||
|
|
173
|
+
(activity === null || activity === void 0 ? void 0 : activity.deliveryMode) === agents_activity_1.DeliveryModes.ExpectReplies) {
|
|
174
|
+
const context = this.createTurnContext(activity, logic);
|
|
175
|
+
await this.runMiddleware(context, logic);
|
|
176
|
+
const invokeResponse = this.processTurnResults(context);
|
|
177
|
+
return end((_a = invokeResponse === null || invokeResponse === void 0 ? void 0 : invokeResponse.status) !== null && _a !== void 0 ? _a : statusCodes_1.StatusCodes.OK, JSON.stringify(invokeResponse === null || invokeResponse === void 0 ? void 0 : invokeResponse.body), true);
|
|
178
|
+
}
|
|
179
|
+
const scope = (_e = (_c = (_b = request.user) === null || _b === void 0 ? void 0 : _b.azp) !== null && _c !== void 0 ? _c : (_d = request.user) === null || _d === void 0 ? void 0 : _d.appid) !== null && _e !== void 0 ? _e : 'https://api.botframework.com';
|
|
180
|
+
logger.debug('Creating connector client with scope: ', scope);
|
|
181
|
+
this.connectorClient = await this.createConnectorClient(activity.serviceUrl, scope);
|
|
182
|
+
const context = this.createTurnContext(activity, logic);
|
|
183
|
+
this.setConnectorClient(context);
|
|
184
|
+
await this.runMiddleware(context, logic);
|
|
185
|
+
const invokeResponse = this.processTurnResults(context);
|
|
186
|
+
return end((_f = invokeResponse === null || invokeResponse === void 0 ? void 0 : invokeResponse.status) !== null && _f !== void 0 ? _f : statusCodes_1.StatusCodes.OK, invokeResponse === null || invokeResponse === void 0 ? void 0 : invokeResponse.body);
|
|
187
|
+
}
|
|
188
|
+
isValidChannelActivity(activity) {
|
|
189
|
+
var _a, _b;
|
|
190
|
+
if (activity == null) {
|
|
191
|
+
logger.warn('BadRequest: Missing activity');
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
if (activity.type == null || activity.type === '') {
|
|
195
|
+
logger.warn('BadRequest: Missing activity type');
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
if (((_a = activity.conversation) === null || _a === void 0 ? void 0 : _a.id) == null || ((_b = activity.conversation) === null || _b === void 0 ? void 0 : _b.id) === '') {
|
|
199
|
+
logger.warn('BadRequest: Missing conversation.Id');
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
202
|
+
return true;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Updates an activity.
|
|
206
|
+
* @param context - The TurnContext for the current turn.
|
|
207
|
+
* @param activity - The activity to update.
|
|
208
|
+
* @returns A promise representing the ResourceResponse for the updated activity.
|
|
209
|
+
*/
|
|
210
|
+
async updateActivity(context, activity) {
|
|
211
|
+
if (!context) {
|
|
212
|
+
throw new TypeError('`context` parameter required');
|
|
213
|
+
}
|
|
214
|
+
if (!activity) {
|
|
215
|
+
throw new TypeError('`activity` parameter required');
|
|
216
|
+
}
|
|
217
|
+
if (!activity.serviceUrl || (activity.conversation == null) || !activity.conversation.id || !activity.id) {
|
|
218
|
+
throw new Error('Invalid activity object');
|
|
219
|
+
}
|
|
220
|
+
const response = await this.connectorClient.updateActivityAsync(activity.conversation.id, activity.id, activity);
|
|
221
|
+
return response.id ? { id: response.id } : undefined;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Deletes an activity.
|
|
225
|
+
* @param context - The TurnContext for the current turn.
|
|
226
|
+
* @param reference - The conversation reference of the activity to delete.
|
|
227
|
+
* @returns A promise representing the completion of the delete operation.
|
|
228
|
+
*/
|
|
229
|
+
async deleteActivity(context, reference) {
|
|
230
|
+
if (!context) {
|
|
231
|
+
throw new TypeError('`context` parameter required');
|
|
232
|
+
}
|
|
233
|
+
if (!reference || !reference.serviceUrl || (reference.conversation == null) || !reference.conversation.id || !reference.activityId) {
|
|
234
|
+
throw new Error('Invalid conversation reference object');
|
|
235
|
+
}
|
|
236
|
+
await this.connectorClient.deleteActivityAsync(reference.conversation.id, reference.activityId);
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Continues a conversation.
|
|
240
|
+
* @param reference - The conversation reference to continue.
|
|
241
|
+
* @param logic - The logic to execute.
|
|
242
|
+
* @returns A promise representing the completion of the continue operation.
|
|
243
|
+
*/
|
|
244
|
+
async continueConversation(reference, logic, isResponse = false) {
|
|
245
|
+
if (!reference || !reference.serviceUrl || (reference.conversation == null) || !reference.conversation.id) {
|
|
246
|
+
throw new Error('Invalid conversation reference object');
|
|
247
|
+
}
|
|
248
|
+
let context;
|
|
249
|
+
if (isResponse) {
|
|
250
|
+
context = await this.createTurnContextWithScope(agents_activity_1.Activity.getContinuationActivity(reference), logic, 'https://api.botframework.com');
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
context = this.createTurnContext(agents_activity_1.Activity.getContinuationActivity(reference), logic);
|
|
254
|
+
}
|
|
255
|
+
await this.runMiddleware(context, logic);
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Processes the turn results and returns an InvokeResponse if applicable.
|
|
259
|
+
* @param context - The TurnContext for the current turn.
|
|
260
|
+
* @returns The InvokeResponse if applicable, otherwise undefined.
|
|
261
|
+
*/
|
|
262
|
+
processTurnResults(context) {
|
|
263
|
+
// Handle ExpectedReplies scenarios where all activities have been buffered and sent back at once in an invoke response.
|
|
264
|
+
if (context.activity.deliveryMode === agents_activity_1.DeliveryModes.ExpectReplies) {
|
|
265
|
+
return {
|
|
266
|
+
status: statusCodes_1.StatusCodes.OK,
|
|
267
|
+
body: {
|
|
268
|
+
activities: context.bufferedReplyActivities
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
// Handle Invoke scenarios where the agent will return a specific body and return code.
|
|
273
|
+
if (context.activity.type === agents_activity_1.ActivityTypes.Invoke) {
|
|
274
|
+
const activityInvokeResponse = context.turnState.get(activityHandler_1.INVOKE_RESPONSE_KEY);
|
|
275
|
+
if (!activityInvokeResponse) {
|
|
276
|
+
return { status: statusCodes_1.StatusCodes.NOT_IMPLEMENTED };
|
|
277
|
+
}
|
|
278
|
+
return activityInvokeResponse.value;
|
|
279
|
+
}
|
|
280
|
+
// No body to return.
|
|
281
|
+
return undefined;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Creates an activity to represent the result of creating a conversation.
|
|
285
|
+
* @param createdConversationId - The ID of the created conversation.
|
|
286
|
+
* @param channelId - The channel ID.
|
|
287
|
+
* @param serviceUrl - The service URL.
|
|
288
|
+
* @param conversationParameters - The conversation parameters.
|
|
289
|
+
* @returns The created activity.
|
|
290
|
+
*/
|
|
291
|
+
createCreateActivity(createdConversationId, channelId, serviceUrl, conversationParameters) {
|
|
292
|
+
// Create a conversation update activity to represent the result.
|
|
293
|
+
const activity = new agents_activity_1.Activity(agents_activity_1.ActivityTypes.Event);
|
|
294
|
+
activity.name = agents_activity_1.ActivityEventNames.CreateConversation;
|
|
295
|
+
activity.channelId = channelId;
|
|
296
|
+
activity.serviceUrl = serviceUrl;
|
|
297
|
+
activity.id = createdConversationId !== null && createdConversationId !== void 0 ? createdConversationId : uuid.v4();
|
|
298
|
+
activity.conversation = {
|
|
299
|
+
conversationType: undefined,
|
|
300
|
+
id: createdConversationId,
|
|
301
|
+
isGroup: conversationParameters.isGroup,
|
|
302
|
+
name: undefined,
|
|
303
|
+
tenantId: conversationParameters.tenantId,
|
|
304
|
+
};
|
|
305
|
+
activity.channelData = conversationParameters.channelData;
|
|
306
|
+
activity.recipient = conversationParameters.bot;
|
|
307
|
+
return activity;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Creates a conversation.
|
|
311
|
+
* @param agentAppId - The agent application ID.
|
|
312
|
+
* @param channelId - The channel ID.
|
|
313
|
+
* @param serviceUrl - The service URL.
|
|
314
|
+
* @param audience - The audience.
|
|
315
|
+
* @param conversationParameters - The conversation parameters.
|
|
316
|
+
* @param logic - The logic to execute.
|
|
317
|
+
* @returns A promise representing the completion of the create operation.
|
|
318
|
+
*/
|
|
319
|
+
async createConversationAsync(agentAppId, channelId, serviceUrl, audience, conversationParameters, logic) {
|
|
320
|
+
if (typeof serviceUrl !== 'string' || !serviceUrl) {
|
|
321
|
+
throw new TypeError('`serviceUrl` must be a non-empty string');
|
|
322
|
+
}
|
|
323
|
+
if (!conversationParameters)
|
|
324
|
+
throw new TypeError('`conversationParameters` must be defined');
|
|
325
|
+
if (!logic)
|
|
326
|
+
throw new TypeError('`logic` must be defined');
|
|
327
|
+
const restClient = await this.createConnectorClient(serviceUrl, audience);
|
|
328
|
+
const createConversationResult = await restClient.createConversationAsync(conversationParameters);
|
|
329
|
+
const createActivity = this.createCreateActivity(createConversationResult.id, channelId, serviceUrl, conversationParameters);
|
|
330
|
+
const context = new turnContext_1.TurnContext(this, createActivity);
|
|
331
|
+
await this.runMiddleware(context, logic);
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Uploads an attachment.
|
|
335
|
+
* @param conversationId - The conversation ID.
|
|
336
|
+
* @param attachmentData - The attachment data.
|
|
337
|
+
* @returns A promise representing the ResourceResponse for the uploaded attachment.
|
|
338
|
+
*/
|
|
339
|
+
async uploadAttachment(conversationId, attachmentData) {
|
|
340
|
+
if (conversationId === undefined) {
|
|
341
|
+
throw new Error('conversationId is required');
|
|
342
|
+
}
|
|
343
|
+
if (attachmentData === undefined) {
|
|
344
|
+
throw new Error('attachmentData is required');
|
|
345
|
+
}
|
|
346
|
+
return await this.connectorClient.uploadAttachment(conversationId, attachmentData);
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Gets attachment information.
|
|
350
|
+
* @param attachmentId - The attachment ID.
|
|
351
|
+
* @returns A promise representing the AttachmentInfo for the requested attachment.
|
|
352
|
+
*/
|
|
353
|
+
async getAttachmentInfo(attachmentId) {
|
|
354
|
+
if (attachmentId === undefined) {
|
|
355
|
+
throw new Error('attachmentId is required');
|
|
356
|
+
}
|
|
357
|
+
return await this.connectorClient.getAttachmentInfo(attachmentId);
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Gets an attachment.
|
|
361
|
+
* @param attachmentId - The attachment ID.
|
|
362
|
+
* @param viewId - The view ID.
|
|
363
|
+
* @returns A promise representing the NodeJS.ReadableStream for the requested attachment.
|
|
364
|
+
*/
|
|
365
|
+
async getAttachment(attachmentId, viewId) {
|
|
366
|
+
if (attachmentId === undefined) {
|
|
367
|
+
throw new Error('attachmentId is required');
|
|
368
|
+
}
|
|
369
|
+
if (viewId === undefined) {
|
|
370
|
+
throw new Error('viewId is required');
|
|
371
|
+
}
|
|
372
|
+
return await this.connectorClient.getAttachment(attachmentId, viewId);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
exports.CloudAdapter = CloudAdapter;
|
|
376
|
+
//# sourceMappingURL=cloudAdapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloudAdapter.js","sourceRoot":"","sources":["../../src/cloudAdapter.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;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,MAAM,IAAI,CAAC,eAAe,CAAC,gBAAgB,CAAC,cAAc,EAAE,cAAc,CAAC,CAAA;IACpF,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,iBAAiB,CAAE,YAAoB;QAC3C,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;QAC7C,CAAC;QAED,OAAO,MAAM,IAAI,CAAC,eAAe,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAA;IACnE,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,aAAa,CAAE,YAAoB,EAAE,MAAc;QACvD,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;QAC7C,CAAC;QAED,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAA;QACvC,CAAC;QAED,OAAO,MAAM,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,YAAY,EAAE,MAAM,CAAC,CAAA;IACvE,CAAC;CACF;AAjZD,oCAiZC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Represents the data of an attachment.
|
|
7
|
+
*/
|
|
8
|
+
export interface AttachmentData {
|
|
9
|
+
/**
|
|
10
|
+
* The type of the attachment.
|
|
11
|
+
*/
|
|
12
|
+
type: string;
|
|
13
|
+
/**
|
|
14
|
+
* The name of the attachment.
|
|
15
|
+
*/
|
|
16
|
+
name: string;
|
|
17
|
+
/**
|
|
18
|
+
* The original data of the attachment in Base64 format.
|
|
19
|
+
*/
|
|
20
|
+
originalBase64: Uint8Array;
|
|
21
|
+
/**
|
|
22
|
+
* The thumbnail data of the attachment in Base64 format.
|
|
23
|
+
*/
|
|
24
|
+
thumbnailBase64: Uint8Array;
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachmentData.js","sourceRoot":"","sources":["../../../src/connector-client/attachmentData.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { AttachmentView } from './attachmentView';
|
|
6
|
+
/**
|
|
7
|
+
* Represents information about an attachment.
|
|
8
|
+
*/
|
|
9
|
+
export interface AttachmentInfo {
|
|
10
|
+
/**
|
|
11
|
+
* The name of the attachment.
|
|
12
|
+
*/
|
|
13
|
+
name: string;
|
|
14
|
+
/**
|
|
15
|
+
* The type of the attachment.
|
|
16
|
+
*/
|
|
17
|
+
type: string;
|
|
18
|
+
/**
|
|
19
|
+
* The views of the attachment.
|
|
20
|
+
*/
|
|
21
|
+
views: AttachmentView[];
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachmentInfo.js","sourceRoot":"","sources":["../../../src/connector-client/attachmentInfo.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Represents a view of an attachment.
|
|
7
|
+
*/
|
|
8
|
+
export interface AttachmentView {
|
|
9
|
+
/**
|
|
10
|
+
* The ID of the view.
|
|
11
|
+
*/
|
|
12
|
+
viewId: string;
|
|
13
|
+
/**
|
|
14
|
+
* The size of the view.
|
|
15
|
+
*/
|
|
16
|
+
size: number;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachmentView.js","sourceRoot":"","sources":["../../../src/connector-client/attachmentView.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|