@codingame/monaco-vscode-xterm-addons-common 26.2.2 → 27.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +10 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContext.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/attachInstructionsAction.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/attachInstructionsAction.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/newPromptFileActions.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/newPromptFileActions.js +77 -34
- 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 +25 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/promptFilePickers.js +87 -32
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatPasteProviders.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.js +316 -193
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/decorationAddon.js +16 -16
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.js +28 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatDynamicVariables.d.ts +0 -42
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatDynamicVariables.js +0 -209
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-xterm-addons-common",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "27.0.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": "27.0.0",
|
|
19
|
+
"@xterm/addon-clipboard": "0.3.0-beta.168",
|
|
20
|
+
"@xterm/addon-image": "0.10.0-beta.168",
|
|
21
|
+
"@xterm/addon-ligatures": "0.11.0-beta.168",
|
|
22
|
+
"@xterm/addon-progress": "0.3.0-beta.168",
|
|
23
|
+
"@xterm/addon-search": "0.17.0-beta.168",
|
|
24
|
+
"@xterm/addon-serialize": "0.15.0-beta.168",
|
|
25
|
+
"@xterm/addon-unicode11": "0.10.0-beta.168",
|
|
26
|
+
"@xterm/addon-webgl": "0.20.0-beta.167"
|
|
27
27
|
},
|
|
28
28
|
"exports": {
|
|
29
29
|
".": {
|
|
@@ -51,7 +51,7 @@ ChatContextContributions = ( __decorate([( __param(0, IInstantiationService)), (
|
|
|
51
51
|
class ToolsContextPickerPick {
|
|
52
52
|
constructor() {
|
|
53
53
|
this.type = "pickerPick";
|
|
54
|
-
this.label = ( localize(
|
|
54
|
+
this.label = ( localize(4839, "Tools..."));
|
|
55
55
|
this.icon = Codicon.tools;
|
|
56
56
|
this.ordinal = -500;
|
|
57
57
|
}
|
|
@@ -102,7 +102,7 @@ class ToolsContextPickerPick {
|
|
|
102
102
|
picks.push(item);
|
|
103
103
|
}
|
|
104
104
|
return {
|
|
105
|
-
placeholder: ( localize(
|
|
105
|
+
placeholder: ( localize(4840, "Select a tool")),
|
|
106
106
|
picks: Promise.resolve(picks)
|
|
107
107
|
};
|
|
108
108
|
}
|
|
@@ -112,7 +112,7 @@ let OpenEditorContextValuePick = class OpenEditorContextValuePick {
|
|
|
112
112
|
this._editorService = _editorService;
|
|
113
113
|
this._labelService = _labelService;
|
|
114
114
|
this.type = "valuePick";
|
|
115
|
-
this.label = ( localize(
|
|
115
|
+
this.label = ( localize(4841, "Open Editors"));
|
|
116
116
|
this.icon = Codicon.file;
|
|
117
117
|
this.ordinal = 800;
|
|
118
118
|
}
|
|
@@ -148,7 +148,7 @@ let ClipboardImageContextValuePick = class ClipboardImageContextValuePick {
|
|
|
148
148
|
constructor(_clipboardService) {
|
|
149
149
|
this._clipboardService = _clipboardService;
|
|
150
150
|
this.type = "valuePick";
|
|
151
|
-
this.label = ( localize(
|
|
151
|
+
this.label = ( localize(4842, "Image from Clipboard"));
|
|
152
152
|
this.icon = Codicon.fileMedia;
|
|
153
153
|
}
|
|
154
154
|
async isEnabled(widget) {
|
|
@@ -165,8 +165,8 @@ let ClipboardImageContextValuePick = class ClipboardImageContextValuePick {
|
|
|
165
165
|
const fileBuffer = await this._clipboardService.readImage();
|
|
166
166
|
return {
|
|
167
167
|
id: await imageToHash(fileBuffer),
|
|
168
|
-
name: ( localize(
|
|
169
|
-
fullName: ( localize(
|
|
168
|
+
name: ( localize(4843, "Pasted Image")),
|
|
169
|
+
fullName: ( localize(4843, "Pasted Image")),
|
|
170
170
|
value: fileBuffer,
|
|
171
171
|
kind: "image"
|
|
172
172
|
};
|
|
@@ -179,7 +179,7 @@ let TerminalContext = class TerminalContext {
|
|
|
179
179
|
this._terminalService = _terminalService;
|
|
180
180
|
this.type = "valuePick";
|
|
181
181
|
this.icon = Codicon.terminal;
|
|
182
|
-
this.label = ( localize(
|
|
182
|
+
this.label = ( localize(4844, "Terminal"));
|
|
183
183
|
}
|
|
184
184
|
isEnabled(widget) {
|
|
185
185
|
const terminal = this._terminalService.getInstanceFromResource(this._resource);
|
|
@@ -244,7 +244,7 @@ let ScreenshotContextValuePick = class ScreenshotContextValuePick {
|
|
|
244
244
|
this._hostService = _hostService;
|
|
245
245
|
this.type = "valuePick";
|
|
246
246
|
this.icon = Codicon.deviceCamera;
|
|
247
|
-
this.label = (isElectron ? ( localize(
|
|
247
|
+
this.label = (isElectron ? ( localize(4845, "Screenshot Window")) : ( localize(4846, "Screenshot")));
|
|
248
248
|
}
|
|
249
249
|
async isEnabled(widget) {
|
|
250
250
|
return !!widget.attachmentCapabilities.supportsImageAttachments && !!widget.input.selectedLanguageModel.get()?.metadata.capabilities?.vision;
|
package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/attachInstructionsAction.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { IChatWidget } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat";
|
|
2
2
|
import { IPromptsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.service";
|
|
3
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";
|
|
4
12
|
/**
|
|
5
13
|
* Helper to register the `Attach Prompt` action.
|
|
6
14
|
*/
|
package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/attachInstructionsAction.js
CHANGED
|
@@ -23,8 +23,8 @@ class ManageInstructionsFilesAction extends Action2 {
|
|
|
23
23
|
constructor() {
|
|
24
24
|
super({
|
|
25
25
|
id: CONFIGURE_INSTRUCTIONS_ACTION_ID,
|
|
26
|
-
title: ( localize2(
|
|
27
|
-
shortTitle: ( localize2(
|
|
26
|
+
title: ( localize2(6173, "Configure Instructions & Rules...")),
|
|
27
|
+
shortTitle: ( localize2(6174, "Instructions & Rules")),
|
|
28
28
|
icon: Codicon.bookmark,
|
|
29
29
|
f1: true,
|
|
30
30
|
precondition: ChatContextKeys.enabled,
|
|
@@ -41,7 +41,7 @@ class ManageInstructionsFilesAction extends Action2 {
|
|
|
41
41
|
const openerService = accessor.get(IOpenerService);
|
|
42
42
|
const instaService = accessor.get(IInstantiationService);
|
|
43
43
|
const pickers = instaService.createInstance(PromptFilePickers);
|
|
44
|
-
const placeholder = ( localize(
|
|
44
|
+
const placeholder = ( localize(6175, "Select the instructions file to open"));
|
|
45
45
|
const result = await pickers.selectPromptFile({
|
|
46
46
|
placeholder,
|
|
47
47
|
type: PromptsType.instructions,
|
|
@@ -59,7 +59,7 @@ let ChatInstructionsPickerPick = class ChatInstructionsPickerPick {
|
|
|
59
59
|
constructor(promptsService) {
|
|
60
60
|
this.promptsService = promptsService;
|
|
61
61
|
this.type = "pickerPick";
|
|
62
|
-
this.label = ( localize(
|
|
62
|
+
this.label = ( localize(6176, "Instructions..."));
|
|
63
63
|
this.icon = Codicon.bookmark;
|
|
64
64
|
this.commandId = ATTACH_INSTRUCTIONS_ACTION_ID;
|
|
65
65
|
}
|
|
@@ -89,10 +89,10 @@ let ChatInstructionsPickerPick = class ChatInstructionsPickerPick {
|
|
|
89
89
|
return result;
|
|
90
90
|
});
|
|
91
91
|
return {
|
|
92
|
-
placeholder: ( localize(
|
|
92
|
+
placeholder: ( localize(6177, "Select instructions files to attach")),
|
|
93
93
|
picks,
|
|
94
94
|
configure: {
|
|
95
|
-
label: ( localize(
|
|
95
|
+
label: ( localize(6178, "Configure Instructions...")),
|
|
96
96
|
commandId: CONFIGURE_INSTRUCTIONS_ACTION_ID
|
|
97
97
|
}
|
|
98
98
|
};
|
|
@@ -100,4 +100,4 @@ let ChatInstructionsPickerPick = class ChatInstructionsPickerPick {
|
|
|
100
100
|
};
|
|
101
101
|
ChatInstructionsPickerPick = ( __decorate([( __param(0, IPromptsService))], ChatInstructionsPickerPick));
|
|
102
102
|
|
|
103
|
-
export { ChatInstructionsPickerPick, registerAttachPromptActions };
|
|
103
|
+
export { ATTACH_INSTRUCTIONS_ACTION_ID, CONFIGURE_INSTRUCTIONS_ACTION_ID, ChatInstructionsPickerPick, registerAttachPromptActions };
|
|
@@ -1,3 +1,16 @@
|
|
|
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
|
+
}
|
|
1
14
|
export declare const NEW_PROMPT_COMMAND_ID = "workbench.command.new.prompt";
|
|
2
15
|
export declare const NEW_INSTRUCTIONS_COMMAND_ID = "workbench.command.new.instructions";
|
|
3
16
|
export declare const NEW_AGENT_COMMAND_ID = "workbench.command.new.agent";
|
|
@@ -24,7 +24,7 @@ import { askForPromptFileName } from './pickers/askForPromptName.js';
|
|
|
24
24
|
import { askForPromptSourceFolder } from './pickers/askForPromptSourceFolder.js';
|
|
25
25
|
import { IQuickInputService } from '@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput.service';
|
|
26
26
|
import { getCleanPromptName, SKILL_FILENAME } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/config/promptFileLocations';
|
|
27
|
-
import { Target } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService';
|
|
27
|
+
import { PromptsStorage, Target } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService';
|
|
28
28
|
import { getTarget } from '../../common/promptSyntax/languageProviders/promptValidator.js';
|
|
29
29
|
import Severity from '@codingame/monaco-vscode-api/vscode/vs/base/common/severity';
|
|
30
30
|
|
|
@@ -46,7 +46,7 @@ class AbstractNewPromptFileAction extends Action2 {
|
|
|
46
46
|
});
|
|
47
47
|
this.type = type;
|
|
48
48
|
}
|
|
49
|
-
async run(accessor) {
|
|
49
|
+
async run(accessor, options) {
|
|
50
50
|
const logService = accessor.get(ILogService);
|
|
51
51
|
const openerService = accessor.get(IOpenerService);
|
|
52
52
|
const commandService = accessor.get(ICommandService);
|
|
@@ -55,27 +55,41 @@ class AbstractNewPromptFileAction extends Action2 {
|
|
|
55
55
|
const editorService = accessor.get(IEditorService);
|
|
56
56
|
const fileService = accessor.get(IFileService);
|
|
57
57
|
const instaService = accessor.get(IInstantiationService);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
let folderUri;
|
|
59
|
+
let storage;
|
|
60
|
+
if (options?.targetFolder) {
|
|
61
|
+
folderUri = options.targetFolder;
|
|
62
|
+
storage = options.targetStorage ?? PromptsStorage.local;
|
|
63
|
+
} else {
|
|
64
|
+
const selectedFolder = await instaService.invokeFunction(askForPromptSourceFolder, this.type);
|
|
65
|
+
if (!selectedFolder) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
folderUri = selectedFolder.uri;
|
|
69
|
+
storage = selectedFolder.storage;
|
|
61
70
|
}
|
|
62
|
-
const fileName = await instaService.invokeFunction(askForPromptFileName, this.type,
|
|
71
|
+
const fileName = await instaService.invokeFunction(askForPromptFileName, this.type, folderUri);
|
|
63
72
|
if (!fileName) {
|
|
64
73
|
return;
|
|
65
74
|
}
|
|
66
|
-
await fileService.createFolder(
|
|
67
|
-
const promptUri = URI.joinPath(
|
|
75
|
+
await fileService.createFolder(folderUri);
|
|
76
|
+
const promptUri = URI.joinPath(folderUri, fileName);
|
|
68
77
|
await fileService.createFile(promptUri);
|
|
69
|
-
await openerService.open(promptUri);
|
|
70
78
|
const cleanName = getCleanPromptName(promptUri);
|
|
71
|
-
|
|
79
|
+
let editor;
|
|
80
|
+
if (options?.openFile) {
|
|
81
|
+
editor = await options.openFile(promptUri);
|
|
82
|
+
} else {
|
|
83
|
+
await openerService.open(promptUri);
|
|
84
|
+
editor = getCodeEditor(editorService.activeTextEditorControl);
|
|
85
|
+
}
|
|
72
86
|
if (editor && editor.hasModel() && isEqual(editor.getModel().uri, promptUri)) {
|
|
73
87
|
SnippetController2.get(editor)?.apply([{
|
|
74
88
|
range: editor.getModel().getFullModelRange(),
|
|
75
89
|
template: getDefaultContentSnippet(this.type, cleanName, getTarget(this.type, promptUri))
|
|
76
90
|
}]);
|
|
77
91
|
}
|
|
78
|
-
if (
|
|
92
|
+
if (storage !== "user") {
|
|
79
93
|
return;
|
|
80
94
|
}
|
|
81
95
|
const isConfigured = userDataSyncEnablementService.isResourceEnablementConfigured(SyncResource.Prompts);
|
|
@@ -84,17 +98,17 @@ class AbstractNewPromptFileAction extends Action2 {
|
|
|
84
98
|
return;
|
|
85
99
|
}
|
|
86
100
|
notificationService.prompt(Severity.Info, ( localize(
|
|
87
|
-
|
|
101
|
+
6206,
|
|
88
102
|
"Do you want to backup and sync your user prompt, instruction and custom agent files with Setting Sync?'"
|
|
89
103
|
)), [{
|
|
90
|
-
label: ( localize(
|
|
104
|
+
label: ( localize(6207, "Enable")),
|
|
91
105
|
run: () => {
|
|
92
106
|
commandService.executeCommand(CONFIGURE_SYNC_COMMAND_ID).catch(error => {
|
|
93
107
|
logService.error(`Failed to run '${CONFIGURE_SYNC_COMMAND_ID}' command: ${error}.`);
|
|
94
108
|
});
|
|
95
109
|
}
|
|
96
110
|
}, {
|
|
97
|
-
label: ( localize(
|
|
111
|
+
label: ( localize(6208, "Learn More")),
|
|
98
112
|
run: () => {
|
|
99
113
|
openerService.open(( URI.parse("https://aka.ms/vscode-settings-sync-help")));
|
|
100
114
|
}
|
|
@@ -114,6 +128,9 @@ function getDefaultContentSnippet(promptType, name, target) {
|
|
|
114
128
|
`name: ${name ?? "${1:prompt-name}"}`,
|
|
115
129
|
`description: \${2:Describe when to use this prompt}`,
|
|
116
130
|
`---`,
|
|
131
|
+
``,
|
|
132
|
+
`<!-- Tip: Use /create-prompt in chat to generate content with agent assistance -->`,
|
|
133
|
+
``,
|
|
117
134
|
`\${3:Define the prompt content here. You can include instructions, examples, and any other relevant information to guide the AI's responses.}`
|
|
118
135
|
].join("\n");
|
|
119
136
|
case PromptsType.instructions:
|
|
@@ -124,14 +141,20 @@ function getDefaultContentSnippet(promptType, name, target) {
|
|
|
124
141
|
`paths:`,
|
|
125
142
|
`. - "src/**/*.ts"`,
|
|
126
143
|
`---`,
|
|
144
|
+
``,
|
|
145
|
+
`<!-- Tip: Use /create-instructions in chat to generate content with agent assistance -->`,
|
|
146
|
+
``,
|
|
127
147
|
`\${2:Provide coding guidelines that AI should follow when generating code, answering questions, or reviewing changes.}`
|
|
128
148
|
].join("\n");
|
|
129
149
|
} else {
|
|
130
150
|
return [
|
|
131
151
|
`---`,
|
|
132
|
-
`description: \${1:Describe when these instructions should be loaded}`,
|
|
152
|
+
`description: \${1:Describe when these instructions should be loaded by the agent based on task context}`,
|
|
133
153
|
`# applyTo: '\${1|**,**/*.ts|}' # when provided, instructions will automatically be added to the request context when the pattern matches an attached file`,
|
|
134
154
|
`---`,
|
|
155
|
+
``,
|
|
156
|
+
`<!-- Tip: Use /create-instructions in chat to generate content with agent assistance -->`,
|
|
157
|
+
``,
|
|
135
158
|
`\${2:Provide project context and coding guidelines that AI should follow when generating code, answering questions, or reviewing changes.}`
|
|
136
159
|
].join("\n");
|
|
137
160
|
}
|
|
@@ -143,6 +166,9 @@ function getDefaultContentSnippet(promptType, name, target) {
|
|
|
143
166
|
`description: \${2:Describe what this custom agent does and when to use it.}`,
|
|
144
167
|
`tools: Read, Grep, Glob, Bash # specify the tools this agent can use. If not set, all enabled tools are allowed.`,
|
|
145
168
|
`---`,
|
|
169
|
+
``,
|
|
170
|
+
`<!-- Tip: Use /create-agent in chat to generate content with agent assistance -->`,
|
|
171
|
+
``,
|
|
146
172
|
`\${4:Define what this custom agent does, including its behavior, capabilities, and any specific instructions for its operation.}`
|
|
147
173
|
].join("\n");
|
|
148
174
|
} else {
|
|
@@ -153,6 +179,9 @@ function getDefaultContentSnippet(promptType, name, target) {
|
|
|
153
179
|
`argument-hint: \${3:The inputs this agent expects, e.g., "a task to implement" or "a question to answer".}`,
|
|
154
180
|
`# tools: ['vscode', 'execute', 'read', 'agent', 'edit', 'search', 'web', 'todo'] # specify the tools this agent can use. If not set, all enabled tools are allowed.`,
|
|
155
181
|
`---`,
|
|
182
|
+
``,
|
|
183
|
+
`<!-- Tip: Use /create-agent in chat to generate content with agent assistance -->`,
|
|
184
|
+
``,
|
|
156
185
|
`\${4:Define what this custom agent does, including its behavior, capabilities, and any specific instructions for its operation.}`
|
|
157
186
|
].join("\n");
|
|
158
187
|
}
|
|
@@ -162,6 +191,9 @@ function getDefaultContentSnippet(promptType, name, target) {
|
|
|
162
191
|
`name: ${name ?? "${1:skill-name}"}`,
|
|
163
192
|
`description: \${2:Describe what this skill does and when to use it. Include keywords that help agents identify relevant tasks.}`,
|
|
164
193
|
`---`,
|
|
194
|
+
``,
|
|
195
|
+
`<!-- Tip: Use /create-skill in chat to generate content with agent assistance -->`,
|
|
196
|
+
``,
|
|
165
197
|
`\${3:Define the functionality provided by this skill, including detailed instructions and examples}`
|
|
166
198
|
].join("\n");
|
|
167
199
|
default:
|
|
@@ -174,24 +206,24 @@ const NEW_AGENT_COMMAND_ID = "workbench.command.new.agent";
|
|
|
174
206
|
const NEW_SKILL_COMMAND_ID = "workbench.command.new.skill";
|
|
175
207
|
class NewPromptFileAction extends AbstractNewPromptFileAction {
|
|
176
208
|
constructor() {
|
|
177
|
-
super(NEW_PROMPT_COMMAND_ID, ( localize(
|
|
209
|
+
super(NEW_PROMPT_COMMAND_ID, ( localize(6209, "New Prompt File...")), PromptsType.prompt);
|
|
178
210
|
}
|
|
179
211
|
}
|
|
180
212
|
class NewInstructionsFileAction extends AbstractNewPromptFileAction {
|
|
181
213
|
constructor() {
|
|
182
|
-
super(NEW_INSTRUCTIONS_COMMAND_ID, ( localize(
|
|
214
|
+
super(NEW_INSTRUCTIONS_COMMAND_ID, ( localize(6210, "New Instructions File...")), PromptsType.instructions);
|
|
183
215
|
}
|
|
184
216
|
}
|
|
185
217
|
class NewAgentFileAction extends AbstractNewPromptFileAction {
|
|
186
218
|
constructor() {
|
|
187
|
-
super(NEW_AGENT_COMMAND_ID, ( localize(
|
|
219
|
+
super(NEW_AGENT_COMMAND_ID, ( localize(6211, "New Custom Agent...")), PromptsType.agent);
|
|
188
220
|
}
|
|
189
221
|
}
|
|
190
222
|
class NewSkillFileAction extends Action2 {
|
|
191
223
|
constructor() {
|
|
192
224
|
super({
|
|
193
225
|
id: NEW_SKILL_COMMAND_ID,
|
|
194
|
-
title: ( localize(
|
|
226
|
+
title: ( localize(6212, "New Skill File...")),
|
|
195
227
|
f1: false,
|
|
196
228
|
precondition: ChatContextKeys.enabled,
|
|
197
229
|
category: CHAT_CATEGORY,
|
|
@@ -204,41 +236,47 @@ class NewSkillFileAction extends Action2 {
|
|
|
204
236
|
}
|
|
205
237
|
});
|
|
206
238
|
}
|
|
207
|
-
async run(accessor) {
|
|
239
|
+
async run(accessor, options) {
|
|
208
240
|
const openerService = accessor.get(IOpenerService);
|
|
209
241
|
const editorService = accessor.get(IEditorService);
|
|
210
242
|
const fileService = accessor.get(IFileService);
|
|
211
243
|
const instaService = accessor.get(IInstantiationService);
|
|
212
244
|
const quickInputService = accessor.get(IQuickInputService);
|
|
213
|
-
|
|
214
|
-
if (
|
|
215
|
-
|
|
245
|
+
let folderUri;
|
|
246
|
+
if (options?.targetFolder) {
|
|
247
|
+
folderUri = options.targetFolder;
|
|
248
|
+
} else {
|
|
249
|
+
const selectedFolder = await instaService.invokeFunction(askForPromptSourceFolder, PromptsType.skill);
|
|
250
|
+
if (!selectedFolder) {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
folderUri = selectedFolder.uri;
|
|
216
254
|
}
|
|
217
255
|
const skillName = await quickInputService.input({
|
|
218
256
|
prompt: ( localize(
|
|
219
|
-
|
|
257
|
+
6213,
|
|
220
258
|
"Enter a name for the skill (lowercase letters, numbers, and hyphens only)"
|
|
221
259
|
)),
|
|
222
|
-
placeHolder: ( localize(
|
|
260
|
+
placeHolder: ( localize(6214, "e.g., pdf-processing, data-analysis")),
|
|
223
261
|
validateInput: async value => {
|
|
224
262
|
if (!value || !value.trim()) {
|
|
225
|
-
return localize(
|
|
263
|
+
return localize(6215, "Skill name is required");
|
|
226
264
|
}
|
|
227
265
|
const name = value.trim();
|
|
228
266
|
if (name.length > 64) {
|
|
229
|
-
return localize(
|
|
267
|
+
return localize(6216, "Skill name must be 64 characters or less");
|
|
230
268
|
}
|
|
231
269
|
if (!/^[a-z0-9-]+$/.test(name)) {
|
|
232
270
|
return localize(
|
|
233
|
-
|
|
271
|
+
6217,
|
|
234
272
|
"Skill name may only contain lowercase letters, numbers, and hyphens"
|
|
235
273
|
);
|
|
236
274
|
}
|
|
237
275
|
if (name.startsWith("-") || name.endsWith("-")) {
|
|
238
|
-
return localize(
|
|
276
|
+
return localize(6218, "Skill name must not start or end with a hyphen");
|
|
239
277
|
}
|
|
240
278
|
if (name.includes("--")) {
|
|
241
|
-
return localize(
|
|
279
|
+
return localize(6219, "Skill name must not contain consecutive hyphens");
|
|
242
280
|
}
|
|
243
281
|
return undefined;
|
|
244
282
|
}
|
|
@@ -247,12 +285,17 @@ class NewSkillFileAction extends Action2 {
|
|
|
247
285
|
return;
|
|
248
286
|
}
|
|
249
287
|
const trimmedName = skillName.trim();
|
|
250
|
-
const skillFolder = URI.joinPath(
|
|
288
|
+
const skillFolder = URI.joinPath(folderUri, trimmedName);
|
|
251
289
|
await fileService.createFolder(skillFolder);
|
|
252
290
|
const skillFileUri = URI.joinPath(skillFolder, SKILL_FILENAME);
|
|
253
291
|
await fileService.createFile(skillFileUri);
|
|
254
|
-
|
|
255
|
-
|
|
292
|
+
let editor;
|
|
293
|
+
if (options?.openFile) {
|
|
294
|
+
editor = await options.openFile(skillFileUri);
|
|
295
|
+
} else {
|
|
296
|
+
await openerService.open(skillFileUri);
|
|
297
|
+
editor = getCodeEditor(editorService.activeTextEditorControl);
|
|
298
|
+
}
|
|
256
299
|
if (editor && editor.hasModel() && isEqual(editor.getModel().uri, skillFileUri)) {
|
|
257
300
|
SnippetController2.get(editor)?.apply([{
|
|
258
301
|
range: editor.getModel().getFullModelRange(),
|
|
@@ -265,7 +308,7 @@ class NewUntitledPromptFileAction extends Action2 {
|
|
|
265
308
|
constructor() {
|
|
266
309
|
super({
|
|
267
310
|
id: "workbench.command.new.untitled.prompt",
|
|
268
|
-
title: ( localize2(
|
|
311
|
+
title: ( localize2(6220, "New Untitled Prompt File")),
|
|
269
312
|
f1: true,
|
|
270
313
|
precondition: ChatContextKeys.enabled,
|
|
271
314
|
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(6221, "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(6222, "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(6223, "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(6224, "Enter the name of the instructions file");
|
|
60
60
|
case PromptsType.prompt:
|
|
61
|
-
return localize(
|
|
61
|
+
return localize(6225, "Enter the name of the prompt file");
|
|
62
62
|
case PromptsType.agent:
|
|
63
|
-
return localize(
|
|
63
|
+
return localize(6226, "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(6227, "Enter a new name of the instructions file");
|
|
72
72
|
case PromptsType.prompt:
|
|
73
|
-
return localize(
|
|
73
|
+
return localize(6228, "Enter a new name of the prompt file");
|
|
74
74
|
case PromptsType.agent:
|
|
75
|
-
return localize(
|
|
75
|
+
return localize(6229, "Enter a new name of the agent file");
|
|
76
76
|
default:
|
|
77
77
|
throw ( new Error("Unknown prompt type"));
|
|
78
78
|
}
|
|
@@ -27,7 +27,7 @@ async function askForPromptSourceFolder(accessor, type, existingFolder, isMove =
|
|
|
27
27
|
};
|
|
28
28
|
const foldersList = ( folders.map(folder => {
|
|
29
29
|
const uri = folder.uri;
|
|
30
|
-
const detail = (existingFolder && isEqual(uri, existingFolder)) ? ( localize(
|
|
30
|
+
const detail = (existingFolder && isEqual(uri, existingFolder)) ? ( localize(6230, "Current Location")) : undefined;
|
|
31
31
|
if (folder.storage !== PromptsStorage.local) {
|
|
32
32
|
return {
|
|
33
33
|
type: "item",
|
|
@@ -55,7 +55,7 @@ async function askForPromptSourceFolder(accessor, type, existingFolder, isMove =
|
|
|
55
55
|
}
|
|
56
56
|
return {
|
|
57
57
|
type: "item",
|
|
58
|
-
label: ( localize(
|
|
58
|
+
label: ( localize(6231, "Current Workspace")),
|
|
59
59
|
detail,
|
|
60
60
|
tooltip: labelService.getUriLabel(uri),
|
|
61
61
|
folder
|
|
@@ -70,15 +70,15 @@ async function askForPromptSourceFolder(accessor, type, existingFolder, isMove =
|
|
|
70
70
|
function getPlaceholderStringforNew(type) {
|
|
71
71
|
switch (type) {
|
|
72
72
|
case PromptsType.instructions:
|
|
73
|
-
return localize(
|
|
73
|
+
return localize(6232, "Select a location to create the instructions file");
|
|
74
74
|
case PromptsType.prompt:
|
|
75
|
-
return localize(
|
|
75
|
+
return localize(6233, "Select a location to create the prompt file");
|
|
76
76
|
case PromptsType.agent:
|
|
77
|
-
return localize(
|
|
77
|
+
return localize(6234, "Select a location to create the agent file");
|
|
78
78
|
case PromptsType.skill:
|
|
79
|
-
return localize(
|
|
79
|
+
return localize(6235, "Select a location to create the skill");
|
|
80
80
|
case PromptsType.hook:
|
|
81
|
-
return localize(
|
|
81
|
+
return localize(6236, "Select a location to create the hook file");
|
|
82
82
|
default:
|
|
83
83
|
throw ( new Error("Unknown prompt type"));
|
|
84
84
|
}
|
|
@@ -87,13 +87,13 @@ function getPlaceholderStringforMove(type, isMove) {
|
|
|
87
87
|
if (isMove) {
|
|
88
88
|
switch (type) {
|
|
89
89
|
case PromptsType.instructions:
|
|
90
|
-
return localize(
|
|
90
|
+
return localize(6237, "Select a location to move the instructions file to");
|
|
91
91
|
case PromptsType.prompt:
|
|
92
|
-
return localize(
|
|
92
|
+
return localize(6238, "Select a location to move the prompt file to");
|
|
93
93
|
case PromptsType.agent:
|
|
94
|
-
return localize(
|
|
94
|
+
return localize(6239, "Select a location to move the agent file to");
|
|
95
95
|
case PromptsType.skill:
|
|
96
|
-
return localize(
|
|
96
|
+
return localize(6240, "Select a location to move the skill to");
|
|
97
97
|
case PromptsType.hook:
|
|
98
98
|
throw ( new Error("Hooks cannot be moved"));
|
|
99
99
|
default:
|
|
@@ -102,13 +102,13 @@ function getPlaceholderStringforMove(type, isMove) {
|
|
|
102
102
|
}
|
|
103
103
|
switch (type) {
|
|
104
104
|
case PromptsType.instructions:
|
|
105
|
-
return localize(
|
|
105
|
+
return localize(6241, "Select a location to copy the instructions file to");
|
|
106
106
|
case PromptsType.prompt:
|
|
107
|
-
return localize(
|
|
107
|
+
return localize(6242, "Select a location to copy the prompt file to");
|
|
108
108
|
case PromptsType.agent:
|
|
109
|
-
return localize(
|
|
109
|
+
return localize(6243, "Select a location to copy the agent file to");
|
|
110
110
|
case PromptsType.skill:
|
|
111
|
-
return localize(
|
|
111
|
+
return localize(6244, "Select a location to copy the skill to");
|
|
112
112
|
case PromptsType.hook:
|
|
113
113
|
throw ( new Error("Hooks cannot be copied"));
|
|
114
114
|
default:
|
|
@@ -136,15 +136,15 @@ async function showNoFoldersDialog(accessor, type) {
|
|
|
136
136
|
function getLearnLabel(type) {
|
|
137
137
|
switch (type) {
|
|
138
138
|
case PromptsType.prompt:
|
|
139
|
-
return localize(
|
|
139
|
+
return localize(6245, "Learn how to configure reusable prompts");
|
|
140
140
|
case PromptsType.instructions:
|
|
141
|
-
return localize(
|
|
141
|
+
return localize(6246, "Learn how to configure reusable instructions");
|
|
142
142
|
case PromptsType.agent:
|
|
143
|
-
return localize(
|
|
143
|
+
return localize(6247, "Learn how to configure custom agents");
|
|
144
144
|
case PromptsType.skill:
|
|
145
|
-
return localize(
|
|
145
|
+
return localize(6248, "Learn how to configure skills");
|
|
146
146
|
case PromptsType.hook:
|
|
147
|
-
return localize(
|
|
147
|
+
return localize(6249, "Learn how to configure hooks");
|
|
148
148
|
default:
|
|
149
149
|
throw ( new Error("Unknown prompt type"));
|
|
150
150
|
}
|
|
@@ -152,15 +152,15 @@ function getLearnLabel(type) {
|
|
|
152
152
|
function getMissingSourceFolderString(type) {
|
|
153
153
|
switch (type) {
|
|
154
154
|
case PromptsType.instructions:
|
|
155
|
-
return localize(
|
|
155
|
+
return localize(6250, "No instruction source folders found.");
|
|
156
156
|
case PromptsType.prompt:
|
|
157
|
-
return localize(
|
|
157
|
+
return localize(6251, "No prompt source folders found.");
|
|
158
158
|
case PromptsType.agent:
|
|
159
|
-
return localize(
|
|
159
|
+
return localize(6252, "No agent source folders found.");
|
|
160
160
|
case PromptsType.skill:
|
|
161
|
-
return localize(
|
|
161
|
+
return localize(6253, "No skill source folders found.");
|
|
162
162
|
case PromptsType.hook:
|
|
163
|
-
return localize(
|
|
163
|
+
return localize(6254, "No hook source folders found.");
|
|
164
164
|
default:
|
|
165
165
|
throw ( new Error("Unknown prompt type"));
|
|
166
166
|
}
|