@microsoft/agents-copilotstudio-client 1.4.0-beta.6.g725ba9fc33 → 1.4.1
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 +2 -0
- package/dist/src/connectionSettings.js +5 -2
- package/dist/src/connectionSettings.js.map +1 -1
- package/dist/src/copilotStudioClient.d.ts +61 -6
- package/dist/src/copilotStudioClient.js +176 -38
- package/dist/src/copilotStudioClient.js.map +1 -1
- package/dist/src/copilotStudioConnectionSettings.d.ts +6 -0
- package/dist/src/copilotStudioWebChat.d.ts +30 -0
- package/dist/src/copilotStudioWebChat.js +38 -11
- package/dist/src/copilotStudioWebChat.js.map +1 -1
- package/dist/src/executeTurnRequest.d.ts +5 -2
- package/dist/src/executeTurnRequest.js +4 -2
- package/dist/src/executeTurnRequest.js.map +1 -1
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.js +5 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/powerPlatformEnvironment.d.ts +8 -0
- package/dist/src/powerPlatformEnvironment.js +21 -6
- package/dist/src/powerPlatformEnvironment.js.map +1 -1
- package/dist/src/responses.d.ts +50 -0
- package/dist/src/responses.js +35 -0
- package/dist/src/responses.js.map +1 -0
- package/dist/src/scopeHelper.d.ts +17 -0
- package/dist/src/scopeHelper.js +24 -0
- package/dist/src/scopeHelper.js.map +1 -0
- package/dist/src/startRequest.d.ts +34 -0
- package/dist/src/startRequest.js +22 -0
- package/dist/src/startRequest.js.map +1 -0
- package/dist/src/strategies/prebuiltBotStrategy.d.ts +2 -1
- package/dist/src/strategies/publishedBotStrategy.d.ts +2 -1
- package/dist/src/subscribeEvent.d.ts +33 -0
- package/dist/src/subscribeEvent.js +7 -0
- package/dist/src/subscribeEvent.js.map +1 -0
- package/dist/src/userAgentHelper.d.ts +26 -0
- package/dist/src/userAgentHelper.js +52 -0
- package/dist/src/userAgentHelper.js.map +1 -0
- package/package.json +2 -2
- package/src/connectionSettings.ts +4 -1
- package/src/copilotStudioClient.ts +238 -32
- package/src/copilotStudioConnectionSettings.ts +7 -0
- package/src/copilotStudioWebChat.ts +75 -12
- package/src/executeTurnRequest.ts +7 -2
- package/src/index.ts +5 -0
- package/src/powerPlatformEnvironment.ts +26 -7
- package/src/responses.ts +75 -0
- package/src/scopeHelper.ts +22 -0
- package/src/startRequest.ts +48 -0
- package/src/strategies/prebuiltBotStrategy.ts +1 -1
- package/src/strategies/publishedBotStrategy.ts +1 -1
- package/src/subscribeEvent.ts +38 -0
- package/src/userAgentHelper.ts +49 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents a request to start a new conversation with a Copilot Studio agent.
|
|
8
|
+
* This request encapsulates all parameters needed to initiate a conversation.
|
|
9
|
+
*/
|
|
10
|
+
export interface StartRequest {
|
|
11
|
+
/**
|
|
12
|
+
* Optional locale code (e.g., 'en-US', 'fr-FR') for the conversation.
|
|
13
|
+
* If not specified, the agent's default locale will be used.
|
|
14
|
+
*/
|
|
15
|
+
locale?: string
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Whether to emit a start conversation event.
|
|
19
|
+
* When true, the agent will be notified that this is the beginning of a new conversation.
|
|
20
|
+
* Default is true.
|
|
21
|
+
*/
|
|
22
|
+
emitStartConversationEvent?: boolean
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Optional conversation ID to use for this conversation.
|
|
26
|
+
* If not specified, a new conversation ID will be generated by the service.
|
|
27
|
+
*/
|
|
28
|
+
conversationId?: string
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Creates a StartRequest with default values.
|
|
33
|
+
* @param emitStartConversationEvent Whether to emit a start conversation event. Defaults to true.
|
|
34
|
+
* @param locale Optional locale for the conversation.
|
|
35
|
+
* @param conversationId Optional conversation ID.
|
|
36
|
+
* @returns A new StartRequest object.
|
|
37
|
+
*/
|
|
38
|
+
export function createStartRequest (
|
|
39
|
+
emitStartConversationEvent: boolean = true,
|
|
40
|
+
locale?: string,
|
|
41
|
+
conversationId?: string
|
|
42
|
+
): StartRequest {
|
|
43
|
+
return {
|
|
44
|
+
emitStartConversationEvent,
|
|
45
|
+
locale,
|
|
46
|
+
conversationId
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import type { Strategy, StrategySettings } from './strategy'
|
|
7
7
|
|
|
8
8
|
/** @deprecated This interface will not be supported in future versions. Use StrategySettings instead. */
|
|
9
|
-
|
|
9
|
+
interface PrebuiltBotStrategySettings {
|
|
10
10
|
readonly host: URL;
|
|
11
11
|
readonly identifier: string;
|
|
12
12
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import type { Strategy, StrategySettings } from './strategy'
|
|
7
7
|
|
|
8
8
|
/** @deprecated This interface will not be supported in future versions. Use StrategySettings instead. */
|
|
9
|
-
|
|
9
|
+
interface PublishedBotStrategySettings {
|
|
10
10
|
readonly host: URL;
|
|
11
11
|
readonly schema: string;
|
|
12
12
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { Activity } from '@microsoft/agents-activity'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents an event received from a subscription to a Copilot Studio conversation.
|
|
10
|
+
*/
|
|
11
|
+
export interface SubscribeEvent {
|
|
12
|
+
/**
|
|
13
|
+
* The activity from the copilot.
|
|
14
|
+
*/
|
|
15
|
+
activity: Activity
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The SSE event ID for resumption.
|
|
19
|
+
* Can be used to resume subscription from a specific point.
|
|
20
|
+
*/
|
|
21
|
+
eventId?: string
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Represents a request to subscribe to a conversation.
|
|
26
|
+
*/
|
|
27
|
+
export interface SubscribeRequest {
|
|
28
|
+
/**
|
|
29
|
+
* The conversation ID to subscribe to.
|
|
30
|
+
*/
|
|
31
|
+
conversationId: string
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The last received event ID for resumption.
|
|
35
|
+
* If provided, subscription will resume from this point.
|
|
36
|
+
*/
|
|
37
|
+
lastReceivedEventId?: string
|
|
38
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { version } from '../package.json'
|
|
7
|
+
import os from 'os'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Utility class for generating user agent strings for Copilot Studio client requests.
|
|
11
|
+
*/
|
|
12
|
+
export class UserAgentHelper {
|
|
13
|
+
/**
|
|
14
|
+
* Generates a user agent string appropriate for the current environment.
|
|
15
|
+
* - For browser environments, includes the browser's user agent.
|
|
16
|
+
* - For Node.js environments, includes Node version, platform, architecture, and release.
|
|
17
|
+
* @returns A user agent string for HTTP headers.
|
|
18
|
+
*/
|
|
19
|
+
static getProductInfo (): string {
|
|
20
|
+
const versionString = `CopilotStudioClient.agents-sdk-js/${version}`
|
|
21
|
+
let userAgent: string
|
|
22
|
+
|
|
23
|
+
if (typeof window !== 'undefined' && window.navigator) {
|
|
24
|
+
// Browser environment
|
|
25
|
+
userAgent = `${versionString} ${navigator.userAgent}`
|
|
26
|
+
} else {
|
|
27
|
+
// Node.js environment
|
|
28
|
+
userAgent = `${versionString} nodejs/${process.version} ${os.platform()}-${os.arch()}/${os.release()}`
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return userAgent
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Gets just the version string without environment details.
|
|
36
|
+
* @returns The version string (e.g., "CopilotStudioClient.agents-sdk-js/0.1.0")
|
|
37
|
+
*/
|
|
38
|
+
static getVersionString (): string {
|
|
39
|
+
return `CopilotStudioClient.agents-sdk-js/${version}`
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Gets the SDK version number.
|
|
44
|
+
* @returns The version number (e.g., "0.1.0")
|
|
45
|
+
*/
|
|
46
|
+
static getVersion (): string {
|
|
47
|
+
return version
|
|
48
|
+
}
|
|
49
|
+
}
|