@codingame/monaco-vscode-xterm-addons-common 27.0.0 → 28.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContext.d.ts +5 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContext.js +62 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugAttachment.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugAttachment.js +72 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/attachInstructionsAction.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/newPromptFileActions.js +18 -18
- 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.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/promptFilePickers.js +60 -34
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatPasteProviders.js +10 -11
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/decorationAddon.js +16 -16
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.d.ts +0 -118
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.js +0 -1437
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-xterm-addons-common",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "28.0.1",
|
|
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,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@codingame/monaco-vscode-api": "
|
|
18
|
+
"@codingame/monaco-vscode-api": "28.0.1",
|
|
19
19
|
"@xterm/addon-clipboard": "0.3.0-beta.168",
|
|
20
20
|
"@xterm/addon-image": "0.10.0-beta.168",
|
|
21
21
|
"@xterm/addon-ligatures": "0.11.0-beta.168",
|
|
@@ -5,12 +5,16 @@ import { IWorkbenchContribution } from "@codingame/monaco-vscode-api/vscode/vs/w
|
|
|
5
5
|
import { IChatContextValueItem } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/attachments/chatContextPickService";
|
|
6
6
|
import { IChatContextPickService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/attachments/chatContextPickService.service";
|
|
7
7
|
import { IChatRequestVariableEntry } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/attachments/chatVariableEntries";
|
|
8
|
+
import { ILanguageModelToolsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/tools/languageModelToolsService.service";
|
|
8
9
|
import { IChatWidget } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat";
|
|
10
|
+
import { IChatWidgetService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service";
|
|
11
|
+
import { IChatDebugService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatDebugService.service";
|
|
12
|
+
import { IContextKeyService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service";
|
|
9
13
|
import { ITerminalService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal.service";
|
|
10
14
|
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
11
15
|
export declare class ChatContextContributions extends Disposable implements IWorkbenchContribution {
|
|
12
16
|
static readonly ID = "chat.contextContributions";
|
|
13
|
-
constructor(instantiationService: IInstantiationService, contextPickService: IChatContextPickService);
|
|
17
|
+
constructor(instantiationService: IInstantiationService, contextPickService: IChatContextPickService, chatDebugService: IChatDebugService, contextKeyService: IContextKeyService, languageModelToolsService: ILanguageModelToolsService, chatWidgetService: IChatWidgetService);
|
|
14
18
|
}
|
|
15
19
|
export declare class TerminalContext implements IChatContextValueItem {
|
|
16
20
|
private readonly _resource;
|
|
@@ -17,9 +17,15 @@ import { NotebookEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/work
|
|
|
17
17
|
import { IChatContextPickService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/attachments/chatContextPickService.service';
|
|
18
18
|
import { toToolSetVariableEntry, toToolVariableEntry } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/attachments/chatVariableEntries';
|
|
19
19
|
import { isToolSet, ToolDataSource } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/tools/languageModelToolsService';
|
|
20
|
+
import { ILanguageModelToolsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/tools/languageModelToolsService.service';
|
|
21
|
+
import { IChatWidgetService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
20
22
|
import { isImage } from '../widget/input/editor/chatPasteProviders.js';
|
|
21
23
|
import { convertBufferToScreenshotVariable } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/attachments/chatScreenshotContext';
|
|
22
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
|
+
import { ChatContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/actions/chatContextKeys';
|
|
28
|
+
import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
23
29
|
import { ITerminalService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal.service';
|
|
24
30
|
import { TerminalCapability } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/capabilities/capabilities';
|
|
25
31
|
import { imageToHash } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chatImageUtils';
|
|
@@ -28,8 +34,30 @@ let ChatContextContributions = class ChatContextContributions extends Disposable
|
|
|
28
34
|
static {
|
|
29
35
|
this.ID = "chat.contextContributions";
|
|
30
36
|
}
|
|
31
|
-
constructor(
|
|
37
|
+
constructor(
|
|
38
|
+
instantiationService,
|
|
39
|
+
contextPickService,
|
|
40
|
+
chatDebugService,
|
|
41
|
+
contextKeyService,
|
|
42
|
+
languageModelToolsService,
|
|
43
|
+
chatWidgetService
|
|
44
|
+
) {
|
|
32
45
|
super();
|
|
46
|
+
const hasAttachedDebugDataKey = ChatContextKeys.chatSessionHasAttachedDebugData.bindTo(contextKeyService);
|
|
47
|
+
this._store.add(chatWidgetService.onDidChangeFocusedSession(() => {
|
|
48
|
+
const sessionResource = chatWidgetService.lastFocusedWidget?.viewModel?.sessionResource;
|
|
49
|
+
hasAttachedDebugDataKey.set(
|
|
50
|
+
!!sessionResource && chatDebugService.hasAttachedDebugData(sessionResource)
|
|
51
|
+
);
|
|
52
|
+
languageModelToolsService.flushToolUpdates();
|
|
53
|
+
}));
|
|
54
|
+
this._store.add(chatDebugService.onDidAttachDebugData(sessionResource => {
|
|
55
|
+
const focusedSession = chatWidgetService.lastFocusedWidget?.viewModel?.sessionResource;
|
|
56
|
+
if (focusedSession && ( focusedSession.toString()) === ( sessionResource.toString())) {
|
|
57
|
+
hasAttachedDebugDataKey.set(true);
|
|
58
|
+
languageModelToolsService.flushToolUpdates();
|
|
59
|
+
}
|
|
60
|
+
}));
|
|
33
61
|
this._store.add(
|
|
34
62
|
contextPickService.registerChatContextItem(instantiationService.createInstance(ToolsContextPickerPick))
|
|
35
63
|
);
|
|
@@ -45,13 +73,16 @@ let ChatContextContributions = class ChatContextContributions extends Disposable
|
|
|
45
73
|
this._store.add(
|
|
46
74
|
contextPickService.registerChatContextItem(instantiationService.createInstance(ScreenshotContextValuePick))
|
|
47
75
|
);
|
|
76
|
+
this._store.add(
|
|
77
|
+
contextPickService.registerChatContextItem(instantiationService.createInstance(DebugEventsSnapshotContextValuePick))
|
|
78
|
+
);
|
|
48
79
|
}
|
|
49
80
|
};
|
|
50
|
-
ChatContextContributions = ( __decorate([( __param(0, IInstantiationService)), ( __param(1, IChatContextPickService))], ChatContextContributions));
|
|
81
|
+
ChatContextContributions = ( __decorate([( __param(0, IInstantiationService)), ( __param(1, IChatContextPickService)), ( __param(2, IChatDebugService)), ( __param(3, IContextKeyService)), ( __param(4, ILanguageModelToolsService)), ( __param(5, IChatWidgetService))], ChatContextContributions));
|
|
51
82
|
class ToolsContextPickerPick {
|
|
52
83
|
constructor() {
|
|
53
84
|
this.type = "pickerPick";
|
|
54
|
-
this.label = ( localize(
|
|
85
|
+
this.label = ( localize(4846, "Tools..."));
|
|
55
86
|
this.icon = Codicon.tools;
|
|
56
87
|
this.ordinal = -500;
|
|
57
88
|
}
|
|
@@ -102,7 +133,7 @@ class ToolsContextPickerPick {
|
|
|
102
133
|
picks.push(item);
|
|
103
134
|
}
|
|
104
135
|
return {
|
|
105
|
-
placeholder: ( localize(
|
|
136
|
+
placeholder: ( localize(4847, "Select a tool")),
|
|
106
137
|
picks: Promise.resolve(picks)
|
|
107
138
|
};
|
|
108
139
|
}
|
|
@@ -112,7 +143,7 @@ let OpenEditorContextValuePick = class OpenEditorContextValuePick {
|
|
|
112
143
|
this._editorService = _editorService;
|
|
113
144
|
this._labelService = _labelService;
|
|
114
145
|
this.type = "valuePick";
|
|
115
|
-
this.label = ( localize(
|
|
146
|
+
this.label = ( localize(4848, "Open Editors"));
|
|
116
147
|
this.icon = Codicon.file;
|
|
117
148
|
this.ordinal = 800;
|
|
118
149
|
}
|
|
@@ -148,7 +179,7 @@ let ClipboardImageContextValuePick = class ClipboardImageContextValuePick {
|
|
|
148
179
|
constructor(_clipboardService) {
|
|
149
180
|
this._clipboardService = _clipboardService;
|
|
150
181
|
this.type = "valuePick";
|
|
151
|
-
this.label = ( localize(
|
|
182
|
+
this.label = ( localize(4849, "Image from Clipboard"));
|
|
152
183
|
this.icon = Codicon.fileMedia;
|
|
153
184
|
}
|
|
154
185
|
async isEnabled(widget) {
|
|
@@ -165,8 +196,8 @@ let ClipboardImageContextValuePick = class ClipboardImageContextValuePick {
|
|
|
165
196
|
const fileBuffer = await this._clipboardService.readImage();
|
|
166
197
|
return {
|
|
167
198
|
id: await imageToHash(fileBuffer),
|
|
168
|
-
name: ( localize(
|
|
169
|
-
fullName: ( localize(
|
|
199
|
+
name: ( localize(4850, "Pasted Image")),
|
|
200
|
+
fullName: ( localize(4850, "Pasted Image")),
|
|
170
201
|
value: fileBuffer,
|
|
171
202
|
kind: "image"
|
|
172
203
|
};
|
|
@@ -179,7 +210,7 @@ let TerminalContext = class TerminalContext {
|
|
|
179
210
|
this._terminalService = _terminalService;
|
|
180
211
|
this.type = "valuePick";
|
|
181
212
|
this.icon = Codicon.terminal;
|
|
182
|
-
this.label = ( localize(
|
|
213
|
+
this.label = ( localize(4851, "Terminal"));
|
|
183
214
|
}
|
|
184
215
|
isEnabled(widget) {
|
|
185
216
|
const terminal = this._terminalService.getInstanceFromResource(this._resource);
|
|
@@ -244,7 +275,7 @@ let ScreenshotContextValuePick = class ScreenshotContextValuePick {
|
|
|
244
275
|
this._hostService = _hostService;
|
|
245
276
|
this.type = "valuePick";
|
|
246
277
|
this.icon = Codicon.deviceCamera;
|
|
247
|
-
this.label = (isElectron ? ( localize(
|
|
278
|
+
this.label = (isElectron ? ( localize(4852, "Screenshot Window")) : ( localize(4853, "Screenshot")));
|
|
248
279
|
}
|
|
249
280
|
async isEnabled(widget) {
|
|
250
281
|
return !!widget.attachmentCapabilities.supportsImageAttachments && !!widget.input.selectedLanguageModel.get()?.metadata.capabilities?.vision;
|
|
@@ -255,5 +286,26 @@ let ScreenshotContextValuePick = class ScreenshotContextValuePick {
|
|
|
255
286
|
}
|
|
256
287
|
};
|
|
257
288
|
ScreenshotContextValuePick = ( __decorate([( __param(0, IHostService))], ScreenshotContextValuePick));
|
|
289
|
+
let DebugEventsSnapshotContextValuePick = class DebugEventsSnapshotContextValuePick {
|
|
290
|
+
constructor(_chatDebugService) {
|
|
291
|
+
this._chatDebugService = _chatDebugService;
|
|
292
|
+
this.type = "valuePick";
|
|
293
|
+
this.icon = Codicon.output;
|
|
294
|
+
this.label = ( localize(4854, "Debug Events Snapshot"));
|
|
295
|
+
this.ordinal = -600;
|
|
296
|
+
}
|
|
297
|
+
isEnabled(widget) {
|
|
298
|
+
const sessionResource = widget.viewModel?.sessionResource;
|
|
299
|
+
return !!sessionResource && this._chatDebugService.getEvents(sessionResource).length > 0;
|
|
300
|
+
}
|
|
301
|
+
async asAttachment(widget) {
|
|
302
|
+
const sessionResource = widget.viewModel?.sessionResource;
|
|
303
|
+
if (!sessionResource) {
|
|
304
|
+
return undefined;
|
|
305
|
+
}
|
|
306
|
+
return createDebugEventsAttachment(sessionResource, this._chatDebugService);
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
DebugEventsSnapshotContextValuePick = ( __decorate([( __param(0, IChatDebugService))], DebugEventsSnapshotContextValuePick));
|
|
258
310
|
|
|
259
311
|
export { ChatContextContributions, TerminalContext };
|
|
@@ -0,0 +1,8 @@
|
|
|
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>;
|
|
@@ -0,0 +1,72 @@
|
|
|
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
|
+
|
|
5
|
+
const debugEventKindDescriptions = {
|
|
6
|
+
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.",
|
|
7
|
+
toolCall: "- toolCall: A tool invocation. Resolving returns tool name, input, output, status, and duration.",
|
|
8
|
+
modelTurn: "- modelTurn: An LLM round-trip. Resolving returns model name, token usage, timing, errors, and prompt sections.",
|
|
9
|
+
subagentInvocation: "- subagentInvocation: A sub-agent spawn. Resolving returns agent name, status, duration, and counts.",
|
|
10
|
+
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.",
|
|
11
|
+
agentResponse: "- agentResponse: The model's response. Resolving returns the full response text and sections."
|
|
12
|
+
};
|
|
13
|
+
function formatDebugEventsForContext(events) {
|
|
14
|
+
const lines = [];
|
|
15
|
+
for (const event of events) {
|
|
16
|
+
const ts = event.created.toISOString();
|
|
17
|
+
const id = event.id ? ` [id=${event.id}]` : "";
|
|
18
|
+
switch (event.kind) {
|
|
19
|
+
case "generic":
|
|
20
|
+
lines.push(
|
|
21
|
+
`[${ts}]${id} ${event.level >= 3 ? "ERROR" : event.level >= 2 ? "WARN" : "INFO"}: ${event.name}${event.details ? " - " + event.details : ""}${event.category ? " (category: " + event.category + ")" : ""}`
|
|
22
|
+
);
|
|
23
|
+
break;
|
|
24
|
+
case "toolCall":
|
|
25
|
+
lines.push(
|
|
26
|
+
`[${ts}]${id} TOOL_CALL: ${event.toolName}${event.result ? " result=" + event.result : ""}${event.durationInMillis !== undefined ? " duration=" + event.durationInMillis + "ms" : ""}`
|
|
27
|
+
);
|
|
28
|
+
break;
|
|
29
|
+
case "modelTurn":
|
|
30
|
+
lines.push(
|
|
31
|
+
`[${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" : ""}`
|
|
32
|
+
);
|
|
33
|
+
break;
|
|
34
|
+
case "subagentInvocation":
|
|
35
|
+
lines.push(
|
|
36
|
+
`[${ts}]${id} SUBAGENT: ${event.agentName}${event.status ? " status=" + event.status : ""}${event.durationInMillis !== undefined ? " duration=" + event.durationInMillis + "ms" : ""}`
|
|
37
|
+
);
|
|
38
|
+
break;
|
|
39
|
+
case "userMessage":
|
|
40
|
+
lines.push(
|
|
41
|
+
`[${ts}]${id} USER_MESSAGE: ${event.message.substring(0, 200)}${event.message.length > 200 ? "..." : ""} (${event.sections.length} sections)`
|
|
42
|
+
);
|
|
43
|
+
break;
|
|
44
|
+
case "agentResponse":
|
|
45
|
+
lines.push(
|
|
46
|
+
`[${ts}]${id} AGENT_RESPONSE: ${event.message.substring(0, 200)}${event.message.length > 200 ? "..." : ""} (${event.sections.length} sections)`
|
|
47
|
+
);
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return lines.join("\n");
|
|
52
|
+
}
|
|
53
|
+
async function createDebugEventsAttachment(sessionResource, chatDebugService) {
|
|
54
|
+
chatDebugService.markDebugDataAttached(sessionResource);
|
|
55
|
+
if (!chatDebugService.hasInvokedProviders(sessionResource)) {
|
|
56
|
+
await chatDebugService.invokeProviders(sessionResource);
|
|
57
|
+
}
|
|
58
|
+
const events = chatDebugService.getEvents(sessionResource);
|
|
59
|
+
const summary = events.length > 0 ? formatDebugEventsForContext(events) : ( localize(5641, "No debug events found for this conversation."));
|
|
60
|
+
return {
|
|
61
|
+
id: "chatDebugEvents",
|
|
62
|
+
name: ( localize(5642, "Debug Events Snapshot")),
|
|
63
|
+
icon: Codicon.output,
|
|
64
|
+
kind: "debugEvents",
|
|
65
|
+
snapshotTime: Date.now(),
|
|
66
|
+
sessionResource,
|
|
67
|
+
value: summary,
|
|
68
|
+
modelDescription: "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")
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export { createDebugEventsAttachment };
|
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(6262, "Configure Instructions & Rules...")),
|
|
27
|
+
shortTitle: ( localize2(6263, "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(6264, "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(6265, "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(6266, "Select instructions files to attach")),
|
|
93
93
|
picks,
|
|
94
94
|
configure: {
|
|
95
|
-
label: ( localize(
|
|
95
|
+
label: ( localize(6267, "Configure Instructions...")),
|
|
96
96
|
commandId: CONFIGURE_INSTRUCTIONS_ACTION_ID
|
|
97
97
|
}
|
|
98
98
|
};
|
|
@@ -13,7 +13,7 @@ import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log
|
|
|
13
13
|
import { NeverShowAgainScope } from '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification';
|
|
14
14
|
import { INotificationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification.service';
|
|
15
15
|
import { IOpenerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service';
|
|
16
|
-
import { PromptsType, getLanguageIdForPromptsType } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/promptTypes';
|
|
16
|
+
import { PromptsType, Target, getLanguageIdForPromptsType } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/promptTypes';
|
|
17
17
|
import { SyncResource } from '@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync';
|
|
18
18
|
import { IUserDataSyncEnablementService } from '@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync.service';
|
|
19
19
|
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
@@ -24,8 +24,8 @@ 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 { PromptsStorage
|
|
28
|
-
import { getTarget } from '
|
|
27
|
+
import { PromptsStorage } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService';
|
|
28
|
+
import { getTarget } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptFileAttributes';
|
|
29
29
|
import Severity from '@codingame/monaco-vscode-api/vscode/vs/base/common/severity';
|
|
30
30
|
|
|
31
31
|
class AbstractNewPromptFileAction extends Action2 {
|
|
@@ -98,17 +98,17 @@ class AbstractNewPromptFileAction extends Action2 {
|
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
100
|
notificationService.prompt(Severity.Info, ( localize(
|
|
101
|
-
|
|
101
|
+
6299,
|
|
102
102
|
"Do you want to backup and sync your user prompt, instruction and custom agent files with Setting Sync?'"
|
|
103
103
|
)), [{
|
|
104
|
-
label: ( localize(
|
|
104
|
+
label: ( localize(6300, "Enable")),
|
|
105
105
|
run: () => {
|
|
106
106
|
commandService.executeCommand(CONFIGURE_SYNC_COMMAND_ID).catch(error => {
|
|
107
107
|
logService.error(`Failed to run '${CONFIGURE_SYNC_COMMAND_ID}' command: ${error}.`);
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
110
|
}, {
|
|
111
|
-
label: ( localize(
|
|
111
|
+
label: ( localize(6301, "Learn More")),
|
|
112
112
|
run: () => {
|
|
113
113
|
openerService.open(( URI.parse("https://aka.ms/vscode-settings-sync-help")));
|
|
114
114
|
}
|
|
@@ -206,24 +206,24 @@ const NEW_AGENT_COMMAND_ID = "workbench.command.new.agent";
|
|
|
206
206
|
const NEW_SKILL_COMMAND_ID = "workbench.command.new.skill";
|
|
207
207
|
class NewPromptFileAction extends AbstractNewPromptFileAction {
|
|
208
208
|
constructor() {
|
|
209
|
-
super(NEW_PROMPT_COMMAND_ID, ( localize(
|
|
209
|
+
super(NEW_PROMPT_COMMAND_ID, ( localize(6302, "New Prompt File...")), PromptsType.prompt);
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
212
|
class NewInstructionsFileAction extends AbstractNewPromptFileAction {
|
|
213
213
|
constructor() {
|
|
214
|
-
super(NEW_INSTRUCTIONS_COMMAND_ID, ( localize(
|
|
214
|
+
super(NEW_INSTRUCTIONS_COMMAND_ID, ( localize(6303, "New Instructions File...")), PromptsType.instructions);
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
class NewAgentFileAction extends AbstractNewPromptFileAction {
|
|
218
218
|
constructor() {
|
|
219
|
-
super(NEW_AGENT_COMMAND_ID, ( localize(
|
|
219
|
+
super(NEW_AGENT_COMMAND_ID, ( localize(6304, "New Custom Agent...")), PromptsType.agent);
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
class NewSkillFileAction extends Action2 {
|
|
223
223
|
constructor() {
|
|
224
224
|
super({
|
|
225
225
|
id: NEW_SKILL_COMMAND_ID,
|
|
226
|
-
title: ( localize(
|
|
226
|
+
title: ( localize(6305, "New Skill File...")),
|
|
227
227
|
f1: false,
|
|
228
228
|
precondition: ChatContextKeys.enabled,
|
|
229
229
|
category: CHAT_CATEGORY,
|
|
@@ -254,29 +254,29 @@ class NewSkillFileAction extends Action2 {
|
|
|
254
254
|
}
|
|
255
255
|
const skillName = await quickInputService.input({
|
|
256
256
|
prompt: ( localize(
|
|
257
|
-
|
|
257
|
+
6306,
|
|
258
258
|
"Enter a name for the skill (lowercase letters, numbers, and hyphens only)"
|
|
259
259
|
)),
|
|
260
|
-
placeHolder: ( localize(
|
|
260
|
+
placeHolder: ( localize(6307, "e.g., pdf-processing, data-analysis")),
|
|
261
261
|
validateInput: async value => {
|
|
262
262
|
if (!value || !value.trim()) {
|
|
263
|
-
return localize(
|
|
263
|
+
return localize(6308, "Skill name is required");
|
|
264
264
|
}
|
|
265
265
|
const name = value.trim();
|
|
266
266
|
if (name.length > 64) {
|
|
267
|
-
return localize(
|
|
267
|
+
return localize(6309, "Skill name must be 64 characters or less");
|
|
268
268
|
}
|
|
269
269
|
if (!/^[a-z0-9-]+$/.test(name)) {
|
|
270
270
|
return localize(
|
|
271
|
-
|
|
271
|
+
6310,
|
|
272
272
|
"Skill name may only contain lowercase letters, numbers, and hyphens"
|
|
273
273
|
);
|
|
274
274
|
}
|
|
275
275
|
if (name.startsWith("-") || name.endsWith("-")) {
|
|
276
|
-
return localize(
|
|
276
|
+
return localize(6311, "Skill name must not start or end with a hyphen");
|
|
277
277
|
}
|
|
278
278
|
if (name.includes("--")) {
|
|
279
|
-
return localize(
|
|
279
|
+
return localize(6312, "Skill name must not contain consecutive hyphens");
|
|
280
280
|
}
|
|
281
281
|
return undefined;
|
|
282
282
|
}
|
|
@@ -308,7 +308,7 @@ class NewUntitledPromptFileAction extends Action2 {
|
|
|
308
308
|
constructor() {
|
|
309
309
|
super({
|
|
310
310
|
id: "workbench.command.new.untitled.prompt",
|
|
311
|
-
title: ( localize2(
|
|
311
|
+
title: ( localize2(6313, "New Untitled Prompt File")),
|
|
312
312
|
f1: true,
|
|
313
313
|
precondition: ChatContextKeys.enabled,
|
|
314
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(6314, "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(6315, "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(6316, "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(6317, "Enter the name of the instructions file");
|
|
60
60
|
case PromptsType.prompt:
|
|
61
|
-
return localize(
|
|
61
|
+
return localize(6318, "Enter the name of the prompt file");
|
|
62
62
|
case PromptsType.agent:
|
|
63
|
-
return localize(
|
|
63
|
+
return localize(6319, "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(6320, "Enter a new name of the instructions file");
|
|
72
72
|
case PromptsType.prompt:
|
|
73
|
-
return localize(
|
|
73
|
+
return localize(6321, "Enter a new name of the prompt file");
|
|
74
74
|
case PromptsType.agent:
|
|
75
|
-
return localize(
|
|
75
|
+
return localize(6322, "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(6323, "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(6324, "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(6325, "Select a location to create the instructions file");
|
|
74
74
|
case PromptsType.prompt:
|
|
75
|
-
return localize(
|
|
75
|
+
return localize(6326, "Select a location to create the prompt file");
|
|
76
76
|
case PromptsType.agent:
|
|
77
|
-
return localize(
|
|
77
|
+
return localize(6327, "Select a location to create the agent file");
|
|
78
78
|
case PromptsType.skill:
|
|
79
|
-
return localize(
|
|
79
|
+
return localize(6328, "Select a location to create the skill");
|
|
80
80
|
case PromptsType.hook:
|
|
81
|
-
return localize(
|
|
81
|
+
return localize(6329, "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(6330, "Select a location to move the instructions file to");
|
|
91
91
|
case PromptsType.prompt:
|
|
92
|
-
return localize(
|
|
92
|
+
return localize(6331, "Select a location to move the prompt file to");
|
|
93
93
|
case PromptsType.agent:
|
|
94
|
-
return localize(
|
|
94
|
+
return localize(6332, "Select a location to move the agent file to");
|
|
95
95
|
case PromptsType.skill:
|
|
96
|
-
return localize(
|
|
96
|
+
return localize(6333, "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(6334, "Select a location to copy the instructions file to");
|
|
106
106
|
case PromptsType.prompt:
|
|
107
|
-
return localize(
|
|
107
|
+
return localize(6335, "Select a location to copy the prompt file to");
|
|
108
108
|
case PromptsType.agent:
|
|
109
|
-
return localize(
|
|
109
|
+
return localize(6336, "Select a location to copy the agent file to");
|
|
110
110
|
case PromptsType.skill:
|
|
111
|
-
return localize(
|
|
111
|
+
return localize(6337, "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(6338, "Learn how to configure reusable prompts");
|
|
140
140
|
case PromptsType.instructions:
|
|
141
|
-
return localize(
|
|
141
|
+
return localize(6339, "Learn how to configure reusable instructions");
|
|
142
142
|
case PromptsType.agent:
|
|
143
|
-
return localize(
|
|
143
|
+
return localize(6340, "Learn how to configure custom agents");
|
|
144
144
|
case PromptsType.skill:
|
|
145
|
-
return localize(
|
|
145
|
+
return localize(6341, "Learn how to configure skills");
|
|
146
146
|
case PromptsType.hook:
|
|
147
|
-
return localize(
|
|
147
|
+
return localize(6342, "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(6343, "No instruction source folders found.");
|
|
156
156
|
case PromptsType.prompt:
|
|
157
|
-
return localize(
|
|
157
|
+
return localize(6344, "No prompt source folders found.");
|
|
158
158
|
case PromptsType.agent:
|
|
159
|
-
return localize(
|
|
159
|
+
return localize(6345, "No agent source folders found.");
|
|
160
160
|
case PromptsType.skill:
|
|
161
|
-
return localize(
|
|
161
|
+
return localize(6346, "No skill source folders found.");
|
|
162
162
|
case PromptsType.hook:
|
|
163
|
-
return localize(
|
|
163
|
+
return localize(6347, "No hook source folders found.");
|
|
164
164
|
default:
|
|
165
165
|
throw ( new Error("Unknown prompt type"));
|
|
166
166
|
}
|