@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,398 +0,0 @@
1
-
2
- import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
- import { raceCancellationError, disposableTimeout } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
4
- import { CancellationToken, CancellationTokenSource } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
5
- import { CancellationError, isCancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
6
- import { Disposable, DisposableMap, toDisposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
7
- import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
8
- import { isObject } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
9
- import { StopWatch } from '@codingame/monaco-vscode-api/vscode/vs/base/common/stopwatch';
10
- import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
11
- import { IAgentHostService } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentService.service';
12
- import { cloudSandboxAddress } from '../../../../../platform/agentHost/common/cloudSandboxAgentHost.js';
13
- import { ICloudSandboxApiService, ICloudSandboxAgentHostService } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/cloudSandboxAgentHost.service';
14
- import { RemoteAgentHostsEnabledSettingId } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/remoteAgentHostService';
15
- import { IRemoteAgentHostService } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/remoteAgentHostService.service';
16
- import { formatConnectionDiagnosticError, getConnectionDiagnosticError } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/connectionDiagnostics';
17
- import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
18
- import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
19
- import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
20
- import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
21
- import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
22
- import { IChatEntitlementService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/chat/common/chatEntitlementService.service';
23
- import { IAuthenticationService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/common/authentication.service';
24
- import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableValue';
25
-
26
- const INVENTORY_PREFIX = "missionControl.userLocalHosts.v1.";
27
- const CONNECT_TIMEOUT_MS = 60_000;
28
- function isHost(value) {
29
- const host = value;
30
- return isObject(host) && typeof host.id === "string" && /^[A-Za-z0-9_-]+$/.test(host.id) && typeof host.name === "string" && !!host.name.trim() && host.kind === "user-local" && typeof host.status === "string" && (host.displayName === undefined || typeof host.displayName === "string");
31
- }
32
- let MissionControlEnvironmentService = class MissionControlEnvironmentService extends Disposable {
33
- constructor(
34
- _api,
35
- _connections,
36
- _local,
37
- _storage,
38
- _configuration,
39
- _entitlement,
40
- _log,
41
- authentication,
42
- _remote,
43
- _telemetry
44
- ) {
45
- super();
46
- this._api = _api;
47
- this._connections = _connections;
48
- this._local = _local;
49
- this._storage = _storage;
50
- this._configuration = _configuration;
51
- this._entitlement = _entitlement;
52
- this._log = _log;
53
- this._remote = _remote;
54
- this._telemetry = _telemetry;
55
- this.hosts = observableValue(this, []);
56
- this._generation = 0;
57
- this._refreshGeneration = 0;
58
- this._connects = this._register(( new DisposableMap()));
59
- this._pendingConnects = ( new Map());
60
- this._register(toDisposable(() => this._withdraw()));
61
- this._register(_api.onDidChangeAccount(account => {
62
- if (account !== this._accountKey) {
63
- this._withdraw();
64
- void this.refresh(CancellationToken.None).catch(error => this._reportBackgroundError(error));
65
- }
66
- }));
67
- this._register(authentication.onDidChangeSessions(e => {
68
- if (e.event.removed?.some(
69
- session => JSON.stringify([e.providerId, session.account.id]) === this._accountKey
70
- ) && !( [...(e.event.added ?? []), ...(e.event.changed ?? [])].some(
71
- session => JSON.stringify([e.providerId, session.account.id]) === this._accountKey
72
- ))) {
73
- this._withdraw();
74
- }
75
- }));
76
- const updateEnabled = () => {
77
- if (!this.enabled) {
78
- this._withdraw();
79
- } else {
80
- void this.refresh(CancellationToken.None).catch(error => this._reportBackgroundError(error));
81
- }
82
- };
83
- this._register(_configuration.onDidChangeConfiguration(e => {
84
- if (e.affectsConfiguration(RemoteAgentHostsEnabledSettingId) || e.affectsConfiguration("chat.disableAIFeatures")) {
85
- updateEnabled();
86
- }
87
- }));
88
- this._register(_entitlement.onDidChangeSentiment(updateEnabled));
89
- this._register(
90
- _storage.onDidChangeValue(StorageScope.PROFILE, undefined, this._store)(e => {
91
- if (this._accountKey && e.key.startsWith(this._storagePrefix)) {
92
- this._restore();
93
- }
94
- })
95
- );
96
- }
97
- get accountKey() {
98
- return this._accountKey;
99
- }
100
- get enabled() {
101
- return !this._entitlement.sentiment.hidden && this._configuration.getValue("chat.disableAIFeatures") !== true && this._configuration.getValue(RemoteAgentHostsEnabledSettingId) === true;
102
- }
103
- get _storagePrefix() {
104
- return `${INVENTORY_PREFIX}${encodeURIComponent(this._accountKey)}.`;
105
- }
106
- initialize() {
107
- if (!this.enabled || this._store.isDisposed) {
108
- return Promise.resolve();
109
- }
110
- if (!this._initializing) {
111
- const generation = this._generation;
112
- const promise = this._initialize(generation);
113
- this._initializing = promise;
114
- void promise.finally(() => {
115
- if (this._initializing === promise) {
116
- this._initializing = undefined;
117
- }
118
- }).catch(error => this._reportBackgroundError(error));
119
- }
120
- return this._initializing;
121
- }
122
- async _initialize(generation) {
123
- const account = await this._api.getAccountKey();
124
- const own = await this._local.getMissionControlEnvironmentId?.();
125
- this._checkGeneration(generation);
126
- if (account !== this._accountKey) {
127
- this._withdraw();
128
- this._accountKey = account;
129
- this._ownEnvironment = own;
130
- if (account) {
131
- this._restore();
132
- }
133
- } else if (own !== this._ownEnvironment) {
134
- this._ownEnvironment = own;
135
- this._replaceHosts(this.hosts.get().filter(host => host.id !== own));
136
- }
137
- }
138
- async refresh(token) {
139
- if (!this.enabled) {
140
- return;
141
- }
142
- await raceCancellationError(this.initialize(), token);
143
- if (!this._accountKey) {
144
- return;
145
- }
146
- const generation = this._generation;
147
- const refreshGeneration = ++this._refreshGeneration;
148
- const account = this._accountKey;
149
- const environments = await this._api.listEnvironments(token, {
150
- refresh: true
151
- });
152
- const own = await this._local.getMissionControlEnvironmentId?.();
153
- const currentAccount = await this._api.getAccountKey();
154
- this._checkGeneration(generation, token);
155
- if (account !== currentAccount || refreshGeneration !== this._refreshGeneration) {
156
- throw ( new CancellationError());
157
- }
158
- this._ownEnvironment = own;
159
- const previous = ( new Map(this.hosts.get().map(host => [host.id, host])));
160
- const next = ( new Map());
161
- for (const environment of environments) {
162
- if (environment.kind === "user-local" && environment.id !== this._ownEnvironment) {
163
- const retained = previous.get(environment.id);
164
- next.set(environment.id, {
165
- id: environment.id,
166
- name: environment.name,
167
- kind: "user-local",
168
- status: environment.status,
169
- displayName: retained?.displayName
170
- });
171
- }
172
- }
173
- this._replaceHosts([...( next.values())]);
174
- this._persist();
175
- }
176
- async connect(id, token) {
177
- const pending = this._pendingConnects.get(id);
178
- if (pending) {
179
- await raceCancellationError(pending, token);
180
- return;
181
- }
182
- const connection = this._connect(id, token);
183
- this._pendingConnects.set(id, connection);
184
- try {
185
- await connection;
186
- } finally {
187
- if (this._pendingConnects.get(id) === connection) {
188
- this._pendingConnects.delete(id);
189
- }
190
- }
191
- }
192
- async _connect(id, token) {
193
- const watch = StopWatch.create(false);
194
- let outcome = "success";
195
- const operation = ( new DisposableStore());
196
- const source = operation.add(( new CancellationTokenSource(token)));
197
- let timedOut = false;
198
- let connecting = false;
199
- let joiningRecovery = false;
200
- operation.add(disposableTimeout(() => {
201
- timedOut = true;
202
- source.cancel();
203
- }, CONNECT_TIMEOUT_MS));
204
- try {
205
- await raceCancellationError(this.initialize(), source.token);
206
- const host = this._requireHost(id);
207
- const generation = this._generation;
208
- this._connects.set(id, source);
209
- const reuseConnection = async () => {
210
- const connection = this._remote.connections.find(connection => connection.address === cloudSandboxAddress(id));
211
- if (!connection || (connection.status.kind !== "connected" && connection.status.kind !== "connecting" && connection.status.kind !== "reconnecting")) {
212
- return false;
213
- }
214
- connecting = true;
215
- joiningRecovery = true;
216
- if (connection.status.kind !== "connected") {
217
- await raceCancellationError(this._remote.waitForConnection(connection.address), source.token);
218
- }
219
- this._checkGeneration(generation, source.token);
220
- this._requireHost(id);
221
- return true;
222
- };
223
- if (await reuseConnection()) {
224
- return;
225
- }
226
- const environment = await raceCancellationError(this._api.getEnvironment(id, source.token), source.token);
227
- const account = await raceCancellationError(this._api.getAccountKey(), source.token);
228
- this._checkGeneration(generation, source.token);
229
- this._requireHost(id);
230
- if (account !== this._accountKey || environment.id !== id) {
231
- throw ( new CancellationError());
232
- }
233
- if (environment.status !== "online") {
234
- throw ( new Error(( localize(
235
- 13295,
236
- "{0} is not online. Start its owning application before connecting. Connecting will not start or replace this machine.",
237
- host.displayName ?? host.name
238
- ))));
239
- }
240
- if (await reuseConnection()) {
241
- return;
242
- }
243
- if (( this._remote.connections.some(connection => connection.address === cloudSandboxAddress(id)))) {
244
- await raceCancellationError(this._connections.disconnect(id), source.token);
245
- this._checkGeneration(generation, source.token);
246
- this._requireHost(id);
247
- }
248
- connecting = true;
249
- await raceCancellationError(this._connections.connect({
250
- environmentId: id,
251
- name: host.name,
252
- environmentKind: "user-local"
253
- }, source.token), source.token);
254
- this._checkGeneration(generation, source.token);
255
- this._requireHost(id);
256
- } catch (error) {
257
- outcome = timedOut ? "timeout" : isCancellationError(error) || token.isCancellationRequested ? "cancelled" : "failure";
258
- if (outcome !== "cancelled") {
259
- const message = `[MissionControl] Connection ${outcome}; stage=${connecting ? "connection" : "environment"} durationMs=${watch.elapsed()}`;
260
- this._log.warn(
261
- timedOut ? message : `${message}: ${formatConnectionDiagnosticError(getConnectionDiagnosticError(error))}`
262
- );
263
- }
264
- if (timedOut) {
265
- if (connecting && !joiningRecovery && this._connects.get(id) === source) {
266
- await this._connections.disconnect(id);
267
- }
268
- throw ( new Error(( localize(
269
- 13296,
270
- "Connecting to the environment timed out. Ensure its owning application is running, then reconnect."
271
- ))));
272
- }
273
- throw error;
274
- } finally {
275
- if (this._connects.get(id) === source) {
276
- this._connects.deleteAndDispose(id);
277
- }
278
- operation.dispose();
279
- this._telemetry.publicLog2("missionControlConnectionAttempt", {
280
- outcome,
281
- stage: connecting ? "connection" : "environment",
282
- durationMs: watch.elapsed()
283
- });
284
- }
285
- }
286
- async disconnect(id) {
287
- this._cancelConnect(id);
288
- await this._connections.disconnect(id);
289
- }
290
- setDisplayName(id, name) {
291
- this._requireHost(id);
292
- const key = `${this._storagePrefix}${id}.displayName`;
293
- const value = name?.trim() || undefined;
294
- if (value === undefined) {
295
- this._storage.remove(key, StorageScope.PROFILE);
296
- } else {
297
- this._storage.store(key, value, StorageScope.PROFILE, StorageTarget.MACHINE);
298
- }
299
- this._restore();
300
- }
301
- _requireHost(id) {
302
- const host = this.hosts.get().find(host => host.id === id);
303
- if (!this.enabled || !this._accountKey || !host) {
304
- throw ( new CancellationError());
305
- }
306
- return host;
307
- }
308
- _persist() {
309
- if (this._accountKey) {
310
- const entries = this.hosts.get().map(host => ({
311
- key: `${this._storagePrefix}${host.id}.metadata`,
312
- value: JSON.stringify({
313
- id: host.id,
314
- name: host.name,
315
- kind: "user-local",
316
- status: host.status
317
- }),
318
- scope: StorageScope.PROFILE,
319
- target: StorageTarget.MACHINE
320
- }));
321
- const currentKeys = ( new Set(entries.map(entry => entry.key)));
322
- for (const key of ( this._storage.keys(StorageScope.PROFILE, StorageTarget.MACHINE))) {
323
- if (key.startsWith(this._storagePrefix) && key.endsWith(".metadata") && !( currentKeys.has(key))) {
324
- entries.push({
325
- key,
326
- value: undefined,
327
- scope: StorageScope.PROFILE,
328
- target: StorageTarget.MACHINE
329
- });
330
- }
331
- }
332
- this._storage.storeAll(entries, false);
333
- }
334
- }
335
- _restore() {
336
- try {
337
- const hosts = [];
338
- for (const key of ( this._storage.keys(StorageScope.PROFILE, StorageTarget.MACHINE))) {
339
- if (!key.startsWith(this._storagePrefix) || !key.endsWith(".metadata")) {
340
- continue;
341
- }
342
- const host = JSON.parse(this._storage.get(key, StorageScope.PROFILE));
343
- if (!isHost(host) || key !== `${this._storagePrefix}${host.id}.metadata`) {
344
- throw ( new Error("Invalid Mission Control host inventory."));
345
- }
346
- if (host.id !== this._ownEnvironment) {
347
- hosts.push({
348
- id: host.id,
349
- name: host.name,
350
- kind: "user-local",
351
- status: host.status,
352
- displayName: this._storage.get(`${this._storagePrefix}${host.id}.displayName`, StorageScope.PROFILE)
353
- });
354
- }
355
- }
356
- this._replaceHosts(hosts);
357
- } catch (error) {
358
- this._log.error("Failed to restore Mission Control host inventory", error);
359
- }
360
- }
361
- _replaceHosts(hosts) {
362
- const visible = ( new Set(hosts.map(host => host.id)));
363
- for (const previous of this.hosts.get()) {
364
- if (!( visible.has(previous.id))) {
365
- void this.disconnect(previous.id).catch(error => this._log.error("Failed to withdraw Mission Control host", error));
366
- }
367
- }
368
- this.hosts.set(hosts, undefined);
369
- }
370
- _checkGeneration(generation, token = CancellationToken.None) {
371
- if (generation !== this._generation || token.isCancellationRequested || !this.enabled || this._store.isDisposed) {
372
- throw ( new CancellationError());
373
- }
374
- }
375
- _cancelConnect(id) {
376
- this._connects.get(id)?.cancel();
377
- this._connects.deleteAndDispose(id);
378
- this._pendingConnects.delete(id);
379
- }
380
- _withdraw() {
381
- this._generation++;
382
- this._initializing = undefined;
383
- for (const host of this.hosts.get()) {
384
- this._cancelConnect(host.id);
385
- void this._connections.disconnect(host.id).catch(error => this._log.error("Failed to withdraw Mission Control host", error));
386
- }
387
- this._accountKey = undefined;
388
- this.hosts.set([], undefined);
389
- }
390
- _reportBackgroundError(error) {
391
- if (!isCancellationError(error)) {
392
- this._log.warn("Mission Control host discovery failed; retaining cached hosts", error);
393
- }
394
- }
395
- };
396
- MissionControlEnvironmentService = ( __decorate([( __param(0, ICloudSandboxApiService)), ( __param(1, ICloudSandboxAgentHostService)), ( __param(2, IAgentHostService)), ( __param(3, IStorageService)), ( __param(4, IConfigurationService)), ( __param(5, IChatEntitlementService)), ( __param(6, ILogService)), ( __param(7, IAuthenticationService)), ( __param(8, IRemoteAgentHostService)), ( __param(9, ITelemetryService))], MissionControlEnvironmentService));
397
-
398
- export { MissionControlEnvironmentService };
@@ -1,45 +0,0 @@
1
- import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
2
- import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
3
- import { IAgentHostService } from "@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentService.service";
4
- import { IMissionControlSharingService } from "@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/missionControlEnvironment.service";
5
- import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
6
- import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service";
7
- import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
8
- import { INotificationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification.service";
9
- import { IProductService } from "@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service";
10
- import { IPathService } from "@codingame/monaco-vscode-api/vscode/vs/platform/path/common/pathService.service";
11
- import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
12
- import { IWorkspaceContextService } from "@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service";
13
- import { IAuthenticationService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/common/authentication.service";
14
- import { IChatEntitlementService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/chat/common/chatEntitlementService.service";
15
- export declare class MissionControlSharingService extends Disposable implements IMissionControlSharingService {
16
- private readonly _agentHost;
17
- private readonly _configuration;
18
- private readonly _authentication;
19
- private readonly _entitlement;
20
- private readonly _workspace;
21
- private readonly _product;
22
- private readonly _logService;
23
- private readonly _storage;
24
- private readonly _notificationService;
25
- private readonly _pathService;
26
- private readonly _fileService;
27
- readonly _serviceBrand: undefined;
28
- readonly state: import("@codingame/monaco-vscode-api/vscode/vs/base/common/observable").ISettableObservable<"connecting" | "disabled" | "enabled", void>;
29
- private _enabled;
30
- private _configured;
31
- private _generation;
32
- private _accountId;
33
- private _accountSessionIds;
34
- private _projectFolders;
35
- private readonly _updates;
36
- private readonly _update;
37
- constructor(_agentHost: IAgentHostService, _configuration: IConfigurationService, _authentication: IAuthenticationService, _entitlement: IChatEntitlementService, _workspace: IWorkspaceContextService, _product: IProductService, _logService: ILogService, _storage: IStorageService, _notificationService: INotificationService, _pathService: IPathService, _fileService: IFileService);
38
- setProjectFolders(folders: readonly URI[]): void;
39
- setEnabled(enabled: boolean): Promise<void>;
40
- private _usesMissionControl;
41
- private _reportWithdrawalError;
42
- private _withdraw;
43
- private _getScopes;
44
- private _configure;
45
- }