@vscode/chat-lib 0.0.5-17 → 0.0.5-19

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 (37) hide show
  1. package/dist/src/_internal/extension/prompt/node/chatMLFetcher.d.ts +9 -24
  2. package/dist/src/_internal/extension/prompt/node/chatMLFetcher.d.ts.map +1 -1
  3. package/dist/src/_internal/extension/prompt/node/chatMLFetcher.js +176 -409
  4. package/dist/src/_internal/extension/prompt/node/chatMLFetcher.js.map +1 -1
  5. package/dist/src/_internal/extension/xtab/common/tags.d.ts +0 -13
  6. package/dist/src/_internal/extension/xtab/common/tags.d.ts.map +1 -1
  7. package/dist/src/_internal/extension/xtab/common/tags.js +1 -15
  8. package/dist/src/_internal/extension/xtab/common/tags.js.map +1 -1
  9. package/dist/src/_internal/extension/xtab/node/xtabProvider.d.ts.map +1 -1
  10. package/dist/src/_internal/extension/xtab/node/xtabProvider.js +20 -6
  11. package/dist/src/_internal/extension/xtab/node/xtabProvider.js.map +1 -1
  12. package/dist/src/_internal/platform/configuration/common/configurationService.d.ts +0 -1
  13. package/dist/src/_internal/platform/configuration/common/configurationService.d.ts.map +1 -1
  14. package/dist/src/_internal/platform/configuration/common/configurationService.js +0 -1
  15. package/dist/src/_internal/platform/configuration/common/configurationService.js.map +1 -1
  16. package/dist/src/_internal/platform/github/common/githubAPI.d.ts +0 -3
  17. package/dist/src/_internal/platform/github/common/githubAPI.d.ts.map +1 -1
  18. package/dist/src/_internal/platform/github/common/githubAPI.js +0 -6
  19. package/dist/src/_internal/platform/github/common/githubAPI.js.map +1 -1
  20. package/dist/src/_internal/platform/networking/common/fetch.d.ts +1 -0
  21. package/dist/src/_internal/platform/networking/common/fetch.d.ts.map +1 -1
  22. package/dist/src/_internal/platform/networking/common/fetch.js +8 -0
  23. package/dist/src/_internal/platform/networking/common/fetch.js.map +1 -1
  24. package/dist/src/_internal/platform/openai/node/fetch.d.ts +33 -2
  25. package/dist/src/_internal/platform/openai/node/fetch.d.ts.map +1 -1
  26. package/dist/src/_internal/platform/openai/node/fetch.js +401 -0
  27. package/dist/src/_internal/platform/openai/node/fetch.js.map +1 -1
  28. package/dist/src/main.d.ts +21 -0
  29. package/dist/src/main.d.ts.map +1 -1
  30. package/dist/src/main.js +55 -2
  31. package/dist/src/main.js.map +1 -1
  32. package/dist/src/package.json +10 -26
  33. package/package.json +1 -1
  34. package/dist/src/_internal/extension/prompt/node/chatMLFetcherTelemetry.d.ts +0 -42
  35. package/dist/src/_internal/extension/prompt/node/chatMLFetcherTelemetry.d.ts.map +0 -1
  36. package/dist/src/_internal/extension/prompt/node/chatMLFetcherTelemetry.js +0 -171
  37. package/dist/src/_internal/extension/prompt/node/chatMLFetcherTelemetry.js.map +0 -1
@@ -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.34.0",
5
+ "version": "0.33.0",
6
6
  "build": "1",
7
7
  "internalAIKey": "1058ec22-3c95-4951-8443-f26c1f325911",
8
8
  "completionsCoreVersion": "1.378.1799",
@@ -2304,12 +2304,6 @@
2304
2304
  "title": "Change Completions Model",
2305
2305
  "category": "GitHub Copilot",
2306
2306
  "enablement": "github.copilot.extensionUnification.activated && !isWeb"
2307
- },
2308
- {
2309
- "command": "github.copilot.chat.applyCopilotCLIAgentSessionChanges",
2310
- "title": "%github.copilot.command.applyCopilotCLIAgentSessionChanges%",
2311
- "icon": "$(git-stash-pop)",
2312
- "category": "GitHub Copilot"
2313
2307
  }
2314
2308
  ],
