@codingame/monaco-vscode-chat-service-override 38.0.7 → 38.1.2

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 (144) hide show
  1. package/common.js +0 -53
  2. package/index.js +0 -3
  3. package/package.json +5 -5
  4. package/session.js +0 -3
  5. package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/missionControlAgentHostContribution.js +1 -1
  6. package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/remoteAgentHostActions.js +1 -1
  7. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostChatContribution.js +1 -1
  8. package/vscode/src/vs/workbench/contrib/chat/browser/chat.shared.contribution.js +6 -6
  9. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxSessionListController.d.ts +1 -1
  10. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxSessionListController.js +1 -1
  11. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/editorCloudSandboxContribution.d.ts +1 -1
  12. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/editorCloudSandboxContribution.js +2 -2
  13. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/missionControlEnvironmentActions.js +1 -1
  14. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/remoteAgentHost.contribution.js +7 -7
  15. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/remoteAgentHostChatContribution.js +4 -4
  16. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewTitleControl.js +1 -1
  17. package/vscode/src/vs/platform/agentHost/browser/webPubSubRelayTransport.d.ts +0 -135
  18. package/vscode/src/vs/platform/agentHost/browser/webPubSubRelayTransport.js +0 -510
  19. package/vscode/src/vs/platform/agentHost/common/agentModelNotices.d.ts +0 -22
  20. package/vscode/src/vs/platform/agentHost/common/agentModelNotices.js +0 -21
  21. package/vscode/src/vs/platform/agentHost/common/cloudSandboxAgentHost.d.ts +0 -273
  22. package/vscode/src/vs/platform/agentHost/common/cloudSandboxAgentHost.js +0 -61
  23. package/vscode/src/vs/platform/agentHost/common/meta/agentModelMeta.d.ts +0 -7
  24. package/vscode/src/vs/platform/agentHost/common/meta/agentModelMeta.js +0 -17
  25. package/vscode/src/vs/platform/agentHost/common/meta/copilotd/cloudSandboxProjectMeta.d.ts +0 -12
  26. package/vscode/src/vs/platform/agentHost/common/meta/copilotd/cloudSandboxProjectMeta.js +0 -48
  27. package/vscode/src/vs/platform/agentHost/common/meta/vscode/agentModelEnsembleMeta.d.ts +0 -8
  28. package/vscode/src/vs/platform/agentHost/common/meta/vscode/agentModelEnsembleMeta.js +0 -11
  29. package/vscode/src/vs/platform/agentHost/common/meta/vscode/agentModelPricing.d.ts +0 -114
  30. package/vscode/src/vs/platform/agentHost/common/meta/vscode/agentModelPricing.js +0 -141
  31. package/vscode/src/vs/platform/agentHost/common/taskEventReplay.d.ts +0 -48
  32. package/vscode/src/vs/platform/agentHost/common/taskEventReplay.js +0 -238
  33. package/vscode/src/vs/platform/agentHost/common/webPubSub/chunking.d.ts +0 -102
  34. package/vscode/src/vs/platform/agentHost/common/webPubSub/chunking.js +0 -260
  35. package/vscode/src/vs/platform/agentHost/common/webPubSub/framing.d.ts +0 -102
  36. package/vscode/src/vs/platform/agentHost/common/webPubSub/framing.js +0 -115
  37. package/vscode/src/vs/platform/agentHost/common/webPubSub/groups.d.ts +0 -46
  38. package/vscode/src/vs/platform/agentHost/common/webPubSub/groups.js +0 -92
  39. package/vscode/src/vs/sessions/contrib/chat/browser/newSession.d.ts +0 -9
  40. package/vscode/src/vs/sessions/contrib/chat/browser/voiceBridge.contribution.d.ts +0 -14
  41. package/vscode/src/vs/sessions/contrib/chat/browser/voiceBridge.contribution.js +0 -385
  42. package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/cloudAutomationStore.d.ts +0 -67
  43. package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/cloudAutomationStore.js +0 -695
  44. package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/cloudSandboxSessionConfig.d.ts +0 -4
  45. package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/cloudSandboxSessionConfig.js +0 -39
  46. package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessions.contribution.d.ts +0 -1
  47. package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessions.contribution.js +0 -59
  48. package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsActions.d.ts +0 -1
  49. package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsActions.js +0 -83
  50. package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsChangesets.d.ts +0 -87
  51. package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsChangesets.js +0 -176
  52. package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsProvider.d.ts +0 -422
  53. package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsProvider.js +0 -2444
  54. package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/githubCloudAutomationStore.d.ts +0 -91
  55. package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/githubCloudAutomationStore.js +0 -620
  56. package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/cloudSandboxAgentHost.contribution.d.ts +0 -1
  57. package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/cloudSandboxAgentHost.contribution.js +0 -5
  58. package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/cloudSandboxAgentHostContribution.d.ts +0 -46
  59. package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/cloudSandboxAgentHostContribution.js +0 -321
  60. package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/cloudSandboxSessionsProvider.d.ts +0 -104
  61. package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/cloudSandboxSessionsProvider.js +0 -345
  62. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoice.contribution.d.ts +0 -2
  63. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoice.contribution.js +0 -611
  64. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceSessionsPicker.d.ts +0 -20
  65. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceSessionsPicker.js +0 -85
  66. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidget.d.ts +0 -200
  67. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidget.js +0 -981
  68. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidgetBinding.d.ts +0 -24
  69. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidgetBinding.js +0 -206
  70. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWindowService.d.ts +0 -65
  71. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWindowService.js +0 -368
  72. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/confirmationComponent.d.ts +0 -10
  73. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/confirmationComponent.js +0 -57
  74. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/feedbackDialog.d.ts +0 -33
  75. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/feedbackDialog.js +0 -98
  76. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/headerComponent.d.ts +0 -32
  77. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/headerComponent.js +0 -186
  78. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/onboardingComponent.d.ts +0 -12
  79. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/onboardingComponent.js +0 -116
  80. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/sessionListComponent.d.ts +0 -32
  81. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/sessionListComponent.js +0 -226
  82. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/statusRowsComponent.d.ts +0 -18
  83. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/statusRowsComponent.js +0 -138
  84. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/tokens.d.ts +0 -32
  85. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/tokens.js +0 -29
  86. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/transcriptComponent.d.ts +0 -13
  87. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/transcriptComponent.js +0 -108
  88. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/voiceBarComponent.d.ts +0 -13
  89. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/voiceBarComponent.js +0 -63
  90. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/media/voiceModeOnboarding.css +0 -252
  91. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/transcriptsView/voiceTranscripts.contribution.d.ts +0 -1
  92. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/transcriptsView/voiceTranscripts.contribution.js +0 -178
  93. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/transcriptsView/voiceTranscriptsView.d.ts +0 -47
  94. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/transcriptsView/voiceTranscriptsView.js +0 -322
  95. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/voiceModeOnboarding.d.ts +0 -146
  96. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/voiceModeOnboarding.js +0 -890
  97. package/vscode/src/vs/workbench/contrib/agentsVoice/common/voiceTranscriptStore.d.ts +0 -132
  98. package/vscode/src/vs/workbench/contrib/agentsVoice/common/voiceTranscriptStore.js +0 -237
  99. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostLanguageModelProvider.d.ts +0 -120
  100. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostLanguageModelProvider.js +0 -234
  101. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsPicker.d.ts +0 -36
  102. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsPicker.js +0 -164
  103. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/repositoryPicker.d.ts +0 -21
  104. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/repositoryPicker.js +0 -122
  105. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupMicrosoftProbe.d.ts +0 -82
  106. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupMicrosoftProbe.js +0 -213
  107. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxAgentHostService.d.ts +0 -40
  108. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxAgentHostService.js +0 -561
  109. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxApiService.d.ts +0 -133
  110. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxApiService.js +0 -1176
  111. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxConnectionCustomization.d.ts +0 -17
  112. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxConnectionCustomization.js +0 -76
  113. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxCredentialRefresh.d.ts +0 -54
  114. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxCredentialRefresh.js +0 -220
  115. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxHistoryCache.d.ts +0 -21
  116. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxHistoryCache.js +0 -184
  117. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxLegacySessionPreparation.d.ts +0 -8
  118. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxLegacySessionPreparation.js +0 -165
  119. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxModels.d.ts +0 -43
  120. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxModels.js +0 -162
  121. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxReadOnlySessionHandler.d.ts +0 -40
  122. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxReadOnlySessionHandler.js +0 -129
  123. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxSessionContribution.d.ts +0 -166
  124. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxSessionContribution.js +0 -838
  125. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxSessionHandler.d.ts +0 -40
  126. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxSessionHandler.js +0 -604
  127. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxTelemetry.d.ts +0 -289
  128. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxTelemetry.js +0 -497
  129. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/missionControlCredentialSealing.d.ts +0 -6
  130. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/missionControlCredentialSealing.js +0 -41
  131. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/missionControlEnvironmentService.d.ts +0 -73
  132. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/missionControlEnvironmentService.js +0 -398
  133. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/missionControlSharingService.d.ts +0 -45
  134. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/missionControlSharingService.js +0 -296
  135. package/vscode/src/vs/workbench/contrib/chat/browser/speechToText/voiceCodeTranscriptionClient.d.ts +0 -63
  136. package/vscode/src/vs/workbench/contrib/chat/browser/speechToText/voiceCodeTranscriptionClient.js +0 -361
  137. package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/ttsPlaybackService.d.ts +0 -34
  138. package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/ttsPlaybackService.js +0 -198
  139. package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/voiceClientService.d.ts +0 -131
  140. package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/voiceClientService.js +0 -871
  141. package/vscode/src/vs/workbench/contrib/chat/browser/voiceInputMode/voiceInputMode.d.ts +0 -66
  142. package/vscode/src/vs/workbench/contrib/chat/browser/voiceInputMode/voiceInputMode.js +0 -297
  143. package/vscode/src/vs/workbench/contrib/chat/common/voicePlaybackService.d.ts +0 -31
  144. package/vscode/src/vs/workbench/contrib/chat/common/voicePlaybackService.js +0 -118
