@codingame/monaco-vscode-chat-service-override 16.0.0 → 16.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-chat-service-override",
3
- "version": "16.0.0",
3
+ "version": "16.0.2",
4
4
  "private": false,
5
5
  "description": "VSCode public API plugged on the monaco editor - chat service-override",
6
6
  "keywords": [],
@@ -15,31 +15,31 @@
15
15
  },
16
16
  "type": "module",
17
17
  "dependencies": {
18
- "@codingame/monaco-vscode-1021b67c-93e5-5c78-a270-cbdb2574d980-common": "16.0.0",
19
- "@codingame/monaco-vscode-12c5f9eb-72d3-57ca-babd-5bef7aa9de3b-common": "16.0.0",
20
- "@codingame/monaco-vscode-1cc4ea0a-c5b6-54ed-bb60-078a99119b55-common": "16.0.0",
21
- "@codingame/monaco-vscode-29bc1406-2925-5b8f-b25e-d04a7772d896-common": "16.0.0",
22
- "@codingame/monaco-vscode-2b1a9082-790f-527f-b013-d1b29d6265a3-common": "16.0.0",
23
- "@codingame/monaco-vscode-42931eb9-e564-530c-bafc-fa23ab43a070-common": "16.0.0",
24
- "@codingame/monaco-vscode-65619f8f-0eab-5d8b-855a-43b6353fe527-common": "16.0.0",
25
- "@codingame/monaco-vscode-68b3311c-eb96-5711-8f72-f5f4b2e31932-common": "16.0.0",
26
- "@codingame/monaco-vscode-805e9c2f-56b6-5a43-8b5b-d2dc2d3805fc-common": "16.0.0",
27
- "@codingame/monaco-vscode-8c844347-a703-5de1-9eeb-5e0c7f503a58-common": "16.0.0",
28
- "@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common": "16.0.0",
29
- "@codingame/monaco-vscode-9b5a5e82-d649-5455-b4bf-ef90d6afd294-common": "16.0.0",
30
- "@codingame/monaco-vscode-a1eb43d5-da63-5f76-8ad4-acf0d6c3b749-common": "16.0.0",
31
- "@codingame/monaco-vscode-a7c9ae3c-16d2-5d17-86b2-981be7094566-common": "16.0.0",
32
- "@codingame/monaco-vscode-ad89fae6-94f0-5ac2-a185-22dea4b68ee0-common": "16.0.0",
33
- "@codingame/monaco-vscode-ae8a8ca1-f243-508b-9c37-c88ebbd295fa-common": "16.0.0",
34
- "@codingame/monaco-vscode-aff8bc9b-c6f8-578f-9c8a-f70d14f9c13c-common": "16.0.0",
35
- "@codingame/monaco-vscode-api": "16.0.0",
36
- "@codingame/monaco-vscode-b1110435-a331-5549-ab1e-aa3d763c3a1f-common": "16.0.0",
37
- "@codingame/monaco-vscode-bba55be6-41a2-50cd-a3cc-8bafa35bfa89-common": "16.0.0",
38
- "@codingame/monaco-vscode-c4e2825a-b5b1-5f0e-b547-068c32e06d50-common": "16.0.0",
39
- "@codingame/monaco-vscode-ea14e352-8f1c-5569-b79a-8a96a53e8abe-common": "16.0.0",
40
- "@codingame/monaco-vscode-ec21d4de-4d65-574c-8715-bb1a6bbad376-common": "16.0.0",
41
- "@codingame/monaco-vscode-f1bbc6d3-6129-583c-a2ba-c80b832993d2-common": "16.0.0",
42
- "@codingame/monaco-vscode-fdf643f9-94dd-5510-b97a-408abf26ad92-common": "16.0.0"
18
+ "@codingame/monaco-vscode-1021b67c-93e5-5c78-a270-cbdb2574d980-common": "16.0.2",
19
+ "@codingame/monaco-vscode-12c5f9eb-72d3-57ca-babd-5bef7aa9de3b-common": "16.0.2",
20
+ "@codingame/monaco-vscode-1cc4ea0a-c5b6-54ed-bb60-078a99119b55-common": "16.0.2",
21
+ "@codingame/monaco-vscode-29bc1406-2925-5b8f-b25e-d04a7772d896-common": "16.0.2",
22
+ "@codingame/monaco-vscode-2b1a9082-790f-527f-b013-d1b29d6265a3-common": "16.0.2",
23
+ "@codingame/monaco-vscode-42931eb9-e564-530c-bafc-fa23ab43a070-common": "16.0.2",
24
+ "@codingame/monaco-vscode-65619f8f-0eab-5d8b-855a-43b6353fe527-common": "16.0.2",
25
+ "@codingame/monaco-vscode-68b3311c-eb96-5711-8f72-f5f4b2e31932-common": "16.0.2",
26
+ "@codingame/monaco-vscode-805e9c2f-56b6-5a43-8b5b-d2dc2d3805fc-common": "16.0.2",
27
+ "@codingame/monaco-vscode-8c844347-a703-5de1-9eeb-5e0c7f503a58-common": "16.0.2",
28
+ "@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common": "16.0.2",
29
+ "@codingame/monaco-vscode-9b5a5e82-d649-5455-b4bf-ef90d6afd294-common": "16.0.2",
30
+ "@codingame/monaco-vscode-a1eb43d5-da63-5f76-8ad4-acf0d6c3b749-common": "16.0.2",
31
+ "@codingame/monaco-vscode-a7c9ae3c-16d2-5d17-86b2-981be7094566-common": "16.0.2",
32
+ "@codingame/monaco-vscode-ad89fae6-94f0-5ac2-a185-22dea4b68ee0-common": "16.0.2",
33
+ "@codingame/monaco-vscode-ae8a8ca1-f243-508b-9c37-c88ebbd295fa-common": "16.0.2",
34
+ "@codingame/monaco-vscode-aff8bc9b-c6f8-578f-9c8a-f70d14f9c13c-common": "16.0.2",
35
+ "@codingame/monaco-vscode-api": "16.0.2",
36
+ "@codingame/monaco-vscode-b1110435-a331-5549-ab1e-aa3d763c3a1f-common": "16.0.2",
37
+ "@codingame/monaco-vscode-bba55be6-41a2-50cd-a3cc-8bafa35bfa89-common": "16.0.2",
38
+ "@codingame/monaco-vscode-c4e2825a-b5b1-5f0e-b547-068c32e06d50-common": "16.0.2",
39
+ "@codingame/monaco-vscode-ea14e352-8f1c-5569-b79a-8a96a53e8abe-common": "16.0.2",
40
+ "@codingame/monaco-vscode-ec21d4de-4d65-574c-8715-bb1a6bbad376-common": "16.0.2",
41
+ "@codingame/monaco-vscode-f1bbc6d3-6129-583c-a2ba-c80b832993d2-common": "16.0.2",
42
+ "@codingame/monaco-vscode-fdf643f9-94dd-5510-b97a-408abf26ad92-common": "16.0.2"
43
43
  },
