@codingame/monaco-vscode-chat-service-override 15.0.2 → 16.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 (147) hide show
  1. package/index.js +11 -8
  2. package/package.json +29 -20
  3. package/vscode/src/vs/editor/common/diff/documentDiffProvider.d.ts +22 -0
  4. package/vscode/src/vs/editor/common/diff/documentDiffProvider.js +10 -0
  5. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.d.ts +9 -2
  6. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +80 -55
  7. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/chatAttachPromptAction.d.ts +2 -2
  8. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/chatAttachPromptAction.js +17 -3
  9. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/{askToSelectPrompt.d.ts → askToSelectPrompt/askToSelectPrompt.d.ts} +9 -1
  10. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/askToSelectPrompt.js +79 -0
  11. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/constants.d.ts +7 -0
  12. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/constants.js +27 -0
  13. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/utils/attachPrompts.d.ts +5 -0
  14. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/utils/attachPrompts.js +53 -0
  15. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/utils/createPlaceholderText.d.ts +2 -0
  16. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/utils/createPlaceholderText.js +19 -0
  17. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/utils/createPromptPickItem.d.ts +5 -0
  18. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/utils/createPromptPickItem.js +27 -0
  19. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/utils/handleButtonClick.d.ts +13 -0
  20. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/utils/handleButtonClick.js +49 -0
  21. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +11 -11
  22. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.d.ts +6 -1
  23. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +163 -72
  24. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +2 -2
  25. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +22 -2
  26. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +2 -2
  27. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.js +4 -1
  28. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +3 -3
  29. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +17 -17
  30. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +9 -8
  31. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTransfer.d.ts +7 -0
  32. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTransfer.js +17 -0
  33. package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +15 -15
  34. package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +242 -74
  35. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditing.d.ts +4 -0
  36. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditing.js +15 -0
  37. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.d.ts +47 -0
  38. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.js +688 -0
  39. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.d.ts +28 -0
  40. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +355 -0
  41. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +11 -11
  42. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.d.ts +71 -0
  43. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.js +395 -0
  44. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.d.ts +98 -0
  45. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.js +216 -0
  46. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.d.ts +97 -0
  47. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.js +831 -0
  48. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.d.ts +7 -4
  49. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.js +32 -47
  50. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.d.ts +110 -0
  51. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +985 -0
  52. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelContentProviders.d.ts +20 -0
  53. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelContentProviders.js +69 -0
  54. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookDiff.d.ts +15 -0
  55. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookDiff.js +67 -0
  56. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookSnapshot.d.ts +26 -0
  57. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookSnapshot.js +147 -0
  58. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookCellEntry.d.ts +56 -0
  59. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookCellEntry.js +284 -0
  60. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.d.ts +38 -0
  61. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.js +578 -0
  62. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookFileSystemProvider.d.ts +45 -0
  63. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookFileSystemProvider.js +122 -0
  64. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/helpers.d.ts +15 -0
  65. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/helpers.js +320 -0
  66. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/notebookCellChanges.d.ts +31 -0
  67. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/notebookCellChanges.js +50 -0
  68. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.d.ts +5 -3
  69. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +22 -5
  70. package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.d.ts +4 -0
  71. package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +166 -62
  72. package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +1 -1
  73. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.d.ts +6 -104
  74. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.js +704 -732
  75. package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus.d.ts +10 -25
  76. package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus.js +329 -236
  77. package/vscode/src/vs/workbench/contrib/chat/browser/chatStatusItemService.d.ts +19 -0
  78. package/vscode/src/vs/workbench/contrib/chat/browser/chatStatusItemService.js +27 -0
  79. package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.d.ts +4 -2
  80. package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +14 -6
  81. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +3 -3
  82. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.d.ts +1 -1
  83. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.js +1 -1
  84. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/editorHoverWrapper.d.ts +1 -1
  85. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/editorHoverWrapper.js +1 -1
  86. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/media/editorHoverWrapper.css +3 -0
  87. package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.d.ts +17 -1
  88. package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.js +217 -18
  89. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatEditingEditorOverlay.css +114 -0
  90. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatEditorController.css +30 -0
  91. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatSetup.css +56 -0
  92. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatStatus.css +90 -0
  93. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/createPromptCommand.js +65 -19
  94. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptName.js +2 -2
  95. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptSourceFolder.js +4 -4
  96. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/errors.js +2 -2
  97. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/utils/createPromptFile.d.ts +2 -2
  98. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/utils/createPromptFile.js +3 -3
  99. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/usePromptCommand.js +14 -12
  100. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.js +5 -5
  101. package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.d.ts +5 -3
  102. package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.js +5 -2
  103. package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.d.ts +16 -8
  104. package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +175 -57
  105. package/vscode/src/vs/workbench/contrib/chat/common/chatSessionStore.d.ts +66 -0
  106. package/vscode/src/vs/workbench/contrib/chat/common/chatSessionStore.js +313 -0
  107. package/vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.d.ts +3 -2
  108. package/vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.js +4 -2
  109. package/vscode/src/vs/workbench/contrib/chat/common/chatTransferService.d.ts +14 -0
  110. package/vscode/src/vs/workbench/contrib/chat/common/chatTransferService.js +30 -0
  111. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/constants.d.ts +2 -3
  112. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/constants.js +6 -2
  113. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/textModelContentsProvider.d.ts +10 -2
  114. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/textModelContentsProvider.js +18 -3
  115. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptLinkDiagnosticsProvider.d.ts +9 -0
  116. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptLinkDiagnosticsProvider.js +117 -0
  117. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptPathAutocompletion.js +3 -4
  118. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/textModelPromptParser.js +2 -2
  119. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.js +2 -2
  120. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +6 -4
  121. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +157 -65
  122. package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.d.ts +2 -1
  123. package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +39 -21
  124. package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.d.ts +0 -1
  125. package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +2 -3
  126. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +4 -4
  127. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.js +11 -10
  128. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +1 -1
  129. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookModifiedCellDecorator.d.ts +10 -0
  130. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookModifiedCellDecorator.js +47 -0
  131. package/vscode/src/vs/workbench/services/workspaces/common/workspaceUtils.d.ts +5 -0
  132. package/vscode/src/vs/workbench/services/workspaces/common/workspaceUtils.js +26 -0
  133. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt.js +0 -142
  134. package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.d.ts +0 -52
  135. package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.js +0 -331
  136. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputRelatedFilesContrib.d.ts +0 -15
  137. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputRelatedFilesContrib.js +0 -110
  138. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/media/editorHoverWrapper.css.js +0 -6
  139. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatEditingEditorOverlay.css.js +0 -6
  140. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatStatus.css.js +0 -6
  141. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatViewSetup.css.js +0 -6
  142. package/vscode/src/vs/workbench/contrib/chat/common/chatEntitlementsService.d.ts +0 -19
  143. package/vscode/src/vs/workbench/contrib/chat/common/chatEntitlementsService.js +0 -13
  144. package/vscode/src/vs/workbench/contrib/chat/common/chatQuotasService.d.ts +0 -31
  145. package/vscode/src/vs/workbench/contrib/chat/common/chatQuotasService.js +0 -85
  146. package/vscode/src/vs/workbench/contrib/chat/common/tools/tools.d.ts +0 -11
  147. package/vscode/src/vs/workbench/contrib/chat/common/tools/tools.js +0 -22
