@codingame/monaco-vscode-katex-common 30.0.1 → 31.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 +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,31 @@
|
|
|
1
|
+
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
|
+
import type { OperatingSystem } from "@codingame/monaco-vscode-api/vscode/vs/base/common/platform";
|
|
3
|
+
import type { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
4
|
+
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
5
|
+
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
6
|
+
import { ITerminalChatService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal.service";
|
|
7
|
+
import type { IAutoApproveRule, INpmScriptAutoApproveRule } from "../commandLineAnalyzer.js";
|
|
8
|
+
export interface ICommandApprovalResultWithReason {
|
|
9
|
+
result: ICommandApprovalResult;
|
|
10
|
+
reason: string;
|
|
11
|
+
rule?: IAutoApproveRule | INpmScriptAutoApproveRule;
|
|
12
|
+
}
|
|
13
|
+
export type ICommandApprovalResult = "approved" | "denied" | "noMatch";
|
|
14
|
+
export declare class CommandLineAutoApprover extends Disposable {
|
|
15
|
+
private readonly _configurationService;
|
|
16
|
+
private readonly _terminalChatService;
|
|
17
|
+
private _denyListRules;
|
|
18
|
+
private _allowListRules;
|
|
19
|
+
private _allowListCommandLineRules;
|
|
20
|
+
private _denyListCommandLineRules;
|
|
21
|
+
private readonly _npmScriptAutoApprover;
|
|
22
|
+
constructor(_configurationService: IConfigurationService, instantiationService: IInstantiationService, _terminalChatService: ITerminalChatService);
|
|
23
|
+
updateConfiguration(): void;
|
|
24
|
+
isCommandAutoApproved(command: string, shell: string, os: OperatingSystem, cwd: URI | undefined, chatSessionResource?: URI): Promise<ICommandApprovalResultWithReason>;
|
|
25
|
+
isCommandLineAutoApproved(commandLine: string, chatSessionResource?: URI): ICommandApprovalResultWithReason;
|
|
26
|
+
private _getSessionRules;
|
|
27
|
+
private _commandMatchesRule;
|
|
28
|
+
private _mapAutoApproveConfigToRules;
|
|
29
|
+
private _convertAutoApproveEntryToRegex;
|
|
30
|
+
private _doConvertAutoApproveEntryToRegex;
|
|
31
|
+
}
|
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { structuralEquals } from '@codingame/monaco-vscode-api/vscode/vs/base/common/equals';
|
|
4
|
+
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
5
|
+
import { regExpLeadsToEndlessLoop, escapeRegExpCharacters } from '@codingame/monaco-vscode-api/vscode/vs/base/common/strings';
|
|
6
|
+
import { isObject } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
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 { TerminalChatAgentToolsSettingId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration';
|
|
12
|
+
import { isPowerShell } from '../../../runInTerminalHelpers.js';
|
|
13
|
+
import { NpmScriptAutoApprover } from './npmScriptAutoApprover.js';
|
|
14
|
+
|
|
15
|
+
const neverMatchRegex = /(?!.*)/;
|
|
16
|
+
const transientEnvVarRegex = /^[A-Z_][A-Z0-9_]*=/i;
|
|
17
|
+
let CommandLineAutoApprover = class CommandLineAutoApprover extends Disposable {
|
|
18
|
+
constructor(_configurationService, instantiationService, _terminalChatService) {
|
|
19
|
+
super();
|
|
20
|
+
this._configurationService = _configurationService;
|
|
21
|
+
this._terminalChatService = _terminalChatService;
|
|
22
|
+
this._denyListRules = [];
|
|
23
|
+
this._allowListRules = [];
|
|
24
|
+
this._allowListCommandLineRules = [];
|
|
25
|
+
this._denyListCommandLineRules = [];
|
|
26
|
+
this._npmScriptAutoApprover = this._register(instantiationService.createInstance(NpmScriptAutoApprover));
|
|
27
|
+
this.updateConfiguration();
|
|
28
|
+
this._register(this._configurationService.onDidChangeConfiguration(e => {
|
|
29
|
+
if (e.affectsConfiguration(TerminalChatAgentToolsSettingId.AutoApprove) || e.affectsConfiguration(TerminalChatAgentToolsSettingId.IgnoreDefaultAutoApproveRules) || e.affectsConfiguration(TerminalChatAgentToolsSettingId.DeprecatedAutoApproveCompatible)) {
|
|
30
|
+
this.updateConfiguration();
|
|
31
|
+
}
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
updateConfiguration() {
|
|
35
|
+
let configValue = this._configurationService.getValue(TerminalChatAgentToolsSettingId.AutoApprove);
|
|
36
|
+
const configInspectValue = this._configurationService.inspect(TerminalChatAgentToolsSettingId.AutoApprove);
|
|
37
|
+
const deprecatedValue = this._configurationService.getValue(TerminalChatAgentToolsSettingId.DeprecatedAutoApproveCompatible);
|
|
38
|
+
if (deprecatedValue && typeof deprecatedValue === "object" && configValue && typeof configValue === "object") {
|
|
39
|
+
configValue = {
|
|
40
|
+
...configValue,
|
|
41
|
+
...deprecatedValue
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
const {
|
|
45
|
+
denyListRules,
|
|
46
|
+
allowListRules,
|
|
47
|
+
allowListCommandLineRules,
|
|
48
|
+
denyListCommandLineRules
|
|
49
|
+
} = this._mapAutoApproveConfigToRules(configValue, configInspectValue);
|
|
50
|
+
this._allowListRules = allowListRules;
|
|
51
|
+
this._denyListRules = denyListRules;
|
|
52
|
+
this._allowListCommandLineRules = allowListCommandLineRules;
|
|
53
|
+
this._denyListCommandLineRules = denyListCommandLineRules;
|
|
54
|
+
}
|
|
55
|
+
async isCommandAutoApproved(command, shell, os, cwd, chatSessionResource) {
|
|
56
|
+
if (transientEnvVarRegex.test(command)) {
|
|
57
|
+
return {
|
|
58
|
+
result: "denied",
|
|
59
|
+
reason: `Command '${command}' is denied because it contains transient environment variables`
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
for (const rule of this._denyListRules) {
|
|
63
|
+
if (this._commandMatchesRule(rule, command, shell, os)) {
|
|
64
|
+
return {
|
|
65
|
+
result: "denied",
|
|
66
|
+
rule,
|
|
67
|
+
reason: `Command '${command}' is denied by deny list rule: ${rule.sourceText}`
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
for (const rule of this._getSessionRules(chatSessionResource).allowListRules) {
|
|
72
|
+
if (this._commandMatchesRule(rule, command, shell, os)) {
|
|
73
|
+
return {
|
|
74
|
+
result: "approved",
|
|
75
|
+
rule,
|
|
76
|
+
reason: `Command '${command}' is approved by session allow list rule: ${rule.sourceText}`
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
for (const rule of this._allowListRules) {
|
|
81
|
+
if (this._commandMatchesRule(rule, command, shell, os)) {
|
|
82
|
+
return {
|
|
83
|
+
result: "approved",
|
|
84
|
+
rule,
|
|
85
|
+
reason: `Command '${command}' is approved by allow list rule: ${rule.sourceText}`
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
const npmScriptResult = await this._npmScriptAutoApprover.isCommandAutoApproved(command, cwd);
|
|
90
|
+
if (npmScriptResult.isAutoApproved) {
|
|
91
|
+
return {
|
|
92
|
+
result: "approved",
|
|
93
|
+
rule: {
|
|
94
|
+
type: "npmScript",
|
|
95
|
+
npmScriptResult
|
|
96
|
+
},
|
|
97
|
+
reason: `Command '${command}' is approved as npm script '${npmScriptResult.scriptName}' is defined in package.json`
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
result: "noMatch",
|
|
102
|
+
reason: `Command '${command}' has no matching auto approve entries`
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
isCommandLineAutoApproved(commandLine, chatSessionResource) {
|
|
106
|
+
for (const rule of this._denyListCommandLineRules) {
|
|
107
|
+
if (rule.regex.test(commandLine)) {
|
|
108
|
+
return {
|
|
109
|
+
result: "denied",
|
|
110
|
+
rule,
|
|
111
|
+
reason: `Command line '${commandLine}' is denied by deny list rule: ${rule.sourceText}`
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
for (const rule of this._getSessionRules(chatSessionResource).allowListCommandLineRules) {
|
|
116
|
+
if (rule.regex.test(commandLine)) {
|
|
117
|
+
return {
|
|
118
|
+
result: "approved",
|
|
119
|
+
rule,
|
|
120
|
+
reason: `Command line '${commandLine}' is approved by session allow list rule: ${rule.sourceText}`
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
for (const rule of this._allowListCommandLineRules) {
|
|
125
|
+
if (rule.regex.test(commandLine)) {
|
|
126
|
+
return {
|
|
127
|
+
result: "approved",
|
|
128
|
+
rule,
|
|
129
|
+
reason: `Command line '${commandLine}' is approved by allow list rule: ${rule.sourceText}`
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
result: "noMatch",
|
|
135
|
+
reason: `Command line '${commandLine}' has no matching auto approve entries`
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
_getSessionRules(chatSessionResource) {
|
|
139
|
+
const denyListRules = [];
|
|
140
|
+
const allowListRules = [];
|
|
141
|
+
const allowListCommandLineRules = [];
|
|
142
|
+
const denyListCommandLineRules = [];
|
|
143
|
+
if (!chatSessionResource) {
|
|
144
|
+
return {
|
|
145
|
+
denyListRules,
|
|
146
|
+
allowListRules,
|
|
147
|
+
allowListCommandLineRules,
|
|
148
|
+
denyListCommandLineRules
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
const sessionRulesConfig = this._terminalChatService.getSessionAutoApproveRules(chatSessionResource);
|
|
152
|
+
for (const [key, value] of Object.entries(sessionRulesConfig)) {
|
|
153
|
+
if (typeof value === "boolean") {
|
|
154
|
+
const {
|
|
155
|
+
regex,
|
|
156
|
+
regexCaseInsensitive
|
|
157
|
+
} = this._convertAutoApproveEntryToRegex(key);
|
|
158
|
+
if (value === true) {
|
|
159
|
+
allowListRules.push({
|
|
160
|
+
regex,
|
|
161
|
+
regexCaseInsensitive,
|
|
162
|
+
sourceText: key,
|
|
163
|
+
sourceTarget: "session",
|
|
164
|
+
isDefaultRule: false
|
|
165
|
+
});
|
|
166
|
+
} else if (value === false) {
|
|
167
|
+
denyListRules.push({
|
|
168
|
+
regex,
|
|
169
|
+
regexCaseInsensitive,
|
|
170
|
+
sourceText: key,
|
|
171
|
+
sourceTarget: "session",
|
|
172
|
+
isDefaultRule: false
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
} else if (typeof value === "object" && value !== null) {
|
|
176
|
+
const objectValue = value;
|
|
177
|
+
if (typeof objectValue.approve === "boolean") {
|
|
178
|
+
const {
|
|
179
|
+
regex,
|
|
180
|
+
regexCaseInsensitive
|
|
181
|
+
} = this._convertAutoApproveEntryToRegex(key);
|
|
182
|
+
if (objectValue.approve === true) {
|
|
183
|
+
if (objectValue.matchCommandLine === true) {
|
|
184
|
+
allowListCommandLineRules.push({
|
|
185
|
+
regex,
|
|
186
|
+
regexCaseInsensitive,
|
|
187
|
+
sourceText: key,
|
|
188
|
+
sourceTarget: "session",
|
|
189
|
+
isDefaultRule: false
|
|
190
|
+
});
|
|
191
|
+
} else {
|
|
192
|
+
allowListRules.push({
|
|
193
|
+
regex,
|
|
194
|
+
regexCaseInsensitive,
|
|
195
|
+
sourceText: key,
|
|
196
|
+
sourceTarget: "session",
|
|
197
|
+
isDefaultRule: false
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
} else if (objectValue.approve === false) {
|
|
201
|
+
if (objectValue.matchCommandLine === true) {
|
|
202
|
+
denyListCommandLineRules.push({
|
|
203
|
+
regex,
|
|
204
|
+
regexCaseInsensitive,
|
|
205
|
+
sourceText: key,
|
|
206
|
+
sourceTarget: "session",
|
|
207
|
+
isDefaultRule: false
|
|
208
|
+
});
|
|
209
|
+
} else {
|
|
210
|
+
denyListRules.push({
|
|
211
|
+
regex,
|
|
212
|
+
regexCaseInsensitive,
|
|
213
|
+
sourceText: key,
|
|
214
|
+
sourceTarget: "session",
|
|
215
|
+
isDefaultRule: false
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
denyListRules,
|
|
224
|
+
allowListRules,
|
|
225
|
+
allowListCommandLineRules,
|
|
226
|
+
denyListCommandLineRules
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
_commandMatchesRule(rule, command, shell, os) {
|
|
230
|
+
const isPwsh = isPowerShell(shell, os);
|
|
231
|
+
if ((isPwsh ? rule.regexCaseInsensitive : rule.regex).test(command)) {
|
|
232
|
+
return true;
|
|
233
|
+
} else if (isPwsh && command.startsWith("(")) {
|
|
234
|
+
if (rule.regexCaseInsensitive.test(command.slice(1))) {
|
|
235
|
+
return true;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return false;
|
|
239
|
+
}
|
|
240
|
+
_mapAutoApproveConfigToRules(config, configInspectValue) {
|
|
241
|
+
if (!config || typeof config !== "object") {
|
|
242
|
+
return {
|
|
243
|
+
denyListRules: [],
|
|
244
|
+
allowListRules: [],
|
|
245
|
+
allowListCommandLineRules: [],
|
|
246
|
+
denyListCommandLineRules: []
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
const denyListRules = [];
|
|
250
|
+
const allowListRules = [];
|
|
251
|
+
const allowListCommandLineRules = [];
|
|
252
|
+
const denyListCommandLineRules = [];
|
|
253
|
+
const ignoreDefaults = this._configurationService.getValue(TerminalChatAgentToolsSettingId.IgnoreDefaultAutoApproveRules) === true;
|
|
254
|
+
for (const [key, value] of Object.entries(config)) {
|
|
255
|
+
const defaultValue = configInspectValue?.default?.value;
|
|
256
|
+
const isDefaultRule = !!(isObject(defaultValue) && Object.prototype.hasOwnProperty.call(defaultValue, key) && structuralEquals(defaultValue[key], value));
|
|
257
|
+
function checkTarget(inspectValue) {
|
|
258
|
+
return (isObject(inspectValue) && Object.prototype.hasOwnProperty.call(inspectValue, key) && structuralEquals(inspectValue[key], value));
|
|
259
|
+
}
|
|
260
|
+
const sourceTarget = (checkTarget(configInspectValue.workspaceFolder) ? ConfigurationTarget.WORKSPACE_FOLDER : checkTarget(configInspectValue.workspaceValue) ? ConfigurationTarget.WORKSPACE : checkTarget(configInspectValue.userRemoteValue) ? ConfigurationTarget.USER_REMOTE : checkTarget(configInspectValue.userLocalValue) ? ConfigurationTarget.USER_LOCAL : checkTarget(configInspectValue.userValue) ? ConfigurationTarget.USER : checkTarget(configInspectValue.applicationValue) ? ConfigurationTarget.APPLICATION : ConfigurationTarget.DEFAULT);
|
|
261
|
+
if (ignoreDefaults && isDefaultRule && sourceTarget === ConfigurationTarget.DEFAULT) {
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
if (typeof value === "boolean") {
|
|
265
|
+
const {
|
|
266
|
+
regex,
|
|
267
|
+
regexCaseInsensitive
|
|
268
|
+
} = this._convertAutoApproveEntryToRegex(key);
|
|
269
|
+
if (value === true) {
|
|
270
|
+
allowListRules.push({
|
|
271
|
+
regex,
|
|
272
|
+
regexCaseInsensitive,
|
|
273
|
+
sourceText: key,
|
|
274
|
+
sourceTarget,
|
|
275
|
+
isDefaultRule
|
|
276
|
+
});
|
|
277
|
+
} else if (value === false) {
|
|
278
|
+
denyListRules.push({
|
|
279
|
+
regex,
|
|
280
|
+
regexCaseInsensitive,
|
|
281
|
+
sourceText: key,
|
|
282
|
+
sourceTarget,
|
|
283
|
+
isDefaultRule
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
} else if (typeof value === "object" && value !== null) {
|
|
287
|
+
const objectValue = value;
|
|
288
|
+
if (typeof objectValue.approve === "boolean") {
|
|
289
|
+
const {
|
|
290
|
+
regex,
|
|
291
|
+
regexCaseInsensitive
|
|
292
|
+
} = this._convertAutoApproveEntryToRegex(key);
|
|
293
|
+
if (objectValue.approve === true) {
|
|
294
|
+
if (objectValue.matchCommandLine === true) {
|
|
295
|
+
allowListCommandLineRules.push({
|
|
296
|
+
regex,
|
|
297
|
+
regexCaseInsensitive,
|
|
298
|
+
sourceText: key,
|
|
299
|
+
sourceTarget,
|
|
300
|
+
isDefaultRule
|
|
301
|
+
});
|
|
302
|
+
} else {
|
|
303
|
+
allowListRules.push({
|
|
304
|
+
regex,
|
|
305
|
+
regexCaseInsensitive,
|
|
306
|
+
sourceText: key,
|
|
307
|
+
sourceTarget,
|
|
308
|
+
isDefaultRule
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
} else if (objectValue.approve === false) {
|
|
312
|
+
if (objectValue.matchCommandLine === true) {
|
|
313
|
+
denyListCommandLineRules.push({
|
|
314
|
+
regex,
|
|
315
|
+
regexCaseInsensitive,
|
|
316
|
+
sourceText: key,
|
|
317
|
+
sourceTarget,
|
|
318
|
+
isDefaultRule
|
|
319
|
+
});
|
|
320
|
+
} else {
|
|
321
|
+
denyListRules.push({
|
|
322
|
+
regex,
|
|
323
|
+
regexCaseInsensitive,
|
|
324
|
+
sourceText: key,
|
|
325
|
+
sourceTarget,
|
|
326
|
+
isDefaultRule
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
return {
|
|
334
|
+
denyListRules,
|
|
335
|
+
allowListRules,
|
|
336
|
+
allowListCommandLineRules,
|
|
337
|
+
denyListCommandLineRules
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
_convertAutoApproveEntryToRegex(value) {
|
|
341
|
+
const regex = this._doConvertAutoApproveEntryToRegex(value);
|
|
342
|
+
if (regex.flags.includes("i")) {
|
|
343
|
+
return {
|
|
344
|
+
regex,
|
|
345
|
+
regexCaseInsensitive: regex
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
return {
|
|
349
|
+
regex,
|
|
350
|
+
regexCaseInsensitive: ( new RegExp(regex.source, regex.flags + "i"))
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
_doConvertAutoApproveEntryToRegex(value) {
|
|
354
|
+
const regexMatch = value.match(/^\/(?<pattern>.+)\/(?<flags>[dgimsuvy]*)$/);
|
|
355
|
+
const regexPattern = regexMatch?.groups?.pattern;
|
|
356
|
+
if (regexPattern) {
|
|
357
|
+
let flags = regexMatch.groups?.flags;
|
|
358
|
+
if (flags) {
|
|
359
|
+
flags = flags.replaceAll("g", "");
|
|
360
|
+
}
|
|
361
|
+
if (regexPattern === ".*") {
|
|
362
|
+
return ( new RegExp(regexPattern));
|
|
363
|
+
}
|
|
364
|
+
try {
|
|
365
|
+
const regex = ( new RegExp(regexPattern, flags || undefined));
|
|
366
|
+
if (regExpLeadsToEndlessLoop(regex)) {
|
|
367
|
+
return neverMatchRegex;
|
|
368
|
+
}
|
|
369
|
+
return regex;
|
|
370
|
+
} catch (error) {
|
|
371
|
+
return neverMatchRegex;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
if (value === "") {
|
|
375
|
+
return neverMatchRegex;
|
|
376
|
+
}
|
|
377
|
+
let sanitizedValue;
|
|
378
|
+
if (value.includes("/") || value.includes("\\")) {
|
|
379
|
+
let pattern = value.replace(/[/\\]/g, "%%PATH_SEP%%");
|
|
380
|
+
pattern = escapeRegExpCharacters(pattern);
|
|
381
|
+
pattern = pattern.replace(/%%PATH_SEP%%*/g, "[/\\\\]");
|
|
382
|
+
sanitizedValue = `^(?:\\.[/\\\\])?${pattern}`;
|
|
383
|
+
}
|
|
384
|
+
else {
|
|
385
|
+
sanitizedValue = escapeRegExpCharacters(value);
|
|
386
|
+
}
|
|
387
|
+
return ( new RegExp(`^${sanitizedValue}\\b`));
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
CommandLineAutoApprover = ( __decorate([( __param(0, IConfigurationService)), ( __param(1, IInstantiationService)), ( __param(2, ITerminalChatService))], CommandLineAutoApprover));
|
|
391
|
+
|
|
392
|
+
export { CommandLineAutoApprover };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type IMarkdownString } from "@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent";
|
|
2
|
+
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
3
|
+
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
4
|
+
import { IUriIdentityService } from "@codingame/monaco-vscode-api/vscode/vs/platform/uriIdentity/common/uriIdentity.service";
|
|
5
|
+
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
6
|
+
import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service";
|
|
7
|
+
import { IWorkspaceContextService } from "@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service";
|
|
8
|
+
export interface INpmScriptAutoApproveResult {
|
|
9
|
+
isAutoApproved: boolean;
|
|
10
|
+
scriptName?: string;
|
|
11
|
+
autoApproveInfo?: IMarkdownString;
|
|
12
|
+
}
|
|
13
|
+
export declare class NpmScriptAutoApprover extends Disposable {
|
|
14
|
+
private readonly _configurationService;
|
|
15
|
+
private readonly _fileService;
|
|
16
|
+
private readonly _uriIdentityService;
|
|
17
|
+
private readonly _workspaceContextService;
|
|
18
|
+
constructor(_configurationService: IConfigurationService, _fileService: IFileService, _uriIdentityService: IUriIdentityService, _workspaceContextService: IWorkspaceContextService);
|
|
19
|
+
/**
|
|
20
|
+
* Checks if a single command is an npm/yarn/pnpm script that exists in package.json.
|
|
21
|
+
* Returns auto-approve result if the command is a valid script.
|
|
22
|
+
*/
|
|
23
|
+
isCommandAutoApproved(command: string, cwd: URI | undefined): Promise<INpmScriptAutoApproveResult>;
|
|
24
|
+
/**
|
|
25
|
+
* Extracts script name from an npm/yarn/pnpm run command.
|
|
26
|
+
*/
|
|
27
|
+
private _extractScriptName;
|
|
28
|
+
/**
|
|
29
|
+
* Checks if a URI is within any workspace folder.
|
|
30
|
+
*/
|
|
31
|
+
private _isWithinWorkspace;
|
|
32
|
+
/**
|
|
33
|
+
* Finds and parses package.json to get the scripts section.
|
|
34
|
+
* Only looks within the workspace for security.
|
|
35
|
+
*/
|
|
36
|
+
private _getPackageJsonScripts;
|
|
37
|
+
/**
|
|
38
|
+
* Reads and parses the scripts section from a package.json file.
|
|
39
|
+
*/
|
|
40
|
+
private _readPackageJsonScripts;
|
|
41
|
+
/**
|
|
42
|
+
* Parses the scripts section from package.json content using jsonc-parser.
|
|
43
|
+
*/
|
|
44
|
+
private _parsePackageJsonScripts;
|
|
45
|
+
}
|