@microsoft/agents-copilotstudio-client 0.1.25-gcaee57b821

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.
Files changed (34) hide show
  1. package/README.md +48 -0
  2. package/dist/src/botType.d.ts +17 -0
  3. package/dist/src/botType.js +22 -0
  4. package/dist/src/botType.js.map +1 -0
  5. package/dist/src/connectionSettings.d.ts +28 -0
  6. package/dist/src/connectionSettings.js +41 -0
  7. package/dist/src/connectionSettings.js.map +1 -0
  8. package/dist/src/copilotStudioClient.d.ts +25 -0
  9. package/dist/src/copilotStudioClient.js +120 -0
  10. package/dist/src/copilotStudioClient.js.map +1 -0
  11. package/dist/src/directToEngineConnectionSettings.d.ts +21 -0
  12. package/dist/src/directToEngineConnectionSettings.js +7 -0
  13. package/dist/src/directToEngineConnectionSettings.js.map +1 -0
  14. package/dist/src/executeTurnRequest.d.ts +14 -0
  15. package/dist/src/executeTurnRequest.js +18 -0
  16. package/dist/src/executeTurnRequest.js.map +1 -0
  17. package/dist/src/index.d.ts +7 -0
  18. package/dist/src/index.js +24 -0
  19. package/dist/src/index.js.map +1 -0
  20. package/dist/src/powerPlatformCloud.d.ts +77 -0
  21. package/dist/src/powerPlatformCloud.js +82 -0
  22. package/dist/src/powerPlatformCloud.js.map +1 -0
  23. package/dist/src/powerPlatformEnvironment.d.ts +13 -0
  24. package/dist/src/powerPlatformEnvironment.js +140 -0
  25. package/dist/src/powerPlatformEnvironment.js.map +1 -0
  26. package/package.json +43 -0
  27. package/src/botType.ts +18 -0
  28. package/src/connectionSettings.ts +40 -0
  29. package/src/copilotStudioClient.ts +134 -0
  30. package/src/directToEngineConnectionSettings.ts +23 -0
  31. package/src/executeTurnRequest.ts +19 -0
  32. package/src/index.ts +7 -0
  33. package/src/powerPlatformCloud.ts +78 -0
  34. package/src/powerPlatformEnvironment.ts +175 -0
