@codingame/monaco-vscode-chat-service-override 20.1.0 → 20.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +36 -36
- package/vscode/src/vs/base/common/decorators/cancelPreviousCalls.d.ts +73 -0
- package/vscode/src/vs/base/common/policy.d.ts +27 -0
- package/vscode/src/vs/editor/common/diff/documentDiffProvider.d.ts +41 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolPicker.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSessionStorage.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelChangeService.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTimeline.d.ts +44 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNewNotebookContentEdits.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookCellEntry.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/helpers.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/notebookCellChanges.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/editorHoverWrapper.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/media/editorHoverWrapper.css +5 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatEditingEditorOverlay.css +22 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatEditorController.css +10 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatSessions.css +14 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatSetup.css +19 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatStatus.css +45 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/simpleBrowserOverlay.css +13 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/attachInstructionsAction.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/chatModeActions.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptName.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptSourceFolder.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/promptFilePickers.d.ts +23 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptFileActions.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/runPromptAction.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/saveToPromptAction.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatSessionStore.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptFileReferenceErrors.d.ts +54 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/asyncDecoder.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/baseDecoder.d.ts +102 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/baseToken.d.ts +42 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/compositeToken.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/frontMatterCodec/constants.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/frontMatterCodec/frontMatterDecoder.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/frontMatterCodec/parsers/frontMatterArray.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/frontMatterCodec/parsers/frontMatterRecord/frontMatterRecord.d.ts +30 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/frontMatterCodec/parsers/frontMatterRecord/frontMatterRecordName.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/frontMatterCodec/parsers/frontMatterRecord/frontMatterRecordNameWithDelimiter.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/frontMatterCodec/parsers/frontMatterSequence.d.ts +32 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/frontMatterCodec/parsers/frontMatterString.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/frontMatterCodec/parsers/frontMatterValue.d.ts +41 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/frontMatterCodec/tokens/frontMatterArray.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/frontMatterCodec/tokens/frontMatterBoolean.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/frontMatterCodec/tokens/frontMatterRecord.d.ts +61 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/frontMatterCodec/tokens/frontMatterSequence.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/frontMatterCodec/tokens/frontMatterString.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/frontMatterCodec/tokens/frontMatterToken.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/linesCodec/linesDecoder.d.ts +44 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/linesCodec/tokens/carriageReturn.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/linesCodec/tokens/line.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/linesCodec/tokens/newLine.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/markdownCodec/markdownDecoder.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/markdownCodec/parsers/markdownComment.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/markdownCodec/parsers/markdownImage.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/markdownCodec/parsers/markdownLink.d.ts +54 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/markdownCodec/tokens/markdownComment.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/markdownCodec/tokens/markdownImage.d.ts +39 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/markdownCodec/tokens/markdownLink.d.ts +39 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/markdownCodec/tokens/markdownToken.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/markdownExtensionsCodec/markdownExtensionsDecoder.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/markdownExtensionsCodec/parsers/frontMatterHeader.d.ts +29 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/markdownExtensionsCodec/tokens/frontMatterHeader.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/markdownExtensionsCodec/tokens/frontMatterMarker.d.ts +16 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/markdownExtensionsCodec/tokens/markdownExtensionsToken.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/simpleCodec/parserBase.d.ts +64 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/simpleCodec/simpleDecoder.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/simpleCodec/tokens/angleBrackets.d.ts +29 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/simpleCodec/tokens/at.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/simpleCodec/tokens/brackets.d.ts +29 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/simpleCodec/tokens/colon.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/simpleCodec/tokens/comma.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/simpleCodec/tokens/curlyBraces.d.ts +29 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/simpleCodec/tokens/dash.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/simpleCodec/tokens/dollarSign.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/simpleCodec/tokens/doubleQuote.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/simpleCodec/tokens/exclamationMark.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/simpleCodec/tokens/formFeed.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/simpleCodec/tokens/hash.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/simpleCodec/tokens/parentheses.d.ts +29 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/simpleCodec/tokens/quote.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/simpleCodec/tokens/simpleToken.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/simpleCodec/tokens/slash.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/simpleCodec/tokens/space.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/simpleCodec/tokens/tab.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/simpleCodec/tokens/verticalTab.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/simpleCodec/tokens/word.d.ts +24 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/textToken.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/utils/objectStream.d.ts +37 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/utils/objectStreamFromTextModel.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/chatPromptCodec.d.ts +30 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/chatPromptDecoder.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/parsers/promptAtMentionParser.d.ts +16 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/parsers/promptSlashCommandParser.d.ts +16 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/parsers/promptTemplateVariableParser.d.ts +21 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/parsers/promptVariableParser.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/tokens/fileReference.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/tokens/promptAtMention.d.ts +17 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/tokens/promptSlashCommand.d.ts +17 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/tokens/promptTemplateVariable.d.ts +19 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/tokens/promptToken.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/tokens/promptVariable.d.ts +39 -2
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/config/configMigration.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/filePromptContentsProvider.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/promptContentsProviderBase.d.ts +70 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/textModelContentsProvider.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderAutocompletion.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderDiagnosticsProvider.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderHovers.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptLinkDiagnosticsProvider.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptLinkProvider.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptPathAutocompletion.d.ts +45 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/providerInstanceBase.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/providerInstanceManagerBase.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/basePromptParser.d.ts +144 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/promptHeader/diagnostics.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/promptHeader/headerBase.d.ts +71 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/promptHeader/instructionsHeader.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/promptHeader/metadata/applyTo.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/promptHeader/metadata/base/enum.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/promptHeader/metadata/base/record.d.ts +42 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/promptHeader/metadata/base/string.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/promptHeader/metadata/description.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/promptHeader/metadata/mode.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/promptHeader/metadata/model.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/promptHeader/metadata/tools.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/promptHeader/modeHeader.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/promptHeader/promptHeader.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/promptParser.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/textModelPromptParser.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/topError.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/promptFileContributions.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/objectCache.d.ts +83 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/observableDisposable.d.ts +31 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +39 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsParametersSchema.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.service.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/media/terminalChatWidget.css +17 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatController.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatControllerHolder.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/bufferOutputPolling.d.ts +7 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/executeStrategy.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/noneExecuteStrategy.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/richExecuteStrategy.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/task/taskHelpers.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.d.ts +4 -0
|
@@ -6,11 +6,38 @@ import { ResolveError } from "../../promptFileReferenceErrors.js";
|
|
|
6
6
|
import { PromptsType } from "@codingame/monaco-vscode-e28ac690-06d5-5ee9-92d1-02df70296354-common/vscode/vs/workbench/contrib/chat/common/promptSyntax/promptTypes";
|
|
7
7
|
import { ObservableDisposable } from "../utils/observableDisposable.js";
|
|
8
8
|
import { IPromptContentsProvider } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/types";
|
|
9
|
+
/**
|
|
10
|
+
* Options of the {@link PromptContentsProviderBase} class.
|
|
11
|
+
*/
|
|
9
12
|
export interface IPromptContentsProviderOptions {
|
|
13
|
+
/**
|
|
14
|
+
* Whether to allow files that don't have usual prompt
|
|
15
|
+
* file extension to be treated as a prompt file.
|
|
16
|
+
*/
|
|
10
17
|
readonly allowNonPromptFiles: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Language ID to use for the prompt contents. If not set, the language ID will be inferred from the file.
|
|
20
|
+
*/
|
|
11
21
|
readonly languageId: string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* If set to `true`, the contents provider will listen for updates and retrigger a parse.
|
|
24
|
+
*/
|
|
12
25
|
readonly updateOnChange: boolean;
|
|
13
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Base class for prompt contents providers. Classes that extend this one are responsible to:
|
|
29
|
+
*
|
|
30
|
+
* - implement the {@link getContentsStream} method to provide the contents stream
|
|
31
|
+
* of a prompt; this method should throw a `ResolveError` or its derivative if the contents
|
|
32
|
+
* cannot be parsed for any reason
|
|
33
|
+
* - fire a {@link TChangeEvent} event on the {@link onChangeEmitter} event when
|
|
34
|
+
* prompt contents change
|
|
35
|
+
* - misc:
|
|
36
|
+
* - provide the {@link uri} property that represents the URI of a prompt that
|
|
37
|
+
* the contents are for
|
|
38
|
+
* - implement the {@link toString} method to return a string representation of this
|
|
39
|
+
* provider type to aid with debugging/tracing
|
|
40
|
+
*/
|
|
14
41
|
export declare abstract class PromptContentsProviderBase<TChangeEvent extends NonNullable<unknown>> extends ObservableDisposable implements IPromptContentsProvider {
|
|
15
42
|
abstract readonly uri: URI;
|
|
16
43
|
abstract createNew(promptContentsSource: {
|
|
@@ -19,14 +46,57 @@ export declare abstract class PromptContentsProviderBase<TChangeEvent extends No
|
|
|
19
46
|
abstract toString(): string;
|
|
20
47
|
abstract get languageId(): string;
|
|
21
48
|
abstract get sourceName(): string;
|
|
49
|
+
/**
|
|
50
|
+
* Prompt contents stream.
|
|
51
|
+
*/
|
|
22
52
|
get contents(): Promise<VSBufferReadableStream>;
|
|
53
|
+
/**
|
|
54
|
+
* Prompt type used to determine how to interpret file contents.
|
|
55
|
+
*/
|
|
23
56
|
get promptType(): PromptsType | "non-prompt";
|
|
57
|
+
/**
|
|
58
|
+
* Function to get contents stream for the provider. This function should
|
|
59
|
+
* throw a `ResolveError` or its derivative if the contents cannot be parsed.
|
|
60
|
+
*
|
|
61
|
+
* @param changesEvent The event that triggered the change. The special
|
|
62
|
+
* `'full'` value means that everything has changed hence entire prompt
|
|
63
|
+
* contents need to be re-parsed from scratch.
|
|
64
|
+
*/
|
|
24
65
|
protected abstract getContentsStream(changesEvent: TChangeEvent | "full", cancellationToken?: CancellationToken): Promise<VSBufferReadableStream>;
|
|
66
|
+
/**
|
|
67
|
+
* Internal event emitter for the prompt contents change event. Classes that extend
|
|
68
|
+
* this abstract class are responsible to use this emitter to fire the contents change
|
|
69
|
+
* event when the prompt contents get modified.
|
|
70
|
+
*/
|
|
25
71
|
protected readonly onChangeEmitter: Emitter<"full" | TChangeEvent>;
|
|
72
|
+
/**
|
|
73
|
+
* Options passed to the constructor
|
|
74
|
+
*/
|
|
26
75
|
protected readonly options: IPromptContentsProviderOptions;
|
|
27
76
|
constructor(options: IPromptContentsProviderOptions);
|
|
77
|
+
/**
|
|
78
|
+
* Event emitter for the prompt contents change event.
|
|
79
|
+
* See {@link onContentChanged} for more details.
|
|
80
|
+
*/
|
|
28
81
|
private readonly onContentChangedEmitter;
|
|
82
|
+
/**
|
|
83
|
+
* Event that fires when the prompt contents change. The event is either
|
|
84
|
+
* a `VSBufferReadableStream` stream with changed contents or an instance of
|
|
85
|
+
* the `ResolveError` class representing a parsing failure case.
|
|
86
|
+
*
|
|
87
|
+
* `Note!` this field is meant to be used by the external consumers of the prompt
|
|
88
|
+
* contents provider that the classes that extend this abstract class.
|
|
89
|
+
* Please use the {@link onChangeEmitter} event to provide a change
|
|
90
|
+
* event in your prompt contents implementation instead.
|
|
91
|
+
*/
|
|
29
92
|
readonly onContentChanged: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<VSBufferReadableStream | ResolveError>;
|
|
93
|
+
/**
|
|
94
|
+
* Internal common implementation of the event that should be fired when
|
|
95
|
+
* prompt contents change.
|
|
96
|
+
*/
|
|
30
97
|
private onContentsChanged;
|
|
98
|
+
/**
|
|
99
|
+
* Start producing the prompt contents data.
|
|
100
|
+
*/
|
|
31
101
|
start(token?: CancellationToken): this;
|
|
32
102
|
}
|
|
@@ -7,16 +7,36 @@ import { IModelContentChangedEvent } from "@codingame/monaco-vscode-api/vscode/v
|
|
|
7
7
|
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
8
8
|
import { IPromptContentsProviderOptions, PromptContentsProviderBase } from "./promptContentsProviderBase.js";
|
|
9
9
|
import { IPromptContentsProvider } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/types";
|
|
10
|
+
/**
|
|
11
|
+
* Prompt contents provider for a {@link ITextModel} instance.
|
|
12
|
+
*/
|
|
10
13
|
export declare class TextModelContentsProvider extends PromptContentsProviderBase<IModelContentChangedEvent> {
|
|
11
14
|
private readonly model;
|
|
12
15
|
private readonly instantiationService;
|
|
16
|
+
/**
|
|
17
|
+
* URI component of the prompt associated with this contents provider.
|
|
18
|
+
*/
|
|
13
19
|
get uri(): URI;
|
|
14
20
|
get sourceName(): string;
|
|
15
21
|
get languageId(): string;
|
|
16
22
|
constructor(model: ITextModel, options: IPromptContentsProviderOptions, instantiationService: IInstantiationService);
|
|
23
|
+
/**
|
|
24
|
+
* Creates a stream of binary data from the text model based on the changes
|
|
25
|
+
* listed in the provided event.
|
|
26
|
+
*
|
|
27
|
+
* Note! this method implements a basic logic which does not take into account
|
|
28
|
+
* the `_event` argument for incremental updates. This needs to be improved.
|
|
29
|
+
*
|
|
30
|
+
* @param _event - event that describes the changes in the text model; `'full'` is
|
|
31
|
+
* the special value that means that all contents have changed
|
|
32
|
+
* @param cancellationToken - token that cancels this operation
|
|
33
|
+
*/
|
|
17
34
|
protected getContentsStream(_event: IModelContentChangedEvent | "full", cancellationToken?: CancellationToken): Promise<VSBufferReadableStream>;
|
|
18
35
|
createNew(promptContentsSource: TextModel | {
|
|
19
36
|
uri: URI;
|
|
20
37
|
}, options: IPromptContentsProviderOptions): IPromptContentsProvider;
|
|
38
|
+
/**
|
|
39
|
+
* String representation of this object.
|
|
40
|
+
*/
|
|
21
41
|
toString(): string;
|
|
22
42
|
}
|
|
@@ -12,9 +12,19 @@ export declare class PromptHeaderAutocompletion extends Disposable implements Co
|
|
|
12
12
|
private readonly languageService;
|
|
13
13
|
private readonly languageModelsService;
|
|
14
14
|
private readonly languageModelToolsService;
|
|
15
|
+
/**
|
|
16
|
+
* Debug display name for this provider.
|
|
17
|
+
*/
|
|
15
18
|
readonly _debugDisplayName: string;
|
|
19
|
+
/**
|
|
20
|
+
* List of trigger characters handled by this provider.
|
|
21
|
+
*/
|
|
16
22
|
readonly triggerCharacters: string[];
|
|
17
23
|
constructor(promptsService: IPromptsService, languageService: ILanguageFeaturesService, languageModelsService: ILanguageModelsService, languageModelToolsService: ILanguageModelToolsService);
|
|
24
|
+
/**
|
|
25
|
+
* The main function of this provider that calculates
|
|
26
|
+
* completion items based on the provided arguments.
|
|
27
|
+
*/
|
|
18
28
|
provideCompletionItems(model: ITextModel, position: Position, context: CompletionContext, token: CancellationToken): Promise<CompletionList | undefined>;
|
|
19
29
|
private providePropertyCompletions;
|
|
20
30
|
private provideValueCompletions;
|
|
@@ -11,17 +11,31 @@ import { ILanguageModelChatMetadata } from "@codingame/monaco-vscode-api/vscode/
|
|
|
11
11
|
import { ILanguageModelsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels.service";
|
|
12
12
|
import { ILanguageModelToolsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModelToolsService.service";
|
|
13
13
|
import { ChatModeKind } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants";
|
|
14
|
+
/**
|
|
15
|
+
* Prompt header diagnostics provider for an individual text model
|
|
16
|
+
* of a prompt file.
|
|
17
|
+
*/
|
|
14
18
|
declare class PromptHeaderDiagnosticsProvider extends ProviderInstanceBase {
|
|
15
19
|
private readonly markerService;
|
|
16
20
|
private readonly languageModelsService;
|
|
17
21
|
private readonly languageModelToolsService;
|
|
18
22
|
constructor(model: ITextModel, promptsService: IPromptsService, markerService: IMarkerService, languageModelsService: ILanguageModelsService, languageModelToolsService: ILanguageModelToolsService);
|
|
23
|
+
/**
|
|
24
|
+
* Update diagnostic markers for the current editor.
|
|
25
|
+
*/
|
|
19
26
|
protected onPromptSettled(_error: Error | undefined, token: CancellationToken): Promise<void>;
|
|
20
27
|
validateModel(modelNode: PromptModelMetadata | undefined, modeKind: ChatModeKind | undefined, markers: IMarkerData[]): void;
|
|
21
28
|
findModelByName(languageModes: string[], modelName: string): ILanguageModelChatMetadata | undefined;
|
|
22
29
|
validateTools(tools: PromptToolsMetadata | undefined, modeKind: ChatModeKind | undefined, markers: IMarkerData[]): void;
|
|
30
|
+
/**
|
|
31
|
+
* Returns a string representation of this object.
|
|
32
|
+
*/
|
|
23
33
|
toString(): string;
|
|
24
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* The class that manages creation and disposal of {@link PromptHeaderDiagnosticsProvider}
|
|
37
|
+
* classes for each specific editor text model.
|
|
38
|
+
*/
|
|
25
39
|
export declare class PromptHeaderDiagnosticsInstanceManager extends ProviderInstanceManagerBase<PromptHeaderDiagnosticsProvider> {
|
|
26
40
|
protected get InstanceClass(): TProviderClass<PromptHeaderDiagnosticsProvider>;
|
|
27
41
|
}
|
|
@@ -12,6 +12,9 @@ export declare class PromptHeaderHoverProvider extends Disposable implements Hov
|
|
|
12
12
|
private readonly languageService;
|
|
13
13
|
private readonly languageModelToolsService;
|
|
14
14
|
private readonly languageModelsService;
|
|
15
|
+
/**
|
|
16
|
+
* Debug display name for this provider.
|
|
17
|
+
*/
|
|
15
18
|
readonly _debugDisplayName: string;
|
|
16
19
|
constructor(promptsService: IPromptsService, languageService: ILanguageFeaturesService, languageModelToolsService: ILanguageModelToolsService, languageModelsService: ILanguageModelsService);
|
|
17
20
|
private createHover;
|
|
@@ -4,13 +4,26 @@ import { ITextModel } from "@codingame/monaco-vscode-api/vscode/vs/editor/common
|
|
|
4
4
|
import { ProviderInstanceManagerBase, TProviderClass } from "./providerInstanceManagerBase.js";
|
|
5
5
|
import { IMarkerService } from "@codingame/monaco-vscode-api/vscode/vs/platform/markers/common/markers.service";
|
|
6
6
|
import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service";
|
|
7
|
+
/**
|
|
8
|
+
* Prompt links diagnostics provider for a single text model.
|
|
9
|
+
*/
|
|
7
10
|
declare class PromptLinkDiagnosticsProvider extends ProviderInstanceBase {
|
|
8
11
|
private readonly markerService;
|
|
9
12
|
private readonly fileService;
|
|
10
13
|
constructor(model: ITextModel, promptsService: IPromptsService, markerService: IMarkerService, fileService: IFileService);
|
|
14
|
+
/**
|
|
15
|
+
* Update diagnostic markers for the current editor.
|
|
16
|
+
*/
|
|
11
17
|
protected onPromptSettled(): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Returns a string representation of this object.
|
|
20
|
+
*/
|
|
12
21
|
toString(): string;
|
|
13
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* The class that manages creation and disposal of {@link PromptLinkDiagnosticsProvider}
|
|
25
|
+
* classes for each specific editor text model.
|
|
26
|
+
*/
|
|
14
27
|
export declare class PromptLinkDiagnosticsInstanceManager extends ProviderInstanceManagerBase<PromptLinkDiagnosticsProvider> {
|
|
15
28
|
protected get InstanceClass(): TProviderClass<PromptLinkDiagnosticsProvider>;
|
|
16
29
|
}
|
|
@@ -2,8 +2,14 @@ import { IPromptsService } from "@codingame/monaco-vscode-api/vscode/vs/workbenc
|
|
|
2
2
|
import { ITextModel } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/model";
|
|
3
3
|
import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
|
|
4
4
|
import { ILinksList, LinkProvider } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/languages";
|
|
5
|
+
/**
|
|
6
|
+
* Provides link references for prompt files.
|
|
7
|
+
*/
|
|
5
8
|
export declare class PromptLinkProvider implements LinkProvider {
|
|
6
9
|
private readonly promptsService;
|
|
7
10
|
constructor(promptsService: IPromptsService);
|
|
11
|
+
/**
|
|
12
|
+
* Provide list of links for the provided text model.
|
|
13
|
+
*/
|
|
8
14
|
provideLinks(model: ITextModel, token: CancellationToken): Promise<ILinksList | undefined>;
|
|
9
15
|
}
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notes on what to implement next:
|
|
3
|
+
* - re-trigger suggestions dialog on `folder` selection because the `#file:` references take
|
|
4
|
+
* `file` paths, therefore a "folder" completion is never final
|
|
5
|
+
* - provide the same suggestions that the `#file:` variables in the chat input have, e.g.,
|
|
6
|
+
* recently used files, related files, etc.
|
|
7
|
+
* - support markdown links; markdown extension does sometimes provide the paths completions, but
|
|
8
|
+
* the prompt completions give more options (e.g., recently used files, related files, etc.)
|
|
9
|
+
* - add `Windows` support
|
|
10
|
+
*/
|
|
1
11
|
import { IPromptsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.service";
|
|
2
12
|
import { ITextModel } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/model";
|
|
3
13
|
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
@@ -6,17 +16,52 @@ import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/fi
|
|
|
6
16
|
import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
|
|
7
17
|
import { ILanguageFeaturesService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/languageFeatures.service";
|
|
8
18
|
import { CompletionContext, CompletionItemProvider, CompletionList } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/languages";
|
|
19
|
+
/**
|
|
20
|
+
* Type for trigger characters handled by this autocompletion provider.
|
|
21
|
+
*/
|
|
9
22
|
type TTriggerCharacter = ":" | "." | "/";
|
|
23
|
+
/**
|
|
24
|
+
* Provides reference paths autocompletion for the `#file:` variables inside prompts.
|
|
25
|
+
*/
|
|
10
26
|
export declare class PromptPathAutocompletion extends Disposable implements CompletionItemProvider {
|
|
11
27
|
private readonly fileService;
|
|
12
28
|
private readonly promptsService;
|
|
13
29
|
private readonly languageService;
|
|
30
|
+
/**
|
|
31
|
+
* Debug display name for this provider.
|
|
32
|
+
*/
|
|
14
33
|
readonly _debugDisplayName: string;
|
|
34
|
+
/**
|
|
35
|
+
* List of trigger characters handled by this provider.
|
|
36
|
+
*/
|
|
15
37
|
readonly triggerCharacters: TTriggerCharacter[];
|
|
16
38
|
constructor(fileService: IFileService, promptsService: IPromptsService, languageService: ILanguageFeaturesService);
|
|
39
|
+
/**
|
|
40
|
+
* The main function of this provider that calculates
|
|
41
|
+
* completion items based on the provided arguments.
|
|
42
|
+
*/
|
|
17
43
|
provideCompletionItems(model: ITextModel, position: Position, context: CompletionContext, token: CancellationToken): Promise<CompletionList | undefined>;
|
|
44
|
+
/**
|
|
45
|
+
* Gets "raw" folder suggestions. Unlike the full completion items,
|
|
46
|
+
* these ones do not have `insertText` and `range` properties which
|
|
47
|
+
* are meant to be added by the caller later on.
|
|
48
|
+
*/
|
|
18
49
|
private getFolderSuggestions;
|
|
50
|
+
/**
|
|
51
|
+
* Gets suggestions for a first folder/file name in the path. E.g., the one
|
|
52
|
+
* that follows immediately after the `:` character of the `#file:` variable.
|
|
53
|
+
*
|
|
54
|
+
* The main difference between this and "subsequent" folder cases is that in
|
|
55
|
+
* the beginning of the path the suggestions also contain the `..` item and
|
|
56
|
+
* the `./` normalization prefix for relative paths.
|
|
57
|
+
*
|
|
58
|
+
* See also {@link getNonFirstFolderSuggestions}.
|
|
59
|
+
*/
|
|
19
60
|
private getFirstFolderSuggestions;
|
|
61
|
+
/**
|
|
62
|
+
* Gets suggestions for a folder/file name that follows after the first one.
|
|
63
|
+
* See also {@link getFirstFolderSuggestions}.
|
|
64
|
+
*/
|
|
20
65
|
private getNonFirstFolderSuggestions;
|
|
21
66
|
}
|
|
22
67
|
export {};
|
|
@@ -3,10 +3,22 @@ import { IPromptsService } from "@codingame/monaco-vscode-api/vscode/vs/workbenc
|
|
|
3
3
|
import { ITextModel } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/model";
|
|
4
4
|
import { ObservableDisposable } from "../utils/observableDisposable.js";
|
|
5
5
|
import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
|
|
6
|
+
/**
|
|
7
|
+
* Abstract base class for all reusable prompt file providers.
|
|
8
|
+
*/
|
|
6
9
|
export declare abstract class ProviderInstanceBase extends ObservableDisposable {
|
|
7
10
|
protected readonly model: ITextModel;
|
|
11
|
+
/**
|
|
12
|
+
* Function that is called when the prompt parser is settled.
|
|
13
|
+
*/
|
|
8
14
|
protected abstract onPromptSettled(error: Error | undefined, token: CancellationToken): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Returns a string representation of this object.
|
|
17
|
+
*/
|
|
9
18
|
abstract toString(): string;
|
|
19
|
+
/**
|
|
20
|
+
* The prompt parser instance.
|
|
21
|
+
*/
|
|
10
22
|
protected readonly parser: TSharedPrompt;
|
|
11
23
|
constructor(model: ITextModel, promptsService: IPromptsService);
|
|
12
24
|
}
|
|
@@ -6,13 +6,32 @@ import { IEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench
|
|
|
6
6
|
import { IEditor } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/editorCommon";
|
|
7
7
|
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
8
8
|
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
9
|
+
/**
|
|
10
|
+
* Type for a text editor that is used for reusable prompt files.
|
|
11
|
+
*/
|
|
9
12
|
export interface IPromptFileEditor extends IEditor {
|
|
10
13
|
readonly getModel: () => ITextModel;
|
|
11
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Type for a class that can create a new provider instance.
|
|
17
|
+
*/
|
|
12
18
|
export type TProviderClass<TInstance extends ProviderInstanceBase> = new (editor: ITextModel, ...args: any[]) => TInstance;
|
|
19
|
+
/**
|
|
20
|
+
* A generic base class that manages creation and disposal of {@link TInstance}
|
|
21
|
+
* objects for each specific editor object that is used for reusable prompt files.
|
|
22
|
+
*/
|
|
13
23
|
export declare abstract class ProviderInstanceManagerBase<TInstance extends ProviderInstanceBase> extends Disposable {
|
|
24
|
+
/**
|
|
25
|
+
* Currently available {@link TInstance} instances.
|
|
26
|
+
*/
|
|
14
27
|
private readonly instances;
|
|
28
|
+
/**
|
|
29
|
+
* Class object of the managed {@link TInstance}.
|
|
30
|
+
*/
|
|
15
31
|
protected abstract get InstanceClass(): TProviderClass<TInstance>;
|
|
16
32
|
constructor(modelService: IModelService, editorService: IEditorService, instantiationService: IInstantiationService, configService: IConfigurationService);
|
|
33
|
+
/**
|
|
34
|
+
* Initialize a new {@link TInstance} for the given editor.
|
|
35
|
+
*/
|
|
17
36
|
private handleNewEditor;
|
|
18
37
|
}
|
package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/basePromptParser.d.ts
CHANGED
|
@@ -17,56 +17,200 @@ import { OpenFailed, NotPromptFile, RecursiveReference, FolderReference, Resolve
|
|
|
17
17
|
import { type IPromptContentsProviderOptions } from "../contentProviders/promptContentsProviderBase.js";
|
|
18
18
|
import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
|
|
19
19
|
import { IWorkbenchEnvironmentService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/environmentService.service";
|
|
20
|
+
/**
|
|
21
|
+
* Options of the {@link BasePromptParser} class.
|
|
22
|
+
*/
|
|
20
23
|
export interface IBasePromptParserOptions {
|
|
21
24
|
}
|
|
22
25
|
export type IPromptParserOptions = IBasePromptParserOptions & IPromptContentsProviderOptions;
|
|
26
|
+
/**
|
|
27
|
+
* Error conditions that may happen during the file reference resolution.
|
|
28
|
+
*/
|
|
23
29
|
export type TErrorCondition = OpenFailed | RecursiveReference | FolderReference | NotPromptFile;
|
|
30
|
+
/**
|
|
31
|
+
* Base prompt parser class that provides a common interface for all
|
|
32
|
+
* prompt parsers that are responsible for parsing chat prompt syntax.
|
|
33
|
+
*/
|
|
24
34
|
export declare class BasePromptParser<TContentsProvider extends IPromptContentsProvider> extends ObservableDisposable {
|
|
25
35
|
private readonly promptContentsProvider;
|
|
26
36
|
protected readonly instantiationService: IInstantiationService;
|
|
27
37
|
private readonly envService;
|
|
28
38
|
protected readonly logService: ILogService;
|
|
39
|
+
/**
|
|
40
|
+
* Options passed to the constructor.
|
|
41
|
+
*/
|
|
29
42
|
protected readonly options: IBasePromptParserOptions;
|
|
43
|
+
/**
|
|
44
|
+
* List of all tokens that were parsed from the prompt contents so far.
|
|
45
|
+
*/
|
|
30
46
|
get tokens(): readonly BaseToken[];
|
|
47
|
+
/**
|
|
48
|
+
* Private field behind the readonly {@link tokens} property.
|
|
49
|
+
*/
|
|
31
50
|
private receivedTokens;
|
|
51
|
+
/**
|
|
52
|
+
* List of file references in the current branch of the file reference tree.
|
|
53
|
+
*/
|
|
32
54
|
private readonly _references;
|
|
55
|
+
/**
|
|
56
|
+
* Reference to the prompt header object that holds metadata associated
|
|
57
|
+
* with the prompt.
|
|
58
|
+
*/
|
|
33
59
|
private promptHeader?;
|
|
60
|
+
/**
|
|
61
|
+
* Reference to the prompt header object that holds metadata associated
|
|
62
|
+
* with the prompt.
|
|
63
|
+
*/
|
|
34
64
|
get header(): PromptHeader | InstructionsHeader | ModeHeader | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Get contents of the prompt body.
|
|
67
|
+
*/
|
|
35
68
|
getBody(): Promise<string>;
|
|
69
|
+
/**
|
|
70
|
+
* The event is fired when lines or their content change.
|
|
71
|
+
*/
|
|
36
72
|
private readonly _onUpdate;
|
|
73
|
+
/**
|
|
74
|
+
* Subscribe to the event that is fired the parser state or contents
|
|
75
|
+
* changes, including changes in the possible prompt child references.
|
|
76
|
+
*/
|
|
37
77
|
readonly onUpdate: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<void>;
|
|
78
|
+
/**
|
|
79
|
+
* Event that is fired when the current prompt parser is settled.
|
|
80
|
+
*/
|
|
38
81
|
private readonly _onSettled;
|
|
82
|
+
/**
|
|
83
|
+
* Event that is fired when the current prompt parser is settled.
|
|
84
|
+
*/
|
|
39
85
|
onSettled(callback: (error?: Error) => void): IDisposable;
|
|
86
|
+
/**
|
|
87
|
+
* If failed to parse prompt contents, this property has
|
|
88
|
+
* an error object that describes the failure reason.
|
|
89
|
+
*/
|
|
40
90
|
private _errorCondition?;
|
|
91
|
+
/**
|
|
92
|
+
* If file reference resolution fails, this attribute will be set
|
|
93
|
+
* to an error instance that describes the error condition.
|
|
94
|
+
*/
|
|
41
95
|
get errorCondition(): ResolveError | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Whether file references resolution failed.
|
|
98
|
+
* Set to `undefined` if the `resolve` method hasn't been ever called yet.
|
|
99
|
+
*/
|
|
42
100
|
get resolveFailed(): boolean | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* The promise is resolved when at least one parse result (a stream or
|
|
103
|
+
* an error) has been received from the prompt contents provider.
|
|
104
|
+
*/
|
|
43
105
|
private readonly firstParseResult;
|
|
106
|
+
/**
|
|
107
|
+
* Returned promise is resolved when the parser process is settled.
|
|
108
|
+
* The settled state means that the prompt parser stream exists and
|
|
109
|
+
* has ended, or an error condition has been set in case of failure.
|
|
110
|
+
*
|
|
111
|
+
* Furthermore, this function can be called multiple times and will
|
|
112
|
+
* block until the latest prompt contents parsing logic is settled
|
|
113
|
+
* (e.g., for every `onContentChanged` event of the prompt source).
|
|
114
|
+
*/
|
|
44
115
|
settled(): Promise<boolean>;
|
|
45
116
|
constructor(promptContentsProvider: TContentsProvider, options: IBasePromptParserOptions, instantiationService: IInstantiationService, envService: IWorkbenchEnvironmentService, logService: ILogService);
|
|
117
|
+
/**
|
|
118
|
+
* The latest received stream of prompt tokens, if any.
|
|
119
|
+
*/
|
|
46
120
|
private stream;
|
|
121
|
+
/**
|
|
122
|
+
* Handler the event event that is triggered when prompt contents change.
|
|
123
|
+
*
|
|
124
|
+
* @param streamOrError Either a binary stream of file contents, or an error object
|
|
125
|
+
* that was generated during the reference resolve attempt.
|
|
126
|
+
* @param seenReferences List of parent references that we've have already seen
|
|
127
|
+
* during the process of traversing the references tree. It's
|
|
128
|
+
* used to prevent the tree navigation to fall into an infinite
|
|
129
|
+
* references recursion.
|
|
130
|
+
*/
|
|
47
131
|
private onContentsChanged;
|
|
132
|
+
/**
|
|
133
|
+
* Create header object base on the target prompt file language ID.
|
|
134
|
+
* The language ID is important here, because it defines what type
|
|
135
|
+
* of metadata is valid for a prompt file and what type of related
|
|
136
|
+
* diagnostics we would show to the user.
|
|
137
|
+
*/
|
|
48
138
|
private createHeader;
|
|
139
|
+
/**
|
|
140
|
+
* Handle a new reference token inside prompt contents.
|
|
141
|
+
*/
|
|
49
142
|
private handleLinkToken;
|
|
143
|
+
/**
|
|
144
|
+
* Handle the `stream` end event.
|
|
145
|
+
*
|
|
146
|
+
* @param stream The stream that has ended.
|
|
147
|
+
* @param error Optional error object if stream ended with an error.
|
|
148
|
+
*/
|
|
50
149
|
private onStreamEnd;
|
|
51
150
|
private disposeReferences;
|
|
151
|
+
/**
|
|
152
|
+
* Private attribute to track if the {@link start}
|
|
153
|
+
* method has been already called at least once.
|
|
154
|
+
*/
|
|
52
155
|
private started;
|
|
156
|
+
/**
|
|
157
|
+
* Start the prompt parser.
|
|
158
|
+
*/
|
|
53
159
|
start(token?: CancellationToken): this;
|
|
160
|
+
/**
|
|
161
|
+
* Associated URI of the prompt.
|
|
162
|
+
*/
|
|
54
163
|
get uri(): URI;
|
|
164
|
+
/**
|
|
165
|
+
* Get a list of immediate child references of the prompt.
|
|
166
|
+
*/
|
|
55
167
|
get references(): readonly TPromptReference[];
|
|
168
|
+
/**
|
|
169
|
+
* Valid metadata records defined in the prompt header.
|
|
170
|
+
*/
|
|
56
171
|
get metadata(): TMetadata | null;
|
|
172
|
+
/**
|
|
173
|
+
* The top most error of the current reference or any of its
|
|
174
|
+
* possible child reference errors.
|
|
175
|
+
*/
|
|
57
176
|
get topError(): ITopError | undefined;
|
|
177
|
+
/**
|
|
178
|
+
* Returns a string representation of this object.
|
|
179
|
+
*/
|
|
58
180
|
toString(): string;
|
|
181
|
+
/**
|
|
182
|
+
* @inheritdoc
|
|
183
|
+
*/
|
|
59
184
|
dispose(): void;
|
|
60
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* Prompt reference object represents any reference inside prompt text
|
|
188
|
+
* contents. For instance the file variable(`#file:/path/to/file.md`) or
|
|
189
|
+
* a markdown link(`[#file:file.md](/path/to/file.md)`).
|
|
190
|
+
*/
|
|
61
191
|
export declare class PromptReference implements TPromptReference {
|
|
62
192
|
readonly uri: URI;
|
|
63
193
|
readonly token: FileReference | MarkdownLink;
|
|
64
194
|
constructor(uri: URI, token: FileReference | MarkdownLink);
|
|
195
|
+
/**
|
|
196
|
+
* Get the range of the `link` part of the reference.
|
|
197
|
+
*/
|
|
65
198
|
get linkRange(): IRange | undefined;
|
|
199
|
+
/**
|
|
200
|
+
* Type of the reference, - either a prompt `#file` variable,
|
|
201
|
+
* or a `markdown link` reference (`[caption](/path/to/file.md)`).
|
|
202
|
+
*/
|
|
66
203
|
get type(): "file";
|
|
204
|
+
/**
|
|
205
|
+
* Subtype of the reference, - either a prompt `#file` variable,
|
|
206
|
+
* or a `markdown link` reference (`[caption](/path/to/file.md)`).
|
|
207
|
+
*/
|
|
67
208
|
get subtype(): "prompt" | "markdown";
|
|
68
209
|
get range(): Range;
|
|
69
210
|
get path(): string;
|
|
70
211
|
get text(): string;
|
|
212
|
+
/**
|
|
213
|
+
* Returns a string representation of this object.
|
|
214
|
+
*/
|
|
71
215
|
toString(): string;
|
|
72
216
|
}
|
|
@@ -1,14 +1,32 @@
|
|
|
1
1
|
import { Range } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/core/range";
|
|
2
|
+
/**
|
|
3
|
+
* List of all currently supported diagnostic types.
|
|
4
|
+
*/
|
|
2
5
|
export type TDiagnostic = PromptMetadataWarning | PromptMetadataError;
|
|
6
|
+
/**
|
|
7
|
+
* Diagnostics object that hold information about some issue
|
|
8
|
+
* related to the prompt header metadata.
|
|
9
|
+
*/
|
|
3
10
|
export declare abstract class PromptMetadataDiagnostic {
|
|
4
11
|
readonly range: Range;
|
|
5
12
|
readonly message: string;
|
|
6
13
|
constructor(range: Range, message: string);
|
|
14
|
+
/**
|
|
15
|
+
* String representation of the diagnostic object.
|
|
16
|
+
*/
|
|
7
17
|
abstract toString(): string;
|
|
8
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Diagnostics object that hold information about some
|
|
21
|
+
* non-fatal issue related to the prompt header metadata.
|
|
22
|
+
*/
|
|
9
23
|
export declare class PromptMetadataWarning extends PromptMetadataDiagnostic {
|
|
10
24
|
toString(): string;
|
|
11
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Diagnostics object that hold information about some
|
|
28
|
+
* fatal issue related to the prompt header metadata.
|
|
29
|
+
*/
|
|
12
30
|
export declare class PromptMetadataError extends PromptMetadataDiagnostic {
|
|
13
31
|
toString(): string;
|
|
14
32
|
}
|