@microsoft/agents-copilotstudio-client 1.1.0-alpha.9.g154c2c8a32 → 1.1.4-g8d884129e7
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 +3 -3
- package/dist/src/browser.mjs +6 -8
- package/dist/src/browser.mjs.map +4 -4
- package/dist/src/copilotStudioClient.d.ts +30 -6
- package/dist/src/copilotStudioClient.js +152 -102
- package/dist/src/copilotStudioClient.js.map +1 -1
- package/dist/src/copilotStudioWebChat.js +88 -14
- package/dist/src/copilotStudioWebChat.js.map +1 -1
- package/package.json +3 -3
- package/src/copilotStudioClient.ts +157 -113
- package/src/copilotStudioWebChat.ts +97 -16
|
@@ -17,8 +17,8 @@ export declare class CopilotStudioClient {
|
|
|
17
17
|
private conversationId;
|
|
18
18
|
/** The connection settings for the client. */
|
|
19
19
|
private readonly settings;
|
|
20
|
-
/** The
|
|
21
|
-
private readonly
|
|
20
|
+
/** The authenticaton token. */
|
|
21
|
+
private readonly token;
|
|
22
22
|
/**
|
|
23
23
|
* Returns the scope URL needed to connect to Copilot Studio from the connection settings.
|
|
24
24
|
* This is used for authentication token audience configuration.
|
|
@@ -32,6 +32,13 @@ export declare class CopilotStudioClient {
|
|
|
32
32
|
* @param token The authentication token.
|
|
33
33
|
*/
|
|
34
34
|
constructor(settings: ConnectionSettings, token: string);
|
|
35
|
+
/**
|
|
36
|
+
* Streams activities from the Copilot Studio service using eventsource-client.
|
|
37
|
+
* @param url The connection URL for Copilot Studio.
|
|
38
|
+
* @param body Optional. The request body (for POST).
|
|
39
|
+
* @param method Optional. The HTTP method (default: POST).
|
|
40
|
+
* @returns An async generator yielding the Agent's Activities.
|
|
41
|
+
*/
|
|
35
42
|
private postRequestAsync;
|
|
36
43
|
/**
|
|
37
44
|
* Appends this package.json version to the User-Agent header.
|
|
@@ -40,24 +47,41 @@ export declare class CopilotStudioClient {
|
|
|
40
47
|
* @returns A string containing the product information, including version and user agent.
|
|
41
48
|
*/
|
|
42
49
|
private static getProductInfo;
|
|
50
|
+
private processResponseHeaders;
|
|
51
|
+
/**
|
|
52
|
+
* Starts a new conversation with the Copilot Studio service.
|
|
53
|
+
* @param emitStartConversationEvent Whether to emit a start conversation event. Defaults to true.
|
|
54
|
+
* @returns An async generator yielding the Agent's Activities.
|
|
55
|
+
*/
|
|
56
|
+
startConversationStreaming(emitStartConversationEvent?: boolean): AsyncGenerator<Activity>;
|
|
57
|
+
/**
|
|
58
|
+
* Sends an activity to the Copilot Studio service and retrieves the response activities.
|
|
59
|
+
* @param activity The activity to send.
|
|
60
|
+
* @param conversationId The ID of the conversation. Defaults to the current conversation ID.
|
|
61
|
+
* @returns An async generator yielding the Agent's Activities.
|
|
62
|
+
*/
|
|
63
|
+
sendActivityStreaming(activity: Activity, conversationId?: string): AsyncGenerator<Activity>;
|
|
43
64
|
/**
|
|
44
65
|
* Starts a new conversation with the Copilot Studio service.
|
|
45
66
|
* @param emitStartConversationEvent Whether to emit a start conversation event. Defaults to true.
|
|
46
|
-
* @returns A promise
|
|
67
|
+
* @returns A promise yielding an array of activities.
|
|
68
|
+
* @deprecated Use startConversationStreaming instead.
|
|
47
69
|
*/
|
|
48
|
-
startConversationAsync(emitStartConversationEvent?: boolean): Promise<Activity>;
|
|
70
|
+
startConversationAsync(emitStartConversationEvent?: boolean): Promise<Activity[]>;
|
|
49
71
|
/**
|
|
50
72
|
* Sends a question to the Copilot Studio service and retrieves the response activities.
|
|
51
73
|
* @param question The question to ask.
|
|
52
74
|
* @param conversationId The ID of the conversation. Defaults to the current conversation ID.
|
|
53
|
-
* @returns A promise
|
|
75
|
+
* @returns A promise yielding an array of activities.
|
|
76
|
+
* @deprecated Use sendActivityStreaming instead.
|
|
54
77
|
*/
|
|
55
78
|
askQuestionAsync(question: string, conversationId?: string): Promise<Activity[]>;
|
|
56
79
|
/**
|
|
57
80
|
* Sends an activity to the Copilot Studio service and retrieves the response activities.
|
|
58
81
|
* @param activity The activity to send.
|
|
59
82
|
* @param conversationId The ID of the conversation. Defaults to the current conversation ID.
|
|
60
|
-
* @returns A promise
|
|
83
|
+
* @returns A promise yielding an array of activities.
|
|
84
|
+
* @deprecated Use sendActivityStreaming instead.
|
|
61
85
|
*/
|
|
62
86
|
sendActivity(activity: Activity, conversationId?: string): Promise<Activity[]>;
|
|
63
87
|
}
|
|
@@ -8,7 +8,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
8
8
|
};
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.CopilotStudioClient = void 0;
|
|
11
|
-
const
|
|
11
|
+
const eventsource_client_1 = require("eventsource-client");
|
|
12
12
|
const powerPlatformEnvironment_1 = require("./powerPlatformEnvironment");
|
|
13
13
|
const agents_activity_1 = require("@microsoft/agents-activity");
|
|
14
14
|
const executeTurnRequest_1 = require("./executeTurnRequest");
|
|
@@ -30,72 +30,96 @@ class CopilotStudioClient {
|
|
|
30
30
|
/** The ID of the current conversation. */
|
|
31
31
|
this.conversationId = '';
|
|
32
32
|
this.settings = settings;
|
|
33
|
-
this.
|
|
34
|
-
this.client.defaults.headers.common.Authorization = `Bearer ${token}`;
|
|
35
|
-
this.client.defaults.headers.common['User-Agent'] = CopilotStudioClient.getProductInfo();
|
|
33
|
+
this.token = token;
|
|
36
34
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (done) {
|
|
63
|
-
logger.debug('Stream complete');
|
|
64
|
-
result += value;
|
|
65
|
-
results.push(result);
|
|
66
|
-
return results;
|
|
35
|
+
/**
|
|
36
|
+
* Streams activities from the Copilot Studio service using eventsource-client.
|
|
37
|
+
* @param url The connection URL for Copilot Studio.
|
|
38
|
+
* @param body Optional. The request body (for POST).
|
|
39
|
+
* @param method Optional. The HTTP method (default: POST).
|
|
40
|
+
* @returns An async generator yielding the Agent's Activities.
|
|
41
|
+
*/
|
|
42
|
+
async *postRequestAsync(url, body, method = 'POST') {
|
|
43
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
44
|
+
logger.debug(`>>> SEND TO ${url}`);
|
|
45
|
+
const streamMap = new Map();
|
|
46
|
+
const eventSource = (0, eventsource_client_1.createEventSource)({
|
|
47
|
+
url,
|
|
48
|
+
headers: {
|
|
49
|
+
Authorization: `Bearer ${this.token}`,
|
|
50
|
+
'User-Agent': CopilotStudioClient.getProductInfo(),
|
|
51
|
+
'Content-Type': 'application/json',
|
|
52
|
+
Accept: 'text/event-stream'
|
|
53
|
+
},
|
|
54
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
55
|
+
method,
|
|
56
|
+
fetch: async (url, init) => {
|
|
57
|
+
const response = await fetch(url, init);
|
|
58
|
+
this.processResponseHeaders(response.headers);
|
|
59
|
+
return response;
|
|
67
60
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
61
|
+
});
|
|
62
|
+
try {
|
|
63
|
+
for await (const { data, event } of eventSource) {
|
|
64
|
+
if (data && event === 'activity') {
|
|
65
|
+
try {
|
|
66
|
+
const activity = agents_activity_1.Activity.fromJson(data);
|
|
67
|
+
// check to see if this activity is part of the streamed response, in which case we need to accumulate the text
|
|
68
|
+
const streamingEntity = (_a = activity.entities) === null || _a === void 0 ? void 0 : _a.find(e => e.type === 'streaminfo' && e.streamType === 'streaming');
|
|
69
|
+
switch (activity.type) {
|
|
70
|
+
case agents_activity_1.ActivityTypes.Message:
|
|
71
|
+
if (!this.conversationId.trim()) { // Did not get it from the header.
|
|
72
|
+
this.conversationId = (_c = (_b = activity.conversation) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : '';
|
|
73
|
+
logger.debug(`Conversation ID: ${this.conversationId}`);
|
|
74
|
+
}
|
|
75
|
+
yield activity;
|
|
76
|
+
break;
|
|
77
|
+
case agents_activity_1.ActivityTypes.Typing:
|
|
78
|
+
logger.debug(`Activity type: ${activity.type}`);
|
|
79
|
+
// Accumulate the text as it comes in from the stream.
|
|
80
|
+
// This also accounts for the "old style" of streaming where the stream info is in channelData.
|
|
81
|
+
if (streamingEntity || ((_d = activity.channelData) === null || _d === void 0 ? void 0 : _d.streamType) === 'streaming') {
|
|
82
|
+
const text = (_e = activity.text) !== null && _e !== void 0 ? _e : '';
|
|
83
|
+
const id = ((_f = streamingEntity === null || streamingEntity === void 0 ? void 0 : streamingEntity.streamId) !== null && _f !== void 0 ? _f : (_g = activity.channelData) === null || _g === void 0 ? void 0 : _g.streamId);
|
|
84
|
+
const sequence = ((_h = streamingEntity === null || streamingEntity === void 0 ? void 0 : streamingEntity.streamSequence) !== null && _h !== void 0 ? _h : (_j = activity.channelData) === null || _j === void 0 ? void 0 : _j.streamSequence);
|
|
85
|
+
// Accumulate the text chunks based on stream ID and sequence number.
|
|
86
|
+
if (id && sequence) {
|
|
87
|
+
if (streamMap.has(id)) {
|
|
88
|
+
const existing = streamMap.get(id);
|
|
89
|
+
existing.push({ text, sequence });
|
|
90
|
+
streamMap.set(id, existing);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
streamMap.set(id, [{ text, sequence }]);
|
|
94
|
+
}
|
|
95
|
+
activity.text = ((_k = streamMap.get(id)) === null || _k === void 0 ? void 0 : _k.sort((a, b) => a.sequence - b.sequence).map(item => item.text).join('')) || '';
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
yield activity;
|
|
99
|
+
break;
|
|
100
|
+
default:
|
|
101
|
+
logger.debug(`Activity type: ${activity.type}`);
|
|
102
|
+
yield activity;
|
|
103
|
+
break;
|
|
86
104
|
}
|
|
87
105
|
}
|
|
88
|
-
|
|
89
|
-
logger.
|
|
106
|
+
catch (error) {
|
|
107
|
+
logger.error('Failed to parse activity:', error);
|
|
90
108
|
}
|
|
91
109
|
}
|
|
92
|
-
|
|
93
|
-
logger.
|
|
94
|
-
|
|
110
|
+
else if (event === 'end') {
|
|
111
|
+
logger.debug('Stream complete');
|
|
112
|
+
break;
|
|
95
113
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
114
|
+
if (eventSource.readyState === 'closed') {
|
|
115
|
+
logger.debug('Connection closed');
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
finally {
|
|
121
|
+
eventSource.close();
|
|
122
|
+
}
|
|
99
123
|
}
|
|
100
124
|
/**
|
|
101
125
|
* Appends this package.json version to the User-Agent header.
|
|
@@ -115,41 +139,76 @@ class CopilotStudioClient {
|
|
|
115
139
|
logger.debug(`User-Agent: ${userAgent}`);
|
|
116
140
|
return userAgent;
|
|
117
141
|
}
|
|
142
|
+
processResponseHeaders(responseHeaders) {
|
|
143
|
+
var _a, _b;
|
|
144
|
+
if (this.settings.useExperimentalEndpoint && !((_a = this.settings.directConnectUrl) === null || _a === void 0 ? void 0 : _a.trim())) {
|
|
145
|
+
const islandExperimentalUrl = responseHeaders === null || responseHeaders === void 0 ? void 0 : responseHeaders.get(CopilotStudioClient.islandExperimentalUrlHeaderKey);
|
|
146
|
+
if (islandExperimentalUrl) {
|
|
147
|
+
this.settings.directConnectUrl = islandExperimentalUrl;
|
|
148
|
+
logger.debug(`Island Experimental URL: ${islandExperimentalUrl}`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
this.conversationId = (_b = responseHeaders === null || responseHeaders === void 0 ? void 0 : responseHeaders.get(CopilotStudioClient.conversationIdHeaderKey)) !== null && _b !== void 0 ? _b : '';
|
|
152
|
+
if (this.conversationId) {
|
|
153
|
+
logger.debug(`Conversation ID: ${this.conversationId}`);
|
|
154
|
+
}
|
|
155
|
+
const sanitizedHeaders = new Headers();
|
|
156
|
+
responseHeaders.forEach((value, key) => {
|
|
157
|
+
if (key.toLowerCase() !== 'authorization' && key.toLowerCase() !== CopilotStudioClient.conversationIdHeaderKey.toLowerCase()) {
|
|
158
|
+
sanitizedHeaders.set(key, value);
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
logger.debug('Headers received:', sanitizedHeaders);
|
|
162
|
+
}
|
|
118
163
|
/**
|
|
119
164
|
* Starts a new conversation with the Copilot Studio service.
|
|
120
165
|
* @param emitStartConversationEvent Whether to emit a start conversation event. Defaults to true.
|
|
121
|
-
* @returns
|
|
166
|
+
* @returns An async generator yielding the Agent's Activities.
|
|
122
167
|
*/
|
|
123
|
-
async
|
|
124
|
-
var _a;
|
|
168
|
+
async *startConversationStreaming(emitStartConversationEvent = true) {
|
|
125
169
|
const uriStart = (0, powerPlatformEnvironment_1.getCopilotStudioConnectionUrl)(this.settings);
|
|
126
170
|
const body = { emitStartConversationEvent };
|
|
127
|
-
const config = {
|
|
128
|
-
method: 'post',
|
|
129
|
-
url: uriStart,
|
|
130
|
-
headers: {
|
|
131
|
-
Accept: 'text/event-stream',
|
|
132
|
-
'Content-Type': 'application/json',
|
|
133
|
-
},
|
|
134
|
-
data: body,
|
|
135
|
-
responseType: 'stream',
|
|
136
|
-
adapter: 'fetch'
|
|
137
|
-
};
|
|
138
171
|
logger.info('Starting conversation ...');
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
172
|
+
yield* this.postRequestAsync(uriStart, body, 'POST');
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Sends an activity to the Copilot Studio service and retrieves the response activities.
|
|
176
|
+
* @param activity The activity to send.
|
|
177
|
+
* @param conversationId The ID of the conversation. Defaults to the current conversation ID.
|
|
178
|
+
* @returns An async generator yielding the Agent's Activities.
|
|
179
|
+
*/
|
|
180
|
+
async *sendActivityStreaming(activity, conversationId = this.conversationId) {
|
|
181
|
+
var _a, _b;
|
|
182
|
+
const localConversationId = (_b = (_a = activity.conversation) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : conversationId;
|
|
183
|
+
const uriExecute = (0, powerPlatformEnvironment_1.getCopilotStudioConnectionUrl)(this.settings, localConversationId);
|
|
184
|
+
const qbody = new executeTurnRequest_1.ExecuteTurnRequest(activity);
|
|
185
|
+
logger.info('Sending activity...', activity);
|
|
186
|
+
yield* this.postRequestAsync(uriExecute, qbody, 'POST');
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Starts a new conversation with the Copilot Studio service.
|
|
190
|
+
* @param emitStartConversationEvent Whether to emit a start conversation event. Defaults to true.
|
|
191
|
+
* @returns A promise yielding an array of activities.
|
|
192
|
+
* @deprecated Use startConversationStreaming instead.
|
|
193
|
+
*/
|
|
194
|
+
async startConversationAsync(emitStartConversationEvent = true) {
|
|
195
|
+
const result = [];
|
|
196
|
+
for await (const value of this.startConversationStreaming(emitStartConversationEvent)) {
|
|
197
|
+
result.push(value);
|
|
198
|
+
}
|
|
199
|
+
return result;
|
|
143
200
|
}
|
|
144
201
|
/**
|
|
145
202
|
* Sends a question to the Copilot Studio service and retrieves the response activities.
|
|
146
203
|
* @param question The question to ask.
|
|
147
204
|
* @param conversationId The ID of the conversation. Defaults to the current conversation ID.
|
|
148
|
-
* @returns A promise
|
|
205
|
+
* @returns A promise yielding an array of activities.
|
|
206
|
+
* @deprecated Use sendActivityStreaming instead.
|
|
149
207
|
*/
|
|
150
|
-
async askQuestionAsync(question, conversationId
|
|
208
|
+
async askQuestionAsync(question, conversationId) {
|
|
209
|
+
const localConversationId = (conversationId === null || conversationId === void 0 ? void 0 : conversationId.trim()) ? conversationId : this.conversationId;
|
|
151
210
|
const conversationAccount = {
|
|
152
|
-
id:
|
|
211
|
+
id: localConversationId
|
|
153
212
|
};
|
|
154
213
|
const activityObj = {
|
|
155
214
|
type: 'message',
|
|
@@ -157,34 +216,25 @@ class CopilotStudioClient {
|
|
|
157
216
|
conversation: conversationAccount
|
|
158
217
|
};
|
|
159
218
|
const activity = agents_activity_1.Activity.fromObject(activityObj);
|
|
160
|
-
|
|
219
|
+
const result = [];
|
|
220
|
+
for await (const value of this.sendActivityStreaming(activity, conversationId)) {
|
|
221
|
+
result.push(value);
|
|
222
|
+
}
|
|
223
|
+
return result;
|
|
161
224
|
}
|
|
162
225
|
/**
|
|
163
226
|
* Sends an activity to the Copilot Studio service and retrieves the response activities.
|
|
164
227
|
* @param activity The activity to send.
|
|
165
228
|
* @param conversationId The ID of the conversation. Defaults to the current conversation ID.
|
|
166
|
-
* @returns A promise
|
|
229
|
+
* @returns A promise yielding an array of activities.
|
|
230
|
+
* @deprecated Use sendActivityStreaming instead.
|
|
167
231
|
*/
|
|
168
232
|
async sendActivity(activity, conversationId = this.conversationId) {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
method: 'post',
|
|
175
|
-
url: uriExecute,
|
|
176
|
-
headers: {
|
|
177
|
-
Accept: 'text/event-stream',
|
|
178
|
-
'Content-Type': 'application/json',
|
|
179
|
-
},
|
|
180
|
-
data: qbody,
|
|
181
|
-
responseType: 'stream',
|
|
182
|
-
adapter: 'fetch'
|
|
183
|
-
};
|
|
184
|
-
logger.info('Sending activity...', activity);
|
|
185
|
-
const values = await this.postRequestAsync(config);
|
|
186
|
-
logger.info(`Received ${values.length} activities.`, values);
|
|
187
|
-
return values;
|
|
233
|
+
const result = [];
|
|
234
|
+
for await (const value of this.sendActivityStreaming(activity, conversationId)) {
|
|
235
|
+
result.push(value);
|
|
236
|
+
}
|
|
237
|
+
return result;
|
|
188
238
|
}
|
|
189
239
|
}
|
|
190
240
|
exports.CopilotStudioClient = CopilotStudioClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copilotStudioClient.js","sourceRoot":"","sources":["../../src/copilotStudioClient.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;
|
|
1
|
+
{"version":3,"file":"copilotStudioClient.js","sourceRoot":"","sources":["../../src/copilotStudioClient.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,2DAAyE;AAEzE,yEAA4F;AAC5F,gEAAyF;AACzF,6DAAyD;AACzD,8DAAyD;AACzD,kDAAyC;AACzC,4CAAmB;AAEnB,MAAM,MAAM,GAAG,IAAA,cAAK,EAAC,uBAAuB,CAAC,CAAA;AAE7C;;;GAGG;AACH,MAAa,mBAAmB;IAqB9B;;;;OAIG;IACH,YAAa,QAA4B,EAAE,KAAa;QApBxD,0CAA0C;QAClC,mBAAc,GAAW,EAAE,CAAA;QAoBjC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAED;;;;;;OAMG;IACK,KAAK,CAAC,CAAE,gBAAgB,CAAE,GAAW,EAAE,IAAU,EAAE,SAAiB,MAAM;;QAChF,MAAM,CAAC,KAAK,CAAC,eAAe,GAAG,EAAE,CAAC,CAAA;QAElC,MAAM,SAAS,GAAG,IAAI,GAAG,EAAgD,CAAA;QAEzE,MAAM,WAAW,GAAsB,IAAA,sCAAiB,EAAC;YACvD,GAAG;YACH,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,IAAI,CAAC,KAAK,EAAE;gBACrC,YAAY,EAAE,mBAAmB,CAAC,cAAc,EAAE;gBAClD,cAAc,EAAE,kBAAkB;gBAClC,MAAM,EAAE,mBAAmB;aAC5B;YACD,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;Y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,cAAc,CAAA;QACzF,MAAM,mBAAmB,GAAwB;YAC/C,EAAE,EAAE,mBAAmB;SACxB,CAAA;QACD,MAAM,WAAW,GAAG;YAClB,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,QAAQ;YACd,YAAY,EAAE,mBAAmB;SAClC,CAAA;QACD,MAAM,QAAQ,GAAG,0BAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,CAAA;QAEjD,MAAM,MAAM,GAAe,EAAE,CAAA;QAC7B,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,IAAI,CAAC,qBAAqB,CAAC,QAAQ,EAAE,cAAc,CAAC,EAAE,CAAC;YAC/E,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACpB,CAAC;QACD,OAAO,MAAM,CAAA;IACf,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,YAAY,CAAE,QAAkB,EAAE,iBAAyB,IAAI,CAAC,cAAc;QACzF,MAAM,MAAM,GAAe,EAAE,CAAA;QAC7B,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,IAAI,CAAC,qBAAqB,CAAC,QAAQ,EAAE,cAAc,CAAC,EAAE,CAAC;YAC/E,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACpB,CAAC;QACD,OAAO,MAAM,CAAA;IACf,CAAC;;AAtPH,kDAuPC;AAtPC,sCAAsC;AACd,2CAAuB,GAAW,qBAAqB,AAAhC,CAAgC;AAC/E,wBAAwB;AACA,kDAA8B,GAAW,uBAAuB,AAAlC,CAAkC;AASxF;;;;;GAKG;AACI,qCAAiB,GAA6C,2CAAgB,AAA7D,CAA6D"}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.CopilotStudioWebChat = void 0;
|
|
8
8
|
const uuid_1 = require("uuid");
|
|
9
|
+
const agents_activity_1 = require("@microsoft/agents-activity");
|
|
9
10
|
const rxjs_1 = require("rxjs");
|
|
10
11
|
const logger_1 = require("@microsoft/agents-activity/logger");
|
|
11
12
|
const logger = (0, logger_1.debug)('copilot-studio:webchat');
|
|
@@ -128,16 +129,22 @@ class CopilotStudioWebChat {
|
|
|
128
129
|
const connectionStatus$ = new rxjs_1.BehaviorSubject(0);
|
|
129
130
|
const activity$ = createObservable(async (subscriber) => {
|
|
130
131
|
activitySubscriber = subscriber;
|
|
131
|
-
|
|
132
|
+
const handleAcknowledgementOnce = async () => {
|
|
132
133
|
connectionStatus$.next(2);
|
|
133
|
-
|
|
134
|
-
}
|
|
134
|
+
await 0; // Webchat requires an extra tick to process the connection status change
|
|
135
|
+
};
|
|
135
136
|
logger.debug('--> Connection established.');
|
|
136
137
|
notifyTyping();
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
138
|
+
if (connectionStatus$.value < 2) {
|
|
139
|
+
for await (const activity of client.startConversationStreaming()) {
|
|
140
|
+
delete activity.replyToId;
|
|
141
|
+
if (!conversation && activity.conversation) {
|
|
142
|
+
conversation = activity.conversation;
|
|
143
|
+
await handleAcknowledgementOnce();
|
|
144
|
+
}
|
|
145
|
+
notifyActivity(activity);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
141
148
|
});
|
|
142
149
|
const notifyActivity = (activity) => {
|
|
143
150
|
const newActivity = {
|
|
@@ -145,9 +152,10 @@ class CopilotStudioWebChat {
|
|
|
145
152
|
timestamp: new Date().toISOString(),
|
|
146
153
|
channelData: {
|
|
147
154
|
...activity.channelData,
|
|
148
|
-
'webchat:sequence-id': sequence
|
|
155
|
+
'webchat:sequence-id': sequence,
|
|
149
156
|
},
|
|
150
157
|
};
|
|
158
|
+
sequence++;
|
|
151
159
|
logger.debug(`Notify '${newActivity.type}' activity to WebChat:`, newActivity);
|
|
152
160
|
activitySubscriber === null || activitySubscriber === void 0 ? void 0 : activitySubscriber.next(newActivity);
|
|
153
161
|
};
|
|
@@ -173,17 +181,22 @@ class CopilotStudioWebChat {
|
|
|
173
181
|
}
|
|
174
182
|
return createObservable(async (subscriber) => {
|
|
175
183
|
try {
|
|
176
|
-
const id = (0, uuid_1.v4)();
|
|
177
184
|
logger.info('--> Sending activity to Copilot Studio ...');
|
|
178
|
-
|
|
185
|
+
const newActivity = agents_activity_1.Activity.fromObject({
|
|
186
|
+
...activity,
|
|
187
|
+
id: (0, uuid_1.v4)(),
|
|
188
|
+
attachments: await processAttachments(activity)
|
|
189
|
+
});
|
|
190
|
+
notifyActivity(newActivity);
|
|
179
191
|
notifyTyping();
|
|
180
|
-
|
|
181
|
-
|
|
192
|
+
// Notify WebChat immediately that the message was sent
|
|
193
|
+
subscriber.next(newActivity.id);
|
|
194
|
+
// Stream the agent's response, but don't block the UI
|
|
195
|
+
for await (const responseActivity of client.sendActivityStreaming(newActivity)) {
|
|
182
196
|
notifyActivity(responseActivity);
|
|
197
|
+
logger.info('<-- Activity received correctly from Copilot Studio.');
|
|
183
198
|
}
|
|
184
|
-
subscriber.next(id);
|
|
185
199
|
subscriber.complete();
|
|
186
|
-
logger.info('--> Activity received correctly from Copilot Studio.');
|
|
187
200
|
}
|
|
188
201
|
catch (error) {
|
|
189
202
|
logger.error('Error sending Activity to Copilot Studio:', error);
|
|
@@ -203,6 +216,67 @@ class CopilotStudioWebChat {
|
|
|
203
216
|
}
|
|
204
217
|
}
|
|
205
218
|
exports.CopilotStudioWebChat = CopilotStudioWebChat;
|
|
219
|
+
/**
|
|
220
|
+
* Processes activity attachments.
|
|
221
|
+
* @param activity The activity to process for attachments.
|
|
222
|
+
* @returns A promise that resolves to the activity with all attachments converted.
|
|
223
|
+
*/
|
|
224
|
+
async function processAttachments(activity) {
|
|
225
|
+
var _a;
|
|
226
|
+
if (activity.type !== 'message' || !((_a = activity.attachments) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
227
|
+
return activity.attachments || [];
|
|
228
|
+
}
|
|
229
|
+
const attachments = [];
|
|
230
|
+
for (const attachment of activity.attachments) {
|
|
231
|
+
const processed = await processBlobAttachment(attachment);
|
|
232
|
+
attachments.push(processed);
|
|
233
|
+
}
|
|
234
|
+
return attachments;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Processes a blob attachment to convert its content URL to a data URL.
|
|
238
|
+
* @param attachment The attachment to process.
|
|
239
|
+
* @returns A promise that resolves to the processed attachment.
|
|
240
|
+
*/
|
|
241
|
+
async function processBlobAttachment(attachment) {
|
|
242
|
+
let newContentUrl = attachment.contentUrl;
|
|
243
|
+
if (!(newContentUrl === null || newContentUrl === void 0 ? void 0 : newContentUrl.startsWith('blob:'))) {
|
|
244
|
+
return attachment;
|
|
245
|
+
}
|
|
246
|
+
try {
|
|
247
|
+
const response = await fetch(newContentUrl);
|
|
248
|
+
if (!response.ok) {
|
|
249
|
+
throw new Error(`Failed to fetch blob URL: ${response.status} ${response.statusText}`);
|
|
250
|
+
}
|
|
251
|
+
const blob = await response.blob();
|
|
252
|
+
const arrayBuffer = await blob.arrayBuffer();
|
|
253
|
+
const base64 = arrayBufferToBase64(arrayBuffer);
|
|
254
|
+
newContentUrl = `data:${blob.type};base64,${base64}`;
|
|
255
|
+
}
|
|
256
|
+
catch (error) {
|
|
257
|
+
newContentUrl = attachment.contentUrl;
|
|
258
|
+
logger.error('Error processing blob attachment:', newContentUrl, error);
|
|
259
|
+
}
|
|
260
|
+
return { ...attachment, contentUrl: newContentUrl };
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Converts an ArrayBuffer to a base64 string.
|
|
264
|
+
* @param buffer The ArrayBuffer to convert.
|
|
265
|
+
* @returns The base64 encoded string.
|
|
266
|
+
*/
|
|
267
|
+
function arrayBufferToBase64(buffer) {
|
|
268
|
+
// Node.js environment
|
|
269
|
+
const BufferClass = typeof globalThis.Buffer === 'function' ? globalThis.Buffer : undefined;
|
|
270
|
+
if (BufferClass && typeof BufferClass.from === 'function') {
|
|
271
|
+
return BufferClass.from(buffer).toString('base64');
|
|
272
|
+
}
|
|
273
|
+
// Browser environment
|
|
274
|
+
let binary = '';
|
|
275
|
+
for (const byte of new Uint8Array(buffer)) {
|
|
276
|
+
binary += String.fromCharCode(byte);
|
|
277
|
+
}
|
|
278
|
+
return btoa(binary);
|
|
279
|
+
}
|
|
206
280
|
/**
|
|
207
281
|
* Creates an RxJS Observable that wraps an asynchronous function execution.
|
|
208
282
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copilotStudioWebChat.js","sourceRoot":"","sources":["../../src/copilotStudioWebChat.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+BAAiC;
|
|
1
|
+
{"version":3,"file":"copilotStudioWebChat.js","sourceRoot":"","sources":["../../src/copilotStudioWebChat.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+BAAiC;AAEjC,gEAAsF;AACtF,+BAAmE;AAGnE,8DAAyD;AAEzD,MAAM,MAAM,GAAG,IAAA,cAAK,EAAC,wBAAwB,CAAC,CAAA;AA4E9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,MAAa,oBAAoB;IAC/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgDG;IACH,MAAM,CAAC,gBAAgB,CACrB,MAA2B,EAC3B,QAAuC;QAEvC,MAAM,CAAC,IAAI,CAAC,gEAAgE,CAAC,CAAA;QAC7E,IAAI,QAAQ,GAAG,CAAC,CAAA;QAChB,IAAI,kBAA6D,CAAA;QACjE,IAAI,YAA6C,CAAA;QAEjD,MAAM,iBAAiB,GAAG,IAAI,sBAAe,CAAC,CAAC,CAAC,CAAA;QAChD,MAAM,SAAS,GAAG,gBAAgB,CAAoB,KAAK,EAAE,UAAU,EAAE,EAAE;YACzE,kBAAkB,GAAG,UAAU,CAAA;YAE/B,MAAM,yBAAyB,GAAG,KAAK,IAAmB,EAAE;gBAC1D,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;gBACzB,MAAM,CAA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C,YAAY,CAAC,IAAI,CAAC,CAAA;IACrC,CAAC;IACD,OAAO,IAAI,CAAC,MAAM,CAAC,CAAA;AACrB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,SAAS,gBAAgB,CAAK,EAAuC;IACnE,OAAO,IAAI,iBAAU,CAAI,CAAC,UAAyB,EAAE,EAAE;QACrD,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA;IAC3E,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/agents-copilotstudio-client",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4-g8d884129e7",
|
|
4
4
|
"homepage": "https://github.com/microsoft/Agents-for-js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,8 +27,8 @@
|
|
|
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.1.
|
|
31
|
-
"
|
|
30
|
+
"@microsoft/agents-activity": "1.1.4-g8d884129e7",
|
|
31
|
+
"eventsource-client": "^1.2.0",
|
|
32
32
|
"rxjs": "7.8.2",
|
|
33
33
|
"uuid": "^11.1.0"
|
|
34
34
|
},
|