@microsoft/agents-hosting 0.2.14 → 0.3.5
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 +17 -1
- package/dist/src/app/agentApplication.d.ts +16 -4
- package/dist/src/app/agentApplication.js +22 -12
- package/dist/src/app/agentApplication.js.map +1 -1
- package/dist/src/app/agentApplicationBuilder.d.ts +3 -4
- package/dist/src/app/agentApplicationBuilder.js +7 -7
- package/dist/src/app/agentApplicationBuilder.js.map +1 -1
- package/dist/src/app/agentApplicationOptions.d.ts +26 -2
- package/dist/src/app/appRoute.d.ts +6 -0
- package/dist/src/app/attachmentDownloader.d.ts +18 -0
- package/dist/src/app/attachmentDownloader.js +18 -0
- package/dist/src/app/attachmentDownloader.js.map +1 -1
- package/dist/src/app/conversationUpdateEvents.d.ts +6 -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/inputFileDownloader.d.ts +22 -0
- package/dist/src/app/oauth/authorization.d.ts +87 -0
- package/dist/src/app/oauth/authorization.js +135 -0
- package/dist/src/app/oauth/authorization.js.map +1 -0
- package/dist/src/app/routeHandler.d.ts +8 -0
- package/dist/src/app/routeSelector.d.ts +9 -0
- package/dist/src/app/turnState.d.ts +150 -0
- package/dist/src/app/turnState.js +125 -0
- package/dist/src/app/turnState.js.map +1 -1
- package/dist/src/auth/authConfiguration.d.ts +24 -0
- package/dist/src/auth/authConfiguration.js.map +1 -1
- package/dist/src/auth/request.d.ts +12 -0
- package/dist/src/baseAdapter.d.ts +17 -0
- package/dist/src/baseAdapter.js +17 -0
- package/dist/src/baseAdapter.js.map +1 -1
- package/dist/src/cards/cardFactory.d.ts +3 -0
- package/dist/src/cards/cardFactory.js +3 -0
- package/dist/src/cards/cardFactory.js.map +1 -1
- package/dist/src/cards/o365ConnectorCardActionBase.d.ts +8 -0
- package/dist/src/oauth/oAuthFlow.d.ts +32 -3
- package/dist/src/oauth/oAuthFlow.js +38 -14
- package/dist/src/oauth/oAuthFlow.js.map +1 -1
- package/dist/src/oauth/userTokenClient.d.ts +2 -2
- package/dist/src/oauth/userTokenClient.js +3 -3
- package/dist/src/oauth/userTokenClient.js.map +1 -1
- package/dist/src/state/agentStatePropertyAccesor.d.ts +1 -1
- package/dist/src/state/agentStatePropertyAccesor.js +1 -1
- package/dist/src/statusCodes.d.ts +39 -0
- package/dist/src/statusCodes.js +39 -0
- package/dist/src/statusCodes.js.map +1 -1
- package/dist/src/tokenResponseEventName.d.ts +3 -0
- package/dist/src/tokenResponseEventName.js +3 -0
- package/dist/src/tokenResponseEventName.js.map +1 -1
- package/package.json +4 -4
- package/src/app/agentApplication.ts +24 -13
- package/src/app/agentApplicationBuilder.ts +8 -8
- package/src/app/agentApplicationOptions.ts +33 -2
- package/src/app/appRoute.ts +7 -0
- package/src/app/attachmentDownloader.ts +18 -0
- package/src/app/conversationUpdateEvents.ts +6 -0
- package/src/app/index.ts +1 -1
- package/src/app/inputFileDownloader.ts +24 -0
- package/src/app/oauth/authorization.ts +162 -0
- package/src/app/routeHandler.ts +8 -0
- package/src/app/routeSelector.ts +9 -0
- package/src/app/turnState.ts +151 -1
- package/src/auth/authConfiguration.ts +32 -1
- package/src/auth/request.ts +15 -0
- package/src/baseAdapter.ts +18 -0
- package/src/cards/cardFactory.ts +3 -0
- package/src/cards/o365ConnectorCardActionBase.ts +8 -0
- package/src/oauth/oAuthFlow.ts +59 -18
- package/src/oauth/userTokenClient.ts +4 -4
- package/src/state/agentStatePropertyAccesor.ts +1 -1
- package/src/statusCodes.ts +51 -0
- package/src/tokenResponseEventName.ts +3 -0
- package/dist/src/app/oauth/userIdentity.d.ts +0 -43
- package/dist/src/app/oauth/userIdentity.js +0 -54
- package/dist/src/app/oauth/userIdentity.js.map +0 -1
- package/src/app/oauth/userIdentity.ts +0 -78
|
@@ -0,0 +1,135 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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;QACH,oBAAe,GAAG,CAAC,aAAsB,EAAgB,EAAE;YACzD,IAAI,aAAa,EAAE,CAAC;gBAClB,OAAO,IAAI,CAAC,aAAc,CAAC,aAAa,CAAC,CAAA;YAC3C,CAAC;YACD,OAAO,IAAI,CAAC,aAAc,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,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AI,CAAC,cAAc,EAAE,CAAC;oBACxB,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,KAAK,EAAE,aAAa,CAAC,CAAA;gBAC1D,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,aAAa,CAAA;IACtB,CAAC;IAED;;;;OAIG;IACI,YAAY,CAAE,aAAsB;;QACzC,MAAM,IAAI,GAAG,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,IAAK,CAAA;QACtD,OAAO,MAAA,IAAI,CAAC,KAAK,0CAAE,WAAY,CAAA;IACjC,CAAC;IAcD;;;;;;;;OAQG;IACH,KAAK,CAAC,OAAO,CAAE,OAAoB,EAAE,KAAgB,EAAE,aAAsB;;QAC3E,MAAM,CAAC,IAAI,CAAC,4BAA4B,EAAE,aAAa,CAAC,CAAA;QACxD,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC,CAAC,KAAK;YACtC,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;gBACpC,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,IAAI,CAAA;gBACxC,MAAM,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,CAAC,OAAO,CAAC,CAAA,CAAA;YAC9B,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,CAAA,MAAA,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,IAAI,0CAAE,OAAO,CAAC,OAAO,CAAC,CAAA,CAAA;QAClE,CAAC;IACH,CAAC;IAID;;;OAGG;IACI,eAAe,CAAE,OAAiF;QACvG,IAAI,CAAC,cAAc,GAAG,OAAO,CAAA;IAC/B,CAAC;CACF;AAxHD,sCAwHC"}
|
|
@@ -4,4 +4,12 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { TurnContext } from '../turnContext';
|
|
6
6
|
import { TurnState } from './turnState';
|
|
7
|
+
/**
|
|
8
|
+
* A handler function for routing operations in a specific turn context and state.
|
|
9
|
+
*
|
|
10
|
+
* @typeParam TState - The type of the turn state.
|
|
11
|
+
* @param context - The turn context for the current operation.
|
|
12
|
+
* @param state - The state associated with the current turn.
|
|
13
|
+
* @returns A promise that resolves when the routing operation is complete.
|
|
14
|
+
*/
|
|
7
15
|
export type RouteHandler<TState extends TurnState> = (context: TurnContext, state: TState) => Promise<void>;
|
|
@@ -3,5 +3,14 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { TurnContext } from '../turnContext';
|
|
6
|
+
/**
|
|
7
|
+
* A function that determines whether a specific condition is met in the given turn context.
|
|
8
|
+
*
|
|
9
|
+
* @param context - The turn context for the current operation.
|
|
10
|
+
* @returns A promise that resolves to a boolean indicating whether the condition is met.
|
|
11
|
+
*/
|
|
6
12
|
export type Selector = (context: TurnContext) => Promise<boolean>;
|
|
13
|
+
/**
|
|
14
|
+
* A specialized selector for routing operations.
|
|
15
|
+
*/
|
|
7
16
|
export type RouteSelector = Selector;
|
|
@@ -7,23 +7,48 @@ import { AppMemory } from './appMemory';
|
|
|
7
7
|
import { InputFile } from './inputFileDownloader';
|
|
8
8
|
import { TurnStateEntry } from './turnStateEntry';
|
|
9
9
|
import { TurnContext } from '../turnContext';
|
|
10
|
+
/**
|
|
11
|
+
* Default interface for conversation state.
|
|
12
|
+
* Extend this interface to define custom conversation state properties.
|
|
13
|
+
*/
|
|
10
14
|
export interface DefaultConversationState {
|
|
11
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Default interface for user state.
|
|
18
|
+
* Extend this interface to define custom user state properties.
|
|
19
|
+
*/
|
|
12
20
|
export interface DefaultUserState {
|
|
13
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Default interface for temporary state that persists only during the current turn.
|
|
24
|
+
* Contains properties used for handling user input, file attachments, and OAuth flows.
|
|
25
|
+
*/
|
|
14
26
|
export interface DefaultTempState {
|
|
27
|
+
/** Current user input text */
|
|
15
28
|
input: string;
|
|
29
|
+
/** Collection of files attached to the current message */
|
|
16
30
|
inputFiles: InputFile[];
|
|
31
|
+
/** Last output text generated by the agent */
|
|
17
32
|
lastOutput: string;
|
|
33
|
+
/** Results from actions performed by the agent */
|
|
18
34
|
actionOutputs: Record<string, string>;
|
|
35
|
+
/** OAuth tokens keyed by provider ID */
|
|
19
36
|
authTokens: {
|
|
20
37
|
[key: string]: string;
|
|
21
38
|
};
|
|
39
|
+
/** Flag to prevent duplicate token exchanges */
|
|
22
40
|
duplicateTokenExchange?: boolean;
|
|
23
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Default interface for Single Sign-On (SSO) state.
|
|
44
|
+
* Contains properties used for managing OAuth authentication flows.
|
|
45
|
+
*/
|
|
24
46
|
export interface DefaultSSOState {
|
|
47
|
+
/** Whether an OAuth flow has been started */
|
|
25
48
|
flowStarted: boolean;
|
|
49
|
+
/** The user's access token */
|
|
26
50
|
userToken: string;
|
|
51
|
+
/** Expiration timestamp for the current flow */
|
|
27
52
|
flowExpires: number;
|
|
28
53
|
}
|
|
29
54
|
/**
|
|
@@ -55,31 +80,156 @@ export interface DefaultSSOState {
|
|
|
55
80
|
* }
|
|
56
81
|
* }
|
|
57
82
|
* ```
|
|
83
|
+
* @template TConversationState - Type for conversation-scoped state
|
|
84
|
+
* @template TUserState - Type for user-scoped state
|
|
85
|
+
* @template TTempState - Type for temporary state that exists only for the current turn
|
|
86
|
+
* @template TSSOState - Type for Single Sign-On (SSO) state
|
|
58
87
|
*/
|
|
59
88
|
export declare class TurnState<TConversationState = DefaultConversationState, TUserState = DefaultUserState, TTempState = DefaultTempState, TSSOState = DefaultSSOState> implements AppMemory {
|
|
60
89
|
private _scopes;
|
|
61
90
|
private _isLoaded;
|
|
62
91
|
private _loadingPromise?;
|
|
63
92
|
private _stateNotLoadedString;
|
|
93
|
+
/**
|
|
94
|
+
* Gets the conversation-scoped state.
|
|
95
|
+
* This state is shared by all users in the same conversation.
|
|
96
|
+
* @returns The conversation state object
|
|
97
|
+
* @throws Error if state hasn't been loaded
|
|
98
|
+
*/
|
|
64
99
|
get conversation(): TConversationState;
|
|
100
|
+
/**
|
|
101
|
+
* Sets the conversation-scoped state.
|
|
102
|
+
* @param value - The new conversation state object
|
|
103
|
+
* @throws Error if state hasn't been loaded
|
|
104
|
+
*/
|
|
65
105
|
set conversation(value: TConversationState);
|
|
106
|
+
/**
|
|
107
|
+
* Gets whether the state has been loaded from storage
|
|
108
|
+
* @returns True if the state has been loaded, false otherwise
|
|
109
|
+
*/
|
|
66
110
|
get isLoaded(): boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Gets the temporary state for the current turn.
|
|
113
|
+
* This state is not persisted between turns.
|
|
114
|
+
* @returns The temporary state object
|
|
115
|
+
* @throws Error if state hasn't been loaded
|
|
116
|
+
*/
|
|
67
117
|
get temp(): TTempState;
|
|
118
|
+
/**
|
|
119
|
+
* Sets the temporary state for the current turn.
|
|
120
|
+
* @param value - The new temporary state object
|
|
121
|
+
* @throws Error if state hasn't been loaded
|
|
122
|
+
*/
|
|
68
123
|
set temp(value: TTempState);
|
|
124
|
+
/**
|
|
125
|
+
* Gets the user-scoped state.
|
|
126
|
+
* This state is unique to each user and persists across conversations.
|
|
127
|
+
* @returns The user state object
|
|
128
|
+
* @throws Error if state hasn't been loaded
|
|
129
|
+
*/
|
|
69
130
|
get user(): TUserState;
|
|
131
|
+
/**
|
|
132
|
+
* Sets the user-scoped state.
|
|
133
|
+
* @param value - The new user state object
|
|
134
|
+
* @throws Error if state hasn't been loaded
|
|
135
|
+
*/
|
|
70
136
|
set user(value: TUserState);
|
|
137
|
+
/**
|
|
138
|
+
* Gets the Single Sign-On (SSO) state.
|
|
139
|
+
* This state is used to manage OAuth authentication flows.
|
|
140
|
+
* @returns The SSO state object
|
|
141
|
+
* @throws Error if state hasn't been loaded
|
|
142
|
+
*/
|
|
71
143
|
get sso(): TSSOState;
|
|
144
|
+
/**
|
|
145
|
+
* Sets the Single Sign-On (SSO) state.
|
|
146
|
+
* @param value - The new SSO state object
|
|
147
|
+
* @throws Error if state hasn't been loaded
|
|
148
|
+
*/
|
|
72
149
|
set sso(value: TSSOState);
|
|
150
|
+
/**
|
|
151
|
+
* Marks the conversation state for deletion.
|
|
152
|
+
* The state will be deleted from storage on the next call to save().
|
|
153
|
+
* @throws Error if state hasn't been loaded
|
|
154
|
+
*/
|
|
73
155
|
deleteConversationState(): void;
|
|
156
|
+
/**
|
|
157
|
+
* Marks the temporary state for deletion.
|
|
158
|
+
* Since temporary state is not persisted, this just clears the in-memory object.
|
|
159
|
+
* @throws Error if state hasn't been loaded
|
|
160
|
+
*/
|
|
74
161
|
deleteTempState(): void;
|
|
162
|
+
/**
|
|
163
|
+
* Marks the user state for deletion.
|
|
164
|
+
* The state will be deleted from storage on the next call to save().
|
|
165
|
+
* @throws Error if state hasn't been loaded
|
|
166
|
+
*/
|
|
75
167
|
deleteUserState(): void;
|
|
168
|
+
/**
|
|
169
|
+
* Gets a specific state scope by name.
|
|
170
|
+
* @param scope - The name of the scope to retrieve
|
|
171
|
+
* @returns The state entry for the scope, or undefined if not found
|
|
172
|
+
*/
|
|
76
173
|
getScope(scope: string): TurnStateEntry | undefined;
|
|
174
|
+
/**
|
|
175
|
+
* Deletes a value from state by dot-notation path.
|
|
176
|
+
* Format: "scope.property" or just "property" (defaults to temp scope)
|
|
177
|
+
* @param path - The path to the value to delete
|
|
178
|
+
*/
|
|
77
179
|
deleteValue(path: string): void;
|
|
180
|
+
/**
|
|
181
|
+
* Checks if a value exists in state by dot-notation path.
|
|
182
|
+
* Format: "scope.property" or just "property" (defaults to temp scope)
|
|
183
|
+
* @param path - The path to check
|
|
184
|
+
* @returns True if the value exists, false otherwise
|
|
185
|
+
*/
|
|
78
186
|
hasValue(path: string): boolean;
|
|
187
|
+
/**
|
|
188
|
+
* Gets a value from state by dot-notation path.
|
|
189
|
+
* Format: "scope.property" or just "property" (defaults to temp scope)
|
|
190
|
+
* @template TValue - The type of the value to retrieve
|
|
191
|
+
* @param path - The path to the value
|
|
192
|
+
* @returns The value at the specified path
|
|
193
|
+
*/
|
|
79
194
|
getValue<TValue = unknown>(path: string): TValue;
|
|
195
|
+
/**
|
|
196
|
+
* Sets a value in state by dot-notation path.
|
|
197
|
+
* Format: "scope.property" or just "property" (defaults to temp scope)
|
|
198
|
+
* @param path - The path to set
|
|
199
|
+
* @param value - The value to set
|
|
200
|
+
*/
|
|
80
201
|
setValue(path: string, value: unknown): void;
|
|
202
|
+
/**
|
|
203
|
+
* Loads state from storage into memory.
|
|
204
|
+
* @param context - The turn context
|
|
205
|
+
* @param storage - Optional storage provider (if not provided, state will be in-memory only)
|
|
206
|
+
* @param force - If true, forces a reload from storage even if state is already loaded
|
|
207
|
+
* @returns Promise that resolves to true if state was loaded, false if it was already loaded
|
|
208
|
+
*/
|
|
81
209
|
load(context: TurnContext, storage?: Storage, force?: boolean): Promise<boolean>;
|
|
210
|
+
/**
|
|
211
|
+
* Saves state changes to storage.
|
|
212
|
+
* Only changed scopes will be persisted.
|
|
213
|
+
* @param context - The turn context
|
|
214
|
+
* @param storage - Optional storage provider (if not provided, state changes won't be persisted)
|
|
215
|
+
* @returns Promise that resolves when the save operation is complete
|
|
216
|
+
* @throws Error if state hasn't been loaded
|
|
217
|
+
*/
|
|
82
218
|
save(context: TurnContext, storage?: Storage): Promise<void>;
|
|
219
|
+
/**
|
|
220
|
+
* Computes the storage keys for each scope based on the turn context.
|
|
221
|
+
* Override this method in derived classes to add or modify storage keys.
|
|
222
|
+
* @param context - The turn context
|
|
223
|
+
* @returns Promise that resolves to a dictionary of scope names to storage keys
|
|
224
|
+
* @protected
|
|
225
|
+
*/
|
|
83
226
|
protected onComputeStorageKeys(context: TurnContext): Promise<Record<string, string>>;
|
|
227
|
+
/**
|
|
228
|
+
* Parses a dot-notation path into scope and property name.
|
|
229
|
+
* If no scope is specified, defaults to the temp scope.
|
|
230
|
+
* @param path - The path to parse (format: "scope.property" or just "property")
|
|
231
|
+
* @returns Object containing the scope entry and property name
|
|
232
|
+
* @private
|
|
233
|
+
*/
|
|
84
234
|
private getScopeAndName;
|
|
85
235
|
}
|
|
@@ -41,6 +41,10 @@ const SSO_SCOPE = 'sso';
|
|
|
41
41
|
* }
|
|
42
42
|
* }
|
|
43
43
|
* ```
|
|
44
|
+
* @template TConversationState - Type for conversation-scoped state
|
|
45
|
+
* @template TUserState - Type for user-scoped state
|
|
46
|
+
* @template TTempState - Type for temporary state that exists only for the current turn
|
|
47
|
+
* @template TSSOState - Type for Single Sign-On (SSO) state
|
|
44
48
|
*/
|
|
45
49
|
class TurnState {
|
|
46
50
|
constructor() {
|
|
@@ -48,6 +52,12 @@ class TurnState {
|
|
|
48
52
|
this._isLoaded = false;
|
|
49
53
|
this._stateNotLoadedString = 'TurnState hasn\'t been loaded. Call load() first.';
|
|
50
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Gets the conversation-scoped state.
|
|
57
|
+
* This state is shared by all users in the same conversation.
|
|
58
|
+
* @returns The conversation state object
|
|
59
|
+
* @throws Error if state hasn't been loaded
|
|
60
|
+
*/
|
|
51
61
|
get conversation() {
|
|
52
62
|
const scope = this.getScope(CONVERSATION_SCOPE);
|
|
53
63
|
if (!scope) {
|
|
@@ -55,6 +65,11 @@ class TurnState {
|
|
|
55
65
|
}
|
|
56
66
|
return scope.value;
|
|
57
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Sets the conversation-scoped state.
|
|
70
|
+
* @param value - The new conversation state object
|
|
71
|
+
* @throws Error if state hasn't been loaded
|
|
72
|
+
*/
|
|
58
73
|
set conversation(value) {
|
|
59
74
|
const scope = this.getScope(CONVERSATION_SCOPE);
|
|
60
75
|
if (!scope) {
|
|
@@ -62,9 +77,19 @@ class TurnState {
|
|
|
62
77
|
}
|
|
63
78
|
scope.replace(value);
|
|
64
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Gets whether the state has been loaded from storage
|
|
82
|
+
* @returns True if the state has been loaded, false otherwise
|
|
83
|
+
*/
|
|
65
84
|
get isLoaded() {
|
|
66
85
|
return this._isLoaded;
|
|
67
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Gets the temporary state for the current turn.
|
|
89
|
+
* This state is not persisted between turns.
|
|
90
|
+
* @returns The temporary state object
|
|
91
|
+
* @throws Error if state hasn't been loaded
|
|
92
|
+
*/
|
|
68
93
|
get temp() {
|
|
69
94
|
const scope = this.getScope(TEMP_SCOPE);
|
|
70
95
|
if (!scope) {
|
|
@@ -72,6 +97,11 @@ class TurnState {
|
|
|
72
97
|
}
|
|
73
98
|
return scope.value;
|
|
74
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Sets the temporary state for the current turn.
|
|
102
|
+
* @param value - The new temporary state object
|
|
103
|
+
* @throws Error if state hasn't been loaded
|
|
104
|
+
*/
|
|
75
105
|
set temp(value) {
|
|
76
106
|
const scope = this.getScope(TEMP_SCOPE);
|
|
77
107
|
if (!scope) {
|
|
@@ -79,6 +109,12 @@ class TurnState {
|
|
|
79
109
|
}
|
|
80
110
|
scope.replace(value);
|
|
81
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Gets the user-scoped state.
|
|
114
|
+
* This state is unique to each user and persists across conversations.
|
|
115
|
+
* @returns The user state object
|
|
116
|
+
* @throws Error if state hasn't been loaded
|
|
117
|
+
*/
|
|
82
118
|
get user() {
|
|
83
119
|
const scope = this.getScope(USER_SCOPE);
|
|
84
120
|
if (!scope) {
|
|
@@ -86,6 +122,11 @@ class TurnState {
|
|
|
86
122
|
}
|
|
87
123
|
return scope.value;
|
|
88
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* Sets the user-scoped state.
|
|
127
|
+
* @param value - The new user state object
|
|
128
|
+
* @throws Error if state hasn't been loaded
|
|
129
|
+
*/
|
|
89
130
|
set user(value) {
|
|
90
131
|
const scope = this.getScope(USER_SCOPE);
|
|
91
132
|
if (!scope) {
|
|
@@ -93,6 +134,12 @@ class TurnState {
|
|
|
93
134
|
}
|
|
94
135
|
scope.replace(value);
|
|
95
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* Gets the Single Sign-On (SSO) state.
|
|
139
|
+
* This state is used to manage OAuth authentication flows.
|
|
140
|
+
* @returns The SSO state object
|
|
141
|
+
* @throws Error if state hasn't been loaded
|
|
142
|
+
*/
|
|
96
143
|
get sso() {
|
|
97
144
|
const scope = this.getScope(SSO_SCOPE);
|
|
98
145
|
if (!scope) {
|
|
@@ -100,6 +147,11 @@ class TurnState {
|
|
|
100
147
|
}
|
|
101
148
|
return scope.value;
|
|
102
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* Sets the Single Sign-On (SSO) state.
|
|
152
|
+
* @param value - The new SSO state object
|
|
153
|
+
* @throws Error if state hasn't been loaded
|
|
154
|
+
*/
|
|
103
155
|
set sso(value) {
|
|
104
156
|
const scope = this.getScope(SSO_SCOPE);
|
|
105
157
|
if (!scope) {
|
|
@@ -107,6 +159,11 @@ class TurnState {
|
|
|
107
159
|
}
|
|
108
160
|
scope.replace(value);
|
|
109
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* Marks the conversation state for deletion.
|
|
164
|
+
* The state will be deleted from storage on the next call to save().
|
|
165
|
+
* @throws Error if state hasn't been loaded
|
|
166
|
+
*/
|
|
110
167
|
deleteConversationState() {
|
|
111
168
|
const scope = this.getScope(CONVERSATION_SCOPE);
|
|
112
169
|
if (!scope) {
|
|
@@ -114,6 +171,11 @@ class TurnState {
|
|
|
114
171
|
}
|
|
115
172
|
scope.delete();
|
|
116
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* Marks the temporary state for deletion.
|
|
176
|
+
* Since temporary state is not persisted, this just clears the in-memory object.
|
|
177
|
+
* @throws Error if state hasn't been loaded
|
|
178
|
+
*/
|
|
117
179
|
deleteTempState() {
|
|
118
180
|
const scope = this.getScope(TEMP_SCOPE);
|
|
119
181
|
if (!scope) {
|
|
@@ -121,6 +183,11 @@ class TurnState {
|
|
|
121
183
|
}
|
|
122
184
|
scope.delete();
|
|
123
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* Marks the user state for deletion.
|
|
188
|
+
* The state will be deleted from storage on the next call to save().
|
|
189
|
+
* @throws Error if state hasn't been loaded
|
|
190
|
+
*/
|
|
124
191
|
deleteUserState() {
|
|
125
192
|
const scope = this.getScope(USER_SCOPE);
|
|
126
193
|
if (!scope) {
|
|
@@ -128,27 +195,63 @@ class TurnState {
|
|
|
128
195
|
}
|
|
129
196
|
scope.delete();
|
|
130
197
|
}
|
|
198
|
+
/**
|
|
199
|
+
* Gets a specific state scope by name.
|
|
200
|
+
* @param scope - The name of the scope to retrieve
|
|
201
|
+
* @returns The state entry for the scope, or undefined if not found
|
|
202
|
+
*/
|
|
131
203
|
getScope(scope) {
|
|
132
204
|
return this._scopes[scope];
|
|
133
205
|
}
|
|
206
|
+
/**
|
|
207
|
+
* Deletes a value from state by dot-notation path.
|
|
208
|
+
* Format: "scope.property" or just "property" (defaults to temp scope)
|
|
209
|
+
* @param path - The path to the value to delete
|
|
210
|
+
*/
|
|
134
211
|
deleteValue(path) {
|
|
135
212
|
const { scope, name } = this.getScopeAndName(path);
|
|
136
213
|
if (Object.prototype.hasOwnProperty.call(scope.value, name)) {
|
|
137
214
|
delete scope.value[name];
|
|
138
215
|
}
|
|
139
216
|
}
|
|
217
|
+
/**
|
|
218
|
+
* Checks if a value exists in state by dot-notation path.
|
|
219
|
+
* Format: "scope.property" or just "property" (defaults to temp scope)
|
|
220
|
+
* @param path - The path to check
|
|
221
|
+
* @returns True if the value exists, false otherwise
|
|
222
|
+
*/
|
|
140
223
|
hasValue(path) {
|
|
141
224
|
const { scope, name } = this.getScopeAndName(path);
|
|
142
225
|
return Object.prototype.hasOwnProperty.call(scope.value, name);
|
|
143
226
|
}
|
|
227
|
+
/**
|
|
228
|
+
* Gets a value from state by dot-notation path.
|
|
229
|
+
* Format: "scope.property" or just "property" (defaults to temp scope)
|
|
230
|
+
* @template TValue - The type of the value to retrieve
|
|
231
|
+
* @param path - The path to the value
|
|
232
|
+
* @returns The value at the specified path
|
|
233
|
+
*/
|
|
144
234
|
getValue(path) {
|
|
145
235
|
const { scope, name } = this.getScopeAndName(path);
|
|
146
236
|
return scope.value[name];
|
|
147
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* Sets a value in state by dot-notation path.
|
|
240
|
+
* Format: "scope.property" or just "property" (defaults to temp scope)
|
|
241
|
+
* @param path - The path to set
|
|
242
|
+
* @param value - The value to set
|
|
243
|
+
*/
|
|
148
244
|
setValue(path, value) {
|
|
149
245
|
const { scope, name } = this.getScopeAndName(path);
|
|
150
246
|
scope.value[name] = value;
|
|
151
247
|
}
|
|
248
|
+
/**
|
|
249
|
+
* Loads state from storage into memory.
|
|
250
|
+
* @param context - The turn context
|
|
251
|
+
* @param storage - Optional storage provider (if not provided, state will be in-memory only)
|
|
252
|
+
* @param force - If true, forces a reload from storage even if state is already loaded
|
|
253
|
+
* @returns Promise that resolves to true if state was loaded, false if it was already loaded
|
|
254
|
+
*/
|
|
152
255
|
load(context, storage, force = false) {
|
|
153
256
|
if (this._isLoaded && !force) {
|
|
154
257
|
return Promise.resolve(false);
|
|
@@ -186,6 +289,14 @@ class TurnState {
|
|
|
186
289
|
}
|
|
187
290
|
return this._loadingPromise;
|
|
188
291
|
}
|
|
292
|
+
/**
|
|
293
|
+
* Saves state changes to storage.
|
|
294
|
+
* Only changed scopes will be persisted.
|
|
295
|
+
* @param context - The turn context
|
|
296
|
+
* @param storage - Optional storage provider (if not provided, state changes won't be persisted)
|
|
297
|
+
* @returns Promise that resolves when the save operation is complete
|
|
298
|
+
* @throws Error if state hasn't been loaded
|
|
299
|
+
*/
|
|
189
300
|
async save(context, storage) {
|
|
190
301
|
if (!this._isLoaded && this._loadingPromise) {
|
|
191
302
|
await this._loadingPromise;
|
|
@@ -230,6 +341,13 @@ class TurnState {
|
|
|
230
341
|
}
|
|
231
342
|
}
|
|
232
343
|
}
|
|
344
|
+
/**
|
|
345
|
+
* Computes the storage keys for each scope based on the turn context.
|
|
346
|
+
* Override this method in derived classes to add or modify storage keys.
|
|
347
|
+
* @param context - The turn context
|
|
348
|
+
* @returns Promise that resolves to a dictionary of scope names to storage keys
|
|
349
|
+
* @protected
|
|
350
|
+
*/
|
|
233
351
|
onComputeStorageKeys(context) {
|
|
234
352
|
var _a, _b, _c;
|
|
235
353
|
const activity = context.activity;
|
|
@@ -255,6 +373,13 @@ class TurnState {
|
|
|
255
373
|
keys[SSO_SCOPE] = `${channelId}/${agentId}/sso`;
|
|
256
374
|
return Promise.resolve(keys);
|
|
257
375
|
}
|
|
376
|
+
/**
|
|
377
|
+
* Parses a dot-notation path into scope and property name.
|
|
378
|
+
* If no scope is specified, defaults to the temp scope.
|
|
379
|
+
* @param path - The path to parse (format: "scope.property" or just "property")
|
|
380
|
+
* @returns Object containing the scope entry and property name
|
|
381
|
+
* @private
|
|
382
|
+
*/
|
|
258
383
|
getScopeAndName(path) {
|
|
259
384
|
const parts = path.split('.');
|
|
260
385
|
if (parts.length > 2) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"turnState.js","sourceRoot":"","sources":["../../../src/app/turnState.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,qDAAiD;AAEjD,sCAAiC;AAEjC,MAAM,MAAM,GAAG,IAAA,cAAK,EAAC,kBAAkB,CAAC,CAAA;AAExC,MAAM,kBAAkB,GAAG,cAAc,CAAA;AAEzC,MAAM,UAAU,GAAG,MAAM,CAAA;AAEzB,MAAM,UAAU,GAAG,MAAM,CAAA;AAEzB,MAAM,SAAS,GAAG,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"turnState.js","sourceRoot":"","sources":["../../../src/app/turnState.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,qDAAiD;AAEjD,sCAAiC;AAEjC,MAAM,MAAM,GAAG,IAAA,cAAK,EAAC,kBAAkB,CAAC,CAAA;AAExC,MAAM,kBAAkB,GAAG,cAAc,CAAA;AAEzC,MAAM,UAAU,GAAG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