Path: blob/main/extensions/copilot/src/platform/promptFiles/common/promptsService.ts
13401 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import type { ChatCustomAgent, ChatHook, ChatInstruction, ChatPlugin, ChatSkill, ChatSlashCommand } from 'vscode';6import { createServiceIdentifier } from '../../../util/common/services';7import { Event } from '../../../util/vs/base/common/event';8import { CancellationToken } from '../../../util/vs/base/common/cancellation';9import { URI } from '../../../util/vs/base/common/uri';10import { ParsedPromptFile } from '../../../util/vs/workbench/contrib/chat/common/promptSyntax/promptFileParser';1112export * from '../../../util/vs/workbench/contrib/chat/common/promptSyntax/promptFileParser';1314export const IPromptsService = createServiceIdentifier<IPromptsService>('IPromptsService');1516export namespace PromptFileLangageId {17export const prompt = 'prompt';18export const instructions = 'instructions';19export const agent = 'chatagent';20}2122/**23* A service that provides prompt file related functionalities: agents, instructions and prompt files.24*/25export interface IPromptsService {26readonly _serviceBrand: undefined;27/**28* Reads and parses the provided URI29* @param uris30*/31parseFile(uri: URI, token: CancellationToken): Promise<ParsedPromptFile>;3233/**34* An event that fires when the list of {@link customAgents custom agents} changes.35*/36readonly onDidChangeCustomAgents: Event<void>;3738/**39* The list of currently available custom agents. These are `.agent.md` files40* from all sources (workspace, user, and extension-provided).41*/42getCustomAgents(token: CancellationToken): Promise<readonly ChatCustomAgent[]>;4344/**45* Returns the slash command prompt files. These are prompts and skills46* from all sources (workspace, user, and extension-provided).47*/48getSlashCommands(token: CancellationToken): Promise<readonly ChatSlashCommand[]>;4950/**51* An event that fires when the list of {@link instructions instructions} changes.52*/53readonly onDidChangeInstructions: Event<void>;5455/**56* The list of currently available instructions. These are `.instructions.md` files57* from all sources (workspace, user, and extension-provided).58*/59getInstructions(token: CancellationToken): Promise<readonly ChatInstruction[]>;6061/**62* An event that fires when the list of {@link skills skills} changes.63*/64readonly onDidChangeSkills: Event<void>;6566/**67* The list of currently available skills. These are `SKILL.md` files68* from all sources (workspace, user, and extension-provided).69*/70getSkills(token: CancellationToken): Promise<readonly ChatSkill[]>;7172/**73* An event that fires when the list of {@link hooks hooks} changes.74*/75readonly onDidChangeHooks: Event<void>;7677/**78* The list of currently available hook configuration files.79* These are JSON files that define lifecycle hooks from all sources80* (workspace, user, and extension-provided).81*/82getHooks(token: CancellationToken): Promise<readonly ChatHook[]>;8384/**85* An event that fires when the list of {@link plugins plugins} changes.86*/87readonly onDidChangePlugins: Event<void>;8889/**90* The list of currently installed agent plugins.91*/92getPlugins(token: CancellationToken): Promise<readonly ChatPlugin[]>;939495}969798