1
>
/*---------------------------------------------------------------------------------------------
userDataProfile.ts
2
>
* Copyright (c) Microsoft Corporation. All rights reserved.
3
>
* Licensed under the MIT License. See License.txt in the project root for license information.
4
>
*--------------------------------------------------------------------------------------------*/
5
>
6
>
import { hash } from '../../../base/common/hash.js';
7
>
import { Emitter, Event } from '../../../base/common/event.js';
8
>
import { Disposable } from '../../../base/common/lifecycle.js';
9
>
import { basename, joinPath } from '../../../base/common/resources.js';
10
>
import { URI, UriDto } from '../../../base/common/uri.js';
11
>
import { localize } from '../../../nls.js';
12
>
import { IEnvironmentService } from '../../environment/common/environment.js';
13
>
import { FileOperationResult, IFileService, toFileOperationResult } from '../../files/common/files.js';
14
>
import { createDecorator } from '../../instantiation/common/instantiation.js';
15
>
import { ILogService } from '../../log/common/log.js';
16
>
import { IAnyWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier, isWorkspaceIdentifier } from '../../workspace/common/workspace.js';
17
>
import { IStringDictionary } from '../../../base/common/collections.js';
18
>
import { IUriIdentityService } from '../../uriIdentity/common/uriIdentity.js';
19
>
import { Promises } from '../../../base/common/async.js';
20
>
import { generateUuid } from '../../../base/common/uuid.js';
21
>
import { escapeRegExpCharacters } from '../../../base/common/strings.js';
22
>
import { isString, Mutable } from '../../../base/common/types.js';
23
>
24
>
export const AGENTS_WINDOW_PROFILE_ID = 'agents';
25
>
26
>
const AGENTS_WINDOW_PROFILE_FLAGS: UseDefaultProfileFlags = {
27
>
settings: true,
28
>
keybindings: true,
29
>
prompts: true,
30
>
mcp: true,
31
>
languageModels: true,
32
>
snippets: true,
33
>
tasks: true,
34
>
extensions: true,
35
>
};
36
>
37
>
export const enum ProfileResourceType {
38
>
Settings = 'settings',
39
>
Keybindings = 'keybindings',
40
>
Snippets = 'snippets',
41
>
Prompts = 'prompts',
42
>
Tasks = 'tasks',
43
>
Extensions = 'extensions',
44
>
GlobalState = 'globalState',
45
>
Mcp = 'mcp',
46
>
LanguageModels = 'languageModels',
47
>
}
48
>
49
>
/**
50
>
* Flags to indicate whether to use the default profile or not.
51
>
*/
52
>
export type UseDefaultProfileFlags = { [key in ProfileResourceType]?: boolean };
53
>
export type ProfileResourceTypeFlags = UseDefaultProfileFlags;
54
>
export type SettingValue = string | boolean | number | undefined | null | object;
55
>
export type ISettingsDictionary = Record<string, SettingValue>;
56
>
57
>
export interface IUserDataProfile {
58
>
readonly id: string;
59
>
readonly isDefault: boolean;
60
>
readonly name: string;
61
>
readonly icon?: string;
62
>
readonly location: URI;
63
>
readonly globalStorageHome: URI;
64
>
readonly settingsResource: URI;
65
>
readonly keybindingsResource: URI;
66
>
readonly tasksResource: URI;
67
>
readonly snippetsHome: URI;
68
>
readonly promptsHome: URI;
69
>
readonly extensionsResource: URI;
70
>
readonly mcpResource: URI;
71
>
readonly languageModelsResource: URI;
72
>
readonly agentPluginsHome: URI;
73
>
readonly cacheHome: URI;
74
>
readonly useDefaultFlags?: UseDefaultProfileFlags;
75
>
readonly isInternal?: boolean;
76
>
readonly isTransient?: boolean;
77
>
readonly isAgentsWindowProfile?: boolean;
78
>
readonly workspaces?: readonly URI[];
79
>
}
80
>
81
>
export function isUserDataProfile(thing: unknown): thing is IUserDataProfile {
82
const candidate = thing as IUserDataProfile | undefined;
83