@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,168 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
4
|
+
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
5
|
+
import { win32, posix } from '@codingame/monaco-vscode-api/vscode/vs/base/common/path';
|
|
6
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
7
|
+
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
8
|
+
import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
|
|
9
|
+
import { TerminalChatAgentToolsSettingId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration';
|
|
10
|
+
import { TreeSitterCommandParserLanguage } from '../../treeSitterCommandParser.js';
|
|
11
|
+
import { OperatingSystem } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
|
|
12
|
+
import { isString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
13
|
+
import { ILabelService } from '@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service';
|
|
14
|
+
|
|
15
|
+
const nullDevice = Symbol("null device");
|
|
16
|
+
let CommandLineFileWriteAnalyzer = class CommandLineFileWriteAnalyzer extends Disposable {
|
|
17
|
+
constructor(
|
|
18
|
+
_treeSitterCommandParser,
|
|
19
|
+
_log,
|
|
20
|
+
_configurationService,
|
|
21
|
+
_labelService,
|
|
22
|
+
_workspaceContextService
|
|
23
|
+
) {
|
|
24
|
+
super();
|
|
25
|
+
this._treeSitterCommandParser = _treeSitterCommandParser;
|
|
26
|
+
this._log = _log;
|
|
27
|
+
this._configurationService = _configurationService;
|
|
28
|
+
this._labelService = _labelService;
|
|
29
|
+
this._workspaceContextService = _workspaceContextService;
|
|
30
|
+
}
|
|
31
|
+
async analyze(options) {
|
|
32
|
+
let fileWrites;
|
|
33
|
+
try {
|
|
34
|
+
fileWrites = await this._getFileWrites(options);
|
|
35
|
+
} catch (e) {
|
|
36
|
+
console.error(e);
|
|
37
|
+
this._log("Failed to get file writes via grammar", options.treeSitterLanguage);
|
|
38
|
+
return {
|
|
39
|
+
isAutoApproveAllowed: false
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
return this._getResult(options, fileWrites);
|
|
43
|
+
}
|
|
44
|
+
async _getFileWrites(options) {
|
|
45
|
+
let fileWrites = [];
|
|
46
|
+
const capturedFileWrites = ( (await this._treeSitterCommandParser.getFileWrites(options.treeSitterLanguage, options.commandLine)).map(this._mapNullDevice.bind(this, options)));
|
|
47
|
+
const commandFileWrites = ( (await this._treeSitterCommandParser.getCommandFileWrites(options.treeSitterLanguage, options.commandLine)).map(this._mapNullDevice.bind(this, options)));
|
|
48
|
+
const allCapturedFileWrites = [...capturedFileWrites, ...commandFileWrites];
|
|
49
|
+
if (allCapturedFileWrites.length) {
|
|
50
|
+
const cwd = options.cwd;
|
|
51
|
+
if (cwd) {
|
|
52
|
+
this._log("Detected cwd", ( cwd.toString()));
|
|
53
|
+
fileWrites = ( allCapturedFileWrites.map(e => {
|
|
54
|
+
if (e === nullDevice) {
|
|
55
|
+
return e;
|
|
56
|
+
}
|
|
57
|
+
if (/^['"].*['"]$/.test(e)) {
|
|
58
|
+
e = this._stripSurroundingQuotes(e);
|
|
59
|
+
}
|
|
60
|
+
const isAbsolute = options.os === OperatingSystem.Windows ? win32.isAbsolute(e) : posix.isAbsolute(e);
|
|
61
|
+
if (isAbsolute) {
|
|
62
|
+
return cwd.with({
|
|
63
|
+
path: e
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return URI.joinPath(cwd, e);
|
|
67
|
+
}));
|
|
68
|
+
} else {
|
|
69
|
+
this._log("Cwd could not be detected");
|
|
70
|
+
fileWrites = allCapturedFileWrites;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
this._log("File writes detected", ( fileWrites.map(e => ( e.toString()))));
|
|
74
|
+
return fileWrites;
|
|
75
|
+
}
|
|
76
|
+
_stripSurroundingQuotes(text) {
|
|
77
|
+
if ((text.startsWith("\"") && text.endsWith("\"")) || (text.startsWith("'") && text.endsWith("'"))) {
|
|
78
|
+
return text.slice(1, -1);
|
|
79
|
+
}
|
|
80
|
+
return text;
|
|
81
|
+
}
|
|
82
|
+
_mapNullDevice(options, rawFileWrite) {
|
|
83
|
+
if (options.treeSitterLanguage === TreeSitterCommandParserLanguage.PowerShell) {
|
|
84
|
+
return rawFileWrite === "$null" ? nullDevice : rawFileWrite;
|
|
85
|
+
}
|
|
86
|
+
return rawFileWrite === "/dev/null" ? nullDevice : rawFileWrite;
|
|
87
|
+
}
|
|
88
|
+
_getResult(options, fileWrites) {
|
|
89
|
+
let isAutoApproveAllowed = true;
|
|
90
|
+
if (fileWrites.length > 0) {
|
|
91
|
+
const blockDetectedFileWrites = this._configurationService.getValue(TerminalChatAgentToolsSettingId.BlockDetectedFileWrites);
|
|
92
|
+
switch (blockDetectedFileWrites) {
|
|
93
|
+
case "all":
|
|
94
|
+
{
|
|
95
|
+
isAutoApproveAllowed = false;
|
|
96
|
+
this._log("File writes blocked due to \"all\" setting");
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
case "outsideWorkspace":
|
|
100
|
+
{
|
|
101
|
+
const workspaceFolders = this._workspaceContextService.getWorkspace().folders;
|
|
102
|
+
if (workspaceFolders.length > 0) {
|
|
103
|
+
for (const fileWrite of fileWrites) {
|
|
104
|
+
if (fileWrite === nullDevice) {
|
|
105
|
+
this._log("File write to null device allowed", URI.isUri(fileWrite) ? ( fileWrite.toString()) : fileWrite);
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
if (isString(fileWrite)) {
|
|
109
|
+
const isAbsolute = options.os === OperatingSystem.Windows ? win32.isAbsolute(fileWrite) : posix.isAbsolute(fileWrite);
|
|
110
|
+
if (!isAbsolute) {
|
|
111
|
+
isAutoApproveAllowed = false;
|
|
112
|
+
this._log("File write blocked due to unknown terminal cwd", fileWrite);
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
const fileUri = URI.isUri(fileWrite) ? fileWrite : URI.file(fileWrite);
|
|
117
|
+
if (fileUri.fsPath.match(/[$\(\){}`]/)) {
|
|
118
|
+
isAutoApproveAllowed = false;
|
|
119
|
+
this._log(
|
|
120
|
+
"File write blocked due to likely containing a variable or sub-command",
|
|
121
|
+
( fileUri.toString())
|
|
122
|
+
);
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
const isInsideWorkspace = ( workspaceFolders.some(
|
|
126
|
+
folder => folder.uri.scheme === fileUri.scheme && (fileUri.path.startsWith(folder.uri.path + "/") || fileUri.path === folder.uri.path)
|
|
127
|
+
));
|
|
128
|
+
if (!isInsideWorkspace) {
|
|
129
|
+
isAutoApproveAllowed = false;
|
|
130
|
+
this._log("File write blocked outside workspace", ( fileUri.toString()));
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
} else {
|
|
135
|
+
const hasOnlyNullDevices = fileWrites.every(fw => fw === nullDevice);
|
|
136
|
+
if (!hasOnlyNullDevices) {
|
|
137
|
+
isAutoApproveAllowed = false;
|
|
138
|
+
this._log("File writes blocked - no workspace folders");
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
const disclaimers = [];
|
|
146
|
+
if (fileWrites.length > 0) {
|
|
147
|
+
const fileWritesList = ( fileWrites.map(
|
|
148
|
+
fw => `\`${URI.isUri(fw) ? this._labelService.getUriLabel(fw) : fw === nullDevice ? "/dev/null" : ( fw.toString())}\``
|
|
149
|
+
)).join(", ");
|
|
150
|
+
if (!isAutoApproveAllowed) {
|
|
151
|
+
disclaimers.push(( localize(
|
|
152
|
+
14017,
|
|
153
|
+
"File write operations detected that cannot be auto approved: {0}",
|
|
154
|
+
fileWritesList
|
|
155
|
+
)));
|
|
156
|
+
} else {
|
|
157
|
+
disclaimers.push(( localize(14018, "File write operations detected: {0}", fileWritesList)));
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return {
|
|
161
|
+
isAutoApproveAllowed,
|
|
162
|
+
disclaimers
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
CommandLineFileWriteAnalyzer = ( __decorate([( __param(2, IConfigurationService)), ( __param(3, ILabelService)), ( __param(4, IWorkspaceContextService))], CommandLineFileWriteAnalyzer));
|
|
167
|
+
|
|
168
|
+
export { CommandLineFileWriteAnalyzer };
|
|
@@ -0,0 +1,11 @@
|
|
|
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 { ITerminalSandboxService } from "../../../common/terminalSandboxService.js";
|
|
4
|
+
import type { ICommandLineAnalyzer, ICommandLineAnalyzerOptions, ICommandLineAnalyzerResult } from "./commandLineAnalyzer.js";
|
|
5
|
+
export declare class CommandLineSandboxAnalyzer extends Disposable implements ICommandLineAnalyzer {
|
|
6
|
+
private readonly _sandboxService;
|
|
7
|
+
private readonly _configurationService;
|
|
8
|
+
constructor(_sandboxService: ITerminalSandboxService, _configurationService: IConfigurationService);
|
|
9
|
+
private _isAutoApproveEnabled;
|
|
10
|
+
analyze(_options: ICommandLineAnalyzerOptions): Promise<ICommandLineAnalyzerResult>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
4
|
+
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
5
|
+
import { TerminalChatAgentToolsSettingId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration';
|
|
6
|
+
import '../../../common/terminalSandboxService.js';
|
|
7
|
+
import { ITerminalSandboxService } from '@codingame/monaco-vscode-api/vscode/vs/platform/sandbox/common/terminalSandboxService.service';
|
|
8
|
+
|
|
9
|
+
let CommandLineSandboxAnalyzer = class CommandLineSandboxAnalyzer extends Disposable {
|
|
10
|
+
constructor(_sandboxService, _configurationService) {
|
|
11
|
+
super();
|
|
12
|
+
this._sandboxService = _sandboxService;
|
|
13
|
+
this._configurationService = _configurationService;
|
|
14
|
+
}
|
|
15
|
+
_isAutoApproveEnabled() {
|
|
16
|
+
return this._configurationService.getValue(TerminalChatAgentToolsSettingId.EnableAutoApprove) !== false;
|
|
17
|
+
}
|
|
18
|
+
async analyze(_options) {
|
|
19
|
+
const isAutoApproveEnabled = this._isAutoApproveEnabled();
|
|
20
|
+
if (!(await this._sandboxService.isEnabled())) {
|
|
21
|
+
return {
|
|
22
|
+
isAutoApproveAllowed: isAutoApproveEnabled
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
isAutoApproveAllowed: isAutoApproveEnabled,
|
|
27
|
+
forceAutoApproval: !_options.requiresUnsandboxConfirmation && isAutoApproveEnabled
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
CommandLineSandboxAnalyzer = ( __decorate([( __param(0, ITerminalSandboxService)), ( __param(1, IConfigurationService))], CommandLineSandboxAnalyzer));
|
|
32
|
+
|
|
33
|
+
export { CommandLineSandboxAnalyzer };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { MaybePromise } from "@codingame/monaco-vscode-api/vscode/vs/base/common/async";
|
|
2
|
+
import type { OperatingSystem } from "@codingame/monaco-vscode-api/vscode/vs/base/common/platform";
|
|
3
|
+
export interface ICommandLinePresenter {
|
|
4
|
+
/**
|
|
5
|
+
* Attempts to create a presentation for the given command line.
|
|
6
|
+
* Command line presenters allow displaying an extracted/transformed version
|
|
7
|
+
* of a command (e.g., Python code from `python -c "..."`) with appropriate
|
|
8
|
+
* syntax highlighting, while the actual command remains unchanged.
|
|
9
|
+
*
|
|
10
|
+
* @returns The presentation result if this presenter handles the command, undefined otherwise.
|
|
11
|
+
*/
|
|
12
|
+
present(options: ICommandLinePresenterOptions): MaybePromise<ICommandLinePresenterResult | undefined>;
|
|
13
|
+
}
|
|
14
|
+
export interface ICommandLinePresenterOptions {
|
|
15
|
+
commandLine: ICommandLinePresentationInput;
|
|
16
|
+
shell: string;
|
|
17
|
+
os: OperatingSystem;
|
|
18
|
+
}
|
|
19
|
+
export interface ICommandLinePresentationInput {
|
|
20
|
+
original?: string;
|
|
21
|
+
forDisplay: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ICommandLinePresenterResult {
|
|
24
|
+
/**
|
|
25
|
+
* The extracted/transformed command to display (e.g., the Python code).
|
|
26
|
+
*/
|
|
27
|
+
commandLine: string;
|
|
28
|
+
/**
|
|
29
|
+
* The language ID for syntax highlighting (e.g., 'python').
|
|
30
|
+
*/
|
|
31
|
+
language?: string;
|
|
32
|
+
/**
|
|
33
|
+
* A human-readable name for the language (e.g., 'Python') used in UI labels.
|
|
34
|
+
*/
|
|
35
|
+
languageDisplayName?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Whether other presenters should still process the command line.
|
|
38
|
+
* Defaults to false - once a presenter handles a command, no further processing is done.
|
|
39
|
+
*/
|
|
40
|
+
processOtherPresenters?: boolean;
|
|
41
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { OperatingSystem } from "@codingame/monaco-vscode-api/vscode/vs/base/common/platform";
|
|
2
|
+
import type { ICommandLinePresenter, ICommandLinePresenterOptions, ICommandLinePresenterResult } from "./commandLinePresenter.js";
|
|
3
|
+
/**
|
|
4
|
+
* Command line presenter for Node.js inline commands (`node -e "..."`).
|
|
5
|
+
* Extracts the JavaScript code and sets up JavaScript syntax highlighting.
|
|
6
|
+
*/
|
|
7
|
+
export declare class NodeCommandLinePresenter implements ICommandLinePresenter {
|
|
8
|
+
present(options: ICommandLinePresenterOptions): ICommandLinePresenterResult | undefined;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Extracts the JavaScript code from a `node -e "..."` or `node -e '...'` command,
|
|
12
|
+
* returning the code with properly unescaped quotes.
|
|
13
|
+
*
|
|
14
|
+
* @param commandLine The full command line to parse
|
|
15
|
+
* @param shell The shell path (to determine quote escaping style)
|
|
16
|
+
* @param os The operating system
|
|
17
|
+
* @returns The extracted JavaScript code, or undefined if not a node -e/--eval command
|
|
18
|
+
*/
|
|
19
|
+
export declare function extractNodeCommand(commandLine: string, shell: string, os: OperatingSystem): string | undefined;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
|
|
2
|
+
import { isPowerShell } from '../../runInTerminalHelpers.js';
|
|
3
|
+
|
|
4
|
+
class NodeCommandLinePresenter {
|
|
5
|
+
present(options) {
|
|
6
|
+
const commandLine = options.commandLine.forDisplay;
|
|
7
|
+
const extractedNode = extractNodeCommand(commandLine, options.shell, options.os);
|
|
8
|
+
if (extractedNode) {
|
|
9
|
+
return {
|
|
10
|
+
commandLine: extractedNode,
|
|
11
|
+
language: 'javascript',
|
|
12
|
+
languageDisplayName: 'Node.js',
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function extractNodeCommand(commandLine, shell, os) {
|
|
19
|
+
const doubleQuoteMatch = commandLine.match(/^node(?:js)?\s+(?:-e|--eval)\s+"(?<code>.+)"$/s);
|
|
20
|
+
if (doubleQuoteMatch?.groups?.code) {
|
|
21
|
+
let jsCode = doubleQuoteMatch.groups.code.trim();
|
|
22
|
+
if (isPowerShell(shell, os)) {
|
|
23
|
+
jsCode = jsCode.replace(/`"/g, '"');
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
jsCode = jsCode.replace(/\\"/g, '"');
|
|
27
|
+
}
|
|
28
|
+
return jsCode;
|
|
29
|
+
}
|
|
30
|
+
const singleQuoteMatch = commandLine.match(/^node(?:js)?\s+(?:-e|--eval)\s+'(?<code>.+)'$/s);
|
|
31
|
+
if (singleQuoteMatch?.groups?.code) {
|
|
32
|
+
return singleQuoteMatch.groups.code.trim();
|
|
33
|
+
}
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { NodeCommandLinePresenter, extractNodeCommand };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { OperatingSystem } from "@codingame/monaco-vscode-api/vscode/vs/base/common/platform";
|
|
2
|
+
import type { ICommandLinePresenter, ICommandLinePresenterOptions, ICommandLinePresenterResult } from "./commandLinePresenter.js";
|
|
3
|
+
/**
|
|
4
|
+
* Command line presenter for Python inline commands (`python -c "..."`).
|
|
5
|
+
* Extracts the Python code and sets up Python syntax highlighting.
|
|
6
|
+
*/
|
|
7
|
+
export declare class PythonCommandLinePresenter implements ICommandLinePresenter {
|
|
8
|
+
present(options: ICommandLinePresenterOptions): ICommandLinePresenterResult | undefined;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Extracts the Python code from a `python -c "..."` or `python -c '...'` command,
|
|
12
|
+
* returning the code with properly unescaped quotes.
|
|
13
|
+
*
|
|
14
|
+
* @param commandLine The full command line to parse
|
|
15
|
+
* @param shell The shell path (to determine quote escaping style)
|
|
16
|
+
* @param os The operating system
|
|
17
|
+
* @returns The extracted Python code, or undefined if not a python -c command
|
|
18
|
+
*/
|
|
19
|
+
export declare function extractPythonCommand(commandLine: string, shell: string, os: OperatingSystem): string | undefined;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
|
|
2
|
+
import { isPowerShell } from '../../runInTerminalHelpers.js';
|
|
3
|
+
|
|
4
|
+
class PythonCommandLinePresenter {
|
|
5
|
+
present(options) {
|
|
6
|
+
const commandLine = options.commandLine.forDisplay;
|
|
7
|
+
const extractedPython = extractPythonCommand(commandLine, options.shell, options.os);
|
|
8
|
+
if (extractedPython) {
|
|
9
|
+
return {
|
|
10
|
+
commandLine: extractedPython,
|
|
11
|
+
language: 'python',
|
|
12
|
+
languageDisplayName: 'Python',
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function extractPythonCommand(commandLine, shell, os) {
|
|
19
|
+
const doubleQuoteMatch = commandLine.match(/^python(?:3)?\s+-c\s+"(?<python>.+)"$/s);
|
|
20
|
+
if (doubleQuoteMatch?.groups?.python) {
|
|
21
|
+
let pythonCode = doubleQuoteMatch.groups.python.trim();
|
|
22
|
+
if (isPowerShell(shell, os)) {
|
|
23
|
+
pythonCode = pythonCode.replace(/`"/g, '"');
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
pythonCode = pythonCode.replace(/\\"/g, '"');
|
|
27
|
+
}
|
|
28
|
+
return pythonCode;
|
|
29
|
+
}
|
|
30
|
+
const singleQuoteMatch = commandLine.match(/^python(?:3)?\s+-c\s+'(?<python>.+)'$/s);
|
|
31
|
+
if (singleQuoteMatch?.groups?.python) {
|
|
32
|
+
return singleQuoteMatch.groups.python.trim();
|
|
33
|
+
}
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { PythonCommandLinePresenter, extractPythonCommand };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { OperatingSystem } from "@codingame/monaco-vscode-api/vscode/vs/base/common/platform";
|
|
2
|
+
import type { ICommandLinePresenter, ICommandLinePresenterOptions, ICommandLinePresenterResult } from "./commandLinePresenter.js";
|
|
3
|
+
/**
|
|
4
|
+
* Command line presenter for Ruby inline commands (`ruby -e "..."`).
|
|
5
|
+
* Extracts the Ruby code and sets up Ruby syntax highlighting.
|
|
6
|
+
*/
|
|
7
|
+
export declare class RubyCommandLinePresenter implements ICommandLinePresenter {
|
|
8
|
+
present(options: ICommandLinePresenterOptions): ICommandLinePresenterResult | undefined;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Extracts the Ruby code from a `ruby -e "..."` or `ruby -e '...'` command,
|
|
12
|
+
* returning the code with properly unescaped quotes.
|
|
13
|
+
*
|
|
14
|
+
* @param commandLine The full command line to parse
|
|
15
|
+
* @param shell The shell path (to determine quote escaping style)
|
|
16
|
+
* @param os The operating system
|
|
17
|
+
* @returns The extracted Ruby code, or undefined if not a ruby -e command
|
|
18
|
+
*/
|
|
19
|
+
export declare function extractRubyCommand(commandLine: string, shell: string, os: OperatingSystem): string | undefined;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
|
|
2
|
+
import { isPowerShell } from '../../runInTerminalHelpers.js';
|
|
3
|
+
|
|
4
|
+
class RubyCommandLinePresenter {
|
|
5
|
+
present(options) {
|
|
6
|
+
const commandLine = options.commandLine.forDisplay;
|
|
7
|
+
const extractedRuby = extractRubyCommand(commandLine, options.shell, options.os);
|
|
8
|
+
if (extractedRuby) {
|
|
9
|
+
return {
|
|
10
|
+
commandLine: extractedRuby,
|
|
11
|
+
language: 'ruby',
|
|
12
|
+
languageDisplayName: 'Ruby',
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function extractRubyCommand(commandLine, shell, os) {
|
|
19
|
+
const doubleQuoteMatch = commandLine.match(/^ruby\s+-e\s+"(?<code>.+)"$/s);
|
|
20
|
+
if (doubleQuoteMatch?.groups?.code) {
|
|
21
|
+
let rubyCode = doubleQuoteMatch.groups.code.trim();
|
|
22
|
+
if (!rubyCode) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
if (isPowerShell(shell, os)) {
|
|
26
|
+
rubyCode = rubyCode.replace(/`"/g, '"');
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
rubyCode = rubyCode.replace(/\\"/g, '"');
|
|
30
|
+
}
|
|
31
|
+
return rubyCode;
|
|
32
|
+
}
|
|
33
|
+
const singleQuoteMatch = commandLine.match(/^ruby\s+-e\s+'(?<code>.+)'$/s);
|
|
34
|
+
if (singleQuoteMatch?.groups?.code) {
|
|
35
|
+
const rubyCode = singleQuoteMatch.groups.code.trim();
|
|
36
|
+
if (!rubyCode) {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
return rubyCode;
|
|
40
|
+
}
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { RubyCommandLinePresenter, extractRubyCommand };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ITerminalSandboxService } from "../../../common/terminalSandboxService.js";
|
|
2
|
+
import type { ICommandLinePresenter, ICommandLinePresenterOptions, ICommandLinePresenterResult } from "./commandLinePresenter.js";
|
|
3
|
+
/**
|
|
4
|
+
* Command line presenter for sandboxed commands.
|
|
5
|
+
* Returns the display form of the command (provided via {@link ICommandLineRewriterResult.forDisplay}
|
|
6
|
+
* from the rewriter pipeline) for cleaner presentation, while the actual sandboxed command runs
|
|
7
|
+
* unchanged.
|
|
8
|
+
*/
|
|
9
|
+
export declare class SandboxedCommandLinePresenter implements ICommandLinePresenter {
|
|
10
|
+
private readonly _sandboxService;
|
|
11
|
+
constructor(_sandboxService: ITerminalSandboxService);
|
|
12
|
+
present(options: ICommandLinePresenterOptions): Promise<ICommandLinePresenterResult | undefined>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import '../../../common/terminalSandboxService.js';
|
|
4
|
+
import { ITerminalSandboxService } from '@codingame/monaco-vscode-api/vscode/vs/platform/sandbox/common/terminalSandboxService.service';
|
|
5
|
+
|
|
6
|
+
let SandboxedCommandLinePresenter = class SandboxedCommandLinePresenter {
|
|
7
|
+
constructor(_sandboxService) {
|
|
8
|
+
this._sandboxService = _sandboxService;
|
|
9
|
+
}
|
|
10
|
+
async present(options) {
|
|
11
|
+
if (!(await this._sandboxService.isEnabled())) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
commandLine: options.commandLine.forDisplay,
|
|
16
|
+
processOtherPresenters: true
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
SandboxedCommandLinePresenter = ( __decorate([( __param(0, ITerminalSandboxService))], SandboxedCommandLinePresenter));
|
|
21
|
+
|
|
22
|
+
export { SandboxedCommandLinePresenter };
|
|
@@ -0,0 +1,22 @@
|
|
|
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 type { ICommandLineRewriter, ICommandLineRewriterOptions, ICommandLineRewriterResult } from "./commandLineRewriter.js";
|
|
4
|
+
/**
|
|
5
|
+
* Wraps background terminal commands so their processes survive VS Code shutdown.
|
|
6
|
+
*
|
|
7
|
+
* On POSIX (bash/zsh/fish), uses `nohup <command> &` to ignore SIGHUP and
|
|
8
|
+
* detach from the terminal's process group.
|
|
9
|
+
*
|
|
10
|
+
* On Windows (PowerShell), uses `Start-Process` to create a process outside
|
|
11
|
+
* the terminal's process tree.
|
|
12
|
+
*
|
|
13
|
+
* Gated behind the {@link TerminalChatAgentToolsSettingId.DetachBackgroundProcesses} setting
|
|
14
|
+
* (default off) to avoid orphaned processes in normal usage.
|
|
15
|
+
*/
|
|
16
|
+
export declare class CommandLineBackgroundDetachRewriter extends Disposable implements ICommandLineRewriter {
|
|
17
|
+
private readonly _configurationService;
|
|
18
|
+
constructor(_configurationService: IConfigurationService);
|
|
19
|
+
rewrite(options: ICommandLineRewriterOptions): ICommandLineRewriterResult | undefined;
|
|
20
|
+
private _rewriteForPosix;
|
|
21
|
+
private _rewriteForPowerShell;
|
|
22
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
4
|
+
import { OperatingSystem } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
|
|
5
|
+
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
6
|
+
import { TerminalChatAgentToolsSettingId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration';
|
|
7
|
+
import { isPowerShell } from '../../runInTerminalHelpers.js';
|
|
8
|
+
|
|
9
|
+
let CommandLineBackgroundDetachRewriter = class CommandLineBackgroundDetachRewriter extends Disposable {
|
|
10
|
+
constructor(_configurationService) {
|
|
11
|
+
super();
|
|
12
|
+
this._configurationService = _configurationService;
|
|
13
|
+
}
|
|
14
|
+
rewrite(options) {
|
|
15
|
+
if (!options.isBackground) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
if (!this._configurationService.getValue(TerminalChatAgentToolsSettingId.DetachBackgroundProcesses)) {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
if (options.os === OperatingSystem.Windows) {
|
|
22
|
+
return this._rewriteForPowerShell(options);
|
|
23
|
+
}
|
|
24
|
+
return this._rewriteForPosix(options);
|
|
25
|
+
}
|
|
26
|
+
_rewriteForPosix(options) {
|
|
27
|
+
return {
|
|
28
|
+
rewritten: `nohup ${options.commandLine} &`,
|
|
29
|
+
reasoning: "Wrapped background command with nohup to survive terminal shutdown",
|
|
30
|
+
forDisplay: options.commandLine
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
_rewriteForPowerShell(options) {
|
|
34
|
+
if (!isPowerShell(options.shell, options.os)) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
const escapedCommand = options.commandLine.replace(/"/g, "\\\"");
|
|
38
|
+
return {
|
|
39
|
+
rewritten: `Start-Process -WindowStyle Hidden -FilePath "${options.shell}" -ArgumentList "-NoProfile", "-Command", "${escapedCommand}"`,
|
|
40
|
+
reasoning: "Wrapped background command with Start-Process to survive terminal shutdown",
|
|
41
|
+
forDisplay: options.commandLine
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
CommandLineBackgroundDetachRewriter = ( __decorate([( __param(0, IConfigurationService))], CommandLineBackgroundDetachRewriter));
|
|
46
|
+
|
|
47
|
+
export { CommandLineBackgroundDetachRewriter };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
|
+
import type { ICommandLineRewriter, ICommandLineRewriterOptions, ICommandLineRewriterResult } from "./commandLineRewriter.js";
|
|
3
|
+
export declare class CommandLineCdPrefixRewriter extends Disposable implements ICommandLineRewriter {
|
|
4
|
+
rewrite(options: ICommandLineRewriterOptions): ICommandLineRewriterResult | undefined;
|
|
5
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
3
|
+
import { OperatingSystem } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
|
|
4
|
+
import { extractCdPrefix } from '../../runInTerminalHelpers.js';
|
|
5
|
+
|
|
6
|
+
class CommandLineCdPrefixRewriter extends Disposable {
|
|
7
|
+
rewrite(options) {
|
|
8
|
+
if (!options.cwd) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
const extracted = extractCdPrefix(options.commandLine, options.shell, options.os);
|
|
12
|
+
if (extracted) {
|
|
13
|
+
let cdDirPath = extracted.directory.replace(/(?:[\\\/])$/, '');
|
|
14
|
+
let cwdFsPath = options.cwd.fsPath.replace(/(?:[\\\/])$/, '');
|
|
15
|
+
if (options.os === OperatingSystem.Windows) {
|
|
16
|
+
cdDirPath = cdDirPath.toLowerCase();
|
|
17
|
+
cwdFsPath = cwdFsPath.toLowerCase();
|
|
18
|
+
}
|
|
19
|
+
if (cdDirPath === cwdFsPath) {
|
|
20
|
+
return { rewritten: extracted.command, reasoning: 'Removed redundant cd command' };
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { CommandLineCdPrefixRewriter };
|
|
@@ -0,0 +1,14 @@
|
|
|
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 type { ICommandLineRewriter, ICommandLineRewriterOptions, ICommandLineRewriterResult } from "./commandLineRewriter.js";
|
|
4
|
+
/**
|
|
5
|
+
* Rewriter that prepends a space to commands to prevent them from being added to shell history for
|
|
6
|
+
* certain shells. This depends on $VSCODE_PREVENT_SHELL_HISTORY being handled in shell integration
|
|
7
|
+
* scripts to set `HISTCONTROL=ignorespace` (bash) or `HIST_IGNORE_SPACE` (zsh) env vars. The
|
|
8
|
+
* prepended space is harmless so we don't try to remove it if shell integration isn't functional.
|
|
9
|
+
*/
|
|
10
|
+
export declare class CommandLinePreventHistoryRewriter extends Disposable implements ICommandLineRewriter {
|
|
11
|
+
private readonly _configurationService;
|
|
12
|
+
constructor(_configurationService: IConfigurationService);
|
|
13
|
+
rewrite(options: ICommandLineRewriterOptions): ICommandLineRewriterResult | undefined;
|
|
14
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
4
|
+
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
5
|
+
import { isBash, isZsh } from '../../runInTerminalHelpers.js';
|
|
6
|
+
import { TerminalChatAgentToolsSettingId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration';
|
|
7
|
+
|
|
8
|
+
let CommandLinePreventHistoryRewriter = class CommandLinePreventHistoryRewriter extends Disposable {
|
|
9
|
+
constructor(_configurationService) {
|
|
10
|
+
super();
|
|
11
|
+
this._configurationService = _configurationService;
|
|
12
|
+
}
|
|
13
|
+
rewrite(options) {
|
|
14
|
+
const preventShellHistory = this._configurationService.getValue(TerminalChatAgentToolsSettingId.PreventShellHistory) === true;
|
|
15
|
+
if (!preventShellHistory) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
if (isBash(options.shell, options.os) || isZsh(options.shell, options.os)) {
|
|
19
|
+
return {
|
|
20
|
+
rewritten: ` ${options.commandLine}`,
|
|
21
|
+
reasoning: "Prepended with a space to exclude from shell history"
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
CommandLinePreventHistoryRewriter = ( __decorate([( __param(0, IConfigurationService))], CommandLinePreventHistoryRewriter));
|
|
28
|
+
|
|
29
|
+
export { CommandLinePreventHistoryRewriter };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
|
+
import type { TreeSitterCommandParser } from "../../treeSitterCommandParser.js";
|
|
3
|
+
import type { ICommandLineRewriter, ICommandLineRewriterOptions, ICommandLineRewriterResult } from "./commandLineRewriter.js";
|
|
4
|
+
export declare class CommandLinePwshChainOperatorRewriter extends Disposable implements ICommandLineRewriter {
|
|
5
|
+
private readonly _treeSitterCommandParser;
|
|
6
|
+
constructor(_treeSitterCommandParser: TreeSitterCommandParser);
|
|
7
|
+
rewrite(options: ICommandLineRewriterOptions): Promise<ICommandLineRewriterResult | undefined>;
|
|
8
|
+
}
|