Skip to content

Commit 01efdd1

Browse files
fix: specify agent
1 parent cee03bf commit 01efdd1

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

core/control-plane/client.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@ export class ControlPlaneClient {
452452
organizationId?: string,
453453
contextItems?: any[],
454454
selectedCode?: any[],
455+
agent?: string,
455456
): Promise<{ id: string }> {
456457
if (!(await this.isSignedIn())) {
457458
throw new Error("Not signed in to Continue");
@@ -487,6 +488,11 @@ export class ControlPlaneClient {
487488
}));
488489
}
489490

491+
// Include agent configuration if provided
492+
if (agent) {
493+
requestBody.agent = agent;
494+
}
495+
490496
const resp = await this.requestAndHandleError("agents", {
491497
method: "POST",
492498
headers: {

core/protocol/ideWebview.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export type ToIdeFromWebviewProtocol = ToIdeFromWebviewOrCoreProtocol & {
5858
contextItems: ContextItemWithId[];
5959
selectedCode: RangeInFile[];
6060
organizationId?: string;
61+
agent?: string;
6162
},
6263
void,
6364
];

extensions/vscode/src/extension/VsCodeMessenger.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { encodeFullSlug } from "@continuedev/config-yaml";
12
import { ConfigHandler } from "core/config/ConfigHandler";
23
import { DataLogger } from "core/data/log";
34
import { EDIT_MODE_STREAM_ID } from "core/edit/constants";
@@ -331,6 +332,22 @@ export class VsCodeMessenger {
331332

332333
// debugger;
333334

335+
// Get the current agent configuration from the selected profile
336+
let agent: string | undefined;
337+
try {
338+
const currentProfile = configHandler.currentProfile;
339+
if (
340+
currentProfile &&
341+
currentProfile.profileDescription.profileType !== "local"
342+
) {
343+
// Encode the full slug to pass as the agent parameter
344+
agent = encodeFullSlug(currentProfile.profileDescription.fullSlug);
345+
}
346+
} catch (e) {
347+
console.error("Error getting agent configuration from profile:", e);
348+
// Continue without agent config - will use default
349+
}
350+
334351
// Create the background agent
335352
try {
336353
console.log("Creating background agent with:", {
@@ -340,6 +357,7 @@ export class VsCodeMessenger {
340357
branch,
341358
contextItemsCount: contextItems?.length || 0,
342359
selectedCodeCount: selectedCode?.length || 0,
360+
agent: agent || "default",
343361
});
344362

345363
const result =
@@ -351,6 +369,7 @@ export class VsCodeMessenger {
351369
organizationId,
352370
contextItems,
353371
selectedCode,
372+
agent,
354373
);
355374

356375
vscode.window.showInformationMessage(

0 commit comments

Comments
 (0)