2315
2309
  "configuration": [
@@ -3384,11 +3378,6 @@
3384
3378
  "command": "github.copilot.chat.replay",
3385
3379
  "group": "navigation@9",
3386
3380
  "when": "resourceLangId == chatReplay"
3387
- },
3388
- {
3389
- "command": "github.copilot.chat.applyCopilotCLIAgentSessionChanges",
3390
- "group": "navigation@1",
3391
- "when": "resourceScheme == copilotcli-worktree-changes"
3392
3381
  }
3393
3382
  ],
3394
3383
  "editor/context": [
@@ -3646,10 +3635,6 @@
3646
3635
  {
3647
3636
  "command": "github.copilot.cloud.sessions.proxy.closeChatSessionPullRequest",
3648
3637
  "when": "false"
3649
- },
3650
- {
3651
- "command": "github.copilot.chat.applyCopilotCLIAgentSessionChanges",
3652
- "when": "false"
3653
3638
  }
3654
3639
  ],
3655
3640
  "view/title": [
@@ -4462,10 +4447,10 @@
4462
4447
  "compile": "tsx .esbuild.ts --dev",
4463
4448
  "watch": "npm-run-all -p watch:*",
4464
4449
  "watch:esbuild": "tsx .esbuild.ts --watch --dev",
4465
- "watch:tsc-extension": "tsgo --noEmit --watch --project tsconfig.json",
4466
- "watch:tsc-extension-web": "tsgo --noEmit --watch --project tsconfig.worker.json",
4467
- "watch:tsc-simulation-workbench": "tsgo --noEmit --watch --project test/simulation/workbench/tsconfig.json",
4468
- "typecheck": "tsgo --noEmit --project tsconfig.json && tsgo --noEmit --project test/simulation/workbench/tsconfig.json && tsgo --noEmit --project tsconfig.worker.json && tsgo --noEmit --project src/extension/completions-core/vscode-node/extension/src/copilotPanel/webView/tsconfig.json",
4450
+ "watch:tsc-extension": "tsc --noEmit --watch --project tsconfig.json",
4451
+ "watch:tsc-extension-web": "tsc --noEmit --watch --project tsconfig.worker.json",
4452
+ "watch:tsc-simulation-workbench": "tsc --noEmit --watch --project test/simulation/workbench/tsconfig.json",
4453
+ "typecheck": "tsc --noEmit --project tsconfig.json && tsc --noEmit --project test/simulation/workbench/tsconfig.json && tsc --noEmit --project tsconfig.worker.json && tsc --noEmit --project src/extension/completions-core/vscode-node/extension/src/copilotPanel/webView/tsconfig.json",
4469
4454
  "lint": "eslint . --max-warnings=0",
4470
4455
  "lint-staged": "eslint --max-warnings=0",
4471
4456
  "tsfmt": "npx tsfmt -r --verify",
@@ -4523,12 +4508,11 @@
4523
4508
  "@types/tar": "^6.1.13",
4524
4509
  "@types/vinyl": "^2.0.12",
4525
4510
  "@types/vscode": "^1.102.0",
4526
- "@types/vscode-webview": "^1.57.4",
4527
4511
  "@types/yargs": "^17.0.24",
4512
+ "@types/vscode-webview": "^1.57.4",
4528
4513
  "@typescript-eslint/eslint-plugin": "^8.35.0",
4529
4514
  "@typescript-eslint/parser": "^8.32.0",
4530
4515
  "@typescript-eslint/typescript-estree": "^8.26.1",
4531
- "@typescript/native-preview": "^7.0.0-dev.20251110.1",
4532
4516
  "@vitest/coverage-v8": "^3.2.4",
4533
4517
  "@vitest/snapshot": "^1.5.0",
4534
4518
  "@vscode/debugadapter": "^1.68.0",
@@ -4596,7 +4580,7 @@
4596
4580
  "dependencies": {
4597
4581
  "@anthropic-ai/claude-code": "^1.0.120",
4598
4582
  "@anthropic-ai/sdk": "^0.68.0",
4599
- "@github/copilot": "^0.0.354",
4583
+ "@github/copilot": "^0.0.343",
4600
4584
  "@google/genai": "^1.22.0",
4601
4585
  "@humanwhocodes/gitignore-to-minimatch": "1.0.2",
4602
4586
  "@microsoft/tiktokenizer": "^1.0.10",
@@ -4610,7 +4594,6 @@
4610
4594
  "ajv": "^8.17.1",
4611
4595
  "applicationinsights": "^2.9.7",
4612
4596
  "diff": "^8.0.2",
4613
- "dompurify": "^3.3.0",
4614
4597
  "ignore": "^7.0.5",
4615
4598
  "isbinaryfile": "^5.0.4",
4616
4599
  "jsonc-parser": "^3.3.1",
@@ -4619,11 +4602,12 @@
4619
4602
  "minimatch": "^10.0.3",
4620
4603
  "undici": "^7.11.0",
4621
4604
  "vscode-tas-client": "^0.1.84",
4622
- "web-tree-sitter": "^0.23.0"
4605
+ "web-tree-sitter": "^0.23.0",
4606
+ "dompurify": "^3.3.0"
4623
4607
  },
4624
4608
  "overrides": {
4625
4609
  "@aminya/node-gyp-build": "npm:node-gyp-build@4.8.1",
4626
4610
  "string_decoder": "npm:string_decoder@1.2.0",
4627
4611
  "node-gyp": "npm:node-gyp@10.3.1"
4628
4612
  }
4629
- }
4613
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vscode/chat-lib",
3
- "version": "0.0.5-17",
3
+ "version": "0.0.5-19",
4
4
  "description": "Chat and inline editing SDK extracted from VS Code Copilot Chat",