package/README.md ADDED
@@ -0,0 +1,48 @@
1
+ # @microsoft/agents-copilotstudio-client
2
+
3
+ ## Overview
4
+
5
+ The `@microsoft/agents-copilotstudio-client` package allows you to interact with Copilot Studio Agents using the Direct Engine Protocol. This client library is designed to facilitate communication with agents, enabling seamless integration and interaction within your JavaScript or TypeScript applications.
6
+
7
+ > Note: The Client needs to be initialized with a valid JWT Token.
8
+
9
+ ## Installation
10
+
11
+ To install the package, use npm or yarn:
12
+
13
+ ```sh
14
+ npm install @microsoft/agents-copilotstudio-client
15
+ ```
16
+
17
+ ## Pre-requisites
18
+
19
+ Create and deploy an agent in Copilot Studio, see [this guide](https://learn.microsoft.com/en-us/microsoft-copilot-studio/fundamentals-get-started?tabs=web) for a quick start
20
+
21
+ Obtain the Agent configuration values from `<YourAgent>/Settings/Advanced/Metadata`, you will need:
22
+
23
+ - Environment ID
24
+ - Tenant ID
25
+ - Agent app ID
26
+ - Schema name
27
+
28
+ Create an Entra ID app registration with permissions in the PowerPlatform API: `CopilotStudio.Copilots.Invoke`
29
+
30
+ > Note: If you do not see `Power Platform API` in the list of API's your organization uses, you need to add the Power Platform API to your tenant. To do that, goto [Power Platform API Authentication](https://learn.microsoft.com/power-platform/admin/programmability-authentication-v2#step-2-configure-api-permissions) and follow the instructions on Step 2 to add the Power Platform Admin API to your Tenant
31
+
32
+ ## Usage
33
+
34
+ The client requires the `connectionSettings` and a the `jwt token` to authenticate in the service.
35
+
36
+ ```ts
37
+ const createClient = async (): Promise<CopilotStudioClient> => {
38
+ const settings = loadCopilotStudioConnectionSettingsFromEnv()
39
+ const token = await acquireToken(settings)
40
+ const copilotClient = new CopilotStudioClient(settings, token)
41
+ return copilotClient
42
+ }
43
+ const copilotClient = await createClient()
44
+ const replies = await copilotClient.startConversationAsync(true)
45
+ replies.forEach(r => console.log(r.text))
46
+ ```
47
+
48
+
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ /**
6
+ * Enum representing the type of bot.
7
+ */
8
+ export declare enum BotType {
9
+ /**
10
+ * Represents a published bot.
11
+ */
12
+ Published = 0,
13
+ /**
14
+ * Represents a prebuilt bot.
15
+ */
16
+ Prebuilt = 1
17
+ }
@@ -0,0 +1,22 @@
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.BotType = void 0;
8
+ /**
9
+ * Enum representing the type of bot.
10
+ */
11
+ var BotType;
12
+ (function (BotType) {
13
+ /**
14
+ * Represents a published bot.
15
+ */
16
+ BotType[BotType["Published"] = 0] = "Published";
17
+ /**
18
+ * Represents a prebuilt bot.
19
+ */
20
+ BotType[BotType["Prebuilt"] = 1] = "Prebuilt";
21
+ })(BotType || (exports.BotType = BotType = {}));
22
+ //# sourceMappingURL=botType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"botType.js","sourceRoot":"","sources":["../../src/botType.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;GAEG;AACH,IAAY,OASX;AATD,WAAY,OAAO;IACjB;;OAEG;IACH,+CAAa,CAAA;IACb;;OAEG;IACH,6CAAY,CAAA;AACd,CAAC,EATW,OAAO,uBAAP,OAAO,QASlB"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ /**
6
+ * Represents the settings required to establish a connection to Copilot Studio.
7
+ */
8
+ export declare class ConnectionSettings {
9
+ /** The client ID of the application. */
10
+ appClientId: string;
11
+ /** The tenant ID of the application. */
12
+ tenantId: string;
13
+ /** The environment ID of the application. */
14
+ environmentId: string;
15
+ /** The cloud environment of the application. */
16
+ cloud: string;
17
+ /** The custom Power Platform cloud URL, if any. */
18
+ customPowerPlatformCloud?: string;
19
+ /** The identifier of the bot. */
20
+ botIdentifier?: string;
21
+ /** The type of the Copilot bot. */
22
+ copilotBotType?: string;
23
+ }
24
+ /**
25
+ * Loads the connection settings for Copilot Studio from environment variables.
26
+ * @returns The connection settings.
27
+ */
28
+ export declare const loadCopilotStudioConnectionSettingsFromEnv: () => ConnectionSettings;
@@ -0,0 +1,41 @@
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.loadCopilotStudioConnectionSettingsFromEnv = exports.ConnectionSettings = void 0;
8
+ /**
9
+ * Represents the settings required to establish a connection to Copilot Studio.
10
+ */
11
+ class ConnectionSettings {
12
+ constructor() {
13
+ /** The client ID of the application. */
14
+ this.appClientId = '';
15
+ /** The tenant ID of the application. */
16
+ this.tenantId = '';
17
+ /** The environment ID of the application. */
18
+ this.environmentId = '';
19
+ /** The cloud environment of the application. */
20
+ this.cloud = '';
21
+ }
22
+ }
23
+ exports.ConnectionSettings = ConnectionSettings;
24
+ /**
25
+ * Loads the connection settings for Copilot Studio from environment variables.
26
+ * @returns The connection settings.
27
+ */
28
+ const loadCopilotStudioConnectionSettingsFromEnv = () => {
29
+ var _a, _b, _c;
30
+ return {
31
+ appClientId: (_a = process.env.appClientId) !== null && _a !== void 0 ? _a : '',
32
+ tenantId: (_b = process.env.tenantId) !== null && _b !== void 0 ? _b : '',
33
+ environmentId: (_c = process.env.environmentId) !== null && _c !== void 0 ? _c : '',
34
+ cloud: process.env.cloud,
35
+ customPowerPlatformCloud: process.env.customPowerPlatformCloud,
36
+ botIdentifier: process.env.botIdentifier,
37
+ copilotBotType: process.env.copilotBotType
38
+ };
39
+ };
40
+ exports.loadCopilotStudioConnectionSettingsFromEnv = loadCopilotStudioConnectionSettingsFromEnv;
41
+ //# sourceMappingURL=connectionSettings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connectionSettings.js","sourceRoot":"","sources":["../../src/connectionSettings.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;GAEG;AACH,MAAa,kBAAkB;IAA/B;QACE,wCAAwC;QACjC,gBAAW,GAAW,EAAE,CAAA;QAC/B,wCAAwC;QACjC,aAAQ,GAAW,EAAE,CAAA;QAC5B,6CAA6C;QACtC,kBAAa,GAAW,EAAE,CAAA;QACjC,gDAAgD;QACzC,UAAK,GAAW,EAAE,CAAA;IAO3B,CAAC;CAAA;AAfD,gDAeC;AAED;;;GAGG;AACI,MAAM,0CAA0C,GAA6B,GAAG,EAAE;;IACvF,OAAO;QACL,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,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK;QACxB,wBAAwB,EAAE,OAAO,CAAC,GAAG,CAAC,wBAAwB;QAC9D,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa;QACxC,cAAc,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc;KACrB,CAAA;AACzB,CAAC,CAAA;AAVY,QAAA,0CAA0C,8CAUtD"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { ConnectionSettings } from './connectionSettings';
6
+ import { Activity } from '@microsoft/agents-bot-activity';
7
+ export declare class CopilotStudioClient {
8
+ /** The ID of the current conversation. */
9
+ private conversationId;
10
+ /** The connection settings for the client. */
11
+ private readonly settings;
12
+ /** The Axios instance used for HTTP requests. */
13
+ private readonly client;
14
+ /** The logger for debugging. */
15
+ private readonly logger;
16
+ /**
17
+ * Creates an instance of CopilotStudioClient.
18
+ * @param settings The connection settings.
19
+ * @param token The authentication token.
20
+ */
21
+ constructor(settings: ConnectionSettings, token: string);
22
+ private postRequestAsync;
23
+ startConversationAsync(emitStartConversationEvent?: boolean): Promise<Activity>;
24
+ askQuestionAsync(question: string, conversationId?: string): Promise<Activity[]>;
25
+ }
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) Microsoft Corporation. All rights reserved.
4
+ * Licensed under the MIT License.
5
+ */
6
+ var __importDefault = (this && this.__importDefault) || function (mod) {
7
+ return (mod && mod.__esModule) ? mod : { "default": mod };
8
+ };
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.CopilotStudioClient = void 0;
11
+ const axios_1 = __importDefault(require("axios"));
12
+ const powerPlatformEnvironment_1 = require("./powerPlatformEnvironment");
13
+ const agents_bot_activity_1 = require("@microsoft/agents-bot-activity");
14
+ const executeTurnRequest_1 = require("./executeTurnRequest");
15
+ const debug_1 = __importDefault(require("debug"));
16
+ class CopilotStudioClient {
17
+ /**
18
+ * Creates an instance of CopilotStudioClient.
19
+ * @param settings The connection settings.
20
+ * @param token The authentication token.
21
+ */
22
+ constructor(settings, token) {
23
+ /** The ID of the current conversation. */
24
+ this.conversationId = '';
25
+ this.settings = settings;
26
+ this.client = axios_1.default.create();
27
+ this.client.defaults.headers.common.Authorization = `Bearer ${token}`;
28
+ this.logger = (0, debug_1.default)('copilot-studio-client');
29
+ }
30
+ async postRequestAsync(axiosConfig) {
31
+ const activities = [];
32
+ const response = await this.client(axiosConfig);
33
+ const stream = response.data;
34
+ const reader = stream.pipeThrough(new TextDecoderStream()).getReader();
35
+ let result = '';
36
+ const results = [];
37
+ const processEvents = async ({ done, value }) => {
38
+ if (done) {
39
+ this.logger('Stream complete');
40
+ result += value;
41
+ results.push(result);
42
+ return results;
43
+ }
44
+ this.logger('Bot is typing...');
45
+ result += value;
46
+ return await processEvents(await reader.read());
47
+ };
48
+ const events = await reader.read().then(processEvents);
49
+ events.forEach(event => {
50
+ const values = event.toString().split('\n');
51
+ const validEvents = values.filter(e => e.substring(0, 4) === 'data' && e !== 'data: end\r');
52
+ validEvents.forEach(ve => {
53
+ try {
54
+ const act = agents_bot_activity_1.Activity.fromJson(ve.substring(5, ve.length));
55
+ if (act.type === agents_bot_activity_1.ActivityTypes.Message) {
56
+ activities.push(act);
57
+ }
58
+ else {
59
+ this.logger('Activity type: ', act.type);
60
+ }
61
+ }
62
+ catch (e) {
63
+ this.logger('Error: ', e);
64
+ throw e;
65
+ }
66
+ });
67
+ });
68
+ return activities;
69
+ }
70
+ async startConversationAsync(emitStartConversationEvent = true) {
71
+ var _a;
72
+ const uriStart = (0, powerPlatformEnvironment_1.getCopilotStudioConnectionUrl)(this.settings);
73
+ const body = { emitStartConversationEvent };
74
+ const config = {
75
+ method: 'post',
76
+ url: uriStart,
77
+ headers: {
78
+ Accept: 'text/event-stream',
79
+ 'Content-Type': 'application/json'
80
+ },
81
+ data: body,
82
+ responseType: 'stream',
83
+ adapter: 'fetch'
84
+ };
85
+ const values = await this.postRequestAsync(config);
86
+ const act = values[0];
87
+ this.conversationId = (_a = act.conversation) === null || _a === void 0 ? void 0 : _a.id;
88
+ return act;
89
+ }
90
+ async askQuestionAsync(question, conversationId = this.conversationId) {
91
+ var _a, _b;
92
+ const conversationAccount = {
93
+ id: conversationId
94
+ };
95
+ const activityObj = {
96
+ type: 'message',
97
+ text: question,
98
+ conversation: conversationAccount
99
+ };
100
+ const activity = agents_bot_activity_1.Activity.fromObject(activityObj);
101
+ const localConversationId = (_b = (_a = activity.conversation) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : conversationId;
102
+ const uriExecute = (0, powerPlatformEnvironment_1.getCopilotStudioConnectionUrl)(this.settings, localConversationId);
103
+ const qbody = new executeTurnRequest_1.ExecuteTurnRequest(activity);
104
+ const config = {
105
+ method: 'post',
106
+ url: uriExecute,
107
+ headers: {
108
+ Accept: 'text/event-stream',
109
+ 'Content-Type': 'application/json'
110
+ },
111
+ data: qbody,
112
+ responseType: 'stream',
113
+ adapter: 'fetch'
114
+ };
115
+ const values = await this.postRequestAsync(config);
116
+ return values;
117
+ }
118
+ }
119
+ exports.CopilotStudioClient = CopilotStudioClient;
120
+ //# sourceMappingURL=copilotStudioClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copilotStudioClient.js","sourceRoot":"","sources":["../../src/copilotStudioClient.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAGH,kDAAgE;AAChE,yEAA0E;AAC1E,wEAA6F;AAC7F,6DAAyD;AACzD,kDAA6C;AAO7C,MAAa,mBAAmB;IAU9B;;;;OAIG;IACH,YAAa,QAA4B,EAAE,KAAa;QAdxD,0CAA0C;QAClC,mBAAc,GAAW,EAAE,CAAA;QAcjC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,MAAM,GAAG,eAAK,CAAC,MAAM,EAAE,CAAA;QAC5B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,GAAG,UAAU,KAAK,EAAE,CAAA;QACrE,IAAI,CAAC,MAAM,GAAG,IAAA,eAAW,EAAC,uBAAuB,CAAC,CAAA;IACpD,CAAC;IAEO,KAAK,CAAC,gBAAgB,CAAE,WAA+B;QAC7D,MAAM,UAAU,GAAe,EAAE,CAAA;QACjC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAA;QAC/C,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAA;QAC5B,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,iBAAiB,EAAE,CAAC,CAAC,SAAS,EAAE,CAAA;QACtE,IAAI,MAAM,GAAW,EAAE,CAAA;QACvB,MAAM,OAAO,GAAa,EAAE,CAAA;QAE5B,MAAM,aAAa,GAAG,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,EAAc,EAAqB,EAAE;YAC7E,IAAI,IAAI,EAAE,CAAC;gBACT,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAA;gBAC9B,MAAM,IAAI,KAAK,CAAA;gBACf,OAAO,CAAC,IAAI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AAC,QAAQ,CAAC,CAAA;QAElE,MAAM,MAAM,GAAuB;YACjC,MAAM,EAAE,MAAM;YACd,GAAG,EAAE,UAAU;YACf,OAAO,EAAE;gBACP,MAAM,EAAE,mBAAmB;gBAC3B,cAAc,EAAE,kBAAkB;aACnC;YACD,IAAI,EAAE,KAAK;YACX,YAAY,EAAE,QAAQ;YACtB,OAAO,EAAE,OAAO;SACjB,CAAA;QACD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAA;QAClD,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AApHD,kDAoHC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { BotType } from './botType';
6
+ import { PowerPlatformCloud } from './powerPlatformCloud';
7
+ /**
8
+ * Represents the settings required to establish a direct connection to the engine.
9
+ */
10
+ export interface DirectToEngineConnectionSettings {
11
+ /** The identifier of the bot. */
12
+ botIdentifier: string;
13
+ /** The custom Power Platform cloud URL. */
14
+ customPowerPlatformCloud: string;
15
+ /** The environment ID of the application. */
16
+ environmentId: string;
17
+ /** The cloud environment of the application. */
18
+ cloud: PowerPlatformCloud;
19
+ /** The type of the Copilot bot. */
20
+ copilotBotType: BotType;
21
+ }
@@ -0,0 +1,7 @@
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
+ //# sourceMappingURL=directToEngineConnectionSettings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directToEngineConnectionSettings.js","sourceRoot":"","sources":["../../src/directToEngineConnectionSettings.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { Activity } from '@microsoft/agents-bot-activity';
6
+ export declare class ExecuteTurnRequest {
7
+ /** The activity to be executed. */
8
+ activity?: Activity;
9
+ /**
10
+ * Creates an instance of ExecuteTurnRequest.
11
+ * @param activity The activity to be executed.
12
+ */
13
+ constructor(activity?: Activity);
14
+ }
@@ -0,0 +1,18 @@
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.ExecuteTurnRequest = void 0;
8
+ class ExecuteTurnRequest {
9
+ /**
10
+ * Creates an instance of ExecuteTurnRequest.
11
+ * @param activity The activity to be executed.
12
+ */
13
+ constructor(activity) {
14
+ this.activity = activity;
15
+ }
16
+ }
17
+ exports.ExecuteTurnRequest = ExecuteTurnRequest;
18
+ //# sourceMappingURL=executeTurnRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executeTurnRequest.js","sourceRoot":"","sources":["../../src/executeTurnRequest.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,MAAa,kBAAkB;IAI7B;;;OAGG;IACH,YAAa,QAAmB;QAC9B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;CACF;AAXD,gDAWC"}
@@ -0,0 +1,7 @@
1
+ export * from './botType';
2
+ export * from './connectionSettings';
3
+ export * from './copilotStudioClient';
4
+ export * from './directToEngineConnectionSettings';
5
+ export * from './executeTurnRequest';
6
+ export * from './powerPlatformCloud';
7
+ export * from './powerPlatformEnvironment';
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./botType"), exports);
18
+ __exportStar(require("./connectionSettings"), exports);
19
+ __exportStar(require("./copilotStudioClient"), exports);
20
+ __exportStar(require("./directToEngineConnectionSettings"), exports);
21
+ __exportStar(require("./executeTurnRequest"), exports);
22
+ __exportStar(require("./powerPlatformCloud"), exports);
23
+ __exportStar(require("./powerPlatformEnvironment"), exports);
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAAyB;AACzB,uDAAoC;AACpC,wDAAqC;AACrC,qEAAkD;AAClD,uDAAoC;AACpC,uDAAoC;AACpC,6DAA0C"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ /**
6
+ * Enum representing different Power Platform cloud environments.
7
+ */
8
+ export declare enum PowerPlatformCloud {
9
+ /**
10
+ * Unknown cloud environment.
11
+ */
12
+ Unknown = -1,
13
+ /**
14
+ * Experimental cloud environment.
15
+ */
16
+ Exp = 0,
17
+ /**
18
+ * Development cloud environment.
19
+ */
20
+ Dev = 1,
21
+ /**
22
+ * Test cloud environment.
23
+ */
24
+ Test = 2,
25
+ /**
26
+ * Pre-production cloud environment.
27
+ */
28
+ Preprod = 3,
29
+ /**
30
+ * First release cloud environment.
31
+ */
32
+ FirstRelease = 4,
33
+ /**
34
+ * Production cloud environment.
35
+ */
36
+ Prod = 5,
37
+ /**
38
+ * Government cloud environment.
39
+ */
40
+ Gov = 6,
41
+ /**
42
+ * High security cloud environment.
43
+ */
44
+ High = 7,
45
+ /**
46
+ * Department of Defense cloud environment.
47
+ */
48
+ DoD = 8,
49
+ /**
50
+ * Mooncake cloud environment.
51
+ */
52
+ Mooncake = 9,
53
+ /**
54
+ * Ex cloud environment.
55
+ */
56
+ Ex = 10,
57
+ /**
58
+ * Rx cloud environment.
59
+ */
60
+ Rx = 11,
61
+ /**
62
+ * Private cloud environment.
63
+ */
64
+ Prv = 12,
65
+ /**
66
+ * Local cloud environment.
67
+ */
68
+ Local = 13,
69
+ /**
70
+ * French government cloud environment.
71
+ */
72
+ GovFR = 14,
73
+ /**
74
+ * Other cloud environment.
75
+ */
76
+ Other = 100
77
+ }
@@ -0,0 +1,82 @@
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.PowerPlatformCloud = void 0;
8
+ /**
9
+ * Enum representing different Power Platform cloud environments.
10
+ */
11
+ var PowerPlatformCloud;
12
+ (function (PowerPlatformCloud) {
13
+ /**
14
+ * Unknown cloud environment.
15
+ */
16
+ PowerPlatformCloud[PowerPlatformCloud["Unknown"] = -1] = "Unknown";
17
+ /**
18
+ * Experimental cloud environment.
19
+ */
20
+ PowerPlatformCloud[PowerPlatformCloud["Exp"] = 0] = "Exp";
21
+ /**
22
+ * Development cloud environment.
23
+ */
24
+ PowerPlatformCloud[PowerPlatformCloud["Dev"] = 1] = "Dev";
25
+ /**
26
+ * Test cloud environment.
27
+ */
28
+ PowerPlatformCloud[PowerPlatformCloud["Test"] = 2] = "Test";
29
+ /**
30
+ * Pre-production cloud environment.
31
+ */
32
+ PowerPlatformCloud[PowerPlatformCloud["Preprod"] = 3] = "Preprod";
33
+ /**
34
+ * First release cloud environment.
35
+ */
36
+ PowerPlatformCloud[PowerPlatformCloud["FirstRelease"] = 4] = "FirstRelease";
37
+ /**
38
+ * Production cloud environment.
39
+ */
40
+ PowerPlatformCloud[PowerPlatformCloud["Prod"] = 5] = "Prod";
41
+ /**
42
+ * Government cloud environment.
43
+ */
44
+ PowerPlatformCloud[PowerPlatformCloud["Gov"] = 6] = "Gov";
45
+ /**
46
+ * High security cloud environment.
47
+ */
48
+ PowerPlatformCloud[PowerPlatformCloud["High"] = 7] = "High";
49
+ /**
50
+ * Department of Defense cloud environment.
51
+ */
52
+ PowerPlatformCloud[PowerPlatformCloud["DoD"] = 8] = "DoD";
53
+ /**
54
+ * Mooncake cloud environment.
55
+ */
56
+ PowerPlatformCloud[PowerPlatformCloud["Mooncake"] = 9] = "Mooncake";
57
+ /**
58
+ * Ex cloud environment.
59
+ */
60
+ PowerPlatformCloud[PowerPlatformCloud["Ex"] = 10] = "Ex";
61
+ /**
62
+ * Rx cloud environment.
63
+ */
64
+ PowerPlatformCloud[PowerPlatformCloud["Rx"] = 11] = "Rx";
65
+ /**
66
+ * Private cloud environment.
67
+ */
68
+ PowerPlatformCloud[PowerPlatformCloud["Prv"] = 12] = "Prv";
69
+ /**
70
+ * Local cloud environment.
71
+ */
72
+ PowerPlatformCloud[PowerPlatformCloud["Local"] = 13] = "Local";
73
+ /**
74
+ * French government cloud environment.
75
+ */
76
+ PowerPlatformCloud[PowerPlatformCloud["GovFR"] = 14] = "GovFR";
77
+ /**
78
+ * Other cloud environment.
79
+ */
80
+ PowerPlatformCloud[PowerPlatformCloud["Other"] = 100] = "Other";
81
+ })(PowerPlatformCloud || (exports.PowerPlatformCloud = PowerPlatformCloud = {}));
82
+ //# sourceMappingURL=powerPlatformCloud.js.map
@@ -0,0 +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,kEAAY,CAAA;IACZ;;OAEG;IACH,yDAAO,CAAA;IACP;;OAEG;IACH,yDAAO,CAAA;IACP;;OAEG;IACH,2DAAQ,CAAA;IACR;;OAEG;IACH,iEAAW,CAAA;IACX;;OAEG;IACH,2EAAgB,CAAA;IAChB;;OAEG;IACH,2DAAQ,CAAA;IACR;;OAEG;IACH,yDAAO,CAAA;IACP;;OAEG;IACH,2DAAQ,CAAA;IACR;;OAEG;IACH,yDAAO,CAAA;IACP;;OAEG;IACH,mEAAY,CAAA;IACZ;;OAEG;IACH,wDAAO,CAAA;IACP;;OAEG;IACH,wDAAO,CAAA;IACP;;OAEG;IACH,0DAAQ,CAAA;IACR;;OAEG;IACH,8DAAU,CAAA;IACV;;OAEG;IACH,8DAAU,CAAA;IACV;;OAEG;IACH,+DAAW,CAAA;AACb,CAAC,EArEW,kBAAkB,kCAAlB,kBAAkB,QAqE7B"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { ConnectionSettings } from './connectionSettings';
6
+ /**
7
+ * Generates the connection URL for Copilot Studio.
8
+ * @param settings - The connection settings.
9
+ * @param conversationId - Optional conversation ID.
10
+ * @returns The connection URL.
11
+ * @throws Will throw an error if required settings are missing or invalid.
12
+ */
13
+ export declare function getCopilotStudioConnectionUrl(settings: ConnectionSettings, conversationId?: string): string;