@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,40 +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 { IObservable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/observable";
4
- import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
5
- import { ICloudSandboxApiService } from "@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/cloudSandboxAgentHost.service";
6
- import { RemoteAgentHostConnectionStatus } from "@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/remoteAgentHostService";
7
- import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
8
- import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
9
- import { IChatService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService.service";
10
- import { IChatSession, IChatSessionContentProvider } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService";
11
- import { ICloudSandboxReadOnlyConfig } from "./cloudSandboxReadOnlySessionHandler.js";
12
- interface ICloudSandboxSessionConfig extends ICloudSandboxReadOnlyConfig {
13
- readonly connectionStatus?: IObservable<RemoteAgentHostConnectionStatus>;
14
- }
15
- /** Serves whichever source is ready first, then promotes recorded history without unregistering. */
16
- export declare class CloudSandboxSessionHandler extends Disposable implements IChatSessionContentProvider {
17
- private readonly _config;
18
- private readonly _logService;
19
- private readonly _apiService;
20
- private readonly _chatService;
21
- private readonly _sessions;
22
- private readonly _readOnlyHandler;
23
- private readonly _liveReady;
24
- private _liveProvider;
25
- constructor(_config: ICloudSandboxSessionConfig, instantiationService: IInstantiationService, _logService: ILogService, _apiService: ICloudSandboxApiService, _chatService: IChatService);
26
- setLiveProvider(provider: IChatSessionContentProvider): void;
27
- retryLiveSessions(): void;
28
- provideChatSessionContent(resource: URI, token: CancellationToken): Promise<IChatSession>;
29
- private _disposeUnreferencedSession;
30
- private _accept;
31
- private _updateHistoryStatus;
32
- private _loadHistory;
33
- private _loadLive;
34
- get updateChatSessionMetadata(): IChatSessionContentProvider["updateChatSessionMetadata"];
35
- resolveChatResponseUri(resource: URI, href: string, kind: "link" | "image"): string;
36
- provideChatInputCompletions: NonNullable<IChatSessionContentProvider["provideChatInputCompletions"]>;
37
- provideChatInputCompletionTriggerCharacters(): Promise<readonly string[]>;
38
- dispose(): void;
39
- }
40
- export {};
@@ -1,604 +0,0 @@
1
-
2
- import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
- import { DeferredPromise, raceCancellationError, disposableTimeout, timeout } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
4
- import { cancelOnDispose, CancellationTokenSource } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
5
- import { toErrorMessage } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errorMessage';
6
- import { CancellationError, isCancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
7
- import { Emitter, Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
8
- import { Disposable, MutableDisposable, DisposableStore, DisposableResourceMap } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
9
- import { equals } from '@codingame/monaco-vscode-api/vscode/vs/base/common/objects';
10
- import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
11
- import { isEqual } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
12
- import { StopWatch } from '@codingame/monaco-vscode-api/vscode/vs/base/common/stopwatch';
13
- import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
14
- import { CloudSandboxAuthenticationRequiredError, CloudSandboxRequestError } from '../../../../../platform/agentHost/common/cloudSandboxAgentHost.js';
15
- import { ICloudSandboxApiService } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/cloudSandboxAgentHost.service';
16
- import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
17
- import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
18
- import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService.service';
19
- import { getChatSessionHistoryContent } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService';
20
- import { CloudSandboxSessionTrace } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/cloudSandboxSessionTrace';
21
- import { CloudSandboxReadOnlySessionHandler, ReadOnlyChatSession } from './cloudSandboxReadOnlySessionHandler.js';
22
- import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/reactions/autorun';
23
- import { transaction } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/transaction';
24
- import { constObservable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/constObservable';
25
- import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableValue';
26
-
27
- const LIVE_CONTENT_TIMEOUT_MS = 30_000;
28
- class PromotableCloudSandboxChatSession extends Disposable {
29
- constructor(_source, _invalidateHistory, live) {
30
- super();
31
- this._source = _source;
32
- this._invalidateHistory = _invalidateHistory;
33
- this.preserveHistoryItemIdentity = true;
34
- this._sourceStore = this._register(( new MutableDisposable()));
35
- this._onWillDispose = this._register(( new Emitter()));
36
- this.onWillDispose = this._onWillDispose.event;
37
- this._onDidChangeHistory = this._register(( new Emitter()));
38
- this.onDidChangeHistory = this._onDidChangeHistory.event;
39
- this._onDidStartServerRequest = this._register(( new Emitter()));
40
- this.onDidStartServerRequest = this._onDidStartServerRequest.event;
41
- this.progressObs = observableValue(this, []);
42
- this.isCompleteObs = observableValue(this, true);
43
- this.isReadOnly = observableValue(this, true);
44
- this.isInputBlocked = observableValue(this, false);
45
- this.historyStatus = observableValue(this, undefined);
46
- this.backgroundShellCount = observableValue(this, undefined);
47
- this.canvasContext = observableValue(this, undefined);
48
- this._disposed = false;
49
- this.interruptActiveResponseCallback = async () => this._source.interruptActiveResponseCallback?.() ?? true;
50
- this.sessionResource = _source.sessionResource;
51
- this._bindSource(_source, false, live);
52
- }
53
- get history() {
54
- return this._source.history;
55
- }
56
- get title() {
57
- return this._source.title;
58
- }
59
- get options() {
60
- return this._source.options;
61
- }
62
- get transferredState() {
63
- return this._source.transferredState;
64
- }
65
- get requestHandler() {
66
- const source = this._source;
67
- return source.requestHandler ? (request, progress, history, token) => source.requestHandler(request, progress, history, token) : undefined;
68
- }
69
- get forkSession() {
70
- const source = this._source;
71
- return source.forkSession ? (request, token) => source.forkSession(request, token) : undefined;
72
- }
73
- get renameSession() {
74
- const source = this._source;
75
- return source.renameSession ? (title, token) => source.renameSession(title, token) : undefined;
76
- }
77
- get prepareForClientTools() {
78
- const source = this._source;
79
- return source.prepareForClientTools ? token => source.prepareForClientTools(token) : undefined;
80
- }
81
- get retryInput() {
82
- const source = this._source;
83
- return source.retryInput ? () => source.retryInput() : undefined;
84
- }
85
- promote(source, live) {
86
- this._bindSource(source, true, live);
87
- }
88
- _bindSource(source, promote, live) {
89
- const activeRequest = !source.isCompleteObs?.get() && source.progressObs ? source.history.findLast(item => item.type === "request") : undefined;
90
- if (activeRequest && !activeRequest.id) {
91
- source.dispose();
92
- throw ( new Error("A live sandbox turn must have an ID before it can be promoted."));
93
- }
94
- this._sourceStore.clear();
95
- this._source = source;
96
- const store = ( new DisposableStore());
97
- this._sourceStore.value = store;
98
- store.add(source);
99
- transaction(() => {
100
- if (promote) {
101
- this._onDidChangeHistory.fire(source.history);
102
- if (activeRequest?.id) {
103
- this._onDidStartServerRequest.fire({
104
- id: activeRequest.id,
105
- prompt: activeRequest.prompt,
106
- resume: true
107
- });
108
- }
109
- }
110
- if (source.onDidChangeHistory) {
111
- store.add(source.onDidChangeHistory(history => {
112
- if (live) {
113
- this._invalidateHistory();
114
- }
115
- this._onDidChangeHistory.fire(history);
116
- }));
117
- }
118
- if (source.onDidStartServerRequest) {
119
- store.add(source.onDidStartServerRequest(request => {
120
- if (live) {
121
- this._invalidateHistory();
122
- }
123
- this._onDidStartServerRequest.fire(request);
124
- }));
125
- }
126
- let previousProgress = source.progressObs?.get();
127
- let previousComplete = source.isCompleteObs?.get();
128
- store.add(autorun(reader => {
129
- const progress = source.progressObs?.read(reader);
130
- const complete = source.isCompleteObs?.read(reader);
131
- const readOnly = source.isReadOnly?.read(reader) ?? false;
132
- const blocked = source.isInputBlocked?.read(reader) ?? false;
133
- const backgroundShellCount = source.backgroundShellCount?.read(reader);
134
- const canvasContext = source.canvasContext?.read(reader);
135
- if (live && (previousProgress !== progress || previousComplete !== complete)) {
136
- this._invalidateHistory();
137
- }
138
- previousProgress = progress;
139
- previousComplete = complete;
140
- transaction(tx => {
141
- this.progressObs.set(progress ?? [], tx);
142
- this.isCompleteObs.set(complete ?? true, tx);
143
- this.isReadOnly.set(readOnly, tx);
144
- this.isInputBlocked.set(blocked, tx);
145
- this.backgroundShellCount.set(backgroundShellCount, tx);
146
- this.canvasContext.set(canvasContext, tx);
147
- });
148
- }));
149
- });
150
- }
151
- dispose() {
152
- if (this._disposed) {
153
- return;
154
- }
155
- this._disposed = true;
156
- this.isCompleteObs.set(true, undefined);
157
- this._onWillDispose.fire();
158
- super.dispose();
159
- }
160
- }
161
- class CloudSandboxChatSessionReference extends Disposable {
162
- constructor(_session, _release) {
163
- super();
164
- this._session = _session;
165
- this._release = _release;
166
- this._onWillDispose = this._register(( new Emitter()));
167
- this.onWillDispose = this._onWillDispose.event;
168
- this._disposed = false;
169
- this._register(Event.once(_session.onWillDispose)(() => this.dispose()));
170
- }
171
- get sessionResource() {
172
- return this._session.sessionResource;
173
- }
174
- get history() {
175
- return this._session.history;
176
- }
177
- get preserveHistoryItemIdentity() {
178
- return this._session.preserveHistoryItemIdentity;
179
- }
180
- get title() {
181
- return this._session.title;
182
- }
183
- get options() {
184
- return this._session.options;
185
- }
186
- get transferredState() {
187
- return this._session.transferredState;
188
- }
189
- get progressObs() {
190
- return this._session.progressObs;
191
- }
192
- get isCompleteObs() {
193
- return this._session.isCompleteObs;
194
- }
195
- get isReadOnly() {
196
- return this._session.isReadOnly;
197
- }
198
- get isInputBlocked() {
199
- return this._session.isInputBlocked;
200
- }
201
- get historyStatus() {
202
- return this._session.historyStatus;
203
- }
204
- get backgroundShellCount() {
205
- return this._session.backgroundShellCount;
206
- }
207
- get canvasContext() {
208
- return this._session.canvasContext;
209
- }
210
- get onDidChangeHistory() {
211
- return this._session.onDidChangeHistory;
212
- }
213
- get onDidStartServerRequest() {
214
- return this._session.onDidStartServerRequest;
215
- }
216
- get requestHandler() {
217
- return this._session.requestHandler;
218
- }
219
- get forkSession() {
220
- return this._session.forkSession;
221
- }
222
- get renameSession() {
223
- return this._session.renameSession;
224
- }
225
- get prepareForClientTools() {
226
- return this._session.prepareForClientTools;
227
- }
228
- get retryInput() {
229
- return this._session.retryInput;
230
- }
231
- get interruptActiveResponseCallback() {
232
- return this._session.interruptActiveResponseCallback;
233
- }
234
- dispose() {
235
- if (this._disposed) {
236
- return;
237
- }
238
- this._disposed = true;
239
- this._onWillDispose.fire();
240
- super.dispose();
241
- this._release();
242
- }
243
- }
244
- let CloudSandboxSessionHandler = class CloudSandboxSessionHandler extends Disposable {
245
- constructor(_config, instantiationService, _logService, _apiService, _chatService) {
246
- super();
247
- this._config = _config;
248
- this._logService = _logService;
249
- this._apiService = _apiService;
250
- this._chatService = _chatService;
251
- this._sessions = this._register(( new DisposableResourceMap()));
252
- this._liveReady = ( new DeferredPromise());
253
- this.provideChatInputCompletions = async (resource, params, token) => this._liveProvider?.provideChatInputCompletions?.(resource, params, token);
254
- this._readOnlyHandler = this._register(
255
- instantiationService.createInstance(CloudSandboxReadOnlySessionHandler, _config)
256
- );
257
- }
258
- setLiveProvider(provider) {
259
- this._liveProvider = provider;
260
- if (!this._liveReady.isSettled) {
261
- void this._liveReady.complete(provider);
262
- }
263
- for (const entry of ( this._sessions.values())) {
264
- entry.trace.record("liveProviderReady");
265
- }
266
- this.retryLiveSessions();
267
- }
268
- retryLiveSessions() {
269
- for (const entry of ( this._sessions.values())) {
270
- this._loadLive(entry);
271
- }
272
- }
273
- async provideChatSessionContent(resource, token) {
274
- let entry = this._sessions.get(resource);
275
- if (!entry) {
276
- const store = ( new DisposableStore());
277
- const historyStore = store.add(( new DisposableStore()));
278
- const entryToken = cancelOnDispose(store);
279
- const historyToken = cancelOnDispose(historyStore);
280
- const trace = store.add(( new CloudSandboxSessionTrace(this._logService)));
281
- entry = {
282
- resource,
283
- store,
284
- token: entryToken,
285
- historyStore,
286
- historyToken,
287
- trace,
288
- ready: ( new DeferredPromise()),
289
- liveStore: store.add(( new MutableDisposable())),
290
- liveProviderTimeout: store.add(( new MutableDisposable())),
291
- liveRequested: false,
292
- historyRequested: false,
293
- live: false,
294
- waiters: 0,
295
- references: 0,
296
- hasHistory: false,
297
- historyFailed: false,
298
- historyRetryAfter: 0,
299
- liveFailed: false,
300
- liveProviderWaitExpired: false,
301
- dispose: () => store.dispose()
302
- };
303
- this._sessions.set(resource, entry);
304
- const current = entry;
305
- let previousConnection = this._config.connectionStatus?.get().kind;
306
- store.add(autorun(reader => {
307
- const connection = this._config.connectionStatus?.read(reader).kind;
308
- if (connection !== previousConnection) {
309
- previousConnection = connection;
310
- current.liveProviderWaitExpired = false;
311
- current.liveProviderTimeout.clear();
312
- }
313
- this._updateHistoryStatus(current);
314
- }));
315
- store.add(this._chatService.onDidSubmitRequest(event => {
316
- if (isEqual(event.chatSessionResource, resource)) {
317
- this._apiService.invalidateSessionHistory(this._config.taskId);
318
- }
319
- }));
320
- if (this._liveProvider) {
321
- entry.trace.record("liveProviderReady");
322
- }
323
- void this._loadHistory(entry);
324
- this._loadLive(entry);
325
- }
326
- entry.waiters++;
327
- try {
328
- const session = await raceCancellationError(raceCancellationError(entry.ready.p, entry.token), token);
329
- if (token.isCancellationRequested || entry.token.isCancellationRequested) {
330
- throw ( new CancellationError());
331
- }
332
- entry.references++;
333
- const current = entry;
334
- const reference = ( new CloudSandboxChatSessionReference(session, () => {
335
- current.references--;
336
- this._disposeUnreferencedSession(current);
337
- }));
338
- entry.trace.associate(reference);
339
- return reference;
340
- } finally {
341
- entry.waiters--;
342
- this._disposeUnreferencedSession(entry);
343
- }
344
- }
345
- _disposeUnreferencedSession(entry) {
346
- if (entry.references === 0 && entry.waiters === 0 && this._sessions.get(entry.resource) === entry) {
347
- this._sessions.deleteAndDispose(entry.resource);
348
- }
349
- }
350
- _accept(entry, source, kind) {
351
- const live = kind === "live";
352
- if (entry.token.isCancellationRequested || entry.live || (kind === "cache" && entry.session)) {
353
- entry.trace.record("discarded", {
354
- source: kind,
355
- reason: entry.live ? "liveAlreadyAccepted" : entry.token.isCancellationRequested ? "disposed" : "alreadyLoaded"
356
- });
357
- source.dispose();
358
- return;
359
- }
360
- if (!isEqual(source.sessionResource, entry.resource)) {
361
- source.dispose();
362
- throw ( new Error("The sandbox content provider returned a different session resource."));
363
- }
364
- if (live) {
365
- const unchanged = entry.hasHistory && !!entry.session && equals(
366
- getChatSessionHistoryContent(entry.session.history),
367
- getChatSessionHistoryContent(source.history)
368
- );
369
- this._apiService.invalidateSessionHistory(this._config.taskId, unchanged);
370
- }
371
- if (entry.session) {
372
- const session = entry.session;
373
- transaction(tx => {
374
- session.promote(source, live);
375
- session.historyStatus.set(undefined, tx);
376
- if (source.title !== undefined) {
377
- this._chatService.setSessionTitle(entry.resource, source.title);
378
- }
379
- });
380
- entry.trace.record("promoted", {
381
- source: kind,
382
- historyItems: source.history.length
383
- });
384
- } else {
385
- const session = entry.store.add(( new PromotableCloudSandboxChatSession(
386
- source,
387
- () => this._apiService.invalidateSessionHistory(this._config.taskId),
388
- live
389
- )));
390
- entry.trace.associate(session);
391
- entry.session = session;
392
- entry.store.add(Event.once(session.onWillDispose)(() => {
393
- if (this._sessions.get(entry.resource) === entry) {
394
- this._sessions.deleteAndDispose(entry.resource);
395
- }
396
- }));
397
- entry.trace.record("contentReady", {
398
- source: kind,
399
- historyItems: source.history.length
400
- });
401
- void entry.ready.complete(session);
402
- }
403
- entry.live = live;
404
- entry.hasHistory = kind !== "historyError" && source.history.length > 0;
405
- entry.historyFailed = false;
406
- if (live) {
407
- entry.historyStore.dispose();
408
- }
409
- this._updateHistoryStatus(entry);
410
- }
411
- _updateHistoryStatus(entry) {
412
- if (entry.token.isCancellationRequested) {
413
- return;
414
- }
415
- const connection = this._config.connectionStatus?.get().kind;
416
- const waitingForProvider = connection === "connected" && !this._liveProvider && !entry.liveProviderWaitExpired;
417
- if (waitingForProvider && entry.historyFailed && !entry.liveProviderTimeout.value) {
418
- entry.liveProviderTimeout.value = disposableTimeout(() => {
419
- entry.liveProviderWaitExpired = true;
420
- this._logService.warn(
421
- "[CloudSandbox] Live content provider did not become available before the recorded-history recovery deadline."
422
- );
423
- this._updateHistoryStatus(entry);
424
- }, LIVE_CONTENT_TIMEOUT_MS);
425
- } else if (!waitingForProvider || entry.live) {
426
- entry.liveProviderTimeout.clear();
427
- }
428
- const pending = connection === "connecting" || connection === "reconnecting" || waitingForProvider || entry.liveRequested;
429
- const kind = !entry.live && !pending ? entry.hasHistory && entry.historyFailed ? "history" : entry.liveFailed ? "live" : undefined : undefined;
430
- const session = entry.session;
431
- if (!session || session.historyStatus.get()?.kind === kind) {
432
- return;
433
- }
434
- session.historyStatus.set(kind === "history" ? {
435
- kind,
436
- message: ( localize(
437
- 13270,
438
- "Couldn't refresh this conversation. Recent messages may be missing."
439
- )),
440
- action: {
441
- label: ( localize(13271, "Refresh")),
442
- run: () => this._loadHistory(entry)
443
- }
444
- } : kind === "live" ? {
445
- kind,
446
- message: ( localize(13272, "Couldn't load the live conversation. Try again to continue.")),
447
- action: {
448
- label: ( localize(13273, "Retry")),
449
- run: () => this._loadLive(entry)
450
- }
451
- } : undefined, undefined);
452
- }
453
- async _loadHistory(entry) {
454
- if (entry.historyRequested || entry.live || entry.token.isCancellationRequested) {
455
- return;
456
- }
457
- entry.historyRequested = true;
458
- const watch = StopWatch.create(false);
459
- entry.trace.record("historyStarted");
460
- const cancellationListener = entry.historyStore.add(entry.historyToken.onCancellationRequested(() => {
461
- entry.trace.record("historyCancelled", {
462
- reason: entry.live ? "liveWon" : "disposed",
463
- durationMs: watch.elapsed()
464
- });
465
- }));
466
- try {
467
- const delay = entry.historyRetryAfter - Date.now();
468
- if (delay > 0) {
469
- await timeout(delay, entry.historyToken);
470
- }
471
- const source = await this._readOnlyHandler.provideChatSessionContent(
472
- entry.resource,
473
- entry.historyToken,
474
- entry.trace.id,
475
- cached => this._accept(entry, cached, "cache"),
476
- entry.hasHistory
477
- );
478
- entry.trace.record("historyReady", {
479
- durationMs: watch.elapsed(),
480
- historyItems: source.history.length
481
- });
482
- this._accept(entry, source, "history");
483
- } catch (error) {
484
- if (entry.historyToken.isCancellationRequested || entry.live) {
485
- return;
486
- }
487
- if (isCancellationError(error)) {
488
- entry.trace.record("historyCancelled", {
489
- reason: "providerCancelled",
490
- durationMs: watch.elapsed()
491
- });
492
- if (!entry.session) {
493
- void entry.ready.error(error);
494
- }
495
- return;
496
- }
497
- entry.trace.record("historyFailed", {
498
- durationMs: watch.elapsed()
499
- });
500
- this._logService.error("[CloudSandbox] Failed to load recorded conversation", error);
501
- const accessLost = error instanceof CloudSandboxAuthenticationRequiredError || (error instanceof CloudSandboxRequestError && [401, 403, 404].includes(error.statusCode ?? 0));
502
- if (entry.hasHistory && !accessLost) {
503
- entry.historyFailed = true;
504
- entry.historyRetryAfter = Date.now() + (error instanceof CloudSandboxRequestError ? (error.retryAfterSeconds ?? 0) * 1000 : 0);
505
- this._updateHistoryStatus(entry);
506
- return;
507
- }
508
- this._accept(entry, ( new ReadOnlyChatSession(entry.resource, [{
509
- type: "request",
510
- prompt: "",
511
- participant: this._config.agentId,
512
- isSystemInitiated: true,
513
- systemInitiatedLabel: ( localize(13274, "Couldn't load recorded conversation"))
514
- }, {
515
- type: "response",
516
- parts: [],
517
- participant: this._config.agentId,
518
- errorDetails: {
519
- message: toErrorMessage(error)
520
- }
521
- }], undefined, constObservable(true))), "historyError");
522
- } finally {
523
- entry.historyRequested = false;
524
- entry.historyStore.delete(cancellationListener);
525
- }
526
- }
527
- async _loadLive(entry) {
528
- const provider = this._liveProvider;
529
- if (!provider || entry.live || entry.liveRequested || entry.token.isCancellationRequested) {
530
- return;
531
- }
532
- entry.liveRequested = true;
533
- entry.liveFailed = false;
534
- entry.liveProviderTimeout.clear();
535
- this._updateHistoryStatus(entry);
536
- const watch = StopWatch.create(false);
537
- entry.trace.record("liveStarted");
538
- const store = ( new DisposableStore());
539
- entry.liveStore.value = store;
540
- const source = store.add(( new CancellationTokenSource(entry.token)));
541
- const token = source.token;
542
- let timedOut = false;
543
- store.add(disposableTimeout(() => {
544
- timedOut = true;
545
- source.cancel();
546
- }, LIVE_CONTENT_TIMEOUT_MS));
547
- try {
548
- const pending = provider.provideChatSessionContent(entry.resource, token).then(session => {
549
- if (token.isCancellationRequested) {
550
- session.dispose();
551
- throw ( new CancellationError());
552
- }
553
- return session;
554
- });
555
- const session = await raceCancellationError(pending, token);
556
- if (token.isCancellationRequested) {
557
- session.dispose();
558
- throw ( new CancellationError());
559
- }
560
- entry.trace.record("liveReady", {
561
- durationMs: watch.elapsed(),
562
- historyItems: session.history.length
563
- });
564
- this._accept(entry, session, "live");
565
- } catch (error) {
566
- const cancelled = entry.token.isCancellationRequested || (!timedOut && isCancellationError(error));
567
- entry.trace.record(cancelled ? "liveCancelled" : "liveFailed", {
568
- durationMs: watch.elapsed()
569
- });
570
- if (!cancelled) {
571
- entry.liveFailed = true;
572
- this._logService.error(
573
- "[CloudSandbox] Failed to load live conversation; retaining recorded history",
574
- timedOut ? ( new Error("Loading the live conversation timed out.")) : error
575
- );
576
- }
577
- } finally {
578
- entry.liveRequested = false;
579
- entry.liveStore.clear();
580
- this._updateHistoryStatus(entry);
581
- }
582
- }
583
- get updateChatSessionMetadata() {
584
- const provider = this._liveProvider;
585
- return provider?.updateChatSessionMetadata ? (resource, metadata) => provider.updateChatSessionMetadata(resource, metadata) : undefined;
586
- }
587
- resolveChatResponseUri(resource, href, kind) {
588
- return this._liveProvider?.resolveChatResponseUri?.(resource, href, kind) ?? href;
589
- }
590
- async provideChatInputCompletionTriggerCharacters() {
591
- const provider = await this._liveReady.p;
592
- const characters = (await provider?.provideChatInputCompletionTriggerCharacters?.()) ?? [];
593
- return this._store.isDisposed ? [] : characters;
594
- }
595
- dispose() {
596
- if (!this._liveReady.isSettled) {
597
- void this._liveReady.complete(undefined);
598
- }
599
- super.dispose();
600
- }
601
- };
602
- CloudSandboxSessionHandler = ( __decorate([( __param(1, IInstantiationService)), ( __param(2, ILogService)), ( __param(3, ICloudSandboxApiService)), ( __param(4, IChatService))], CloudSandboxSessionHandler));
603
-
604
- export { CloudSandboxSessionHandler };