@codingame/monaco-vscode-chat-service-override 23.0.2 → 23.0.4
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 +43 -43
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +106 -74
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentResolveService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +17 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/simpleBrowserEditorOverlay.js +19 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagement.contribution.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditor.js +18 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditorInput.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.js +28 -28
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatUsageWidget.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOutputItemRenderer.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +32 -32
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/localChatSessionsProvider.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/view/chatSessionsView.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/view/sessionsTreeRenderer.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/view/sessionsViewPane.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions.contribution.js +33 -33
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.js +52 -52
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus.js +65 -65
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +6 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsConfirmationService.js +32 -32
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.js +57 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/chatModeActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptCodingAgentActionOverlay.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptToolsCodeLensProvider.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptUrlHandler.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/runPromptAction.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/saveAsPromptFileActions.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolSetsContribution.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatSessionStore.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/chatPromptFilesContribution.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptCodeActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderAutocompletion.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHovers.js +26 -26
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.js +53 -53
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +27 -27
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +4 -4
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.js +22 -23
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.js +8 -8
- package/vscode/src/vs/workbench/contrib/remoteCodingAgents/browser/remoteCodingAgents.contribution.js +7 -7
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibilityHelp.js +16 -16
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatActions.js +18 -18
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatWidget.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.js +4 -4
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/terminal.chatAgentTools.contribution.js +5 -5
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.js +10 -10
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineFileWriteAnalyzer.js +2 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalLastCommandTool.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalOutputTool.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalSelectionTool.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.js +9 -9
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalConfirmationTool.js +2 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.js +10 -7
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/createAndRunTaskTool.js +15 -15
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/getTaskOutputTool.js +7 -7
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/runTaskTool.js +14 -14
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/taskHelpers.js +1 -1
|
@@ -109,13 +109,13 @@ let CommandLineFileWriteAnalyzer = class CommandLineFileWriteAnalyzer extends Di
|
|
|
109
109
|
const fileWritesList = ( fileWrites.map(fw => `\`${URI.isUri(fw) ? this._labelService.getUriLabel(fw) : fw}\``)).join(', ');
|
|
110
110
|
if (!isAutoApproveAllowed) {
|
|
111
111
|
disclaimers.push(( localize(
|
|
112
|
-
|
|
112
|
+
11847,
|
|
113
113
|
'File write operations detected that cannot be auto approved: {0}',
|
|
114
114
|
fileWritesList
|
|
115
115
|
)));
|
|
116
116
|
}
|
|
117
117
|
else {
|
|
118
|
-
disclaimers.push(( localize(
|
|
118
|
+
disclaimers.push(( localize(11848, 'File write operations detected: {0}', fileWritesList)));
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
return {
|
|
@@ -10,7 +10,7 @@ import { ITerminalService } from '@codingame/monaco-vscode-api/vscode/vs/workben
|
|
|
10
10
|
const GetTerminalLastCommandToolData = {
|
|
11
11
|
id: 'terminal_last_command',
|
|
12
12
|
toolReferenceName: 'terminalLastCommand',
|
|
13
|
-
displayName: ( localize(
|
|
13
|
+
displayName: ( localize(11849, 'Get Terminal Last Command')),
|
|
14
14
|
modelDescription: 'Get the last command run in the active terminal.',
|
|
15
15
|
source: ToolDataSource.Internal,
|
|
16
16
|
icon: Codicon.terminal,
|
|
@@ -22,8 +22,8 @@ let GetTerminalLastCommandTool = class GetTerminalLastCommandTool extends Dispos
|
|
|
22
22
|
}
|
|
23
23
|
async prepareToolInvocation(context, token) {
|
|
24
24
|
return {
|
|
25
|
-
invocationMessage: ( localize(
|
|
26
|
-
pastTenseMessage: ( localize(
|
|
25
|
+
invocationMessage: ( localize(11850, "Getting last terminal command")),
|
|
26
|
+
pastTenseMessage: ( localize(11851, "Got last terminal command")),
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
async invoke(invocation, _countTokens, _progress, token) {
|
|
@@ -8,7 +8,7 @@ import { RunInTerminalTool } from './runInTerminalTool.js';
|
|
|
8
8
|
const GetTerminalOutputToolData = {
|
|
9
9
|
id: 'get_terminal_output',
|
|
10
10
|
toolReferenceName: 'getTerminalOutput',
|
|
11
|
-
displayName: ( localize(
|
|
11
|
+
displayName: ( localize(11852, 'Get Terminal Output')),
|
|
12
12
|
modelDescription: 'Get the output of a terminal command previously started with run_in_terminal',
|
|
13
13
|
icon: Codicon.terminal,
|
|
14
14
|
source: ToolDataSource.Internal,
|
|
@@ -28,8 +28,8 @@ const GetTerminalOutputToolData = {
|
|
|
28
28
|
class GetTerminalOutputTool extends Disposable {
|
|
29
29
|
async prepareToolInvocation(context, token) {
|
|
30
30
|
return {
|
|
31
|
-
invocationMessage: ( localize(
|
|
32
|
-
pastTenseMessage: ( localize(
|
|
31
|
+
invocationMessage: ( localize(11853, "Checking background terminal output")),
|
|
32
|
+
pastTenseMessage: ( localize(11854, "Checked background terminal output")),
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
async invoke(invocation, _countTokens, _progress, token) {
|
|
@@ -9,7 +9,7 @@ import { ITerminalService } from '@codingame/monaco-vscode-api/vscode/vs/workben
|
|
|
9
9
|
const GetTerminalSelectionToolData = {
|
|
10
10
|
id: 'terminal_selection',
|
|
11
11
|
toolReferenceName: 'terminalSelection',
|
|
12
|
-
displayName: ( localize(
|
|
12
|
+
displayName: ( localize(11855, 'Get Terminal Selection')),
|
|
13
13
|
modelDescription: 'Get the current selection in the active terminal.',
|
|
14
14
|
source: ToolDataSource.Internal,
|
|
15
15
|
icon: Codicon.terminal,
|
|
@@ -21,8 +21,8 @@ let GetTerminalSelectionTool = class GetTerminalSelectionTool extends Disposable
|
|
|
21
21
|
}
|
|
22
22
|
async prepareToolInvocation(context, token) {
|
|
23
23
|
return {
|
|
24
|
-
invocationMessage: ( localize(
|
|
25
|
-
pastTenseMessage: ( localize(
|
|
24
|
+
invocationMessage: ( localize(11856, "Reading terminal selection")),
|
|
25
|
+
pastTenseMessage: ( localize(11857, "Read terminal selection")),
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
async invoke(invocation, _countTokens, _progress, token) {
|
|
@@ -255,10 +255,10 @@ let OutputMonitor = class OutputMonitor extends Disposable {
|
|
|
255
255
|
if (token.isCancellationRequested || this._state === OutputMonitorState.Cancelled) {
|
|
256
256
|
return { promise: Promise.resolve(false) };
|
|
257
257
|
}
|
|
258
|
-
const result = this._createElicitationPart(token, context?.sessionId, ( new MarkdownString(( localize(
|
|
259
|
-
|
|
258
|
+
const result = this._createElicitationPart(token, context?.sessionId, ( new MarkdownString(( localize(11858, "Continue waiting for `{0}`?", command)))), ( new MarkdownString(( localize(
|
|
259
|
+
11859,
|
|
260
260
|
"This will continue to poll for output to determine when the terminal becomes idle for up to 2 minutes."
|
|
261
|
-
)))), '', ( localize(
|
|
261
|
+
)))), '', ( localize(11860, 'Yes')), ( localize(11861, 'No')), async () => true, async () => { this._state = OutputMonitorState.Cancelled; return false; });
|
|
262
262
|
return { promise: result.promise.then(p => p ?? false), part: result.part };
|
|
263
263
|
}
|
|
264
264
|
async _assessOutputForErrors(buffer, token) {
|
|
@@ -406,11 +406,11 @@ let OutputMonitor = class OutputMonitor extends Disposable {
|
|
|
406
406
|
return description ? { suggestedOption: { description, option: validOption }, sentToTerminal } : { suggestedOption: validOption, sentToTerminal };
|
|
407
407
|
}
|
|
408
408
|
async _requestFreeFormTerminalInput(token, execution, confirmationPrompt) {
|
|
409
|
-
const { promise: userPrompt, part } = this._createElicitationPart(token, execution.sessionId, ( new MarkdownString(( localize(
|
|
410
|
-
|
|
409
|
+
const { promise: userPrompt, part } = this._createElicitationPart(token, execution.sessionId, ( new MarkdownString(( localize(11862, "The terminal is awaiting input.")))), ( new MarkdownString(( localize(
|
|
410
|
+
11863,
|
|
411
411
|
"{0}\nPlease provide the required input to the terminal.\n\n",
|
|
412
412
|
confirmationPrompt.prompt
|
|
413
|
-
)))), '', ( localize(
|
|
413
|
+
)))), '', ( localize(11864, 'Focus terminal')), undefined, async () => {
|
|
414
414
|
this._showInstance(execution.instance.instanceId);
|
|
415
415
|
return true;
|
|
416
416
|
});
|
|
@@ -430,13 +430,13 @@ let OutputMonitor = class OutputMonitor extends Disposable {
|
|
|
430
430
|
async _confirmRunInTerminal(token, suggestedOption, execution, confirmationPrompt) {
|
|
431
431
|
const suggestedOptionValue = typeof suggestedOption === 'string' ? suggestedOption : suggestedOption.option;
|
|
432
432
|
let inputDataDisposable = Disposable.None;
|
|
433
|
-
const { promise: userPrompt, part } = this._createElicitationPart(token, execution.sessionId, ( new MarkdownString(( localize(
|
|
434
|
-
|
|
433
|
+
const { promise: userPrompt, part } = this._createElicitationPart(token, execution.sessionId, ( new MarkdownString(( localize(11865, "The terminal is awaiting input.")))), ( new MarkdownString(( localize(
|
|
434
|
+
11866,
|
|
435
435
|
"{0}\n Do you want to send `{1}`{2} followed by `Enter` to the terminal?",
|
|
436
436
|
confirmationPrompt.prompt,
|
|
437
437
|
suggestedOptionValue,
|
|
438
438
|
typeof suggestedOption === 'string' ? '' : suggestedOption.description ? ' (' + suggestedOption.description + ')' : ''
|
|
439
|
-
)))), '', ( localize(
|
|
439
|
+
)))), '', ( localize(11867, 'Allow')), ( localize(11868, 'Focus Terminal')), async (value) => {
|
|
440
440
|
let option = undefined;
|
|
441
441
|
if (value === true) {
|
|
442
442
|
option = suggestedOptionValue;
|
|
@@ -6,7 +6,7 @@ import { RunInTerminalTool } from './runInTerminalTool.js';
|
|
|
6
6
|
|
|
7
7
|
const ConfirmTerminalCommandToolData = {
|
|
8
8
|
id: 'vscode_get_terminal_confirmation',
|
|
9
|
-
displayName: ( localize(
|
|
9
|
+
displayName: ( localize(11869, 'Confirm Terminal Command')),
|
|
10
10
|
modelDescription: [
|
|
11
11
|
'This tool allows you to get explicit user confirmation for a terminal command without executing it.',
|
|
12
12
|
'',
|
|
@@ -24,7 +24,7 @@ const ConfirmTerminalCommandToolData = {
|
|
|
24
24
|
'',
|
|
25
25
|
'After confirmation, use a tool to actually execute the command.'
|
|
26
26
|
].join('\n'),
|
|
27
|
-
userDescription: ( localize(
|
|
27
|
+
userDescription: ( localize(11870, 'Tool for confirming terminal commands')),
|
|
28
28
|
source: ToolDataSource.Internal,
|
|
29
29
|
icon: Codicon.shield,
|
|
30
30
|
inputSchema: {
|
|
@@ -43,8 +43,10 @@ import { CommandLineCdPrefixRewriter } from './commandLineRewriter/commandLineCd
|
|
|
43
43
|
import { CommandLinePwshChainOperatorRewriter } from './commandLineRewriter/commandLinePwshChainOperatorRewriter.js';
|
|
44
44
|
import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
|
|
45
45
|
import { IHistoryService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/history/common/history.service';
|
|
46
|
+
import { ChatConfiguration } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
|
|
46
47
|
|
|
47
48
|
var RunInTerminalTool_1;
|
|
49
|
+
const TOOL_REFERENCE_NAME = 'runInTerminal';
|
|
48
50
|
function createPowerShellModelDescription(shell) {
|
|
49
51
|
const isWinPwsh = isWindowsPowerShell(shell);
|
|
50
52
|
return [
|
|
@@ -170,10 +172,10 @@ async function createRunInTerminalToolData(accessor) {
|
|
|
170
172
|
}
|
|
171
173
|
return {
|
|
172
174
|
id: 'run_in_terminal',
|
|
173
|
-
toolReferenceName:
|
|
174
|
-
displayName: ( localize(
|
|
175
|
+
toolReferenceName: TOOL_REFERENCE_NAME,
|
|
176
|
+
displayName: ( localize(11871, 'Run in Terminal')),
|
|
175
177
|
modelDescription,
|
|
176
|
-
userDescription: ( localize(
|
|
178
|
+
userDescription: ( localize(11872, 'Tool for running commands in the terminal')),
|
|
177
179
|
source: ToolDataSource.Internal,
|
|
178
180
|
icon: Codicon.terminal,
|
|
179
181
|
inputSchema: {
|
|
@@ -319,9 +321,10 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
319
321
|
};
|
|
320
322
|
}
|
|
321
323
|
const commandLine = rewrittenCommand ?? args.command;
|
|
324
|
+
const isEligibleForAutoApproval = this._configurationService.getValue(ChatConfiguration.EligibleForAutoApproval)?.[TOOL_REFERENCE_NAME] ?? true;
|
|
322
325
|
const isAutoApproveEnabled = this._configurationService.getValue(TerminalChatAgentToolsSettingId.EnableAutoApprove) === true;
|
|
323
326
|
const isAutoApproveWarningAccepted = this._storageService.getBoolean(TerminalToolConfirmationStorageKeys.TerminalAutoApproveWarningAccepted, StorageScope.APPLICATION, false);
|
|
324
|
-
const isAutoApproveAllowed = isAutoApproveEnabled && isAutoApproveWarningAccepted;
|
|
327
|
+
const isAutoApproveAllowed = isEligibleForAutoApproval && isAutoApproveEnabled && isAutoApproveWarningAccepted;
|
|
325
328
|
const commandLineAnalyzerOptions = {
|
|
326
329
|
commandLine,
|
|
327
330
|
cwd,
|
|
@@ -339,7 +342,7 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
339
342
|
{ supportThemeIcons: true }
|
|
340
343
|
));
|
|
341
344
|
}
|
|
342
|
-
const customActions = ( commandLineAnalyzerResults.map(e => e.customActions ?? [])).flat();
|
|
345
|
+
const customActions = isEligibleForAutoApproval ? ( commandLineAnalyzerResults.map(e => e.customActions ?? [])).flat() : undefined;
|
|
343
346
|
toolSpecificData.autoApproveInfo = commandLineAnalyzerResults.find(e => e.autoApproveInfo)?.autoApproveInfo;
|
|
344
347
|
let shellType = basename(shell, '.exe');
|
|
345
348
|
if (shellType === 'powershell') {
|
|
@@ -348,8 +351,8 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
348
351
|
const isFinalAutoApproved = isAutoApproveAllowed && commandLineAnalyzerResults.every(e => e.isAutoApproveAllowed);
|
|
349
352
|
const confirmationMessages = isFinalAutoApproved ? undefined : {
|
|
350
353
|
title: args.isBackground
|
|
351
|
-
? ( localize(
|
|
352
|
-
: ( localize(
|
|
354
|
+
? ( localize(11873, "Run `{0}` command? (background terminal)", shellType))
|
|
355
|
+
: ( localize(11874, "Run `{0}` command?", shellType)),
|
|
353
356
|
message: ( new MarkdownString(args.explanation)),
|
|
354
357
|
disclaimer,
|
|
355
358
|
terminalCustomActions: customActions,
|
|
@@ -57,7 +57,7 @@ let CreateAndRunTaskTool = class CreateAndRunTaskTool {
|
|
|
57
57
|
await this._fileService.writeFile(tasksJsonUri, VSBuffer.fromString(JSON.stringify(tasksJson, null, '\t')));
|
|
58
58
|
_progress.report({ message: 'Updated tasks.json file' });
|
|
59
59
|
}
|
|
60
|
-
_progress.report({ message: ( new MarkdownString(( localize(
|
|
60
|
+
_progress.report({ message: ( new MarkdownString(( localize(11875, 'Resolving the task')))) });
|
|
61
61
|
let task;
|
|
62
62
|
const start = Date.now();
|
|
63
63
|
while (Date.now() - start < 5000 && !token.isCancellationRequested) {
|
|
@@ -68,9 +68,9 @@ let CreateAndRunTaskTool = class CreateAndRunTaskTool {
|
|
|
68
68
|
await timeout(100);
|
|
69
69
|
}
|
|
70
70
|
if (!task) {
|
|
71
|
-
return { content: [{ kind: 'text', value: `Task not found: ${args.task.label}` }], toolResultMessage: ( new MarkdownString(( localize(
|
|
71
|
+
return { content: [{ kind: 'text', value: `Task not found: ${args.task.label}` }], toolResultMessage: ( new MarkdownString(( localize(11876, 'Task not found: `{0}`', args.task.label)))) };
|
|
72
72
|
}
|
|
73
|
-
_progress.report({ message: ( new MarkdownString(( localize(
|
|
73
|
+
_progress.report({ message: ( new MarkdownString(( localize(11877, 'Running task `{0}`', args.task.label)))) });
|
|
74
74
|
const raceResult = await Promise.race([this._tasksService.run(task, undefined, TaskRunSource.ChatAgent), timeout(3000)]);
|
|
75
75
|
const result = raceResult && typeof raceResult === 'object' ? raceResult : undefined;
|
|
76
76
|
const dependencyTasks = await resolveDependencyTasks(task, args.workspaceFolder, this._configurationService, this._tasksService);
|
|
@@ -78,7 +78,7 @@ let CreateAndRunTaskTool = class CreateAndRunTaskTool {
|
|
|
78
78
|
const terminals = resources?.map(resource => this._terminalService.instances.find(t => t.resource.path === resource?.path && t.resource.scheme === resource.scheme)).filter(Boolean);
|
|
79
79
|
if (!terminals || terminals.length === 0) {
|
|
80
80
|
return { content: [{ kind: 'text', value: `Task started but no terminal was found for: ${args.task.label}` }], toolResultMessage: ( new MarkdownString(( localize(
|
|
81
|
-
|
|
81
|
+
11878,
|
|
82
82
|
'Task started but no terminal was found for: `{0}`',
|
|
83
83
|
args.task.label
|
|
84
84
|
)))) };
|
|
@@ -119,26 +119,26 @@ let CreateAndRunTaskTool = class CreateAndRunTaskTool {
|
|
|
119
119
|
const allTasks = await this._tasksService.tasks();
|
|
120
120
|
if (allTasks?.find(t => t._label === task.label)) {
|
|
121
121
|
return {
|
|
122
|
-
invocationMessage: ( new MarkdownString(( localize(
|
|
123
|
-
pastTenseMessage: ( new MarkdownString(( localize(
|
|
122
|
+
invocationMessage: ( new MarkdownString(( localize(11879, 'Task `{0}` already exists.', task.label)))),
|
|
123
|
+
pastTenseMessage: ( new MarkdownString(( localize(11880, 'Task `{0}` already exists.', task.label)))),
|
|
124
124
|
confirmationMessages: undefined
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
127
|
const activeTasks = await this._tasksService.getActiveTasks();
|
|
128
128
|
if (activeTasks.find(t => t._label === task.label)) {
|
|
129
129
|
return {
|
|
130
|
-
invocationMessage: ( new MarkdownString(( localize(
|
|
131
|
-
pastTenseMessage: ( new MarkdownString(( localize(
|
|
130
|
+
invocationMessage: ( new MarkdownString(( localize(11881, 'Task \`{0}\` is already running.', task.label)))),
|
|
131
|
+
pastTenseMessage: ( new MarkdownString(( localize(11881, 'Task \`{0}\` is already running.', task.label)))),
|
|
132
132
|
confirmationMessages: undefined
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
135
|
return {
|
|
136
|
-
invocationMessage: ( new MarkdownString(( localize(
|
|
137
|
-
pastTenseMessage: ( new MarkdownString(( localize(
|
|
136
|
+
invocationMessage: ( new MarkdownString(( localize(11882, 'Created task \`{0}\`', task.label)))),
|
|
137
|
+
pastTenseMessage: ( new MarkdownString(( localize(11883, 'Created task \`{0}\`', task.label)))),
|
|
138
138
|
confirmationMessages: {
|
|
139
|
-
title: ( localize(
|
|
139
|
+
title: ( localize(11884, 'Allow task creation and execution?')),
|
|
140
140
|
message: ( new MarkdownString(( localize(
|
|
141
|
-
|
|
141
|
+
11885,
|
|
142
142
|
'A task \`{0}\` with command \`{1}\`{2} will be created.',
|
|
143
143
|
task.label,
|
|
144
144
|
task.command,
|
|
@@ -159,12 +159,12 @@ CreateAndRunTaskTool = ( __decorate([
|
|
|
159
159
|
const CreateAndRunTaskToolData = {
|
|
160
160
|
id: 'create_and_run_task',
|
|
161
161
|
toolReferenceName: 'createAndRunTask',
|
|
162
|
-
displayName: ( localize(
|
|
162
|
+
displayName: ( localize(11886, 'Create and run Task')),
|
|
163
163
|
modelDescription: ( localize(
|
|
164
|
-
|
|
164
|
+
11887,
|
|
165
165
|
'Creates and runs a build, run, or custom task for the workspace by generating or adding to a tasks.json file based on the project structure (such as package.json or README.md). If the user asks to build, run, launch and they have no tasks.json file, use this tool. If they ask to create or add a task, use this tool.'
|
|
166
166
|
)),
|
|
167
|
-
userDescription: ( localize(
|
|
167
|
+
userDescription: ( localize(11888, "Create and run a task in the workspace")),
|
|
168
168
|
source: ToolDataSource.Internal,
|
|
169
169
|
inputSchema: {
|
|
170
170
|
'type': 'object',
|
|
@@ -16,7 +16,7 @@ import { toolResultDetailsFromResponse, toolResultMessageFromResponse } from './
|
|
|
16
16
|
const GetTaskOutputToolData = {
|
|
17
17
|
id: 'get_task_output',
|
|
18
18
|
toolReferenceName: 'getTaskOutput',
|
|
19
|
-
displayName: ( localize(
|
|
19
|
+
displayName: ( localize(11889, 'Get Task Output')),
|
|
20
20
|
modelDescription: 'Get the output of a task',
|
|
21
21
|
source: ToolDataSource.Internal,
|
|
22
22
|
when: TasksAvailableContext,
|
|
@@ -52,16 +52,16 @@ let GetTaskOutputTool = class GetTaskOutputTool extends Disposable {
|
|
|
52
52
|
const taskDefinition = getTaskDefinition(args.id);
|
|
53
53
|
const task = await getTaskForTool(args.id, taskDefinition, args.workspaceFolder, this._configurationService, this._tasksService, true);
|
|
54
54
|
if (!task) {
|
|
55
|
-
return { invocationMessage: ( new MarkdownString(( localize(
|
|
55
|
+
return { invocationMessage: ( new MarkdownString(( localize(11890, 'Task not found: `{0}`', args.id)))) };
|
|
56
56
|
}
|
|
57
57
|
const taskLabel = task._label;
|
|
58
58
|
const activeTasks = await this._tasksService.getActiveTasks();
|
|
59
59
|
if (activeTasks.includes(task)) {
|
|
60
|
-
return { invocationMessage: ( new MarkdownString(( localize(
|
|
60
|
+
return { invocationMessage: ( new MarkdownString(( localize(11891, 'The task `{0}` is already running.', taskLabel)))) };
|
|
61
61
|
}
|
|
62
62
|
return {
|
|
63
|
-
invocationMessage: ( new MarkdownString(( localize(
|
|
64
|
-
pastTenseMessage: ( new MarkdownString(( localize(
|
|
63
|
+
invocationMessage: ( new MarkdownString(( localize(11892, 'Checking output for task `{0}`', taskLabel)))),
|
|
64
|
+
pastTenseMessage: ( new MarkdownString(( localize(11893, 'Checked output for task `{0}`', taskLabel)))),
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
67
|
async invoke(invocation, _countTokens, _progress, token) {
|
|
@@ -69,14 +69,14 @@ let GetTaskOutputTool = class GetTaskOutputTool extends Disposable {
|
|
|
69
69
|
const taskDefinition = getTaskDefinition(args.id);
|
|
70
70
|
const task = await getTaskForTool(args.id, taskDefinition, args.workspaceFolder, this._configurationService, this._tasksService, true);
|
|
71
71
|
if (!task) {
|
|
72
|
-
return { content: [{ kind: 'text', value: `Task not found: ${args.id}` }], toolResultMessage: ( new MarkdownString(( localize(
|
|
72
|
+
return { content: [{ kind: 'text', value: `Task not found: ${args.id}` }], toolResultMessage: ( new MarkdownString(( localize(11890, 'Task not found: `{0}`', args.id)))) };
|
|
73
73
|
}
|
|
74
74
|
const dependencyTasks = await resolveDependencyTasks(task, args.workspaceFolder, this._configurationService, this._tasksService);
|
|
75
75
|
const resources = this._tasksService.getTerminalsForTasks(dependencyTasks ?? task);
|
|
76
76
|
const taskLabel = task._label;
|
|
77
77
|
const terminals = resources?.map(resource => this._terminalService.instances.find(t => t.resource.path === resource?.path && t.resource.scheme === resource.scheme)).filter(t => !!t);
|
|
78
78
|
if (!terminals || terminals.length === 0) {
|
|
79
|
-
return { content: [{ kind: 'text', value: `Terminal not found for task ${taskLabel}` }], toolResultMessage: ( new MarkdownString(( localize(
|
|
79
|
+
return { content: [{ kind: 'text', value: `Terminal not found for task ${taskLabel}` }], toolResultMessage: ( new MarkdownString(( localize(11894, 'Terminal not found for task `{0}`', taskLabel)))) };
|
|
80
80
|
}
|
|
81
81
|
const store = ( new DisposableStore());
|
|
82
82
|
const terminalResults = await collectTerminalResults(terminals, task, this._instantiationService, invocation.context, _progress, token, store, (terminalTask) => this._isTaskActive(terminalTask), dependencyTasks);
|
|
@@ -32,23 +32,23 @@ let RunTaskTool = class RunTaskTool {
|
|
|
32
32
|
const taskDefinition = getTaskDefinition(args.id);
|
|
33
33
|
const task = await getTaskForTool(args.id, taskDefinition, args.workspaceFolder, this._configurationService, this._tasksService, true);
|
|
34
34
|
if (!task) {
|
|
35
|
-
return { content: [{ kind: 'text', value: `Task not found: ${args.id}` }], toolResultMessage: ( new MarkdownString(( localize(
|
|
35
|
+
return { content: [{ kind: 'text', value: `Task not found: ${args.id}` }], toolResultMessage: ( new MarkdownString(( localize(11895, 'Task not found: `{0}`', args.id)))) };
|
|
36
36
|
}
|
|
37
37
|
const taskLabel = task._label;
|
|
38
38
|
const activeTasks = await this._tasksService.getActiveTasks();
|
|
39
39
|
if (activeTasks.includes(task)) {
|
|
40
|
-
return { content: [{ kind: 'text', value: `The task ${taskLabel} is already running.` }], toolResultMessage: ( new MarkdownString(( localize(
|
|
40
|
+
return { content: [{ kind: 'text', value: `The task ${taskLabel} is already running.` }], toolResultMessage: ( new MarkdownString(( localize(11896, 'The task `{0}` is already running.', taskLabel)))) };
|
|
41
41
|
}
|
|
42
42
|
const raceResult = await Promise.race([this._tasksService.run(task, undefined, TaskRunSource.ChatAgent), timeout(3000)]);
|
|
43
43
|
const result = raceResult && typeof raceResult === 'object' ? raceResult : undefined;
|
|
44
44
|
const dependencyTasks = await resolveDependencyTasks(task, args.workspaceFolder, this._configurationService, this._tasksService);
|
|
45
45
|
const resources = this._tasksService.getTerminalsForTasks(dependencyTasks ?? task);
|
|
46
46
|
if (!resources || resources.length === 0) {
|
|
47
|
-
return { content: [{ kind: 'text', value: `Task started but no terminal was found for: ${taskLabel}` }], toolResultMessage: ( new MarkdownString(( localize(
|
|
47
|
+
return { content: [{ kind: 'text', value: `Task started but no terminal was found for: ${taskLabel}` }], toolResultMessage: ( new MarkdownString(( localize(11897, 'Task started but no terminal was found for: `{0}`', taskLabel)))) };
|
|
48
48
|
}
|
|
49
49
|
const terminals = this._terminalService.instances.filter(t => ( resources.some(r => r.path === t.resource.path && r.scheme === t.resource.scheme)));
|
|
50
50
|
if (terminals.length === 0) {
|
|
51
|
-
return { content: [{ kind: 'text', value: `Task started but no terminal was found for: ${taskLabel}` }], toolResultMessage: ( new MarkdownString(( localize(
|
|
51
|
+
return { content: [{ kind: 'text', value: `Task started but no terminal was found for: ${taskLabel}` }], toolResultMessage: ( new MarkdownString(( localize(11897, 'Task started but no terminal was found for: `{0}`', taskLabel)))) };
|
|
52
52
|
}
|
|
53
53
|
const store = ( new DisposableStore());
|
|
54
54
|
const terminalResults = await collectTerminalResults(terminals, task, this._instantiationService, invocation.context, _progress, token, store, (terminalTask) => this._isTaskActive(terminalTask), dependencyTasks);
|
|
@@ -85,27 +85,27 @@ let RunTaskTool = class RunTaskTool {
|
|
|
85
85
|
const taskDefinition = getTaskDefinition(args.id);
|
|
86
86
|
const task = await getTaskForTool(args.id, taskDefinition, args.workspaceFolder, this._configurationService, this._tasksService, true);
|
|
87
87
|
if (!task) {
|
|
88
|
-
return { invocationMessage: ( new MarkdownString(( localize(
|
|
88
|
+
return { invocationMessage: ( new MarkdownString(( localize(11895, 'Task not found: `{0}`', args.id)))) };
|
|
89
89
|
}
|
|
90
90
|
const taskLabel = task._label;
|
|
91
91
|
const activeTasks = await this._tasksService.getActiveTasks();
|
|
92
92
|
if (task && activeTasks.includes(task)) {
|
|
93
|
-
return { invocationMessage: ( new MarkdownString(( localize(
|
|
93
|
+
return { invocationMessage: ( new MarkdownString(( localize(11898, 'The task is already running.')))) };
|
|
94
94
|
}
|
|
95
95
|
if (await this._isTaskActive(task)) {
|
|
96
96
|
return {
|
|
97
|
-
invocationMessage: ( new MarkdownString(( localize(
|
|
98
|
-
pastTenseMessage: ( new MarkdownString(( localize(
|
|
97
|
+
invocationMessage: ( new MarkdownString(( localize(11899, '`{0}` is already running.', taskLabel)))),
|
|
98
|
+
pastTenseMessage: ( new MarkdownString(( localize(11900, '`{0}` was already running.', taskLabel)))),
|
|
99
99
|
confirmationMessages: undefined
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
return {
|
|
103
|
-
invocationMessage: ( new MarkdownString(( localize(
|
|
103
|
+
invocationMessage: ( new MarkdownString(( localize(11901, 'Running `{0}`', taskLabel)))),
|
|
104
104
|
pastTenseMessage: ( new MarkdownString(task?.configurationProperties.isBackground
|
|
105
|
-
? ( localize(
|
|
106
|
-
: ( localize(
|
|
105
|
+
? ( localize(11902, 'Started `{0}`', taskLabel))
|
|
106
|
+
: ( localize(11903, 'Ran `{0}`', taskLabel)))),
|
|
107
107
|
confirmationMessages: task
|
|
108
|
-
? { title: ( localize(
|
|
108
|
+
? { title: ( localize(11904, 'Allow task run?')), message: ( localize(11905, 'Allow to run the task `{0}`?', taskLabel)) }
|
|
109
109
|
: undefined
|
|
110
110
|
};
|
|
111
111
|
}
|
|
@@ -120,9 +120,9 @@ RunTaskTool = ( __decorate([
|
|
|
120
120
|
const RunTaskToolData = {
|
|
121
121
|
id: 'run_task',
|
|
122
122
|
toolReferenceName: 'runTask',
|
|
123
|
-
displayName: ( localize(
|
|
123
|
+
displayName: ( localize(11906, 'Run Task')),
|
|
124
124
|
modelDescription: 'Runs a VS Code task.\n\n- If you see that an appropriate task exists for building or running code, prefer to use this tool to run the task instead of using the run_in_terminal tool.\n- Make sure that any appropriate build or watch task is running before trying to run tests or execute code.\n- If the user asks to run a task, use this tool to do so.',
|
|
125
|
-
userDescription: ( localize(
|
|
125
|
+
userDescription: ( localize(11907, 'Tool for running tasks in the workspace')),
|
|
126
126
|
icon: Codicon.tools,
|
|
127
127
|
source: ToolDataSource.Internal,
|
|
128
128
|
when: TasksAvailableContext,
|
|
@@ -17,7 +17,7 @@ function toolResultDetailsFromResponse(terminalResults) {
|
|
|
17
17
|
function toolResultMessageFromResponse(result, taskLabel, toolResultDetails, terminalResults, getOutputTool) {
|
|
18
18
|
let resultSummary = '';
|
|
19
19
|
if (result?.exitCode) {
|
|
20
|
-
resultSummary = ( localize(
|
|
20
|
+
resultSummary = ( localize(11908, 'Task `{0}` failed with exit code {1}.', taskLabel, result.exitCode));
|
|
21
21
|
}
|
|
22
22
|
else {
|
|
23
23
|
resultSummary += `\`${taskLabel}\` task `;
|