@codingame/monaco-vscode-xterm-addons-common 36.2.7 → 37.1.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 +10 -10
- package/vscode/src/vs/base/browser/htmlToMarkdown.js +24 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContext.d.ts +27 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContext.js +158 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/attachInstructionsAction.js +8 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/newPromptFileActions.js +15 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptName.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptSourceFolder.js +30 -29
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/promptFilePickers.js +42 -38
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatPasteProviders.d.ts +22 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatPasteProviders.js +254 -132
- package/vscode/src/vs/workbench/contrib/git/common/utils.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/git/common/utils.js +105 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/decorationAddon.d.ts +1 -2
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/decorationAddon.js +24 -21
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/markNavigationAddon.js +1 -11
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.d.ts +16 -1
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.js +75 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/copilotCliEventsUri.d.ts +0 -82
- package/vscode/src/vs/workbench/contrib/chat/browser/copilotCliEventsUri.js +0 -114
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-xterm-addons-common",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "37.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "VSCode public API plugged on the monaco editor - common package depending on xterm addons",
|
|
6
6
|
"keywords": [],
|
|
@@ -15,15 +15,15 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@codingame/monaco-vscode-api": "
|
|
19
|
-
"@xterm/addon-clipboard": "0.3.0-beta.
|
|
20
|
-
"@xterm/addon-image": "0.10.0-beta.
|
|
21
|
-
"@xterm/addon-ligatures": "0.11.0-beta.
|
|
22
|
-
"@xterm/addon-progress": "0.3.0-beta.
|
|
23
|
-
"@xterm/addon-search": "0.17.0-beta.
|
|
24
|
-
"@xterm/addon-serialize": "0.15.0-beta.
|
|
25
|
-
"@xterm/addon-unicode11": "0.10.0-beta.
|
|
26
|
-
"@xterm/addon-webgl": "0.20.0-beta.
|
|
18
|
+
"@codingame/monaco-vscode-api": "37.1.0",
|
|
19
|
+
"@xterm/addon-clipboard": "0.3.0-beta.303",
|
|
20
|
+
"@xterm/addon-image": "0.10.0-beta.301",
|
|
21
|
+
"@xterm/addon-ligatures": "0.11.0-beta.301",
|
|
22
|
+
"@xterm/addon-progress": "0.3.0-beta.301",
|
|
23
|
+
"@xterm/addon-search": "0.17.0-beta.301",
|
|
24
|
+
"@xterm/addon-serialize": "0.15.0-beta.301",
|
|
25
|
+
"@xterm/addon-unicode11": "0.10.0-beta.301",
|
|
26
|
+
"@xterm/addon-webgl": "0.20.0-beta.300"
|
|
27
27
|
},
|
|
28
28
|
"exports": {
|
|
29
29
|
".": {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
|
|
2
|
+
import { isPortableMarkdownTarget, appendEscapedMarkdownInlineCode } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
|
|
2
3
|
import { createTrustedTypesPolicy } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/trustedTypes';
|
|
3
4
|
|
|
4
5
|
const maxInputLength = 200_000;
|
|
@@ -45,7 +46,7 @@ function convertNode(node) {
|
|
|
45
46
|
return `\n\`\`\`\n${text.replace(/^\n+|\n+$/g, "")}\n\`\`\`\n`;
|
|
46
47
|
}
|
|
47
48
|
case "code":
|
|
48
|
-
return
|
|
49
|
+
return appendEscapedMarkdownInlineCode(el.textContent ?? "");
|
|
49
50
|
case "blockquote":
|
|
50
51
|
{
|
|
51
52
|
const inner = convertChildren(el).trim();
|
|
@@ -86,13 +87,19 @@ function convertNode(node) {
|
|
|
86
87
|
return "\n---\n";
|
|
87
88
|
case "a":
|
|
88
89
|
{
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
return sanitizeLink(
|
|
91
|
+
linkTargetOf(el),
|
|
92
|
+
convertChildren(el).trim(),
|
|
93
|
+
(el.textContent ?? "").trim()
|
|
94
|
+
);
|
|
91
95
|
}
|
|
92
96
|
case "img":
|
|
93
97
|
{
|
|
94
98
|
const src = el.getAttribute("src") ?? "";
|
|
95
99
|
const alt = el.getAttribute("alt") ?? "";
|
|
100
|
+
if (!isPortableMarkdownTarget(src)) {
|
|
101
|
+
return alt ? appendEscapedMarkdownInlineCode(alt) : "";
|
|
102
|
+
}
|
|
96
103
|
return ``;
|
|
97
104
|
}
|
|
98
105
|
case "strong":
|
|
@@ -116,11 +123,22 @@ function convertChildren(node) {
|
|
|
116
123
|
}
|
|
117
124
|
return result;
|
|
118
125
|
}
|
|
119
|
-
function
|
|
120
|
-
|
|
126
|
+
function linkTargetOf(el) {
|
|
127
|
+
const href = (el.getAttribute("href") ?? "").trim();
|
|
128
|
+
if (href && isPortableMarkdownTarget(href)) {
|
|
129
|
+
return href;
|
|
130
|
+
}
|
|
131
|
+
return (el.getAttribute("data-href") ?? "").trim() || href;
|
|
132
|
+
}
|
|
133
|
+
function sanitizeLink(href, text, plainText) {
|
|
134
|
+
const target = href.trim();
|
|
135
|
+
if (/^(javascript|vbscript|data):/i.test(target)) {
|
|
121
136
|
return text;
|
|
122
137
|
}
|
|
123
|
-
|
|
138
|
+
if (!target || !isPortableMarkdownTarget(target)) {
|
|
139
|
+
return plainText ? appendEscapedMarkdownInlineCode(plainText) : "";
|
|
140
|
+
}
|
|
141
|
+
return `[${text}](${target})`;
|
|
124
142
|
}
|
|
125
143
|
|
|
126
144
|
export { convertHtmlToMarkdown };
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
2
|
import { ThemeIcon } from "@codingame/monaco-vscode-api/vscode/vs/base/common/themables";
|
|
3
|
+
import { ICommandService } from "@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service";
|
|
3
4
|
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
5
|
+
import { IQuickPickItem } from "@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput";
|
|
6
|
+
import { IQuickInputService } from "@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput.service";
|
|
4
7
|
import { IWorkbenchContribution } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/contributions";
|
|
5
8
|
import { IChatContextValueItem } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/attachments/chatContextPickService";
|
|
6
9
|
import { IChatContextPickService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/attachments/chatContextPickService.service";
|
|
@@ -8,6 +11,12 @@ import { IChatRequestVariableEntry } from "@codingame/monaco-vscode-api/vscode/v
|
|
|
8
11
|
import { IChatWidget } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat";
|
|
9
12
|
import { ITerminalService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal.service";
|
|
10
13
|
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
14
|
+
import { IGitService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/git/common/gitService.service";
|
|
15
|
+
import { IWorkspaceContextService } from "@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service";
|
|
16
|
+
interface IGitHubRepositoryPick extends IQuickPickItem {
|
|
17
|
+
readonly repoId?: string;
|
|
18
|
+
readonly folderUri?: URI;
|
|
19
|
+
}
|
|
11
20
|
/**
|
|
12
21
|
* Command ID that extensions can call to enable debug tools for the current
|
|
13
22
|
* chat session. Sets the context key and immediately flushes tool updates so
|
|
@@ -19,6 +28,23 @@ export declare class ChatContextContributions extends Disposable implements IWor
|
|
|
19
28
|
static readonly ID = "chat.contextContributions";
|
|
20
29
|
constructor(instantiationService: IInstantiationService, contextPickService: IChatContextPickService);
|
|
21
30
|
}
|
|
31
|
+
export declare class GitHubContextValuePick implements IChatContextValueItem {
|
|
32
|
+
private readonly gitService;
|
|
33
|
+
private readonly quickInputService;
|
|
34
|
+
private readonly commandService;
|
|
35
|
+
private readonly workspaceContextService;
|
|
36
|
+
readonly type = "valuePick";
|
|
37
|
+
readonly label: string;
|
|
38
|
+
readonly icon: ThemeIcon;
|
|
39
|
+
readonly ordinal = -450;
|
|
40
|
+
private readonly _commandId;
|
|
41
|
+
constructor(kind: "issue" | "pullRequest", gitService: IGitService, quickInputService: IQuickInputService, commandService: ICommandService, workspaceContextService: IWorkspaceContextService);
|
|
42
|
+
isEnabled(): boolean;
|
|
43
|
+
asAttachment(): Promise<IChatRequestVariableEntry | undefined>;
|
|
44
|
+
protected pickRepository(repositories: readonly IGitHubRepositoryPick[]): Promise<IGitHubRepositoryPick | undefined>;
|
|
45
|
+
private getRepositoryPicks;
|
|
46
|
+
private getRepositoryId;
|
|
47
|
+
}
|
|
22
48
|
export declare class TerminalContext implements IChatContextValueItem {
|
|
23
49
|
private readonly _resource;
|
|
24
50
|
private readonly _terminalService;
|
|
@@ -30,3 +56,4 @@ export declare class TerminalContext implements IChatContextValueItem {
|
|
|
30
56
|
asAttachment(widget: IChatWidget): Promise<IChatRequestVariableEntry | undefined>;
|
|
31
57
|
private asValue;
|
|
32
58
|
}
|
|
59
|
+
export {};
|
|
@@ -8,8 +8,10 @@ import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
|
8
8
|
import { agentHostAuthority } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentHostUri';
|
|
9
9
|
import { IRemoteAgentHostService } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/remoteAgentHostService.service';
|
|
10
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';
|
|
11
12
|
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
12
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';
|
|
13
15
|
import { EditorResourceAccessor, SideBySideEditor } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor';
|
|
14
16
|
import { DiffEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor/diffEditorInput';
|
|
15
17
|
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
@@ -29,11 +31,18 @@ import { isAgentHostTarget } from '@codingame/monaco-vscode-api/vscode/vs/workbe
|
|
|
29
31
|
import { IChatSessionsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService.service';
|
|
30
32
|
import { AgentSessionProviders, getAgentSessionProviderIcon } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessions';
|
|
31
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';
|
|
32
35
|
import { TerminalCapability } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/capabilities/capabilities';
|
|
33
36
|
import { getChatSessionType } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatUri';
|
|
34
|
-
import { buildHostLocalEventsPath } from '
|
|
37
|
+
import { buildHostLocalEventsPath } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/copilotCliEventsUri';
|
|
35
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';
|
|
36
43
|
|
|
44
|
+
const OPEN_GITHUB_ISSUE_COMMAND = "github.copilot.chat.cloudSessions.openIssue";
|
|
45
|
+
const OPEN_GITHUB_PULL_REQUEST_COMMAND = "github.copilot.chat.cloudSessions.openPullRequest";
|
|
37
46
|
function shouldShowOpenEditorsContext(widget, hasEligibleOpenEditors) {
|
|
38
47
|
if (!hasEligibleOpenEditors) {
|
|
39
48
|
return false;
|
|
@@ -71,13 +80,131 @@ let ChatContextContributions = class ChatContextContributions extends Disposable
|
|
|
71
80
|
this._store.add(
|
|
72
81
|
contextPickService.registerChatContextItem(instantiationService.createInstance(SessionReferenceContextPickerPick))
|
|
73
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
|
+
);
|
|
74
89
|
}
|
|
75
90
|
};
|
|
76
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));
|
|
77
204
|
class ToolsContextPickerPick {
|
|
78
205
|
constructor() {
|
|
79
206
|
this.type = "pickerPick";
|
|
80
|
-
this.label = ( localize(
|
|
207
|
+
this.label = ( localize(5644, "Tools..."));
|
|
81
208
|
this.icon = Codicon.tools;
|
|
82
209
|
this.ordinal = -500;
|
|
83
210
|
}
|
|
@@ -128,7 +255,7 @@ class ToolsContextPickerPick {
|
|
|
128
255
|
picks.push(item);
|
|
129
256
|
}
|
|
130
257
|
return {
|
|
131
|
-
placeholder: ( localize(
|
|
258
|
+
placeholder: ( localize(5645, "Select a tool")),
|
|
132
259
|
picks: Promise.resolve(picks)
|
|
133
260
|
};
|
|
134
261
|
}
|
|
@@ -138,7 +265,7 @@ let OpenEditorContextValuePick = class OpenEditorContextValuePick {
|
|
|
138
265
|
this._editorService = _editorService;
|
|
139
266
|
this._labelService = _labelService;
|
|
140
267
|
this.type = "valuePick";
|
|
141
|
-
this.label = ( localize(
|
|
268
|
+
this.label = ( localize(5646, "Open Editors"));
|
|
142
269
|
this.icon = Codicon.file;
|
|
143
270
|
this.ordinal = 800;
|
|
144
271
|
}
|
|
@@ -175,7 +302,7 @@ let ClipboardImageContextValuePick = class ClipboardImageContextValuePick {
|
|
|
175
302
|
constructor(_clipboardService) {
|
|
176
303
|
this._clipboardService = _clipboardService;
|
|
177
304
|
this.type = "valuePick";
|
|
178
|
-
this.label = ( localize(
|
|
305
|
+
this.label = ( localize(5647, "Image from Clipboard"));
|
|
179
306
|
this.icon = Codicon.fileMedia;
|
|
180
307
|
}
|
|
181
308
|
async isEnabled(widget) {
|
|
@@ -192,8 +319,8 @@ let ClipboardImageContextValuePick = class ClipboardImageContextValuePick {
|
|
|
192
319
|
const fileBuffer = await this._clipboardService.readImage();
|
|
193
320
|
return {
|
|
194
321
|
id: await imageToHash(fileBuffer),
|
|
195
|
-
name: ( localize(
|
|
196
|
-
fullName: ( localize(
|
|
322
|
+
name: ( localize(5648, "Pasted Image")),
|
|
323
|
+
fullName: ( localize(5648, "Pasted Image")),
|
|
197
324
|
value: fileBuffer,
|
|
198
325
|
kind: "image"
|
|
199
326
|
};
|
|
@@ -206,7 +333,7 @@ let TerminalContext = class TerminalContext {
|
|
|
206
333
|
this._terminalService = _terminalService;
|
|
207
334
|
this.type = "valuePick";
|
|
208
335
|
this.icon = Codicon.terminal;
|
|
209
|
-
this.label = ( localize(
|
|
336
|
+
this.label = ( localize(5649, "Terminal"));
|
|
210
337
|
}
|
|
211
338
|
isEnabled(widget) {
|
|
212
339
|
const terminal = this._terminalService.getInstanceFromResource(this._resource);
|
|
@@ -271,7 +398,7 @@ let ScreenshotContextValuePick = class ScreenshotContextValuePick {
|
|
|
271
398
|
this._hostService = _hostService;
|
|
272
399
|
this.type = "valuePick";
|
|
273
400
|
this.icon = Codicon.deviceCamera;
|
|
274
|
-
this.label = (isElectron ? ( localize(
|
|
401
|
+
this.label = (isElectron ? ( localize(5650, "Screenshot Window")) : ( localize(5651, "Screenshot")));
|
|
275
402
|
}
|
|
276
403
|
async isEnabled(widget) {
|
|
277
404
|
return !!widget.attachmentCapabilities.supportsImageAttachments && !!widget.input.selectedLanguageModel.get()?.metadata.capabilities?.vision;
|
|
@@ -289,7 +416,7 @@ let SessionReferenceContextPickerPick = class SessionReferenceContextPickerPick
|
|
|
289
416
|
this._remoteAgentHostService = _remoteAgentHostService;
|
|
290
417
|
this.type = "pickerPick";
|
|
291
418
|
this.icon = Codicon.comment;
|
|
292
|
-
this.label = ( localize(
|
|
419
|
+
this.label = ( localize(5652, "Sessions..."));
|
|
293
420
|
this.ordinal = -400;
|
|
294
421
|
}
|
|
295
422
|
isEnabled(widget) {
|
|
@@ -299,13 +426,12 @@ let SessionReferenceContextPickerPick = class SessionReferenceContextPickerPick
|
|
|
299
426
|
const currentSessionResource = widget.viewModel?.sessionResource;
|
|
300
427
|
const onlyShowAttachableCopilotCliSessions = !!currentSessionResource && isAgentHostTarget(getChatSessionType(currentSessionResource));
|
|
301
428
|
return {
|
|
302
|
-
placeholder: ( localize(
|
|
429
|
+
placeholder: ( localize(5653, "Select a session")),
|
|
303
430
|
picks: (async () => {
|
|
304
431
|
const picks = [];
|
|
305
432
|
const sessionProviderFilter = [
|
|
306
433
|
AgentSessionProviders.Local,
|
|
307
434
|
AgentSessionProviders.Background,
|
|
308
|
-
AgentSessionProviders.Claude,
|
|
309
435
|
AgentSessionProviders.AgentHostCopilot
|
|
310
436
|
];
|
|
311
437
|
for await (const group of this._chatSessionsService.getChatSessionItems(sessionProviderFilter, CancellationToken.None)) {
|
|
@@ -319,21 +445,29 @@ let SessionReferenceContextPickerPick = class SessionReferenceContextPickerPick
|
|
|
319
445
|
continue;
|
|
320
446
|
}
|
|
321
447
|
const icon = item.iconPath ?? providerIcon;
|
|
448
|
+
const lastActivity = item.timing.lastRequestEnded ?? item.timing.created;
|
|
322
449
|
picks.push({
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
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
|
+
}
|
|
332
462
|
});
|
|
333
463
|
}
|
|
334
464
|
}
|
|
335
|
-
picks.sort((a, b) =>
|
|
336
|
-
return picks
|
|
465
|
+
picks.sort((a, b) => b.lastActivity - a.lastActivity);
|
|
466
|
+
return ( picks.map((
|
|
467
|
+
{
|
|
468
|
+
pick
|
|
469
|
+
}
|
|
470
|
+
) => pick));
|
|
337
471
|
})()
|
|
338
472
|
};
|
|
339
473
|
}
|
|
@@ -345,4 +479,4 @@ let SessionReferenceContextPickerPick = class SessionReferenceContextPickerPick
|
|
|
345
479
|
};
|
|
346
480
|
SessionReferenceContextPickerPick = ( __decorate([( __param(0, IChatSessionsService)), ( __param(1, IPathService)), ( __param(2, IRemoteAgentHostService))], SessionReferenceContextPickerPick));
|
|
347
481
|
|
|
348
|
-
export { ChatContextContributions, TerminalContext, shouldShowOpenEditorsContext };
|
|
482
|
+
export { ChatContextContributions, GitHubContextValuePick, TerminalContext, shouldShowOpenEditorsContext };
|
package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/attachInstructionsAction.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
-
import {
|
|
4
|
-
import { CHAT_CONFIG_MENU_ID, CHAT_CATEGORY } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
|
|
3
|
+
import { CHAT_CATEGORY } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
|
|
5
4
|
import { localize2, localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
6
5
|
import { ChatContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/actions/chatContextKeys';
|
|
7
6
|
import { IPromptsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.service';
|
|
@@ -10,7 +9,6 @@ import { Action2, registerAction2 } from '@codingame/monaco-vscode-api/vscode/vs
|
|
|
10
9
|
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
11
10
|
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
12
11
|
import { getCleanPromptName } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/config/promptFileLocations';
|
|
13
|
-
import { ContextKeyExpr } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey';
|
|
14
12
|
import { PromptsType } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/promptTypes';
|
|
15
13
|
import { compare } from '@codingame/monaco-vscode-api/vscode/vs/base/common/strings';
|
|
16
14
|
import { toPromptFileVariableEntry, PromptFileVariableKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/attachments/chatVariableEntries';
|
|
@@ -23,25 +21,19 @@ class ManageInstructionsFilesAction extends Action2 {
|
|
|
23
21
|
constructor() {
|
|
24
22
|
super({
|
|
25
23
|
id: CONFIGURE_INSTRUCTIONS_ACTION_ID,
|
|
26
|
-
title: ( localize2(
|
|
27
|
-
shortTitle: ( localize2(
|
|
24
|
+
title: ( localize2(8860, "Configure Instructions & Rules...")),
|
|
25
|
+
shortTitle: ( localize2(8861, "Instructions & Rules")),
|
|
28
26
|
icon: Codicon.bookmark,
|
|
29
27
|
f1: true,
|
|
30
28
|
precondition: ChatContextKeys.enabled,
|
|
31
|
-
category: CHAT_CATEGORY
|
|
32
|
-
menu: {
|
|
33
|
-
id: CHAT_CONFIG_MENU_ID,
|
|
34
|
-
when: ( ContextKeyExpr.and(ChatContextKeys.enabled, ( ContextKeyExpr.equals("view", ChatViewId)))),
|
|
35
|
-
order: 10,
|
|
36
|
-
group: "1_level"
|
|
37
|
-
}
|
|
29
|
+
category: CHAT_CATEGORY
|
|
38
30
|
});
|
|
39
31
|
}
|
|
40
32
|
async run(accessor) {
|
|
41
33
|
const openerService = accessor.get(IOpenerService);
|
|
42
34
|
const instaService = accessor.get(IInstantiationService);
|
|
43
35
|
const pickers = instaService.createInstance(PromptFilePickers);
|
|
44
|
-
const placeholder = ( localize(
|
|
36
|
+
const placeholder = ( localize(8862, "Select the instructions file to open"));
|
|
45
37
|
const result = await pickers.selectPromptFile({
|
|
46
38
|
placeholder,
|
|
47
39
|
type: PromptsType.instructions,
|
|
@@ -59,7 +51,7 @@ let ChatInstructionsPickerPick = class ChatInstructionsPickerPick {
|
|
|
59
51
|
constructor(promptsService) {
|
|
60
52
|
this.promptsService = promptsService;
|
|
61
53
|
this.type = "pickerPick";
|
|
62
|
-
this.label = ( localize(
|
|
54
|
+
this.label = ( localize(8863, "Instructions..."));
|
|
63
55
|
this.icon = Codicon.bookmark;
|
|
64
56
|
this.commandId = ATTACH_INSTRUCTIONS_ACTION_ID;
|
|
65
57
|
}
|
|
@@ -89,10 +81,10 @@ let ChatInstructionsPickerPick = class ChatInstructionsPickerPick {
|
|
|
89
81
|
return result;
|
|
90
82
|
});
|
|
91
83
|
return {
|
|
92
|
-
placeholder: ( localize(
|
|
84
|
+
placeholder: ( localize(8864, "Select instructions files to attach")),
|
|
93
85
|
picks,
|
|
94
86
|
configure: {
|
|
95
|
-
label: ( localize(
|
|
87
|
+
label: ( localize(8865, "Configure Instructions...")),
|
|
96
88
|
commandId: CONFIGURE_INSTRUCTIONS_ACTION_ID
|
|
97
89
|
}
|
|
98
90
|
};
|
|
@@ -104,17 +104,17 @@ class AbstractNewPromptFileAction extends Action2 {
|
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
106
106
|
notificationService.prompt(Severity.Info, ( localize(
|
|
107
|
-
|
|
107
|
+
8896,
|
|
108
108
|
"Do you want to backup and sync your user prompt, instruction and custom agent files with Setting Sync?'"
|
|
109
109
|
)), [{
|
|
110
|
-
label: ( localize(
|
|
110
|
+
label: ( localize(8897, "Enable")),
|
|
111
111
|
run: () => {
|
|
112
112
|
commandService.executeCommand(CONFIGURE_SYNC_COMMAND_ID).catch(error => {
|
|
113
113
|
logService.error(`Failed to run '${CONFIGURE_SYNC_COMMAND_ID}' command: ${error}.`);
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
116
|
}, {
|
|
117
|
-
label: ( localize(
|
|
117
|
+
label: ( localize(8898, "Learn More")),
|
|
118
118
|
run: () => {
|
|
119
119
|
openerService.open(( URI.parse("https://aka.ms/vscode-settings-sync-help")));
|
|
120
120
|
}
|
|
@@ -212,24 +212,24 @@ const NEW_AGENT_COMMAND_ID = "workbench.command.new.agent";
|
|
|
212
212
|
const NEW_SKILL_COMMAND_ID = "workbench.command.new.skill";
|
|
213
213
|
class NewPromptFileAction extends AbstractNewPromptFileAction {
|
|
214
214
|
constructor() {
|
|
215
|
-
super(NEW_PROMPT_COMMAND_ID, ( localize(
|
|
215
|
+
super(NEW_PROMPT_COMMAND_ID, ( localize(8899, "New Prompt File...")), PromptsType.prompt);
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
218
|
class NewInstructionsFileAction extends AbstractNewPromptFileAction {
|
|
219
219
|
constructor() {
|
|
220
|
-
super(NEW_INSTRUCTIONS_COMMAND_ID, ( localize(
|
|
220
|
+
super(NEW_INSTRUCTIONS_COMMAND_ID, ( localize(8900, "New Instructions File...")), PromptsType.instructions);
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
class NewAgentFileAction extends AbstractNewPromptFileAction {
|
|
224
224
|
constructor() {
|
|
225
|
-
super(NEW_AGENT_COMMAND_ID, ( localize(
|
|
225
|
+
super(NEW_AGENT_COMMAND_ID, ( localize(8901, "New Custom Agent...")), PromptsType.agent);
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
228
|
class NewSkillFileAction extends Action2 {
|
|
229
229
|
constructor() {
|
|
230
230
|
super({
|
|
231
231
|
id: NEW_SKILL_COMMAND_ID,
|
|
232
|
-
title: ( localize(
|
|
232
|
+
title: ( localize(8902, "New Skill File...")),
|
|
233
233
|
f1: false,
|
|
234
234
|
precondition: ChatContextKeys.enabled,
|
|
235
235
|
category: CHAT_CATEGORY,
|
|
@@ -260,29 +260,29 @@ class NewSkillFileAction extends Action2 {
|
|
|
260
260
|
}
|
|
261
261
|
const skillName = await quickInputService.input({
|
|
262
262
|
prompt: ( localize(
|
|
263
|
-
|
|
263
|
+
8903,
|
|
264
264
|
"Enter a name for the skill (lowercase letters, numbers, and hyphens only)"
|
|
265
265
|
)),
|
|
266
|
-
placeHolder: ( localize(
|
|
266
|
+
placeHolder: ( localize(8904, "e.g., pdf-processing, data-analysis")),
|
|
267
267
|
validateInput: async value => {
|
|
268
268
|
if (!value || !value.trim()) {
|
|
269
|
-
return localize(
|
|
269
|
+
return localize(8905, "Skill name is required");
|
|
270
270
|
}
|
|
271
271
|
const name = value.trim();
|
|
272
272
|
if (name.length > 64) {
|
|
273
|
-
return localize(
|
|
273
|
+
return localize(8906, "Skill name must be 64 characters or less");
|
|
274
274
|
}
|
|
275
275
|
if (!VALID_SKILL_NAME_REGEX.test(name)) {
|
|
276
276
|
return localize(
|
|
277
|
-
|
|
277
|
+
8907,
|
|
278
278
|
"Skill name may only contain lowercase letters, numbers, and hyphens"
|
|
279
279
|
);
|
|
280
280
|
}
|
|
281
281
|
if (name.startsWith("-") || name.endsWith("-")) {
|
|
282
|
-
return localize(
|
|
282
|
+
return localize(8908, "Skill name must not start or end with a hyphen");
|
|
283
283
|
}
|
|
284
284
|
if (name.includes("--")) {
|
|
285
|
-
return localize(
|
|
285
|
+
return localize(8909, "Skill name must not contain consecutive hyphens");
|
|
286
286
|
}
|
|
287
287
|
return undefined;
|
|
288
288
|
}
|
|
@@ -314,7 +314,7 @@ class NewUntitledPromptFileAction extends Action2 {
|
|
|
314
314
|
constructor() {
|
|
315
315
|
super({
|
|
316
316
|
id: "workbench.command.new.untitled.prompt",
|
|
317
|
-
title: ( localize2(
|
|
317
|
+
title: ( localize2(8910, "New Untitled Prompt File")),
|
|
318
318
|
f1: true,
|
|
319
319
|
precondition: ChatContextKeys.enabled,
|
|
320
320
|
category: CHAT_CATEGORY,
|
package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptName.js
CHANGED
|
@@ -23,20 +23,20 @@ async function askForPromptFileName(accessor, type, selectedFolder, existingFile
|
|
|
23
23
|
const fileName = sanitizeInput(value);
|
|
24
24
|
if (!fileName) {
|
|
25
25
|
return {
|
|
26
|
-
content: ( localize(
|
|
26
|
+
content: ( localize(8911, "Please enter a name.")),
|
|
27
27
|
severity: Severity.Warning
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
if (!isValidBasename(fileName)) {
|
|
31
31
|
return {
|
|
32
|
-
content: ( localize(
|
|
32
|
+
content: ( localize(8912, "The name contains invalid characters.")),
|
|
33
33
|
severity: Severity.Error
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
const fileUri = URI.joinPath(selectedFolder, fileName);
|
|
37
37
|
if (await fileService.exists(fileUri)) {
|
|
38
38
|
return {
|
|
39
|
-
content: ( localize(
|
|
39
|
+
content: ( localize(8913, "A file for the given name already exists.")),
|
|
40
40
|
severity: Severity.Error
|
|
41
41
|
};
|
|
42
42
|
}
|
|
@@ -56,11 +56,11 @@ async function askForPromptFileName(accessor, type, selectedFolder, existingFile
|
|
|
56
56
|
function getPlaceholderStringForNew(type) {
|
|
57
57
|
switch (type) {
|
|
58
58
|
case PromptsType.instructions:
|
|
59
|
-
return localize(
|
|
59
|
+
return localize(8914, "Enter the name of the instructions file");
|
|
60
60
|
case PromptsType.prompt:
|
|
61
|
-
return localize(
|
|
61
|
+
return localize(8915, "Enter the name of the prompt file");
|
|
62
62
|
case PromptsType.agent:
|
|
63
|
-
return localize(
|
|
63
|
+
return localize(8916, "Enter the name of the agent file");
|
|
64
64
|
default:
|
|
65
65
|
throw ( new Error("Unknown prompt type"));
|
|
66
66
|
}
|
|
@@ -68,11 +68,11 @@ function getPlaceholderStringForNew(type) {
|
|
|
68
68
|
function getPlaceholderStringForRename(type) {
|
|
69
69
|
switch (type) {
|
|
70
70
|
case PromptsType.instructions:
|
|
71
|
-
return localize(
|
|
71
|
+
return localize(8917, "Enter a new name of the instructions file");
|
|
72
72
|
case PromptsType.prompt:
|
|
73
|
-
return localize(
|
|
73
|
+
return localize(8918, "Enter a new name of the prompt file");
|
|
74
74
|
case PromptsType.agent:
|
|
75
|
-
return localize(
|
|
75
|
+
return localize(8919, "Enter a new name of the agent file");
|
|
76
76
|
default:
|
|
77
77
|
throw ( new Error("Unknown prompt type"));
|
|
78
78
|
}
|