fix: specify agent

This commit is contained in:
Tomasz Stefaniak 2025-10-14 13:22:21 -07:00
parent cee03bf469
commit 01efdd15a9
3 changed files with 26 additions and 0 deletions

View file

@ -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: {

View file

@ -58,6 +58,7 @@ export type ToIdeFromWebviewProtocol = ToIdeFromWebviewOrCoreProtocol & {
contextItems: ContextItemWithId[];
selectedCode: RangeInFile[];
organizationId?: string;
agent?: string;
},
void,
];

View file

@ -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(