44
44
  "main": "index.js",
45
45
  "module": "index.js",
@@ -5,6 +5,7 @@ import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/fi
5
5
  import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
6
6
  import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
7
7
  import { ITelemetryService } from "@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service";
8
+ import { IUserDataProfilesService } from "@codingame/monaco-vscode-api/vscode/vs/platform/userDataProfile/common/userDataProfile.service";
8
9
  import { IWorkspaceContextService } from "@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service";
9
10
  import { ILifecycleService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle.service";
10
11
  import { ChatModel, ISerializableChatData, ISerializableChatsData } from "@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/common/chatModel";
@@ -17,11 +18,13 @@ export declare class ChatSessionStore extends Disposable {
17
18
  private readonly telemetryService;
18
19
  private readonly storageService;
19
20
  private readonly lifecycleService;
21
+ private readonly userDataProfilesService;
20
22
  private readonly storageRoot;
23
+ private readonly previousEmptyWindowStorageRoot;
21
24
  private readonly storeQueue;
22
25
  private storeTask;
23
26
  private shuttingDown;
24
- constructor(fileService: IFileService, environmentService: IEnvironmentService, logService: ILogService, workspaceContextService: IWorkspaceContextService, telemetryService: ITelemetryService, storageService: IStorageService, lifecycleService: ILifecycleService);
27
+ constructor(fileService: IFileService, environmentService: IEnvironmentService, logService: ILogService, workspaceContextService: IWorkspaceContextService, telemetryService: ITelemetryService, storageService: IStorageService, lifecycleService: ILifecycleService, userDataProfilesService: IUserDataProfilesService);
25
28
  storeSessions(sessions: ChatModel[]): Promise<void>;
26
29
  private writeSession;
27
30
  private flushIndex;
@@ -41,6 +44,7 @@ export declare class ChatSessionStore extends Disposable {
41
44
  migrateDataIfNeeded(getInitialData: () => ISerializableChatsData | undefined): Promise<void>;
42
45
  private migrate;
43
46
  readSession(sessionId: string): Promise<ISerializableChatData | undefined>;
47
+ private readSessionFromPreviousLocation;
44
48
  private getStorageLocation;
45
49
  getChatStorageFolder(): URI;
46
50
  }
@@ -15,6 +15,7 @@ import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log
15
15
  import { StorageTarget, StorageScope } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
16
16
  import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
17
17
  import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
18
+ import { IUserDataProfilesService } from '@codingame/monaco-vscode-api/vscode/vs/platform/userDataProfile/common/userDataProfile.service';
18
19
  import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
19
20
  import { ILifecycleService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle.service';
20
21
  import { normalizeSerializableChatData, ChatModel } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/common/chatModel';
@@ -22,7 +23,7 @@ import { normalizeSerializableChatData, ChatModel } from '@codingame/monaco-vsco
22
23
  const maxPersistedSessions = 25;
23
24
  const ChatIndexStorageKey = 'chat.ChatSessionStore.index';
24
25
  let ChatSessionStore = class ChatSessionStore extends Disposable {
25
- constructor(fileService, environmentService, logService, workspaceContextService, telemetryService, storageService, lifecycleService) {
26
+ constructor(fileService, environmentService, logService, workspaceContextService, telemetryService, storageService, lifecycleService, userDataProfilesService) {
26
27
  super();
27
28
  this.fileService = fileService;
28
29
  this.environmentService = environmentService;
@@ -31,14 +32,18 @@ let ChatSessionStore = class ChatSessionStore extends Disposable {
31
32
  this.telemetryService = telemetryService;
32
33
  this.storageService = storageService;
33
34
  this.lifecycleService = lifecycleService;
35
+ this.userDataProfilesService = userDataProfilesService;
34
36
  this.storeQueue = ( new Sequencer());
35
37
  this.shuttingDown = false;
36
38
  const workspace = this.workspaceContextService.getWorkspace();
37
39
  const isEmptyWindow = !workspace.configuration && workspace.folders.length === 0;
38
- const workspaceId = isEmptyWindow ?
39
- 'no-workspace' :
40
- this.workspaceContextService.getWorkspace().id;
41
- this.storageRoot = joinPath(this.environmentService.workspaceStorageHome, workspaceId, 'chatSessions');
40
+ const workspaceId = this.workspaceContextService.getWorkspace().id;
41
+ this.storageRoot = isEmptyWindow ?
42
+ joinPath(this.userDataProfilesService.defaultProfile.globalStorageHome, 'emptyWindowChatSessions') :
43
+ joinPath(this.environmentService.workspaceStorageHome, workspaceId, 'chatSessions');
44
+ this.previousEmptyWindowStorageRoot = isEmptyWindow ?
45
+ joinPath(this.environmentService.workspaceStorageHome, 'no-workspace', 'chatSessions') :
46
+ undefined;
42
47
  this._register(this.lifecycleService.onWillShutdown(e => {
43
48
  this.shuttingDown = true;
44
49
  if (!this.storeTask) {
@@ -230,7 +235,12 @@ let ChatSessionStore = class ChatSessionStore extends Disposable {
230
235
  }
231
236
  catch (e) {
232
237
  this.reportError('sessionReadFile', `Error reading chat session file ${sessionId}`, e);
233
- return undefined;
238
+ if (toFileOperationResult(e) === FileOperationResult.FILE_NOT_FOUND && this.previousEmptyWindowStorageRoot) {
239
+ rawData = await this.readSessionFromPreviousLocation(sessionId);
240
+ }
241
+ if (!rawData) {
242
+ return undefined;
243
+ }
234
244
  }
235
245
  try {
236
246
  const session = revive(JSON.parse(rawData));
@@ -255,6 +265,21 @@ let ChatSessionStore = class ChatSessionStore extends Disposable {
255
265
  }
256
266
  });
257
267
  }
268
+ async readSessionFromPreviousLocation(sessionId) {
269
+ let rawData;
270
+ if (this.previousEmptyWindowStorageRoot) {
271
+ const storageLocation2 = joinPath(this.previousEmptyWindowStorageRoot, `${sessionId}.json`);
272
+ try {
273
+ rawData = ( (await this.fileService.readFile(storageLocation2)).value.toString());
274
+ this.logService.info(`ChatSessionStore: Read chat session ${sessionId} from previous location`);
275
+ }
276
+ catch (e) {
277
+ this.reportError('sessionReadFile', `Error reading chat session file ${sessionId} from previous location`, e);
278
+ return undefined;
279
+ }
280
+ }
281
+ return rawData;
282
+ }
258
283
  getStorageLocation(chatSessionId) {
259
284
  return joinPath(this.storageRoot, `${chatSessionId}.json`);
260
285
  }
@@ -269,7 +294,8 @@ ChatSessionStore = ( __decorate([
269
294
  ( __param(3, IWorkspaceContextService)),
270
295
  ( __param(4, ITelemetryService)),
271
296
  ( __param(5, IStorageService)),
272
- ( __param(6, ILifecycleService))
297
+ ( __param(6, ILifecycleService)),
298
+ ( __param(7, IUserDataProfilesService))
273
299
  ], ChatSessionStore));
274
300
  function isChatSessionEntryMetadata(obj) {
275
301
  return (!!obj &&