import type * as vscode from 'vscode'; import type { ChatMessage, SerializedChatMessage } from '../chat/transcript/messages'; import type { ContextItem } from '../codebase-context/messages'; import type { ContextFiltersProvider } from '../cody-ignore/context-filters-provider'; import type { TerminalOutputArguments } from '../commands/types'; import type { RangeData } from '../common/range'; import type { AutocompleteContextSnippet, DocumentContext, GitContext } from '../completions/types'; import type { ConfigGetter } from '../configuration'; import type { ActiveTextEditorDiagnostic } from '../editor'; /** * A "safe" string class for constructing prompts. */ export declare class PromptString { private __debug; /** * @deprecated Do not use the constructor directly. Instead, use ps`...` or a * PromptString helper to handle string data for prompts safely * * @param __debug The string that is wrapped by this PromptString. This is * useful for debugging since it will be shown when `console.log()` is called * with this prompt string. */ constructor(__debug: string); toString(): string; /** * Returns a string that is safe to use in a prompt that is sent to an LLM. */ toFilteredString(contextFilter: Pick): Promise; getReferences(): readonly StringReference[]; toJSON(): string; get length(): number; slice(start?: number, end?: number): PromptString; trim(): PromptString; trimEnd(): PromptString; indexOf(searchString: string | PromptString, start?: number): number; split(separator: string): PromptString[]; toLocaleLowerCase(): PromptString; includes(searchString: string | PromptString, position?: number): boolean; static join(promptStrings: PromptString[], boundary: PromptString): PromptString; concat(...promptStrings: readonly PromptString[]): PromptString; replace(searchValue: string | RegExp, replaceValue: PromptString): PromptString; replaceAll(searchValue: string | RegExp, replaceValue: PromptString): PromptString; static fromConfig(config: ConfigGetter, path: string, defaultValue: D): PromptString | D; static fromEditorIndentString(uri: vscode.Uri, workspace: Pick, window: Pick): PromptString; static fromDisplayPath(uri: vscode.Uri): PromptString; static fromDisplayPathLineRange(uri: vscode.Uri, range?: RangeData): PromptString; static fromDocumentText(document: vscode.TextDocument, range?: vscode.Range): PromptString; static fromGitDiff(uri: vscode.Uri, oldContent: string, newContent: string): PromptString; static fromTextEditorDiagnostic(diagnostic: ActiveTextEditorDiagnostic, uri: vscode.Uri): { type: PromptString; text: PromptString; message: PromptString; }; static fromMarkdownCodeBlockLanguageIDForFilename(uri: vscode.Uri): PromptString; static fromDiagnostic(uri: vscode.Uri, diagnostic: vscode.Diagnostic): { message: PromptString; source: PromptString | undefined; relatedInformation: { message: PromptString; }[] | undefined; }; static fromDocumentSymbol(uri: vscode.Uri, documentSymbol: vscode.DocumentSymbol, SymbolKind: typeof vscode.SymbolKind): PromptString; static fromDefaultCommands(commands: { [name: string]: { prompt: string; }; }, name: 'doc' | 'explain' | 'test' | 'smell'): PromptString; static fromTerminalOutputArguments(output: TerminalOutputArguments): { name: PromptString; selection: PromptString | undefined; creationOptions: PromptString | undefined; }; static fromAutocompleteDocumentContext(docContext: DocumentContext, uri: vscode.Uri): { prefix: PromptString; suffix: PromptString; injectedPrefix: PromptString | null; }; static fromAutocompleteContextSnippet(contextSnippet: AutocompleteContextSnippet): { content: PromptString; symbol: PromptString | undefined; }; static fromAutocompleteGitContext(gitContext: GitContext, uri: vscode.Uri): { repoName: PromptString; }; static fromContextItem(contextItem: ContextItem): { content: PromptString | undefined; repoName: PromptString | undefined; title: PromptString | undefined; }; static unsafe_fromUserQuery(string: string): PromptString; static unsafe_fromLLMResponse(string: string): PromptString; static unsafe_deserializeChatMessage(serializedMessage: SerializedChatMessage): ChatMessage; } type TemplateArgs = readonly (PromptString | '' | number)[]; /** * Constructs PromptStrings from template literals, numbers or other * PromptStrings. A linter in `/lint/safe-prompts.ts` checks that this function * is never used except in a tagged template literal. * * @param format the format string pieces. * @param args the arguments to splice into the format string. */ export declare function ps(format: TemplateStringsArray, ...args: TemplateArgs): PromptString; export declare function psDedent(format: TemplateStringsArray, ...args: TemplateArgs): PromptString; type StringReference = vscode.Uri; export declare function isValidPromptString(promptString: PromptString): boolean; export {}; //# sourceMappingURL=prompt-string.d.ts.map