@vscode/chat-lib 0.42.2026032703 → 0.43.2026033101
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/inlineEdits/common/editRebase.d.ts +4 -5
- package/dist/src/_internal/extension/inlineEdits/common/editRebase.d.ts.map +1 -1
- package/dist/src/_internal/extension/inlineEdits/common/editRebase.js +8 -3
- package/dist/src/_internal/extension/inlineEdits/common/editRebase.js.map +1 -1
- package/dist/src/_internal/extension/prompt/node/chatMLFetcher.d.ts +2 -0
- package/dist/src/_internal/extension/prompt/node/chatMLFetcher.d.ts.map +1 -1
- package/dist/src/_internal/extension/prompt/node/chatMLFetcher.js +149 -14
- package/dist/src/_internal/extension/prompt/node/chatMLFetcher.js.map +1 -1
- package/dist/src/_internal/platform/authentication/common/authentication.d.ts +14 -6
- package/dist/src/_internal/platform/authentication/common/authentication.d.ts.map +1 -1
- package/dist/src/_internal/platform/authentication/common/authentication.js.map +1 -1
- package/dist/src/_internal/platform/authentication/common/copilotToken.d.ts +6 -0
- package/dist/src/_internal/platform/authentication/common/copilotToken.d.ts.map +1 -1
- package/dist/src/_internal/platform/authentication/common/copilotToken.js +1 -0
- package/dist/src/_internal/platform/authentication/common/copilotToken.js.map +1 -1
- package/dist/src/_internal/platform/authentication/common/staticGitHubAuthenticationService.d.ts +4 -4
- package/dist/src/_internal/platform/authentication/common/staticGitHubAuthenticationService.d.ts.map +1 -1
- package/dist/src/_internal/platform/authentication/common/staticGitHubAuthenticationService.js.map +1 -1
- package/dist/src/_internal/platform/authentication/node/copilotTokenManager.d.ts.map +1 -1
- package/dist/src/_internal/platform/authentication/node/copilotTokenManager.js +1 -7
- package/dist/src/_internal/platform/authentication/node/copilotTokenManager.js.map +1 -1
- package/dist/src/_internal/platform/chat/common/chatQuotaService.d.ts +14 -0
- package/dist/src/_internal/platform/chat/common/chatQuotaService.d.ts.map +1 -1
- package/dist/src/_internal/platform/chat/common/chatQuotaService.js.map +1 -1
- package/dist/src/_internal/platform/chat/common/chatQuotaServiceImpl.d.ts +2 -1
- package/dist/src/_internal/platform/chat/common/chatQuotaServiceImpl.d.ts.map +1 -1
- package/dist/src/_internal/platform/chat/common/chatQuotaServiceImpl.js +24 -0
- package/dist/src/_internal/platform/chat/common/chatQuotaServiceImpl.js.map +1 -1
- package/dist/src/_internal/platform/chat/common/commonTypes.d.ts +1 -1
- package/dist/src/_internal/platform/chat/common/commonTypes.d.ts.map +1 -1
- package/dist/src/_internal/platform/configuration/common/configurationService.d.ts +2 -0
- package/dist/src/_internal/platform/configuration/common/configurationService.d.ts.map +1 -1
- package/dist/src/_internal/platform/configuration/common/configurationService.js +2 -0
- package/dist/src/_internal/platform/configuration/common/configurationService.js.map +1 -1
- package/dist/src/_internal/platform/endpoint/common/capiClient.d.ts.map +1 -1
- package/dist/src/_internal/platform/endpoint/common/capiClient.js +2 -1
- package/dist/src/_internal/platform/endpoint/common/capiClient.js.map +1 -1
- package/dist/src/_internal/platform/endpoint/common/chatModelCapabilities.d.ts +1 -0
- package/dist/src/_internal/platform/endpoint/common/chatModelCapabilities.d.ts.map +1 -1
- package/dist/src/_internal/platform/endpoint/common/chatModelCapabilities.js +11 -3
- package/dist/src/_internal/platform/endpoint/common/chatModelCapabilities.js.map +1 -1
- package/dist/src/_internal/platform/endpoint/common/endpointTypes.d.ts +1 -0
- package/dist/src/_internal/platform/endpoint/common/endpointTypes.d.ts.map +1 -1
- package/dist/src/_internal/platform/endpoint/common/endpointTypes.js +1 -0
- package/dist/src/_internal/platform/endpoint/common/endpointTypes.js.map +1 -1
- package/dist/src/_internal/platform/endpoint/common/phaseDataContainer.d.ts +8 -2
- package/dist/src/_internal/platform/endpoint/common/phaseDataContainer.d.ts.map +1 -1
- package/dist/src/_internal/platform/endpoint/common/phaseDataContainer.js +26 -2
- package/dist/src/_internal/platform/endpoint/common/phaseDataContainer.js.map +1 -1
- package/dist/src/_internal/platform/endpoint/common/responseOutputMessageIdContainer.d.ts +19 -0
- package/dist/src/_internal/platform/endpoint/common/responseOutputMessageIdContainer.d.ts.map +1 -0
- package/dist/src/_internal/platform/endpoint/common/responseOutputMessageIdContainer.js +64 -0
- package/dist/src/_internal/platform/endpoint/common/responseOutputMessageIdContainer.js.map +1 -0
- package/dist/src/_internal/platform/endpoint/node/chatEndpoint.js +1 -1
- package/dist/src/_internal/platform/endpoint/node/chatEndpoint.js.map +1 -1
- package/dist/src/_internal/platform/endpoint/node/messagesApi.d.ts +9 -0
- package/dist/src/_internal/platform/endpoint/node/messagesApi.d.ts.map +1 -1
- package/dist/src/_internal/platform/endpoint/node/messagesApi.js +31 -11
- package/dist/src/_internal/platform/endpoint/node/messagesApi.js.map +1 -1
- package/dist/src/_internal/platform/endpoint/node/responsesApi.d.ts.map +1 -1
- package/dist/src/_internal/platform/endpoint/node/responsesApi.js +19 -6
- package/dist/src/_internal/platform/endpoint/node/responsesApi.js.map +1 -1
- package/dist/src/_internal/platform/git/common/gitService.d.ts +5 -0
- package/dist/src/_internal/platform/git/common/gitService.d.ts.map +1 -1
- package/dist/src/_internal/platform/git/common/gitService.js.map +1 -1
- package/dist/src/_internal/platform/github/common/githubService.d.ts +6 -5
- package/dist/src/_internal/platform/github/common/githubService.d.ts.map +1 -1
- package/dist/src/_internal/platform/github/common/githubService.js +0 -3
- package/dist/src/_internal/platform/github/common/githubService.js.map +1 -1
- package/dist/src/_internal/platform/github/common/nullOctokitServiceImpl.d.ts +0 -1
- package/dist/src/_internal/platform/github/common/nullOctokitServiceImpl.d.ts.map +1 -1
- package/dist/src/_internal/platform/github/common/nullOctokitServiceImpl.js +0 -3
- package/dist/src/_internal/platform/github/common/nullOctokitServiceImpl.js.map +1 -1
- package/dist/src/_internal/platform/inlineEdits/common/inlineEditLogContext.d.ts +2 -0
- package/dist/src/_internal/platform/inlineEdits/common/inlineEditLogContext.d.ts.map +1 -1
- package/dist/src/_internal/platform/inlineEdits/common/inlineEditLogContext.js +5 -0
- package/dist/src/_internal/platform/inlineEdits/common/inlineEditLogContext.js.map +1 -1
- package/dist/src/_internal/platform/networking/common/fetch.d.ts +2 -0
- package/dist/src/_internal/platform/networking/common/fetch.d.ts.map +1 -1
- package/dist/src/_internal/platform/networking/common/fetch.js.map +1 -1
- package/dist/src/_internal/platform/networking/node/chatWebSocketManager.d.ts +47 -21
- package/dist/src/_internal/platform/networking/node/chatWebSocketManager.d.ts.map +1 -1
- package/dist/src/_internal/platform/networking/node/chatWebSocketManager.js +138 -58
- package/dist/src/_internal/platform/networking/node/chatWebSocketManager.js.map +1 -1
- package/dist/src/_internal/platform/networking/node/chatWebSocketTelemetry.d.ts +15 -11
- package/dist/src/_internal/platform/networking/node/chatWebSocketTelemetry.d.ts.map +1 -1
- package/dist/src/_internal/platform/networking/node/chatWebSocketTelemetry.js +22 -8
- package/dist/src/_internal/platform/networking/node/chatWebSocketTelemetry.js.map +1 -1
- package/dist/src/_internal/platform/otel/common/genAiAttributes.d.ts +20 -0
- package/dist/src/_internal/platform/otel/common/genAiAttributes.d.ts.map +1 -1
- package/dist/src/_internal/platform/otel/common/genAiAttributes.js +18 -0
- package/dist/src/_internal/platform/otel/common/genAiAttributes.js.map +1 -1
- package/dist/src/_internal/platform/otel/common/genAiEvents.d.ts +7 -0
- package/dist/src/_internal/platform/otel/common/genAiEvents.d.ts.map +1 -1
- package/dist/src/_internal/platform/otel/common/genAiEvents.js +74 -0
- package/dist/src/_internal/platform/otel/common/genAiEvents.js.map +1 -1
- package/dist/src/_internal/platform/otel/common/genAiMetrics.d.ts +18 -0
- package/dist/src/_internal/platform/otel/common/genAiMetrics.d.ts.map +1 -1
- package/dist/src/_internal/platform/otel/common/genAiMetrics.js +73 -0
- package/dist/src/_internal/platform/otel/common/genAiMetrics.js.map +1 -1
- package/dist/src/_internal/platform/otel/common/index.d.ts +1 -0
- package/dist/src/_internal/platform/otel/common/index.d.ts.map +1 -1
- package/dist/src/_internal/platform/otel/common/index.js +4 -1
- package/dist/src/_internal/platform/otel/common/index.js.map +1 -1
- package/dist/src/_internal/platform/otel/common/workspaceOTelMetadata.d.ts +18 -0
- package/dist/src/_internal/platform/otel/common/workspaceOTelMetadata.d.ts.map +1 -0
- package/dist/src/_internal/platform/otel/common/workspaceOTelMetadata.js +62 -0
- package/dist/src/_internal/platform/otel/common/workspaceOTelMetadata.js.map +1 -0
- package/dist/src/_internal/platform/requestLogger/common/capturingToken.d.ts +1 -13
- package/dist/src/_internal/platform/requestLogger/common/capturingToken.d.ts.map +1 -1
- package/dist/src/_internal/platform/requestLogger/common/capturingToken.js +1 -8
- package/dist/src/_internal/platform/requestLogger/common/capturingToken.js.map +1 -1
- package/dist/src/package.json +48 -13
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../../../../src/_internal/platform/networking/common/fetch.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACrG,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAyC,+BAA+B,EAAE,MAAM,UAAU,CAAC;AAKhI,MAAM,WAAW,SAAS;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,SAAS,CASrE;AAID,MAAM,WAAW,4BAA4B;IAC5C,OAAO,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;KACpB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,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,kEAAkE;IAClE,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,+BAA+B;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAE1B,SAAS,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAChC,aAAa,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACjC,KAAK,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC7B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG;QAAE,IAAI,EAAE,UAAU,CAAC;QAAC,QAAQ,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;IAEjF,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,oBAAoB;IACpB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../../../../src/_internal/platform/networking/common/fetch.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAmBhG,oCASC;AAmBD,kDAQC;AAED,4DAQC;AAyDD,sDAEC;
|
|
1
|
+
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../../../../src/_internal/platform/networking/common/fetch.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAmBhG,oCASC;AAmBD,kDAQC;AAED,4DAQC;AAyDD,sDAEC;AAuCD,8EAEC;AAED,oFAEC;AAiID,oDAEC;AAvSD,qCAAgI;AAchI,SAAgB,YAAY,CAAC,OAAiB,EAAE,IAAU;IACzD,OAAO;QACN,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,IAAI,SAAS,KAAK,IAAI;QACzD,KAAK,IAAI,SAAS,IAAI,SAAS,IAAI,SAAS,IAAI,OAAO,SAAS,CAAC,GAAG,KAAK,QAAQ,IAAI,OAAO,SAAS,CAAC,OAAO,KAAK,QAAQ,CAAC;AAC7H,CAAC;AAyDD,SAAgB,qBAAqB,CAAC,SAAkB;IACvD,OAAO,OAAO,SAAS,KAAK,QAAQ,IAAI,CAAC,CAAC,SAAS,IAAI,OAAO,IAAI,SAAS,IAAI,SAAS,IAAI,SAAS,IAAI,KAAK,IAAI,SAAS,CAAC;AAC7H,CAAC;AAuCD,SAAgB,iCAAiC,CAAC,KAAkE;IACnH,OAAO,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,8CAAqC,CAAC;AAChF,CAAC;AAED,SAAgB,oCAAoC,CAAC,KAAkE;IACtH,OAAO,eAAe,IAAI,KAAK,CAAC;AACjC,CAAC;AAiID,SAAgB,oBAAoB,CAAC,IAA8E;IAClH,OAAQ,IAA2B,CAAC,QAAQ,KAAK,SAAS,CAAC;AAC5D,CAAC"}
|
|
@@ -2,6 +2,8 @@ import type { OpenAI } from 'openai';
|
|
|
2
2
|
import { CancellationToken } from '../../../util/vs/base/common/cancellation';
|
|
3
3
|
import { Event } from '../../../util/vs/base/common/event';
|
|
4
4
|
import { Disposable, IDisposable } from '../../../util/vs/base/common/lifecycle';
|
|
5
|
+
import { QuotaSnapshots } from '../../chat/common/chatQuotaService';
|
|
6
|
+
import { IConfigurationService } from '../../configuration/common/configurationService';
|
|
5
7
|
import { ICAPIClientService } from '../../endpoint/common/capiClient';
|
|
6
8
|
import { ILogService } from '../../log/common/logService';
|
|
7
9
|
import { ITelemetryService } from '../../telemetry/common/telemetry';
|
|
@@ -11,23 +13,21 @@ export declare const IChatWebSocketManager: import("../../../util/common/service
|
|
|
11
13
|
export interface IChatWebSocketManager {
|
|
12
14
|
readonly _serviceBrand: undefined;
|
|
13
15
|
/**
|
|
14
|
-
* Gets or creates a WebSocket connection for the given conversation
|
|
15
|
-
* The connection is
|
|
16
|
-
*
|
|
16
|
+
* Gets or creates a WebSocket connection for the given conversation.
|
|
17
|
+
* The connection is shared across turns and tool call rounds within
|
|
18
|
+
* the same conversation, keeping server-side context alive.
|
|
17
19
|
*/
|
|
18
|
-
getOrCreateConnection(conversationId: string,
|
|
20
|
+
getOrCreateConnection(conversationId: string, headers: Record<string, string>): IChatWebSocketConnection;
|
|
19
21
|
/**
|
|
20
22
|
* Returns true if there is an open WebSocket connection for the given
|
|
21
|
-
* conversation
|
|
22
|
-
*
|
|
23
|
+
* conversation. Used to decide whether the server already has context
|
|
24
|
+
* from earlier requests in this conversation.
|
|
23
25
|
*/
|
|
24
|
-
hasActiveConnection(conversationId: string
|
|
26
|
+
hasActiveConnection(conversationId: string): boolean;
|
|
25
27
|
/**
|
|
26
28
|
* Closes and removes the connection for a specific conversation.
|
|
27
|
-
* When turnId is provided, the connection is only closed if it matches
|
|
28
|
-
* the currently tracked run for that conversation.
|
|
29
29
|
*/
|
|
30
|
-
closeConnection(conversationId: string
|
|
30
|
+
closeConnection(conversationId: string): void;
|
|
31
31
|
/**
|
|
32
32
|
* Closes all active connections.
|
|
33
33
|
*/
|
|
@@ -38,13 +38,14 @@ export interface IChatWebSocketManager {
|
|
|
38
38
|
*/
|
|
39
39
|
export declare class NullChatWebSocketManager implements IChatWebSocketManager {
|
|
40
40
|
readonly _serviceBrand: undefined;
|
|
41
|
-
getOrCreateConnection(_conversationId: string,
|
|
42
|
-
hasActiveConnection(_conversationId: string
|
|
43
|
-
closeConnection(_conversationId: string
|
|
41
|
+
getOrCreateConnection(_conversationId: string, _headers?: Record<string, string>): IChatWebSocketConnection;
|
|
42
|
+
hasActiveConnection(_conversationId: string): boolean;
|
|
43
|
+
closeConnection(_conversationId: string): void;
|
|
44
44
|
closeAll(): void;
|
|
45
45
|
}
|
|
46
46
|
export interface IChatWebSocketRequestOptions {
|
|
47
47
|
userInitiated: boolean;
|
|
48
|
+
turnId: string;
|
|
48
49
|
}
|
|
49
50
|
export interface IChatWebSocketConnection extends IDisposable {
|
|
50
51
|
/** Opens the WebSocket connection. Must be called before sendRequest. */
|
|
@@ -71,25 +72,50 @@ export interface IChatWebSocketConnection extends IDisposable {
|
|
|
71
72
|
readonly statefulMarker: string | undefined;
|
|
72
73
|
}
|
|
73
74
|
export interface IChatWebSocketRequestHandle {
|
|
74
|
-
/** Fires for each
|
|
75
|
+
/** Fires for each OpenAI stream event received from the server. */
|
|
75
76
|
readonly onEvent: Event<OpenAI.Responses.ResponseStreamEvent>;
|
|
76
|
-
/** Fires when
|
|
77
|
+
/** Fires when a CAPI WebSocket error is received (nested error shape). */
|
|
78
|
+
readonly onCAPIError: Event<CAPIWebSocketErrorEvent>;
|
|
79
|
+
/** Fires when a transport-level error occurs (connection lost, etc.). */
|
|
77
80
|
readonly onError: Event<Error>;
|
|
78
|
-
/**
|
|
79
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Resolves with the first event received from the server, or rejects
|
|
83
|
+
* if the connection errors/closes before any event arrives.
|
|
84
|
+
* Consumers can inspect the event type to decide the response kind
|
|
85
|
+
* (success stream vs. CAPI error) before processing remaining events.
|
|
86
|
+
*/
|
|
87
|
+
readonly firstEvent: Promise<OpenAI.Responses.ResponseStreamEvent | CAPIWebSocketErrorEvent>;
|
|
80
88
|
/** Resolves when the request has finished (completed or errored). */
|
|
81
89
|
readonly done: Promise<void>;
|
|
82
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* CAPI WebSocket error shape. Unlike the OpenAI SDK's flat `ResponseErrorEvent`
|
|
93
|
+
* (`{ type: "error", code, message }`), CAPI wraps the error details in a
|
|
94
|
+
* nested `error` object: `{ type: "error", error: { code, message } }`.
|
|
95
|
+
*
|
|
96
|
+
* Non-recoverable errors (rate limits, quota, upstream failures) also include
|
|
97
|
+
* `copilot_quota_snapshots` with per-model quota state.
|
|
98
|
+
*/
|
|
99
|
+
export interface CAPIWebSocketErrorEvent {
|
|
100
|
+
readonly type: 'error';
|
|
101
|
+
readonly error: {
|
|
102
|
+
readonly code: string;
|
|
103
|
+
readonly message: string;
|
|
104
|
+
};
|
|
105
|
+
readonly copilot_quota_snapshots?: QuotaSnapshots;
|
|
106
|
+
}
|
|
107
|
+
export declare function isCAPIWebSocketError(event: OpenAI.Responses.ResponseStreamEvent | CAPIWebSocketErrorEvent): event is CAPIWebSocketErrorEvent;
|
|
83
108
|
export declare class ChatWebSocketManager extends Disposable implements IChatWebSocketManager {
|
|
84
109
|
private readonly _logService;
|
|
85
110
|
private readonly _capiClientService;
|
|
86
111
|
private readonly _telemetryService;
|
|
112
|
+
private readonly _configurationService;
|
|
87
113
|
readonly _serviceBrand: undefined;
|
|
88
114
|
private readonly _connections;
|
|
89
|
-
constructor(_logService: ILogService, _capiClientService: ICAPIClientService, _telemetryService: ITelemetryService);
|
|
90
|
-
getOrCreateConnection(conversationId: string,
|
|
91
|
-
hasActiveConnection(conversationId: string
|
|
92
|
-
closeConnection(conversationId: string
|
|
115
|
+
constructor(_logService: ILogService, _capiClientService: ICAPIClientService, _telemetryService: ITelemetryService, _configurationService: IConfigurationService);
|
|
116
|
+
getOrCreateConnection(conversationId: string, headers: Record<string, string>): IChatWebSocketConnection;
|
|
117
|
+
hasActiveConnection(conversationId: string): boolean;
|
|
118
|
+
closeConnection(conversationId: string): void;
|
|
93
119
|
closeAll(): void;
|
|
94
120
|
dispose(): void;
|
|
95
121
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatWebSocketManager.d.ts","sourceRoot":"","sources":["../../../../../../src/_internal/platform/networking/node/chatWebSocketManager.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAE9E,OAAO,EAAW,KAAK,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAiC,MAAM,6BAA6B,CAAC;AACzF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAe,QAAQ,EAAuB,MAAM,0BAA0B,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD,eAAO,MAAM,qBAAqB,kFAA0E,CAAC;AAE7G,MAAM,WAAW,qBAAqB;IACrC,QAAQ,CAAC,aAAa,EAAE,SAAS,CAAC;IAElC;;;;OAIG;IACH,qBAAqB,CAAC,cAAc,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"chatWebSocketManager.d.ts","sourceRoot":"","sources":["../../../../../../src/_internal/platform/networking/node/chatWebSocketManager.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAE9E,OAAO,EAAW,KAAK,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAa,qBAAqB,EAAE,MAAM,iDAAiD,CAAC;AACnG,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAiC,MAAM,6BAA6B,CAAC;AACzF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAe,QAAQ,EAAuB,MAAM,0BAA0B,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD,eAAO,MAAM,qBAAqB,kFAA0E,CAAC;AAE7G,MAAM,WAAW,qBAAqB;IACrC,QAAQ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AAkB;IACpC,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAC9B,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IAR9D,SAAiB,aAAa,EAAE,SAAS,CAAC;IAE1C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA8C;gBAG5C,WAAW,EAAE,WAAW,EACjB,kBAAkB,EAAE,kBAAkB,EACvC,iBAAiB,EAAE,iBAAiB,EAChC,qBAAqB,EAAE,qBAAqB;IAKrF,qBAAqB,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,wBAAwB;IA6BxG,mBAAmB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO;IAKpD,eAAe,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI;IAa7C,QAAQ,IAAI,IAAI;IAOP,OAAO,IAAI,IAAI;CAIxB"}
|
|
@@ -14,10 +14,12 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
14
14
|
};
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.ChatWebSocketManager = exports.NullChatWebSocketManager = exports.IChatWebSocketManager = void 0;
|
|
17
|
+
exports.isCAPIWebSocketError = isCAPIWebSocketError;
|
|
17
18
|
const services_1 = require("../../../util/common/services");
|
|
18
19
|
const errors_1 = require("../../../util/vs/base/common/errors");
|
|
19
20
|
const event_1 = require("../../../util/vs/base/common/event");
|
|
20
21
|
const lifecycle_1 = require("../../../util/vs/base/common/lifecycle");
|
|
22
|
+
const configurationService_1 = require("../../configuration/common/configurationService");
|
|
21
23
|
const capiClient_1 = require("../../endpoint/common/capiClient");
|
|
22
24
|
const logService_1 = require("../../log/common/logService");
|
|
23
25
|
const telemetry_1 = require("../../telemetry/common/telemetry");
|
|
@@ -28,65 +30,79 @@ exports.IChatWebSocketManager = (0, services_1.createServiceIdentifier)('IChatWe
|
|
|
28
30
|
* No-op implementation for contexts where WebSocket is not available (web, tests, chat-lib).
|
|
29
31
|
*/
|
|
30
32
|
class NullChatWebSocketManager {
|
|
31
|
-
getOrCreateConnection(_conversationId,
|
|
33
|
+
getOrCreateConnection(_conversationId, _headers) {
|
|
32
34
|
throw new Error('WebSocket not available');
|
|
33
35
|
}
|
|
34
|
-
hasActiveConnection(_conversationId
|
|
35
|
-
closeConnection(_conversationId
|
|
36
|
+
hasActiveConnection(_conversationId) { return false; }
|
|
37
|
+
closeConnection(_conversationId) { }
|
|
36
38
|
closeAll() { }
|
|
37
39
|
}
|
|
38
40
|
exports.NullChatWebSocketManager = NullChatWebSocketManager;
|
|
41
|
+
function isCAPIWebSocketError(event) {
|
|
42
|
+
return event.type === 'error' && 'error' in event && typeof event.error?.code === 'string';
|
|
43
|
+
}
|
|
44
|
+
const streamTerminatingOutcomes = {
|
|
45
|
+
'response.completed': 'completed',
|
|
46
|
+
'response.failed': 'response_failed',
|
|
47
|
+
'response.incomplete': 'response_incomplete',
|
|
48
|
+
'response.cancelled': 'response_cancelled',
|
|
49
|
+
'error': 'upstream_error',
|
|
50
|
+
};
|
|
51
|
+
function getStreamTerminatingOutcome(event) {
|
|
52
|
+
return streamTerminatingOutcomes[event.type];
|
|
53
|
+
}
|
|
39
54
|
let ChatWebSocketManager = class ChatWebSocketManager extends lifecycle_1.Disposable {
|
|
40
|
-
constructor(_logService, _capiClientService, _telemetryService) {
|
|
55
|
+
constructor(_logService, _capiClientService, _telemetryService, _configurationService) {
|
|
41
56
|
super();
|
|
42
57
|
this._logService = _logService;
|
|
43
58
|
this._capiClientService = _capiClientService;
|
|
44
59
|
this._telemetryService = _telemetryService;
|
|
60
|
+
this._configurationService = _configurationService;
|
|
45
61
|
this._connections = new Map();
|
|
46
62
|
}
|
|
47
|
-
getOrCreateConnection(conversationId,
|
|
63
|
+
getOrCreateConnection(conversationId, headers) {
|
|
48
64
|
const existing = this._connections.get(conversationId);
|
|
49
|
-
// Reuse the connection if it's
|
|
50
|
-
if (existing?.
|
|
51
|
-
|
|
52
|
-
return existing.connection;
|
|
65
|
+
// Reuse the connection if it's still open, even across turns.
|
|
66
|
+
if (existing?.isOpen) {
|
|
67
|
+
return existing;
|
|
53
68
|
}
|
|
54
69
|
if (existing) {
|
|
55
|
-
this._logService.debug(`[ChatWebSocketManager]
|
|
56
|
-
existing.
|
|
70
|
+
this._logService.debug(`[ChatWebSocketManager] Replacing closed connection for conversation ${conversationId}`);
|
|
71
|
+
existing.dispose();
|
|
57
72
|
this._connections.delete(conversationId);
|
|
58
73
|
}
|
|
59
|
-
const connection = new ChatWebSocketConnection(this._capiClientService, this._logService, this._telemetryService,
|
|
60
|
-
this._logService.debug(`[ChatWebSocketManager] Creating new connection for conversation ${conversationId}
|
|
61
|
-
this._connections.set(conversationId,
|
|
74
|
+
const connection = new ChatWebSocketConnection(this._capiClientService, this._logService, this._telemetryService, this._configurationService, conversationId, headers);
|
|
75
|
+
this._logService.debug(`[ChatWebSocketManager] Creating new connection for conversation ${conversationId}`);
|
|
76
|
+
this._connections.set(conversationId, connection);
|
|
62
77
|
// Remove from map when disposed externally
|
|
63
78
|
connection.onDidDispose(() => {
|
|
64
79
|
const entry = this._connections.get(conversationId);
|
|
65
|
-
if (entry
|
|
80
|
+
if (entry === connection) {
|
|
66
81
|
this._connections.delete(conversationId);
|
|
67
82
|
}
|
|
68
83
|
});
|
|
69
84
|
return connection;
|
|
70
85
|
}
|
|
71
|
-
hasActiveConnection(conversationId
|
|
72
|
-
const
|
|
73
|
-
return !!
|
|
86
|
+
hasActiveConnection(conversationId) {
|
|
87
|
+
const connection = this._connections.get(conversationId);
|
|
88
|
+
return !!connection?.isOpen;
|
|
74
89
|
}
|
|
75
|
-
closeConnection(conversationId
|
|
76
|
-
const
|
|
77
|
-
if (
|
|
78
|
-
if (
|
|
79
|
-
this._logService.
|
|
80
|
-
return;
|
|
90
|
+
closeConnection(conversationId) {
|
|
91
|
+
const connection = this._connections.get(conversationId);
|
|
92
|
+
if (connection) {
|
|
93
|
+
if (connection.hasActiveRequest) {
|
|
94
|
+
this._logService.warn(`[ChatWebSocketManager] Closing connection for conversation ${conversationId} while turn ${connection.turnId} still has an active request`);
|
|
81
95
|
}
|
|
82
|
-
|
|
83
|
-
|
|
96
|
+
else {
|
|
97
|
+
this._logService.debug(`[ChatWebSocketManager] Closing connection for conversation ${conversationId}`);
|
|
98
|
+
}
|
|
99
|
+
connection.dispose();
|
|
84
100
|
this._connections.delete(conversationId);
|
|
85
101
|
}
|
|
86
102
|
}
|
|
87
103
|
closeAll() {
|
|
88
|
-
for (const
|
|
89
|
-
|
|
104
|
+
for (const connection of this._connections.values()) {
|
|
105
|
+
connection.dispose();
|
|
90
106
|
}
|
|
91
107
|
this._connections.clear();
|
|
92
108
|
}
|
|
@@ -99,7 +115,8 @@ exports.ChatWebSocketManager = ChatWebSocketManager;
|
|
|
99
115
|
exports.ChatWebSocketManager = ChatWebSocketManager = __decorate([
|
|
100
116
|
__param(0, logService_1.ILogService),
|
|
101
117
|
__param(1, capiClient_1.ICAPIClientService),
|
|
102
|
-
__param(2, telemetry_1.ITelemetryService)
|
|
118
|
+
__param(2, telemetry_1.ITelemetryService),
|
|
119
|
+
__param(3, configurationService_1.IConfigurationService)
|
|
103
120
|
], ChatWebSocketManager);
|
|
104
121
|
function wsCloseCodeToString(code) {
|
|
105
122
|
switch (code) {
|
|
@@ -122,13 +139,13 @@ function wsCloseCodeToString(code) {
|
|
|
122
139
|
}
|
|
123
140
|
}
|
|
124
141
|
class ChatWebSocketConnection extends lifecycle_1.Disposable {
|
|
125
|
-
constructor(_capiClientService, _logService, _telemetryService,
|
|
142
|
+
constructor(_capiClientService, _logService, _telemetryService, _configurationService, _conversationId, _headers) {
|
|
126
143
|
super();
|
|
127
144
|
this._capiClientService = _capiClientService;
|
|
128
145
|
this._logService = _logService;
|
|
129
146
|
this._telemetryService = _telemetryService;
|
|
147
|
+
this._configurationService = _configurationService;
|
|
130
148
|
this._conversationId = _conversationId;
|
|
131
|
-
this._turnId = _turnId;
|
|
132
149
|
this._headers = _headers;
|
|
133
150
|
this._state = 2 /* ConnectionState.Closed */;
|
|
134
151
|
this._onDidDispose = this._register(new event_1.Emitter());
|
|
@@ -138,10 +155,17 @@ class ChatWebSocketConnection extends lifecycle_1.Disposable {
|
|
|
138
155
|
this._totalSentCharacters = 0;
|
|
139
156
|
this._totalReceivedCharacters = 0;
|
|
140
157
|
this._responseHeaders = new fetcherService_1.HeadersImpl({});
|
|
158
|
+
this._hadActiveRequest = false;
|
|
141
159
|
}
|
|
142
160
|
get isOpen() {
|
|
143
161
|
return this._state === 1 /* ConnectionState.Open */ && !!this._ws;
|
|
144
162
|
}
|
|
163
|
+
get hasActiveRequest() {
|
|
164
|
+
return !!this._activeRequest;
|
|
165
|
+
}
|
|
166
|
+
get turnId() {
|
|
167
|
+
return this._turnId;
|
|
168
|
+
}
|
|
145
169
|
get statefulMarker() {
|
|
146
170
|
return this._statefulMarker;
|
|
147
171
|
}
|
|
@@ -166,7 +190,7 @@ class ChatWebSocketConnection extends lifecycle_1.Disposable {
|
|
|
166
190
|
}
|
|
167
191
|
this._state = 0 /* ConnectionState.Connecting */;
|
|
168
192
|
this._connectStartTime = Date.now();
|
|
169
|
-
this._logService.debug(`[ChatWebSocketManager] Connecting WebSocket for conversation ${this._conversationId}
|
|
193
|
+
this._logService.debug(`[ChatWebSocketManager] Connecting WebSocket for conversation ${this._conversationId}`);
|
|
170
194
|
const connection = await this._capiClientService.createResponsesWebSocket({
|
|
171
195
|
headers: this._headers,
|
|
172
196
|
});
|
|
@@ -182,10 +206,9 @@ class ChatWebSocketConnection extends lifecycle_1.Disposable {
|
|
|
182
206
|
this._responseStatusText = connection.responseStatusText;
|
|
183
207
|
this._setupMessageHandlers(ws);
|
|
184
208
|
const connectDurationMs = this._connectedTime - (this._connectStartTime ?? this._connectedTime);
|
|
185
|
-
this._logService.debug(`[ChatWebSocketManager] Connected for conversation ${this._conversationId}
|
|
209
|
+
this._logService.debug(`[ChatWebSocketManager] Connected for conversation ${this._conversationId}`);
|
|
186
210
|
chatWebSocketTelemetry_1.ChatWebSocketTelemetrySender.sendConnectedTelemetry(this._telemetryService, {
|
|
187
211
|
conversationId: this._conversationId,
|
|
188
|
-
turnId: this._turnId,
|
|
189
212
|
requestId: this.requestId,
|
|
190
213
|
gitHubRequestId: this.gitHubRequestId,
|
|
191
214
|
connectDurationMs,
|
|
@@ -200,10 +223,9 @@ class ChatWebSocketConnection extends lifecycle_1.Disposable {
|
|
|
200
223
|
this._responseStatusText = connection.responseStatusText;
|
|
201
224
|
const errorMessage = event.error ? `${event.message}: ${(0, logService_1.collectSingleLineErrorMessage)(event.error)}` : event.message || 'WebSocket error';
|
|
202
225
|
const connectDurationMs = Date.now() - (this._connectStartTime ?? Date.now());
|
|
203
|
-
this._logService.error(`[ChatWebSocketManager] Connection error for conversation ${this._conversationId}
|
|
226
|
+
this._logService.error(`[ChatWebSocketManager] Connection error for conversation ${this._conversationId}: ${errorMessage}`);
|
|
204
227
|
chatWebSocketTelemetry_1.ChatWebSocketTelemetrySender.sendConnectErrorTelemetry(this._telemetryService, {
|
|
205
228
|
conversationId: this._conversationId,
|
|
206
|
-
turnId: this._turnId,
|
|
207
229
|
requestId: this.requestId,
|
|
208
230
|
gitHubRequestId: this.gitHubRequestId,
|
|
209
231
|
error: errorMessage,
|
|
@@ -221,10 +243,9 @@ class ChatWebSocketConnection extends lifecycle_1.Disposable {
|
|
|
221
243
|
this._responseStatusText = connection.responseStatusText;
|
|
222
244
|
const connectDurationMs = Date.now() - (this._connectStartTime ?? Date.now());
|
|
223
245
|
const closeCodeDescription = wsCloseCodeToString(event.code);
|
|
224
|
-
this._logService.debug(`[ChatWebSocketManager] Connection closed during setup for conversation ${this._conversationId}
|
|
246
|
+
this._logService.debug(`[ChatWebSocketManager] Connection closed during setup for conversation ${this._conversationId} (code: ${event.code} ${closeCodeDescription}, reason: ${event.reason || '<empty>'}, wasClean: ${event.wasClean})`);
|
|
225
247
|
chatWebSocketTelemetry_1.ChatWebSocketTelemetrySender.sendCloseDuringSetupTelemetry(this._telemetryService, {
|
|
226
248
|
conversationId: this._conversationId,
|
|
227
|
-
turnId: this._turnId,
|
|
228
249
|
requestId: this.requestId,
|
|
229
250
|
gitHubRequestId: this.gitHubRequestId,
|
|
230
251
|
closeCode: event.code,
|
|
@@ -264,6 +285,8 @@ class ChatWebSocketConnection extends lifecycle_1.Disposable {
|
|
|
264
285
|
chatWebSocketTelemetry_1.ChatWebSocketTelemetrySender.sendMessageParseErrorTelemetry(this._telemetryService, {
|
|
265
286
|
conversationId: this._conversationId,
|
|
266
287
|
turnId: this._turnId,
|
|
288
|
+
previousTurnId: this._previousTurnId,
|
|
289
|
+
hadActiveRequest: this._hadActiveRequest,
|
|
267
290
|
requestId: this.requestId,
|
|
268
291
|
gitHubRequestId: this.gitHubRequestId,
|
|
269
292
|
error: parseErrorMessage,
|
|
@@ -276,7 +299,7 @@ class ChatWebSocketConnection extends lifecycle_1.Disposable {
|
|
|
276
299
|
});
|
|
277
300
|
return;
|
|
278
301
|
}
|
|
279
|
-
if (parsed.type === 'response.completed') {
|
|
302
|
+
if (!isCAPIWebSocketError(parsed) && parsed.type === 'response.completed') {
|
|
280
303
|
this._statefulMarker = parsed.response.id;
|
|
281
304
|
}
|
|
282
305
|
this._activeRequest?.handleEvent(parsed);
|
|
@@ -289,6 +312,8 @@ class ChatWebSocketConnection extends lifecycle_1.Disposable {
|
|
|
289
312
|
chatWebSocketTelemetry_1.ChatWebSocketTelemetrySender.sendCloseTelemetry(this._telemetryService, {
|
|
290
313
|
conversationId: this._conversationId,
|
|
291
314
|
turnId: this._turnId,
|
|
315
|
+
previousTurnId: this._previousTurnId,
|
|
316
|
+
hadActiveRequest: this._hadActiveRequest,
|
|
292
317
|
requestId: this.requestId,
|
|
293
318
|
gitHubRequestId: this.gitHubRequestId,
|
|
294
319
|
closeCode: event.code,
|
|
@@ -313,6 +338,8 @@ class ChatWebSocketConnection extends lifecycle_1.Disposable {
|
|
|
313
338
|
chatWebSocketTelemetry_1.ChatWebSocketTelemetrySender.sendErrorTelemetry(this._telemetryService, {
|
|
314
339
|
conversationId: this._conversationId,
|
|
315
340
|
turnId: this._turnId,
|
|
341
|
+
previousTurnId: this._previousTurnId,
|
|
342
|
+
hadActiveRequest: this._hadActiveRequest,
|
|
316
343
|
requestId: this.requestId,
|
|
317
344
|
gitHubRequestId: this.gitHubRequestId,
|
|
318
345
|
error: errorMessage,
|
|
@@ -340,15 +367,33 @@ class ChatWebSocketConnection extends lifecycle_1.Disposable {
|
|
|
340
367
|
else {
|
|
341
368
|
this._logService.info(`[ChatWebSocketManager] WebSocket stateful marker (${statefulMarkerPrefix}) does not match previous_response_id (${previousResponsePrefix})`);
|
|
342
369
|
}
|
|
343
|
-
//
|
|
344
|
-
this._activeRequest
|
|
370
|
+
// Supersede any in-flight request before updating turn state
|
|
371
|
+
const hadActiveRequest = !!this._activeRequest;
|
|
372
|
+
if (hadActiveRequest) {
|
|
373
|
+
this._logService.warn(`[ChatWebSocketManager] New request for conversation ${this._conversationId} turn ${options.turnId} while turn ${this._turnId} still has an active request`);
|
|
374
|
+
this._activeRequest.handleSuperseded();
|
|
375
|
+
}
|
|
376
|
+
else {
|
|
377
|
+
this._logService.debug(`[ChatWebSocketManager] New request for conversation ${this._conversationId} turn ${options.turnId} (previous turn: ${this._turnId})`);
|
|
378
|
+
}
|
|
379
|
+
// Update turn state after superseding so the old request's settle
|
|
380
|
+
// callback (which fires synchronously from handleSuperseded) still
|
|
381
|
+
// sees its own turnId on `this`.
|
|
382
|
+
const previousTurnId = this._turnId;
|
|
383
|
+
const turnId = options.turnId;
|
|
384
|
+
this._previousTurnId = previousTurnId;
|
|
385
|
+
this._turnId = turnId;
|
|
386
|
+
this._hadActiveRequest = hadActiveRequest;
|
|
345
387
|
const requestStartTime = Date.now();
|
|
346
388
|
const requestStartSentMessageCount = this._totalSentMessageCount;
|
|
347
389
|
const requestStartReceivedMessageCount = this._totalReceivedMessageCount;
|
|
348
390
|
const requestStartSentCharacters = this._totalSentCharacters;
|
|
349
391
|
const requestStartReceivedCharacters = this._totalReceivedCharacters;
|
|
350
|
-
const request = new ChatWebSocketActiveRequest();
|
|
392
|
+
const request = new ChatWebSocketActiveRequest(this._configurationService, this._logService);
|
|
351
393
|
request.onDidSettle(({ outcome, closeCode, closeReason, serverErrorMessage, serverErrorCode }) => {
|
|
394
|
+
if (this._activeRequest === request) {
|
|
395
|
+
this._activeRequest = undefined;
|
|
396
|
+
}
|
|
352
397
|
const connectionDurationMs = Date.now() - (this._connectedTime ?? Date.now());
|
|
353
398
|
const requestDurationMs = Date.now() - requestStartTime;
|
|
354
399
|
const requestSentMessageCount = this._totalSentMessageCount - requestStartSentMessageCount;
|
|
@@ -357,7 +402,9 @@ class ChatWebSocketConnection extends lifecycle_1.Disposable {
|
|
|
357
402
|
const requestReceivedCharacters = this._totalReceivedCharacters - requestStartReceivedCharacters;
|
|
358
403
|
chatWebSocketTelemetry_1.ChatWebSocketTelemetrySender.sendRequestOutcomeTelemetry(this._telemetryService, {
|
|
359
404
|
conversationId: this._conversationId,
|
|
360
|
-
turnId
|
|
405
|
+
turnId,
|
|
406
|
+
previousTurnId,
|
|
407
|
+
hadActiveRequest,
|
|
361
408
|
requestId: this.requestId,
|
|
362
409
|
gitHubRequestId: this.gitHubRequestId,
|
|
363
410
|
requestOutcome: outcome,
|
|
@@ -388,7 +435,7 @@ class ChatWebSocketConnection extends lifecycle_1.Disposable {
|
|
|
388
435
|
this._activeRequest = undefined;
|
|
389
436
|
}
|
|
390
437
|
});
|
|
391
|
-
request.done.finally(() => cancelDisposable.dispose());
|
|
438
|
+
request.done.finally(() => cancelDisposable.dispose()).catch(() => { });
|
|
392
439
|
const { stream: _, ...rest } = body;
|
|
393
440
|
const message = {
|
|
394
441
|
type: 'response.create',
|
|
@@ -403,7 +450,9 @@ class ChatWebSocketConnection extends lifecycle_1.Disposable {
|
|
|
403
450
|
this._logService.debug(`[ChatWebSocketManager] Sending request for conversation ${this._conversationId} turn ${this._turnId} (totalSentMessageCount: ${this._totalSentMessageCount}, sentMessageCharacters: ${sentMessageCharacters})`);
|
|
404
451
|
chatWebSocketTelemetry_1.ChatWebSocketTelemetrySender.sendRequestSentTelemetry(this._telemetryService, {
|
|
405
452
|
conversationId: this._conversationId,
|
|
406
|
-
turnId
|
|
453
|
+
turnId,
|
|
454
|
+
previousTurnId,
|
|
455
|
+
hadActiveRequest,
|
|
407
456
|
requestId: this.requestId,
|
|
408
457
|
gitHubRequestId: this.gitHubRequestId,
|
|
409
458
|
statefulMarkerMatched,
|
|
@@ -432,18 +481,25 @@ class ChatWebSocketConnection extends lifecycle_1.Disposable {
|
|
|
432
481
|
}
|
|
433
482
|
}
|
|
434
483
|
class ChatWebSocketActiveRequest {
|
|
435
|
-
constructor() {
|
|
484
|
+
constructor(_configurationService, _logService) {
|
|
485
|
+
this._configurationService = _configurationService;
|
|
486
|
+
this._logService = _logService;
|
|
436
487
|
this._onEvent = new event_1.Emitter();
|
|
437
488
|
this.onEvent = this._onEvent.event;
|
|
489
|
+
this._onCAPIError = new event_1.Emitter();
|
|
490
|
+
this.onCAPIError = this._onCAPIError.event;
|
|
438
491
|
this._onError = new event_1.Emitter();
|
|
439
492
|
this.onError = this._onError.event;
|
|
440
|
-
this.
|
|
441
|
-
this.onComplete = this._onComplete.event;
|
|
493
|
+
this._firstEventSettled = false;
|
|
442
494
|
this._settled = false;
|
|
443
495
|
this.done = new Promise((resolve, reject) => {
|
|
444
496
|
this._resolve = resolve;
|
|
445
497
|
this._reject = reject;
|
|
446
498
|
});
|
|
499
|
+
this.firstEvent = new Promise((resolve, reject) => {
|
|
500
|
+
this._resolveFirstEvent = resolve;
|
|
501
|
+
this._rejectFirstEvent = reject;
|
|
502
|
+
});
|
|
447
503
|
}
|
|
448
504
|
onDidSettle(callback) {
|
|
449
505
|
this._onDidSettle = callback;
|
|
@@ -452,18 +508,30 @@ class ChatWebSocketActiveRequest {
|
|
|
452
508
|
if (this._settled) {
|
|
453
509
|
return;
|
|
454
510
|
}
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
511
|
+
// E.g.: "github.copilot.chat.advanced.debug.simulateWebSocketResponse": "{\"type\":\"error\",\"error\":{\"code\":\"user_global_rate_limited:enterprise\",\"message\":\"Rate limit exceeded\"}}"
|
|
512
|
+
// E.g.: "github.copilot.chat.advanced.debug.simulateWebSocketResponse": "{\"type\":\"error\",\"error\":{\"code\":\"service_unavailable\",\"message\":\"service temporarily unavailable, please retry\"}}"
|
|
513
|
+
const simulateResponse = this._configurationService.getConfig(configurationService_1.ConfigKey.TeamInternal.DebugSimulateWebSocketResponse);
|
|
514
|
+
if (simulateResponse) {
|
|
515
|
+
try {
|
|
516
|
+
event = JSON.parse(simulateResponse);
|
|
517
|
+
this._logService.info(`[ChatWebSocketManager] Simulating WebSocket response event: ${simulateResponse}`);
|
|
518
|
+
}
|
|
519
|
+
catch (e) {
|
|
520
|
+
this._logService.error(`[ChatWebSocketManager] Failed to parse simulated WebSocket response: ${(0, logService_1.collectSingleLineErrorMessage)(e)}`);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
if (!this._firstEventSettled) {
|
|
524
|
+
this._firstEventSettled = true;
|
|
525
|
+
this._resolveFirstEvent(event);
|
|
526
|
+
}
|
|
527
|
+
if (isCAPIWebSocketError(event)) {
|
|
528
|
+
this._finalizeCAPIError(event);
|
|
461
529
|
return;
|
|
462
530
|
}
|
|
463
531
|
this._onEvent.fire(event);
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
this._finalizeSuccess(
|
|
532
|
+
const outcome = getStreamTerminatingOutcome(event);
|
|
533
|
+
if (outcome) {
|
|
534
|
+
this._finalizeSuccess(outcome);
|
|
467
535
|
}
|
|
468
536
|
}
|
|
469
537
|
handleConnectionClose(code, reason, errorMessage) {
|
|
@@ -499,7 +567,19 @@ class ChatWebSocketActiveRequest {
|
|
|
499
567
|
this._resolve();
|
|
500
568
|
this._dispose();
|
|
501
569
|
}
|
|
570
|
+
_finalizeCAPIError(event) {
|
|
571
|
+
const { code, message } = event.error;
|
|
572
|
+
this._onCAPIError.fire(event);
|
|
573
|
+
this._settled = true;
|
|
574
|
+
this._onDidSettle?.({ outcome: 'error_response', serverErrorMessage: message, serverErrorCode: code });
|
|
575
|
+
this._reject(new Error(`${message} (${code})`));
|
|
576
|
+
this._dispose();
|
|
577
|
+
}
|
|
502
578
|
_finalizeError(outcome, error, closeCode, closeReason, serverErrorMessage, serverErrorCode) {
|
|
579
|
+
if (!this._firstEventSettled) {
|
|
580
|
+
this._firstEventSettled = true;
|
|
581
|
+
this._rejectFirstEvent(error);
|
|
582
|
+
}
|
|
503
583
|
this._onError.fire(error);
|
|
504
584
|
this._settled = true;
|
|
505
585
|
this._onDidSettle?.({ outcome, closeCode, closeReason, serverErrorMessage, serverErrorCode });
|
|
@@ -508,8 +588,8 @@ class ChatWebSocketActiveRequest {
|
|
|
508
588
|
}
|
|
509
589
|
_dispose() {
|
|
510
590
|
this._onEvent.dispose();
|
|
591
|
+
this._onCAPIError.dispose();
|
|
511
592
|
this._onError.dispose();
|
|
512
|
-
this._onComplete.dispose();
|
|
513
593
|
}
|
|
514
594
|
}
|
|
515
595
|
//# sourceMappingURL=chatWebSocketManager.js.map
|