@microsoft/agents-copilotstudio-client 0.6.16-gc874f0c9d8 → 0.6.21-g3c2261b2fc
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 +58 -0
- package/dist/src/agentType.d.ts +2 -2
- package/dist/src/agentType.js +2 -2
- package/dist/src/agentType.js.map +1 -1
- package/dist/src/browser.mjs +8 -8
- package/dist/src/browser.mjs.map +3 -3
- package/dist/src/connectionSettings.d.ts +25 -6
- package/dist/src/connectionSettings.js +35 -11
- package/dist/src/connectionSettings.js.map +1 -1
- package/dist/src/powerPlatformCloud.d.ts +17 -17
- package/dist/src/powerPlatformCloud.js +17 -17
- package/dist/src/powerPlatformCloud.js.map +1 -1
- package/dist/src/powerPlatformEnvironment.js +12 -35
- package/dist/src/powerPlatformEnvironment.js.map +1 -1
- package/package.json +5 -3
- package/src/agentType.ts +2 -2
- package/src/connectionSettings.ts +57 -15
- package/src/powerPlatformCloud.ts +17 -17
- package/src/powerPlatformEnvironment.ts +9 -38
|
@@ -6,30 +6,49 @@ import { AgentType } from './agentType';
|
|
|
6
6
|
import { CopilotStudioConnectionSettings } from './copilotStudioConnectionSettings';
|
|
7
7
|
import { PowerPlatformCloud } from './powerPlatformCloud';
|
|
8
8
|
/**
|
|
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
12
|
/** The client ID of the application. */
|
|
13
13
|
appClientId: string;
|
|
14
14
|
/** The tenant ID of the application. */
|
|
15
15
|
tenantId: string;
|
|
16
16
|
/** The environment ID of the application. */
|
|
17
17
|
environmentId: string;
|
|
18
|
+
/** The identifier of the agent. */
|
|
19
|
+
agentIdentifier: string;
|
|
18
20
|
/** The cloud environment of the application. */
|
|
19
|
-
cloud?: PowerPlatformCloud;
|
|
21
|
+
cloud?: PowerPlatformCloud | keyof typeof PowerPlatformCloud;
|
|
20
22
|
/** The custom Power Platform cloud URL, if any. */
|
|
21
23
|
customPowerPlatformCloud?: string;
|
|
22
|
-
/** The identifier of the agent. */
|
|
23
|
-
agentIdentifier?: string;
|
|
24
24
|
/** The type of the Copilot agent. */
|
|
25
|
-
copilotAgentType?: AgentType;
|
|
25
|
+
copilotAgentType?: AgentType | keyof typeof AgentType;
|
|
26
26
|
/** The URL to connect directly to Copilot Studio endpoint */
|
|
27
27
|
directConnectUrl?: string;
|
|
28
28
|
/** Flag to use the experimental endpoint if available */
|
|
29
29
|
useExperimentalEndpoint?: boolean;
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Represents the settings required to establish a connection to Copilot Studio.
|
|
33
|
+
*/
|
|
34
|
+
export declare class ConnectionSettings extends ConnectionOptions {
|
|
35
|
+
/** The cloud environment of the application. */
|
|
36
|
+
cloud?: PowerPlatformCloud;
|
|
37
|
+
/** The type of the Copilot agent. */
|
|
38
|
+
copilotAgentType?: AgentType;
|
|
39
|
+
/**
|
|
40
|
+
* Default constructor for the ConnectionSettings class.
|
|
41
|
+
*/
|
|
42
|
+
constructor();
|
|
43
|
+
/**
|
|
44
|
+
* Creates an instance of ConnectionSettings.
|
|
45
|
+
* @param options Represents the settings required to establish a direct connection to the engine.
|
|
46
|
+
*/
|
|
47
|
+
constructor(options: ConnectionOptions);
|
|
48
|
+
}
|
|
31
49
|
/**
|
|
32
50
|
* Loads the connection settings for Copilot Studio from environment variables.
|
|
33
51
|
* @returns The connection settings.
|
|
34
52
|
*/
|
|
35
53
|
export declare const loadCopilotStudioConnectionSettingsFromEnv: () => ConnectionSettings;
|
|
54
|
+
export {};
|
|
@@ -8,9 +8,9 @@ exports.loadCopilotStudioConnectionSettingsFromEnv = exports.ConnectionSettings
|
|
|
8
8
|
const agentType_1 = require("./agentType");
|
|
9
9
|
const powerPlatformCloud_1 = require("./powerPlatformCloud");
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Configuration options for establishing a connection to Copilot Studio.
|
|
12
12
|
*/
|
|
13
|
-
class
|
|
13
|
+
class ConnectionOptions {
|
|
14
14
|
constructor() {
|
|
15
15
|
/** The client ID of the application. */
|
|
16
16
|
this.appClientId = '';
|
|
@@ -18,30 +18,54 @@ class ConnectionSettings {
|
|
|
18
18
|
this.tenantId = '';
|
|
19
19
|
/** The environment ID of the application. */
|
|
20
20
|
this.environmentId = '';
|
|
21
|
+
/** The identifier of the agent. */
|
|
22
|
+
this.agentIdentifier = '';
|
|
21
23
|
/** Flag to use the experimental endpoint if available */
|
|
22
24
|
this.useExperimentalEndpoint = false;
|
|
23
25
|
}
|
|
24
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Represents the settings required to establish a connection to Copilot Studio.
|
|
29
|
+
*/
|
|
30
|
+
class ConnectionSettings extends ConnectionOptions {
|
|
31
|
+
/**
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
constructor(options) {
|
|
35
|
+
var _a, _b;
|
|
36
|
+
super();
|
|
37
|
+
if (!options) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const cloud = (_a = options.cloud) !== null && _a !== void 0 ? _a : powerPlatformCloud_1.PowerPlatformCloud.Prod;
|
|
41
|
+
const copilotAgentType = (_b = options.copilotAgentType) !== null && _b !== void 0 ? _b : agentType_1.AgentType.Published;
|
|
42
|
+
if (!Object.values(powerPlatformCloud_1.PowerPlatformCloud).includes(cloud)) {
|
|
43
|
+
throw new Error(`Invalid PowerPlatformCloud: '${cloud}'. Supported values: ${Object.values(powerPlatformCloud_1.PowerPlatformCloud).join(', ')}`);
|
|
44
|
+
}
|
|
45
|
+
if (!Object.values(agentType_1.AgentType).includes(copilotAgentType)) {
|
|
46
|
+
throw new Error(`Invalid AgentType: '${copilotAgentType}'. Supported values: ${Object.values(agentType_1.AgentType).join(', ')}`);
|
|
47
|
+
}
|
|
48
|
+
Object.assign(this, { ...options, cloud, copilotAgentType });
|
|
49
|
+
}
|
|
50
|
+
}
|
|
25
51
|
exports.ConnectionSettings = ConnectionSettings;
|
|
26
52
|
/**
|
|
27
53
|
* Loads the connection settings for Copilot Studio from environment variables.
|
|
28
54
|
* @returns The connection settings.
|
|
29
55
|
*/
|
|
30
56
|
const loadCopilotStudioConnectionSettingsFromEnv = () => {
|
|
31
|
-
var _a, _b, _c, _d;
|
|
32
|
-
|
|
33
|
-
const agentStr = process.env.copilotAgentType;
|
|
34
|
-
return {
|
|
57
|
+
var _a, _b, _c, _d, _e;
|
|
58
|
+
return new ConnectionSettings({
|
|
35
59
|
appClientId: (_a = process.env.appClientId) !== null && _a !== void 0 ? _a : '',
|
|
36
60
|
tenantId: (_b = process.env.tenantId) !== null && _b !== void 0 ? _b : '',
|
|
37
61
|
environmentId: (_c = process.env.environmentId) !== null && _c !== void 0 ? _c : '',
|
|
38
|
-
|
|
62
|
+
agentIdentifier: (_d = process.env.agentIdentifier) !== null && _d !== void 0 ? _d : '',
|
|
63
|
+
cloud: process.env.cloud,
|
|
39
64
|
customPowerPlatformCloud: process.env.customPowerPlatformCloud,
|
|
40
|
-
|
|
41
|
-
copilotAgentType: agentStr ? agentType_1.AgentType[agentStr] : agentType_1.AgentType.Published,
|
|
65
|
+
copilotAgentType: process.env.copilotAgentType,
|
|
42
66
|
directConnectUrl: process.env.directConnectUrl,
|
|
43
|
-
useExperimentalEndpoint: ((
|
|
44
|
-
};
|
|
67
|
+
useExperimentalEndpoint: ((_e = process.env.useExperimentalEndpoint) === null || _e === void 0 ? void 0 : _e.toLowerCase()) === 'true'
|
|
68
|
+
});
|
|
45
69
|
};
|
|
46
70
|
exports.loadCopilotStudioConnectionSettingsFromEnv = loadCopilotStudioConnectionSettingsFromEnv;
|
|
47
71
|
//# sourceMappingURL=connectionSettings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connectionSettings.js","sourceRoot":"","sources":["../../src/connectionSettings.ts"],"names":[],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B,MAAM,CAAC,MAAM,CAAC,qBAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QACvH,CAAC;QAED,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,GAAG,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC,CAAA;IAC9D,CAAC;CACF;AAxCD,gDAwCC;AAED;;;GAGG;AACI,MAAM,0CAA0C,GAA6B,GAAG,EAAE;;IACvF,OAAO,IAAI,kBAAkB,CAAC;QAC5B,WAAW,EAAE,MAAA,OAAO,CAAC,GAAG,CAAC,WAAW,mCAAI,EAAE;QAC1C,QAAQ,EAAE,MAAA,OAAO,CAAC,GAAG,CAAC,QAAQ,mCAAI,EAAE;QACpC,aAAa,EAAE,MAAA,OAAO,CAAC,GAAG,CAAC,aAAa,mCAAI,EAAE;QAC9C,eAAe,EAAE,MAAA,OAAO,CAAC,GAAG,CAAC,eAAe,mCAAI,EAAE;QAClD,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;AAZY,QAAA,0CAA0C,8CAYtD"}
|
|
@@ -9,69 +9,69 @@ export declare enum PowerPlatformCloud {
|
|
|
9
9
|
/**
|
|
10
10
|
* Unknown cloud environment.
|
|
11
11
|
*/
|
|
12
|
-
Unknown =
|
|
12
|
+
Unknown = "Unknown",
|
|
13
13
|
/**
|
|
14
14
|
* Experimental cloud environment.
|
|
15
15
|
*/
|
|
16
|
-
Exp =
|
|
16
|
+
Exp = "Exp",
|
|
17
17
|
/**
|
|
18
18
|
* Development cloud environment.
|
|
19
19
|
*/
|
|
20
|
-
Dev =
|
|
20
|
+
Dev = "Dev",
|
|
21
21
|
/**
|
|
22
22
|
* Test cloud environment.
|
|
23
23
|
*/
|
|
24
|
-
Test =
|
|
24
|
+
Test = "Test",
|
|
25
25
|
/**
|
|
26
26
|
* Pre-production cloud environment.
|
|
27
27
|
*/
|
|
28
|
-
Preprod =
|
|
28
|
+
Preprod = "Preprod",
|
|
29
29
|
/**
|
|
30
30
|
* First release cloud environment.
|
|
31
31
|
*/
|
|
32
|
-
FirstRelease =
|
|
32
|
+
FirstRelease = "FirstRelease",
|
|
33
33
|
/**
|
|
34
34
|
* Production cloud environment.
|
|
35
35
|
*/
|
|
36
|
-
Prod =
|
|
36
|
+
Prod = "Prod",
|
|
37
37
|
/**
|
|
38
38
|
* Government cloud environment.
|
|
39
39
|
*/
|
|
40
|
-
Gov =
|
|
40
|
+
Gov = "Gov",
|
|
41
41
|
/**
|
|
42
42
|
* High security cloud environment.
|
|
43
43
|
*/
|
|
44
|
-
High =
|
|
44
|
+
High = "High",
|
|
45
45
|
/**
|
|
46
46
|
* Department of Defense cloud environment.
|
|
47
47
|
*/
|
|
48
|
-
DoD =
|
|
48
|
+
DoD = "DoD",
|
|
49
49
|
/**
|
|
50
50
|
* Mooncake cloud environment.
|
|
51
51
|
*/
|
|
52
|
-
Mooncake =
|
|
52
|
+
Mooncake = "Mooncake",
|
|
53
53
|
/**
|
|
54
54
|
* Ex cloud environment.
|
|
55
55
|
*/
|
|
56
|
-
Ex =
|
|
56
|
+
Ex = "Ex",
|
|
57
57
|
/**
|
|
58
58
|
* Rx cloud environment.
|
|
59
59
|
*/
|
|
60
|
-
Rx =
|
|
60
|
+
Rx = "Rx",
|
|
61
61
|
/**
|
|
62
62
|
* Private cloud environment.
|
|
63
63
|
*/
|
|
64
|
-
Prv =
|
|
64
|
+
Prv = "Prv",
|
|
65
65
|
/**
|
|
66
66
|
* Local cloud environment.
|
|
67
67
|
*/
|
|
68
|
-
Local =
|
|
68
|
+
Local = "Local",
|
|
69
69
|
/**
|
|
70
70
|
* French government cloud environment.
|
|
71
71
|
*/
|
|
72
|
-
GovFR =
|
|
72
|
+
GovFR = "GovFR",
|
|
73
73
|
/**
|
|
74
74
|
* Other cloud environment.
|
|
75
75
|
*/
|
|
76
|
-
Other =
|
|
76
|
+
Other = "Other"
|
|
77
77
|
}
|
|
@@ -13,70 +13,70 @@ var PowerPlatformCloud;
|
|
|
13
13
|
/**
|
|
14
14
|
* Unknown cloud environment.
|
|
15
15
|
*/
|
|
16
|
-
PowerPlatformCloud[
|
|
16
|
+
PowerPlatformCloud["Unknown"] = "Unknown";
|
|
17
17
|
/**
|
|
18
18
|
* Experimental cloud environment.
|
|
19
19
|
*/
|
|
20
|
-
PowerPlatformCloud[
|
|
20
|
+
PowerPlatformCloud["Exp"] = "Exp";
|
|
21
21
|
/**
|
|
22
22
|
* Development cloud environment.
|
|
23
23
|
*/
|
|
24
|
-
PowerPlatformCloud[
|
|
24
|
+
PowerPlatformCloud["Dev"] = "Dev";
|
|
25
25
|
/**
|
|
26
26
|
* Test cloud environment.
|
|
27
27
|
*/
|
|
28
|
-
PowerPlatformCloud[
|
|
28
|
+
PowerPlatformCloud["Test"] = "Test";
|
|
29
29
|
/**
|
|
30
30
|
* Pre-production cloud environment.
|
|
31
31
|
*/
|
|
32
|
-
PowerPlatformCloud[
|
|
32
|
+
PowerPlatformCloud["Preprod"] = "Preprod";
|
|
33
33
|
/**
|
|
34
34
|
* First release cloud environment.
|
|
35
35
|
*/
|
|
36
|
-
PowerPlatformCloud[
|
|
36
|
+
PowerPlatformCloud["FirstRelease"] = "FirstRelease";
|
|
37
37
|
/**
|
|
38
38
|
* Production cloud environment.
|
|
39
39
|
*/
|
|
40
|
-
PowerPlatformCloud[
|
|
40
|
+
PowerPlatformCloud["Prod"] = "Prod";
|
|
41
41
|
/**
|
|
42
42
|
* Government cloud environment.
|
|
43
43
|
*/
|
|
44
|
-
PowerPlatformCloud[
|
|
44
|
+
PowerPlatformCloud["Gov"] = "Gov";
|
|
45
45
|
/**
|
|
46
46
|
* High security cloud environment.
|
|
47
47
|
*/
|
|
48
|
-
PowerPlatformCloud[
|
|
48
|
+
PowerPlatformCloud["High"] = "High";
|
|
49
49
|
/**
|
|
50
50
|
* Department of Defense cloud environment.
|
|
51
51
|
*/
|
|
52
|
-
PowerPlatformCloud[
|
|
52
|
+
PowerPlatformCloud["DoD"] = "DoD";
|
|
53
53
|
/**
|
|
54
54
|
* Mooncake cloud environment.
|
|
55
55
|
*/
|
|
56
|
-
PowerPlatformCloud[
|
|
56
|
+
PowerPlatformCloud["Mooncake"] = "Mooncake";
|
|
57
57
|
/**
|
|
58
58
|
* Ex cloud environment.
|
|
59
59
|
*/
|
|
60
|
-
PowerPlatformCloud[
|
|
60
|
+
PowerPlatformCloud["Ex"] = "Ex";
|
|
61
61
|
/**
|
|
62
62
|
* Rx cloud environment.
|
|
63
63
|
*/
|
|
64
|
-
PowerPlatformCloud[
|
|
64
|
+
PowerPlatformCloud["Rx"] = "Rx";
|
|
65
65
|
/**
|
|
66
66
|
* Private cloud environment.
|
|
67
67
|
*/
|
|
68
|
-
PowerPlatformCloud[
|
|
68
|
+
PowerPlatformCloud["Prv"] = "Prv";
|
|
69
69
|
/**
|
|
70
70
|
* Local cloud environment.
|
|
71
71
|
*/
|
|
72
|
-
PowerPlatformCloud[
|
|
72
|
+
PowerPlatformCloud["Local"] = "Local";
|
|
73
73
|
/**
|
|
74
74
|
* French government cloud environment.
|
|
75
75
|
*/
|
|
76
|
-
PowerPlatformCloud[
|
|
76
|
+
PowerPlatformCloud["GovFR"] = "GovFR";
|
|
77
77
|
/**
|
|
78
78
|
* Other cloud environment.
|
|
79
79
|
*/
|
|
80
|
-
PowerPlatformCloud[
|
|
80
|
+
PowerPlatformCloud["Other"] = "Other";
|
|
81
81
|
})(PowerPlatformCloud || (exports.PowerPlatformCloud = PowerPlatformCloud = {}));
|
|
82
82
|
//# sourceMappingURL=powerPlatformCloud.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"powerPlatformCloud.js","sourceRoot":"","sources":["../../src/powerPlatformCloud.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;GAEG;AACH,IAAY,kBAqEX;AArED,WAAY,kBAAkB;IAC5B;;OAEG;IACH,
|
|
1
|
+
{"version":3,"file":"powerPlatformCloud.js","sourceRoot":"","sources":["../../src/powerPlatformCloud.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;GAEG;AACH,IAAY,kBAqEX;AArED,WAAY,kBAAkB;IAC5B;;OAEG;IACH,yCAAmB,CAAA;IACnB;;OAEG;IACH,iCAAW,CAAA;IACX;;OAEG;IACH,iCAAW,CAAA;IACX;;OAEG;IACH,mCAAa,CAAA;IACb;;OAEG;IACH,yCAAmB,CAAA;IACnB;;OAEG;IACH,mDAA6B,CAAA;IAC7B;;OAEG;IACH,mCAAa,CAAA;IACb;;OAEG;IACH,iCAAW,CAAA;IACX;;OAEG;IACH,mCAAa,CAAA;IACb;;OAEG;IACH,iCAAW,CAAA;IACX;;OAEG;IACH,2CAAqB,CAAA;IACrB;;OAEG;IACH,+BAAS,CAAA;IACT;;OAEG;IACH,+BAAS,CAAA;IACT;;OAEG;IACH,iCAAW,CAAA;IACX;;OAEG;IACH,qCAAe,CAAA;IACf;;OAEG;IACH,qCAAe,CAAA;IACf;;OAEG;IACH,qCAAe,CAAA;AACjB,CAAC,EArEW,kBAAkB,kCAAlB,kBAAkB,QAqE7B"}
|
|
@@ -20,8 +20,7 @@ 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;
|
|
24
|
-
let cloudValue = powerPlatformCloud_1.PowerPlatformCloud.Prod;
|
|
23
|
+
var _a, _b, _c, _d, _e, _f;
|
|
25
24
|
if ((_a = settings.directConnectUrl) === null || _a === void 0 ? void 0 : _a.trim()) {
|
|
26
25
|
logger.debug(`Using direct connection: ${settings.directConnectUrl}`);
|
|
27
26
|
if (!isValidUri(settings.directConnectUrl)) {
|
|
@@ -35,50 +34,28 @@ function getCopilotStudioConnectionUrl(settings, conversationId) {
|
|
|
35
34
|
}
|
|
36
35
|
return createURL(settings.directConnectUrl, conversationId).href;
|
|
37
36
|
}
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const cloudSetting = isNotEmptyCloud ? settings.cloud : powerPlatformCloud_1.PowerPlatformCloud.Unknown;
|
|
44
|
-
if (cloudSetting === powerPlatformCloud_1.PowerPlatformCloud.Other && isNotEmptyCustomPowerPlatformCloud) {
|
|
45
|
-
throw new Error('customPowerPlatformCloud must be provided when PowerPlatformCloud is Other');
|
|
46
|
-
}
|
|
47
|
-
if (!((_b = settings.environmentId) === null || _b === void 0 ? void 0 : _b.trim())) {
|
|
37
|
+
const cloudSetting = (_b = settings.cloud) !== null && _b !== void 0 ? _b : powerPlatformCloud_1.PowerPlatformCloud.Prod;
|
|
38
|
+
const agentType = (_c = settings.copilotAgentType) !== null && _c !== void 0 ? _c : agentType_1.AgentType.Published;
|
|
39
|
+
logger.debug(`Using cloud setting: ${cloudSetting}`);
|
|
40
|
+
logger.debug(`Using agent type: ${agentType}`);
|
|
41
|
+
if (!((_d = settings.environmentId) === null || _d === void 0 ? void 0 : _d.trim())) {
|
|
48
42
|
throw new Error('EnvironmentId must be provided');
|
|
49
43
|
}
|
|
50
|
-
if (settings.agentIdentifier ===
|
|
44
|
+
if (!((_e = settings.agentIdentifier) === null || _e === void 0 ? void 0 : _e.trim())) {
|
|
51
45
|
throw new Error('AgentIdentifier must be provided');
|
|
52
46
|
}
|
|
53
|
-
if (cloudSetting !== powerPlatformCloud_1.PowerPlatformCloud.Unknown) {
|
|
54
|
-
logger.debug(`Using specified cloud setting: ${cloudSetting}`);
|
|
55
|
-
cloudValue = cloudSetting;
|
|
56
|
-
}
|
|
57
47
|
if (cloudSetting === powerPlatformCloud_1.PowerPlatformCloud.Other) {
|
|
58
|
-
if (
|
|
48
|
+
if (!((_f = settings.customPowerPlatformCloud) === null || _f === void 0 ? void 0 : _f.trim())) {
|
|
49
|
+
throw new Error('customPowerPlatformCloud must be provided when PowerPlatformCloud is Other');
|
|
50
|
+
}
|
|
51
|
+
else if (isValidUri(settings.customPowerPlatformCloud)) {
|
|
59
52
|
logger.debug(`Using custom Power Platform cloud: ${settings.customPowerPlatformCloud}`);
|
|
60
|
-
cloudValue = powerPlatformCloud_1.PowerPlatformCloud.Other;
|
|
61
53
|
}
|
|
62
54
|
else {
|
|
63
55
|
throw new Error('customPowerPlatformCloud must be a valid URL');
|
|
64
56
|
}
|
|
65
57
|
}
|
|
66
|
-
|
|
67
|
-
if (settings.copilotAgentType && settings.copilotAgentType.toString().trim() !== '') {
|
|
68
|
-
if (!Object.values(agentType_1.AgentType).includes(settings.copilotAgentType)) {
|
|
69
|
-
throw new Error('Invalid AgentType enum key');
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
logger.debug(`Using specified agent type: ${settings.copilotAgentType}`);
|
|
73
|
-
agentType = settings.copilotAgentType;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
logger.debug('Using default agent type: Published');
|
|
78
|
-
agentType = agentType_1.AgentType.Published;
|
|
79
|
-
}
|
|
80
|
-
settings.customPowerPlatformCloud = isNotEmptyCustomPowerPlatformCloud ? settings.customPowerPlatformCloud : 'api.unknown.powerplatform.com';
|
|
81
|
-
const host = getEnvironmentEndpoint(cloudValue, settings.environmentId, settings.customPowerPlatformCloud);
|
|
58
|
+
const host = getEnvironmentEndpoint(cloudSetting, settings.environmentId, settings.customPowerPlatformCloud);
|
|
82
59
|
const strategy = {
|
|
83
60
|
[agentType_1.AgentType.Published]: () => new publishedBotStrategy_1.PublishedBotStrategy({
|
|
84
61
|
host,
|
|
@@ -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,sEA8DC;AAWD,4CAiDC;AA1ID,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,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,EAAE,CAAC,QAAQ,CAAC,8CAA8C,CAAC,EAAE,CAAC;YACrG,MAAM,CAAC,KAAK,CAAC,qGAAqG,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CAAA;YAC9I,mFAAmF;YACnF,OAAO,6BAA6B,CAAC,EAAE,GAAG,QAAQ,EAAE,gBAAgB,EAAE,EAAE,EAAE,EAAE,cAAc,CAAC,CAAA;QAC7F,CAAC;QAED,OAAO,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC,IAAI,CAAA;IAClE,CAAC;IAED,MAAM,Y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AO,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/agents-copilotstudio-client",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.21-g3c2261b2fc",
|
|
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": "0.6.
|
|
30
|
+
"@microsoft/agents-activity": "0.6.21-g3c2261b2fc",
|
|
31
31
|
"axios": "^1.9.0",
|
|
32
32
|
"rxjs": "7.8.2",
|
|
33
33
|
"uuid": "^11.1.0"
|
|
@@ -36,10 +36,12 @@
|
|
|
36
36
|
"files": [
|
|
37
37
|
"README.md",
|
|
38
38
|
"dist/src",
|
|
39
|
-
"src"
|
|
39
|
+
"src",
|
|
40
|
+
"package.json"
|
|
40
41
|
],
|
|
41
42
|
"exports": {
|
|
42
43
|
".": {
|
|
44
|
+
"types": "./dist/src/index.d.ts",
|
|
43
45
|
"import": {
|
|
44
46
|
"browser": "./dist/src/browser.mjs",
|
|
45
47
|
"default": "./dist/src/index.js"
|
package/src/agentType.ts
CHANGED
|
@@ -8,46 +8,88 @@ import { CopilotStudioConnectionSettings } from './copilotStudioConnectionSettin
|
|
|
8
8
|
import { PowerPlatformCloud } from './powerPlatformCloud'
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Configuration options for establishing a connection to Copilot Studio.
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
abstract class ConnectionOptions implements Omit<CopilotStudioConnectionSettings, 'cloud' | 'copilotAgentType'> {
|
|
14
14
|
/** The client ID of the application. */
|
|
15
15
|
public appClientId: string = ''
|
|
16
16
|
/** The tenant ID of the application. */
|
|
17
17
|
public tenantId: string = ''
|
|
18
18
|
/** The environment ID of the application. */
|
|
19
19
|
public environmentId: string = ''
|
|
20
|
+
/** The identifier of the agent. */
|
|
21
|
+
public agentIdentifier: string = ''
|
|
20
22
|
/** The cloud environment of the application. */
|
|
21
|
-
public cloud?: PowerPlatformCloud
|
|
23
|
+
public cloud?: PowerPlatformCloud | keyof typeof PowerPlatformCloud
|
|
22
24
|
/** The custom Power Platform cloud URL, if any. */
|
|
23
25
|
public customPowerPlatformCloud?: string
|
|
24
|
-
/** The identifier of the agent. */
|
|
25
|
-
public agentIdentifier?: string
|
|
26
26
|
/** The type of the Copilot agent. */
|
|
27
|
-
public copilotAgentType?: AgentType
|
|
27
|
+
public copilotAgentType?: AgentType | keyof typeof AgentType
|
|
28
28
|
/** The URL to connect directly to Copilot Studio endpoint */
|
|
29
29
|
public directConnectUrl?: string
|
|
30
30
|
/** Flag to use the experimental endpoint if available */
|
|
31
31
|
public useExperimentalEndpoint?: boolean = false
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Represents the settings required to establish a connection to Copilot Studio.
|
|
36
|
+
*/
|
|
37
|
+
export class ConnectionSettings extends ConnectionOptions {
|
|
38
|
+
/** The cloud environment of the application. */
|
|
39
|
+
public cloud?: PowerPlatformCloud
|
|
40
|
+
/** The type of the Copilot agent. */
|
|
41
|
+
public copilotAgentType?: AgentType
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Default constructor for the ConnectionSettings class.
|
|
45
|
+
*/
|
|
46
|
+
constructor ()
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Creates an instance of ConnectionSettings.
|
|
50
|
+
* @param options Represents the settings required to establish a direct connection to the engine.
|
|
51
|
+
*/
|
|
52
|
+
constructor (options: ConnectionOptions)
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @private
|
|
56
|
+
*/
|
|
57
|
+
constructor (options?: ConnectionOptions) {
|
|
58
|
+
super()
|
|
59
|
+
|
|
60
|
+
if (!options) {
|
|
61
|
+
return
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const cloud = options.cloud ?? PowerPlatformCloud.Prod
|
|
65
|
+
const copilotAgentType = options.copilotAgentType ?? AgentType.Published
|
|
66
|
+
|
|
67
|
+
if (!Object.values(PowerPlatformCloud).includes(cloud as PowerPlatformCloud)) {
|
|
68
|
+
throw new Error(`Invalid PowerPlatformCloud: '${cloud}'. Supported values: ${Object.values(PowerPlatformCloud).join(', ')}`)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (!Object.values(AgentType).includes(copilotAgentType as AgentType)) {
|
|
72
|
+
throw new Error(`Invalid AgentType: '${copilotAgentType}'. Supported values: ${Object.values(AgentType).join(', ')}`)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
Object.assign(this, { ...options, cloud, copilotAgentType })
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
34
79
|
/**
|
|
35
80
|
* Loads the connection settings for Copilot Studio from environment variables.
|
|
36
81
|
* @returns The connection settings.
|
|
37
82
|
*/
|
|
38
83
|
export const loadCopilotStudioConnectionSettingsFromEnv: () => ConnectionSettings = () => {
|
|
39
|
-
|
|
40
|
-
const agentStr = process.env.copilotAgentType as keyof typeof AgentType | undefined
|
|
41
|
-
|
|
42
|
-
return {
|
|
84
|
+
return new ConnectionSettings({
|
|
43
85
|
appClientId: process.env.appClientId ?? '',
|
|
44
86
|
tenantId: process.env.tenantId ?? '',
|
|
45
87
|
environmentId: process.env.environmentId ?? '',
|
|
46
|
-
|
|
88
|
+
agentIdentifier: process.env.agentIdentifier ?? '',
|
|
89
|
+
cloud: process.env.cloud as PowerPlatformCloud,
|
|
47
90
|
customPowerPlatformCloud: process.env.customPowerPlatformCloud,
|
|
48
|
-
|
|
49
|
-
copilotAgentType: agentStr ? AgentType[agentStr] : AgentType.Published,
|
|
91
|
+
copilotAgentType: process.env.copilotAgentType as AgentType,
|
|
50
92
|
directConnectUrl: process.env.directConnectUrl,
|
|
51
|
-
useExperimentalEndpoint: process.env.useExperimentalEndpoint?.
|
|
52
|
-
}
|
|
93
|
+
useExperimentalEndpoint: process.env.useExperimentalEndpoint?.toLowerCase() === 'true'
|
|
94
|
+
})
|
|
53
95
|
}
|