Path: blob/main/extensions/copilot/src/extension/prompt/node/promptVariablesService.ts
13399 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 { ChatLanguageModelToolReference, ChatPromptReference } from 'vscode';6import { createServiceIdentifier } from '../../../util/common/services';789export const IPromptVariablesService = createServiceIdentifier<IPromptVariablesService>('IPromptVariablesService');1011export interface IPromptVariablesService {12readonly _serviceBrand: undefined;13resolveVariablesInPrompt(message: string, variables: readonly ChatPromptReference[]): Promise<{ message: string }>;14resolveToolReferencesInPrompt(message: string, toolReferences: readonly ChatLanguageModelToolReference[]): Promise<string>;1516/**17* Builds a context string describing resolved template variables for18* injection into system prompts. This allows skills that reference19* `{{VARIABLE_NAME}}` placeholders to have their values available20* via session context.21*/22buildTemplateVariablesContext(sessionId: string | undefined, debugTargetSessionIds?: readonly string[]): string;23}2425export class NullPromptVariablesService implements IPromptVariablesService {26declare readonly _serviceBrand: undefined;2728async resolveVariablesInPrompt(message: string, variables: readonly ChatPromptReference[]): Promise<{ message: string }> {29return { message };30}3132async resolveToolReferencesInPrompt(message: string, toolReferences: readonly ChatLanguageModelToolReference[]): Promise<string> {33return message;34}3536buildTemplateVariablesContext(): string {37return '';38}39}404142