@codingame/monaco-vscode-extensions-service-override 28.4.0 → 29.0.0

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 (53) hide show
  1. package/index.js +1 -0
  2. package/package.json +3 -3
  3. package/vscode/src/vs/platform/browserView/common/browserViewTelemetry.d.ts +34 -0
  4. package/vscode/src/vs/platform/browserView/common/browserViewTelemetry.js +7 -0
  5. package/vscode/src/vs/platform/browserView/common/browserViewUri.d.ts +21 -0
  6. package/vscode/src/vs/platform/browserView/common/browserViewUri.js +34 -0
  7. package/vscode/src/vs/platform/extensionManagement/common/extensionManagementCLI.js +28 -28
  8. package/vscode/src/vs/workbench/api/browser/mainThreadAuthentication.js +25 -25
  9. package/vscode/src/vs/workbench/api/browser/mainThreadBrowsers.d.ts +29 -0
  10. package/vscode/src/vs/workbench/api/browser/mainThreadBrowsers.js +147 -0
  11. package/vscode/src/vs/workbench/api/browser/mainThreadCLICommands.js +1 -1
  12. package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js +6 -20
  13. package/vscode/src/vs/workbench/api/browser/mainThreadChatDebug.d.ts +8 -1
  14. package/vscode/src/vs/workbench/api/browser/mainThreadChatDebug.js +160 -4
  15. package/vscode/src/vs/workbench/api/browser/mainThreadChatSessions.d.ts +19 -14
  16. package/vscode/src/vs/workbench/api/browser/mainThreadChatSessions.js +134 -49
  17. package/vscode/src/vs/workbench/api/browser/mainThreadComments.js +1 -1
  18. package/vscode/src/vs/workbench/api/browser/mainThreadCustomEditors.js +2 -2
  19. package/vscode/src/vs/workbench/api/browser/mainThreadDownloadService.js +1 -1
  20. package/vscode/src/vs/workbench/api/browser/mainThreadEditSessionIdentityParticipant.js +1 -1
  21. package/vscode/src/vs/workbench/api/browser/mainThreadExtensionService.js +11 -11
  22. package/vscode/src/vs/workbench/api/browser/mainThreadFileSystemEventService.js +20 -20
  23. package/vscode/src/vs/workbench/api/browser/mainThreadGitExtensionService.d.ts +3 -1
  24. package/vscode/src/vs/workbench/api/browser/mainThreadGitExtensionService.js +47 -1
  25. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModelTools.d.ts +3 -1
  26. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModelTools.js +9 -4
  27. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModels.js +2 -2
  28. package/vscode/src/vs/workbench/api/browser/mainThreadMcp.d.ts +4 -1
  29. package/vscode/src/vs/workbench/api/browser/mainThreadMcp.js +21 -10
  30. package/vscode/src/vs/workbench/api/browser/mainThreadMessageService.js +4 -4
  31. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js +1 -1
  32. package/vscode/src/vs/workbench/api/browser/mainThreadOutputService.js +3 -3
  33. package/vscode/src/vs/workbench/api/browser/mainThreadProgress.js +1 -1
  34. package/vscode/src/vs/workbench/api/browser/mainThreadSaveParticipant.js +1 -1
  35. package/vscode/src/vs/workbench/api/browser/mainThreadTask.js +1 -1
  36. package/vscode/src/vs/workbench/api/browser/mainThreadTunnelService.js +2 -2
  37. package/vscode/src/vs/workbench/api/browser/mainThreadUriOpeners.js +2 -2
  38. package/vscode/src/vs/workbench/api/browser/mainThreadWebviews.js +1 -1
  39. package/vscode/src/vs/workbench/api/browser/mainThreadWorkspace.d.ts +2 -2
  40. package/vscode/src/vs/workbench/api/browser/mainThreadWorkspace.js +25 -23
  41. package/vscode/src/vs/workbench/api/common/shared/tasks.d.ts +1 -0
  42. package/vscode/src/vs/workbench/contrib/browserView/common/browserEditorInput.d.ts +60 -0
  43. package/vscode/src/vs/workbench/contrib/browserView/common/browserEditorInput.js +222 -0
  44. package/vscode/src/vs/workbench/contrib/customEditor/common/customTextEditorModel.js +1 -1
  45. package/vscode/src/vs/workbench/contrib/git/common/gitService.d.ts +22 -0
  46. package/vscode/src/vs/workbench/services/extensionManagement/browser/extensionBisect.js +23 -23
  47. package/vscode/src/vs/workbench/services/extensionManagement/browser/webExtensionsScannerService.js +2 -2
  48. package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.js +12 -12
  49. package/vscode/src/vs/workbench/services/extensions/common/extensionHostManager.js +1 -1
  50. package/vscode/src/vs/workbench/services/extensions/common/extensionRunningLocationTracker.js +1 -1
  51. package/vscode/src/vs/workbench/services/extensions/common/extensionsProposedApi.js +1 -1
  52. package/vscode/src/vs/workbench/services/extensions/common/extensionsUtil.js +4 -4
  53. package/vscode/src/vs/workbench/services/themes/browser/cssExtensionPoint.js +6 -6