@@ -1,510 +0,0 @@
1
-
2
- import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
- import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
4
- import { Disposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
5
- import { IntervalTimer, RunOnceScheduler, disposableTimeout } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
6
- import { isObject, hasKey } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
7
- import { StopWatch } from '@codingame/monaco-vscode-api/vscode/vs/base/common/stopwatch';
8
- import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
9
- import { AgentHostClientConnectionKind } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentHostTelemetry';
10
- import { formatConnectionDiagnosticError, getConnectionDiagnosticError } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/connectionDiagnostics';
11
- import { getAhpLogByteLength } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/ahpJsonlLogger';
12
- import { isJsonRpcResponse } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/sessionProtocol';
13
- import { Reassembler } from '../common/webPubSub/chunking.js';
14
- import { RELIABLE_JSON_SUBPROTOCOL, parseInbound, buildPublish } from '../common/webPubSub/framing.js';
15
-
16
- const REASSEMBLY_SWEEP_INTERVAL_MS = 15_000;
17
- const WPS_TIMEOUT_MS = 30_000;
18
- const defaultWebSocketFactory = (url, subprotocol) => ( new WebSocket(url, subprotocol));
19
- const inboundDecoder = ( new TextDecoder("utf-8"));
20
- function frameDataToString(data) {
21
- if (typeof data === "string") {
22
- return data;
23
- }
24
- if (data instanceof ArrayBuffer) {
25
- return inboundDecoder.decode(data);
26
- }
27
- if (ArrayBuffer.isView(data)) {
28
- return inboundDecoder.decode(data);
29
- }
30
- return String(data);
31
- }
32
- let WebPubSubRelayTransport = class WebPubSubRelayTransport extends Disposable {
33
- get clientConnectionKind() {
34
- return this._options.clientConnectionKind ?? AgentHostClientConnectionKind.WebPubSub;
35
- }
36
- constructor(_options, _logService) {
37
- super();
38
- this._options = _options;
39
- this._logService = _logService;
40
- this._onMessage = this._register(( new Emitter()));
41
- this.onMessage = this._onMessage.event;
42
- this._onDidReceiveData = this._register(( new Emitter()));
43
- this.onDidReceiveData = this._onDidReceiveData.event;
44
- this._onClose = this._register(( new Emitter()));
45
- this.onClose = this._onClose.event;
46
- this._reassembler = ( new Reassembler());
47
- this._sweepTimer = this._register(( new IntervalTimer()));
48
- this._publishAckTimer = this._register(( new RunOnceScheduler(() => this._checkPublishAckTimeout(), WPS_TIMEOUT_MS)));
49
- this._handshakeTimer = this._register(( new RunOnceScheduler(() => {
50
- this._reportProtocolError("AHP handshake timed out", ( new Error("WPS host handshake timed out")), true);
51
- this._fireClose();
52
- }, WPS_TIMEOUT_MS)));
53
- this._ackId = 0;
54
- this._lastReceivedSequenceId = 0;
55
- this._pendingJoinAcks = ( new Map());
56
- this._pendingPublishAcks = ( new Map());
57
- this._closed = false;
58
- this._connectResolved = false;
59
- this._requests = ( new Set());
60
- this._closedBeforeHandshake = ( new Set());
61
- this._watch = StopWatch.create(false);
62
- this._publishAcknowledged = false;
63
- this._hostFrames = 0;
64
- this._hostMessages = 0;
65
- this._protocolErrors = 0;
66
- this._expiredAssemblies = 0;
67
- if (this._options.ahpLogger) {
68
- this._register(this._options.ahpLogger);
69
- }
70
- }
71
- get isOpen() {
72
- return this._ws !== undefined && !this._closed && this._connectResolved;
73
- }
74
- connect() {
75
- return ( new Promise((resolve, reject) => {
76
- if (this._store.isDisposed) {
77
- reject(( new Error("Transport is disposed")));
78
- return;
79
- }
80
- const factory = this._options.webSocketFactory ?? defaultWebSocketFactory;
81
- const ws = factory(this._options.url, RELIABLE_JSON_SUBPROTOCOL);
82
- this._ws = ws;
83
- const handshakeStore = ( new DisposableStore());
84
- const settleReject = err => {
85
- this._logService.warn(
86
- `${this._logContext()} handshake failed: ${formatConnectionDiagnosticError(getConnectionDiagnosticError(err))}`
87
- );
88
- handshakeStore.dispose();
89
- this._closeSocket();
90
- reject(err);
91
- };
92
- const settleResolve = () => {
93
- handshakeStore.dispose();
94
- this._rejectConnect = undefined;
95
- this._connectResolved = true;
96
- this._logService.info(
97
- `${this._logContext()} relay ready; joinedGroups=${this._options.joinGroups.length}`
98
- );
99
- this._startObserving();
100
- resolve();
101
- };
102
- const onGroupsJoined = () => {
103
- handshakeStore.dispose();
104
- this._initialCapabilitiesAckId = this._ackId + 1;
105
- this._advertiseReceiveCapabilities(settleReject);
106
- };
107
- this._rejectConnect = settleReject;
108
- handshakeStore.add(disposableTimeout(() => {
109
- settleReject(( new Error("WPS handshake timed out")));
110
- }, WPS_TIMEOUT_MS));
111
- ws.onopen = () => {};
112
- ws.onmessage = event => {
113
- if (!this._closed) {
114
- this._options.onDidReceiveFrame?.();
115
- }
116
- let frame;
117
- try {
118
- frame = JSON.parse(frameDataToString(event.data));
119
- } catch (err) {
120
- this._reportProtocolError("invalid JSON", err);
121
- return;
122
- }
123
- this._handleHandshakeFrame(frame, onGroupsJoined, settleResolve, settleReject);
124
- };
125
- ws.onerror = () => {
126
- settleReject(( new Error("WebSocket error during WPS connect")));
127
- };
128
- ws.onclose = ev => {
129
- this._logService.warn(`${this._logContext()} socket closed during handshake; code=${ev.code}`);
130
- settleReject(( new Error(
131
- `WebSocket closed before connection was established: ${ev.code} ${ev.reason}`
132
- )));
133
- };
134
- }));
135
- }
136
- _handleHandshakeFrame(frame, onGroupsJoined, onConnected, onFail) {
137
- if (this._closed) {
138
- return;
139
- }
140
- if (frame["type"] === "system" && frame["event"] === "connected") {
141
- for (const group of this._options.joinGroups) {
142
- const ackId = ++this._ackId;
143
- this._pendingJoinAcks.set(ackId, group);
144
- this._sendRaw({
145
- type: "joinGroup",
146
- group,
147
- ackId
148
- });
149
- }
150
- if (this._pendingJoinAcks.size === 0) {
151
- onGroupsJoined();
152
- }
153
- return;
154
- }
155
- if (frame["type"] === "ack") {
156
- const ackId = typeof frame["ackId"] === "number" ? frame["ackId"] : undefined;
157
- if (ackId === undefined || !( this._pendingJoinAcks.has(ackId))) {
158
- this._handleInboundFrame(frame, onFail);
159
- if (!this._closed && ackId !== undefined && ackId === this._initialCapabilitiesAckId && !( this._pendingPublishAcks.has(ackId))) {
160
- this._initialCapabilitiesAckId = undefined;
161
- onConnected();
162
- }
163
- return;
164
- }
165
- const group = this._pendingJoinAcks.get(ackId);
166
- this._pendingJoinAcks.delete(ackId);
167
- if (frame["success"] === false) {
168
- onFail(( new Error(
169
- `WPS joinGroup failed for group '${group}': ${getConnectionDiagnosticError(frame["error"]).message}`
170
- )));
171
- return;
172
- }
173
- if (this._pendingJoinAcks.size === 0) {
174
- onGroupsJoined();
175
- }
176
- return;
177
- }
178
- this._handleInboundFrame(frame, onFail);
179
- }
180
- _advertiseReceiveCapabilities(onFail) {
181
- try {
182
- this._publishFrame({
183
- type: "sendToGroup",
184
- group: this._options.toHostGroup,
185
- ackId: ++this._ackId,
186
- dataType: "json",
187
- noEcho: true,
188
- data: {
189
- kind: "capabilities",
190
- accepts: ["batch"]
191
- }
192
- });
193
- } catch (cause) {
194
- const error = ( new Error("Failed to publish WPS receive capabilities", {
195
- cause
196
- }));
197
- this._reportProtocolError("capability publication failed", error, true);
198
- onFail(error);
199
- }
200
- }
201
- _startObserving() {
202
- const ws = this._ws;
203
- if (!ws) {
204
- return;
205
- }
206
- this._sweepTimer.cancelAndSet(() => {
207
- const expired = this._reassembler.sweepExpired().length;
208
- if (expired > 0) {
209
- this._expiredAssemblies += expired;
210
- if (this._expiredAssemblies === expired) {
211
- this._logService.warn(`${this._logContext()} reassembly expired; count=${expired}`);
212
- }
213
- }
214
- }, REASSEMBLY_SWEEP_INTERVAL_MS);
215
- ws.onmessage = event => {
216
- if (!this._closed) {
217
- this._options.onDidReceiveFrame?.();
218
- }
219
- let frame;
220
- try {
221
- frame = JSON.parse(frameDataToString(event.data));
222
- } catch (err) {
223
- this._reportProtocolError("invalid JSON", err);
224
- return;
225
- }
226
- this._handleInboundFrame(frame, () => this._fireClose());
227
- };
228
- ws.onclose = event => {
229
- this._logService.info(`${this._logContext()} socket closed; code=${event.code}`);
230
- this._fireClose();
231
- };
232
- ws.onerror = () => {
233
- this._logService.warn(`${this._logContext()} socket error`);
234
- this._fireClose();
235
- };
236
- }
237
- _handleInboundFrame(frame, onFail) {
238
- if (this._closed) {
239
- return;
240
- }
241
- if (frame?.["type"] === "ack") {
242
- const ackId = frame["ackId"];
243
- if (typeof ackId !== "number" || !this._pendingPublishAcks.delete(ackId)) {
244
- return;
245
- }
246
- this._schedulePublishAckTimeout();
247
- const error = frame["error"];
248
- const responseError = isObject(error) ? error : undefined;
249
- const errorName = responseError?.name;
250
- if (frame["success"] === true || (frame["success"] === false && errorName === "Duplicate")) {
251
- if (!this._publishAcknowledged) {
252
- this._publishAcknowledged = true;
253
- this._logService.info(`${this._logContext()} first publish acknowledged; ackId=${ackId}`);
254
- }
255
- return;
256
- }
257
- const failure = ( new Error(
258
- `WPS publish failed${typeof responseError?.message === "string" ? `: ${getConnectionDiagnosticError(responseError).message}` : ""}`
259
- ));
260
- this._reportProtocolError("publish rejected", failure, true);
261
- onFail(failure);
262
- return;
263
- }
264
- if (frame?.["type"] === "message" && frame["sequenceId"] !== undefined) {
265
- const sequenceId = frame["sequenceId"];
266
- if (typeof sequenceId !== "number" || !Number.isSafeInteger(sequenceId) || sequenceId <= 0) {
267
- this._reportProtocolError("invalid sequence ID", ( new Error("Invalid WPS message sequenceId")));
268
- return;
269
- }
270
- const duplicate = sequenceId <= this._lastReceivedSequenceId;
271
- this._lastReceivedSequenceId = Math.max(this._lastReceivedSequenceId, sequenceId);
272
- try {
273
- this._sendRaw({
274
- type: "sequenceAck",
275
- sequenceId: this._lastReceivedSequenceId
276
- });
277
- } catch (err) {
278
- const error = ( new Error("Failed to send WPS sequence acknowledgement", {
279
- cause: err
280
- }));
281
- this._reportProtocolError("sequence acknowledgement failed", error, true);
282
- onFail(error);
283
- return;
284
- }
285
- if (duplicate) {
286
- return;
287
- }
288
- }
289
- let result;
290
- try {
291
- result = parseInbound(frame, {
292
- reassembler: this._reassembler,
293
- groupValidation: this._options.groupValidation
294
- });
295
- } catch (err) {
296
- this._reportProtocolError("invalid group message", err);
297
- return;
298
- }
299
- if (result.kind === "payload" || result.kind === "batch" || result.kind === "pending") {
300
- this._lastHostFrameMs = this._watch.elapsed();
301
- if (++this._hostFrames === 1) {
302
- this._logService.info(`${this._logContext()} first host frame received`);
303
- }
304
- }
305
- if (result.kind === "closed") {
306
- if (result.group.scope === "client" && result.group.lane === "to-client") {
307
- if (this._handshakeId !== undefined) {
308
- if (result.generation !== undefined) {
309
- this._closedBeforeHandshake.add(result.generation);
310
- if (this._closedBeforeHandshake.size > 128) {
311
- this._options.onProtocolError?.(( new Error("Relay handshake closure window exceeded")));
312
- this._fireClose();
313
- }
314
- }
315
- } else if (result.generation === undefined || result.generation === this._generation) {
316
- this._fireClose();
317
- }
318
- }
319
- } else if (result.kind === "payload" || result.kind === "batch") {
320
- for (const value of result.kind === "batch" ? result.payloads : [result.payload]) {
321
- if (this._closed) {
322
- break;
323
- }
324
- this._deliver(value, result.generation);
325
- }
326
- } else if (result.kind === "pending") {
327
- if (this._handshakeId !== undefined && result.group.scope === "client" && result.group.lane === "to-client") {
328
- this._handshakeTimer.schedule();
329
- }
330
- this._onDidReceiveData.fire();
331
- }
332
- }
333
- _deliver(payload, generation) {
334
- if (!isObject(payload) || payload.jsonrpc !== "2.0") {
335
- this._options.onProtocolError?.(( new Error("Invalid AHP relay message")));
336
- return;
337
- }
338
- const response = isJsonRpcResponse(payload);
339
- if (this._handshakeId !== undefined && !(response && payload.id === this._handshakeId)) {
340
- return;
341
- }
342
- if (response && payload.id !== null && payload.id === this._handshakeId) {
343
- if (generation !== undefined && ( this._closedBeforeHandshake.has(generation))) {
344
- this._fireClose();
345
- return;
346
- }
347
- this._generation = generation;
348
- this._handshakeId = undefined;
349
- this._handshakeTimer.cancel();
350
- this._closedBeforeHandshake.clear();
351
- this._requests.clear();
352
- if (hasKey(payload, {
353
- result: true
354
- })) {
355
- this._advertiseReceiveCapabilities(() => this._fireClose());
356
- if (this._closed) {
357
- return;
358
- }
359
- }
360
- } else if (generation !== undefined && this._generation !== undefined && generation !== this._generation) {
361
- if (response && payload.id !== null && ( this._requests.has(payload.id))) {
362
- this._fireClose();
363
- }
364
- return;
365
- }
366
- if (response && payload.id !== null) {
367
- this._requests.delete(payload.id);
368
- }
369
- this._hostMessages++;
370
- this._logProtocolMessage(payload, "s2c");
371
- this._onMessage.fire(payload);
372
- }
373
- send(message) {
374
- if (this._closed || !this._ws) {
375
- throw ( new Error("WebPubSubRelayTransport is closed"));
376
- }
377
- if (hasKey(message, {
378
- method: true,
379
- params: true
380
- }) && message.method === "authenticate" && (!isObject(message.params) || typeof message.params["token"] !== "string" || !message.params["token"].startsWith("copilot-sealed.v1."))) {
381
- throw ( new Error("Refusing to send plaintext authentication over Web PubSub"));
382
- }
383
- if (hasKey(message, {
384
- id: true,
385
- method: true
386
- }) && (typeof message.id === "number" || typeof message.id === "string")) {
387
- if (this._requests.size >= 1024) {
388
- this._fireClose();
389
- throw ( new Error("Web PubSub outstanding request limit exceeded"));
390
- }
391
- this._requests.add(message.id);
392
- if (message.method === "initialize" || message.method === "reconnect") {
393
- this._handshakeId = message.id;
394
- this._closedBeforeHandshake.clear();
395
- this._handshakeTimer.schedule();
396
- }
397
- }
398
- this._logProtocolMessage(message, "c2s");
399
- const frames = buildPublish({
400
- group: this._options.toHostGroup,
401
- nextAckId: () => ++this._ackId,
402
- payload: message
403
- });
404
- for (const frame of frames) {
405
- this._publishFrame(frame);
406
- }
407
- }
408
- _publishFrame(frame) {
409
- this._pendingPublishAcks.set(frame.ackId, Date.now() + WPS_TIMEOUT_MS);
410
- try {
411
- this._sendRaw(frame);
412
- } catch (err) {
413
- this._pendingPublishAcks.delete(frame.ackId);
414
- throw err;
415
- } finally {
416
- this._schedulePublishAckTimeout();
417
- }
418
- }
419
- _logProtocolMessage(message, direction) {
420
- if (!this._options.ahpLogger) {
421
- return;
422
- }
423
- const logged = hasKey(message, {
424
- method: true,
425
- params: true
426
- }) && message.method === "authenticate" && isObject(message.params) ? {
427
- ...message,
428
- params: {
429
- ...message.params,
430
- token: "[REDACTED]"
431
- }
432
- } : message;
433
- this._options.ahpLogger.log(logged, direction, getAhpLogByteLength(JSON.stringify(message)));
434
- }
435
- _schedulePublishAckTimeout() {
436
- const deadline = ( this._pendingPublishAcks.values()).next().value;
437
- if (deadline === undefined) {
438
- this._publishAckTimer.cancel();
439
- } else if (!this._publishAckTimer.isScheduled()) {
440
- this._publishAckTimer.schedule(Math.max(0, deadline - Date.now()));
441
- }
442
- }
443
- _checkPublishAckTimeout() {
444
- const deadline = ( this._pendingPublishAcks.values()).next().value;
445
- if (this._closed || deadline === undefined) {
446
- return;
447
- }
448
- if (deadline > Date.now()) {
449
- this._schedulePublishAckTimeout();
450
- return;
451
- }
452
- const error = ( new Error("WPS publish acknowledgement timed out"));
453
- this._reportProtocolError("publish acknowledgement timed out", error, true);
454
- if (this._rejectConnect) {
455
- this._rejectConnect(error);
456
- } else {
457
- this._fireClose();
458
- }
459
- }
460
- _sendRaw(obj) {
461
- this._ws?.send(JSON.stringify(obj));
462
- }
463
- _logContext() {
464
- return `[WebPubSubRelayTransport] clientId=${this._options.clientId} durationMs=${this._watch.elapsed()}`;
465
- }
466
- _reportProtocolError(kind, error, fatal = false) {
467
- if (++this._protocolErrors === 1 || fatal) {
468
- this._logService.warn(
469
- `${this._logContext()} protocol error; kind=${kind}${kind === "invalid JSON" ? "" : `: ${formatConnectionDiagnosticError(getConnectionDiagnosticError(error))}`}`
470
- );
471
- }
472
- this._options.onProtocolError?.(error);
473
- }
474
- _fireClose() {
475
- if (this._closed) {
476
- return;
477
- }
478
- this._closeSocket();
479
- this._onClose.fire();
480
- }
481
- _closeSocket() {
482
- if (!this._closed) {
483
- this._logService.info(
484
- `${this._logContext()} closing; relayReady=${this._connectResolved} publishAcknowledged=${this._publishAcknowledged} pendingJoins=${this._pendingJoinAcks.size} pendingPublishes=${this._pendingPublishAcks.size} hostFrames=${this._hostFrames} hostMessages=${this._hostMessages} hostSilenceMs=${this._lastHostFrameMs === undefined ? "none" : this._watch.elapsed() - this._lastHostFrameMs} protocolErrors=${this._protocolErrors} expiredAssemblies=${this._expiredAssemblies}`
485
- );
486
- }
487
- this._closed = true;
488
- this._sweepTimer.cancel();
489
- this._publishAckTimer.cancel();
490
- this._handshakeTimer.cancel();
491
- this._pendingJoinAcks.clear();
492
- this._pendingPublishAcks.clear();
493
- this._initialCapabilitiesAckId = undefined;
494
- this._requests.clear();
495
- this._closedBeforeHandshake.clear();
496
- this._rejectConnect = undefined;
497
- try {
498
- this._ws?.close();
499
- } catch {}
500
- }
501
- dispose() {
502
- if (!this._closed) {
503
- this._closeSocket();
504
- }
505
- super.dispose();
506
- }
507
- };
508
- WebPubSubRelayTransport = ( __decorate([( __param(1, ILogService))], WebPubSubRelayTransport));
509
-
510
- export { WebPubSubRelayTransport };
@@ -1,22 +0,0 @@
1
- import type { IAgentModelInfo } from "@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agent";
2
- import type { SessionModelInfo } from "@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/state";
3
- type ModelMessage = {
4
- readonly code: string;
5
- readonly message: string;
6
- };
7
- type ModelNoticeSource = {
8
- readonly warningText?: {
9
- readonly dataRetention?: string;
10
- };
11
- readonly infoMessages?: readonly ModelMessage[];
12
- readonly warningMessages?: readonly ModelMessage[];
13
- };
14
- /** Converts SDK model messages to model-picker metadata. */
15
- export declare function createAgentModelNoticesMeta(source: ModelNoticeSource): Record<string, unknown> | undefined;
16
- /** Reads model-picker messages from Agent Host metadata. */
17
- export declare function readAgentModelNoticesMeta(model: IAgentModelInfo | SessionModelInfo): {
18
- warningText: Record<string, string> | undefined;
19
- infoText: Record<string, string> | undefined;
20
- rowWarning: string | undefined;
21
- };
22
- export {};
@@ -1,21 +0,0 @@
1
-
2
-
3
- function readAgentModelNoticesMeta(model) {
4
- const meta = model._meta;
5
- return {
6
- warningText: asStringDictionary(meta?.warningText),
7
- infoText: asStringDictionary(meta?.infoText),
8
- rowWarning: typeof meta?.rowWarning === "string" && meta.rowWarning.length > 0 ? meta.rowWarning : undefined
9
- };
10
- }
11
- function asStringDictionary(value) {
12
- if (!value || typeof value !== "object" || Array.isArray(value)) {
13
- return undefined;
14
- }
15
- const entries = Object.entries(value).filter(
16
- entry => entry[0].length > 0 && typeof entry[1] === "string" && entry[1].length > 0
17
- );
18
- return entries.length > 0 ? Object.fromEntries(entries) : undefined;
19
- }
20
-
21
- export { readAgentModelNoticesMeta };