Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/src/platform/promptFiles/common/promptsService.ts
13401 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 type { ChatCustomAgent, ChatHook, ChatInstruction, ChatPlugin, ChatSkill, ChatSlashCommand } from 'vscode';
7
import { createServiceIdentifier } from '../../../util/common/services';
8
import { Event } from '../../../util/vs/base/common/event';
9
import { CancellationToken } from '../../../util/vs/base/common/cancellation';
10
import { URI } from '../../../util/vs/base/common/uri';
11
import { ParsedPromptFile } from '../../../util/vs/workbench/contrib/chat/common/promptSyntax/promptFileParser';
12
13
export * from '../../../util/vs/workbench/contrib/chat/common/promptSyntax/promptFileParser';
14
15
export const IPromptsService = createServiceIdentifier<IPromptsService>('IPromptsService');
16
17
export namespace PromptFileLangageId {
18
export const prompt = 'prompt';
19
export const instructions = 'instructions';
20
export const agent = 'chatagent';
21
}
22
23
/**
24
* A service that provides prompt file related functionalities: agents, instructions and prompt files.
25
*/
26
export interface IPromptsService {
27
readonly _serviceBrand: undefined;
28
/**
29
* Reads and parses the provided URI
30
* @param uris
31
*/
32
parseFile(uri: URI, token: CancellationToken): Promise<ParsedPromptFile>;
33
34
/**
35
* An event that fires when the list of {@link customAgents custom agents} changes.
36
*/
37
readonly onDidChangeCustomAgents: Event<void>;
38
39
/**
40
* The list of currently available custom agents. These are `.agent.md` files
41
* from all sources (workspace, user, and extension-provided).
42
*/
43
getCustomAgents(token: CancellationToken): Promise<readonly ChatCustomAgent[]>;
44
45
/**
46
* Returns the slash command prompt files. These are prompts and skills
47
* from all sources (workspace, user, and extension-provided).
48
*/
49
getSlashCommands(token: CancellationToken): Promise<readonly ChatSlashCommand[]>;
50
51
/**
52
* An event that fires when the list of {@link instructions instructions} changes.
53
*/
54
readonly onDidChangeInstructions: Event<void>;
55
56
/**
57
* The list of currently available instructions. These are `.instructions.md` files
58
* from all sources (workspace, user, and extension-provided).
59
*/
60
getInstructions(token: CancellationToken): Promise<readonly ChatInstruction[]>;
61
62
/**
63
* An event that fires when the list of {@link skills skills} changes.
64
*/
65
readonly onDidChangeSkills: Event<void>;
66
67
/**
68
* The list of currently available skills. These are `SKILL.md` files
69
* from all sources (workspace, user, and extension-provided).
70
*/
71
getSkills(token: CancellationToken): Promise<readonly ChatSkill[]>;
72
73
/**
74
* An event that fires when the list of {@link hooks hooks} changes.
75
*/
76
readonly onDidChangeHooks: Event<void>;
77
78
/**
79
* The list of currently available hook configuration files.
80
* These are JSON files that define lifecycle hooks from all sources
81
* (workspace, user, and extension-provided).
82
*/
83
getHooks(token: CancellationToken): Promise<readonly ChatHook[]>;
84
85
/**
86
* An event that fires when the list of {@link plugins plugins} changes.
87
*/
88
readonly onDidChangePlugins: Event<void>;
89
90
/**
91
* The list of currently installed agent plugins.
92
*/
93
getPlugins(token: CancellationToken): Promise<readonly ChatPlugin[]>;
94
95
96
}
97
98