@microsoft/agents-hosting 0.5.4-ga4d0401645 → 0.5.16-g6bdf69cc43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/app/adaptiveCards/adaptiveCardsActions.js +4 -4
- package/dist/src/app/adaptiveCards/adaptiveCardsActions.js.map +1 -1
- package/dist/src/app/agentApplication.d.ts +186 -20
- package/dist/src/app/agentApplication.js +235 -33
- package/dist/src/app/agentApplication.js.map +1 -1
- package/dist/src/app/agentApplicationBuilder.d.ts +1 -1
- package/dist/src/app/agentApplicationOptions.d.ts +1 -1
- package/dist/src/app/appRoute.d.ts +5 -0
- package/dist/src/app/authorization.d.ts +293 -0
- package/dist/src/app/authorization.js +375 -0
- package/dist/src/app/authorization.js.map +1 -0
- package/dist/src/app/index.d.ts +1 -1
- package/dist/src/app/index.js +1 -1
- package/dist/src/app/index.js.map +1 -1
- package/dist/src/app/streaming/citation.d.ts +25 -0
- package/dist/src/app/streaming/{AIEntity.js → citation.js} +1 -1
- package/dist/src/app/streaming/citation.js.map +1 -0
- package/dist/src/app/streaming/{utilities.d.ts → citationUtil.d.ts} +3 -3
- package/dist/src/app/streaming/{utilities.js → citationUtil.js} +5 -36
- package/dist/src/app/streaming/citationUtil.js.map +1 -0
- package/dist/src/app/streaming/streamingResponse.d.ts +3 -4
- package/dist/src/app/streaming/streamingResponse.js +24 -22
- package/dist/src/app/streaming/streamingResponse.js.map +1 -1
- package/dist/src/auth/index.d.ts +1 -0
- package/dist/src/auth/index.js +1 -0
- package/dist/src/auth/index.js.map +1 -1
- package/dist/src/auth/jwt-middleware.js.map +1 -1
- package/dist/src/auth/msalTokenCredential.d.ts +10 -0
- package/dist/src/auth/msalTokenCredential.js +19 -0
- package/dist/src/auth/msalTokenCredential.js.map +1 -0
- package/dist/src/auth/msalTokenProvider.d.ts +1 -0
- package/dist/src/auth/msalTokenProvider.js +15 -0
- package/dist/src/auth/msalTokenProvider.js.map +1 -1
- package/dist/src/cards/cardFactory.d.ts +2 -2
- package/dist/src/cards/cardFactory.js.map +1 -1
- package/dist/src/oauth/index.d.ts +1 -4
- package/dist/src/oauth/index.js +1 -4
- package/dist/src/oauth/index.js.map +1 -1
- package/dist/src/oauth/oAuthFlow.d.ts +62 -19
- package/dist/src/oauth/oAuthFlow.js +193 -67
- package/dist/src/oauth/oAuthFlow.js.map +1 -1
- package/dist/src/oauth/userTokenClient.d.ts +37 -7
- package/dist/src/oauth/userTokenClient.js +56 -15
- package/dist/src/oauth/userTokenClient.js.map +1 -1
- package/dist/src/oauth/userTokenClient.types.d.ts +147 -0
- package/dist/src/oauth/{oAuthCard.js → userTokenClient.types.js} +1 -1
- package/dist/src/oauth/userTokenClient.types.js.map +1 -0
- package/package.json +5 -4
- package/src/app/adaptiveCards/adaptiveCardsActions.ts +4 -4
- package/src/app/agentApplication.ts +248 -33
- package/src/app/agentApplicationBuilder.ts +1 -1
- package/src/app/agentApplicationOptions.ts +1 -1
- package/src/app/appRoute.ts +6 -0
- package/src/app/authorization.ts +418 -0
- package/src/app/index.ts +1 -1
- package/src/app/streaming/citation.ts +29 -0
- package/src/app/streaming/{utilities.ts → citationUtil.ts} +3 -35
- package/src/app/streaming/streamingResponse.ts +28 -27
- package/src/auth/index.ts +1 -0
- package/src/auth/jwt-middleware.ts +1 -1
- package/src/auth/msalTokenCredential.ts +14 -0
- package/src/auth/msalTokenProvider.ts +17 -1
- package/src/cards/cardFactory.ts +2 -3
- package/src/oauth/index.ts +1 -4
- package/src/oauth/oAuthFlow.ts +226 -70
- package/src/oauth/userTokenClient.ts +62 -19
- package/src/oauth/userTokenClient.types.ts +173 -0
- package/dist/src/app/oauth/authorization.d.ts +0 -87
- package/dist/src/app/oauth/authorization.js +0 -135
- package/dist/src/app/oauth/authorization.js.map +0 -1
- package/dist/src/app/streaming/AIEntity.d.ts +0 -36
- package/dist/src/app/streaming/AIEntity.js.map +0 -1
- package/dist/src/app/streaming/actionCall.d.ts +0 -33
- package/dist/src/app/streaming/actionCall.js +0 -7
- package/dist/src/app/streaming/actionCall.js.map +0 -1
- package/dist/src/app/streaming/clientCitation.d.ts +0 -68
- package/dist/src/app/streaming/clientCitation.js +0 -10
- package/dist/src/app/streaming/clientCitation.js.map +0 -1
- package/dist/src/app/streaming/message.d.ts +0 -106
- package/dist/src/app/streaming/message.js +0 -7
- package/dist/src/app/streaming/message.js.map +0 -1
- package/dist/src/app/streaming/sensitivityUsageInfo.d.ts +0 -40
- package/dist/src/app/streaming/sensitivityUsageInfo.js +0 -3
- package/dist/src/app/streaming/sensitivityUsageInfo.js.map +0 -1
- package/dist/src/app/streaming/utilities.js.map +0 -1
- package/dist/src/oauth/oAuthCard.d.ts +0 -27
- package/dist/src/oauth/oAuthCard.js.map +0 -1
- package/dist/src/oauth/signingResource.d.ts +0 -43
- package/dist/src/oauth/signingResource.js +0 -5
- package/dist/src/oauth/signingResource.js.map +0 -1
- package/dist/src/oauth/tokenExchangeRequest.d.ts +0 -17
- package/dist/src/oauth/tokenExchangeRequest.js +0 -5
- package/dist/src/oauth/tokenExchangeRequest.js.map +0 -1
- package/dist/src/oauth/tokenResponse.d.ts +0 -29
- package/dist/src/oauth/tokenResponse.js +0 -25
- package/dist/src/oauth/tokenResponse.js.map +0 -1
- package/src/app/oauth/authorization.ts +0 -162
- package/src/app/streaming/AIEntity.ts +0 -44
- package/src/app/streaming/actionCall.ts +0 -37
- package/src/app/streaming/clientCitation.ts +0 -102
- package/src/app/streaming/message.ts +0 -125
- package/src/app/streaming/sensitivityUsageInfo.ts +0 -48
- package/src/oauth/oAuthCard.ts +0 -30
- package/src/oauth/signingResource.ts +0 -48
- package/src/oauth/tokenExchangeRequest.ts +0 -20
- package/src/oauth/tokenResponse.ts +0 -43
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
import { CardAction } from '@microsoft/agents-activity'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents the response containing OAuth token information.
|
|
8
|
+
* This interface encapsulates all data related to an OAuth token response.
|
|
9
|
+
*/
|
|
10
|
+
export interface TokenResponse {
|
|
11
|
+
/**
|
|
12
|
+
* The OAuth token string, or undefined if no token is available.
|
|
13
|
+
*/
|
|
14
|
+
token: string | undefined;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Represents a request for exchanging tokens.
|
|
19
|
+
* This interface defines the structure of a token exchange request, including the URI, token, and ID.
|
|
20
|
+
*/
|
|
21
|
+
export interface TokenExchangeRequest {
|
|
22
|
+
/**
|
|
23
|
+
* The URI for the token exchange request.
|
|
24
|
+
*/
|
|
25
|
+
uri?: string;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The token to be exchanged.
|
|
29
|
+
*/
|
|
30
|
+
token?: string;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The ID associated with the token exchange request.
|
|
34
|
+
*/
|
|
35
|
+
id?: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Represents a resource for exchanging tokens.
|
|
40
|
+
* This interface defines the structure of a token exchange resource, including its ID, URI, and provider ID.
|
|
41
|
+
*/
|
|
42
|
+
export interface TokenExchangeResource {
|
|
43
|
+
/**
|
|
44
|
+
* The ID of the token exchange resource.
|
|
45
|
+
*/
|
|
46
|
+
id?: string;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The URI of the token exchange resource.
|
|
50
|
+
*/
|
|
51
|
+
uri?: string;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The provider ID for the token exchange resource.
|
|
55
|
+
*/
|
|
56
|
+
providerId?: string;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Represents a resource for posting tokens.
|
|
61
|
+
* This interface defines the structure of a token post resource, including its SAS URL.
|
|
62
|
+
*/
|
|
63
|
+
export interface TokenPostResource {
|
|
64
|
+
/**
|
|
65
|
+
* The SAS URL for the token post resource.
|
|
66
|
+
*/
|
|
67
|
+
sasUrl?: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Represents a resource for signing in.
|
|
72
|
+
* This interface defines the structure of a sign-in resource, including the sign-in link, token exchange resource, and token post resource.
|
|
73
|
+
*/
|
|
74
|
+
export interface SignInResource {
|
|
75
|
+
/**
|
|
76
|
+
* The link for signing in.
|
|
77
|
+
*/
|
|
78
|
+
signInLink: string;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The resource for token exchange.
|
|
82
|
+
*/
|
|
83
|
+
tokenExchangeResource: TokenExchangeResource;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The resource for token post.
|
|
87
|
+
*/
|
|
88
|
+
tokenPostResource: TokenPostResource;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Represents an OAuth card.
|
|
93
|
+
* This interface defines the structure of an OAuth card, including its buttons, connection name, text, and associated resources.
|
|
94
|
+
*/
|
|
95
|
+
export interface OAuthCard {
|
|
96
|
+
/**
|
|
97
|
+
* The buttons associated with the OAuth card.
|
|
98
|
+
*/
|
|
99
|
+
buttons: CardAction[];
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* The connection name for the OAuth card.
|
|
103
|
+
*/
|
|
104
|
+
connectionName: string;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* The text content of the OAuth card.
|
|
108
|
+
*/
|
|
109
|
+
text: string;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* The token exchange resource for the OAuth card.
|
|
113
|
+
*/
|
|
114
|
+
tokenExchangeResource: TokenExchangeResource;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* The token post resource for the OAuth card.
|
|
118
|
+
*/
|
|
119
|
+
tokenPostResource: TokenPostResource;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Represents a response containing either a token or a sign-in resource.
|
|
124
|
+
* This interface defines the structure of a response that includes a token response and a sign-in resource.
|
|
125
|
+
*/
|
|
126
|
+
export interface TokenOrSinginResourceResponse {
|
|
127
|
+
/**
|
|
128
|
+
* The token response containing OAuth token information.
|
|
129
|
+
*/
|
|
130
|
+
tokenResponse: TokenResponse;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* The sign-in resource containing sign-in and token exchange information.
|
|
134
|
+
*/
|
|
135
|
+
signInResource: SignInResource;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Represents the status of a token.
|
|
140
|
+
* This interface defines the structure of a token status, including channel ID, connection name, and other metadata.
|
|
141
|
+
*/
|
|
142
|
+
export interface TokenStatus {
|
|
143
|
+
/**
|
|
144
|
+
* The ID of the channel associated with the token.
|
|
145
|
+
*/
|
|
146
|
+
channelId: string;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* The connection name associated with the token.
|
|
150
|
+
*/
|
|
151
|
+
connectionName: string;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Indicates whether a token is available.
|
|
155
|
+
*/
|
|
156
|
+
hasToken: boolean;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* The display name of the service provider.
|
|
160
|
+
*/
|
|
161
|
+
serviceProviderDisplayName: string;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Represents a collection of Azure Active Directory (AAD) resource URLs.
|
|
166
|
+
* This interface defines the structure of a collection of resource URLs.
|
|
167
|
+
*/
|
|
168
|
+
export interface AadResourceUrls {
|
|
169
|
+
/**
|
|
170
|
+
* An array of resource URLs.
|
|
171
|
+
*/
|
|
172
|
+
resourceUrls: string[];
|
|
173
|
+
}
|
|
@@ -1,87 +0,0 @@
|
|
|
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
|
-
import { Storage } from '../../storage';
|
|
8
|
-
import { OAuthFlow, TokenResponse } from '../../oauth';
|
|
9
|
-
/**
|
|
10
|
-
* Interface defining an authorization handler for OAuth flows
|
|
11
|
-
* @interface AuthHandler
|
|
12
|
-
*/
|
|
13
|
-
export interface AuthHandler {
|
|
14
|
-
/** Connection name for the auth provider */
|
|
15
|
-
name?: string;
|
|
16
|
-
/** Whether authorization should be triggered automatically */
|
|
17
|
-
auto?: boolean;
|
|
18
|
-
/** The OAuth flow implementation */
|
|
19
|
-
flow?: OAuthFlow;
|
|
20
|
-
/** Title to display on auth cards/UI */
|
|
21
|
-
title?: string;
|
|
22
|
-
/** Text to display on auth cards/UI */
|
|
23
|
-
text?: string;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Options for configuring user authorization.
|
|
27
|
-
* Contains settings to configure OAuth connections.
|
|
28
|
-
*/
|
|
29
|
-
export interface AuthorizationHandlers extends Record<string, AuthHandler> {
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Class responsible for managing authorization and OAuth flows
|
|
33
|
-
* @class Authorization
|
|
34
|
-
*/
|
|
35
|
-
export declare class Authorization {
|
|
36
|
-
_authHandlers: AuthorizationHandlers;
|
|
37
|
-
/**
|
|
38
|
-
* Creates a new instance of UserAuthorization.
|
|
39
|
-
* @param {Storage} storage - The storage system to use for state management.
|
|
40
|
-
* @param {AuthorizationHandlers} authHandlers - Configuration for OAuth providers
|
|
41
|
-
* @throws {Error} If storage is null/undefined or no auth handlers are provided
|
|
42
|
-
*/
|
|
43
|
-
constructor(storage: Storage, authHandlers: AuthorizationHandlers);
|
|
44
|
-
/**
|
|
45
|
-
* Gets the token for a specific auth handler
|
|
46
|
-
* @param {TurnContext} context - The context object for the current turn
|
|
47
|
-
* @param {string} [authHandlerId] - Optional ID of the auth handler to use, defaults to first handler
|
|
48
|
-
* @returns {Promise<TokenResponse>} The token response from the OAuth provider
|
|
49
|
-
*/
|
|
50
|
-
getToken(context: TurnContext, authHandlerId?: string): Promise<TokenResponse>;
|
|
51
|
-
/**
|
|
52
|
-
* Begins or continues an OAuth flow
|
|
53
|
-
* @param {TurnContext} context - The context object for the current turn
|
|
54
|
-
* @param {TurnState} state - The state object for the current turn
|
|
55
|
-
* @param {string} [authHandlerId] - Optional ID of the auth handler to use, defaults to first handler
|
|
56
|
-
* @returns {Promise<TokenResponse>} The token response from the OAuth provider
|
|
57
|
-
*/
|
|
58
|
-
beginOrContinueFlow(context: TurnContext, state: TurnState, authHandlerId?: string): Promise<TokenResponse>;
|
|
59
|
-
/**
|
|
60
|
-
* Gets the current state of the OAuth flow
|
|
61
|
-
* @param {string} [authHandlerId] - Optional ID of the auth handler to check, defaults to first handler
|
|
62
|
-
* @returns {boolean} Whether the flow has started
|
|
63
|
-
*/
|
|
64
|
-
getFlowState(authHandlerId?: string): boolean;
|
|
65
|
-
/**
|
|
66
|
-
* Resolves the auth handler to use based on the provided ID
|
|
67
|
-
* @param {string} [authHandlerId] - Optional ID of the auth handler to resolve, defaults to first handler
|
|
68
|
-
* @returns {AuthHandler} The resolved auth handler
|
|
69
|
-
*/
|
|
70
|
-
resolverHandler: (authHandlerId?: string) => AuthHandler;
|
|
71
|
-
/**
|
|
72
|
-
* Signs out the current user.
|
|
73
|
-
* This method clears the user's token and resets the SSO state.
|
|
74
|
-
*
|
|
75
|
-
* @param {TurnContext} context - The context object for the current turn.
|
|
76
|
-
* @param {TurnState} state - The state object for the current turn.
|
|
77
|
-
* @param {string} [authHandlerId] - Optional ID of the auth handler to use for sign out
|
|
78
|
-
* @returns {Promise<void>}
|
|
79
|
-
*/
|
|
80
|
-
signOut(context: TurnContext, state: TurnState, authHandlerId?: string): Promise<void>;
|
|
81
|
-
_signInHandler: ((context: TurnContext, state: TurnState, authHandlerId?: string) => void) | null;
|
|
82
|
-
/**
|
|
83
|
-
* Sets a handler to be called when sign-in is successfully completed
|
|
84
|
-
* @param {Function} handler - The handler function to call on successful sign-in
|
|
85
|
-
*/
|
|
86
|
-
onSignInSuccess(handler: (context: TurnContext, state: TurnState, authHandlerId?: string) => void): void;
|
|
87
|
-
}
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.Authorization = void 0;
|
|
8
|
-
const logger_1 = require("../../logger");
|
|
9
|
-
const oauth_1 = require("../../oauth");
|
|
10
|
-
const state_1 = require("../../state");
|
|
11
|
-
const logger = (0, logger_1.debug)('agents:authorization');
|
|
12
|
-
/**
|
|
13
|
-
* Class responsible for managing authorization and OAuth flows
|
|
14
|
-
* @class Authorization
|
|
15
|
-
*/
|
|
16
|
-
class Authorization {
|
|
17
|
-
/**
|
|
18
|
-
* Creates a new instance of UserAuthorization.
|
|
19
|
-
* @param {Storage} storage - The storage system to use for state management.
|
|
20
|
-
* @param {AuthorizationHandlers} authHandlers - Configuration for OAuth providers
|
|
21
|
-
* @throws {Error} If storage is null/undefined or no auth handlers are provided
|
|
22
|
-
*/
|
|
23
|
-
constructor(storage, authHandlers) {
|
|
24
|
-
var _a, _b, _c, _d;
|
|
25
|
-
/**
|
|
26
|
-
* Resolves the auth handler to use based on the provided ID
|
|
27
|
-
* @param {string} [authHandlerId] - Optional ID of the auth handler to resolve, defaults to first handler
|
|
28
|
-
* @returns {AuthHandler} The resolved auth handler
|
|
29
|
-
*/
|
|
30
|
-
this.resolverHandler = (authHandlerId) => {
|
|
31
|
-
if (authHandlerId) {
|
|
32
|
-
return this._authHandlers[authHandlerId];
|
|
33
|
-
}
|
|
34
|
-
return this._authHandlers[Object.keys(this._authHandlers)[0]];
|
|
35
|
-
};
|
|
36
|
-
this._signInHandler = null;
|
|
37
|
-
if (storage === undefined || storage === null) {
|
|
38
|
-
throw new Error('Storage is required for UserAuthorization');
|
|
39
|
-
}
|
|
40
|
-
const userState = new state_1.UserState(storage);
|
|
41
|
-
if (authHandlers === undefined || Object.keys(authHandlers).length === 0) {
|
|
42
|
-
throw new Error('The authorization does not have any auth handlers');
|
|
43
|
-
}
|
|
44
|
-
this._authHandlers = authHandlers;
|
|
45
|
-
for (const ah in this._authHandlers) {
|
|
46
|
-
if (this._authHandlers[ah].name === undefined && process.env[ah + '_connectionName'] === undefined) {
|
|
47
|
-
throw new Error(`AuthHandler name ${ah}_connectionName not set in autorization and not found in env vars.`);
|
|
48
|
-
}
|
|
49
|
-
const currentAuthHandler = this._authHandlers[ah];
|
|
50
|
-
currentAuthHandler.name = (_a = currentAuthHandler.name) !== null && _a !== void 0 ? _a : process.env[ah + '_connectionName'];
|
|
51
|
-
currentAuthHandler.title = (_b = currentAuthHandler.title) !== null && _b !== void 0 ? _b : process.env[ah + '_connectionTitle'];
|
|
52
|
-
currentAuthHandler.text = (_c = currentAuthHandler.text) !== null && _c !== void 0 ? _c : process.env[ah + '_connectionText'];
|
|
53
|
-
currentAuthHandler.auto = (_d = currentAuthHandler.auto) !== null && _d !== void 0 ? _d : process.env[ah + '_connectionAuto'] === 'true';
|
|
54
|
-
currentAuthHandler.flow = new oauth_1.OAuthFlow(userState, currentAuthHandler.name, null, currentAuthHandler.title, currentAuthHandler.text);
|
|
55
|
-
}
|
|
56
|
-
logger.info('Authorization handlers configured with', this._authHandlers.length, 'handlers');
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Gets the token for a specific auth handler
|
|
60
|
-
* @param {TurnContext} context - The context object for the current turn
|
|
61
|
-
* @param {string} [authHandlerId] - Optional ID of the auth handler to use, defaults to first handler
|
|
62
|
-
* @returns {Promise<TokenResponse>} The token response from the OAuth provider
|
|
63
|
-
*/
|
|
64
|
-
async getToken(context, authHandlerId) {
|
|
65
|
-
var _a;
|
|
66
|
-
logger.info('getToken from user token service for authHandlerId:', authHandlerId);
|
|
67
|
-
const authHandler = this.resolverHandler(authHandlerId);
|
|
68
|
-
return await ((_a = authHandler.flow) === null || _a === void 0 ? void 0 : _a.getUserToken(context));
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Begins or continues an OAuth flow
|
|
72
|
-
* @param {TurnContext} context - The context object for the current turn
|
|
73
|
-
* @param {TurnState} state - The state object for the current turn
|
|
74
|
-
* @param {string} [authHandlerId] - Optional ID of the auth handler to use, defaults to first handler
|
|
75
|
-
* @returns {Promise<TokenResponse>} The token response from the OAuth provider
|
|
76
|
-
*/
|
|
77
|
-
async beginOrContinueFlow(context, state, authHandlerId) {
|
|
78
|
-
logger.info('beginOrContinueFlow for authHandlerId:', authHandlerId);
|
|
79
|
-
const flow = this.resolverHandler(authHandlerId).flow;
|
|
80
|
-
let tokenResponse;
|
|
81
|
-
if (flow.state.flowStarted === false) {
|
|
82
|
-
tokenResponse = await flow.beginFlow(context);
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
tokenResponse = await flow.continueFlow(context);
|
|
86
|
-
if (tokenResponse.status === oauth_1.TokenRequestStatus.Success) {
|
|
87
|
-
if (this._signInHandler) {
|
|
88
|
-
await this._signInHandler(context, state, authHandlerId);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
return tokenResponse;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Gets the current state of the OAuth flow
|
|
96
|
-
* @param {string} [authHandlerId] - Optional ID of the auth handler to check, defaults to first handler
|
|
97
|
-
* @returns {boolean} Whether the flow has started
|
|
98
|
-
*/
|
|
99
|
-
getFlowState(authHandlerId) {
|
|
100
|
-
var _a;
|
|
101
|
-
const flow = this.resolverHandler(authHandlerId).flow;
|
|
102
|
-
return (_a = flow.state) === null || _a === void 0 ? void 0 : _a.flowStarted;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Signs out the current user.
|
|
106
|
-
* This method clears the user's token and resets the SSO state.
|
|
107
|
-
*
|
|
108
|
-
* @param {TurnContext} context - The context object for the current turn.
|
|
109
|
-
* @param {TurnState} state - The state object for the current turn.
|
|
110
|
-
* @param {string} [authHandlerId] - Optional ID of the auth handler to use for sign out
|
|
111
|
-
* @returns {Promise<void>}
|
|
112
|
-
*/
|
|
113
|
-
async signOut(context, state, authHandlerId) {
|
|
114
|
-
var _a;
|
|
115
|
-
logger.info('signOut for authHandlerId:', authHandlerId);
|
|
116
|
-
if (authHandlerId === undefined) { // aw
|
|
117
|
-
for (const ah in this._authHandlers) {
|
|
118
|
-
const flow = this._authHandlers[ah].flow;
|
|
119
|
-
await (flow === null || flow === void 0 ? void 0 : flow.signOut(context));
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
await ((_a = this.resolverHandler(authHandlerId).flow) === null || _a === void 0 ? void 0 : _a.signOut(context));
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Sets a handler to be called when sign-in is successfully completed
|
|
128
|
-
* @param {Function} handler - The handler function to call on successful sign-in
|
|
129
|
-
*/
|
|
130
|
-
onSignInSuccess(handler) {
|
|
131
|
-
this._signInHandler = handler;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
exports.Authorization = Authorization;
|
|
135
|
-
//# sourceMappingURL=authorization.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authorization.js","sourceRoot":"","sources":["../../../../src/app/oauth/authorization.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,yCAAoC;AAGpC,uCAA0E;AAC1E,uCAAuC;AAEvC,MAAM,MAAM,GAAG,IAAA,cAAK,EAAC,sBAAsB,CAAC,CAAA;AAyB5C;;;GAGG;AACH,MAAa,aAAa;IAGxB;;;;;OAKG;IACH,YAAa,OAAgB,EAAE,YAAmC;;QAqElE;;;;WAIG;Q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GG;IACI,eAAe,CAAE,OAAiF;QACvG,IAAI,CAAC,cAAc,GAAG,OAAO,CAAA;IAC/B,CAAC;CACF;AAxHD,sCAwHC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { ClientCitation } from './clientCitation';
|
|
6
|
-
import { SensitivityUsageInfo } from './sensitivityUsageInfo';
|
|
7
|
-
export interface AIEntity {
|
|
8
|
-
/**
|
|
9
|
-
* Required as 'https://schema.org/Message'
|
|
10
|
-
*/
|
|
11
|
-
type: 'https://schema.org/Message';
|
|
12
|
-
/**
|
|
13
|
-
* Required as 'Message
|
|
14
|
-
*/
|
|
15
|
-
'@type': 'Message';
|
|
16
|
-
/**
|
|
17
|
-
* Required as 'https://schema.org
|
|
18
|
-
*/
|
|
19
|
-
'@context': 'https://schema.org';
|
|
20
|
-
/**
|
|
21
|
-
* Must be left blank. This is for Bot Framework schema.
|
|
22
|
-
*/
|
|
23
|
-
'@id': '';
|
|
24
|
-
/**
|
|
25
|
-
* Indicate that the content was generated by AI.
|
|
26
|
-
*/
|
|
27
|
-
additionalType: ['AIGeneratedContent'];
|
|
28
|
-
/**
|
|
29
|
-
* Optional; if citations object is included, the sent activity will include the citations, referenced in the activity text.
|
|
30
|
-
*/
|
|
31
|
-
citation?: ClientCitation[];
|
|
32
|
-
/**
|
|
33
|
-
* Optional; if usage_info object is included, the sent activity will include the sensitivity usage information.
|
|
34
|
-
*/
|
|
35
|
-
usageInfo?: SensitivityUsageInfo;
|
|
36
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AIEntity.js","sourceRoot":"","sources":["../../../../src/app/streaming/AIEntity.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* An action call to be requested by the LLM model. This type is a generic meant to be the equivalent of OpenAI's [`ChatCompletionMessageToolCall`](https://github.com/openai/openai-node/blob/master/src/resources/chat/completions.ts#L477), but is not tied to OpenAI's implementation in order to allow for flexibility for other models in the future.
|
|
7
|
-
*/
|
|
8
|
-
export interface ActionCall {
|
|
9
|
-
/**
|
|
10
|
-
* The ID of the tool call.
|
|
11
|
-
*/
|
|
12
|
-
id: string;
|
|
13
|
-
/**
|
|
14
|
-
* The function that the model called.
|
|
15
|
-
*/
|
|
16
|
-
function: {
|
|
17
|
-
/**
|
|
18
|
-
* The name of the function.
|
|
19
|
-
*/
|
|
20
|
-
name: string;
|
|
21
|
-
/**
|
|
22
|
-
* The arguments to call the function with, as generated by the model in JSON
|
|
23
|
-
* format. Note that the model does not always generate valid JSON, and may
|
|
24
|
-
* hallucinate parameters not defined by your function schema. Validate the
|
|
25
|
-
* arguments in your code before calling your function.
|
|
26
|
-
*/
|
|
27
|
-
arguments: string;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* The type of the tool. Currently, only `function` is supported.
|
|
31
|
-
*/
|
|
32
|
-
type: 'function';
|
|
33
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"actionCall.js","sourceRoot":"","sources":["../../../../src/app/streaming/actionCall.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module teams-ai
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6
|
-
* Licensed under the MIT License.
|
|
7
|
-
*/
|
|
8
|
-
import { SensitivityUsageInfo } from './sensitivityUsageInfo';
|
|
9
|
-
export type ClientCitationIconName = 'Microsoft Word' | 'Microsoft Excel' | 'Microsoft PowerPoint' | 'Microsoft OneNote' | 'Microsoft SharePoint' | 'Microsoft Visio' | 'Microsoft Loop' | 'Microsoft Whiteboard' | 'Adobe Illustrator' | 'Adobe Photoshop' | 'Adobe InDesign' | 'Adobe Flash' | 'Sketch' | 'Source Code' | 'Image' | 'GIF' | 'Video' | 'Sound' | 'ZIP' | 'Text' | 'PDF';
|
|
10
|
-
/**
|
|
11
|
-
* Represents a Teams client citation to be included in a message. See Bot messages with AI-generated content for more details.
|
|
12
|
-
* https://learn.microsoft.com/en-us/microsoftteams/platform/bots/how-to/bot-messages-ai-generated-content?tabs=before%2Cbotmessage
|
|
13
|
-
*/
|
|
14
|
-
export interface ClientCitation {
|
|
15
|
-
/**
|
|
16
|
-
* Required; must be "Claim"
|
|
17
|
-
*/
|
|
18
|
-
'@type': 'Claim';
|
|
19
|
-
/**
|
|
20
|
-
* Required. Number and position of the citation.
|
|
21
|
-
*/
|
|
22
|
-
position: number;
|
|
23
|
-
appearance: {
|
|
24
|
-
/**
|
|
25
|
-
* Required; Must be 'DigitalDocument'
|
|
26
|
-
*/
|
|
27
|
-
'@type': 'DigitalDocument';
|
|
28
|
-
/**
|
|
29
|
-
* Name of the document. (max length 80)
|
|
30
|
-
*/
|
|
31
|
-
name: string;
|
|
32
|
-
/**
|
|
33
|
-
* Stringified adaptive card with additional information about the citation.
|
|
34
|
-
* It is rendered within the modal.
|
|
35
|
-
*/
|
|
36
|
-
text?: string;
|
|
37
|
-
/**
|
|
38
|
-
* URL of the document. This will make the name of the citation clickable and direct the user to the specified URL.
|
|
39
|
-
*/
|
|
40
|
-
url?: string;
|
|
41
|
-
/**
|
|
42
|
-
* Extract of the referenced content. (max length 160)
|
|
43
|
-
*/
|
|
44
|
-
abstract: string;
|
|
45
|
-
/**
|
|
46
|
-
* Encoding format of the `citation.appearance.text` field.
|
|
47
|
-
*/
|
|
48
|
-
encodingFormat?: 'application/vnd.microsoft.card.adaptive';
|
|
49
|
-
/**
|
|
50
|
-
* Information about the citation’s icon.
|
|
51
|
-
*/
|
|
52
|
-
image?: {
|
|
53
|
-
'@type': 'ImageObject';
|
|
54
|
-
/**
|
|
55
|
-
* The image/icon name
|
|
56
|
-
*/
|
|
57
|
-
name: ClientCitationIconName;
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* Optional; set by developer. (max length 3) (max keyword length 28)
|
|
61
|
-
*/
|
|
62
|
-
keywords?: string[];
|
|
63
|
-
/**
|
|
64
|
-
* Optional sensitivity content information.
|
|
65
|
-
*/
|
|
66
|
-
usageInfo?: SensitivityUsageInfo;
|
|
67
|
-
};
|
|
68
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @module teams-ai
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7
|
-
* Licensed under the MIT License.
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
//# sourceMappingURL=clientCitation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clientCitation.js","sourceRoot":"","sources":["../../../../src/app/streaming/clientCitation.ts"],"names":[],"mappings":";AAAA;;GAEG;AACH;;;GAGG"}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { ActionCall } from './actionCall';
|
|
6
|
-
/**
|
|
7
|
-
* A message object sent to or received from an LLM.
|
|
8
|
-
* @param TContent Optional. Type of the message content. Defaults to `string`
|
|
9
|
-
*/
|
|
10
|
-
export interface Message<TContent = string> {
|
|
11
|
-
/**
|
|
12
|
-
* The messages role. Typically 'system', 'user', 'assistant', 'tool', 'function'.
|
|
13
|
-
*/
|
|
14
|
-
role: string;
|
|
15
|
-
/**
|
|
16
|
-
* Text of the message.
|
|
17
|
-
*/
|
|
18
|
-
content: TContent | undefined;
|
|
19
|
-
/**
|
|
20
|
-
* Optional. A named function to call.
|
|
21
|
-
*/
|
|
22
|
-
function_call?: FunctionCall;
|
|
23
|
-
/**
|
|
24
|
-
* The context used for the message.
|
|
25
|
-
*/
|
|
26
|
-
context?: MessageContext;
|
|
27
|
-
/**
|
|
28
|
-
* Optional. Name of the function that was called.
|
|
29
|
-
*/
|
|
30
|
-
name?: string;
|
|
31
|
-
/**
|
|
32
|
-
* Optional. The action or tool to be called by the model when using 'tools' augmentation. In OpenAI, this is the tool_calls property returned from the model.
|
|
33
|
-
*/
|
|
34
|
-
action_calls?: ActionCall[];
|
|
35
|
-
/**
|
|
36
|
-
* Optional. The id of the action called.
|
|
37
|
-
*/
|
|
38
|
-
action_call_id?: string | undefined;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* A named function to call.
|
|
42
|
-
*/
|
|
43
|
-
export interface FunctionCall {
|
|
44
|
-
/**
|
|
45
|
-
* Name of the function to call.
|
|
46
|
-
*/
|
|
47
|
-
name?: string;
|
|
48
|
-
/**
|
|
49
|
-
* Optional. Arguments to pass to the function. Must be deserialized.
|
|
50
|
-
*/
|
|
51
|
-
arguments?: string;
|
|
52
|
-
}
|
|
53
|
-
export type MessageContentParts = TextContentPart | ImageContentPart;
|
|
54
|
-
export interface TextContentPart {
|
|
55
|
-
/**
|
|
56
|
-
* Type of the message content. Should always be 'text'.
|
|
57
|
-
*/
|
|
58
|
-
type: 'text';
|
|
59
|
-
/**
|
|
60
|
-
* The text of the message.
|
|
61
|
-
*/
|
|
62
|
-
text: string;
|
|
63
|
-
}
|
|
64
|
-
export interface ImageContentPart {
|
|
65
|
-
/**
|
|
66
|
-
* Type of the message content. Should always be 'image_url'.
|
|
67
|
-
*/
|
|
68
|
-
type: 'image_url';
|
|
69
|
-
/**
|
|
70
|
-
* The URL of the image.
|
|
71
|
-
*/
|
|
72
|
-
image_url: string | {
|
|
73
|
-
url: string;
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Citations returned by the model.
|
|
78
|
-
*/
|
|
79
|
-
export interface Citation {
|
|
80
|
-
/**
|
|
81
|
-
* The content of the citation.
|
|
82
|
-
*/
|
|
83
|
-
content: string;
|
|
84
|
-
/**
|
|
85
|
-
* The title of the citation.
|
|
86
|
-
*/
|
|
87
|
-
title: string | null;
|
|
88
|
-
/**
|
|
89
|
-
* The URL of the citation.
|
|
90
|
-
*/
|
|
91
|
-
url: string | null;
|
|
92
|
-
/**
|
|
93
|
-
* The filepath of the document.
|
|
94
|
-
*/
|
|
95
|
-
filepath: string | null;
|
|
96
|
-
}
|
|
97
|
-
export interface MessageContext {
|
|
98
|
-
/**
|
|
99
|
-
* Citations used in the message.
|
|
100
|
-
*/
|
|
101
|
-
citations: Citation[];
|
|
102
|
-
/**
|
|
103
|
-
* The intent of the message (what the user wrote).
|
|
104
|
-
*/
|
|
105
|
-
intent: string;
|
|
106
|
-
}
|