@codingame/monaco-vscode-workbench-service-override 37.1.0 → 37.3.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/common.d.ts +3 -0
- package/common.js +29 -0
- package/index.d.ts +1 -1
- package/index.js +25 -32
- package/package.json +18 -8
- package/session.d.ts +4 -0
- package/session.js +260 -0
- package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostLocationPreferenceService.d.ts +24 -0
- package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostLocationPreferenceService.js +71 -0
- package/vscode/src/vs/platform/agentHost/common/remoteAgentHostLocationPreference.d.ts +7 -0
- package/vscode/src/vs/platform/agentHost/common/remoteAgentHostLocationPreference.js +7 -0
- package/vscode/src/vs/sessions/browser/dockedAuxiliaryBarController.d.ts +50 -0
- package/vscode/src/vs/sessions/browser/dockedAuxiliaryBarController.js +120 -0
- package/vscode/src/vs/sessions/browser/media/sessions-logo-dark.svg +6 -0
- package/vscode/src/vs/sessions/browser/media/sessions-logo-light.svg +6 -0
- package/vscode/src/vs/sessions/browser/media/sessionsSetUp.css +72 -0
- package/vscode/src/vs/sessions/browser/parts/chatCompositeBar.d.ts +116 -0
- package/vscode/src/vs/sessions/browser/parts/chatCompositeBar.js +566 -0
- package/vscode/src/vs/sessions/browser/parts/chatGroupDropTarget.d.ts +43 -0
- package/vscode/src/vs/sessions/browser/parts/chatGroupDropTarget.js +308 -0
- package/vscode/src/vs/sessions/browser/parts/chatGroupView.d.ts +108 -0
- package/vscode/src/vs/sessions/browser/parts/chatGroupView.js +324 -0
- package/vscode/src/vs/sessions/browser/parts/chatGroupsView.d.ts +136 -0
- package/vscode/src/vs/sessions/browser/parts/chatGroupsView.js +771 -0
- package/vscode/src/vs/sessions/browser/parts/customViewGridPart.d.ts +43 -0
- package/vscode/src/vs/sessions/browser/parts/customViewGridPart.js +113 -0
- package/vscode/src/vs/sessions/browser/parts/customViewGridParts.d.ts +17 -0
- package/vscode/src/vs/sessions/browser/parts/customViewGridParts.js +31 -0
- package/vscode/src/vs/sessions/browser/parts/customViewNode.d.ts +24 -0
- package/vscode/src/vs/sessions/browser/parts/customViewNode.js +131 -0
- package/vscode/src/vs/sessions/browser/parts/editorPart.d.ts +11 -0
- package/vscode/src/vs/sessions/browser/parts/editorPart.js +36 -0
- package/vscode/src/vs/sessions/browser/parts/editorParts.d.ts +12 -0
- package/vscode/src/vs/sessions/browser/parts/editorParts.js +45 -0
- package/vscode/src/vs/sessions/browser/parts/media/chatCompositeBar.css +559 -0
- package/vscode/src/vs/sessions/browser/parts/media/chatGroupDropTarget.css +27 -0
- package/vscode/src/vs/sessions/browser/parts/media/chatGroupsView.css +60 -0
- package/vscode/src/vs/sessions/browser/parts/media/customViewGridPart.css +108 -0
- package/vscode/src/vs/sessions/browser/parts/media/editorPart.css +210 -0
- package/vscode/src/vs/sessions/browser/parts/media/remoteHostUnavailableEmptyState.css +81 -0
- package/vscode/src/vs/sessions/browser/parts/media/sessionDropTarget.css +31 -0
- package/vscode/src/vs/sessions/browser/parts/media/sessionReadOnlyBanner.css +87 -0
- package/vscode/src/vs/sessions/browser/parts/media/sessionView.css +107 -0
- package/vscode/src/vs/sessions/browser/parts/media/sessionsPart.css +134 -0
- package/vscode/src/vs/sessions/browser/parts/menubar.contribution.d.ts +1 -0
- package/vscode/src/vs/sessions/browser/parts/menubar.contribution.js +79 -0
- package/vscode/src/vs/sessions/browser/parts/mobile/mobileCustomViewGridPart.d.ts +13 -0
- package/vscode/src/vs/sessions/browser/parts/mobile/mobileCustomViewGridPart.js +33 -0
- package/vscode/src/vs/sessions/browser/parts/mobile/mobileSessionsPart.d.ts +14 -0
- package/vscode/src/vs/sessions/browser/parts/mobile/mobileSessionsPart.js +34 -0
- package/vscode/src/vs/sessions/browser/parts/remoteHostUnavailableEmptyState.d.ts +39 -0
- package/vscode/src/vs/sessions/browser/parts/remoteHostUnavailableEmptyState.js +136 -0
- package/vscode/src/vs/sessions/browser/parts/sessionBarStyles.d.ts +9 -0
- package/vscode/src/vs/sessions/browser/parts/sessionBarStyles.js +62 -0
- package/vscode/src/vs/sessions/browser/parts/sessionDropTarget.d.ts +39 -0
- package/vscode/src/vs/sessions/browser/parts/sessionDropTarget.js +261 -0
- package/vscode/src/vs/sessions/browser/parts/sessionHeader.d.ts +97 -0
- package/vscode/src/vs/sessions/browser/parts/sessionHeader.js +345 -0
- package/vscode/src/vs/sessions/browser/parts/sessionReadOnlyBanner.d.ts +43 -0
- package/vscode/src/vs/sessions/browser/parts/sessionReadOnlyBanner.js +69 -0
- package/vscode/src/vs/sessions/browser/parts/sessionRemoteConnection.d.ts +79 -0
- package/vscode/src/vs/sessions/browser/parts/sessionRemoteConnection.js +363 -0
- package/vscode/src/vs/sessions/browser/parts/sessionView.d.ts +125 -0
- package/vscode/src/vs/sessions/browser/parts/sessionView.js +300 -0
- package/vscode/src/vs/sessions/browser/parts/sessionsPart.d.ts +124 -0
- package/vscode/src/vs/sessions/browser/parts/sessionsPart.js +336 -0
- package/vscode/src/vs/sessions/browser/parts/sessionsParts.d.ts +33 -0
- package/vscode/src/vs/sessions/browser/parts/sessionsParts.js +62 -0
- package/vscode/src/vs/sessions/browser/parts/singlePaneAuxiliaryBarPart.d.ts +13 -0
- package/vscode/src/vs/sessions/browser/parts/singlePaneAuxiliaryBarPart.js +36 -0
- package/vscode/src/vs/sessions/browser/parts/singlePaneEditorPart.d.ts +65 -0
- package/vscode/src/vs/sessions/browser/parts/singlePaneEditorPart.js +178 -0
- package/vscode/src/vs/sessions/browser/sessionWorkspace.d.ts +12 -0
- package/vscode/src/vs/sessions/browser/sessionWorkspace.js +19 -0
- package/vscode/src/vs/sessions/browser/sessionsSetUpService.d.ts +24 -0
- package/vscode/src/vs/sessions/browser/sessionsSetUpService.js +598 -0
- package/vscode/src/vs/sessions/browser/sessionsSignInDialog.d.ts +25 -0
- package/vscode/src/vs/sessions/browser/sessionsSignInDialog.js +91 -0
- package/vscode/src/vs/sessions/common/welcome.d.ts +1 -0
- package/vscode/src/vs/sessions/common/welcome.js +5 -0
- package/vscode/src/vs/sessions/contrib/accountMenu/browser/account.contribution.d.ts +11 -0
- package/vscode/src/vs/sessions/contrib/accountMenu/browser/account.contribution.js +1052 -0
- package/vscode/src/vs/sessions/contrib/accountMenu/browser/chatPetAchievementBadges.d.ts +23 -0
- package/vscode/src/vs/sessions/contrib/accountMenu/browser/chatPetAchievementBadges.js +168 -0
- package/vscode/src/vs/sessions/contrib/accountMenu/browser/media/accountTitleBarWidget.css +646 -0
- package/vscode/src/vs/sessions/contrib/accountMenu/browser/media/accountWidget.css +231 -0
- package/vscode/src/vs/sessions/contrib/accountMenu/browser/media/chatPetAchievementBadges.css +120 -0
- package/vscode/src/vs/sessions/contrib/agentFeedback/browser/nullAgentFeedbackService.contribution.d.ts +53 -0
- package/vscode/src/vs/sessions/contrib/agentFeedback/browser/nullAgentFeedbackService.contribution.js +99 -0
- package/vscode/src/vs/sessions/contrib/aiCustomizationTreeView/browser/aiCustomizationTreeView.contribution.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/aiCustomizationTreeView/browser/aiCustomizationTreeView.contribution.js +270 -0
- package/vscode/src/vs/sessions/contrib/aiCustomizationTreeView/browser/aiCustomizationTreeViewViews.d.ts +62 -0
- package/vscode/src/vs/sessions/contrib/aiCustomizationTreeView/browser/aiCustomizationTreeViewViews.js +606 -0
- package/vscode/src/vs/sessions/contrib/aiCustomizationTreeView/browser/media/aiCustomizationTreeView.css +116 -0
- package/vscode/src/vs/sessions/contrib/aquarium/browser/aquarium.contribution.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/aquarium/browser/aquarium.contribution.js +97 -0
- package/vscode/src/vs/sessions/contrib/aquarium/browser/aquariumOverlay.d.ts +72 -0
- package/vscode/src/vs/sessions/contrib/aquarium/browser/aquariumOverlay.js +776 -0
- package/vscode/src/vs/sessions/contrib/aquarium/browser/fish.d.ts +68 -0
- package/vscode/src/vs/sessions/contrib/aquarium/browser/fish.js +153 -0
- package/vscode/src/vs/sessions/contrib/aquarium/browser/fishFeedingStreak.d.ts +58 -0
- package/vscode/src/vs/sessions/contrib/aquarium/browser/fishFeedingStreak.js +172 -0
- package/vscode/src/vs/sessions/contrib/aquarium/browser/media/aquarium.css +316 -0
- package/vscode/src/vs/sessions/contrib/aquarium/browser/vscodeLogoPath.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/aquarium/browser/vscodeLogoPath.js +5 -0
- package/vscode/src/vs/sessions/contrib/automations/browser/automationDialog.d.ts +173 -0
- package/vscode/src/vs/sessions/contrib/automations/browser/automationDialog.js +1589 -0
- package/vscode/src/vs/sessions/contrib/automations/browser/automationDialogService.d.ts +32 -0
- package/vscode/src/vs/sessions/contrib/automations/browser/automationDialogService.js +396 -0
- package/vscode/src/vs/sessions/contrib/automations/browser/automationInputCompletions.d.ts +33 -0
- package/vscode/src/vs/sessions/contrib/automations/browser/automationInputCompletions.js +216 -0
- package/vscode/src/vs/sessions/contrib/automations/browser/automationLeaderElection.d.ts +37 -0
- package/vscode/src/vs/sessions/contrib/automations/browser/automationLeaderElection.js +126 -0
- package/vscode/src/vs/sessions/contrib/automations/browser/automationRunner.d.ts +21 -0
- package/vscode/src/vs/sessions/contrib/automations/browser/automationRunner.js +294 -0
- package/vscode/src/vs/sessions/contrib/automations/browser/automationScheduler.d.ts +59 -0
- package/vscode/src/vs/sessions/contrib/automations/browser/automationScheduler.js +232 -0
- package/vscode/src/vs/sessions/contrib/automations/browser/automationStorageService.d.ts +13 -0
- package/vscode/src/vs/sessions/contrib/automations/browser/automationStorageService.js +22 -0
- package/vscode/src/vs/sessions/contrib/automations/browser/automationTools.d.ts +60 -0
- package/vscode/src/vs/sessions/contrib/automations/browser/automationTools.js +1256 -0
- package/vscode/src/vs/sessions/contrib/automations/browser/automations.contribution.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/automations/browser/automations.contribution.js +88 -0
- package/vscode/src/vs/sessions/contrib/automations/browser/media/automationDialog.css +746 -0
- package/vscode/src/vs/sessions/contrib/automations/browser/providerAutomationService.d.ts +62 -0
- package/vscode/src/vs/sessions/contrib/automations/browser/providerAutomationService.js +493 -0
- package/vscode/src/vs/sessions/contrib/automations/common/isolationGroupModel.d.ts +38 -0
- package/vscode/src/vs/sessions/contrib/automations/common/isolationGroupModel.js +123 -0
- package/vscode/src/vs/sessions/contrib/blockedSessions/browser/blockedSessions.d.ts +45 -0
- package/vscode/src/vs/sessions/contrib/blockedSessions/browser/blockedSessions.js +110 -0
- package/vscode/src/vs/sessions/contrib/browserView/browser/sessionBrowserView.contribution.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/browserView/browser/sessionBrowserView.contribution.js +5 -0
- package/vscode/src/vs/sessions/contrib/browserView/browser/sessionBrowserView.d.ts +31 -0
- package/vscode/src/vs/sessions/contrib/browserView/browser/sessionBrowserView.js +137 -0
- package/vscode/src/vs/sessions/contrib/changes/browser/changes.contribution.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/changes/browser/changes.contribution.js +130 -0
- package/vscode/src/vs/sessions/contrib/changes/browser/changesActions.d.ts +8 -0
- package/vscode/src/vs/sessions/contrib/changes/browser/changesActions.js +385 -0
- package/vscode/src/vs/sessions/contrib/changes/browser/changesMultiDiffSourceResolver.d.ts +28 -0
- package/vscode/src/vs/sessions/contrib/changes/browser/changesMultiDiffSourceResolver.js +76 -0
- package/vscode/src/vs/sessions/contrib/changes/browser/changesViewActions.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/changes/browser/changesViewActions.js +509 -0
- package/vscode/src/vs/sessions/contrib/changes/browser/changesetReviewActions.d.ts +6 -0
- package/vscode/src/vs/sessions/contrib/changes/browser/changesetReviewActions.js +58 -0
- package/vscode/src/vs/sessions/contrib/changes/browser/media/changesActions.css +11 -0
- package/vscode/src/vs/sessions/contrib/changes/browser/sessionSyncChanges.d.ts +24 -0
- package/vscode/src/vs/sessions/contrib/changes/browser/sessionSyncChanges.js +188 -0
- package/vscode/src/vs/sessions/contrib/changes/browser/sessionsChangesAccessibilityHelp.d.ts +15 -0
- package/vscode/src/vs/sessions/contrib/changes/browser/sessionsChangesAccessibilityHelp.js +100 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/chatViewStateService.d.ts +9 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/chatViewStateService.js +18 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/media/sessionChatInputToolbarDebug.css +59 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/sessionChatInputToolbarDebug.d.ts +47 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/sessionChatInputToolbarDebug.js +306 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/sessionTaskRunner.d.ts +41 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/sessionTaskRunner.js +31 -0
- package/vscode/src/vs/sessions/contrib/chatDebug/browser/chatDebug.contribution.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/chatDebug/browser/chatDebug.contribution.js +84 -0
- package/vscode/src/vs/sessions/contrib/customViewTest/browser/customViewTest.contribution.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/customViewTest/browser/customViewTest.contribution.js +111 -0
- package/vscode/src/vs/sessions/contrib/customViewTest/browser/media/customViewTest.css +9 -0
- package/vscode/src/vs/sessions/contrib/editor/browser/addTabActions.d.ts +21 -0
- package/vscode/src/vs/sessions/contrib/editor/browser/addTabActions.js +170 -0
- package/vscode/src/vs/sessions/contrib/editor/browser/editor.contribution.d.ts +14 -0
- package/vscode/src/vs/sessions/contrib/editor/browser/editor.contribution.js +425 -0
- package/vscode/src/vs/sessions/contrib/editor/browser/emptyFileEditor.contribution.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/editor/browser/emptyFileEditor.contribution.js +35 -0
- package/vscode/src/vs/sessions/contrib/editor/browser/emptyFileEditor.d.ts +18 -0
- package/vscode/src/vs/sessions/contrib/editor/browser/emptyFileEditor.js +85 -0
- package/vscode/src/vs/sessions/contrib/editor/browser/emptyFileEditorInput.d.ts +31 -0
- package/vscode/src/vs/sessions/contrib/editor/browser/emptyFileEditorInput.js +125 -0
- package/vscode/src/vs/sessions/contrib/editor/browser/media/editorBreadcrumbs.css +66 -0
- package/vscode/src/vs/sessions/contrib/editor/browser/media/editorHeader.css +113 -0
- package/vscode/src/vs/sessions/contrib/editor/browser/media/emptyFileEditor.css +30 -0
- package/vscode/src/vs/sessions/contrib/fileTreeView/browser/fileTreeView.contribution.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/fileTreeView/browser/fileTreeView.contribution.js +25 -0
- package/vscode/src/vs/sessions/contrib/fileTreeView/browser/githubFileSystemProvider.d.ts +66 -0
- package/vscode/src/vs/sessions/contrib/fileTreeView/browser/githubFileSystemProvider.js +274 -0
- package/vscode/src/vs/sessions/contrib/files/browser/files.contribution.d.ts +6 -0
- package/vscode/src/vs/sessions/contrib/files/browser/files.contribution.js +100 -0
- package/vscode/src/vs/sessions/contrib/files/browser/filesView.d.ts +21 -0
- package/vscode/src/vs/sessions/contrib/files/browser/filesView.js +76 -0
- package/vscode/src/vs/sessions/contrib/files/browser/media/filesView.css +29 -0
- package/vscode/src/vs/sessions/contrib/layout/browser/baseSessionLayoutController.d.ts +211 -0
- package/vscode/src/vs/sessions/contrib/layout/browser/baseSessionLayoutController.js +587 -0
- package/vscode/src/vs/sessions/contrib/layout/browser/desktopSessionLayoutController.d.ts +112 -0
- package/vscode/src/vs/sessions/contrib/layout/browser/desktopSessionLayoutController.js +444 -0
- package/vscode/src/vs/sessions/contrib/layout/browser/mobileSessionLayoutController.d.ts +13 -0
- package/vscode/src/vs/sessions/contrib/layout/browser/mobileSessionLayoutController.js +8 -0
- package/vscode/src/vs/sessions/contrib/layout/browser/sessions.layout.contribution.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/layout/browser/sessions.layout.contribution.js +68 -0
- package/vscode/src/vs/sessions/contrib/layout/browser/singlePane/singlePaneDetailPanelCoordinator.d.ts +32 -0
- package/vscode/src/vs/sessions/contrib/layout/browser/singlePane/singlePaneDetailPanelCoordinator.js +81 -0
- package/vscode/src/vs/sessions/contrib/layout/browser/singlePane/singlePaneDockedTabsCoordinator.d.ts +111 -0
- package/vscode/src/vs/sessions/contrib/layout/browser/singlePane/singlePaneDockedTabsCoordinator.js +513 -0
- package/vscode/src/vs/sessions/contrib/layout/browser/singlePane/singlePaneDraftSessionStrategy.d.ts +44 -0
- package/vscode/src/vs/sessions/contrib/layout/browser/singlePane/singlePaneDraftSessionStrategy.js +423 -0
- package/vscode/src/vs/sessions/contrib/layout/browser/singlePane/singlePaneExistingSessionStrategy.d.ts +62 -0
- package/vscode/src/vs/sessions/contrib/layout/browser/singlePane/singlePaneExistingSessionStrategy.js +435 -0
- package/vscode/src/vs/sessions/contrib/layout/browser/singlePane/singlePaneLayoutStrategy.d.ts +46 -0
- package/vscode/src/vs/sessions/contrib/layout/browser/singlePane/singlePaneLayoutStrategy.js +11 -0
- package/vscode/src/vs/sessions/contrib/layout/browser/singlePane/singlePaneSharedHelpers.d.ts +11 -0
- package/vscode/src/vs/sessions/contrib/layout/browser/singlePane/singlePaneSharedHelpers.js +43 -0
- package/vscode/src/vs/sessions/contrib/layout/browser/singlePane/singlePaneVisibilityProfileStore.d.ts +21 -0
- package/vscode/src/vs/sessions/contrib/layout/browser/singlePane/singlePaneVisibilityProfileStore.js +77 -0
- package/vscode/src/vs/sessions/contrib/layout/browser/singlePaneLayoutController.d.ts +55 -0
- package/vscode/src/vs/sessions/contrib/layout/browser/singlePaneLayoutController.js +91 -0
- package/vscode/src/vs/sessions/contrib/onboardingTours/browser/agentHostReadinessContext.d.ts +11 -0
- package/vscode/src/vs/sessions/contrib/onboardingTours/browser/agentHostReadinessContext.js +39 -0
- package/vscode/src/vs/sessions/contrib/onboardingTours/browser/newSessionTourContribution.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/onboardingTours/browser/newSessionTourContribution.js +109 -0
- package/vscode/src/vs/sessions/contrib/onboardingTours/browser/newSessionViewTourContribution.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/onboardingTours/browser/newSessionViewTourContribution.js +123 -0
- package/vscode/src/vs/sessions/contrib/onboardingTours/browser/newSessionViewTourTrigger.d.ts +24 -0
- package/vscode/src/vs/sessions/contrib/onboardingTours/browser/newSessionViewTourTrigger.js +67 -0
- package/vscode/src/vs/sessions/contrib/onboardingTours/browser/newSessionViewV2TourContribution.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/onboardingTours/browser/newSessionViewV2TourContribution.js +47 -0
- package/vscode/src/vs/sessions/contrib/onboardingTours/browser/newSessionViewV3Prompt.d.ts +79 -0
- package/vscode/src/vs/sessions/contrib/onboardingTours/browser/newSessionViewV3Prompt.js +1277 -0
- package/vscode/src/vs/sessions/contrib/onboardingTours/browser/newSessionViewV3TourContribution.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/onboardingTours/browser/newSessionViewV3TourContribution.js +75 -0
- package/vscode/src/vs/sessions/contrib/onboardingTours/browser/tours/newSessionTour.d.ts +34 -0
- package/vscode/src/vs/sessions/contrib/onboardingTours/browser/tours/newSessionTour.js +53 -0
- package/vscode/src/vs/sessions/contrib/onboardingTours/browser/tours/newSessionViewTour.d.ts +40 -0
- package/vscode/src/vs/sessions/contrib/onboardingTours/browser/tours/newSessionViewTour.js +69 -0
- package/vscode/src/vs/sessions/contrib/onboardingTours/browser/tours/newSessionViewTourShared.d.ts +4 -0
- package/vscode/src/vs/sessions/contrib/onboardingTours/browser/tours/newSessionViewTourShared.js +38 -0
- package/vscode/src/vs/sessions/contrib/onboardingTours/browser/tours/newSessionViewV2Tour.d.ts +6 -0
- package/vscode/src/vs/sessions/contrib/onboardingTours/browser/tours/newSessionViewV2Tour.js +63 -0
- package/vscode/src/vs/sessions/contrib/onboardingTours/browser/tours/newSessionViewV3Tour.d.ts +15 -0
- package/vscode/src/vs/sessions/contrib/onboardingTours/browser/tours/newSessionViewV3Tour.js +49 -0
- package/vscode/src/vs/sessions/contrib/policyBlocked/browser/media/sessionsPolicyBlocked.css +125 -0
- package/vscode/src/vs/sessions/contrib/policyBlocked/browser/policyBlocked.contribution.d.ts +20 -0
- package/vscode/src/vs/sessions/contrib/policyBlocked/browser/policyBlocked.contribution.js +98 -0
- package/vscode/src/vs/sessions/contrib/policyBlocked/browser/sessionsPolicyBlocked.d.ts +39 -0
- package/vscode/src/vs/sessions/contrib/policyBlocked/browser/sessionsPolicyBlocked.js +218 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/devContainerAgentHostService.d.ts +53 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/devContainerAgentHostService.js +496 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/remoteAgentHostConnectionCustomization.d.ts +27 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/remoteAgentHostConnectionCustomization.js +26 -0
- package/vscode/src/vs/sessions/contrib/search/browser/media/searchEditorEmptyState.css +15 -0
- package/vscode/src/vs/sessions/contrib/search/browser/search.contribution.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/search/browser/search.contribution.js +79 -0
- package/vscode/src/vs/sessions/contrib/search/browser/searchEditorEmptyState.contribution.d.ts +7 -0
- package/vscode/src/vs/sessions/contrib/search/browser/searchEditorEmptyState.contribution.js +57 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/blockedSessionsCIFixModel.d.ts +39 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/blockedSessionsCIFixModel.js +155 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/blockedSessionsIndicatorModel.d.ts +117 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/blockedSessionsIndicatorModel.js +320 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/blockedSessionsList.d.ts +65 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/blockedSessionsList.js +129 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/media/automationsCards.css +624 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/media/blockedSessionsList.css +111 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/media/newSessionActionViewItem.css +112 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/media/sessionsTitleBarWidget.css +159 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/sessionActionFeedback.d.ts +26 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/sessionActionFeedback.js +26 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/sessionDetailsAction.d.ts +2 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/sessionDetailsAction.js +77 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/sessions.contribution.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/sessions.contribution.js +162 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsActions.d.ts +111 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsActions.js +1550 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsMouseNavigation.d.ts +13 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsMouseNavigation.js +69 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsPicker.d.ts +10 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsPicker.js +33 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsTelemetry.contribution.d.ts +126 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsTelemetry.contribution.js +724 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsTitleBarWidget.d.ts +150 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsTitleBarWidget.js +526 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsTypedCharactersTracker.d.ts +64 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsTypedCharactersTracker.js +99 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsWindowNotifier.d.ts +37 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsWindowNotifier.js +160 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/views/automationTemplates.d.ts +19 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/views/automationTemplates.js +74 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/views/automationsAccessibility.d.ts +4 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/views/automationsAccessibility.js +228 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/views/automationsView.d.ts +53 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/views/automationsView.js +2143 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/views/sessionsViewActions.d.ts +12 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/views/sessionsViewActions.js +1270 -0
- package/vscode/src/vs/sessions/contrib/workspace/browser/workspace.contribution.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/workspace/browser/workspace.contribution.js +5 -0
- package/vscode/src/vs/sessions/contrib/workspace/browser/workspaceFolderManagement.d.ts +28 -0
- package/vscode/src/vs/sessions/contrib/workspace/browser/workspaceFolderManagement.js +95 -0
- package/vscode/src/vs/sessions/services/agentHostFilter/browser/agentHostFilterService.d.ts +79 -0
- package/vscode/src/vs/sessions/services/agentHostFilter/browser/agentHostFilterService.js +259 -0
- package/vscode/src/vs/sessions/services/customView/browser/customView.d.ts +42 -0
- package/vscode/src/vs/sessions/services/customView/browser/customView.js +15 -0
- package/vscode/src/vs/sessions/services/customView/browser/customViewService.d.ts +21 -0
- package/vscode/src/vs/sessions/services/customView/browser/customViewService.js +68 -0
- package/vscode/src/vs/sessions/services/sessions/browser/closedItemHistory.d.ts +72 -0
- package/vscode/src/vs/sessions/services/sessions/browser/closedItemHistory.js +115 -0
- package/vscode/src/vs/sessions/services/sessions/browser/sessionGroupsService.d.ts +77 -0
- package/vscode/src/vs/sessions/services/sessions/browser/sessionGroupsService.js +330 -0
- package/vscode/src/vs/sessions/services/sessions/browser/sessionNavigation.d.ts +67 -0
- package/vscode/src/vs/sessions/services/sessions/browser/sessionNavigation.js +157 -0
- package/vscode/src/vs/sessions/services/sessions/browser/sessionOpenTelemetryService.d.ts +32 -0
- package/vscode/src/vs/sessions/services/sessions/browser/sessionOpenTelemetryService.js +162 -0
- package/vscode/src/vs/sessions/services/sessions/browser/sessionSectionOrderService.d.ts +40 -0
- package/vscode/src/vs/sessions/services/sessions/browser/sessionSectionOrderService.js +170 -0
- package/vscode/src/vs/sessions/services/sessions/browser/sessionsListModelService.d.ts +63 -0
- package/vscode/src/vs/sessions/services/sessions/browser/sessionsListModelService.js +419 -0
- package/vscode/src/vs/sessions/services/sessions/browser/sessionsManagementService.d.ts +229 -0
- package/vscode/src/vs/sessions/services/sessions/browser/sessionsManagementService.js +1212 -0
- package/vscode/src/vs/sessions/services/sessions/browser/sessionsProvidersService.d.ts +22 -0
- package/vscode/src/vs/sessions/services/sessions/browser/sessionsProvidersService.js +42 -0
- package/vscode/src/vs/sessions/services/sessions/browser/sessionsRecencyHistory.d.ts +43 -0
- package/vscode/src/vs/sessions/services/sessions/browser/sessionsRecencyHistory.js +103 -0
- package/vscode/src/vs/sessions/services/sessions/browser/sessionsService.d.ts +243 -0
- package/vscode/src/vs/sessions/services/sessions/browser/sessionsService.js +1121 -0
- package/vscode/src/vs/sessions/services/sessions/browser/sessionsWindowUsageService.d.ts +8 -0
- package/vscode/src/vs/sessions/services/sessions/browser/sessionsWindowUsageService.js +24 -0
- package/vscode/src/vs/sessions/services/sessions/browser/visibleSessions.d.ts +321 -0
- package/vscode/src/vs/sessions/services/sessions/browser/visibleSessions.js +729 -0
- package/vscode/src/vs/sessions/services/sessions/browser/worktreeTrust.d.ts +23 -0
- package/vscode/src/vs/sessions/services/sessions/browser/worktreeTrust.js +23 -0
- package/vscode/src/vs/sessions/services/sessions/common/sessionContextKeys.d.ts +32 -0
- package/vscode/src/vs/sessions/services/sessions/common/sessionContextKeys.js +103 -0
- package/vscode/src/vs/sessions/services/workspaceFolderLabel/browser/workspaceFolderLabelService.d.ts +16 -0
- package/vscode/src/vs/sessions/services/workspaceFolderLabel/browser/workspaceFolderLabelService.js +41 -0
- package/vscode/src/vs/workbench/browser/layout.js +7 -7
- package/vscode/src/vs/workbench/browser/workbench.js +3 -3
|
@@ -0,0 +1,1589 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { $ as $$1, isEditableElement, addDisposableListener, EventType, clearNode, append, getWindow, hide, DisposableResizeObserver, addStandardDisposableListener, show } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
|
|
4
|
+
import { raceCancellationError, raceTimeout } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
5
|
+
import { BaseActionViewItem } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/actionbar/actionViewItems';
|
|
6
|
+
import { renderIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/iconLabel/iconLabels';
|
|
7
|
+
import { InputBox } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/inputbox/inputBox';
|
|
8
|
+
import { SelectBox } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/selectBox/selectBox';
|
|
9
|
+
import { Checkbox } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/toggle/toggle';
|
|
10
|
+
import { CancellationToken, CancellationTokenSource } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
11
|
+
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
12
|
+
import { Emitter, Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
13
|
+
import { KeyCode } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keyCodes';
|
|
14
|
+
import { DisposableStore, Disposable, MutableDisposable, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
15
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
16
|
+
import { isEqual } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
17
|
+
import { ICodeEditorService } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/codeEditorService.service';
|
|
18
|
+
import { EditorOptions } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/config/editorOptions';
|
|
19
|
+
import { EditorContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/editorContextKeys';
|
|
20
|
+
import { SuggestController } from '@codingame/monaco-vscode-api/vscode/vs/editor/contrib/suggest/browser/suggestController';
|
|
21
|
+
import { Context } from '@codingame/monaco-vscode-api/vscode/vs/editor/contrib/suggest/browser/suggest';
|
|
22
|
+
import { State } from '@codingame/monaco-vscode-api/vscode/vs/editor/contrib/suggest/browser/suggestModel';
|
|
23
|
+
import { localize, localize2 } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
24
|
+
import { registerAction2, Action2, MenuId } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
|
|
25
|
+
import { ActionListItemKind } from '@codingame/monaco-vscode-api/vscode/vs/platform/actionWidget/browser/actionList';
|
|
26
|
+
import { ContextKeyExpr } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey';
|
|
27
|
+
import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
28
|
+
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
29
|
+
import { ServiceCollection } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/serviceCollection';
|
|
30
|
+
import { KeybindingsRegistry, KeybindingWeight } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybindingsRegistry';
|
|
31
|
+
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
32
|
+
import { MenuWorkbenchToolBar, HiddenItemStrategy } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/browser/toolbar';
|
|
33
|
+
import { defaultInputBoxStyles, defaultSelectBoxStyles, defaultCheckboxStyles } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/browser/defaultStyles';
|
|
34
|
+
import { hasNativeContextMenu } from '@codingame/monaco-vscode-api/vscode/vs/platform/window/common/window';
|
|
35
|
+
import { WorkspacePicker } from '@codingame/monaco-vscode-api/vscode/vs/sessions/contrib/chat/browser/sessionWorkspacePicker';
|
|
36
|
+
import { BranchPicker } from '@codingame/monaco-vscode-api/vscode/vs/sessions/contrib/chat/browser/branchPicker';
|
|
37
|
+
import { MobileSessionTypePicker } from '@codingame/monaco-vscode-api/vscode/vs/sessions/contrib/chat/browser/mobile/mobileSessionTypePicker';
|
|
38
|
+
import { isMobilePickerSheetTarget } from '@codingame/monaco-vscode-api/vscode/vs/sessions/browser/parts/mobile/mobilePickerSheet';
|
|
39
|
+
import { SESSION_WORKSPACE_GROUP_LOCAL } from '@codingame/monaco-vscode-api/vscode/vs/sessions/services/sessions/common/session';
|
|
40
|
+
import { IGitService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/git/common/gitService.service';
|
|
41
|
+
import { DAYS_OF_WEEK } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/automations/schedule';
|
|
42
|
+
import { ChatContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/actions/chatContextKeys';
|
|
43
|
+
import { ChatAgentLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
|
|
44
|
+
import { ChatInputPart } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/widget/input/chatInputPart';
|
|
45
|
+
import { ChatInputPickerResponsiveLayout } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/widget/input/chatInputPickerResponsiveLayout';
|
|
46
|
+
import { normalizeAutomationBranchNames, AutomationIsolationModel } from '../common/isolationGroupModel.js';
|
|
47
|
+
import { ISessionsManagementService } from '@codingame/monaco-vscode-api/vscode/vs/sessions/services/sessions/common/sessionsManagement.service';
|
|
48
|
+
import { shouldUseMobileWorkspacePickerSheet, showMobileWorkspacePickerSheet } from '@codingame/monaco-vscode-api/vscode/vs/sessions/contrib/chat/browser/mobile/mobileWorkspacePickerSheet';
|
|
49
|
+
import { AutomationInputCompletions } from './automationInputCompletions.js';
|
|
50
|
+
import { NewChatModelPickerService } from '@codingame/monaco-vscode-api/vscode/vs/sessions/contrib/chat/browser/newChatModelPicker';
|
|
51
|
+
import { INewChatModelPickerService } from '@codingame/monaco-vscode-api/vscode/vs/sessions/contrib/chat/browser/newChatModelPicker.service';
|
|
52
|
+
import { createNewSessionConfigToolbar, createNewSessionControlToolbar } from '@codingame/monaco-vscode-api/vscode/vs/sessions/contrib/chat/browser/newSessionConfigToolbars';
|
|
53
|
+
import { SessionModelSelection } from '@codingame/monaco-vscode-api/vscode/vs/sessions/contrib/chat/browser/sessionModelSelection';
|
|
54
|
+
import { ISessionModelSelection } from '@codingame/monaco-vscode-api/vscode/vs/sessions/contrib/chat/browser/sessionModelSelection.service';
|
|
55
|
+
import { SessionContext } from '@codingame/monaco-vscode-api/vscode/vs/sessions/services/sessions/browser/sessionContext';
|
|
56
|
+
import { ISessionContext } from '@codingame/monaco-vscode-api/vscode/vs/sessions/services/sessions/browser/sessionContext.service';
|
|
57
|
+
import { VisibleSession } from '../../../services/sessions/browser/visibleSessions.js';
|
|
58
|
+
import { setActiveSessionContextKeys } from '../../../services/sessions/common/sessionContextKeys.js';
|
|
59
|
+
import { SessionUsesCombinedConfigPickerContext } from '@codingame/monaco-vscode-api/vscode/vs/sessions/common/contextkeys';
|
|
60
|
+
import { Menus } from '@codingame/monaco-vscode-api/vscode/vs/sessions/browser/menus';
|
|
61
|
+
import { derived } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/derived';
|
|
62
|
+
import { constObservable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/constObservable';
|
|
63
|
+
import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/reactions/autorun';
|
|
64
|
+
import { observableValue, disposableObservableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableValue';
|
|
65
|
+
import { observableSignalFromEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableSignalFromEvent';
|
|
66
|
+
|
|
67
|
+
const $ = $$1;
|
|
68
|
+
const INTERVALS = [{
|
|
69
|
+
value: "manual",
|
|
70
|
+
label: ( localize(3272, "Manual"))
|
|
71
|
+
}, {
|
|
72
|
+
value: "hourly",
|
|
73
|
+
label: ( localize(3273, "Hourly"))
|
|
74
|
+
}, {
|
|
75
|
+
value: "daily",
|
|
76
|
+
label: ( localize(3274, "Daily"))
|
|
77
|
+
}, {
|
|
78
|
+
value: "weekly",
|
|
79
|
+
label: ( localize(3275, "Weekly"))
|
|
80
|
+
}];
|
|
81
|
+
function isAutomationDialogPopupTarget(relatedTarget) {
|
|
82
|
+
return isMobilePickerSheetTarget(relatedTarget) || !!relatedTarget.closest(
|
|
83
|
+
".context-view, .quick-input-widget, .monaco-menu-container, .monaco-hover, .monaco-hover-content, .suggest-widget"
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
function shouldPassThroughAutomationDialogCommand(commandId, target) {
|
|
87
|
+
return commandId === "acceptSelectedSuggestion" || ((commandId === "undo" || commandId === "redo") && isEditableElement(target));
|
|
88
|
+
}
|
|
89
|
+
async function canSelectAutomationWorkspace(
|
|
90
|
+
folderUri,
|
|
91
|
+
preferredProviderId,
|
|
92
|
+
sessionsManagementService,
|
|
93
|
+
workspaceTrustRequestService
|
|
94
|
+
) {
|
|
95
|
+
const resolved = sessionsManagementService.resolveWorkspace(folderUri, preferredProviderId);
|
|
96
|
+
if (!resolved) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
if (!resolved.workspace.requiresWorkspaceTrust) {
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
return !!(await workspaceTrustRequestService.requestResourcesTrust({
|
|
103
|
+
uri: folderUri,
|
|
104
|
+
message: ( localize(
|
|
105
|
+
3276,
|
|
106
|
+
"An agent session will be able to read files, run commands, and make changes in this folder."
|
|
107
|
+
))
|
|
108
|
+
}));
|
|
109
|
+
}
|
|
110
|
+
function registerAutomationDialogKeyboardNavigation(
|
|
111
|
+
targetWindow,
|
|
112
|
+
getFocusableElements,
|
|
113
|
+
isPopupTarget,
|
|
114
|
+
acceptPromptSuggestion = () => false,
|
|
115
|
+
cancelPromptSuggestion = () => false
|
|
116
|
+
) {
|
|
117
|
+
const store = ( new DisposableStore());
|
|
118
|
+
let suppressPopupEscapeKeyUp = false;
|
|
119
|
+
const visibleFocusableElements = () => getFocusableElements().filter(element => {
|
|
120
|
+
if (!element.isConnected || element.tabIndex < 0 || element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true") {
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
for (let current = element; current; current = current.parentElement) {
|
|
124
|
+
if (current.hidden || current.hasAttribute("inert") || current.getAttribute("aria-hidden") === "true") {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
const style = targetWindow.getComputedStyle(current);
|
|
128
|
+
if (style.display === "none" || style.visibility === "hidden") {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return true;
|
|
133
|
+
});
|
|
134
|
+
store.add(addDisposableListener(targetWindow, EventType.KEY_DOWN, event => {
|
|
135
|
+
const target = event.target;
|
|
136
|
+
const isPopup = target instanceof targetWindow.HTMLElement && isPopupTarget(target);
|
|
137
|
+
if (event.key === "Escape" && !event.repeat) {
|
|
138
|
+
const promptSuggestionCancelled = !isPopup && !event.altKey && !event.ctrlKey && !event.metaKey && cancelPromptSuggestion();
|
|
139
|
+
suppressPopupEscapeKeyUp = isPopup || promptSuggestionCancelled;
|
|
140
|
+
if (promptSuggestionCancelled) {
|
|
141
|
+
event.preventDefault();
|
|
142
|
+
event.stopImmediatePropagation();
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if (isPopup) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
if (event.key !== "Tab") {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
if (!event.shiftKey && acceptPromptSuggestion()) {
|
|
153
|
+
event.preventDefault();
|
|
154
|
+
event.stopImmediatePropagation();
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
const focusableElements = visibleFocusableElements();
|
|
158
|
+
if (focusableElements.length === 0) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
const activeElement = targetWindow.document.activeElement;
|
|
162
|
+
let focusedIndex = focusableElements.findIndex(element => element === activeElement);
|
|
163
|
+
if (focusedIndex < 0) {
|
|
164
|
+
focusedIndex = focusableElements.findIndex(element => !!activeElement && element.contains(activeElement));
|
|
165
|
+
}
|
|
166
|
+
if (focusedIndex < 0) {
|
|
167
|
+
focusedIndex = event.shiftKey ? 0 : -1;
|
|
168
|
+
}
|
|
169
|
+
const nextIndex = event.shiftKey ? (focusedIndex - 1 + focusableElements.length) % focusableElements.length : (focusedIndex + 1) % focusableElements.length;
|
|
170
|
+
event.preventDefault();
|
|
171
|
+
event.stopImmediatePropagation();
|
|
172
|
+
focusableElements[nextIndex].focus();
|
|
173
|
+
}, true));
|
|
174
|
+
store.add(addDisposableListener(targetWindow, EventType.KEY_UP, event => {
|
|
175
|
+
if (event.key === "Escape") {
|
|
176
|
+
if (suppressPopupEscapeKeyUp) {
|
|
177
|
+
event.stopImmediatePropagation();
|
|
178
|
+
}
|
|
179
|
+
suppressPopupEscapeKeyUp = false;
|
|
180
|
+
}
|
|
181
|
+
}, true));
|
|
182
|
+
return {
|
|
183
|
+
focusFirst: () => visibleFocusableElements()[0]?.focus(),
|
|
184
|
+
dispose: () => store.dispose()
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
const AUTOMATION_CONFIGURATION_CAPTURE_TIMEOUT_MS = 5_000;
|
|
188
|
+
const AUTOMATION_CONFIGURATION_RETARGET_CAPTURE_TIMEOUT_MS = 1_000;
|
|
189
|
+
class AutomationSessionDraftSynchronizer extends Disposable {
|
|
190
|
+
constructor(
|
|
191
|
+
sessionsManagementService,
|
|
192
|
+
canSelectWorkspace,
|
|
193
|
+
onError,
|
|
194
|
+
configurationCaptureTimeoutMs = AUTOMATION_CONFIGURATION_CAPTURE_TIMEOUT_MS,
|
|
195
|
+
retargetConfigurationCaptureTimeoutMs = AUTOMATION_CONFIGURATION_RETARGET_CAPTURE_TIMEOUT_MS
|
|
196
|
+
) {
|
|
197
|
+
super();
|
|
198
|
+
this.sessionsManagementService = sessionsManagementService;
|
|
199
|
+
this.canSelectWorkspace = canSelectWorkspace;
|
|
200
|
+
this.onError = onError;
|
|
201
|
+
this.configurationCaptureTimeoutMs = configurationCaptureTimeoutMs;
|
|
202
|
+
this.retargetConfigurationCaptureTimeoutMs = retargetConfigurationCaptureTimeoutMs;
|
|
203
|
+
this.availability = observableValue(this, "idle");
|
|
204
|
+
this.configurationsByTarget = ( new Map());
|
|
205
|
+
this.generation = 0;
|
|
206
|
+
this.syncScheduled = false;
|
|
207
|
+
this.syncInProgress = false;
|
|
208
|
+
this.syncPromise = Promise.resolve();
|
|
209
|
+
this.disposed = false;
|
|
210
|
+
}
|
|
211
|
+
update(target) {
|
|
212
|
+
if (this.targetsEqual(this.requestedTarget, target) && (!target || this.syncScheduled || this.syncInProgress || !!this.session && this.sessionsManagementService.automationSession.get()?.sessionId === this.session.sessionId)) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
if (target?.sessionConfiguration) {
|
|
216
|
+
const key = this.targetKey(target);
|
|
217
|
+
if (!( this.configurationsByTarget.has(key))) {
|
|
218
|
+
this.configurationsByTarget.set(key, target.sessionConfiguration);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
this.requestedTarget = target;
|
|
222
|
+
this.generation++;
|
|
223
|
+
this.synchronizationError = undefined;
|
|
224
|
+
this.availability.set(target ? "pending" : "idle", undefined);
|
|
225
|
+
this.scheduleSync();
|
|
226
|
+
}
|
|
227
|
+
async waitForSync(token = CancellationToken.None) {
|
|
228
|
+
let pendingSync;
|
|
229
|
+
do {
|
|
230
|
+
pendingSync = this.syncPromise;
|
|
231
|
+
await raceCancellationError(pendingSync, token);
|
|
232
|
+
} while (pendingSync !== this.syncPromise);
|
|
233
|
+
}
|
|
234
|
+
async getSessionConfiguration(token = CancellationToken.None) {
|
|
235
|
+
const deadline = Date.now() + this.configurationCaptureTimeoutMs;
|
|
236
|
+
while (!this.disposed) {
|
|
237
|
+
const synchronized = await this.waitForResultBeforeDeadline(this.waitForSync(token), deadline, token);
|
|
238
|
+
if (!synchronized) {
|
|
239
|
+
return this.captureFailed(( new Error(
|
|
240
|
+
`Timed out after ${this.configurationCaptureTimeoutMs}ms while synchronizing the Automation session configuration.`
|
|
241
|
+
)));
|
|
242
|
+
}
|
|
243
|
+
const generation = this.generation;
|
|
244
|
+
const session = this.session;
|
|
245
|
+
const target = this.requestedTarget;
|
|
246
|
+
if (!session || !target) {
|
|
247
|
+
if (this.synchronizationError) {
|
|
248
|
+
return {
|
|
249
|
+
kind: "failed",
|
|
250
|
+
error: this.synchronizationError
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
return {
|
|
254
|
+
kind: "preserved",
|
|
255
|
+
configuration: this.configurationForTarget(target)
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
const remaining = deadline - Date.now();
|
|
259
|
+
if (remaining <= 0) {
|
|
260
|
+
return this.captureFailed(( new Error(
|
|
261
|
+
`Timed out after ${this.configurationCaptureTimeoutMs}ms while capturing the Automation session configuration.`
|
|
262
|
+
)));
|
|
263
|
+
}
|
|
264
|
+
const captured = await this.captureSessionConfiguration(session, target, remaining, token);
|
|
265
|
+
if (generation !== this.generation || session !== this.session) {
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
return captured;
|
|
269
|
+
}
|
|
270
|
+
return {
|
|
271
|
+
kind: "preserved",
|
|
272
|
+
configuration: this.configurationForTarget(this.requestedTarget)
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
scheduleSync() {
|
|
276
|
+
this.syncScheduled = true;
|
|
277
|
+
if (this.syncInProgress) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
this.syncInProgress = true;
|
|
281
|
+
this.syncPromise = (async () => {
|
|
282
|
+
try {
|
|
283
|
+
while (this.syncScheduled && !this.disposed) {
|
|
284
|
+
this.syncScheduled = false;
|
|
285
|
+
await this.sync(this.generation);
|
|
286
|
+
}
|
|
287
|
+
} finally {
|
|
288
|
+
this.syncInProgress = false;
|
|
289
|
+
}
|
|
290
|
+
})();
|
|
291
|
+
}
|
|
292
|
+
async sync(generation) {
|
|
293
|
+
const target = this.requestedTarget;
|
|
294
|
+
if (!target) {
|
|
295
|
+
this.discardSession();
|
|
296
|
+
this.availability.set("idle", undefined);
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
if (this.matchesAppliedTarget(target)) {
|
|
300
|
+
this.availability.set("available", undefined);
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
try {
|
|
304
|
+
if (target.kind === "workspace" && !(await this.canSelectWorkspace(target.folderUri, target.providerId))) {
|
|
305
|
+
if (generation === this.generation) {
|
|
306
|
+
this.discardSession();
|
|
307
|
+
this.availability.set("unavailable", undefined);
|
|
308
|
+
}
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
if (this.disposed || generation !== this.generation) {
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
if (this.session && this.appliedTarget) {
|
|
315
|
+
await this.captureSessionConfiguration(
|
|
316
|
+
this.session,
|
|
317
|
+
this.appliedTarget,
|
|
318
|
+
this.retargetConfigurationCaptureTimeoutMs
|
|
319
|
+
);
|
|
320
|
+
if (this.disposed || generation !== this.generation) {
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
const targetAvailable = target.kind === "quickChat" ? this.sessionsManagementService.isQuickChatTargetAvailable({
|
|
325
|
+
providerId: target.providerId,
|
|
326
|
+
sessionTypeId: target.sessionTypeId
|
|
327
|
+
}) : this.sessionsManagementService.isNewSessionTargetAvailable(target.folderUri, {
|
|
328
|
+
providerId: target.providerId,
|
|
329
|
+
sessionTypeId: target.sessionTypeId
|
|
330
|
+
});
|
|
331
|
+
if (!targetAvailable) {
|
|
332
|
+
this.discardSession();
|
|
333
|
+
this.availability.set("unavailable", undefined);
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
const sessionConfiguration = this.configurationForTarget(target);
|
|
337
|
+
this.session = target.kind === "quickChat" ? this.sessionsManagementService.createAutomationQuickChat({
|
|
338
|
+
providerId: target.providerId,
|
|
339
|
+
sessionTypeId: target.sessionTypeId,
|
|
340
|
+
sessionTemplate: sessionConfiguration?.sessionTemplate,
|
|
341
|
+
automationConfiguration: sessionConfiguration
|
|
342
|
+
}) : this.sessionsManagementService.createAutomationSession(target.folderUri, {
|
|
343
|
+
providerId: target.providerId,
|
|
344
|
+
sessionTypeId: target.sessionTypeId,
|
|
345
|
+
sessionTemplate: sessionConfiguration?.sessionTemplate,
|
|
346
|
+
automationConfiguration: sessionConfiguration
|
|
347
|
+
});
|
|
348
|
+
this.appliedTarget = target;
|
|
349
|
+
this.appliedConfiguration = sessionConfiguration;
|
|
350
|
+
this.availability.set(
|
|
351
|
+
this.sessionsManagementService.supportsAutomationSessionConfiguration(this.session) ? "available" : "unavailable",
|
|
352
|
+
undefined
|
|
353
|
+
);
|
|
354
|
+
} catch (error) {
|
|
355
|
+
if (!this.disposed && generation === this.generation) {
|
|
356
|
+
this.synchronizationError = error;
|
|
357
|
+
this.discardSession();
|
|
358
|
+
this.availability.set("unavailable", undefined);
|
|
359
|
+
this.onError(error);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
matchesAppliedTarget(target) {
|
|
364
|
+
if (!this.session || !this.appliedTarget || this.sessionsManagementService.automationSession.get()?.sessionId !== this.session.sessionId || this.appliedTarget.kind !== target.kind || this.appliedTarget.providerId !== target.providerId || this.appliedTarget.sessionTypeId !== target.sessionTypeId || this.appliedConfiguration !== this.configurationForTarget(target)) {
|
|
365
|
+
return false;
|
|
366
|
+
}
|
|
367
|
+
return target.kind === "quickChat" || (this.appliedTarget.kind === "workspace" && isEqual(this.appliedTarget.folderUri, target.folderUri));
|
|
368
|
+
}
|
|
369
|
+
discardSession() {
|
|
370
|
+
if (this.session) {
|
|
371
|
+
this.sessionsManagementService.discardAutomationSession(this.session);
|
|
372
|
+
}
|
|
373
|
+
this.session = undefined;
|
|
374
|
+
this.appliedTarget = undefined;
|
|
375
|
+
this.appliedConfiguration = undefined;
|
|
376
|
+
}
|
|
377
|
+
async captureSessionConfiguration(session, target, timeoutMs, token = CancellationToken.None) {
|
|
378
|
+
try {
|
|
379
|
+
const result = await raceTimeout(raceCancellationError(
|
|
380
|
+
this.sessionsManagementService.getAutomationSessionConfiguration(session).then(configuration => ({
|
|
381
|
+
configuration
|
|
382
|
+
})),
|
|
383
|
+
token
|
|
384
|
+
), timeoutMs);
|
|
385
|
+
if (!result) {
|
|
386
|
+
throw ( new Error(
|
|
387
|
+
`Timed out after ${timeoutMs}ms while capturing Automation session configuration.`
|
|
388
|
+
));
|
|
389
|
+
}
|
|
390
|
+
if (result.configuration === null) {
|
|
391
|
+
return {
|
|
392
|
+
kind: "preserved",
|
|
393
|
+
configuration: this.configurationForTarget(target)
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
if (result.configuration === undefined) {
|
|
397
|
+
throw ( new Error(
|
|
398
|
+
"The Automation session draft was replaced before its configuration could be captured."
|
|
399
|
+
));
|
|
400
|
+
}
|
|
401
|
+
this.configurationsByTarget.set(this.targetKey(target), result.configuration);
|
|
402
|
+
return {
|
|
403
|
+
kind: "captured",
|
|
404
|
+
configuration: result.configuration
|
|
405
|
+
};
|
|
406
|
+
} catch (error) {
|
|
407
|
+
if (token.isCancellationRequested) {
|
|
408
|
+
throw error;
|
|
409
|
+
}
|
|
410
|
+
return this.captureFailed(error);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
captureFailed(error) {
|
|
414
|
+
this.onError(error);
|
|
415
|
+
return {
|
|
416
|
+
kind: "failed",
|
|
417
|
+
error
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
async waitForResultBeforeDeadline(promise, deadline, token) {
|
|
421
|
+
const remaining = deadline - Date.now();
|
|
422
|
+
if (remaining <= 0) {
|
|
423
|
+
return false;
|
|
424
|
+
}
|
|
425
|
+
return (await raceTimeout(raceCancellationError(promise.then(() => true), token), remaining)) ?? false;
|
|
426
|
+
}
|
|
427
|
+
configurationForTarget(target) {
|
|
428
|
+
return target ? this.configurationsByTarget.get(this.targetKey(target)) ?? target.sessionConfiguration : undefined;
|
|
429
|
+
}
|
|
430
|
+
targetsEqual(first, second) {
|
|
431
|
+
if (first === second) {
|
|
432
|
+
return true;
|
|
433
|
+
}
|
|
434
|
+
if (!first || !second || first.kind !== second.kind || first.providerId !== second.providerId || first.sessionTypeId !== second.sessionTypeId || first.sessionConfiguration !== second.sessionConfiguration) {
|
|
435
|
+
return false;
|
|
436
|
+
}
|
|
437
|
+
return first.kind === "quickChat" || (second.kind === "workspace" && isEqual(first.folderUri, second.folderUri));
|
|
438
|
+
}
|
|
439
|
+
targetKey(target) {
|
|
440
|
+
return target.kind === "quickChat" ? `quickChat:${target.providerId}:${target.sessionTypeId}` : `workspace:${( target.folderUri.toString())}:${target.providerId ?? ""}:${target.sessionTypeId}`;
|
|
441
|
+
}
|
|
442
|
+
dispose() {
|
|
443
|
+
this.disposed = true;
|
|
444
|
+
this.generation++;
|
|
445
|
+
this.discardSession();
|
|
446
|
+
super.dispose();
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
const AUTOMATIONS_HARNESS_CHIP_ACTION_ID = "workbench.action.chat.renderAutomationsHarnessChip";
|
|
450
|
+
const AUTOMATIONS_WORKSPACE_PICKER_ACTION_ID = "workbench.action.chat.renderAutomationsWorkspacePicker";
|
|
451
|
+
const AUTOMATIONS_ISOLATION_GROUP_ACTION_ID = "workbench.action.chat.renderAutomationsIsolationGroup";
|
|
452
|
+
function setAutomationControlVisible(container, visible) {
|
|
453
|
+
container.style.display = visible ? "" : "none";
|
|
454
|
+
if (visible) {
|
|
455
|
+
container.removeAttribute("aria-hidden");
|
|
456
|
+
} else {
|
|
457
|
+
container.setAttribute("aria-hidden", "true");
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
function getAutomationToolbarResponsiveItems(toolbar, options = {}) {
|
|
461
|
+
const items = [];
|
|
462
|
+
for (let index = 0; index < toolbar.getItemsLength(); index++) {
|
|
463
|
+
const element = toolbar.getItemElement(index);
|
|
464
|
+
const action = toolbar.getItemAction(index);
|
|
465
|
+
if (!element || !action) {
|
|
466
|
+
continue;
|
|
467
|
+
}
|
|
468
|
+
items.push({
|
|
469
|
+
element,
|
|
470
|
+
canShrink: options.canShrink ?? true,
|
|
471
|
+
isCompact: () => element.classList.contains("compact-picker"),
|
|
472
|
+
setCompact: compact => {
|
|
473
|
+
element.classList.toggle("compact-picker", compact);
|
|
474
|
+
if (action.id === "sessions.modelPicker") {
|
|
475
|
+
options.compactModelPicker?.set(compact, undefined);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
return items;
|
|
481
|
+
}
|
|
482
|
+
let AutomationIsolationGroupActionViewItem = class AutomationIsolationGroupActionViewItem extends BaseActionViewItem {
|
|
483
|
+
constructor(
|
|
484
|
+
action,
|
|
485
|
+
state,
|
|
486
|
+
isolationModel,
|
|
487
|
+
workspaceFolder,
|
|
488
|
+
onDidChangeTarget,
|
|
489
|
+
revalidate,
|
|
490
|
+
options,
|
|
491
|
+
visible,
|
|
492
|
+
gitService,
|
|
493
|
+
sessionsManagementService,
|
|
494
|
+
pickerLogService,
|
|
495
|
+
instantiationService
|
|
496
|
+
) {
|
|
497
|
+
super(undefined, action, options);
|
|
498
|
+
this.state = state;
|
|
499
|
+
this.isolationModel = isolationModel;
|
|
500
|
+
this.workspaceFolder = workspaceFolder;
|
|
501
|
+
this.onDidChangeTarget = onDidChangeTarget;
|
|
502
|
+
this.revalidate = revalidate;
|
|
503
|
+
this.visible = visible;
|
|
504
|
+
this.gitService = gitService;
|
|
505
|
+
this.sessionsManagementService = sessionsManagementService;
|
|
506
|
+
this.pickerLogService = pickerLogService;
|
|
507
|
+
this.renderDisposables = this._register(( new DisposableStore()));
|
|
508
|
+
this.branchRepoDisposable = this._register(( new MutableDisposable()));
|
|
509
|
+
this.branchRequest = this._register(( new MutableDisposable()));
|
|
510
|
+
this.branchRequestId = 0;
|
|
511
|
+
this.branchLoadState = "noFolder";
|
|
512
|
+
this.branches = [];
|
|
513
|
+
this.worktreeCapabilityResolved = false;
|
|
514
|
+
this.branchPicker = this._register(instantiationService.createInstance(BranchPicker, {
|
|
515
|
+
user: "automationBranchPicker",
|
|
516
|
+
slotClassName: "automation-form-branch-picker-slot",
|
|
517
|
+
triggerClassName: "automation-form-branch-slot",
|
|
518
|
+
labelClassName: "automation-form-branch-name",
|
|
519
|
+
descriptionClassName: "automation-form-branch-description",
|
|
520
|
+
keepDisabledFocusable: true,
|
|
521
|
+
renderDisabledAsStatic: true,
|
|
522
|
+
ariaLive: "polite",
|
|
523
|
+
onSelectBranch: branch => {
|
|
524
|
+
this.isolationModel.selectBranch(branch);
|
|
525
|
+
this.renderBranchControl();
|
|
526
|
+
},
|
|
527
|
+
onRetry: () => {
|
|
528
|
+
void this.reloadRepository(this.isolationModel.folderUri);
|
|
529
|
+
},
|
|
530
|
+
isolation: {
|
|
531
|
+
label: ( localize(3277, "New Worktree")),
|
|
532
|
+
ariaLabel: ( localize(3278, "Worktree isolation")),
|
|
533
|
+
onToggle: checked => {
|
|
534
|
+
this.isolationModel.selectIsolationMode(checked ? "worktree" : "workspace");
|
|
535
|
+
this.renderBranchControl();
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}));
|
|
539
|
+
}
|
|
540
|
+
render(container) {
|
|
541
|
+
this.renderDisposables.clear();
|
|
542
|
+
this.branchRepoDisposable.clear();
|
|
543
|
+
this.cancelBranchRequest();
|
|
544
|
+
clearNode(container);
|
|
545
|
+
container.style.marginLeft = "auto";
|
|
546
|
+
const visible = this.visible;
|
|
547
|
+
if (visible) {
|
|
548
|
+
this.renderDisposables.add(autorun(reader => {
|
|
549
|
+
setAutomationControlVisible(container, visible.read(reader));
|
|
550
|
+
}));
|
|
551
|
+
}
|
|
552
|
+
const isolationGroup = append(container, $("span.automation-form-isolation-group"));
|
|
553
|
+
this.branchPicker.render(isolationGroup);
|
|
554
|
+
this.refreshTargetCapability();
|
|
555
|
+
this.renderBranchControl();
|
|
556
|
+
this.renderDisposables.add(autorun(reader => {
|
|
557
|
+
const folderUri = this.workspaceFolder.read(reader);
|
|
558
|
+
this.refreshTargetAndRender();
|
|
559
|
+
void this.reloadRepository(folderUri);
|
|
560
|
+
}));
|
|
561
|
+
this.renderDisposables.add(this.onDidChangeTarget(() => {
|
|
562
|
+
this.refreshTargetAndRender();
|
|
563
|
+
}));
|
|
564
|
+
this.renderDisposables.add(
|
|
565
|
+
this.sessionsManagementService.onDidChangeSessionTypes(() => this.refreshTargetAndRender())
|
|
566
|
+
);
|
|
567
|
+
this.renderDisposables.add({
|
|
568
|
+
dispose: () => {
|
|
569
|
+
this.cancelBranchRequest();
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
showPicker(anchor) {
|
|
574
|
+
this.branchPicker.showPicker(anchor);
|
|
575
|
+
}
|
|
576
|
+
refreshTargetCapability() {
|
|
577
|
+
const folderUri = this.isolationModel.folderUri;
|
|
578
|
+
const sessionTypeId = this.state.sessionTypeId;
|
|
579
|
+
if (!folderUri || !sessionTypeId) {
|
|
580
|
+
this.worktreeCapabilityResolved = false;
|
|
581
|
+
this.isolationModel.setSupportsWorktreeConfiguration(false);
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
const sessionType = this.sessionsManagementService.getSessionTypesForFolder(folderUri).find(
|
|
585
|
+
candidate => candidate.sessionType.id === sessionTypeId && (this.state.providerId === undefined || candidate.providerId === this.state.providerId)
|
|
586
|
+
)?.sessionType;
|
|
587
|
+
if (!sessionType) {
|
|
588
|
+
this.worktreeCapabilityResolved = false;
|
|
589
|
+
this.isolationModel.setSupportsWorktreeConfiguration(false);
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
this.worktreeCapabilityResolved = true;
|
|
593
|
+
const supportsWorktreeConfiguration = sessionType.supportsWorktreeConfiguration === true;
|
|
594
|
+
this.isolationModel.setSupportsWorktreeConfiguration(supportsWorktreeConfiguration);
|
|
595
|
+
if (!supportsWorktreeConfiguration && this.isolationModel.isolationMode === "worktree") {
|
|
596
|
+
this.isolationModel.selectIsolationMode("workspace");
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
refreshTargetAndRender() {
|
|
600
|
+
this.refreshTargetCapability();
|
|
601
|
+
this.renderBranchControl();
|
|
602
|
+
}
|
|
603
|
+
renderBranchControl() {
|
|
604
|
+
const presentation = this.getBranchPresentation();
|
|
605
|
+
const canOpen = this.canOpenBranchPicker();
|
|
606
|
+
const selectedBranch = this.isolationModel.selectedBranch ?? this.isolationModel.headBranch;
|
|
607
|
+
const branches = this.branches.map(branch => ({
|
|
608
|
+
name: branch,
|
|
609
|
+
selected: branch === selectedBranch
|
|
610
|
+
}));
|
|
611
|
+
if (selectedBranch && !this.branches.includes(selectedBranch)) {
|
|
612
|
+
branches.unshift({
|
|
613
|
+
name: selectedBranch,
|
|
614
|
+
selected: true,
|
|
615
|
+
unavailable: true
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
const worktreeUnavailableReason = this.getWorktreeUnavailableReason();
|
|
619
|
+
const isolationState = worktreeUnavailableReason === undefined ? "enabled" : "disabled";
|
|
620
|
+
this.branchPicker.update({
|
|
621
|
+
label: presentation.label,
|
|
622
|
+
branches,
|
|
623
|
+
status: this.branchLoadState === "loadingRepository" || this.branchLoadState === "loadingBranches" ? "loading" : this.branchLoadState === "error" ? "error" : this.branchLoadState === "ready" ? "ready" : "empty",
|
|
624
|
+
canOpen,
|
|
625
|
+
disabledReason: presentation.reason,
|
|
626
|
+
missing: presentation.missing,
|
|
627
|
+
showChevron: this.isolationModel.branchPickerAvailable || this.branchLoadState === "error",
|
|
628
|
+
isolation: {
|
|
629
|
+
checked: this.isolationModel.isolationMode === "worktree",
|
|
630
|
+
state: isolationState,
|
|
631
|
+
disabledReason: worktreeUnavailableReason
|
|
632
|
+
}
|
|
633
|
+
});
|
|
634
|
+
this.revalidate();
|
|
635
|
+
}
|
|
636
|
+
getBranchPresentation() {
|
|
637
|
+
const displayBranch = this.isolationModel.displayBranch;
|
|
638
|
+
if (!this.isolationModel.folderUri) {
|
|
639
|
+
return {
|
|
640
|
+
label: ( localize(3279, "—")),
|
|
641
|
+
reason: ( localize(3280, "Select a folder to determine its Git branch.")),
|
|
642
|
+
missing: true
|
|
643
|
+
};
|
|
644
|
+
}
|
|
645
|
+
if (!this.worktreeCapabilityResolved) {
|
|
646
|
+
return {
|
|
647
|
+
label: displayBranch ?? ( localize(3279, "—")),
|
|
648
|
+
reason: ( localize(3281, "Session capabilities are loading.")),
|
|
649
|
+
missing: !displayBranch
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
if (!this.isolationModel.supportsWorktreeConfiguration) {
|
|
653
|
+
return {
|
|
654
|
+
label: displayBranch ?? ( localize(3279, "—")),
|
|
655
|
+
reason: ( localize(
|
|
656
|
+
3282,
|
|
657
|
+
"The selected session type does not support Worktree branch configuration."
|
|
658
|
+
)),
|
|
659
|
+
missing: !displayBranch
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
if (this.branchLoadState === "error") {
|
|
663
|
+
return {
|
|
664
|
+
label: displayBranch ?? ( localize(3283, "Unable to load branches")),
|
|
665
|
+
reason: ( localize(3284, "Open the branch picker to retry loading local branches.")),
|
|
666
|
+
missing: !displayBranch
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
if (this.isolationModel.isolationMode !== "worktree") {
|
|
670
|
+
return {
|
|
671
|
+
label: displayBranch ?? this.detachedCommit ?? ( localize(3279, "—")),
|
|
672
|
+
reason: ( localize(3285, "Select Worktree to choose a branch.")),
|
|
673
|
+
missing: !displayBranch && !this.detachedCommit
|
|
674
|
+
};
|
|
675
|
+
}
|
|
676
|
+
switch (this.branchLoadState) {
|
|
677
|
+
case "loadingRepository":
|
|
678
|
+
case "loadingBranches":
|
|
679
|
+
return {
|
|
680
|
+
label: displayBranch ?? ( localize(3286, "Loading branches…")),
|
|
681
|
+
reason: ( localize(3287, "Local branches are loading.")),
|
|
682
|
+
missing: !displayBranch
|
|
683
|
+
};
|
|
684
|
+
case "noRepository":
|
|
685
|
+
return {
|
|
686
|
+
label: displayBranch ?? ( localize(3288, "no git repo")),
|
|
687
|
+
reason: ( localize(3289, "No Git repository was found for the selected folder.")),
|
|
688
|
+
missing: !displayBranch
|
|
689
|
+
};
|
|
690
|
+
case "empty":
|
|
691
|
+
return {
|
|
692
|
+
label: displayBranch ?? ( localize(3290, "No local branches")),
|
|
693
|
+
reason: ( localize(3291, "No local branches were found in this repository.")),
|
|
694
|
+
missing: !displayBranch
|
|
695
|
+
};
|
|
696
|
+
case "ready":
|
|
697
|
+
return {
|
|
698
|
+
label: displayBranch ?? ( localize(3292, "Select branch")),
|
|
699
|
+
reason: ( localize(3293, "Choose the local branch to use as the Worktree base.")),
|
|
700
|
+
missing: !displayBranch
|
|
701
|
+
};
|
|
702
|
+
case "noFolder":
|
|
703
|
+
return {
|
|
704
|
+
label: ( localize(3279, "—")),
|
|
705
|
+
reason: ( localize(3280, "Select a folder to determine its Git branch.")),
|
|
706
|
+
missing: true
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
canOpenBranchPicker() {
|
|
711
|
+
if (this.branchLoadState === "error") {
|
|
712
|
+
return !!this.isolationModel.folderUri && this.worktreeCapabilityResolved && this.isolationModel.supportsWorktreeConfiguration;
|
|
713
|
+
}
|
|
714
|
+
return this.isolationModel.branchPickerAvailable && this.branchLoadState !== "noFolder" && this.branchLoadState !== "noRepository" && this.branchLoadState !== "loadingRepository" && this.branchLoadState !== "loadingBranches";
|
|
715
|
+
}
|
|
716
|
+
getWorktreeUnavailableReason() {
|
|
717
|
+
if (!this.isolationModel.folderUri) {
|
|
718
|
+
return localize(3294, "Select a folder to use Worktree isolation.");
|
|
719
|
+
}
|
|
720
|
+
if (!this.worktreeCapabilityResolved) {
|
|
721
|
+
return localize(3281, "Session capabilities are loading.");
|
|
722
|
+
}
|
|
723
|
+
if (!this.isolationModel.supportsWorktreeConfiguration) {
|
|
724
|
+
return localize(3295, "Not supported by the selected session type");
|
|
725
|
+
}
|
|
726
|
+
if (this.isolationModel.selectedBranch) {
|
|
727
|
+
return undefined;
|
|
728
|
+
}
|
|
729
|
+
switch (this.branchLoadState) {
|
|
730
|
+
case "loadingRepository":
|
|
731
|
+
case "loadingBranches":
|
|
732
|
+
return localize(3287, "Local branches are loading.");
|
|
733
|
+
case "noRepository":
|
|
734
|
+
return localize(3289, "No Git repository was found for the selected folder.");
|
|
735
|
+
case "error":
|
|
736
|
+
return localize(3284, "Open the branch picker to retry loading local branches.");
|
|
737
|
+
case "empty":
|
|
738
|
+
return localize(3291, "No local branches were found in this repository.");
|
|
739
|
+
case "ready":
|
|
740
|
+
return this.branches.length > 0 ? undefined : ( localize(3291, "No local branches were found in this repository."));
|
|
741
|
+
case "noFolder":
|
|
742
|
+
return localize(3294, "Select a folder to use Worktree isolation.");
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
cancelBranchRequest() {
|
|
746
|
+
this.branchRequest.value?.cancel();
|
|
747
|
+
this.branchRequest.clear();
|
|
748
|
+
}
|
|
749
|
+
async reloadRepository(folder) {
|
|
750
|
+
const requestId = ++this.branchRequestId;
|
|
751
|
+
this.cancelBranchRequest();
|
|
752
|
+
this.branchRepoDisposable.clear();
|
|
753
|
+
this.repository = undefined;
|
|
754
|
+
this.branches = [];
|
|
755
|
+
this.detachedCommit = undefined;
|
|
756
|
+
if (!folder) {
|
|
757
|
+
this.branchLoadState = "noFolder";
|
|
758
|
+
this.isolationModel.setHeadBranch(undefined);
|
|
759
|
+
this.renderBranchControl();
|
|
760
|
+
return;
|
|
761
|
+
}
|
|
762
|
+
this.branchLoadState = "loadingRepository";
|
|
763
|
+
this.renderBranchControl();
|
|
764
|
+
const cts = ( new CancellationTokenSource());
|
|
765
|
+
this.branchRequest.value = cts;
|
|
766
|
+
let repo;
|
|
767
|
+
try {
|
|
768
|
+
repo = await this.gitService.openRepository(folder);
|
|
769
|
+
} catch (error) {
|
|
770
|
+
if (requestId !== this.branchRequestId || cts.token.isCancellationRequested) {
|
|
771
|
+
return;
|
|
772
|
+
}
|
|
773
|
+
this.pickerLogService.error(
|
|
774
|
+
"[AutomationDialog] Failed to open Git repository for branch selection.",
|
|
775
|
+
error
|
|
776
|
+
);
|
|
777
|
+
this.branchLoadState = "error";
|
|
778
|
+
this.renderBranchControl();
|
|
779
|
+
return;
|
|
780
|
+
}
|
|
781
|
+
if (requestId !== this.branchRequestId || cts.token.isCancellationRequested) {
|
|
782
|
+
return;
|
|
783
|
+
}
|
|
784
|
+
if (!repo) {
|
|
785
|
+
this.branchLoadState = "noRepository";
|
|
786
|
+
this.renderBranchControl();
|
|
787
|
+
return;
|
|
788
|
+
}
|
|
789
|
+
this.repository = repo;
|
|
790
|
+
const watcher = ( new DisposableStore());
|
|
791
|
+
watcher.add(autorun(reader => {
|
|
792
|
+
const head = repo.state.read(reader).HEAD;
|
|
793
|
+
if (head?.commit && head.name) {
|
|
794
|
+
this.detachedCommit = undefined;
|
|
795
|
+
this.isolationModel.setHeadBranch(head.name);
|
|
796
|
+
} else if (head?.commit) {
|
|
797
|
+
this.detachedCommit = ( localize(3296, "({0})", head.commit.slice(0, 7)));
|
|
798
|
+
this.isolationModel.setHeadBranch(undefined);
|
|
799
|
+
} else {
|
|
800
|
+
this.detachedCommit = undefined;
|
|
801
|
+
this.isolationModel.setHeadBranch(undefined);
|
|
802
|
+
}
|
|
803
|
+
this.renderBranchControl();
|
|
804
|
+
}));
|
|
805
|
+
this.branchRepoDisposable.value = watcher;
|
|
806
|
+
this.branchLoadState = "loadingBranches";
|
|
807
|
+
this.renderBranchControl();
|
|
808
|
+
try {
|
|
809
|
+
const refs = await repo.getRefs({
|
|
810
|
+
pattern: "refs/heads"
|
|
811
|
+
}, cts.token);
|
|
812
|
+
if (requestId !== this.branchRequestId || cts.token.isCancellationRequested || this.repository !== repo) {
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
815
|
+
this.branches = normalizeAutomationBranchNames(refs.map(ref => ref.name));
|
|
816
|
+
this.branchLoadState = this.branches.length > 0 ? "ready" : "empty";
|
|
817
|
+
} catch (error) {
|
|
818
|
+
if (requestId !== this.branchRequestId || cts.token.isCancellationRequested) {
|
|
819
|
+
return;
|
|
820
|
+
}
|
|
821
|
+
this.pickerLogService.error("[AutomationDialog] Failed to load local branches.", error);
|
|
822
|
+
this.branchLoadState = "error";
|
|
823
|
+
}
|
|
824
|
+
this.renderBranchControl();
|
|
825
|
+
}
|
|
826
|
+
};
|
|
827
|
+
AutomationIsolationGroupActionViewItem = ( __decorate([( __param(8, IGitService)), ( __param(9, ISessionsManagementService)), ( __param(10, ILogService)), ( __param(11, IInstantiationService))], AutomationIsolationGroupActionViewItem));
|
|
828
|
+
class AutomationPickerActionViewItem extends BaseActionViewItem {
|
|
829
|
+
constructor(action, renderPicker, visible, options) {
|
|
830
|
+
super(undefined, action, options);
|
|
831
|
+
this.renderPicker = renderPicker;
|
|
832
|
+
this.visible = visible;
|
|
833
|
+
this.visibilityWatch = this._register(( new MutableDisposable()));
|
|
834
|
+
}
|
|
835
|
+
render(container) {
|
|
836
|
+
super.render(container);
|
|
837
|
+
clearNode(container);
|
|
838
|
+
this.renderPicker(container);
|
|
839
|
+
const visible = this.visible;
|
|
840
|
+
this.visibilityWatch.value = visible ? autorun(reader => {
|
|
841
|
+
setAutomationControlVisible(container, visible.read(reader));
|
|
842
|
+
}) : undefined;
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
registerAction2(class OpenAutomationsHarnessChipAction extends Action2 {
|
|
846
|
+
constructor() {
|
|
847
|
+
super({
|
|
848
|
+
id: AUTOMATIONS_HARNESS_CHIP_ACTION_ID,
|
|
849
|
+
title: ( localize2(3297, "Automations Harness Chip")),
|
|
850
|
+
f1: false,
|
|
851
|
+
precondition: ChatContextKeys.enabled,
|
|
852
|
+
menu: [{
|
|
853
|
+
id: Menus.AutomationsDialogTargetToolbar,
|
|
854
|
+
group: "navigation",
|
|
855
|
+
order: -1,
|
|
856
|
+
when: ChatContextKeys.inAutomationsDialog
|
|
857
|
+
}]
|
|
858
|
+
});
|
|
859
|
+
}
|
|
860
|
+
async run() {}
|
|
861
|
+
});
|
|
862
|
+
registerAction2(class OpenAutomationsWorkspacePickerAction extends Action2 {
|
|
863
|
+
constructor() {
|
|
864
|
+
super({
|
|
865
|
+
id: AUTOMATIONS_WORKSPACE_PICKER_ACTION_ID,
|
|
866
|
+
title: ( localize2(3298, "Automations Workspace Picker")),
|
|
867
|
+
f1: false,
|
|
868
|
+
precondition: ChatContextKeys.enabled,
|
|
869
|
+
menu: [{
|
|
870
|
+
id: Menus.AutomationsDialogTargetToolbar,
|
|
871
|
+
group: "navigation",
|
|
872
|
+
order: -2,
|
|
873
|
+
when: ChatContextKeys.inAutomationsDialog
|
|
874
|
+
}]
|
|
875
|
+
});
|
|
876
|
+
}
|
|
877
|
+
async run() {}
|
|
878
|
+
});
|
|
879
|
+
registerAction2(class OpenAutomationsIsolationGroupAction extends Action2 {
|
|
880
|
+
constructor() {
|
|
881
|
+
super({
|
|
882
|
+
id: AUTOMATIONS_ISOLATION_GROUP_ACTION_ID,
|
|
883
|
+
title: ( localize2(3299, "Automations Isolation Group")),
|
|
884
|
+
f1: false,
|
|
885
|
+
precondition: ChatContextKeys.enabled,
|
|
886
|
+
menu: [{
|
|
887
|
+
id: Menus.AutomationsDialogTargetToolbar,
|
|
888
|
+
group: "navigation",
|
|
889
|
+
order: 2,
|
|
890
|
+
when: ChatContextKeys.inAutomationsDialog
|
|
891
|
+
}]
|
|
892
|
+
});
|
|
893
|
+
}
|
|
894
|
+
async run() {}
|
|
895
|
+
});
|
|
896
|
+
function renderForm(
|
|
897
|
+
form,
|
|
898
|
+
state,
|
|
899
|
+
disposables,
|
|
900
|
+
validation,
|
|
901
|
+
revalidate,
|
|
902
|
+
instantiationService,
|
|
903
|
+
contextKeyService,
|
|
904
|
+
contextViewService,
|
|
905
|
+
configurationService,
|
|
906
|
+
layoutService,
|
|
907
|
+
logService,
|
|
908
|
+
sessionsManagementService,
|
|
909
|
+
workspaceTrustRequestService,
|
|
910
|
+
initialPrompt,
|
|
911
|
+
initialTarget,
|
|
912
|
+
initialSessionConfiguration
|
|
913
|
+
) {
|
|
914
|
+
const formContent = append(form, $(".automation-form-content"));
|
|
915
|
+
const nameRow = append(formContent, $(".automation-form-row"));
|
|
916
|
+
append(nameRow, $("span.automation-form-label", undefined, ( localize(3300, "Name"))));
|
|
917
|
+
const nameInputContainer = append(nameRow, $(".automation-form-input-host"));
|
|
918
|
+
const nameInput = disposables.add(( new InputBox(nameInputContainer, contextViewService, {
|
|
919
|
+
inputBoxStyles: defaultInputBoxStyles,
|
|
920
|
+
placeholder: ( localize(3301, "e.g. Morning standup notes")),
|
|
921
|
+
ariaLabel: ( localize(3300, "Name"))
|
|
922
|
+
})));
|
|
923
|
+
nameInput.value = state.name;
|
|
924
|
+
disposables.add(nameInput.onDidChange(value => {
|
|
925
|
+
state.name = value;
|
|
926
|
+
revalidate();
|
|
927
|
+
}));
|
|
928
|
+
const scheduleRow = append(formContent, $(".automation-form-row.automation-form-schedule-row"));
|
|
929
|
+
const useCustomDrawn = !hasNativeContextMenu(configurationService);
|
|
930
|
+
const intervalGroup = append(scheduleRow, $(".automation-form-schedule-group"));
|
|
931
|
+
append(intervalGroup, $("span.automation-form-label", undefined, ( localize(3302, "Schedule"))));
|
|
932
|
+
const intervalOptions = INTERVALS.map(item => ({
|
|
933
|
+
text: item.label
|
|
934
|
+
}));
|
|
935
|
+
const intervalIndex = Math.max(0, INTERVALS.findIndex(item => item.value === state.interval));
|
|
936
|
+
const intervalSelect = disposables.add(( new SelectBox(
|
|
937
|
+
intervalOptions,
|
|
938
|
+
intervalIndex,
|
|
939
|
+
contextViewService,
|
|
940
|
+
defaultSelectBoxStyles,
|
|
941
|
+
{
|
|
942
|
+
ariaLabel: ( localize(3302, "Schedule")),
|
|
943
|
+
useCustomDrawn
|
|
944
|
+
}
|
|
945
|
+
)));
|
|
946
|
+
const intervalSelectContainer = append(intervalGroup, $(".automation-form-schedule-select-container"));
|
|
947
|
+
intervalSelect.render(intervalSelectContainer);
|
|
948
|
+
const timeGroup = append(
|
|
949
|
+
scheduleRow,
|
|
950
|
+
$(".automation-form-schedule-group.automation-form-time-group")
|
|
951
|
+
);
|
|
952
|
+
append(timeGroup, $("span.automation-form-label", undefined, ( localize(3303, "Time"))));
|
|
953
|
+
const timeOptions = buildTimeOptions();
|
|
954
|
+
const initialTimeIndex = nearestTimeOptionIndex(state.hour, state.minute);
|
|
955
|
+
state.hour = timeOptions[initialTimeIndex].hour;
|
|
956
|
+
state.minute = timeOptions[initialTimeIndex].minute;
|
|
957
|
+
const timeSelect = disposables.add(( new SelectBox(timeOptions.map(opt => ({
|
|
958
|
+
text: opt.label
|
|
959
|
+
})), initialTimeIndex, contextViewService, defaultSelectBoxStyles, {
|
|
960
|
+
ariaLabel: ( localize(3303, "Time")),
|
|
961
|
+
useCustomDrawn
|
|
962
|
+
})));
|
|
963
|
+
const timeSelectContainer = append(timeGroup, $(
|
|
964
|
+
".automation-form-schedule-select-container.automation-form-time-select-container"
|
|
965
|
+
));
|
|
966
|
+
timeSelect.render(timeSelectContainer);
|
|
967
|
+
disposables.add(timeSelect.onDidSelect(e => {
|
|
968
|
+
const opt = timeOptions[e.index];
|
|
969
|
+
state.hour = opt.hour;
|
|
970
|
+
state.minute = opt.minute;
|
|
971
|
+
}));
|
|
972
|
+
const dayGroup = append(
|
|
973
|
+
scheduleRow,
|
|
974
|
+
$(".automation-form-schedule-group.automation-form-day-group")
|
|
975
|
+
);
|
|
976
|
+
append(dayGroup, $("span.automation-form-label", undefined, ( localize(3304, "Day of week"))));
|
|
977
|
+
const dayOptions = DAYS_OF_WEEK.map(d => ({
|
|
978
|
+
text: d
|
|
979
|
+
}));
|
|
980
|
+
const daySelect = disposables.add(( new SelectBox(
|
|
981
|
+
dayOptions,
|
|
982
|
+
Math.min(Math.max(state.day, 0), DAYS_OF_WEEK.length - 1),
|
|
983
|
+
contextViewService,
|
|
984
|
+
defaultSelectBoxStyles,
|
|
985
|
+
{
|
|
986
|
+
ariaLabel: ( localize(3304, "Day of week")),
|
|
987
|
+
useCustomDrawn
|
|
988
|
+
}
|
|
989
|
+
)));
|
|
990
|
+
const daySelectContainer = append(dayGroup, $(".automation-form-schedule-select-container"));
|
|
991
|
+
daySelect.render(daySelectContainer);
|
|
992
|
+
disposables.add(daySelect.onDidSelect(e => {
|
|
993
|
+
state.day = e.index;
|
|
994
|
+
}));
|
|
995
|
+
const applyIntervalVisibility = () => {
|
|
996
|
+
const showTime = state.interval === "daily" || state.interval === "weekly";
|
|
997
|
+
const showDay = state.interval === "weekly";
|
|
998
|
+
timeGroup.style.display = showTime ? "" : "none";
|
|
999
|
+
dayGroup.style.display = showDay ? "" : "none";
|
|
1000
|
+
};
|
|
1001
|
+
applyIntervalVisibility();
|
|
1002
|
+
disposables.add(intervalSelect.onDidSelect(e => {
|
|
1003
|
+
state.interval = INTERVALS[e.index].value;
|
|
1004
|
+
applyIntervalVisibility();
|
|
1005
|
+
}));
|
|
1006
|
+
const isolationModel = ( new AutomationIsolationModel(state));
|
|
1007
|
+
const workspaceControlsVisible = derived(
|
|
1008
|
+
reader => !isolationModel.isQuickChatObs.read(reader) && isolationModel.folderUriObs.read(reader) !== undefined
|
|
1009
|
+
);
|
|
1010
|
+
const sessionTypePicker = disposables.add(
|
|
1011
|
+
instantiationService.createInstance(MobileSessionTypePicker, constObservable(undefined), {
|
|
1012
|
+
persistSelection: false,
|
|
1013
|
+
telemetrySource: "AutomationSessionTypePicker"
|
|
1014
|
+
})
|
|
1015
|
+
);
|
|
1016
|
+
sessionTypePicker.setQuickChatSource(isolationModel.isQuickChatObs);
|
|
1017
|
+
sessionTypePicker.setFolderSource(isolationModel.folderUriObs, {
|
|
1018
|
+
initialPick: state.sessionTypeId ? {
|
|
1019
|
+
providerId: state.providerId,
|
|
1020
|
+
sessionTypeId: state.sessionTypeId
|
|
1021
|
+
} : undefined,
|
|
1022
|
+
preserveUnavailableInitialPick: true
|
|
1023
|
+
});
|
|
1024
|
+
const onDidChangeSessionType = disposables.add(( new Emitter()));
|
|
1025
|
+
const onDidChangeSessionTarget = disposables.add(( new Emitter()));
|
|
1026
|
+
const sessionTypeDelegate = {
|
|
1027
|
+
getActiveSessionProvider: () => sessionTypePicker.modelTargetChatSessionType.get(),
|
|
1028
|
+
onDidChangeActiveSessionProvider: onDidChangeSessionType.event
|
|
1029
|
+
};
|
|
1030
|
+
const syncStateFromPicker = () => {
|
|
1031
|
+
const pick = sessionTypePicker.selectedPick;
|
|
1032
|
+
state.providerId = pick?.providerId;
|
|
1033
|
+
state.sessionTypeId = pick?.sessionTypeId;
|
|
1034
|
+
onDidChangeSessionTarget.fire();
|
|
1035
|
+
};
|
|
1036
|
+
disposables.add(autorun(reader => {
|
|
1037
|
+
const modelTarget = sessionTypePicker.modelTargetChatSessionType.read(reader);
|
|
1038
|
+
if (modelTarget) {
|
|
1039
|
+
onDidChangeSessionType.fire(modelTarget);
|
|
1040
|
+
}
|
|
1041
|
+
}));
|
|
1042
|
+
syncStateFromPicker();
|
|
1043
|
+
const workspacePicker = disposables.add(instantiationService.createInstance(MobileAutomationsWorkspacePicker, {
|
|
1044
|
+
restoreFromSessions: false,
|
|
1045
|
+
canRestoreWorkspace: () => false,
|
|
1046
|
+
canSelectWorkspace: (folderUri, preferredProviderId) => canSelectAutomationWorkspace(
|
|
1047
|
+
folderUri,
|
|
1048
|
+
preferredProviderId,
|
|
1049
|
+
sessionsManagementService,
|
|
1050
|
+
workspaceTrustRequestService
|
|
1051
|
+
)
|
|
1052
|
+
}));
|
|
1053
|
+
workspacePicker.setTargetModel(isolationModel);
|
|
1054
|
+
workspacePicker.setLayoutService(layoutService);
|
|
1055
|
+
const automationSessionDraftSynchronizer = disposables.add(( new AutomationSessionDraftSynchronizer(
|
|
1056
|
+
sessionsManagementService,
|
|
1057
|
+
(folderUri, preferredProviderId) => canSelectAutomationWorkspace(
|
|
1058
|
+
folderUri,
|
|
1059
|
+
preferredProviderId,
|
|
1060
|
+
sessionsManagementService,
|
|
1061
|
+
workspaceTrustRequestService
|
|
1062
|
+
),
|
|
1063
|
+
error => logService.error(
|
|
1064
|
+
"[AutomationDialog] Failed to synchronize the automation session draft.",
|
|
1065
|
+
error
|
|
1066
|
+
)
|
|
1067
|
+
)));
|
|
1068
|
+
let resolvedInitialProviderId = initialTarget?.providerId;
|
|
1069
|
+
let resolvedInitialSessionTypeId = initialTarget?.sessionTypeId;
|
|
1070
|
+
const getInitialSessionConfiguration = (folderUri, providerId, sessionTypeId, isQuickChat) => {
|
|
1071
|
+
if (!initialTarget || !initialSessionConfiguration || initialTarget.kind !== (isQuickChat ? "quickChat" : "workspace")) {
|
|
1072
|
+
return undefined;
|
|
1073
|
+
}
|
|
1074
|
+
if (initialTarget.kind === "workspace" && (!folderUri || !isEqual(initialTarget.folderUri, folderUri))) {
|
|
1075
|
+
return undefined;
|
|
1076
|
+
}
|
|
1077
|
+
resolvedInitialProviderId ??= providerId;
|
|
1078
|
+
resolvedInitialSessionTypeId ??= sessionTypeId;
|
|
1079
|
+
if (resolvedInitialProviderId !== providerId || resolvedInitialSessionTypeId !== sessionTypeId) {
|
|
1080
|
+
return undefined;
|
|
1081
|
+
}
|
|
1082
|
+
return initialSessionConfiguration;
|
|
1083
|
+
};
|
|
1084
|
+
const updateAutomationSessionTarget = () => {
|
|
1085
|
+
const folderUri = isolationModel.folderUriObs.get();
|
|
1086
|
+
const pick = sessionTypePicker.selectedPick;
|
|
1087
|
+
const isQuickChat = isolationModel.isQuickChatObs.get();
|
|
1088
|
+
if (!pick || (isQuickChat && !pick.providerId) || (!isQuickChat && !folderUri)) {
|
|
1089
|
+
automationSessionDraftSynchronizer.update(undefined);
|
|
1090
|
+
return;
|
|
1091
|
+
}
|
|
1092
|
+
if (isQuickChat) {
|
|
1093
|
+
const providerId = pick.providerId;
|
|
1094
|
+
if (providerId) {
|
|
1095
|
+
automationSessionDraftSynchronizer.update({
|
|
1096
|
+
kind: "quickChat",
|
|
1097
|
+
providerId,
|
|
1098
|
+
sessionTypeId: pick.sessionTypeId,
|
|
1099
|
+
sessionConfiguration: getInitialSessionConfiguration(undefined, providerId, pick.sessionTypeId, true)
|
|
1100
|
+
});
|
|
1101
|
+
}
|
|
1102
|
+
} else if (folderUri) {
|
|
1103
|
+
automationSessionDraftSynchronizer.update({
|
|
1104
|
+
kind: "workspace",
|
|
1105
|
+
folderUri,
|
|
1106
|
+
providerId: pick.providerId,
|
|
1107
|
+
sessionTypeId: pick.sessionTypeId,
|
|
1108
|
+
sessionConfiguration: getInitialSessionConfiguration(folderUri, pick.providerId, pick.sessionTypeId, false)
|
|
1109
|
+
});
|
|
1110
|
+
}
|
|
1111
|
+
};
|
|
1112
|
+
disposables.add(sessionTypePicker.onDidChangeSelectedPick(() => {
|
|
1113
|
+
syncStateFromPicker();
|
|
1114
|
+
updateAutomationSessionTarget();
|
|
1115
|
+
revalidate();
|
|
1116
|
+
}));
|
|
1117
|
+
disposables.add(
|
|
1118
|
+
sessionsManagementService.onDidChangeSessionTypes(() => updateAutomationSessionTarget())
|
|
1119
|
+
);
|
|
1120
|
+
if (state.folderUri) {
|
|
1121
|
+
workspacePicker.setSelectedWorkspace(state.folderUri, {
|
|
1122
|
+
fireEvent: false,
|
|
1123
|
+
persist: false
|
|
1124
|
+
});
|
|
1125
|
+
}
|
|
1126
|
+
disposables.add(workspacePicker.onDidSelectWorkspace(uri => {
|
|
1127
|
+
if (isolationModel.setWorkspace(uri)) {
|
|
1128
|
+
updateAutomationSessionTarget();
|
|
1129
|
+
revalidate();
|
|
1130
|
+
}
|
|
1131
|
+
}));
|
|
1132
|
+
disposables.add(autorun(reader => {
|
|
1133
|
+
isolationModel.isQuickChatObs.read(reader);
|
|
1134
|
+
updateAutomationSessionTarget();
|
|
1135
|
+
revalidate();
|
|
1136
|
+
}));
|
|
1137
|
+
const sessionSection = append(formContent, $(".automation-session-section"));
|
|
1138
|
+
const targetRow = append(sessionSection, $(".automation-form-row.automation-target-row"));
|
|
1139
|
+
const targetLabel = append(targetRow, $("span.automation-form-label", {
|
|
1140
|
+
id: "automation-target-label"
|
|
1141
|
+
}, ( localize(3305, "Target"))));
|
|
1142
|
+
const targetContainer = append(targetRow, $(".automation-target-toolbar", {
|
|
1143
|
+
role: "group",
|
|
1144
|
+
"aria-labelledby": targetLabel.id
|
|
1145
|
+
}));
|
|
1146
|
+
const promptSection = append(sessionSection, $(".automation-prompt-section"));
|
|
1147
|
+
const promptRow = append(promptSection, $(".automation-form-row"));
|
|
1148
|
+
append(promptRow, $("span.automation-form-label", undefined, ( localize(3306, "Prompt"))));
|
|
1149
|
+
const promptHost = append(promptRow, $(".automation-form-prompt-host.interactive-session"));
|
|
1150
|
+
const editorOverflowWidgetsDomNode = layoutService.getContainer(getWindow(promptHost)).appendChild($(".chat-editor-overflow.automation-dialog-editor-overflow.monaco-editor"));
|
|
1151
|
+
disposables.add(toDisposable(() => editorOverflowWidgetsDomNode.remove()));
|
|
1152
|
+
const activeAutomationSession = disposables.add(disposableObservableValue(form, undefined));
|
|
1153
|
+
disposables.add(autorun(reader => {
|
|
1154
|
+
const session = sessionsManagementService.automationSession.read(reader);
|
|
1155
|
+
activeAutomationSession.set(session ? ( new VisibleSession(session, session.mainChat.read(reader))) : undefined, undefined);
|
|
1156
|
+
}));
|
|
1157
|
+
const scopedContextKeyService = disposables.add(contextKeyService.createScoped(sessionSection));
|
|
1158
|
+
ChatContextKeys.location.bindTo(scopedContextKeyService).set(ChatAgentLocation.Chat);
|
|
1159
|
+
ChatContextKeys.inChatSession.bindTo(scopedContextKeyService).set(true);
|
|
1160
|
+
ChatContextKeys.inAutomationsDialog.bindTo(scopedContextKeyService).set(true);
|
|
1161
|
+
const newChatModelPickerService = ( new NewChatModelPickerService());
|
|
1162
|
+
const sessionModelSelection = disposables.add(
|
|
1163
|
+
instantiationService.createInstance(SessionModelSelection, activeAutomationSession, {
|
|
1164
|
+
modelConfiguration: true
|
|
1165
|
+
})
|
|
1166
|
+
);
|
|
1167
|
+
const scopedInstantiationService = disposables.add(instantiationService.createChild(( new ServiceCollection(
|
|
1168
|
+
[IContextKeyService, scopedContextKeyService],
|
|
1169
|
+
[ISessionContext, ( new SessionContext(activeAutomationSession))],
|
|
1170
|
+
[INewChatModelPickerService, newChatModelPickerService],
|
|
1171
|
+
[ISessionModelSelection, sessionModelSelection]
|
|
1172
|
+
))));
|
|
1173
|
+
const usesCombinedConfigPicker = SessionUsesCombinedConfigPickerContext.bindTo(scopedContextKeyService);
|
|
1174
|
+
const sessionTypesChanged = observableSignalFromEvent(form, sessionsManagementService.onDidChangeSessionTypes);
|
|
1175
|
+
disposables.add(autorun(reader => {
|
|
1176
|
+
sessionTypesChanged.read(reader);
|
|
1177
|
+
const session = activeAutomationSession.read(reader);
|
|
1178
|
+
setActiveSessionContextKeys(session, scopedContextKeyService, reader);
|
|
1179
|
+
usesCombinedConfigPicker.set(
|
|
1180
|
+
!!session && sessionsManagementService.usesCombinedNewSessionConfigPicker(session)
|
|
1181
|
+
);
|
|
1182
|
+
}));
|
|
1183
|
+
const targetToolbar = disposables.add(scopedInstantiationService.createInstance(
|
|
1184
|
+
MenuWorkbenchToolBar,
|
|
1185
|
+
targetContainer,
|
|
1186
|
+
Menus.AutomationsDialogTargetToolbar,
|
|
1187
|
+
{
|
|
1188
|
+
ariaLabel: ( localize(3307, "Automation target options")),
|
|
1189
|
+
telemetrySource: "automations.dialog",
|
|
1190
|
+
hiddenItemStrategy: HiddenItemStrategy.NoHide,
|
|
1191
|
+
responsiveBehavior: {
|
|
1192
|
+
enabled: true,
|
|
1193
|
+
kind: "all",
|
|
1194
|
+
actionMinWidth: 22,
|
|
1195
|
+
allowOverflow: false
|
|
1196
|
+
},
|
|
1197
|
+
actionViewItemProvider: (action, itemOptions) => {
|
|
1198
|
+
if (action.id === AUTOMATIONS_HARNESS_CHIP_ACTION_ID) {
|
|
1199
|
+
return ( new AutomationPickerActionViewItem(
|
|
1200
|
+
action,
|
|
1201
|
+
container => sessionTypePicker.render(container),
|
|
1202
|
+
undefined,
|
|
1203
|
+
itemOptions
|
|
1204
|
+
));
|
|
1205
|
+
}
|
|
1206
|
+
if (action.id === AUTOMATIONS_WORKSPACE_PICKER_ACTION_ID) {
|
|
1207
|
+
return ( new AutomationPickerActionViewItem(
|
|
1208
|
+
action,
|
|
1209
|
+
container => workspacePicker.render(container),
|
|
1210
|
+
undefined,
|
|
1211
|
+
itemOptions
|
|
1212
|
+
));
|
|
1213
|
+
}
|
|
1214
|
+
if (action.id === AUTOMATIONS_ISOLATION_GROUP_ACTION_ID) {
|
|
1215
|
+
return instantiationService.createInstance(
|
|
1216
|
+
AutomationIsolationGroupActionViewItem,
|
|
1217
|
+
action,
|
|
1218
|
+
state,
|
|
1219
|
+
isolationModel,
|
|
1220
|
+
isolationModel.folderUriObs,
|
|
1221
|
+
onDidChangeSessionTarget.event,
|
|
1222
|
+
revalidate,
|
|
1223
|
+
itemOptions,
|
|
1224
|
+
workspaceControlsVisible
|
|
1225
|
+
);
|
|
1226
|
+
}
|
|
1227
|
+
return undefined;
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
));
|
|
1231
|
+
const targetLayout = disposables.add(( new ChatInputPickerResponsiveLayout("AutomationDialog.target", targetContainer, {
|
|
1232
|
+
getItems: () => getAutomationToolbarResponsiveItems(targetToolbar, {
|
|
1233
|
+
canShrink: false
|
|
1234
|
+
}),
|
|
1235
|
+
hasOverflow: () => targetToolbar.hasOverflow(),
|
|
1236
|
+
relayout: () => targetToolbar.relayout()
|
|
1237
|
+
})));
|
|
1238
|
+
targetLayout.layout();
|
|
1239
|
+
const chatInputStyles = {
|
|
1240
|
+
overlayBackground: "var(--vscode-input-background)",
|
|
1241
|
+
listForeground: "var(--vscode-foreground)",
|
|
1242
|
+
listBackground: "var(--vscode-input-background)"
|
|
1243
|
+
};
|
|
1244
|
+
const chatInputOptions = {
|
|
1245
|
+
renderFollowups: false,
|
|
1246
|
+
renderInputToolbarBelowInput: false,
|
|
1247
|
+
renderWorkingSet: false,
|
|
1248
|
+
enableImplicitContext: false,
|
|
1249
|
+
supportsChangingModes: false,
|
|
1250
|
+
suppressModePreferredModel: true,
|
|
1251
|
+
suppressModelPersistence: true,
|
|
1252
|
+
menus: {
|
|
1253
|
+
executeToolbar: MenuId.AutomationsDialogInput,
|
|
1254
|
+
inputToolbar: Menus.AutomationsDialogInputToolbar,
|
|
1255
|
+
telemetrySource: "automations.dialog"
|
|
1256
|
+
},
|
|
1257
|
+
widgetViewKindTag: "automations-dialog",
|
|
1258
|
+
isTransientChat: true,
|
|
1259
|
+
inputEditorMinLines: 3,
|
|
1260
|
+
inputEditorQuickSuggestions: EditorOptions.quickSuggestions.defaultValue,
|
|
1261
|
+
inputPartHorizontalPadding: 0,
|
|
1262
|
+
editorOverflowWidgetsDomNode,
|
|
1263
|
+
sessionTypePickerDelegate: sessionTypeDelegate
|
|
1264
|
+
};
|
|
1265
|
+
const stubWidget = {
|
|
1266
|
+
onDidChangeViewModel: Event.None,
|
|
1267
|
+
viewModel: undefined,
|
|
1268
|
+
contribs: [],
|
|
1269
|
+
location: ChatAgentLocation.Chat,
|
|
1270
|
+
viewContext: {},
|
|
1271
|
+
lockToCodingAgent: () => {},
|
|
1272
|
+
unlockFromCodingAgent: () => {}
|
|
1273
|
+
};
|
|
1274
|
+
const chatInput = disposables.add(scopedInstantiationService.createInstance(
|
|
1275
|
+
ChatInputPart,
|
|
1276
|
+
ChatAgentLocation.Chat,
|
|
1277
|
+
chatInputOptions,
|
|
1278
|
+
chatInputStyles,
|
|
1279
|
+
false
|
|
1280
|
+
));
|
|
1281
|
+
chatInput.render(promptHost, initialPrompt, stubWidget);
|
|
1282
|
+
chatInput.inputEditor.updateOptions({
|
|
1283
|
+
placeholder: ( localize(3308, "Describe what you want to automate"))
|
|
1284
|
+
});
|
|
1285
|
+
disposables.add(
|
|
1286
|
+
scopedInstantiationService.createInstance(AutomationInputCompletions, chatInput.inputEditor)
|
|
1287
|
+
);
|
|
1288
|
+
const sessionConfigurationRow = append(promptSection, $(".automation-form-row"));
|
|
1289
|
+
const sessionConfigurationLabel = append(sessionConfigurationRow, $("span.automation-form-label", {
|
|
1290
|
+
id: "automation-session-configuration-label"
|
|
1291
|
+
}, ( localize(3309, "Session configuration"))));
|
|
1292
|
+
const sessionConfiguration = append(sessionConfigurationRow, $(".automation-session-configuration", {
|
|
1293
|
+
role: "group",
|
|
1294
|
+
"aria-labelledby": sessionConfigurationLabel.id
|
|
1295
|
+
}));
|
|
1296
|
+
const sessionConfigContainer = append(
|
|
1297
|
+
sessionConfiguration,
|
|
1298
|
+
$(".automation-session-config.sessions-chat-config-toolbar")
|
|
1299
|
+
);
|
|
1300
|
+
const compactModelPicker = observableValue(sessionConfigContainer, false);
|
|
1301
|
+
const sessionConfigToolbar = disposables.add(createNewSessionConfigToolbar(
|
|
1302
|
+
sessionConfigContainer,
|
|
1303
|
+
scopedInstantiationService,
|
|
1304
|
+
compactModelPicker,
|
|
1305
|
+
( localize(3310, "Session configuration options"))
|
|
1306
|
+
));
|
|
1307
|
+
const sessionControlsContainer = append(sessionConfiguration, $(".automation-session-controls"));
|
|
1308
|
+
const sessionControlsToolbar = disposables.add(
|
|
1309
|
+
createNewSessionControlToolbar(sessionControlsContainer, scopedInstantiationService, ( localize(3311, "Session controls")))
|
|
1310
|
+
);
|
|
1311
|
+
const sessionConfigLayout = disposables.add(( new ChatInputPickerResponsiveLayout("AutomationDialog.sessionConfig", sessionConfigContainer, {
|
|
1312
|
+
getItems: () => getAutomationToolbarResponsiveItems(sessionConfigToolbar, {
|
|
1313
|
+
compactModelPicker
|
|
1314
|
+
}),
|
|
1315
|
+
hasOverflow: () => sessionConfigToolbar.hasOverflow(),
|
|
1316
|
+
relayout: () => sessionConfigToolbar.relayout()
|
|
1317
|
+
})));
|
|
1318
|
+
sessionConfigLayout.layout();
|
|
1319
|
+
const sessionControlsLayout = disposables.add(( new ChatInputPickerResponsiveLayout("AutomationDialog.sessionControls", sessionControlsContainer, {
|
|
1320
|
+
getItems: () => getAutomationToolbarResponsiveItems(sessionControlsToolbar),
|
|
1321
|
+
hasOverflow: () => sessionControlsToolbar.hasOverflow(),
|
|
1322
|
+
relayout: () => sessionControlsToolbar.relayout()
|
|
1323
|
+
})));
|
|
1324
|
+
sessionControlsLayout.layout();
|
|
1325
|
+
const sessionConfigurationUnavailable = append(
|
|
1326
|
+
sessionConfiguration,
|
|
1327
|
+
$("span.automation-session-configuration-unavailable", {
|
|
1328
|
+
role: "status",
|
|
1329
|
+
"aria-atomic": "true"
|
|
1330
|
+
})
|
|
1331
|
+
);
|
|
1332
|
+
const sessionConfigurationError = append(sessionConfiguration, $("span.automation-session-configuration-error", {
|
|
1333
|
+
role: "alert",
|
|
1334
|
+
tabindex: "-1"
|
|
1335
|
+
}));
|
|
1336
|
+
hide(sessionConfigurationError);
|
|
1337
|
+
disposables.add(autorun(reader => {
|
|
1338
|
+
const hasTarget = isolationModel.isQuickChatObs.read(reader) || isolationModel.folderUriObs.read(reader) !== undefined;
|
|
1339
|
+
setAutomationControlVisible(sessionConfigurationRow, hasTarget);
|
|
1340
|
+
const availability = automationSessionDraftSynchronizer.availability.read(reader);
|
|
1341
|
+
const pending = availability === "pending";
|
|
1342
|
+
const controlsUnavailable = availability !== "available";
|
|
1343
|
+
sessionConfiguration.classList.toggle("controls-unavailable", controlsUnavailable);
|
|
1344
|
+
for (const container of [sessionConfigContainer, sessionControlsContainer]) {
|
|
1345
|
+
container.toggleAttribute("inert", controlsUnavailable);
|
|
1346
|
+
container.setAttribute("aria-hidden", String(controlsUnavailable));
|
|
1347
|
+
container.setAttribute("aria-busy", String(pending));
|
|
1348
|
+
}
|
|
1349
|
+
sessionConfigurationUnavailable.textContent = pending ? ( localize(3312, "Loading session configuration…")) : hasTarget && controlsUnavailable ? ( localize(3313, "Session configuration unavailable")) : "";
|
|
1350
|
+
}));
|
|
1351
|
+
disposables.add(chatInput.inputEditor.onDidChangeModelContent(() => {
|
|
1352
|
+
revalidate();
|
|
1353
|
+
}));
|
|
1354
|
+
const layoutChatInput = () => {
|
|
1355
|
+
const width = promptHost.getBoundingClientRect().width;
|
|
1356
|
+
if (width > 0) {
|
|
1357
|
+
chatInput.layout(width);
|
|
1358
|
+
}
|
|
1359
|
+
};
|
|
1360
|
+
layoutChatInput();
|
|
1361
|
+
queueMicrotask(() => {
|
|
1362
|
+
if (!disposables.isDisposed) {
|
|
1363
|
+
layoutChatInput();
|
|
1364
|
+
}
|
|
1365
|
+
});
|
|
1366
|
+
const resizeObserver = disposables.add(
|
|
1367
|
+
new DisposableResizeObserver("automationDialog.promptHost", entries => {
|
|
1368
|
+
for (const entry of entries) {
|
|
1369
|
+
const width = entry.contentRect.width;
|
|
1370
|
+
if (width > 0) {
|
|
1371
|
+
chatInput.layout(width);
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
}, getWindow(promptHost))
|
|
1375
|
+
);
|
|
1376
|
+
disposables.add(resizeObserver.observe(promptHost));
|
|
1377
|
+
const enabledRow = append(formContent, $(".automation-form-row.automation-form-checkbox-row"));
|
|
1378
|
+
const enabledLabelText = ( localize(3314, "Enabled (the scheduler runs this automation when due)"));
|
|
1379
|
+
const enabledCheckbox = disposables.add(( new Checkbox(enabledLabelText, state.enabled, defaultCheckboxStyles)));
|
|
1380
|
+
append(enabledRow, enabledCheckbox.domNode);
|
|
1381
|
+
const enabledLabel = append(
|
|
1382
|
+
enabledRow,
|
|
1383
|
+
$("span.automation-form-checkbox-label", undefined, enabledLabelText)
|
|
1384
|
+
);
|
|
1385
|
+
const setEnabled = value => {
|
|
1386
|
+
if (enabledCheckbox.checked !== value) {
|
|
1387
|
+
enabledCheckbox.checked = value;
|
|
1388
|
+
}
|
|
1389
|
+
state.enabled = value;
|
|
1390
|
+
};
|
|
1391
|
+
disposables.add(enabledCheckbox.onChange(() => {
|
|
1392
|
+
state.enabled = enabledCheckbox.checked;
|
|
1393
|
+
}));
|
|
1394
|
+
disposables.add(addStandardDisposableListener(enabledLabel, "click", () => {
|
|
1395
|
+
setEnabled(!enabledCheckbox.checked);
|
|
1396
|
+
}));
|
|
1397
|
+
const saveStatus = append(form, $("span.automation-form-save-status", {
|
|
1398
|
+
role: "status",
|
|
1399
|
+
"aria-atomic": "true"
|
|
1400
|
+
}));
|
|
1401
|
+
hide(saveStatus);
|
|
1402
|
+
return {
|
|
1403
|
+
getPrompt: () => chatInput.inputEditor.getValue(),
|
|
1404
|
+
getSessionConfiguration: token => automationSessionDraftSynchronizer.getSessionConfiguration(token),
|
|
1405
|
+
getBranch: () => isolationModel.persistedBranch,
|
|
1406
|
+
waitForAutomationSessionSync: token => {
|
|
1407
|
+
updateAutomationSessionTarget();
|
|
1408
|
+
return automationSessionDraftSynchronizer.waitForSync(token);
|
|
1409
|
+
},
|
|
1410
|
+
setSaving: saving => {
|
|
1411
|
+
formContent.toggleAttribute("inert", saving);
|
|
1412
|
+
formContent.setAttribute("aria-busy", String(saving));
|
|
1413
|
+
form.classList.toggle("saving", saving);
|
|
1414
|
+
if (saving) {
|
|
1415
|
+
show(saveStatus);
|
|
1416
|
+
saveStatus.textContent = ( localize(3315, "Saving automation…"));
|
|
1417
|
+
} else {
|
|
1418
|
+
hide(saveStatus);
|
|
1419
|
+
saveStatus.textContent = "";
|
|
1420
|
+
}
|
|
1421
|
+
},
|
|
1422
|
+
showSessionConfigurationError: message => {
|
|
1423
|
+
if (message) {
|
|
1424
|
+
show(sessionConfigurationError);
|
|
1425
|
+
sessionConfigurationError.textContent = message;
|
|
1426
|
+
} else {
|
|
1427
|
+
hide(sessionConfigurationError);
|
|
1428
|
+
sessionConfigurationError.textContent = "";
|
|
1429
|
+
}
|
|
1430
|
+
},
|
|
1431
|
+
focusSessionConfigurationError: () => sessionConfigurationError.focus(),
|
|
1432
|
+
getFocusableElements: () => {
|
|
1433
|
+
return Array.from(
|
|
1434
|
+
form.querySelectorAll("input, select, textarea, button, a[href], [tabindex]")
|
|
1435
|
+
);
|
|
1436
|
+
},
|
|
1437
|
+
acceptPromptSuggestion: () => {
|
|
1438
|
+
const suggestController = SuggestController.get(chatInput.inputEditor);
|
|
1439
|
+
if (!suggestController || suggestController.model.state === State.Idle || !suggestController.widget.value.getFocusedItem()) {
|
|
1440
|
+
return false;
|
|
1441
|
+
}
|
|
1442
|
+
suggestController.acceptSelectedSuggestion(true, false);
|
|
1443
|
+
return true;
|
|
1444
|
+
},
|
|
1445
|
+
cancelPromptSuggestion: () => {
|
|
1446
|
+
const suggestController = SuggestController.get(chatInput.inputEditor);
|
|
1447
|
+
if (!chatInput.inputEditor.hasTextFocus() || !suggestController || suggestController.model.state === State.Idle) {
|
|
1448
|
+
return false;
|
|
1449
|
+
}
|
|
1450
|
+
suggestController.cancelSuggestWidget();
|
|
1451
|
+
return true;
|
|
1452
|
+
}
|
|
1453
|
+
};
|
|
1454
|
+
}
|
|
1455
|
+
function buildTimeOptions() {
|
|
1456
|
+
const options = [];
|
|
1457
|
+
for (let hour = 0; hour < 24; hour++) {
|
|
1458
|
+
for (let minute = 0; minute < 60; minute += 15) {
|
|
1459
|
+
const period = hour < 12 ? "AM" : "PM";
|
|
1460
|
+
const hour12 = hour === 0 ? 12 : (hour > 12 ? hour - 12 : hour);
|
|
1461
|
+
const minuteText = ( minute.toString()).padStart(2, "0");
|
|
1462
|
+
options.push({
|
|
1463
|
+
hour,
|
|
1464
|
+
minute,
|
|
1465
|
+
label: `${hour12}:${minuteText} ${period}`
|
|
1466
|
+
});
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
return options;
|
|
1470
|
+
}
|
|
1471
|
+
function nearestTimeOptionIndex(hour, minute) {
|
|
1472
|
+
const safeHour = Math.max(0, Math.min(23, hour | 0));
|
|
1473
|
+
const safeMinute = Math.max(0, Math.min(59, minute | 0));
|
|
1474
|
+
const slot = Math.round(safeMinute / 15) % 4;
|
|
1475
|
+
const carriedHour = safeMinute >= 53 && slot === 0 ? (safeHour + 1) % 24 : safeHour;
|
|
1476
|
+
return carriedHour * 4 + slot;
|
|
1477
|
+
}
|
|
1478
|
+
function updateSaveButtonState(saveButton, state, validation, form, getPrompt, getBranch) {
|
|
1479
|
+
validation.nameError = state.name.trim() === "" ? ( localize(3316, "Name is required.")) : undefined;
|
|
1480
|
+
validation.promptError = getPrompt().trim() === "" ? ( localize(3317, "Prompt is required.")) : undefined;
|
|
1481
|
+
validation.folderError = !state.folderUri && !state.isQuickChat ? ( localize(3318, "Workspace folder is required.")) : undefined;
|
|
1482
|
+
validation.sessionTypeError = !state.sessionTypeId || (state.isQuickChat && !state.providerId) ? ( localize(3319, "Session type is required.")) : undefined;
|
|
1483
|
+
validation.branchError = !state.isQuickChat && state.isolationMode === "worktree" && !getBranch() ? ( localize(3320, "A branch is required for Worktree isolation.")) : undefined;
|
|
1484
|
+
const valid = !validation.nameError && !validation.promptError && !validation.folderError && !validation.sessionTypeError && !validation.branchError;
|
|
1485
|
+
if (saveButton) {
|
|
1486
|
+
saveButton.enabled = valid;
|
|
1487
|
+
}
|
|
1488
|
+
form.classList.toggle("automation-form-invalid", !valid);
|
|
1489
|
+
}
|
|
1490
|
+
class AutomationsWorkspacePicker extends WorkspacePicker {
|
|
1491
|
+
constructor() {
|
|
1492
|
+
super(...arguments);
|
|
1493
|
+
this.targetModelWatch = this._register(( new MutableDisposable()));
|
|
1494
|
+
}
|
|
1495
|
+
setTargetModel(model) {
|
|
1496
|
+
this.targetModel = model;
|
|
1497
|
+
this.targetModelWatch.value = autorun(reader => {
|
|
1498
|
+
model.isQuickChatObs.read(reader);
|
|
1499
|
+
this._updateTriggerLabel();
|
|
1500
|
+
});
|
|
1501
|
+
}
|
|
1502
|
+
_showTabs() {
|
|
1503
|
+
return false;
|
|
1504
|
+
}
|
|
1505
|
+
_shouldPersistSelection() {
|
|
1506
|
+
return false;
|
|
1507
|
+
}
|
|
1508
|
+
_buildItems() {
|
|
1509
|
+
const items = super._buildItems();
|
|
1510
|
+
const noWorkspace = {
|
|
1511
|
+
kind: ActionListItemKind.Action,
|
|
1512
|
+
label: ( localize(3321, "No workspace")),
|
|
1513
|
+
description: ( localize(3322, "Run without a backing workspace")),
|
|
1514
|
+
group: {
|
|
1515
|
+
title: "",
|
|
1516
|
+
icon: Codicon.commentDiscussion
|
|
1517
|
+
},
|
|
1518
|
+
item: {
|
|
1519
|
+
checked: this.targetModel?.isQuickChat || undefined,
|
|
1520
|
+
run: () => this.targetModel?.setQuickChat(true)
|
|
1521
|
+
}
|
|
1522
|
+
};
|
|
1523
|
+
return items.length > 0 ? [noWorkspace, {
|
|
1524
|
+
kind: ActionListItemKind.Separator,
|
|
1525
|
+
label: ""
|
|
1526
|
+
}, ...items] : [noWorkspace];
|
|
1527
|
+
}
|
|
1528
|
+
async _dispatchPickerItem(item) {
|
|
1529
|
+
const applied = await super._dispatchPickerItem(item);
|
|
1530
|
+
const selectedFolder = this.selectedFolderUri;
|
|
1531
|
+
if (applied && selectedFolder && (item.folderUri || item.browseActionIndex !== undefined)) {
|
|
1532
|
+
this.targetModel?.setQuickChat(false, selectedFolder);
|
|
1533
|
+
}
|
|
1534
|
+
return applied;
|
|
1535
|
+
}
|
|
1536
|
+
_isSelectedFolder(folderUri) {
|
|
1537
|
+
return !this.targetModel?.isQuickChat && super._isSelectedFolder(folderUri);
|
|
1538
|
+
}
|
|
1539
|
+
_renderTriggerLabel(trigger) {
|
|
1540
|
+
clearNode(trigger);
|
|
1541
|
+
const workspace = this.selectedResolved?.workspace;
|
|
1542
|
+
const noWorkspace = this.targetModel?.isQuickChat === true;
|
|
1543
|
+
const label = noWorkspace ? ( localize(3321, "No workspace")) : workspace?.label ?? ( localize(3323, "Select workspace"));
|
|
1544
|
+
const icon = noWorkspace ? Codicon.commentDiscussion : workspace?.icon ?? Codicon.project;
|
|
1545
|
+
trigger.setAttribute("aria-label", workspace || noWorkspace ? ( localize(3324, "Automation target, {0}", label)) : ( localize(3325, "Pick a workspace for this automation")));
|
|
1546
|
+
const renderedIcon = append(trigger, renderIcon(icon));
|
|
1547
|
+
renderedIcon.setAttribute("aria-hidden", "true");
|
|
1548
|
+
append(trigger, $("span.sessions-chat-dropdown-label", undefined, label));
|
|
1549
|
+
const chevron = append(trigger, renderIcon(Codicon.chevronDownCompact));
|
|
1550
|
+
chevron.classList.add("sessions-chat-dropdown-chevron");
|
|
1551
|
+
chevron.setAttribute("aria-hidden", "true");
|
|
1552
|
+
}
|
|
1553
|
+
_getAllBrowseActions() {
|
|
1554
|
+
return super._getAllBrowseActions().filter(a => a.group === SESSION_WORKSPACE_GROUP_LOCAL);
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
class MobileAutomationsWorkspacePicker extends AutomationsWorkspacePicker {
|
|
1558
|
+
setLayoutService(layoutService) {
|
|
1559
|
+
this.layoutService = layoutService;
|
|
1560
|
+
}
|
|
1561
|
+
showPicker(force = false, anchor) {
|
|
1562
|
+
const triggerElement = anchor ?? this._triggerElement;
|
|
1563
|
+
if (!triggerElement || !this.layoutService || !shouldUseMobileWorkspacePickerSheet(this.layoutService)) {
|
|
1564
|
+
super.showPicker(force, anchor);
|
|
1565
|
+
return;
|
|
1566
|
+
}
|
|
1567
|
+
void showMobileWorkspacePickerSheet(this.layoutService, triggerElement, this._buildItems(), item => {
|
|
1568
|
+
void this._dispatchPickerItem(item);
|
|
1569
|
+
}, this._getAllBrowseActions());
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
1573
|
+
id: "workbench.action.chat.automationsDialog.insertNewline",
|
|
1574
|
+
weight: KeybindingWeight.EditorContrib + 100,
|
|
1575
|
+
when: ( ContextKeyExpr.and(
|
|
1576
|
+
EditorContextKeys.textInputFocus,
|
|
1577
|
+
ChatContextKeys.inAutomationsDialog,
|
|
1578
|
+
( Context.Visible.toNegated())
|
|
1579
|
+
)),
|
|
1580
|
+
primary: KeyCode.Enter,
|
|
1581
|
+
handler: accessor => {
|
|
1582
|
+
const editor = accessor.get(ICodeEditorService).getFocusedCodeEditor();
|
|
1583
|
+
editor?.trigger("keyboard", "type", {
|
|
1584
|
+
text: "\n"
|
|
1585
|
+
});
|
|
1586
|
+
}
|
|
1587
|
+
});
|
|
1588
|
+
|
|
1589
|
+
export { AutomationIsolationGroupActionViewItem, AutomationSessionDraftSynchronizer, AutomationsWorkspacePicker, MobileAutomationsWorkspacePicker, canSelectAutomationWorkspace, isAutomationDialogPopupTarget, registerAutomationDialogKeyboardNavigation, renderForm, shouldPassThroughAutomationDialogCommand, updateSaveButtonState };
|