Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/workbench/contrib/chat/common/constants.ts
3296 views
1
/*---------------------------------------------------------------------------------------------
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 { Schemas } from '../../../../base/common/network.js';
7
8
export enum ChatConfiguration {
9
UseFileStorage = 'chat.useFileStorage',
10
AgentEnabled = 'chat.agent.enabled',
11
Edits2Enabled = 'chat.edits2.enabled',
12
ExtensionToolsEnabled = 'chat.extensionTools.enabled',
13
EditRequests = 'chat.editRequests',
14
GlobalAutoApprove = 'chat.tools.global.autoApprove',
15
AutoApproveEdits = 'chat.tools.edits.autoApprove',
16
EnableMath = 'chat.math.enabled',
17
CheckpointsEnabled = 'chat.checkpoints.enabled',
18
AgentSessionsViewLocation = 'chat.agentSessionsViewLocation',
19
ThinkingStyle = 'chat.agent.thinkingStyle',
20
UseChatSessionsForCloudButton = 'chat.useChatSessionsForCloudButton',
21
ShowAgentSessionsViewDescription = 'chat.showAgentSessionsViewDescription',
22
EmptyStateHistoryEnabled = 'chat.emptyState.history.enabled'
23
}
24
25
/**
26
* The "kind" of the chat mode- "Agent" for custom modes.
27
*/
28
export enum ChatModeKind {
29
Ask = 'ask',
30
Edit = 'edit',
31
Agent = 'agent'
32
}
33
34
export function validateChatMode(mode: unknown): ChatModeKind | undefined {
35
switch (mode) {
36
case ChatModeKind.Ask:
37
case ChatModeKind.Edit:
38
case ChatModeKind.Agent:
39
return mode as ChatModeKind;
40
default:
41
return undefined;
42
}
43
}
44
45
export function isChatMode(mode: unknown): mode is ChatModeKind {
46
return !!validateChatMode(mode);
47
}
48
49
// Thinking display modes for pinned content
50
export enum ThinkingDisplayMode {
51
Collapsed = 'collapsed',
52
CollapsedPreview = 'collapsedPreview',
53
Expanded = 'expanded',
54
None = 'none'
55
}
56
57
export type RawChatParticipantLocation = 'panel' | 'terminal' | 'notebook' | 'editing-session';
58
59
export enum ChatAgentLocation {
60
Panel = 'panel',
61
Terminal = 'terminal',
62
Notebook = 'notebook',
63
Editor = 'editor',
64
}
65
66
export namespace ChatAgentLocation {
67
export function fromRaw(value: RawChatParticipantLocation | string): ChatAgentLocation {
68
switch (value) {
69
case 'panel': return ChatAgentLocation.Panel;
70
case 'terminal': return ChatAgentLocation.Terminal;
71
case 'notebook': return ChatAgentLocation.Notebook;
72
case 'editor': return ChatAgentLocation.Editor;
73
}
74
return ChatAgentLocation.Panel;
75
}
76
}
77
78
export const ChatUnsupportedFileSchemes = new Set([Schemas.vscodeChatEditor, Schemas.walkThrough, Schemas.vscodeChatSession, 'ccreq']);
79
80