@@ -0,0 +1,147 @@
1
+
2
+ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
+ import { Disposable, DisposableMap, DisposableStore, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
4
+ import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
5
+ import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
6
+ import { ExtHostContext, MainContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/api/common/extHost.protocol';
7
+ import { IBrowserViewCDPService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/browserView/common/browserView.service';
8
+ import { BrowserViewUri } from '../../../platform/browserView/common/browserViewUri.js';
9
+ import { generateUuid } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uuid';
10
+ import { columnToEditorGroup } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupColumn';
11
+ import { IEditorGroupsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
12
+ import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
13
+ import { BrowserEditorInput } from '../../contrib/browserView/common/browserEditorInput.js';
14
+
15
+ let MainThreadBrowsers = class MainThreadBrowsers extends Disposable {
16
+ constructor(
17
+ extHostContext,
18
+ editorService,
19
+ cdpService,
20
+ editorGroupsService,
21
+ configurationService
22
+ ) {
23
+ super();
24
+ this.editorService = editorService;
25
+ this.cdpService = cdpService;
26
+ this.editorGroupsService = editorGroupsService;
27
+ this.configurationService = configurationService;
28
+ this._cdpSessions = this._register(( new DisposableMap()));
29
+ this._knownBrowsers = this._register(( new DisposableMap()));
30
+ this._lastActiveBrowserId = undefined;
31
+ this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostBrowsers));
32
+ this._register(this.editorService.onWillOpenEditor(e => {
33
+ if (e.editor instanceof BrowserEditorInput) {
34
+ this._track(e.editor);
35
+ }
36
+ }));
37
+ this._register(
38
+ this.editorService.onDidActiveEditorChange(() => this._syncActiveBrowserTab())
39
+ );
40
+ for (const input of this.editorService.editors) {
41
+ if (input instanceof BrowserEditorInput) {
42
+ this._track(input);
43
+ }
44
+ }
45
+ this._syncActiveBrowserTab();
46
+ }
47
+ async $openBrowserTab(url, viewColumn, options) {
48
+ const id = generateUuid();
49
+ const browserUri = BrowserViewUri.forId(id);
50
+ await this.editorService.openEditor({
51
+ resource: browserUri,
52
+ options: {
53
+ ...options,
54
+ viewState: {
55
+ url
56
+ }
57
+ }
58
+ }, columnToEditorGroup(this.editorGroupsService, this.configurationService, viewColumn));
59
+ const known = this._knownBrowsers.get(id);
60
+ if (!known) {
61
+ throw ( new Error("Failed to open browser tab"));
62
+ }
63
+ return this._toDto(known.input);
64
+ }
65
+ async _syncActiveBrowserTab() {
66
+ const active = this.editorService.activeEditorPane?.input;
67
+ let activeId;
68
+ if (active instanceof BrowserEditorInput) {
69
+ this._track(active);
70
+ activeId = active.id;
71
+ }
72
+ if (this._lastActiveBrowserId !== activeId) {
73
+ this._lastActiveBrowserId = activeId;
74
+ this._proxy.$onDidChangeActiveBrowserTab(activeId);
75
+ }
76
+ }
77
+ _track(input) {
78
+ if (( this._knownBrowsers.has(input.id))) {
79
+ return;
80
+ }
81
+ const disposables = ( new DisposableStore());
82
+ disposables.add(input.onDidChangeLabel(() => {
83
+ this._proxy.$onDidChangeBrowserTabState(this._toDto(input));
84
+ }));
85
+ disposables.add(input.onWillDispose(() => {
86
+ this._knownBrowsers.deleteAndDispose(input.id);
87
+ }));
88
+ disposables.add(toDisposable(() => {
89
+ this._proxy.$onDidCloseBrowserTab(input.id);
90
+ }));
91
+ this._knownBrowsers.set(input.id, {
92
+ input,
93
+ dispose: () => disposables.dispose()
94
+ });
95
+ this._proxy.$onDidOpenBrowserTab(this._toDto(input));
96
+ }
97
+ _toDto(input) {
98
+ return {
99
+ id: input.id,
100
+ url: input.url || "about:blank",
101
+ title: input.getTitle(),
102
+ favicon: input.favicon
103
+ };
104
+ }
105
+ async $startCDPSession(sessionId, browserId) {
106
+ const known = this._knownBrowsers.get(browserId);
107
+ if (!known) {
108
+ throw ( new Error(`Unknown browser id: ${browserId}`));
109
+ }
110
+ await known.input.resolve();
111
+ const groupId = await this.cdpService.createSessionGroup(browserId);
112
+ const disposables = ( new DisposableStore());
113
+ disposables.add(this.cdpService.onCDPMessage(groupId)(message => {
114
+ this._proxy.$onCDPSessionMessage(sessionId, message);
115
+ }));
116
+ disposables.add(this.cdpService.onDidDestroy(groupId)(() => {
117
+ this._cdpSessions.deleteAndDispose(sessionId);
118
+ }));
119
+ disposables.add(toDisposable(() => {
120
+ this.cdpService.destroySessionGroup(groupId).catch(() => {});
121
+ this._proxy.$onCDPSessionClosed(sessionId);
122
+ }));
123
+ this._cdpSessions.set(sessionId, {
124
+ groupId,
125
+ dispose: () => disposables.dispose()
126
+ });
127
+ }
128
+ async $closeCDPSession(sessionId) {
129
+ this._cdpSessions.deleteAndDispose(sessionId);
130
+ }
131
+ async $sendCDPMessage(sessionId, message) {
132
+ const session = this._cdpSessions.get(sessionId);
133
+ if (session) {
134
+ await this.cdpService.sendCDPMessage(session.groupId, message);
135
+ }
136
+ }
137
+ async $closeBrowserTab(browserId) {
138
+ const known = this._knownBrowsers.get(browserId);
139
+ if (!known) {
140
+ throw ( new Error(`Unknown browser id: ${browserId}`));
141
+ }
142
+ known.input.dispose();
143
+ }
144
+ };
145
+ MainThreadBrowsers = __decorate([extHostNamedCustomer(MainContext.MainThreadBrowsers), ( __param(1, IEditorService)), ( __param(2, IBrowserViewCDPService)), ( __param(3, IEditorGroupsService)), ( __param(4, IConfigurationService))], MainThreadBrowsers);
146
+
147
+ export { MainThreadBrowsers };
@@ -108,7 +108,7 @@ let RemoteExtensionManagementCLI = class RemoteExtensionManagementCLI extends Ex
108
108
  if (
109
109
  !this._extensionManifestPropertiesService.canExecuteOnWorkspace(manifest) && !(isWeb && this._extensionManifestPropertiesService.canExecuteOnWeb(manifest))) {
110
110
  this.logger.info(( localize(
111
- 2545,
111
+ 2553,
112
112
  "Cannot install the '{0}' extension because it is declared to not run in this setup.",
113
113
  getExtensionId(manifest.publisher, manifest.name)
114
114
  )));
@@ -25,6 +25,7 @@ import { ChatRequestAgentPart } from '@codingame/monaco-vscode-api/vscode/vs/wor
25
25
  import { ChatRequestParser } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/requestParser/chatRequestParser';
26
26
  import { getDynamicVariablesForWidget, getSelectedToolAndToolSetsForWidget } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/attachments/chatVariables';
27
27
  import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService.service';
28
+ import { ChatSessionOptionsMap } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService';
28
29
  import { IChatSessionsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService.service';
29
30
  import { ChatModeKind, ChatAgentLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
30
31
  import { ILanguageModelToolsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/tools/languageModelToolsService.service';
@@ -32,6 +33,7 @@ import { extHostNamedCustomer } from '../../services/extensions/common/extHostCu
32
33
  import { IExtensionService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service';
33
34
  import { ExtHostContext, MainContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/api/common/extHost.protocol';
34
35
  import { NotebookDto } from './mainThreadNotebookDto.js';
36
+ import { isUntitledChatSession } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatUri';
35
37
  import { addDynamicVariableActionId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/widget/input/editor/chatDynamicVariablesConstant';
36
38
  import { getAgentSessionProvider, AgentSessionProviders } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessions';
37
39
 
@@ -217,29 +219,12 @@ let MainThreadChatAgents2 = class MainThreadChatAgents2 extends Disposable {
217
219
  const contributedSession = chatSession?.contributedChatSession;
218
220
  let chatSessionContext;
219
221
  if (contributedSession) {
220
- let chatSessionResource = contributedSession.chatSessionResource;
221
- let isUntitled = contributedSession.isUntitled;
222
- if (isUntitled) {
223
- const newItem = await this._chatSessionService.createNewChatSessionItem(contributedSession.chatSessionType, request, token);
224
- if (newItem) {
225
- chatSessionResource = newItem.resource;
226
- isUntitled = false;
227
- chatSession?.setContributedChatSession({
228
- chatSessionType: contributedSession.chatSessionType,
229
- chatSessionResource,
230
- isUntitled: false,
231
- initialSessionOptions: contributedSession.initialSessionOptions
232
- });
233
- this._chatSessionService.registerSessionResourceAlias(contributedSession.chatSessionResource, chatSessionResource);
234
- }
235
- }
222
+ const chatSessionResource = contributedSession.chatSessionResource;
223
+ const isUntitled = isUntitledChatSession(chatSessionResource);
236
224
  chatSessionContext = {
237
225
  chatSessionResource,
238
226
  isUntitled,
239
- initialSessionOptions: contributedSession.initialSessionOptions?.map(o => ({
240
- optionId: o.optionId,
241
- value: typeof o.value === "string" ? o.value : o.value.id
242
- }))
227
+ initialSessionOptions: ChatSessionOptionsMap.toStrValueArray(contributedSession.initialSessionOptions)
243
228
  };
244
229
  }
245
230
  return (await this._proxy.$invokeAgent(handle, request, {
@@ -367,6 +352,7 @@ let MainThreadChatAgents2 = class MainThreadChatAgents2 extends Disposable {
367
352
  kind: "usage",
368
353
  promptTokens: progress.promptTokens,
369
354
  completionTokens: progress.completionTokens,
355
+ outputBuffer: progress.outputBuffer,
370
356
  promptTokenDetails: progress.promptTokenDetails
371
357
  });
372
358
  }
@@ -1,15 +1,22 @@
1
1
  import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
2
2
  import { IChatDebugService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatDebugService.service";
3
+ import { IChatService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService.service";
3
4
  import { IExtHostContext } from "../../services/extensions/common/extHostCustomers.js";
4
5
  import { IChatDebugEventDto, MainThreadChatDebugShape } from "@codingame/monaco-vscode-api/vscode/vs/workbench/api/common/extHost.protocol";
5
6
  export declare class MainThreadChatDebug extends Disposable implements MainThreadChatDebugShape {
6
7
  private readonly _chatDebugService;
8
+ private readonly _chatService;
7
9
  private readonly _proxy;
8
10
  private readonly _providerDisposables;
9
11
  private readonly _activeSessionResources;
10
- constructor(extHostContext: IExtHostContext, _chatDebugService: IChatDebugService);
12
+ private readonly _coreEventForwarder;
13
+ constructor(extHostContext: IExtHostContext, _chatDebugService: IChatDebugService, _chatService: IChatService);
14
+ $subscribeToCoreDebugEvents(): void;
15
+ $unsubscribeFromCoreDebugEvents(): void;
11
16
  $registerChatDebugLogProvider(handle: number): void;
12
17
  $unregisterChatDebugLogProvider(handle: number): void;
13
18
  $acceptChatDebugEvent(handle: number, dto: IChatDebugEventDto): void;
19
+ private _serializeEvent;
14
20
  private _reviveEvent;
21
+ private _reviveResolvedContent;
15
22
  }
@@ -1,19 +1,34 @@
1
1
 
2
2
  import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
- import { Disposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
3
+ import { Disposable, MutableDisposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
4
4
  import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
5
+ import { VSBuffer } from '@codingame/monaco-vscode-api/vscode/vs/base/common/buffer';
6
+ import { ChatDebugHookResult } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatDebugService';
5
7
  import { IChatDebugService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatDebugService.service';
8
+ import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService.service';
6
9
  import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
7
10
  import { ExtHostContext, MainContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/api/common/extHost.protocol';
8
11
 
9
12
  let MainThreadChatDebug = class MainThreadChatDebug extends Disposable {
10
- constructor(extHostContext, _chatDebugService) {
13
+ constructor(extHostContext, _chatDebugService, _chatService) {
11
14
  super();
12
15
  this._chatDebugService = _chatDebugService;
16
+ this._chatService = _chatService;
13
17
  this._providerDisposables = ( new Map());
14
18
  this._activeSessionResources = ( new Map());
19
+ this._coreEventForwarder = this._register(( new MutableDisposable()));
15
20
  this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostChatDebug));
16
21
  }
22
+ $subscribeToCoreDebugEvents() {
23
+ this._coreEventForwarder.value = this._chatDebugService.onDidAddEvent(event => {
24
+ if (this._chatDebugService.isCoreEvent(event)) {
25
+ this._proxy.$onCoreDebugEvent(this._serializeEvent(event));
26
+ }
27
+ });
28
+ }
29
+ $unsubscribeFromCoreDebugEvents() {
30
+ this._coreEventForwarder.clear();
31
+ }
17
32
  $registerChatDebugLogProvider(handle) {
18
33
  const disposables = ( new DisposableStore());
19
34
  this._providerDisposables.set(handle, disposables);
@@ -24,7 +39,25 @@ let MainThreadChatDebug = class MainThreadChatDebug extends Disposable {
24
39
  return dtos?.map(dto => this._reviveEvent(dto, sessionResource));
25
40
  },
26
41
  resolveChatDebugLogEvent: async (eventId, token) => {
27
- return this._proxy.$resolveChatDebugLogEvent(handle, eventId, token);
42
+ const dto = await this._proxy.$resolveChatDebugLogEvent(handle, eventId, token);
43
+ return dto ? this._reviveResolvedContent(dto) : undefined;
44
+ },
45
+ provideChatDebugLogExport: async (sessionResource, token) => {
46
+ const coreEventDtos = ( this._chatDebugService.getEvents(sessionResource).filter(e => this._chatDebugService.isCoreEvent(e)).map(e => this._serializeEvent(e)));
47
+ const sessionTitle = this._chatService.getSessionTitle(sessionResource);
48
+ const result = await this._proxy.$exportChatDebugLog(handle, sessionResource, coreEventDtos, sessionTitle, token);
49
+ return result?.buffer;
50
+ },
51
+ resolveChatDebugLogImport: async (data, token) => {
52
+ const result = await this._proxy.$importChatDebugLog(handle, VSBuffer.wrap(data), token);
53
+ if (!result) {
54
+ return undefined;
55
+ }
56
+ const uri = URI.revive(result.uri);
57
+ if (result.sessionTitle) {
58
+ this._chatDebugService.setImportedSessionTitle(uri, result.sessionTitle);
59
+ }
60
+ return uri;
28
61
  }
29
62
  }));
30
63
  }
@@ -42,6 +75,78 @@ let MainThreadChatDebug = class MainThreadChatDebug extends Disposable {
42
75
  const revived = this._reviveEvent(dto, sessionResource);
43
76
  this._chatDebugService.addProviderEvent(revived);
44
77
  }
78
+ _serializeEvent(event) {
79
+ const base = {
80
+ id: event.id,
81
+ sessionResource: event.sessionResource,
82
+ created: event.created.getTime(),
83
+ parentEventId: event.parentEventId
84
+ };
85
+ switch (event.kind) {
86
+ case "toolCall":
87
+ return {
88
+ ...base,
89
+ kind: "toolCall",
90
+ toolName: event.toolName,
91
+ toolCallId: event.toolCallId,
92
+ input: event.input,
93
+ output: event.output,
94
+ result: event.result,
95
+ durationInMillis: event.durationInMillis
96
+ };
97
+ case "modelTurn":
98
+ return {
99
+ ...base,
100
+ kind: "modelTurn",
101
+ model: event.model,
102
+ requestName: event.requestName,
103
+ inputTokens: event.inputTokens,
104
+ outputTokens: event.outputTokens,
105
+ totalTokens: event.totalTokens,
106
+ durationInMillis: event.durationInMillis
107
+ };
108
+ case "generic":
109
+ return {
110
+ ...base,
111
+ kind: "generic",
112
+ name: event.name,
113
+ details: event.details,
114
+ level: event.level,
115
+ category: event.category
116
+ };
117
+ case "subagentInvocation":
118
+ return {
119
+ ...base,
120
+ kind: "subagentInvocation",
121
+ agentName: event.agentName,
122
+ description: event.description,
123
+ status: event.status,
124
+ durationInMillis: event.durationInMillis,
125
+ toolCallCount: event.toolCallCount,
126
+ modelTurnCount: event.modelTurnCount
127
+ };
128
+ case "userMessage":
129
+ return {
130
+ ...base,
131
+ kind: "userMessage",
132
+ message: event.message,
133
+ sections: ( event.sections.map(s => ({
134
+ name: s.name,
135
+ content: s.content
136
+ })))
137
+ };
138
+ case "agentResponse":
139
+ return {
140
+ ...base,
141
+ kind: "agentResponse",
142
+ message: event.message,
143
+ sections: ( event.sections.map(s => ({
144
+ name: s.name,
145
+ content: s.content
146
+ })))
147
+ };
148
+ }
149
+ }
45
150
  _reviveEvent(dto, sessionResource) {
46
151
  const base = {
47
152
  id: dto.id,
@@ -108,7 +213,58 @@ let MainThreadChatDebug = class MainThreadChatDebug extends Disposable {
108
213
  };
109
214
  }
110
215
  }
216
+ _reviveResolvedContent(dto) {
217
+ switch (dto.kind) {
218
+ case "text":
219
+ return {
220
+ kind: "text",
221
+ value: dto.value
222
+ };
223
+ case "message":
224
+ return {
225
+ kind: "message",
226
+ type: dto.type,
227
+ message: dto.message,
228
+ sections: dto.sections
229
+ };
230
+ case "toolCall":
231
+ return {
232
+ kind: "toolCall",
233
+ toolName: dto.toolName,
234
+ result: dto.result,
235
+ durationInMillis: dto.durationInMillis,
236
+ input: dto.input,
237
+ output: dto.output
238
+ };
239
+ case "modelTurn":
240
+ return {
241
+ kind: "modelTurn",
242
+ requestName: dto.requestName,
243
+ model: dto.model,
244
+ status: dto.status,
245
+ durationInMillis: dto.durationInMillis,
246
+ inputTokens: dto.inputTokens,
247
+ outputTokens: dto.outputTokens,
248
+ cachedTokens: dto.cachedTokens,
249
+ totalTokens: dto.totalTokens,
250
+ errorMessage: dto.errorMessage,
251
+ sections: dto.sections
252
+ };
253
+ case "hook":
254
+ return {
255
+ kind: "hook",
256
+ hookType: dto.hookType,
257
+ command: dto.command,
258
+ result: dto.result === "success" ? ChatDebugHookResult.Success : dto.result === "error" ? ChatDebugHookResult.Error : dto.result === "nonBlockingError" ? ChatDebugHookResult.NonBlockingError : undefined,
259
+ durationInMillis: dto.durationInMillis,
260
+ input: dto.input,
261
+ output: dto.output,
262
+ exitCode: dto.exitCode,
263
+ errorMessage: dto.errorMessage
264
+ };
265
+ }
266
+ }
111
267
  };
112
- MainThreadChatDebug = __decorate([extHostNamedCustomer(MainContext.MainThreadChatDebug), ( __param(1, IChatDebugService))], MainThreadChatDebug);
268
+ MainThreadChatDebug = __decorate([extHostNamedCustomer(MainContext.MainThreadChatDebug), ( __param(1, IChatDebugService)), ( __param(2, IChatService))], MainThreadChatDebug);
113
269
 
114
270
  export { MainThreadChatDebug };
@@ -3,27 +3,30 @@ import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/l
3
3
  import { IObservable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/observable";
4
4
  import { URI, UriComponents } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
5
5
  import { IDialogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service";
6
+ import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
6
7
  import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
7
8
  import { IAgentSessionsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.service";
8
9
  import { IChatWidgetService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service";
9
10
  import { IChatContentInlineReference, IChatProgress } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService";
10
11
  import { IChatService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService.service";
11
- import { IChatSession, IChatSessionHistoryItem, IChatSessionItem, IChatSessionProviderOptionItem } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService";
12
+ import { IChatSession, IChatSessionHistoryItem, IChatSessionItem, IChatSessionProviderOptionItem, IChatSessionRequestHistoryItem, ReadonlyChatSessionOptionsMap } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService";
12
13
  import { IChatSessionsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService.service";
13
14
  import { IChatAgentRequest } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/participants/chatAgents";
15
+ import { IChatDebugService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatDebugService.service";
16
+ import { IChatArtifactsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/tools/chatArtifactsService.service";
14
17
  import { IChatTodoListService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/tools/chatTodoListService.service";
15
18
  import { IEditorGroupsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service";
16
19
  import { IEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service";
17
20
  import { IExtHostContext } from "../../services/extensions/common/extHostCustomers.js";
18
21
  import { Dto } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/proxyIdentifier";
19
- import { ExtHostChatSessionsShape, IChatProgressDto, IChatSessionItemsChange, MainThreadChatSessionsShape } from "@codingame/monaco-vscode-api/vscode/vs/workbench/api/common/extHost.protocol";
22
+ import { ChatSessionContentContextDto, ExtHostChatSessionsShape, IChatProgressDto, IChatSessionItemsChange, MainThreadChatSessionsShape } from "@codingame/monaco-vscode-api/vscode/vs/workbench/api/common/extHost.protocol";
20
23
  export declare class ObservableChatSession extends Disposable implements IChatSession {
21
24
  readonly sessionResource: URI;
22
25
  readonly providerHandle: number;
23
26
  readonly history: Array<IChatSessionHistoryItem>;
24
27
  title?: string;
25
28
  private _options?;
26
- get options(): Record<string, string | IChatSessionProviderOptionItem> | undefined;
29
+ get options(): ReadonlyChatSessionOptionsMap | undefined;
27
30
  private readonly _progressObservable;
28
31
  private readonly _isCompleteObservable;
29
32
  private readonly _onWillDispose;
@@ -35,6 +38,7 @@ export declare class ObservableChatSession extends Disposable implements IChatSe
35
38
  private _initializationPromise?;
36
39
  interruptActiveResponseCallback?: () => Promise<boolean>;
37
40
  requestHandler?: (request: IChatAgentRequest, progress: (progress: IChatProgress[]) => void, history: any[], token: CancellationToken) => Promise<void>;
41
+ forkSession?: (request: IChatSessionRequestHistoryItem | undefined, token: CancellationToken) => Promise<IChatSessionItem>;
38
42
  private readonly _proxy;
39
43
  private readonly _providerHandle;
40
44
  private readonly _logService;
@@ -42,7 +46,7 @@ export declare class ObservableChatSession extends Disposable implements IChatSe
42
46
  get progressObs(): IObservable<IChatProgress[]>;
43
47
  get isCompleteObs(): IObservable<boolean>;
44
48
  constructor(resource: URI, providerHandle: number, proxy: ExtHostChatSessionsShape, logService: ILogService, dialogService: IDialogService);
45
- initialize(token: CancellationToken): Promise<void>;
49
+ initialize(token: CancellationToken, context: ChatSessionContentContextDto): Promise<void>;
46
50
  private _doInitializeContent;
47
51
  /**
48
52
  * Handle progress chunks coming from the extension host.
@@ -55,6 +59,7 @@ export declare class ObservableChatSession extends Disposable implements IChatSe
55
59
  handleProgressComplete(requestId: string): void;
56
60
  private _addProgress;
57
61
  private _markComplete;
62
+ private toRequestDto;
58
63
  dispose(): void;
59
64
  }
60
65
  export declare class MainThreadChatSessions extends Disposable implements MainThreadChatSessionsShape {
@@ -64,29 +69,32 @@ export declare class MainThreadChatSessions extends Disposable implements MainTh
64
69
  private readonly _chatService;
65
70
  private readonly _chatWidgetService;
66
71
  private readonly _chatTodoListService;
72
+ private readonly _chatArtifactsService;
73
+ private readonly _chatDebugService;
67
74
  private readonly _dialogService;
68
75
  private readonly _editorService;
69
76
  private readonly editorGroupService;
70
77
  private readonly _logService;
78
+ private readonly _instantiationService;
71
79
  private readonly _itemControllerRegistrations;
72
80
  private readonly _contentProvidersRegistrations;
73
81
  private readonly _sessionTypeToHandle;
74
82
  private readonly _activeSessions;
75
83
  private readonly _sessionDisposables;
76
84
  private readonly _proxy;
77
- constructor(_extHostContext: IExtHostContext, _agentSessionsService: IAgentSessionsService, _chatSessionsService: IChatSessionsService, _chatService: IChatService, _chatWidgetService: IChatWidgetService, _chatTodoListService: IChatTodoListService, _dialogService: IDialogService, _editorService: IEditorService, editorGroupService: IEditorGroupsService, _logService: ILogService);
85
+ constructor(_extHostContext: IExtHostContext, _agentSessionsService: IAgentSessionsService, _chatSessionsService: IChatSessionsService, _chatService: IChatService, _chatWidgetService: IChatWidgetService, _chatTodoListService: IChatTodoListService, _chatArtifactsService: IChatArtifactsService, _chatDebugService: IChatDebugService, _dialogService: IDialogService, _editorService: IEditorService, editorGroupService: IEditorGroupsService, _logService: ILogService, _instantiationService: IInstantiationService);
78
86
  private _getHandleForSessionType;
79
87
  $registerChatSessionItemController(handle: number, chatSessionType: string): void;
80
88
  private getController;
81
- $onDidChangeChatSessionItems(handle: number): void;
82
89
  private _resolveSessionItem;
83
90
  $updateChatSessionItems(controllerHandle: number, change: IChatSessionItemsChange): Promise<void>;
84
91
  $addOrUpdateChatSessionItem(controllerHandle: number, item: Dto<IChatSessionItem>): Promise<void>;
85
- $onDidChangeChatSessionOptions(handle: number, sessionResourceComponents: UriComponents, updates: ReadonlyArray<{
86
- optionId: string;
87
- value: string;
88
- }>): void;
92
+ $onDidChangeChatSessionOptions(handle: number, sessionResourceComponents: UriComponents, updates: Record<string, string | IChatSessionProviderOptionItem>): void;
89
93
  $onDidCommitChatSessionItem(handle: number, originalComponents: UriComponents, modifiedCompoennts: UriComponents): Promise<void>;
94
+ /**
95
+ * Re-sends pending and in-flight requests from the original session on the committed session.
96
+ */
97
+ private _resendPendingRequests;
90
98
  private handleSessionModelOverrides;
91
99
  private _provideChatSessionContent;
92
100
  $unregisterChatSessionItemController(handle: number): void;
@@ -105,8 +113,5 @@ export declare class MainThreadChatSessions extends Disposable implements MainTh
105
113
  /**
106
114
  * Notify the extension about option changes for a session
107
115
  */
108
- notifyOptionsChange(handle: number, sessionResource: URI, updates: ReadonlyArray<{
109
- optionId: string;
110
- value: string | IChatSessionProviderOptionItem | undefined;
111
- }>): Promise<void>;
116
+ notifyOptionsChange(handle: number, sessionResource: URI, updates: ReadonlyMap<string, string | IChatSessionProviderOptionItem | undefined>): Promise<void>;
112
117
  }