5
5
  "main": "dist/src/main.js",
6
6
  "types": "dist/src/main.d.ts",
@@ -1,42 +0,0 @@
1
- import { ChatFetchError } from '../../../platform/chat/common/commonTypes';
2
- import { IChatEndpoint, IEndpointBody } from '../../../platform/networking/common/networking';
3
- import { ChatCompletion } from '../../../platform/networking/common/openai';
4
- import { ITelemetryService, TelemetryProperties } from '../../../platform/telemetry/common/telemetry';
5
- import { TelemetryData } from '../../../platform/telemetry/common/telemetryData';
6
- export interface IChatMLFetcherSuccessfulData {
7
- requestId: string;
8
- chatCompletion: ChatCompletion;
9
- baseTelemetry: TelemetryData | undefined;
10
- userInitiatedRequest: boolean | undefined;
11
- chatEndpointInfo: IChatEndpoint | undefined;
12
- requestBody: IEndpointBody;
13
- maxResponseTokens: number;
14
- promptTokenCount: number;
15
- timeToFirstToken: number;
16
- timeToFirstTokenEmitted: number;
17
- hasImageMessages: boolean;
18
- }
19
- export interface IChatMLFetcherCancellationProperties {
20
- source: string;
21
- requestId: string;
22
- model: string;
23
- apiType: string | undefined;
24
- associatedRequestId?: string;
25
- }
26
- export interface IChatMLFetcherCancellationMeasures {
27
- totalTokenMax: number;
28
- promptTokenCount: number;
29
- tokenCountMax: number;
30
- timeToFirstToken: number | undefined;
31
- timeToFirstTokenEmitted?: number;
32
- timeToCancelled: number;
33
- isVisionRequest: number;
34
- isBYOK: number;
35
- isAuto: number;
36
- }
37
- export declare class ChatMLFetcherTelemetrySender {
38
- static sendSuccessTelemetry(telemetryService: ITelemetryService, { requestId, chatCompletion, baseTelemetry, userInitiatedRequest, chatEndpointInfo, requestBody, maxResponseTokens, promptTokenCount, timeToFirstToken, timeToFirstTokenEmitted, hasImageMessages }: IChatMLFetcherSuccessfulData): void;
39
- static sendCancellationTelemetry(telemetryService: ITelemetryService, { source, requestId, model, apiType, associatedRequestId }: IChatMLFetcherCancellationProperties, { totalTokenMax, promptTokenCount, tokenCountMax, timeToFirstToken, timeToFirstTokenEmitted, timeToCancelled, isVisionRequest, isBYOK, isAuto }: IChatMLFetcherCancellationMeasures): void;
40
- static sendResponseErrorTelemetry(telemetryService: ITelemetryService, processed: ChatFetchError, telemetryProperties: TelemetryProperties | undefined, ourRequestId: string, chatEndpointInfo: IChatEndpoint, requestBody: IEndpointBody, tokenCount: number, maxResponseTokens: number, timeToFirstToken: number, isVisionRequest: boolean): void;
41
- }
42
- //# sourceMappingURL=chatMLFetcherTelemetry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chatMLFetcherTelemetry.d.ts","sourceRoot":"","sources":["../../../../../../src/_internal/extension/prompt/node/chatMLFetcherTelemetry.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAE3E,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAC9F,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACtG,OAAO,EAAE,aAAa,EAAE,MAAM,kDAAkD,CAAC;AAGjF,MAAM,WAAW,4BAA4B;IAC5C,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,cAAc,CAAC;IAC/B,aAAa,EAAE,aAAa,GAAG,SAAS,CAAC;IACzC,oBAAoB,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1C,gBAAgB,EAAE,aAAa,GAAG,SAAS,CAAC;IAC5C,WAAW,EAAE,aAAa,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,uBAAuB,EAAE,MAAM,CAAC;IAChC,gBAAgB,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,oCAAoC;IACpD,MAAM,EA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gB,EAAE,MAAM,EACxB,eAAe,EAAE,OAAO;CAiDzB"}
@@ -1,171 +0,0 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Microsoft Corporation. All rights reserved.
4
- * Licensed under the MIT License. See License.txt in the project root for license information.
5
- *--------------------------------------------------------------------------------------------*/
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.ChatMLFetcherTelemetrySender = void 0;
8
- const autoChatEndpoint_1 = require("../../../platform/endpoint/node/autoChatEndpoint");
9
- const openAIEndpoint_1 = require("../../byok/node/openAIEndpoint");
10
- class ChatMLFetcherTelemetrySender {
11
- static sendSuccessTelemetry(telemetryService, { requestId, chatCompletion, baseTelemetry, userInitiatedRequest, chatEndpointInfo, requestBody, maxResponseTokens, promptTokenCount, timeToFirstToken, timeToFirstTokenEmitted, hasImageMessages }) {
12
- /* __GDPR__
13
- "response.success" : {
14
- "owner": "digitarald",
15
- "comment": "Report quality details for a successful service response.",
16
- "reason": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Reason for why a response finished" },
17
- "filterReason": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Reason for why a response was filtered" },
18
- "source": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Source of the initial request" },
19
- "initiatorType": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the request was initiated by a user or an agent" },
20
- "model": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Model selection for the response" },
21
- "modelInvoked": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Actual model invoked for the response" },
22
- "apiType": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "API type for the response- chat completions or responses" },
23
- "requestId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Id of the current turn request" },
24
- "associatedRequestId": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Another request ID that this request is associated with (eg, the originating request of a summarization request)." },
25
- "reasoningEffort": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Reasoning effort level" },
26
- "reasoningSummary": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Reasoning summary level" },
27
- "totalTokenMax": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Maximum total token window", "isMeasurement": true },
28
- "clientPromptTokenCount": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Number of prompt tokens, locally counted", "isMeasurement": true },
29
- "promptTokenCount": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Number of prompt tokens, server side counted", "isMeasurement": true },
30
- "promptCacheTokenCount": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Number of prompt tokens hitting cache as reported by server", "isMeasurement": true },
31
- "tokenCountMax": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Maximum generated tokens", "isMeasurement": true },
32
- "tokenCount": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Number of generated tokens", "isMeasurement": true },
33
- "reasoningTokens": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Number of reasoning tokens", "isMeasurement": true },
34
- "acceptedPredictionTokens": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Number of tokens in the prediction that appeared in the completion", "isMeasurement": true },
35
- "rejectedPredictionTokens": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Number of tokens in the prediction that appeared in the completion", "isMeasurement": true },
36
- "completionTokens": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Number of tokens in the output", "isMeasurement": true },
37
- "timeToFirstToken": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Time to first token", "isMeasurement": true },
38
- "timeToFirstTokenEmitted": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Time to first token emitted (visible text)", "isMeasurement": true },
39
- "timeToComplete": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Time to complete the request", "isMeasurement": true },
40
- "isVisionRequest": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Whether the request was for a vision model", "isMeasurement": true },
41
- "isBYOK": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the request was for a BYOK model", "isMeasurement": true },
42
- "isAuto": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the request was for an Auto model", "isMeasurement": true },
43
- "retryAfterErrorCategory": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "If the response failed and this is a retry attempt, this contains the error category." },
44
- "retryAfterFilterCategory": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "If the response was filtered and this is a retry attempt, this contains the original filtered content category." }
45
- }
46
- */
47
- telemetryService.sendTelemetryEvent('response.success', { github: true, microsoft: true }, {
48
- reason: chatCompletion.finishReason,
49
- filterReason: chatCompletion.filterReason,
50
- source: baseTelemetry?.properties.messageSource ?? 'unknown',
51
- initiatorType: userInitiatedRequest ? 'user' : 'agent',
52
- model: chatEndpointInfo?.model,
53
- modelInvoked: chatCompletion.model,
54
- apiType: chatEndpointInfo?.apiType,
55
- requestId,
56
- associatedRequestId: baseTelemetry?.properties.associatedRequestId,
57
- reasoningEffort: requestBody.reasoning?.effort,
58
- reasoningSummary: requestBody.reasoning?.summary,
59
- ...(baseTelemetry?.properties.retryAfterErrorCategory ? { retryAfterErrorCategory: baseTelemetry.properties.retryAfterErrorCategory } : {}),
60
- ...(baseTelemetry?.properties.retryAfterFilterCategory ? { retryAfterFilterCategory: baseTelemetry.properties.retryAfterFilterCategory } : {}),
61
- }, {
62
- totalTokenMax: chatEndpointInfo?.modelMaxPromptTokens ?? -1,
63
- tokenCountMax: maxResponseTokens,
64
- promptTokenCount: chatCompletion.usage?.prompt_tokens,
65
- promptCacheTokenCount: chatCompletion.usage?.prompt_tokens_details?.cached_tokens,
66
- clientPromptTokenCount: promptTokenCount,
67
- tokenCount: chatCompletion.usage?.total_tokens,
68
- reasoningTokens: chatCompletion.usage?.completion_tokens_details?.reasoning_tokens,
69
- acceptedPredictionTokens: chatCompletion.usage?.completion_tokens_details?.accepted_prediction_tokens,
70
- rejectedPredictionTokens: chatCompletion.usage?.completion_tokens_details?.rejected_prediction_tokens,
71
- completionTokens: chatCompletion.usage?.completion_tokens,
72
- timeToFirstToken,
73
- timeToFirstTokenEmitted,
74
- timeToComplete: baseTelemetry ? Date.now() - baseTelemetry.issuedTime : -1,
75
- isVisionRequest: hasImageMessages ? 1 : -1,
76
- isBYOK: (0, openAIEndpoint_1.isBYOKModel)(chatEndpointInfo),
77
- isAuto: (0, autoChatEndpoint_1.isAutoModel)(chatEndpointInfo)
78
- });
79
- }
80
- static sendCancellationTelemetry(telemetryService, { source, requestId, model, apiType, associatedRequestId }, { totalTokenMax, promptTokenCount, tokenCountMax, timeToFirstToken, timeToFirstTokenEmitted, timeToCancelled, isVisionRequest, isBYOK, isAuto }) {
81
- /* __GDPR__
82
- "response.cancelled" : {
83
- "owner": "digitarald",
84
- "comment": "Report canceled service responses for quality.",
85
- "model": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Model selection for the response" },
86
- "apiType": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "API type for the response- chat completions or responses" },
87
- "source": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Source for why the request was made" },
88
- "requestId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Id of the request" },
89
- "associatedRequestId": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Another request ID that this request is associated with (eg, the originating request of a summarization request)." },
90
- "totalTokenMax": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Maximum total token window", "isMeasurement": true },
91
- "promptTokenCount": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Number of prompt tokens", "isMeasurement": true },
92
- "tokenCountMax": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Maximum generated tokens", "isMeasurement": true },
93
- "timeToFirstToken": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Time to first token", "isMeasurement": true },
94
- "timeToFirstTokenEmitted": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Time to first token emitted (visible text)", "isMeasurement": true },
95
- "timeToCancelled": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Time to first token", "isMeasurement": true },
96
- "isVisionRequest": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Whether the request was for a vision model", "isMeasurement": true },
97
- "isBYOK": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the request was for a BYOK model", "isMeasurement": true },
98
- "isAuto": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the request was for an Auto model", "isMeasurement": true },
99
- "retryAfterErrorCategory": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "If the response failed and this is a retry attempt, this contains the error category." },
100
- "retryAfterFilterCategory": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "If the response was filtered and this is a retry attempt, this contains the original filtered content category." }
101
- }
102
- */
103
- telemetryService.sendTelemetryEvent('response.cancelled', { github: true, microsoft: true }, {
104
- apiType,
105
- source,
106
- requestId,
107
- model,
108
- associatedRequestId,
109
- }, {
110
- totalTokenMax,
111
- promptTokenCount,
112
- tokenCountMax,
113
- timeToFirstToken,
114
- timeToFirstTokenEmitted,
115
- timeToCancelled,
116
- isVisionRequest,
117
- isBYOK,
118
- isAuto
119
- });
120
- }
121
- static sendResponseErrorTelemetry(telemetryService, processed, telemetryProperties, ourRequestId, chatEndpointInfo, requestBody, tokenCount, maxResponseTokens, timeToFirstToken, isVisionRequest) {
122
- /* __GDPR__
123
- "response.error" : {
124
- "owner": "digitarald",
125
- "comment": "Report quality issue for when a service response failed.",
126
- "type": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Type of issue" },
127
- "reason": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Reason of issue" },
128
- "model": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Model selection for the response" },
129
- "apiType": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "API type for the response- chat completions or responses" },
130
- "source": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Source for why the request was made" },
131
- "requestId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Id of the request" },
132
- "associatedRequestId": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Another request ID that this request is associated with (eg, the originating request of a summarization request)." },
133
- "reasoningEffort": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Reasoning effort level" },
134
- "reasoningSummary": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Reasoning summary level" },
135
- "totalTokenMax": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Maximum total token window", "isMeasurement": true },
136
- "promptTokenCount": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Number of prompt tokens", "isMeasurement": true },
137
- "tokenCountMax": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Maximum generated tokens", "isMeasurement": true },
138
- "timeToFirstToken": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Time to first token", "isMeasurement": true },
139
- "timeToFirstTokenEmitted": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Time to first token emitted (visible text)", "isMeasurement": true },
140
- "isVisionRequest": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Whether the request was for a vision model", "isMeasurement": true },
141
- "isBYOK": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the request was for a BYOK model", "isMeasurement": true },
142
- "isAuto": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the request was for an Auto model", "isMeasurement": true },
143
- "retryAfterErrorCategory": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "If the response failed and this is a retry attempt, this contains the error category." },
144
- "retryAfterFilterCategory": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "If the response was filtered and this is a retry attempt, this contains the original filtered content category." }
145
- }
146
- */
147
- telemetryService.sendTelemetryEvent('response.error', { github: true, microsoft: true }, {
148
- type: processed.type,
149
- reason: processed.reasonDetail || processed.reason,
150
- source: telemetryProperties?.messageSource ?? 'unknown',
151
- requestId: ourRequestId,
152
- model: chatEndpointInfo.model,
153
- apiType: chatEndpointInfo.apiType,
154
- reasoningEffort: requestBody.reasoning?.effort,
155
- reasoningSummary: requestBody.reasoning?.summary,
156
- associatedRequestId: telemetryProperties?.associatedRequestId,
157
- ...(telemetryProperties?.retryAfterErrorCategory ? { retryAfterErrorCategory: telemetryProperties.retryAfterErrorCategory } : {}),
158
- ...(telemetryProperties?.retryAfterFilterCategory ? { retryAfterFilterCategory: telemetryProperties.retryAfterFilterCategory } : {})
159
- }, {
160
- totalTokenMax: chatEndpointInfo.modelMaxPromptTokens ?? -1,
161
- promptTokenCount: tokenCount,
162
- tokenCountMax: maxResponseTokens,
163
- timeToFirstToken,
164
- isVisionRequest: isVisionRequest ? 1 : -1,
165
- isBYOK: (0, openAIEndpoint_1.isBYOKModel)(chatEndpointInfo),
166
- isAuto: (0, autoChatEndpoint_1.isAutoModel)(chatEndpointInfo)
167
- });
168
- }
169
- }
170
- exports.ChatMLFetcherTelemetrySender = ChatMLFetcherTelemetrySender;
171
- //# sourceMappingURL=chatMLFetcherTelemetry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chatMLFetcherTelemetry.js","sourceRoot":"","sources":["../../../../../../src/_internal/extension/prompt/node/chatMLFetcherTelemetry.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAGhG,uFAA+E;AAK/E,mEAA6D;AAoC7D,MAAa,4BAA4B;IAEjC,MAAM,CAAC,oBAAoB,CACjC,gBAAm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