@codingame/monaco-vscode-katex-common 33.0.9 → 34.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/vscode/src/vs/base/browser/ui/pixelSpinner/pixelSpinner.css +169 -0
- package/vscode/src/vs/base/browser/ui/pixelSpinner/pixelSpinner.d.ts +28 -0
- package/vscode/src/vs/base/browser/ui/pixelSpinner/pixelSpinner.js +61 -0
- package/vscode/src/vs/platform/actions/browser/actionWidgetDropdownActionViewItem.d.ts +1 -1
- package/vscode/src/vs/platform/actions/browser/actionWidgetDropdownActionViewItem.js +1 -1
- package/vscode/src/vs/platform/actions/browser/buttonbar.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatAccessibilityProvider.js +18 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatElicitationActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +40 -38
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolActions.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolPicker.js +14 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostChatInputPicker.contribution.d.ts +1 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostChatInputPicker.contribution.js +4 -48
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostChatInputPicker.d.ts +16 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostChatInputPicker.js +81 -69
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostGenericConfigChips.d.ts +1 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostGenericConfigChips.js +5 -22
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionUri.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionUri.js +21 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/media/agentHostChatInputPicker.css +18 -28
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionHoverWidget.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.js +9 -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 +30 -30
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.d.ts +13 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.js +177 -80
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.js +15 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.js +34 -34
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.d.ts +7 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.js +69 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/chatToolRiskAssessmentService.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolSetsContribution.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatAgentHover.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatArtifactsWidget.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentMarkdownRenderer.js +25 -1
- 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/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/chatCollapsibleContentPart.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleContentPart.js +4 -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.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDisabledClaudeHooksContentPart.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatEditPillElement.d.ts +93 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatEditPillElement.js +140 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatExtensionsContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatExternalEditContentPart.d.ts +46 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatExternalEditContentPart.js +134 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatHookContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.d.ts +2 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.js +49 -117
- 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.js +30 -30
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatProgressContentPart.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatProgressContentPart.js +47 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.js +52 -51
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuotaExceededPart.js +18 -14
- 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 +23 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentContentPart.js +13 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSuggestNextWidget.d.ts +15 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSuggestNextWidget.js +87 -11
- 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 +21 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.js +102 -35
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTipContentPart.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTodoListWidget.js +17 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolInputOutputContentPart.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTreeContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatWorkspaceEditContentPart.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/codeBlockPart.js +14 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatCodeBlockPill.css +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatTerminalToolProgressPart.css +22 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatThinkingContent.css +22 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.js +6 -2
- 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/chatInputOutputMarkdownProgressPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppModel.js +21 -2
- 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 +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatSimpleToolProgressPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.js +35 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.js +62 -35
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationCarouselPart.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolOutputPart.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPartUtilities.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPartUtilities.js +15 -12
- 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/chatToolProgressPart.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolProgressPart.js +10 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/terminalToolAutoExpand.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/terminalToolAutoExpand.js +13 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/toolRiskBadgeWidget.js +4 -4
- 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 +19 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.js +154 -59
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListWidget.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListWidget.js +21 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatOptions.d.ts +4 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatOptions.js +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.d.ts +17 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.js +113 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatFollowups.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatGoalBannerWidget.d.ts +21 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatGoalBannerWidget.js +64 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputNotificationService.d.ts +10 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputNotificationService.js +7 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputNotificationWidget.d.ts +11 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputNotificationWidget.js +18 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.js +361 -66
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPickerActionItem.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPickerActionItem.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputStatusActionViewItem.d.ts +30 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputStatusActionViewItem.js +147 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelPicker.d.ts +11 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelPicker.js +133 -87
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatPhoneInputPresenter.js +2 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.d.ts +4 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.js +13 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/media/chatGoalBannerWidget.css +81 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/media/chatInputNotificationWidget.css +32 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/permissionPickerActionItem.js +39 -40
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.d.ts +23 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.js +66 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/workspacePickerActionItem.js +3 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/media/chat.css +373 -32
- 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 +5 -3
- package/vscode/src/vs/workbench/contrib/chat/common/chatArtifactExtraction.js +18 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatImageExtraction.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/common/chatPermissionWarnings.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/common/widget/chatColors.js +18 -18
- package/vscode/src/vs/workbench/contrib/chat/common/widget/chatWidgetHistoryService.d.ts +12 -2
- package/vscode/src/vs/workbench/contrib/chat/common/widget/chatWidgetHistoryService.js +54 -11
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.js +3 -3
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.js +5 -5
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +30 -30
- 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/platform/actionWidget/browser/actionWidgetDropdown.d.ts +0 -76
- package/vscode/src/vs/platform/actionWidget/browser/actionWidgetDropdown.js +0 -191
- package/vscode/src/vs/platform/networkFilter/common/domainMatcher.d.ts +0 -50
- package/vscode/src/vs/platform/networkFilter/common/domainMatcher.js +0 -138
- package/vscode/src/vs/platform/networkFilter/common/settings.d.ts +0 -12
- package/vscode/src/vs/platform/networkFilter/common/settings.js +0 -14
- package/vscode/src/vs/platform/sandbox/common/sandboxHelperIpc.d.ts +0 -18
- package/vscode/src/vs/platform/sandbox/common/sandboxHelperIpc.js +0 -13
- package/vscode/src/vs/platform/sandbox/common/terminalSandboxService.d.ts +0 -87
- package/vscode/src/vs/platform/sandbox/common/terminalSandboxService.js +0 -10
- package/vscode/src/vs/workbench/contrib/terminal/terminalContribChatExports.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/alternativeRecommendation.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/alternativeRecommendation.js +0 -41
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandParsers/commandFileWriteParser.d.ts +0 -24
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandParsers/sedFileWriteParser.d.ts +0 -26
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandParsers/sedFileWriteParser.js +0 -142
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.d.ts +0 -52
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.js +0 -232
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/executeStrategy.d.ts +0 -65
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/executeStrategy.js +0 -225
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/noneExecuteStrategy.d.ts +0 -27
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/noneExecuteStrategy.js +0 -143
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/richExecuteStrategy.d.ts +0 -37
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/richExecuteStrategy.js +0 -205
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/strategyHelpers.d.ts +0 -40
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/strategyHelpers.js +0 -174
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/outputHelpers.d.ts +0 -7
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/outputHelpers.js +0 -43
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.d.ts +0 -52
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.js +0 -260
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalToolTelemetry.d.ts +0 -44
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalToolTelemetry.js +0 -98
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.d.ts +0 -42
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.js +0 -225
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/autoApprove/commandLineAutoApprover.d.ts +0 -31
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/autoApprove/commandLineAutoApprover.js +0 -392
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/autoApprove/npmScriptAutoApprover.d.ts +0 -45
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/autoApprove/npmScriptAutoApprover.js +0 -243
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAnalyzer.d.ts +0 -53
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAnalyzer.js +0 -10
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.d.ts +0 -20
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.js +0 -310
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineFileWriteAnalyzer.d.ts +0 -27
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineFileWriteAnalyzer.js +0 -177
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineSandboxAnalyzer.d.ts +0 -11
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineSandboxAnalyzer.js +0 -33
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/commandLinePresenter.d.ts +0 -41
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/nodeCommandLinePresenter.d.ts +0 -19
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/nodeCommandLinePresenter.js +0 -37
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/pythonCommandLinePresenter.d.ts +0 -19
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/pythonCommandLinePresenter.js +0 -37
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/rubyCommandLinePresenter.d.ts +0 -19
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/rubyCommandLinePresenter.js +0 -44
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/sandboxedCommandLinePresenter.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/sandboxedCommandLinePresenter.js +0 -22
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineBackgroundDetachRewriter.d.ts +0 -42
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineBackgroundDetachRewriter.js +0 -102
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineCdPrefixRewriter.d.ts +0 -5
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineCdPrefixRewriter.js +0 -27
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLinePreventHistoryRewriter.d.ts +0 -14
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLinePreventHistoryRewriter.js +0 -29
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLinePwshChainOperatorRewriter.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLinePwshChainOperatorRewriter.js +0 -33
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineRewriter.d.ts +0 -24
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineSandboxRewriter.d.ts +0 -15
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineSandboxRewriter.js +0 -53
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.d.ts +0 -177
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.js +0 -512
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/types.d.ts +0 -42
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/types.js +0 -23
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/outputAnalyzer.d.ts +0 -9
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.d.ts +0 -258
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.js +0 -2623
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sandboxOutputAnalyzer.d.ts +0 -22
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sandboxOutputAnalyzer.js +0 -43
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalCommandArtifactCollector.d.ts +0 -17
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalCommandArtifactCollector.js +0 -118
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalToolAutoApprove.d.ts +0 -22
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalToolAutoApprove.js +0 -44
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/toolIds.d.ts +0 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/treeSitterCommandParser.d.ts +0 -58
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/treeSitterCommandParser.js +0 -223
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxCommandRules.d.ts +0 -31
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxCommandRules.js +0 -49
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxReadAllowList.d.ts +0 -18
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxReadAllowList.js +0 -302
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxRuntimeConfigurationPerOperation.d.ts +0 -7
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxRuntimeConfigurationPerOperation.js +0 -118
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.d.ts +0 -114
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.js +0 -788
|
@@ -1,788 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
-
import { timeout } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
4
|
-
import { VSBuffer } from '@codingame/monaco-vscode-api/vscode/vs/base/common/buffer';
|
|
5
|
-
import { Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
6
|
-
import { Disposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
7
|
-
import { FileAccess } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
|
|
8
|
-
import { win32, posix, dirname } from '@codingame/monaco-vscode-api/vscode/vs/base/common/path';
|
|
9
|
-
import { OS, OperatingSystem } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
|
|
10
|
-
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
11
|
-
import { generateUuid } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uuid';
|
|
12
|
-
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
13
|
-
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
14
|
-
import { IEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/platform/environment/common/environment.service';
|
|
15
|
-
import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
|
|
16
|
-
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
17
|
-
import { IRemoteAgentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/remote/common/remoteAgentService.service';
|
|
18
|
-
import { TerminalChatAgentToolsSettingId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration';
|
|
19
|
-
import { AgentNetworkDomainSettingId } from '../../../../../platform/networkFilter/common/settings.js';
|
|
20
|
-
import { matchesDomainPattern, normalizeDomain } from '../../../../../platform/networkFilter/common/domainMatcher.js';
|
|
21
|
-
import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
|
|
22
|
-
import { IProductService } from '@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service';
|
|
23
|
-
import { WillShutdownJoinerOrder } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle';
|
|
24
|
-
import { ILifecycleService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle.service';
|
|
25
|
-
import { ISandboxHelperService } from '@codingame/monaco-vscode-api/vscode/vs/platform/sandbox/common/sandboxHelperService.service';
|
|
26
|
-
import { TerminalCapability } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/capabilities/capabilities';
|
|
27
|
-
import { MarkdownString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
|
|
28
|
-
import { ChatElicitationRequestPart } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatProgressTypes/chatElicitationRequestPart';
|
|
29
|
-
import { ChatModel } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatModel';
|
|
30
|
-
import { ElicitationState } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService';
|
|
31
|
-
import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService.service';
|
|
32
|
-
import { SANDBOX_HELPER_CHANNEL_NAME, SandboxHelperChannelClient } from '../../../../../platform/sandbox/common/sandboxHelperIpc.js';
|
|
33
|
-
import { AgentSandboxSettingId, AgentSandboxEnabledValue } from '@codingame/monaco-vscode-api/vscode/vs/platform/sandbox/common/settings';
|
|
34
|
-
import { TerminalSandboxPrerequisiteCheck } from '../../../../../platform/sandbox/common/terminalSandboxService.js';
|
|
35
|
-
import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
36
|
-
import { getTerminalSandboxReadAllowListForCommands } from './terminalSandboxReadAllowList.js';
|
|
37
|
-
import { getTerminalSandboxRuntimeConfigurationForCommands } from './terminalSandboxRuntimeConfigurationPerOperation.js';
|
|
38
|
-
|
|
39
|
-
var TerminalSandboxService_1;
|
|
40
|
-
let TerminalSandboxService = class TerminalSandboxService extends Disposable {
|
|
41
|
-
static {
|
|
42
|
-
TerminalSandboxService_1 = this;
|
|
43
|
-
}
|
|
44
|
-
static {
|
|
45
|
-
this._sandboxTempDirName = "tmp";
|
|
46
|
-
}
|
|
47
|
-
static {
|
|
48
|
-
this._urlRegex = /(?:https?|wss?):\/\/[^\s'"`|&;<>]+/gi;
|
|
49
|
-
}
|
|
50
|
-
static {
|
|
51
|
-
this._sshRemoteRegex = /(?:^|[\s'"`])(?:[^\s@:'"`]+@)?([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})(?::[^\s'"`|&;<>]+)(?=$|[\s'"`|&;<>])/gi;
|
|
52
|
-
}
|
|
53
|
-
static {
|
|
54
|
-
this._hostRegex = /(?:^|[\s'"`(=])([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})(?::\d+)?(?=(?:\/[^\s'"`|&;<>]*)?(?:$|[\s'"`)\]|,;|&<>]))/gi;
|
|
55
|
-
}
|
|
56
|
-
constructor(
|
|
57
|
-
_configurationService,
|
|
58
|
-
_fileService,
|
|
59
|
-
_environmentService,
|
|
60
|
-
_logService,
|
|
61
|
-
_remoteAgentService,
|
|
62
|
-
_workspaceContextService,
|
|
63
|
-
_productService,
|
|
64
|
-
_lifecycleService,
|
|
65
|
-
_sandboxHelperService,
|
|
66
|
-
_chatService
|
|
67
|
-
) {
|
|
68
|
-
super();
|
|
69
|
-
this._configurationService = _configurationService;
|
|
70
|
-
this._fileService = _fileService;
|
|
71
|
-
this._environmentService = _environmentService;
|
|
72
|
-
this._logService = _logService;
|
|
73
|
-
this._remoteAgentService = _remoteAgentService;
|
|
74
|
-
this._workspaceContextService = _workspaceContextService;
|
|
75
|
-
this._productService = _productService;
|
|
76
|
-
this._lifecycleService = _lifecycleService;
|
|
77
|
-
this._sandboxHelperService = _sandboxHelperService;
|
|
78
|
-
this._chatService = _chatService;
|
|
79
|
-
this._srtPathResolved = false;
|
|
80
|
-
this._needsForceUpdateConfigFile = true;
|
|
81
|
-
this._remoteEnvDetails = null;
|
|
82
|
-
this._commandAllowListKeywords = [];
|
|
83
|
-
this._commandAllowListCommandDetails = [];
|
|
84
|
-
this._os = OS;
|
|
85
|
-
this._defaultWritePaths = [];
|
|
86
|
-
this._pathJoin = (...segments) => {
|
|
87
|
-
const path = this._os === OperatingSystem.Windows ? win32 : posix;
|
|
88
|
-
return path.join(...segments);
|
|
89
|
-
};
|
|
90
|
-
this._appRoot = dirname(( FileAccess.asFileUri("")).path);
|
|
91
|
-
const nativeEnv = this._environmentService;
|
|
92
|
-
this._execPath = nativeEnv.execPath;
|
|
93
|
-
this._sandboxSettingsId = generateUuid();
|
|
94
|
-
this._remoteEnvDetailsPromise = this._remoteAgentService.getEnvironment();
|
|
95
|
-
this._register(
|
|
96
|
-
Event.runAndSubscribe(this._configurationService.onDidChangeConfiguration, e => {
|
|
97
|
-
if (e?.affectsConfiguration(AgentSandboxSettingId.AgentSandboxEnabled) || e?.affectsConfiguration(AgentSandboxSettingId.DeprecatedAgentSandboxEnabled) || e?.affectsConfiguration(AgentNetworkDomainSettingId.AllowedNetworkDomains) || e?.affectsConfiguration(AgentNetworkDomainSettingId.DeprecatedSandboxAllowedNetworkDomains) || e?.affectsConfiguration(AgentNetworkDomainSettingId.DeprecatedOldAllowedNetworkDomains) || e?.affectsConfiguration(AgentNetworkDomainSettingId.DeniedNetworkDomains) || e?.affectsConfiguration(AgentNetworkDomainSettingId.DeprecatedSandboxDeniedNetworkDomains) || e?.affectsConfiguration(AgentNetworkDomainSettingId.DeprecatedOldDeniedNetworkDomains) || e?.affectsConfiguration(TerminalChatAgentToolsSettingId.AgentSandboxLinuxFileSystem) || e?.affectsConfiguration(TerminalChatAgentToolsSettingId.DeprecatedAgentSandboxLinuxFileSystem) || e?.affectsConfiguration(TerminalChatAgentToolsSettingId.AgentSandboxMacFileSystem) || e?.affectsConfiguration(TerminalChatAgentToolsSettingId.DeprecatedAgentSandboxMacFileSystem) || e?.affectsConfiguration(TerminalChatAgentToolsSettingId.AgentSandboxAdvancedRuntime)) {
|
|
98
|
-
this.setNeedsForceUpdateConfigFile();
|
|
99
|
-
}
|
|
100
|
-
})
|
|
101
|
-
);
|
|
102
|
-
this._register(this._workspaceContextService.onDidChangeWorkspaceFolders(() => {
|
|
103
|
-
this.setNeedsForceUpdateConfigFile();
|
|
104
|
-
}));
|
|
105
|
-
this._register(this._lifecycleService.onWillShutdown(e => {
|
|
106
|
-
if (!this._tempDir) {
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
e.join(this._cleanupSandboxTempDir(), {
|
|
110
|
-
id: "join.deleteFilesInSandboxTempDir",
|
|
111
|
-
label: ( localize(14652, "Delete Files in Sandbox Temp Dir")),
|
|
112
|
-
order: WillShutdownJoinerOrder.Default
|
|
113
|
-
});
|
|
114
|
-
}));
|
|
115
|
-
}
|
|
116
|
-
async isEnabled() {
|
|
117
|
-
return await this._isSandboxConfiguredEnabled();
|
|
118
|
-
}
|
|
119
|
-
async isSandboxAllowNetworkEnabled() {
|
|
120
|
-
if (!(await this._isSandboxConfiguredEnabled())) {
|
|
121
|
-
return false;
|
|
122
|
-
}
|
|
123
|
-
return this._isSandboxAllowNetworkConfigured();
|
|
124
|
-
}
|
|
125
|
-
async getOS() {
|
|
126
|
-
this._remoteEnvDetails = await this._remoteEnvDetailsPromise;
|
|
127
|
-
this._os = this._remoteEnvDetails ? this._remoteEnvDetails.os : OS;
|
|
128
|
-
return this._os;
|
|
129
|
-
}
|
|
130
|
-
async wrapCommand(command, requestUnsandboxedExecution, shell, cwd, commandDetails) {
|
|
131
|
-
const normalizedCommandDetails = this._normalizeCommandDetails(commandDetails ?? []);
|
|
132
|
-
const normalizedCommandKeywords = this._normalizeCommandKeywords(( normalizedCommandDetails.map(command => command.keyword)));
|
|
133
|
-
const currentReadAllowListPaths = getTerminalSandboxReadAllowListForCommands(
|
|
134
|
-
this._os,
|
|
135
|
-
this._commandAllowListKeywords,
|
|
136
|
-
this._commandAllowListCommandDetails
|
|
137
|
-
);
|
|
138
|
-
const nextReadAllowListPaths = getTerminalSandboxReadAllowListForCommands(this._os, normalizedCommandKeywords, normalizedCommandDetails);
|
|
139
|
-
const currentRuntimeConfiguration = getTerminalSandboxRuntimeConfigurationForCommands(this._os, this._commandAllowListCommandDetails);
|
|
140
|
-
const nextRuntimeConfiguration = getTerminalSandboxRuntimeConfigurationForCommands(this._os, normalizedCommandDetails);
|
|
141
|
-
const shouldRefreshConfig = this._commandAllowListKeywords.length === 0 || this._needsForceUpdateConfigFile || !this._areStringArraysEqual(this._commandAllowListKeywords, normalizedCommandKeywords) || !this._areStringArraysEqual(currentReadAllowListPaths, nextReadAllowListPaths) || !this._areObjectsEqual(currentRuntimeConfiguration, nextRuntimeConfiguration) || this._commandCwd?.toString() !== cwd?.toString();
|
|
142
|
-
if (shouldRefreshConfig) {
|
|
143
|
-
this._commandAllowListKeywords = normalizedCommandKeywords;
|
|
144
|
-
this._commandAllowListCommandDetails = normalizedCommandDetails;
|
|
145
|
-
this._commandCwd = cwd;
|
|
146
|
-
await this.getSandboxConfigPath(true);
|
|
147
|
-
}
|
|
148
|
-
if (!this._sandboxConfigPath || !this._tempDir) {
|
|
149
|
-
throw ( new Error("Sandbox config path or temp dir not initialized"));
|
|
150
|
-
}
|
|
151
|
-
const allowUnsandboxedCommands = this._areUnsandboxedCommandsAllowed();
|
|
152
|
-
const blockedDomainResult = requestUnsandboxedExecution || !allowUnsandboxedCommands ? {
|
|
153
|
-
blockedDomains: [],
|
|
154
|
-
deniedDomains: []
|
|
155
|
-
} : this._getBlockedDomains(command);
|
|
156
|
-
if (!requestUnsandboxedExecution && allowUnsandboxedCommands && blockedDomainResult.blockedDomains.length > 0) {
|
|
157
|
-
return {
|
|
158
|
-
command: this._wrapUnsandboxedCommand(command, shell),
|
|
159
|
-
isSandboxWrapped: false,
|
|
160
|
-
blockedDomains: blockedDomainResult.blockedDomains,
|
|
161
|
-
deniedDomains: blockedDomainResult.deniedDomains,
|
|
162
|
-
requiresUnsandboxConfirmation: true
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
if (requestUnsandboxedExecution && allowUnsandboxedCommands) {
|
|
166
|
-
return {
|
|
167
|
-
command: this._wrapUnsandboxedCommand(command, shell),
|
|
168
|
-
isSandboxWrapped: false
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
if (!this._execPath) {
|
|
172
|
-
throw ( new Error("Executable path not set to run sandbox commands"));
|
|
173
|
-
}
|
|
174
|
-
if (!this._srtPath) {
|
|
175
|
-
throw ( new Error("Sandbox runtime path not resolved"));
|
|
176
|
-
}
|
|
177
|
-
if (!this._rgPath) {
|
|
178
|
-
throw ( new Error("Ripgrep path not resolved"));
|
|
179
|
-
}
|
|
180
|
-
const commandToRunInSandbox = this._getSandboxCommandWithPreservedCwd(command, cwd);
|
|
181
|
-
const sandboxRuntimeCommand = `PATH="$PATH:${dirname(this._rgPath)}" TMPDIR="${this._tempDir.path}" CLAUDE_TMPDIR="${this._tempDir.path}" "${this._execPath}" "${this._srtPath}" --settings "${this._sandboxConfigPath}" -c ${this._quoteShellArgument(commandToRunInSandbox)}`;
|
|
182
|
-
const wrappedCommand = this._os === OperatingSystem.Linux && cwd?.path && cwd.path !== this._tempDir.path ? `cd ${this._quoteShellArgument(this._tempDir.path)}; ${sandboxRuntimeCommand}` : sandboxRuntimeCommand;
|
|
183
|
-
if (this._remoteEnvDetails) {
|
|
184
|
-
return {
|
|
185
|
-
command: wrappedCommand,
|
|
186
|
-
isSandboxWrapped: true
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
return {
|
|
190
|
-
command: `ELECTRON_RUN_AS_NODE=1 ${wrappedCommand}`,
|
|
191
|
-
isSandboxWrapped: true
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
getTempDir() {
|
|
195
|
-
return this._tempDir;
|
|
196
|
-
}
|
|
197
|
-
setNeedsForceUpdateConfigFile() {
|
|
198
|
-
this._needsForceUpdateConfigFile = true;
|
|
199
|
-
}
|
|
200
|
-
async checkForSandboxingPrereqs(forceRefresh = false) {
|
|
201
|
-
if (!(await this._isSandboxConfiguredEnabled())) {
|
|
202
|
-
return {
|
|
203
|
-
enabled: false,
|
|
204
|
-
sandboxConfigPath: undefined,
|
|
205
|
-
failedCheck: undefined
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
const sandboxConfigPath = await this.getSandboxConfigPath(forceRefresh);
|
|
209
|
-
if (!sandboxConfigPath) {
|
|
210
|
-
return {
|
|
211
|
-
enabled: true,
|
|
212
|
-
sandboxConfigPath,
|
|
213
|
-
failedCheck: TerminalSandboxPrerequisiteCheck.Config
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
if (!(await this._checkSandboxDependencies(forceRefresh))) {
|
|
217
|
-
return {
|
|
218
|
-
enabled: true,
|
|
219
|
-
sandboxConfigPath,
|
|
220
|
-
failedCheck: TerminalSandboxPrerequisiteCheck.Dependencies,
|
|
221
|
-
missingDependencies: await this.getMissingSandboxDependencies()
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
return {
|
|
225
|
-
enabled: true,
|
|
226
|
-
sandboxConfigPath,
|
|
227
|
-
failedCheck: undefined
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
async getSandboxConfigPath(forceRefresh = false) {
|
|
231
|
-
if (!(await this._isSandboxConfiguredEnabled())) {
|
|
232
|
-
return undefined;
|
|
233
|
-
}
|
|
234
|
-
await this._resolveSrtPath();
|
|
235
|
-
if (!this._sandboxConfigPath || forceRefresh || this._needsForceUpdateConfigFile) {
|
|
236
|
-
this._sandboxConfigPath = await this._createSandboxConfig();
|
|
237
|
-
this._needsForceUpdateConfigFile = false;
|
|
238
|
-
}
|
|
239
|
-
return this._sandboxConfigPath;
|
|
240
|
-
}
|
|
241
|
-
async _checkSandboxDependencies(forceRefresh = false) {
|
|
242
|
-
const os = await this.getOS();
|
|
243
|
-
if (os === OperatingSystem.Windows) {
|
|
244
|
-
return false;
|
|
245
|
-
}
|
|
246
|
-
const sandboxDependencyStatus = await this._resolveSandboxDependencyStatus(forceRefresh);
|
|
247
|
-
this._sandboxDependencyStatus = sandboxDependencyStatus;
|
|
248
|
-
if (sandboxDependencyStatus && !sandboxDependencyStatus.bubblewrapInstalled) {
|
|
249
|
-
this._logService.warn("TerminalSandboxService: bubblewrap (bwrap) is not installed");
|
|
250
|
-
}
|
|
251
|
-
if (sandboxDependencyStatus && !sandboxDependencyStatus.socatInstalled) {
|
|
252
|
-
this._logService.warn("TerminalSandboxService: socat is not installed");
|
|
253
|
-
}
|
|
254
|
-
return sandboxDependencyStatus ? sandboxDependencyStatus.bubblewrapInstalled && sandboxDependencyStatus.socatInstalled : true;
|
|
255
|
-
}
|
|
256
|
-
async getMissingSandboxDependencies() {
|
|
257
|
-
const os = await this.getOS();
|
|
258
|
-
if (os === OperatingSystem.Windows) {
|
|
259
|
-
return [];
|
|
260
|
-
}
|
|
261
|
-
if (!this._sandboxDependencyStatus || !this._sandboxDependencyStatus.bubblewrapInstalled || !this._sandboxDependencyStatus.socatInstalled) {
|
|
262
|
-
this._sandboxDependencyStatus = await this._resolveSandboxDependencyStatus(true);
|
|
263
|
-
}
|
|
264
|
-
const missing = [];
|
|
265
|
-
if (this._sandboxDependencyStatus && !this._sandboxDependencyStatus.bubblewrapInstalled) {
|
|
266
|
-
missing.push("bubblewrap");
|
|
267
|
-
}
|
|
268
|
-
if (this._sandboxDependencyStatus && !this._sandboxDependencyStatus.socatInstalled) {
|
|
269
|
-
missing.push("socat");
|
|
270
|
-
}
|
|
271
|
-
return missing;
|
|
272
|
-
}
|
|
273
|
-
async installMissingSandboxDependencies(missingDependencies, sessionResource, token, options) {
|
|
274
|
-
const depsList = missingDependencies.join(" ");
|
|
275
|
-
const installCommand = `sudo apt install -y ${depsList}`;
|
|
276
|
-
const instance = await options.createTerminal();
|
|
277
|
-
let installCommandSent = false;
|
|
278
|
-
const completionPromise = ( new Promise(resolve => {
|
|
279
|
-
const store = ( new DisposableStore());
|
|
280
|
-
let resolved = false;
|
|
281
|
-
const resolveOnce = code => {
|
|
282
|
-
if (resolved) {
|
|
283
|
-
return;
|
|
284
|
-
}
|
|
285
|
-
resolved = true;
|
|
286
|
-
store.dispose();
|
|
287
|
-
resolve(code);
|
|
288
|
-
};
|
|
289
|
-
const attachListener = () => {
|
|
290
|
-
const detection = instance.capabilities.get(TerminalCapability.CommandDetection);
|
|
291
|
-
if (detection) {
|
|
292
|
-
store.add(detection.onCommandFinished(cmd => resolveOnce(cmd.exitCode)));
|
|
293
|
-
}
|
|
294
|
-
};
|
|
295
|
-
attachListener();
|
|
296
|
-
store.add(instance.capabilities.onDidAddCapability(e => {
|
|
297
|
-
if (e.id === TerminalCapability.CommandDetection) {
|
|
298
|
-
attachListener();
|
|
299
|
-
}
|
|
300
|
-
}));
|
|
301
|
-
store.add(instance.onDisposed(() => resolveOnce(undefined)));
|
|
302
|
-
store.add(token.onCancellationRequested(() => resolveOnce(undefined)));
|
|
303
|
-
const safetyTimeout = timeout(5 * 60 * 1000);
|
|
304
|
-
store.add({
|
|
305
|
-
dispose: () => safetyTimeout.cancel()
|
|
306
|
-
});
|
|
307
|
-
safetyTimeout.then(() => resolveOnce(undefined));
|
|
308
|
-
const passwordPrompt = this._createMissingDependencyPasswordPrompt(sessionResource, {
|
|
309
|
-
focusTerminal: () => options.focusTerminal(instance),
|
|
310
|
-
onDidInputData: instance.onDidInputData,
|
|
311
|
-
onDisposed: instance.onDisposed,
|
|
312
|
-
didSendInstallCommand: () => installCommandSent
|
|
313
|
-
}, token);
|
|
314
|
-
store.add(passwordPrompt);
|
|
315
|
-
}));
|
|
316
|
-
await instance.sendText(installCommand, true);
|
|
317
|
-
installCommandSent = true;
|
|
318
|
-
return {
|
|
319
|
-
exitCode: await completionPromise
|
|
320
|
-
};
|
|
321
|
-
}
|
|
322
|
-
_createMissingDependencyPasswordPrompt(sessionResource, promptContext, token) {
|
|
323
|
-
const chatModel = sessionResource && this._chatService.getSession(sessionResource);
|
|
324
|
-
if (!(chatModel instanceof ChatModel)) {
|
|
325
|
-
return ( new DisposableStore());
|
|
326
|
-
}
|
|
327
|
-
const request = chatModel.getRequests().at(-1);
|
|
328
|
-
if (!request) {
|
|
329
|
-
return ( new DisposableStore());
|
|
330
|
-
}
|
|
331
|
-
const part = ( new ChatElicitationRequestPart(( localize(14653, "The terminal is awaiting input.")), ( new MarkdownString(( localize(
|
|
332
|
-
14654,
|
|
333
|
-
"Installing missing sandbox dependencies may prompt for your sudo password. Select Focus Terminal to type it in the terminal."
|
|
334
|
-
)))), "", ( localize(14655, "Focus Terminal")), undefined, async () => {
|
|
335
|
-
await promptContext.focusTerminal();
|
|
336
|
-
return ElicitationState.Pending;
|
|
337
|
-
}));
|
|
338
|
-
chatModel.acceptResponseProgress(request, part);
|
|
339
|
-
const store = ( new DisposableStore());
|
|
340
|
-
const disposePrompt = () => store.dispose();
|
|
341
|
-
store.add({
|
|
342
|
-
dispose: () => part.hide()
|
|
343
|
-
});
|
|
344
|
-
store.add(token.onCancellationRequested(disposePrompt));
|
|
345
|
-
store.add(promptContext.onDisposed(disposePrompt));
|
|
346
|
-
store.add(promptContext.onDidInputData(data => {
|
|
347
|
-
if (promptContext.didSendInstallCommand() && data.length > 0) {
|
|
348
|
-
disposePrompt();
|
|
349
|
-
}
|
|
350
|
-
}));
|
|
351
|
-
return store;
|
|
352
|
-
}
|
|
353
|
-
_quoteShellArgument(value) {
|
|
354
|
-
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
355
|
-
}
|
|
356
|
-
_getSandboxCommandWithPreservedCwd(command, cwd) {
|
|
357
|
-
if (this._os !== OperatingSystem.Linux || !cwd?.path || cwd.path === this._tempDir?.path) {
|
|
358
|
-
return command;
|
|
359
|
-
}
|
|
360
|
-
return `cd ${this._quoteShellArgument(cwd.path)} && ${command}`;
|
|
361
|
-
}
|
|
362
|
-
_wrapUnsandboxedCommand(command, shell) {
|
|
363
|
-
if (!this._tempDir?.path) {
|
|
364
|
-
return command;
|
|
365
|
-
}
|
|
366
|
-
if (!shell) {
|
|
367
|
-
return `(TMPDIR="${this._tempDir.path}"; export TMPDIR; ${command})`;
|
|
368
|
-
}
|
|
369
|
-
return `env TMPDIR="${this._tempDir.path}" ${this._quoteShellArgument(shell)} -c ${this._quoteShellArgument(command)}`;
|
|
370
|
-
}
|
|
371
|
-
_getBlockedDomains(command) {
|
|
372
|
-
if (this._isSandboxAllowNetworkConfigured()) {
|
|
373
|
-
return {
|
|
374
|
-
blockedDomains: [],
|
|
375
|
-
deniedDomains: []
|
|
376
|
-
};
|
|
377
|
-
}
|
|
378
|
-
const domains = this._extractDomains(command);
|
|
379
|
-
if (domains.length === 0) {
|
|
380
|
-
return {
|
|
381
|
-
blockedDomains: [],
|
|
382
|
-
deniedDomains: []
|
|
383
|
-
};
|
|
384
|
-
}
|
|
385
|
-
const {
|
|
386
|
-
allowedDomains,
|
|
387
|
-
deniedDomains
|
|
388
|
-
} = this.getResolvedNetworkDomains();
|
|
389
|
-
const blockedDomains = ( new Set());
|
|
390
|
-
const explicitlyDeniedDomains = ( new Set());
|
|
391
|
-
for (const domain of domains) {
|
|
392
|
-
if (( deniedDomains.some(pattern => matchesDomainPattern(domain, pattern)))) {
|
|
393
|
-
blockedDomains.add(domain);
|
|
394
|
-
explicitlyDeniedDomains.add(domain);
|
|
395
|
-
continue;
|
|
396
|
-
}
|
|
397
|
-
if (!( allowedDomains.some(pattern => matchesDomainPattern(domain, pattern)))) {
|
|
398
|
-
blockedDomains.add(domain);
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
return {
|
|
402
|
-
blockedDomains: [...blockedDomains],
|
|
403
|
-
deniedDomains: [...explicitlyDeniedDomains]
|
|
404
|
-
};
|
|
405
|
-
}
|
|
406
|
-
_extractDomains(command) {
|
|
407
|
-
const domains = ( new Set());
|
|
408
|
-
let match;
|
|
409
|
-
TerminalSandboxService_1._urlRegex.lastIndex = 0;
|
|
410
|
-
while ((match = TerminalSandboxService_1._urlRegex.exec(command)) !== null) {
|
|
411
|
-
const domain = this._extractDomainFromUrl(match[0]);
|
|
412
|
-
if (domain) {
|
|
413
|
-
domains.add(domain);
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
TerminalSandboxService_1._sshRemoteRegex.lastIndex = 0;
|
|
417
|
-
while ((match = TerminalSandboxService_1._sshRemoteRegex.exec(command)) !== null) {
|
|
418
|
-
const domain = normalizeDomain(match[1], true);
|
|
419
|
-
if (domain) {
|
|
420
|
-
domains.add(domain);
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
TerminalSandboxService_1._hostRegex.lastIndex = 0;
|
|
424
|
-
while ((match = TerminalSandboxService_1._hostRegex.exec(command)) !== null) {
|
|
425
|
-
const domain = normalizeDomain(match[1]);
|
|
426
|
-
if (domain) {
|
|
427
|
-
domains.add(domain);
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
return [...domains];
|
|
431
|
-
}
|
|
432
|
-
_extractDomainFromUrl(value) {
|
|
433
|
-
try {
|
|
434
|
-
const authority = ( URI.parse(value)).authority;
|
|
435
|
-
return normalizeDomain(authority, true);
|
|
436
|
-
} catch {
|
|
437
|
-
return undefined;
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
_normalizeCommandKeywords(commandKeywords) {
|
|
441
|
-
return [...( new Set(( commandKeywords.map(keyword => keyword.toLowerCase()))))].sort();
|
|
442
|
-
}
|
|
443
|
-
_normalizeCommandDetails(commandDetails) {
|
|
444
|
-
const seen = ( new Set());
|
|
445
|
-
const result = [];
|
|
446
|
-
for (const command of commandDetails) {
|
|
447
|
-
const normalizedCommand = {
|
|
448
|
-
keyword: command.keyword.toLowerCase(),
|
|
449
|
-
args: [...command.args]
|
|
450
|
-
};
|
|
451
|
-
const key = JSON.stringify(normalizedCommand);
|
|
452
|
-
if (!( seen.has(key))) {
|
|
453
|
-
seen.add(key);
|
|
454
|
-
result.push(normalizedCommand);
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
return result.sort(
|
|
458
|
-
(a, b) => a.keyword.localeCompare(b.keyword) || a.args.join("\u0000").localeCompare(b.args.join("\u0000"))
|
|
459
|
-
);
|
|
460
|
-
}
|
|
461
|
-
_areStringArraysEqual(a, b) {
|
|
462
|
-
return a.length === b.length && a.every((keyword, index) => keyword === b[index]);
|
|
463
|
-
}
|
|
464
|
-
_areObjectsEqual(a, b) {
|
|
465
|
-
return JSON.stringify(a) === JSON.stringify(b);
|
|
466
|
-
}
|
|
467
|
-
async _isSandboxConfiguredEnabled() {
|
|
468
|
-
const os = await this.getOS();
|
|
469
|
-
if (os === OperatingSystem.Windows) {
|
|
470
|
-
return false;
|
|
471
|
-
}
|
|
472
|
-
const value = this._getSandboxConfiguredEnabledValue();
|
|
473
|
-
return value === true || value === AgentSandboxEnabledValue.On || value === AgentSandboxEnabledValue.AllowNetwork;
|
|
474
|
-
}
|
|
475
|
-
async _resolveSrtPath() {
|
|
476
|
-
if (this._srtPathResolved) {
|
|
477
|
-
return;
|
|
478
|
-
}
|
|
479
|
-
this._srtPathResolved = true;
|
|
480
|
-
const remoteEnv = this._remoteEnvDetails || (await this._remoteEnvDetailsPromise);
|
|
481
|
-
if (remoteEnv) {
|
|
482
|
-
this._appRoot = remoteEnv.appRoot.path;
|
|
483
|
-
this._execPath = remoteEnv.execPath;
|
|
484
|
-
}
|
|
485
|
-
this._srtPath = this._pathJoin(
|
|
486
|
-
this._appRoot,
|
|
487
|
-
"node_modules",
|
|
488
|
-
"@vscode",
|
|
489
|
-
"sandbox-runtime",
|
|
490
|
-
"dist",
|
|
491
|
-
"cli.js"
|
|
492
|
-
);
|
|
493
|
-
this._rgPath = this._pathJoin(this._appRoot, "node_modules", "@vscode", "ripgrep", "bin", "rg");
|
|
494
|
-
}
|
|
495
|
-
async _createSandboxConfig() {
|
|
496
|
-
if ((await this.isEnabled()) && !this._tempDir) {
|
|
497
|
-
await this._initTempDir();
|
|
498
|
-
}
|
|
499
|
-
if (this._tempDir) {
|
|
500
|
-
const allowNetwork = await this.isSandboxAllowNetworkEnabled();
|
|
501
|
-
const linuxFileSystemSetting = this._os === OperatingSystem.Linux ? this._getSettingValue(
|
|
502
|
-
TerminalChatAgentToolsSettingId.AgentSandboxLinuxFileSystem,
|
|
503
|
-
TerminalChatAgentToolsSettingId.DeprecatedAgentSandboxLinuxFileSystem
|
|
504
|
-
) ?? {} : {};
|
|
505
|
-
const macFileSystemSetting = this._os === OperatingSystem.Macintosh ? this._getSettingValue(
|
|
506
|
-
TerminalChatAgentToolsSettingId.AgentSandboxMacFileSystem,
|
|
507
|
-
TerminalChatAgentToolsSettingId.DeprecatedAgentSandboxMacFileSystem
|
|
508
|
-
) ?? {} : {};
|
|
509
|
-
const runtimeSetting = this._getSettingValue(TerminalChatAgentToolsSettingId.AgentSandboxAdvancedRuntime) ?? {};
|
|
510
|
-
const commandRuntimeSetting = getTerminalSandboxRuntimeConfigurationForCommands(this._os, this._commandAllowListCommandDetails);
|
|
511
|
-
const commandRuntimeAllowReadPaths = this._getCommandRuntimeFileSystemPaths(commandRuntimeSetting, "allowRead");
|
|
512
|
-
const commandRuntimeAllowWritePaths = this._getCommandRuntimeFileSystemPaths(commandRuntimeSetting, "allowWrite");
|
|
513
|
-
const configFileUri = URI.joinPath(this._tempDir, `vscode-sandbox-settings-${this._sandboxSettingsId}.json`);
|
|
514
|
-
let allowWritePaths = [];
|
|
515
|
-
let allowReadPaths = [];
|
|
516
|
-
let denyReadPaths = [];
|
|
517
|
-
let denyWritePaths;
|
|
518
|
-
if (this._os === OperatingSystem.Macintosh) {
|
|
519
|
-
allowWritePaths = this._updateAllowWritePathsWithWorkspaceFolders(macFileSystemSetting.allowWrite, commandRuntimeAllowWritePaths);
|
|
520
|
-
allowReadPaths = this._updateAllowReadPathsWithAllowWrite(
|
|
521
|
-
macFileSystemSetting.allowRead,
|
|
522
|
-
allowWritePaths,
|
|
523
|
-
commandRuntimeAllowReadPaths
|
|
524
|
-
);
|
|
525
|
-
denyReadPaths = this._updateDenyReadPathsWithHome(macFileSystemSetting.denyRead);
|
|
526
|
-
denyWritePaths = macFileSystemSetting.denyWrite;
|
|
527
|
-
} else if (this._os === OperatingSystem.Linux) {
|
|
528
|
-
allowWritePaths = this._resolveLinuxFileSystemPaths(
|
|
529
|
-
this._updateAllowWritePathsWithWorkspaceFolders(linuxFileSystemSetting.allowWrite, commandRuntimeAllowWritePaths)
|
|
530
|
-
);
|
|
531
|
-
allowReadPaths = this._resolveLinuxFileSystemPaths(this._updateAllowReadPathsWithAllowWrite(
|
|
532
|
-
linuxFileSystemSetting.allowRead,
|
|
533
|
-
allowWritePaths,
|
|
534
|
-
commandRuntimeAllowReadPaths
|
|
535
|
-
));
|
|
536
|
-
denyReadPaths = this._resolveLinuxFileSystemPaths(this._updateDenyReadPathsWithHome(linuxFileSystemSetting.denyRead));
|
|
537
|
-
denyWritePaths = this._resolveLinuxFileSystemPaths(linuxFileSystemSetting.denyWrite);
|
|
538
|
-
}
|
|
539
|
-
const sandboxSettings = {
|
|
540
|
-
network: allowNetwork ? {
|
|
541
|
-
allowedDomains: [],
|
|
542
|
-
deniedDomains: [],
|
|
543
|
-
enabled: false
|
|
544
|
-
} : this.getResolvedNetworkDomains(),
|
|
545
|
-
filesystem: {
|
|
546
|
-
denyRead: denyReadPaths,
|
|
547
|
-
allowRead: allowReadPaths,
|
|
548
|
-
allowWrite: allowWritePaths,
|
|
549
|
-
denyWrite: denyWritePaths
|
|
550
|
-
}
|
|
551
|
-
};
|
|
552
|
-
this._mergeAdditionalSandboxConfigProperties(
|
|
553
|
-
sandboxSettings,
|
|
554
|
-
allowNetwork ? this._withoutNetworkRuntimeSetting(runtimeSetting) : runtimeSetting
|
|
555
|
-
);
|
|
556
|
-
this._mergeAdditionalSandboxConfigProperties(sandboxSettings, commandRuntimeSetting);
|
|
557
|
-
this._sandboxConfigPath = configFileUri.path;
|
|
558
|
-
await this._fileService.createFile(
|
|
559
|
-
configFileUri,
|
|
560
|
-
VSBuffer.fromString(JSON.stringify(sandboxSettings, null, "\t")),
|
|
561
|
-
{
|
|
562
|
-
overwrite: true
|
|
563
|
-
}
|
|
564
|
-
);
|
|
565
|
-
return this._sandboxConfigPath;
|
|
566
|
-
}
|
|
567
|
-
return undefined;
|
|
568
|
-
}
|
|
569
|
-
_getCommandRuntimeFileSystemPaths(runtimeSetting, key) {
|
|
570
|
-
const filesystem = runtimeSetting.filesystem;
|
|
571
|
-
if (!this._isObjectForSandboxConfigMerge(filesystem)) {
|
|
572
|
-
return [];
|
|
573
|
-
}
|
|
574
|
-
const paths = filesystem[key];
|
|
575
|
-
if (!Array.isArray(paths)) {
|
|
576
|
-
return [];
|
|
577
|
-
}
|
|
578
|
-
return paths.filter(path => typeof path === "string");
|
|
579
|
-
}
|
|
580
|
-
_withoutNetworkRuntimeSetting(runtimeSetting) {
|
|
581
|
-
const sanitizedRuntimeSetting = {
|
|
582
|
-
...runtimeSetting
|
|
583
|
-
};
|
|
584
|
-
delete sanitizedRuntimeSetting.network;
|
|
585
|
-
return sanitizedRuntimeSetting;
|
|
586
|
-
}
|
|
587
|
-
_mergeAdditionalSandboxConfigProperties(target, additional) {
|
|
588
|
-
for (const [key, value] of Object.entries(additional)) {
|
|
589
|
-
if (!Object.prototype.hasOwnProperty.call(target, key)) {
|
|
590
|
-
target[key] = value;
|
|
591
|
-
continue;
|
|
592
|
-
}
|
|
593
|
-
const existingValue = target[key];
|
|
594
|
-
if (this._isObjectForSandboxConfigMerge(existingValue) && this._isObjectForSandboxConfigMerge(value)) {
|
|
595
|
-
this._mergeAdditionalSandboxConfigProperties(existingValue, value);
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
_isObjectForSandboxConfigMerge(value) {
|
|
600
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
601
|
-
}
|
|
602
|
-
async _initTempDir() {
|
|
603
|
-
if (await this.isEnabled()) {
|
|
604
|
-
this._needsForceUpdateConfigFile = true;
|
|
605
|
-
const remoteEnv = this._remoteEnvDetails || (await this._remoteEnvDetailsPromise);
|
|
606
|
-
this._tempDir = this._getSandboxTempDirPath(remoteEnv);
|
|
607
|
-
if (this._tempDir) {
|
|
608
|
-
await this._fileService.createFolder(this._tempDir);
|
|
609
|
-
this._defaultWritePaths.push(this._tempDir.path);
|
|
610
|
-
}
|
|
611
|
-
if (!this._tempDir) {
|
|
612
|
-
this._logService.warn(
|
|
613
|
-
"TerminalSandboxService: Cannot create sandbox settings file because no tmpDir is available in this environment"
|
|
614
|
-
);
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
async _cleanupSandboxTempDir() {
|
|
619
|
-
if (!this._tempDir) {
|
|
620
|
-
return;
|
|
621
|
-
}
|
|
622
|
-
try {
|
|
623
|
-
await this._fileService.del(this._tempDir, {
|
|
624
|
-
recursive: true,
|
|
625
|
-
useTrash: false
|
|
626
|
-
});
|
|
627
|
-
} catch (error) {
|
|
628
|
-
this._logService.warn("TerminalSandboxService: Failed to delete sandbox temp dir", error);
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
_getSandboxTempDirPath(remoteEnv) {
|
|
632
|
-
const sandboxTempDirName = this._getSandboxWindowTempDirName();
|
|
633
|
-
if (remoteEnv?.userHome) {
|
|
634
|
-
const sandboxRoot = URI.joinPath(
|
|
635
|
-
remoteEnv.userHome,
|
|
636
|
-
this._productService.serverDataFolderName ?? this._productService.dataFolderName,
|
|
637
|
-
TerminalSandboxService_1._sandboxTempDirName
|
|
638
|
-
);
|
|
639
|
-
return sandboxTempDirName ? URI.joinPath(sandboxRoot, sandboxTempDirName) : sandboxRoot;
|
|
640
|
-
}
|
|
641
|
-
const nativeEnv = this._environmentService;
|
|
642
|
-
if (nativeEnv.userHome) {
|
|
643
|
-
const sandboxRoot = URI.joinPath(
|
|
644
|
-
nativeEnv.userHome,
|
|
645
|
-
this._productService.dataFolderName,
|
|
646
|
-
TerminalSandboxService_1._sandboxTempDirName
|
|
647
|
-
);
|
|
648
|
-
return sandboxTempDirName ? URI.joinPath(sandboxRoot, sandboxTempDirName) : sandboxRoot;
|
|
649
|
-
}
|
|
650
|
-
return undefined;
|
|
651
|
-
}
|
|
652
|
-
_getSandboxWindowTempDirName() {
|
|
653
|
-
const workbenchEnv = this._environmentService;
|
|
654
|
-
const windowId = workbenchEnv.window?.id;
|
|
655
|
-
return typeof windowId === "number" ? `tmp_vscode_${windowId}` : undefined;
|
|
656
|
-
}
|
|
657
|
-
getResolvedNetworkDomains() {
|
|
658
|
-
const allowedDomains = this._getSettingValue(
|
|
659
|
-
AgentNetworkDomainSettingId.AllowedNetworkDomains,
|
|
660
|
-
AgentNetworkDomainSettingId.DeprecatedSandboxAllowedNetworkDomains,
|
|
661
|
-
AgentNetworkDomainSettingId.DeprecatedOldAllowedNetworkDomains
|
|
662
|
-
) ?? [];
|
|
663
|
-
const deniedDomains = this._getSettingValue(
|
|
664
|
-
AgentNetworkDomainSettingId.DeniedNetworkDomains,
|
|
665
|
-
AgentNetworkDomainSettingId.DeprecatedSandboxDeniedNetworkDomains,
|
|
666
|
-
AgentNetworkDomainSettingId.DeprecatedOldDeniedNetworkDomains
|
|
667
|
-
) ?? [];
|
|
668
|
-
return {
|
|
669
|
-
allowedDomains,
|
|
670
|
-
deniedDomains
|
|
671
|
-
};
|
|
672
|
-
}
|
|
673
|
-
_updateAllowWritePathsWithWorkspaceFolders(configuredAllowWrite, commandRuntimeAllowWrite = []) {
|
|
674
|
-
const workspaceFolderPaths = ( this._workspaceContextService.getWorkspace().folders.map(folder => folder.uri.path));
|
|
675
|
-
return [...( new Set([
|
|
676
|
-
...workspaceFolderPaths,
|
|
677
|
-
...this._defaultWritePaths,
|
|
678
|
-
...this._getWorkspaceStoragePaths(),
|
|
679
|
-
...(configuredAllowWrite ?? []),
|
|
680
|
-
...commandRuntimeAllowWrite
|
|
681
|
-
]))];
|
|
682
|
-
}
|
|
683
|
-
_updateDenyReadPathsWithHome(configuredDenyRead) {
|
|
684
|
-
const userHome = this._getUserHomePath();
|
|
685
|
-
return [...( new Set([...(configuredDenyRead ?? []), ...(userHome ? [userHome] : [])]))];
|
|
686
|
-
}
|
|
687
|
-
_updateAllowReadPathsWithAllowWrite(configuredAllowRead, allowWrite, commandRuntimeAllowRead = []) {
|
|
688
|
-
return [...( new Set([
|
|
689
|
-
...(configuredAllowRead ?? []),
|
|
690
|
-
...getTerminalSandboxReadAllowListForCommands(
|
|
691
|
-
this._os,
|
|
692
|
-
this._commandAllowListKeywords,
|
|
693
|
-
this._commandAllowListCommandDetails
|
|
694
|
-
),
|
|
695
|
-
...commandRuntimeAllowRead,
|
|
696
|
-
...this._getSandboxRuntimeReadPaths(),
|
|
697
|
-
...allowWrite
|
|
698
|
-
]))];
|
|
699
|
-
}
|
|
700
|
-
_resolveLinuxFileSystemPaths(paths) {
|
|
701
|
-
return ( (paths ?? []).map(path => this._expandHomePath(path)));
|
|
702
|
-
}
|
|
703
|
-
_expandHomePath(path) {
|
|
704
|
-
const userHome = this._getUserHomePath();
|
|
705
|
-
if (!userHome) {
|
|
706
|
-
return path;
|
|
707
|
-
}
|
|
708
|
-
if (path === "~") {
|
|
709
|
-
return userHome;
|
|
710
|
-
}
|
|
711
|
-
if (path.startsWith("~/")) {
|
|
712
|
-
return this._pathJoin(userHome, path.slice(2));
|
|
713
|
-
}
|
|
714
|
-
return path;
|
|
715
|
-
}
|
|
716
|
-
_getSandboxRuntimeReadPaths() {
|
|
717
|
-
const paths = [this._appRoot];
|
|
718
|
-
if (this._execPath) {
|
|
719
|
-
for (const path of [this._execPath, dirname(this._execPath)]) {
|
|
720
|
-
if (!this._isPathUnderAppRoot(path)) {
|
|
721
|
-
paths.push(path);
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
return paths;
|
|
726
|
-
}
|
|
727
|
-
_isPathUnderAppRoot(path) {
|
|
728
|
-
return path === this._appRoot || path.startsWith(
|
|
729
|
-
`${this._appRoot}${this._os === OperatingSystem.Windows ? win32.sep : posix.sep}`
|
|
730
|
-
);
|
|
731
|
-
}
|
|
732
|
-
_getWorkspaceStoragePaths() {
|
|
733
|
-
const workspaceStorageHome = this._remoteEnvDetails?.workspaceStorageHome ?? this._environmentService.workspaceStorageHome;
|
|
734
|
-
const workspaceId = this._workspaceContextService.getWorkspace().id;
|
|
735
|
-
return [URI.joinPath(workspaceStorageHome, workspaceId).path];
|
|
736
|
-
}
|
|
737
|
-
_getUserHomePath() {
|
|
738
|
-
const nativeEnv = this._environmentService;
|
|
739
|
-
return this._remoteEnvDetails?.userHome?.path ?? nativeEnv.userHome?.path;
|
|
740
|
-
}
|
|
741
|
-
async _resolveSandboxDependencyStatus(forceRefresh = false) {
|
|
742
|
-
if (!forceRefresh && this._sandboxDependencyStatus) {
|
|
743
|
-
return this._sandboxDependencyStatus;
|
|
744
|
-
}
|
|
745
|
-
const connection = this._remoteAgentService.getConnection();
|
|
746
|
-
if (connection) {
|
|
747
|
-
return connection.withChannel(SANDBOX_HELPER_CHANNEL_NAME, channel => {
|
|
748
|
-
const sandboxHelper = ( new SandboxHelperChannelClient(channel));
|
|
749
|
-
return sandboxHelper.checkSandboxDependencies();
|
|
750
|
-
});
|
|
751
|
-
}
|
|
752
|
-
return this._sandboxHelperService.checkSandboxDependencies();
|
|
753
|
-
}
|
|
754
|
-
_getSandboxConfiguredEnabledValue() {
|
|
755
|
-
return this._getSettingValue(
|
|
756
|
-
AgentSandboxSettingId.AgentSandboxEnabled,
|
|
757
|
-
AgentSandboxSettingId.DeprecatedAgentSandboxEnabled
|
|
758
|
-
) ?? AgentSandboxEnabledValue.Off;
|
|
759
|
-
}
|
|
760
|
-
_isSandboxAllowNetworkConfigured() {
|
|
761
|
-
return this._getSandboxConfiguredEnabledValue() === AgentSandboxEnabledValue.AllowNetwork;
|
|
762
|
-
}
|
|
763
|
-
_areUnsandboxedCommandsAllowed() {
|
|
764
|
-
return this._getSettingValue(AgentSandboxSettingId.AgentSandboxAllowUnsandboxedCommands) === true;
|
|
765
|
-
}
|
|
766
|
-
_getSettingValue(settingId, ...deprecatedSettingIds) {
|
|
767
|
-
const setting = this._configurationService.inspect(settingId);
|
|
768
|
-
if (setting.userValue !== undefined) {
|
|
769
|
-
return setting.value;
|
|
770
|
-
}
|
|
771
|
-
if (deprecatedSettingIds.length > 0) {
|
|
772
|
-
const userConfiguredKeys = ( this._configurationService.keys()).user;
|
|
773
|
-
for (const deprecatedId of deprecatedSettingIds) {
|
|
774
|
-
const deprecated = this._configurationService.inspect(deprecatedId);
|
|
775
|
-
if (deprecated.userValue !== undefined && userConfiguredKeys.includes(deprecatedId)) {
|
|
776
|
-
this._logService.warn(
|
|
777
|
-
`TerminalSandboxService: Using deprecated setting ${deprecatedId} because ${settingId} is not set. Please update your settings to use ${settingId} instead.`
|
|
778
|
-
);
|
|
779
|
-
return deprecated.value;
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
return setting.value;
|
|
784
|
-
}
|
|
785
|
-
};
|
|
786
|
-
TerminalSandboxService = TerminalSandboxService_1 = ( __decorate([( __param(0, IConfigurationService)), ( __param(1, IFileService)), ( __param(2, IEnvironmentService)), ( __param(3, ILogService)), ( __param(4, IRemoteAgentService)), ( __param(5, IWorkspaceContextService)), ( __param(6, IProductService)), ( __param(7, ILifecycleService)), ( __param(8, ISandboxHelperService)), ( __param(9, IChatService))], TerminalSandboxService));
|
|
787
|
-
|
|
788
|
-
export { TerminalSandboxPrerequisiteCheck, TerminalSandboxService };
|