@codingame/monaco-vscode-chat-service-override 14.0.6 → 15.0.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.
Files changed (110) hide show
  1. package/index.js +14 -8
  2. package/package.json +20 -20
  3. package/vscode/src/vs/base/common/objectCache.d.ts +1 -1
  4. package/vscode/src/vs/base/common/objectCache.js +1 -1
  5. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +43 -42
  6. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/chatAttachPromptAction.d.ts +10 -0
  7. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/chatAttachPromptAction.js +40 -0
  8. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt.d.ts +17 -0
  9. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt.js +142 -0
  10. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.d.ts +2 -2
  11. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +25 -25
  12. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.d.ts +2 -0
  13. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +252 -260
  14. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +4 -4
  15. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +1 -1
  16. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +4 -4
  17. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.d.ts +3 -1
  18. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.js +8 -4
  19. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +6 -6
  20. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +6 -6
  21. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +12 -41
  22. package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.d.ts +7 -5
  23. package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +31 -29
  24. package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +151 -69
  25. package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.d.ts +1 -1
  26. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMarkdownAnchorService.d.ts +1 -1
  27. package/vscode/src/vs/workbench/contrib/chat/browser/chatEdinputInputContentProvider.d.ts +4 -3
  28. package/vscode/src/vs/workbench/contrib/chat/browser/chatEdinputInputContentProvider.js +4 -4
  29. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorAccessibility.d.ts +10 -0
  30. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorAccessibility.js +38 -0
  31. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.d.ts +9 -0
  32. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +379 -0
  33. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/{chatEditingService.d.ts → chatEditingServiceImpl.d.ts} +12 -28
  34. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.js +423 -0
  35. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.d.ts +3 -3
  36. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +6 -7
  37. package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +38 -38
  38. package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.d.ts +16 -6
  39. package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.js +93 -24
  40. package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.d.ts +1 -1
  41. package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +21 -2
  42. package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.d.ts +1 -1
  43. package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.js +1 -1
  44. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.d.ts +101 -2
  45. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.js +146 -126
  46. package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus.d.ts +39 -0
  47. package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus.js +386 -0
  48. package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.d.ts +4 -12
  49. package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +8 -91
  50. package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockContextProviderService.d.ts +1 -1
  51. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +7 -11
  52. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.js +3 -3
  53. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputRelatedFilesContrib.js +45 -45
  54. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/editorHoverWrapper.d.ts +1 -1
  55. package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.js +11 -19
  56. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatEditingEditorOverlay.css.js +6 -0
  57. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatStatus.css.js +6 -0
  58. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/createPromptCommand.d.ts +1 -0
  59. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/createPromptCommand.js +82 -0
  60. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptName.d.ts +2 -0
  61. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptName.js +22 -0
  62. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptSourceFolder.d.ts +16 -0
  63. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptSourceFolder.js +67 -0
  64. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/errors.d.ts +9 -0
  65. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/errors.js +17 -0
  66. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/utils/createPromptFile.d.ts +12 -0
  67. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/utils/createPromptFile.js +24 -0
  68. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/usePromptCommand.d.ts +6 -0
  69. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/usePromptCommand.js +78 -0
  70. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.js +6 -6
  71. package/vscode/src/vs/workbench/contrib/chat/common/chatCodeMapperService.d.ts +2 -0
  72. package/vscode/src/vs/workbench/contrib/chat/common/chatEntitlementsService.d.ts +19 -0
  73. package/vscode/src/vs/workbench/contrib/chat/common/chatEntitlementsService.js +13 -0
  74. package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.d.ts +12 -10
  75. package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.js +26 -13
  76. package/vscode/src/vs/workbench/contrib/chat/common/chatQuotasService.d.ts +31 -0
  77. package/vscode/src/vs/workbench/contrib/chat/common/chatQuotasService.js +85 -0
  78. package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.d.ts +6 -2
  79. package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +33 -27
  80. package/vscode/src/vs/workbench/contrib/chat/common/chatServiceTelemetry.js +0 -10
  81. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/constants.d.ts +4 -0
  82. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/constants.js +9 -0
  83. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/textModelContentsProvider.d.ts +1 -1
  84. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/textModelContentsProvider.js +1 -1
  85. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptLinkProvider.d.ts +4 -6
  86. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptLinkProvider.js +15 -23
  87. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptPathAutocompletion.d.ts +22 -0
  88. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptPathAutocompletion.js +175 -0
  89. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/textModelPromptParser.d.ts +2 -3
  90. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/textModelPromptParser.js +6 -7
  91. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.d.ts +20 -0
  92. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.js +62 -0
  93. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +14 -0
  94. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +101 -0
  95. package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +17 -17
  96. package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.d.ts +1 -1
  97. package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +2 -2
  98. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +12 -12
  99. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibilityHelp.js +2 -2
  100. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.js +4 -4
  101. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.d.ts +1 -1
  102. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.js +31 -36
  103. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +3 -3
  104. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingService.js +0 -505
  105. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.d.ts +0 -104
  106. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +0 -871
  107. package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.d.ts +0 -54
  108. package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +0 -245
  109. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController2.d.ts +0 -39
  110. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController2.js +0 -314
