@codingame/monaco-vscode-katex-common 30.0.1 → 31.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/vscode/src/vs/platform/actions/browser/actionbar.d.ts +16 -0
- package/vscode/src/vs/platform/actions/browser/actionbar.js +22 -0
- package/vscode/src/vs/platform/actions/browser/buttonbar.js +2 -2
- package/vscode/src/vs/platform/networkFilter/common/domainMatcher.d.ts +50 -0
- package/vscode/src/vs/platform/networkFilter/common/domainMatcher.js +138 -0
- package/vscode/src/vs/platform/networkFilter/common/settings.d.ts +12 -0
- package/vscode/src/vs/platform/networkFilter/common/settings.js +14 -0
- package/vscode/src/vs/platform/sandbox/common/sandboxHelperIpc.d.ts +18 -0
- package/vscode/src/vs/platform/sandbox/common/sandboxHelperIpc.js +13 -0
- package/vscode/src/vs/platform/sandbox/common/terminalSandboxService.d.ts +73 -0
- package/vscode/src/vs/platform/sandbox/common/terminalSandboxService.js +10 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatAccessibilityProvider.js +16 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.js +51 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatElicitationActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +64 -72
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolActions.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolActions.js +17 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolPicker.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionApprovalModel.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionHoverWidget.js +17 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.js +5 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.js +73 -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 +32 -32
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentModel.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentModel.js +20 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.js +73 -49
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.d.ts +0 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.js +41 -99
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +14 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +13 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationWidget.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolSetsContribution.js +14 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatAgentHover.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatArtifactsWidget.d.ts +11 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatArtifactsWidget.js +339 -161
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentMarkdownRenderer.js +9 -2
- 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.d.ts +9 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAttachmentsContentPart.js +33 -5
- 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/chatCollections.d.ts +43 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollections.js +147 -2
- 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 +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationWidget.js +55 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatContentCodePools.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatContentCodePools.js +7 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatContentParts.d.ts +1 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDiffBlockPart.js +42 -10
- 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/chatIncrementalRendering/animations/animation.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatIncrementalRendering/animations/animationRegistry.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatIncrementalRendering/animations/animationRegistry.js +16 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatIncrementalRendering/animations/blockAnimations.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatIncrementalRendering/animations/blockAnimations.js +33 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatIncrementalRendering/buffers/buffer.d.ts +46 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatIncrementalRendering/buffers/bufferRegistry.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatIncrementalRendering/buffers/bufferRegistry.js +12 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatIncrementalRendering/buffers/offBuffer.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatIncrementalRendering/buffers/offBuffer.js +12 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatIncrementalRendering/buffers/paragraphBuffer.d.ts +23 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatIncrementalRendering/buffers/paragraphBuffer.js +37 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatIncrementalRendering/buffers/wordBuffer.d.ts +34 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatIncrementalRendering/buffers/wordBuffer.js +68 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatIncrementalRendering/chatIncrementalRendering.d.ts +77 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatIncrementalRendering/chatIncrementalRendering.js +170 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatIncrementalRendering/media/chatIncrementalRendering.css +112 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.js +26 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.d.ts +24 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.js +111 -145
- 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 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatPlanReviewPart.js +425 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatProgressContentPart.d.ts +16 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatProgressContentPart.js +68 -25
- 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 +101 -45
- 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.d.ts +36 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentContentPart.js +217 -25
- 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 +23 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.js +168 -60
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTipContentPart.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTodoListWidget.js +18 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolInputOutputContentPart.d.ts +1 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolInputOutputContentPart.js +7 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolOutputContentSubPart.d.ts +1 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolOutputContentSubPart.js +7 -19
- 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 +24 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/codeBlockPart.js +104 -78
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatConfirmationWidget.css +11 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatPlanReview.css +257 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatQuestionCarousel.css +19 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatSubagentContent.css +30 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatTerminalToolProgressPart.css +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatThinkingContent.css +12 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatToolConfirmationCarousel.css +286 -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 +15 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.d.ts +1 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.js +25 -47
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.d.ts +29 -53
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.js +258 -321
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationCarouselPart.d.ts +53 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationCarouselPart.js +392 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.d.ts +1 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.js +24 -30
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationPart.d.ts +2 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationPart.js +9 -8
- 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/terminalToolAutoExpand.d.ts +6 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/terminalToolAutoExpand.js +2 -3
- 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 +38 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.js +577 -113
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListWidget.d.ts +0 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListWidget.js +4 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.d.ts +1 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.js +58 -75
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatFollowups.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.d.ts +44 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.js +362 -188
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPickerActionItem.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelPicker.d.ts +4 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelPicker.js +42 -95
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelSelectionLogic.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.js +9 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem.js +57 -38
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem.d.ts +21 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/{modelPickerActionItem2.js → modelPickerActionItem.js} +5 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/permissionPickerActionItem.js +38 -31
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.js +4 -5
- 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 +94 -40
- 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/common/chatArtifactExtraction.d.ts +16 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatArtifactExtraction.js +218 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatImageExtraction.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/common/widget/annotations.js +6 -1
- package/vscode/src/vs/workbench/contrib/chat/common/widget/chatColors.js +15 -15
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAffordance.js +12 -21
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.d.ts +2 -32
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.js +355 -156
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatEditorAffordance.d.ts +2 -13
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatEditorAffordance.js +72 -65
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatOverlayWidget.d.ts +4 -43
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatOverlayWidget.js +238 -204
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.d.ts +4 -19
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.js +128 -115
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.d.ts +6 -9
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.js +152 -49
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChat.css +64 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +40 -40
- 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/terminal/terminalContribChatExports.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/alternativeRecommendation.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/alternativeRecommendation.js +41 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandParsers/commandFileWriteParser.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandParsers/sedFileWriteParser.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandParsers/sedFileWriteParser.js +142 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.d.ts +45 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.js +165 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/executeStrategy.d.ts +53 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/executeStrategy.js +163 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/noneExecuteStrategy.d.ts +27 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/noneExecuteStrategy.js +142 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/richExecuteStrategy.d.ts +29 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/richExecuteStrategy.js +144 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/strategyHelpers.d.ts +40 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/strategyHelpers.js +174 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/outputHelpers.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/outputHelpers.js +43 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.d.ts +42 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.js +256 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalToolTelemetry.d.ts +42 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalToolTelemetry.js +94 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.d.ts +42 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.js +221 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/autoApprove/commandLineAutoApprover.d.ts +31 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/autoApprove/commandLineAutoApprover.js +392 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/autoApprove/npmScriptAutoApprover.d.ts +45 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/autoApprove/npmScriptAutoApprover.js +243 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAnalyzer.d.ts +52 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAnalyzer.js +10 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.js +310 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineFileWriteAnalyzer.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineFileWriteAnalyzer.js +168 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineSandboxAnalyzer.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineSandboxAnalyzer.js +33 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/commandLinePresenter.d.ts +41 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/nodeCommandLinePresenter.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/nodeCommandLinePresenter.js +37 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/pythonCommandLinePresenter.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/pythonCommandLinePresenter.js +37 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/rubyCommandLinePresenter.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/rubyCommandLinePresenter.js +44 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/sandboxedCommandLinePresenter.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/sandboxedCommandLinePresenter.js +22 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineBackgroundDetachRewriter.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineBackgroundDetachRewriter.js +47 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineCdPrefixRewriter.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineCdPrefixRewriter.js +27 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLinePreventHistoryRewriter.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLinePreventHistoryRewriter.js +29 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLinePwshChainOperatorRewriter.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLinePwshChainOperatorRewriter.js +33 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineRewriter.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineSandboxRewriter.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineSandboxRewriter.js +32 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.d.ts +108 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.js +412 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/types.d.ts +42 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/types.js +23 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/outputAnalyzer.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.d.ts +192 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.js +2258 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sandboxOutputAnalyzer.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sandboxOutputAnalyzer.js +43 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalCommandArtifactCollector.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalCommandArtifactCollector.js +118 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalToolAutoApprove.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalToolAutoApprove.js +44 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/toolIds.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/treeSitterCommandParser.d.ts +25 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/treeSitterCommandParser.js +141 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.d.ts +85 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.js +608 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/searchableOptionPickerActionItem.d.ts +0 -40
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/searchableOptionPickerActionItem.js +0 -196
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem2.d.ts +0 -29
- package/vscode/src/vs/workbench/contrib/chat/common/widget/codeBlockModelCollection.d.ts +0 -46
- package/vscode/src/vs/workbench/contrib/chat/common/widget/codeBlockModelCollection.js +0 -215
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatGutterAffordance.d.ts +0 -18
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatGutterAffordance.js +0 -107
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { MarkdownString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
|
|
4
|
+
import { visit } from '@codingame/monaco-vscode-api/vscode/vs/base/common/json';
|
|
5
|
+
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
6
|
+
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
7
|
+
import { IUriIdentityService } from '@codingame/monaco-vscode-api/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
|
|
8
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
9
|
+
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
10
|
+
import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
|
|
11
|
+
import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
|
|
12
|
+
import { TerminalChatAgentToolsSettingId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration';
|
|
13
|
+
|
|
14
|
+
const npmRunPatterns = [
|
|
15
|
+
/^(?<command>npm)\s+(?:run(?:-script)?)\s+(?<scriptName>[^\s&|;]+)/i,
|
|
16
|
+
/^(?<command>npm)\s+(?<scriptName>test|start|stop|restart)\b/i,
|
|
17
|
+
/^(?<command>yarn)\s+(?:run\s+)?(?<scriptName>[^\s&|;]+)/i,
|
|
18
|
+
/^(?<command>pnpm)\s+(?:run\s+)?(?<scriptName>[^\s&|;]+)/i];
|
|
19
|
+
const yarnBuiltinCommands = ( new Set([
|
|
20
|
+
"add",
|
|
21
|
+
"audit",
|
|
22
|
+
"autoclean",
|
|
23
|
+
"bin",
|
|
24
|
+
"cache",
|
|
25
|
+
"check",
|
|
26
|
+
"config",
|
|
27
|
+
"create",
|
|
28
|
+
"dedupe",
|
|
29
|
+
"dlx",
|
|
30
|
+
"exec",
|
|
31
|
+
"explain",
|
|
32
|
+
"generate-lock-entry",
|
|
33
|
+
"global",
|
|
34
|
+
"help",
|
|
35
|
+
"import",
|
|
36
|
+
"info",
|
|
37
|
+
"init",
|
|
38
|
+
"install",
|
|
39
|
+
"licenses",
|
|
40
|
+
"link",
|
|
41
|
+
"list",
|
|
42
|
+
"login",
|
|
43
|
+
"logout",
|
|
44
|
+
"node",
|
|
45
|
+
"outdated",
|
|
46
|
+
"owner",
|
|
47
|
+
"pack",
|
|
48
|
+
"patch",
|
|
49
|
+
"patch-commit",
|
|
50
|
+
"plugin",
|
|
51
|
+
"policies",
|
|
52
|
+
"publish",
|
|
53
|
+
"rebuild",
|
|
54
|
+
"remove",
|
|
55
|
+
"run",
|
|
56
|
+
"search",
|
|
57
|
+
"set",
|
|
58
|
+
"stage",
|
|
59
|
+
"tag",
|
|
60
|
+
"team",
|
|
61
|
+
"unlink",
|
|
62
|
+
"unplug",
|
|
63
|
+
"up",
|
|
64
|
+
"upgrade",
|
|
65
|
+
"upgrade-interactive",
|
|
66
|
+
"version",
|
|
67
|
+
"versions",
|
|
68
|
+
"why",
|
|
69
|
+
"workspace",
|
|
70
|
+
"workspaces"
|
|
71
|
+
]));
|
|
72
|
+
const pnpmBuiltinCommands = ( new Set([
|
|
73
|
+
"add",
|
|
74
|
+
"audit",
|
|
75
|
+
"bin",
|
|
76
|
+
"config",
|
|
77
|
+
"dedupe",
|
|
78
|
+
"deploy",
|
|
79
|
+
"dlx",
|
|
80
|
+
"doctor",
|
|
81
|
+
"env",
|
|
82
|
+
"exec",
|
|
83
|
+
"fetch",
|
|
84
|
+
"import",
|
|
85
|
+
"init",
|
|
86
|
+
"install",
|
|
87
|
+
"install-test",
|
|
88
|
+
"licenses",
|
|
89
|
+
"link",
|
|
90
|
+
"list",
|
|
91
|
+
"ln",
|
|
92
|
+
"ls",
|
|
93
|
+
"outdated",
|
|
94
|
+
"pack",
|
|
95
|
+
"patch",
|
|
96
|
+
"patch-commit",
|
|
97
|
+
"patch-remove",
|
|
98
|
+
"prune",
|
|
99
|
+
"publish",
|
|
100
|
+
"rb",
|
|
101
|
+
"rebuild",
|
|
102
|
+
"remove",
|
|
103
|
+
"rm",
|
|
104
|
+
"root",
|
|
105
|
+
"run",
|
|
106
|
+
"server",
|
|
107
|
+
"setup",
|
|
108
|
+
"store",
|
|
109
|
+
"un",
|
|
110
|
+
"uninstall",
|
|
111
|
+
"unlink",
|
|
112
|
+
"up",
|
|
113
|
+
"update",
|
|
114
|
+
"why"
|
|
115
|
+
]));
|
|
116
|
+
let NpmScriptAutoApprover = class NpmScriptAutoApprover extends Disposable {
|
|
117
|
+
constructor(
|
|
118
|
+
_configurationService,
|
|
119
|
+
_fileService,
|
|
120
|
+
_uriIdentityService,
|
|
121
|
+
_workspaceContextService
|
|
122
|
+
) {
|
|
123
|
+
super();
|
|
124
|
+
this._configurationService = _configurationService;
|
|
125
|
+
this._fileService = _fileService;
|
|
126
|
+
this._uriIdentityService = _uriIdentityService;
|
|
127
|
+
this._workspaceContextService = _workspaceContextService;
|
|
128
|
+
}
|
|
129
|
+
async isCommandAutoApproved(command, cwd) {
|
|
130
|
+
const isNpmScriptAutoApproveEnabled = this._configurationService.getValue(TerminalChatAgentToolsSettingId.AutoApproveWorkspaceNpmScripts) === true;
|
|
131
|
+
if (!isNpmScriptAutoApproveEnabled) {
|
|
132
|
+
return {
|
|
133
|
+
isAutoApproved: false
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
const scriptName = this._extractScriptName(command);
|
|
137
|
+
if (!scriptName) {
|
|
138
|
+
return {
|
|
139
|
+
isAutoApproved: false
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
const packageJsonScripts = await this._getPackageJsonScripts(cwd);
|
|
143
|
+
if (!packageJsonScripts) {
|
|
144
|
+
return {
|
|
145
|
+
isAutoApproved: false
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
if (!( packageJsonScripts.scripts.has(scriptName))) {
|
|
149
|
+
return {
|
|
150
|
+
isAutoApproved: false
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
return {
|
|
154
|
+
isAutoApproved: true,
|
|
155
|
+
scriptName,
|
|
156
|
+
autoApproveInfo: ( new MarkdownString(( localize(
|
|
157
|
+
14005,
|
|
158
|
+
"Auto approved as {0} is defined in package.json",
|
|
159
|
+
`\`${scriptName}\``
|
|
160
|
+
))))
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
_extractScriptName(command) {
|
|
164
|
+
const trimmedCommand = command.trim();
|
|
165
|
+
for (const pattern of npmRunPatterns) {
|
|
166
|
+
const match = trimmedCommand.match(pattern);
|
|
167
|
+
if (match?.groups?.scriptName) {
|
|
168
|
+
const {
|
|
169
|
+
command: pkgManager,
|
|
170
|
+
scriptName
|
|
171
|
+
} = match.groups;
|
|
172
|
+
if (pkgManager.toLowerCase() === "yarn" && ( yarnBuiltinCommands.has(scriptName.toLowerCase()))) {
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
if (pkgManager.toLowerCase() === "pnpm" && ( pnpmBuiltinCommands.has(scriptName.toLowerCase()))) {
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
return scriptName;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return undefined;
|
|
182
|
+
}
|
|
183
|
+
_isWithinWorkspace(uri) {
|
|
184
|
+
const workspaceFolders = this._workspaceContextService.getWorkspace().folders;
|
|
185
|
+
return ( workspaceFolders.some(folder => this._uriIdentityService.extUri.isEqualOrParent(uri, folder.uri)));
|
|
186
|
+
}
|
|
187
|
+
async _getPackageJsonScripts(cwd) {
|
|
188
|
+
if (!cwd || !this._isWithinWorkspace(cwd)) {
|
|
189
|
+
return undefined;
|
|
190
|
+
}
|
|
191
|
+
const packageJsonUri = URI.joinPath(cwd, "package.json");
|
|
192
|
+
const scripts = await this._readPackageJsonScripts(packageJsonUri);
|
|
193
|
+
if (scripts) {
|
|
194
|
+
return {
|
|
195
|
+
uri: packageJsonUri,
|
|
196
|
+
scripts
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
return undefined;
|
|
200
|
+
}
|
|
201
|
+
async _readPackageJsonScripts(packageJsonUri) {
|
|
202
|
+
try {
|
|
203
|
+
const exists = await this._fileService.exists(packageJsonUri);
|
|
204
|
+
if (!exists) {
|
|
205
|
+
return undefined;
|
|
206
|
+
}
|
|
207
|
+
const content = await this._fileService.readFile(packageJsonUri);
|
|
208
|
+
const text = ( content.value.toString());
|
|
209
|
+
return this._parsePackageJsonScripts(text);
|
|
210
|
+
} catch {
|
|
211
|
+
return undefined;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
_parsePackageJsonScripts(content) {
|
|
215
|
+
const scripts = ( new Set());
|
|
216
|
+
let inScripts = false;
|
|
217
|
+
let level = 0;
|
|
218
|
+
const visitor = {
|
|
219
|
+
onError() {},
|
|
220
|
+
onObjectBegin() {
|
|
221
|
+
level++;
|
|
222
|
+
},
|
|
223
|
+
onObjectEnd() {
|
|
224
|
+
if (inScripts && level === 2) {
|
|
225
|
+
inScripts = false;
|
|
226
|
+
}
|
|
227
|
+
level--;
|
|
228
|
+
},
|
|
229
|
+
onObjectProperty(property) {
|
|
230
|
+
if (level === 1 && property === "scripts") {
|
|
231
|
+
inScripts = true;
|
|
232
|
+
} else if (inScripts && level === 2) {
|
|
233
|
+
scripts.add(property);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
visit(content, visitor);
|
|
238
|
+
return scripts.size > 0 ? scripts : undefined;
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
NpmScriptAutoApprover = ( __decorate([( __param(0, IConfigurationService)), ( __param(1, IFileService)), ( __param(2, IUriIdentityService)), ( __param(3, IWorkspaceContextService))], NpmScriptAutoApprover));
|
|
242
|
+
|
|
243
|
+
export { NpmScriptAutoApprover };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { IMarkdownString } from "@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent";
|
|
2
|
+
import type { IDisposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
3
|
+
import type { OperatingSystem } from "@codingame/monaco-vscode-api/vscode/vs/base/common/platform";
|
|
4
|
+
import type { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
5
|
+
import type { ConfigurationTarget } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration";
|
|
6
|
+
import type { ToolConfirmationAction } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/tools/languageModelToolsService";
|
|
7
|
+
import type { INpmScriptAutoApproveResult } from "./autoApprove/npmScriptAutoApprover.js";
|
|
8
|
+
import type { TreeSitterCommandParserLanguage } from "../../treeSitterCommandParser.js";
|
|
9
|
+
export interface IAutoApproveRule {
|
|
10
|
+
regex: RegExp;
|
|
11
|
+
regexCaseInsensitive: RegExp;
|
|
12
|
+
sourceText: string;
|
|
13
|
+
sourceTarget: ConfigurationTarget | "session";
|
|
14
|
+
isDefaultRule: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface INpmScriptAutoApproveRule {
|
|
17
|
+
type: "npmScript";
|
|
18
|
+
npmScriptResult: INpmScriptAutoApproveResult;
|
|
19
|
+
}
|
|
20
|
+
export declare function isAutoApproveRule(rule: IAutoApproveRule | INpmScriptAutoApproveRule | undefined): rule is IAutoApproveRule;
|
|
21
|
+
export declare function isNpmScriptAutoApproveRule(rule: IAutoApproveRule | INpmScriptAutoApproveRule | undefined): rule is INpmScriptAutoApproveRule;
|
|
22
|
+
export interface ICommandLineAnalyzer extends IDisposable {
|
|
23
|
+
analyze(options: ICommandLineAnalyzerOptions): Promise<ICommandLineAnalyzerResult>;
|
|
24
|
+
}
|
|
25
|
+
export interface ICommandLineAnalyzerOptions {
|
|
26
|
+
commandLine: string;
|
|
27
|
+
cwd: URI | undefined;
|
|
28
|
+
shell: string;
|
|
29
|
+
os: OperatingSystem;
|
|
30
|
+
treeSitterLanguage: TreeSitterCommandParserLanguage;
|
|
31
|
+
terminalToolSessionId: string;
|
|
32
|
+
chatSessionResource: URI | undefined;
|
|
33
|
+
requiresUnsandboxConfirmation?: boolean;
|
|
34
|
+
}
|
|
35
|
+
export interface ICommandLineAnalyzerResult {
|
|
36
|
+
/**
|
|
37
|
+
* Whether auto approval is allowed based on the analysis, when false this
|
|
38
|
+
* will block auto approval.
|
|
39
|
+
*/
|
|
40
|
+
readonly isAutoApproveAllowed: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Whether the command line was explicitly auto approved by this analyzer.
|
|
43
|
+
* - `true`: This analyzer explicitly approves auto-execution
|
|
44
|
+
* - `false`: This analyzer explicitly denies auto-execution
|
|
45
|
+
* - `undefined`: This analyzer does not make an approval/denial decision
|
|
46
|
+
*/
|
|
47
|
+
readonly isAutoApproved?: boolean;
|
|
48
|
+
readonly disclaimers?: readonly (string | IMarkdownString)[];
|
|
49
|
+
readonly autoApproveInfo?: IMarkdownString;
|
|
50
|
+
readonly customActions?: ToolConfirmationAction[];
|
|
51
|
+
readonly forceAutoApproval?: boolean;
|
|
52
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
|
+
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
3
|
+
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
4
|
+
import { ITerminalChatService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal.service";
|
|
5
|
+
import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
|
|
6
|
+
import type { RunInTerminalToolTelemetry } from "../../runInTerminalToolTelemetry.js";
|
|
7
|
+
import { type TreeSitterCommandParser } from "../../treeSitterCommandParser.js";
|
|
8
|
+
import { type ICommandLineAnalyzer, type ICommandLineAnalyzerOptions, type ICommandLineAnalyzerResult } from "./commandLineAnalyzer.js";
|
|
9
|
+
export declare class CommandLineAutoApproveAnalyzer extends Disposable implements ICommandLineAnalyzer {
|
|
10
|
+
private readonly _treeSitterCommandParser;
|
|
11
|
+
private readonly _telemetry;
|
|
12
|
+
private readonly _log;
|
|
13
|
+
private readonly _configurationService;
|
|
14
|
+
private readonly _storageService;
|
|
15
|
+
private readonly _terminalChatService;
|
|
16
|
+
private readonly _commandLineAutoApprover;
|
|
17
|
+
constructor(_treeSitterCommandParser: TreeSitterCommandParser, _telemetry: RunInTerminalToolTelemetry, _log: (message: string, ...args: unknown[]) => void, _configurationService: IConfigurationService, instantiationService: IInstantiationService, _storageService: IStorageService, _terminalChatService: ITerminalChatService);
|
|
18
|
+
analyze(options: ICommandLineAnalyzerOptions): Promise<ICommandLineAnalyzerResult>;
|
|
19
|
+
private _createAutoApproveInfo;
|
|
20
|
+
}
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { asArray } from '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
|
|
4
|
+
import { createCommandUri, MarkdownString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
|
|
5
|
+
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
6
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
7
|
+
import { ConfigurationTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration';
|
|
8
|
+
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
9
|
+
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
10
|
+
import { ITerminalChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal.service';
|
|
11
|
+
import { StorageScope } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
|
|
12
|
+
import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
|
|
13
|
+
import { TerminalToolConfirmationStorageKeys } from '../../../../../chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.js';
|
|
14
|
+
import { ChatConfiguration } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
|
|
15
|
+
import { TerminalChatAgentToolsSettingId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration';
|
|
16
|
+
import { isPowerShell, generateAutoApproveActions, dedupeRules } from '../../runInTerminalHelpers.js';
|
|
17
|
+
import { isAutoApproveRule, isNpmScriptAutoApproveRule } from './commandLineAnalyzer.js';
|
|
18
|
+
import { TerminalChatCommandId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminalContrib/chat/browser/terminalChat';
|
|
19
|
+
import { CommandLineAutoApprover } from './autoApprove/commandLineAutoApprover.js';
|
|
20
|
+
|
|
21
|
+
const promptInjectionWarningCommandsLower = ["curl", "wget"];
|
|
22
|
+
const promptInjectionWarningCommandsLowerPwshOnly = ["invoke-restmethod", "invoke-webrequest", "irm", "iwr"];
|
|
23
|
+
let CommandLineAutoApproveAnalyzer = class CommandLineAutoApproveAnalyzer extends Disposable {
|
|
24
|
+
constructor(
|
|
25
|
+
_treeSitterCommandParser,
|
|
26
|
+
_telemetry,
|
|
27
|
+
_log,
|
|
28
|
+
_configurationService,
|
|
29
|
+
instantiationService,
|
|
30
|
+
_storageService,
|
|
31
|
+
_terminalChatService
|
|
32
|
+
) {
|
|
33
|
+
super();
|
|
34
|
+
this._treeSitterCommandParser = _treeSitterCommandParser;
|
|
35
|
+
this._telemetry = _telemetry;
|
|
36
|
+
this._log = _log;
|
|
37
|
+
this._configurationService = _configurationService;
|
|
38
|
+
this._storageService = _storageService;
|
|
39
|
+
this._terminalChatService = _terminalChatService;
|
|
40
|
+
this._commandLineAutoApprover = this._register(instantiationService.createInstance(CommandLineAutoApprover));
|
|
41
|
+
}
|
|
42
|
+
async analyze(options) {
|
|
43
|
+
const isAutoApproveEnabledInSettings = this._configurationService.getValue(TerminalChatAgentToolsSettingId.EnableAutoApprove) === true;
|
|
44
|
+
if (isAutoApproveEnabledInSettings && options.chatSessionResource && this._terminalChatService.hasChatSessionAutoApproval(options.chatSessionResource)) {
|
|
45
|
+
this._log("Session has auto approval enabled, auto approving command");
|
|
46
|
+
const disableUri = createCommandUri(
|
|
47
|
+
TerminalChatCommandId.DisableSessionAutoApproval,
|
|
48
|
+
options.chatSessionResource
|
|
49
|
+
);
|
|
50
|
+
const mdTrustSettings = {
|
|
51
|
+
isTrusted: {
|
|
52
|
+
enabledCommands: [TerminalChatCommandId.DisableSessionAutoApproval]
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
return {
|
|
56
|
+
isAutoApproved: true,
|
|
57
|
+
isAutoApproveAllowed: true,
|
|
58
|
+
disclaimers: [],
|
|
59
|
+
autoApproveInfo: ( new MarkdownString(`${( localize(14006, "Auto approved for this session"))} ([${( localize(14007, "Disable"))}](${( disableUri.toString())}))`, mdTrustSettings))
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
const trimmedCommandLine = options.commandLine.trimStart();
|
|
63
|
+
let subCommands;
|
|
64
|
+
try {
|
|
65
|
+
subCommands = await this._treeSitterCommandParser.extractSubCommands(options.treeSitterLanguage, trimmedCommandLine);
|
|
66
|
+
this._log(
|
|
67
|
+
`Parsed sub-commands via ${options.treeSitterLanguage} grammar`,
|
|
68
|
+
subCommands
|
|
69
|
+
);
|
|
70
|
+
} catch (e) {
|
|
71
|
+
console.error(e);
|
|
72
|
+
this._log(`Failed to parse sub-commands via ${options.treeSitterLanguage} grammar`);
|
|
73
|
+
}
|
|
74
|
+
let isAutoApproved = false;
|
|
75
|
+
let autoApproveInfo;
|
|
76
|
+
let customActions;
|
|
77
|
+
if (!subCommands?.length) {
|
|
78
|
+
if (trimmedCommandLine.length === 0) {
|
|
79
|
+
this._log("Command line is empty, auto approving");
|
|
80
|
+
return {
|
|
81
|
+
isAutoApproved: true,
|
|
82
|
+
isAutoApproveAllowed: true,
|
|
83
|
+
disclaimers: []
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
this._log("No sub-commands were parsed, auto approval is not allowed");
|
|
87
|
+
return {
|
|
88
|
+
isAutoApproveAllowed: false,
|
|
89
|
+
disclaimers: []
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
const subCommandResults = await Promise.all(( subCommands.map(
|
|
93
|
+
e => this._commandLineAutoApprover.isCommandAutoApproved(e, options.shell, options.os, options.cwd, options.chatSessionResource)
|
|
94
|
+
)));
|
|
95
|
+
const commandLineResult = this._commandLineAutoApprover.isCommandLineAutoApproved(trimmedCommandLine, options.chatSessionResource);
|
|
96
|
+
const autoApproveReasons = [...( subCommandResults.map(e => e.reason)), commandLineResult.reason];
|
|
97
|
+
let isDenied = false;
|
|
98
|
+
let autoApproveReason;
|
|
99
|
+
let autoApproveDefault;
|
|
100
|
+
const deniedSubCommandResult = subCommandResults.find(e => e.result === "denied");
|
|
101
|
+
if (deniedSubCommandResult) {
|
|
102
|
+
this._log("Sub-command DENIED auto approval");
|
|
103
|
+
isDenied = true;
|
|
104
|
+
autoApproveDefault = isAutoApproveRule(deniedSubCommandResult.rule) ? deniedSubCommandResult.rule.isDefaultRule : undefined;
|
|
105
|
+
autoApproveReason = "subCommand";
|
|
106
|
+
} else if (commandLineResult.result === "denied") {
|
|
107
|
+
this._log("Command line DENIED auto approval");
|
|
108
|
+
isDenied = true;
|
|
109
|
+
autoApproveDefault = isAutoApproveRule(commandLineResult.rule) ? commandLineResult.rule.isDefaultRule : undefined;
|
|
110
|
+
autoApproveReason = "commandLine";
|
|
111
|
+
} else {
|
|
112
|
+
if (subCommandResults.every(e => e.result === "approved")) {
|
|
113
|
+
this._log("All sub-commands auto-approved");
|
|
114
|
+
isAutoApproved = true;
|
|
115
|
+
autoApproveReason = "subCommand";
|
|
116
|
+
autoApproveDefault = subCommandResults.every(e => isAutoApproveRule(e.rule) && e.rule.isDefaultRule);
|
|
117
|
+
} else {
|
|
118
|
+
this._log("All sub-commands NOT auto-approved");
|
|
119
|
+
if (commandLineResult.result === "approved") {
|
|
120
|
+
this._log("Command line auto-approved");
|
|
121
|
+
autoApproveReason = "commandLine";
|
|
122
|
+
isAutoApproved = true;
|
|
123
|
+
autoApproveDefault = isAutoApproveRule(commandLineResult.rule) ? commandLineResult.rule.isDefaultRule : undefined;
|
|
124
|
+
} else {
|
|
125
|
+
this._log("Command line NOT auto-approved");
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
for (const reason of autoApproveReasons) {
|
|
130
|
+
this._log(`- ${reason}`);
|
|
131
|
+
}
|
|
132
|
+
const isAutoApproveEnabled = this._configurationService.getValue(TerminalChatAgentToolsSettingId.EnableAutoApprove) === true;
|
|
133
|
+
const isAutoApproveWarningAccepted = this._storageService.getBoolean(
|
|
134
|
+
TerminalToolConfirmationStorageKeys.TerminalAutoApproveWarningAccepted,
|
|
135
|
+
StorageScope.APPLICATION,
|
|
136
|
+
false
|
|
137
|
+
);
|
|
138
|
+
if (isAutoApproveEnabled && isAutoApproved) {
|
|
139
|
+
autoApproveInfo = this._createAutoApproveInfo(
|
|
140
|
+
isAutoApproved,
|
|
141
|
+
isDenied,
|
|
142
|
+
autoApproveReason,
|
|
143
|
+
subCommandResults,
|
|
144
|
+
commandLineResult
|
|
145
|
+
);
|
|
146
|
+
} else {
|
|
147
|
+
isAutoApproved = false;
|
|
148
|
+
}
|
|
149
|
+
this._telemetry.logPrepare({
|
|
150
|
+
terminalToolSessionId: options.terminalToolSessionId,
|
|
151
|
+
subCommands,
|
|
152
|
+
autoApproveAllowed: !isAutoApproveEnabled ? "off" : isAutoApproveWarningAccepted ? "allowed" : "needsOptIn",
|
|
153
|
+
autoApproveResult: isAutoApproved ? "approved" : isDenied ? "denied" : "manual",
|
|
154
|
+
autoApproveReason,
|
|
155
|
+
autoApproveDefault
|
|
156
|
+
});
|
|
157
|
+
const disclaimers = [];
|
|
158
|
+
const subCommandsLowerFirstWordOnly = ( subCommands.map(command => command.split(" ")[0].toLowerCase()));
|
|
159
|
+
if (!isAutoApproved && (( subCommandsLowerFirstWordOnly.some(command => promptInjectionWarningCommandsLower.includes(command))) || (isPowerShell(options.shell, options.os) && ( subCommandsLowerFirstWordOnly.some(command => promptInjectionWarningCommandsLowerPwshOnly.includes(command)))))) {
|
|
160
|
+
disclaimers.push(( localize(
|
|
161
|
+
14008,
|
|
162
|
+
"Web content may contain malicious code or attempt prompt injection attacks."
|
|
163
|
+
)));
|
|
164
|
+
}
|
|
165
|
+
if (isAutoApproveEnabled && isDenied) {
|
|
166
|
+
const denialInfo = this._createAutoApproveInfo(
|
|
167
|
+
isAutoApproved,
|
|
168
|
+
isDenied,
|
|
169
|
+
autoApproveReason,
|
|
170
|
+
subCommandResults,
|
|
171
|
+
commandLineResult
|
|
172
|
+
);
|
|
173
|
+
if (denialInfo) {
|
|
174
|
+
disclaimers.push(denialInfo);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
if (!isAutoApproved && isAutoApproveEnabled) {
|
|
178
|
+
customActions = generateAutoApproveActions(trimmedCommandLine, subCommands, {
|
|
179
|
+
subCommandResults,
|
|
180
|
+
commandLineResult
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
return {
|
|
184
|
+
isAutoApproved,
|
|
185
|
+
isAutoApproveAllowed: true,
|
|
186
|
+
disclaimers,
|
|
187
|
+
autoApproveInfo,
|
|
188
|
+
customActions
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
_createAutoApproveInfo(
|
|
192
|
+
isAutoApproved,
|
|
193
|
+
isDenied,
|
|
194
|
+
autoApproveReason,
|
|
195
|
+
subCommandResults,
|
|
196
|
+
commandLineResult
|
|
197
|
+
) {
|
|
198
|
+
const formatRuleLinks = result => {
|
|
199
|
+
return ( asArray(result).filter(e => isAutoApproveRule(e.rule)).map(e => {
|
|
200
|
+
const escapedSourceText = e.rule.sourceText.replaceAll("$", "\\$");
|
|
201
|
+
if (e.rule.sourceTarget === "session") {
|
|
202
|
+
return localize(14009, "{0} (session)", `\`${escapedSourceText}\``);
|
|
203
|
+
}
|
|
204
|
+
const settingsUri = createCommandUri(TerminalChatCommandId.OpenTerminalSettingsLink, e.rule.sourceTarget);
|
|
205
|
+
const tooltip = ( localize(14010, "View rule in settings"));
|
|
206
|
+
let label = escapedSourceText;
|
|
207
|
+
switch (e.rule?.sourceTarget) {
|
|
208
|
+
case ConfigurationTarget.DEFAULT:
|
|
209
|
+
label = `${label} (default)`;
|
|
210
|
+
break;
|
|
211
|
+
case ConfigurationTarget.USER:
|
|
212
|
+
case ConfigurationTarget.USER_LOCAL:
|
|
213
|
+
label = `${label} (user)`;
|
|
214
|
+
break;
|
|
215
|
+
case ConfigurationTarget.USER_REMOTE:
|
|
216
|
+
label = `${label} (remote)`;
|
|
217
|
+
break;
|
|
218
|
+
case ConfigurationTarget.WORKSPACE:
|
|
219
|
+
case ConfigurationTarget.WORKSPACE_FOLDER:
|
|
220
|
+
label = `${label} (workspace)`;
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
return `[\`${label}\`](${( settingsUri.toString())} "${tooltip}")`;
|
|
224
|
+
})).join(", ");
|
|
225
|
+
};
|
|
226
|
+
const mdTrustSettings = {
|
|
227
|
+
isTrusted: {
|
|
228
|
+
enabledCommands: [TerminalChatCommandId.OpenTerminalSettingsLink]
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
const config = this._configurationService.inspect(ChatConfiguration.GlobalAutoApprove);
|
|
232
|
+
const isGlobalAutoApproved = config?.value ?? config.defaultValue;
|
|
233
|
+
if (isGlobalAutoApproved) {
|
|
234
|
+
const settingsUri = createCommandUri(TerminalChatCommandId.OpenTerminalSettingsLink, "global");
|
|
235
|
+
return (new MarkdownString(`${( localize(
|
|
236
|
+
14011,
|
|
237
|
+
"Auto approved by setting {0}",
|
|
238
|
+
`[\`${ChatConfiguration.GlobalAutoApprove}\`](${( settingsUri.toString())} "${( localize(14012, "View settings"))}")`
|
|
239
|
+
))}`, mdTrustSettings));
|
|
240
|
+
}
|
|
241
|
+
if (isAutoApproved) {
|
|
242
|
+
switch (autoApproveReason) {
|
|
243
|
+
case "commandLine":
|
|
244
|
+
{
|
|
245
|
+
if (isAutoApproveRule(commandLineResult.rule)) {
|
|
246
|
+
return (new MarkdownString(
|
|
247
|
+
localize(14013, "Auto approved by rule {0}", formatRuleLinks(commandLineResult)),
|
|
248
|
+
mdTrustSettings
|
|
249
|
+
));
|
|
250
|
+
}
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
253
|
+
case "subCommand":
|
|
254
|
+
{
|
|
255
|
+
const npmScriptApproval = subCommandResults.find(e => isNpmScriptAutoApproveRule(e.rule));
|
|
256
|
+
if (npmScriptApproval && isNpmScriptAutoApproveRule(npmScriptApproval.rule) && npmScriptApproval.rule.npmScriptResult.autoApproveInfo) {
|
|
257
|
+
return npmScriptApproval.rule.npmScriptResult.autoApproveInfo;
|
|
258
|
+
}
|
|
259
|
+
const uniqueRules = dedupeRules(subCommandResults);
|
|
260
|
+
if (uniqueRules.length === 1) {
|
|
261
|
+
return (new MarkdownString(
|
|
262
|
+
localize(14013, "Auto approved by rule {0}", formatRuleLinks(uniqueRules)),
|
|
263
|
+
mdTrustSettings
|
|
264
|
+
));
|
|
265
|
+
} else if (uniqueRules.length > 1) {
|
|
266
|
+
return (new MarkdownString(
|
|
267
|
+
localize(14014, "Auto approved by rules {0}", formatRuleLinks(uniqueRules)),
|
|
268
|
+
mdTrustSettings
|
|
269
|
+
));
|
|
270
|
+
}
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
} else if (isDenied) {
|
|
275
|
+
switch (autoApproveReason) {
|
|
276
|
+
case "commandLine":
|
|
277
|
+
{
|
|
278
|
+
if (commandLineResult.rule) {
|
|
279
|
+
return (new MarkdownString(localize(
|
|
280
|
+
14015,
|
|
281
|
+
"Auto approval denied by rule {0}",
|
|
282
|
+
formatRuleLinks(commandLineResult)
|
|
283
|
+
), mdTrustSettings));
|
|
284
|
+
}
|
|
285
|
+
break;
|
|
286
|
+
}
|
|
287
|
+
case "subCommand":
|
|
288
|
+
{
|
|
289
|
+
const uniqueRules = dedupeRules(subCommandResults.filter(e => e.result === "denied"));
|
|
290
|
+
if (uniqueRules.length === 1) {
|
|
291
|
+
return (new MarkdownString(
|
|
292
|
+
localize(14015, "Auto approval denied by rule {0}", formatRuleLinks(uniqueRules)),
|
|
293
|
+
mdTrustSettings
|
|
294
|
+
));
|
|
295
|
+
} else if (uniqueRules.length > 1) {
|
|
296
|
+
return (new MarkdownString(
|
|
297
|
+
localize(14016, "Auto approval denied by rules {0}", formatRuleLinks(uniqueRules)),
|
|
298
|
+
mdTrustSettings
|
|
299
|
+
));
|
|
300
|
+
}
|
|
301
|
+
break;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
return undefined;
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
CommandLineAutoApproveAnalyzer = ( __decorate([( __param(3, IConfigurationService)), ( __param(4, IInstantiationService)), ( __param(5, IStorageService)), ( __param(6, ITerminalChatService))], CommandLineAutoApproveAnalyzer));
|
|
309
|
+
|
|
310
|
+
export { CommandLineAutoApproveAnalyzer };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
|
+
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
3
|
+
import { IWorkspaceContextService } from "@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service";
|
|
4
|
+
import { type TreeSitterCommandParser } from "../../treeSitterCommandParser.js";
|
|
5
|
+
import type { ICommandLineAnalyzer, ICommandLineAnalyzerOptions, ICommandLineAnalyzerResult } from "./commandLineAnalyzer.js";
|
|
6
|
+
import { ILabelService } from "@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service";
|
|
7
|
+
export declare class CommandLineFileWriteAnalyzer extends Disposable implements ICommandLineAnalyzer {
|
|
8
|
+
private readonly _treeSitterCommandParser;
|
|
9
|
+
private readonly _log;
|
|
10
|
+
private readonly _configurationService;
|
|
11
|
+
private readonly _labelService;
|
|
12
|
+
private readonly _workspaceContextService;
|
|
13
|
+
constructor(_treeSitterCommandParser: TreeSitterCommandParser, _log: (message: string, ...args: unknown[]) => void, _configurationService: IConfigurationService, _labelService: ILabelService, _workspaceContextService: IWorkspaceContextService);
|
|
14
|
+
analyze(options: ICommandLineAnalyzerOptions): Promise<ICommandLineAnalyzerResult>;
|
|
15
|
+
private _getFileWrites;
|
|
16
|
+
private _stripSurroundingQuotes;
|
|
17
|
+
private _mapNullDevice;
|
|
18
|
+
private _getResult;
|
|
19
|
+
}
|