@codingame/monaco-vscode-chat-service-override 38.0.7 → 38.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/common.js +0 -53
- package/index.js +0 -3
- package/package.json +5 -5
- package/session.js +0 -3
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/missionControlAgentHostContribution.js +1 -1
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/remoteAgentHostActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostChatContribution.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.shared.contribution.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxSessionListController.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxSessionListController.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/editorCloudSandboxContribution.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/editorCloudSandboxContribution.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/missionControlEnvironmentActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/remoteAgentHost.contribution.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/remoteAgentHostChatContribution.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewTitleControl.js +1 -1
- package/vscode/src/vs/platform/agentHost/browser/webPubSubRelayTransport.d.ts +0 -135
- package/vscode/src/vs/platform/agentHost/browser/webPubSubRelayTransport.js +0 -510
- package/vscode/src/vs/platform/agentHost/common/agentModelNotices.d.ts +0 -22
- package/vscode/src/vs/platform/agentHost/common/agentModelNotices.js +0 -21
- package/vscode/src/vs/platform/agentHost/common/cloudSandboxAgentHost.d.ts +0 -273
- package/vscode/src/vs/platform/agentHost/common/cloudSandboxAgentHost.js +0 -61
- package/vscode/src/vs/platform/agentHost/common/meta/agentModelMeta.d.ts +0 -7
- package/vscode/src/vs/platform/agentHost/common/meta/agentModelMeta.js +0 -17
- package/vscode/src/vs/platform/agentHost/common/meta/copilotd/cloudSandboxProjectMeta.d.ts +0 -12
- package/vscode/src/vs/platform/agentHost/common/meta/copilotd/cloudSandboxProjectMeta.js +0 -48
- package/vscode/src/vs/platform/agentHost/common/meta/vscode/agentModelEnsembleMeta.d.ts +0 -8
- package/vscode/src/vs/platform/agentHost/common/meta/vscode/agentModelEnsembleMeta.js +0 -11
- package/vscode/src/vs/platform/agentHost/common/meta/vscode/agentModelPricing.d.ts +0 -114
- package/vscode/src/vs/platform/agentHost/common/meta/vscode/agentModelPricing.js +0 -141
- package/vscode/src/vs/platform/agentHost/common/taskEventReplay.d.ts +0 -48
- package/vscode/src/vs/platform/agentHost/common/taskEventReplay.js +0 -238
- package/vscode/src/vs/platform/agentHost/common/webPubSub/chunking.d.ts +0 -102
- package/vscode/src/vs/platform/agentHost/common/webPubSub/chunking.js +0 -260
- package/vscode/src/vs/platform/agentHost/common/webPubSub/framing.d.ts +0 -102
- package/vscode/src/vs/platform/agentHost/common/webPubSub/framing.js +0 -115
- package/vscode/src/vs/platform/agentHost/common/webPubSub/groups.d.ts +0 -46
- package/vscode/src/vs/platform/agentHost/common/webPubSub/groups.js +0 -92
- package/vscode/src/vs/sessions/contrib/chat/browser/newSession.d.ts +0 -9
- package/vscode/src/vs/sessions/contrib/chat/browser/voiceBridge.contribution.d.ts +0 -14
- package/vscode/src/vs/sessions/contrib/chat/browser/voiceBridge.contribution.js +0 -385
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/cloudAutomationStore.d.ts +0 -67
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/cloudAutomationStore.js +0 -695
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/cloudSandboxSessionConfig.d.ts +0 -4
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/cloudSandboxSessionConfig.js +0 -39
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessions.contribution.d.ts +0 -1
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessions.contribution.js +0 -59
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsActions.d.ts +0 -1
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsActions.js +0 -83
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsChangesets.d.ts +0 -87
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsChangesets.js +0 -176
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsProvider.d.ts +0 -422
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsProvider.js +0 -2444
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/githubCloudAutomationStore.d.ts +0 -91
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/githubCloudAutomationStore.js +0 -620
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/cloudSandboxAgentHost.contribution.d.ts +0 -1
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/cloudSandboxAgentHost.contribution.js +0 -5
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/cloudSandboxAgentHostContribution.d.ts +0 -46
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/cloudSandboxAgentHostContribution.js +0 -321
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/cloudSandboxSessionsProvider.d.ts +0 -104
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/cloudSandboxSessionsProvider.js +0 -345
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoice.contribution.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoice.contribution.js +0 -611
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceSessionsPicker.d.ts +0 -20
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceSessionsPicker.js +0 -85
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidget.d.ts +0 -200
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidget.js +0 -981
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidgetBinding.d.ts +0 -24
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidgetBinding.js +0 -206
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWindowService.d.ts +0 -65
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWindowService.js +0 -368
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/confirmationComponent.d.ts +0 -10
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/confirmationComponent.js +0 -57
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/feedbackDialog.d.ts +0 -33
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/feedbackDialog.js +0 -98
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/headerComponent.d.ts +0 -32
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/headerComponent.js +0 -186
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/onboardingComponent.d.ts +0 -12
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/onboardingComponent.js +0 -116
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/sessionListComponent.d.ts +0 -32
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/sessionListComponent.js +0 -226
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/statusRowsComponent.d.ts +0 -18
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/statusRowsComponent.js +0 -138
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/tokens.d.ts +0 -32
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/tokens.js +0 -29
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/transcriptComponent.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/transcriptComponent.js +0 -108
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/voiceBarComponent.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/voiceBarComponent.js +0 -63
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/media/voiceModeOnboarding.css +0 -252
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/transcriptsView/voiceTranscripts.contribution.d.ts +0 -1
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/transcriptsView/voiceTranscripts.contribution.js +0 -178
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/transcriptsView/voiceTranscriptsView.d.ts +0 -47
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/transcriptsView/voiceTranscriptsView.js +0 -322
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/voiceModeOnboarding.d.ts +0 -146
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/voiceModeOnboarding.js +0 -890
- package/vscode/src/vs/workbench/contrib/agentsVoice/common/voiceTranscriptStore.d.ts +0 -132
- package/vscode/src/vs/workbench/contrib/agentsVoice/common/voiceTranscriptStore.js +0 -237
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostLanguageModelProvider.d.ts +0 -120
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostLanguageModelProvider.js +0 -234
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsPicker.d.ts +0 -36
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsPicker.js +0 -164
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/repositoryPicker.d.ts +0 -21
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/repositoryPicker.js +0 -122
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupMicrosoftProbe.d.ts +0 -82
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupMicrosoftProbe.js +0 -213
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxAgentHostService.d.ts +0 -40
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxAgentHostService.js +0 -561
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxApiService.d.ts +0 -133
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxApiService.js +0 -1176
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxConnectionCustomization.d.ts +0 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxConnectionCustomization.js +0 -76
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxCredentialRefresh.d.ts +0 -54
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxCredentialRefresh.js +0 -220
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxHistoryCache.d.ts +0 -21
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxHistoryCache.js +0 -184
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxLegacySessionPreparation.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxLegacySessionPreparation.js +0 -165
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxModels.d.ts +0 -43
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxModels.js +0 -162
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxReadOnlySessionHandler.d.ts +0 -40
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxReadOnlySessionHandler.js +0 -129
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxSessionContribution.d.ts +0 -166
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxSessionContribution.js +0 -838
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxSessionHandler.d.ts +0 -40
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxSessionHandler.js +0 -604
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxTelemetry.d.ts +0 -289
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxTelemetry.js +0 -497
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/missionControlCredentialSealing.d.ts +0 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/missionControlCredentialSealing.js +0 -41
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/missionControlEnvironmentService.d.ts +0 -73
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/missionControlEnvironmentService.js +0 -398
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/missionControlSharingService.d.ts +0 -45
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/missionControlSharingService.js +0 -296
- package/vscode/src/vs/workbench/contrib/chat/browser/speechToText/voiceCodeTranscriptionClient.d.ts +0 -63
- package/vscode/src/vs/workbench/contrib/chat/browser/speechToText/voiceCodeTranscriptionClient.js +0 -361
- package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/ttsPlaybackService.d.ts +0 -34
- package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/ttsPlaybackService.js +0 -198
- package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/voiceClientService.d.ts +0 -131
- package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/voiceClientService.js +0 -871
- package/vscode/src/vs/workbench/contrib/chat/browser/voiceInputMode/voiceInputMode.d.ts +0 -66
- package/vscode/src/vs/workbench/contrib/chat/browser/voiceInputMode/voiceInputMode.js +0 -297
- package/vscode/src/vs/workbench/contrib/chat/common/voicePlaybackService.d.ts +0 -31
- package/vscode/src/vs/workbench/contrib/chat/common/voicePlaybackService.js +0 -118
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { raceCancellationError, disposableTimeout } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
3
|
-
import { cancelOnDispose, CancellationTokenPool } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
4
|
-
import { CancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
5
|
-
import { DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
6
|
-
import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
|
|
7
|
-
import { equals } from '@codingame/monaco-vscode-api/vscode/vs/base/common/objects';
|
|
8
|
-
import { equalsIgnoreCase } from '@codingame/monaco-vscode-api/vscode/vs/base/common/strings';
|
|
9
|
-
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
10
|
-
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
11
|
-
import { readCloudSandboxProjects, readCloudSandboxCloneResult } from '../../../../../platform/agentHost/common/meta/copilotd/cloudSandboxProjectMeta.js';
|
|
12
|
-
import { getGitHubRepositoryFromRemoteUrl } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/git/common/utils';
|
|
13
|
-
|
|
14
|
-
function createCloudSandboxSessionPreparation(root, request, owner) {
|
|
15
|
-
const lifetime = cancelOnDispose(owner);
|
|
16
|
-
const preparations = ( new Map());
|
|
17
|
-
return async (selection, token) => {
|
|
18
|
-
if (token.isCancellationRequested || lifetime.isCancellationRequested) {
|
|
19
|
-
throw ( new CancellationError());
|
|
20
|
-
}
|
|
21
|
-
if (!selection || selection.scheme !== Schemas.https) {
|
|
22
|
-
return undefined;
|
|
23
|
-
}
|
|
24
|
-
const state = root.value;
|
|
25
|
-
if (state instanceof Error) {
|
|
26
|
-
throw state;
|
|
27
|
-
}
|
|
28
|
-
if (!state) {
|
|
29
|
-
throw ( new Error(( localize(13251, "The cloud sandbox's project state is unavailable."))));
|
|
30
|
-
}
|
|
31
|
-
const projects = readCloudSandboxProjects(state);
|
|
32
|
-
if (!projects) {
|
|
33
|
-
return undefined;
|
|
34
|
-
}
|
|
35
|
-
const repository = getGitHubRepositoryFromRemoteUrl(( selection.toString()), ["github.com"]);
|
|
36
|
-
if (!repository || !equalsIgnoreCase(selection.authority, "github.com") || selection.query || selection.fragment) {
|
|
37
|
-
throw ( new Error(( localize(
|
|
38
|
-
13252,
|
|
39
|
-
"The cloud sandbox requires a GitHub repository URL without credentials, a query, or a fragment."
|
|
40
|
-
))));
|
|
41
|
-
}
|
|
42
|
-
const key = `${repository.owner.toLowerCase()}/${repository.repo.toLowerCase()}`;
|
|
43
|
-
let preparation = preparations.get(key);
|
|
44
|
-
if (!preparation || preparation.cancellation.token.isCancellationRequested) {
|
|
45
|
-
const cancellation = ( new CancellationTokenPool());
|
|
46
|
-
const promise = prepareRepository(repository, projects, cancellation.token).finally(() => {
|
|
47
|
-
if (preparations.get(key)?.promise === promise) {
|
|
48
|
-
preparations.delete(key);
|
|
49
|
-
}
|
|
50
|
-
cancellation.dispose();
|
|
51
|
-
});
|
|
52
|
-
preparation = {
|
|
53
|
-
promise,
|
|
54
|
-
cancellation
|
|
55
|
-
};
|
|
56
|
-
preparations.set(key, preparation);
|
|
57
|
-
}
|
|
58
|
-
preparation.cancellation.add(token);
|
|
59
|
-
return raceCancellationError(preparation.promise, token);
|
|
60
|
-
};
|
|
61
|
-
async function prepareRepository(repository, projects, token) {
|
|
62
|
-
const matchesRepository = project => {
|
|
63
|
-
const remote = project.remoteUrl && getGitHubRepositoryFromRemoteUrl(project.remoteUrl, ["github.com"]);
|
|
64
|
-
return !!remote && equalsIgnoreCase(remote.owner, repository.owner) && equalsIgnoreCase(remote.repo, repository.repo);
|
|
65
|
-
};
|
|
66
|
-
const matching = projects.filter(matchesRepository);
|
|
67
|
-
const existing = matching.find(project => project.status === "ready") ?? matching.find(project => project.status === "cloning");
|
|
68
|
-
const store = ( new DisposableStore());
|
|
69
|
-
try {
|
|
70
|
-
return await ( new Promise((resolve, reject) => {
|
|
71
|
-
let projectId = existing?.id;
|
|
72
|
-
let staleFailure = matching.find(project => project.status === "failed");
|
|
73
|
-
const seen = ( new Set(projects.map(project => project.id)));
|
|
74
|
-
const update = () => {
|
|
75
|
-
if (store.isDisposed) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
const state = root.value;
|
|
79
|
-
if (state instanceof Error) {
|
|
80
|
-
reject(state);
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
const current = state && readCloudSandboxProjects(state);
|
|
84
|
-
if (!current) {
|
|
85
|
-
reject(( new Error(( localize(13253, "The cloud sandbox no longer advertises repository preparation.")))));
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
if (staleFailure && !equals(staleFailure, current.find(project => project.id === staleFailure?.id))) {
|
|
89
|
-
staleFailure = undefined;
|
|
90
|
-
}
|
|
91
|
-
const project = current.find(project => project.id === projectId);
|
|
92
|
-
if (projectId && !project && ( seen.has(projectId))) {
|
|
93
|
-
reject(( new Error(( localize(
|
|
94
|
-
13254,
|
|
95
|
-
"The repository was removed from the cloud sandbox while it was being prepared."
|
|
96
|
-
)))));
|
|
97
|
-
}
|
|
98
|
-
for (const entry of current) {
|
|
99
|
-
seen.add(entry.id);
|
|
100
|
-
}
|
|
101
|
-
if (!project) {
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
if (!matchesRepository(project)) {
|
|
105
|
-
reject(( new Error(( localize(13255, "The cloud sandbox returned a different repository.")))));
|
|
106
|
-
} else if (project.status === "failed" && !equals(project, staleFailure)) {
|
|
107
|
-
reject(getCloneError(project));
|
|
108
|
-
} else if (project.status === "ready") {
|
|
109
|
-
if (!project.git || !project.path.startsWith("/") || project.path.includes("\u0000")) {
|
|
110
|
-
reject(( new Error(( localize(13256, "The cloud sandbox did not return a usable repository directory.")))));
|
|
111
|
-
} else {
|
|
112
|
-
resolve(URI.file(project.path));
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
store.add(root.onDidChange(update));
|
|
117
|
-
if (root.onDidError) {
|
|
118
|
-
store.add(root.onDidError(reject));
|
|
119
|
-
}
|
|
120
|
-
store.add(token.onCancellationRequested(() => reject(( new CancellationError()))));
|
|
121
|
-
store.add(lifetime.onCancellationRequested(() => reject(( new CancellationError()))));
|
|
122
|
-
store.add(disposableTimeout(() => reject(( new Error(( localize(13257, "Repository cloning did not finish within five minutes."))))), 5 * 60_000));
|
|
123
|
-
update();
|
|
124
|
-
if (!projectId) {
|
|
125
|
-
const url = ( ( URI.from({
|
|
126
|
-
scheme: Schemas.https,
|
|
127
|
-
authority: "github.com",
|
|
128
|
-
path: `/${repository.owner}/${repository.repo}`
|
|
129
|
-
})).toString());
|
|
130
|
-
request("extensions/cloneProject", {
|
|
131
|
-
url,
|
|
132
|
-
depth: 1
|
|
133
|
-
}).then(result => {
|
|
134
|
-
if (store.isDisposed) {
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
const project = readCloudSandboxCloneResult(result);
|
|
138
|
-
if (!project || (project.status !== "failed" && !matchesRepository(project))) {
|
|
139
|
-
reject(( new Error(( localize(
|
|
140
|
-
13258,
|
|
141
|
-
"The cloud sandbox returned an invalid repository cloning response."
|
|
142
|
-
)))));
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
if (project.status === "failed") {
|
|
146
|
-
reject(getCloneError(project));
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
projectId = project.id;
|
|
150
|
-
update();
|
|
151
|
-
}, reject);
|
|
152
|
-
}
|
|
153
|
-
}));
|
|
154
|
-
} finally {
|
|
155
|
-
store.dispose();
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
function getCloneError(project) {
|
|
160
|
-
return (new Error(
|
|
161
|
-
project.error ? ( localize(13259, "Repository cloning failed: {0}", project.error)) : ( localize(13260, "Repository cloning failed."))
|
|
162
|
-
));
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
export { createCloudSandboxSessionPreparation };
|
package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxModels.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
|
-
import { ICloudSandboxModelCatalog } from "../../../../../platform/agentHost/common/cloudSandboxAgentHost.js";
|
|
3
|
-
import { ICloudSandboxApiService } from "@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/cloudSandboxAgentHost.service";
|
|
4
|
-
import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
|
|
5
|
-
import { INotificationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification.service";
|
|
6
|
-
import { ILanguageModelChatMetadataAndIdentifier } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels";
|
|
7
|
-
import { ILanguageModelsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels.service";
|
|
8
|
-
import { AgentHostLanguageModelProvider } from "../agentSessions/agentHost/agentHostLanguageModelProvider.js";
|
|
9
|
-
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
10
|
-
import { ICloudSandboxModelCatalogService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxModels.service";
|
|
11
|
-
/** Shares account-scoped discovery and retry notifications across all sandbox model providers. */
|
|
12
|
-
export declare class CloudSandboxModelCatalogService extends Disposable implements ICloudSandboxModelCatalogService {
|
|
13
|
-
private readonly _api;
|
|
14
|
-
private readonly _logService;
|
|
15
|
-
private readonly _notificationService;
|
|
16
|
-
readonly _serviceBrand: undefined;
|
|
17
|
-
private readonly _onDidChange;
|
|
18
|
-
readonly onDidChange: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<void>;
|
|
19
|
-
private readonly _token;
|
|
20
|
-
private readonly _requestCancellation;
|
|
21
|
-
private readonly _notification;
|
|
22
|
-
private _request;
|
|
23
|
-
private _requested;
|
|
24
|
-
private _generation;
|
|
25
|
-
private _catalog;
|
|
26
|
-
get catalog(): ICloudSandboxModelCatalog | undefined;
|
|
27
|
-
constructor(_api: ICloudSandboxApiService, _logService: ILogService, _notificationService: INotificationService);
|
|
28
|
-
load(retry?: boolean): void;
|
|
29
|
-
}
|
|
30
|
-
/** Adapts the shared cloud catalog to one draft or connected host's model identifier space. */
|
|
31
|
-
export declare class CloudSandboxModels extends Disposable {
|
|
32
|
-
private readonly _catalogService;
|
|
33
|
-
private readonly _onDidChange;
|
|
34
|
-
readonly onDidChange: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<void>;
|
|
35
|
-
private readonly _token;
|
|
36
|
-
private readonly _provider;
|
|
37
|
-
private _generation;
|
|
38
|
-
models: readonly ILanguageModelChatMetadataAndIdentifier[];
|
|
39
|
-
ready: boolean;
|
|
40
|
-
constructor(sessionType: string, vendor: string, modelProvider: AgentHostLanguageModelProvider | undefined, _catalogService: ICloudSandboxModelCatalogService, languageModelsService: ILanguageModelsService, instantiationService: IInstantiationService);
|
|
41
|
-
load(retry?: boolean): void;
|
|
42
|
-
private _updateCatalog;
|
|
43
|
-
}
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
-
import { cancelOnDispose, CancellationTokenSource } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
4
|
-
import { isCancellationError, onUnexpectedError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
5
|
-
import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
6
|
-
import { Disposable, MutableDisposable, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
7
|
-
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
8
|
-
import { ICloudSandboxApiService } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/cloudSandboxAgentHost.service';
|
|
9
|
-
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
10
|
-
import '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification';
|
|
11
|
-
import { INotificationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification.service';
|
|
12
|
-
import { ILanguageModelsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels.service';
|
|
13
|
-
import { AgentHostLanguageModelProvider } from '../agentSessions/agentHost/agentHostLanguageModelProvider.js';
|
|
14
|
-
import { ChatAgentLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
|
|
15
|
-
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
16
|
-
import { ICloudSandboxModelCatalogService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxModels.service';
|
|
17
|
-
import Severity from '@codingame/monaco-vscode-api/vscode/vs/base/common/severity';
|
|
18
|
-
|
|
19
|
-
let CloudSandboxModelCatalogService = class CloudSandboxModelCatalogService extends Disposable {
|
|
20
|
-
get catalog() {
|
|
21
|
-
return this._catalog;
|
|
22
|
-
}
|
|
23
|
-
constructor(_api, _logService, _notificationService) {
|
|
24
|
-
super();
|
|
25
|
-
this._api = _api;
|
|
26
|
-
this._logService = _logService;
|
|
27
|
-
this._notificationService = _notificationService;
|
|
28
|
-
this._onDidChange = this._register(( new Emitter()));
|
|
29
|
-
this.onDidChange = this._onDidChange.event;
|
|
30
|
-
this._token = cancelOnDispose(this._store);
|
|
31
|
-
this._requestCancellation = this._register(( new MutableDisposable()));
|
|
32
|
-
this._notification = this._register(( new MutableDisposable()));
|
|
33
|
-
this._requested = false;
|
|
34
|
-
this._generation = 0;
|
|
35
|
-
this._register(this._api.onDidChangeAccount(() => {
|
|
36
|
-
this._generation++;
|
|
37
|
-
this._requestCancellation.value?.cancel();
|
|
38
|
-
this._requestCancellation.clear();
|
|
39
|
-
this._notification.clear();
|
|
40
|
-
this._request = undefined;
|
|
41
|
-
this._catalog = undefined;
|
|
42
|
-
this._onDidChange.fire();
|
|
43
|
-
if (this._requested) {
|
|
44
|
-
this.load(true);
|
|
45
|
-
}
|
|
46
|
-
}));
|
|
47
|
-
}
|
|
48
|
-
load(retry = false) {
|
|
49
|
-
if (this._request || (this._requested && !retry)) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
this._requested = true;
|
|
53
|
-
this._notification.clear();
|
|
54
|
-
const generation = this._generation;
|
|
55
|
-
const cancellation = ( new CancellationTokenSource(this._token));
|
|
56
|
-
this._requestCancellation.value = cancellation;
|
|
57
|
-
this._request = (async () => {
|
|
58
|
-
try {
|
|
59
|
-
const catalog = await this._api.listModels(cancellation.token);
|
|
60
|
-
if (this._store.isDisposed || generation !== this._generation) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
this._catalog = catalog;
|
|
64
|
-
this._onDidChange.fire();
|
|
65
|
-
} catch (error) {
|
|
66
|
-
if (isCancellationError(error) || this._store.isDisposed || generation !== this._generation) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
this._logService.error("[CloudSandboxModels] Failed to load cloud models", error);
|
|
70
|
-
const notification = this._notificationService.prompt(Severity.Error, ( localize(13261, "Could not load models for GitHub sandboxes.")), [{
|
|
71
|
-
label: ( localize(13262, "Retry")),
|
|
72
|
-
run: () => this.load(true)
|
|
73
|
-
}]);
|
|
74
|
-
this._notification.value = toDisposable(() => notification.close());
|
|
75
|
-
} finally {
|
|
76
|
-
if (generation === this._generation) {
|
|
77
|
-
this._request = undefined;
|
|
78
|
-
this._requestCancellation.clear();
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
})();
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
CloudSandboxModelCatalogService = ( __decorate([( __param(0, ICloudSandboxApiService)), ( __param(1, ILogService)), ( __param(2, INotificationService))], CloudSandboxModelCatalogService));
|
|
85
|
-
let CloudSandboxModels = class CloudSandboxModels extends Disposable {
|
|
86
|
-
constructor(
|
|
87
|
-
sessionType,
|
|
88
|
-
vendor,
|
|
89
|
-
modelProvider,
|
|
90
|
-
_catalogService,
|
|
91
|
-
languageModelsService,
|
|
92
|
-
instantiationService
|
|
93
|
-
) {
|
|
94
|
-
super();
|
|
95
|
-
this._catalogService = _catalogService;
|
|
96
|
-
this._onDidChange = this._register(( new Emitter()));
|
|
97
|
-
this.onDidChange = this._onDidChange.event;
|
|
98
|
-
this._token = cancelOnDispose(this._store);
|
|
99
|
-
this._generation = 0;
|
|
100
|
-
this.models = [];
|
|
101
|
-
this.ready = false;
|
|
102
|
-
if (modelProvider) {
|
|
103
|
-
this._provider = modelProvider;
|
|
104
|
-
this._register(toDisposable(() => modelProvider.updateAdditionalModels([])));
|
|
105
|
-
} else {
|
|
106
|
-
const descriptor = {
|
|
107
|
-
vendor,
|
|
108
|
-
displayName: ( localize(13263, "GitHub Sandboxes")),
|
|
109
|
-
configuration: undefined,
|
|
110
|
-
managementCommand: undefined,
|
|
111
|
-
when: undefined
|
|
112
|
-
};
|
|
113
|
-
languageModelsService.deltaLanguageModelChatProviderDescriptors([descriptor], []);
|
|
114
|
-
this._register(toDisposable(
|
|
115
|
-
() => languageModelsService.deltaLanguageModelChatProviderDescriptors([], [descriptor])
|
|
116
|
-
));
|
|
117
|
-
this._provider = this._register(
|
|
118
|
-
instantiationService.createInstance(AgentHostLanguageModelProvider, sessionType, vendor)
|
|
119
|
-
);
|
|
120
|
-
this._register(
|
|
121
|
-
languageModelsService.registerLanguageModelProvider(vendor, this._provider)
|
|
122
|
-
);
|
|
123
|
-
}
|
|
124
|
-
this._register(this._catalogService.onDidChange(() => {
|
|
125
|
-
void this._updateCatalog().catch(onUnexpectedError);
|
|
126
|
-
}));
|
|
127
|
-
void this._updateCatalog().catch(onUnexpectedError);
|
|
128
|
-
}
|
|
129
|
-
load(retry = false) {
|
|
130
|
-
this._catalogService.load(retry);
|
|
131
|
-
}
|
|
132
|
-
async _updateCatalog() {
|
|
133
|
-
const generation = ++this._generation;
|
|
134
|
-
const catalog = this._catalogService.catalog;
|
|
135
|
-
if (!catalog) {
|
|
136
|
-
this.models = [];
|
|
137
|
-
this.ready = false;
|
|
138
|
-
this._provider.updateAdditionalModels([]);
|
|
139
|
-
this._onDidChange.fire();
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
this._provider.updateAdditionalModels(catalog.models);
|
|
143
|
-
const models = await this._provider.provideLanguageModelChatInfo({}, this._token);
|
|
144
|
-
if (this._store.isDisposed || generation !== this._generation) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
this.models = models.map(model => ({
|
|
148
|
-
...model,
|
|
149
|
-
metadata: {
|
|
150
|
-
...model.metadata,
|
|
151
|
-
isDefaultForLocation: {
|
|
152
|
-
[ChatAgentLocation.Chat]: model.metadata.id === catalog.defaultModel
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}));
|
|
156
|
-
this.ready = true;
|
|
157
|
-
this._onDidChange.fire();
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
CloudSandboxModels = ( __decorate([( __param(3, ICloudSandboxModelCatalogService)), ( __param(4, ILanguageModelsService)), ( __param(5, IInstantiationService))], CloudSandboxModels));
|
|
161
|
-
|
|
162
|
-
export { CloudSandboxModelCatalogService, CloudSandboxModels };
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
|
|
2
|
-
import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event";
|
|
3
|
-
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
4
|
-
import { IObservable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/observable";
|
|
5
|
-
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
6
|
-
import { ICloudSandboxApiService } from "@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/cloudSandboxAgentHost.service";
|
|
7
|
-
import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
|
|
8
|
-
import { IChatSession, IChatSessionContentProvider, IChatSessionHistoryItem } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService";
|
|
9
|
-
export interface ICloudSandboxReadOnlyConfig {
|
|
10
|
-
/** Mission Control task owning the session, which is what persisted history is addressed by. */
|
|
11
|
-
readonly taskId: string;
|
|
12
|
-
/** Chat participant id. Matches the live handler, where `agentId === sessionType`. */
|
|
13
|
-
readonly agentId: string;
|
|
14
|
-
/** Sanitized agent-host authority used to rewrite resource URIs in history. */
|
|
15
|
-
readonly connectionAuthority: string;
|
|
16
|
-
}
|
|
17
|
-
/** A resolved chat session backed entirely by read-only history. */
|
|
18
|
-
export declare class ReadOnlyChatSession extends Disposable implements IChatSession {
|
|
19
|
-
readonly sessionResource: URI;
|
|
20
|
-
readonly history: readonly IChatSessionHistoryItem[];
|
|
21
|
-
readonly title: string | undefined;
|
|
22
|
-
readonly isReadOnly: IObservable<boolean>;
|
|
23
|
-
private readonly _onWillDispose;
|
|
24
|
-
readonly onWillDispose: Event<void>;
|
|
25
|
-
constructor(sessionResource: URI, history: readonly IChatSessionHistoryItem[], title: string | undefined, isReadOnly: IObservable<boolean>);
|
|
26
|
-
dispose(): void;
|
|
27
|
-
}
|
|
28
|
-
/** Loads recorded conversations independently of the sandbox's live connection. */
|
|
29
|
-
export declare class CloudSandboxReadOnlySessionHandler extends Disposable implements IChatSessionContentProvider {
|
|
30
|
-
private readonly _config;
|
|
31
|
-
private readonly _apiService;
|
|
32
|
-
private readonly _logService;
|
|
33
|
-
private readonly _isReadOnly;
|
|
34
|
-
constructor(_config: ICloudSandboxReadOnlyConfig, _apiService: ICloudSandboxApiService, _logService: ILogService);
|
|
35
|
-
provideChatSessionContent(sessionResource: URI, token: CancellationToken, diagnosticId?: string, onCachedSession?: (session: IChatSession) => void, hasHistory?: boolean): Promise<IChatSession>;
|
|
36
|
-
private _findSession;
|
|
37
|
-
private _getChatResource;
|
|
38
|
-
private _hasChatHistory;
|
|
39
|
-
private _createSession;
|
|
40
|
-
}
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
-
import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
4
|
-
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
5
|
-
import { MarkdownString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
|
|
6
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
7
|
-
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
8
|
-
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
9
|
-
import { AgentSession } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agent';
|
|
10
|
-
import { getAgentHostChatId } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentHostChatIdentity';
|
|
11
|
-
import { ICloudSandboxApiService } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/cloudSandboxAgentHost.service';
|
|
12
|
-
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
13
|
-
import { turnsToHistory, messageToRequestOrigin, messageToVariableData, activeTurnToProgress } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentHost/stateToProgressAdapter';
|
|
14
|
-
import { CHAT_SUBAGENT_RESOURCE_QUERY_PARAM } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
|
|
15
|
-
import { constObservable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/constObservable';
|
|
16
|
-
|
|
17
|
-
const LOG_PREFIX = "[CloudSandboxReadOnly]";
|
|
18
|
-
class ReadOnlyChatSession extends Disposable {
|
|
19
|
-
constructor(sessionResource, history, title, isReadOnly) {
|
|
20
|
-
super();
|
|
21
|
-
this.sessionResource = sessionResource;
|
|
22
|
-
this.history = history;
|
|
23
|
-
this.title = title;
|
|
24
|
-
this.isReadOnly = isReadOnly;
|
|
25
|
-
this._onWillDispose = this._register(( new Emitter()));
|
|
26
|
-
this.onWillDispose = this._onWillDispose.event;
|
|
27
|
-
}
|
|
28
|
-
dispose() {
|
|
29
|
-
this._onWillDispose.fire();
|
|
30
|
-
super.dispose();
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
let CloudSandboxReadOnlySessionHandler = class CloudSandboxReadOnlySessionHandler extends Disposable {
|
|
34
|
-
constructor(_config, _apiService, _logService) {
|
|
35
|
-
super();
|
|
36
|
-
this._config = _config;
|
|
37
|
-
this._apiService = _apiService;
|
|
38
|
-
this._logService = _logService;
|
|
39
|
-
this._isReadOnly = constObservable(true);
|
|
40
|
-
}
|
|
41
|
-
async provideChatSessionContent(sessionResource, token, diagnosticId, onCachedSession, hasHistory = false) {
|
|
42
|
-
const replayed = await this._apiService.getSessionHistory(this._config.taskId, token, diagnosticId, onCachedSession && (history => {
|
|
43
|
-
const session = this._findSession(sessionResource, history);
|
|
44
|
-
const chatResource = session && this._getChatResource(sessionResource, session);
|
|
45
|
-
const chat = chatResource ? session?.chats.get(chatResource) : undefined;
|
|
46
|
-
if (!this._hasChatHistory(chat)) {
|
|
47
|
-
this._logService.trace(
|
|
48
|
-
`${LOG_PREFIX} Cached history has no content for the requested conversation; waiting for fresh history.`
|
|
49
|
-
);
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
hasHistory = true;
|
|
53
|
-
onCachedSession(this._createSession(sessionResource, history));
|
|
54
|
-
}), history => {
|
|
55
|
-
const session = this._findSession(sessionResource, history);
|
|
56
|
-
const chatResource = session && this._getChatResource(sessionResource, session);
|
|
57
|
-
const chat = chatResource ? session?.chats.get(chatResource) : undefined;
|
|
58
|
-
return !!chat && (!hasHistory || this._hasChatHistory(chat));
|
|
59
|
-
});
|
|
60
|
-
return this._createSession(sessionResource, replayed, hasHistory);
|
|
61
|
-
}
|
|
62
|
-
_findSession(resource, history) {
|
|
63
|
-
return history?.sessions.find(session => AgentSession.id(( URI.parse(session.session))) === AgentSession.id(resource));
|
|
64
|
-
}
|
|
65
|
-
_getChatResource(resource, session) {
|
|
66
|
-
return ( new URLSearchParams(resource.query)).get(CHAT_SUBAGENT_RESOURCE_QUERY_PARAM) || (resource.fragment ? [...( session.chats.keys())].find(chat => getAgentHostChatId(chat) === resource.fragment) : session.defaultChat);
|
|
67
|
-
}
|
|
68
|
-
_hasChatHistory(chat) {
|
|
69
|
-
return !!chat && (chat.turns.length > 0 || !!chat.activeTurn);
|
|
70
|
-
}
|
|
71
|
-
_createSession(sessionResource, replayed, hasHistory = false) {
|
|
72
|
-
const sessionId = AgentSession.id(sessionResource);
|
|
73
|
-
const session = this._findSession(sessionResource, replayed);
|
|
74
|
-
const chatResource = session && this._getChatResource(sessionResource, session);
|
|
75
|
-
const chat = chatResource ? session?.chats.get(chatResource) : undefined;
|
|
76
|
-
if (hasHistory && (!this._hasChatHistory(chat) || replayed?.truncated)) {
|
|
77
|
-
throw ( new Error(( localize(13264, "The latest recorded conversation is unavailable or incomplete."))));
|
|
78
|
-
}
|
|
79
|
-
if (!session) {
|
|
80
|
-
this._logService.warn(
|
|
81
|
-
`${LOG_PREFIX} No persisted history for session ${sessionId} in task ${this._config.taskId} (replayed sessions: [${replayed?.sessions.map(s => s.session).join(", ") ?? "none"}]); opening an empty read-only session.`
|
|
82
|
-
);
|
|
83
|
-
return ( new ReadOnlyChatSession(sessionResource, [], undefined, this._isReadOnly));
|
|
84
|
-
}
|
|
85
|
-
const explicitChat = ( new URLSearchParams(sessionResource.query)).get(CHAT_SUBAGENT_RESOURCE_QUERY_PARAM);
|
|
86
|
-
if (!chat && (explicitChat || sessionResource.fragment)) {
|
|
87
|
-
throw ( new Error(( localize(13265, "Recorded history for this conversation is unavailable."))));
|
|
88
|
-
}
|
|
89
|
-
const history = chat ? turnsToHistory(( URI.parse(session.session)), chat.turns, this._config.agentId, this._config.connectionAuthority) : [];
|
|
90
|
-
const active = chat?.activeTurn;
|
|
91
|
-
if (active) {
|
|
92
|
-
history.push({
|
|
93
|
-
id: active.id,
|
|
94
|
-
type: "request",
|
|
95
|
-
prompt: active.message.text,
|
|
96
|
-
participant: this._config.agentId,
|
|
97
|
-
variableData: messageToVariableData(active.message, this._config.connectionAuthority),
|
|
98
|
-
origin: messageToRequestOrigin(( URI.parse(session.session)), active.message, this._config.agentId, this._config.connectionAuthority)
|
|
99
|
-
});
|
|
100
|
-
history.push({
|
|
101
|
-
type: "response",
|
|
102
|
-
parts: activeTurnToProgress(( URI.parse(session.session)), active, this._config.connectionAuthority, sessionResource.authority),
|
|
103
|
-
participant: this._config.agentId
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
if (replayed?.truncated) {
|
|
107
|
-
this._logService.warn(
|
|
108
|
-
`${LOG_PREFIX} History for task ${this._config.taskId} is truncated; the final exchange may be incomplete.`
|
|
109
|
-
);
|
|
110
|
-
history.push({
|
|
111
|
-
type: "response",
|
|
112
|
-
parts: [{
|
|
113
|
-
kind: "warning",
|
|
114
|
-
content: ( new MarkdownString(( localize(
|
|
115
|
-
13266,
|
|
116
|
-
"This conversation is incomplete. Its recorded history ends mid-response, so the last exchange may be missing."
|
|
117
|
-
))))
|
|
118
|
-
}],
|
|
119
|
-
participant: this._config.agentId
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
this._logService.info(`${LOG_PREFIX} Opened ${( sessionResource.toString())} read-only with ${history.length} history item(s) from ${chat?.turns.length ?? 0} turn(s); chats=[${[...( session.chats.keys())].join(", ")}], default=${session.defaultChat}.`);
|
|
123
|
-
const title = session.state.chats.find(summary => summary.resource === chatResource)?.title || (chatResource === session.defaultChat ? session.state.title : undefined);
|
|
124
|
-
return ( new ReadOnlyChatSession(sessionResource, history, title || undefined, this._isReadOnly));
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
CloudSandboxReadOnlySessionHandler = ( __decorate([( __param(1, ICloudSandboxApiService)), ( __param(2, ILogService))], CloudSandboxReadOnlySessionHandler));
|
|
128
|
-
|
|
129
|
-
export { CloudSandboxReadOnlySessionHandler, ReadOnlyChatSession };
|