import { CancellationToken } from "../../../../../../base/common/cancellation.js"; import { IDisposable } from "../../../../../../base/common/lifecycle.js"; import { ResourceSet } from "../../../../../../base/common/map.js"; import { ITextModel } from "../../../../../../editor/common/model.js"; import { IExtensionDescription } from "../../../../../../platform/extensions/common/extensions.js"; import { URI, Event } from "../../../../../../sessions/sessions.web.main.internal.js"; import { IResolvedPromptSourceFolder } from "../config/promptFileLocations.js"; import { ParsedPromptFile } from "../promptFileParser.js"; import { PromptsType } from "../promptTypes.js"; import { IPromptPath, PromptsStorage, IResolvedChatPromptSlashCommand, IChatPromptSlashCommand, ICustomAgent, IAgentInstructionFile, Logger, IPromptFileContext, IPromptFileResource, IAgentSkill, IConfiguredHooksInfo, IInstructionFile, IPromptDiscoveryInfo } from "./promptsService.js"; /** * Provides prompt services. */ export declare const IPromptsService: import("../../../../../../platform/instantiation/common/instantiation.js").ServiceIdentifier; /** * Provides prompt services. */ export interface IPromptsService extends IDisposable { readonly _serviceBrand: undefined; /** * The parsed prompt file for the provided text model. * @param textModel Returns the parsed prompt file. */ getParsedPromptFile(textModel: ITextModel): ParsedPromptFile; /** * List all available prompt files. */ listPromptFiles(type: PromptsType, token: CancellationToken): Promise; /** * Lists all available prompt files from a storage location. For local storage, root scopes relative locations; it is ignored for other storages, and without it the current workspace folders are used. */ listPromptFilesForStorage(type: PromptsType, storage: PromptsStorage, token: CancellationToken, root?: URI): Promise; /** * Get a list of prompt source folders based on the provided prompt type. */ getSourceFolders(type: PromptsType): Promise; /** * Get a list of resolved prompt source folders with full metadata. * This includes displayPath, isDefault, and storage information. * Used for diagnostics and config-info displays. */ getResolvedSourceFolders(type: PromptsType): Promise; /** * Validates if the provided command name is a valid prompt slash command. */ isValidSlashCommandName(name: string): boolean; /** * Synchronously checks whether `name` matches a discovered prompt slash command. * Backed by a cache that is populated lazily on the first call and refreshed on * subsequent {@link onDidChangeSlashCommands} firings, so the very first call after * service creation may return `false` for known commands until the first discovery * completes. */ hasPromptSlashCommand(name: string): boolean; /** * Gets the prompt file for a slash command. */ resolvePromptSlashCommand(command: string, sessionType: string | undefined, token: CancellationToken): Promise; /** * Event that is triggered when the slash command to ParsedPromptFile cache is updated. * Event handlers can use {@link resolvePromptSlashCommand} to retrieve the latest data. */ readonly onDidChangeSlashCommands: Event; /** * Returns a prompt command if the command name is valid. */ getPromptSlashCommands(token: CancellationToken): Promise; /** * Returns the prompt command name for the given URI. */ getPromptSlashCommandName(uri: URI, token: CancellationToken): Promise; /** * Event that is triggered when the list of custom agents changes. */ readonly onDidChangeCustomAgents: Event; /** * Event that is triggered when the list of instruction files changes. */ readonly onDidChangeInstructions: Event; /** * Event that is triggered when the list of agent instruction files changes. */ readonly onDidChangeAgentInstructions: Event; /** * Finds all available custom agents */ getCustomAgents(token: CancellationToken): Promise; /** * Parses the provided URI * @param uris */ parseNew(uri: URI, token: CancellationToken): Promise; /** * Internal: register a contributed file. Returns a disposable that removes the contribution. * Not intended for extension authors; used by contribution point handler. */ registerContributedFile(type: PromptsType, uri: URI, extension: IExtensionDescription, name: string | undefined, description: string | undefined, when?: string, sessionTypes?: readonly string[]): IDisposable; getPromptLocationLabel(promptPath: IPromptPath): string; /** * Gets list of AGENTS.md files, including optionally nested ones from subfolders. */ listNestedAgentMDs(token: CancellationToken): Promise; /** * Gets combined list of agent instruction files (AGENTS.md, CLAUDE.md, copilot-instructions.md). * Combines results from listAgentMDs (non-nested), listClaudeMDs, and listCopilotInstructionsMDs. */ listAgentInstructions(token: CancellationToken, logger?: Logger): Promise; /** * Gets the combined voice customization from `~/.copilot/voice.md` and each * trusted workspace's `.github/voice.md`. */ getVoiceInstructions(token: CancellationToken): Promise; /** * Gets the combined dictation customization from `~/.copilot/dictation.md` * and each trusted workspace's `.github/dictation.md`. */ getDictationInstructions(token: CancellationToken): Promise; /** * For a chat mode file URI, return the name of the agent file that it should use. * @param oldURI */ getAgentFileURIFromModeFile(oldURI: URI): URI | undefined; /** * Returns the list of disabled prompt file URIs for a given type. By default no prompt files are disabled. */ getDisabledPromptFiles(type: PromptsType): ResourceSet; /** * Persists the set of disabled prompt file URIs for the given type. */ setDisabledPromptFiles(type: PromptsType, uris: ResourceSet): void; /** * Registers a prompt file provider that can provide prompt files for repositories. * @param extension The extension registering the provider. * @param type The type of contribution. * @param provider The provider implementation with optional change event. * @returns A disposable that unregisters the provider when disposed. */ registerPromptFileProvider(extension: IExtensionDescription, type: PromptsType, provider: { onDidChangePromptFiles?: Event; providePromptFiles: (context: IPromptFileContext, token: CancellationToken) => Promise; }): IDisposable; /** * Gets list of agent skills files. */ findAgentSkills(token: CancellationToken): Promise; /** * Event that is triggered when the list of skills changes. */ readonly onDidChangeSkills: Event; /** * Event that is triggered when the effective hook availability or configuration changes. */ readonly onDidChangeHooks: Event; /** * Gets all hooks collected from hooks.json files. * The result is cached and invalidated when the effective hook availability or configuration changes. */ getHooks(token: CancellationToken): Promise; /** * Gets all instruction files */ getInstructionFiles(token: CancellationToken): Promise; /** * Returns the cached discovery info for the given prompt type. */ getDiscoveryInfo(type: PromptsType, token: CancellationToken): Promise; }