@@ -0,0 +1,216 @@
1
+
2
+ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
+ import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
4
+ import { Disposable, DisposableMap, MutableDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
5
+ import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
6
+ import { clamp } from '@codingame/monaco-vscode-api/vscode/vs/base/common/numbers';
7
+ import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
8
+ import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
9
+ import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
10
+ import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
11
+ import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
12
+ import { observableConfigValue } from '@codingame/monaco-vscode-api/vscode/vs/platform/observable/common/platformObservableUtils';
13
+ import { registerColor, transparent } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colorUtils';
14
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/baseColors';
15
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/chartsColors';
16
+ import { editorBackground } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/editorColors';
17
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/inputColors';
18
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/listColors';
19
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/menuColors';
20
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/minimapColors';
21
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/miscColors';
22
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/quickpickColors';
23
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/searchColors';
24
+ import { IUndoRedoService } from '@codingame/monaco-vscode-api/vscode/vs/platform/undoRedo/common/undoRedo.service';
25
+ import { IFilesConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService.service';
26
+ import { WorkingSetEntryState, ChatEditKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService';
27
+ import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService.service';
28
+ import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/base';
29
+ import { derived } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/derived';
30
+ import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/autorun';
31
+
32
+ var AbstractChatEditingModifiedFileEntry_1;
33
+ class AutoAcceptControl {
34
+ constructor(total, remaining, cancel) {
35
+ this.total = total;
36
+ this.remaining = remaining;
37
+ this.cancel = cancel;
38
+ }
39
+ }
40
+ const pendingRewriteMinimap = registerColor('minimap.chatEditHighlight', ( transparent(editorBackground, 0.6)), ( localize(4687, "Color of pending edit regions in the minimap")));
41
+ let AbstractChatEditingModifiedFileEntry = class AbstractChatEditingModifiedFileEntry extends Disposable {
42
+ static { AbstractChatEditingModifiedFileEntry_1 = this; }
43
+ static { this.scheme = 'modified-file-entry'; }
44
+ static { this.lastEntryId = 0; }
45
+ get telemetryInfo() {
46
+ return this._telemetryInfo;
47
+ }
48
+ get lastModifyingRequestId() {
49
+ return this._telemetryInfo.requestId;
50
+ }
51
+ constructor(modifiedURI, _telemetryInfo, kind, configService, _fileConfigService, _chatService, _fileService, _undoRedoService, _instantiationService) {
52
+ super();
53
+ this.modifiedURI = modifiedURI;
54
+ this._telemetryInfo = _telemetryInfo;
55
+ this._fileConfigService = _fileConfigService;
56
+ this._chatService = _chatService;
57
+ this._fileService = _fileService;
58
+ this._undoRedoService = _undoRedoService;
59
+ this._instantiationService = _instantiationService;
60
+ this.entryId = `${AbstractChatEditingModifiedFileEntry_1.scheme}::${++AbstractChatEditingModifiedFileEntry_1.lastEntryId}`;
61
+ this._onDidDelete = this._register(( new Emitter()));
62
+ this.onDidDelete = this._onDidDelete.event;
63
+ this._stateObs = observableValue(this, WorkingSetEntryState.Attached);
64
+ this.state = this._stateObs;
65
+ this._isCurrentlyBeingModifiedByObs = observableValue(this, undefined);
66
+ this.isCurrentlyBeingModifiedBy = this._isCurrentlyBeingModifiedByObs;
67
+ this._rewriteRatioObs = observableValue(this, 0);
68
+ this.rewriteRatio = this._rewriteRatioObs;
69
+ this._reviewModeTempObs = observableValue(this, undefined);
70
+ this._autoAcceptCtrl = observableValue(this, undefined);
71
+ this.autoAcceptController = this._autoAcceptCtrl;
72
+ this._refCounter = 1;
73
+ this._editorIntegrations = this._register(( new DisposableMap()));
74
+ if (kind === ChatEditKind.Created) {
75
+ this.createdInRequestId = this._telemetryInfo.requestId;
76
+ }
77
+ if (this.modifiedURI.scheme !== Schemas.untitled && this.modifiedURI.scheme !== Schemas.vscodeNotebookCell) {
78
+ this._register(this._fileService.watch(this.modifiedURI));
79
+ this._register(this._fileService.onDidFilesChange(e => {
80
+ if (e.affects(this.modifiedURI) && kind === ChatEditKind.Created && e.gotDeleted()) {
81
+ this._onDidDelete.fire();
82
+ }
83
+ }));
84
+ }
85
+ const autoAcceptRaw = observableConfigValue('chat.editing.autoAcceptDelay', 0, configService);
86
+ this._autoAcceptTimeout = derived(r => {
87
+ const value = autoAcceptRaw.read(r);
88
+ return clamp(value, 0, 100);
89
+ });
90
+ this.reviewMode = derived(r => {
91
+ const configuredValue = this._autoAcceptTimeout.read(r);
92
+ const tempValue = this._reviewModeTempObs.read(r);
93
+ return tempValue ?? configuredValue === 0;
94
+ });
95
+ const autoSaveOff = this._store.add(( new MutableDisposable()));
96
+ this._store.add(autorun(r => {
97
+ if (this.isCurrentlyBeingModifiedBy.read(r)) {
98
+ autoSaveOff.value = _fileConfigService.disableAutoSave(this.modifiedURI);
99
+ }
100
+ else {
101
+ autoSaveOff.clear();
102
+ }
103
+ }));
104
+ }
105
+ dispose() {
106
+ if (--this._refCounter === 0) {
107
+ super.dispose();
108
+ }
109
+ }
110
+ acquire() {
111
+ this._refCounter++;
112
+ return this;
113
+ }
114
+ enableReviewModeUntilSettled() {
115
+ this._reviewModeTempObs.set(true, undefined);
116
+ const cleanup = autorun(r => {
117
+ const resetConfig = this.state.read(r) !== WorkingSetEntryState.Modified;
118
+ if (resetConfig) {
119
+ this._store.delete(cleanup);
120
+ this._reviewModeTempObs.set(undefined, undefined);
121
+ }
122
+ });
123
+ this._store.add(cleanup);
124
+ }
125
+ updateTelemetryInfo(telemetryInfo) {
126
+ this._telemetryInfo = telemetryInfo;
127
+ }
128
+ async accept(tx) {
129
+ if (this._stateObs.get() !== WorkingSetEntryState.Modified) {
130
+ return;
131
+ }
132
+ await this._doAccept(tx);
133
+ this._stateObs.set(WorkingSetEntryState.Accepted, tx);
134
+ this._autoAcceptCtrl.set(undefined, tx);
135
+ this._notifyAction('accepted');
136
+ }
137
+ async reject(tx) {
138
+ if (this._stateObs.get() !== WorkingSetEntryState.Modified) {
139
+ return;
140
+ }
141
+ await this._doReject(tx);
142
+ this._stateObs.set(WorkingSetEntryState.Rejected, tx);
143
+ this._autoAcceptCtrl.set(undefined, tx);
144
+ this._notifyAction('rejected');
145
+ }
146
+ _notifyAction(outcome) {
147
+ this._chatService.notifyUserAction({
148
+ action: { kind: 'chatEditingSessionAction', uri: this.modifiedURI, hasRemainingEdits: false, outcome },
149
+ agentId: this._telemetryInfo.agentId,
150
+ command: this._telemetryInfo.command,
151
+ sessionId: this._telemetryInfo.sessionId,
152
+ requestId: this._telemetryInfo.requestId,
153
+ result: this._telemetryInfo.result
154
+ });
155
+ }
156
+ getEditorIntegration(pane) {
157
+ let value = this._editorIntegrations.get(pane);
158
+ if (!value) {
159
+ value = this._createEditorIntegration(pane);
160
+ this._editorIntegrations.set(pane, value);
161
+ }
162
+ return value;
163
+ }
164
+ acceptStreamingEditsStart(responseModel, tx) {
165
+ this._resetEditsState(tx);
166
+ this._isCurrentlyBeingModifiedByObs.set(responseModel, tx);
167
+ this._autoAcceptCtrl.get()?.cancel();
168
+ const undoRedoElement = this._createUndoRedoElement(responseModel);
169
+ if (undoRedoElement) {
170
+ this._undoRedoService.pushElement(undoRedoElement);
171
+ }
172
+ }
173
+ async acceptStreamingEditsEnd(tx) {
174
+ this._resetEditsState(tx);
175
+ if (await this._areOriginalAndModifiedIdentical()) {
176
+ this.accept(tx);
177
+ }
178
+ else if (!this.reviewMode.get() && !this._autoAcceptCtrl.get()) {
179
+ const acceptTimeout = this._autoAcceptTimeout.get() * 1000;
180
+ const future = Date.now() + acceptTimeout;
181
+ const update = () => {
182
+ const reviewMode = this.reviewMode.get();
183
+ if (reviewMode) {
184
+ this._autoAcceptCtrl.set(undefined, undefined);
185
+ return;
186
+ }
187
+ const remain = Math.round(future - Date.now());
188
+ if (remain <= 0) {
189
+ this.accept(undefined);
190
+ }
191
+ else {
192
+ const handle = setTimeout(update, 100);
193
+ this._autoAcceptCtrl.set(( new AutoAcceptControl(acceptTimeout, remain, () => {
194
+ clearTimeout(handle);
195
+ this._autoAcceptCtrl.set(undefined, undefined);
196
+ })), undefined);
197
+ }
198
+ };
199
+ update();
200
+ }
201
+ }
202
+ _resetEditsState(tx) {
203
+ this._isCurrentlyBeingModifiedByObs.set(undefined, tx);
204
+ this._rewriteRatioObs.set(0, tx);
205
+ }
206
+ };
207
+ AbstractChatEditingModifiedFileEntry = AbstractChatEditingModifiedFileEntry_1 = ( __decorate([
208
+ ( __param(3, IConfigurationService)),
209
+ ( __param(4, IFilesConfigurationService)),
210
+ ( __param(5, IChatService)),
211
+ ( __param(6, IFileService)),
212
+ ( __param(7, IUndoRedoService)),
213
+ ( __param(8, IInstantiationService))
214
+ ], AbstractChatEditingModifiedFileEntry));
215
+
216
+ export { AbstractChatEditingModifiedFileEntry, pendingRewriteMinimap };
@@ -0,0 +1,97 @@
1
+ import { IReference } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
2
+ import { ITransaction, IObservable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/observable";
3
+ import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
4
+ import { TextEdit } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/languages";
5
+ import { ITextModel } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/model";
6
+ import { IModelService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model.service";
7
+ import { ITextModelService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService.service";
8
+ import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
9
+ import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service";
10
+ import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
11
+ import { IUndoRedoElement } from "@codingame/monaco-vscode-api/vscode/vs/platform/undoRedo/common/undoRedo";
12
+ import { IUndoRedoService } from "@codingame/monaco-vscode-api/vscode/vs/platform/undoRedo/common/undoRedo.service";
13
+ import { IEditorPane } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor";
14
+ import { IFilesConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService.service";
15
+ import { CellDiffInfo } from "@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel";
16
+ import { NotebookCellTextModel } from "@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/notebook/common/model/notebookCellTextModel";
17
+ import { ICellEditOperation, IResolvedNotebookEditorModel, NotebookTextModelChangedEvent, TransientOptions } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon";
18
+ import { INotebookEditorModelResolverService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookEditorModelResolverService.service";
19
+ import { INotebookLoggingService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookLoggingService.service";
20
+ import { INotebookEditorWorkerService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/services/notebookWorkerService.service";
21
+ import { ChatEditKind, IModifiedFileEntryEditorIntegration } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService";
22
+ import { IChatResponseModel } from "@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/common/chatModel";
23
+ import { IChatService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService.service";
24
+ import { AbstractChatEditingModifiedFileEntry, IModifiedEntryTelemetryInfo, ISnapshotEntry } from "./chatEditingModifiedFileEntry.js";
25
+ import { ChatEditingNotebookCellEntry } from "./notebook/chatEditingNotebookCellEntry.js";
26
+ import { ICellDiffInfo } from "./notebook/notebookCellChanges.js";
27
+ export declare class ChatEditingModifiedNotebookEntry extends AbstractChatEditingModifiedFileEntry {
28
+ private readonly modifiedResourceRef;
29
+ private readonly _multiDiffEntryDelegate;
30
+ private readonly transientOptions;
31
+ private readonly configurationService;
32
+ private readonly textModelService;
33
+ private readonly modelService;
34
+ private readonly notebookEditorWorkerService;
35
+ private readonly loggingService;
36
+ private readonly notebookResolver;
37
+ static NewModelCounter: number;
38
+ private readonly modifiedModel;
39
+ private readonly originalModel;
40
+ originalURI: URI;
41
+ initialContent: string;
42
+ private _isProcessingResponse;
43
+ get isProcessingResponse(): IObservable<boolean>;
44
+ private _isEditFromUs;
45
+ private _allEditsAreFromUs;
46
+ private readonly _changesCount;
47
+ changesCount: IObservable<number>;
48
+ private readonly cellEntryMap;
49
+ private modifiedToOriginalCell;
50
+ private readonly _cellsDiffInfo;
51
+ get cellsDiffInfo(): IObservable<ICellDiffInfo[]>;
52
+ private readonly editedCells;
53
+ static create(uri: URI, _multiDiffEntryDelegate: {
54
+ collapse: (transaction: ITransaction | undefined) => void;
55
+ }, telemetryInfo: IModifiedEntryTelemetryInfo, chatKind: ChatEditKind, initialContent: string | undefined, instantiationService: IInstantiationService): Promise<AbstractChatEditingModifiedFileEntry>;
56
+ static canHandleSnapshotContent(initialContent: string | undefined): boolean;
57
+ static canHandleSnapshot(snapshot: ISnapshotEntry): boolean;
58
+ private readonly initialContentComparer;
59
+ constructor(modifiedResourceRef: IReference<IResolvedNotebookEditorModel>, originalResourceRef: IReference<IResolvedNotebookEditorModel>, _multiDiffEntryDelegate: {
60
+ collapse: (transaction: ITransaction | undefined) => void;
61
+ }, transientOptions: TransientOptions | undefined, telemetryInfo: IModifiedEntryTelemetryInfo, kind: ChatEditKind, initialContent: string, configurationService: IConfigurationService, fileConfigService: IFilesConfigurationService, chatService: IChatService, fileService: IFileService, instantiationService: IInstantiationService, textModelService: ITextModelService, modelService: IModelService, undoRedoService: IUndoRedoService, notebookEditorWorkerService: INotebookEditorWorkerService, loggingService: INotebookLoggingService, notebookResolver: INotebookEditorModelResolverService);
62
+ initializeModelsFromDiffImpl(cellsDiffInfo: CellDiffInfo[]): void;
63
+ private computeRequestId;
64
+ initializeModelsFromDiff(): Promise<void>;
65
+ updateCellDiffInfo(cellsDiffInfo: ICellDiffInfo[], transcation: ITransaction | undefined): void;
66
+ mirrorNotebookEdits(e: NotebookTextModelChangedEvent): void;
67
+ protected _doAccept(tx: ITransaction | undefined): Promise<void>;
68
+ protected _doReject(tx: ITransaction | undefined): Promise<void>;
69
+ private _collapse;
70
+ protected _createEditorIntegration(editor: IEditorPane): IModifiedFileEntryEditorIntegration;
71
+ protected _resetEditsState(tx: ITransaction): void;
72
+ protected _createUndoRedoElement(response: IChatResponseModel): IUndoRedoElement | undefined;
73
+ protected _areOriginalAndModifiedIdentical(): Promise<boolean>;
74
+ private _areOriginalAndModifiedIdenticalImpl;
75
+ private newNotebookEditGenerator?;
76
+ acceptAgentEdits(resource: URI, edits: (TextEdit | ICellEditOperation)[], isLastEdits: boolean, responseModel: IChatResponseModel): Promise<void>;
77
+ private disposeDeletedCellEntries;
78
+ acceptNotebookEdit(edit: ICellEditOperation): void;
79
+ private computeStateAfterAcceptingRejectingChanges;
80
+ createModifiedCellDiffInfo(modifiedCellIndex: number, originalCellIndex: number): ICellDiffInfo;
81
+ createInsertedCellDiffInfo(modifiedCellIndex: number): ICellDiffInfo;
82
+ createDeleteCellDiffInfo(originalCellIndex: number): ICellDiffInfo;
83
+ private undoPreviouslyInsertedCell;
84
+ private keepPreviouslyInsertedCell;
85
+ private undoPreviouslyDeletedCell;
86
+ private keepPreviouslyDeletedCell;
87
+ private _applyEdits;
88
+ private _applyEditsSync;
89
+ createSnapshot(requestId: string | undefined, undoStop: string | undefined): ISnapshotEntry;
90
+ equalsSnapshot(snapshot: ISnapshotEntry | undefined): boolean;
91
+ restoreFromSnapshot(snapshot: ISnapshotEntry, restoreToDisk?: boolean): void;
92
+ resetToInitialContent(): void;
93
+ private restoreSnapshotInModifiedModel;
94
+ private readonly cellTextModelMap;
95
+ private resolveCellModel;
96
+ getOrCreateModifiedTextFileEntryForCell(cell: NotebookCellTextModel, modifiedCellModel: ITextModel, originalCellModel: ITextModel): ChatEditingNotebookCellEntry | undefined;
97
+ }