From 01efdd15a9c87ed7119d0878fea378e894141e3e Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 14 Oct 2025 13:22:21 -0700 Subject: [PATCH] fix: specify agent --- core/control-plane/client.ts | 6 ++++++ core/protocol/ideWebview.ts | 1 + .../vscode/src/extension/VsCodeMessenger.ts | 19 +++++++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/core/control-plane/client.ts b/core/control-plane/client.ts index 43fea391a..d33374565 100644 --- a/core/control-plane/client.ts +++ b/core/control-plane/client.ts @@ -452,6 +452,7 @@ export class ControlPlaneClient { organizationId?: string, contextItems?: any[], selectedCode?: any[], + agent?: string, ): Promise<{ id: string }> { if (!(await this.isSignedIn())) { throw new Error("Not signed in to Continue"); @@ -487,6 +488,11 @@ export class ControlPlaneClient { })); } + // Include agent configuration if provided + if (agent) { + requestBody.agent = agent; + } + const resp = await this.requestAndHandleError("agents", { method: "POST", headers: { diff --git a/core/protocol/ideWebview.ts b/core/protocol/ideWebview.ts index 8efb1a8d2..c61844cca 100644 --- a/core/protocol/ideWebview.ts +++ b/core/protocol/ideWebview.ts @@ -58,6 +58,7 @@ export type ToIdeFromWebviewProtocol = ToIdeFromWebviewOrCoreProtocol & { contextItems: ContextItemWithId[]; selectedCode: RangeInFile[]; organizationId?: string; + agent?: string; }, void, ]; diff --git a/extensions/vscode/src/extension/VsCodeMessenger.ts b/extensions/vscode/src/extension/VsCodeMessenger.ts index 02679e0ab..d16e2a0e6 100644 --- a/extensions/vscode/src/extension/VsCodeMessenger.ts +++ b/extensions/vscode/src/extension/VsCodeMessenger.ts @@ -1,3 +1,4 @@ +import { encodeFullSlug } from "@continuedev/config-yaml"; import { ConfigHandler } from "core/config/ConfigHandler"; import { DataLogger } from "core/data/log"; import { EDIT_MODE_STREAM_ID } from "core/edit/constants"; @@ -331,6 +332,22 @@ export class VsCodeMessenger { // debugger; + // Get the current agent configuration from the selected profile + let agent: string | undefined; + try { + const currentProfile = configHandler.currentProfile; + if ( + currentProfile && + currentProfile.profileDescription.profileType !== "local" + ) { + // Encode the full slug to pass as the agent parameter + agent = encodeFullSlug(currentProfile.profileDescription.fullSlug); + } + } catch (e) { + console.error("Error getting agent configuration from profile:", e); + // Continue without agent config - will use default + } + // Create the background agent try { console.log("Creating background agent with:", { @@ -340,6 +357,7 @@ export class VsCodeMessenger { branch, contextItemsCount: contextItems?.length || 0, selectedCodeCount: selectedCode?.length || 0, + agent: agent || "default", }); const result = @@ -351,6 +369,7 @@ export class VsCodeMessenger { organizationId, contextItems, selectedCode, + agent, ); vscode.window.showInformationMessage(