@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,497 +0,0 @@
1
-
2
- import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
- import { IntervalTimer } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
4
- import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
5
- import { CloudSandboxRequestError } from '../../../../../platform/agentHost/common/cloudSandboxAgentHost.js';
6
- import { JsonRpcErrorCodes, AhpErrorCodes } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/common/errors';
7
- import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
8
-
9
- function getCloudSandboxConnectionSurface(isSessionsWindow, isWeb) {
10
- return isSessionsWindow ? (isWeb ? "agentsWeb" : "agentsDesktop") : (isWeb ? "editorWeb" : "editorDesktop");
11
- }
12
- const REQUEST_REPORT_INTERVAL_MS = 30 * 60_000;
13
- const CONNECTION_REPORT_INTERVAL_MS = 5 * 60_000;
14
- const KNOWN_PROTOCOL_ERROR_CODES = [...( Object.values(JsonRpcErrorCodes)), ...( Object.values(AhpErrorCodes))];
15
- const nullConnectionTelemetry = {
16
- setConnectStage() {},
17
- completeConnect() {},
18
- onConnectionStateChange() {},
19
- recordReceivedFrame() {},
20
- createRequestObserver: () => () => {},
21
- recordConnectionDiagnostic() {},
22
- dispose() {}
23
- };
24
- function requestOutcomeForStatus(statusCode) {
25
- if (statusCode === undefined) {
26
- return "networkError";
27
- }
28
- if (statusCode === 202) {
29
- return "waking";
30
- }
31
- if (statusCode >= 200 && statusCode < 300) {
32
- return "succeeded";
33
- }
34
- if (statusCode >= 500) {
35
- return "serverError";
36
- }
37
- if (statusCode >= 400) {
38
- return "clientError";
39
- }
40
- return "unexpectedStatus";
41
- }
42
- function emptyCounts() {
43
- return {
44
- succeeded: 0,
45
- waking: 0,
46
- clientError: 0,
47
- serverError: 0,
48
- networkError: 0,
49
- unexpectedStatus: 0
50
- };
51
- }
52
- let CloudSandboxTelemetryService = class CloudSandboxTelemetryService extends Disposable {
53
- constructor(_telemetryService) {
54
- super();
55
- this._telemetryService = _telemetryService;
56
- this._counts = ( new Map());
57
- this._reportTimer = this._register(( new IntervalTimer()));
58
- this._connections = ( new Set());
59
- this._connectionReportTimer = this._register(( new IntervalTimer()));
60
- this._windowStart = Date.now();
61
- this._register({
62
- dispose: () => this.flushRequestCounts()
63
- });
64
- this._register({
65
- dispose: () => {
66
- for (const connection of this._connections) {
67
- connection.dispose();
68
- }
69
- }
70
- });
71
- }
72
- trackConnection(stage, surface = "unknown", source = "existing", context) {
73
- if (this._store.isDisposed) {
74
- return nullConnectionTelemetry;
75
- }
76
- const environmentOperation = context?.environmentKind === "user-local" ? "attach" : source === "created" ? "provision" : "resume";
77
- const connection = ( new CloudSandboxConnectionTelemetry(
78
- stage,
79
- surface,
80
- source,
81
- context?.environmentKind ?? "cloud",
82
- environmentOperation,
83
- context?.provisioningStartedAt,
84
- event => {
85
- if (event.environmentKind === "user-local") {
86
- this._telemetryService.publicLog2("userLocalRelayConnectionOutcome", event);
87
- } else {
88
- this._telemetryService.publicLog2("cloudSandboxConnectionOutcome", event);
89
- }
90
- },
91
- event => {
92
- if (event.environmentKind === "user-local") {
93
- this._telemetryService.publicLog2("userLocalRelayFirstSessionRequest", event);
94
- } else {
95
- this._telemetryService.publicLog2("cloudSandboxFirstSessionRequest", event);
96
- }
97
- },
98
- () => {
99
- const counts = connection.takeHealthSnapshot(Date.now());
100
- this._connections.delete(connection);
101
- if (this._connections.size === 0) {
102
- this._connectionReportTimer.cancel();
103
- }
104
- this._reportConnectionHealth(counts);
105
- }
106
- ));
107
- this._connections.add(connection);
108
- if (this._connections.size === 1) {
109
- this._connectionReportTimer.cancelAndSet(() => this.flushConnectionHealth(), CONNECTION_REPORT_INTERVAL_MS);
110
- }
111
- return connection;
112
- }
113
- flushConnectionHealth() {
114
- const now = Date.now();
115
- const counts = ( new Map());
116
- for (const connection of this._connections) {
117
- const delta = connection.takeHealthSnapshot(now);
118
- const aggregate = counts.get(delta.environmentKind);
119
- if (aggregate) {
120
- aggregate.connectedMs += delta.connectedMs;
121
- aggregate.unexpectedDisconnects += delta.unexpectedDisconnects;
122
- aggregate.receivedFrames += delta.receivedFrames;
123
- } else {
124
- counts.set(delta.environmentKind, delta);
125
- }
126
- }
127
- for (const aggregate of ( counts.values())) {
128
- this._reportConnectionHealth(aggregate);
129
- }
130
- }
131
- _reportConnectionHealth(counts) {
132
- if (counts.connectedMs || counts.unexpectedDisconnects || counts.receivedFrames) {
133
- if (counts.environmentKind === "user-local") {
134
- this._telemetryService.publicLog2("userLocalRelayConnectionHealth", counts);
135
- } else {
136
- this._telemetryService.publicLog2("cloudSandboxConnectionHealth", counts);
137
- }
138
- }
139
- }
140
- reportRequest(action, outcome) {
141
- let counts = this._counts.get(action);
142
- if (!counts) {
143
- counts = emptyCounts();
144
- this._counts.set(action, counts);
145
- if (this._counts.size === 1) {
146
- this._windowStart = Date.now();
147
- this._reportTimer.cancelAndSet(() => this.flushRequestCounts(), REQUEST_REPORT_INTERVAL_MS);
148
- }
149
- }
150
- counts[outcome]++;
151
- }
152
- reportProvisioningOutcome(outcome, durationMs) {
153
- this._telemetryService.publicLog2("cloudSandboxProvisioningOutcome", {
154
- outcome,
155
- durationMs
156
- });
157
- }
158
- reportCredentialRefreshStopped(reason, consecutiveFailures, error) {
159
- this._telemetryService.publicLog2("cloudSandboxCredentialRefreshStopped", {
160
- reason,
161
- consecutiveFailures,
162
- statusCode: error instanceof CloudSandboxRequestError ? error.statusCode : undefined
163
- });
164
- }
165
- flushRequestCounts() {
166
- if (this._counts.size === 0) {
167
- return;
168
- }
169
- const windowMs = Date.now() - this._windowStart;
170
- for (const [action, counts] of this._counts) {
171
- this._telemetryService.publicLog2("cloudSandboxRequests", {
172
- action,
173
- windowMs,
174
- total: counts.succeeded + counts.waking + counts.clientError + counts.serverError + counts.networkError + counts.unexpectedStatus,
175
- succeeded: counts.succeeded,
176
- waking: counts.waking,
177
- clientError: counts.clientError,
178
- serverError: counts.serverError,
179
- networkError: counts.networkError,
180
- unexpectedStatus: counts.unexpectedStatus
181
- });
182
- }
183
- this._counts.clear();
184
- this._reportTimer.cancel();
185
- }
186
- };
187
- CloudSandboxTelemetryService = ( __decorate([( __param(0, ITelemetryService))], CloudSandboxTelemetryService));
188
- class CloudSandboxConnectionTelemetry extends Disposable {
189
- constructor(
190
- stage,
191
- _surface,
192
- _source,
193
- _environmentKind,
194
- _initialEnvironmentOperation,
195
- provisioningStartedAt,
196
- _reportOutcome,
197
- _reportFirstRequest,
198
- _onDispose
199
- ) {
200
- super();
201
- this._surface = _surface;
202
- this._source = _source;
203
- this._environmentKind = _environmentKind;
204
- this._initialEnvironmentOperation = _initialEnvironmentOperation;
205
- this._reportOutcome = _reportOutcome;
206
- this._reportFirstRequest = _reportFirstRequest;
207
- this._onDispose = _onDispose;
208
- this._restoring = false;
209
- this._counts = {
210
- connectedMs: 0,
211
- unexpectedDisconnects: 0,
212
- receivedFrames: 0
213
- };
214
- this._operation = this._newOperation("connect", stage, provisioningStartedAt);
215
- if (stage === "credentials") {
216
- this._operation.phases.set("credentials", {
217
- id: "initial",
218
- startedAt: this._operation.startedAt
219
- });
220
- }
221
- }
222
- _newOperation(operation, stage, provisioningStartedAt) {
223
- const startedAt = Date.now();
224
- const provisioningMs = operation === "connect" && this._initialEnvironmentOperation === "provision" ? provisioningStartedAt === undefined ? undefined : Math.max(0, startedAt - provisioningStartedAt) : 0;
225
- return {
226
- operation,
227
- stage,
228
- startedAt,
229
- credentialRequests: 0,
230
- wakingResponses: 0,
231
- transportAttempts: 0,
232
- provisioningMs,
233
- preparationStartedAt: stage === "credentials" ? startedAt : undefined,
234
- preparationMs: 0,
235
- failures: {
236
- credentials: 0,
237
- relay: 0,
238
- protocol: 0,
239
- authentication: 0,
240
- restoration: 0
241
- },
242
- durations: {
243
- credentials: 0,
244
- relay: 0,
245
- protocol: 0,
246
- authentication: 0,
247
- restoration: 0
248
- },
249
- phases: ( new Map())
250
- };
251
- }
252
- get isConnecting() {
253
- return this._operation?.operation === "connect";
254
- }
255
- setConnectStage(stage) {
256
- if (this._operation) {
257
- if (stage === "connection") {
258
- this._finishPhase(this._operation, "credentials");
259
- }
260
- this._setPreparing(this._operation, stage === "credentials");
261
- this._operation.stage = stage;
262
- }
263
- }
264
- completeConnect(outcome) {
265
- if (!this.isConnecting || (outcome === "failure" && this._restoring)) {
266
- return;
267
- }
268
- this._complete(outcome);
269
- if (outcome === "cancelled") {
270
- this.dispose();
271
- }
272
- }
273
- onConnectionStateChange(state) {
274
- if (this._store.isDisposed) {
275
- return;
276
- }
277
- switch (state) {
278
- case "connecting":
279
- this.setConnectStage("connection");
280
- break;
281
- case "connected":
282
- this._restoring = false;
283
- this._connectedSince ??= Date.now();
284
- this._complete("success");
285
- break;
286
- case "reconnecting":
287
- this._completeFirstRequest("failure");
288
- this._restoring = true;
289
- if (this._connectedSince !== undefined) {
290
- this._pauseConnectedTime();
291
- this._counts.unexpectedDisconnects++;
292
- this._operation = this._newOperation("recover", "connection");
293
- }
294
- break;
295
- case "failed":
296
- this._completeFirstRequest("failure");
297
- this._complete("failure");
298
- this.dispose();
299
- break;
300
- case "disposed":
301
- this.dispose();
302
- break;
303
- }
304
- }
305
- recordReceivedFrame() {
306
- if (!this._store.isDisposed) {
307
- this._counts.receivedFrames++;
308
- }
309
- }
310
- createRequestObserver() {
311
- let operation;
312
- return event => {
313
- if (this._store.isDisposed) {
314
- return;
315
- }
316
- if (event === "issued") {
317
- operation = this._operation;
318
- if (operation) {
319
- operation.credentialRequests++;
320
- }
321
- } else if (operation && operation === this._operation) {
322
- operation.wakingResponses++;
323
- }
324
- };
325
- }
326
- recordConnectionDiagnostic(event) {
327
- if (this._store.isDisposed) {
328
- return;
329
- }
330
- if (event.phase === "protocol.firstSessionRequest") {
331
- if (event.outcome === "started") {
332
- this._firstRequest = {
333
- id: event.operationId,
334
- startedAt: Date.now()
335
- };
336
- } else if (this._firstRequest?.id === event.operationId && (event.outcome === "succeeded" || event.outcome === "failed")) {
337
- this._completeFirstRequest(event.outcome === "succeeded" ? "success" : "failure");
338
- }
339
- return;
340
- }
341
- const phase = this._diagnosticPhase(event.phase);
342
- const operation = this._operation;
343
- if (!phase || !operation) {
344
- return;
345
- }
346
- if (event.outcome === "started") {
347
- this._finishPhase(operation, phase);
348
- this._setPreparing(operation, phase === "credentials");
349
- operation.stage = phase;
350
- operation.phases.set(phase, {
351
- id: event.operationId,
352
- startedAt: Date.now()
353
- });
354
- if (phase === "relay") {
355
- operation.transportAttempts++;
356
- }
357
- } else if (operation.phases.get(phase)?.id === event.operationId && (event.outcome === "succeeded" || event.outcome === "failed")) {
358
- this._finishPhase(operation, phase);
359
- if (phase === "credentials" && event.outcome === "succeeded") {
360
- this._setPreparing(operation, false);
361
- }
362
- if (event.outcome === "failed") {
363
- operation.failures[phase]++;
364
- operation.firstFailure ??= {
365
- phase: event.phase,
366
- code: KNOWN_PROTOCOL_ERROR_CODES.find(code => String(code) === event.error?.code)
367
- };
368
- }
369
- const enclosingPhase = [...( operation.phases.keys())].at(-1);
370
- if (event.outcome === "succeeded" && enclosingPhase) {
371
- operation.stage = enclosingPhase;
372
- }
373
- }
374
- }
375
- _diagnosticPhase(phase) {
376
- switch (phase) {
377
- case "credentials":
378
- return "credentials";
379
- case "transport.connect":
380
- case "transport.reconnect":
381
- return "relay";
382
- case "protocol.initialize":
383
- case "protocol.reconnect":
384
- return "protocol";
385
- case "protocol.authentication":
386
- return "authentication";
387
- case "protocol.subscriptions":
388
- return "restoration";
389
- default:
390
- return undefined;
391
- }
392
- }
393
- _finishPhase(operation, phase) {
394
- const active = operation.phases.get(phase);
395
- if (active) {
396
- operation.durations[phase] += Math.max(0, Date.now() - active.startedAt);
397
- operation.phases.delete(phase);
398
- }
399
- }
400
- _setPreparing(operation, preparing) {
401
- if (preparing) {
402
- operation.preparationStartedAt ??= Date.now();
403
- } else if (operation.preparationStartedAt !== undefined) {
404
- operation.preparationMs += Math.max(0, Date.now() - operation.preparationStartedAt);
405
- operation.preparationStartedAt = undefined;
406
- }
407
- }
408
- _completeFirstRequest(outcome) {
409
- if (this._firstRequest) {
410
- const durationMs = Math.max(0, Date.now() - this._firstRequest.startedAt);
411
- this._firstRequest = undefined;
412
- this._reportFirstRequest({
413
- surface: this._surface,
414
- source: this._source,
415
- environmentKind: this._environmentKind,
416
- outcome,
417
- durationMs
418
- });
419
- }
420
- }
421
- takeHealthSnapshot(now) {
422
- if (this._connectedSince !== undefined) {
423
- this._counts.connectedMs += Math.max(0, now - this._connectedSince);
424
- this._connectedSince = now;
425
- }
426
- const counts = this._counts;
427
- this._counts = {
428
- connectedMs: 0,
429
- unexpectedDisconnects: 0,
430
- receivedFrames: 0
431
- };
432
- return {
433
- ...counts,
434
- environmentKind: this._environmentKind
435
- };
436
- }
437
- _pauseConnectedTime() {
438
- if (this._connectedSince !== undefined) {
439
- this._counts.connectedMs += Math.max(0, Date.now() - this._connectedSince);
440
- this._connectedSince = undefined;
441
- }
442
- }
443
- _complete(outcome) {
444
- const operation = this._operation;
445
- if (!operation) {
446
- return;
447
- }
448
- this._operation = undefined;
449
- for (const phase of ( operation.phases.keys())) {
450
- this._finishPhase(operation, phase);
451
- }
452
- this._setPreparing(operation, false);
453
- const durationMs = Math.max(0, Date.now() - operation.startedAt);
454
- const preparationMs = Math.min(durationMs, operation.preparationMs);
455
- this._reportOutcome({
456
- operation: operation.operation,
457
- outcome,
458
- stage: operation.stage,
459
- durationMs,
460
- environmentOperation: operation.operation === "recover" ? "recover" : this._initialEnvironmentOperation,
461
- provisioningMs: operation.provisioningMs,
462
- readinessMs: operation.provisioningMs === undefined ? undefined : operation.provisioningMs + durationMs,
463
- preparationMs,
464
- connectionMs: durationMs - preparationMs,
465
- surface: this._surface,
466
- source: this._source,
467
- environmentKind: this._environmentKind,
468
- credentialRequests: operation.credentialRequests,
469
- wakingResponses: operation.wakingResponses,
470
- transportAttempts: operation.transportAttempts,
471
- credentialsMs: operation.durations.credentials,
472
- relayMs: operation.durations.relay,
473
- protocolMs: operation.durations.protocol,
474
- authenticationMs: operation.durations.authentication,
475
- restorationMs: operation.durations.restoration,
476
- firstFailurePhase: operation.firstFailure?.phase,
477
- firstFailureCode: operation.firstFailure?.code,
478
- credentialFailures: operation.failures.credentials,
479
- relayFailures: operation.failures.relay,
480
- protocolFailures: operation.failures.protocol,
481
- authenticationFailures: operation.failures.authentication,
482
- restorationFailures: operation.failures.restoration
483
- });
484
- }
485
- dispose() {
486
- if (this._store.isDisposed) {
487
- return;
488
- }
489
- this._pauseConnectedTime();
490
- this._complete("cancelled");
491
- this._completeFirstRequest("cancelled");
492
- super.dispose();
493
- this._onDispose();
494
- }
495
- }
496
-
497
- export { CloudSandboxTelemetryService, getCloudSandboxConnectionSurface, requestOutcomeForStatus };
@@ -1,6 +0,0 @@
1
- import type { IHostEncryptionKey } from "../../../../../platform/agentHost/common/cloudSandboxAgentHost.js";
2
- import type { IMissionControlCredentialSealingRequest } from "@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentService";
3
- import type { RootState } from "@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/sessionState";
4
- import type { IAgentHostAuthenticateRequest } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostAuth";
5
- /** Pins MCP sealing to the authenticated environment descriptor and this handshake's advertised key. */
6
- export declare function sealMissionControlMcpCredential(request: IAgentHostAuthenticateRequest, trustedKeys: readonly IHostEncryptionKey[] | undefined, root: RootState, handshakeMeta: Record<string, unknown> | undefined, seal: (request: IMissionControlCredentialSealingRequest) => Promise<string>): Promise<IAgentHostAuthenticateRequest>;
@@ -1,41 +0,0 @@
1
-
2
- import { isObject } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
3
-
4
- async function sealMissionControlMcpCredential(request, trustedKeys, root, handshakeMeta, seal) {
5
- const advertised = root._meta?.["copilot.encryptionKeys"];
6
- if (!Array.isArray(trustedKeys) || !Array.isArray(advertised)) {
7
- throw ( new Error("Mission Control has no authenticated MCP recipient key."));
8
- }
9
- const key = trustedKeys.find(
10
- key => key.use === "mcp-auth-token" && key.algorithm === "x25519-sealedbox" && ( advertised.some(value => {
11
- if (!isObject(value)) {
12
- return false;
13
- }
14
- const candidate = value;
15
- return candidate.keyId === key.key_id && candidate.use === key.use && candidate.algorithm === key.algorithm && candidate.publicKey === key.public_key;
16
- }))
17
- );
18
- if (!key) {
19
- throw ( new Error("Mission Control MCP key does not match the connected host."));
20
- }
21
- const value = handshakeMeta?.["copilot.authChallenge"];
22
- const binding = isObject(value) ? value : undefined;
23
- if (binding?.required === true && typeof binding.challenge !== "string") {
24
- throw ( new Error("Mission Control requires a missing handshake challenge."));
25
- }
26
- const token = await seal({
27
- resource: request.resource,
28
- token: request.token,
29
- key: {
30
- ...key,
31
- use: "mcp-auth-token"
32
- },
33
- challenge: typeof binding?.challenge === "string" ? binding.challenge : undefined
34
- });
35
- return {
36
- ...request,
37
- token
38
- };
39
- }
40
-
41
- export { sealMissionControlMcpCredential };
@@ -1,73 +0,0 @@
1
- import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
2
- import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
3
- import { IAgentHostService } from "@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentService.service";
4
- import { ICloudSandboxAgentHostService } from "@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/cloudSandboxAgentHost.service";
5
- import { ICloudSandboxApiService } from "@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/cloudSandboxAgentHost.service";
6
- import { IMissionControlHost } from "@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/missionControlEnvironment";
7
- import { IMissionControlEnvironmentService } from "@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/missionControlEnvironment.service";
8
- import { IRemoteAgentHostService } from "@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/remoteAgentHostService.service";
9
- import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
10
- import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
11
- import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
12
- import { ITelemetryService } from "@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service";
13
- import { IChatEntitlementService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/chat/common/chatEntitlementService.service";
14
- import { IAuthenticationService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/common/authentication.service";
15
- export type MissionControlConnectionAttemptClassification = {
16
- owner: "roblourens";
17
- comment: "User-local Mission Control connection attempts, including inventory validation and the end-to-end deadline.";
18
- outcome: {
19
- classification: "SystemMetaData";
20
- purpose: "PerformanceAndHealth";
21
- comment: "Success, failure, caller cancellation or the user-local connection deadline.";
22
- };
23
- stage: {
24
- classification: "SystemMetaData";
25
- purpose: "PerformanceAndHealth";
26
- comment: "Environment validation or delegated relay connection.";
27
- };
28
- durationMs: {
29
- classification: "SystemMetaData";
30
- purpose: "PerformanceAndHealth";
31
- isMeasurement: true;
32
- comment: "Milliseconds for the complete attempt, including environment validation.";
33
- };
34
- };
35
- export declare class MissionControlEnvironmentService extends Disposable implements IMissionControlEnvironmentService {
36
- private readonly _api;
37
- private readonly _connections;
38
- private readonly _local;
39
- private readonly _storage;
40
- private readonly _configuration;
41
- private readonly _entitlement;
42
- private readonly _log;
43
- private readonly _remote;
44
- private readonly _telemetry;
45
- readonly _serviceBrand: undefined;
46
- readonly hosts: import("@codingame/monaco-vscode-api/vscode/vs/base/common/observable").ISettableObservable<readonly IMissionControlHost[], void>;
47
- private _accountKey;
48
- private _ownEnvironment;
49
- private _generation;
50
- private _refreshGeneration;
51
- private _initializing;
52
- private readonly _connects;
53
- private readonly _pendingConnects;
54
- constructor(_api: ICloudSandboxApiService, _connections: ICloudSandboxAgentHostService, _local: IAgentHostService, _storage: IStorageService, _configuration: IConfigurationService, _entitlement: IChatEntitlementService, _log: ILogService, authentication: IAuthenticationService, _remote: IRemoteAgentHostService, _telemetry: ITelemetryService);
55
- get accountKey(): string | undefined;
56
- get enabled(): boolean;
57
- private get _storagePrefix();
58
- initialize(): Promise<void>;
59
- private _initialize;
60
- refresh(token: CancellationToken): Promise<void>;
61
- connect(id: string, token: CancellationToken): Promise<void>;
62
- private _connect;
63
- disconnect(id: string): Promise<void>;
64
- setDisplayName(id: string, name: string | undefined): void;
65
- private _requireHost;
66
- private _persist;
67
- private _restore;
68
- private _replaceHosts;
69
- private _checkGeneration;
70
- private _cancelConnect;
71
- private _withdraw;
72
- private _reportBackgroundError;
73
- }