@microsoft/agents-copilotstudio-client 1.1.4-geb1c05c291 → 1.2.0-alpha.18.g3c104e426a
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/package.json +2 -2
- package/dist/src/browser.mjs +5 -5
- package/dist/src/browser.mjs.map +4 -4
- package/dist/src/connectionSettings.d.ts +20 -7
- package/dist/src/connectionSettings.js +7 -18
- package/dist/src/connectionSettings.js.map +1 -1
- package/dist/src/copilotStudioConnectionSettings.d.ts +11 -3
- package/dist/src/powerPlatformEnvironment.js +12 -14
- package/dist/src/powerPlatformEnvironment.js.map +1 -1
- package/dist/src/strategies/prebuiltBotStrategy.d.ts +9 -1
- package/dist/src/strategies/prebuiltBotStrategy.js +6 -2
- package/dist/src/strategies/prebuiltBotStrategy.js.map +1 -1
- package/dist/src/strategies/publishedBotStrategy.d.ts +5 -1
- package/dist/src/strategies/publishedBotStrategy.js +3 -0
- package/dist/src/strategies/publishedBotStrategy.js.map +1 -1
- package/dist/src/strategies/strategy.d.ts +13 -0
- package/package.json +2 -2
- package/src/connectionSettings.ts +25 -13
- package/src/copilotStudioConnectionSettings.ts +12 -4
- package/src/powerPlatformEnvironment.ts +9 -12
- package/src/strategies/prebuiltBotStrategy.ts +14 -4
- package/src/strategies/publishedBotStrategy.ts +7 -2
- package/src/strategies/strategy.ts +15 -0
|
@@ -9,16 +9,29 @@ import { PowerPlatformCloud } from './powerPlatformCloud';
|
|
|
9
9
|
* Configuration options for establishing a connection to Copilot Studio.
|
|
10
10
|
*/
|
|
11
11
|
declare abstract class ConnectionOptions implements Omit<CopilotStudioConnectionSettings, 'cloud' | 'copilotAgentType'> {
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
/**
|
|
13
|
+
* The client ID of the application.
|
|
14
|
+
* @deprecated This property will not be supported in future versions. Handle the auth properties in the agent.
|
|
15
|
+
**/
|
|
16
|
+
appClientId?: string;
|
|
17
|
+
/**
|
|
18
|
+
* The tenant ID of the application.
|
|
19
|
+
*@deprecated This property will not be supported in future versions. Handle the auth properties in the agent.
|
|
20
|
+
**/
|
|
21
|
+
tenantId?: string;
|
|
22
|
+
/**
|
|
23
|
+
* The login authority to use for the connection.
|
|
24
|
+
* @deprecated This property will not be supported in future versions. Handle the auth properties in the agent.
|
|
25
|
+
**/
|
|
17
26
|
authority?: string;
|
|
18
27
|
/** The environment ID of the application. */
|
|
19
|
-
environmentId
|
|
28
|
+
environmentId?: string;
|
|
29
|
+
/** The identifier of the agent.
|
|
30
|
+
* @deprecated This property will not be supported in future versions. Use schemaName instead.
|
|
31
|
+
**/
|
|
32
|
+
agentIdentifier?: string;
|
|
20
33
|
/** The identifier of the agent. */
|
|
21
|
-
|
|
34
|
+
schemaName?: string;
|
|
22
35
|
/** The cloud environment of the application. */
|
|
23
36
|
cloud?: PowerPlatformCloud | keyof typeof PowerPlatformCloud;
|
|
24
37
|
/** The custom Power Platform cloud URL, if any. */
|
|
@@ -12,16 +12,6 @@ const powerPlatformCloud_1 = require("./powerPlatformCloud");
|
|
|
12
12
|
*/
|
|
13
13
|
class ConnectionOptions {
|
|
14
14
|
constructor() {
|
|
15
|
-
/** The client ID of the application. */
|
|
16
|
-
this.appClientId = '';
|
|
17
|
-
/** The tenant ID of the application. */
|
|
18
|
-
this.tenantId = '';
|
|
19
|
-
/** The login authority to use for the connection */
|
|
20
|
-
this.authority = '';
|
|
21
|
-
/** The environment ID of the application. */
|
|
22
|
-
this.environmentId = '';
|
|
23
|
-
/** The identifier of the agent. */
|
|
24
|
-
this.agentIdentifier = '';
|
|
25
15
|
/** Flag to use the experimental endpoint if available */
|
|
26
16
|
this.useExperimentalEndpoint = false;
|
|
27
17
|
}
|
|
@@ -34,16 +24,14 @@ class ConnectionSettings extends ConnectionOptions {
|
|
|
34
24
|
* @private
|
|
35
25
|
*/
|
|
36
26
|
constructor(options) {
|
|
37
|
-
var _a, _b;
|
|
27
|
+
var _a, _b, _c;
|
|
38
28
|
super();
|
|
39
29
|
if (!options) {
|
|
40
30
|
return;
|
|
41
31
|
}
|
|
42
|
-
const cloud = (_a = options.cloud)
|
|
43
|
-
const copilotAgentType = (_b = options.copilotAgentType)
|
|
44
|
-
const authority = options.authority
|
|
45
|
-
? options.authority
|
|
46
|
-
: 'https://login.microsoftonline.com';
|
|
32
|
+
const cloud = ((_a = options.cloud) === null || _a === void 0 ? void 0 : _a.trim()) || powerPlatformCloud_1.PowerPlatformCloud.Prod;
|
|
33
|
+
const copilotAgentType = ((_b = options.copilotAgentType) === null || _b === void 0 ? void 0 : _b.trim()) || agentType_1.AgentType.Published;
|
|
34
|
+
const authority = ((_c = options.authority) === null || _c === void 0 ? void 0 : _c.trim()) || 'https://login.microsoftonline.com';
|
|
47
35
|
if (!Object.values(powerPlatformCloud_1.PowerPlatformCloud).includes(cloud)) {
|
|
48
36
|
throw new Error(`Invalid PowerPlatformCloud: '${cloud}'. Supported values: ${Object.values(powerPlatformCloud_1.PowerPlatformCloud).join(', ')}`);
|
|
49
37
|
}
|
|
@@ -59,18 +47,19 @@ exports.ConnectionSettings = ConnectionSettings;
|
|
|
59
47
|
* @returns The connection settings.
|
|
60
48
|
*/
|
|
61
49
|
const loadCopilotStudioConnectionSettingsFromEnv = () => {
|
|
62
|
-
var _a, _b, _c, _d, _e, _f;
|
|
50
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
63
51
|
return new ConnectionSettings({
|
|
64
52
|
appClientId: (_a = process.env.appClientId) !== null && _a !== void 0 ? _a : '',
|
|
65
53
|
tenantId: (_b = process.env.tenantId) !== null && _b !== void 0 ? _b : '',
|
|
66
54
|
authority: (_c = process.env.authorityEndpoint) !== null && _c !== void 0 ? _c : 'https://login.microsoftonline.com',
|
|
67
55
|
environmentId: (_d = process.env.environmentId) !== null && _d !== void 0 ? _d : '',
|
|
68
56
|
agentIdentifier: (_e = process.env.agentIdentifier) !== null && _e !== void 0 ? _e : '',
|
|
57
|
+
schemaName: (_f = process.env.schemaName) !== null && _f !== void 0 ? _f : '',
|
|
69
58
|
cloud: process.env.cloud,
|
|
70
59
|
customPowerPlatformCloud: process.env.customPowerPlatformCloud,
|
|
71
60
|
copilotAgentType: process.env.copilotAgentType,
|
|
72
61
|
directConnectUrl: process.env.directConnectUrl,
|
|
73
|
-
useExperimentalEndpoint: ((
|
|
62
|
+
useExperimentalEndpoint: ((_g = process.env.useExperimentalEndpoint) === null || _g === void 0 ? void 0 : _g.toLowerCase()) === 'true'
|
|
74
63
|
});
|
|
75
64
|
};
|
|
76
65
|
exports.loadCopilotStudioConnectionSettingsFromEnv = loadCopilotStudioConnectionSettingsFromEnv;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connectionSettings.js","sourceRoot":"","sources":["../../src/connectionSettings.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2CAAuC;AAEvC,6DAAyD;AAEzD;;GAEG;AACH,MAAe,iBAAiB;IAAhC;
|
|
1
|
+
{"version":3,"file":"connectionSettings.js","sourceRoot":"","sources":["../../src/connectionSettings.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2CAAuC;AAEvC,6DAAyD;AAEzD;;GAEG;AACH,MAAe,iBAAiB;IAAhC;QAgCE,yDAAyD;QAClD,4BAAuB,GAAa,KAAK,CAAA;IAClD,CAAC;CAAA;AAED;;GAEG;AACH,MAAa,kBAAmB,SAAQ,iBAAiB;IAiBvD;;OAEG;IACH,YAAa,OAA2B;;QACtC,KAAK,EAAE,CAAA;QAEP,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAM;QACR,CAAC;QAED,MAAM,KAAK,GAAG,CAAA,MAAA,OAAO,CAAC,KAAK,0CAAE,IAAI,EAAE,KAAI,uCAAkB,CAAC,IAAI,CAAA;QAC9D,MAAM,gBAAgB,GAAG,CAAA,MAAA,OAAO,CAAC,gBAAgB,0CAAE,IAAI,EAAE,KAAI,qBAAS,CAAC,SAAS,CAA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C,UAAU,mCAAI,EAAE;QACxC,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,KAA2B;QAC9C,wBAAwB,EAAE,OAAO,CAAC,GAAG,CAAC,wBAAwB;QAC9D,gBAAgB,EAAE,OAAO,CAAC,GAAG,CAAC,gBAA6B;QAC3D,gBAAgB,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB;QAC9C,uBAAuB,EAAE,CAAA,MAAA,OAAO,CAAC,GAAG,CAAC,uBAAuB,0CAAE,WAAW,EAAE,MAAK,MAAM;KACvF,CAAC,CAAA;AACJ,CAAC,CAAA;AAdY,QAAA,0CAA0C,8CActD"}
|
|
@@ -8,8 +8,13 @@ import { PowerPlatformCloud } from './powerPlatformCloud';
|
|
|
8
8
|
* Represents the settings required to establish a direct connection to the engine.
|
|
9
9
|
*/
|
|
10
10
|
export interface CopilotStudioConnectionSettings {
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* The identifier of the agent.
|
|
13
|
+
* @deprecated This property will not be supported in future versions. Use schemaName instead.
|
|
14
|
+
**/
|
|
12
15
|
agentIdentifier?: string;
|
|
16
|
+
/** The schema name of the agent. */
|
|
17
|
+
schemaName?: string;
|
|
13
18
|
/** The custom Power Platform cloud URL. */
|
|
14
19
|
customPowerPlatformCloud?: string;
|
|
15
20
|
/** The environment ID of the application. */
|
|
@@ -20,8 +25,11 @@ export interface CopilotStudioConnectionSettings {
|
|
|
20
25
|
copilotAgentType?: AgentType;
|
|
21
26
|
/** URL provided to connect directly to Copilot Studio endpoint. When provided all other settings are ignored. */
|
|
22
27
|
directConnectUrl?: string;
|
|
23
|
-
/** Directs Copilot Studio Client to use the experimental endpoint if available. */
|
|
28
|
+
/** Directs Copilot Studio Client to use the experimental endpoint if available. Default value is false. */
|
|
24
29
|
useExperimentalEndpoint?: boolean;
|
|
25
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* The login authority to use for the connection.
|
|
32
|
+
* @deprecated This property will not be supported in future versions. Handle the auth properties in the agent.
|
|
33
|
+
**/
|
|
26
34
|
authority?: string;
|
|
27
35
|
}
|
|
@@ -20,32 +20,30 @@ const logger = (0, logger_1.debug)('copilot-studio:power-platform');
|
|
|
20
20
|
* @throws Will throw an error if required settings are missing or invalid.
|
|
21
21
|
*/
|
|
22
22
|
function getCopilotStudioConnectionUrl(settings, conversationId) {
|
|
23
|
-
var _a, _b, _c, _d, _e, _f;
|
|
24
|
-
|
|
23
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
24
|
+
const schemaName = ((_a = settings.schemaName) === null || _a === void 0 ? void 0 : _a.trim()) || ((_b = settings.agentIdentifier) === null || _b === void 0 ? void 0 : _b.trim());
|
|
25
|
+
if (!((_c = settings.directConnectUrl) === null || _c === void 0 ? void 0 : _c.trim()) && (!((_d = settings.environmentId) === null || _d === void 0 ? void 0 : _d.trim()) || !(schemaName === null || schemaName === void 0 ? void 0 : schemaName.trim()))) {
|
|
26
|
+
throw new Error('Either directConnectUrl OR both environmentId and schemaName/agentIdentifier must be provided');
|
|
27
|
+
}
|
|
28
|
+
if ((_e = settings.directConnectUrl) === null || _e === void 0 ? void 0 : _e.trim()) {
|
|
25
29
|
logger.debug(`Using direct connection: ${settings.directConnectUrl}`);
|
|
26
30
|
if (!isValidUri(settings.directConnectUrl)) {
|
|
27
31
|
throw new Error('directConnectUrl must be a valid URL');
|
|
28
32
|
}
|
|
29
33
|
// FIX for Missing Tenant ID
|
|
30
34
|
if (settings.directConnectUrl.toLowerCase().includes('tenants/00000000-0000-0000-0000-000000000000')) {
|
|
31
|
-
logger.
|
|
35
|
+
logger.warn(`Direct connection cannot be used, forcing default settings flow. Tenant ID is missing in the URL: ${settings.directConnectUrl}`);
|
|
32
36
|
// Direct connection cannot be used, ejecting and forcing the normal settings flow:
|
|
33
37
|
return getCopilotStudioConnectionUrl({ ...settings, directConnectUrl: '' }, conversationId);
|
|
34
38
|
}
|
|
35
39
|
return createURL(settings.directConnectUrl, conversationId).href;
|
|
36
40
|
}
|
|
37
|
-
const cloudSetting = (
|
|
38
|
-
const agentType = (
|
|
41
|
+
const cloudSetting = (_f = settings.cloud) !== null && _f !== void 0 ? _f : powerPlatformCloud_1.PowerPlatformCloud.Prod;
|
|
42
|
+
const agentType = (_g = settings.copilotAgentType) !== null && _g !== void 0 ? _g : agentType_1.AgentType.Published;
|
|
39
43
|
logger.debug(`Using cloud setting: ${cloudSetting}`);
|
|
40
44
|
logger.debug(`Using agent type: ${agentType}`);
|
|
41
|
-
if (!((_d = settings.environmentId) === null || _d === void 0 ? void 0 : _d.trim())) {
|
|
42
|
-
throw new Error('EnvironmentId must be provided');
|
|
43
|
-
}
|
|
44
|
-
if (!((_e = settings.agentIdentifier) === null || _e === void 0 ? void 0 : _e.trim())) {
|
|
45
|
-
throw new Error('AgentIdentifier must be provided');
|
|
46
|
-
}
|
|
47
45
|
if (cloudSetting === powerPlatformCloud_1.PowerPlatformCloud.Other) {
|
|
48
|
-
if (!((
|
|
46
|
+
if (!((_h = settings.customPowerPlatformCloud) === null || _h === void 0 ? void 0 : _h.trim())) {
|
|
49
47
|
throw new Error('customPowerPlatformCloud must be provided when PowerPlatformCloud is Other');
|
|
50
48
|
}
|
|
51
49
|
else if (isValidUri(settings.customPowerPlatformCloud)) {
|
|
@@ -59,11 +57,11 @@ function getCopilotStudioConnectionUrl(settings, conversationId) {
|
|
|
59
57
|
const strategy = {
|
|
60
58
|
[agentType_1.AgentType.Published]: () => new publishedBotStrategy_1.PublishedBotStrategy({
|
|
61
59
|
host,
|
|
62
|
-
schema:
|
|
60
|
+
schema: schemaName,
|
|
63
61
|
}),
|
|
64
62
|
[agentType_1.AgentType.Prebuilt]: () => new prebuiltBotStrategy_1.PrebuiltBotStrategy({
|
|
65
63
|
host,
|
|
66
|
-
|
|
64
|
+
schema: schemaName,
|
|
67
65
|
}),
|
|
68
66
|
}[agentType]();
|
|
69
67
|
const url = strategy.getConversationUrl(conversationId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"powerPlatformEnvironment.js","sourceRoot":"","sources":["../../src/powerPlatformEnvironment.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAkBH,
|
|
1
|
+
{"version":3,"file":"powerPlatformEnvironment.js","sourceRoot":"","sources":["../../src/powerPlatformEnvironment.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAkBH,sEA2DC;AAWD,4CAiDC;AAvID,2CAAuC;AAEvC,8DAAyD;AACzD,6DAAyD;AACzD,0EAAsE;AACtE,4EAAwE;AAExE,MAAM,MAAM,GAAG,IAAA,cAAK,EAAC,+BAA+B,CAAC,CAAA;AAErD;;;;;;GAMG;AACH,SAAgB,6BAA6B,CAC3C,QAA4B,EAC5B,cAAuB;;IAEvB,MAAM,UAAU,GAAG,CAAA,MAAA,QAAQ,CAAC,UAAU,0CAAE,IAAI,EAAE,MAAI,MAAA,QAAQ,CAAC,eAAe,0CAAE,IAAI,EAAE,CAAA,CAAA;IAClF,IAAI,CAAC,CAAA,MAAA,QAAQ,CAAC,gBAAgB,0CAAE,IAAI,EAAE,CAAA,IAAI,CAAC,CAAC,CAAA,MAAA,QAAQ,CAAC,aAAa,0CAAE,IAAI,EAAE,CAAA,IAAI,CAAC,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI,EAAE,CAAA,CAAC,EAAE,CAAC;QACnG,MAAM,IAAI,KAAK,CAAC,+FAA+F,CAAC,CAAA;IAClH,CAAC;IAED,IAAI,MAAA,QAAQ,CAAC,gBAAgB,0CAAE,IAAI,EAAE,EAAE,CAAC;QACtC,MAAM,CAAC,KAAK,CAAC,4BAA4B,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CAAA;QACrE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC;YAC3C,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAA;QACzD,CAAC;QAED,4BAA4B;QAC5B,IAAI,QAAQ,CAAC,gBAAgB,CAAC,WAAW,EAA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,KAAK,uCAAkB,CAAC,IAAI;YAC1B,OAAO,CAAC,CAAA;QACV;YACE,OAAO,CAAC,CAAA;IACZ,CAAC;AACH,CAAC;AAED,SAAS,kBAAkB,CAAE,GAAQ;IACnC,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAA;IAEnC,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,6BAA6B;YAChC,OAAO,uCAAkB,CAAC,KAAK,CAAA;QACjC,KAAK,2BAA2B;YAC9B,OAAO,uCAAkB,CAAC,GAAG,CAAA;QAC/B,KAAK,2BAA2B;YAC9B,OAAO,uCAAkB,CAAC,GAAG,CAAA;QAC/B,KAAK,2BAA2B;YAC9B,OAAO,uCAAkB,CAAC,GAAG,CAAA;QAC/B,KAAK,4BAA4B;YAC/B,OAAO,uCAAkB,CAAC,IAAI,CAAA;QAChC,KAAK,+BAA+B;YAClC,OAAO,uCAAkB,CAAC,OAAO,CAAA;QACnC,KAAK,uBAAuB;YAC1B,OAAO,uCAAkB,CAAC,IAAI,CAAA;QAChC,KAAK,oCAAoC;YACvC,OAAO,uCAAkB,CAAC,KAAK,CAAA;QACjC,KAAK,qCAAqC;YACxC,OAAO,uCAAkB,CAAC,IAAI,CAAA;QAChC,KAAK,qBAAqB;YACxB,OAAO,uCAAkB,CAAC,GAAG,CAAA;QAC/B,KAAK,8CAA8C;YACjD,OAAO,uCAAkB,CAAC,QAAQ,CAAA;QACpC;YACE,OAAO,uCAAkB,CAAC,OAAO,CAAA;IACrC,CAAC;AACH,CAAC"}
|
|
@@ -2,14 +2,22 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { Strategy } from './strategy';
|
|
5
|
+
import type { Strategy, StrategySettings } from './strategy';
|
|
6
|
+
/** @deprecated This interface will not be supported in future versions. Use StrategySettings instead. */
|
|
6
7
|
export interface PrebuiltBotStrategySettings {
|
|
7
8
|
readonly host: URL;
|
|
8
9
|
readonly identifier: string;
|
|
9
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Strategy for constructing PowerPlatform API connection URLs for prebuilt agents.
|
|
13
|
+
*/
|
|
10
14
|
export declare class PrebuiltBotStrategy implements Strategy {
|
|
11
15
|
private readonly API_VERSION;
|
|
12
16
|
private baseURL;
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated This constructor will not be supported in future versions. Use constructor (settings: StrategySettings).
|
|
19
|
+
*/
|
|
13
20
|
constructor(settings: PrebuiltBotStrategySettings);
|
|
21
|
+
constructor(settings: StrategySettings);
|
|
14
22
|
getConversationUrl(conversationId?: string): string;
|
|
15
23
|
}
|
|
@@ -5,11 +5,15 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.PrebuiltBotStrategy = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* Strategy for constructing PowerPlatform API connection URLs for prebuilt agents.
|
|
10
|
+
*/
|
|
8
11
|
class PrebuiltBotStrategy {
|
|
9
12
|
constructor(settings) {
|
|
10
13
|
this.API_VERSION = '2022-03-01-preview';
|
|
11
|
-
const
|
|
12
|
-
|
|
14
|
+
const schema = 'schema' in settings ? settings.schema : settings.identifier;
|
|
15
|
+
const host = settings.host;
|
|
16
|
+
this.baseURL = new URL(`/copilotstudio/prebuilt/authenticated/bots/${schema}`, host);
|
|
13
17
|
this.baseURL.searchParams.append('api-version', this.API_VERSION);
|
|
14
18
|
}
|
|
15
19
|
getConversationUrl(conversationId) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prebuiltBotStrategy.js","sourceRoot":"","sources":["../../../src/strategies/prebuiltBotStrategy.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"prebuiltBotStrategy.js","sourceRoot":"","sources":["../../../src/strategies/prebuiltBotStrategy.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAUH;;GAEG;AACH,MAAa,mBAAmB;IAS9B,YAAa,QAAwD;QARpD,gBAAW,GAAG,oBAAoB,CAAA;QASjD,MAAM,MAAM,GAAG,QAAQ,IAAI,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAA;QAC3E,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAA;QAE1B,IAAI,CAAC,OAAO,GAAG,IAAI,GAAG,CACpB,8CAA8C,MAAM,EAAE,EACtD,IAAI,CACL,CAAA;QACD,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,aAAa,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;IACnE,CAAC;IAEM,kBAAkB,CAAE,cAAuB;QAChD,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QAClD,eAAe,CAAC,QAAQ,GAAG,GAAG,eAAe,CAAC,QAAQ,gBAAgB,CAAA;QAEtE,IAAI,cAAc,EAAE,CAAC;YACnB,eAAe,CAAC,QAAQ,GAAG,GAAG,eAAe,CAAC,QAAQ,IAAI,cAAc,EAAE,CAAA;QAC5E,CAAC;QAED,OAAO,eAAe,CAAC,IAAI,CAAA;IAC7B,CAAC;CACF;AA9BD,kDA8BC"}
|
|
@@ -2,11 +2,15 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { Strategy } from './strategy';
|
|
5
|
+
import type { Strategy } from './strategy';
|
|
6
|
+
/** @deprecated This interface will not be supported in future versions. Use StrategySettings instead. */
|
|
6
7
|
export interface PublishedBotStrategySettings {
|
|
7
8
|
readonly host: URL;
|
|
8
9
|
readonly schema: string;
|
|
9
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Strategy for constructing PowerPlatform API connection URLs for published agents.
|
|
13
|
+
*/
|
|
10
14
|
export declare class PublishedBotStrategy implements Strategy {
|
|
11
15
|
private readonly API_VERSION;
|
|
12
16
|
private baseURL;
|
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.PublishedBotStrategy = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* Strategy for constructing PowerPlatform API connection URLs for published agents.
|
|
10
|
+
*/
|
|
8
11
|
class PublishedBotStrategy {
|
|
9
12
|
constructor(settings) {
|
|
10
13
|
this.API_VERSION = '2022-03-01-preview';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publishedBotStrategy.js","sourceRoot":"","sources":["../../../src/strategies/publishedBotStrategy.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"publishedBotStrategy.js","sourceRoot":"","sources":["../../../src/strategies/publishedBotStrategy.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAUH;;GAEG;AACH,MAAa,oBAAoB;IAK/B,YAAa,QAA0B;QAJtB,gBAAW,GAAG,oBAAoB,CAAA;QAKjD,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAA;QAEjC,IAAI,CAAC,OAAO,GAAG,IAAI,GAAG,CACpB,sDAAsD,MAAM,EAAE,EAC9D,IAAI,CACL,CAAA;QACD,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,aAAa,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;IACnE,CAAC;IAEM,kBAAkB,CAAE,cAAuB;QAChD,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QAClD,eAAe,CAAC,QAAQ,GAAG,GAAG,eAAe,CAAC,QAAQ,gBAAgB,CAAA;QAEtE,IAAI,cAAc,EAAE,CAAC;YACnB,eAAe,CAAC,QAAQ,GAAG,GAAG,eAAe,CAAC,QAAQ,IAAI,cAAc,EAAE,CAAA;QAC5E,CAAC;QAED,OAAO,eAAe,CAAC,IAAI,CAAA;IAC7B,CAAC;CACF;AAzBD,oDAyBC"}
|
|
@@ -5,3 +5,16 @@
|
|
|
5
5
|
export interface Strategy {
|
|
6
6
|
getConversationUrl(conversationId?: string): string;
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Settings required to configure the Strategy.
|
|
10
|
+
*/
|
|
11
|
+
export interface StrategySettings {
|
|
12
|
+
/**
|
|
13
|
+
* The host URL of the Copilot Studio service.
|
|
14
|
+
*/
|
|
15
|
+
readonly host: URL;
|
|
16
|
+
/**
|
|
17
|
+
* The schema identifier for the agent.
|
|
18
|
+
*/
|
|
19
|
+
readonly schema: string;
|
|
20
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/agents-copilotstudio-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0-alpha.18.g3c104e426a",
|
|
4
4
|
"homepage": "https://github.com/microsoft/Agents-for-js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"build:browser": "esbuild --platform=browser --target=es2019 --format=esm --bundle --sourcemap --minify --outfile=dist/src/browser.mjs src/index.ts"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@microsoft/agents-activity": "1.
|
|
30
|
+
"@microsoft/agents-activity": "1.2.0-alpha.18.g3c104e426a",
|
|
31
31
|
"eventsource-client": "^1.2.0",
|
|
32
32
|
"rxjs": "7.8.2",
|
|
33
33
|
"uuid": "^11.1.0"
|
|
@@ -11,16 +11,29 @@ import { PowerPlatformCloud } from './powerPlatformCloud'
|
|
|
11
11
|
* Configuration options for establishing a connection to Copilot Studio.
|
|
12
12
|
*/
|
|
13
13
|
abstract class ConnectionOptions implements Omit<CopilotStudioConnectionSettings, 'cloud' | 'copilotAgentType'> {
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
/**
|
|
15
|
+
* The client ID of the application.
|
|
16
|
+
* @deprecated This property will not be supported in future versions. Handle the auth properties in the agent.
|
|
17
|
+
**/
|
|
18
|
+
public appClientId?: string
|
|
19
|
+
/**
|
|
20
|
+
* The tenant ID of the application.
|
|
21
|
+
*@deprecated This property will not be supported in future versions. Handle the auth properties in the agent.
|
|
22
|
+
**/
|
|
23
|
+
public tenantId?: string
|
|
24
|
+
/**
|
|
25
|
+
* The login authority to use for the connection.
|
|
26
|
+
* @deprecated This property will not be supported in future versions. Handle the auth properties in the agent.
|
|
27
|
+
**/
|
|
28
|
+
public authority?: string
|
|
20
29
|
/** The environment ID of the application. */
|
|
21
|
-
public environmentId
|
|
30
|
+
public environmentId?: string
|
|
31
|
+
/** The identifier of the agent.
|
|
32
|
+
* @deprecated This property will not be supported in future versions. Use schemaName instead.
|
|
33
|
+
**/
|
|
34
|
+
public agentIdentifier?: string
|
|
22
35
|
/** The identifier of the agent. */
|
|
23
|
-
public
|
|
36
|
+
public schemaName?: string
|
|
24
37
|
/** The cloud environment of the application. */
|
|
25
38
|
public cloud?: PowerPlatformCloud | keyof typeof PowerPlatformCloud
|
|
26
39
|
/** The custom Power Platform cloud URL, if any. */
|
|
@@ -63,11 +76,9 @@ export class ConnectionSettings extends ConnectionOptions {
|
|
|
63
76
|
return
|
|
64
77
|
}
|
|
65
78
|
|
|
66
|
-
const cloud = options.cloud
|
|
67
|
-
const copilotAgentType = options.copilotAgentType
|
|
68
|
-
const authority = options.authority
|
|
69
|
-
? options.authority
|
|
70
|
-
: 'https://login.microsoftonline.com'
|
|
79
|
+
const cloud = options.cloud?.trim() || PowerPlatformCloud.Prod
|
|
80
|
+
const copilotAgentType = options.copilotAgentType?.trim() || AgentType.Published
|
|
81
|
+
const authority = options.authority?.trim() || 'https://login.microsoftonline.com'
|
|
71
82
|
|
|
72
83
|
if (!Object.values(PowerPlatformCloud).includes(cloud as PowerPlatformCloud)) {
|
|
73
84
|
throw new Error(`Invalid PowerPlatformCloud: '${cloud}'. Supported values: ${Object.values(PowerPlatformCloud).join(', ')}`)
|
|
@@ -92,6 +103,7 @@ export const loadCopilotStudioConnectionSettingsFromEnv: () => ConnectionSetting
|
|
|
92
103
|
authority: process.env.authorityEndpoint ?? 'https://login.microsoftonline.com',
|
|
93
104
|
environmentId: process.env.environmentId ?? '',
|
|
94
105
|
agentIdentifier: process.env.agentIdentifier ?? '',
|
|
106
|
+
schemaName: process.env.schemaName ?? '',
|
|
95
107
|
cloud: process.env.cloud as PowerPlatformCloud,
|
|
96
108
|
customPowerPlatformCloud: process.env.customPowerPlatformCloud,
|
|
97
109
|
copilotAgentType: process.env.copilotAgentType as AgentType,
|
|
@@ -10,8 +10,13 @@ import { PowerPlatformCloud } from './powerPlatformCloud'
|
|
|
10
10
|
* Represents the settings required to establish a direct connection to the engine.
|
|
11
11
|
*/
|
|
12
12
|
export interface CopilotStudioConnectionSettings {
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* The identifier of the agent.
|
|
15
|
+
* @deprecated This property will not be supported in future versions. Use schemaName instead.
|
|
16
|
+
**/
|
|
14
17
|
agentIdentifier?: string
|
|
18
|
+
/** The schema name of the agent. */
|
|
19
|
+
schemaName?: string
|
|
15
20
|
|
|
16
21
|
/** The custom Power Platform cloud URL. */
|
|
17
22
|
customPowerPlatformCloud?: string
|
|
@@ -28,9 +33,12 @@ export interface CopilotStudioConnectionSettings {
|
|
|
28
33
|
/** URL provided to connect directly to Copilot Studio endpoint. When provided all other settings are ignored. */
|
|
29
34
|
directConnectUrl?: string
|
|
30
35
|
|
|
31
|
-
/** Directs Copilot Studio Client to use the experimental endpoint if available. */
|
|
32
|
-
useExperimentalEndpoint?: boolean
|
|
36
|
+
/** Directs Copilot Studio Client to use the experimental endpoint if available. Default value is false. */
|
|
37
|
+
useExperimentalEndpoint?: boolean
|
|
33
38
|
|
|
34
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* The login authority to use for the connection.
|
|
41
|
+
* @deprecated This property will not be supported in future versions. Handle the auth properties in the agent.
|
|
42
|
+
**/
|
|
35
43
|
authority?: string
|
|
36
44
|
}
|
|
@@ -23,6 +23,11 @@ export function getCopilotStudioConnectionUrl (
|
|
|
23
23
|
settings: ConnectionSettings,
|
|
24
24
|
conversationId?: string
|
|
25
25
|
): string {
|
|
26
|
+
const schemaName = settings.schemaName?.trim() || settings.agentIdentifier?.trim()
|
|
27
|
+
if (!settings.directConnectUrl?.trim() && (!settings.environmentId?.trim() || !schemaName?.trim())) {
|
|
28
|
+
throw new Error('Either directConnectUrl OR both environmentId and schemaName/agentIdentifier must be provided')
|
|
29
|
+
}
|
|
30
|
+
|
|
26
31
|
if (settings.directConnectUrl?.trim()) {
|
|
27
32
|
logger.debug(`Using direct connection: ${settings.directConnectUrl}`)
|
|
28
33
|
if (!isValidUri(settings.directConnectUrl)) {
|
|
@@ -31,7 +36,7 @@ export function getCopilotStudioConnectionUrl (
|
|
|
31
36
|
|
|
32
37
|
// FIX for Missing Tenant ID
|
|
33
38
|
if (settings.directConnectUrl.toLowerCase().includes('tenants/00000000-0000-0000-0000-000000000000')) {
|
|
34
|
-
logger.
|
|
39
|
+
logger.warn(`Direct connection cannot be used, forcing default settings flow. Tenant ID is missing in the URL: ${settings.directConnectUrl}`)
|
|
35
40
|
// Direct connection cannot be used, ejecting and forcing the normal settings flow:
|
|
36
41
|
return getCopilotStudioConnectionUrl({ ...settings, directConnectUrl: '' }, conversationId)
|
|
37
42
|
}
|
|
@@ -45,14 +50,6 @@ export function getCopilotStudioConnectionUrl (
|
|
|
45
50
|
logger.debug(`Using cloud setting: ${cloudSetting}`)
|
|
46
51
|
logger.debug(`Using agent type: ${agentType}`)
|
|
47
52
|
|
|
48
|
-
if (!settings.environmentId?.trim()) {
|
|
49
|
-
throw new Error('EnvironmentId must be provided')
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (!settings.agentIdentifier?.trim()) {
|
|
53
|
-
throw new Error('AgentIdentifier must be provided')
|
|
54
|
-
}
|
|
55
|
-
|
|
56
53
|
if (cloudSetting === PowerPlatformCloud.Other) {
|
|
57
54
|
if (!settings.customPowerPlatformCloud?.trim()) {
|
|
58
55
|
throw new Error('customPowerPlatformCloud must be provided when PowerPlatformCloud is Other')
|
|
@@ -65,16 +62,16 @@ export function getCopilotStudioConnectionUrl (
|
|
|
65
62
|
}
|
|
66
63
|
}
|
|
67
64
|
|
|
68
|
-
const host = getEnvironmentEndpoint(cloudSetting, settings.environmentId
|
|
65
|
+
const host = getEnvironmentEndpoint(cloudSetting, settings.environmentId!, settings.customPowerPlatformCloud)
|
|
69
66
|
|
|
70
67
|
const strategy = {
|
|
71
68
|
[AgentType.Published]: () => new PublishedBotStrategy({
|
|
72
69
|
host,
|
|
73
|
-
schema:
|
|
70
|
+
schema: schemaName!,
|
|
74
71
|
}),
|
|
75
72
|
[AgentType.Prebuilt]: () => new PrebuiltBotStrategy({
|
|
76
73
|
host,
|
|
77
|
-
|
|
74
|
+
schema: schemaName!,
|
|
78
75
|
}),
|
|
79
76
|
}[agentType]()
|
|
80
77
|
|
|
@@ -3,22 +3,32 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { Strategy } from './strategy'
|
|
6
|
+
import type { Strategy, StrategySettings } from './strategy'
|
|
7
7
|
|
|
8
|
+
/** @deprecated This interface will not be supported in future versions. Use StrategySettings instead. */
|
|
8
9
|
export interface PrebuiltBotStrategySettings {
|
|
9
10
|
readonly host: URL;
|
|
10
11
|
readonly identifier: string;
|
|
11
12
|
}
|
|
12
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Strategy for constructing PowerPlatform API connection URLs for prebuilt agents.
|
|
16
|
+
*/
|
|
13
17
|
export class PrebuiltBotStrategy implements Strategy {
|
|
14
18
|
private readonly API_VERSION = '2022-03-01-preview'
|
|
15
19
|
private baseURL: URL
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated This constructor will not be supported in future versions. Use constructor (settings: StrategySettings).
|
|
23
|
+
*/
|
|
24
|
+
constructor (settings: PrebuiltBotStrategySettings)
|
|
25
|
+
constructor (settings: StrategySettings)
|
|
26
|
+
constructor (settings: PrebuiltBotStrategySettings | StrategySettings) {
|
|
27
|
+
const schema = 'schema' in settings ? settings.schema : settings.identifier
|
|
28
|
+
const host = settings.host
|
|
19
29
|
|
|
20
30
|
this.baseURL = new URL(
|
|
21
|
-
`/copilotstudio/prebuilt/authenticated/bots/${
|
|
31
|
+
`/copilotstudio/prebuilt/authenticated/bots/${schema}`,
|
|
22
32
|
host
|
|
23
33
|
)
|
|
24
34
|
this.baseURL.searchParams.append('api-version', this.API_VERSION)
|
|
@@ -3,18 +3,23 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { Strategy } from './strategy'
|
|
6
|
+
import type { Strategy, StrategySettings } from './strategy'
|
|
7
7
|
|
|
8
|
+
/** @deprecated This interface will not be supported in future versions. Use StrategySettings instead. */
|
|
8
9
|
export interface PublishedBotStrategySettings {
|
|
9
10
|
readonly host: URL;
|
|
10
11
|
readonly schema: string;
|
|
11
12
|
}
|
|
12
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Strategy for constructing PowerPlatform API connection URLs for published agents.
|
|
16
|
+
*/
|
|
13
17
|
export class PublishedBotStrategy implements Strategy {
|
|
14
18
|
private readonly API_VERSION = '2022-03-01-preview'
|
|
15
19
|
private baseURL: URL
|
|
16
20
|
|
|
17
|
-
constructor (settings: PublishedBotStrategySettings)
|
|
21
|
+
constructor (settings: PublishedBotStrategySettings)
|
|
22
|
+
constructor (settings: StrategySettings) {
|
|
18
23
|
const { schema, host } = settings
|
|
19
24
|
|
|
20
25
|
this.baseURL = new URL(
|
|
@@ -6,3 +6,18 @@
|
|
|
6
6
|
export interface Strategy {
|
|
7
7
|
getConversationUrl(conversationId?: string): string;
|
|
8
8
|
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Settings required to configure the Strategy.
|
|
12
|
+
*/
|
|
13
|
+
export interface StrategySettings {
|
|
14
|
+
/**
|
|
15
|
+
* The host URL of the Copilot Studio service.
|
|
16
|
+
*/
|
|
17
|
+
readonly host: URL;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The schema identifier for the agent.
|
|
21
|
+
*/
|
|
22
|
+
readonly schema: string;
|
|
23
|
+
}
|