@codingame/monaco-vscode-katex-common 26.1.1 → 26.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 +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.js +4 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatElicitationActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +45 -36
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionHoverWidget.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsOpener.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.js +23 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.js +31 -31
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.js +33 -33
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +14 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationWidget.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.js +47 -45
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/searchableOptionPickerActionItem.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatAgentHover.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAgentCommandContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAnonymousRateLimitedPart.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatChangesSummaryPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCodeCitationContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleContentPart.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCommandContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationContentPart.js +5 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationWidget.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDisabledClaudeHooksContentPart.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDisabledClaudeHooksContentPart.js +55 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatExtensionsContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatHookContentPart.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatHookContentPart.js +55 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMcpServersInteractionContentPart.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMultiDiffContentPart.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatProgressContentPart.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.d.ts +5 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.js +96 -53
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuotaExceededPart.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatReferencesContentPart.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentContentPart.d.ts +15 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentContentPart.js +83 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSuggestNextWidget.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTextEditContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.js +26 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTodoListWidget.js +16 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolInputOutputContentPart.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolOutputContentSubPart.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTreeContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatWorkspaceEditContentPart.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/codeBlockPart.js +14 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatDisabledClaudeHooksContent.css +14 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatHookContentPart.css +44 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatQuestionCarousel.css +15 -22
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatExtensionsInstallToolSubPart.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppModel.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppSubPart.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.js +15 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.js +18 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationPart.js +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolOutputPart.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPartUtilities.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolProgressPart.js +14 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatDragAndDrop.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.js +206 -41
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListWidget.js +12 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatPendingDragAndDrop.d.ts +27 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatPendingDragAndDrop.js +148 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.d.ts +5 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.js +108 -51
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatFollowups.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.d.ts +14 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.js +59 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatSelectedTools.js +1 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.js +13 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/workspacePickerActionItem.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/media/chat.css +90 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageDetails.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageWidget.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/widget/chatColors.js +14 -14
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.js +3 -3
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatGutterAffordance.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatOverlayWidget.js +5 -5
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.js +5 -5
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +32 -32
- package/vscode/src/vs/workbench/contrib/interactive/browser/replInputHintContentWidget.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +7 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +2 -2
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditor.js +1 -1
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorInput.js +1 -1
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { $, DragAndDropObserver, addDisposableListener, EventType } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
|
|
4
|
+
import { Disposable, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
5
|
+
import { ChatRequestQueueKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService';
|
|
6
|
+
import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService.service';
|
|
7
|
+
|
|
8
|
+
const PENDING_REQUEST_ID_ATTR = "data-pending-request-id";
|
|
9
|
+
const PENDING_KIND_ATTR = "data-pending-kind";
|
|
10
|
+
const DRAGGING_CLASS = "chat-pending-dragging";
|
|
11
|
+
let ChatPendingDragController = class ChatPendingDragController extends Disposable {
|
|
12
|
+
constructor(listContainer, _getViewModel, _chatService) {
|
|
13
|
+
super();
|
|
14
|
+
this._getViewModel = _getViewModel;
|
|
15
|
+
this._chatService = _chatService;
|
|
16
|
+
this._insertIndicator = $(".chat-pending-insert-indicator");
|
|
17
|
+
listContainer.append(this._insertIndicator);
|
|
18
|
+
this._register(toDisposable(() => this._insertIndicator.remove()));
|
|
19
|
+
this._register(( new DragAndDropObserver(listContainer, {
|
|
20
|
+
onDragOver: e => this._onDragOver(e),
|
|
21
|
+
onDragLeave: () => this._hideIndicator(),
|
|
22
|
+
onDragEnd: () => this._onDragEnd(),
|
|
23
|
+
onDrop: e => this._onDrop(e)
|
|
24
|
+
})));
|
|
25
|
+
}
|
|
26
|
+
attachDragHandle(element, handleEl, rowContainer, disposables) {
|
|
27
|
+
handleEl.setAttribute("draggable", "true");
|
|
28
|
+
disposables.add(addDisposableListener(handleEl, EventType.DRAG_START, e => {
|
|
29
|
+
if (!e.dataTransfer || !element.pendingKind) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
this._dragState = {
|
|
33
|
+
element,
|
|
34
|
+
pendingKind: element.pendingKind
|
|
35
|
+
};
|
|
36
|
+
rowContainer.classList.add(DRAGGING_CLASS);
|
|
37
|
+
e.dataTransfer.setDragImage(rowContainer, 0, 0);
|
|
38
|
+
e.dataTransfer.effectAllowed = "move";
|
|
39
|
+
}));
|
|
40
|
+
disposables.add(addDisposableListener(handleEl, EventType.DRAG_END, () => {
|
|
41
|
+
rowContainer.classList.remove(DRAGGING_CLASS);
|
|
42
|
+
this._onDragEnd();
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
_onDragOver(e) {
|
|
46
|
+
if (!this._dragState) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const target = this._findDropTarget(e);
|
|
50
|
+
if (!target) {
|
|
51
|
+
this._hideIndicator();
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
if (e.dataTransfer) {
|
|
56
|
+
e.dataTransfer.dropEffect = "move";
|
|
57
|
+
}
|
|
58
|
+
const rect = target.row.getBoundingClientRect();
|
|
59
|
+
const midY = rect.top + rect.height / 2;
|
|
60
|
+
const before = e.clientY < midY;
|
|
61
|
+
this._showIndicator(target.row, before);
|
|
62
|
+
}
|
|
63
|
+
_onDrop(e) {
|
|
64
|
+
this._hideIndicator();
|
|
65
|
+
if (!this._dragState) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const target = this._findDropTarget(e);
|
|
69
|
+
if (!target) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
const rect = target.row.getBoundingClientRect();
|
|
74
|
+
const midY = rect.top + rect.height / 2;
|
|
75
|
+
const insertBefore = e.clientY < midY;
|
|
76
|
+
this._reorder(this._dragState.element, target.requestId, insertBefore);
|
|
77
|
+
this._dragState = undefined;
|
|
78
|
+
}
|
|
79
|
+
_onDragEnd() {
|
|
80
|
+
this._hideIndicator();
|
|
81
|
+
this._dragState = undefined;
|
|
82
|
+
}
|
|
83
|
+
_showIndicator(targetRow, before) {
|
|
84
|
+
const rect = targetRow.getBoundingClientRect();
|
|
85
|
+
const parentRect = this._insertIndicator.parentElement.getBoundingClientRect();
|
|
86
|
+
this._insertIndicator.style.display = "block";
|
|
87
|
+
this._insertIndicator.style.left = `${rect.left - parentRect.left}px`;
|
|
88
|
+
this._insertIndicator.style.width = `${rect.width}px`;
|
|
89
|
+
this._insertIndicator.style.top = before ? `${rect.top - parentRect.top}px` : `${rect.bottom - parentRect.top}px`;
|
|
90
|
+
}
|
|
91
|
+
_hideIndicator() {
|
|
92
|
+
this._insertIndicator.style.display = "none";
|
|
93
|
+
}
|
|
94
|
+
_findDropTarget(e) {
|
|
95
|
+
if (!this._dragState) {
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
const target = e.target?.closest?.(`[${PENDING_REQUEST_ID_ATTR}]`);
|
|
99
|
+
if (!target) {
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
const requestId = target.getAttribute(PENDING_REQUEST_ID_ATTR);
|
|
103
|
+
const kind = target.getAttribute(PENDING_KIND_ATTR);
|
|
104
|
+
if (kind !== this._dragState.pendingKind || requestId === this._dragState.element.id) {
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
row: target,
|
|
109
|
+
requestId
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
_reorder(draggedElement, targetId, insertBefore) {
|
|
113
|
+
const viewModel = this._getViewModel();
|
|
114
|
+
if (!viewModel) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const pendingRequests = viewModel.model.getPendingRequests();
|
|
118
|
+
const draggedKind = draggedElement.pendingKind;
|
|
119
|
+
const group = [];
|
|
120
|
+
const rest = [];
|
|
121
|
+
for (const p of pendingRequests) {
|
|
122
|
+
(p.kind === draggedKind ? group : rest).push(p);
|
|
123
|
+
}
|
|
124
|
+
const draggedIdx = group.findIndex(p => p.request.id === draggedElement.id);
|
|
125
|
+
if (draggedIdx === -1) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const [dragged] = group.splice(draggedIdx, 1);
|
|
129
|
+
let targetIdx = group.findIndex(p => p.request.id === targetId);
|
|
130
|
+
if (targetIdx === -1) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
if (!insertBefore) {
|
|
134
|
+
targetIdx++;
|
|
135
|
+
}
|
|
136
|
+
group.splice(targetIdx, 0, dragged);
|
|
137
|
+
const reordered = (
|
|
138
|
+
(draggedKind === ChatRequestQueueKind.Steering ?
|
|
139
|
+
[...group, ...rest] : [...rest, ...group]).map(p => ({
|
|
140
|
+
requestId: p.request.id,
|
|
141
|
+
kind: p.kind
|
|
142
|
+
})));
|
|
143
|
+
this._chatService.setPendingRequests(viewModel.sessionResource, reordered);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
ChatPendingDragController = ( __decorate([( __param(2, IChatService))], ChatPendingDragController));
|
|
147
|
+
|
|
148
|
+
export { ChatPendingDragController };
|
|
@@ -6,6 +6,7 @@ import { ICodeEditor } from "@codingame/monaco-vscode-api/vscode/vs/editor/brows
|
|
|
6
6
|
import { ICodeEditorService } from "@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/codeEditorService.service";
|
|
7
7
|
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
8
8
|
import { IContextKeyService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service";
|
|
9
|
+
import { IDialogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service";
|
|
9
10
|
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
10
11
|
import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
|
|
11
12
|
import { ITelemetryService } from "@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service";
|
|
@@ -63,6 +64,7 @@ export declare class ChatWidget extends Disposable implements IChatWidget {
|
|
|
63
64
|
private readonly codeEditorService;
|
|
64
65
|
private readonly editorService;
|
|
65
66
|
private readonly configurationService;
|
|
67
|
+
private readonly dialogService;
|
|
66
68
|
private readonly contextKeyService;
|
|
67
69
|
private readonly instantiationService;
|
|
68
70
|
private readonly chatService;
|
|
@@ -142,7 +144,6 @@ export declare class ChatWidget extends Disposable implements IChatWidget {
|
|
|
142
144
|
private visibleChangeCount;
|
|
143
145
|
private requestInProgress;
|
|
144
146
|
private agentInInput;
|
|
145
|
-
private currentRequest;
|
|
146
147
|
private _visible;
|
|
147
148
|
get visible(): boolean;
|
|
148
149
|
private _instructionFilesCheckPromise;
|
|
@@ -152,6 +153,7 @@ export declare class ChatWidget extends Disposable implements IChatWidget {
|
|
|
152
153
|
private readonly _lockedToCodingAgentContextKey;
|
|
153
154
|
private readonly _agentSupportsAttachmentsContextKey;
|
|
154
155
|
private readonly _sessionIsEmptyContextKey;
|
|
156
|
+
private readonly _hasPendingRequestsContextKey;
|
|
155
157
|
private _attachmentCapabilities;
|
|
156
158
|
private readonly promptDescriptionsCache;
|
|
157
159
|
private readonly promptUriCache;
|
|
@@ -169,7 +171,7 @@ export declare class ChatWidget extends Disposable implements IChatWidget {
|
|
|
169
171
|
readonly viewContext: IChatWidgetViewContext;
|
|
170
172
|
get supportsChangingModes(): boolean;
|
|
171
173
|
get locationData(): IChatLocationData | undefined;
|
|
172
|
-
constructor(location: ChatAgentLocation | IChatWidgetLocationOptions, viewContext: IChatWidgetViewContext | undefined, viewOptions: IChatWidgetViewOptions, styles: IChatWidgetStyles, codeEditorService: ICodeEditorService, editorService: IEditorService, configurationService: IConfigurationService, contextKeyService: IContextKeyService, instantiationService: IInstantiationService, chatService: IChatService, chatAgentService: IChatAgentService, chatWidgetService: IChatWidgetService, chatAccessibilityService: IChatAccessibilityService, logService: ILogService, themeService: IThemeService, chatSlashCommandService: IChatSlashCommandService, chatEditingService: IChatEditingService, telemetryService: ITelemetryService, promptsService: IPromptsService, toolsService: ILanguageModelToolsService, chatModeService: IChatModeService, chatLayoutService: IChatLayoutService, chatEntitlementService: IChatEntitlementService, chatSessionsService: IChatSessionsService, agentSessionsService: IAgentSessionsService, chatTodoListService: IChatTodoListService, contextService: IWorkspaceContextService, lifecycleService: ILifecycleService);
|
|
174
|
+
constructor(location: ChatAgentLocation | IChatWidgetLocationOptions, viewContext: IChatWidgetViewContext | undefined, viewOptions: IChatWidgetViewOptions, styles: IChatWidgetStyles, codeEditorService: ICodeEditorService, editorService: IEditorService, configurationService: IConfigurationService, dialogService: IDialogService, contextKeyService: IContextKeyService, instantiationService: IInstantiationService, chatService: IChatService, chatAgentService: IChatAgentService, chatWidgetService: IChatWidgetService, chatAccessibilityService: IChatAccessibilityService, logService: ILogService, themeService: IThemeService, chatSlashCommandService: IChatSlashCommandService, chatEditingService: IChatEditingService, telemetryService: ITelemetryService, promptsService: IPromptsService, toolsService: ILanguageModelToolsService, chatModeService: IChatModeService, chatLayoutService: IChatLayoutService, chatEntitlementService: IChatEntitlementService, chatSessionsService: IChatSessionsService, agentSessionsService: IAgentSessionsService, chatTodoListService: IChatTodoListService, contextService: IWorkspaceContextService, lifecycleService: ILifecycleService);
|
|
173
175
|
private _lastSelectedAgent;
|
|
174
176
|
set lastSelectedAgent(agent: IChatAgentData | undefined);
|
|
175
177
|
get lastSelectedAgent(): IChatAgentData | undefined;
|
|
@@ -254,6 +256,7 @@ export declare class ChatWidget extends Disposable implements IChatWidget {
|
|
|
254
256
|
rerunLastRequest(): Promise<void>;
|
|
255
257
|
private _applyPromptFileIfSet;
|
|
256
258
|
private _acceptInput;
|
|
259
|
+
private confirmPendingRequestsBeforeSend;
|
|
257
260
|
getModeRequestOptions(): Partial<IChatSendRequestOptions>;
|
|
258
261
|
getCodeBlockInfosForResponse(response: IChatResponseViewModel): IChatCodeBlockInfo[];
|
|
259
262
|
getCodeBlockInfoForEditor(uri: URI): IChatCodeBlockInfo | undefined;
|
|
@@ -28,6 +28,7 @@ import { MenuId } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/
|
|
|
28
28
|
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
29
29
|
import { ContextKeyExpr } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey';
|
|
30
30
|
import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
31
|
+
import { IDialogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
31
32
|
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
32
33
|
import { ServiceCollection } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/serviceCollection';
|
|
33
34
|
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
@@ -51,6 +52,7 @@ import { ChatMode } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contr
|
|
|
51
52
|
import { IChatModeService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatModes.service';
|
|
52
53
|
import { ChatRequestToolPart, ChatRequestToolSetPart, ChatRequestDynamicVariablePart, IParsedChatRequest, chatAgentLeader, chatSubcommandLeader, ChatRequestSlashPromptPart, formatChatQuestion, ChatRequestAgentPart } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/requestParser/chatParserTypes';
|
|
53
54
|
import { ChatRequestParser } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/requestParser/chatRequestParser';
|
|
55
|
+
import { ChatRequestQueueKind, ChatSendResult } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService';
|
|
54
56
|
import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService.service';
|
|
55
57
|
import { IChatSessionsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService.service';
|
|
56
58
|
import { IChatSlashCommandService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/participants/chatSlashCommands.service';
|
|
@@ -63,7 +65,6 @@ import { isToolSet } from '@codingame/monaco-vscode-api/vscode/vs/workbench/cont
|
|
|
63
65
|
import { ILanguageModelToolsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/tools/languageModelToolsService.service';
|
|
64
66
|
import { ComputeAutomaticInstructions } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/computeAutomaticInstructions';
|
|
65
67
|
import { PromptsConfig } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/config/config';
|
|
66
|
-
import { Target } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/promptFileParser';
|
|
67
68
|
import { IPromptsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.service';
|
|
68
69
|
import { handleModeSwitch } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
|
|
69
70
|
import { isIChatResourceViewContext, isIChatViewViewContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat';
|
|
@@ -101,7 +102,7 @@ const supportsAllAttachments = {
|
|
|
101
102
|
supportsSymbolAttachments: true,
|
|
102
103
|
supportsTerminalAttachments: true
|
|
103
104
|
};
|
|
104
|
-
const DISCLAIMER = ( localize(
|
|
105
|
+
const DISCLAIMER = ( localize(6131, "AI responses may be inaccurate."));
|
|
105
106
|
let ChatWidget = class ChatWidget extends Disposable {
|
|
106
107
|
static {
|
|
107
108
|
ChatWidget_1 = this;
|
|
@@ -131,7 +132,6 @@ let ChatWidget = class ChatWidget extends Disposable {
|
|
|
131
132
|
} else {
|
|
132
133
|
this.logService.debug("ChatWidget#setViewModel: no viewModel");
|
|
133
134
|
}
|
|
134
|
-
this.currentRequest = undefined;
|
|
135
135
|
this._onDidChangeViewModel.fire({
|
|
136
136
|
previousSessionResource,
|
|
137
137
|
currentSessionResource: this._viewModel?.sessionResource
|
|
@@ -177,6 +177,7 @@ let ChatWidget = class ChatWidget extends Disposable {
|
|
|
177
177
|
codeEditorService,
|
|
178
178
|
editorService,
|
|
179
179
|
configurationService,
|
|
180
|
+
dialogService,
|
|
180
181
|
contextKeyService,
|
|
181
182
|
instantiationService,
|
|
182
183
|
chatService,
|
|
@@ -205,6 +206,7 @@ let ChatWidget = class ChatWidget extends Disposable {
|
|
|
205
206
|
this.codeEditorService = codeEditorService;
|
|
206
207
|
this.editorService = editorService;
|
|
207
208
|
this.configurationService = configurationService;
|
|
209
|
+
this.dialogService = dialogService;
|
|
208
210
|
this.contextKeyService = contextKeyService;
|
|
209
211
|
this.instantiationService = instantiationService;
|
|
210
212
|
this.chatService = chatService;
|
|
@@ -270,6 +272,7 @@ let ChatWidget = class ChatWidget extends Disposable {
|
|
|
270
272
|
this._lockedToCodingAgentContextKey = ChatContextKeys.lockedToCodingAgent.bindTo(this.contextKeyService);
|
|
271
273
|
this._agentSupportsAttachmentsContextKey = ChatContextKeys.agentSupportsAttachments.bindTo(this.contextKeyService);
|
|
272
274
|
this._sessionIsEmptyContextKey = ChatContextKeys.chatSessionIsEmpty.bindTo(this.contextKeyService);
|
|
275
|
+
this._hasPendingRequestsContextKey = ChatContextKeys.hasPendingRequests.bindTo(this.contextKeyService);
|
|
273
276
|
this.viewContext = viewContext ?? {};
|
|
274
277
|
const viewModelObs = observableFromEvent(this, this.onDidChangeViewModel, () => this.viewModel);
|
|
275
278
|
if (typeof location === "object") {
|
|
@@ -679,7 +682,7 @@ let ChatWidget = class ChatWidget extends Disposable {
|
|
|
679
682
|
if (this.chatEntitlementService.anonymous && !this.chatEntitlementService.sentiment.installed) {
|
|
680
683
|
const providers = product.defaultChatAgent.provider;
|
|
681
684
|
additionalMessage = ( new MarkdownString(( localize(
|
|
682
|
-
|
|
685
|
+
6132,
|
|
683
686
|
"By continuing with {0} Copilot, you agree to {1}'s [Terms]({2}) and [Privacy Statement]({3}).",
|
|
684
687
|
providers.default.name,
|
|
685
688
|
providers.default.name,
|
|
@@ -725,7 +728,7 @@ let ChatWidget = class ChatWidget extends Disposable {
|
|
|
725
728
|
} else if (this._instructionFilesExist === false) {
|
|
726
729
|
const generateInstructionsCommand = "workbench.action.chat.generateInstructions";
|
|
727
730
|
return (new MarkdownString(localize(
|
|
728
|
-
|
|
731
|
+
6133,
|
|
729
732
|
"[Generate Agent Instructions]({0}) to onboard AI onto your codebase.",
|
|
730
733
|
`command:${generateInstructionsCommand}`
|
|
731
734
|
), {
|
|
@@ -738,13 +741,7 @@ let ChatWidget = class ChatWidget extends Disposable {
|
|
|
738
741
|
}
|
|
739
742
|
async _checkForAgentInstructionFiles() {
|
|
740
743
|
try {
|
|
741
|
-
|
|
742
|
-
const useAgentMd = this.configurationService.getValue(PromptsConfig.USE_AGENT_MD);
|
|
743
|
-
if (!useCopilotInstructionsFiles && !useAgentMd) {
|
|
744
|
-
return true;
|
|
745
|
-
}
|
|
746
|
-
return ((await this.promptsService.listCopilotInstructionsMDs(CancellationToken.None)).length > 0 ||
|
|
747
|
-
(await this.promptsService.listAgentMDs(CancellationToken.None, false)).length > 0);
|
|
744
|
+
return (await this.promptsService.listAgentInstructions(CancellationToken.None)).length > 0;
|
|
748
745
|
} catch (error) {
|
|
749
746
|
this.logService.warn("[ChatWidget] Error checking for instruction files:", error);
|
|
750
747
|
return false;
|
|
@@ -756,19 +753,19 @@ let ChatWidget = class ChatWidget extends Disposable {
|
|
|
756
753
|
const providerTitle = this._lockedAgent ? this.chatSessionsService.getWelcomeTitleForSessionType(this._lockedAgent.id) : undefined;
|
|
757
754
|
const providerMessage = this._lockedAgent ? this.chatSessionsService.getWelcomeMessageForSessionType(this._lockedAgent.id) : undefined;
|
|
758
755
|
const message = providerMessage ? ( new MarkdownString(providerMessage)) : (this._lockedAgent?.prefix === "@copilot " ? ( new MarkdownString(( localize(
|
|
759
|
-
|
|
756
|
+
6134,
|
|
760
757
|
"This chat session will be forwarded to the {0} [coding agent]({1}) where work is completed in the background. ",
|
|
761
758
|
this._lockedAgent.prefix,
|
|
762
759
|
"https://aka.ms/coding-agent-docs"
|
|
763
760
|
)) + DISCLAIMER, {
|
|
764
761
|
isTrusted: true
|
|
765
762
|
})) : ( new MarkdownString(( localize(
|
|
766
|
-
|
|
763
|
+
6135,
|
|
767
764
|
"This chat session will be forwarded to the {0} coding agent where work is completed in the background. ",
|
|
768
765
|
this._lockedAgent?.prefix
|
|
769
766
|
)) + DISCLAIMER)));
|
|
770
767
|
return {
|
|
771
|
-
title: providerTitle ?? ( localize(
|
|
768
|
+
title: providerTitle ?? ( localize(6136, "Delegate to {0}", this._lockedAgent?.prefix)),
|
|
772
769
|
message,
|
|
773
770
|
icon: providerIcon ?? Codicon.sendToRemoteAgent,
|
|
774
771
|
additionalMessage,
|
|
@@ -777,11 +774,11 @@ let ChatWidget = class ChatWidget extends Disposable {
|
|
|
777
774
|
}
|
|
778
775
|
let title;
|
|
779
776
|
if (this.input.currentModeKind === ChatModeKind.Ask) {
|
|
780
|
-
title = ( localize(
|
|
777
|
+
title = ( localize(6137, "Ask about your code"));
|
|
781
778
|
} else if (this.input.currentModeKind === ChatModeKind.Edit) {
|
|
782
|
-
title = ( localize(
|
|
779
|
+
title = ( localize(6138, "Edit in context"));
|
|
783
780
|
} else {
|
|
784
|
-
title = ( localize(
|
|
781
|
+
title = ( localize(6139, "Build with Agent"));
|
|
785
782
|
}
|
|
786
783
|
return {
|
|
787
784
|
title,
|
|
@@ -797,22 +794,22 @@ let ChatWidget = class ChatWidget extends Disposable {
|
|
|
797
794
|
if (isEmpty) {
|
|
798
795
|
return [{
|
|
799
796
|
icon: Codicon.vscode,
|
|
800
|
-
label: ( localize(
|
|
801
|
-
prompt: ( localize(
|
|
797
|
+
label: ( localize(6140, "Ask @vscode")),
|
|
798
|
+
prompt: ( localize(6141, "@vscode How do I change the theme to light mode?"))
|
|
802
799
|
}, {
|
|
803
800
|
icon: Codicon.newFolder,
|
|
804
|
-
label: ( localize(
|
|
805
|
-
prompt: ( localize(
|
|
801
|
+
label: ( localize(6142, "Create Project")),
|
|
802
|
+
prompt: ( localize(6143, "Create a #new Hello World project in TypeScript"))
|
|
806
803
|
}];
|
|
807
804
|
} else {
|
|
808
805
|
return [{
|
|
809
806
|
icon: Codicon.debugAlt,
|
|
810
|
-
label: ( localize(
|
|
811
|
-
prompt: ( localize(
|
|
807
|
+
label: ( localize(6144, "Build Workspace")),
|
|
808
|
+
prompt: ( localize(6145, "How do I build this workspace?"))
|
|
812
809
|
}, {
|
|
813
810
|
icon: Codicon.gear,
|
|
814
|
-
label: ( localize(
|
|
815
|
-
prompt: ( localize(
|
|
811
|
+
label: ( localize(6146, "Show Config")),
|
|
812
|
+
prompt: ( localize(6147, "Where is the configuration for this project defined?"))
|
|
816
813
|
}];
|
|
817
814
|
}
|
|
818
815
|
}
|
|
@@ -884,7 +881,7 @@ let ChatWidget = class ChatWidget extends Disposable {
|
|
|
884
881
|
promptName
|
|
885
882
|
} of topPrompts) {
|
|
886
883
|
const description = this.promptDescriptionsCache.get(promptName);
|
|
887
|
-
const commandLabel = ( localize(
|
|
884
|
+
const commandLabel = ( localize(6148, "{0}", promptName));
|
|
888
885
|
const uri = this.promptUriCache.get(promptName);
|
|
889
886
|
const descriptionText = description?.trim() ? description : undefined;
|
|
890
887
|
result.push({
|
|
@@ -1195,21 +1192,23 @@ let ChatWidget = class ChatWidget extends Disposable {
|
|
|
1195
1192
|
if (request.id === currentElement.id) {
|
|
1196
1193
|
request.setShouldBeBlocked(false);
|
|
1197
1194
|
request.attachedContext?.forEach(addToContext);
|
|
1198
|
-
currentElement.variables.forEach(addToContext);
|
|
1199
1195
|
}
|
|
1200
1196
|
}
|
|
1197
|
+
currentElement.variables.forEach(addToContext);
|
|
1201
1198
|
this.viewModel?.setEditing(currentElement);
|
|
1202
1199
|
if (item?.contextKeyService) {
|
|
1203
1200
|
ChatContextKeys.currentlyEditing.bindTo(item.contextKeyService).set(true);
|
|
1204
1201
|
}
|
|
1202
|
+
const isEditingSentRequest = currentElement.pendingKind === undefined ? ChatContextKeys.EditingRequestType.Sent : ChatContextKeys.EditingRequestType.QueueOrSteer;
|
|
1205
1203
|
const isInput = this.configurationService.getValue("chat.editRequests") === "input";
|
|
1206
|
-
this.inputPart?.setEditing(!!this.viewModel?.editing && isInput);
|
|
1204
|
+
this.inputPart?.setEditing(!!this.viewModel?.editing && isInput, isEditingSentRequest);
|
|
1207
1205
|
if (!isInput) {
|
|
1208
1206
|
const rowContainer = item.rowContainer;
|
|
1209
1207
|
this.inputContainer = $$1(".chat-edit-input-container");
|
|
1210
1208
|
rowContainer.appendChild(this.inputContainer);
|
|
1211
1209
|
this.createInput(this.inputContainer);
|
|
1212
1210
|
this.input.setChatMode(this.inputPart.currentModeObs.get().id);
|
|
1211
|
+
this.input.setEditing(true, isEditingSentRequest);
|
|
1213
1212
|
} else {
|
|
1214
1213
|
this.inputPart.element.classList.add("editing");
|
|
1215
1214
|
}
|
|
@@ -1275,7 +1274,7 @@ let ChatWidget = class ChatWidget extends Disposable {
|
|
|
1275
1274
|
this.inputPart.element.classList.remove("editing");
|
|
1276
1275
|
}
|
|
1277
1276
|
this.viewModel?.setEditing(undefined);
|
|
1278
|
-
this.inputPart?.setEditing(
|
|
1277
|
+
this.inputPart?.setEditing(false, undefined);
|
|
1279
1278
|
this.onDidChangeItems();
|
|
1280
1279
|
this.telemetryService.publicLog2("chat.editRequestsFinished", {
|
|
1281
1280
|
editRequestType: this.configurationService.getValue("chat.editRequests"),
|
|
@@ -1428,6 +1427,7 @@ let ChatWidget = class ChatWidget extends Disposable {
|
|
|
1428
1427
|
}
|
|
1429
1428
|
this.viewModel = undefined;
|
|
1430
1429
|
this.onDidChangeItems();
|
|
1430
|
+
this._hasPendingRequestsContextKey.set(false);
|
|
1431
1431
|
return;
|
|
1432
1432
|
}
|
|
1433
1433
|
if (isEqual(model.sessionResource, this.viewModel?.sessionResource)) {
|
|
@@ -1446,7 +1446,7 @@ let ChatWidget = class ChatWidget extends Disposable {
|
|
|
1446
1446
|
if (this._lockedAgent) {
|
|
1447
1447
|
let placeholder = this.chatSessionsService.getInputPlaceholderForSessionType(this._lockedAgent.id);
|
|
1448
1448
|
if (!placeholder) {
|
|
1449
|
-
placeholder = ( localize(
|
|
1449
|
+
placeholder = ( localize(6149, "Chat with {0}", this._lockedAgent.id));
|
|
1450
1450
|
}
|
|
1451
1451
|
this.viewModel.setInputPlaceholder(placeholder);
|
|
1452
1452
|
this.inputEditor.updateOptions({
|
|
@@ -1484,6 +1484,12 @@ let ChatWidget = class ChatWidget extends Disposable {
|
|
|
1484
1484
|
this.onDidChangeItems();
|
|
1485
1485
|
}));
|
|
1486
1486
|
this._sessionIsEmptyContextKey.set(model.getRequests().length === 0);
|
|
1487
|
+
const updatePendingRequestKeys = () => {
|
|
1488
|
+
const pendingCount = model.getPendingRequests().length;
|
|
1489
|
+
this._hasPendingRequestsContextKey.set(pendingCount > 0);
|
|
1490
|
+
};
|
|
1491
|
+
updatePendingRequestKeys();
|
|
1492
|
+
this.viewModelDisposables.add(model.onDidChangePendingRequests(() => updatePendingRequestKeys()));
|
|
1487
1493
|
this.refreshParsedInput();
|
|
1488
1494
|
this.viewModelDisposables.add(model.onDidChange(e => {
|
|
1489
1495
|
if (e.kind === "setAgent") {
|
|
@@ -1658,10 +1664,7 @@ let ChatWidget = class ChatWidget extends Disposable {
|
|
|
1658
1664
|
await this._applyPromptMetadata(parseResult.header, requestInput);
|
|
1659
1665
|
}
|
|
1660
1666
|
}
|
|
1661
|
-
async _acceptInput(query, options) {
|
|
1662
|
-
if (this.viewModel?.model.requestInProgress.get()) {
|
|
1663
|
-
return;
|
|
1664
|
-
}
|
|
1667
|
+
async _acceptInput(query, options = {}) {
|
|
1665
1668
|
if (!query && this.input.generating) {
|
|
1666
1669
|
const generatingAutoSubmitWindow = 500;
|
|
1667
1670
|
const start = Date.now();
|
|
@@ -1693,10 +1696,28 @@ let ChatWidget = class ChatWidget extends Disposable {
|
|
|
1693
1696
|
attachedContext: options?.enableImplicitContext === false ? this.input.getAttachedContext(this.viewModel.sessionResource) : this.input.getAttachedAndImplicitContext(this.viewModel.sessionResource)
|
|
1694
1697
|
};
|
|
1695
1698
|
const isUserQuery = !query;
|
|
1696
|
-
|
|
1699
|
+
const isEditing = this.viewModel?.editing;
|
|
1700
|
+
if (isEditing) {
|
|
1701
|
+
const editingPendingRequest = this.viewModel.editing.pendingKind;
|
|
1702
|
+
if (editingPendingRequest !== undefined) {
|
|
1703
|
+
const editingRequestId = this.viewModel.editing.id;
|
|
1704
|
+
this.chatService.removePendingRequest(this.viewModel.sessionResource, editingRequestId);
|
|
1705
|
+
options.queue ??= editingPendingRequest;
|
|
1706
|
+
} else {
|
|
1707
|
+
this.chatService.cancelCurrentRequestForSession(this.viewModel.sessionResource);
|
|
1708
|
+
options.queue = undefined;
|
|
1709
|
+
}
|
|
1697
1710
|
this.finishedEditing(true);
|
|
1698
1711
|
this.viewModel.model?.setCheckpoint(undefined);
|
|
1699
1712
|
}
|
|
1713
|
+
const model = this.viewModel.model;
|
|
1714
|
+
const requestInProgress = model.requestInProgress.get();
|
|
1715
|
+
if (requestInProgress) {
|
|
1716
|
+
options.queue ??= ChatRequestQueueKind.Queued;
|
|
1717
|
+
}
|
|
1718
|
+
if (!requestInProgress && !isEditing && !(await this.confirmPendingRequestsBeforeSend(model, options))) {
|
|
1719
|
+
return;
|
|
1720
|
+
}
|
|
1700
1721
|
await this._applyPromptFileIfSet(requestInputs);
|
|
1701
1722
|
await this._autoAttachInstructions(requestInputs);
|
|
1702
1723
|
if (this.viewOptions.enableWorkingSet !== undefined && this.input.currentModeKind === ChatModeKind.Edit && !this.chatService.edits2Enabled) {
|
|
@@ -1720,10 +1741,6 @@ let ChatWidget = class ChatWidget extends Disposable {
|
|
|
1720
1741
|
actualSize: uniqueWorkingSetEntries.size
|
|
1721
1742
|
});
|
|
1722
1743
|
}
|
|
1723
|
-
this.chatService.cancelCurrentRequestForSession(this.viewModel.sessionResource);
|
|
1724
|
-
if (this.currentRequest) {
|
|
1725
|
-
await Promise.race([this.currentRequest, timeout(1000)]);
|
|
1726
|
-
}
|
|
1727
1744
|
this.input.validateAgentMode();
|
|
1728
1745
|
if (this.viewModel.model.checkpoint) {
|
|
1729
1746
|
const requests = this.viewModel.model.getRequests();
|
|
@@ -1734,7 +1751,7 @@ let ChatWidget = class ChatWidget extends Disposable {
|
|
|
1734
1751
|
}
|
|
1735
1752
|
}
|
|
1736
1753
|
}
|
|
1737
|
-
if (this.viewModel.sessionResource) {
|
|
1754
|
+
if (this.viewModel.sessionResource && !options.queue) {
|
|
1738
1755
|
this.chatAccessibilityService.acceptRequest(this._viewModel.sessionResource);
|
|
1739
1756
|
}
|
|
1740
1757
|
const result = await this.chatService.sendRequest(this.viewModel.sessionResource, requestInputs.input, {
|
|
@@ -1749,20 +1766,27 @@ let ChatWidget = class ChatWidget extends Disposable {
|
|
|
1749
1766
|
noCommandDetection: options?.noCommandDetection,
|
|
1750
1767
|
...this.getModeRequestOptions(),
|
|
1751
1768
|
modeInfo: this.input.currentModeInfo,
|
|
1752
|
-
agentIdSilent: this._lockedAgent?.id
|
|
1769
|
+
agentIdSilent: this._lockedAgent?.id,
|
|
1770
|
+
queue: options?.queue
|
|
1753
1771
|
});
|
|
1754
|
-
if (!
|
|
1772
|
+
if (this.viewModel.sessionResource && !options.queue) {
|
|
1755
1773
|
this.chatAccessibilityService.disposeRequest(this.viewModel.sessionResource);
|
|
1774
|
+
}
|
|
1775
|
+
if (ChatSendResult.isRejected(result)) {
|
|
1756
1776
|
return;
|
|
1757
1777
|
}
|
|
1758
1778
|
this.updateChatViewVisibility();
|
|
1759
1779
|
this.input.acceptInput(options?.storeToHistory ?? isUserQuery);
|
|
1780
|
+
const sent = ChatSendResult.isQueued(result) ? await result.deferred : result;
|
|
1781
|
+
if (!ChatSendResult.isSent(sent)) {
|
|
1782
|
+
return;
|
|
1783
|
+
}
|
|
1760
1784
|
this._onDidSubmitAgent.fire({
|
|
1761
|
-
agent:
|
|
1762
|
-
slashCommand:
|
|
1785
|
+
agent: sent.data.agent,
|
|
1786
|
+
slashCommand: sent.data.slashCommand
|
|
1763
1787
|
});
|
|
1764
|
-
this.handleDelegationExitIfNeeded(this._lockedAgent,
|
|
1765
|
-
|
|
1788
|
+
this.handleDelegationExitIfNeeded(this._lockedAgent, sent.data.agent);
|
|
1789
|
+
sent.data.responseCompletePromise.then(() => {
|
|
1766
1790
|
const responses = this.viewModel?.getItems().filter(isResponseVM);
|
|
1767
1791
|
const lastResponse = responses?.[responses.length - 1];
|
|
1768
1792
|
this.chatAccessibilityService.acceptResponse(
|
|
@@ -1783,9 +1807,42 @@ let ChatWidget = class ChatWidget extends Disposable {
|
|
|
1783
1807
|
this.input.setValue(question, false);
|
|
1784
1808
|
}
|
|
1785
1809
|
}
|
|
1786
|
-
this.currentRequest = undefined;
|
|
1787
1810
|
});
|
|
1788
|
-
return
|
|
1811
|
+
return sent.data.responseCreatedPromise;
|
|
1812
|
+
}
|
|
1813
|
+
async confirmPendingRequestsBeforeSend(model, options) {
|
|
1814
|
+
if (options.queue) {
|
|
1815
|
+
return true;
|
|
1816
|
+
}
|
|
1817
|
+
const hasPendingRequests = model.getPendingRequests().length > 0;
|
|
1818
|
+
if (!hasPendingRequests) {
|
|
1819
|
+
return true;
|
|
1820
|
+
}
|
|
1821
|
+
const promptResult = await this.dialogService.prompt({
|
|
1822
|
+
type: "question",
|
|
1823
|
+
message: ( localize(6150, "You already have pending requests.")),
|
|
1824
|
+
detail: ( localize(
|
|
1825
|
+
6151,
|
|
1826
|
+
"Do you want to keep them in the queue or remove them before sending this message?"
|
|
1827
|
+
)),
|
|
1828
|
+
buttons: [{
|
|
1829
|
+
label: ( localize(6152, "Keep Pending Requests")),
|
|
1830
|
+
run: () => "keep"
|
|
1831
|
+
}, {
|
|
1832
|
+
label: ( localize(6153, "Remove Pending Requests")),
|
|
1833
|
+
run: () => "remove"
|
|
1834
|
+
}],
|
|
1835
|
+
cancelButton: true
|
|
1836
|
+
});
|
|
1837
|
+
if (!promptResult.result) {
|
|
1838
|
+
return false;
|
|
1839
|
+
}
|
|
1840
|
+
if (promptResult.result === "remove") {
|
|
1841
|
+
for (const pendingRequest of [...model.getPendingRequests()]) {
|
|
1842
|
+
this.chatService.removePendingRequest(model.sessionResource, pendingRequest.request.id);
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1845
|
+
return true;
|
|
1789
1846
|
}
|
|
1790
1847
|
getModeRequestOptions() {
|
|
1791
1848
|
return {
|
|
@@ -1963,7 +2020,7 @@ let ChatWidget = class ChatWidget extends Disposable {
|
|
|
1963
2020
|
this._switchToAgentByName(agent);
|
|
1964
2021
|
}
|
|
1965
2022
|
if (tools !== undefined && this.input.currentModeKind === ChatModeKind.Agent) {
|
|
1966
|
-
const enablementMap = this.toolsService.toToolAndToolSetEnablementMap(tools,
|
|
2023
|
+
const enablementMap = this.toolsService.toToolAndToolSetEnablementMap(tools, this.input.selectedLanguageModel.get()?.metadata);
|
|
1967
2024
|
this.input.selectedToolsModel.set(enablementMap, true);
|
|
1968
2025
|
}
|
|
1969
2026
|
if (model !== undefined) {
|
|
@@ -1990,6 +2047,6 @@ let ChatWidget = class ChatWidget extends Disposable {
|
|
|
1990
2047
|
this.listWidget.delegateScrollFromMouseWheelEvent(browserEvent);
|
|
1991
2048
|
}
|
|
1992
2049
|
};
|
|
1993
|
-
ChatWidget = ChatWidget_1 = ( __decorate([( __param(4, ICodeEditorService)), ( __param(5, IEditorService)), ( __param(6, IConfigurationService)), ( __param(7,
|
|
2050
|
+
ChatWidget = ChatWidget_1 = ( __decorate([( __param(4, ICodeEditorService)), ( __param(5, IEditorService)), ( __param(6, IConfigurationService)), ( __param(7, IDialogService)), ( __param(8, IContextKeyService)), ( __param(9, IInstantiationService)), ( __param(10, IChatService)), ( __param(11, IChatAgentService)), ( __param(12, IChatWidgetService)), ( __param(13, IChatAccessibilityService)), ( __param(14, ILogService)), ( __param(15, IThemeService)), ( __param(16, IChatSlashCommandService)), ( __param(17, IChatEditingService)), ( __param(18, ITelemetryService)), ( __param(19, IPromptsService)), ( __param(20, ILanguageModelToolsService)), ( __param(21, IChatModeService)), ( __param(22, IChatLayoutService)), ( __param(23, IChatEntitlementService)), ( __param(24, IChatSessionsService)), ( __param(25, IAgentSessionsService)), ( __param(26, IChatTodoListService)), ( __param(27, IWorkspaceContextService)), ( __param(28, ILifecycleService))], ChatWidget));
|
|
1994
2051
|
|
|
1995
2052
|
export { ChatWidget, isQuickChat };
|
|
@@ -45,7 +45,7 @@ let ChatFollowups = class ChatFollowups extends Disposable {
|
|
|
45
45
|
} else if (followup.kind === "command") {
|
|
46
46
|
button.element.classList.add("interactive-followup-command");
|
|
47
47
|
}
|
|
48
|
-
button.element.ariaLabel = ( localize(
|
|
48
|
+
button.element.ariaLabel = ( localize(6154, "Follow up question: {0}", baseTitle));
|
|
49
49
|
button.label = ( new MarkdownString(baseTitle));
|
|
50
50
|
this._register(button.onDidClick(() => this.clickHandler(followup)));
|
|
51
51
|
}
|