@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,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { CloudAdapter } from '../cloudAdapter';
|
|
6
|
+
import { InputFileDownloader } from './inputFileDownloader';
|
|
7
|
+
import { TurnState } from './turnState';
|
|
8
|
+
import { Storage } from '../storage';
|
|
9
|
+
import { AuthenticationOptions } from './oauth/authenticationOptions';
|
|
10
|
+
export interface ApplicationOptions<TState extends TurnState> {
|
|
11
|
+
adapter?: CloudAdapter;
|
|
12
|
+
agentAppId?: string;
|
|
13
|
+
storage?: Storage;
|
|
14
|
+
startTypingTimer: boolean;
|
|
15
|
+
longRunningMessages: boolean;
|
|
16
|
+
turnStateFactory: () => TState;
|
|
17
|
+
fileDownloaders?: InputFileDownloader<TState>[];
|
|
18
|
+
authentication?: AuthenticationOptions;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applicationOptions.js","sourceRoot":"","sources":["../../../src/app/applicationOptions.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { InputFile, InputFileDownloader } from './inputFileDownloader';
|
|
6
|
+
import { TurnState } from './turnState';
|
|
7
|
+
import { TurnContext } from '../turnContext';
|
|
8
|
+
export declare class AttachmentDownloader<TState extends TurnState = TurnState> implements InputFileDownloader<TState> {
|
|
9
|
+
private _httpClient;
|
|
10
|
+
constructor();
|
|
11
|
+
downloadFiles(context: TurnContext, state: TState): Promise<InputFile[]>;
|
|
12
|
+
private downloadFile;
|
|
13
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.AttachmentDownloader = void 0;
|
|
11
|
+
const axios_1 = __importDefault(require("axios"));
|
|
12
|
+
const logger_1 = require("../logger");
|
|
13
|
+
const auth_1 = require("../auth");
|
|
14
|
+
const logger = (0, logger_1.debug)('agents:attachmentDownloader');
|
|
15
|
+
class AttachmentDownloader {
|
|
16
|
+
constructor() {
|
|
17
|
+
this._httpClient = axios_1.default.create();
|
|
18
|
+
}
|
|
19
|
+
async downloadFiles(context, state) {
|
|
20
|
+
var _a;
|
|
21
|
+
const attachments = (_a = context.activity.attachments) === null || _a === void 0 ? void 0 : _a.filter((a) => !a.contentType.startsWith('text/html'));
|
|
22
|
+
if (!attachments || attachments.length === 0) {
|
|
23
|
+
logger.info('No Attachments to download');
|
|
24
|
+
return Promise.resolve([]);
|
|
25
|
+
}
|
|
26
|
+
const authProvider = new auth_1.MsalTokenProvider();
|
|
27
|
+
const accessToken = await authProvider.getAccessToken((0, auth_1.loadAuthConfigFromEnv)(), 'https://api.botframework.com');
|
|
28
|
+
const files = [];
|
|
29
|
+
for (const attachment of attachments) {
|
|
30
|
+
const file = await this.downloadFile(attachment, accessToken);
|
|
31
|
+
if (file) {
|
|
32
|
+
files.push(file);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
logger.info('Attachments downloaded');
|
|
36
|
+
return files;
|
|
37
|
+
}
|
|
38
|
+
async downloadFile(attachment, accessToken) {
|
|
39
|
+
if ((attachment.contentUrl && attachment.contentUrl.startsWith('https://')) ||
|
|
40
|
+
(attachment.contentUrl && attachment.contentUrl.startsWith('http://localhost'))) {
|
|
41
|
+
let headers;
|
|
42
|
+
if (accessToken.length > 0) {
|
|
43
|
+
headers = {
|
|
44
|
+
Authorization: `Bearer ${accessToken}`
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
const response = await this._httpClient.get(attachment.contentUrl, {
|
|
48
|
+
headers,
|
|
49
|
+
responseType: 'arraybuffer'
|
|
50
|
+
});
|
|
51
|
+
const content = Buffer.from(response.data, 'binary');
|
|
52
|
+
let contentType = attachment.contentType;
|
|
53
|
+
if (contentType === 'image/*') {
|
|
54
|
+
contentType = 'image/png';
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
content,
|
|
58
|
+
contentType,
|
|
59
|
+
contentUrl: attachment.contentUrl
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
return {
|
|
64
|
+
content: Buffer.from(attachment.content),
|
|
65
|
+
contentType: attachment.contentType,
|
|
66
|
+
contentUrl: attachment.contentUrl
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.AttachmentDownloader = AttachmentDownloader;
|
|
72
|
+
//# sourceMappingURL=attachmentDownloader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachmentDownloader.js","sourceRoot":"","sources":["../../../src/app/attachmentDownloader.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,kDAA4C;AAM5C,sCAAiC;AACjC,kCAAkE;AAElE,MAAM,MAAM,GAAG,IAAA,cAAK,EAAC,6BAA6B,CAAC,CAAA;AAEnD,MAAa,oBAAoB;IAG/B;QACE,IAAI,CAAC,WAAW,GAAG,eAAK,CAAC,MAAM,EAAE,CAAA;IACnC,CAAC;IAEM,KAAK,CAAC,aAAa,CAAE,OAAoB,EAAE,KAAa;;QAC7D,MAAM,WAAW,GAAG,MAAA,OAAO,CAAC,QAAQ,CAAC,WAAW,0CAAE,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,C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AE,aAAa;aAC5B,CAAC,CAAA;YAEF,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;YAEpD,IAAI,WAAW,GAAG,UAAU,CAAC,WAAW,CAAA;YACxC,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;gBAC9B,WAAW,GAAG,WAAW,CAAA;YAC3B,CAAC;YAED,OAAO;gBACL,OAAO;gBACP,WAAW;gBACX,UAAU,EAAE,UAAU,CAAC,UAAU;aAClC,CAAA;QACH,CAAC;aAAM,CAAC;YACN,OAAO;gBACL,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,OAAc,CAAC;gBAC/C,WAAW,EAAE,UAAU,CAAC,WAAW;gBACnC,UAAU,EAAE,UAAU,CAAC,UAAU;aAClC,CAAA;QACH,CAAC;IACH,CAAC;CACF;AAlED,oDAkEC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversationUpdateEvents.js","sourceRoot":"","sources":["../../../src/app/conversationUpdateEvents.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './agentApplication';
|
|
2
|
+
export * from './applicationBuilder';
|
|
3
|
+
export * from './applicationOptions';
|
|
4
|
+
export * from './appRoute';
|
|
5
|
+
export * from './attachmentDownloader';
|
|
6
|
+
export * from './oauth/webChatOAuthFlowAppStyle';
|
|
7
|
+
export * from './conversationUpdateEvents';
|
|
8
|
+
export * from './routeHandler';
|
|
9
|
+
export * from './routeSelector';
|
|
10
|
+
export * from './turnState';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./agentApplication"), exports);
|
|
18
|
+
__exportStar(require("./applicationBuilder"), exports);
|
|
19
|
+
__exportStar(require("./applicationOptions"), exports);
|
|
20
|
+
__exportStar(require("./appRoute"), exports);
|
|
21
|
+
__exportStar(require("./attachmentDownloader"), exports);
|
|
22
|
+
__exportStar(require("./oauth/webChatOAuthFlowAppStyle"), exports);
|
|
23
|
+
__exportStar(require("./conversationUpdateEvents"), exports);
|
|
24
|
+
__exportStar(require("./routeHandler"), exports);
|
|
25
|
+
__exportStar(require("./routeSelector"), exports);
|
|
26
|
+
__exportStar(require("./turnState"), exports);
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/app/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAkC;AAClC,uDAAoC;AACpC,uDAAoC;AACpC,6CAA0B;AAC1B,yDAAsC;AACtC,mEAAgD;AAChD,6DAA0C;AAC1C,iDAA8B;AAC9B,kDAA+B;AAC/B,8CAA2B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { TurnContext } from '../turnContext';
|
|
6
|
+
import { TurnState } from './turnState';
|
|
7
|
+
export interface InputFile {
|
|
8
|
+
content: Buffer;
|
|
9
|
+
contentType: string;
|
|
10
|
+
contentUrl?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface InputFileDownloader<TState extends TurnState = TurnState> {
|
|
13
|
+
downloadFiles(context: TurnContext, state: TState): Promise<InputFile[]>;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inputFileDownloader.js","sourceRoot":"","sources":["../../../src/app/inputFileDownloader.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
export interface Memory {
|
|
6
|
+
deleteValue(path: string): void;
|
|
7
|
+
hasValue(path: string): boolean;
|
|
8
|
+
getValue<TValue = unknown>(path: string): TValue;
|
|
9
|
+
setValue(path: string, value: unknown): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory.js","sourceRoot":"","sources":["../../../src/app/memory.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authenticationOptions.js","sourceRoot":"","sources":["../../../../src/app/oauth/authenticationOptions.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { UserTokenClient } from '../../oauth/userTokenClient';
|
|
2
|
+
import { TurnContext } from '../../turnContext';
|
|
3
|
+
import { TurnState } from '../turnState';
|
|
4
|
+
import { Storage } from '../../storage';
|
|
5
|
+
export declare class WebChatOAuthFlowAppStyle {
|
|
6
|
+
userTokenClient?: UserTokenClient;
|
|
7
|
+
storage: Storage;
|
|
8
|
+
constructor(storage: Storage);
|
|
9
|
+
getOAuthToken(context: TurnContext, state: TurnState): Promise<string>;
|
|
10
|
+
signOut(context: TurnContext, state: TurnState): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.WebChatOAuthFlowAppStyle = void 0;
|
|
6
|
+
const userTokenClient_1 = require("../../oauth/userTokenClient");
|
|
7
|
+
const cardFactory_1 = require("../../cards/cardFactory");
|
|
8
|
+
const messageFactory_1 = require("../../messageFactory");
|
|
9
|
+
const logger_1 = require("../../logger");
|
|
10
|
+
const logger = (0, logger_1.debug)('agents:web-chat-oauth-flow');
|
|
11
|
+
class WebChatOAuthFlowAppStyle {
|
|
12
|
+
constructor(storage) {
|
|
13
|
+
this.storage = storage;
|
|
14
|
+
}
|
|
15
|
+
async getOAuthToken(context, state) {
|
|
16
|
+
var _a, _b, _c;
|
|
17
|
+
if (Object.keys(state.sso).length === 0) {
|
|
18
|
+
state.sso.flowStarted = false;
|
|
19
|
+
state.sso.userToken = '';
|
|
20
|
+
state.sso.flowExpires = 0;
|
|
21
|
+
await state.save(context);
|
|
22
|
+
}
|
|
23
|
+
if (state.sso.userToken !== '') {
|
|
24
|
+
return state.sso.userToken;
|
|
25
|
+
}
|
|
26
|
+
if (((_a = state.sso) === null || _a === void 0 ? void 0 : _a.flowExpires) !== 0 && Date.now() > state.sso.flowExpires) {
|
|
27
|
+
logger.warn('Sign-in flow expired');
|
|
28
|
+
state.sso.flowStarted = false;
|
|
29
|
+
state.sso.userToken = '';
|
|
30
|
+
await context.sendActivity(messageFactory_1.MessageFactory.text('Sign-in session expired. Please try again.'));
|
|
31
|
+
}
|
|
32
|
+
let retVal = '';
|
|
33
|
+
const authConfig = context.adapter.authConfig;
|
|
34
|
+
if (authConfig.connectionName === undefined) {
|
|
35
|
+
throw new Error('connectionName is not set in the auth config, review your environment variables');
|
|
36
|
+
}
|
|
37
|
+
const adapter = context.adapter;
|
|
38
|
+
const scope = 'https://api.botframework.com';
|
|
39
|
+
const accessToken = await adapter.authProvider.getAccessToken(authConfig, scope);
|
|
40
|
+
this.userTokenClient = new userTokenClient_1.UserTokenClient(accessToken);
|
|
41
|
+
if (state.sso.flowStarted === true) {
|
|
42
|
+
const userToken = await this.userTokenClient.getUserToken(authConfig.connectionName, context.activity.channelId, (_b = context.activity.from) === null || _b === void 0 ? void 0 : _b.id);
|
|
43
|
+
if (userToken !== null) {
|
|
44
|
+
logger.info('Token obtained');
|
|
45
|
+
state.sso.userToken = userToken.token;
|
|
46
|
+
state.sso.flowStarted = false;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
const code = context.activity.text;
|
|
50
|
+
const userToken = await this.userTokenClient.getUserToken(authConfig.connectionName, context.activity.channelId, (_c = context.activity.from) === null || _c === void 0 ? void 0 : _c.id, code);
|
|
51
|
+
if (userToken !== null) {
|
|
52
|
+
logger.info('Token obtained with code');
|
|
53
|
+
state.sso.userToken = userToken.token;
|
|
54
|
+
state.sso.flowStarted = false;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
logger.error('Sign in failed');
|
|
58
|
+
await context.sendActivity(messageFactory_1.MessageFactory.text('Sign in failed'));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
retVal = state.sso.userToken;
|
|
62
|
+
}
|
|
63
|
+
else if (state.sso.flowStarted === false) {
|
|
64
|
+
const signingResource = await this.userTokenClient.getSignInResource(authConfig.clientId, authConfig.connectionName, context.activity);
|
|
65
|
+
const oCard = cardFactory_1.CardFactory.oauthCard(authConfig.connectionName, 'Sign in', '', signingResource);
|
|
66
|
+
await context.sendActivity(messageFactory_1.MessageFactory.attachment(oCard));
|
|
67
|
+
state.sso.flowStarted = true;
|
|
68
|
+
state.sso.flowExpires = Date.now() + 30000;
|
|
69
|
+
logger.info('OAuth flow started');
|
|
70
|
+
}
|
|
71
|
+
state.save(context);
|
|
72
|
+
return retVal;
|
|
73
|
+
}
|
|
74
|
+
async signOut(context, state) {
|
|
75
|
+
var _a;
|
|
76
|
+
await this.userTokenClient.signOut((_a = context.activity.from) === null || _a === void 0 ? void 0 : _a.id, context.adapter.authConfig.connectionName, context.activity.channelId);
|
|
77
|
+
state.sso.flowStarted = false;
|
|
78
|
+
state.sso.userToken = '';
|
|
79
|
+
state.sso.flowExpires = 0;
|
|
80
|
+
state.save(context);
|
|
81
|
+
logger.info('User signed out successfully');
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.WebChatOAuthFlowAppStyle = WebChatOAuthFlowAppStyle;
|
|
85
|
+
//# sourceMappingURL=webChatOAuthFlowAppStyle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webChatOAuthFlowAppStyle.js","sourceRoot":"","sources":["../../../../src/app/oauth/webChatOAuthFlowAppStyle.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D,kCAAkC;;;AAGlC,iEAA6D;AAE7D,yDAAqD;AAErD,yDAAqD;AACrD,yCAAoC;AAIpC,MAAM,MAAM,GAAG,IAAA,cAAK,EAAC,4BAA4B,CAAC,CAAA;AAElD,MAAa,wBAAwB;IAInC,YAAa,OAAgB;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAEM,KAAK,CAAC,aAAa,CAAE,OAAoB,EAAE,KAAgB;;QAChE,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxC,KAAK,CAAC,GAAG,CAAC,WAAW,GAAG,KAAK,CAAA;YAC7B,KAAK,CAAC,GAAG,CAAC,SAAS,GAAG,EAAE,CAAA;YACxB,KAAK,CAAC,GAAG,CAAC,WAAW,GAAG,CAAC,CAAA;YACzB,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA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CAAC,CAAA;YACxI,MAAM,KAAK,GAAe,yBAAW,CAAC,SAAS,CAAC,UAAU,CAAC,cAAe,EAAE,SAAS,EAAE,EAAE,EAAE,eAAe,CAAC,CAAA;YAC3G,MAAM,OAAO,CAAC,YAAY,CAAC,+BAAc,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAA;YAC5D,KAAK,CAAC,GAAI,CAAC,WAAW,GAAG,IAAI,CAAA;YAC7B,KAAK,CAAC,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAA;YAC1C,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAA;QACnC,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QACnB,OAAO,MAAM,CAAA;IACf,CAAC;IAED,KAAK,CAAC,OAAO,CAAE,OAAoB,EAAE,KAAgB;;QACnD,MAAM,IAAI,CAAC,eAAgB,CAAC,OAAO,CAAC,MAAA,OAAO,CAAC,QAAQ,CAAC,IAAI,0CAAE,EAAG,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,cAAe,EAAE,OAAO,CAAC,QAAQ,CAAC,SAAU,CAAC,CAAA;QACxI,KAAK,CAAC,GAAI,CAAC,WAAW,GAAG,KAAK,CAAA;QAC9B,KAAK,CAAC,GAAI,CAAC,SAAS,GAAG,EAAE,CAAA;QACzB,KAAK,CAAC,GAAI,CAAC,WAAW,GAAG,CAAC,CAAA;QAC1B,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QACnB,MAAM,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAA;IAC7C,CAAC;CACF;AA1ED,4DA0EC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { TurnContext } from '../turnContext';
|
|
6
|
+
import { TurnState } from './turnState';
|
|
7
|
+
export type RouteHandler<TState extends TurnState> = (context: TurnContext, state: TState) => Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routeHandler.js","sourceRoot":"","sources":["../../../src/app/routeHandler.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routeSelector.js","sourceRoot":"","sources":["../../../src/app/routeSelector.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turnEvents.js","sourceRoot":"","sources":["../../../src/app/turnEvents.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { Storage } from '../storage';
|
|
6
|
+
import { Memory } from './memory';
|
|
7
|
+
import { InputFile } from './inputFileDownloader';
|
|
8
|
+
import { TurnStateEntry } from './turnStateEntry';
|
|
9
|
+
import { TurnContext } from '../turnContext';
|
|
10
|
+
export interface DefaultConversationState {
|
|
11
|
+
}
|
|
12
|
+
export interface DefaultUserState {
|
|
13
|
+
}
|
|
14
|
+
export interface DefaultTempState {
|
|
15
|
+
input: string;
|
|
16
|
+
inputFiles: InputFile[];
|
|
17
|
+
lastOutput: string;
|
|
18
|
+
actionOutputs: Record<string, string>;
|
|
19
|
+
authTokens: {
|
|
20
|
+
[key: string]: string;
|
|
21
|
+
};
|
|
22
|
+
duplicateTokenExchange?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface DefaultSSOState {
|
|
25
|
+
flowStarted: boolean;
|
|
26
|
+
userToken: string;
|
|
27
|
+
flowExpires: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Base class defining a collection of turn state scopes.
|
|
31
|
+
* @remarks
|
|
32
|
+
* Developers can create a derived class that extends `TurnState` to add additional state scopes.
|
|
33
|
+
* ```JavaScript
|
|
34
|
+
* class MyTurnState extends TurnState {
|
|
35
|
+
* protected async onComputeStorageKeys(context) {
|
|
36
|
+
* const keys = await super.onComputeStorageKeys(context);
|
|
37
|
+
* keys['myScope'] = `myScopeKey`;
|
|
38
|
+
* return keys;
|
|
39
|
+
* }
|
|
40
|
+
*
|
|
41
|
+
* public get myScope() {
|
|
42
|
+
* const scope = this.getScope('myScope');
|
|
43
|
+
* if (!scope) {
|
|
44
|
+
* throw new Error(`MyTurnState hasn't been loaded. Call load() first.`);
|
|
45
|
+
* }
|
|
46
|
+
* return scope.value;
|
|
47
|
+
* }
|
|
48
|
+
*
|
|
49
|
+
* public set myScope(value) {
|
|
50
|
+
* const scope = this.getScope('myScope');
|
|
51
|
+
* if (!scope) {
|
|
52
|
+
* throw new Error(`MyTurnState hasn't been loaded. Call load() first.`);
|
|
53
|
+
* }
|
|
54
|
+
* scope.replace(value);
|
|
55
|
+
* }
|
|
56
|
+
* }
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export declare class TurnState<TConversationState = DefaultConversationState, TUserState = DefaultUserState, TTempState = DefaultTempState, TSSOState = DefaultSSOState> implements Memory {
|
|
60
|
+
private _scopes;
|
|
61
|
+
private _isLoaded;
|
|
62
|
+
private _loadingPromise?;
|
|
63
|
+
private _stateNotLoadedString;
|
|
64
|
+
get conversation(): TConversationState;
|
|
65
|
+
set conversation(value: TConversationState);
|
|
66
|
+
get isLoaded(): boolean;
|
|
67
|
+
get temp(): TTempState;
|
|
68
|
+
set temp(value: TTempState);
|
|
69
|
+
get user(): TUserState;
|
|
70
|
+
set user(value: TUserState);
|
|
71
|
+
get sso(): TSSOState;
|
|
72
|
+
set sso(value: TSSOState);
|
|
73
|
+
deleteConversationState(): void;
|
|
74
|
+
deleteTempState(): void;
|
|
75
|
+
deleteUserState(): void;
|
|
76
|
+
getScope(scope: string): TurnStateEntry | undefined;
|
|
77
|
+
deleteValue(path: string): void;
|
|
78
|
+
hasValue(path: string): boolean;
|
|
79
|
+
getValue<TValue = unknown>(path: string): TValue;
|
|
80
|
+
setValue(path: string, value: unknown): void;
|
|
81
|
+
load(context: TurnContext, storage?: Storage): Promise<boolean>;
|
|
82
|
+
save(context: TurnContext, storage?: Storage): Promise<void>;
|
|
83
|
+
protected onComputeStorageKeys(context: TurnContext): Promise<Record<string, string>>;
|
|
84
|
+
private getScopeAndName;
|
|
85
|
+
}
|