@codingame/monaco-vscode-workbench-service-override 37.3.2 → 37.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +10 -10
- package/session.js +11 -0
- package/vscode/src/vs/platform/agentHost/common/meta/agentCheckoutOperationMeta.d.ts +18 -0
- package/vscode/src/vs/platform/agentHost/common/meta/agentCheckoutOperationMeta.js +27 -0
- package/vscode/src/vs/sessions/browser/layoutActions.d.ts +1 -0
- package/vscode/src/vs/sessions/browser/layoutActions.js +146 -0
- package/vscode/src/vs/sessions/browser/parts/chatCompositeBar.js +6 -6
- package/vscode/src/vs/sessions/browser/parts/chatGroupView.js +5 -5
- package/vscode/src/vs/sessions/browser/parts/menubar.contribution.js +8 -8
- package/vscode/src/vs/sessions/browser/parts/sessionHeader.js +1 -1
- package/vscode/src/vs/sessions/browser/parts/sessionReadOnlyBanner.js +1 -1
- package/vscode/src/vs/sessions/browser/parts/sessionRemoteConnection.js +20 -20
- package/vscode/src/vs/sessions/browser/sessionsSetUpService.js +7 -7
- package/vscode/src/vs/sessions/browser/sessionsSignInDialog.js +4 -4
- package/vscode/src/vs/sessions/contrib/accountMenu/browser/account.contribution.js +42 -42
- package/vscode/src/vs/sessions/contrib/accountMenu/browser/chatPetAchievementBadges.js +11 -11
- package/vscode/src/vs/sessions/contrib/aiCustomizationTreeView/browser/aiCustomizationTreeView.contribution.js +18 -18
- package/vscode/src/vs/sessions/contrib/aiCustomizationTreeView/browser/aiCustomizationTreeViewViews.js +12 -12
- package/vscode/src/vs/sessions/contrib/applyCommitsToParentRepo/browser/applyChangesToParentRepo.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/applyCommitsToParentRepo/browser/applyChangesToParentRepo.js +149 -0
- package/vscode/src/vs/sessions/contrib/aquarium/browser/aquarium.contribution.js +12 -12
- package/vscode/src/vs/sessions/contrib/aquarium/browser/aquariumOverlay.js +10 -10
- package/vscode/src/vs/sessions/contrib/automations/browser/automationDialog.js +68 -68
- package/vscode/src/vs/sessions/contrib/automations/browser/automationDialogService.js +7 -7
- package/vscode/src/vs/sessions/contrib/automations/browser/automationRunner.js +4 -4
- package/vscode/src/vs/sessions/contrib/automations/browser/automationScheduler.js +2 -2
- package/vscode/src/vs/sessions/contrib/automations/browser/automationTools.js +38 -38
- package/vscode/src/vs/sessions/contrib/automations/browser/automations.contribution.js +2 -2
- package/vscode/src/vs/sessions/contrib/automations/browser/providerAutomationService.js +1 -1
- package/vscode/src/vs/sessions/contrib/changes/browser/changes.contribution.js +6 -6
- package/vscode/src/vs/sessions/contrib/changes/browser/changesActions.js +4 -4
- package/vscode/src/vs/sessions/contrib/changes/browser/changesViewActions.js +20 -20
- package/vscode/src/vs/sessions/contrib/changes/browser/changesetReviewActions.js +1 -1
- package/vscode/src/vs/sessions/contrib/changes/browser/sessionSyncChanges.js +9 -9
- package/vscode/src/vs/sessions/contrib/changes/browser/sessionsChangesAccessibilityHelp.js +17 -17
- package/vscode/src/vs/sessions/contrib/chat/browser/sessionChatInputToolbarDebug.js +17 -17
- package/vscode/src/vs/sessions/contrib/chat/browser/taskCommand.d.ts +44 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/taskCommand.js +111 -0
- package/vscode/src/vs/sessions/contrib/chatDebug/browser/chatDebug.contribution.js +2 -2
- package/vscode/src/vs/sessions/contrib/codeReview/browser/codeReview.contributions.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/codeReview/browser/codeReview.contributions.js +75 -0
- package/vscode/src/vs/sessions/contrib/customViewTest/browser/customViewTest.contribution.js +7 -7
- package/vscode/src/vs/sessions/contrib/editor/browser/addTabActions.js +4 -4
- package/vscode/src/vs/sessions/contrib/editor/browser/editor.contribution.js +8 -8
- package/vscode/src/vs/sessions/contrib/editor/browser/emptyFileEditor.contribution.js +1 -1
- package/vscode/src/vs/sessions/contrib/editor/browser/emptyFileEditor.js +5 -5
- package/vscode/src/vs/sessions/contrib/editor/browser/emptyFileEditorInput.js +1 -1
- package/vscode/src/vs/sessions/contrib/files/browser/files.contribution.js +7 -7
- package/vscode/src/vs/sessions/contrib/files/browser/filesView.js +1 -1
- package/vscode/src/vs/sessions/contrib/layout/browser/baseSessionLayoutController.js +5 -5
- package/vscode/src/vs/sessions/contrib/layout/browser/sessions.layout.contribution.js +2 -2
- package/vscode/src/vs/sessions/contrib/layout/browser/singlePane/singlePaneExistingSessionStrategy.js +1 -1
- package/vscode/src/vs/sessions/contrib/onboardingTours/browser/newSessionViewV3Prompt.js +19 -19
- package/vscode/src/vs/sessions/contrib/onboardingTours/browser/tours/newSessionTour.js +4 -4
- package/vscode/src/vs/sessions/contrib/onboardingTours/browser/tours/newSessionViewTour.js +6 -6
- package/vscode/src/vs/sessions/contrib/onboardingTours/browser/tours/newSessionViewTourShared.js +2 -2
- package/vscode/src/vs/sessions/contrib/onboardingTours/browser/tours/newSessionViewV2Tour.js +4 -4
- package/vscode/src/vs/sessions/contrib/policyBlocked/browser/sessionsPolicyBlocked.js +24 -24
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostClaudePermissionModePicker.d.ts +26 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostClaudePermissionModePicker.js +98 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostCodexApprovalsPicker.d.ts +33 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostCodexApprovalsPicker.js +98 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostForkActions.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostForkActions.js +72 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostModeIcon.d.ts +2 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostModeIcon.js +13 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostModePicker.d.ts +122 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostModePicker.js +464 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostPermissionPickerActionItem.d.ts +35 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostPermissionPickerActionItem.js +90 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostPermissionPickerDelegate.d.ts +84 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostPermissionPickerDelegate.js +328 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostSessionBranchActions.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostSessionBranchActions.js +94 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostSessionConfigPicker.d.ts +174 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostSessionConfigPicker.js +1390 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentMergeActions.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentMergeActions.js +468 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/exportDebugLogsAction.d.ts +7 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/exportDebugLogsAction.js +48 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/media/agentHostSessionConfigPicker.css +44 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/mobile/mobileAgentHostModePicker.d.ts +30 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/mobile/mobileAgentHostModePicker.js +78 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/mobile/mobileChatInputConfigPicker.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/mobile/mobileChatInputConfigPicker.js +345 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/mobile/mobileChatPhoneInputTarget.d.ts +11 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/mobile/mobileChatPhoneInputTarget.js +26 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/devContainerAgentHostService.js +6 -6
- package/vscode/src/vs/sessions/contrib/search/browser/search.contribution.js +3 -3
- package/vscode/src/vs/sessions/contrib/search/browser/searchEditorEmptyState.contribution.js +1 -1
- package/vscode/src/vs/sessions/contrib/sessions/browser/blockedSessionsIndicatorModel.js +4 -4
- package/vscode/src/vs/sessions/contrib/sessions/browser/blockedSessionsList.js +5 -5
- package/vscode/src/vs/sessions/contrib/sessions/browser/sessionDetailsAction.js +2 -2
- package/vscode/src/vs/sessions/contrib/sessions/browser/sessions.contribution.js +8 -8
- package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsActions.js +58 -58
- package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsTitleBarWidget.js +8 -8
- package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsWindowNotifier.js +5 -5
- package/vscode/src/vs/sessions/contrib/sessions/browser/views/automationTemplates.js +10 -10
- package/vscode/src/vs/sessions/contrib/sessions/browser/views/automationsAccessibility.js +38 -38
- package/vscode/src/vs/sessions/contrib/sessions/browser/views/automationsView.js +118 -118
- package/vscode/src/vs/sessions/contrib/sessions/browser/views/sessionsViewActions.js +53 -53
- package/vscode/src/vs/sessions/contrib/terminal/browser/agentHostSessionTaskRunner.d.ts +42 -0
- package/vscode/src/vs/sessions/contrib/terminal/browser/agentHostSessionTaskRunner.js +139 -0
- package/vscode/src/vs/sessions/contrib/terminal/browser/sessionsTerminalContribution.d.ts +120 -0
- package/vscode/src/vs/sessions/contrib/terminal/browser/sessionsTerminalContribution.js +741 -0
- package/vscode/src/vs/sessions/services/sessions/browser/sessionsManagementService.js +2 -2
- package/vscode/src/vs/sessions/services/sessions/browser/sessionsService.js +2 -2
- package/vscode/src/vs/workbench/browser/layout.js +1 -1
package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostSessionConfigPicker.js
ADDED
|
@@ -0,0 +1,1390 @@
|
|
|
1
|
+
|
|
2
|
+
import { registerCss } from '@codingame/monaco-vscode-api/css';
|
|
3
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
4
|
+
import * as agentHostSessionConfigPicker from './media/agentHostSessionConfigPicker.css';
|
|
5
|
+
import { getActiveElement, isHTMLElement, getActiveDocument, append, $, EventType, addDisposableListener, EventHelper, clearNode, isAncestorOfActiveElement, isAncestor, isActiveElement } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
|
|
6
|
+
import { Gesture, EventType as EventType$1 } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/touch';
|
|
7
|
+
import { renderIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/iconLabel/iconLabels';
|
|
8
|
+
import { ActionListItemKind } from '@codingame/monaco-vscode-api/vscode/vs/platform/actionWidget/browser/actionList';
|
|
9
|
+
import { IActionWidgetService } from '@codingame/monaco-vscode-api/vscode/vs/platform/actionWidget/browser/actionWidget.service';
|
|
10
|
+
import { BaseActionViewItem } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/actionbar/actionViewItems';
|
|
11
|
+
import { Checkbox } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/toggle/toggle';
|
|
12
|
+
import { toAction } from '@codingame/monaco-vscode-api/vscode/vs/base/common/actions';
|
|
13
|
+
import { Delayer, SequencerByKey } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
14
|
+
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
15
|
+
import { Disposable, MutableDisposable, DisposableStore, DisposableMap, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
16
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
17
|
+
import { ThemeIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/themables';
|
|
18
|
+
import { localize2, localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
19
|
+
import { IActionViewItemService } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/browser/actionViewItemService.service';
|
|
20
|
+
import { registerAction2, Action2, MenuId, MenuItemAction } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
|
|
21
|
+
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
22
|
+
import { ContextKeyExpr } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey';
|
|
23
|
+
import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
24
|
+
import { IDialogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
25
|
+
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
26
|
+
import { IHoverService } from '@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service';
|
|
27
|
+
import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
28
|
+
import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
|
|
29
|
+
import { defaultCheckboxStyles } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/browser/defaultStyles';
|
|
30
|
+
import { ChatConfiguration, isChatPermissionLevel } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
|
|
31
|
+
import { maybeConfirmElevatedPermissionLevel } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatPermissionWarnings';
|
|
32
|
+
import { ChatContextKeyExprs, ChatContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/actions/chatContextKeys';
|
|
33
|
+
import { markOnboardingTarget } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/onboarding/browser/spotlight/onboardingTarget';
|
|
34
|
+
import { registerWorkbenchContribution2, WorkbenchPhase } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/contributions';
|
|
35
|
+
import { IViewsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/views/common/viewsService.service';
|
|
36
|
+
import { IAgentWorkbenchLayoutService } from '@codingame/monaco-vscode-api/vscode/vs/sessions/browser/workbench.service';
|
|
37
|
+
import { Menus } from '@codingame/monaco-vscode-api/vscode/vs/sessions/browser/menus';
|
|
38
|
+
import { DevContainerWorktreeEnabledSettingId } from '@codingame/monaco-vscode-api/vscode/vs/sessions/common/devContainerAgentHostService';
|
|
39
|
+
import { SessionProviderIdContext, IsQuickChatSessionContext, IsPhoneLayoutContext } from '@codingame/monaco-vscode-api/vscode/vs/sessions/common/contextkeys';
|
|
40
|
+
import { IWorkbenchLayoutService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/browser/layoutService.service';
|
|
41
|
+
import { reportNewChatPickerClosed } from '@codingame/monaco-vscode-api/vscode/vs/sessions/contrib/chat/browser/newChatPickerTelemetry';
|
|
42
|
+
import '@codingame/monaco-vscode-api/vscode/vs/sessions/contrib/changes/browser/sessionChangesService';
|
|
43
|
+
import { CHANGES_VIEW_ID } from '@codingame/monaco-vscode-api/vscode/vs/sessions/contrib/changes/common/changes';
|
|
44
|
+
import { ISessionsProvidersService } from '@codingame/monaco-vscode-api/vscode/vs/sessions/services/sessions/browser/sessionsProvidersService.service';
|
|
45
|
+
import { ISessionContext } from '@codingame/monaco-vscode-api/vscode/vs/sessions/services/sessions/browser/sessionContext.service';
|
|
46
|
+
import { ISessionsService } from '@codingame/monaco-vscode-api/vscode/vs/sessions/services/sessions/browser/sessionsService.service';
|
|
47
|
+
import { REMOTE_AGENT_HOST_PROVIDER_RE, LOCAL_AGENT_HOST_PROVIDER_ID, isAgentHostProvider } from '@codingame/monaco-vscode-api/vscode/vs/sessions/common/agentHostSessionsProvider';
|
|
48
|
+
import { MobilePermissionPicker } from '@codingame/monaco-vscode-katex-common/vscode/vs/sessions/contrib/providers/copilotChatSessions/browser/mobilePermissionPicker';
|
|
49
|
+
import { isPhoneLayout } from '@codingame/monaco-vscode-api/vscode/vs/sessions/browser/parts/mobile/mobileLayout';
|
|
50
|
+
import { showMobilePickerSheet, MOBILE_PICKER_SHEET_CONFIRM } from '@codingame/monaco-vscode-api/vscode/vs/sessions/browser/parts/mobile/mobilePickerSheet';
|
|
51
|
+
import { AgentHostModePicker } from './agentHostModePicker.js';
|
|
52
|
+
import { MobileAgentHostModePicker } from './mobile/mobileAgentHostModePicker.js';
|
|
53
|
+
import { AgentHostPermissionPickerActionItem } from './agentHostPermissionPickerActionItem.js';
|
|
54
|
+
import { isWellKnownClaudePermissionModeSchema, isWellKnownCodexApprovalsSchema, AgentHostPermissionPickerDelegate } from './agentHostPermissionPickerDelegate.js';
|
|
55
|
+
import { SessionConfigKey } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/sessionConfigKeys';
|
|
56
|
+
import { AGENT_HOST_CHECKOUT_CHANGESET_OPERATION_ID } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentHostChangesetOperationService';
|
|
57
|
+
import { checkoutOperationMeta, isCheckoutOperationDirtyWorkingTreeErrorData, CheckoutOperationPreAction } from '../../../../../platform/agentHost/common/meta/agentCheckoutOperationMeta.js';
|
|
58
|
+
import { ProtocolError } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/sessionProtocol';
|
|
59
|
+
import { AgentHostClaudePermissionModePicker } from './agentHostClaudePermissionModePicker.js';
|
|
60
|
+
import { ClaudeSessionConfigKey } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/claudeSessionConfigKeys';
|
|
61
|
+
import { AgentHostCodexApprovalsPicker } from './agentHostCodexApprovalsPicker.js';
|
|
62
|
+
import { isAutoApproveValuePolicyRestricted } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/agentHostConfigPolicy';
|
|
63
|
+
import { CodexSessionConfigKey } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/codexSessionConfigKeys';
|
|
64
|
+
import { UNCOMMITTED_CHANGES_CHANGESET_ID } from '@codingame/monaco-vscode-api/vscode/vs/sessions/services/sessions/common/session';
|
|
65
|
+
import { MarkdownString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
|
|
66
|
+
import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableValue';
|
|
67
|
+
import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/reactions/autorun';
|
|
68
|
+
import { isWellKnownAutoApproveSchema, isWellKnownModeSchema } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostModePickerPresentation';
|
|
69
|
+
import { ISessionChangesService } from '@codingame/monaco-vscode-api/vscode/vs/sessions/contrib/changes/common/sessionChangesService.service';
|
|
70
|
+
|
|
71
|
+
registerCss(agentHostSessionConfigPicker, 1);
|
|
72
|
+
const IsActiveSessionRemoteAgentHost = ( ContextKeyExpr.regex(SessionProviderIdContext.key, REMOTE_AGENT_HOST_PROVIDER_RE));
|
|
73
|
+
const IsActiveSessionLocalAgentHost = ( ContextKeyExpr.equals(SessionProviderIdContext.key, LOCAL_AGENT_HOST_PROVIDER_ID));
|
|
74
|
+
function showActiveSessionModePicker(accessor) {
|
|
75
|
+
const activeElement = getActiveElement();
|
|
76
|
+
const anchor = isHTMLElement(activeElement) ? activeElement : getActiveDocument().body;
|
|
77
|
+
const picker = accessor.get(IInstantiationService).createInstance(
|
|
78
|
+
isPhoneLayout(accessor.get(IWorkbenchLayoutService)) ? MobileAgentHostModePicker : AgentHostModePicker,
|
|
79
|
+
accessor.get(ISessionsService).activeSession
|
|
80
|
+
);
|
|
81
|
+
if (!picker.showPicker(anchor, () => picker.dispose())) {
|
|
82
|
+
picker.dispose();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
registerAction2(class extends Action2 {
|
|
86
|
+
constructor() {
|
|
87
|
+
super({
|
|
88
|
+
id: "sessions.agentHost.sessionConfigPicker",
|
|
89
|
+
title: ( localize2(4212, "Session Configuration")),
|
|
90
|
+
f1: false,
|
|
91
|
+
menu: [{
|
|
92
|
+
id: Menus.NewSessionRepositoryConfig,
|
|
93
|
+
group: "navigation",
|
|
94
|
+
order: 3,
|
|
95
|
+
when: ( ContextKeyExpr.and(( ContextKeyExpr.or(IsActiveSessionLocalAgentHost, IsActiveSessionRemoteAgentHost)), ( IsQuickChatSessionContext.negate())))
|
|
96
|
+
}]
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
async run() {}
|
|
100
|
+
});
|
|
101
|
+
function getConfigIcon(property, value, hasUncommittedChanges = false) {
|
|
102
|
+
if (property === SessionConfigKey.Isolation) {
|
|
103
|
+
if (value === "folder") {
|
|
104
|
+
return Codicon.folder;
|
|
105
|
+
}
|
|
106
|
+
if (value === "worktree") {
|
|
107
|
+
return Codicon.worktree;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (property === SessionConfigKey.Branch) {
|
|
111
|
+
return hasUncommittedChanges ? Codicon.gitBranchChanges : Codicon.gitBranch;
|
|
112
|
+
}
|
|
113
|
+
if (property === SessionConfigKey.AutoApprove) {
|
|
114
|
+
if (value === "autopilot") {
|
|
115
|
+
return Codicon.rocket;
|
|
116
|
+
}
|
|
117
|
+
if (value === "autoApprove") {
|
|
118
|
+
return Codicon.warning;
|
|
119
|
+
}
|
|
120
|
+
if (value === "assisted") {
|
|
121
|
+
return Codicon.sparkle;
|
|
122
|
+
}
|
|
123
|
+
return Codicon.shield;
|
|
124
|
+
}
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
127
|
+
function formatUncommittedChanges(count) {
|
|
128
|
+
return count === 1 ? ( localize(4213, "1 uncommitted file")) : ( localize(4214, "{0} uncommitted files", count));
|
|
129
|
+
}
|
|
130
|
+
function getBranchUncommittedChanges(branchName, repositoryBranchName, repositoryUncommittedChanges) {
|
|
131
|
+
return branchName === repositoryBranchName && (repositoryUncommittedChanges ?? 0) > 0 ? repositoryUncommittedChanges : undefined;
|
|
132
|
+
}
|
|
133
|
+
function toActionItems(
|
|
134
|
+
property,
|
|
135
|
+
items,
|
|
136
|
+
currentValue,
|
|
137
|
+
policyRestricted,
|
|
138
|
+
repositoryBranchName,
|
|
139
|
+
repositoryUncommittedChanges,
|
|
140
|
+
onShowChanges
|
|
141
|
+
) {
|
|
142
|
+
const actionItems = items.map(item => {
|
|
143
|
+
const disabled = property === SessionConfigKey.AutoApprove && isAutoApproveValuePolicyRestricted(item.value, policyRestricted === true);
|
|
144
|
+
const checked = isSelectedValue(currentValue, item.value);
|
|
145
|
+
const uncommittedChanges = property === SessionConfigKey.Branch ? getBranchUncommittedChanges(item.value, repositoryBranchName, repositoryUncommittedChanges) : undefined;
|
|
146
|
+
const uncommittedChangesDescription = uncommittedChanges !== undefined ? formatUncommittedChanges(uncommittedChanges) : undefined;
|
|
147
|
+
return {
|
|
148
|
+
kind: ActionListItemKind.Action,
|
|
149
|
+
label: item.label,
|
|
150
|
+
detail: disabled ? ( localize(4215, "Disabled by your organization. Contact your administrator.")) : uncommittedChangesDescription ?? item.description,
|
|
151
|
+
group: {
|
|
152
|
+
title: "",
|
|
153
|
+
icon: getConfigIcon(property, item.value, uncommittedChanges !== undefined)
|
|
154
|
+
},
|
|
155
|
+
ariaDescription: uncommittedChangesDescription,
|
|
156
|
+
disabled,
|
|
157
|
+
item: {
|
|
158
|
+
...item,
|
|
159
|
+
checked
|
|
160
|
+
},
|
|
161
|
+
toolbarActions: property === SessionConfigKey.Branch && item.value === repositoryBranchName && onShowChanges ? [toAction({
|
|
162
|
+
id: "sessions.agentHost.showBranchChanges",
|
|
163
|
+
label: ( localize(4216, "Show Changes")),
|
|
164
|
+
class: ThemeIcon.asClassName(Codicon.diffMultiple),
|
|
165
|
+
run: onShowChanges
|
|
166
|
+
})] : undefined
|
|
167
|
+
};
|
|
168
|
+
});
|
|
169
|
+
if (property === SessionConfigKey.Branch) {
|
|
170
|
+
const currentIndex = actionItems.findIndex(item => item.item?.checked);
|
|
171
|
+
if (currentIndex >= 0) {
|
|
172
|
+
const [current] = actionItems.splice(currentIndex, 1);
|
|
173
|
+
actionItems.unshift(current);
|
|
174
|
+
if (actionItems.length > 1) {
|
|
175
|
+
actionItems.splice(1, 0, {
|
|
176
|
+
kind: ActionListItemKind.Separator,
|
|
177
|
+
label: ""
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return actionItems;
|
|
183
|
+
}
|
|
184
|
+
function isSelectedValue(currentValue, itemValue) {
|
|
185
|
+
if (typeof currentValue === "boolean") {
|
|
186
|
+
return currentValue === (itemValue === "true");
|
|
187
|
+
}
|
|
188
|
+
return itemValue === currentValue;
|
|
189
|
+
}
|
|
190
|
+
function renderPickerTrigger(slot, disabled, disposables, onOpen) {
|
|
191
|
+
const trigger = append(slot, disabled ? $("span.action-label") : $("a.action-label"));
|
|
192
|
+
if (disabled) {
|
|
193
|
+
trigger.setAttribute("aria-readonly", "true");
|
|
194
|
+
} else {
|
|
195
|
+
trigger.role = "button";
|
|
196
|
+
trigger.tabIndex = 0;
|
|
197
|
+
trigger.setAttribute("aria-haspopup", "listbox");
|
|
198
|
+
disposables.add(Gesture.addTarget(trigger));
|
|
199
|
+
for (const eventType of [EventType.CLICK, EventType$1.Tap]) {
|
|
200
|
+
disposables.add(addDisposableListener(trigger, eventType, e => {
|
|
201
|
+
EventHelper.stop(e, true);
|
|
202
|
+
onOpen();
|
|
203
|
+
}));
|
|
204
|
+
}
|
|
205
|
+
disposables.add(addDisposableListener(trigger, EventType.KEY_DOWN, e => {
|
|
206
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
207
|
+
EventHelper.stop(e, true);
|
|
208
|
+
onOpen();
|
|
209
|
+
}
|
|
210
|
+
}));
|
|
211
|
+
}
|
|
212
|
+
slot.classList.toggle("disabled", disabled);
|
|
213
|
+
return trigger;
|
|
214
|
+
}
|
|
215
|
+
function applyAutoApproveFiltering(items, property, configurationService) {
|
|
216
|
+
if (property !== SessionConfigKey.AutoApprove) {
|
|
217
|
+
return {
|
|
218
|
+
items,
|
|
219
|
+
policyRestricted: false
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
const policyRestricted = configurationService.inspect(ChatConfiguration.GlobalAutoApprove).policyValue === false;
|
|
223
|
+
return {
|
|
224
|
+
items,
|
|
225
|
+
policyRestricted
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
async function confirmAutoApproveLevel(value, label, dialogService, storageService) {
|
|
229
|
+
if (!isChatPermissionLevel(value)) {
|
|
230
|
+
return true;
|
|
231
|
+
}
|
|
232
|
+
return maybeConfirmElevatedPermissionLevel(value, dialogService, storageService, {
|
|
233
|
+
defaultSettingKey: ChatConfiguration.DefaultConfiguration,
|
|
234
|
+
levelLabel: label
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
function triggerAriaLabel(title, label, isReadOnly, hasUncommittedChanges) {
|
|
238
|
+
if (hasUncommittedChanges) {
|
|
239
|
+
return isReadOnly ? ( localize(4217, "{0}: {1}, Uncommitted Files, Read-Only", title, label)) : ( localize(4218, "{0}: {1}, Uncommitted Files", title, label));
|
|
240
|
+
}
|
|
241
|
+
return isReadOnly ? ( localize(4219, "{0}: {1}, Read-Only", title, label)) : ( localize(4220, "{0}: {1}", title, label));
|
|
242
|
+
}
|
|
243
|
+
class ConfigCheckboxControl extends Disposable {
|
|
244
|
+
constructor(sessionId, label, className, _hoverService, onToggle, onboardingTarget) {
|
|
245
|
+
super();
|
|
246
|
+
this.sessionId = sessionId;
|
|
247
|
+
this._hoverService = _hoverService;
|
|
248
|
+
this._hover = this._register(( new MutableDisposable()));
|
|
249
|
+
this._enabled = true;
|
|
250
|
+
this.slot = $(".sessions-chat-picker-slot.sessions-chat-config-checkbox");
|
|
251
|
+
this.slot.classList.add(className);
|
|
252
|
+
this._row = append(this.slot, $(".action-label"));
|
|
253
|
+
this.checkbox = this._register(( new Checkbox(label, false, {
|
|
254
|
+
...defaultCheckboxStyles,
|
|
255
|
+
size: 14
|
|
256
|
+
})));
|
|
257
|
+
append(this._row, this.checkbox.domNode);
|
|
258
|
+
const labelSpan = append(this._row, $("span.sessions-chat-dropdown-label"));
|
|
259
|
+
labelSpan.textContent = label;
|
|
260
|
+
if (onboardingTarget) {
|
|
261
|
+
this._register(markOnboardingTarget(this.slot, onboardingTarget));
|
|
262
|
+
}
|
|
263
|
+
this._register(this.checkbox.onChange(() => onToggle(this.checkbox.checked)));
|
|
264
|
+
this._register(Gesture.addTarget(this._row));
|
|
265
|
+
for (const eventType of [EventType.CLICK, EventType$1.Tap]) {
|
|
266
|
+
this._register(addDisposableListener(this._row, eventType, e => {
|
|
267
|
+
EventHelper.stop(e, true);
|
|
268
|
+
if (!this._enabled) {
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
this.checkbox.checked = !this.checkbox.checked;
|
|
272
|
+
onToggle(this.checkbox.checked);
|
|
273
|
+
}));
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
update(checked, readOnly, resolving, tooltip) {
|
|
277
|
+
this._enabled = !readOnly && !resolving;
|
|
278
|
+
this.checkbox.checked = checked;
|
|
279
|
+
if (readOnly) {
|
|
280
|
+
this.checkbox.disable();
|
|
281
|
+
} else {
|
|
282
|
+
this.checkbox.enable();
|
|
283
|
+
this.checkbox.domNode.setAttribute("aria-disabled", resolving ? "true" : "false");
|
|
284
|
+
}
|
|
285
|
+
this.slot.classList.toggle("disabled", readOnly);
|
|
286
|
+
this.slot.classList.toggle("resolving", !readOnly && resolving);
|
|
287
|
+
if (this._tooltip !== tooltip) {
|
|
288
|
+
this._tooltip = tooltip;
|
|
289
|
+
this._hover.value = tooltip ? this._hoverService.setupDelayedHover(this._row, {
|
|
290
|
+
content: tooltip
|
|
291
|
+
}) : undefined;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
dispose() {
|
|
295
|
+
this.slot.remove();
|
|
296
|
+
super.dispose();
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
let AgentHostSessionConfigPicker = class AgentHostSessionConfigPicker extends Disposable {
|
|
300
|
+
constructor(
|
|
301
|
+
_session,
|
|
302
|
+
_actionWidgetService,
|
|
303
|
+
_configurationService,
|
|
304
|
+
_contextKeyService,
|
|
305
|
+
_dialogService,
|
|
306
|
+
_hoverService,
|
|
307
|
+
_sessionsProvidersService,
|
|
308
|
+
_telemetryService,
|
|
309
|
+
_layoutService,
|
|
310
|
+
_storageService,
|
|
311
|
+
_sessionChangesService,
|
|
312
|
+
_viewsService
|
|
313
|
+
) {
|
|
314
|
+
super();
|
|
315
|
+
this._session = _session;
|
|
316
|
+
this._actionWidgetService = _actionWidgetService;
|
|
317
|
+
this._configurationService = _configurationService;
|
|
318
|
+
this._contextKeyService = _contextKeyService;
|
|
319
|
+
this._dialogService = _dialogService;
|
|
320
|
+
this._hoverService = _hoverService;
|
|
321
|
+
this._sessionsProvidersService = _sessionsProvidersService;
|
|
322
|
+
this._telemetryService = _telemetryService;
|
|
323
|
+
this._layoutService = _layoutService;
|
|
324
|
+
this._storageService = _storageService;
|
|
325
|
+
this._sessionChangesService = _sessionChangesService;
|
|
326
|
+
this._viewsService = _viewsService;
|
|
327
|
+
this._renderDisposables = this._register(( new DisposableStore()));
|
|
328
|
+
this._providerListeners = this._register(( new DisposableMap()));
|
|
329
|
+
this._isolationCheckbox = this._register(( new MutableDisposable()));
|
|
330
|
+
this._hostMarker = this._register(( new MutableDisposable()));
|
|
331
|
+
this._filterDelayer = this._register(( new Delayer(200)));
|
|
332
|
+
this._repositoryConfigSequencer = ( new SequencerByKey());
|
|
333
|
+
this._dynamicValueLabels = ( new Map());
|
|
334
|
+
this._register(autorun(reader => {
|
|
335
|
+
const session = this._session.read(reader);
|
|
336
|
+
for (const changeset of session?.changesets?.read(reader) ?? []) {
|
|
337
|
+
changeset.operations?.read(reader);
|
|
338
|
+
}
|
|
339
|
+
this._renderConfigPickers();
|
|
340
|
+
}));
|
|
341
|
+
this._register(this._sessionsProvidersService.onDidChangeProviders(e => {
|
|
342
|
+
for (const provider of e.removed) {
|
|
343
|
+
this._providerListeners.deleteAndDispose(provider.id);
|
|
344
|
+
}
|
|
345
|
+
this._watchProviders(e.added);
|
|
346
|
+
this._renderConfigPickers();
|
|
347
|
+
}));
|
|
348
|
+
this._watchProviders(this._sessionsProvidersService.getProviders());
|
|
349
|
+
this._register(this._configurationService.onDidChangeConfiguration(e => {
|
|
350
|
+
if (e.affectsConfiguration(DevContainerWorktreeEnabledSettingId)) {
|
|
351
|
+
this._renderConfigPickers();
|
|
352
|
+
}
|
|
353
|
+
}));
|
|
354
|
+
this._register(this._contextKeyService.onDidChangeContext(e => {
|
|
355
|
+
if (e.affectsSome(( new Set([IsPhoneLayoutContext.key])))) {
|
|
356
|
+
this._renderConfigPickers();
|
|
357
|
+
}
|
|
358
|
+
}));
|
|
359
|
+
}
|
|
360
|
+
_watchProviders(providers) {
|
|
361
|
+
for (const provider of providers) {
|
|
362
|
+
if (!isAgentHostProvider(provider) || ( this._providerListeners.has(provider.id))) {
|
|
363
|
+
continue;
|
|
364
|
+
}
|
|
365
|
+
this._providerListeners.set(
|
|
366
|
+
provider.id,
|
|
367
|
+
provider.onDidChangeSessionConfig(() => this._renderConfigPickers())
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
render(container) {
|
|
372
|
+
this._isolationCheckbox.clear();
|
|
373
|
+
container.classList.add("sessions-chat-agent-host-config-host");
|
|
374
|
+
this._hostMarker.value = toDisposable(() => container.classList.remove("sessions-chat-agent-host-config-host"));
|
|
375
|
+
this._container = append(container, $(".sessions-chat-agent-host-config"));
|
|
376
|
+
this._renderConfigPickers();
|
|
377
|
+
}
|
|
378
|
+
_renderConfigPickers() {
|
|
379
|
+
if (!this._container) {
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
this._renderDisposables.clear();
|
|
383
|
+
const checkboxSlots = ( new Set([this._isolationCheckbox.value?.slot]));
|
|
384
|
+
for (const child of Array.from(this._container.children)) {
|
|
385
|
+
if (!( checkboxSlots.has(child))) {
|
|
386
|
+
child.remove();
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
const session = this._session.get();
|
|
390
|
+
this._evictDynamicValueLabelsForOtherSessions(session?.sessionId);
|
|
391
|
+
const provider = session ? this._getProvider(session.providerId) : undefined;
|
|
392
|
+
const resolvedConfig = session && provider?.getSessionConfig(session.sessionId);
|
|
393
|
+
if (!session || !provider || !resolvedConfig) {
|
|
394
|
+
this._isolationCheckbox.clear();
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
const isNewSession = provider.getCreateSessionConfig(session.sessionId) !== undefined;
|
|
398
|
+
const isLoading = provider.isSessionConfigResolving(session.sessionId).get();
|
|
399
|
+
const properties = this._orderProperties(Object.entries(resolvedConfig.schema.properties));
|
|
400
|
+
let renderedIsolationCheckbox = false;
|
|
401
|
+
for (const [property, schema] of properties) {
|
|
402
|
+
if (!this._isPickable(schema)) {
|
|
403
|
+
continue;
|
|
404
|
+
}
|
|
405
|
+
if (property === SessionConfigKey.SandboxEnabled) {
|
|
406
|
+
continue;
|
|
407
|
+
}
|
|
408
|
+
if (property === SessionConfigKey.WorktreeBranchTrack || property === SessionConfigKey.WorktreeCreateNewBranch) {
|
|
409
|
+
continue;
|
|
410
|
+
}
|
|
411
|
+
if (property === SessionConfigKey.Isolation && !schema.enum?.includes("worktree")) {
|
|
412
|
+
continue;
|
|
413
|
+
}
|
|
414
|
+
if (!this._shouldRenderProperty(property, schema, isNewSession)) {
|
|
415
|
+
continue;
|
|
416
|
+
}
|
|
417
|
+
if (property === SessionConfigKey.AutoApprove && isWellKnownAutoApproveSchema(schema)) {
|
|
418
|
+
continue;
|
|
419
|
+
}
|
|
420
|
+
if (property === SessionConfigKey.Mode && isWellKnownModeSchema(schema)) {
|
|
421
|
+
continue;
|
|
422
|
+
}
|
|
423
|
+
if (property === ClaudeSessionConfigKey.PermissionMode && isWellKnownClaudePermissionModeSchema(schema)) {
|
|
424
|
+
continue;
|
|
425
|
+
}
|
|
426
|
+
if (property === CodexSessionConfigKey.PermissionsPreset && isWellKnownCodexApprovalsSchema(schema)) {
|
|
427
|
+
continue;
|
|
428
|
+
}
|
|
429
|
+
const value = resolvedConfig.values[property] ?? schema.default;
|
|
430
|
+
const isReadOnly = this._isReadOnlyChip(property, schema, isNewSession) || (this._requiresBranchCheckout(provider, session.sessionId, property) && !this._getCheckoutChangeset(session.sessionId));
|
|
431
|
+
if (property === SessionConfigKey.Isolation && this._shouldRenderIsolationAsCheckbox(schema)) {
|
|
432
|
+
this._renderIsolationCheckbox(
|
|
433
|
+
provider,
|
|
434
|
+
session.sessionId,
|
|
435
|
+
schema,
|
|
436
|
+
value,
|
|
437
|
+
isReadOnly,
|
|
438
|
+
!isReadOnly && isLoading
|
|
439
|
+
);
|
|
440
|
+
renderedIsolationCheckbox = true;
|
|
441
|
+
continue;
|
|
442
|
+
}
|
|
443
|
+
const slot = append(this._container, $(".sessions-chat-picker-slot"));
|
|
444
|
+
if (property === SessionConfigKey.Isolation) {
|
|
445
|
+
this._renderDisposables.add(markOnboardingTarget(slot, "sessions.newSession.isolation"));
|
|
446
|
+
}
|
|
447
|
+
const trigger = renderPickerTrigger(
|
|
448
|
+
slot,
|
|
449
|
+
isReadOnly,
|
|
450
|
+
this._renderDisposables,
|
|
451
|
+
() => this._showPicker(provider, session.sessionId, property, schema, trigger)
|
|
452
|
+
);
|
|
453
|
+
const tooltip = property !== SessionConfigKey.Branch ? (schema.description ?? schema.title) : undefined;
|
|
454
|
+
if (tooltip) {
|
|
455
|
+
this._renderDisposables.add(this._hoverService.setupDelayedHover(trigger, {
|
|
456
|
+
content: tooltip
|
|
457
|
+
}));
|
|
458
|
+
}
|
|
459
|
+
if (!isReadOnly && isLoading) {
|
|
460
|
+
slot.classList.add("resolving");
|
|
461
|
+
trigger.setAttribute("aria-disabled", "true");
|
|
462
|
+
}
|
|
463
|
+
this._renderTrigger(trigger, session.sessionId, property, schema, value, isReadOnly);
|
|
464
|
+
}
|
|
465
|
+
if (!renderedIsolationCheckbox) {
|
|
466
|
+
this._isolationCheckbox.clear();
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
_isPickable(schema) {
|
|
470
|
+
if (schema.type === "boolean") {
|
|
471
|
+
return true;
|
|
472
|
+
}
|
|
473
|
+
if (schema.type !== "string") {
|
|
474
|
+
return false;
|
|
475
|
+
}
|
|
476
|
+
return !!schema.enumDynamic || (Array.isArray(schema.enum) && schema.enum.length > 0);
|
|
477
|
+
}
|
|
478
|
+
_orderProperties(properties) {
|
|
479
|
+
const order = ( new Map([[SessionConfigKey.Isolation, 0], [SessionConfigKey.Branch, 1]]));
|
|
480
|
+
return properties.map(([key, schema], index) => ({
|
|
481
|
+
key,
|
|
482
|
+
schema,
|
|
483
|
+
index
|
|
484
|
+
})).sort((a, b) => {
|
|
485
|
+
const aRank = order.get(a.key) ?? Number.MAX_SAFE_INTEGER;
|
|
486
|
+
const bRank = order.get(b.key) ?? Number.MAX_SAFE_INTEGER;
|
|
487
|
+
return aRank - bRank || a.index - b.index;
|
|
488
|
+
}).map((
|
|
489
|
+
{
|
|
490
|
+
key,
|
|
491
|
+
schema
|
|
492
|
+
}
|
|
493
|
+
) => [key, schema]);
|
|
494
|
+
}
|
|
495
|
+
_shouldRenderProperty(property, schema, isNewSession) {
|
|
496
|
+
return isNewSession || !!schema.sessionMutable;
|
|
497
|
+
}
|
|
498
|
+
_isReadOnlyChip(property, schema, isNewSession) {
|
|
499
|
+
return !!schema.readOnly;
|
|
500
|
+
}
|
|
501
|
+
async _setSessionConfigValue(provider, sessionId, property, value) {
|
|
502
|
+
const isDraftRepositoryProperty = provider.getCreateSessionConfig(sessionId) !== undefined && (property === SessionConfigKey.Isolation || property === SessionConfigKey.Branch);
|
|
503
|
+
if (!isDraftRepositoryProperty) {
|
|
504
|
+
await provider.setSessionConfigValue(sessionId, property, value);
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
let treeish;
|
|
508
|
+
if (property === SessionConfigKey.Branch) {
|
|
509
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
510
|
+
throw ( new Error("Branch configuration values must be non-empty strings."));
|
|
511
|
+
}
|
|
512
|
+
treeish = value;
|
|
513
|
+
}
|
|
514
|
+
const configOperation = this._repositoryConfigSequencer.queue(sessionId, async () => {
|
|
515
|
+
const shouldCheckout = this._requiresBranchCheckout(provider, sessionId, property);
|
|
516
|
+
if (!shouldCheckout) {
|
|
517
|
+
await provider.setSessionConfigValue(sessionId, property, value);
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
if (!treeish) {
|
|
521
|
+
throw ( new Error("Branch checkout requires a non-empty treeish."));
|
|
522
|
+
}
|
|
523
|
+
const changeset = this._getCheckoutChangeset(sessionId);
|
|
524
|
+
if (!changeset) {
|
|
525
|
+
throw ( new Error("Branch checkout is not available for this session."));
|
|
526
|
+
}
|
|
527
|
+
const checkedOut = await this._invokeCheckoutOperation(changeset, treeish);
|
|
528
|
+
if (checkedOut) {
|
|
529
|
+
await provider.setSessionConfigValue(sessionId, property, value);
|
|
530
|
+
}
|
|
531
|
+
});
|
|
532
|
+
provider.trackSessionConfigOperation(sessionId, configOperation);
|
|
533
|
+
await configOperation;
|
|
534
|
+
}
|
|
535
|
+
async _invokeCheckoutOperation(changeset, treeish) {
|
|
536
|
+
let errorMessage;
|
|
537
|
+
try {
|
|
538
|
+
await changeset.invokeOperation(
|
|
539
|
+
AGENT_HOST_CHECKOUT_CHANGESET_OPERATION_ID,
|
|
540
|
+
undefined,
|
|
541
|
+
checkoutOperationMeta(treeish)
|
|
542
|
+
);
|
|
543
|
+
return true;
|
|
544
|
+
} catch (error) {
|
|
545
|
+
if (!(error instanceof ProtocolError) || !isCheckoutOperationDirtyWorkingTreeErrorData(error.data)) {
|
|
546
|
+
throw error;
|
|
547
|
+
}
|
|
548
|
+
errorMessage = error instanceof Error ? error.message : String(error);
|
|
549
|
+
}
|
|
550
|
+
const {
|
|
551
|
+
result
|
|
552
|
+
} = await this._dialogService.prompt({
|
|
553
|
+
type: "warning",
|
|
554
|
+
message: ( localize(
|
|
555
|
+
4221,
|
|
556
|
+
"Your local changes would be overwritten when checking out '{0}'.",
|
|
557
|
+
treeish
|
|
558
|
+
)),
|
|
559
|
+
detail: ( new MarkdownString(errorMessage)),
|
|
560
|
+
buttons: [{
|
|
561
|
+
label: ( localize(4222, "Stash & Checkout")),
|
|
562
|
+
run: () => CheckoutOperationPreAction.Stash
|
|
563
|
+
}, {
|
|
564
|
+
label: ( localize(4223, "Commit & Checkout")),
|
|
565
|
+
run: () => CheckoutOperationPreAction.Commit
|
|
566
|
+
}],
|
|
567
|
+
cancelButton: true
|
|
568
|
+
});
|
|
569
|
+
if (!result) {
|
|
570
|
+
return false;
|
|
571
|
+
}
|
|
572
|
+
await changeset.invokeOperation(
|
|
573
|
+
AGENT_HOST_CHECKOUT_CHANGESET_OPERATION_ID,
|
|
574
|
+
undefined,
|
|
575
|
+
checkoutOperationMeta(treeish, result)
|
|
576
|
+
);
|
|
577
|
+
return true;
|
|
578
|
+
}
|
|
579
|
+
_requiresBranchCheckout(provider, sessionId, property) {
|
|
580
|
+
return property === SessionConfigKey.Branch && provider.getCreateSessionConfig(sessionId) !== undefined && provider.getSessionConfig(sessionId)?.values[SessionConfigKey.Isolation] === "folder";
|
|
581
|
+
}
|
|
582
|
+
_getCheckoutChangeset(sessionId) {
|
|
583
|
+
const session = this._session.get();
|
|
584
|
+
if (session?.sessionId !== sessionId) {
|
|
585
|
+
return undefined;
|
|
586
|
+
}
|
|
587
|
+
return session.changesets.get()?.find(
|
|
588
|
+
changeset => changeset.id === UNCOMMITTED_CHANGES_CHANGESET_ID && ( changeset.operations.get().some(operation => operation.id === AGENT_HOST_CHECKOUT_CHANGESET_OPERATION_ID))
|
|
589
|
+
);
|
|
590
|
+
}
|
|
591
|
+
_renderTrigger(trigger, sessionId, property, schema, value, isReadOnly) {
|
|
592
|
+
clearNode(trigger);
|
|
593
|
+
const icon = getConfigIcon(property, value);
|
|
594
|
+
const iconElement = icon ? append(trigger, renderIcon(icon)) : undefined;
|
|
595
|
+
const labelSpan = append(trigger, $("span.sessions-chat-dropdown-label"));
|
|
596
|
+
const label = this._getLabel(sessionId, property, schema, value);
|
|
597
|
+
labelSpan.textContent = label;
|
|
598
|
+
trigger.setAttribute("aria-label", triggerAriaLabel(schema.title, label, isReadOnly, false));
|
|
599
|
+
if (property === SessionConfigKey.Branch && icon && iconElement) {
|
|
600
|
+
this._trackBranchRepositoryState(trigger, iconElement, icon, schema, label, value, isReadOnly);
|
|
601
|
+
} else if (property === SessionConfigKey.AutoApprove) {
|
|
602
|
+
trigger.classList.toggle("warning", value === "autopilot" || value === "assisted");
|
|
603
|
+
trigger.classList.toggle("info", value === "autoApprove");
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
_trackBranchRepositoryState(trigger, iconElement, icon, schema, label, value, isReadOnly) {
|
|
607
|
+
let appliedHoverContent;
|
|
608
|
+
const hover = this._renderDisposables.add(( new MutableDisposable()));
|
|
609
|
+
this._renderDisposables.add(autorun(reader => {
|
|
610
|
+
const session = this._session.read(reader);
|
|
611
|
+
const repository = session?.workspace.read(reader)?.folders[0]?.gitRepository;
|
|
612
|
+
const uncommittedChanges = typeof value === "string" ? getBranchUncommittedChanges(value, repository?.branchName, repository?.uncommittedChanges) : undefined;
|
|
613
|
+
const hasUncommittedChanges = uncommittedChanges !== undefined;
|
|
614
|
+
iconElement.className = "";
|
|
615
|
+
iconElement.classList.add(
|
|
616
|
+
...ThemeIcon.asClassNameArray(hasUncommittedChanges ? Codicon.gitBranchChanges : icon)
|
|
617
|
+
);
|
|
618
|
+
trigger.setAttribute(
|
|
619
|
+
"aria-label",
|
|
620
|
+
triggerAriaLabel(schema.title, label, isReadOnly, hasUncommittedChanges)
|
|
621
|
+
);
|
|
622
|
+
const branchName = schema.description ?? schema.title;
|
|
623
|
+
const content = !hasUncommittedChanges ? branchName : uncommittedChanges === 1 ? ( localize(4224, "{0}, {1} uncommitted file", branchName, uncommittedChanges)) : ( localize(4225, "{0}, {1} uncommitted files", branchName, uncommittedChanges));
|
|
624
|
+
if (appliedHoverContent !== content) {
|
|
625
|
+
appliedHoverContent = content;
|
|
626
|
+
hover.clear();
|
|
627
|
+
hover.value = content ? this._hoverService.setupDelayedHover(trigger, {
|
|
628
|
+
content
|
|
629
|
+
}) : undefined;
|
|
630
|
+
}
|
|
631
|
+
}));
|
|
632
|
+
}
|
|
633
|
+
_shouldRenderIsolationAsCheckbox(schema) {
|
|
634
|
+
return !isPhoneLayout(this._layoutService) && Array.isArray(schema.enum) && schema.enum.includes("worktree") && schema.enum.includes("folder");
|
|
635
|
+
}
|
|
636
|
+
_renderIsolationCheckbox(provider, sessionId, schema, value, isReadOnly, isLoading) {
|
|
637
|
+
const label = ( localize(4226, "New Worktree"));
|
|
638
|
+
const worktreeIndex = schema.enum?.indexOf("worktree") ?? -1;
|
|
639
|
+
const checked = value === "worktree";
|
|
640
|
+
const combinationDisabled = !this._isDevContainerWorktreeEnabled() && provider.isDevContainerEnabled?.(sessionId) === true && !checked;
|
|
641
|
+
const tooltip = combinationDisabled ? ( localize(4227, "New Worktree cannot be combined with Dev Container execution.")) : (worktreeIndex >= 0 ? schema.enumDescriptions?.[worktreeIndex] : undefined) ?? schema.description ?? schema.title;
|
|
642
|
+
let control = this._isolationCheckbox.value;
|
|
643
|
+
if (!control || control.sessionId !== sessionId) {
|
|
644
|
+
control = ( new ConfigCheckboxControl(
|
|
645
|
+
sessionId,
|
|
646
|
+
label,
|
|
647
|
+
"sessions-chat-isolation-checkbox",
|
|
648
|
+
this._hoverService,
|
|
649
|
+
checked => this._applyIsolationValue(sessionId, checked),
|
|
650
|
+
"sessions.newSession.isolation"
|
|
651
|
+
));
|
|
652
|
+
this._isolationCheckbox.value = control;
|
|
653
|
+
this._container?.prepend(control.slot);
|
|
654
|
+
}
|
|
655
|
+
control.update(checked, isReadOnly || combinationDisabled, isLoading, tooltip);
|
|
656
|
+
}
|
|
657
|
+
_isDevContainerWorktreeEnabled() {
|
|
658
|
+
return this._configurationService.getValue(DevContainerWorktreeEnabledSettingId) === true;
|
|
659
|
+
}
|
|
660
|
+
_applyIsolationValue(sessionId, checked) {
|
|
661
|
+
const session = this._session.get();
|
|
662
|
+
if (!session || session.sessionId !== sessionId) {
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
const provider = this._getProvider(session.providerId);
|
|
666
|
+
const resolvedConfig = provider?.getSessionConfig(sessionId);
|
|
667
|
+
const schema = resolvedConfig?.schema.properties[SessionConfigKey.Isolation];
|
|
668
|
+
if (!provider || !schema) {
|
|
669
|
+
return;
|
|
670
|
+
}
|
|
671
|
+
const before = resolvedConfig.values[SessionConfigKey.Isolation] ?? schema.default;
|
|
672
|
+
const nextValue = checked ? "worktree" : "folder";
|
|
673
|
+
reportNewChatPickerClosed(this._telemetryService, {
|
|
674
|
+
id: "NewChatAgentHostSessionConfigPicker",
|
|
675
|
+
name: `NewChatAgentHostSessionConfigPicker.${SessionConfigKey.Isolation}`,
|
|
676
|
+
optionIdBefore: typeof before === "string" ? before : undefined,
|
|
677
|
+
optionIdAfter: nextValue,
|
|
678
|
+
optionLabelBefore: typeof before === "string" ? this._getLabel(sessionId, SessionConfigKey.Isolation, schema, before) : undefined,
|
|
679
|
+
optionLabelAfter: this._getLabel(sessionId, SessionConfigKey.Isolation, schema, nextValue),
|
|
680
|
+
isPII: false
|
|
681
|
+
});
|
|
682
|
+
this._setSessionConfigValue(provider, sessionId, SessionConfigKey.Isolation, nextValue).catch(() => {});
|
|
683
|
+
}
|
|
684
|
+
async _showPicker(provider, sessionId, property, schema, trigger) {
|
|
685
|
+
if (schema.readOnly || this._actionWidgetService.isVisible) {
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
688
|
+
if (provider.isSessionConfigResolving(sessionId).get()) {
|
|
689
|
+
return;
|
|
690
|
+
}
|
|
691
|
+
const rawItems = await this._getItems(provider, sessionId, property, schema);
|
|
692
|
+
const {
|
|
693
|
+
items,
|
|
694
|
+
policyRestricted
|
|
695
|
+
} = applyAutoApproveFiltering(rawItems, property, this._configurationService);
|
|
696
|
+
if (items.length === 0) {
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
699
|
+
const isAutoApproveProperty = property === SessionConfigKey.AutoApprove;
|
|
700
|
+
const currentValue = provider.getSessionConfig(sessionId)?.values[property] ?? schema.default;
|
|
701
|
+
const currentItem = items.find(i => isSelectedValue(currentValue, i.value));
|
|
702
|
+
const repositoryState = property === SessionConfigKey.Branch ? this._getRepositoryBranchState(sessionId) : undefined;
|
|
703
|
+
const onShowChanges = property === SessionConfigKey.Branch ? () => this._showChanges() : undefined;
|
|
704
|
+
const actionItems = toActionItems(
|
|
705
|
+
property,
|
|
706
|
+
items,
|
|
707
|
+
currentValue,
|
|
708
|
+
policyRestricted,
|
|
709
|
+
repositoryState?.branchName,
|
|
710
|
+
repositoryState?.uncommittedChanges,
|
|
711
|
+
onShowChanges
|
|
712
|
+
);
|
|
713
|
+
const delegate = {
|
|
714
|
+
onSelect: async item => {
|
|
715
|
+
this._actionWidgetService.hide();
|
|
716
|
+
reportNewChatPickerClosed(this._telemetryService, {
|
|
717
|
+
id: "NewChatAgentHostSessionConfigPicker",
|
|
718
|
+
name: `NewChatAgentHostSessionConfigPicker.${property}`,
|
|
719
|
+
optionIdBefore: typeof currentValue === "string" ? currentValue : undefined,
|
|
720
|
+
optionIdAfter: item.value,
|
|
721
|
+
optionLabelBefore: currentItem?.label,
|
|
722
|
+
optionLabelAfter: item.label,
|
|
723
|
+
isPII: !!schema.enumDynamic
|
|
724
|
+
});
|
|
725
|
+
if (isAutoApproveProperty && item.value !== "default") {
|
|
726
|
+
const confirmed = await confirmAutoApproveLevel(item.value, item.label, this._dialogService, this._storageService);
|
|
727
|
+
if (!confirmed) {
|
|
728
|
+
return;
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
const nextValue = schema.type === "boolean" ? item.value === "true" : item.value;
|
|
732
|
+
this._setSessionConfigValue(provider, sessionId, property, nextValue).catch(() => {});
|
|
733
|
+
},
|
|
734
|
+
onFilter: schema.enumDynamic ? query => this._filterDelayer.trigger(async () => {
|
|
735
|
+
const filteredRawItems = await this._getItems(provider, sessionId, property, schema, query);
|
|
736
|
+
const {
|
|
737
|
+
items: filteredItems,
|
|
738
|
+
policyRestricted: filteredPolicyRestricted
|
|
739
|
+
} = applyAutoApproveFiltering(filteredRawItems, property, this._configurationService);
|
|
740
|
+
const filteredRepositoryState = this._getRepositoryBranchState(sessionId);
|
|
741
|
+
return toActionItems(
|
|
742
|
+
property,
|
|
743
|
+
filteredItems,
|
|
744
|
+
provider.getSessionConfig(sessionId)?.values[property] ?? schema.default,
|
|
745
|
+
filteredPolicyRestricted,
|
|
746
|
+
filteredRepositoryState.branchName,
|
|
747
|
+
filteredRepositoryState.uncommittedChanges,
|
|
748
|
+
onShowChanges
|
|
749
|
+
);
|
|
750
|
+
}) : undefined,
|
|
751
|
+
onHide: () => {
|
|
752
|
+
trigger.focus();
|
|
753
|
+
}
|
|
754
|
+
};
|
|
755
|
+
this._actionWidgetService.show(
|
|
756
|
+
`agentHostSessionConfig.${property}`,
|
|
757
|
+
false,
|
|
758
|
+
actionItems,
|
|
759
|
+
delegate,
|
|
760
|
+
trigger,
|
|
761
|
+
undefined,
|
|
762
|
+
[],
|
|
763
|
+
{
|
|
764
|
+
getAriaLabel: item => item.ariaDescription ? ( localize(4228, "{0}, {1}", item.label ?? "", item.ariaDescription)) : item.label ?? "",
|
|
765
|
+
getWidgetAriaLabel: () => ( localize(4229, "{0} Picker", schema.title))
|
|
766
|
+
},
|
|
767
|
+
items.length > 10 ? {
|
|
768
|
+
showFilter: true,
|
|
769
|
+
filterPlaceholder: ( localize(4230, "Filter options...")),
|
|
770
|
+
minWidth: 255
|
|
771
|
+
} : {
|
|
772
|
+
minWidth: 255
|
|
773
|
+
}
|
|
774
|
+
);
|
|
775
|
+
}
|
|
776
|
+
async _showChanges() {
|
|
777
|
+
this._actionWidgetService.hide();
|
|
778
|
+
const session = this._session.get();
|
|
779
|
+
if (this._layoutService.isSinglePaneLayoutEnabled && session) {
|
|
780
|
+
if ((this._getRepositoryBranchState(session.sessionId).uncommittedChanges ?? 0) > 0) {
|
|
781
|
+
this._layoutService.revealEditorPartExplicitly();
|
|
782
|
+
}
|
|
783
|
+
const suppression = this._layoutService.suppressEditorPartAutoVisibility();
|
|
784
|
+
try {
|
|
785
|
+
await this._sessionChangesService.openChangesEditor(session.resource);
|
|
786
|
+
} finally {
|
|
787
|
+
suppression.dispose();
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
await this._viewsService.openView(CHANGES_VIEW_ID, true);
|
|
791
|
+
}
|
|
792
|
+
_getRepositoryBranchState(sessionId) {
|
|
793
|
+
const session = this._session.get();
|
|
794
|
+
const repository = session?.sessionId === sessionId ? session.workspace.get()?.folders[0]?.gitRepository : undefined;
|
|
795
|
+
return {
|
|
796
|
+
branchName: repository?.branchName,
|
|
797
|
+
uncommittedChanges: repository?.uncommittedChanges
|
|
798
|
+
};
|
|
799
|
+
}
|
|
800
|
+
async _getItems(provider, sessionId, property, schema, query) {
|
|
801
|
+
if (schema.type === "boolean") {
|
|
802
|
+
return [{
|
|
803
|
+
value: "true",
|
|
804
|
+
label: ( localize(4231, "On"))
|
|
805
|
+
}, {
|
|
806
|
+
value: "false",
|
|
807
|
+
label: ( localize(4232, "Off"))
|
|
808
|
+
}];
|
|
809
|
+
}
|
|
810
|
+
const dynamicItems = schema.enumDynamic ? await provider.getSessionConfigCompletions(sessionId, property, query) : undefined;
|
|
811
|
+
if (dynamicItems?.length) {
|
|
812
|
+
const items = dynamicItems.map(item => this._fromCompletionItem(item));
|
|
813
|
+
this._cacheDynamicValueLabels(sessionId, property, items);
|
|
814
|
+
return items;
|
|
815
|
+
}
|
|
816
|
+
return (schema.enum ?? []).map((value, index) => ({
|
|
817
|
+
value: String(value),
|
|
818
|
+
label: schema.enumLabels?.[index] ?? String(value),
|
|
819
|
+
description: schema.enumDescriptions?.[index]
|
|
820
|
+
}));
|
|
821
|
+
}
|
|
822
|
+
_fromCompletionItem(item) {
|
|
823
|
+
return {
|
|
824
|
+
value: item.value,
|
|
825
|
+
label: item.label,
|
|
826
|
+
description: item.description
|
|
827
|
+
};
|
|
828
|
+
}
|
|
829
|
+
_dynamicValueLabelsKey(sessionId, property) {
|
|
830
|
+
return `${sessionId}\0${property}`;
|
|
831
|
+
}
|
|
832
|
+
_cacheDynamicValueLabels(sessionId, property, items) {
|
|
833
|
+
const key = this._dynamicValueLabelsKey(sessionId, property);
|
|
834
|
+
let labels = this._dynamicValueLabels.get(key);
|
|
835
|
+
if (!labels) {
|
|
836
|
+
labels = ( new Map());
|
|
837
|
+
this._dynamicValueLabels.set(key, labels);
|
|
838
|
+
}
|
|
839
|
+
for (const item of items) {
|
|
840
|
+
labels.set(item.value, item.label);
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
_evictDynamicValueLabelsForOtherSessions(sessionId) {
|
|
844
|
+
if (!sessionId) {
|
|
845
|
+
return;
|
|
846
|
+
}
|
|
847
|
+
const prefix = `${sessionId}\0`;
|
|
848
|
+
for (const key of ( this._dynamicValueLabels.keys())) {
|
|
849
|
+
if (!key.startsWith(prefix)) {
|
|
850
|
+
this._dynamicValueLabels.delete(key);
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
_getLabel(sessionId, property, schema, value) {
|
|
855
|
+
if (schema.type === "boolean") {
|
|
856
|
+
return value === true ? ( localize(4233, "On")) : ( localize(4234, "Off"));
|
|
857
|
+
}
|
|
858
|
+
if (typeof value === "string") {
|
|
859
|
+
if (schema.enumDynamic) {
|
|
860
|
+
const key = this._dynamicValueLabelsKey(sessionId, property);
|
|
861
|
+
const dynamicLabel = this._dynamicValueLabels.get(key)?.get(value);
|
|
862
|
+
if (dynamicLabel) {
|
|
863
|
+
return dynamicLabel;
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
const index = schema.enum?.indexOf(value) ?? -1;
|
|
867
|
+
return index >= 0 ? schema.enumLabels?.[index] ?? value : value;
|
|
868
|
+
}
|
|
869
|
+
return schema.title;
|
|
870
|
+
}
|
|
871
|
+
_getProvider(providerId) {
|
|
872
|
+
const provider = this._sessionsProvidersService.getProvider(providerId);
|
|
873
|
+
return provider && isAgentHostProvider(provider) ? provider : undefined;
|
|
874
|
+
}
|
|
875
|
+
};
|
|
876
|
+
AgentHostSessionConfigPicker = ( __decorate([( __param(1, IActionWidgetService)), ( __param(2, IConfigurationService)), ( __param(3, IContextKeyService)), ( __param(4, IDialogService)), ( __param(5, IHoverService)), ( __param(6, ISessionsProvidersService)), ( __param(7, ITelemetryService)), ( __param(8, IAgentWorkbenchLayoutService)), ( __param(9, IStorageService)), ( __param(10, ISessionChangesService)), ( __param(11, IViewsService))], AgentHostSessionConfigPicker));
|
|
877
|
+
class MobileAgentHostSessionConfigPicker extends AgentHostSessionConfigPicker {
|
|
878
|
+
_orderProperties(properties) {
|
|
879
|
+
if (!isPhoneLayout(this._layoutService)) {
|
|
880
|
+
return super._orderProperties(properties);
|
|
881
|
+
}
|
|
882
|
+
const order = ( new Map([[SessionConfigKey.Branch, 0], [SessionConfigKey.Isolation, 1]]));
|
|
883
|
+
return properties.slice().sort(([aKey], [bKey]) => {
|
|
884
|
+
const a = order.get(aKey) ?? Number.MAX_SAFE_INTEGER;
|
|
885
|
+
const b = order.get(bKey) ?? Number.MAX_SAFE_INTEGER;
|
|
886
|
+
return a - b;
|
|
887
|
+
});
|
|
888
|
+
}
|
|
889
|
+
_shouldRenderProperty(property, schema, isNewSession) {
|
|
890
|
+
const isUnifiedRepoProperty = property === SessionConfigKey.Isolation || property === SessionConfigKey.Branch;
|
|
891
|
+
return isUnifiedRepoProperty || super._shouldRenderProperty(property, schema, isNewSession);
|
|
892
|
+
}
|
|
893
|
+
_isReadOnlyChip(property, schema, isNewSession) {
|
|
894
|
+
return super._isReadOnlyChip(property, schema, isNewSession) || (!isNewSession && !schema.sessionMutable);
|
|
895
|
+
}
|
|
896
|
+
async _showPicker(provider, sessionId, property, schema, trigger) {
|
|
897
|
+
if (!isPhoneLayout(this._layoutService)) {
|
|
898
|
+
return super._showPicker(provider, sessionId, property, schema, trigger);
|
|
899
|
+
}
|
|
900
|
+
if (provider.isSessionConfigResolving(sessionId).get()) {
|
|
901
|
+
return;
|
|
902
|
+
}
|
|
903
|
+
if (property === SessionConfigKey.Isolation || property === SessionConfigKey.Branch) {
|
|
904
|
+
await this._showUnifiedRepoSheet(provider, sessionId, trigger);
|
|
905
|
+
return;
|
|
906
|
+
}
|
|
907
|
+
return super._showPicker(provider, sessionId, property, schema, trigger);
|
|
908
|
+
}
|
|
909
|
+
async _showUnifiedRepoSheet(provider, sessionId, trigger) {
|
|
910
|
+
const config = provider.getSessionConfig(sessionId);
|
|
911
|
+
if (!config) {
|
|
912
|
+
return;
|
|
913
|
+
}
|
|
914
|
+
const isolationSchema = config.schema.properties[SessionConfigKey.Isolation];
|
|
915
|
+
const branchSchema = config.schema.properties[SessionConfigKey.Branch];
|
|
916
|
+
const canSelectBranch = !this._requiresBranchCheckout(provider, sessionId, SessionConfigKey.Branch) || !!this._getCheckoutChangeset(sessionId);
|
|
917
|
+
const [isolationItems, branchItems] = await Promise.all([
|
|
918
|
+
isolationSchema && !isolationSchema.readOnly ? this._getItems(provider, sessionId, SessionConfigKey.Isolation, isolationSchema) : Promise.resolve([]),
|
|
919
|
+
branchSchema && !branchSchema.readOnly && canSelectBranch ? this._getItems(provider, sessionId, SessionConfigKey.Branch, branchSchema) : Promise.resolve([])
|
|
920
|
+
]);
|
|
921
|
+
const isolationValue = config.values[SessionConfigKey.Isolation];
|
|
922
|
+
const branchValue = config.values[SessionConfigKey.Branch];
|
|
923
|
+
const repositoryState = this._getRepositoryBranchState(sessionId);
|
|
924
|
+
const sheetItems = [];
|
|
925
|
+
const idToConfig = ( new Map());
|
|
926
|
+
const registerId = (property, value, label, isPII) => {
|
|
927
|
+
const id = `repo-row-${idToConfig.size}`;
|
|
928
|
+
idToConfig.set(id, {
|
|
929
|
+
property,
|
|
930
|
+
value,
|
|
931
|
+
label,
|
|
932
|
+
isPII
|
|
933
|
+
});
|
|
934
|
+
return id;
|
|
935
|
+
};
|
|
936
|
+
isolationItems.forEach((item, index) => {
|
|
937
|
+
sheetItems.push({
|
|
938
|
+
id: registerId(
|
|
939
|
+
SessionConfigKey.Isolation,
|
|
940
|
+
item.value,
|
|
941
|
+
item.label,
|
|
942
|
+
!!isolationSchema?.enumDynamic
|
|
943
|
+
),
|
|
944
|
+
label: item.label,
|
|
945
|
+
description: item.description,
|
|
946
|
+
icon: getConfigIcon(SessionConfigKey.Isolation, item.value),
|
|
947
|
+
checked: item.value === isolationValue,
|
|
948
|
+
sectionTitle: index === 0 ? (isolationSchema?.title ?? ( localize(4235, "Isolation"))) : undefined
|
|
949
|
+
});
|
|
950
|
+
});
|
|
951
|
+
const branchSectionTitle = branchSchema?.title ?? ( localize(4236, "Base Branch"));
|
|
952
|
+
if (!branchSchema?.enumDynamic) {
|
|
953
|
+
branchItems.forEach((item, index) => {
|
|
954
|
+
const uncommittedChanges = getBranchUncommittedChanges(item.value, repositoryState.branchName, repositoryState.uncommittedChanges);
|
|
955
|
+
sheetItems.push({
|
|
956
|
+
id: registerId(
|
|
957
|
+
SessionConfigKey.Branch,
|
|
958
|
+
item.value,
|
|
959
|
+
item.label,
|
|
960
|
+
!!branchSchema?.enumDynamic
|
|
961
|
+
),
|
|
962
|
+
label: item.label,
|
|
963
|
+
description: uncommittedChanges !== undefined ? formatUncommittedChanges(uncommittedChanges) : item.description,
|
|
964
|
+
icon: getConfigIcon(SessionConfigKey.Branch, item.value, uncommittedChanges !== undefined),
|
|
965
|
+
checked: item.value === branchValue,
|
|
966
|
+
sectionTitle: index === 0 ? branchSectionTitle : undefined
|
|
967
|
+
});
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
if (sheetItems.length === 0 && !branchSchema?.enumDynamic) {
|
|
971
|
+
return;
|
|
972
|
+
}
|
|
973
|
+
let search;
|
|
974
|
+
if (branchSchema?.enumDynamic && !branchSchema.readOnly && canSelectBranch) {
|
|
975
|
+
search = {
|
|
976
|
+
placeholder: ( localize(4237, "Search branches")),
|
|
977
|
+
ariaLabel: ( localize(4238, "Search base branches")),
|
|
978
|
+
resultsSectionTitle: branchSectionTitle,
|
|
979
|
+
emptyMessage: ( localize(4239, "No matching branches.")),
|
|
980
|
+
loadItems: async (query, token) => {
|
|
981
|
+
const items = query ? await this._getItems(provider, sessionId, SessionConfigKey.Branch, branchSchema, query) : branchItems;
|
|
982
|
+
if (token.isCancellationRequested) {
|
|
983
|
+
return [];
|
|
984
|
+
}
|
|
985
|
+
return items.map(item => {
|
|
986
|
+
const uncommittedChanges = getBranchUncommittedChanges(item.value, repositoryState.branchName, repositoryState.uncommittedChanges);
|
|
987
|
+
return {
|
|
988
|
+
id: registerId(
|
|
989
|
+
SessionConfigKey.Branch,
|
|
990
|
+
item.value,
|
|
991
|
+
item.label,
|
|
992
|
+
!!branchSchema.enumDynamic
|
|
993
|
+
),
|
|
994
|
+
label: item.label,
|
|
995
|
+
description: uncommittedChanges !== undefined ? formatUncommittedChanges(uncommittedChanges) : item.description,
|
|
996
|
+
icon: getConfigIcon(SessionConfigKey.Branch, item.value, uncommittedChanges !== undefined),
|
|
997
|
+
checked: item.value === branchValue
|
|
998
|
+
};
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
1001
|
+
};
|
|
1002
|
+
}
|
|
1003
|
+
trigger.setAttribute("aria-expanded", "true");
|
|
1004
|
+
await showMobilePickerSheet(this._layoutService.mainContainer, ( localize(4240, "Worktree")), sheetItems, {
|
|
1005
|
+
search,
|
|
1006
|
+
stayOpenOnSelect: true,
|
|
1007
|
+
onDidSelect: id => {
|
|
1008
|
+
const selection = idToConfig.get(id);
|
|
1009
|
+
if (selection) {
|
|
1010
|
+
const beforeValue = provider.getSessionConfig(sessionId)?.values[selection.property];
|
|
1011
|
+
reportNewChatPickerClosed(this._telemetryService, {
|
|
1012
|
+
id: "NewChatAgentHostSessionConfigPicker",
|
|
1013
|
+
name: `NewChatAgentHostSessionConfigPicker.${selection.property}`,
|
|
1014
|
+
optionIdBefore: typeof beforeValue === "string" ? beforeValue : undefined,
|
|
1015
|
+
optionIdAfter: selection.value,
|
|
1016
|
+
optionLabelBefore: undefined,
|
|
1017
|
+
optionLabelAfter: selection.label,
|
|
1018
|
+
isPII: selection.isPII
|
|
1019
|
+
});
|
|
1020
|
+
this._setSessionConfigValue(provider, sessionId, selection.property, selection.value).catch(() => {});
|
|
1021
|
+
if (selection.property === SessionConfigKey.Isolation) {
|
|
1022
|
+
return MOBILE_PICKER_SHEET_CONFIRM;
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
return undefined;
|
|
1026
|
+
}
|
|
1027
|
+
});
|
|
1028
|
+
trigger.setAttribute("aria-expanded", "false");
|
|
1029
|
+
trigger.focus();
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
class PickerActionViewItem extends BaseActionViewItem {
|
|
1033
|
+
constructor(_picker, disposable) {
|
|
1034
|
+
super(undefined, {
|
|
1035
|
+
id: "",
|
|
1036
|
+
label: "",
|
|
1037
|
+
enabled: true,
|
|
1038
|
+
class: undefined,
|
|
1039
|
+
tooltip: "",
|
|
1040
|
+
run: () => {}
|
|
1041
|
+
});
|
|
1042
|
+
this._picker = _picker;
|
|
1043
|
+
this._compact = false;
|
|
1044
|
+
if (disposable) {
|
|
1045
|
+
this._register(disposable);
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
render(container) {
|
|
1049
|
+
this.element = container;
|
|
1050
|
+
this._focusableElement = this._picker.render(container) ?? undefined;
|
|
1051
|
+
container.classList.toggle("compact-picker", this._compact);
|
|
1052
|
+
}
|
|
1053
|
+
focus() {
|
|
1054
|
+
if (this._picker.focus) {
|
|
1055
|
+
this._picker.focus();
|
|
1056
|
+
} else if (this._focusableElement) {
|
|
1057
|
+
this._focusableElement.focus();
|
|
1058
|
+
} else if (this.element) {
|
|
1059
|
+
this._focusFirstTabStop(this.element);
|
|
1060
|
+
} else {
|
|
1061
|
+
super.focus();
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
isFocused() {
|
|
1065
|
+
return this.element ? isAncestorOfActiveElement(this.element) : super.isFocused();
|
|
1066
|
+
}
|
|
1067
|
+
blur() {
|
|
1068
|
+
const activeElement = getActiveElement();
|
|
1069
|
+
if (this.element && isHTMLElement(activeElement) && isAncestor(activeElement, this.element)) {
|
|
1070
|
+
activeElement.blur();
|
|
1071
|
+
} else {
|
|
1072
|
+
super.blur();
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
setFocusable(_focusable) {
|
|
1076
|
+
if (this.element) {
|
|
1077
|
+
this.element.tabIndex = -1;
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
_focusFirstTabStop(container) {
|
|
1081
|
+
for (const child of container.children) {
|
|
1082
|
+
if (!isHTMLElement(child)) {
|
|
1083
|
+
continue;
|
|
1084
|
+
}
|
|
1085
|
+
if (child.tabIndex >= 0) {
|
|
1086
|
+
child.focus();
|
|
1087
|
+
if (isActiveElement(child)) {
|
|
1088
|
+
return true;
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
if (this._focusFirstTabStop(child)) {
|
|
1092
|
+
return true;
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
return false;
|
|
1096
|
+
}
|
|
1097
|
+
isCompact() {
|
|
1098
|
+
return this._compact;
|
|
1099
|
+
}
|
|
1100
|
+
setCompact(compact) {
|
|
1101
|
+
this._compact = compact;
|
|
1102
|
+
this.element?.classList.toggle("compact-picker", compact);
|
|
1103
|
+
}
|
|
1104
|
+
show(anchor) {
|
|
1105
|
+
const target = anchor ?? this.element;
|
|
1106
|
+
if (target) {
|
|
1107
|
+
this._picker.showPicker?.(target);
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
dispose() {
|
|
1111
|
+
this._picker.dispose();
|
|
1112
|
+
super.dispose();
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
let AgentHostSessionConfigPickerContribution = class AgentHostSessionConfigPickerContribution extends Disposable {
|
|
1116
|
+
static {
|
|
1117
|
+
this.ID = "sessions.contrib.agentHostSessionConfigPicker";
|
|
1118
|
+
}
|
|
1119
|
+
constructor(actionViewItemService, _layoutService) {
|
|
1120
|
+
super();
|
|
1121
|
+
this._layoutService = _layoutService;
|
|
1122
|
+
this._register(actionViewItemService.register(
|
|
1123
|
+
Menus.NewSessionRepositoryConfig,
|
|
1124
|
+
"sessions.agentHost.sessionConfigPicker",
|
|
1125
|
+
(_action, _options, scopedInstantiationService) => {
|
|
1126
|
+
const {
|
|
1127
|
+
session
|
|
1128
|
+
} = scopedInstantiationService.invokeFunction(accessor => accessor.get(ISessionContext));
|
|
1129
|
+
return ( new PickerActionViewItem(
|
|
1130
|
+
scopedInstantiationService.createInstance(MobileAgentHostSessionConfigPicker, session)
|
|
1131
|
+
));
|
|
1132
|
+
}
|
|
1133
|
+
));
|
|
1134
|
+
this._register(actionViewItemService.register(
|
|
1135
|
+
Menus.NewSessionControl,
|
|
1136
|
+
NEW_SESSION_MODE_PICKER_ID,
|
|
1137
|
+
(_action, _options, scopedInstantiationService) => {
|
|
1138
|
+
const {
|
|
1139
|
+
session
|
|
1140
|
+
} = scopedInstantiationService.invokeFunction(accessor => accessor.get(ISessionContext));
|
|
1141
|
+
return ( new PickerActionViewItem(scopedInstantiationService.createInstance(
|
|
1142
|
+
isPhoneLayout(this._layoutService) ? MobileAgentHostModePicker : AgentHostModePicker,
|
|
1143
|
+
session
|
|
1144
|
+
)));
|
|
1145
|
+
}
|
|
1146
|
+
));
|
|
1147
|
+
this._register(actionViewItemService.register(
|
|
1148
|
+
MenuId.ChatInputSecondary,
|
|
1149
|
+
RUNNING_SESSION_MODE_PICKER_ID,
|
|
1150
|
+
(_action, _options, scopedInstantiationService) => {
|
|
1151
|
+
const {
|
|
1152
|
+
session
|
|
1153
|
+
} = scopedInstantiationService.invokeFunction(accessor => accessor.get(ISessionContext));
|
|
1154
|
+
return ( new PickerActionViewItem(scopedInstantiationService.createInstance(
|
|
1155
|
+
isPhoneLayout(this._layoutService) ? MobileAgentHostModePicker : AgentHostModePicker,
|
|
1156
|
+
session
|
|
1157
|
+
)));
|
|
1158
|
+
}
|
|
1159
|
+
));
|
|
1160
|
+
this._register(actionViewItemService.register(
|
|
1161
|
+
Menus.NewSessionControl,
|
|
1162
|
+
NEW_SESSION_APPROVE_PICKER_ID,
|
|
1163
|
+
(_action, _options, scopedInstantiationService) => this._createNewSessionPermissionPicker(scopedInstantiationService)
|
|
1164
|
+
));
|
|
1165
|
+
this._register(actionViewItemService.register(
|
|
1166
|
+
Menus.NewSessionControl,
|
|
1167
|
+
NEW_SESSION_PERMISSION_MODE_PICKER_ID,
|
|
1168
|
+
(_action, _options, scopedInstantiationService) => {
|
|
1169
|
+
const {
|
|
1170
|
+
session
|
|
1171
|
+
} = scopedInstantiationService.invokeFunction(accessor => accessor.get(ISessionContext));
|
|
1172
|
+
return ( new PickerActionViewItem(
|
|
1173
|
+
scopedInstantiationService.createInstance(AgentHostClaudePermissionModePicker, session)
|
|
1174
|
+
));
|
|
1175
|
+
}
|
|
1176
|
+
));
|
|
1177
|
+
this._register(actionViewItemService.register(
|
|
1178
|
+
Menus.NewSessionControl,
|
|
1179
|
+
NEW_SESSION_CODEX_APPROVALS_PICKER_ID,
|
|
1180
|
+
(_action, _options, scopedInstantiationService) => {
|
|
1181
|
+
const {
|
|
1182
|
+
session
|
|
1183
|
+
} = scopedInstantiationService.invokeFunction(accessor => accessor.get(ISessionContext));
|
|
1184
|
+
return ( new PickerActionViewItem(
|
|
1185
|
+
scopedInstantiationService.createInstance(AgentHostCodexApprovalsPicker, session)
|
|
1186
|
+
));
|
|
1187
|
+
}
|
|
1188
|
+
));
|
|
1189
|
+
this._register(actionViewItemService.register(
|
|
1190
|
+
MenuId.ChatInputSecondary,
|
|
1191
|
+
RUNNING_SESSION_CONFIG_PICKER_ID,
|
|
1192
|
+
this._createRunningSessionPermissionPickerFactory()
|
|
1193
|
+
));
|
|
1194
|
+
this._register(actionViewItemService.register(
|
|
1195
|
+
MenuId.ChatInputSecondary,
|
|
1196
|
+
RUNNING_SESSION_PERMISSION_MODE_PICKER_ID,
|
|
1197
|
+
(_action, _options, scopedInstantiationService) => {
|
|
1198
|
+
const {
|
|
1199
|
+
session
|
|
1200
|
+
} = scopedInstantiationService.invokeFunction(accessor => accessor.get(ISessionContext));
|
|
1201
|
+
return ( new PickerActionViewItem(
|
|
1202
|
+
scopedInstantiationService.createInstance(AgentHostClaudePermissionModePicker, session)
|
|
1203
|
+
));
|
|
1204
|
+
}
|
|
1205
|
+
));
|
|
1206
|
+
this._register(actionViewItemService.register(
|
|
1207
|
+
MenuId.ChatInputSecondary,
|
|
1208
|
+
RUNNING_SESSION_CODEX_APPROVALS_PICKER_ID,
|
|
1209
|
+
(_action, _options, scopedInstantiationService) => {
|
|
1210
|
+
const {
|
|
1211
|
+
session
|
|
1212
|
+
} = scopedInstantiationService.invokeFunction(accessor => accessor.get(ISessionContext));
|
|
1213
|
+
return ( new PickerActionViewItem(
|
|
1214
|
+
scopedInstantiationService.createInstance(AgentHostCodexApprovalsPicker, session)
|
|
1215
|
+
));
|
|
1216
|
+
}
|
|
1217
|
+
));
|
|
1218
|
+
}
|
|
1219
|
+
_createNewSessionPermissionPicker(instantiationService) {
|
|
1220
|
+
const {
|
|
1221
|
+
session
|
|
1222
|
+
} = instantiationService.invokeFunction(accessor => accessor.get(ISessionContext));
|
|
1223
|
+
const delegate = instantiationService.createInstance(AgentHostPermissionPickerDelegate, session);
|
|
1224
|
+
const picker = instantiationService.createInstance(MobilePermissionPicker, delegate);
|
|
1225
|
+
return ( new PickerActionViewItem(picker, delegate));
|
|
1226
|
+
}
|
|
1227
|
+
_createRunningSessionPermissionPickerFactory() {
|
|
1228
|
+
return (action, _options, instantiationService) => {
|
|
1229
|
+
if (!(action instanceof MenuItemAction)) {
|
|
1230
|
+
return undefined;
|
|
1231
|
+
}
|
|
1232
|
+
const {
|
|
1233
|
+
session
|
|
1234
|
+
} = instantiationService.invokeFunction(accessor => accessor.get(ISessionContext));
|
|
1235
|
+
const pickerOptions = {
|
|
1236
|
+
compact: observableValue(action, false),
|
|
1237
|
+
listOptions: {
|
|
1238
|
+
minWidth: 255
|
|
1239
|
+
}
|
|
1240
|
+
};
|
|
1241
|
+
return instantiationService.createInstance(AgentHostPermissionPickerActionItem, action, pickerOptions, session);
|
|
1242
|
+
};
|
|
1243
|
+
}
|
|
1244
|
+
};
|
|
1245
|
+
AgentHostSessionConfigPickerContribution = ( __decorate([( __param(0, IActionViewItemService)), ( __param(1, IWorkbenchLayoutService))], AgentHostSessionConfigPickerContribution));
|
|
1246
|
+
const NEW_SESSION_APPROVE_PICKER_ID = "sessions.agentHost.newSessionApprovePicker";
|
|
1247
|
+
registerAction2(class extends Action2 {
|
|
1248
|
+
constructor() {
|
|
1249
|
+
super({
|
|
1250
|
+
id: NEW_SESSION_APPROVE_PICKER_ID,
|
|
1251
|
+
title: ( localize2(4241, "Session Approvals")),
|
|
1252
|
+
f1: false,
|
|
1253
|
+
menu: [{
|
|
1254
|
+
id: Menus.NewSessionControl,
|
|
1255
|
+
group: "navigation",
|
|
1256
|
+
order: 1,
|
|
1257
|
+
when: ( ContextKeyExpr.or(IsActiveSessionLocalAgentHost, IsActiveSessionRemoteAgentHost))
|
|
1258
|
+
}]
|
|
1259
|
+
});
|
|
1260
|
+
}
|
|
1261
|
+
async run() {}
|
|
1262
|
+
});
|
|
1263
|
+
const NEW_SESSION_PERMISSION_MODE_PICKER_ID = "sessions.agentHost.newSessionPermissionModePicker";
|
|
1264
|
+
registerAction2(class extends Action2 {
|
|
1265
|
+
constructor() {
|
|
1266
|
+
super({
|
|
1267
|
+
id: NEW_SESSION_PERMISSION_MODE_PICKER_ID,
|
|
1268
|
+
title: ( localize2(4242, "Approvals")),
|
|
1269
|
+
f1: false,
|
|
1270
|
+
menu: [{
|
|
1271
|
+
id: Menus.NewSessionControl,
|
|
1272
|
+
group: "navigation",
|
|
1273
|
+
order: 2,
|
|
1274
|
+
when: ( ContextKeyExpr.or(IsActiveSessionLocalAgentHost, IsActiveSessionRemoteAgentHost))
|
|
1275
|
+
}]
|
|
1276
|
+
});
|
|
1277
|
+
}
|
|
1278
|
+
async run() {}
|
|
1279
|
+
});
|
|
1280
|
+
const NEW_SESSION_CODEX_APPROVALS_PICKER_ID = "sessions.agentHost.newSessionCodexApprovalsPicker";
|
|
1281
|
+
registerAction2(class extends Action2 {
|
|
1282
|
+
constructor() {
|
|
1283
|
+
super({
|
|
1284
|
+
id: NEW_SESSION_CODEX_APPROVALS_PICKER_ID,
|
|
1285
|
+
title: ( localize2(4243, "Approvals")),
|
|
1286
|
+
f1: false,
|
|
1287
|
+
menu: [{
|
|
1288
|
+
id: Menus.NewSessionControl,
|
|
1289
|
+
group: "navigation",
|
|
1290
|
+
order: 3,
|
|
1291
|
+
when: ( ContextKeyExpr.or(IsActiveSessionLocalAgentHost, IsActiveSessionRemoteAgentHost))
|
|
1292
|
+
}]
|
|
1293
|
+
});
|
|
1294
|
+
}
|
|
1295
|
+
async run() {}
|
|
1296
|
+
});
|
|
1297
|
+
const NEW_SESSION_MODE_PICKER_ID = "sessions.agentHost.newSessionModePicker";
|
|
1298
|
+
registerAction2(class extends Action2 {
|
|
1299
|
+
constructor() {
|
|
1300
|
+
super({
|
|
1301
|
+
id: NEW_SESSION_MODE_PICKER_ID,
|
|
1302
|
+
title: ( localize2(4244, "Agent Mode")),
|
|
1303
|
+
f1: false,
|
|
1304
|
+
menu: [{
|
|
1305
|
+
id: Menus.NewSessionControl,
|
|
1306
|
+
group: "navigation",
|
|
1307
|
+
order: 0,
|
|
1308
|
+
when: ( ContextKeyExpr.and(( ContextKeyExpr.or(IsActiveSessionLocalAgentHost, IsActiveSessionRemoteAgentHost)), ( IsPhoneLayoutContext.negate())))
|
|
1309
|
+
}]
|
|
1310
|
+
});
|
|
1311
|
+
}
|
|
1312
|
+
async run() {}
|
|
1313
|
+
});
|
|
1314
|
+
const RUNNING_SESSION_CONFIG_PICKER_ID = "sessions.agentHost.runningSessionConfigPicker";
|
|
1315
|
+
registerAction2(class extends Action2 {
|
|
1316
|
+
constructor() {
|
|
1317
|
+
super({
|
|
1318
|
+
id: RUNNING_SESSION_CONFIG_PICKER_ID,
|
|
1319
|
+
title: ( localize2(4245, "Session Approvals")),
|
|
1320
|
+
f1: false,
|
|
1321
|
+
menu: [{
|
|
1322
|
+
id: MenuId.ChatInputSecondary,
|
|
1323
|
+
group: "navigation",
|
|
1324
|
+
order: 10,
|
|
1325
|
+
when: ChatContextKeyExprs.isAgentHostSession
|
|
1326
|
+
}]
|
|
1327
|
+
});
|
|
1328
|
+
}
|
|
1329
|
+
async run() {}
|
|
1330
|
+
});
|
|
1331
|
+
const RUNNING_SESSION_PERMISSION_MODE_PICKER_ID = "sessions.agentHost.runningSessionPermissionModePicker";
|
|
1332
|
+
registerAction2(class extends Action2 {
|
|
1333
|
+
constructor() {
|
|
1334
|
+
super({
|
|
1335
|
+
id: RUNNING_SESSION_PERMISSION_MODE_PICKER_ID,
|
|
1336
|
+
title: ( localize2(4246, "Approvals")),
|
|
1337
|
+
f1: false,
|
|
1338
|
+
menu: [{
|
|
1339
|
+
id: MenuId.ChatInputSecondary,
|
|
1340
|
+
group: "navigation",
|
|
1341
|
+
order: 11,
|
|
1342
|
+
when: ChatContextKeyExprs.isAgentHostSession
|
|
1343
|
+
}]
|
|
1344
|
+
});
|
|
1345
|
+
}
|
|
1346
|
+
async run() {}
|
|
1347
|
+
});
|
|
1348
|
+
const RUNNING_SESSION_CODEX_APPROVALS_PICKER_ID = "sessions.agentHost.runningSessionCodexApprovalsPicker";
|
|
1349
|
+
registerAction2(class extends Action2 {
|
|
1350
|
+
constructor() {
|
|
1351
|
+
super({
|
|
1352
|
+
id: RUNNING_SESSION_CODEX_APPROVALS_PICKER_ID,
|
|
1353
|
+
title: ( localize2(4247, "Approvals")),
|
|
1354
|
+
f1: false,
|
|
1355
|
+
menu: [{
|
|
1356
|
+
id: MenuId.ChatInputSecondary,
|
|
1357
|
+
group: "navigation",
|
|
1358
|
+
order: 12,
|
|
1359
|
+
when: ChatContextKeyExprs.isAgentHostSession
|
|
1360
|
+
}]
|
|
1361
|
+
});
|
|
1362
|
+
}
|
|
1363
|
+
async run() {}
|
|
1364
|
+
});
|
|
1365
|
+
const RUNNING_SESSION_MODE_PICKER_ID = "sessions.agentHost.runningSessionModePicker";
|
|
1366
|
+
registerAction2(class extends Action2 {
|
|
1367
|
+
constructor() {
|
|
1368
|
+
super({
|
|
1369
|
+
id: RUNNING_SESSION_MODE_PICKER_ID,
|
|
1370
|
+
title: ( localize2(4248, "Agent Mode")),
|
|
1371
|
+
f1: false,
|
|
1372
|
+
menu: [{
|
|
1373
|
+
id: MenuId.ChatInputSecondary,
|
|
1374
|
+
group: "navigation",
|
|
1375
|
+
order: 9,
|
|
1376
|
+
when: ( ContextKeyExpr.and(ChatContextKeyExprs.isAgentHostSession, ( ChatContextKeys.hasPendingDelegationTarget.negate())))
|
|
1377
|
+
}]
|
|
1378
|
+
});
|
|
1379
|
+
}
|
|
1380
|
+
async run(accessor) {
|
|
1381
|
+
showActiveSessionModePicker(accessor);
|
|
1382
|
+
}
|
|
1383
|
+
});
|
|
1384
|
+
registerWorkbenchContribution2(
|
|
1385
|
+
AgentHostSessionConfigPickerContribution.ID,
|
|
1386
|
+
AgentHostSessionConfigPickerContribution,
|
|
1387
|
+
WorkbenchPhase.AfterRestored
|
|
1388
|
+
);
|
|
1389
|
+
|
|
1390
|
+
export { AgentHostSessionConfigPicker, PickerActionViewItem, getConfigIcon };
|