@codingame/monaco-vscode-xterm-addons-common 30.0.1 → 31.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 +10 -36
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/attachInstructionsAction.js +6 -6
- 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 +28 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/promptFilePickers.js +34 -34
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatPasteProviders.js +8 -8
- 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 +14 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.js +29 -21
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugAttachment.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugAttachment.js +0 -25
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugEvents.d.ts +0 -58
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugEvents.js +0 -135
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-xterm-addons-common",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "31.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": "31.0.0",
|
|
19
|
+
"@xterm/addon-clipboard": "0.3.0-beta.204",
|
|
20
|
+
"@xterm/addon-image": "0.10.0-beta.204",
|
|
21
|
+
"@xterm/addon-ligatures": "0.11.0-beta.204",
|
|
22
|
+
"@xterm/addon-progress": "0.3.0-beta.204",
|
|
23
|
+
"@xterm/addon-search": "0.17.0-beta.204",
|
|
24
|
+
"@xterm/addon-serialize": "0.15.0-beta.204",
|
|
25
|
+
"@xterm/addon-unicode11": "0.10.0-beta.204",
|
|
26
|
+
"@xterm/addon-webgl": "0.20.0-beta.203"
|
|
27
27
|
},
|
|
28
28
|
"exports": {
|
|
29
29
|
".": {
|
|
@@ -22,8 +22,6 @@ import { ChatAgentLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbe
|
|
|
22
22
|
import { isImage } from '../widget/input/editor/chatPasteProviders.js';
|
|
23
23
|
import { convertBufferToScreenshotVariable } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/attachments/chatScreenshotContext';
|
|
24
24
|
import { ChatInstructionsPickerPick } from '../promptSyntax/attachInstructionsAction.js';
|
|
25
|
-
import { createDebugEventsAttachment } from '../chatDebug/chatDebugAttachment.js';
|
|
26
|
-
import { IChatDebugService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatDebugService.service';
|
|
27
25
|
import { IChatSessionsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService.service';
|
|
28
26
|
import { AgentSessionProviders, getAgentSessionProviderIcon } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessions';
|
|
29
27
|
import { ITerminalService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal.service';
|
|
@@ -51,9 +49,6 @@ let ChatContextContributions = class ChatContextContributions extends Disposable
|
|
|
51
49
|
this._store.add(
|
|
52
50
|
contextPickService.registerChatContextItem(instantiationService.createInstance(ScreenshotContextValuePick))
|
|
53
51
|
);
|
|
54
|
-
this._store.add(
|
|
55
|
-
contextPickService.registerChatContextItem(instantiationService.createInstance(DebugEventsSnapshotContextValuePick))
|
|
56
|
-
);
|
|
57
52
|
this._store.add(
|
|
58
53
|
contextPickService.registerChatContextItem(instantiationService.createInstance(SessionReferenceContextPickerPick))
|
|
59
54
|
);
|
|
@@ -63,7 +58,7 @@ ChatContextContributions = ( __decorate([( __param(0, IInstantiationService)), (
|
|
|
63
58
|
class ToolsContextPickerPick {
|
|
64
59
|
constructor() {
|
|
65
60
|
this.type = "pickerPick";
|
|
66
|
-
this.label = ( localize(
|
|
61
|
+
this.label = ( localize(4863, "Tools..."));
|
|
67
62
|
this.icon = Codicon.tools;
|
|
68
63
|
this.ordinal = -500;
|
|
69
64
|
}
|
|
@@ -114,7 +109,7 @@ class ToolsContextPickerPick {
|
|
|
114
109
|
picks.push(item);
|
|
115
110
|
}
|
|
116
111
|
return {
|
|
117
|
-
placeholder: ( localize(
|
|
112
|
+
placeholder: ( localize(4864, "Select a tool")),
|
|
118
113
|
picks: Promise.resolve(picks)
|
|
119
114
|
};
|
|
120
115
|
}
|
|
@@ -124,7 +119,7 @@ let OpenEditorContextValuePick = class OpenEditorContextValuePick {
|
|
|
124
119
|
this._editorService = _editorService;
|
|
125
120
|
this._labelService = _labelService;
|
|
126
121
|
this.type = "valuePick";
|
|
127
|
-
this.label = ( localize(
|
|
122
|
+
this.label = ( localize(4865, "Open Editors"));
|
|
128
123
|
this.icon = Codicon.file;
|
|
129
124
|
this.ordinal = 800;
|
|
130
125
|
}
|
|
@@ -160,7 +155,7 @@ let ClipboardImageContextValuePick = class ClipboardImageContextValuePick {
|
|
|
160
155
|
constructor(_clipboardService) {
|
|
161
156
|
this._clipboardService = _clipboardService;
|
|
162
157
|
this.type = "valuePick";
|
|
163
|
-
this.label = ( localize(
|
|
158
|
+
this.label = ( localize(4866, "Image from Clipboard"));
|
|
164
159
|
this.icon = Codicon.fileMedia;
|
|
165
160
|
}
|
|
166
161
|
async isEnabled(widget) {
|
|
@@ -177,8 +172,8 @@ let ClipboardImageContextValuePick = class ClipboardImageContextValuePick {
|
|
|
177
172
|
const fileBuffer = await this._clipboardService.readImage();
|
|
178
173
|
return {
|
|
179
174
|
id: await imageToHash(fileBuffer),
|
|
180
|
-
name: ( localize(
|
|
181
|
-
fullName: ( localize(
|
|
175
|
+
name: ( localize(4867, "Pasted Image")),
|
|
176
|
+
fullName: ( localize(4867, "Pasted Image")),
|
|
182
177
|
value: fileBuffer,
|
|
183
178
|
kind: "image"
|
|
184
179
|
};
|
|
@@ -191,7 +186,7 @@ let TerminalContext = class TerminalContext {
|
|
|
191
186
|
this._terminalService = _terminalService;
|
|
192
187
|
this.type = "valuePick";
|
|
193
188
|
this.icon = Codicon.terminal;
|
|
194
|
-
this.label = ( localize(
|
|
189
|
+
this.label = ( localize(4868, "Terminal"));
|
|
195
190
|
}
|
|
196
191
|
isEnabled(widget) {
|
|
197
192
|
const terminal = this._terminalService.getInstanceFromResource(this._resource);
|
|
@@ -256,7 +251,7 @@ let ScreenshotContextValuePick = class ScreenshotContextValuePick {
|
|
|
256
251
|
this._hostService = _hostService;
|
|
257
252
|
this.type = "valuePick";
|
|
258
253
|
this.icon = Codicon.deviceCamera;
|
|
259
|
-
this.label = (isElectron ? ( localize(
|
|
254
|
+
this.label = (isElectron ? ( localize(4869, "Screenshot Window")) : ( localize(4870, "Screenshot")));
|
|
260
255
|
}
|
|
261
256
|
async isEnabled(widget) {
|
|
262
257
|
return !!widget.attachmentCapabilities.supportsImageAttachments && !!widget.input.selectedLanguageModel.get()?.metadata.capabilities?.vision;
|
|
@@ -267,33 +262,12 @@ let ScreenshotContextValuePick = class ScreenshotContextValuePick {
|
|
|
267
262
|
}
|
|
268
263
|
};
|
|
269
264
|
ScreenshotContextValuePick = ( __decorate([( __param(0, IHostService))], ScreenshotContextValuePick));
|
|
270
|
-
let DebugEventsSnapshotContextValuePick = class DebugEventsSnapshotContextValuePick {
|
|
271
|
-
constructor(_chatDebugService) {
|
|
272
|
-
this._chatDebugService = _chatDebugService;
|
|
273
|
-
this.type = "valuePick";
|
|
274
|
-
this.icon = Codicon.output;
|
|
275
|
-
this.label = ( localize(4869, "Debug Events Snapshot"));
|
|
276
|
-
this.ordinal = -600;
|
|
277
|
-
}
|
|
278
|
-
isEnabled(widget) {
|
|
279
|
-
const sessionResource = widget.viewModel?.sessionResource;
|
|
280
|
-
return !!sessionResource && this._chatDebugService.getEvents(sessionResource).length > 0;
|
|
281
|
-
}
|
|
282
|
-
async asAttachment(widget) {
|
|
283
|
-
const sessionResource = widget.viewModel?.sessionResource;
|
|
284
|
-
if (!sessionResource) {
|
|
285
|
-
return undefined;
|
|
286
|
-
}
|
|
287
|
-
return createDebugEventsAttachment(sessionResource, this._chatDebugService);
|
|
288
|
-
}
|
|
289
|
-
};
|
|
290
|
-
DebugEventsSnapshotContextValuePick = ( __decorate([( __param(0, IChatDebugService))], DebugEventsSnapshotContextValuePick));
|
|
291
265
|
let SessionReferenceContextPickerPick = class SessionReferenceContextPickerPick {
|
|
292
266
|
constructor(_chatSessionsService) {
|
|
293
267
|
this._chatSessionsService = _chatSessionsService;
|
|
294
268
|
this.type = "pickerPick";
|
|
295
269
|
this.icon = Codicon.comment;
|
|
296
|
-
this.label = ( localize(
|
|
270
|
+
this.label = ( localize(4871, "Sessions..."));
|
|
297
271
|
this.ordinal = -400;
|
|
298
272
|
}
|
|
299
273
|
isEnabled(widget) {
|
|
@@ -302,7 +276,7 @@ let SessionReferenceContextPickerPick = class SessionReferenceContextPickerPick
|
|
|
302
276
|
asPicker(widget) {
|
|
303
277
|
const currentSessionResource = widget.viewModel?.sessionResource;
|
|
304
278
|
return {
|
|
305
|
-
placeholder: ( localize(
|
|
279
|
+
placeholder: ( localize(4872, "Select a session")),
|
|
306
280
|
picks: (async () => {
|
|
307
281
|
const picks = [];
|
|
308
282
|
const sessionProviderFilter = [
|
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(6529, "Configure Instructions & Rules...")),
|
|
27
|
+
shortTitle: ( localize2(6530, "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(6531, "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(6532, "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(6533, "Select instructions files to attach")),
|
|
93
93
|
picks,
|
|
94
94
|
configure: {
|
|
95
|
-
label: ( localize(
|
|
95
|
+
label: ( localize(6534, "Configure Instructions...")),
|
|
96
96
|
commandId: CONFIGURE_INSTRUCTIONS_ACTION_ID
|
|
97
97
|
}
|
|
98
98
|
};
|
|
@@ -104,17 +104,17 @@ class AbstractNewPromptFileAction extends Action2 {
|
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
106
106
|
notificationService.prompt(Severity.Info, ( localize(
|
|
107
|
-
|
|
107
|
+
6566,
|
|
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(6567, "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(6568, "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(6569, "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(6570, "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(6571, "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(6572, "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
|
+
6573,
|
|
264
264
|
"Enter a name for the skill (lowercase letters, numbers, and hyphens only)"
|
|
265
265
|
)),
|
|
266
|
-
placeHolder: ( localize(
|
|
266
|
+
placeHolder: ( localize(6574, "e.g., pdf-processing, data-analysis")),
|
|
267
267
|
validateInput: async value => {
|
|
268
268
|
if (!value || !value.trim()) {
|
|
269
|
-
return localize(
|
|
269
|
+
return localize(6575, "Skill name is required");
|
|
270
270
|
}
|
|
271
271
|
const name = value.trim();
|
|
272
272
|
if (name.length > 64) {
|
|
273
|
-
return localize(
|
|
273
|
+
return localize(6576, "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
|
+
6577,
|
|
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(6578, "Skill name must not start or end with a hyphen");
|
|
283
283
|
}
|
|
284
284
|
if (name.includes("--")) {
|
|
285
|
-
return localize(
|
|
285
|
+
return localize(6579, "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(6580, "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(6581, "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(6582, "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(6583, "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(6584, "Enter the name of the instructions file");
|
|
60
60
|
case PromptsType.prompt:
|
|
61
|
-
return localize(
|
|
61
|
+
return localize(6585, "Enter the name of the prompt file");
|
|
62
62
|
case PromptsType.agent:
|
|
63
|
-
return localize(
|
|
63
|
+
return localize(6586, "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(6587, "Enter a new name of the instructions file");
|
|
72
72
|
case PromptsType.prompt:
|
|
73
|
-
return localize(
|
|
73
|
+
return localize(6588, "Enter a new name of the prompt file");
|
|
74
74
|
case PromptsType.agent:
|
|
75
|
-
return localize(
|
|
75
|
+
return localize(6589, "Enter a new name of the agent file");
|
|
76
76
|
default:
|
|
77
77
|
throw ( new Error("Unknown prompt type"));
|
|
78
78
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { isEqual, extUri } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
3
3
|
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
4
4
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
5
|
+
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
5
6
|
import { ILabelService } from '@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service';
|
|
6
7
|
import { IOpenerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service';
|
|
7
8
|
import { PromptsType, PROMPT_DOCUMENTATION_URL } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/promptTypes';
|
|
@@ -11,13 +12,14 @@ import { PromptsStorage } from '@codingame/monaco-vscode-api/vscode/vs/workbench
|
|
|
11
12
|
import { IPromptsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.service';
|
|
12
13
|
|
|
13
14
|
async function askForPromptSourceFolder(accessor, type, existingFolder, isMove = false) {
|
|
15
|
+
const instantiationService = accessor.get(IInstantiationService);
|
|
14
16
|
const quickInputService = accessor.get(IQuickInputService);
|
|
15
17
|
const promptsService = accessor.get(IPromptsService);
|
|
16
18
|
const labelService = accessor.get(ILabelService);
|
|
17
19
|
const workspaceService = accessor.get(IWorkspaceContextService);
|
|
18
20
|
const folders = await promptsService.getSourceFolders(type);
|
|
19
21
|
if (folders.length === 0) {
|
|
20
|
-
await showNoFoldersDialog(accessor, type);
|
|
22
|
+
await instantiationService.invokeFunction(accessor => showNoFoldersDialog(accessor, type));
|
|
21
23
|
return;
|
|
22
24
|
}
|
|
23
25
|
const pickOptions = {
|
|
@@ -27,7 +29,7 @@ async function askForPromptSourceFolder(accessor, type, existingFolder, isMove =
|
|
|
27
29
|
};
|
|
28
30
|
const foldersList = ( folders.map(folder => {
|
|
29
31
|
const uri = folder.uri;
|
|
30
|
-
const detail = (existingFolder && isEqual(uri, existingFolder)) ? ( localize(
|
|
32
|
+
const detail = (existingFolder && isEqual(uri, existingFolder)) ? ( localize(6590, "Current Location")) : undefined;
|
|
31
33
|
if (folder.storage !== PromptsStorage.local) {
|
|
32
34
|
return {
|
|
33
35
|
type: "item",
|
|
@@ -55,7 +57,7 @@ async function askForPromptSourceFolder(accessor, type, existingFolder, isMove =
|
|
|
55
57
|
}
|
|
56
58
|
return {
|
|
57
59
|
type: "item",
|
|
58
|
-
label: ( localize(
|
|
60
|
+
label: ( localize(6591, "Current Workspace")),
|
|
59
61
|
detail,
|
|
60
62
|
tooltip: labelService.getUriLabel(uri),
|
|
61
63
|
folder
|
|
@@ -70,15 +72,15 @@ async function askForPromptSourceFolder(accessor, type, existingFolder, isMove =
|
|
|
70
72
|
function getPlaceholderStringforNew(type) {
|
|
71
73
|
switch (type) {
|
|
72
74
|
case PromptsType.instructions:
|
|
73
|
-
return localize(
|
|
75
|
+
return localize(6592, "Select a location to create the instructions file");
|
|
74
76
|
case PromptsType.prompt:
|
|
75
|
-
return localize(
|
|
77
|
+
return localize(6593, "Select a location to create the prompt file");
|
|
76
78
|
case PromptsType.agent:
|
|
77
|
-
return localize(
|
|
79
|
+
return localize(6594, "Select a location to create the agent file");
|
|
78
80
|
case PromptsType.skill:
|
|
79
|
-
return localize(
|
|
81
|
+
return localize(6595, "Select a location to create the skill");
|
|
80
82
|
case PromptsType.hook:
|
|
81
|
-
return localize(
|
|
83
|
+
return localize(6596, "Select a location to create the hook file");
|
|
82
84
|
default:
|
|
83
85
|
throw ( new Error("Unknown prompt type"));
|
|
84
86
|
}
|
|
@@ -87,13 +89,13 @@ function getPlaceholderStringforMove(type, isMove) {
|
|
|
87
89
|
if (isMove) {
|
|
88
90
|
switch (type) {
|
|
89
91
|
case PromptsType.instructions:
|
|
90
|
-
return localize(
|
|
92
|
+
return localize(6597, "Select a location to move the instructions file to");
|
|
91
93
|
case PromptsType.prompt:
|
|
92
|
-
return localize(
|
|
94
|
+
return localize(6598, "Select a location to move the prompt file to");
|
|
93
95
|
case PromptsType.agent:
|
|
94
|
-
return localize(
|
|
96
|
+
return localize(6599, "Select a location to move the agent file to");
|
|
95
97
|
case PromptsType.skill:
|
|
96
|
-
return localize(
|
|
98
|
+
return localize(6600, "Select a location to move the skill to");
|
|
97
99
|
case PromptsType.hook:
|
|
98
100
|
throw ( new Error("Hooks cannot be moved"));
|
|
99
101
|
default:
|
|
@@ -102,13 +104,13 @@ function getPlaceholderStringforMove(type, isMove) {
|
|
|
102
104
|
}
|
|
103
105
|
switch (type) {
|
|
104
106
|
case PromptsType.instructions:
|
|
105
|
-
return localize(
|
|
107
|
+
return localize(6601, "Select a location to copy the instructions file to");
|
|
106
108
|
case PromptsType.prompt:
|
|
107
|
-
return localize(
|
|
109
|
+
return localize(6602, "Select a location to copy the prompt file to");
|
|
108
110
|
case PromptsType.agent:
|
|
109
|
-
return localize(
|
|
111
|
+
return localize(6603, "Select a location to copy the agent file to");
|
|
110
112
|
case PromptsType.skill:
|
|
111
|
-
return localize(
|
|
113
|
+
return localize(6604, "Select a location to copy the skill to");
|
|
112
114
|
case PromptsType.hook:
|
|
113
115
|
throw ( new Error("Hooks cannot be copied"));
|
|
114
116
|
default:
|
|
@@ -136,15 +138,15 @@ async function showNoFoldersDialog(accessor, type) {
|
|
|
136
138
|
function getLearnLabel(type) {
|
|
137
139
|
switch (type) {
|
|
138
140
|
case PromptsType.prompt:
|
|
139
|
-
return localize(
|
|
141
|
+
return localize(6605, "Learn how to configure reusable prompts");
|
|
140
142
|
case PromptsType.instructions:
|
|
141
|
-
return localize(
|
|
143
|
+
return localize(6606, "Learn how to configure reusable instructions");
|
|
142
144
|
case PromptsType.agent:
|
|
143
|
-
return localize(
|
|
145
|
+
return localize(6607, "Learn how to configure custom agents");
|
|
144
146
|
case PromptsType.skill:
|
|
145
|
-
return localize(
|
|
147
|
+
return localize(6608, "Learn how to configure skills");
|
|
146
148
|
case PromptsType.hook:
|
|
147
|
-
return localize(
|
|
149
|
+
return localize(6609, "Learn how to configure hooks");
|
|
148
150
|
default:
|
|
149
151
|
throw ( new Error("Unknown prompt type"));
|
|
150
152
|
}
|
|
@@ -152,15 +154,15 @@ function getLearnLabel(type) {
|
|
|
152
154
|
function getMissingSourceFolderString(type) {
|
|
153
155
|
switch (type) {
|
|
154
156
|
case PromptsType.instructions:
|
|
155
|
-
return localize(
|
|
157
|
+
return localize(6610, "No instruction source folders found.");
|
|
156
158
|
case PromptsType.prompt:
|
|
157
|
-
return localize(
|
|
159
|
+
return localize(6611, "No prompt source folders found.");
|
|
158
160
|
case PromptsType.agent:
|
|
159
|
-
return localize(
|
|
161
|
+
return localize(6612, "No agent source folders found.");
|
|
160
162
|
case PromptsType.skill:
|
|
161
|
-
return localize(
|
|
163
|
+
return localize(6613, "No skill source folders found.");
|
|
162
164
|
case PromptsType.hook:
|
|
163
|
-
return localize(
|
|
165
|
+
return localize(6614, "No hook source folders found.");
|
|
164
166
|
default:
|
|
165
167
|
throw ( new Error("Unknown prompt type"));
|
|
166
168
|
}
|
package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/promptFilePickers.js
CHANGED
|
@@ -4,7 +4,7 @@ import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
|
4
4
|
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
5
5
|
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
6
6
|
import { ThemeIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/themables';
|
|
7
|
-
import { PromptsStorage,
|
|
7
|
+
import { PromptsStorage, AgentInstructionFileType } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService';
|
|
8
8
|
import { IPromptsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.service';
|
|
9
9
|
import { extUri, dirname, joinPath, basename } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
10
10
|
import { DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
@@ -32,31 +32,31 @@ function newHelpButton(type) {
|
|
|
32
32
|
switch (type) {
|
|
33
33
|
case PromptsType.prompt:
|
|
34
34
|
return {
|
|
35
|
-
tooltip: ( localize(
|
|
35
|
+
tooltip: ( localize(6615, "Show help on prompt files")),
|
|
36
36
|
helpURI: ( URI.parse(PROMPT_DOCUMENTATION_URL)),
|
|
37
37
|
iconClass
|
|
38
38
|
};
|
|
39
39
|
case PromptsType.instructions:
|
|
40
40
|
return {
|
|
41
|
-
tooltip: ( localize(
|
|
41
|
+
tooltip: ( localize(6616, "Show help on instruction files")),
|
|
42
42
|
helpURI: ( URI.parse(INSTRUCTIONS_DOCUMENTATION_URL)),
|
|
43
43
|
iconClass
|
|
44
44
|
};
|
|
45
45
|
case PromptsType.agent:
|
|
46
46
|
return {
|
|
47
|
-
tooltip: ( localize(
|
|
47
|
+
tooltip: ( localize(6617, "Show help on custom agent files")),
|
|
48
48
|
helpURI: ( URI.parse(AGENT_DOCUMENTATION_URL)),
|
|
49
49
|
iconClass
|
|
50
50
|
};
|
|
51
51
|
case PromptsType.skill:
|
|
52
52
|
return {
|
|
53
|
-
tooltip: ( localize(
|
|
53
|
+
tooltip: ( localize(6618, "Show help on skill files")),
|
|
54
54
|
helpURI: ( URI.parse(SKILL_DOCUMENTATION_URL)),
|
|
55
55
|
iconClass
|
|
56
56
|
};
|
|
57
57
|
case PromptsType.hook:
|
|
58
58
|
return {
|
|
59
|
-
tooltip: ( localize(
|
|
59
|
+
tooltip: ( localize(6619, "Show help on hook files")),
|
|
60
60
|
helpURI: ( URI.parse(HOOK_DOCUMENTATION_URL)),
|
|
61
61
|
iconClass
|
|
62
62
|
};
|
|
@@ -73,7 +73,7 @@ function isExtensionPromptPath(prompt) {
|
|
|
73
73
|
}
|
|
74
74
|
const NEW_PROMPT_FILE_OPTION = {
|
|
75
75
|
type: "item",
|
|
76
|
-
label: `$(plus) ${( localize(
|
|
76
|
+
label: `$(plus) ${( localize(6620, "New prompt file..."))}`,
|
|
77
77
|
pickable: false,
|
|
78
78
|
alwaysShow: true,
|
|
79
79
|
buttons: [newHelpButton(PromptsType.prompt)],
|
|
@@ -81,7 +81,7 @@ const NEW_PROMPT_FILE_OPTION = {
|
|
|
81
81
|
};
|
|
82
82
|
const NEW_INSTRUCTIONS_FILE_OPTION = {
|
|
83
83
|
type: "item",
|
|
84
|
-
label: `$(plus) ${( localize(
|
|
84
|
+
label: `$(plus) ${( localize(6621, "New instruction file..."))}`,
|
|
85
85
|
pickable: false,
|
|
86
86
|
alwaysShow: true,
|
|
87
87
|
buttons: [newHelpButton(PromptsType.instructions)],
|
|
@@ -89,7 +89,7 @@ const NEW_INSTRUCTIONS_FILE_OPTION = {
|
|
|
89
89
|
};
|
|
90
90
|
const GENERATE_AGENT_INSTRUCTIONS_OPTION = {
|
|
91
91
|
type: "item",
|
|
92
|
-
label: `$(sparkle) ${( localize(
|
|
92
|
+
label: `$(sparkle) ${( localize(6622, "Generate agent instructions..."))}`,
|
|
93
93
|
pickable: false,
|
|
94
94
|
alwaysShow: true,
|
|
95
95
|
buttons: [newHelpButton(PromptsType.instructions)],
|
|
@@ -97,7 +97,7 @@ const GENERATE_AGENT_INSTRUCTIONS_OPTION = {
|
|
|
97
97
|
};
|
|
98
98
|
const GENERATE_ON_DEMAND_INSTRUCTIONS_OPTION = {
|
|
99
99
|
type: "item",
|
|
100
|
-
label: `$(sparkle) ${( localize(
|
|
100
|
+
label: `$(sparkle) ${( localize(6623, "Generate on-demand instructions..."))}`,
|
|
101
101
|
pickable: false,
|
|
102
102
|
alwaysShow: true,
|
|
103
103
|
buttons: [newHelpButton(PromptsType.instructions)],
|
|
@@ -105,7 +105,7 @@ const GENERATE_ON_DEMAND_INSTRUCTIONS_OPTION = {
|
|
|
105
105
|
};
|
|
106
106
|
const NEW_AGENT_FILE_OPTION = {
|
|
107
107
|
type: "item",
|
|
108
|
-
label: `$(plus) ${( localize(
|
|
108
|
+
label: `$(plus) ${( localize(6624, "Create new custom agent..."))}`,
|
|
109
109
|
pickable: false,
|
|
110
110
|
alwaysShow: true,
|
|
111
111
|
buttons: [newHelpButton(PromptsType.agent)],
|
|
@@ -113,7 +113,7 @@ const NEW_AGENT_FILE_OPTION = {
|
|
|
113
113
|
};
|
|
114
114
|
const NEW_SKILL_FILE_OPTION = {
|
|
115
115
|
type: "item",
|
|
116
|
-
label: `$(plus) ${( localize(
|
|
116
|
+
label: `$(plus) ${( localize(6625, "New skill..."))}`,
|
|
117
117
|
pickable: false,
|
|
118
118
|
alwaysShow: true,
|
|
119
119
|
buttons: [newHelpButton(PromptsType.skill)],
|
|
@@ -121,7 +121,7 @@ const NEW_SKILL_FILE_OPTION = {
|
|
|
121
121
|
};
|
|
122
122
|
const GENERATE_PROMPT_OPTION = {
|
|
123
123
|
type: "item",
|
|
124
|
-
label: `$(sparkle) ${( localize(
|
|
124
|
+
label: `$(sparkle) ${( localize(6626, "Generate prompt..."))}`,
|
|
125
125
|
pickable: false,
|
|
126
126
|
alwaysShow: true,
|
|
127
127
|
buttons: [newHelpButton(PromptsType.prompt)],
|
|
@@ -129,7 +129,7 @@ const GENERATE_PROMPT_OPTION = {
|
|
|
129
129
|
};
|
|
130
130
|
const GENERATE_SKILL_OPTION = {
|
|
131
131
|
type: "item",
|
|
132
|
-
label: `$(sparkle) ${( localize(
|
|
132
|
+
label: `$(sparkle) ${( localize(6627, "Generate skill..."))}`,
|
|
133
133
|
pickable: false,
|
|
134
134
|
alwaysShow: true,
|
|
135
135
|
buttons: [newHelpButton(PromptsType.skill)],
|
|
@@ -137,39 +137,39 @@ const GENERATE_SKILL_OPTION = {
|
|
|
137
137
|
};
|
|
138
138
|
const GENERATE_AGENT_OPTION = {
|
|
139
139
|
type: "item",
|
|
140
|
-
label: `$(sparkle) ${( localize(
|
|
140
|
+
label: `$(sparkle) ${( localize(6628, "Generate agent..."))}`,
|
|
141
141
|
pickable: false,
|
|
142
142
|
alwaysShow: true,
|
|
143
143
|
buttons: [newHelpButton(PromptsType.agent)],
|
|
144
144
|
commandId: GENERATE_AGENT_COMMAND_ID
|
|
145
145
|
};
|
|
146
146
|
const EDIT_BUTTON = {
|
|
147
|
-
tooltip: ( localize(
|
|
147
|
+
tooltip: ( localize(6629, "Open in Editor")),
|
|
148
148
|
iconClass: ThemeIcon.asClassName(Codicon.fileCode)
|
|
149
149
|
};
|
|
150
150
|
const DELETE_BUTTON = {
|
|
151
|
-
tooltip: ( localize(
|
|
151
|
+
tooltip: ( localize(6630, "Delete")),
|
|
152
152
|
iconClass: ThemeIcon.asClassName(Codicon.trash)
|
|
153
153
|
};
|
|
154
154
|
const RENAME_BUTTON = {
|
|
155
|
-
tooltip: ( localize(
|
|
155
|
+
tooltip: ( localize(6631, "Move and/or Rename")),
|
|
156
156
|
iconClass: ThemeIcon.asClassName(Codicon.replace)
|
|
157
157
|
};
|
|
158
158
|
const COPY_BUTTON = {
|
|
159
|
-
tooltip: ( localize(
|
|
159
|
+
tooltip: ( localize(6632, "Make a Copy")),
|
|
160
160
|
iconClass: ThemeIcon.asClassName(Codicon.copy)
|
|
161
161
|
};
|
|
162
162
|
const MAKE_VISIBLE_BUTTON = {
|
|
163
|
-
tooltip: ( localize(
|
|
163
|
+
tooltip: ( localize(6633, "Hidden from chat view agent picker. Click to show.")),
|
|
164
164
|
iconClass: ThemeIcon.asClassName(Codicon.eyeClosed),
|
|
165
165
|
alwaysVisible: true
|
|
166
166
|
};
|
|
167
167
|
const MAKE_INVISIBLE_BUTTON = {
|
|
168
|
-
tooltip: ( localize(
|
|
168
|
+
tooltip: ( localize(6634, "Shown in chat view agent picker. Click to hide.")),
|
|
169
169
|
iconClass: ThemeIcon.asClassName(Codicon.eye)
|
|
170
170
|
};
|
|
171
171
|
const RUN_IN_CHAT_BUTTON = {
|
|
172
|
-
tooltip: ( localize(
|
|
172
|
+
tooltip: ( localize(6635, "Run in Chat View")),
|
|
173
173
|
iconClass: ThemeIcon.asClassName(Codicon.play)
|
|
174
174
|
};
|
|
175
175
|
let PromptFilePickers = class PromptFilePickers {
|
|
@@ -200,7 +200,7 @@ let PromptFilePickers = class PromptFilePickers {
|
|
|
200
200
|
useSeparators: true
|
|
201
201
|
});
|
|
202
202
|
quickPick.busy = true;
|
|
203
|
-
quickPick.placeholder = ( localize(
|
|
203
|
+
quickPick.placeholder = ( localize(6636, "Searching file system..."));
|
|
204
204
|
try {
|
|
205
205
|
const fileOptions = await this._createPromptPickItems(options, cts.token);
|
|
206
206
|
const activeItem = options.resource && fileOptions.find(
|
|
@@ -301,7 +301,7 @@ let PromptFilePickers = class PromptFilePickers {
|
|
|
301
301
|
if (locals.length) {
|
|
302
302
|
result.push({
|
|
303
303
|
type: "separator",
|
|
304
|
-
label: ( localize(
|
|
304
|
+
label: ( localize(6637, "Workspace"))
|
|
305
305
|
});
|
|
306
306
|
result.push(...sortByLabel(await Promise.all(( locals.map(l => this._createPromptPickItem(l, buttons, getVisibility(l), token))))));
|
|
307
307
|
}
|
|
@@ -314,7 +314,7 @@ let PromptFilePickers = class PromptFilePickers {
|
|
|
314
314
|
});
|
|
315
315
|
return {
|
|
316
316
|
uri: agentInstructionFile.uri,
|
|
317
|
-
description: agentInstructionFile.type !==
|
|
317
|
+
description: agentInstructionFile.type !== AgentInstructionFileType.copilotInstructionsMd ? folderName : undefined,
|
|
318
318
|
storage: PromptsStorage.local,
|
|
319
319
|
type: options.type
|
|
320
320
|
};
|
|
@@ -324,7 +324,7 @@ let PromptFilePickers = class PromptFilePickers {
|
|
|
324
324
|
const agentButtons = buttons.filter(b => b !== RENAME_BUTTON);
|
|
325
325
|
result.push({
|
|
326
326
|
type: "separator",
|
|
327
|
-
label: ( localize(
|
|
327
|
+
label: ( localize(6638, "Agent Instructions"))
|
|
328
328
|
});
|
|
329
329
|
result.push(...sortByLabel(await Promise.all(( agentInstructionFiles.map(l => this._createPromptPickItem(l, agentButtons, getVisibility(l), token))))));
|
|
330
330
|
}
|
|
@@ -361,7 +361,7 @@ let PromptFilePickers = class PromptFilePickers {
|
|
|
361
361
|
if (users.length) {
|
|
362
362
|
result.push({
|
|
363
363
|
type: "separator",
|
|
364
|
-
label: ( localize(
|
|
364
|
+
label: ( localize(6639, "User Data"))
|
|
365
365
|
});
|
|
366
366
|
result.push(...sortByLabel(await Promise.all(( users.map(u => this._createPromptPickItem(u, buttons, getVisibility(u), token))))));
|
|
367
367
|
}
|
|
@@ -373,7 +373,7 @@ let PromptFilePickers = class PromptFilePickers {
|
|
|
373
373
|
}
|
|
374
374
|
result.push({
|
|
375
375
|
type: "separator",
|
|
376
|
-
label: ( localize(
|
|
376
|
+
label: ( localize(6640, "Plugins"))
|
|
377
377
|
});
|
|
378
378
|
result.push(...sortByLabel(await Promise.all(( plugins.map(p => this._createPromptPickItem(p, pluginButtons, getVisibility(p), token))))));
|
|
379
379
|
}
|
|
@@ -381,9 +381,9 @@ let PromptFilePickers = class PromptFilePickers {
|
|
|
381
381
|
}
|
|
382
382
|
_getExtensionGroupLabel(extPath) {
|
|
383
383
|
if (isOrganizationPromptFile(extPath.uri, extPath.extension.identifier, this._productService)) {
|
|
384
|
-
return localize(
|
|
384
|
+
return localize(6641, "Organization");
|
|
385
385
|
}
|
|
386
|
-
return localize(
|
|
386
|
+
return localize(6642, "Extensions");
|
|
387
387
|
}
|
|
388
388
|
_getNewItems(type) {
|
|
389
389
|
switch (type) {
|
|
@@ -429,8 +429,8 @@ let PromptFilePickers = class PromptFilePickers {
|
|
|
429
429
|
let iconClass;
|
|
430
430
|
if (visibility === false) {
|
|
431
431
|
buttons = (buttons ?? []).concat(MAKE_VISIBLE_BUTTON);
|
|
432
|
-
promptName = ( localize(
|
|
433
|
-
tooltip = ( localize(
|
|
432
|
+
promptName = ( localize(6643, "{0} (hidden)", promptName));
|
|
433
|
+
tooltip = ( localize(6644, "Hidden from chat view agent picker"));
|
|
434
434
|
} else if (visibility === true) {
|
|
435
435
|
buttons = (buttons ?? []).concat(MAKE_INVISIBLE_BUTTON);
|
|
436
436
|
}
|
|
@@ -506,10 +506,10 @@ let PromptFilePickers = class PromptFilePickers {
|
|
|
506
506
|
const isSkill = options.type === PromptsType.skill;
|
|
507
507
|
const filename = isSkill ? basename(dirname(value)) : item.label;
|
|
508
508
|
const message = isSkill ? ( localize(
|
|
509
|
-
|
|
509
|
+
6645,
|
|
510
510
|
"Are you sure you want to delete skill '{0}' and its folder?",
|
|
511
511
|
filename
|
|
512
|
-
)) : ( localize(
|
|
512
|
+
)) : ( localize(6646, "Are you sure you want to delete '{0}'?", filename));
|
|
513
513
|
const {
|
|
514
514
|
confirmed
|
|
515
515
|
} = await this._dialogService.confirm({
|
package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatPasteProviders.js
CHANGED
|
@@ -85,7 +85,7 @@ let PasteImageProvider = class PasteImageProvider {
|
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
87
|
const attachedVariables = widget.attachmentModel.attachments;
|
|
88
|
-
const displayName = ( localize(
|
|
88
|
+
const displayName = ( localize(7212, "Pasted Image"));
|
|
89
89
|
let tempDisplayName = displayName;
|
|
90
90
|
for (let appendValue = 2; ( attachedVariables.some(attachment => attachment.name === tempDisplayName)); appendValue++)
|
|
91
91
|
{
|
|
@@ -107,7 +107,7 @@ let PasteImageProvider = class PasteImageProvider {
|
|
|
107
107
|
if (( currentContextIds.has(scaledImageContext.id))) {
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
110
|
-
const edit = createCustomPasteEdit(model, [scaledImageContext], mimeType, this.kind, ( localize(
|
|
110
|
+
const edit = createCustomPasteEdit(model, [scaledImageContext], mimeType, this.kind, ( localize(7213, "Pasted Image Attachment")), this.chatWidgetService);
|
|
111
111
|
return createEditSession(edit);
|
|
112
112
|
}
|
|
113
113
|
};
|
|
@@ -251,7 +251,7 @@ let CopyAttachmentsProvider = class CopyAttachmentsProvider {
|
|
|
251
251
|
}
|
|
252
252
|
const edit = {
|
|
253
253
|
insertText: textdata,
|
|
254
|
-
title: ( localize(
|
|
254
|
+
title: ( localize(7214, "Insert Prompt & Attachments")),
|
|
255
255
|
kind: this.kind,
|
|
256
256
|
handledMimeType: CopyAttachmentsProvider_1.ATTACHMENT_MIME_TYPE,
|
|
257
257
|
additionalEdit: {
|
|
@@ -327,7 +327,7 @@ class PasteTextProvider {
|
|
|
327
327
|
if (( currentContextIds.has(copiedContext.id))) {
|
|
328
328
|
return;
|
|
329
329
|
}
|
|
330
|
-
const edit = createCustomPasteEdit(model, [copiedContext], Mimes.text, this.kind, ( localize(
|
|
330
|
+
const edit = createCustomPasteEdit(model, [copiedContext], Mimes.text, this.kind, ( localize(7215, "Pasted Code Attachment")), this.chatWidgetService);
|
|
331
331
|
edit.yieldTo = [{
|
|
332
332
|
kind: HierarchicalKind.Empty.append("text", "plain")
|
|
333
333
|
}];
|
|
@@ -339,7 +339,7 @@ function getCopiedContext(code, file, language, range) {
|
|
|
339
339
|
const start = range.startLineNumber;
|
|
340
340
|
const end = range.endLineNumber;
|
|
341
341
|
const resultText = `Copied Selection of Code: \n\n\n From the file: ${fileName} From lines ${start} to ${end} \n \`\`\`${code}\`\`\``;
|
|
342
|
-
const pastedLines = start === end ? ( localize(
|
|
342
|
+
const pastedLines = start === end ? ( localize(7216, "1 line")) : ( localize(7217, "{0} lines", end + 1 - start));
|
|
343
343
|
return {
|
|
344
344
|
kind: "paste",
|
|
345
345
|
value: resultText,
|
|
@@ -361,7 +361,7 @@ function getCopiedContext(code, file, language, range) {
|
|
|
361
361
|
};
|
|
362
362
|
}
|
|
363
363
|
function createCustomPasteEdit(model, context, handledMimeType, kind, title, chatWidgetService) {
|
|
364
|
-
const label = context.length === 1 ? context[0].name : ( localize(
|
|
364
|
+
const label = context.length === 1 ? context[0].name : ( localize(7218, "{0} and {1} more", context[0].name, context.length - 1));
|
|
365
365
|
const announceImageAttachment = context.length === 1 && isImageVariableEntry(context[0]);
|
|
366
366
|
const customEdit = {
|
|
367
367
|
resource: model.uri,
|
|
@@ -380,7 +380,7 @@ function createCustomPasteEdit(model, context, handledMimeType, kind, title, cha
|
|
|
380
380
|
}
|
|
381
381
|
widget.attachmentModel.addContext(...context);
|
|
382
382
|
if (announceImageAttachment) {
|
|
383
|
-
alert(( localize(
|
|
383
|
+
alert(( localize(7219, "Attached image")));
|
|
384
384
|
}
|
|
385
385
|
},
|
|
386
386
|
metadata: {
|
|
@@ -564,7 +564,7 @@ let PasteSymbolProvider = class PasteSymbolProvider {
|
|
|
564
564
|
};
|
|
565
565
|
const edit = {
|
|
566
566
|
insertText,
|
|
567
|
-
title: ( localize(
|
|
567
|
+
title: ( localize(7220, "Pasted Symbol Reference")),
|
|
568
568
|
kind: this.kind,
|
|
569
569
|
handledMimeType: COPY_MIME_TYPES,
|
|
570
570
|
additionalEdit: {
|
|
@@ -410,7 +410,7 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
410
410
|
})];
|
|
411
411
|
}
|
|
412
412
|
_getContextMenuActions() {
|
|
413
|
-
const label = ( localize(
|
|
413
|
+
const label = ( localize(13655, "Toggle Visibility"));
|
|
414
414
|
return [{
|
|
415
415
|
class: undefined,
|
|
416
416
|
tooltip: label,
|
|
@@ -433,7 +433,7 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
433
433
|
actions.push(attachToChatAction, ( new Separator()));
|
|
434
434
|
}
|
|
435
435
|
if (command.command !== "") {
|
|
436
|
-
const labelRun = ( localize(
|
|
436
|
+
const labelRun = ( localize(13656, "Rerun Command"));
|
|
437
437
|
actions.push({
|
|
438
438
|
class: undefined,
|
|
439
439
|
tooltip: labelRun,
|
|
@@ -446,11 +446,11 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
446
446
|
}
|
|
447
447
|
if (!command.isTrusted) {
|
|
448
448
|
const shouldRun = await ( new Promise(r => {
|
|
449
|
-
this._notificationService.prompt(Severity.Info, ( localize(
|
|
450
|
-
label: ( localize(
|
|
449
|
+
this._notificationService.prompt(Severity.Info, ( localize(13657, "Do you want to run the command: {0}", command.command)), [{
|
|
450
|
+
label: ( localize(13658, "Yes")),
|
|
451
451
|
run: () => r(true)
|
|
452
452
|
}, {
|
|
453
|
-
label: ( localize(
|
|
453
|
+
label: ( localize(13659, "No")),
|
|
454
454
|
run: () => r(false)
|
|
455
455
|
}]);
|
|
456
456
|
}));
|
|
@@ -464,7 +464,7 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
464
464
|
}
|
|
465
465
|
});
|
|
466
466
|
actions.push(( new Separator()));
|
|
467
|
-
const labelCopy = ( localize(
|
|
467
|
+
const labelCopy = ( localize(13660, "Copy Command"));
|
|
468
468
|
actions.push({
|
|
469
469
|
class: undefined,
|
|
470
470
|
tooltip: labelCopy,
|
|
@@ -475,7 +475,7 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
475
475
|
});
|
|
476
476
|
}
|
|
477
477
|
if (command.hasOutput()) {
|
|
478
|
-
const labelCopyCommandAndOutput = ( localize(
|
|
478
|
+
const labelCopyCommandAndOutput = ( localize(13661, "Copy Command and Output"));
|
|
479
479
|
actions.push({
|
|
480
480
|
class: undefined,
|
|
481
481
|
tooltip: labelCopyCommandAndOutput,
|
|
@@ -489,7 +489,7 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
491
|
});
|
|
492
|
-
const labelText = ( localize(
|
|
492
|
+
const labelText = ( localize(13662, "Copy Output"));
|
|
493
493
|
actions.push({
|
|
494
494
|
class: undefined,
|
|
495
495
|
tooltip: labelText,
|
|
@@ -503,7 +503,7 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
503
503
|
}
|
|
504
504
|
}
|
|
505
505
|
});
|
|
506
|
-
const labelHtml = ( localize(
|
|
506
|
+
const labelHtml = ( localize(13663, "Copy Output as HTML"));
|
|
507
507
|
actions.push({
|
|
508
508
|
class: undefined,
|
|
509
509
|
tooltip: labelHtml,
|
|
@@ -518,7 +518,7 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
518
518
|
if (actions.length > 0) {
|
|
519
519
|
actions.push(( new Separator()));
|
|
520
520
|
}
|
|
521
|
-
const labelRunRecent = ( localize(
|
|
521
|
+
const labelRunRecent = ( localize(13664, "Run Recent Command"));
|
|
522
522
|
actions.push({
|
|
523
523
|
class: undefined,
|
|
524
524
|
tooltip: labelRunRecent,
|
|
@@ -527,7 +527,7 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
527
527
|
enabled: true,
|
|
528
528
|
run: () => this._commandService.executeCommand("workbench.action.terminal.runRecentCommand")
|
|
529
529
|
});
|
|
530
|
-
const labelGoToRecent = ( localize(
|
|
530
|
+
const labelGoToRecent = ( localize(13665, "Go To Recent Directory"));
|
|
531
531
|
actions.push({
|
|
532
532
|
class: undefined,
|
|
533
533
|
tooltip: labelRunRecent,
|
|
@@ -537,7 +537,7 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
537
537
|
run: () => this._commandService.executeCommand("workbench.action.terminal.goToRecentDirectory")
|
|
538
538
|
});
|
|
539
539
|
actions.push(( new Separator()));
|
|
540
|
-
const labelAbout = ( localize(
|
|
540
|
+
const labelAbout = ( localize(13666, "Learn About Shell Integration"));
|
|
541
541
|
actions.push({
|
|
542
542
|
class: undefined,
|
|
543
543
|
tooltip: labelAbout,
|
|
@@ -553,7 +553,7 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
553
553
|
if (!chatIsEnabled) {
|
|
554
554
|
return undefined;
|
|
555
555
|
}
|
|
556
|
-
const labelAttachToChat = ( localize(
|
|
556
|
+
const labelAttachToChat = ( localize(13667, "Attach To Chat"));
|
|
557
557
|
return {
|
|
558
558
|
class: undefined,
|
|
559
559
|
tooltip: labelAttachToChat,
|
|
@@ -595,14 +595,14 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
595
595
|
quickPick.hideInput = true;
|
|
596
596
|
quickPick.hideCheckAll = true;
|
|
597
597
|
quickPick.canSelectMany = true;
|
|
598
|
-
quickPick.title = ( localize(
|
|
598
|
+
quickPick.title = ( localize(13668, "Toggle visibility"));
|
|
599
599
|
const configValue = this._configurationService.getValue(TerminalSettingId.ShellIntegrationDecorationsEnabled);
|
|
600
600
|
const gutterIcon = {
|
|
601
|
-
label: ( localize(
|
|
601
|
+
label: ( localize(13669, "Gutter command decorations")),
|
|
602
602
|
picked: configValue !== "never" && configValue !== "overviewRuler"
|
|
603
603
|
};
|
|
604
604
|
const overviewRulerIcon = {
|
|
605
|
-
label: ( localize(
|
|
605
|
+
label: ( localize(13670, "Overview ruler command decorations")),
|
|
606
606
|
picked: configValue !== "never" && configValue !== "gutter"
|
|
607
607
|
};
|
|
608
608
|
quickPick.items = [gutterIcon, overviewRulerIcon];
|
|
@@ -39,6 +39,14 @@ export interface IXtermTerminalOptions {
|
|
|
39
39
|
xtermAddonImporter?: XtermAddonImporter;
|
|
40
40
|
/** Whether to disable the overview ruler. */
|
|
41
41
|
disableOverviewRuler?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* When true, skips registering listeners on global singleton services
|
|
44
|
+
* (configuration, theme, log level) to avoid accumulating listeners when
|
|
45
|
+
* many detached terminals are created concurrently. The caller should use
|
|
46
|
+
* {@link XtermTerminal.updateConfig}, {@link XtermTerminal.updateTheme},
|
|
47
|
+
* and {@link XtermTerminal.updateLogLevel} to apply those changes externally.
|
|
48
|
+
*/
|
|
49
|
+
detached?: boolean;
|
|
42
50
|
}
|
|
43
51
|
/**
|
|
44
52
|
* Wraps the xterm object with additional functionality. Interaction with the backing process is out
|
|
@@ -143,6 +151,7 @@ export declare class XtermTerminal extends Disposable implements IXtermTerminal,
|
|
|
143
151
|
private _setFocused;
|
|
144
152
|
write(data: string | Uint8Array, callback?: () => void): void;
|
|
145
153
|
resize(columns: number, rows: number): void;
|
|
154
|
+
updateLogLevel(): void;
|
|
146
155
|
updateConfig(): void;
|
|
147
156
|
private _updateSmoothScrolling;
|
|
148
157
|
private _shouldLoadWebgl;
|
|
@@ -186,6 +195,11 @@ export declare class XtermTerminal extends Disposable implements IXtermTerminal,
|
|
|
186
195
|
getRangeAsVT(startMarker?: IXtermMarker, endMarker?: IXtermMarker, skipLastLine?: boolean): Promise<string>;
|
|
187
196
|
getXtermTheme(theme?: IColorTheme): ITheme;
|
|
188
197
|
private _updateTheme;
|
|
198
|
+
/**
|
|
199
|
+
* Updates the terminal theme. Use this to externally trigger a theme
|
|
200
|
+
* refresh for detached terminals that skip global service listeners.
|
|
201
|
+
*/
|
|
202
|
+
updateTheme(): void;
|
|
189
203
|
refresh(): void;
|
|
190
204
|
private _updateUnicodeVersion;
|
|
191
205
|
_writeText(data: string): void;
|
|
@@ -242,26 +242,28 @@ let XtermTerminal = class XtermTerminal extends Disposable {
|
|
|
242
242
|
})));
|
|
243
243
|
this._updateSmoothScrolling();
|
|
244
244
|
this._core = this.raw._core;
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
this.
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
this.
|
|
264
|
-
|
|
245
|
+
if (!options.detached) {
|
|
246
|
+
this._register(this._configurationService.onDidChangeConfiguration(async e => {
|
|
247
|
+
if (e.affectsConfiguration(TerminalSettingId.GpuAcceleration)) {
|
|
248
|
+
XtermTerminal_1._suggestedRendererType = undefined;
|
|
249
|
+
}
|
|
250
|
+
if (e.affectsConfiguration("terminal.integrated") || e.affectsConfiguration("editor.fastScrollSensitivity") || e.affectsConfiguration("editor.mouseWheelScrollSensitivity") || e.affectsConfiguration("editor.multiCursorModifier")) {
|
|
251
|
+
this.updateConfig();
|
|
252
|
+
}
|
|
253
|
+
if (e.affectsConfiguration(TerminalSettingId.UnicodeVersion)) {
|
|
254
|
+
this._updateUnicodeVersion();
|
|
255
|
+
}
|
|
256
|
+
if (e.affectsConfiguration(TerminalSettingId.ShellIntegrationDecorationsEnabled)) {
|
|
257
|
+
this._updateTheme();
|
|
258
|
+
}
|
|
259
|
+
}));
|
|
260
|
+
this._register(
|
|
261
|
+
this._themeService.onDidColorThemeChange(theme => this._updateTheme(theme))
|
|
262
|
+
);
|
|
263
|
+
this._register(
|
|
264
|
+
this._logService.onDidChangeLogLevel(e => this.raw.options.logLevel = vscodeToXtermLogLevel(e))
|
|
265
|
+
);
|
|
266
|
+
}
|
|
265
267
|
this._register(this.raw.onSelectionChange(() => {
|
|
266
268
|
this._onDidChangeSelection.fire();
|
|
267
269
|
if (this.isFocused) {
|
|
@@ -521,6 +523,9 @@ let XtermTerminal = class XtermTerminal extends Disposable {
|
|
|
521
523
|
this._logService.debug("resizing", columns, rows);
|
|
522
524
|
this.raw.resize(columns, rows);
|
|
523
525
|
}
|
|
526
|
+
updateLogLevel() {
|
|
527
|
+
this.raw.options.logLevel = vscodeToXtermLogLevel(this._logService.getLevel());
|
|
528
|
+
}
|
|
524
529
|
updateConfig() {
|
|
525
530
|
const config = this._terminalConfigurationService.config;
|
|
526
531
|
this.raw.options.altClickMovesCursor = config.altClickMovesCursor;
|
|
@@ -750,7 +755,7 @@ let XtermTerminal = class XtermTerminal extends Disposable {
|
|
|
750
755
|
await this._clipboardService.writeText(this.raw.getSelection());
|
|
751
756
|
}
|
|
752
757
|
} else {
|
|
753
|
-
this._notificationService.warn(( localize(
|
|
758
|
+
this._notificationService.warn(( localize(13681, "The terminal has no selection to copy")));
|
|
754
759
|
}
|
|
755
760
|
}
|
|
756
761
|
_setCursorBlink(blink) {
|
|
@@ -947,6 +952,9 @@ let XtermTerminal = class XtermTerminal extends Disposable {
|
|
|
947
952
|
_updateTheme(theme) {
|
|
948
953
|
this.raw.options.theme = this.getXtermTheme(theme);
|
|
949
954
|
}
|
|
955
|
+
updateTheme() {
|
|
956
|
+
this._updateTheme();
|
|
957
|
+
}
|
|
950
958
|
refresh() {
|
|
951
959
|
this._updateTheme();
|
|
952
960
|
this._decorationAddon.refreshLayouts();
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
2
|
-
import { IChatDebugService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatDebugService.service";
|
|
3
|
-
import { IChatRequestVariableEntry } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/attachments/chatVariableEntries";
|
|
4
|
-
/**
|
|
5
|
-
* Creates a debug events attachment for a chat session.
|
|
6
|
-
* This can be used to attach debug logs to a chat request.
|
|
7
|
-
*/
|
|
8
|
-
export declare function createDebugEventsAttachment(sessionResource: URI, chatDebugService: IChatDebugService): Promise<IChatRequestVariableEntry>;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
3
|
-
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
4
|
-
import { formatDebugEventsForContext, getDebugEventsModelDescription } from '../../common/chatDebugEvents.js';
|
|
5
|
-
|
|
6
|
-
async function createDebugEventsAttachment(sessionResource, chatDebugService) {
|
|
7
|
-
chatDebugService.markDebugDataAttached(sessionResource);
|
|
8
|
-
if (!chatDebugService.hasInvokedProviders(sessionResource)) {
|
|
9
|
-
await chatDebugService.invokeProviders(sessionResource);
|
|
10
|
-
}
|
|
11
|
-
const events = chatDebugService.getEvents(sessionResource);
|
|
12
|
-
const summary = events.length > 0 ? formatDebugEventsForContext(events) : ( localize(5789, "No debug events found for this conversation."));
|
|
13
|
-
return {
|
|
14
|
-
id: "chatDebugEvents",
|
|
15
|
-
name: ( localize(5790, "Debug Events Snapshot")),
|
|
16
|
-
icon: Codicon.output,
|
|
17
|
-
kind: "debugEvents",
|
|
18
|
-
snapshotTime: Date.now(),
|
|
19
|
-
sessionResource,
|
|
20
|
-
value: summary,
|
|
21
|
-
modelDescription: getDebugEventsModelDescription()
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export { createDebugEventsAttachment };
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { IChatDebugEvent } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatDebugService";
|
|
2
|
-
/**
|
|
3
|
-
* Descriptions of each debug event kind for the model. Adding a new event kind
|
|
4
|
-
* to {@link IChatDebugEvent} without adding an entry here will cause a compile error.
|
|
5
|
-
*/
|
|
6
|
-
export declare const debugEventKindDescriptions: Record<IChatDebugEvent["kind"], string>;
|
|
7
|
-
/**
|
|
8
|
-
* Formats debug events into a compact log-style summary for context attachment.
|
|
9
|
-
*/
|
|
10
|
-
export declare function formatDebugEventsForContext(events: readonly IChatDebugEvent[]): string;
|
|
11
|
-
/**
|
|
12
|
-
* Constructs the model description for the debug events attachment,
|
|
13
|
-
* explaining to the model how to use the resolveDebugEventDetails tool.
|
|
14
|
-
*/
|
|
15
|
-
export declare function getDebugEventsModelDescription(): string;
|
|
16
|
-
/**
|
|
17
|
-
* Checks whether a debug event matches a single text search term.
|
|
18
|
-
* Used by both the debug panel filter and the listDebugEvents tool.
|
|
19
|
-
*/
|
|
20
|
-
export declare function debugEventMatchesText(event: IChatDebugEvent, term: string): boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Parse a `before:YYYY[-MM[-DD[THH[:MM[:SS]]]]]` or `after:…` token from
|
|
23
|
-
* free-form filter text. Each component after the year is optional.
|
|
24
|
-
*
|
|
25
|
-
* For `before:`, the timestamp is rounded **up** to the end of the most
|
|
26
|
-
* specific unit given (e.g. `before:2026-03` → end-of-March).
|
|
27
|
-
* For `after:`, the timestamp is the **start** of the most specific unit.
|
|
28
|
-
*/
|
|
29
|
-
export declare function parseTimeToken(text: string, prefix: string): number | undefined;
|
|
30
|
-
/**
|
|
31
|
-
* Strips `before:…` and `after:…` timestamp tokens from filter text,
|
|
32
|
-
* returning only the plain text search portion.
|
|
33
|
-
*/
|
|
34
|
-
export declare function stripTimestampTokens(text: string): string;
|
|
35
|
-
/**
|
|
36
|
-
* Filters debug events by comma-separated text terms and optional
|
|
37
|
-
* `before:`/`after:` timestamp tokens.
|
|
38
|
-
*
|
|
39
|
-
* Terms prefixed with `!` are exclusions; all others are inclusions.
|
|
40
|
-
* At least one inclusion term must match (if any are present).
|
|
41
|
-
* Timestamp tokens are parsed and applied as date-range bounds, then
|
|
42
|
-
* stripped before text matching.
|
|
43
|
-
*/
|
|
44
|
-
export declare function filterDebugEventsByText(events: readonly IChatDebugEvent[], filterText: string): readonly IChatDebugEvent[];
|
|
45
|
-
/**
|
|
46
|
-
* Description of the text filter syntax for tool schemas and documentation.
|
|
47
|
-
*/
|
|
48
|
-
export declare const debugEventFilterDescription = "Comma-separated text search terms. Prefix a term with ! to exclude it. Matches against event kind, tool names, model names, agent names, categories, event names, and message content. Also supports before:YYYY[-MM[-DD[THH[:MM[:SS]]]]] and after:YYYY[-MM[-DD[THH[:MM[:SS]]]]] to filter by timestamp.";
|
|
49
|
-
export interface DebugEventFilterOptions {
|
|
50
|
-
readonly kind?: string;
|
|
51
|
-
readonly filter?: string;
|
|
52
|
-
readonly limit?: number;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Applies kind, text, and limit filters to debug events.
|
|
56
|
-
* Used by the listDebugEvents tool to consolidate all filtering in one place.
|
|
57
|
-
*/
|
|
58
|
-
export declare function filterDebugEvents(events: readonly IChatDebugEvent[], options: DebugEventFilterOptions): readonly IChatDebugEvent[];
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const debugEventKindDescriptions = {
|
|
4
|
-
generic: "- generic (category: \"discovery\"): File discovery for instructions, skills, agents, hooks. Resolving returns a fileList with full file paths, load status, skip reasons, and source folders. Always resolve these for questions about customization files.\n" + "- generic (other): Miscellaneous logs. Resolving returns additional text details.",
|
|
5
|
-
toolCall: "- toolCall: A tool invocation. Resolving returns tool name, input, output, status, and duration.",
|
|
6
|
-
modelTurn: "- modelTurn: An LLM round-trip. Resolving returns model name, token usage, timing, errors, and prompt sections.",
|
|
7
|
-
subagentInvocation: "- subagentInvocation: A sub-agent spawn. Resolving returns agent name, status, duration, and counts.",
|
|
8
|
-
userMessage: "- userMessage: The full prompt sent to the model. Resolving returns the complete message and all prompt sections (system prompt, instructions, context). Essential for understanding what the model received.",
|
|
9
|
-
agentResponse: "- agentResponse: The model's response. Resolving returns the full response text and sections."
|
|
10
|
-
};
|
|
11
|
-
function formatDebugEventsForContext(events) {
|
|
12
|
-
const lines = [];
|
|
13
|
-
for (const event of events) {
|
|
14
|
-
const ts = event.created.toISOString();
|
|
15
|
-
const id = event.id ? ` [id=${event.id}]` : "";
|
|
16
|
-
switch (event.kind) {
|
|
17
|
-
case "generic":
|
|
18
|
-
lines.push(
|
|
19
|
-
`[${ts}]${id} ${event.level >= 3 ? "ERROR" : event.level >= 2 ? "WARN" : "INFO"}: ${event.name}${event.details ? " - " + event.details : ""}${event.category ? " (category: " + event.category + ")" : ""}`
|
|
20
|
-
);
|
|
21
|
-
break;
|
|
22
|
-
case "toolCall":
|
|
23
|
-
lines.push(
|
|
24
|
-
`[${ts}]${id} TOOL_CALL: ${event.toolName}${event.result ? " result=" + event.result : ""}${event.durationInMillis !== undefined ? " duration=" + event.durationInMillis + "ms" : ""}`
|
|
25
|
-
);
|
|
26
|
-
break;
|
|
27
|
-
case "modelTurn":
|
|
28
|
-
lines.push(
|
|
29
|
-
`[${ts}]${id} MODEL_TURN: ${event.requestName ?? "unknown"}${event.model ? " model=" + event.model : ""}${event.inputTokens !== undefined ? " tokens(in=" + event.inputTokens + ",out=" + (event.outputTokens ?? "?") + ")" : ""}${event.durationInMillis !== undefined ? " duration=" + event.durationInMillis + "ms" : ""}`
|
|
30
|
-
);
|
|
31
|
-
break;
|
|
32
|
-
case "subagentInvocation":
|
|
33
|
-
lines.push(
|
|
34
|
-
`[${ts}]${id} SUBAGENT: ${event.agentName}${event.status ? " status=" + event.status : ""}${event.durationInMillis !== undefined ? " duration=" + event.durationInMillis + "ms" : ""}`
|
|
35
|
-
);
|
|
36
|
-
break;
|
|
37
|
-
case "userMessage":
|
|
38
|
-
lines.push(
|
|
39
|
-
`[${ts}]${id} USER_MESSAGE: ${event.message.substring(0, 200)}${event.message.length > 200 ? "..." : ""} (${event.sections.length} sections)`
|
|
40
|
-
);
|
|
41
|
-
break;
|
|
42
|
-
case "agentResponse":
|
|
43
|
-
lines.push(
|
|
44
|
-
`[${ts}]${id} AGENT_RESPONSE: ${event.message.substring(0, 200)}${event.message.length > 200 ? "..." : ""} (${event.sections.length} sections)`
|
|
45
|
-
);
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return lines.join("\n");
|
|
50
|
-
}
|
|
51
|
-
function getDebugEventsModelDescription() {
|
|
52
|
-
return "These are the debug event logs from the current chat conversation. Analyze them to help answer the user's troubleshooting question.\n" + "\n" + "CRITICAL INSTRUCTION: You MUST call the resolveDebugEventDetails tool on relevant events BEFORE answering. The log lines below are only summaries — they do NOT contain the actual data (file paths, prompt content, tool I/O, etc.). The real information is only available by resolving events. Never answer based solely on the summary lines. Always resolve first, then answer.\n" + "\n" + "Call resolveDebugEventDetails in parallel on all events that could be relevant to the user's question. When in doubt, resolve more events rather than fewer.\n" + "\n" + "IMPORTANT: Do NOT mention event IDs, tool resolution steps, or internal debug mechanics in your response. The user does not know about debug events or event IDs. Present your findings directly and naturally, as if you simply know the answer. Never say things like \"I need to resolve events\" or show event IDs.\n" + "\n" + "Event types and what resolving them returns:\n" + ( Object.values(debugEventKindDescriptions)).join("\n");
|
|
53
|
-
}
|
|
54
|
-
function debugEventMatchesText(event, term) {
|
|
55
|
-
if (event.kind.toLowerCase().includes(term)) {
|
|
56
|
-
return true;
|
|
57
|
-
}
|
|
58
|
-
switch (event.kind) {
|
|
59
|
-
case "toolCall":
|
|
60
|
-
return event.toolName.toLowerCase().includes(term) || (event.input?.toLowerCase().includes(term) ?? false) || (event.output?.toLowerCase().includes(term) ?? false);
|
|
61
|
-
case "modelTurn":
|
|
62
|
-
return (event.model?.toLowerCase().includes(term) ?? false) || (event.requestName?.toLowerCase().includes(term) ?? false);
|
|
63
|
-
case "generic":
|
|
64
|
-
return event.name.toLowerCase().includes(term) || (event.details?.toLowerCase().includes(term) ?? false) || (event.category?.toLowerCase().includes(term) ?? false);
|
|
65
|
-
case "subagentInvocation":
|
|
66
|
-
return event.agentName.toLowerCase().includes(term) || (event.description?.toLowerCase().includes(term) ?? false);
|
|
67
|
-
case "userMessage":
|
|
68
|
-
case "agentResponse":
|
|
69
|
-
return event.message.toLowerCase().includes(term) || ( event.sections.some(
|
|
70
|
-
s => s.name.toLowerCase().includes(term) || s.content.toLowerCase().includes(term)
|
|
71
|
-
));
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
const timestampTokenPattern = /\b(?:before|after):\d{4}(?:-\d{2}(?:-\d{2}(?:t\d{1,2}(?::\d{2}(?::\d{2})?)?)?)?)?(\b|$)/g;
|
|
75
|
-
function parseTimeToken(text, prefix) {
|
|
76
|
-
const regex = ( new RegExp(
|
|
77
|
-
`${prefix}:(\\d{4})(?:-(\\d{2})(?:-(\\d{2})(?:t(\\d{1,2})(?::(\\d{2})(?::(\\d{2}))?)?)?)?)?(?!\\w)`
|
|
78
|
-
));
|
|
79
|
-
const m = regex.exec(text);
|
|
80
|
-
if (!m) {
|
|
81
|
-
return undefined;
|
|
82
|
-
}
|
|
83
|
-
const year = parseInt(m[1], 10);
|
|
84
|
-
const month = m[2] !== undefined ? parseInt(m[2], 10) - 1 : undefined;
|
|
85
|
-
const day = m[3] !== undefined ? parseInt(m[3], 10) : undefined;
|
|
86
|
-
const hour = m[4] !== undefined ? parseInt(m[4], 10) : undefined;
|
|
87
|
-
const minute = m[5] !== undefined ? parseInt(m[5], 10) : undefined;
|
|
88
|
-
const second = m[6] !== undefined ? parseInt(m[6], 10) : undefined;
|
|
89
|
-
if (prefix === "before") {
|
|
90
|
-
if (second !== undefined) {
|
|
91
|
-
return ( new Date(year, month, day, hour, minute, second, 999)).getTime();
|
|
92
|
-
} else if (minute !== undefined) {
|
|
93
|
-
return ( new Date(year, month, day, hour, minute, 59, 999)).getTime();
|
|
94
|
-
} else if (hour !== undefined) {
|
|
95
|
-
return ( new Date(year, month, day, hour, 59, 59, 999)).getTime();
|
|
96
|
-
} else if (day !== undefined) {
|
|
97
|
-
return ( new Date(year, month, day, 23, 59, 59, 999)).getTime();
|
|
98
|
-
} else if (month !== undefined) {
|
|
99
|
-
return ( new Date(year, month + 1, 0, 23, 59, 59, 999)).getTime();
|
|
100
|
-
} else {
|
|
101
|
-
return ( new Date(year, 11, 31, 23, 59, 59, 999)).getTime();
|
|
102
|
-
}
|
|
103
|
-
} else {
|
|
104
|
-
return ( new Date(year, month ?? 0, day ?? 1, hour ?? 0, minute ?? 0, second ?? 0, 0)).getTime();
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
function stripTimestampTokens(text) {
|
|
108
|
-
return text.replace(timestampTokenPattern, "").trim();
|
|
109
|
-
}
|
|
110
|
-
function filterDebugEventsByText(events, filterText) {
|
|
111
|
-
const beforeTimestamp = parseTimeToken(filterText, "before");
|
|
112
|
-
const afterTimestamp = parseTimeToken(filterText, "after");
|
|
113
|
-
const textOnly = stripTimestampTokens(filterText);
|
|
114
|
-
const terms = textOnly.split(/\s*,\s*/).filter(t => t.length > 0);
|
|
115
|
-
const includeTerms = ( terms.filter(t => !t.startsWith("!")).map(t => t.trim()));
|
|
116
|
-
const excludeTerms = ( terms.filter(t => t.startsWith("!")).map(t => t.slice(1).trim())).filter(t => t.length > 0);
|
|
117
|
-
return events.filter(e => {
|
|
118
|
-
const time = e.created.getTime();
|
|
119
|
-
if (beforeTimestamp !== undefined && time > beforeTimestamp) {
|
|
120
|
-
return false;
|
|
121
|
-
}
|
|
122
|
-
if (afterTimestamp !== undefined && time < afterTimestamp) {
|
|
123
|
-
return false;
|
|
124
|
-
}
|
|
125
|
-
if (( excludeTerms.some(term => debugEventMatchesText(e, term)))) {
|
|
126
|
-
return false;
|
|
127
|
-
}
|
|
128
|
-
if (includeTerms.length > 0) {
|
|
129
|
-
return ( includeTerms.some(term => debugEventMatchesText(e, term)));
|
|
130
|
-
}
|
|
131
|
-
return true;
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
export { debugEventKindDescriptions, debugEventMatchesText, filterDebugEventsByText, formatDebugEventsForContext, getDebugEventsModelDescription, parseTimeToken, stripTimestampTokens };
|