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
4770 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
10
// #region CustomAgentProvider
11
12
/**
13
* Represents a custom agent resource file (e.g., .agent.md) available for a repository.
14
*/
15
export interface CustomAgentResource {
16
/**
17
* The URI to the custom agent resource file.
18
*/
19
readonly uri: Uri;
20
21
/**
22
* Indicates whether the custom agent is editable. Defaults to false.
23
*/
24
readonly isEditable?: boolean;
25
}
26
27
/**
28
* Context for querying custom agents.
29
*/
30
export type CustomAgentContext = object;
31
32
/**
33
* A provider that supplies custom agent resources (from .agent.md files) for repositories.
34
*/
35
export interface CustomAgentProvider {
36
/**
37
* A human-readable label for this provider.
38
*/
39
readonly label: string;
40
41
/**
42
* An optional event to signal that custom agents have changed.
43
*/
44
readonly onDidChangeCustomAgents?: Event<void>;
45
46
/**
47
* Provide the list of custom agents available.
48
* @param context Context for the query.
49
* @param token A cancellation token.
50
* @returns An array of custom agent resources or a promise that resolves to such.
51
*/
52
provideCustomAgents(context: CustomAgentContext, token: CancellationToken): ProviderResult<CustomAgentResource[]>;
53
}
54
55
// #endregion
56
57
// #region InstructionsProvider
58
59
/**
60
* Represents an instructions resource file available for a repository.
61
*/
62
export interface InstructionsResource {
63
/**
64
* The URI to the instructions resource file.
65
*/
66
readonly uri: Uri;
67
68
/**
69
* Indicates whether the instructions are editable. Defaults to false.
70
*/
71
readonly isEditable?: boolean;
72
}
73
74
/**
75
* Context for querying instructions.
76
*/
77
export type InstructionsContext = object;
78
79
/**
80
* A provider that supplies instructions resources for repositories.
81
*/
82
export interface InstructionsProvider {
83
/**
84
* A human-readable label for this provider.
85
*/
86
readonly label: string;
87
88
/**
89
* An optional event to signal that instructions have changed.
90
*/
91
readonly onDidChangeInstructions?: Event<void>;
92
93
/**
94
* Provide the list of instructions available.
95
* @param context Context for the query.
96
* @param token A cancellation token.
97
* @returns An array of instructions resources or a promise that resolves to such.
98
*/
99
provideInstructions(context: InstructionsContext, token: CancellationToken): ProviderResult<InstructionsResource[]>;
100
}
101
102
// #endregion
103
104
// #region PromptFileProvider
105
106
/**
107
* Represents a prompt file resource (e.g., .prompt.md) available for a repository.
108
*/
109
export interface PromptFileResource {
110
/**
111
* The URI to the prompt file resource.
112
*/
113
readonly uri: Uri;
114
115
/**
116
* Indicates whether the prompt file is editable. Defaults to false.
117
*/
118
readonly isEditable?: boolean;
119
}
120
121
/**
122
* Context for querying prompt files.
123
*/
124
export type PromptFileContext = object;
125
126
/**
127
* A provider that supplies prompt file resources (from .prompt.md files) for repositories.
128
*/
129
export interface PromptFileProvider {
130
/**
131
* A human-readable label for this provider.
132
*/
133
readonly label: string;
134
135
/**
136
* An optional event to signal that prompt files have changed.
137
*/
138
readonly onDidChangePromptFiles?: Event<void>;
139
140
/**
141
* Provide the list of prompt files available.
142
* @param context Context for the query.
143
* @param token A cancellation token.
144
* @returns An array of prompt file resources or a promise that resolves to such.
145
*/
146
providePromptFiles(context: PromptFileContext, token: CancellationToken): ProviderResult<PromptFileResource[]>;
147
}
148
149
// #endregion
150
151
// #region Chat Provider Registration
152
153
export namespace chat {
154
/**
155
* Register a provider for custom agents.
156
* @param provider The custom agent provider.
157
* @returns A disposable that unregisters the provider when disposed.
158
*/
159
export function registerCustomAgentProvider(provider: CustomAgentProvider): Disposable;
160
161
/**
162
* Register a provider for instructions.
163
* @param provider The instructions provider.
164
* @returns A disposable that unregisters the provider when disposed.
165
*/
166
export function registerInstructionsProvider(provider: InstructionsProvider): Disposable;
167
168
/**
169
* Register a provider for prompt files.
170
* @param provider The prompt file provider.
171
* @returns A disposable that unregisters the provider when disposed.
172
*/
173
export function registerPromptFileProvider(provider: PromptFileProvider): Disposable;
174
}
175
176
// #endregion
177
}
178
179