Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import { IWorkspaceContextService } from '../../../../../platform/workspace/comm
import { IAgentSessionsService } from '../agentSessions/agentSessionsService.js';
import { IChatWidget, IChatWidgetService, isIChatViewViewContext } from '../chat.js';
import { ctxHasEditorModification } from '../chatEditing/chatEditingEditorContextKeys.js';
import { ChatEntitlement, IChatEntitlementService } from '../../../../services/chat/common/chatEntitlementService.js';
import { CHAT_SETUP_ACTION_ID } from './chatActions.js';
import { PromptFileVariableKind, toPromptFileVariableEntry } from '../../common/attachments/chatVariableEntries.js';

Expand Down Expand Up @@ -391,6 +392,15 @@ export class CreateRemoteAgentJobAction {
const agentSessionsService = accessor.get(IAgentSessionsService);
const chatSessionsService = accessor.get(IChatSessionsService);
const fileService = accessor.get(IFileService);
const chatEntitlementService = accessor.get(IChatEntitlementService);

// If the user is not signed in, trigger the sign-in/setup flow before continuing
if (chatEntitlementService.entitlement === ChatEntitlement.Unknown && !chatEntitlementService.anonymous) {
const setupSucceeded = await commandService.executeCommand<boolean | undefined>(CHAT_SETUP_ACTION_ID);
if (!setupSucceeded) {
return;
}
}

const remoteJobCreatingKey = ChatContextKeys.remoteJobCreating.bindTo(contextKeyService);

Expand Down Expand Up @@ -532,6 +542,15 @@ class CreateRemoteAgentJobFromEditorAction {
const editorService = accessor.get(IEditorService);
const activeEditor = editorService.activeTextEditorControl;
const commandService = accessor.get(ICommandService);
const chatEntitlementService = accessor.get(IChatEntitlementService);

// If the user is not signed in, trigger the sign-in/setup flow before continuing
if (chatEntitlementService.entitlement === ChatEntitlement.Unknown && !chatEntitlementService.anonymous) {
const setupSucceeded = await commandService.executeCommand<boolean | undefined>(CHAT_SETUP_ACTION_ID);
if (!setupSucceeded) {
return;
}
}

if (!activeEditor) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ import { IChatWidget, IChatWidgetService } from '../chat.js';
import { getAgentSessionProvider, AgentSessionProviders } from '../agentSessions/agentSessions.js';
import { getEditingSessionContext } from '../chatEditing/chatEditingActions.js';
import { ctxHasEditorModification, ctxHasRequestInProgress, ctxIsGlobalEditingSession } from '../chatEditing/chatEditingEditorContextKeys.js';
import { ACTION_ID_NEW_CHAT, CHAT_CATEGORY, clearChatSessionPreservingType, handleCurrentEditingSession, handleModeSwitch } from './chatActions.js';
import { ChatEntitlement, IChatEntitlementService } from '../../../../services/chat/common/chatEntitlementService.js';
import { ACTION_ID_NEW_CHAT, CHAT_CATEGORY, CHAT_SETUP_ACTION_ID, clearChatSessionPreservingType, handleCurrentEditingSession, handleModeSwitch } from './chatActions.js';
import { CreateRemoteAgentJobAction } from './chatContinueInAction.js';
import { CTX_HOVER_MODE } from '../../../inlineChat/common/inlineChat.js';

Expand Down Expand Up @@ -161,6 +162,16 @@ abstract class SubmitAction extends Action2 {

private async handleDelegation(accessor: ServicesAccessor, widget: IChatWidget, delegationTarget: Exclude<AgentSessionProviders, AgentSessionProviders.Local>): Promise<void> {
const chatSessionsService = accessor.get(IChatSessionsService);
const chatEntitlementService = accessor.get(IChatEntitlementService);
const commandService = accessor.get(ICommandService);

// If the user is not signed in, trigger the sign-in/setup flow before delegating
if (chatEntitlementService.entitlement === ChatEntitlement.Unknown && !chatEntitlementService.anonymous) {
const setupSucceeded = await commandService.executeCommand<boolean | undefined>(CHAT_SETUP_ACTION_ID);
if (!setupSucceeded) {
return;
}
}

// Find the contribution for the delegation target
const contributions = chatSessionsService.getAllChatSessionContributions();
Expand Down