@codingame/monaco-vscode-katex-common 31.0.0 → 32.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/vscode/src/vs/platform/actionWidget/browser/actionWidgetDropdown.d.ts +15 -3
- package/vscode/src/vs/platform/actionWidget/browser/actionWidgetDropdown.js +6 -5
- package/vscode/src/vs/platform/actions/browser/buttonbar.d.ts +5 -1
- package/vscode/src/vs/platform/actions/browser/buttonbar.js +45 -14
- package/vscode/src/vs/platform/sandbox/common/terminalSandboxService.d.ts +15 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatAccessibilityProvider.js +16 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.js +15 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatElicitationActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +51 -54
- 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/agentSessionHoverWidget.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionHoverWidget.js +45 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.js +13 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsOpener.js +5 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.d.ts +4 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.js +46 -32
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentModel.js +8 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.d.ts +23 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.js +155 -46
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatImplicitContext.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatImplicitContext.js +20 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.d.ts +4 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.js +37 -14
- 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/chatSessions/media/chatSessionPickerActionItem.css +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/chatToolRiskAssessmentService.d.ts +28 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/chatToolRiskAssessmentService.js +250 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolSetsContribution.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatAgentHover.js +14 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatArtifactsWidget.js +10 -10
- 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/chatAttachmentsContentPart.js +7 -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 +7 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationWidget.d.ts +12 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationWidget.js +51 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDisabledClaudeHooksContentPart.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatElicitationContentPart.d.ts +6 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatElicitationContentPart.js +56 -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/chatIncrementalRendering/buffers/paragraphBuffer.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatIncrementalRendering/buffers/paragraphBuffer.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatIncrementalRendering/chatIncrementalRendering.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatIncrementalRendering/chatIncrementalRendering.js +4 -0
- 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.js +68 -10
- 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.d.ts +58 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatPlanReviewPart.js +653 -75
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatProgressContentPart.js +28 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.d.ts +5 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.js +91 -54
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuotaExceededPart.js +7 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatReferencesContentPart.js +53 -51
- 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 +11 -11
- 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 +4 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.js +42 -22
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTipContentPart.js +9 -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.js +2 -2
- 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.d.ts +6 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/codeBlockPart.js +93 -35
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatConfirmationWidget.css +5 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatPlanReview.css +169 -27
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatQuestionCarousel.css +13 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatThinkingContent.css +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatToolConfirmationCarousel.css +29 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.js +60 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatExtensionsInstallToolSubPart.js +13 -6
- 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 +15 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.d.ts +6 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.js +125 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.js +29 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationCarouselPart.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationCarouselPart.js +119 -10
- 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/chatToolInvocationPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolOutputPart.js +2 -2
- 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/media/toolRiskBadge.css +77 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/toolRiskBadgeWidget.d.ts +38 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/toolRiskBadgeWidget.js +125 -0
- 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 +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.js +132 -59
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.d.ts +16 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.js +156 -67
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatFollowups.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputNotificationService.d.ts +55 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputNotificationService.js +93 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputNotificationWidget.d.ts +21 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputNotificationWidget.js +133 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.d.ts +53 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.js +288 -125
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelPicker.d.ts +23 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelPicker.js +699 -145
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelSelectionLogic.d.ts +12 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelSelectionLogic.js +12 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatPhoneInputPresenter.d.ts +62 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatPhoneInputPresenter.js +120 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/media/chatInputNotificationWidget.css +191 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/media/chatPhoneInputPresenter.css +22 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem.js +9 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem.js +4 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/permissionPickerActionItem.d.ts +20 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/permissionPickerActionItem.js +89 -108
- 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 +521 -9
- 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 +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/media/chatContextUsageDetails.css +19 -19
- package/vscode/src/vs/workbench/contrib/chat/common/chatImageExtraction.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/common/chatPermissionStorageKeys.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatPermissionStorageKeys.js +6 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatPermissionWarnings.d.ts +27 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatPermissionWarnings.js +82 -0
- package/vscode/src/vs/workbench/contrib/chat/common/widget/chatColors.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/chat/common/widget/chatColors.js +44 -17
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAffordance.d.ts +1 -3
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAffordance.js +3 -46
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/{inlineChatEditorAffordance.d.ts → inlineChatAffordanceWidget.d.ts} +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/{inlineChatEditorAffordance.js → inlineChatAffordanceWidget.js} +6 -6
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.d.ts +2 -18
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.js +19 -400
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.d.ts +4 -9
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.d.ts +5 -19
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.js +47 -133
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.js +103 -25
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChat.css +29 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.d.ts +3 -32
- package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +39 -92
- 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/executeStrategy/basicExecuteStrategy.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.js +99 -32
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/executeStrategy.d.ts +13 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/executeStrategy.js +76 -14
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/noneExecuteStrategy.js +4 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/richExecuteStrategy.d.ts +9 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/richExecuteStrategy.js +89 -28
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/outputHelpers.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.d.ts +11 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.js +11 -7
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalToolTelemetry.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalToolTelemetry.js +7 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/autoApprove/commandLineAutoApprover.js +1 -1
- 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/commandLineAnalyzer.d.ts +1 -0
- 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.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineFileWriteAnalyzer.js +11 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineBackgroundDetachRewriter.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineBackgroundDetachRewriter.js +59 -4
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineSandboxRewriter.d.ts +8 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineSandboxRewriter.js +24 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.d.ts +47 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.js +111 -30
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.d.ts +60 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.js +455 -171
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/treeSitterCommandParser.d.ts +33 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/treeSitterCommandParser.js +82 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxCommandRules.d.ts +31 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxCommandRules.js +49 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxReadAllowList.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxReadAllowList.js +302 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxRuntimeConfigurationPerOperation.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxRuntimeConfigurationPerOperation.js +118 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.d.ts +34 -4
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.js +233 -48
- package/vscode/src/vs/platform/actions/browser/actionbar.d.ts +0 -16
- package/vscode/src/vs/platform/actions/browser/actionbar.js +0 -22
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.d.ts +0 -46
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +0 -539
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.d.ts +0 -29
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +0 -386
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationWidget.d.ts +0 -101
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationWidget.js +0 -509
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/media/chatEditingEditorOverlay.css +0 -130
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/media/chatEditingExplanationWidget.css +0 -276
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPartWidgets.d.ts +0 -45
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPartWidgets.js +0 -93
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatOverlayWidget.d.ts +0 -39
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatOverlayWidget.js +0 -617
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChatOverlayWidget.css +0 -231
|
@@ -126,6 +126,9 @@ let CommandLineFileWriteAnalyzer = class CommandLineFileWriteAnalyzer extends Di
|
|
|
126
126
|
folder => folder.uri.scheme === fileUri.scheme && (fileUri.path.startsWith(folder.uri.path + "/") || fileUri.path === folder.uri.path)
|
|
127
127
|
));
|
|
128
128
|
if (!isInsideWorkspace) {
|
|
129
|
+
if (options.hasSessionAutoApproval && this._isInTempDirectory(fileUri.path, options.os)) {
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
129
132
|
isAutoApproveAllowed = false;
|
|
130
133
|
this._log("File write blocked outside workspace", ( fileUri.toString()));
|
|
131
134
|
break;
|
|
@@ -149,12 +152,12 @@ let CommandLineFileWriteAnalyzer = class CommandLineFileWriteAnalyzer extends Di
|
|
|
149
152
|
)).join(", ");
|
|
150
153
|
if (!isAutoApproveAllowed) {
|
|
151
154
|
disclaimers.push(( localize(
|
|
152
|
-
|
|
155
|
+
14306,
|
|
153
156
|
"File write operations detected that cannot be auto approved: {0}",
|
|
154
157
|
fileWritesList
|
|
155
158
|
)));
|
|
156
159
|
} else {
|
|
157
|
-
disclaimers.push(( localize(
|
|
160
|
+
disclaimers.push(( localize(14307, "File write operations detected: {0}", fileWritesList)));
|
|
158
161
|
}
|
|
159
162
|
}
|
|
160
163
|
return {
|
|
@@ -162,6 +165,12 @@ let CommandLineFileWriteAnalyzer = class CommandLineFileWriteAnalyzer extends Di
|
|
|
162
165
|
disclaimers
|
|
163
166
|
};
|
|
164
167
|
}
|
|
168
|
+
_isInTempDirectory(uriPath, os) {
|
|
169
|
+
if (os === OperatingSystem.Windows) {
|
|
170
|
+
return /[\\/]te?mp[\\/].+/i.test(uriPath);
|
|
171
|
+
}
|
|
172
|
+
return uriPath.startsWith("/tmp/");
|
|
173
|
+
}
|
|
165
174
|
};
|
|
166
175
|
CommandLineFileWriteAnalyzer = ( __decorate([( __param(2, IConfigurationService)), ( __param(3, ILabelService)), ( __param(4, IWorkspaceContextService))], CommandLineFileWriteAnalyzer));
|
|
167
176
|
|
|
@@ -17,6 +17,26 @@ export declare class CommandLineBackgroundDetachRewriter extends Disposable impl
|
|
|
17
17
|
private readonly _configurationService;
|
|
18
18
|
constructor(_configurationService: IConfigurationService);
|
|
19
19
|
rewrite(options: ICommandLineRewriterOptions): ICommandLineRewriterResult | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Returns true when the command line invokes a program that is known to
|
|
22
|
+
* require an interactive stdin. Detaching such a command would close stdin
|
|
23
|
+
* and either hang the program or make it exit with an error.
|
|
24
|
+
*
|
|
25
|
+
* The check is intentionally conservative — only well-known interactive
|
|
26
|
+
* front-ends are matched, and only when their command-line flags do not
|
|
27
|
+
* obviously force non-interactive behaviour.
|
|
28
|
+
*/
|
|
29
|
+
private _readsFromStdin;
|
|
20
30
|
private _rewriteForPosix;
|
|
31
|
+
/**
|
|
32
|
+
* Returns true when the command uses shell constructs that `nohup` cannot exec
|
|
33
|
+
* directly. Such commands must be wrapped in `<shell> -c '...'` before being
|
|
34
|
+
* passed to nohup.
|
|
35
|
+
*
|
|
36
|
+
* `nohup` only accepts a single simple external command (plus its arguments).
|
|
37
|
+
* Anything that requires shell parsing — compound statements, builtins, shell
|
|
38
|
+
* operators, or inline variable assignments — must go through a shell wrapper.
|
|
39
|
+
*/
|
|
40
|
+
private _needsShellCWrapper;
|
|
21
41
|
private _rewriteForPowerShell;
|
|
22
42
|
}
|
|
@@ -4,7 +4,7 @@ import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/l
|
|
|
4
4
|
import { OperatingSystem } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
|
|
5
5
|
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
6
6
|
import { TerminalChatAgentToolsSettingId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration';
|
|
7
|
-
import { isPowerShell } from '../../runInTerminalHelpers.js';
|
|
7
|
+
import { isFish, isBash, isZsh, isPowerShell } from '../../runInTerminalHelpers.js';
|
|
8
8
|
|
|
9
9
|
let CommandLineBackgroundDetachRewriter = class CommandLineBackgroundDetachRewriter extends Disposable {
|
|
10
10
|
constructor(_configurationService) {
|
|
@@ -12,24 +12,79 @@ let CommandLineBackgroundDetachRewriter = class CommandLineBackgroundDetachRewri
|
|
|
12
12
|
this._configurationService = _configurationService;
|
|
13
13
|
}
|
|
14
14
|
rewrite(options) {
|
|
15
|
-
if (!
|
|
15
|
+
if (!this._configurationService.getValue(TerminalChatAgentToolsSettingId.DetachBackgroundProcesses)) {
|
|
16
16
|
return undefined;
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
const trimmedForCheck = options.commandLine.trimEnd();
|
|
19
|
+
const endsWithBareBackgroundAmp = /(?:^|[^&])&$/.test(trimmedForCheck);
|
|
20
|
+
if (!options.isBackground && !endsWithBareBackgroundAmp) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
if (this._readsFromStdin(options.commandLine)) {
|
|
19
24
|
return undefined;
|
|
20
25
|
}
|
|
21
26
|
if (options.os === OperatingSystem.Windows) {
|
|
27
|
+
if (!options.isBackground) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
22
30
|
return this._rewriteForPowerShell(options);
|
|
23
31
|
}
|
|
24
32
|
return this._rewriteForPosix(options);
|
|
25
33
|
}
|
|
34
|
+
_readsFromStdin(commandLine) {
|
|
35
|
+
const trimmed = commandLine.replace(/^\s*(?:[A-Z_][A-Z0-9_]*=\S+\s+)+/, "").replace(/^\s*cd\s+\S+\s*(?:&&|;)\s*/i, "").trimStart();
|
|
36
|
+
if (/^(expect|passwd|vi|vim|nano|less|more|top|htop|sftp|ftp|telnet|gdb|lldb)\b/.test(trimmed)) {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
if (/^psql\b/.test(trimmed) && !/\s(-c|-f|--command|--file)\b/.test(trimmed)) {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
if (/^mysql\b/.test(trimmed) && !/\s(-e|--execute)\b/.test(trimmed)) {
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
if (/^ssh\b/.test(trimmed) && !/\s-T\b/.test(trimmed) && !/\sssh\s+\S+\s+\S/.test(" " + trimmed)) {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
if (/^sudo\b/.test(trimmed) && !/\s-n\b/.test(trimmed) && !/\bSUDO_ASKPASS\b/.test(commandLine)) {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
26
53
|
_rewriteForPosix(options) {
|
|
54
|
+
const trimmed = options.commandLine.trimEnd();
|
|
55
|
+
const endsWithBackgroundAmp = /(?:^|[^&])&$/.test(trimmed);
|
|
56
|
+
let commandToWrap = trimmed;
|
|
57
|
+
if (this._needsShellCWrapper(trimmed)) {
|
|
58
|
+
const innerCommand = endsWithBackgroundAmp ? trimmed.replace(/\s*&$/, "") : trimmed;
|
|
59
|
+
if (isFish(options.shell, options.os)) {
|
|
60
|
+
const escaped = innerCommand.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
|
|
61
|
+
commandToWrap = `${options.shell} -c "${escaped}"`;
|
|
62
|
+
} else {
|
|
63
|
+
const escaped = innerCommand.replace(/'/g, `'\\''`);
|
|
64
|
+
commandToWrap = `${options.shell} -c '${escaped}'`;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const needsTrailingAmp = !(/(?:^|[^&])&$/.test(commandToWrap));
|
|
68
|
+
const supportsDisown = isBash(options.shell, options.os) || isZsh(options.shell, options.os);
|
|
69
|
+
const disownSuffix = supportsDisown ? " disown" : "";
|
|
70
|
+
const rewritten = needsTrailingAmp ? `nohup ${commandToWrap} &${disownSuffix}` : `nohup ${commandToWrap}${disownSuffix}`;
|
|
27
71
|
return {
|
|
28
|
-
rewritten
|
|
72
|
+
rewritten,
|
|
29
73
|
reasoning: "Wrapped background command with nohup to survive terminal shutdown",
|
|
30
74
|
forDisplay: options.commandLine
|
|
31
75
|
};
|
|
32
76
|
}
|
|
77
|
+
_needsShellCWrapper(commandLine) {
|
|
78
|
+
const trimmed = commandLine.trimStart();
|
|
79
|
+
return (
|
|
80
|
+
(/^(for|while|until|if|case|select|function)\b/.test(trimmed) ||
|
|
81
|
+
/^(eval|set|export|source|unset|declare|typeset|local|readonly|alias|cd|exec)\b/.test(trimmed) ||
|
|
82
|
+
/^\.\s/.test(trimmed) ||
|
|
83
|
+
/^[{(]/.test(trimmed) ||
|
|
84
|
+
/^[A-Za-z_][A-Za-z0-9_]*=/.test(trimmed) ||
|
|
85
|
+
/(?:\|\||&&|[|;]|&(?!&)(?!\s*$))/.test(trimmed))
|
|
86
|
+
);
|
|
87
|
+
}
|
|
33
88
|
_rewriteForPowerShell(options) {
|
|
34
89
|
if (!isPowerShell(options.shell, options.os)) {
|
|
35
90
|
return undefined;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
|
+
import { TreeSitterCommandParser } from "../../treeSitterCommandParser.js";
|
|
2
3
|
import { ITerminalSandboxService } from "../../../common/terminalSandboxService.js";
|
|
3
4
|
import type { ICommandLineRewriter, ICommandLineRewriterOptions, ICommandLineRewriterResult } from "./commandLineRewriter.js";
|
|
4
5
|
export declare class CommandLineSandboxRewriter extends Disposable implements ICommandLineRewriter {
|
|
6
|
+
private readonly _treeSitterCommandParser;
|
|
5
7
|
private readonly _sandboxService;
|
|
6
|
-
constructor(_sandboxService: ITerminalSandboxService);
|
|
8
|
+
constructor(_treeSitterCommandParser: TreeSitterCommandParser, _sandboxService: ITerminalSandboxService);
|
|
7
9
|
rewrite(options: ICommandLineRewriterOptions): Promise<ICommandLineRewriterResult | undefined>;
|
|
10
|
+
/**
|
|
11
|
+
* Parses the command line into sandbox command details. If parsing fails,
|
|
12
|
+
* wrapping continues with the base sandbox config rather than blocking the command.
|
|
13
|
+
*/
|
|
14
|
+
private _parseCommandDetails;
|
|
8
15
|
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
|
|
2
2
|
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
3
|
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
4
|
+
import { isPowerShell } from '../../runInTerminalHelpers.js';
|
|
5
|
+
import { TreeSitterCommandParserLanguage } from '../../treeSitterCommandParser.js';
|
|
4
6
|
import '../../../common/terminalSandboxService.js';
|
|
5
7
|
import { TerminalSandboxPrerequisiteCheck } from '../../../../../../../platform/sandbox/common/terminalSandboxService.js';
|
|
6
8
|
import { ITerminalSandboxService } from '@codingame/monaco-vscode-api/vscode/vs/platform/sandbox/common/terminalSandboxService.service';
|
|
7
9
|
|
|
8
10
|
let CommandLineSandboxRewriter = class CommandLineSandboxRewriter extends Disposable {
|
|
9
|
-
constructor(_sandboxService) {
|
|
11
|
+
constructor(_treeSitterCommandParser, _sandboxService) {
|
|
10
12
|
super();
|
|
13
|
+
this._treeSitterCommandParser = _treeSitterCommandParser;
|
|
11
14
|
this._sandboxService = _sandboxService;
|
|
12
15
|
}
|
|
13
16
|
async rewrite(options) {
|
|
@@ -15,7 +18,14 @@ let CommandLineSandboxRewriter = class CommandLineSandboxRewriter extends Dispos
|
|
|
15
18
|
if (!sandboxPrereqs.enabled || sandboxPrereqs.failedCheck === TerminalSandboxPrerequisiteCheck.Config) {
|
|
16
19
|
return undefined;
|
|
17
20
|
}
|
|
18
|
-
const
|
|
21
|
+
const commandDetails = await this._parseCommandDetails(options);
|
|
22
|
+
const wrappedCommand = await this._sandboxService.wrapCommand(
|
|
23
|
+
options.commandLine,
|
|
24
|
+
options.requestUnsandboxedExecution,
|
|
25
|
+
options.shell,
|
|
26
|
+
options.cwd,
|
|
27
|
+
commandDetails
|
|
28
|
+
);
|
|
19
29
|
return {
|
|
20
30
|
rewritten: wrappedCommand.command,
|
|
21
31
|
reasoning: wrappedCommand.requiresUnsandboxConfirmation ? "Switched command to unsandboxed execution because the command includes a domain that is not in the sandbox allowlist" : "Wrapped command for sandbox execution",
|
|
@@ -26,7 +36,18 @@ let CommandLineSandboxRewriter = class CommandLineSandboxRewriter extends Dispos
|
|
|
26
36
|
deniedDomains: wrappedCommand.deniedDomains
|
|
27
37
|
};
|
|
28
38
|
}
|
|
39
|
+
async _parseCommandDetails(options) {
|
|
40
|
+
try {
|
|
41
|
+
if (options.requestUnsandboxedExecution === true) {
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
const languageId = isPowerShell(options.shell, options.os) ? TreeSitterCommandParserLanguage.PowerShell : TreeSitterCommandParserLanguage.Bash;
|
|
45
|
+
return await this._treeSitterCommandParser.extractCommands(languageId, options.commandLine);
|
|
46
|
+
} catch {
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
29
50
|
};
|
|
30
|
-
CommandLineSandboxRewriter = ( __decorate([( __param(
|
|
51
|
+
CommandLineSandboxRewriter = ( __decorate([( __param(1, ITerminalSandboxService))], CommandLineSandboxRewriter));
|
|
31
52
|
|
|
32
53
|
export { CommandLineSandboxRewriter };
|
|
@@ -12,6 +12,14 @@ export interface IOutputMonitor extends Disposable {
|
|
|
12
12
|
readonly outputMonitorTelemetryCounters: IOutputMonitorTelemetryCounters;
|
|
13
13
|
readonly onDidFinishCommand: Event<void>;
|
|
14
14
|
readonly onDidDetectInputNeeded: Event<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Fires when the terminal is detected to be waiting for sensitive input
|
|
17
|
+
* (e.g. a password, passphrase, token, secret or verification code). This
|
|
18
|
+
* is fired *instead of* {@link onDidDetectInputNeeded} so callers can show
|
|
19
|
+
* UI that focuses the terminal rather than routing the prompt through the
|
|
20
|
+
* agent.
|
|
21
|
+
*/
|
|
22
|
+
readonly onDidDetectSensitiveInputNeeded: Event<void>;
|
|
15
23
|
}
|
|
16
24
|
export interface IOutputMonitorTelemetryCounters {
|
|
17
25
|
inputToolManualAcceptCount: number;
|
|
@@ -23,6 +31,10 @@ export interface IOutputMonitorTelemetryCounters {
|
|
|
23
31
|
inputToolFreeFormInputShownCount: number;
|
|
24
32
|
inputToolFreeFormInputCount: number;
|
|
25
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Returns the last visible line from terminal output after trimming trailing line breaks.
|
|
36
|
+
*/
|
|
37
|
+
export declare function getLastLine(output: string | undefined): string;
|
|
26
38
|
export declare class OutputMonitor extends Disposable implements IOutputMonitor {
|
|
27
39
|
private readonly _execution;
|
|
28
40
|
private readonly _pollFn;
|
|
@@ -47,10 +59,21 @@ export declare class OutputMonitor extends Disposable implements IOutputMonitor
|
|
|
47
59
|
readonly onDidFinishCommand: Event<void>;
|
|
48
60
|
private readonly _onDidDetectInputNeeded;
|
|
49
61
|
readonly onDidDetectInputNeeded: Event<void>;
|
|
62
|
+
private readonly _onDidDetectSensitiveInputNeeded;
|
|
63
|
+
readonly onDidDetectSensitiveInputNeeded: Event<void>;
|
|
50
64
|
private _asyncMode;
|
|
51
65
|
private _command;
|
|
52
66
|
private _invocationContext;
|
|
53
67
|
private _currentMonitoringCts;
|
|
68
|
+
/**
|
|
69
|
+
* Tracks whether onDidFinishCommand has fired so the event is delivered at
|
|
70
|
+
* most once. The event must fire synchronously during dispose so consumers
|
|
71
|
+
* awaiting `Event.toPromise(onDidFinishCommand)` are unblocked before the
|
|
72
|
+
* underlying emitter is torn down by super.dispose().
|
|
73
|
+
*/
|
|
74
|
+
private _didFinish;
|
|
75
|
+
private _fireFinishedOnce;
|
|
76
|
+
dispose(): void;
|
|
54
77
|
constructor(_execution: IExecution, _pollFn: ((execution: IExecution, token: CancellationToken, taskService: ITaskService) => Promise<IPollingResult | undefined>) | undefined, invocationContext: IToolInvocationContext | undefined, token: CancellationToken, command: string, _taskService: ITaskService, _logService: ITerminalLogService);
|
|
55
78
|
private _startMonitoring;
|
|
56
79
|
/**
|
|
@@ -86,10 +109,34 @@ export declare class OutputMonitor extends Disposable implements IOutputMonitor
|
|
|
86
109
|
private _cleanupIdleInputListener;
|
|
87
110
|
private _isSensitivePrompt;
|
|
88
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Returns true when the terminal's last visible line looks like a prompt for
|
|
114
|
+
* a sensitive secret (password, passphrase, token, API key, OTP, etc.). Used
|
|
115
|
+
* to short-circuit the normal "input needed → return to agent" flow so that
|
|
116
|
+
* the secret is never routed through the model — instead the user is asked
|
|
117
|
+
* via UI to focus the terminal and type the secret directly.
|
|
118
|
+
*/
|
|
119
|
+
export declare function detectsSensitiveInputPrompt(cursorLine: string): boolean;
|
|
89
120
|
export declare function matchTerminalPromptOption(options: readonly string[], suggestedOption: string): {
|
|
90
121
|
option: string | undefined;
|
|
91
122
|
index: number;
|
|
92
123
|
};
|
|
124
|
+
/**
|
|
125
|
+
* High-confidence patterns that reliably indicate the terminal is waiting for
|
|
126
|
+
* input. These are safe to use as a fast-path in `_waitForIdle` to skip normal
|
|
127
|
+
* idle detection, because they are specific enough to avoid false positives on
|
|
128
|
+
* normal command output (build logs, headers, etc.).
|
|
129
|
+
*/
|
|
130
|
+
export declare function detectsHighConfidenceInputPattern(cursorLine: string): boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Full set of input-required patterns including broader heuristics (bare `:` and
|
|
133
|
+
* `?` with trailing space). These may produce false positives on normal command
|
|
134
|
+
* output, so they should only be used **after** the terminal has been confirmed
|
|
135
|
+
* idle through normal polling (consecutive idle events with no data). In
|
|
136
|
+
* `_waitForIdle`, these are checked only when `recentlyIdle` is true (to handle
|
|
137
|
+
* active executions that are actually waiting for input). For the unconditional
|
|
138
|
+
* fast-path, use {@link detectsHighConfidenceInputPattern} instead.
|
|
139
|
+
*/
|
|
93
140
|
export declare function detectsInputRequiredPattern(cursorLine: string): boolean;
|
|
94
141
|
export declare function detectsNonInteractiveHelpPattern(cursorLine: string): boolean;
|
|
95
142
|
/**
|
|
@@ -9,6 +9,19 @@ import { ITaskService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/c
|
|
|
9
9
|
import { OutputMonitorState, PollingConsts } from './types.js';
|
|
10
10
|
import { ITerminalLogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminal.service';
|
|
11
11
|
|
|
12
|
+
function getLastLine(output) {
|
|
13
|
+
if (!output) {
|
|
14
|
+
return "";
|
|
15
|
+
}
|
|
16
|
+
const trimmedOutput = output.replace(/[\r\n]+$/, "");
|
|
17
|
+
if (!trimmedOutput) {
|
|
18
|
+
return "";
|
|
19
|
+
}
|
|
20
|
+
const lastLineFeed = trimmedOutput.lastIndexOf("\n");
|
|
21
|
+
const lastLine = lastLineFeed === -1 ? trimmedOutput : trimmedOutput.slice(lastLineFeed + 1);
|
|
22
|
+
const lastCarriageReturn = lastLine.lastIndexOf("\r");
|
|
23
|
+
return lastCarriageReturn === -1 ? lastLine : lastLine.slice(lastCarriageReturn + 1);
|
|
24
|
+
}
|
|
12
25
|
let OutputMonitor = class OutputMonitor extends Disposable {
|
|
13
26
|
get state() {
|
|
14
27
|
return this._state;
|
|
@@ -17,7 +30,7 @@ let OutputMonitor = class OutputMonitor extends Disposable {
|
|
|
17
30
|
if (!output) {
|
|
18
31
|
return "<empty>";
|
|
19
32
|
}
|
|
20
|
-
const lastLine = output.trimEnd()
|
|
33
|
+
const lastLine = getLastLine(output).trimEnd();
|
|
21
34
|
if (!lastLine) {
|
|
22
35
|
return "<empty>";
|
|
23
36
|
}
|
|
@@ -32,6 +45,25 @@ let OutputMonitor = class OutputMonitor extends Disposable {
|
|
|
32
45
|
get outputMonitorTelemetryCounters() {
|
|
33
46
|
return this._outputMonitorTelemetryCounters;
|
|
34
47
|
}
|
|
48
|
+
_fireFinishedOnce() {
|
|
49
|
+
if (this._didFinish) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
this._didFinish = true;
|
|
53
|
+
this._onDidFinishCommand.fire();
|
|
54
|
+
}
|
|
55
|
+
dispose() {
|
|
56
|
+
if (!this._didFinish) {
|
|
57
|
+
this._pollingResult ??= {
|
|
58
|
+
state: OutputMonitorState.Cancelled,
|
|
59
|
+
output: this._execution.getOutput(),
|
|
60
|
+
pollDurationMs: 0,
|
|
61
|
+
resources: undefined
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
this._fireFinishedOnce();
|
|
65
|
+
super.dispose();
|
|
66
|
+
}
|
|
35
67
|
constructor(
|
|
36
68
|
_execution,
|
|
37
69
|
_pollFn,
|
|
@@ -63,14 +95,24 @@ let OutputMonitor = class OutputMonitor extends Disposable {
|
|
|
63
95
|
this.onDidFinishCommand = this._onDidFinishCommand.event;
|
|
64
96
|
this._onDidDetectInputNeeded = this._register(( new Emitter()));
|
|
65
97
|
this.onDidDetectInputNeeded = this._onDidDetectInputNeeded.event;
|
|
98
|
+
this._onDidDetectSensitiveInputNeeded = this._register(( new Emitter()));
|
|
99
|
+
this.onDidDetectSensitiveInputNeeded = this._onDidDetectSensitiveInputNeeded.event;
|
|
66
100
|
this._asyncMode = false;
|
|
67
101
|
this._command = "";
|
|
102
|
+
this._didFinish = false;
|
|
68
103
|
this._command = command;
|
|
69
104
|
this._invocationContext = invocationContext;
|
|
70
|
-
|
|
105
|
+
const cts = ( new CancellationTokenSource(token));
|
|
106
|
+
this._currentMonitoringCts = cts;
|
|
107
|
+
this._register(toDisposable(() => {
|
|
108
|
+
this._currentMonitoringCts?.cancel();
|
|
109
|
+
this._currentMonitoringCts?.dispose();
|
|
110
|
+
}));
|
|
71
111
|
timeout(0).then(() => {
|
|
72
|
-
this._currentMonitoringCts
|
|
73
|
-
|
|
112
|
+
if (this._currentMonitoringCts !== cts) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
this._startMonitoring(command, invocationContext, cts.token);
|
|
74
116
|
});
|
|
75
117
|
}
|
|
76
118
|
async _startMonitoring(command, invocationContext, token) {
|
|
@@ -161,7 +203,7 @@ let OutputMonitor = class OutputMonitor extends Disposable {
|
|
|
161
203
|
resources
|
|
162
204
|
};
|
|
163
205
|
this._userInputListener.clear();
|
|
164
|
-
this.
|
|
206
|
+
this._fireFinishedOnce();
|
|
165
207
|
}
|
|
166
208
|
}
|
|
167
209
|
continueMonitoringAsync(token) {
|
|
@@ -201,10 +243,11 @@ let OutputMonitor = class OutputMonitor extends Disposable {
|
|
|
201
243
|
async _handleIdleState(token) {
|
|
202
244
|
const output = this._execution.getOutput();
|
|
203
245
|
const outputTail = output.slice(-1e3);
|
|
246
|
+
const outputLastLine = getLastLine(outputTail);
|
|
204
247
|
this._logService.trace(
|
|
205
248
|
`OutputMonitor: Idle output summary: len=${output.length}, lastLine=${this._formatLastLineForLog(outputTail)}`
|
|
206
249
|
);
|
|
207
|
-
if (detectsNonInteractiveHelpPattern(
|
|
250
|
+
if (detectsNonInteractiveHelpPattern(outputLastLine)) {
|
|
208
251
|
this._logService.trace("OutputMonitor: Idle -> non-interactive help pattern detected, stopping");
|
|
209
252
|
return {
|
|
210
253
|
shouldContinuePolling: false,
|
|
@@ -240,11 +283,18 @@ let OutputMonitor = class OutputMonitor extends Disposable {
|
|
|
240
283
|
};
|
|
241
284
|
}
|
|
242
285
|
if (this._asyncMode) {
|
|
243
|
-
if (detectsInputRequiredPattern(
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
286
|
+
if (detectsInputRequiredPattern(outputLastLine)) {
|
|
287
|
+
if (detectsSensitiveInputPrompt(outputLastLine)) {
|
|
288
|
+
this._logService.trace(
|
|
289
|
+
"OutputMonitor: Async mode - sensitive input prompt detected, signaling sensitive UI"
|
|
290
|
+
);
|
|
291
|
+
this._onDidDetectSensitiveInputNeeded.fire();
|
|
292
|
+
} else {
|
|
293
|
+
this._logService.trace(
|
|
294
|
+
"OutputMonitor: Async mode - input-required pattern detected, signaling agent"
|
|
295
|
+
);
|
|
296
|
+
this._onDidDetectInputNeeded.fire();
|
|
297
|
+
}
|
|
248
298
|
}
|
|
249
299
|
this._cleanupIdleInputListener();
|
|
250
300
|
return {
|
|
@@ -252,9 +302,14 @@ let OutputMonitor = class OutputMonitor extends Disposable {
|
|
|
252
302
|
output
|
|
253
303
|
};
|
|
254
304
|
}
|
|
255
|
-
if (detectsInputRequiredPattern(
|
|
256
|
-
|
|
257
|
-
|
|
305
|
+
if (detectsInputRequiredPattern(outputLastLine)) {
|
|
306
|
+
if (detectsSensitiveInputPrompt(outputLastLine)) {
|
|
307
|
+
this._logService.trace("OutputMonitor: Sensitive input prompt detected, signaling sensitive UI");
|
|
308
|
+
this._onDidDetectSensitiveInputNeeded.fire();
|
|
309
|
+
} else {
|
|
310
|
+
this._logService.trace("OutputMonitor: Input-required pattern detected, signaling agent");
|
|
311
|
+
this._onDidDetectInputNeeded.fire();
|
|
312
|
+
}
|
|
258
313
|
this._cleanupIdleInputListener();
|
|
259
314
|
return {
|
|
260
315
|
shouldContinuePolling: false,
|
|
@@ -273,7 +328,10 @@ let OutputMonitor = class OutputMonitor extends Disposable {
|
|
|
273
328
|
}
|
|
274
329
|
async _handleTimeoutState(_command, _invocationContext, _extended, _token) {
|
|
275
330
|
if (_extended) {
|
|
276
|
-
this._logService.info(
|
|
331
|
+
this._logService.info(
|
|
332
|
+
"OutputMonitor: Extended polling timeout reached after 2 minutes, signaling potential input needed"
|
|
333
|
+
);
|
|
334
|
+
this._onDidDetectInputNeeded.fire();
|
|
277
335
|
this._state = OutputMonitorState.Cancelled;
|
|
278
336
|
return false;
|
|
279
337
|
}
|
|
@@ -304,7 +362,8 @@ let OutputMonitor = class OutputMonitor extends Disposable {
|
|
|
304
362
|
currentInterval = Math.min(currentInterval * 2, maxInterval);
|
|
305
363
|
const currentOutput = execution.getOutput();
|
|
306
364
|
const currentTail = currentOutput.slice(-1000);
|
|
307
|
-
|
|
365
|
+
const currentLastLine = getLastLine(currentTail);
|
|
366
|
+
if (detectsNonInteractiveHelpPattern(currentLastLine)) {
|
|
308
367
|
this._logService.trace(
|
|
309
368
|
`OutputMonitor: waitForIdle -> non-interactive help detected (waited=${waited}ms)`
|
|
310
369
|
);
|
|
@@ -312,10 +371,10 @@ let OutputMonitor = class OutputMonitor extends Disposable {
|
|
|
312
371
|
this._setupIdleInputListener();
|
|
313
372
|
return this._state;
|
|
314
373
|
}
|
|
315
|
-
const promptResult =
|
|
374
|
+
const promptResult = detectsHighConfidenceInputPattern(currentLastLine);
|
|
316
375
|
if (promptResult) {
|
|
317
376
|
this._logService.trace(
|
|
318
|
-
`OutputMonitor: waitForIdle ->
|
|
377
|
+
`OutputMonitor: waitForIdle -> high-confidence input pattern detected (waited=${waited}ms, lastLine=${this._formatLastLineForLog(currentTail)})`
|
|
319
378
|
);
|
|
320
379
|
this._state = OutputMonitorState.Idle;
|
|
321
380
|
this._setupIdleInputListener();
|
|
@@ -340,6 +399,14 @@ let OutputMonitor = class OutputMonitor extends Disposable {
|
|
|
340
399
|
this._setupIdleInputListener();
|
|
341
400
|
return this._state;
|
|
342
401
|
}
|
|
402
|
+
if (recentlyIdle && isActive === true && detectsInputRequiredPattern(currentLastLine)) {
|
|
403
|
+
this._logService.trace(
|
|
404
|
+
`OutputMonitor: waitForIdle -> broad input pattern detected while active+idle (waited=${waited}ms, lastLine=${this._formatLastLineForLog(currentTail)})`
|
|
405
|
+
);
|
|
406
|
+
this._state = OutputMonitorState.Idle;
|
|
407
|
+
this._setupIdleInputListener();
|
|
408
|
+
return this._state;
|
|
409
|
+
}
|
|
343
410
|
}
|
|
344
411
|
} finally {
|
|
345
412
|
onDataDisposable.dispose();
|
|
@@ -350,6 +417,9 @@ let OutputMonitor = class OutputMonitor extends Disposable {
|
|
|
350
417
|
return OutputMonitorState.Timeout;
|
|
351
418
|
}
|
|
352
419
|
_setupIdleInputListener() {
|
|
420
|
+
if (this._store.isDisposed) {
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
353
423
|
this._userInputtedSinceIdleDetected = false;
|
|
354
424
|
this._logService.trace("OutputMonitor: Setting up idle input listener");
|
|
355
425
|
this._userInputListener.value = this._execution.instance.onDidInputData(() => {
|
|
@@ -362,22 +432,33 @@ let OutputMonitor = class OutputMonitor extends Disposable {
|
|
|
362
432
|
this._userInputListener.clear();
|
|
363
433
|
}
|
|
364
434
|
_isSensitivePrompt(prompt) {
|
|
365
|
-
return
|
|
435
|
+
return detectsSensitiveInputPrompt(prompt);
|
|
366
436
|
}
|
|
367
437
|
};
|
|
368
438
|
OutputMonitor = ( __decorate([( __param(5, ITaskService)), ( __param(6, ITerminalLogService))], OutputMonitor));
|
|
369
|
-
function
|
|
439
|
+
function detectsSensitiveInputPrompt(cursorLine) {
|
|
440
|
+
return /(password|passphrase|token|api\s*key|secret|verification code|otp\b|one[\s-]?time (?:code|password)|2fa|mfa|pin\s*(?:code|number)?[: ]?\s*$|authentication code)/i.test(cursorLine);
|
|
441
|
+
}
|
|
442
|
+
function detectsHighConfidenceInputPattern(cursorLine) {
|
|
370
443
|
return ([
|
|
371
444
|
/\s*(?:\[[^\]]\][^\[]*)+(?:\(default is\s+"[^"]+"\):)?\s+$/,
|
|
372
445
|
/(?:\(|\[)\s*(?:y(?:es)?\s*\/\s*n(?:o)?|n(?:o)?\s*\/\s*y(?:es)?)\s*(?:\]|\))\s+$/i,
|
|
373
446
|
/[?:]\s*(?:\(|\[)?\s*y(?:es)?\s*\/\s*n(?:o)?\s*(?:\]|\))?\s+$/i,
|
|
374
|
-
/\(y\)
|
|
375
|
-
/:\s
|
|
376
|
-
/:\s*\([^)]*\)\s*$/,
|
|
447
|
+
/\(y\) +$/i,
|
|
448
|
+
/:\s*\([^)]*\) +$/,
|
|
377
449
|
/\(END\)$/,
|
|
378
|
-
/password[
|
|
379
|
-
|
|
380
|
-
|
|
450
|
+
/password(?: for [^:]+)?:\s*$/i,
|
|
451
|
+
/press a(?:ny)? key/i,
|
|
452
|
+
/^(?:\s|\x1b\[[0-9;]*m)*\?.*[›❯▸▶]\s*$/
|
|
453
|
+
].some(e => e.test(cursorLine)));
|
|
454
|
+
}
|
|
455
|
+
function detectsInputRequiredPattern(cursorLine) {
|
|
456
|
+
if (detectsHighConfidenceInputPattern(cursorLine)) {
|
|
457
|
+
return true;
|
|
458
|
+
}
|
|
459
|
+
return ([
|
|
460
|
+
/: +$/,
|
|
461
|
+
/\? *(?:\([a-z\s]+\))? +$/i
|
|
381
462
|
].some(e => e.test(cursorLine)));
|
|
382
463
|
}
|
|
383
464
|
function detectsNonInteractiveHelpPattern(cursorLine) {
|
|
@@ -394,9 +475,9 @@ function detectsNonInteractiveHelpPattern(cursorLine) {
|
|
|
394
475
|
].some(e => e.test(cursorLine)));
|
|
395
476
|
}
|
|
396
477
|
const taskFinishMessages = [(
|
|
397
|
-
localize(
|
|
398
|
-
localize(
|
|
399
|
-
localize(
|
|
478
|
+
localize(14320, "Terminal will be reused by tasks, press any key to close it.")), ( localize(14321, "Terminal will be reused by tasks, press any key to close it.")), (
|
|
479
|
+
localize(14322, "Press any key to close the terminal.")), ( localize(14323, "Press any key to close the terminal.")), (
|
|
480
|
+
localize(14324, "The terminal will be reused by tasks. Press any key to close."))];
|
|
400
481
|
const normalizedTaskFinishMessages = ( taskFinishMessages.map(msg => msg.replace(/[\s.,:;!?"'`()[\]{}<>\-_/\\]+/g, "").toLowerCase()));
|
|
401
482
|
function detectsVSCodeTaskFinishMessage(cursorLine) {
|
|
402
483
|
const compact = cursorLine.replace(/[\s.,:;!?"'`()[\]{}<>\-_/\\]+/g, "").toLowerCase();
|
|
@@ -409,4 +490,4 @@ function detectsGenericPressAnyKeyPattern(cursorLine) {
|
|
|
409
490
|
return /press a(?:ny)? key/i.test(cursorLine);
|
|
410
491
|
}
|
|
411
492
|
|
|
412
|
-
export { OutputMonitor, detectsGenericPressAnyKeyPattern, detectsInputRequiredPattern, detectsNonInteractiveHelpPattern, detectsVSCodeTaskFinishMessage };
|
|
493
|
+
export { OutputMonitor, detectsGenericPressAnyKeyPattern, detectsHighConfidenceInputPattern, detectsInputRequiredPattern, detectsNonInteractiveHelpPattern, detectsSensitiveInputPrompt, detectsVSCodeTaskFinishMessage, getLastLine };
|