@codingame/monaco-vscode-katex-common 32.0.2 → 33.0.9
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 +3 -3
- package/vscode/src/vs/platform/actions/browser/buttonbar.js +2 -2
- package/vscode/src/vs/platform/agentHost/common/claudeSessionConfigKeys.d.ts +30 -0
- package/vscode/src/vs/platform/agentHost/common/claudeSessionConfigKeys.js +8 -0
- package/vscode/src/vs/platform/agentHost/common/sessionConfigKeys.d.ts +32 -0
- package/vscode/src/vs/platform/agentHost/common/sessionConfigKeys.js +13 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatAccessibilityProvider.js +16 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatElicitationActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +56 -36
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolActions.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolPicker.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostChatInputPicker.contribution.d.ts +45 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostChatInputPicker.contribution.js +114 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostChatInputPicker.d.ts +87 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostChatInputPicker.js +502 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostGenericConfigChips.d.ts +45 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostGenericConfigChips.js +188 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/media/agentHostChatInputPicker.css +153 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionHoverWidget.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsOpener.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.js +30 -30
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.js +52 -52
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.js +34 -34
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/chatToolRiskAssessmentService.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolSetsContribution.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatAgentHover.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatArtifactsWidget.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentMarkdownRenderer.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentMarkdownRenderer.js +23 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAgentCommandContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAnonymousRateLimitedPart.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatChangesSummaryPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCodeCitationContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCommandContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationContentPart.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationWidget.d.ts +13 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationWidget.js +40 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDisabledClaudeHooksContentPart.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatExtensionsContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatHookContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.d.ts +4 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.js +217 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMcpServersInteractionContentPart.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMultiDiffContentPart.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatPlanReviewPart.js +30 -30
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatProgressContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.js +44 -44
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuotaExceededPart.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatReferencesContentPart.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatResourceGroupWidget.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentContentPart.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSuggestNextWidget.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTextEditContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.js +36 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTipContentPart.js +12 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTodoListWidget.js +17 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolInputOutputContentPart.d.ts +1 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolInputOutputContentPart.js +8 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTreeContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatWorkspaceEditContentPart.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/codeBlockPart.js +14 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatTerminalToolProgressPart.css +16 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatExtensionsInstallToolSubPart.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppModel.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppSubPart.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMissingSandboxDepsConfirmationSubPart.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatModifiedFilesConfirmationSubPart.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.js +24 -21
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.d.ts +6 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.js +72 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationCarouselPart.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolOutputPart.d.ts +2 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolOutputPart.js +7 -22
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPartUtilities.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolProgressPart.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/media/toolRiskBadge.css +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/toolRiskBadgeWidget.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/toolRiskBadgeWidget.js +25 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatDragAndDrop.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.d.ts +9 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.js +41 -27
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.js +31 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatFollowups.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputNotificationWidget.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.js +89 -27
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelPicker.d.ts +4 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelPicker.js +203 -107
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelSelectionLogic.d.ts +6 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelSelectionLogic.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatPhoneInputPresenter.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/permissionPickerActionItem.js +18 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/workspacePickerActionItem.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/media/chat.css +32 -81
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageDetails.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageWidget.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/common/chatImageExtraction.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/common/chatPermissionWarnings.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/common/widget/chatColors.js +18 -18
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.js +3 -3
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.js +5 -5
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChat.css +2 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +30 -30
- package/vscode/src/vs/workbench/contrib/interactive/browser/replInputHintContentWidget.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +7 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +24 -24
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +7 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +5 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +1 -1
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditor.js +1 -1
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorInput.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.js +6 -6
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.js +4 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/autoApprove/npmScriptAutoApprover.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.js +12 -12
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineFileWriteAnalyzer.js +4 -4
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.d.ts +29 -7
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.js +27 -8
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.d.ts +17 -8
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.js +150 -69
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.d.ts +1 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.js +9 -14
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
-
import { timeout, DeferredPromise } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
3
|
+
import { timeout, DeferredPromise, RunOnceScheduler } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
4
4
|
import { CancellationTokenSource } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
5
5
|
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
6
6
|
import { CancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
@@ -30,6 +30,7 @@ import { TerminalCapability } from '@codingame/monaco-vscode-api/vscode/vs/platf
|
|
|
30
30
|
import { ITerminalLogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminal.service';
|
|
31
31
|
import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
|
|
32
32
|
import { IHistoryService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/history/common/history.service';
|
|
33
|
+
import { ILifecycleService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle.service';
|
|
33
34
|
import { IRemoteAgentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/remote/common/remoteAgentService.service';
|
|
34
35
|
import { IAgentSessionsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.service';
|
|
35
36
|
import { IChatWidgetService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
@@ -156,7 +157,6 @@ function createSandboxLines(allowToRunUnsandboxedCommands, networkDomains) {
|
|
|
156
157
|
lines.push(
|
|
157
158
|
"- When a command fails due to sandbox restrictions, immediately re-run it with requestUnsandboxedExecution=true. Do NOT ask the user for permission — setting this flag automatically shows a confirmation prompt to the user",
|
|
158
159
|
"- Only set requestUnsandboxedExecution=true when there is evidence of failures caused by the sandbox, e.g. 'Operation not permitted' errors, network failures, or file access errors, etc",
|
|
159
|
-
"- Do NOT set requestUnsandboxedExecution=true without first executing the command in sandbox mode. Always try the command in the sandbox first, and only set requestUnsandboxedExecution=true when retrying after that sandboxed execution failed due to sandbox restrictions.",
|
|
160
160
|
"- When setting requestUnsandboxedExecution=true, also provide requestUnsandboxedExecutionReason explaining why the command needs unsandboxed access"
|
|
161
161
|
);
|
|
162
162
|
} else {
|
|
@@ -251,7 +251,11 @@ function createZshModelDescription(isSandboxEnabled, allowToRunUnsandboxedComman
|
|
|
251
251
|
"- Use jobs, fg, bg for job control",
|
|
252
252
|
"- Use [[ ]] for conditional tests instead of [ ]",
|
|
253
253
|
"- Prefer $() over backticks for command substitution",
|
|
254
|
-
"- Take advantage of zsh globbing features (**, extended globs)"
|
|
254
|
+
"- Take advantage of zsh globbing features (**, extended globs). Note: unmatched globs fail by default (zsh: no matches found) — use a glob qualifier like *(N) or quote the glob if it should be literal",
|
|
255
|
+
"",
|
|
256
|
+
"zsh pitfalls — these WILL cause errors or hangs:",
|
|
257
|
+
"- NEVER use bare == or === as separators (e.g. echo === triggers zsh equals expansion). Quote them: echo '==='",
|
|
258
|
+
"- NEVER use status as a variable name (it is read-only in zsh). Use exit_code or ret instead"
|
|
255
259
|
].join("\n");
|
|
256
260
|
}
|
|
257
261
|
function createFishModelDescription(isSandboxEnabled, allowToRunUnsandboxedCommands, networkDomains) {
|
|
@@ -312,20 +316,20 @@ async function createRunInTerminalToolData(accessor) {
|
|
|
312
316
|
},
|
|
313
317
|
requestUnsandboxedExecution: {
|
|
314
318
|
type: "boolean",
|
|
315
|
-
description: "Request that this command run outside the terminal sandbox. Only set this
|
|
319
|
+
description: "Request that this command run outside the terminal sandbox. Only set this when the command clearly needs unsandboxed access. The user will be prompted before the command runs unsandboxed."
|
|
316
320
|
},
|
|
317
321
|
requestUnsandboxedExecutionReason: {
|
|
318
322
|
type: "string",
|
|
319
|
-
description: "A short explanation of
|
|
323
|
+
description: "A short explanation of why this command must run outside the terminal sandbox. Only provide this when requestUnsandboxedExecution is true."
|
|
320
324
|
}
|
|
321
325
|
} : {};
|
|
322
326
|
return {
|
|
323
327
|
id: TerminalToolId.RunInTerminal,
|
|
324
328
|
toolReferenceName: TOOL_REFERENCE_NAME,
|
|
325
329
|
legacyToolReferenceFullNames: LEGACY_TOOL_REFERENCE_FULL_NAMES,
|
|
326
|
-
displayName: ( localize(
|
|
330
|
+
displayName: ( localize(14482, "Run in Terminal")),
|
|
327
331
|
modelDescription: `${modelDescription}\n\nExecution mode:\n- mode='sync': wait for completion (optionally capped by timeout); if still running when timeout elapses, return with a terminal ID.\n- mode='async': wait for an initial idle/output signal, then return with terminal output snapshot and ID. Timeout caps how long to wait for the initial idle/output signal.\n- Prefer mode='sync' for commands that will prompt for interactive input (e.g., npm init, interactive installers, configuration wizards).\n\nTimeout parameter: For one-shot long-running commands, set a generous timeout as a safety net (e.g. 600000 for installs, longer for big builds). Omit timeout only for processes that should run indefinitely (servers, daemons). If the timeout elapses, you get a terminal ID and can check output later.\n\nTerminal notifications: When an async command finishes or a sync command times out, you will be automatically notified on your next turn with the exit code and terminal output. You will also be notified if the terminal needs input. Do NOT poll or sleep to wait for completion.`,
|
|
328
|
-
userDescription: ( localize(
|
|
332
|
+
userDescription: ( localize(14483, "Run commands in the terminal")),
|
|
329
333
|
source: ToolDataSource.Internal,
|
|
330
334
|
icon: Codicon.terminal,
|
|
331
335
|
inputSchema: {
|
|
@@ -365,7 +369,7 @@ function shouldAutomaticallyRetryUnsandboxed(options) {
|
|
|
365
369
|
const telemetryIgnoredSequences = [
|
|
366
370
|
"\u001b[I",
|
|
367
371
|
"\u001b[O"];
|
|
368
|
-
const altBufferMessage = "\n" + ( localize(
|
|
372
|
+
const altBufferMessage = "\n" + ( localize(14484, "The command opened the alternate buffer."));
|
|
369
373
|
let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
370
374
|
static {
|
|
371
375
|
RunInTerminalTool_1 = this;
|
|
@@ -433,7 +437,7 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
433
437
|
}
|
|
434
438
|
_getUnsandboxedExecutionDisabledMessage() {
|
|
435
439
|
return localize(
|
|
436
|
-
|
|
440
|
+
14485,
|
|
437
441
|
"The command was not executed because it requested to run outside the terminal sandbox, but running commands outside the sandbox is disabled by chat.agent.sandbox.allowUnsandboxedCommands. Run the command in the sandbox instead, or enable the setting to allow unsandboxed execution."
|
|
438
442
|
);
|
|
439
443
|
}
|
|
@@ -456,7 +460,8 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
456
460
|
_terminalSandboxService,
|
|
457
461
|
_workspaceContextService,
|
|
458
462
|
_chatWidgetService,
|
|
459
|
-
_agentSessionsService
|
|
463
|
+
_agentSessionsService,
|
|
464
|
+
lifecycleService
|
|
460
465
|
) {
|
|
461
466
|
super();
|
|
462
467
|
this._chatService = _chatService;
|
|
@@ -480,6 +485,10 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
480
485
|
this._sessionTerminalInstances = ( new ResourceMap());
|
|
481
486
|
this._terminalsBeingDisposedBySessionCleanup = ( new Set());
|
|
482
487
|
this._backgroundNotifications = this._register(( new DisposableMap()));
|
|
488
|
+
this._isShuttingDown = false;
|
|
489
|
+
this._register(lifecycleService.onWillShutdown(() => {
|
|
490
|
+
this._isShuttingDown = true;
|
|
491
|
+
}));
|
|
483
492
|
this._osBackend = this._remoteAgentService.getEnvironment().then(remoteEnv => remoteEnv?.os ?? OS);
|
|
484
493
|
this._terminalToolCreator = this._instantiationService.createInstance(ToolTerminalCreator);
|
|
485
494
|
this._treeSitterCommandParser = this._register(this._instantiationService.createInstance(TreeSitterCommandParser));
|
|
@@ -553,13 +562,13 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
553
562
|
const partialInput = context.rawInput;
|
|
554
563
|
if (partialInput && typeof partialInput === "object" && partialInput.command) {
|
|
555
564
|
const truncatedCommand = buildCommandDisplayText(partialInput.command);
|
|
556
|
-
const invocationMessage = ( new MarkdownString(( localize(
|
|
565
|
+
const invocationMessage = ( new MarkdownString(( localize(14486, "Running `{0}`", escapeMarkdownSyntaxTokens(truncatedCommand)))));
|
|
557
566
|
return {
|
|
558
567
|
invocationMessage
|
|
559
568
|
};
|
|
560
569
|
}
|
|
561
570
|
return {
|
|
562
|
-
invocationMessage: ( localize(
|
|
571
|
+
invocationMessage: ( localize(14487, "Running command"))
|
|
563
572
|
};
|
|
564
573
|
}
|
|
565
574
|
async prepareToolInvocation(context, token) {
|
|
@@ -600,7 +609,7 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
600
609
|
const commandToDisplay = normalizeTerminalCommandForDisplay(args.command);
|
|
601
610
|
return {
|
|
602
611
|
invocationMessage: ( new MarkdownString(( localize(
|
|
603
|
-
|
|
612
|
+
14488,
|
|
604
613
|
"Not running `{0}` because unsandboxed execution is disabled",
|
|
605
614
|
escapeMarkdownSyntaxTokens(buildCommandDisplayText(commandToDisplay))
|
|
606
615
|
)))),
|
|
@@ -657,19 +666,19 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
657
666
|
if (missingDependencies) {
|
|
658
667
|
const depsList = missingDependencies.join(", ");
|
|
659
668
|
sandboxConfirmationMessageForMissingDeps = {
|
|
660
|
-
title: ( localize(
|
|
669
|
+
title: ( localize(14489, "Missing Sandbox Dependencies")),
|
|
661
670
|
message: ( new MarkdownString(( localize(
|
|
662
|
-
|
|
671
|
+
14490,
|
|
663
672
|
"The following dependencies required for sandboxed execution are not installed: {0}. Would you like to install them?",
|
|
664
673
|
depsList
|
|
665
674
|
)))),
|
|
666
675
|
customOptions: [{
|
|
667
676
|
id: "install",
|
|
668
|
-
label: ( localize(
|
|
677
|
+
label: ( localize(14491, "Install")),
|
|
669
678
|
kind: ConfirmationOptionKind.Approve
|
|
670
679
|
}, {
|
|
671
680
|
id: "cancel",
|
|
672
|
-
label: ( localize(
|
|
681
|
+
label: ( localize(14492, "Cancel")),
|
|
673
682
|
kind: ConfirmationOptionKind.Deny
|
|
674
683
|
}]
|
|
675
684
|
};
|
|
@@ -766,12 +775,12 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
766
775
|
cwdLabel: directoryLabel,
|
|
767
776
|
cdPrefix
|
|
768
777
|
};
|
|
769
|
-
confirmationTitle = ( localize(
|
|
778
|
+
confirmationTitle = ( localize(14493, "Run `{0}` command within `{1}`?", shellType, directoryLabel));
|
|
770
779
|
} else {
|
|
771
780
|
toolSpecificData.confirmation = {
|
|
772
781
|
commandLine: commandToDisplay
|
|
773
782
|
};
|
|
774
|
-
confirmationTitle = ( localize(
|
|
783
|
+
confirmationTitle = ( localize(14494, "Run `{0}` command?", shellType));
|
|
775
784
|
}
|
|
776
785
|
const commandForPresenter = extractedCd?.command ?? commandToDisplay;
|
|
777
786
|
let presenterInput = commandForPresenter;
|
|
@@ -792,7 +801,7 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
792
801
|
if (extractedCd && toolSpecificData.confirmation?.cwdLabel) {
|
|
793
802
|
if (presenterResult.languageDisplayName) {
|
|
794
803
|
confirmationTitle = ( localize(
|
|
795
|
-
|
|
804
|
+
14495,
|
|
796
805
|
"Run `{0}` command in `{1}` within `{2}`?",
|
|
797
806
|
presenterResult.languageDisplayName,
|
|
798
807
|
shellType,
|
|
@@ -800,7 +809,7 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
800
809
|
));
|
|
801
810
|
} else {
|
|
802
811
|
confirmationTitle = ( localize(
|
|
803
|
-
|
|
812
|
+
14496,
|
|
804
813
|
"Run command in `{0}` within `{1}`?",
|
|
805
814
|
shellType,
|
|
806
815
|
toolSpecificData.confirmation.cwdLabel
|
|
@@ -809,13 +818,13 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
809
818
|
} else {
|
|
810
819
|
if (presenterResult.languageDisplayName) {
|
|
811
820
|
confirmationTitle = ( localize(
|
|
812
|
-
|
|
821
|
+
14497,
|
|
813
822
|
"Run `{0}` command in `{1}`?",
|
|
814
823
|
presenterResult.languageDisplayName,
|
|
815
824
|
shellType
|
|
816
825
|
));
|
|
817
826
|
} else {
|
|
818
|
-
confirmationTitle = ( localize(
|
|
827
|
+
confirmationTitle = ( localize(14498, "Run command in `{0}`?", shellType));
|
|
819
828
|
}
|
|
820
829
|
}
|
|
821
830
|
if (!presenterResult.processOtherPresenters) {
|
|
@@ -826,28 +835,28 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
826
835
|
}
|
|
827
836
|
if (requiresUnsandboxConfirmation) {
|
|
828
837
|
confirmationTitle = blockedDomains?.length ? ( localize(
|
|
829
|
-
|
|
838
|
+
14499,
|
|
830
839
|
"Run `{0}` command outside the [sandbox]({1}) to access {2}?",
|
|
831
840
|
shellType,
|
|
832
841
|
TERMINAL_SANDBOX_DOCUMENTATION_URL,
|
|
833
842
|
this._formatBlockedDomainsForTitle(blockedDomains)
|
|
834
843
|
)) : ( localize(
|
|
835
|
-
|
|
844
|
+
14500,
|
|
836
845
|
"Run `{0}` command outside the [sandbox]({1})?",
|
|
837
846
|
shellType,
|
|
838
847
|
TERMINAL_SANDBOX_DOCUMENTATION_URL
|
|
839
848
|
));
|
|
840
849
|
}
|
|
841
850
|
const shouldShowConfirmation = (!isFinalAutoApproved && !isSessionAutoApproved) || context.forceConfirmationReason !== undefined;
|
|
842
|
-
const explanation = args.explanation || ( localize(
|
|
843
|
-
const goal = args.goal || ( localize(
|
|
851
|
+
const explanation = args.explanation || ( localize(14501, "No explanation provided"));
|
|
852
|
+
const goal = args.goal || ( localize(14502, "No goal provided"));
|
|
844
853
|
const confirmationMessage = requiresUnsandboxConfirmation ? ( new MarkdownString(( localize(
|
|
845
|
-
|
|
854
|
+
14503,
|
|
846
855
|
"Explanation: {0}\n\nGoal: {1}\n\nReason for leaving the sandbox: {2}",
|
|
847
856
|
explanation,
|
|
848
857
|
goal,
|
|
849
|
-
requestUnsandboxedExecutionReason || ( localize(
|
|
850
|
-
)))) : ( new MarkdownString(( localize(
|
|
858
|
+
requestUnsandboxedExecutionReason || ( localize(14504, "The model indicated that this command needs unsandboxed access."))
|
|
859
|
+
)))) : ( new MarkdownString(( localize(14505, "Explanation: {0}\n\nGoal: {1}", explanation, goal))));
|
|
851
860
|
const confirmationMessages = shouldShowConfirmation ? {
|
|
852
861
|
title: confirmationTitle,
|
|
853
862
|
message: confirmationMessage,
|
|
@@ -858,10 +867,10 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
858
867
|
const rawDisplayCommand = toolSpecificData.commandLine.forDisplay ?? toolSpecificData.commandLine.toolEdited ?? toolSpecificData.commandLine.original;
|
|
859
868
|
const displayCommand = rawDisplayCommand.length > 80 ? rawDisplayCommand.substring(0, 77) + "..." : rawDisplayCommand;
|
|
860
869
|
const invocationMessage = toolSpecificData.commandLine.isSandboxWrapped ? ( new MarkdownString(( localize(
|
|
861
|
-
|
|
870
|
+
14506,
|
|
862
871
|
"Running `{0}` in sandbox",
|
|
863
872
|
escapeMarkdownSyntaxTokens(displayCommand)
|
|
864
|
-
)))) : ( new MarkdownString(( localize(
|
|
873
|
+
)))) : ( new MarkdownString(( localize(14507, "Running `{0}`", escapeMarkdownSyntaxTokens(displayCommand)))));
|
|
865
874
|
return {
|
|
866
875
|
invocationMessage,
|
|
867
876
|
icon: toolSpecificData.commandLine.isSandboxWrapped ? Codicon.terminalSecure : Codicon.terminal,
|
|
@@ -874,7 +883,7 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
874
883
|
return `\`${blockedDomains[0]}\``;
|
|
875
884
|
}
|
|
876
885
|
return localize(
|
|
877
|
-
|
|
886
|
+
14508,
|
|
878
887
|
"`{0}` and {1} more domains",
|
|
879
888
|
blockedDomains[0],
|
|
880
889
|
blockedDomains.length - 1
|
|
@@ -884,13 +893,13 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
884
893
|
if (deniedDomains.length === blockedDomains.length && deniedDomains.length > 0) {
|
|
885
894
|
if (blockedDomains.length === 1) {
|
|
886
895
|
return localize(
|
|
887
|
-
|
|
896
|
+
14509,
|
|
888
897
|
"This command accesses {0}, which is blocked by chat.agent.deniedNetworkDomains.",
|
|
889
898
|
blockedDomains[0]
|
|
890
899
|
);
|
|
891
900
|
}
|
|
892
901
|
return localize(
|
|
893
|
-
|
|
902
|
+
14510,
|
|
894
903
|
"This command accesses {0} and {1} more domains that are blocked by chat.agent.deniedNetworkDomains.",
|
|
895
904
|
blockedDomains[0],
|
|
896
905
|
blockedDomains.length - 1
|
|
@@ -899,13 +908,13 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
899
908
|
if (deniedDomains.length > 0) {
|
|
900
909
|
if (blockedDomains.length === 1) {
|
|
901
910
|
return localize(
|
|
902
|
-
|
|
911
|
+
14511,
|
|
903
912
|
"This command accesses {0}, which is blocked by chat.agent.deniedNetworkDomains or not added to chat.agent.allowedNetworkDomains.",
|
|
904
913
|
blockedDomains[0]
|
|
905
914
|
);
|
|
906
915
|
}
|
|
907
916
|
return localize(
|
|
908
|
-
|
|
917
|
+
14512,
|
|
909
918
|
"This command accesses {0} and {1} more domains that are blocked by chat.agent.deniedNetworkDomains or not added to chat.agent.allowedNetworkDomains.",
|
|
910
919
|
blockedDomains[0],
|
|
911
920
|
blockedDomains.length - 1
|
|
@@ -913,13 +922,13 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
913
922
|
}
|
|
914
923
|
if (blockedDomains.length === 1) {
|
|
915
924
|
return localize(
|
|
916
|
-
|
|
925
|
+
14513,
|
|
917
926
|
"This command accesses {0}, which is not permitted by the current chat.agent.sandbox configuration.",
|
|
918
927
|
blockedDomains[0]
|
|
919
928
|
);
|
|
920
929
|
}
|
|
921
930
|
return localize(
|
|
922
|
-
|
|
931
|
+
14514,
|
|
923
932
|
"This command accesses {0} and {1} more domains that are not permitted by the current chat.agent.sandbox configuration.",
|
|
924
933
|
blockedDomains[0],
|
|
925
934
|
blockedDomains.length - 1
|
|
@@ -1008,13 +1017,13 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
1008
1017
|
const part = ( new ChatElicitationRequestPart(
|
|
1009
1018
|
this._getAutomaticUnsandboxRetryTitle(shellType, blockedDomains),
|
|
1010
1019
|
( new MarkdownString(( localize(
|
|
1011
|
-
|
|
1020
|
+
14515,
|
|
1012
1021
|
"`{0}`",
|
|
1013
1022
|
escapeMarkdownSyntaxTokens(buildCommandDisplayText(command))
|
|
1014
1023
|
)))),
|
|
1015
1024
|
"",
|
|
1016
|
-
( localize(
|
|
1017
|
-
( localize(
|
|
1025
|
+
( localize(14516, "Allow")),
|
|
1026
|
+
( localize(14517, "Skip")),
|
|
1018
1027
|
async () => {
|
|
1019
1028
|
resolveOnce(true);
|
|
1020
1029
|
part.hide();
|
|
@@ -1039,11 +1048,11 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
1039
1048
|
}
|
|
1040
1049
|
_getAutomaticUnsandboxRetryTitle(shellType, blockedDomains) {
|
|
1041
1050
|
return blockedDomains?.length ? ( new MarkdownString(( localize(
|
|
1042
|
-
|
|
1051
|
+
14518,
|
|
1043
1052
|
"Run `{0}` command outside the sandbox to access {1}?",
|
|
1044
1053
|
shellType,
|
|
1045
1054
|
this._formatBlockedDomainsForTitle(blockedDomains)
|
|
1046
|
-
)))) : ( new MarkdownString(( localize(
|
|
1055
|
+
)))) : ( new MarkdownString(( localize(14519, "Run `{0}` command outside the sandbox?", shellType))));
|
|
1047
1056
|
}
|
|
1048
1057
|
_registerSensitiveInputElicitation(
|
|
1049
1058
|
chatSessionResource,
|
|
@@ -1071,10 +1080,10 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
1071
1080
|
if (chatModel instanceof ChatModel) {
|
|
1072
1081
|
const request = chatModel.getRequests().at(-1);
|
|
1073
1082
|
if (request) {
|
|
1074
|
-
const infoPart = ( new ChatElicitationRequestPart(( new MarkdownString(( localize(
|
|
1075
|
-
|
|
1083
|
+
const infoPart = ( new ChatElicitationRequestPart(( new MarkdownString(( localize(14520, "Terminal command cancelled — sensitive input required")))), ( new MarkdownString(( localize(
|
|
1084
|
+
14521,
|
|
1076
1085
|
"The terminal command was prompting for a password or other secret. Auto-approve / autopilot mode cannot safely supply secrets, so the command was cancelled. Run the command interactively if you want to provide the secret."
|
|
1077
|
-
)))), "", ( localize(
|
|
1086
|
+
)))), "", ( localize(14522, "Dismiss")), "", async () => {
|
|
1078
1087
|
infoPart.hide();
|
|
1079
1088
|
return ElicitationState.Accepted;
|
|
1080
1089
|
}, async () => {
|
|
@@ -1098,10 +1107,10 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
1098
1107
|
if (!request) {
|
|
1099
1108
|
return;
|
|
1100
1109
|
}
|
|
1101
|
-
const part = ( new ChatElicitationRequestPart(( new MarkdownString(( localize(
|
|
1102
|
-
|
|
1110
|
+
const part = ( new ChatElicitationRequestPart(( new MarkdownString(( localize(14523, "Terminal is waiting for sensitive input")))), ( new MarkdownString(( localize(
|
|
1111
|
+
14524,
|
|
1103
1112
|
"The terminal command appears to be prompting for a password or other sensitive value. Focus the terminal to type it directly — secrets must not be sent through chat."
|
|
1104
|
-
)))), "", ( localize(
|
|
1113
|
+
)))), "", ( localize(14525, "Focus Terminal")), ( localize(14526, "Cancel Command")), async () => {
|
|
1105
1114
|
pending = undefined;
|
|
1106
1115
|
part.hide();
|
|
1107
1116
|
try {
|
|
@@ -1146,10 +1155,10 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
1146
1155
|
const progress = {
|
|
1147
1156
|
kind: "externalToolInvocationUpdate",
|
|
1148
1157
|
toolCallId,
|
|
1149
|
-
toolName: ( localize(
|
|
1158
|
+
toolName: ( localize(14482, "Run in Terminal")),
|
|
1150
1159
|
isComplete,
|
|
1151
1160
|
invocationMessage: ( new MarkdownString(( localize(
|
|
1152
|
-
|
|
1161
|
+
14527,
|
|
1153
1162
|
"Running `{0}` outside the sandbox",
|
|
1154
1163
|
escapeMarkdownSyntaxTokens(displayCommand)
|
|
1155
1164
|
)))),
|
|
@@ -1215,7 +1224,7 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
1215
1224
|
content: [{
|
|
1216
1225
|
kind: "text",
|
|
1217
1226
|
value: ( localize(
|
|
1218
|
-
|
|
1227
|
+
14528,
|
|
1219
1228
|
"Sandbox dependency installation failed (exit code {0}). The command was not executed.",
|
|
1220
1229
|
exitCode
|
|
1221
1230
|
))
|
|
@@ -1227,7 +1236,7 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
1227
1236
|
content: [{
|
|
1228
1237
|
kind: "text",
|
|
1229
1238
|
value: ( localize(
|
|
1230
|
-
|
|
1239
|
+
14529,
|
|
1231
1240
|
"Could not determine whether sandbox dependency installation succeeded. The command was not executed."
|
|
1232
1241
|
))
|
|
1233
1242
|
}]
|
|
@@ -1241,7 +1250,7 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
1241
1250
|
return {
|
|
1242
1251
|
content: [{
|
|
1243
1252
|
kind: "text",
|
|
1244
|
-
value: ( localize(
|
|
1253
|
+
value: ( localize(14530, "Sandbox dependency installation was cancelled by the user."))
|
|
1245
1254
|
}]
|
|
1246
1255
|
};
|
|
1247
1256
|
}
|
|
@@ -1273,7 +1282,7 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
1273
1282
|
}
|
|
1274
1283
|
let error;
|
|
1275
1284
|
const automaticUnsandboxRetryReason = ( localize(
|
|
1276
|
-
|
|
1285
|
+
14531,
|
|
1277
1286
|
"The sandboxed execution output indicated the sandbox blocked the command."
|
|
1278
1287
|
));
|
|
1279
1288
|
const isNewSession = !executionOptions.persistentSession && !( this._sessionTerminalAssociations.has(chatSessionResource));
|
|
@@ -1311,6 +1320,7 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
1311
1320
|
let exitCode;
|
|
1312
1321
|
let altBufferResult;
|
|
1313
1322
|
let didTimeout = false;
|
|
1323
|
+
let didIdleSilence = false;
|
|
1314
1324
|
let didInputNeeded = false;
|
|
1315
1325
|
let didSensitiveAutoCancelled = false;
|
|
1316
1326
|
let isBackgroundExecution = executionOptions.persistentSession;
|
|
@@ -1421,7 +1431,7 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
1421
1431
|
resultText += `${outputAnalyzerMessage}\n`;
|
|
1422
1432
|
}
|
|
1423
1433
|
resultText += pollingResult.output;
|
|
1424
|
-
resultText += `\n${this._buildInputNeededSteeringText(chatSessionResource, termId,
|
|
1434
|
+
resultText += `\n${this._buildInputNeededSteeringText(chatSessionResource, termId, "none")}`;
|
|
1425
1435
|
} else if (pollingResult) {
|
|
1426
1436
|
resultText += `\n The command is still running, with output:\n`;
|
|
1427
1437
|
if (outputAnalyzerMessage) {
|
|
@@ -1474,8 +1484,22 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
1474
1484
|
if (timeoutRacePromise) {
|
|
1475
1485
|
raceCandidates.push(timeoutRacePromise);
|
|
1476
1486
|
}
|
|
1477
|
-
const
|
|
1478
|
-
|
|
1487
|
+
const idleSilenceMs = this._configurationService.getValue(TerminalChatAgentToolsSettingId.IdleSilenceTimeoutMs) ?? 60000;
|
|
1488
|
+
if (idleSilenceMs > 0) {
|
|
1489
|
+
const idleSilenceDeferred = ( new DeferredPromise());
|
|
1490
|
+
const idleSilenceScheduler = raceCleanup.add(( new RunOnceScheduler(() => idleSilenceDeferred.complete({
|
|
1491
|
+
type: "idleSilence"
|
|
1492
|
+
}), idleSilenceMs)));
|
|
1493
|
+
raceCleanup.add(toolTerminal.instance.onData(() => idleSilenceScheduler.schedule()));
|
|
1494
|
+
idleSilenceScheduler.schedule();
|
|
1495
|
+
raceCandidates.push(idleSilenceDeferred.p);
|
|
1496
|
+
}
|
|
1497
|
+
let raceResult;
|
|
1498
|
+
try {
|
|
1499
|
+
raceResult = await Promise.race(raceCandidates);
|
|
1500
|
+
} finally {
|
|
1501
|
+
raceCleanup.dispose();
|
|
1502
|
+
}
|
|
1479
1503
|
if (raceResult.type === "inputNeeded") {
|
|
1480
1504
|
this._logService.debug(
|
|
1481
1505
|
`RunInTerminalTool: Output monitor detected input needed in foreground terminal, returning output to agent`
|
|
@@ -1499,6 +1523,7 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
1499
1523
|
didTimeout = true;
|
|
1500
1524
|
isBackgroundExecution = true;
|
|
1501
1525
|
toolTerminal.isBackground = true;
|
|
1526
|
+
toolSpecificData.didContinueInBackground = true;
|
|
1502
1527
|
this._sessionTerminalAssociations.delete(chatSessionResource);
|
|
1503
1528
|
await this._associateProcessIdWithSession(
|
|
1504
1529
|
toolTerminal.instance,
|
|
@@ -1510,6 +1535,26 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
1510
1535
|
const timeoutOutput = execution.getOutput();
|
|
1511
1536
|
outputLineCount = timeoutOutput ? count(timeoutOutput.trim(), "\n") + 1 : 0;
|
|
1512
1537
|
terminalResult = timeoutOutput ?? "";
|
|
1538
|
+
} else if (raceResult.type === "idleSilence") {
|
|
1539
|
+
this._logService.debug(
|
|
1540
|
+
`RunInTerminalTool: Idle silence reached (${idleSilenceMs}ms), promoting to background`
|
|
1541
|
+
);
|
|
1542
|
+
error = "idleSilence";
|
|
1543
|
+
didIdleSilence = true;
|
|
1544
|
+
isBackgroundExecution = true;
|
|
1545
|
+
toolTerminal.isBackground = true;
|
|
1546
|
+
toolSpecificData.didContinueInBackground = true;
|
|
1547
|
+
this._sessionTerminalAssociations.delete(chatSessionResource);
|
|
1548
|
+
await this._associateProcessIdWithSession(
|
|
1549
|
+
toolTerminal.instance,
|
|
1550
|
+
chatSessionResource,
|
|
1551
|
+
termId,
|
|
1552
|
+
toolTerminal.shellIntegrationQuality,
|
|
1553
|
+
true
|
|
1554
|
+
);
|
|
1555
|
+
const idleSilenceOutput = execution.getOutput();
|
|
1556
|
+
outputLineCount = idleSilenceOutput ? count(idleSilenceOutput.trim(), "\n") + 1 : 0;
|
|
1557
|
+
terminalResult = idleSilenceOutput ?? "";
|
|
1513
1558
|
} else {
|
|
1514
1559
|
const executeResult = raceResult.result;
|
|
1515
1560
|
toolTerminal.receivedUserInput = false;
|
|
@@ -1573,6 +1618,7 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
1573
1618
|
error = "timeout";
|
|
1574
1619
|
isBackgroundExecution = true;
|
|
1575
1620
|
toolTerminal.isBackground = true;
|
|
1621
|
+
toolSpecificData.didContinueInBackground = true;
|
|
1576
1622
|
this._sessionTerminalAssociations.delete(chatSessionResource);
|
|
1577
1623
|
const timeoutOutput = getOutput(toolTerminal.instance, undefined);
|
|
1578
1624
|
outputLineCount = timeoutOutput ? count(timeoutOutput.trim(), "\n") + 1 : 0;
|
|
@@ -1610,6 +1656,7 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
1610
1656
|
termId,
|
|
1611
1657
|
chatSessionResource,
|
|
1612
1658
|
command,
|
|
1659
|
+
toolSpecificData,
|
|
1613
1660
|
outputMonitor,
|
|
1614
1661
|
alreadyNotifiedInputNeededOutput
|
|
1615
1662
|
);
|
|
@@ -1765,12 +1812,17 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
1765
1812
|
);
|
|
1766
1813
|
} else if (didInputNeeded) {
|
|
1767
1814
|
resultText.push(
|
|
1768
|
-
`Note: The command is running in terminal ID ${termId} and may be waiting for input.\n${this._buildInputNeededSteeringText(chatSessionResource, termId,
|
|
1815
|
+
`Note: The command is running in terminal ID ${termId} and may be waiting for input.\n${this._buildInputNeededSteeringText(chatSessionResource, termId, "none")}\n\n`
|
|
1769
1816
|
);
|
|
1770
1817
|
} else if (didTimeout && timeoutValue !== undefined && timeoutValue > 0) {
|
|
1771
1818
|
const notificationHint = shouldSendNotifications ? " You will be automatically notified on your next turn when it completes." : "";
|
|
1772
1819
|
resultText.push(
|
|
1773
|
-
`Note: Command timed out after ${timeoutValue}ms. The command may still be running in terminal ID ${termId}.${notificationHint}\n${this._buildInputNeededSteeringText(chatSessionResource, termId,
|
|
1820
|
+
`Note: Command timed out after ${timeoutValue}ms. The command may still be running in terminal ID ${termId}.${notificationHint}\n${this._buildInputNeededSteeringText(chatSessionResource, termId, "timeout")}\n\n`
|
|
1821
|
+
);
|
|
1822
|
+
} else if (didIdleSilence) {
|
|
1823
|
+
const notificationHint = shouldSendNotifications ? " You will be automatically notified on your next turn when it completes." : "";
|
|
1824
|
+
resultText.push(
|
|
1825
|
+
`Note: The command produced no new output for an extended period and was moved to background terminal ID ${termId}; the process is still running and has not been killed.${notificationHint}\n${this._buildInputNeededSteeringText(chatSessionResource, termId, "idleSilence")}\n\n`
|
|
1774
1826
|
);
|
|
1775
1827
|
}
|
|
1776
1828
|
const outputAnalyzerMessage = await this._getOutputAnalyzerMessage(exitCode, terminalResult, command, didSandboxWrapCommand);
|
|
@@ -1807,7 +1859,7 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
1807
1859
|
}, ...imageContent]
|
|
1808
1860
|
};
|
|
1809
1861
|
}
|
|
1810
|
-
_buildInputNeededSteeringText(chatSessionResource, termId,
|
|
1862
|
+
_buildInputNeededSteeringText(chatSessionResource, termId, hungHint) {
|
|
1811
1863
|
const isAutoApproved = isSessionAutoApproveLevel(
|
|
1812
1864
|
chatSessionResource,
|
|
1813
1865
|
this._configurationService,
|
|
@@ -1833,10 +1885,14 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
1833
1885
|
` 2. Only if the output clearly ends with a real non-secret input prompt (Continue? (y/n), Enter selection, etc. — a normal shell prompt like \`$\` or \`#\` does NOT count), call the vscode_askQuestions tool to ask the user, then send each answer using ${TerminalToolId.SendToTerminal} with id="${termId}" (which returns the next few lines of output). Repeat one prompt at a time. NEVER route secret prompts (passwords, passphrases, tokens, API keys, etc.) through vscode_askQuestions — answers to that tool are sent through the model. For secret prompts, tell the user to type the value directly into the terminal and stop.`
|
|
1834
1886
|
);
|
|
1835
1887
|
}
|
|
1836
|
-
if (
|
|
1888
|
+
if (hungHint === "timeout") {
|
|
1837
1889
|
lines.push(
|
|
1838
1890
|
` 3. A timeout does not mean the command failed — call ${TerminalToolId.GetTerminalOutput} with id="${termId}" to continue polling. Only call ${TerminalToolId.KillTerminal} if the command is genuinely hung and you need to retry with a different approach.`
|
|
1839
1891
|
);
|
|
1892
|
+
} else if (hungHint === "idleSilence") {
|
|
1893
|
+
lines.push(
|
|
1894
|
+
` 3. Producing no output for an extended period does not mean the command failed — call ${TerminalToolId.GetTerminalOutput} with id="${termId}" to continue polling. Only call ${TerminalToolId.KillTerminal} if the command is genuinely hung and you need to retry with a different approach.`
|
|
1895
|
+
);
|
|
1840
1896
|
}
|
|
1841
1897
|
return lines.join("\n");
|
|
1842
1898
|
}
|
|
@@ -2153,6 +2209,7 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
2153
2209
|
termId,
|
|
2154
2210
|
chatSessionResource,
|
|
2155
2211
|
commandName,
|
|
2212
|
+
toolSpecificData,
|
|
2156
2213
|
outputMonitor,
|
|
2157
2214
|
alreadyNotifiedInputNeededOutput
|
|
2158
2215
|
) {
|
|
@@ -2224,6 +2281,12 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
2224
2281
|
);
|
|
2225
2282
|
return;
|
|
2226
2283
|
}
|
|
2284
|
+
if (terminalInstance.isDisposed) {
|
|
2285
|
+
this._logService.debug(
|
|
2286
|
+
`RunInTerminalTool: Suppressing input-needed notification for terminal ${termId} because the terminal is disposed`
|
|
2287
|
+
);
|
|
2288
|
+
return;
|
|
2289
|
+
}
|
|
2227
2290
|
if (handleSessionCancelled()) {
|
|
2228
2291
|
return;
|
|
2229
2292
|
}
|
|
@@ -2239,7 +2302,7 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
2239
2302
|
}
|
|
2240
2303
|
lastInputNeededOutput = currentOutput;
|
|
2241
2304
|
lastInputNeededNotificationTime = now;
|
|
2242
|
-
const inputAction = this._buildInputNeededSteeringText(chatSessionResource, termId,
|
|
2305
|
+
const inputAction = this._buildInputNeededSteeringText(chatSessionResource, termId, "none");
|
|
2243
2306
|
const message = `[Terminal ${termId} notification: command may be waiting for input — assess the output below.]\n${inputAction}\nTerminal output:\n${currentOutput}`;
|
|
2244
2307
|
this._logService.debug(
|
|
2245
2308
|
`RunInTerminalTool: Input needed in background terminal ${termId}, notifying chat session`
|
|
@@ -2248,7 +2311,7 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
2248
2311
|
...sendOptions,
|
|
2249
2312
|
queue: ChatRequestQueueKind.Steering,
|
|
2250
2313
|
isSystemInitiated: true,
|
|
2251
|
-
systemInitiatedLabel: ( localize(
|
|
2314
|
+
systemInitiatedLabel: ( localize(14532, "`{0}` may need input", commandName)),
|
|
2252
2315
|
terminalExecutionId: termId
|
|
2253
2316
|
}).catch(e => {
|
|
2254
2317
|
this._logService.warn(
|
|
@@ -2279,7 +2342,8 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
2279
2342
|
const exitCode = command.exitCode;
|
|
2280
2343
|
const exitCodeText = exitCode !== undefined ? ` with exit code ${exitCode}` : "";
|
|
2281
2344
|
const currentOutput = execution.getOutput();
|
|
2282
|
-
const
|
|
2345
|
+
const isUserVisible = this._terminalService.foregroundInstances.includes(terminalInstance);
|
|
2346
|
+
const message = isUserVisible ? `[Terminal ${termId} notification: command completed${exitCodeText}. Use send_to_terminal to send another command or kill_terminal to stop it.]\nTerminal output:\n${currentOutput}` : `[Terminal ${termId} notification: command completed${exitCodeText}. The terminal has been cleaned up.]\nTerminal output:\n${currentOutput}`;
|
|
2283
2347
|
this._logService.debug(
|
|
2284
2348
|
`RunInTerminalTool: Command completed in background terminal ${termId}, notifying chat session`
|
|
2285
2349
|
);
|
|
@@ -2287,7 +2351,7 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
2287
2351
|
...sendOptions,
|
|
2288
2352
|
queue: ChatRequestQueueKind.Steering,
|
|
2289
2353
|
isSystemInitiated: true,
|
|
2290
|
-
systemInitiatedLabel: ( localize(
|
|
2354
|
+
systemInitiatedLabel: ( localize(14533, "`{0}` completed", commandName)),
|
|
2291
2355
|
terminalExecutionId: termId
|
|
2292
2356
|
}).catch(e => {
|
|
2293
2357
|
this._logService.warn(
|
|
@@ -2295,6 +2359,19 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
2295
2359
|
e
|
|
2296
2360
|
);
|
|
2297
2361
|
});
|
|
2362
|
+
this._commandArtifactCollector.capture(toolSpecificData, terminalInstance, command.id).then(() => {
|
|
2363
|
+
if (this._terminalService.foregroundInstances.includes(terminalInstance)) {
|
|
2364
|
+
this._logService.debug(
|
|
2365
|
+
`RunInTerminalTool: Background terminal ${termId} was revealed by user, skipping disposal`
|
|
2366
|
+
);
|
|
2367
|
+
return;
|
|
2368
|
+
}
|
|
2369
|
+
this._logService.debug(`RunInTerminalTool: Disposing finished background terminal ${termId}`);
|
|
2370
|
+
RunInTerminalTool_1._killedByTool.add(termId);
|
|
2371
|
+
execution.dispose();
|
|
2372
|
+
RunInTerminalTool_1._activeExecutions.delete(termId);
|
|
2373
|
+
terminalInstance.dispose();
|
|
2374
|
+
});
|
|
2298
2375
|
}));
|
|
2299
2376
|
const executionForDisposal = RunInTerminalTool_1._activeExecutions.get(termId);
|
|
2300
2377
|
store.add(terminalInstance.onDisposed(() => {
|
|
@@ -2302,6 +2379,10 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
2302
2379
|
disposeNotification();
|
|
2303
2380
|
return;
|
|
2304
2381
|
}
|
|
2382
|
+
if (this._isShuttingDown) {
|
|
2383
|
+
disposeNotification();
|
|
2384
|
+
return;
|
|
2385
|
+
}
|
|
2305
2386
|
if (handleSessionCancelled()) {
|
|
2306
2387
|
return;
|
|
2307
2388
|
}
|
|
@@ -2317,7 +2398,7 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
2317
2398
|
...sendOptions,
|
|
2318
2399
|
queue: ChatRequestQueueKind.Steering,
|
|
2319
2400
|
isSystemInitiated: true,
|
|
2320
|
-
systemInitiatedLabel: ( localize(
|
|
2401
|
+
systemInitiatedLabel: ( localize(14534, "`{0}` terminal exited", commandName)),
|
|
2321
2402
|
terminalExecutionId: termId
|
|
2322
2403
|
}).catch(e => {
|
|
2323
2404
|
this._logService.warn(
|
|
@@ -2369,7 +2450,7 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
2369
2450
|
}
|
|
2370
2451
|
}
|
|
2371
2452
|
};
|
|
2372
|
-
RunInTerminalTool = RunInTerminalTool_1 = ( __decorate([( __param(0, IChatService)), ( __param(1, IConfigurationService)), ( __param(2, IFileService)), ( __param(3, IHistoryService)), ( __param(4, IInstantiationService)), ( __param(5, ILabelService)), ( __param(6, ILanguageModelToolsService)), ( __param(7, IRemoteAgentService)), ( __param(8, IStorageService)), ( __param(9, ITerminalChatService)), ( __param(10, ITerminalLogService)), ( __param(11, ITerminalService)), ( __param(12, ITerminalSandboxService)), ( __param(13, IWorkspaceContextService)), ( __param(14, IChatWidgetService)), ( __param(15, IAgentSessionsService))], RunInTerminalTool));
|
|
2453
|
+
RunInTerminalTool = RunInTerminalTool_1 = ( __decorate([( __param(0, IChatService)), ( __param(1, IConfigurationService)), ( __param(2, IFileService)), ( __param(3, IHistoryService)), ( __param(4, IInstantiationService)), ( __param(5, ILabelService)), ( __param(6, ILanguageModelToolsService)), ( __param(7, IRemoteAgentService)), ( __param(8, IStorageService)), ( __param(9, ITerminalChatService)), ( __param(10, ITerminalLogService)), ( __param(11, ITerminalService)), ( __param(12, ITerminalSandboxService)), ( __param(13, IWorkspaceContextService)), ( __param(14, IChatWidgetService)), ( __param(15, IAgentSessionsService)), ( __param(16, ILifecycleService))], RunInTerminalTool));
|
|
2373
2454
|
let ActiveTerminalExecution = class ActiveTerminalExecution extends Disposable {
|
|
2374
2455
|
get completionPromise() {
|
|
2375
2456
|
return this._completionDeferred.p;
|