@@ -2,7 +2,7 @@
2
2
  import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
3
  import { MarkdownString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
4
4
  import { Disposable, MutableDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
5
- import { ICodeEditorService } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/codeEditorService';
5
+ import { ICodeEditorService } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/codeEditorService.service';
6
6
  import { Range } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/core/range';
7
7
  import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
8
8
  import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colorUtils';
@@ -17,12 +17,12 @@ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/misc
17
17
  import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/quickpickColors';
18
18
  import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/searchColors';
19
19
  import { IThemeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service';
20
- import { ChatWidget } from '@codingame/monaco-vscode-c465110a-57c0-59d7-a6b2-be0a4db7e517-common/vscode/vs/workbench/contrib/chat/browser/chatWidget';
21
- import { dynamicVariableDecorationType } from '@codingame/monaco-vscode-e4d0fd26-1b26-5583-b3f7-582e08d7b389-common/vscode/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables';
22
20
  import { IChatAgentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents.service';
23
- import { chatSlashCommandBackground, chatSlashCommandForeground } from '@codingame/monaco-vscode-c465110a-57c0-59d7-a6b2-be0a4db7e517-common/vscode/vs/workbench/contrib/chat/common/chatColors';
24
- import { ChatRequestAgentPart, ChatRequestAgentSubcommandPart, ChatRequestSlashCommandPart, ChatRequestTextPart, ChatRequestVariablePart, ChatRequestToolPart, chatAgentLeader, chatSubcommandLeader } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatParserTypes';
25
- import { ChatRequestParser } from '@codingame/monaco-vscode-fab30422-b487-5f4e-8d30-8b4d266e3fcd-common/vscode/vs/workbench/contrib/chat/common/chatRequestParser';
21
+ import { chatSlashCommandBackground, chatSlashCommandForeground } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/common/chatColors';
22
+ import { ChatRequestAgentPart, ChatRequestAgentSubcommandPart, ChatRequestSlashCommandPart, ChatRequestTextPart, ChatRequestToolPart, chatAgentLeader, chatSubcommandLeader } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/common/chatParserTypes';
23
+ import { ChatRequestParser } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/common/chatRequestParser';
24
+ import { ChatWidget } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/browser/chatWidget';
25
+ import { dynamicVariableDecorationType } from '@codingame/monaco-vscode-e4d0fd26-1b26-5583-b3f7-582e08d7b389-common/vscode/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables';
26
26
 
27
27
  const decorationDescription = 'chat';
28
28
  const placeholderDecorationType = 'chat-session-detail';
@@ -197,10 +197,6 @@ let InputEditorDecorations = class InputEditorDecorations extends Disposable {
197
197
  }
198
198
  this.widget.inputEditor.setDecorationsByType(decorationDescription, slashCommandTextDecorationType, textDecorations);
199
199
  const varDecorations = [];
200
- const variableParts = parsedRequest.filter((p) => p instanceof ChatRequestVariablePart);
201
- for (const variable of variableParts) {
202
- varDecorations.push({ range: variable.editorRange });
203
- }
204
200
  const toolParts = parsedRequest.filter((p) => p instanceof ChatRequestToolPart);
205
201
  for (const tool of toolParts) {
206
202
  varDecorations.push({ range: tool.editorRange });
@@ -263,7 +259,7 @@ let ChatTokenDeleter = class ChatTokenDeleter extends Disposable {
263
259
  const change = e.changes[0];
264
260
  if (!change.text && this.widget.viewModel) {
265
261
  const previousParsedValue = parser.parseChatRequest(this.widget.viewModel.sessionId, previousInputValue, widget.location, { selectedAgent: previousSelectedAgent });
266
- const deletableTokens = previousParsedValue.parts.filter(p => p instanceof ChatRequestAgentPart || p instanceof ChatRequestAgentSubcommandPart || p instanceof ChatRequestSlashCommandPart || p instanceof ChatRequestVariablePart || p instanceof ChatRequestToolPart);
262
+ const deletableTokens = previousParsedValue.parts.filter(p => p instanceof ChatRequestAgentPart || p instanceof ChatRequestAgentSubcommandPart || p instanceof ChatRequestSlashCommandPart || p instanceof ChatRequestToolPart);
267
263
  deletableTokens.forEach(token => {
268
264
  const deletedRangeOfToken = Range.intersectRanges(token.editorRange, change.range);
269
265
  if (deletedRangeOfToken && Range.compareRangesUsingStarts(token.editorRange, change.range) < 0) {
@@ -6,9 +6,9 @@ import { RenderedHoverParts, HoverAnchorType, HoverParticipantRegistry } from '@
6
6
  import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
7
7
  import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
8
8
  import { IChatWidgetService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service';
9
- import { ChatAgentHover, getChatAgentHoverOptions } from '@codingame/monaco-vscode-c465110a-57c0-59d7-a6b2-be0a4db7e517-common/vscode/vs/workbench/contrib/chat/browser/chatAgentHover';
9
+ import { ChatAgentHover, getChatAgentHoverOptions } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/browser/chatAgentHover';
10
10
  import { ChatEditorHoverWrapper } from './editorHoverWrapper.js';
11
- import { extractAgentAndCommand } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatParserTypes';
11
+ import { extractAgentAndCommand } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/common/chatParserTypes';
12
12
  import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
13
13
 
14
14
  let ChatAgentHoverParticipant = class ChatAgentHoverParticipant {
@@ -58,7 +58,7 @@ let ChatAgentHoverParticipant = class ChatAgentHoverParticipant {
58
58
  return ( new RenderedHoverParts([renderedHoverPart]));
59
59
  }
60
60
  getAccessibleContent(hoverPart) {
61
- return localize(4703, 'There is a chat agent hover part here.');
61
+ return localize(4774, 'There is a chat agent hover part here.');
62
62
  }
63
63
  };
64
64
  ChatAgentHoverParticipant = ( __decorate([
@@ -3,15 +3,13 @@ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib
3
3
  import { CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
4
4
  import { Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
5
5
  import { Disposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
6
- import { ResourceMap } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
7
- import '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
8
- import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/autorun';
9
- import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/derived';
10
- import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/utils';
6
+ import { ResourceSet, ResourceMap } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
7
+ import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
11
8
  import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
12
- import { WorkingSetEntryState, WorkingSetEntryRemovalReason, ChatEditingSessionChangeType } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService';
9
+ import { WorkingSetEntryState, WorkingSetEntryRemovalReason } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService';
13
10
  import { IChatEditingService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService.service';
14
11
  import { IChatWidgetService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service';
12
+ import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/autorun';
15
13
 
16
14
  let ChatRelatedFilesContribution = class ChatRelatedFilesContribution extends Disposable {
17
15
  static { this.ID = 'chat.relatedFilesWorkingSet'; }
@@ -19,48 +17,49 @@ let ChatRelatedFilesContribution = class ChatRelatedFilesContribution extends Di
19
17
  super();
20
18
  this.chatEditingService = chatEditingService;
21
19
  this.chatWidgetService = chatWidgetService;
22
- this.chatEditingSessionDisposables = ( new DisposableStore());
23
- this._register(autorun(r => {
24
- this.chatEditingSessionDisposables.clear();
25
- const session = this.chatEditingService.currentEditingSessionObs.read(r);
26
- if (session) {
27
- this._handleNewEditingSession(session);
28
- }
20
+ this.chatEditingSessionDisposables = ( new Map());
21
+ this._register(autorun((reader) => {
22
+ const sessions = this.chatEditingService.editingSessionsObs.read(reader);
23
+ sessions.forEach(session => {
24
+ const widget = this.chatWidgetService.getWidgetBySessionId(session.chatSessionId);
25
+ if (widget && !( this.chatEditingSessionDisposables.has(session.chatSessionId))) {
26
+ this._handleNewEditingSession(session, widget);
27
+ }
28
+ });
29
29
  }));
30
30
  }
31
- _updateRelatedFileSuggestions() {
31
+ _updateRelatedFileSuggestions(currentEditingSession, widget) {
32
32
  if (this._currentRelatedFilesRetrievalOperation) {
33
33
  return;
34
34
  }
35
- const currentEditingSession = this.chatEditingService.currentEditingSessionObs.get();
36
- if (!currentEditingSession) {
37
- return;
38
- }
39
35
  const workingSetEntries = currentEditingSession.entries.get();
40
- if (workingSetEntries.length > 0) {
41
- return;
42
- }
43
- const widget = this.chatWidgetService.getWidgetBySessionId(currentEditingSession.chatSessionId);
44
- if (!widget) {
36
+ if (workingSetEntries.length > 0 || widget.attachmentModel.fileAttachments.length === 0) {
45
37
  return;
46
38
  }
47
- this._currentRelatedFilesRetrievalOperation = this.chatEditingService.getRelatedFiles(currentEditingSession.chatSessionId, widget.getInput(), CancellationToken.None)
39
+ this._currentRelatedFilesRetrievalOperation = this.chatEditingService.getRelatedFiles(currentEditingSession.chatSessionId, widget.getInput(), widget.attachmentModel.fileAttachments, CancellationToken.None)
48
40
  .then((files) => {
49
- if (!files?.length) {
41
+ if (!files?.length || !widget.viewModel?.sessionId) {
50
42
  return;
51
43
  }
52
- const currentEditingSession = this.chatEditingService.currentEditingSessionObs.get();
53
- if (!currentEditingSession || currentEditingSession.chatSessionId !== widget.viewModel?.sessionId || currentEditingSession.entries.get().length) {
44
+ const currentEditingSession = this.chatEditingService.getEditingSession(widget.viewModel.sessionId);
45
+ if (!currentEditingSession || currentEditingSession.entries.get().length) {
46
+ return;
47
+ }
48
+ const existingFiles = ( new ResourceSet(widget.attachmentModel.fileAttachments));
49
+ if (!existingFiles.size) {
54
50
  return;
55
51
  }
56
- const maximumRelatedFiles = Math.min(2, this.chatEditingService.editingSessionFileLimit - widget.input.chatEditWorkingSetFiles.length);
57
52
  const newSuggestions = ( new ResourceMap());
58
53
  for (const group of files) {
59
54
  for (const file of group.files) {
60
- if (newSuggestions.size >= maximumRelatedFiles) {
55
+ if (newSuggestions.size >= 2) {
61
56
  break;
62
57
  }
58
+ if (( existingFiles.has(file.uri))) {
59
+ continue;
60
+ }
63
61
  newSuggestions.set(file.uri, { group: group.group, description: file.description });
62
+ existingFiles.add(file.uri);
64
63
  }
65
64
  }
66
65
  const existingSuggestedEntriesToRemove = [];
@@ -71,34 +70,35 @@ let ChatRelatedFilesContribution = class ChatRelatedFilesContribution extends Di
71
70
  }
72
71
  currentEditingSession?.remove(WorkingSetEntryRemovalReason.Programmatic, ...existingSuggestedEntriesToRemove);
73
72
  for (const [uri, data] of newSuggestions) {
74
- currentEditingSession.addFileToWorkingSet(uri, ( localize(4704, "{0} (Suggested)", data.description)), WorkingSetEntryState.Suggested);
73
+ currentEditingSession.addFileToWorkingSet(uri, ( localize(4775, "{0} (Suggested)", data.description)), WorkingSetEntryState.Suggested);
75
74
  }
76
75
  })
77
76
  .finally(() => {
78
77
  this._currentRelatedFilesRetrievalOperation = undefined;
79
78
  });
80
79
  }
81
- _handleNewEditingSession(currentEditingSession) {
82
- const widget = this.chatWidgetService.getWidgetBySessionId(currentEditingSession.chatSessionId);
83
- if (!widget || widget.viewModel?.sessionId !== currentEditingSession.chatSessionId) {
84
- return;
85
- }
86
- this.chatEditingSessionDisposables.add(currentEditingSession.onDidDispose(() => {
87
- this.chatEditingSessionDisposables.clear();
80
+ _handleNewEditingSession(currentEditingSession, widget) {
81
+ const disposableStore = ( new DisposableStore());
82
+ disposableStore.add(currentEditingSession.onDidDispose(() => {
83
+ disposableStore.clear();
88
84
  }));
89
- this._updateRelatedFileSuggestions();
85
+ this._updateRelatedFileSuggestions(currentEditingSession, widget);
90
86
  const onDebouncedType = Event.debounce(widget.inputEditor.onDidChangeModelContent, () => null, 3000);
91
- this.chatEditingSessionDisposables.add(onDebouncedType(() => {
92
- this._updateRelatedFileSuggestions();
87
+ disposableStore.add(onDebouncedType(() => {
88
+ this._updateRelatedFileSuggestions(currentEditingSession, widget);
93
89
  }));
94
- this.chatEditingSessionDisposables.add(currentEditingSession.onDidChange((e) => {
95
- if (e === ChatEditingSessionChangeType.WorkingSet) {
96
- this._updateRelatedFileSuggestions();
97
- }
90
+ disposableStore.add(widget.attachmentModel.onDidChangeContext(() => {
91
+ this._updateRelatedFileSuggestions(currentEditingSession, widget);
98
92
  }));
93
+ disposableStore.add(currentEditingSession.onDidDispose(() => {
94
+ disposableStore.dispose();
95
+ }));
96
+ this.chatEditingSessionDisposables.set(currentEditingSession.chatSessionId, disposableStore);
99
97
  }
100
98
  dispose() {
101
- this.chatEditingSessionDisposables.dispose();
99
+ for (const store of ( this.chatEditingSessionDisposables.values())) {
100
+ store.dispose();
101
+ }
102
102
  super.dispose();
103
103
  }
104
104
  };
@@ -1,4 +1,4 @@
1
- import { IHoverAction } from "@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/hover/hover";
1
+ import { IHoverAction } from "@codingame/monaco-vscode-view-status-bar-service-override/vscode/vs/base/browser/ui/hover/hover";
2
2
  import { IKeybindingService } from "@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service";
3
3
  export declare class ChatEditorHoverWrapper {
4
4
  private readonly keybindingService;
@@ -7,7 +7,6 @@ import { CancellationError, isCancellationError } from '@codingame/monaco-vscode
7
7
  import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
8
8
  import { Iterable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/iterator';
9
9
  import { Disposable, toDisposable, DisposableStore, dispose } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
10
- import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
11
10
  import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
12
11
  import { IDialogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service';
13
12
  import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
@@ -109,6 +108,7 @@ let LanguageModelToolsService = class LanguageModelToolsService extends Disposab
109
108
  let toolInvocation;
110
109
  let requestId;
111
110
  let store;
111
+ let toolResult;
112
112
  try {
113
113
  if (dto.context) {
114
114
  store = ( new DisposableStore());
@@ -137,22 +137,14 @@ let LanguageModelToolsService = class LanguageModelToolsService extends Disposab
137
137
  const prepared = tool.impl.prepareToolInvocation ?
138
138
  await tool.impl.prepareToolInvocation(dto.parameters, token)
139
139
  : undefined;
140
- const defaultMessage = ( localize(4706, "Using {0}", `"${tool.data.displayName}"`));
141
- const invocationMessage = prepared?.invocationMessage ?? defaultMessage;
142
- if (tool.data.id !== 'vscode_editFile') {
143
- toolInvocation = ( new ChatToolInvocation(
144
- invocationMessage,
145
- prepared?.pastTenseMessage,
146
- prepared?.tooltip,
147
- prepared?.confirmationMessages
148
- ));
149
- model.acceptResponseProgress(request, toolInvocation);
150
- if (prepared?.confirmationMessages) {
151
- const userConfirmed = await toolInvocation.confirmed.p;
152
- if (!userConfirmed) {
153
- throw ( new CancellationError());
154
- }
140
+ toolInvocation = ( new ChatToolInvocation(prepared, tool.data));
141
+ model.acceptResponseProgress(request, toolInvocation);
142
+ if (prepared?.confirmationMessages) {
143
+ const userConfirmed = await toolInvocation.confirmed.p;
144
+ if (!userConfirmed) {
145
+ throw ( new CancellationError());
155
146
  }
147
+ dto.toolSpecificData = toolInvocation?.toolSpecificData;
156
148
  }
157
149
  }
158
150
  else {
@@ -169,14 +161,14 @@ let LanguageModelToolsService = class LanguageModelToolsService extends Disposab
169
161
  if (token.isCancellationRequested) {
170
162
  throw ( new CancellationError());
171
163
  }
172
- const result = await tool.impl.invoke(dto, countTokens, token);
164
+ toolResult = await tool.impl.invoke(dto, countTokens, token);
173
165
  this._telemetryService.publicLog2('languageModelToolInvoked', {
174
166
  result: 'success',
175
167
  chatSessionId: dto.context?.sessionId,
176
168
  toolId: tool.data.id,
177
169
  toolExtensionId: tool.data.extensionId?.value,
178
170
  });
179
- return result;
171
+ return toolResult;
180
172
  }
181
173
  catch (err) {
182
174
  const result = isCancellationError(err) ? 'userCancelled' : 'error';
@@ -189,7 +181,7 @@ let LanguageModelToolsService = class LanguageModelToolsService extends Disposab
189
181
  throw err;
190
182
  }
191
183
  finally {
192
- toolInvocation?.isCompleteDeferred.complete();
184
+ toolInvocation?.complete(toolResult);
193
185
  if (requestId && store) {
194
186
  this.cleanupCallDisposables(requestId, store);
195
187
  }
@@ -0,0 +1,6 @@
1
+ import n from '@codingame/monaco-vscode-api/external/rollup-plugin-styles/dist/runtime/inject-css';
2
+
3
+ var css = ".chat-editor-overlay-widget{align-items:center;background-color:var(--vscode-button-background);border:1px solid var(--vscode-contrastBorder);border-radius:5px;box-shadow:0 2px 8px var(--vscode-widget-shadow);color:var(--vscode-button-foreground);display:flex;overflow:hidden;padding:0;z-index:10}@keyframes pulse{0%{box-shadow:0 2px 8px 0 var(--vscode-widget-shadow)}50%{box-shadow:0 2px 8px 4px var(--vscode-widget-shadow)}to{box-shadow:0 2px 8px 0 var(--vscode-widget-shadow)}}.chat-editor-overlay-widget.busy{animation:pulse 2.3s ease-in infinite}.chat-editor-overlay-widget .chat-editor-overlay-progress{align-items:center;display:none;font-size:12px;font-variant-numeric:tabular-nums;overflow:hidden;padding:0 5px;white-space:nowrap}.chat-editor-overlay-widget.busy .chat-editor-overlay-progress{display:inline-flex}@keyframes ellipsis{0%{content:\"\"}25%{content:\".\"}50%{content:\"..\"}75%{content:\"...\"}to{content:\"\"}}.chat-editor-overlay-widget.busy.paused .chat-editor-overlay-progress{.codicon-loading{display:none}}.chat-editor-overlay-widget .action-item>.action-label{font-size:12px;padding:5px}.chat-editor-overlay-widget.busy .action-item>.action-label.busy:after{animation:ellipsis 1s steps(4) infinite;content:\"\";display:inline-flex;overflow:hidden;white-space:nowrap;width:3ch}.chat-editor-overlay-widget .action-item:first-child>.action-label{padding-left:7px}.chat-editor-overlay-widget .action-item:last-child>.action-label{padding-right:7px}.chat-editor-overlay-widget .action-item>.action-label.codicon,.chat-editor-overlay-widget.busy .chat-editor-overlay-progress .codicon{color:var(--vscode-button-foreground)}.chat-diff-change-content-widget .monaco-action-bar .action-item.disabled,.chat-editor-overlay-widget .monaco-action-bar .action-item.disabled{>.action-label,>.action-label.codicon,>.action-label.codicon:before,>.action-label:hover{color:var(--vscode-button-foreground);opacity:.7}}.chat-editor-overlay-widget .action-item.label-item{font-variant-numeric:tabular-nums}.chat-editor-overlay-widget .monaco-action-bar .action-item.label-item>.action-label,.chat-editor-overlay-widget .monaco-action-bar .action-item.label-item>.action-label:hover{color:var(--vscode-button-foreground);opacity:1}.chat-editor-overlay-widget .action-item.auto{overflow:hidden;position:relative}.chat-editor-overlay-widget .action-item.auto:before{background-color:var(--vscode-toolbar-hoverBackground);content:\"\";height:100%;left:var(--vscode-action-item-auto-timeout,-100%);position:absolute;top:0;transition:left .5s linear;width:100%}";
4
+ n(css,{});
5
+
6
+ export { css, css as default };
@@ -0,0 +1,6 @@
1
+ import n from '@codingame/monaco-vscode-api/external/rollup-plugin-styles/dist/runtime/inject-css';
2
+
3
+ var css = ".chat-status-bar-entry-tooltip{margin-bottom:4px;margin-top:4px}.chat-status-bar-entry-tooltip hr{margin-bottom:8px;margin-top:8px}.chat-status-bar-entry-tooltip div.header{color:var(--vscode-descriptionForeground);font-weight:600;margin-bottom:4px}.chat-status-bar-entry-tooltip div.description{color:var(--vscode-descriptionForeground)}.chat-status-bar-entry-tooltip .settings{display:flex;flex-direction:column;gap:5px}.chat-status-bar-entry-tooltip .settings .setting{align-items:center;display:flex}.chat-status-bar-entry-tooltip .settings .setting .monaco-checkbox{height:14px;margin-right:5px;width:14px}.chat-status-bar-entry-tooltip .settings .setting .codicon{font-size:12px}.chat-status-bar-entry-tooltip .settings .setting .setting-label{cursor:pointer}.chat-status-bar-entry-tooltip .shortcuts{display:flex;flex-direction:column;gap:2px}.chat-status-bar-entry-tooltip .shortcuts .shortcut{display:flex;gap:10px;margin:-1px -3px;padding:1px 3px}.chat-status-bar-entry-tooltip .shortcuts .shortcut:hover{background-color:var(--vscode-toolbar-hoverBackground);border-radius:3px;outline:1px dashed var(--vscode-toolbar-hoverOutline);outline-offset:-1px}.chat-status-bar-entry-tooltip .shortcuts .shortcut .shortcut-label{cursor:pointer;flex:1}.chat-status-bar-entry-tooltip .shortcuts .shortcut .monaco-keybinding{cursor:pointer}.chat-status-bar-entry-tooltip .shortcuts .shortcut .monaco-keybinding>.monaco-keybinding-key{font-size:10px;padding:2px 4px}.chat-status-bar-entry-tooltip .quota-indicator{margin-bottom:6px}.chat-status-bar-entry-tooltip .quota-indicator .quota-label{display:flex;justify-content:space-between;margin-bottom:3px}.chat-status-bar-entry-tooltip .quota-indicator .quota-bar{background-color:var(--vscode-gauge-foreground);border:1px solid var(--vscode-gauge-border);border-radius:4px;height:4px;width:100%}.chat-status-bar-entry-tooltip .quota-indicator .quota-bar .quota-bit{background-color:var(--vscode-gauge-background);border-radius:4px;height:100%}.chat-status-bar-entry-tooltip .quota-indicator.warning .quota-bar{background-color:var(--vscode-gauge-warningForeground)}.chat-status-bar-entry-tooltip .quota-indicator.warning .quota-bar .quota-bit{background-color:var(--vscode-gauge-warningBackground)}.chat-status-bar-entry-tooltip .quota-indicator.error .quota-bar{background-color:var(--vscode-gauge-errorForeground)}.chat-status-bar-entry-tooltip .quota-indicator.error .quota-bar .quota-bit{background-color:var(--vscode-gauge-errorBackground)}";
4
+ n(css,{});
5
+
6
+ export { css, css as default };
@@ -0,0 +1,82 @@
1
+
2
+ import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
3
+ import { createPromptFile } from './utils/createPromptFile.js';
4
+ import { CHAT_CATEGORY } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
5
+ import { askForPromptName } from './dialogs/askForPromptName.js';
6
+ import { askForPromptSourceFolder } from './dialogs/askForPromptSourceFolder.js';
7
+ import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
8
+ import { ILabelService } from '@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service';
9
+ import { IOpenerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service';
10
+ import { PromptsConfig } from '@codingame/monaco-vscode-52bb4d5b-ba1a-57fd-9bee-b28824214eac-common/vscode/vs/platform/prompts/common/config';
11
+ import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
12
+ import { IPromptsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/service/types.service';
13
+ import { appendToCommandPalette } from '@codingame/monaco-vscode-9b5a5e82-d649-5455-b4bf-ef90d6afd294-common/vscode/vs/workbench/contrib/files/browser/fileActions.contribution';
14
+ import { IQuickInputService } from '@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput.service';
15
+ import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
16
+ import { KeybindingsRegistry, KeybindingWeight } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybindingsRegistry';
17
+
18
+ const BASE_COMMAND_ID = 'workbench.command.prompts.create';
19
+ const LOCAL_COMMAND_ID = `${BASE_COMMAND_ID}.local`;
20
+ const USER_COMMAND_ID = `${BASE_COMMAND_ID}.user`;
21
+ const LOCAL_COMMAND_TITLE = ( localize(4777, "Create Prompt"));
22
+ const USER_COMMAND_TITLE = ( localize(4778, "Create User Prompt"));
23
+ const command = async (accessor, type) => {
24
+ const fileService = accessor.get(IFileService);
25
+ const labelService = accessor.get(ILabelService);
26
+ const openerService = accessor.get(IOpenerService);
27
+ const commandService = accessor.get(ICommandService);
28
+ const promptsService = accessor.get(IPromptsService);
29
+ const quickInputService = accessor.get(IQuickInputService);
30
+ const workspaceService = accessor.get(IWorkspaceContextService);
31
+ const fileName = await askForPromptName(type, quickInputService);
32
+ if (!fileName) {
33
+ return;
34
+ }
35
+ const selectedFolder = await askForPromptSourceFolder({
36
+ type: type,
37
+ labelService,
38
+ openerService,
39
+ promptsService,
40
+ workspaceService,
41
+ quickInputService,
42
+ });
43
+ if (!selectedFolder) {
44
+ return;
45
+ }
46
+ const content = ( localize(4779, "Add prompt contents.."));
47
+ const promptUri = await createPromptFile({
48
+ fileName,
49
+ folder: selectedFolder,
50
+ content,
51
+ fileService,
52
+ commandService,
53
+ });
54
+ await openerService.open(promptUri);
55
+ };
56
+ const commandFactory = (type) => {
57
+ return async (accessor) => {
58
+ return command(accessor, type);
59
+ };
60
+ };
61
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
62
+ id: LOCAL_COMMAND_ID,
63
+ weight: KeybindingWeight.WorkbenchContrib,
64
+ handler: commandFactory('local'),
65
+ when: PromptsConfig.enabledCtx,
66
+ });
67
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
68
+ id: USER_COMMAND_ID,
69
+ weight: KeybindingWeight.WorkbenchContrib,
70
+ handler: commandFactory('user'),
71
+ when: PromptsConfig.enabledCtx,
72
+ });
73
+ appendToCommandPalette({
74
+ id: LOCAL_COMMAND_ID,
75
+ title: LOCAL_COMMAND_TITLE,
76
+ category: CHAT_CATEGORY,
77
+ }, PromptsConfig.enabledCtx);
78
+ appendToCommandPalette({
79
+ id: USER_COMMAND_ID,
80
+ title: USER_COMMAND_TITLE,
81
+ category: CHAT_CATEGORY,
82
+ }, PromptsConfig.enabledCtx);
@@ -0,0 +1,2 @@
1
+ import { IQuickInputService } from "@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput.service";
2
+ export declare const askForPromptName: (_type: "local" | "user", quickInputService: IQuickInputService) => Promise<string | undefined>;
@@ -0,0 +1,22 @@
1
+
2
+ import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
3
+ import { PROMPT_FILE_EXTENSION } from '@codingame/monaco-vscode-52bb4d5b-ba1a-57fd-9bee-b28824214eac-common/vscode/vs/platform/prompts/common/constants';
4
+
5
+ const askForPromptName = async (_type, quickInputService) => {
6
+ const result = await quickInputService.input({
7
+ placeHolder: ( localize(4780, "Provide a prompt name", PROMPT_FILE_EXTENSION)),
8
+ });
9
+ if (!result) {
10
+ return undefined;
11
+ }
12
+ const trimmedName = result.trim();
13
+ if (!trimmedName) {
14
+ return undefined;
15
+ }
16
+ const cleanName = (trimmedName.endsWith(PROMPT_FILE_EXTENSION))
17
+ ? trimmedName
18
+ : `${trimmedName}${PROMPT_FILE_EXTENSION}`;
19
+ return cleanName;
20
+ };
21
+
22
+ export { askForPromptName };
@@ -0,0 +1,16 @@
1
+ import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
2
+ import { IPromptsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/service/types.service";
3
+ import { ILabelService } from "@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service";
4
+ import { IOpenerService } from "@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service";
5
+ import { IWorkspaceContextService } from "@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service";
6
+ import { IQuickInputService } from "@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput.service";
7
+ interface IAskForFolderOptions {
8
+ readonly type: "local" | "user";
9
+ readonly labelService: ILabelService;
10
+ readonly openerService: IOpenerService;
11
+ readonly promptsService: IPromptsService;
12
+ readonly quickInputService: IQuickInputService;
13
+ readonly workspaceService: IWorkspaceContextService;
14
+ }
15
+ export declare const askForPromptSourceFolder: (options: IAskForFolderOptions) => Promise<URI | undefined>;
16
+ export {};
@@ -0,0 +1,67 @@
1
+
2
+ import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
3
+ import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
4
+ import { DOCUMENTATION_URL } from '../../../../../common/promptSyntax/constants.js';
5
+ import { extUri, basename } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
6
+
7
+ const askForPromptSourceFolder = async (options) => {
8
+ const { type, promptsService, quickInputService, labelService, openerService, workspaceService } = options;
9
+ const folders = promptsService.getSourceFolders(type);
10
+ if (folders.length === 0) {
11
+ return await showNoFoldersDialog(quickInputService, openerService);
12
+ }
13
+ if (folders.length === 1) {
14
+ return folders[0].uri;
15
+ }
16
+ const pickOptions = {
17
+ placeHolder: ( localize(4781, "Select a prompt source folder")),
18
+ canPickMany: false,
19
+ matchOnDescription: true,
20
+ };
21
+ const foldersList = ( folders.map(({ uri }) => {
22
+ const { folders } = workspaceService.getWorkspace();
23
+ const isMultirootWorkspace = (folders.length > 1);
24
+ const firstFolder = folders[0];
25
+ if (isMultirootWorkspace || !firstFolder || !extUri.isEqual(firstFolder.uri, uri)) {
26
+ return {
27
+ type: 'item',
28
+ label: basename(uri),
29
+ description: labelService.getUriLabel(uri, { relative: true }),
30
+ tooltip: uri.fsPath,
31
+ value: uri,
32
+ };
33
+ }
34
+ return {
35
+ type: 'item',
36
+ label: ( localize(4782, "Current Workspace")),
37
+ description: labelService.getUriLabel(uri, { relative: false }),
38
+ tooltip: uri.fsPath,
39
+ value: uri,
40
+ };
41
+ }));
42
+ const answer = await quickInputService.pick(foldersList, pickOptions);
43
+ if (!answer) {
44
+ return;
45
+ }
46
+ return answer.value;
47
+ };
48
+ const showNoFoldersDialog = async (quickInputService, openerService) => {
49
+ const docsQuickPick = {
50
+ type: 'item',
51
+ label: ( localize(4783, 'Learn how to configure reusable prompts')),
52
+ description: DOCUMENTATION_URL,
53
+ tooltip: DOCUMENTATION_URL,
54
+ value: ( URI.parse(DOCUMENTATION_URL)),
55
+ };
56
+ const result = await quickInputService.pick([docsQuickPick], {
57
+ placeHolder: ( localize(4784, 'No prompt source folders found.')),
58
+ canPickMany: false,
59
+ });
60
+ if (!result) {
61
+ return;
62
+ }
63
+ await openerService.open(result.value);
64
+ return;
65
+ };
66
+
67
+ export { askForPromptSourceFolder };
@@ -0,0 +1,9 @@
1
+ declare class BaseCreatePromptError extends Error {
2
+ }
3
+ export declare class FolderExists extends BaseCreatePromptError {
4
+ constructor(path: string);
5
+ }
6
+ export declare class InvalidPromptName extends BaseCreatePromptError {
7
+ constructor(name: string);
8
+ }
9
+ export {};
@@ -0,0 +1,17 @@
1
+
2
+ import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
3
+
4
+ class BaseCreatePromptError extends Error {
5
+ }
6
+ class FolderExists extends BaseCreatePromptError {
7
+ constructor(path) {
8
+ super(( localize(4785, "Folder already exists at '{0}'.", path)));
9
+ }
10
+ }
11
+ class InvalidPromptName extends BaseCreatePromptError {
12
+ constructor(name) {
13
+ super(( localize(4786, "Invalid prompt file name '{0}'.", name)));
14
+ }
15
+ }
16
+
17
+ export { FolderExists, InvalidPromptName };
@@ -0,0 +1,12 @@
1
+ import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
2
+ import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service";
3
+ import { ICommandService } from "@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service";
4
+ interface ICreatePromptFileOptions {
5
+ readonly fileName: string;
6
+ readonly folder: URI;
7
+ readonly content: string;
8
+ fileService: IFileService;
9
+ commandService: ICommandService;
10
+ }
11
+ export declare const createPromptFile: (options: ICreatePromptFileOptions) => Promise<URI>;
12
+ export {};
@@ -0,0 +1,24 @@
1
+
2
+ import { InvalidPromptName, FolderExists } from '../errors.js';
3
+ import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
4
+ import { assert } from '@codingame/monaco-vscode-api/vscode/vs/base/common/assert';
5
+ import { VSBuffer } from '@codingame/monaco-vscode-api/vscode/vs/base/common/buffer';
6
+ import { dirname } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
7
+ import { isPromptFile } from '@codingame/monaco-vscode-52bb4d5b-ba1a-57fd-9bee-b28824214eac-common/vscode/vs/platform/prompts/common/constants';
8
+
9
+ const createPromptFile = async (options) => {
10
+ const { fileName, folder, content, fileService, commandService } = options;
11
+ const promptUri = URI.joinPath(folder, fileName);
12
+ assert(isPromptFile(promptUri), ( new InvalidPromptName(fileName)));
13
+ if (await fileService.exists(promptUri)) {
14
+ const promptInfo = await fileService.resolve(promptUri);
15
+ assert(!promptInfo.isDirectory, ( new FolderExists(promptUri.fsPath)));
16
+ await commandService.executeCommand('vscode.open', promptUri);
17
+ return promptUri;
18
+ }
19
+ await fileService.createFolder(dirname(promptUri));
20
+ await fileService.createFile(promptUri, VSBuffer.fromString(content));
21
+ return promptUri;
22
+ };
23
+
24
+ export { createPromptFile };
@@ -0,0 +1,6 @@
1
+ import { IChatWidget } from "@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/browser/chat";
2
+ import { ServicesAccessor } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
3
+ import { IActiveCodeEditor } from "@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorBrowser";
4
+ export declare const COMMAND_ID = "workbench.command.prompts.use";
5
+ export declare function getFocusedChatWidget(accessor: ServicesAccessor): IChatWidget | undefined;
6
+ export declare function getActiveCodeEditor(accessor: ServicesAccessor): IActiveCodeEditor | undefined;