Skip to content

Commit 89bb89c

Browse files
Copilotjoshspicer
andauthored
Hide checkpoint UX and action buttons when chat session is locked to coding agent (microsoft#257901)
* Initial plan * Implement checkpoint UX hiding when locked to coding agent Co-authored-by: joshspicer <[email protected]> * Hide MCP and tool configuration actions when locked to coding agent Co-authored-by: joshspicer <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: joshspicer <[email protected]>
1 parent 6a5e8b9 commit 89bb89c

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

src/vs/workbench/contrib/chat/browser/actions/chatClearActions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ export function registerNewChatActions() {
198198
f1: true,
199199
menu: [{
200200
id: MenuId.ChatMessageRestoreCheckpoint,
201-
when: ContextKeyExpr.equals('view', ChatViewId),
201+
when: ContextKeyExpr.and(ContextKeyExpr.equals('view', ChatViewId), ChatContextKeys.lockedToCodingAgent.negate()),
202202
group: 'navigation',
203203
order: -1
204204
}]

src/vs/workbench/contrib/chat/browser/actions/chatToolActions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class ConfigureToolsAction extends Action2 {
8181
category: CHAT_CATEGORY,
8282
precondition: ChatContextKeys.chatModeKind.isEqualTo(ChatModeKind.Agent),
8383
menu: [{
84-
when: ChatContextKeys.chatModeKind.isEqualTo(ChatModeKind.Agent),
84+
when: ContextKeyExpr.and(ChatContextKeys.chatModeKind.isEqualTo(ChatModeKind.Agent), ChatContextKeys.lockedToCodingAgent.negate()),
8585
id: MenuId.ChatExecute,
8686
group: 'navigation',
8787
order: 1,

src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ registerAction2(class RemoveAction extends Action2 {
397397
id: MenuId.ChatMessageTitle,
398398
group: 'navigation',
399399
order: 2,
400-
when: ContextKeyExpr.and(ContextKeyExpr.equals(`config.${ChatConfiguration.EditRequests}`, 'input').negate(), ContextKeyExpr.equals(`config.${ChatConfiguration.CheckpointsEnabled}`, false)),
400+
when: ContextKeyExpr.and(ContextKeyExpr.equals(`config.${ChatConfiguration.EditRequests}`, 'input').negate(), ContextKeyExpr.equals(`config.${ChatConfiguration.CheckpointsEnabled}`, false), ChatContextKeys.lockedToCodingAgent.negate()),
401401
}
402402
]
403403
});
@@ -446,7 +446,7 @@ registerAction2(class RestoreCheckpointAction extends Action2 {
446446
id: MenuId.ChatMessageCheckpoint,
447447
group: 'navigation',
448448
order: 2,
449-
when: ChatContextKeys.isRequest
449+
when: ContextKeyExpr.and(ChatContextKeys.isRequest, ChatContextKeys.lockedToCodingAgent.negate())
450450
}
451451
]
452452
});
@@ -487,7 +487,7 @@ registerAction2(class RestoreLastCheckpoint extends Action2 {
487487
id: MenuId.ChatMessageFooter,
488488
group: 'navigation',
489489
order: 1,
490-
when: ContextKeyExpr.and(ContextKeyExpr.in(ChatContextKeys.itemId.key, ChatContextKeys.lastItemId.key), ContextKeyExpr.equals(`config.${ChatConfiguration.CheckpointsEnabled}`, true)),
490+
when: ContextKeyExpr.and(ContextKeyExpr.in(ChatContextKeys.itemId.key, ChatContextKeys.lastItemId.key), ContextKeyExpr.equals(`config.${ChatConfiguration.CheckpointsEnabled}`, true), ChatContextKeys.lockedToCodingAgent.negate()),
491491
}
492492
]
493493
});

src/vs/workbench/contrib/chat/browser/chatListRenderer.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,11 +552,12 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
552552
}
553553

554554
templateData.checkpointToolbar.context = element;
555-
templateData.checkpointContainer.classList.toggle('hidden', isResponseVM(element) || !this.configService.getValue<boolean>(ChatConfiguration.CheckpointsEnabled));
555+
const isLockedToCodingAgent = ChatContextKeys.lockedToCodingAgent.getValue(templateData.contextKeyService);
556+
templateData.checkpointContainer.classList.toggle('hidden', isResponseVM(element) || !this.configService.getValue<boolean>(ChatConfiguration.CheckpointsEnabled) || isLockedToCodingAgent);
556557

557558
// Only show restore container when we have a checkpoint and not editing
558559
const shouldShowRestore = this.viewModel?.model.checkpoint && !this.viewModel?.editing && (index === this.delegate.getListLength() - 1);
559-
templateData.checkpointRestoreContainer.classList.toggle('hidden', !shouldShowRestore || !this.configService.getValue<boolean>(ChatConfiguration.CheckpointsEnabled));
560+
templateData.checkpointRestoreContainer.classList.toggle('hidden', !shouldShowRestore || !this.configService.getValue<boolean>(ChatConfiguration.CheckpointsEnabled) || isLockedToCodingAgent);
560561

561562
const editing = element.id === this.viewModel?.editing?.id;
562563
const isInput = this.configService.getValue<string>('chat.editRequests') === 'input';

src/vs/workbench/contrib/mcp/browser/mcpCommands.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ export class ListMcpServerCommand extends Action2 {
8484
menu: [{
8585
when: ContextKeyExpr.and(
8686
ContextKeyExpr.or(McpContextKeys.hasUnknownTools, McpContextKeys.hasServersWithErrors),
87-
ChatContextKeys.chatModeKind.isEqualTo(ChatModeKind.Agent)
87+
ChatContextKeys.chatModeKind.isEqualTo(ChatModeKind.Agent),
88+
ChatContextKeys.lockedToCodingAgent.negate()
8889
),
8990
id: MenuId.ChatExecute,
9091
group: 'navigation',

0 commit comments

Comments
 (0)