Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vscode-dts/vscode.proposed.chatPromptFiles.d.ts
5243 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
// version: 1
7
8
declare module 'vscode' {
9
// #region Resource Classes
10
11
/**
12
* Represents a chat-related resource, such as a custom agent, instructions, prompt file, or skill.
13
*/
14
export interface ChatResource {
15
/**
16
* Uri to the chat resource. This is typically a `.agent.md`, `.instructions.md`, `.prompt.md`, or `SKILL.md` file.
17
*/
18
readonly uri: Uri;
19
}
20
21
// #endregion
22
23
// #region Providers
24
25
/**
26
* A provider that supplies custom agent resources (from .agent.md files) for repositories.
27
*/
28
export interface ChatCustomAgentProvider {
29
/**
30
* An optional event to signal that custom agents have changed.
31
*/
32
readonly onDidChangeCustomAgents?: Event<void>;
33
34
/**
35
* Provide the list of custom agents available.
36
* @param context Context for the provide call.
37
* @param token A cancellation token.
38
* @returns An array of custom agents or a promise that resolves to such.
39
*/
40
provideCustomAgents(context: unknown, token: CancellationToken): ProviderResult<ChatResource[]>;
41
}
42
43
/**
44
* A provider that supplies instructions resources for repositories.
45
*/
46
export interface ChatInstructionsProvider {
47
/**
48
* An optional event to signal that instructions have changed.
49
*/
50
readonly onDidChangeInstructions?: Event<void>;
51
52
/**
53
* Provide the list of instructions available.
54
* @param context Context for the provide call.
55
* @param token A cancellation token.
56
* @returns An array of instructions or a promise that resolves to such.
57
*/
58
provideInstructions(context: unknown, token: CancellationToken): ProviderResult<ChatResource[]>;
59
}
60
61
/**
62
* A provider that supplies prompt file resources (from .prompt.md files) for repositories.
63
*/
64
export interface ChatPromptFileProvider {
65
/**
66
* An optional event to signal that prompt files have changed.
67
*/
68
readonly onDidChangePromptFiles?: Event<void>;
69
70
/**
71
* Provide the list of prompt files available.
72
* @param context Context for the provide call.
73
* @param token A cancellation token.
74
* @returns An array of prompt files or a promise that resolves to such.
75
*/
76
providePromptFiles(context: unknown, token: CancellationToken): ProviderResult<ChatResource[]>;
77
}
78
79
// #endregion
80
81
// #region SkillProvider
82
83
/**
84
* A provider that supplies SKILL.md resources for agents.
85
*/
86
export interface ChatSkillProvider {
87
/**
88
* An optional event to signal that skills have changed.
89
*/
90
readonly onDidChangeSkills?: Event<void>;
91
92
/**
93
* Provide the list of skills available.
94
* @param context Context for the provide call.
95
* @param token A cancellation token.
96
* @returns An array of skill resources or a promise that resolves to such.
97
*/
98
provideSkills(context: unknown, token: CancellationToken): ProviderResult<ChatResource[]>;
99
}
100
101
// #endregion
102
103
// #region Chat Provider Registration
104
105
export namespace chat {
106
/**
107
* Register a provider for custom agents.
108
* @param provider The custom agent provider.
109
* @returns A disposable that unregisters the provider when disposed.
110
*/
111
export function registerCustomAgentProvider(provider: ChatCustomAgentProvider): Disposable;
112
113
/**
114
* Register a provider for instructions.
115
* @param provider The instructions provider.
116
* @returns A disposable that unregisters the provider when disposed.
117
*/
118
export function registerInstructionsProvider(provider: ChatInstructionsProvider): Disposable;
119
120
/**
121
* Register a provider for prompt files.
122
* @param provider The prompt file provider.
123
* @returns A disposable that unregisters the provider when disposed.
124
*/
125
export function registerPromptFileProvider(provider: ChatPromptFileProvider): Disposable;
126
127
/**
128
* Register a provider for skills.
129
* @param provider The skill provider.
130
* @returns A disposable that unregisters the provider when disposed.
131
*/
132
export function registerSkillProvider(provider: ChatSkillProvider): Disposable;
133
}
134
135
// #endregion
136
}
137
138