@codingame/monaco-vscode-xterm-addons-common 37.2.0 → 37.3.1
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/terminal/browser/xterm/xtermTerminal.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.d.ts +58 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.js +462 -0
- package/vscode/src/vs/base/browser/htmlToMarkdown.d.ts +0 -1
- package/vscode/src/vs/base/browser/htmlToMarkdown.js +0 -144
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContext.d.ts +0 -59
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContext.js +0 -482
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/attachInstructionsAction.d.ts +0 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/attachInstructionsAction.js +0 -95
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/newPromptFileActions.d.ts +0 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/newPromptFileActions.js +0 -355
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptName.d.ts +0 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptName.js +0 -81
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptSourceFolder.d.ts +0 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptSourceFolder.js +0 -181
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/promptFilePickers.d.ts +0 -75
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/promptFilePickers.js +0 -622
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatPasteProviders.d.ts +0 -71
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatPasteProviders.js +0 -800
- package/vscode/src/vs/workbench/contrib/git/common/utils.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/git/common/utils.js +0 -105
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalUri.d.ts +0 -18
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalUri.js +0 -51
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/decorationAddon.d.ts +0 -79
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/decorationAddon.js +0 -652
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/markNavigationAddon.d.ts +0 -64
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/markNavigationAddon.js +0 -564
|
@@ -1,482 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
-
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
4
|
-
import { CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
5
|
-
import { Disposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
6
|
-
import { isElectron } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
|
|
7
|
-
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
8
|
-
import { agentHostAuthority } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentHostUri';
|
|
9
|
-
import { IRemoteAgentHostService } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/remoteAgentHostService.service';
|
|
10
|
-
import { IClipboardService } from '@codingame/monaco-vscode-api/vscode/vs/platform/clipboard/common/clipboardService.service';
|
|
11
|
-
import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
|
|
12
|
-
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
13
|
-
import { ILabelService } from '@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service';
|
|
14
|
-
import { IQuickInputService } from '@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput.service';
|
|
15
|
-
import { EditorResourceAccessor, SideBySideEditor } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor';
|
|
16
|
-
import { DiffEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor/diffEditorInput';
|
|
17
|
-
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
18
|
-
import { IHostService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/host/browser/host.service';
|
|
19
|
-
import { IPathService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService.service';
|
|
20
|
-
import { UntitledTextEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/untitled/common/untitledTextEditorInput';
|
|
21
|
-
import { FileEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/files/browser/editors/fileEditorInput';
|
|
22
|
-
import { NotebookEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookEditorInput';
|
|
23
|
-
import { IChatContextPickService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/attachments/chatContextPickService.service';
|
|
24
|
-
import { toToolSetVariableEntry, toToolVariableEntry } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/attachments/chatVariableEntries';
|
|
25
|
-
import { isToolSet, ToolDataSource } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/tools/languageModelToolsService';
|
|
26
|
-
import { ChatAgentLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
|
|
27
|
-
import { isImage } from '../widget/input/editor/chatPasteProviders.js';
|
|
28
|
-
import { convertBufferToScreenshotVariable } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/attachments/chatScreenshotContext';
|
|
29
|
-
import { ChatInstructionsPickerPick } from '../promptSyntax/attachInstructionsAction.js';
|
|
30
|
-
import { isAgentHostTarget } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService';
|
|
31
|
-
import { IChatSessionsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService.service';
|
|
32
|
-
import { AgentSessionProviders, getAgentSessionProviderIcon } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessions';
|
|
33
|
-
import { ITerminalService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal.service';
|
|
34
|
-
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
35
|
-
import { TerminalCapability } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/capabilities/capabilities';
|
|
36
|
-
import { getChatSessionType } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatUri';
|
|
37
|
-
import { buildHostLocalEventsPath } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/copilotCliEventsUri';
|
|
38
|
-
import { imageToHash } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chatImageUtils';
|
|
39
|
-
import { IGitService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/git/common/gitService.service';
|
|
40
|
-
import { getGitHubRemoteInfo } from '../../../git/common/utils.js';
|
|
41
|
-
import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
|
|
42
|
-
import { isEqual } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
43
|
-
|
|
44
|
-
const OPEN_GITHUB_ISSUE_COMMAND = "github.copilot.chat.cloudSessions.openIssue";
|
|
45
|
-
const OPEN_GITHUB_PULL_REQUEST_COMMAND = "github.copilot.chat.cloudSessions.openPullRequest";
|
|
46
|
-
function shouldShowOpenEditorsContext(widget, hasEligibleOpenEditors) {
|
|
47
|
-
if (!hasEligibleOpenEditors) {
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
const sessionResource = widget.viewModel?.sessionResource;
|
|
51
|
-
if (sessionResource && isAgentHostTarget(getChatSessionType(sessionResource))) {
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
if (widget.lockedAgentId && isAgentHostTarget(widget.lockedAgentId)) {
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
59
|
-
let ChatContextContributions = class ChatContextContributions extends Disposable {
|
|
60
|
-
static {
|
|
61
|
-
this.ID = "chat.contextContributions";
|
|
62
|
-
}
|
|
63
|
-
constructor(instantiationService, contextPickService) {
|
|
64
|
-
super();
|
|
65
|
-
this._store.add(
|
|
66
|
-
contextPickService.registerChatContextItem(instantiationService.createInstance(ToolsContextPickerPick))
|
|
67
|
-
);
|
|
68
|
-
this._store.add(
|
|
69
|
-
contextPickService.registerChatContextItem(instantiationService.createInstance(ChatInstructionsPickerPick))
|
|
70
|
-
);
|
|
71
|
-
this._store.add(
|
|
72
|
-
contextPickService.registerChatContextItem(instantiationService.createInstance(OpenEditorContextValuePick))
|
|
73
|
-
);
|
|
74
|
-
this._store.add(
|
|
75
|
-
contextPickService.registerChatContextItem(instantiationService.createInstance(ClipboardImageContextValuePick))
|
|
76
|
-
);
|
|
77
|
-
this._store.add(
|
|
78
|
-
contextPickService.registerChatContextItem(instantiationService.createInstance(ScreenshotContextValuePick))
|
|
79
|
-
);
|
|
80
|
-
this._store.add(
|
|
81
|
-
contextPickService.registerChatContextItem(instantiationService.createInstance(SessionReferenceContextPickerPick))
|
|
82
|
-
);
|
|
83
|
-
this._store.add(
|
|
84
|
-
contextPickService.registerChatContextItem(instantiationService.createInstance(GitHubContextValuePick, "issue"))
|
|
85
|
-
);
|
|
86
|
-
this._store.add(
|
|
87
|
-
contextPickService.registerChatContextItem(instantiationService.createInstance(GitHubContextValuePick, "pullRequest"))
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
ChatContextContributions = ( __decorate([( __param(0, IInstantiationService)), ( __param(1, IChatContextPickService))], ChatContextContributions));
|
|
92
|
-
let GitHubContextValuePick = class GitHubContextValuePick {
|
|
93
|
-
constructor(
|
|
94
|
-
kind,
|
|
95
|
-
gitService,
|
|
96
|
-
quickInputService,
|
|
97
|
-
commandService,
|
|
98
|
-
workspaceContextService
|
|
99
|
-
) {
|
|
100
|
-
this.gitService = gitService;
|
|
101
|
-
this.quickInputService = quickInputService;
|
|
102
|
-
this.commandService = commandService;
|
|
103
|
-
this.workspaceContextService = workspaceContextService;
|
|
104
|
-
this.type = "valuePick";
|
|
105
|
-
this.ordinal = -450;
|
|
106
|
-
if (kind === "issue") {
|
|
107
|
-
this.label = ( localize(5641, "Issue..."));
|
|
108
|
-
this.icon = Codicon.issues;
|
|
109
|
-
this._commandId = OPEN_GITHUB_ISSUE_COMMAND;
|
|
110
|
-
} else {
|
|
111
|
-
this.label = ( localize(5642, "Pull Request..."));
|
|
112
|
-
this.icon = Codicon.gitPullRequest;
|
|
113
|
-
this._commandId = OPEN_GITHUB_PULL_REQUEST_COMMAND;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
isEnabled() {
|
|
117
|
-
return true;
|
|
118
|
-
}
|
|
119
|
-
async asAttachment() {
|
|
120
|
-
const repositories = await this.getRepositoryPicks();
|
|
121
|
-
let repository;
|
|
122
|
-
if (repositories.length === 1) {
|
|
123
|
-
repository = repositories[0];
|
|
124
|
-
} else if (repositories.length > 1) {
|
|
125
|
-
repository = await this.pickRepository(repositories);
|
|
126
|
-
}
|
|
127
|
-
if (repositories.length > 1 && !repository) {
|
|
128
|
-
return undefined;
|
|
129
|
-
}
|
|
130
|
-
const repositoryArgument = repository?.repoId ?? this.getRepositoryId(repository?.folderUri) ?? repository?.folderUri;
|
|
131
|
-
const selection = await this.commandService.executeCommand(this._commandId, repositoryArgument);
|
|
132
|
-
if (!selection) {
|
|
133
|
-
return undefined;
|
|
134
|
-
}
|
|
135
|
-
const resource = ( URI.parse(selection.url));
|
|
136
|
-
return {
|
|
137
|
-
kind: "generic",
|
|
138
|
-
id: selection.url,
|
|
139
|
-
fullName: selection.label,
|
|
140
|
-
name: selection.label,
|
|
141
|
-
value: resource,
|
|
142
|
-
icon: this.icon,
|
|
143
|
-
references: [{
|
|
144
|
-
reference: resource,
|
|
145
|
-
kind: "reference"
|
|
146
|
-
}]
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
async pickRepository(repositories) {
|
|
150
|
-
return this.quickInputService.pick([...repositories], {
|
|
151
|
-
canPickMany: false,
|
|
152
|
-
placeHolder: ( localize(5643, "Select a repository"))
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
async getRepositoryPicks() {
|
|
156
|
-
const knownRepositories = Array.from(this.gitService.repositories);
|
|
157
|
-
const workspaceFolders = this.workspaceContextService.getWorkspace().folders;
|
|
158
|
-
if (workspaceFolders.length > 1) {
|
|
159
|
-
return ( workspaceFolders.map(folder => {
|
|
160
|
-
const repository = knownRepositories.find(repository => isEqual(
|
|
161
|
-
this.workspaceContextService.getWorkspaceFolder(repository.rootUri)?.uri,
|
|
162
|
-
folder.uri
|
|
163
|
-
));
|
|
164
|
-
const info = repository && getGitHubRemoteInfo(repository.state.get());
|
|
165
|
-
return info ? {
|
|
166
|
-
label: folder.name,
|
|
167
|
-
description: `${info.owner}/${info.repo}`,
|
|
168
|
-
repoId: `${info.owner}/${info.repo}`,
|
|
169
|
-
folderUri: folder.uri
|
|
170
|
-
} : {
|
|
171
|
-
label: folder.name,
|
|
172
|
-
folderUri: folder.uri
|
|
173
|
-
};
|
|
174
|
-
}));
|
|
175
|
-
}
|
|
176
|
-
const repositoryIds = ( new Set());
|
|
177
|
-
for (const repository of knownRepositories) {
|
|
178
|
-
if (!repository) {
|
|
179
|
-
continue;
|
|
180
|
-
}
|
|
181
|
-
const info = getGitHubRemoteInfo(repository.state.get());
|
|
182
|
-
if (info) {
|
|
183
|
-
repositoryIds.add(`${info.owner}/${info.repo}`);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
return ( Array.from(repositoryIds).sort().map(repoId => ({
|
|
187
|
-
label: repoId,
|
|
188
|
-
repoId
|
|
189
|
-
})));
|
|
190
|
-
}
|
|
191
|
-
getRepositoryId(folderUri) {
|
|
192
|
-
if (!folderUri) {
|
|
193
|
-
return undefined;
|
|
194
|
-
}
|
|
195
|
-
const repository = Array.from(this.gitService.repositories).find(repository => isEqual(
|
|
196
|
-
this.workspaceContextService.getWorkspaceFolder(repository.rootUri)?.uri,
|
|
197
|
-
folderUri
|
|
198
|
-
));
|
|
199
|
-
const info = repository && getGitHubRemoteInfo(repository.state.get());
|
|
200
|
-
return info ? `${info.owner}/${info.repo}` : undefined;
|
|
201
|
-
}
|
|
202
|
-
};
|
|
203
|
-
GitHubContextValuePick = ( __decorate([( __param(1, IGitService)), ( __param(2, IQuickInputService)), ( __param(3, ICommandService)), ( __param(4, IWorkspaceContextService))], GitHubContextValuePick));
|
|
204
|
-
class ToolsContextPickerPick {
|
|
205
|
-
constructor() {
|
|
206
|
-
this.type = "pickerPick";
|
|
207
|
-
this.label = ( localize(5644, "Tools..."));
|
|
208
|
-
this.icon = Codicon.tools;
|
|
209
|
-
this.ordinal = -500;
|
|
210
|
-
}
|
|
211
|
-
isEnabled(widget) {
|
|
212
|
-
return !!widget.attachmentCapabilities.supportsToolAttachments;
|
|
213
|
-
}
|
|
214
|
-
asPicker(widget) {
|
|
215
|
-
const items = [];
|
|
216
|
-
for (const [entry, enabled] of widget.input.selectedToolsModel.entriesMap.get()) {
|
|
217
|
-
if (enabled) {
|
|
218
|
-
if (isToolSet(entry)) {
|
|
219
|
-
items.push({
|
|
220
|
-
toolInfo: ToolDataSource.classify(entry.source),
|
|
221
|
-
label: entry.referenceName,
|
|
222
|
-
description: entry.description,
|
|
223
|
-
asAttachment: () => toToolSetVariableEntry(entry)
|
|
224
|
-
});
|
|
225
|
-
} else {
|
|
226
|
-
items.push({
|
|
227
|
-
toolInfo: ToolDataSource.classify(entry.source),
|
|
228
|
-
label: entry.toolReferenceName ?? entry.displayName,
|
|
229
|
-
description: entry.userDescription ?? entry.modelDescription,
|
|
230
|
-
asAttachment: () => toToolVariableEntry(entry)
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
items.sort((a, b) => {
|
|
236
|
-
let res = a.toolInfo.ordinal - b.toolInfo.ordinal;
|
|
237
|
-
if (res === 0) {
|
|
238
|
-
res = a.toolInfo.label.localeCompare(b.toolInfo.label);
|
|
239
|
-
}
|
|
240
|
-
if (res === 0) {
|
|
241
|
-
res = a.label.localeCompare(b.label);
|
|
242
|
-
}
|
|
243
|
-
return res;
|
|
244
|
-
});
|
|
245
|
-
let lastGroupLabel;
|
|
246
|
-
const picks = [];
|
|
247
|
-
for (const item of items) {
|
|
248
|
-
if (lastGroupLabel !== item.toolInfo.label) {
|
|
249
|
-
picks.push({
|
|
250
|
-
type: "separator",
|
|
251
|
-
label: item.toolInfo.label
|
|
252
|
-
});
|
|
253
|
-
lastGroupLabel = item.toolInfo.label;
|
|
254
|
-
}
|
|
255
|
-
picks.push(item);
|
|
256
|
-
}
|
|
257
|
-
return {
|
|
258
|
-
placeholder: ( localize(5645, "Select a tool")),
|
|
259
|
-
picks: Promise.resolve(picks)
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
let OpenEditorContextValuePick = class OpenEditorContextValuePick {
|
|
264
|
-
constructor(_editorService, _labelService) {
|
|
265
|
-
this._editorService = _editorService;
|
|
266
|
-
this._labelService = _labelService;
|
|
267
|
-
this.type = "valuePick";
|
|
268
|
-
this.label = ( localize(5646, "Open Editors"));
|
|
269
|
-
this.icon = Codicon.file;
|
|
270
|
-
this.ordinal = 800;
|
|
271
|
-
}
|
|
272
|
-
isEnabled(widget) {
|
|
273
|
-
const hasEligibleOpenEditors = ( this._editorService.editors.some(
|
|
274
|
-
e => e instanceof FileEditorInput || e instanceof DiffEditorInput || e instanceof UntitledTextEditorInput
|
|
275
|
-
));
|
|
276
|
-
return shouldShowOpenEditorsContext(widget, hasEligibleOpenEditors);
|
|
277
|
-
}
|
|
278
|
-
async asAttachment() {
|
|
279
|
-
const result = [];
|
|
280
|
-
for (const editor of this._editorService.editors) {
|
|
281
|
-
if (!(editor instanceof FileEditorInput || editor instanceof DiffEditorInput || editor instanceof UntitledTextEditorInput || editor instanceof NotebookEditorInput)) {
|
|
282
|
-
continue;
|
|
283
|
-
}
|
|
284
|
-
const uri = EditorResourceAccessor.getOriginalUri(editor, {
|
|
285
|
-
supportSideBySide: SideBySideEditor.PRIMARY
|
|
286
|
-
});
|
|
287
|
-
if (!uri) {
|
|
288
|
-
continue;
|
|
289
|
-
}
|
|
290
|
-
result.push({
|
|
291
|
-
kind: "file",
|
|
292
|
-
id: ( uri.toString()),
|
|
293
|
-
value: uri,
|
|
294
|
-
name: this._labelService.getUriBasenameLabel(uri)
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
return result;
|
|
298
|
-
}
|
|
299
|
-
};
|
|
300
|
-
OpenEditorContextValuePick = ( __decorate([( __param(0, IEditorService)), ( __param(1, ILabelService))], OpenEditorContextValuePick));
|
|
301
|
-
let ClipboardImageContextValuePick = class ClipboardImageContextValuePick {
|
|
302
|
-
constructor(_clipboardService) {
|
|
303
|
-
this._clipboardService = _clipboardService;
|
|
304
|
-
this.type = "valuePick";
|
|
305
|
-
this.label = ( localize(5647, "Image from Clipboard"));
|
|
306
|
-
this.icon = Codicon.fileMedia;
|
|
307
|
-
}
|
|
308
|
-
async isEnabled(widget) {
|
|
309
|
-
if (!widget.attachmentCapabilities.supportsImageAttachments) {
|
|
310
|
-
return false;
|
|
311
|
-
}
|
|
312
|
-
if (!widget.input.selectedLanguageModel.get()?.metadata.capabilities?.vision) {
|
|
313
|
-
return false;
|
|
314
|
-
}
|
|
315
|
-
const imageData = await this._clipboardService.readImage();
|
|
316
|
-
return isImage(imageData);
|
|
317
|
-
}
|
|
318
|
-
async asAttachment() {
|
|
319
|
-
const fileBuffer = await this._clipboardService.readImage();
|
|
320
|
-
return {
|
|
321
|
-
id: await imageToHash(fileBuffer),
|
|
322
|
-
name: ( localize(5648, "Pasted Image")),
|
|
323
|
-
fullName: ( localize(5648, "Pasted Image")),
|
|
324
|
-
value: fileBuffer,
|
|
325
|
-
kind: "image"
|
|
326
|
-
};
|
|
327
|
-
}
|
|
328
|
-
};
|
|
329
|
-
ClipboardImageContextValuePick = ( __decorate([( __param(0, IClipboardService))], ClipboardImageContextValuePick));
|
|
330
|
-
let TerminalContext = class TerminalContext {
|
|
331
|
-
constructor(_resource, _terminalService) {
|
|
332
|
-
this._resource = _resource;
|
|
333
|
-
this._terminalService = _terminalService;
|
|
334
|
-
this.type = "valuePick";
|
|
335
|
-
this.icon = Codicon.terminal;
|
|
336
|
-
this.label = ( localize(5649, "Terminal"));
|
|
337
|
-
}
|
|
338
|
-
isEnabled(widget) {
|
|
339
|
-
const terminal = this._terminalService.getInstanceFromResource(this._resource);
|
|
340
|
-
return !!widget.attachmentCapabilities.supportsTerminalAttachments && terminal?.isDisposed === false;
|
|
341
|
-
}
|
|
342
|
-
async asAttachment(widget) {
|
|
343
|
-
const terminal = this._terminalService.getInstanceFromResource(this._resource);
|
|
344
|
-
if (!terminal) {
|
|
345
|
-
return;
|
|
346
|
-
}
|
|
347
|
-
const params = ( new URLSearchParams(this._resource.query));
|
|
348
|
-
const command = terminal.capabilities.get(TerminalCapability.CommandDetection)?.commands.find(cmd => cmd.id === params.get("command"));
|
|
349
|
-
if (!command) {
|
|
350
|
-
return;
|
|
351
|
-
}
|
|
352
|
-
const attachment = {
|
|
353
|
-
kind: "terminalCommand",
|
|
354
|
-
id: `terminalCommand:${Date.now()}}`,
|
|
355
|
-
value: this.asValue(command),
|
|
356
|
-
name: command.command,
|
|
357
|
-
command: command.command,
|
|
358
|
-
output: command.getOutput(),
|
|
359
|
-
exitCode: command.exitCode,
|
|
360
|
-
resource: this._resource
|
|
361
|
-
};
|
|
362
|
-
const cleanup = ( new DisposableStore());
|
|
363
|
-
let disposed = false;
|
|
364
|
-
const disposeCleanup = () => {
|
|
365
|
-
if (disposed) {
|
|
366
|
-
return;
|
|
367
|
-
}
|
|
368
|
-
disposed = true;
|
|
369
|
-
cleanup.dispose();
|
|
370
|
-
};
|
|
371
|
-
cleanup.add(widget.attachmentModel.onDidChange(e => {
|
|
372
|
-
if (e.deleted.includes(attachment.id)) {
|
|
373
|
-
disposeCleanup();
|
|
374
|
-
}
|
|
375
|
-
}));
|
|
376
|
-
cleanup.add(terminal.onDisposed(() => {
|
|
377
|
-
widget.attachmentModel.delete(attachment.id);
|
|
378
|
-
widget.refreshParsedInput();
|
|
379
|
-
disposeCleanup();
|
|
380
|
-
}));
|
|
381
|
-
return attachment;
|
|
382
|
-
}
|
|
383
|
-
asValue(command) {
|
|
384
|
-
let value = `Command: ${command.command}`;
|
|
385
|
-
const output = command.getOutput();
|
|
386
|
-
if (output) {
|
|
387
|
-
value += `\nOutput:\n${output}`;
|
|
388
|
-
}
|
|
389
|
-
if (typeof command.exitCode === "number") {
|
|
390
|
-
value += `\nExit Code: ${command.exitCode}`;
|
|
391
|
-
}
|
|
392
|
-
return value;
|
|
393
|
-
}
|
|
394
|
-
};
|
|
395
|
-
TerminalContext = ( __decorate([( __param(1, ITerminalService))], TerminalContext));
|
|
396
|
-
let ScreenshotContextValuePick = class ScreenshotContextValuePick {
|
|
397
|
-
constructor(_hostService) {
|
|
398
|
-
this._hostService = _hostService;
|
|
399
|
-
this.type = "valuePick";
|
|
400
|
-
this.icon = Codicon.deviceCamera;
|
|
401
|
-
this.label = (isElectron ? ( localize(5650, "Screenshot Window")) : ( localize(5651, "Screenshot")));
|
|
402
|
-
}
|
|
403
|
-
async isEnabled(widget) {
|
|
404
|
-
return !!widget.attachmentCapabilities.supportsImageAttachments && !!widget.input.selectedLanguageModel.get()?.metadata.capabilities?.vision;
|
|
405
|
-
}
|
|
406
|
-
async asAttachment() {
|
|
407
|
-
const blob = await this._hostService.getScreenshot();
|
|
408
|
-
return blob && convertBufferToScreenshotVariable(blob);
|
|
409
|
-
}
|
|
410
|
-
};
|
|
411
|
-
ScreenshotContextValuePick = ( __decorate([( __param(0, IHostService))], ScreenshotContextValuePick));
|
|
412
|
-
let SessionReferenceContextPickerPick = class SessionReferenceContextPickerPick {
|
|
413
|
-
constructor(_chatSessionsService, _pathService, _remoteAgentHostService) {
|
|
414
|
-
this._chatSessionsService = _chatSessionsService;
|
|
415
|
-
this._pathService = _pathService;
|
|
416
|
-
this._remoteAgentHostService = _remoteAgentHostService;
|
|
417
|
-
this.type = "pickerPick";
|
|
418
|
-
this.icon = Codicon.comment;
|
|
419
|
-
this.label = ( localize(5652, "Sessions..."));
|
|
420
|
-
this.ordinal = -400;
|
|
421
|
-
}
|
|
422
|
-
isEnabled(widget) {
|
|
423
|
-
return widget.location === ChatAgentLocation.Chat;
|
|
424
|
-
}
|
|
425
|
-
asPicker(widget) {
|
|
426
|
-
const currentSessionResource = widget.viewModel?.sessionResource;
|
|
427
|
-
const onlyShowAttachableCopilotCliSessions = !!currentSessionResource && isAgentHostTarget(getChatSessionType(currentSessionResource));
|
|
428
|
-
return {
|
|
429
|
-
placeholder: ( localize(5653, "Select a session")),
|
|
430
|
-
picks: (async () => {
|
|
431
|
-
const picks = [];
|
|
432
|
-
const sessionProviderFilter = [
|
|
433
|
-
AgentSessionProviders.Local,
|
|
434
|
-
AgentSessionProviders.Background,
|
|
435
|
-
AgentSessionProviders.AgentHostCopilot
|
|
436
|
-
];
|
|
437
|
-
for await (const group of this._chatSessionsService.getChatSessionItems(sessionProviderFilter, CancellationToken.None)) {
|
|
438
|
-
const providerIcon = getAgentSessionProviderIcon(group.chatSessionType);
|
|
439
|
-
for (const item of group.items) {
|
|
440
|
-
if (currentSessionResource && ( item.resource.toString()) === ( currentSessionResource.toString())) {
|
|
441
|
-
continue;
|
|
442
|
-
}
|
|
443
|
-
const sessionResource = item.resource;
|
|
444
|
-
if (onlyShowAttachableCopilotCliSessions && !this._canAttachCopilotCliSession(sessionResource)) {
|
|
445
|
-
continue;
|
|
446
|
-
}
|
|
447
|
-
const icon = item.iconPath ?? providerIcon;
|
|
448
|
-
const lastActivity = item.timing.lastRequestEnded ?? item.timing.created;
|
|
449
|
-
picks.push({
|
|
450
|
-
lastActivity,
|
|
451
|
-
pick: {
|
|
452
|
-
label: item.label,
|
|
453
|
-
description: ( new Date(lastActivity)).toLocaleString(),
|
|
454
|
-
asAttachment: () => ({
|
|
455
|
-
kind: "sessionReference",
|
|
456
|
-
id: ( sessionResource.toString()),
|
|
457
|
-
name: item.label,
|
|
458
|
-
value: sessionResource,
|
|
459
|
-
icon
|
|
460
|
-
})
|
|
461
|
-
}
|
|
462
|
-
});
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
picks.sort((a, b) => b.lastActivity - a.lastActivity);
|
|
466
|
-
return ( picks.map((
|
|
467
|
-
{
|
|
468
|
-
pick
|
|
469
|
-
}
|
|
470
|
-
) => pick));
|
|
471
|
-
})()
|
|
472
|
-
};
|
|
473
|
-
}
|
|
474
|
-
_canAttachCopilotCliSession(sessionResource) {
|
|
475
|
-
return !!buildHostLocalEventsPath(sessionResource, this._pathService.userHome({
|
|
476
|
-
preferLocal: true
|
|
477
|
-
}), authority => this._remoteAgentHostService.connections.find(connection => agentHostAuthority(connection.address) === authority));
|
|
478
|
-
}
|
|
479
|
-
};
|
|
480
|
-
SessionReferenceContextPickerPick = ( __decorate([( __param(0, IChatSessionsService)), ( __param(1, IPathService)), ( __param(2, IRemoteAgentHostService))], SessionReferenceContextPickerPick));
|
|
481
|
-
|
|
482
|
-
export { ChatContextContributions, GitHubContextValuePick, TerminalContext, shouldShowOpenEditorsContext };
|
package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/attachInstructionsAction.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { IChatWidget } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat";
|
|
2
|
-
import { IPromptsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.service";
|
|
3
|
-
import { IChatContextPickerItem, IChatContextPicker } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/attachments/chatContextPickService";
|
|
4
|
-
/**
|
|
5
|
-
* Action ID for the `Attach Instruction` action.
|
|
6
|
-
*/
|
|
7
|
-
export declare const ATTACH_INSTRUCTIONS_ACTION_ID = "workbench.action.chat.attach.instructions";
|
|
8
|
-
/**
|
|
9
|
-
* Action ID for the `Configure Instruction` action.
|
|
10
|
-
*/
|
|
11
|
-
export declare const CONFIGURE_INSTRUCTIONS_ACTION_ID = "workbench.action.chat.configure.instructions";
|
|
12
|
-
/**
|
|
13
|
-
* Helper to register the `Attach Prompt` action.
|
|
14
|
-
*/
|
|
15
|
-
export declare function registerAttachPromptActions(): void;
|
|
16
|
-
export declare class ChatInstructionsPickerPick implements IChatContextPickerItem {
|
|
17
|
-
private readonly promptsService;
|
|
18
|
-
readonly type = "pickerPick";
|
|
19
|
-
readonly label: string;
|
|
20
|
-
readonly icon: import("@codingame/monaco-vscode-api/vscode/vs/base/common/themables").ThemeIcon;
|
|
21
|
-
readonly commandId = "workbench.action.chat.attach.instructions";
|
|
22
|
-
constructor(promptsService: IPromptsService);
|
|
23
|
-
isEnabled(widget: IChatWidget): Promise<boolean> | boolean;
|
|
24
|
-
asPicker(): IChatContextPicker;
|
|
25
|
-
}
|
package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/attachInstructionsAction.js
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
-
import { CHAT_CATEGORY } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
|
|
4
|
-
import { localize2, localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
5
|
-
import { ChatContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/actions/chatContextKeys';
|
|
6
|
-
import { IPromptsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.service';
|
|
7
|
-
import { PromptFilePickers } from './pickers/promptFilePickers.js';
|
|
8
|
-
import { Action2, registerAction2 } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
|
|
9
|
-
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
10
|
-
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
11
|
-
import { getCleanPromptName } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/config/promptFileLocations';
|
|
12
|
-
import { PromptsType } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/promptTypes';
|
|
13
|
-
import { compare } from '@codingame/monaco-vscode-api/vscode/vs/base/common/strings';
|
|
14
|
-
import { toPromptFileVariableEntry, PromptFileVariableKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/attachments/chatVariableEntries';
|
|
15
|
-
import { CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
16
|
-
import { IOpenerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service';
|
|
17
|
-
|
|
18
|
-
const ATTACH_INSTRUCTIONS_ACTION_ID = "workbench.action.chat.attach.instructions";
|
|
19
|
-
const CONFIGURE_INSTRUCTIONS_ACTION_ID = "workbench.action.chat.configure.instructions";
|
|
20
|
-
class ManageInstructionsFilesAction extends Action2 {
|
|
21
|
-
constructor() {
|
|
22
|
-
super({
|
|
23
|
-
id: CONFIGURE_INSTRUCTIONS_ACTION_ID,
|
|
24
|
-
title: ( localize2(8860, "Configure Instructions & Rules...")),
|
|
25
|
-
shortTitle: ( localize2(8861, "Instructions & Rules")),
|
|
26
|
-
icon: Codicon.bookmark,
|
|
27
|
-
f1: true,
|
|
28
|
-
precondition: ChatContextKeys.enabled,
|
|
29
|
-
category: CHAT_CATEGORY
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
async run(accessor) {
|
|
33
|
-
const openerService = accessor.get(IOpenerService);
|
|
34
|
-
const instaService = accessor.get(IInstantiationService);
|
|
35
|
-
const pickers = instaService.createInstance(PromptFilePickers);
|
|
36
|
-
const placeholder = ( localize(8862, "Select the instructions file to open"));
|
|
37
|
-
const result = await pickers.selectPromptFile({
|
|
38
|
-
placeholder,
|
|
39
|
-
type: PromptsType.instructions,
|
|
40
|
-
optionEdit: false
|
|
41
|
-
});
|
|
42
|
-
if (result !== undefined) {
|
|
43
|
-
await openerService.open(result.promptFile);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function registerAttachPromptActions() {
|
|
48
|
-
registerAction2(ManageInstructionsFilesAction);
|
|
49
|
-
}
|
|
50
|
-
let ChatInstructionsPickerPick = class ChatInstructionsPickerPick {
|
|
51
|
-
constructor(promptsService) {
|
|
52
|
-
this.promptsService = promptsService;
|
|
53
|
-
this.type = "pickerPick";
|
|
54
|
-
this.label = ( localize(8863, "Instructions..."));
|
|
55
|
-
this.icon = Codicon.bookmark;
|
|
56
|
-
this.commandId = ATTACH_INSTRUCTIONS_ACTION_ID;
|
|
57
|
-
}
|
|
58
|
-
isEnabled(widget) {
|
|
59
|
-
return !!widget.attachmentCapabilities.supportsInstructionAttachments;
|
|
60
|
-
}
|
|
61
|
-
asPicker() {
|
|
62
|
-
const picks = this.promptsService.listPromptFiles(PromptsType.instructions, CancellationToken.None).then(value => {
|
|
63
|
-
const result = [];
|
|
64
|
-
value = value.slice(0).sort((a, b) => compare(a.storage, b.storage));
|
|
65
|
-
let storageType;
|
|
66
|
-
for (const promptsPath of value) {
|
|
67
|
-
if (storageType !== promptsPath.storage) {
|
|
68
|
-
storageType = promptsPath.storage;
|
|
69
|
-
result.push({
|
|
70
|
-
type: "separator",
|
|
71
|
-
label: this.promptsService.getPromptLocationLabel(promptsPath)
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
result.push({
|
|
75
|
-
label: promptsPath.name ?? getCleanPromptName(promptsPath.uri),
|
|
76
|
-
asAttachment: () => {
|
|
77
|
-
return toPromptFileVariableEntry(promptsPath.uri, PromptFileVariableKind.Instruction);
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
return result;
|
|
82
|
-
});
|
|
83
|
-
return {
|
|
84
|
-
placeholder: ( localize(8864, "Select instructions files to attach")),
|
|
85
|
-
picks,
|
|
86
|
-
configure: {
|
|
87
|
-
label: ( localize(8865, "Configure Instructions...")),
|
|
88
|
-
commandId: CONFIGURE_INSTRUCTIONS_ACTION_ID
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
ChatInstructionsPickerPick = ( __decorate([( __param(0, IPromptsService))], ChatInstructionsPickerPick));
|
|
94
|
-
|
|
95
|
-
export { ATTACH_INSTRUCTIONS_ACTION_ID, CONFIGURE_INSTRUCTIONS_ACTION_ID, ChatInstructionsPickerPick, registerAttachPromptActions };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
2
|
-
import { ICodeEditor } from "@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorBrowser";
|
|
3
|
-
import { PromptsStorage } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService";
|
|
4
|
-
/**
|
|
5
|
-
* Options to override the default folder-picker and editor-open behaviour
|
|
6
|
-
* of the new-prompt-file actions. The agentic editor passes these to open
|
|
7
|
-
* files in the embedded editor and pre-resolve the target folder.
|
|
8
|
-
*/
|
|
9
|
-
export interface INewPromptOptions {
|
|
10
|
-
readonly targetFolder?: URI;
|
|
11
|
-
readonly targetStorage?: PromptsStorage;
|
|
12
|
-
readonly openFile?: (uri: URI) => Promise<ICodeEditor | undefined>;
|
|
13
|
-
/**
|
|
14
|
-
* Override the file extension (e.g. `.md` for Claude rules instead of
|
|
15
|
-
* `.instructions.md`). When set, the name picker uses this extension
|
|
16
|
-
* instead of the default for the prompt type.
|
|
17
|
-
*/
|
|
18
|
-
readonly fileExtension?: string;
|
|
19
|
-
}
|
|
20
|
-
export declare const NEW_PROMPT_COMMAND_ID = "workbench.command.new.prompt";
|
|
21
|
-
export declare const NEW_INSTRUCTIONS_COMMAND_ID = "workbench.command.new.instructions";
|
|
22
|
-
export declare const NEW_AGENT_COMMAND_ID = "workbench.command.new.agent";
|
|
23
|
-
export declare const NEW_SKILL_COMMAND_ID = "workbench.command.new.skill";
|
|
24
|
-
export declare function registerNewPromptFileActions(): void;
|