@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,17 +0,0 @@
1
- import { ICloudSandboxAgentHostService } from "@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/cloudSandboxAgentHost.service";
2
- import { IAgentHostAuthenticateRequest } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostAuth";
3
- import { IRemoteAgentHostConnectionCustomization } from "./remoteAgentHostConnectionCustomization.js";
4
- /**
5
- * The {@link IRemoteAgentHostConnectionCustomization} for a cloud sandbox address, supplying the
6
- * ways the sandbox host deviates from the generic path:
7
- *
8
- * - **Auth**: the host only accepts a sealed envelope, so the connection's `encrypted_github_token`
9
- * is presented instead of the resolved bearer. Fails closed if no sealed token is available.
10
- * - **Scheme**: the host advertises provider `copilot` but addresses sessions as `ahp-session`.
11
- * - **Directory**: prepare an advertised repository checkout before creating a session.
12
- *
13
- * Returns `undefined` for non-sandbox addresses.
14
- */
15
- export declare function createCloudSandboxConnectionCustomization(address: string, sandboxService: ICloudSandboxAgentHostService, userLocal?: boolean, sealUserLocal?: (request: IAgentHostAuthenticateRequest) => Promise<IAgentHostAuthenticateRequest>): IRemoteAgentHostConnectionCustomization | undefined;
16
- /** Whether a remote-agent-host connection address identifies a cloud sandbox environment. */
17
- export declare function isCloudSandboxConnectionAddress(address: string): boolean;
@@ -1,76 +0,0 @@
1
-
2
- import { Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
3
- import { DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
4
- import { AgentHostProtocolClient } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/browser/agentHostProtocolClient';
5
- import '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentService';
6
- import '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/common/actions';
7
- import { AuthRequiredReason } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/common/notifications';
8
- import { cloudSandboxEnvironmentId, isCloudSandboxSealedToken, CLOUD_SANDBOX_SESSION_SCHEME, CLOUD_SANDBOX_AGENT_PROVIDER, CLOUD_SANDBOX_ADDRESS_PREFIX } from '../../../../../platform/agentHost/common/cloudSandboxAgentHost.js';
9
- import { createCloudSandboxSessionPreparation } from './cloudSandboxLegacySessionPreparation.js';
10
- import { GITHUB_COPILOT_PROTECTED_RESOURCE } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agent';
11
-
12
- function isGitHubResource(resource) {
13
- let host;
14
- try {
15
- host = ( new URL(resource)).hostname.toLowerCase();
16
- } catch {
17
- return false;
18
- }
19
- return host === "github.com" || host.endsWith(".github.com") || host === "githubcopilot.com" || host.endsWith(".githubcopilot.com") || host.endsWith(".ghe.com");
20
- }
21
- function createCloudSandboxConnectionCustomization(address, sandboxService, userLocal = false, sealUserLocal) {
22
- const environmentId = cloudSandboxEnvironmentId(address);
23
- if (environmentId === undefined) {
24
- return undefined;
25
- }
26
- const resolveAuthentication = async (resource, scopes, renew) => {
27
- if (!isGitHubResource(resource)) {
28
- throw ( new Error(`Cloud sandbox cannot authenticate the non-GitHub resource '${resource}'.`));
29
- }
30
- const sealed = renew ? await sandboxService.refreshSealedGitHubToken(environmentId) : sandboxService.getSealedGitHubToken(environmentId);
31
- if (!sealed || !isCloudSandboxSealedToken(sealed)) {
32
- throw ( new Error(
33
- `No sealed GitHub token is available for cloud sandbox ${address}; refusing to forward a plaintext bearer.`
34
- ));
35
- }
36
- return {
37
- resource,
38
- scopes,
39
- token: sealed
40
- };
41
- };
42
- return {
43
- requiresWorkspaceTrust: false,
44
- authenticate: async (request, reason) => {
45
- if (reason !== AuthRequiredReason.Expired && isCloudSandboxSealedToken(request.token)) {
46
- return request;
47
- }
48
- if (userLocal && ( new URL(request.resource)).origin !== ( new URL(GITHUB_COPILOT_PROTECTED_RESOURCE.resource)).origin) {
49
- if (!sealUserLocal) {
50
- throw ( new Error("User-local Mission Control sealing is unavailable."));
51
- }
52
- return sealUserLocal(request);
53
- }
54
- return resolveAuthentication(request.resource, request.scopes, reason === AuthRequiredReason.Expired);
55
- },
56
- renewAuthentication: userLocal ? undefined : resource => resolveAuthentication(resource.resource, resource.scopes_supported, true),
57
- backendSessionScheme: provider => provider === CLOUD_SANDBOX_AGENT_PROVIDER || (userLocal && provider === "copilotcli") ? CLOUD_SANDBOX_SESSION_SCHEME : undefined,
58
- createSessionPreparation: userLocal ? undefined : (connection, owner) => {
59
- if (!(connection instanceof AgentHostProtocolClient)) {
60
- throw ( new Error("Cloud sandbox session preparation requires a protocol client."));
61
- }
62
- const store = owner.add(( new DisposableStore()));
63
- store.add(Event.once(connection.onDidClose)(() => store.dispose()));
64
- return createCloudSandboxSessionPreparation(
65
- connection.rootState,
66
- (method, params) => connection.sendHostExtensionRequest(method, params),
67
- store
68
- );
69
- }
70
- };
71
- }
72
- function isCloudSandboxConnectionAddress(address) {
73
- return address.startsWith(CLOUD_SANDBOX_ADDRESS_PREFIX);
74
- }
75
-
76
- export { createCloudSandboxConnectionCustomization, isCloudSandboxConnectionAddress };
@@ -1,54 +0,0 @@
1
- import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
2
- import { type ICloudSandboxClientToken, type ICloudSandboxConnectionRequest } 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 { ICloudSandboxTelemetryService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxTelemetry.service";
6
- /** A broker may omit unchanged sealing material; a replacement key needs matching new ciphertext. */
7
- export declare function mergeCloudSandboxConnectionToken(previous: ICloudSandboxClientToken, refreshed: ICloudSandboxClientToken): ICloudSandboxClientToken | undefined;
8
- /** Minimum delay between connection repairs or failed credential requests. */
9
- export declare const MIN_CREDENTIAL_REFRESH_DELAY_MS = 30000;
10
- /** Maximum consecutive failed on-demand acquisitions, retained across protocol-client replacements. */
11
- export declare const MAX_CONSECUTIVE_CREDENTIAL_REFRESH_FAILURES = 10;
12
- /** Mutable holder for the current Web PubSub credentials, read by the transport factory. */
13
- export interface ICloudSandboxCreds {
14
- token: ICloudSandboxClientToken;
15
- }
16
- /** Retry bookkeeping retained by a staged sandbox connection across protocol-client replacements. */
17
- export declare class CloudSandboxCredentialRefreshState {
18
- unhealthyCycles: number;
19
- lastRefreshAt: number | undefined;
20
- nextRetryAt: number | undefined;
21
- stopped: boolean;
22
- permanentFailure: boolean;
23
- permanentFailureStatus: number | undefined;
24
- }
25
- /**
26
- * Acquires credentials on demand for connection repair and authentication, sharing requests and bounding retries.
27
- * Web PubSub token expiry governs admission to new sockets, not the lifetime of an established connection.
28
- */
29
- export declare class CloudSandboxCredentialRefresher extends Disposable {
30
- private readonly _address;
31
- private readonly _request;
32
- private readonly _clientId;
33
- private readonly _creds;
34
- private readonly _refreshState;
35
- private readonly _apiService;
36
- private readonly _telemetry;
37
- private readonly _logService;
38
- private readonly _cts;
39
- private _refreshInFlight;
40
- constructor(_address: string, _request: ICloudSandboxConnectionRequest, _clientId: string, _creds: ICloudSandboxCreds, _refreshState: CloudSandboxCredentialRefreshState, _apiService: ICloudSandboxApiService, _telemetry: ICloudSandboxTelemetryService, _logService: ILogService);
41
- /** Share an in-flight refresh or refresh expired credentials before opening a replacement transport. */
42
- ensureUnexpiredCredentials(): Promise<void>;
43
- /** Repair connection setup even with a valid cached ticket, waiting for any refresh backoff or rate limit. */
44
- refreshConnectionCredentials(): Promise<void>;
45
- /** Renew authentication without falling back to the previously used sealed envelope. */
46
- refreshAuthenticationCredentials(): Promise<string>;
47
- private _ensureCredentials;
48
- private _hasUnexpiredCredentials;
49
- private _stop;
50
- /** Record a failed acquisition and its earliest retry time without scheduling a request. */
51
- private _recordFailure;
52
- private _refresh;
53
- private _doRefresh;
54
- }
@@ -1,220 +0,0 @@
1
-
2
- import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
- import { timeout, raceCancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
4
- import { 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 { Disposable, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
8
- import { equals } from '@codingame/monaco-vscode-api/vscode/vs/base/common/objects';
9
- import { CLOUD_SANDBOX_SEALED_TOKEN_PREFIX, isCloudSandboxSealedToken, isRetryableCloudSandboxError, CloudSandboxRequestError } from '../../../../../platform/agentHost/common/cloudSandboxAgentHost.js';
10
- import { ICloudSandboxApiService } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/cloudSandboxAgentHost.service';
11
- import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
12
- import { ICloudSandboxTelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxTelemetry.service';
13
-
14
- const LOG_PREFIX = "[CloudSandboxAgentHost]";
15
- function mergeCloudSandboxConnectionToken(previous, refreshed) {
16
- const reusesSealedToken = !refreshed.encrypted_github_token;
17
- const sealedToken = refreshed.encrypted_github_token || previous.encrypted_github_token;
18
- const hostKey = refreshed.host_encryption_key;
19
- if (hostKey) {
20
- const matchesKey = typeof sealedToken === "string" && typeof hostKey.key_id === "string" && hostKey.key_id.length > 0 && sealedToken.startsWith(`${CLOUD_SANDBOX_SEALED_TOKEN_PREFIX}${hostKey.key_id}.`);
21
- const reusedKeyChanged = reusesSealedToken && previous.host_encryption_key !== undefined && !equals(previous.host_encryption_key, hostKey);
22
- if (!matchesKey || reusedKeyChanged) {
23
- return undefined;
24
- }
25
- }
26
- return reusesSealedToken ? {
27
- ...refreshed,
28
- encrypted_github_token: sealedToken,
29
- host_encryption_key: hostKey ?? previous.host_encryption_key
30
- } : refreshed;
31
- }
32
- const MIN_CREDENTIAL_REFRESH_DELAY_MS = 30_000;
33
- const MAX_CREDENTIAL_RETRY_WAIT_MS = 55 * 60_000;
34
- const MAX_CONSECUTIVE_CREDENTIAL_REFRESH_FAILURES = 10;
35
- class CloudSandboxCredentialRefreshState {
36
- constructor() {
37
- this.unhealthyCycles = 0;
38
- this.stopped = false;
39
- this.permanentFailure = false;
40
- }
41
- }
42
- let CloudSandboxCredentialRefresher = class CloudSandboxCredentialRefresher extends Disposable {
43
- constructor(
44
- _address,
45
- _request,
46
- _clientId,
47
- _creds,
48
- _refreshState,
49
- _apiService,
50
- _telemetry,
51
- _logService
52
- ) {
53
- super();
54
- this._address = _address;
55
- this._request = _request;
56
- this._clientId = _clientId;
57
- this._creds = _creds;
58
- this._refreshState = _refreshState;
59
- this._apiService = _apiService;
60
- this._telemetry = _telemetry;
61
- this._logService = _logService;
62
- this._cts = ( new CancellationTokenSource());
63
- this._register(toDisposable(() => this._cts.dispose(true)));
64
- }
65
- ensureUnexpiredCredentials() {
66
- return this._ensureCredentials(false);
67
- }
68
- refreshConnectionCredentials() {
69
- return this._ensureCredentials(true);
70
- }
71
- async refreshAuthenticationCredentials() {
72
- const previousToken = this._creds.token.encrypted_github_token;
73
- await this.refreshConnectionCredentials();
74
- const sealedToken = this._creds.token.encrypted_github_token;
75
- if (!sealedToken || !isCloudSandboxSealedToken(sealedToken) || sealedToken === previousToken) {
76
- throw ( new Error("Sandbox authentication refresh did not provide a new sealed token."));
77
- }
78
- return sealedToken;
79
- }
80
- async _ensureCredentials(refreshConnection) {
81
- if (this._cts.token.isCancellationRequested) {
82
- throw ( new CancellationError());
83
- }
84
- if (!refreshConnection && this._hasUnexpiredCredentials()) {
85
- return;
86
- }
87
- const previousToken = this._creds.token;
88
- let waited = false;
89
- while (!this._refreshInFlight) {
90
- if (this._refreshState.stopped) {
91
- throw ( new Error("Sandbox credential refresh is stopped."));
92
- }
93
- if (waited && this._creds.token !== previousToken && this._hasUnexpiredCredentials()) {
94
- return;
95
- }
96
- const retryAt = this._refreshState.nextRetryAt ?? 0;
97
- const rateLimitAt = refreshConnection && this._refreshState.lastRefreshAt !== undefined ? this._refreshState.lastRefreshAt + MIN_CREDENTIAL_REFRESH_DELAY_MS : 0;
98
- const delay = Math.max(retryAt, rateLimitAt) - Date.now();
99
- if (delay <= 0) {
100
- break;
101
- }
102
- waited = true;
103
- await timeout(Math.min(MAX_CREDENTIAL_RETRY_WAIT_MS, delay), this._cts.token);
104
- }
105
- const refreshed = await raceCancellationError(this._refresh(), this._cts.token);
106
- if (!this._hasUnexpiredCredentials()) {
107
- throw ( new Error(
108
- "Sandbox credential refresh did not provide credentials with a usable future expiry."
109
- ));
110
- }
111
- if (refreshConnection && !refreshed) {
112
- throw ( new Error("Sandbox connection setup could not be refreshed."));
113
- }
114
- }
115
- _hasUnexpiredCredentials() {
116
- return Date.parse(this._creds.token.expires_at) > Date.now();
117
- }
118
- _stop(reason, detail, error) {
119
- this._refreshState.stopped = true;
120
- this._telemetry.reportCredentialRefreshStopped(reason, this._refreshState.unhealthyCycles, error);
121
- this._logService.error(
122
- `${LOG_PREFIX} Stopped refreshing credentials for ${this._address}: ${detail}. Further credential acquisition requires a new connection attempt; an established Web PubSub socket is not closed by token expiry.`
123
- );
124
- }
125
- _recordFailure(delayMs, reason, detail) {
126
- if (++this._refreshState.unhealthyCycles >= MAX_CONSECUTIVE_CREDENTIAL_REFRESH_FAILURES) {
127
- this._stop(
128
- reason,
129
- `${detail} across ${this._refreshState.unhealthyCycles} consecutive attempts`
130
- );
131
- return;
132
- }
133
- this._refreshState.nextRetryAt = Date.now() + Math.max(MIN_CREDENTIAL_REFRESH_DELAY_MS, delayMs);
134
- }
135
- async _refresh() {
136
- if (this._refreshInFlight) {
137
- return this._refreshInFlight;
138
- }
139
- this._refreshState.lastRefreshAt = Date.now();
140
- const pending = this._doRefresh();
141
- this._refreshInFlight = pending;
142
- try {
143
- return await pending;
144
- } finally {
145
- this._refreshInFlight = undefined;
146
- }
147
- }
148
- async _doRefresh() {
149
- let result;
150
- const previousToken = this._creds.token;
151
- try {
152
- result = await this._apiService.reconnect(this._request, this._clientId, this._cts.token);
153
- } catch (err) {
154
- if (this._cts.token.isCancellationRequested || isCancellationError(err) || err instanceof CancellationError) {
155
- return false;
156
- }
157
- if (!isRetryableCloudSandboxError(err)) {
158
- this._refreshState.permanentFailure = true;
159
- this._refreshState.permanentFailureStatus = err instanceof CloudSandboxRequestError ? err.statusCode : undefined;
160
- this._stop("permanentError", toErrorMessage(err), err);
161
- return false;
162
- }
163
- this._logService.warn(
164
- `${LOG_PREFIX} Credential refresh failed for ${this._address}; retrying`,
165
- err
166
- );
167
- const delayMs = err instanceof CloudSandboxRequestError && err.retryAfterSeconds !== undefined ? Math.max(MIN_CREDENTIAL_REFRESH_DELAY_MS, err.retryAfterSeconds * 1000) : MIN_CREDENTIAL_REFRESH_DELAY_MS;
168
- this._recordFailure(delayMs, "consecutiveFailures", "credential refresh kept failing");
169
- return false;
170
- }
171
- if (this._cts.token.isCancellationRequested) {
172
- return false;
173
- }
174
- if (this._creds.token !== previousToken) {
175
- this._logService.trace(
176
- `${LOG_PREFIX} Ignoring a superseded credential refresh for ${this._address}`
177
- );
178
- return true;
179
- }
180
- if (result.kind === "waking") {
181
- this._recordFailure(
182
- result.waking.retryAfterSeconds * 1000,
183
- "environmentWaking",
184
- "environment kept reporting waking"
185
- );
186
- return false;
187
- }
188
- const refreshedToken = mergeCloudSandboxConnectionToken(previousToken, result.token);
189
- if (!refreshedToken) {
190
- this._logService.warn(
191
- `${LOG_PREFIX} Credential refresh for ${this._address} returned inconsistent host credentials; retrying`
192
- );
193
- this._recordFailure(
194
- MIN_CREDENTIAL_REFRESH_DELAY_MS,
195
- "unusableToken",
196
- "refreshed host keys did not match the sealed credentials"
197
- );
198
- return false;
199
- }
200
- if (!(Date.parse(refreshedToken.expires_at) > Date.now())) {
201
- this._logService.warn(
202
- `${LOG_PREFIX} Credential refresh for ${this._address} returned no usable future expiry; retrying`
203
- );
204
- this._recordFailure(
205
- MIN_CREDENTIAL_REFRESH_DELAY_MS,
206
- "unusableToken",
207
- "refreshed tokens did not have a usable future expiry"
208
- );
209
- return false;
210
- }
211
- this._creds.token = refreshedToken;
212
- this._logService.trace(`${LOG_PREFIX} Refreshed Web PubSub credentials for ${this._address}`);
213
- this._refreshState.unhealthyCycles = 0;
214
- this._refreshState.nextRetryAt = undefined;
215
- return true;
216
- }
217
- };
218
- CloudSandboxCredentialRefresher = ( __decorate([( __param(5, ICloudSandboxApiService)), ( __param(6, ICloudSandboxTelemetryService)), ( __param(7, ILogService))], CloudSandboxCredentialRefresher));
219
-
220
- export { CloudSandboxCredentialRefreshState, CloudSandboxCredentialRefresher, MAX_CONSECUTIVE_CREDENTIAL_REFRESH_FAILURES, MIN_CREDENTIAL_REFRESH_DELAY_MS, mergeCloudSandboxConnectionToken };
@@ -1,21 +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 { IReplayedTaskHistory } from "../../../../../platform/agentHost/common/taskEventReplay.js";
4
- /** Shares reads within an authentication lifetime. The owner must clear synchronously when authentication changes. */
5
- export declare class CloudSandboxHistoryCache extends Disposable {
6
- private readonly maxEntries;
7
- private readonly maxBytes;
8
- private readonly entries;
9
- private readonly pending;
10
- private estimatedBytes;
11
- constructor(maxEntries?: number, maxBytes?: number);
12
- load(taskId: string, token: CancellationToken, initialize: (token: CancellationToken) => Promise<{
13
- readonly account: string;
14
- readonly fetch: (token: CancellationToken) => Promise<IReplayedTaskHistory | undefined>;
15
- }>, onCachedHistory?: (history: IReplayedTaskHistory) => void, canCacheHistory?: (history: IReplayedTaskHistory | undefined) => boolean): Promise<IReplayedTaskHistory | undefined>;
16
- /** Live changes invalidate stored data and prevent an older in-flight read from repopulating it. */
17
- invalidate(taskId: string, cancelPending?: boolean, preserveCached?: boolean): void;
18
- clear(): void;
19
- private cache;
20
- dispose(): void;
21
- }
@@ -1,184 +0,0 @@
1
-
2
- import { raceCancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
3
- import { CancellationTokenSource } 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 { Disposable, DisposableMap, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
6
- import { LinkedMap, Touch } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
7
-
8
- class CloudSandboxHistoryCache extends Disposable {
9
- constructor(maxEntries = 20, maxBytes = 64 * 1024 * 1024) {
10
- super();
11
- this.maxEntries = maxEntries;
12
- this.maxBytes = maxBytes;
13
- this.entries = ( new LinkedMap());
14
- this.pending = this._register(( new DisposableMap()));
15
- this.estimatedBytes = 0;
16
- }
17
- async load(taskId, token, initialize, onCachedHistory, canCacheHistory) {
18
- if (this._store.isDisposed || token.isCancellationRequested) {
19
- throw ( new CancellationError());
20
- }
21
- let operation = this.pending.get(taskId);
22
- if (!operation) {
23
- const store = ( new DisposableStore());
24
- const source = store.add(( new CancellationTokenSource()));
25
- const initialized = (async () => {
26
- await Promise.resolve();
27
- if (source.token.isCancellationRequested) {
28
- throw ( new CancellationError());
29
- }
30
- const context = await raceCancellationError(initialize(source.token), source.token);
31
- if (source.token.isCancellationRequested) {
32
- throw ( new CancellationError());
33
- }
34
- return context;
35
- })();
36
- operation = {
37
- store,
38
- source,
39
- waiters: 0,
40
- cacheable: true,
41
- completed: false,
42
- accepted: false,
43
- cached: (async () => {
44
- const context = await initialized;
45
- const key = JSON.stringify([context.account, taskId]);
46
- const value = this.entries.get(key, Touch.AsNew);
47
- return value ? {
48
- key,
49
- value
50
- } : undefined;
51
- })(),
52
- promise: (async () => {
53
- const context = await initialized;
54
- if (source.token.isCancellationRequested) {
55
- throw ( new CancellationError());
56
- }
57
- const history = await raceCancellationError(context.fetch(source.token), source.token);
58
- const current = this.pending.get(taskId);
59
- if (source.token.isCancellationRequested || current?.source !== source) {
60
- throw ( new CancellationError());
61
- }
62
- const key = JSON.stringify([context.account, taskId]);
63
- current.commit = () => this.cache(key, taskId, history);
64
- return history;
65
- })(),
66
- dispose: () => {
67
- source.cancel();
68
- store.dispose();
69
- }
70
- };
71
- this.pending.set(taskId, operation);
72
- const request = operation;
73
- const finish = () => {
74
- request.completed = true;
75
- };
76
- void operation.promise.then(finish, finish);
77
- }
78
- const request = operation;
79
- request.waiters++;
80
- let released = false;
81
- const release = () => {
82
- if (released) {
83
- return;
84
- }
85
- released = true;
86
- request.waiters--;
87
- if (request.waiters === 0 && this.pending.get(taskId) === request) {
88
- if (request.completed) {
89
- this.pending.deleteAndLeak(taskId);
90
- try {
91
- if (request.cacheable && request.accepted) {
92
- request.commit?.();
93
- }
94
- } finally {
95
- request.store.dispose();
96
- }
97
- } else {
98
- this.pending.deleteAndDispose(taskId);
99
- }
100
- }
101
- };
102
- const cancellation = request.store.add(token.onCancellationRequested(release));
103
- try {
104
- const cached = await raceCancellationError(request.cached, token);
105
- if (token.isCancellationRequested || request.source.token.isCancellationRequested) {
106
- throw ( new CancellationError());
107
- }
108
- if (cached && request.cacheable && this.entries.get(cached.key) === cached.value && onCachedHistory) {
109
- onCachedHistory(structuredClone(cached.value.history));
110
- }
111
- const history = await raceCancellationError(request.promise, token);
112
- if (token.isCancellationRequested || request.source.token.isCancellationRequested) {
113
- throw ( new CancellationError());
114
- }
115
- const result = history && structuredClone(history);
116
- try {
117
- if (canCacheHistory && !canCacheHistory(result)) {
118
- request.cacheable = false;
119
- } else {
120
- request.accepted = true;
121
- }
122
- } catch (error) {
123
- request.cacheable = false;
124
- throw error;
125
- }
126
- return result;
127
- } finally {
128
- request.store.delete(cancellation);
129
- release();
130
- }
131
- }
132
- invalidate(taskId, cancelPending = false, preserveCached = false) {
133
- for (const [key, entry] of [...this.entries]) {
134
- if (entry.taskId === taskId && !preserveCached) {
135
- this.entries.delete(key);
136
- this.estimatedBytes -= entry.estimatedBytes;
137
- }
138
- }
139
- const operation = this.pending.get(taskId);
140
- if (operation) {
141
- operation.cacheable = false;
142
- if (cancelPending) {
143
- this.pending.deleteAndDispose(taskId);
144
- }
145
- }
146
- }
147
- clear() {
148
- this.entries.clear();
149
- this.estimatedBytes = 0;
150
- this.pending.clearAndDisposeAll();
151
- }
152
- cache(key, taskId, history) {
153
- if (!history || !history.sessions.length || history.truncated) {
154
- return;
155
- }
156
- const old = this.entries.remove(key);
157
- this.estimatedBytes -= old?.estimatedBytes ?? 0;
158
- const estimatedBytes = JSON.stringify({
159
- ...history,
160
- sessions: history.sessions.map(session => ({
161
- ...session,
162
- chats: [...session.chats]
163
- }))
164
- }).length * 2;
165
- if (estimatedBytes > this.maxBytes || this.maxEntries <= 0) {
166
- return;
167
- }
168
- this.entries.set(key, {
169
- taskId,
170
- history: structuredClone(history),
171
- estimatedBytes
172
- }, Touch.AsNew);
173
- this.estimatedBytes += estimatedBytes;
174
- while (this.entries.size > this.maxEntries || this.estimatedBytes > this.maxBytes) {
175
- this.estimatedBytes -= this.entries.shift().estimatedBytes;
176
- }
177
- }
178
- dispose() {
179
- this.clear();
180
- super.dispose();
181
- }
182
- }
183
-
184
- export { CloudSandboxHistoryCache };
@@ -1,8 +0,0 @@
1
- import { DisposableStore } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
2
- import { IAgentSubscription } from "@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/agentSubscription";
3
- import { RootState } from "@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/state";
4
- import { RemoteAgentHostSessionPreparation } from "./remoteAgentHostConnectionCustomization.js";
5
- export declare function createCloudSandboxSessionPreparation(root: IAgentSubscription<RootState>, request: (method: "extensions/cloneProject", params: {
6
- url: string;
7
- depth: 1;
8
- }) => Promise<unknown>, owner: DisposableStore): RemoteAgentHostSessionPreparation;