@codingame/monaco-vscode-katex-common 30.0.0 → 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,256 @@
|
|
|
1
|
+
|
|
2
|
+
import { Separator } from '@codingame/monaco-vscode-api/vscode/vs/base/common/actions';
|
|
3
|
+
import { coalesce } from '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
|
|
4
|
+
import { win32, posix } from '@codingame/monaco-vscode-api/vscode/vs/base/common/path';
|
|
5
|
+
import { OperatingSystem } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
|
|
6
|
+
import { escapeRegExpCharacters } from '@codingame/monaco-vscode-api/vscode/vs/base/common/strings';
|
|
7
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
8
|
+
import { isAutoApproveRule } from './tools/commandLineAnalyzer/commandLineAnalyzer.js';
|
|
9
|
+
|
|
10
|
+
function isPowerShell(envShell, os) {
|
|
11
|
+
if (os === OperatingSystem.Windows) {
|
|
12
|
+
return /^(?:powershell|pwsh)(?:-preview)?$/i.test(win32.basename(envShell).replace(/\.exe$/i, ""));
|
|
13
|
+
}
|
|
14
|
+
return /^(?:powershell|pwsh)(?:-preview)?$/.test(posix.basename(envShell));
|
|
15
|
+
}
|
|
16
|
+
function isWindowsPowerShell(envShell) {
|
|
17
|
+
return envShell.endsWith("System32\\WindowsPowerShell\\v1.0\\powershell.exe");
|
|
18
|
+
}
|
|
19
|
+
function isZsh(envShell, os) {
|
|
20
|
+
if (os === OperatingSystem.Windows) {
|
|
21
|
+
return /^zsh(?:\.exe)?$/i.test(win32.basename(envShell));
|
|
22
|
+
}
|
|
23
|
+
return /^zsh$/.test(posix.basename(envShell));
|
|
24
|
+
}
|
|
25
|
+
function isBash(envShell, os) {
|
|
26
|
+
if (os === OperatingSystem.Windows) {
|
|
27
|
+
return /^bash(?:\.exe)?$/i.test(win32.basename(envShell));
|
|
28
|
+
}
|
|
29
|
+
return /^bash$/.test(posix.basename(envShell));
|
|
30
|
+
}
|
|
31
|
+
function isFish(envShell, os) {
|
|
32
|
+
if (os === OperatingSystem.Windows) {
|
|
33
|
+
return /^fish(?:\.exe)?$/i.test(win32.basename(envShell));
|
|
34
|
+
}
|
|
35
|
+
return /^fish$/.test(posix.basename(envShell));
|
|
36
|
+
}
|
|
37
|
+
const TRUNCATION_MESSAGE = "\n\n[... PREVIOUS OUTPUT TRUNCATED ...]\n\n";
|
|
38
|
+
function truncateOutputKeepingTail(output, maxLength) {
|
|
39
|
+
if (output.length <= maxLength) {
|
|
40
|
+
return output;
|
|
41
|
+
}
|
|
42
|
+
const truncationMessageLength = TRUNCATION_MESSAGE.length;
|
|
43
|
+
if (truncationMessageLength >= maxLength) {
|
|
44
|
+
return TRUNCATION_MESSAGE.slice(TRUNCATION_MESSAGE.length - maxLength);
|
|
45
|
+
}
|
|
46
|
+
const availableLength = maxLength - truncationMessageLength;
|
|
47
|
+
const endPortion = output.slice(-availableLength);
|
|
48
|
+
return TRUNCATION_MESSAGE + endPortion;
|
|
49
|
+
}
|
|
50
|
+
function normalizeTerminalCommandForDisplay(commandLine) {
|
|
51
|
+
return commandLine.replace(/\\(["'\/])/g, "$1");
|
|
52
|
+
}
|
|
53
|
+
function buildCommandDisplayText(command) {
|
|
54
|
+
const normalized = normalizeTerminalCommandForDisplay(command).replace(/\r\n|\r|\n/g, " ");
|
|
55
|
+
return normalized.length > 80 ? normalized.substring(0, 77) + "..." : normalized;
|
|
56
|
+
}
|
|
57
|
+
function normalizeCommandForExecution(command) {
|
|
58
|
+
return command.replace(/\r\n|\r|\n/g, " ").trim();
|
|
59
|
+
}
|
|
60
|
+
function generateAutoApproveActions(commandLine, subCommands, autoApproveResult) {
|
|
61
|
+
const actions = [];
|
|
62
|
+
const canCreateAutoApproval = (autoApproveResult.subCommandResults.every(e => e.result !== "denied") && autoApproveResult.commandLineResult.result !== "denied");
|
|
63
|
+
if (canCreateAutoApproval) {
|
|
64
|
+
const unapprovedSubCommands = subCommands.filter((_, index) => {
|
|
65
|
+
return autoApproveResult.subCommandResults[index].result !== "approved";
|
|
66
|
+
});
|
|
67
|
+
const neverAutoApproveCommands = ( new Set([
|
|
68
|
+
"bash", "sh", "zsh", "fish", "ksh", "csh", "tcsh", "dash", "pwsh", "powershell", "powershell.exe", "cmd", "cmd.exe",
|
|
69
|
+
"python", "python3", "node", "ruby", "perl", "php", "lua",
|
|
70
|
+
"eval", "exec", "source", "sudo", "su", "doas",
|
|
71
|
+
"curl", "wget", "invoke-restmethod", "invoke-webrequest", "irm", "iwr"]));
|
|
72
|
+
const commandsWithSubcommands = ( new Set([
|
|
73
|
+
"git",
|
|
74
|
+
"npm",
|
|
75
|
+
"npx",
|
|
76
|
+
"yarn",
|
|
77
|
+
"docker",
|
|
78
|
+
"kubectl",
|
|
79
|
+
"cargo",
|
|
80
|
+
"dotnet",
|
|
81
|
+
"mvn",
|
|
82
|
+
"gradle"
|
|
83
|
+
]));
|
|
84
|
+
const commandsWithSubSubCommands = ( new Set(["npm run", "yarn run"]));
|
|
85
|
+
const findNextNonFlagArg = (parts, startIndex) => {
|
|
86
|
+
for (let i = startIndex; i < parts.length; i++) {
|
|
87
|
+
if (!parts[i].startsWith("-")) {
|
|
88
|
+
return i;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return undefined;
|
|
92
|
+
};
|
|
93
|
+
const subCommandsToSuggest = Array.from(( new Set(coalesce(( unapprovedSubCommands.map(command => {
|
|
94
|
+
const parts = command.trim().split(/\s+/);
|
|
95
|
+
const baseCommand = parts[0].toLowerCase();
|
|
96
|
+
if (( neverAutoApproveCommands.has(baseCommand))) {
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
if (( commandsWithSubcommands.has(baseCommand))) {
|
|
100
|
+
const subCommandIndex = findNextNonFlagArg(parts, 1);
|
|
101
|
+
if (subCommandIndex !== undefined) {
|
|
102
|
+
const baseSubCommand = `${parts[0]} ${parts[subCommandIndex]}`.toLowerCase();
|
|
103
|
+
if (( commandsWithSubSubCommands.has(baseSubCommand))) {
|
|
104
|
+
const subSubCommandIndex = findNextNonFlagArg(parts, subCommandIndex + 1);
|
|
105
|
+
if (subSubCommandIndex !== undefined) {
|
|
106
|
+
return parts.slice(0, subSubCommandIndex + 1).join(" ");
|
|
107
|
+
}
|
|
108
|
+
return undefined;
|
|
109
|
+
} else {
|
|
110
|
+
return parts.slice(0, subCommandIndex + 1).join(" ");
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return undefined;
|
|
114
|
+
} else {
|
|
115
|
+
return parts[0];
|
|
116
|
+
}
|
|
117
|
+
}))))));
|
|
118
|
+
if (subCommandsToSuggest.length > 0) {
|
|
119
|
+
let subCommandLabel;
|
|
120
|
+
if (subCommandsToSuggest.length === 1) {
|
|
121
|
+
subCommandLabel = `\`${subCommandsToSuggest[0]} \u2026\``;
|
|
122
|
+
} else {
|
|
123
|
+
subCommandLabel = `Commands ${( subCommandsToSuggest.map(e => `\`${e} \u2026\``)).join(", ")}`;
|
|
124
|
+
}
|
|
125
|
+
actions.push({
|
|
126
|
+
label: `Allow ${subCommandLabel} in this Session`,
|
|
127
|
+
data: {
|
|
128
|
+
type: "newRule",
|
|
129
|
+
rule: ( subCommandsToSuggest.map(key => ({
|
|
130
|
+
key,
|
|
131
|
+
value: true,
|
|
132
|
+
scope: "session"
|
|
133
|
+
})))
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
actions.push({
|
|
137
|
+
label: `Allow ${subCommandLabel} in this Workspace`,
|
|
138
|
+
data: {
|
|
139
|
+
type: "newRule",
|
|
140
|
+
rule: ( subCommandsToSuggest.map(key => ({
|
|
141
|
+
key,
|
|
142
|
+
value: true,
|
|
143
|
+
scope: "workspace"
|
|
144
|
+
})))
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
actions.push({
|
|
148
|
+
label: `Always Allow ${subCommandLabel}`,
|
|
149
|
+
data: {
|
|
150
|
+
type: "newRule",
|
|
151
|
+
rule: ( subCommandsToSuggest.map(key => ({
|
|
152
|
+
key,
|
|
153
|
+
value: true,
|
|
154
|
+
scope: "user"
|
|
155
|
+
})))
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
if (actions.length > 0) {
|
|
160
|
+
actions.push(( new Separator()));
|
|
161
|
+
}
|
|
162
|
+
const firstSubcommandFirstWord = unapprovedSubCommands.length > 0 ? unapprovedSubCommands[0].split(" ")[0] : "";
|
|
163
|
+
if (firstSubcommandFirstWord !== commandLine && !( commandsWithSubcommands.has(commandLine)) && !( commandsWithSubSubCommands.has(commandLine))) {
|
|
164
|
+
actions.push({
|
|
165
|
+
label: ( localize(13997, "Allow Exact Command Line in this Session")),
|
|
166
|
+
data: {
|
|
167
|
+
type: "newRule",
|
|
168
|
+
rule: {
|
|
169
|
+
key: `/^${escapeRegExpCharacters(commandLine)}$/`,
|
|
170
|
+
value: {
|
|
171
|
+
approve: true,
|
|
172
|
+
matchCommandLine: true
|
|
173
|
+
},
|
|
174
|
+
scope: "session"
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
actions.push({
|
|
179
|
+
label: ( localize(13998, "Allow Exact Command Line in this Workspace")),
|
|
180
|
+
data: {
|
|
181
|
+
type: "newRule",
|
|
182
|
+
rule: {
|
|
183
|
+
key: `/^${escapeRegExpCharacters(commandLine)}$/`,
|
|
184
|
+
value: {
|
|
185
|
+
approve: true,
|
|
186
|
+
matchCommandLine: true
|
|
187
|
+
},
|
|
188
|
+
scope: "workspace"
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
actions.push({
|
|
193
|
+
label: ( localize(13999, "Always Allow Exact Command Line")),
|
|
194
|
+
data: {
|
|
195
|
+
type: "newRule",
|
|
196
|
+
rule: {
|
|
197
|
+
key: `/^${escapeRegExpCharacters(commandLine)}$/`,
|
|
198
|
+
value: {
|
|
199
|
+
approve: true,
|
|
200
|
+
matchCommandLine: true
|
|
201
|
+
},
|
|
202
|
+
scope: "user"
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
if (actions.length > 0) {
|
|
209
|
+
actions.push(( new Separator()));
|
|
210
|
+
}
|
|
211
|
+
actions.push({
|
|
212
|
+
label: ( localize(14000, "Allow All Commands in this Session")),
|
|
213
|
+
tooltip: ( localize(14001, "Allow this tool to run in this session without confirmation.")),
|
|
214
|
+
data: {
|
|
215
|
+
type: "sessionApproval"
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
actions.push(( new Separator()));
|
|
219
|
+
actions.push({
|
|
220
|
+
label: ( localize(14002, "Configure Auto Approve...")),
|
|
221
|
+
data: {
|
|
222
|
+
type: "configure"
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
return actions;
|
|
226
|
+
}
|
|
227
|
+
function dedupeRules(rules) {
|
|
228
|
+
return rules.filter((result, index, array) => {
|
|
229
|
+
if (!isAutoApproveRule(result.rule)) {
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
const sourceText = result.rule.sourceText;
|
|
233
|
+
return array.findIndex(r => isAutoApproveRule(r.rule) && r.rule.sourceText === sourceText) === index;
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
function extractCdPrefix(commandLine, shell, os) {
|
|
237
|
+
const isPwsh = isPowerShell(shell, os);
|
|
238
|
+
const cdPrefixMatch = commandLine.match(
|
|
239
|
+
isPwsh ? /^(?:cd(?: \/d)?|Set-Location(?: -Path)?) (?<dir>[^\s]+) ?(?:&&|;)\s+(?<suffix>.+)$/i : /^cd (?<dir>[^\s]+) &&\s+(?<suffix>.+)$/
|
|
240
|
+
);
|
|
241
|
+
const cdDir = cdPrefixMatch?.groups?.dir;
|
|
242
|
+
const cdSuffix = cdPrefixMatch?.groups?.suffix;
|
|
243
|
+
if (cdDir && cdSuffix) {
|
|
244
|
+
let cdDirPath = cdDir;
|
|
245
|
+
if (cdDirPath.startsWith("\"") && cdDirPath.endsWith("\"")) {
|
|
246
|
+
cdDirPath = cdDirPath.slice(1, -1);
|
|
247
|
+
}
|
|
248
|
+
return {
|
|
249
|
+
directory: cdDirPath,
|
|
250
|
+
command: cdSuffix
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
return undefined;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export { TRUNCATION_MESSAGE, buildCommandDisplayText, dedupeRules, extractCdPrefix, generateAutoApproveActions, isBash, isFish, isPowerShell, isWindowsPowerShell, isZsh, normalizeCommandForExecution, normalizeTerminalCommandForDisplay, truncateOutputKeepingTail };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ITelemetryService } from "@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service";
|
|
2
|
+
import type { ITerminalInstance } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal";
|
|
3
|
+
import { ShellIntegrationQuality } from "./toolTerminalCreator.js";
|
|
4
|
+
export declare class RunInTerminalToolTelemetry {
|
|
5
|
+
private readonly _telemetryService;
|
|
6
|
+
constructor(_telemetryService: ITelemetryService);
|
|
7
|
+
logPrepare(state: {
|
|
8
|
+
terminalToolSessionId: string | undefined;
|
|
9
|
+
subCommands: string[];
|
|
10
|
+
autoApproveAllowed: "allowed" | "needsOptIn" | "off";
|
|
11
|
+
autoApproveResult: "approved" | "denied" | "manual";
|
|
12
|
+
autoApproveReason: "subCommand" | "commandLine" | undefined;
|
|
13
|
+
autoApproveDefault: boolean | undefined;
|
|
14
|
+
}): void;
|
|
15
|
+
logInvoke(instance: ITerminalInstance, state: {
|
|
16
|
+
terminalToolSessionId: string | undefined;
|
|
17
|
+
didUserEditCommand: boolean;
|
|
18
|
+
didToolEditCommand: boolean;
|
|
19
|
+
error: string | undefined;
|
|
20
|
+
isBackground: boolean;
|
|
21
|
+
isNewSession: boolean;
|
|
22
|
+
isSandboxWrapped: boolean;
|
|
23
|
+
requestUnsandboxedExecutionReason: string | undefined;
|
|
24
|
+
shellIntegrationQuality: ShellIntegrationQuality;
|
|
25
|
+
outputLineCount: number;
|
|
26
|
+
timingConnectMs: number;
|
|
27
|
+
timingExecuteMs: number;
|
|
28
|
+
pollDurationMs: number | undefined;
|
|
29
|
+
terminalExecutionIdleBeforeTimeout: boolean | undefined;
|
|
30
|
+
exitCode: number | undefined;
|
|
31
|
+
inputUserChars: number;
|
|
32
|
+
inputUserSigint: boolean;
|
|
33
|
+
inputToolManualAcceptCount: number | undefined;
|
|
34
|
+
inputToolManualRejectCount: number | undefined;
|
|
35
|
+
inputToolManualChars: number | undefined;
|
|
36
|
+
inputToolAutoAcceptCount: number | undefined;
|
|
37
|
+
inputToolAutoChars: number | undefined;
|
|
38
|
+
inputToolManualShownCount: number | undefined;
|
|
39
|
+
inputToolFreeFormInputShownCount: number | undefined;
|
|
40
|
+
inputToolFreeFormInputCount: number | undefined;
|
|
41
|
+
}): void;
|
|
42
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
4
|
+
import { TelemetryTrustedValue } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetryUtils';
|
|
5
|
+
import { ShellIntegrationQuality } from './toolTerminalCreator.js';
|
|
6
|
+
|
|
7
|
+
let RunInTerminalToolTelemetry = class RunInTerminalToolTelemetry {
|
|
8
|
+
constructor(_telemetryService) {
|
|
9
|
+
this._telemetryService = _telemetryService;
|
|
10
|
+
}
|
|
11
|
+
logPrepare(state) {
|
|
12
|
+
const subCommandsSanitized = ( state.subCommands.map(e => {
|
|
13
|
+
const commandName = e.split(" ")[0];
|
|
14
|
+
let sanitizedCommandName = commandName.toLowerCase();
|
|
15
|
+
if (!( commandAllowList.has(sanitizedCommandName))) {
|
|
16
|
+
if (/^(?:[A-Z][a-z0-9]+)+(?:-(?:[A-Z][a-z0-9]+))*$/.test(commandName)) {
|
|
17
|
+
sanitizedCommandName = "(unknown:pwsh)";
|
|
18
|
+
} else if (/^[a-z0-9_\-\.\\\/:;]+$/i.test(commandName)) {
|
|
19
|
+
const properties = [];
|
|
20
|
+
if (/[a-z]/.test(commandName)) {
|
|
21
|
+
properties.push("ascii_lower");
|
|
22
|
+
}
|
|
23
|
+
if (/[A-Z]/.test(commandName)) {
|
|
24
|
+
properties.push("ascii_upper");
|
|
25
|
+
}
|
|
26
|
+
if (/[0-9]/.test(commandName)) {
|
|
27
|
+
properties.push("numeric");
|
|
28
|
+
}
|
|
29
|
+
const chars = [];
|
|
30
|
+
for (const c of [".", "-", "_", "/", "\\", ":", ";"]) {
|
|
31
|
+
if (commandName.includes(c)) {
|
|
32
|
+
chars.push(c);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
sanitizedCommandName = `(unknown:${properties.join(",")}:${chars.join("")})`;
|
|
36
|
+
} else if (/[^\x00-\x7F]/.test(commandName)) {
|
|
37
|
+
sanitizedCommandName = "(unknown:unicode)";
|
|
38
|
+
} else {
|
|
39
|
+
sanitizedCommandName = "(unknown)";
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return sanitizedCommandName;
|
|
43
|
+
}));
|
|
44
|
+
this._telemetryService.publicLog2("toolUse.runInTerminal.prepare", {
|
|
45
|
+
terminalToolSessionId: state.terminalToolSessionId,
|
|
46
|
+
subCommands: ( new TelemetryTrustedValue(JSON.stringify(subCommandsSanitized))),
|
|
47
|
+
autoApproveAllowed: state.autoApproveAllowed,
|
|
48
|
+
autoApproveResult: state.autoApproveResult,
|
|
49
|
+
autoApproveReason: state.autoApproveReason,
|
|
50
|
+
autoApproveDefault: state.autoApproveDefault
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
logInvoke(instance, state) {
|
|
54
|
+
this._telemetryService.publicLog2("toolUse.runInTerminal", {
|
|
55
|
+
terminalSessionId: instance.sessionId,
|
|
56
|
+
terminalToolSessionId: state.terminalToolSessionId,
|
|
57
|
+
result: state.error ?? "success",
|
|
58
|
+
strategy: state.shellIntegrationQuality === ShellIntegrationQuality.Rich ? 2 : state.shellIntegrationQuality === ShellIntegrationQuality.Basic ? 1 : 0,
|
|
59
|
+
userEditedCommand: state.didUserEditCommand ? 1 : 0,
|
|
60
|
+
toolEditedCommand: state.didToolEditCommand ? 1 : 0,
|
|
61
|
+
isBackground: state.isBackground ? 1 : 0,
|
|
62
|
+
isNewSession: state.isNewSession ? 1 : 0,
|
|
63
|
+
isSandbox: state.isSandboxWrapped ? 1 : 0,
|
|
64
|
+
requestUnsandboxedExecutionReason: state.requestUnsandboxedExecutionReason,
|
|
65
|
+
outputLineCount: state.outputLineCount,
|
|
66
|
+
nonZeroExitCode: state.exitCode === undefined ? -1 : state.exitCode === 0 ? 0 : 1,
|
|
67
|
+
exitCodeValue: state.exitCode ?? -1,
|
|
68
|
+
timingConnectMs: state.timingConnectMs,
|
|
69
|
+
timingExecuteMs: state.timingExecuteMs,
|
|
70
|
+
pollDurationMs: state.pollDurationMs ?? 0,
|
|
71
|
+
terminalExecutionIdleBeforeTimeout: state.terminalExecutionIdleBeforeTimeout ?? false,
|
|
72
|
+
inputUserChars: state.inputUserChars,
|
|
73
|
+
inputUserSigint: state.inputUserSigint,
|
|
74
|
+
inputToolManualAcceptCount: state.inputToolManualAcceptCount ?? 0,
|
|
75
|
+
inputToolManualRejectCount: state.inputToolManualRejectCount ?? 0,
|
|
76
|
+
inputToolManualChars: state.inputToolManualChars ?? 0,
|
|
77
|
+
inputToolManualShownCount: state.inputToolManualShownCount ?? 0,
|
|
78
|
+
inputToolFreeFormInputShownCount: state.inputToolFreeFormInputShownCount ?? 0,
|
|
79
|
+
inputToolFreeFormInputCount: state.inputToolFreeFormInputCount ?? 0
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
RunInTerminalToolTelemetry = ( __decorate([( __param(0, ITelemetryService))], RunInTerminalToolTelemetry));
|
|
84
|
+
const commandAllowList = ( new Set([
|
|
85
|
+
"!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "~", "{", "}", "<", ">",
|
|
86
|
+
".", "7z", "alias", "assoc", "attrib", "awk", "basename", "bg", "blkid", "bunzip2", "bzip2", "cat", "cd", "certutil", "chkdsk", "chmod", "chown", "cipher", "clear", "cls", "cmp", "column", "comm", "compact", "compress", "copy", "cp", "curl", "cut", "date", "dd", "del", "df", "diff", "dig", "dir", "dirname", "diskpart", "dism", "disown", "du", "echo", "env", "erase", "eval", "expand", "export", "fc", "fdisk", "fg", "file", "find", "findstr", "fmt", "fold", "forfiles", "format", "free", "fsck", "git", "gpupdate", "grep", "groupadd", "groups", "gunzip", "gzip", "hash", "head", "hexdump", "history", "host", "htop", "icacls", "id", "ifconfig", "iostat", "ip", "ipconfig", "iptables", "jobs", "jq", "kill", "killall", "less", "ln", "locate", "ls", "lsblk", "lscpu", "lsof", "man", "mkdir", "mklink", "more", "mount", "move", "mv", "nbtstat", "nc/netcat", "net", "netstat", "nice", "nl", "nohup", "nslookup", "nslookup", "od", "passwd", "paste", "pathping", "pause", "pgrep", "ping", "pkill", "powercfg", "pr", "printenv", "ps", "pwd", "query", "rar", "readlink", "realpath", "reg", "rem", "ren", "rename", "renice", "rev", "rm", "rmdir", "robocopy", "route", "rsync", "sc", "schtasks", "scp", "sed", "seq", "set", "setx", "sfc", "shred", "shuf", "shutdown", "sleep", "sort", "source", "split", "ss", "ssh", "stat", "strings", "su", "subst", "sudo", "systeminfo", "tac", "tail", "tar", "tee", "telnet", "test", "time", "top", "touch", "tr", "traceroute", "tracert", "tree", "true", "truncate", "type", "type", "umask", "umount", "unalias", "uname", "uncompress", "unexpand", "uniq", "unlink", "unrar", "unzip", "uptime", "useradd", "usermod", "vmstat", "vol", "watch", "wc", "wget", "where", "whereis", "which", "who", "whoami", "wmic", "xargs", "xcopy", "xxd", "xz", "yes", "zcat", "zip", "zless", "zmore",
|
|
87
|
+
"bitbucket", "bzr", "cvs", "gh", "git", "glab", "hg", "svn", "fossil", "p4",
|
|
88
|
+
"adb", "ansible", "apk", "apt-get", "apt", "aws", "az", "brew", "bundle", "cargo", "choco", "clang", "cmake", "composer", "conan", "conda", "dnf", "docker-compose", "docker", "dotnet", "emacs", "esbuild", "eslint", "flatpak", "flutter", "fnm", "g++", "gcc", "gcloud", "go", "gradle", "helm", "java", "javac", "jest", "julia", "kotlin", "kubectl", "lua", "make", "mocha", "mvn", "n", "nano", "node", "npm", "nvm", "pacman", "perl", "php", "phpunit", "pip", "pipenv", "pnpm", "pod", "podman", "poetry", "python", "r", "rollup", "ruby", "rustc", "rustup", "snap", "swift", "terraform", "tsc", "tslint", "vagrant", "vcpkg", "vi", "vim", "vite", "vitest", "webpack", "yarn", "yum", "zypper",
|
|
89
|
+
"aider", "amp", "claude", "codex", "copilot", "gemini", "toad", "q",
|
|
90
|
+
"taskkill", "taskkill.exe",
|
|
91
|
+
"add-content", "compare-object", "convertfrom-json", "convertto-json", "copy-item", "format-custom", "format-list", "format-table", "format-wide", "get-childitem", "get-command", "get-content", "get-date", "get-help", "get-location", "get-process", "get-random", "get-service", "invoke-expression", "invoke-restmethod", "invoke-webrequest", "join-path", "measure-command", "measure-object", "move-item", "new-item", "out-file", "remove-item", "restart-computer", "select-object", "select-string", "select-xml", "set-acl", "set-content", "set-itemproperty", "sort-object", "split-path", "start-process", "start-sleep", "stop-process", "test-path", "write-host", "write-output",
|
|
92
|
+
"iex", "irm", "iwr", "rd", "ri", "sp", "spps"]));
|
|
93
|
+
|
|
94
|
+
export { RunInTerminalToolTelemetry };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
|
|
2
|
+
import { OperatingSystem } from "@codingame/monaco-vscode-api/vscode/vs/base/common/platform";
|
|
3
|
+
import { IAccessibilityService } from "@codingame/monaco-vscode-api/vscode/vs/platform/accessibility/common/accessibility.service";
|
|
4
|
+
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
5
|
+
import { ITerminalProfile } from "@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminal";
|
|
6
|
+
import { ITerminalLogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminal.service";
|
|
7
|
+
import { type ITerminalInstance } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal";
|
|
8
|
+
import { ITerminalService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal.service";
|
|
9
|
+
export declare enum ShellIntegrationQuality {
|
|
10
|
+
None = "none",
|
|
11
|
+
Basic = "basic",
|
|
12
|
+
Rich = "rich"
|
|
13
|
+
}
|
|
14
|
+
export interface IToolTerminal {
|
|
15
|
+
instance: ITerminalInstance;
|
|
16
|
+
shellIntegrationQuality: ShellIntegrationQuality;
|
|
17
|
+
receivedUserInput?: boolean;
|
|
18
|
+
isBackground?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare class ToolTerminalCreator {
|
|
21
|
+
private readonly _accessibilityService;
|
|
22
|
+
private readonly _configurationService;
|
|
23
|
+
private readonly _logService;
|
|
24
|
+
private readonly _terminalService;
|
|
25
|
+
/**
|
|
26
|
+
* The shell preference cached for the lifetime of the window. This allows skipping previous
|
|
27
|
+
* shell approaches that failed in previous runs to save time.
|
|
28
|
+
*/
|
|
29
|
+
private static _lastSuccessfulShell;
|
|
30
|
+
constructor(_accessibilityService: IAccessibilityService, _configurationService: IConfigurationService, _logService: ITerminalLogService, _terminalService: ITerminalService);
|
|
31
|
+
createTerminal(shellOrProfile: string | ITerminalProfile, os: OperatingSystem, token: CancellationToken): Promise<IToolTerminal>;
|
|
32
|
+
/**
|
|
33
|
+
* Synchronously update shell integration quality based on the terminal instance's current
|
|
34
|
+
* capabilities. This is a defensive change to avoid no shell integration being sticky
|
|
35
|
+
* https://github.com/microsoft/vscode/issues/260880
|
|
36
|
+
*
|
|
37
|
+
* Only upgrade quality just in case.
|
|
38
|
+
*/
|
|
39
|
+
refreshShellIntegrationQuality(toolTerminal: IToolTerminal): void;
|
|
40
|
+
private _createCopilotTerminal;
|
|
41
|
+
private _waitForShellIntegration;
|
|
42
|
+
}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { raceTimeout, DeferredPromise, disposableTimeout } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
4
|
+
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
5
|
+
import { CancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
6
|
+
import { Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
7
|
+
import { DisposableStore, MutableDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
8
|
+
import { ThemeIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/themables';
|
|
9
|
+
import { isNumber, isObject, hasKey, isString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
10
|
+
import { IAccessibilityService } from '@codingame/monaco-vscode-api/vscode/vs/platform/accessibility/common/accessibility.service';
|
|
11
|
+
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
12
|
+
import { TerminalCapability } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/capabilities/capabilities';
|
|
13
|
+
import { PromptInputState } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/capabilities/commandDetection/promptInputModel';
|
|
14
|
+
import { TerminalSettingId } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminal';
|
|
15
|
+
import { ITerminalLogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminal.service';
|
|
16
|
+
import { ITerminalService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal.service';
|
|
17
|
+
import { getShellIntegrationTimeout } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/terminalEnvironment';
|
|
18
|
+
import { TerminalChatAgentToolsSettingId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration';
|
|
19
|
+
import { isBash, isZsh, isFish, isPowerShell } from './runInTerminalHelpers.js';
|
|
20
|
+
|
|
21
|
+
var ToolTerminalCreator_1;
|
|
22
|
+
var ShellLaunchType;
|
|
23
|
+
(function(ShellLaunchType) {
|
|
24
|
+
ShellLaunchType[ShellLaunchType["Unknown"] = 0] = "Unknown";
|
|
25
|
+
ShellLaunchType[ShellLaunchType["Default"] = 1] = "Default";
|
|
26
|
+
ShellLaunchType[ShellLaunchType["Fallback"] = 2] = "Fallback";
|
|
27
|
+
})(ShellLaunchType || (ShellLaunchType = {}));
|
|
28
|
+
var ShellIntegrationQuality;
|
|
29
|
+
(function(ShellIntegrationQuality) {
|
|
30
|
+
ShellIntegrationQuality["None"] = "none";
|
|
31
|
+
ShellIntegrationQuality["Basic"] = "basic";
|
|
32
|
+
ShellIntegrationQuality["Rich"] = "rich";
|
|
33
|
+
})(ShellIntegrationQuality || (ShellIntegrationQuality = {}));
|
|
34
|
+
let ToolTerminalCreator = class ToolTerminalCreator {
|
|
35
|
+
static {
|
|
36
|
+
ToolTerminalCreator_1 = this;
|
|
37
|
+
}
|
|
38
|
+
static {
|
|
39
|
+
this._lastSuccessfulShell = ShellLaunchType.Unknown;
|
|
40
|
+
}
|
|
41
|
+
constructor(
|
|
42
|
+
_accessibilityService,
|
|
43
|
+
_configurationService,
|
|
44
|
+
_logService,
|
|
45
|
+
_terminalService
|
|
46
|
+
) {
|
|
47
|
+
this._accessibilityService = _accessibilityService;
|
|
48
|
+
this._configurationService = _configurationService;
|
|
49
|
+
this._logService = _logService;
|
|
50
|
+
this._terminalService = _terminalService;
|
|
51
|
+
}
|
|
52
|
+
async createTerminal(shellOrProfile, os, token) {
|
|
53
|
+
const instance = await this._createCopilotTerminal(shellOrProfile, os);
|
|
54
|
+
const toolTerminal = {
|
|
55
|
+
instance,
|
|
56
|
+
shellIntegrationQuality: ShellIntegrationQuality.None
|
|
57
|
+
};
|
|
58
|
+
let processReadyTimestamp = 0;
|
|
59
|
+
const initResult = await Promise.any([
|
|
60
|
+
instance.processReady.then(() => processReadyTimestamp = Date.now()),
|
|
61
|
+
Event.toPromise(instance.onExit)
|
|
62
|
+
]);
|
|
63
|
+
if (!isNumber(initResult) && isObject(initResult) && hasKey(initResult, {
|
|
64
|
+
message: true
|
|
65
|
+
})) {
|
|
66
|
+
throw ( new Error(initResult.message));
|
|
67
|
+
}
|
|
68
|
+
const siInjectionEnabled = this._configurationService.getValue(TerminalSettingId.ShellIntegrationEnabled) === true;
|
|
69
|
+
const waitTime = getShellIntegrationTimeout(
|
|
70
|
+
this._configurationService,
|
|
71
|
+
siInjectionEnabled,
|
|
72
|
+
instance.hasRemoteAuthority,
|
|
73
|
+
processReadyTimestamp
|
|
74
|
+
);
|
|
75
|
+
if (ToolTerminalCreator_1._lastSuccessfulShell !== ShellLaunchType.Fallback || siInjectionEnabled) {
|
|
76
|
+
this._logService.info(
|
|
77
|
+
`ToolTerminalCreator#createTerminal: Waiting ${waitTime}ms for shell integration`
|
|
78
|
+
);
|
|
79
|
+
const shellIntegrationQuality = await this._waitForShellIntegration(instance, waitTime);
|
|
80
|
+
if (token.isCancellationRequested) {
|
|
81
|
+
instance.dispose();
|
|
82
|
+
throw ( new CancellationError());
|
|
83
|
+
}
|
|
84
|
+
if (shellIntegrationQuality === ShellIntegrationQuality.Rich) {
|
|
85
|
+
const commandDetection = instance.capabilities.get(TerminalCapability.CommandDetection);
|
|
86
|
+
if (commandDetection?.promptInputModel.state === PromptInputState.Unknown) {
|
|
87
|
+
this._logService.info(
|
|
88
|
+
`ToolTerminalCreator#createTerminal: Waiting up to 2s for PromptInputModel state to change`
|
|
89
|
+
);
|
|
90
|
+
const didStart = await raceTimeout(Event.toPromise(commandDetection.onCommandStarted), 2000);
|
|
91
|
+
if (!didStart) {
|
|
92
|
+
this._logService.info(
|
|
93
|
+
`ToolTerminalCreator#createTerminal: PromptInputModel state did not change within timeout`
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (shellIntegrationQuality !== ShellIntegrationQuality.None) {
|
|
99
|
+
ToolTerminalCreator_1._lastSuccessfulShell = ShellLaunchType.Default;
|
|
100
|
+
toolTerminal.shellIntegrationQuality = shellIntegrationQuality;
|
|
101
|
+
return toolTerminal;
|
|
102
|
+
}
|
|
103
|
+
} else {
|
|
104
|
+
this._logService.info(
|
|
105
|
+
`ToolTerminalCreator#createTerminal: Skipping wait for shell integration - last successful launch type ${ToolTerminalCreator_1._lastSuccessfulShell}`
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
ToolTerminalCreator_1._lastSuccessfulShell = ShellLaunchType.Fallback;
|
|
109
|
+
return toolTerminal;
|
|
110
|
+
}
|
|
111
|
+
refreshShellIntegrationQuality(toolTerminal) {
|
|
112
|
+
const commandDetection = toolTerminal.instance.capabilities.get(TerminalCapability.CommandDetection);
|
|
113
|
+
if (commandDetection) {
|
|
114
|
+
if (toolTerminal.shellIntegrationQuality === ShellIntegrationQuality.None || toolTerminal.shellIntegrationQuality === ShellIntegrationQuality.Basic) {
|
|
115
|
+
toolTerminal.shellIntegrationQuality = commandDetection.hasRichCommandDetection ? ShellIntegrationQuality.Rich : ShellIntegrationQuality.Basic;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
_createCopilotTerminal(shellOrProfile, os) {
|
|
120
|
+
const shellPath = isString(shellOrProfile) ? shellOrProfile : shellOrProfile.path;
|
|
121
|
+
const env = {
|
|
122
|
+
GIT_PAGER: "cat",
|
|
123
|
+
GIT_MERGE_AUTOEDIT: "no",
|
|
124
|
+
GIT_EDITOR: ":"
|
|
125
|
+
};
|
|
126
|
+
const preventShellHistory = this._configurationService.getValue(TerminalChatAgentToolsSettingId.PreventShellHistory) === true;
|
|
127
|
+
if (preventShellHistory) {
|
|
128
|
+
if (isBash(shellPath, os) || isZsh(shellPath, os) || isFish(shellPath, os) || isPowerShell(shellPath, os)) {
|
|
129
|
+
env["VSCODE_PREVENT_SHELL_HISTORY"] = "1";
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
const config = {
|
|
133
|
+
icon: ThemeIcon.fromId(Codicon.chatSparkle.id),
|
|
134
|
+
hideFromUser: true,
|
|
135
|
+
forcePersist: true,
|
|
136
|
+
env
|
|
137
|
+
};
|
|
138
|
+
if (isString(shellOrProfile)) {
|
|
139
|
+
config.executable = shellOrProfile;
|
|
140
|
+
} else {
|
|
141
|
+
config.executable = shellOrProfile.path;
|
|
142
|
+
config.args = shellOrProfile.args;
|
|
143
|
+
config.icon = shellOrProfile.icon ?? config.icon;
|
|
144
|
+
config.color = shellOrProfile.color;
|
|
145
|
+
config.env = {
|
|
146
|
+
...config.env,
|
|
147
|
+
...shellOrProfile.env
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
return this._terminalService.createTerminal({
|
|
151
|
+
config
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
_waitForShellIntegration(instance, timeoutMs) {
|
|
155
|
+
const store = ( new DisposableStore());
|
|
156
|
+
const result = ( new DeferredPromise());
|
|
157
|
+
const isScreenReaderOptimized = this._accessibilityService.isScreenReaderOptimized();
|
|
158
|
+
const effectiveTimeoutMs = timeoutMs > 0 && isScreenReaderOptimized ? timeoutMs + 3000 : timeoutMs;
|
|
159
|
+
this._logService.info(
|
|
160
|
+
`ToolTerminalCreator#_waitForShellIntegration: base ${timeoutMs}ms, effective ${effectiveTimeoutMs}ms, screenReaderOptimized=${isScreenReaderOptimized}`
|
|
161
|
+
);
|
|
162
|
+
const siNoneTimer = store.add(( new MutableDisposable()));
|
|
163
|
+
siNoneTimer.value = disposableTimeout(() => {
|
|
164
|
+
this._logService.info(
|
|
165
|
+
`ToolTerminalCreator#_waitForShellIntegration: Timed out ${effectiveTimeoutMs}ms, using no SI`
|
|
166
|
+
);
|
|
167
|
+
result.complete(ShellIntegrationQuality.None);
|
|
168
|
+
}, effectiveTimeoutMs);
|
|
169
|
+
if (instance.capabilities.get(TerminalCapability.CommandDetection)?.hasRichCommandDetection) {
|
|
170
|
+
siNoneTimer.clear();
|
|
171
|
+
this._logService.info(
|
|
172
|
+
`ToolTerminalCreator#_waitForShellIntegration: Rich SI available immediately`
|
|
173
|
+
);
|
|
174
|
+
result.complete(ShellIntegrationQuality.Rich);
|
|
175
|
+
} else {
|
|
176
|
+
const onSetRichCommandDetection = store.add(
|
|
177
|
+
this._terminalService.createOnInstanceCapabilityEvent(TerminalCapability.CommandDetection, e => e.onSetRichCommandDetection)
|
|
178
|
+
);
|
|
179
|
+
store.add(onSetRichCommandDetection.event(e => {
|
|
180
|
+
if (e.instance !== instance) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
siNoneTimer.clear();
|
|
184
|
+
this._logService.info(
|
|
185
|
+
`ToolTerminalCreator#_waitForShellIntegration: Rich SI available eventually`
|
|
186
|
+
);
|
|
187
|
+
result.complete(ShellIntegrationQuality.Rich);
|
|
188
|
+
}));
|
|
189
|
+
const commandDetection = instance.capabilities.get(TerminalCapability.CommandDetection);
|
|
190
|
+
if (commandDetection) {
|
|
191
|
+
siNoneTimer.clear();
|
|
192
|
+
store.add(disposableTimeout(() => {
|
|
193
|
+
this._logService.info(
|
|
194
|
+
`ToolTerminalCreator#_waitForShellIntegration: Timed out 200ms, using basic SI`
|
|
195
|
+
);
|
|
196
|
+
result.complete(ShellIntegrationQuality.Basic);
|
|
197
|
+
}, 200));
|
|
198
|
+
} else {
|
|
199
|
+
store.add(instance.capabilities.onDidAddCommandDetectionCapability(e => {
|
|
200
|
+
siNoneTimer.clear();
|
|
201
|
+
store.add(disposableTimeout(() => {
|
|
202
|
+
this._logService.info(
|
|
203
|
+
`ToolTerminalCreator#_waitForShellIntegration: Timed out 200ms, using basic SI (via listener)`
|
|
204
|
+
);
|
|
205
|
+
result.complete(ShellIntegrationQuality.Basic);
|
|
206
|
+
}, 200));
|
|
207
|
+
}));
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
result.p.finally(() => {
|
|
211
|
+
this._logService.info(
|
|
212
|
+
`ToolTerminalCreator#_waitForShellIntegration: Promise complete, disposing store`
|
|
213
|
+
);
|
|
214
|
+
store.dispose();
|
|
215
|
+
});
|
|
216
|
+
return result.p;
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
ToolTerminalCreator = ToolTerminalCreator_1 = ( __decorate([( __param(0, IAccessibilityService)), ( __param(1, IConfigurationService)), ( __param(2, ITerminalLogService)), ( __param(3, ITerminalService))], ToolTerminalCreator));
|
|
220
|
+
|
|
221
|
+
export { ShellIntegrationQuality, ToolTerminalCreator };
|