@vscode/chat-lib 0.0.5-13 → 0.0.5-15
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/src/_internal/extension/prompt/node/chatMLFetcher.d.ts +25 -8
- package/dist/src/_internal/extension/prompt/node/chatMLFetcher.d.ts.map +1 -1
- package/dist/src/_internal/extension/prompt/node/chatMLFetcher.js +411 -174
- package/dist/src/_internal/extension/prompt/node/chatMLFetcher.js.map +1 -1
- package/dist/src/_internal/extension/prompt/node/chatMLFetcherTelemetry.d.ts +42 -0
- package/dist/src/_internal/extension/prompt/node/chatMLFetcherTelemetry.d.ts.map +1 -0
- package/dist/src/_internal/extension/prompt/node/chatMLFetcherTelemetry.js +171 -0
- package/dist/src/_internal/extension/prompt/node/chatMLFetcherTelemetry.js.map +1 -0
- package/dist/src/_internal/extension/xtab/common/tags.d.ts +13 -0
- package/dist/src/_internal/extension/xtab/common/tags.d.ts.map +1 -1
- package/dist/src/_internal/extension/xtab/common/tags.js +15 -1
- package/dist/src/_internal/extension/xtab/common/tags.js.map +1 -1
- package/dist/src/_internal/extension/xtab/node/xtabProvider.d.ts.map +1 -1
- package/dist/src/_internal/extension/xtab/node/xtabProvider.js +6 -20
- package/dist/src/_internal/extension/xtab/node/xtabProvider.js.map +1 -1
- package/dist/src/_internal/platform/github/common/githubAPI.d.ts +3 -0
- package/dist/src/_internal/platform/github/common/githubAPI.d.ts.map +1 -1
- package/dist/src/_internal/platform/github/common/githubAPI.js +6 -0
- package/dist/src/_internal/platform/github/common/githubAPI.js.map +1 -1
- package/dist/src/_internal/platform/networking/common/fetch.d.ts +0 -1
- package/dist/src/_internal/platform/networking/common/fetch.d.ts.map +1 -1
- package/dist/src/_internal/platform/networking/common/fetch.js +0 -8
- package/dist/src/_internal/platform/networking/common/fetch.js.map +1 -1
- package/dist/src/_internal/platform/openai/node/fetch.d.ts +2 -33
- package/dist/src/_internal/platform/openai/node/fetch.d.ts.map +1 -1
- package/dist/src/_internal/platform/openai/node/fetch.js +0 -401
- package/dist/src/_internal/platform/openai/node/fetch.js.map +1 -1
- package/dist/src/package.json +15 -4
- package/package.json +1 -1
|
@@ -5,23 +5,6 @@
|
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.ChatFailKind = exports.FetchResponseKind = void 0;
|
|
8
|
-
exports.fetchAndStreamChat = fetchAndStreamChat;
|
|
9
|
-
const crypto_1 = require("../../../util/common/crypto");
|
|
10
|
-
const uuid_1 = require("../../../util/vs/base/common/uuid");
|
|
11
|
-
const instantiation_1 = require("../../../util/vs/platform/instantiation/common/instantiation");
|
|
12
|
-
const authentication_1 = require("../../authentication/common/authentication");
|
|
13
|
-
const chatQuotaService_1 = require("../../chat/common/chatQuotaService");
|
|
14
|
-
const commonTypes_1 = require("../../chat/common/commonTypes");
|
|
15
|
-
const interactionService_1 = require("../../chat/common/interactionService");
|
|
16
|
-
const capiClient_1 = require("../../endpoint/common/capiClient");
|
|
17
|
-
const logService_1 = require("../../log/common/logService");
|
|
18
|
-
const fetch_1 = require("../../networking/common/fetch");
|
|
19
|
-
const fetcherService_1 = require("../../networking/common/fetcherService");
|
|
20
|
-
const networking_1 = require("../../networking/common/networking");
|
|
21
|
-
const chatStream_1 = require("../../networking/node/chatStream");
|
|
22
|
-
const stream_1 = require("../../networking/node/stream");
|
|
23
|
-
const telemetry_1 = require("../../telemetry/common/telemetry");
|
|
24
|
-
const telemetryData_1 = require("../../telemetry/common/telemetryData");
|
|
25
8
|
var FetchResponseKind;
|
|
26
9
|
(function (FetchResponseKind) {
|
|
27
10
|
FetchResponseKind["Success"] = "success";
|
|
@@ -46,388 +29,4 @@ var ChatFailKind;
|
|
|
46
29
|
ChatFailKind["NotFound"] = "notFound";
|
|
47
30
|
ChatFailKind["Unknown"] = "unknown";
|
|
48
31
|
})(ChatFailKind || (exports.ChatFailKind = ChatFailKind = {}));
|
|
49
|
-
/**
|
|
50
|
-
* A fetcher specialized to fetch ChatML completions. This differs from the standard fetcher in the form that ChatML
|
|
51
|
-
* requires a different datamodel. Details can be found here https://platform.openai.com/docs/guides/chat
|
|
52
|
-
*
|
|
53
|
-
* This fetcher was created because the standard fetcher is tightly coupled to the OpenAI API completion models and a major refactoring
|
|
54
|
-
* or rewrite is necessary to have a more generic fetcher that can be used for both completions and chat models.
|
|
55
|
-
*/
|
|
56
|
-
async function fetchAndStreamChat(accessor, chatEndpointInfo, request, baseTelemetryData, finishedCb, secretKey, location, ourRequestId, nChoices, userInitiatedRequest, cancel, telemetryProperties, useFetcher) {
|
|
57
|
-
const logService = accessor.get(logService_1.ILogService);
|
|
58
|
-
const telemetryService = accessor.get(telemetry_1.ITelemetryService);
|
|
59
|
-
const chatQuotaService = accessor.get(chatQuotaService_1.IChatQuotaService);
|
|
60
|
-
const authenticationService = accessor.get(authentication_1.IAuthenticationService);
|
|
61
|
-
const instantiationService = accessor.get(instantiation_1.IInstantiationService);
|
|
62
|
-
if (cancel?.isCancellationRequested) {
|
|
63
|
-
return { type: FetchResponseKind.Canceled, reason: 'before fetch request' };
|
|
64
|
-
}
|
|
65
|
-
logService.debug(`modelMaxPromptTokens ${chatEndpointInfo.modelMaxPromptTokens}`);
|
|
66
|
-
logService.debug(`modelMaxResponseTokens ${request.max_tokens ?? 2048}`);
|
|
67
|
-
logService.debug(`chat model ${chatEndpointInfo.model}`);
|
|
68
|
-
secretKey ??= (await authenticationService.getCopilotToken()).token;
|
|
69
|
-
if (!secretKey) {
|
|
70
|
-
// If no key is set we error
|
|
71
|
-
const urlOrRequestMetadata = (0, networking_1.stringifyUrlOrRequestMetadata)(chatEndpointInfo.urlOrRequestMetadata);
|
|
72
|
-
logService.error(`Failed to send request to ${urlOrRequestMetadata} due to missing key`);
|
|
73
|
-
(0, stream_1.sendCommunicationErrorTelemetry)(telemetryService, `Failed to send request to ${urlOrRequestMetadata} due to missing key`);
|
|
74
|
-
return {
|
|
75
|
-
type: FetchResponseKind.Failed,
|
|
76
|
-
modelRequestId: undefined,
|
|
77
|
-
failKind: ChatFailKind.TokenExpiredOrInvalid,
|
|
78
|
-
reason: 'key is missing'
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
// Generate unique ID to link input and output messages
|
|
82
|
-
const modelCallId = (0, uuid_1.generateUuid)();
|
|
83
|
-
const response = await instantiationService.invokeFunction(accessor => fetchWithInstrumentation(accessor, chatEndpointInfo, ourRequestId, request, secretKey, location, userInitiatedRequest, cancel, { ...telemetryProperties, modelCallId }, useFetcher));
|
|
84
|
-
if (cancel?.isCancellationRequested) {
|
|
85
|
-
const body = await response.body();
|
|
86
|
-
try {
|
|
87
|
-
// Destroy the stream so that the server is hopefully notified we don't want any more data
|
|
88
|
-
// and can cancel/forget about the request itself.
|
|
89
|
-
body.destroy();
|
|
90
|
-
}
|
|
91
|
-
catch (e) {
|
|
92
|
-
logService.error(e, `Error destroying stream`);
|
|
93
|
-
telemetryService.sendGHTelemetryException(e, 'Error destroying stream');
|
|
94
|
-
}
|
|
95
|
-
return { type: FetchResponseKind.Canceled, reason: 'after fetch request' };
|
|
96
|
-
}
|
|
97
|
-
if (response.status === 200 && authenticationService.copilotToken?.isFreeUser && authenticationService.copilotToken?.isChatQuotaExceeded) {
|
|
98
|
-
authenticationService.resetCopilotToken();
|
|
99
|
-
}
|
|
100
|
-
if (response.status !== 200) {
|
|
101
|
-
const telemetryData = createTelemetryData(chatEndpointInfo, location, ourRequestId);
|
|
102
|
-
logService.info('Request ID for failed request: ' + ourRequestId);
|
|
103
|
-
return instantiationService.invokeFunction(handleError, telemetryData, response, ourRequestId);
|
|
104
|
-
}
|
|
105
|
-
// Extend baseTelemetryData with modelCallId for output messages
|
|
106
|
-
const extendedBaseTelemetryData = baseTelemetryData.extendedBy({ modelCallId });
|
|
107
|
-
const chatCompletions = await chatEndpointInfo.processResponseFromChatEndpoint(telemetryService, logService, response, nChoices ?? /* OpenAI's default */ 1, finishedCb, extendedBaseTelemetryData, cancel);
|
|
108
|
-
// CAPI will return us a Copilot Edits Session Header which is our token to using the speculative decoding endpoint
|
|
109
|
-
// We should store this in the auth service for easy use later
|
|
110
|
-
if (response.headers.get('Copilot-Edits-Session')) {
|
|
111
|
-
authenticationService.speculativeDecodingEndpointToken = response.headers.get('Copilot-Edits-Session') ?? undefined;
|
|
112
|
-
}
|
|
113
|
-
chatQuotaService.processQuotaHeaders(response.headers);
|
|
114
|
-
return {
|
|
115
|
-
type: FetchResponseKind.Success,
|
|
116
|
-
chatCompletions: chatCompletions,
|
|
117
|
-
getProcessingTime: () => (0, fetch_1.getProcessingTime)(response),
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
function createTelemetryData(chatEndpointInfo, location, headerRequestId) {
|
|
121
|
-
return telemetryData_1.TelemetryData.createAndMarkAsIssued({
|
|
122
|
-
endpoint: 'completions',
|
|
123
|
-
engineName: 'chat',
|
|
124
|
-
uiKind: commonTypes_1.ChatLocation.toString(location),
|
|
125
|
-
headerRequestId
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
async function handleError(accessor, telemetryData, response, requestId) {
|
|
129
|
-
const logService = accessor.get(logService_1.ILogService);
|
|
130
|
-
const telemetryService = accessor.get(telemetry_1.ITelemetryService);
|
|
131
|
-
const authenticationService = accessor.get(authentication_1.IAuthenticationService);
|
|
132
|
-
const modelRequestIdObj = (0, fetch_1.getRequestId)(response, undefined);
|
|
133
|
-
requestId = modelRequestIdObj.headerRequestId || requestId;
|
|
134
|
-
modelRequestIdObj.headerRequestId = requestId;
|
|
135
|
-
telemetryData.properties.error = `Response status was ${response.status}`;
|
|
136
|
-
telemetryData.properties.status = String(response.status);
|
|
137
|
-
telemetryService.sendGHTelemetryEvent('request.shownWarning', telemetryData.properties, telemetryData.measurements);
|
|
138
|
-
const text = await response.text();
|
|
139
|
-
let jsonData;
|
|
140
|
-
try {
|
|
141
|
-
jsonData = JSON.parse(text);
|
|
142
|
-
jsonData = jsonData?.error ?? jsonData; // Extract nested error object if it exists
|
|
143
|
-
}
|
|
144
|
-
catch {
|
|
145
|
-
// JSON parsing failed, it's not json content.
|
|
146
|
-
}
|
|
147
|
-
if (400 <= response.status && response.status < 500) {
|
|
148
|
-
if (response.status === 400 && text.includes('off_topic')) {
|
|
149
|
-
return {
|
|
150
|
-
type: FetchResponseKind.Failed,
|
|
151
|
-
modelRequestId: modelRequestIdObj,
|
|
152
|
-
failKind: ChatFailKind.OffTopic,
|
|
153
|
-
reason: 'filtered as off_topic by intent classifier: message was not programming related',
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
if (response.status === 401 && text.includes('authorize_url') && jsonData?.authorize_url) {
|
|
157
|
-
return {
|
|
158
|
-
type: FetchResponseKind.Failed,
|
|
159
|
-
modelRequestId: modelRequestIdObj,
|
|
160
|
-
failKind: ChatFailKind.AgentUnauthorized,
|
|
161
|
-
reason: response.statusText || response.statusText,
|
|
162
|
-
data: jsonData
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
if (response.status === 400 && jsonData?.code === 'previous_response_not_found') {
|
|
166
|
-
return {
|
|
167
|
-
type: FetchResponseKind.Failed,
|
|
168
|
-
modelRequestId: modelRequestIdObj,
|
|
169
|
-
failKind: ChatFailKind.InvalidPreviousResponseId,
|
|
170
|
-
reason: jsonData.message || 'Invalid previous response ID',
|
|
171
|
-
data: jsonData,
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
if (response.status === 401 || response.status === 403) {
|
|
175
|
-
// Token has expired or invalid, fetch a new one on next request
|
|
176
|
-
// TODO(drifkin): these actions should probably happen in vsc specific code
|
|
177
|
-
authenticationService.resetCopilotToken(response.status);
|
|
178
|
-
return {
|
|
179
|
-
type: FetchResponseKind.Failed,
|
|
180
|
-
modelRequestId: modelRequestIdObj,
|
|
181
|
-
failKind: ChatFailKind.TokenExpiredOrInvalid,
|
|
182
|
-
reason: jsonData?.message || `token expired or invalid: ${response.status}`,
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
if (response.status === 402) {
|
|
186
|
-
// When we receive a 402, we have exceed a quota
|
|
187
|
-
// This is stored on the token so let's refresh it
|
|
188
|
-
authenticationService.resetCopilotToken(response.status);
|
|
189
|
-
const retryAfter = response.headers.get('retry-after');
|
|
190
|
-
const convertToDate = (retryAfterString) => {
|
|
191
|
-
if (!retryAfterString) {
|
|
192
|
-
return undefined;
|
|
193
|
-
}
|
|
194
|
-
// Try treating it as a date
|
|
195
|
-
const retryAfterDate = new Date(retryAfterString);
|
|
196
|
-
if (!isNaN(retryAfterDate.getDate())) {
|
|
197
|
-
return retryAfterDate;
|
|
198
|
-
}
|
|
199
|
-
// It is not a date, try treating it as a duration from the current date
|
|
200
|
-
const retryAfterDuration = parseInt(retryAfterString, 10);
|
|
201
|
-
if (isNaN(retryAfterDuration)) {
|
|
202
|
-
return undefined;
|
|
203
|
-
}
|
|
204
|
-
return new Date(Date.now() + retryAfterDuration * 1000);
|
|
205
|
-
};
|
|
206
|
-
const retryAfterDate = convertToDate(retryAfter);
|
|
207
|
-
return {
|
|
208
|
-
type: FetchResponseKind.Failed,
|
|
209
|
-
modelRequestId: modelRequestIdObj,
|
|
210
|
-
failKind: ChatFailKind.QuotaExceeded,
|
|
211
|
-
reason: jsonData?.message ?? 'Free tier quota exceeded',
|
|
212
|
-
data: {
|
|
213
|
-
capiError: jsonData,
|
|
214
|
-
retryAfter: retryAfterDate
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
if (response.status === 404) {
|
|
219
|
-
let errorReason;
|
|
220
|
-
// Check if response body is valid JSON
|
|
221
|
-
if (!jsonData) {
|
|
222
|
-
errorReason = text;
|
|
223
|
-
}
|
|
224
|
-
else {
|
|
225
|
-
errorReason = JSON.stringify(jsonData);
|
|
226
|
-
}
|
|
227
|
-
return {
|
|
228
|
-
type: FetchResponseKind.Failed,
|
|
229
|
-
modelRequestId: modelRequestIdObj,
|
|
230
|
-
failKind: ChatFailKind.NotFound,
|
|
231
|
-
reason: errorReason
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
if (response.status === 422) {
|
|
235
|
-
return {
|
|
236
|
-
type: FetchResponseKind.Failed,
|
|
237
|
-
modelRequestId: modelRequestIdObj,
|
|
238
|
-
failKind: ChatFailKind.ContentFilter,
|
|
239
|
-
reason: 'Filtered by Responsible AI Service'
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
if (response.status === 424) {
|
|
243
|
-
return {
|
|
244
|
-
type: FetchResponseKind.Failed,
|
|
245
|
-
modelRequestId: modelRequestIdObj,
|
|
246
|
-
failKind: ChatFailKind.AgentFailedDependency,
|
|
247
|
-
reason: text
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
if (response.status === 429) {
|
|
251
|
-
let rateLimitReason = text;
|
|
252
|
-
rateLimitReason = jsonData?.message ?? jsonData?.code;
|
|
253
|
-
if (text.includes('extension_blocked') && jsonData?.code === 'extension_blocked' && jsonData?.type === 'rate_limit_error') {
|
|
254
|
-
return {
|
|
255
|
-
type: FetchResponseKind.Failed,
|
|
256
|
-
modelRequestId: modelRequestIdObj,
|
|
257
|
-
failKind: ChatFailKind.ExtensionBlocked,
|
|
258
|
-
reason: 'Extension blocked',
|
|
259
|
-
data: {
|
|
260
|
-
...jsonData?.message,
|
|
261
|
-
retryAfter: response.headers.get('retry-after'),
|
|
262
|
-
}
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
// HTTP 429 Too Many Requests
|
|
266
|
-
return {
|
|
267
|
-
type: FetchResponseKind.Failed,
|
|
268
|
-
modelRequestId: modelRequestIdObj,
|
|
269
|
-
failKind: ChatFailKind.RateLimited,
|
|
270
|
-
reason: rateLimitReason,
|
|
271
|
-
data: {
|
|
272
|
-
retryAfter: response.headers.get('retry-after'),
|
|
273
|
-
rateLimitKey: response.headers.get('x-ratelimit-exceeded'),
|
|
274
|
-
capiError: jsonData
|
|
275
|
-
}
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
if (response.status === 466) {
|
|
279
|
-
logService.info(text);
|
|
280
|
-
return {
|
|
281
|
-
type: FetchResponseKind.Failed,
|
|
282
|
-
modelRequestId: modelRequestIdObj,
|
|
283
|
-
failKind: ChatFailKind.ClientNotSupported,
|
|
284
|
-
reason: `client not supported: ${text}`
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
if (response.status === 499) {
|
|
288
|
-
logService.info('Cancelled by server');
|
|
289
|
-
return {
|
|
290
|
-
type: FetchResponseKind.Failed,
|
|
291
|
-
modelRequestId: modelRequestIdObj,
|
|
292
|
-
failKind: ChatFailKind.ServerCanceled,
|
|
293
|
-
reason: 'canceled by server'
|
|
294
|
-
};
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
else if (500 <= response.status && response.status < 600) {
|
|
298
|
-
if (response.status === 503) {
|
|
299
|
-
return {
|
|
300
|
-
type: FetchResponseKind.Failed,
|
|
301
|
-
modelRequestId: modelRequestIdObj,
|
|
302
|
-
failKind: ChatFailKind.RateLimited,
|
|
303
|
-
reason: 'Upstream provider rate limit hit',
|
|
304
|
-
data: {
|
|
305
|
-
retryAfter: null,
|
|
306
|
-
rateLimitKey: null,
|
|
307
|
-
capiError: { code: 'upstream_provider_rate_limit', message: text }
|
|
308
|
-
}
|
|
309
|
-
};
|
|
310
|
-
}
|
|
311
|
-
const reasonNoText = `Server error: ${response.status}`;
|
|
312
|
-
const reason = `${reasonNoText} ${text}`;
|
|
313
|
-
logService.error(reason);
|
|
314
|
-
// HTTP 5xx Server Error
|
|
315
|
-
return {
|
|
316
|
-
type: FetchResponseKind.Failed,
|
|
317
|
-
modelRequestId: modelRequestIdObj,
|
|
318
|
-
failKind: ChatFailKind.ServerError,
|
|
319
|
-
reason: reasonNoText,
|
|
320
|
-
};
|
|
321
|
-
}
|
|
322
|
-
logService.error(`Request Failed: ${response.status} ${text}`);
|
|
323
|
-
(0, stream_1.sendCommunicationErrorTelemetry)(telemetryService, 'Unhandled status from server: ' + response.status, text);
|
|
324
|
-
return {
|
|
325
|
-
type: FetchResponseKind.Failed,
|
|
326
|
-
modelRequestId: modelRequestIdObj,
|
|
327
|
-
failKind: ChatFailKind.Unknown,
|
|
328
|
-
reason: `Request Failed: ${response.status} ${text}`
|
|
329
|
-
};
|
|
330
|
-
}
|
|
331
|
-
async function fetchWithInstrumentation(accessor, chatEndpoint, ourRequestId, request, secretKey, location, userInitiatedRequest, cancel, telemetryProperties, useFetcher) {
|
|
332
|
-
const logService = accessor.get(logService_1.ILogService);
|
|
333
|
-
const telemetryService = accessor.get(telemetry_1.ITelemetryService);
|
|
334
|
-
const fetcherService = accessor.get(fetcherService_1.IFetcherService);
|
|
335
|
-
const capiClientService = accessor.get(capiClient_1.ICAPIClientService);
|
|
336
|
-
const interactionService = accessor.get(interactionService_1.IInteractionService);
|
|
337
|
-
// If request contains an image, we include this header.
|
|
338
|
-
const additionalHeaders = {
|
|
339
|
-
'X-Interaction-Id': interactionService.interactionId,
|
|
340
|
-
'X-Initiator': userInitiatedRequest ? 'user' : 'agent', // Agent = a system request / not the primary user query.
|
|
341
|
-
};
|
|
342
|
-
if (request.messages?.some((m) => Array.isArray(m.content) ? m.content.some(c => 'image_url' in c) : false) && chatEndpoint.supportsVision) {
|
|
343
|
-
additionalHeaders['Copilot-Vision-Request'] = 'true';
|
|
344
|
-
}
|
|
345
|
-
const telemetryData = telemetryData_1.TelemetryData.createAndMarkAsIssued({
|
|
346
|
-
endpoint: 'completions',
|
|
347
|
-
engineName: 'chat',
|
|
348
|
-
uiKind: commonTypes_1.ChatLocation.toString(location),
|
|
349
|
-
...telemetryProperties // This includes the modelCallId from fetchAndStreamChat
|
|
350
|
-
}, {
|
|
351
|
-
maxTokenWindow: chatEndpoint.modelMaxPromptTokens
|
|
352
|
-
});
|
|
353
|
-
for (const [key, value] of Object.entries(request)) {
|
|
354
|
-
if (key === 'messages' || key === 'input') {
|
|
355
|
-
continue;
|
|
356
|
-
} // Skip messages (PII)
|
|
357
|
-
telemetryData.properties[`request.option.${key}`] = JSON.stringify(value) ?? 'undefined';
|
|
358
|
-
}
|
|
359
|
-
// The request ID we are passed in is sent in the request to the proxy, and included in our pre-request telemetry.
|
|
360
|
-
// We hope (but do not rely on) that the model will use the same ID in the response, allowing us to correlate
|
|
361
|
-
// the request and response.
|
|
362
|
-
telemetryData.properties['headerRequestId'] = ourRequestId;
|
|
363
|
-
telemetryService.sendGHTelemetryEvent('request.sent', telemetryData.properties, telemetryData.measurements);
|
|
364
|
-
const requestStart = Date.now();
|
|
365
|
-
const intent = locationToIntent(location);
|
|
366
|
-
// Wrap the Promise with success/error callbacks so we can log/measure it
|
|
367
|
-
return (0, networking_1.postRequest)(fetcherService, telemetryService, capiClientService, chatEndpoint, secretKey, await (0, crypto_1.createRequestHMAC)(process.env.HMAC_SECRET), intent, ourRequestId, request, additionalHeaders, cancel, useFetcher).then(response => {
|
|
368
|
-
const apim = response.headers.get('apim-request-id');
|
|
369
|
-
if (apim) {
|
|
370
|
-
logService.debug(`APIM request id: ${apim}`);
|
|
371
|
-
}
|
|
372
|
-
const ghRequestId = response.headers.get('x-github-request-id');
|
|
373
|
-
if (ghRequestId) {
|
|
374
|
-
logService.debug(`GH request id: ${ghRequestId}`);
|
|
375
|
-
}
|
|
376
|
-
// This ID is hopefully the one the same as ourRequestId, but it is not guaranteed.
|
|
377
|
-
// If they are different then we will override the original one we set in telemetryData above.
|
|
378
|
-
const modelRequestId = (0, fetch_1.getRequestId)(response, undefined);
|
|
379
|
-
telemetryData.extendWithRequestId(modelRequestId);
|
|
380
|
-
// TODO: Add response length (requires parsing)
|
|
381
|
-
const totalTimeMs = Date.now() - requestStart;
|
|
382
|
-
telemetryData.measurements.totalTimeMs = totalTimeMs;
|
|
383
|
-
logService.debug(`request.response: [${(0, networking_1.stringifyUrlOrRequestMetadata)(chatEndpoint.urlOrRequestMetadata)}], took ${totalTimeMs} ms`);
|
|
384
|
-
telemetryService.sendGHTelemetryEvent('request.response', telemetryData.properties, telemetryData.measurements);
|
|
385
|
-
return response;
|
|
386
|
-
})
|
|
387
|
-
.catch(error => {
|
|
388
|
-
if (fetcherService.isAbortError(error)) {
|
|
389
|
-
// If we cancelled a network request, we don't want to log a `request.error`
|
|
390
|
-
throw error;
|
|
391
|
-
}
|
|
392
|
-
const warningTelemetry = telemetryData.extendedBy({ error: 'Network exception' });
|
|
393
|
-
telemetryService.sendGHTelemetryEvent('request.shownWarning', warningTelemetry.properties, warningTelemetry.measurements);
|
|
394
|
-
telemetryData.properties.code = String(error.code ?? '');
|
|
395
|
-
telemetryData.properties.errno = String(error.errno ?? '');
|
|
396
|
-
telemetryData.properties.message = String(error.message ?? '');
|
|
397
|
-
telemetryData.properties.type = String(error.type ?? '');
|
|
398
|
-
const totalTimeMs = Date.now() - requestStart;
|
|
399
|
-
telemetryData.measurements.totalTimeMs = totalTimeMs;
|
|
400
|
-
logService.debug(`request.response: [${(0, networking_1.stringifyUrlOrRequestMetadata)(chatEndpoint.urlOrRequestMetadata)}] took ${totalTimeMs} ms`);
|
|
401
|
-
telemetryService.sendGHTelemetryEvent('request.error', telemetryData.properties, telemetryData.measurements);
|
|
402
|
-
throw error;
|
|
403
|
-
})
|
|
404
|
-
.finally(() => {
|
|
405
|
-
(0, chatStream_1.sendEngineMessagesTelemetry)(telemetryService, request.messages ?? [], telemetryData, false, logService);
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
/**
|
|
409
|
-
* WARNING: The value that is returned from this function drives the disablement of RAI for full-file rewrite requests
|
|
410
|
-
* in Copilot Edits, Copilot Chat, Agent Mode, and Inline Chat.
|
|
411
|
-
* If your chat location generates full-file rewrite requests and you are unsure if changing something here will cause problems, please talk to @roblourens
|
|
412
|
-
*/
|
|
413
|
-
function locationToIntent(location) {
|
|
414
|
-
switch (location) {
|
|
415
|
-
case commonTypes_1.ChatLocation.Panel:
|
|
416
|
-
return 'conversation-panel';
|
|
417
|
-
case commonTypes_1.ChatLocation.Editor:
|
|
418
|
-
return 'conversation-inline';
|
|
419
|
-
case commonTypes_1.ChatLocation.EditingSession:
|
|
420
|
-
return 'conversation-edits';
|
|
421
|
-
case commonTypes_1.ChatLocation.Notebook:
|
|
422
|
-
return 'conversation-notebook';
|
|
423
|
-
case commonTypes_1.ChatLocation.Terminal:
|
|
424
|
-
return 'conversation-terminal';
|
|
425
|
-
case commonTypes_1.ChatLocation.Other:
|
|
426
|
-
return 'conversation-other';
|
|
427
|
-
case commonTypes_1.ChatLocation.Agent:
|
|
428
|
-
return 'conversation-agent';
|
|
429
|
-
case commonTypes_1.ChatLocation.ResponsesProxy:
|
|
430
|
-
return 'responses-proxy';
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
32
|
//# sourceMappingURL=fetch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../../../../src/_internal/platform/openai/node/fetch.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AA6FhG,gDA4GC;AArMD,wDAAgE;AAChE,4DAAiE;AACjE,gGAAuH;AACvH,+EAAoF;AACpF,yEAAuE;AACvE,+DAA6D;AAC7D,6EAA2E;AAC3E,iEAAsE;AACtE,4DAA0D;AAC1D,yDAAwI;AACxI,2EAA8F;AAC9F,mEAA8H;AAE9H,iEAA+E;AAC/E,yDAA+E;AAC/E,gEAA0F;AAC1F,wEAAqE;AAuBrE,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IAC5B,wCAAmB,CAAA;IACnB,sCAAiB,CAAA;IACjB,0CAAqB,CAAA;AACtB,CAAC,EAJW,iBAAiB,iCAAjB,iBAAiB,QAI5B;AAqBD,IAAY,YAgBX;AAhBD,WAAY,YAAY;IACvB,qCAAqB,CAAA;IACrB,+DAA+C,CAAA;IAC/C,iDAAiC,CAAA;IACjC,yDAAyC,CAAA;IACzC,2CAA2B,CAAA;IAC3B,+CAA+B,CAAA;IAC/B,qDAAqC,CAAA;IACrC,2CAA2B,CAAA;IAC3B,+CAA+B,CAA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AAoB,CAAC;QAC7B,KAAK,0BAAY,CAAC,QAAQ;YACzB,OAAO,uBAAuB,CAAC;QAChC,KAAK,0BAAY,CAAC,QAAQ;YACzB,OAAO,uBAAuB,CAAC;QAChC,KAAK,0BAAY,CAAC,KAAK;YACtB,OAAO,oBAAoB,CAAC;QAC7B,KAAK,0BAAY,CAAC,KAAK;YACtB,OAAO,oBAAoB,CAAC;QAC7B,KAAK,0BAAY,CAAC,cAAc;YAC/B,OAAO,iBAAiB,CAAC;IAC3B,CAAC;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../../../../src/_internal/platform/openai/node/fetch.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAKhG,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IAC5B,wCAAmB,CAAA;IACnB,sCAAiB,CAAA;IACjB,0CAAqB,CAAA;AACtB,CAAC,EAJW,iBAAiB,iCAAjB,iBAAiB,QAI5B;AAoBD,IAAY,YAgBX;AAhBD,WAAY,YAAY;IACvB,qCAAqB,CAAA;IACrB,+DAA+C,CAAA;IAC/C,iDAAiC,CAAA;IACjC,yDAAyC,CAAA;IACzC,2CAA2B,CAAA;IAC3B,+CAA+B,CAAA;IAC/B,qDAAqC,CAAA;IACrC,2CAA2B,CAAA;IAC3B,+CAA+B,CAAA;IAC/B,kDAAkC,CAAA;IAClC,0DAA0C,CAAA;IAC1C,qDAAqC,CAAA;IACrC,uEAAuD,CAAA;IACvD,qCAAqB,CAAA;IACrB,mCAAmB,CAAA;AACpB,CAAC,EAhBW,YAAY,4BAAZ,YAAY,QAgBvB"}
|
package/dist/src/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "copilot-chat",
|
|
3
3
|
"displayName": "GitHub Copilot Chat",
|
|
4
4
|
"description": "AI chat features powered by Copilot",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.34.0",
|
|
6
6
|
"build": "1",
|
|
7
7
|
"internalAIKey": "1058ec22-3c95-4951-8443-f26c1f325911",
|
|
8
8
|
"completionsCoreVersion": "1.378.1799",
|
|
@@ -1714,6 +1714,11 @@
|
|
|
1714
1714
|
"when": "true",
|
|
1715
1715
|
"contents": "%github.copilot.viewsWelcome.agentsPlaceholder%"
|
|
1716
1716
|
},
|
|
1717
|
+
{
|
|
1718
|
+
"view": "workbench.view.chat.sessions.copilot-cloud-agent",
|
|
1719
|
+
"when": "github.copilot.auth.missingPermissiveSession",
|
|
1720
|
+
"contents": "%github.copilot.viewsWelcome.noPermissiveToken.contents%"
|
|
1721
|
+
},
|
|
1717
1722
|
{
|
|
1718
1723
|
"view": "workbench.view.chat.sessions.copilot-cloud-agent",
|
|
1719
1724
|
"when": "workspaceFolderCount == 0",
|
|
@@ -1785,6 +1790,10 @@
|
|
|
1785
1790
|
}
|
|
1786
1791
|
],
|
|
1787
1792
|
"commands": [
|
|
1793
|
+
{
|
|
1794
|
+
"command": "github.copilot.chat.triggerPermissiveSignIn",
|
|
1795
|
+
"title": "%github.copilot.command.triggerPermissiveSignIn%"
|
|
1796
|
+
},
|
|
1788
1797
|
{
|
|
1789
1798
|
"command": "github.copilot.claude.sessions.refresh",
|
|
1790
1799
|
"title": "%github.copilot.command.refreshClaudeCodeSessions%",
|
|
@@ -3415,6 +3424,10 @@
|
|
|
3415
3424
|
}
|
|
3416
3425
|
],
|
|
3417
3426
|
"commandPalette": [
|
|
3427
|
+
{
|
|
3428
|
+
"command": "github.copilot.chat.triggerPermissiveSignIn",
|
|
3429
|
+
"when": "false"
|
|
3430
|
+
},
|
|
3418
3431
|
{
|
|
3419
3432
|
"command": "github.copilot.interactiveSession.feedback",
|
|
3420
3433
|
"when": "github.copilot-chat.activated && !github.copilot.interactiveSession.disabled"
|
|
@@ -4341,7 +4354,6 @@
|
|
|
4341
4354
|
"inputPlaceholder": "Describe your task, type `#` for adding context",
|
|
4342
4355
|
"order": 2,
|
|
4343
4356
|
"description": "The GitHub Copilot CLI Agent works on your local machine",
|
|
4344
|
-
"when": "!chatEntitlementSignedOut && chatIsEnabled",
|
|
4345
4357
|
"capabilities": {
|
|
4346
4358
|
"supportsFileAttachments": true,
|
|
4347
4359
|
"supportsProblemAttachments": true,
|
|
@@ -4370,7 +4382,6 @@
|
|
|
4370
4382
|
"inputPlaceholder": "Describe your task, type `#` for adding context",
|
|
4371
4383
|
"order": 1,
|
|
4372
4384
|
"description": "Delegate tasks to the GitHub Copilot Cloud Agent. The agent works asynchronously in the cloud to implement changes, iterates via chat, and can create or update pull requests as needed.",
|
|
4373
|
-
"when": "!chatEntitlementSignedOut && chatIsEnabled",
|
|
4374
4385
|
"capabilities": {
|
|
4375
4386
|
"supportsFileAttachments": true
|
|
4376
4387
|
}
|
|
@@ -4569,7 +4580,7 @@
|
|
|
4569
4580
|
"dependencies": {
|
|
4570
4581
|
"@anthropic-ai/claude-code": "^1.0.120",
|
|
4571
4582
|
"@anthropic-ai/sdk": "^0.68.0",
|
|
4572
|
-
"@github/copilot": "^0.0.
|
|
4583
|
+
"@github/copilot": "^0.0.354",
|
|
4573
4584
|
"@google/genai": "^1.22.0",
|
|
4574
4585
|
"@humanwhocodes/gitignore-to-minimatch": "1.0.2",
|
|
4575
4586
|
"@microsoft/tiktokenizer": "^1.0.10",
|