Skip to content

Commit bddda36

Browse files
fix: requests
1 parent 357c9b2 commit bddda36

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

core/control-plane/client.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -447,21 +447,23 @@ export class ControlPlaneClient {
447447
public async createBackgroundAgent(
448448
prompt: string,
449449
repoUrl: string,
450+
name: string,
450451
branch?: string,
451452
): Promise<{ id: string }> {
452453
if (!(await this.isSignedIn())) {
453454
throw new Error("Not signed in to Continue");
454455
}
455456

456-
const resp = await this.requestAndHandleError("agents/devboxes", {
457+
const resp = await this.requestAndHandleError("agents", {
457458
method: "POST",
458459
headers: {
459460
"Content-Type": "application/json",
460461
},
461462
body: JSON.stringify({
462463
prompt,
463464
repoUrl,
464-
branch,
465+
name,
466+
branchName: branch,
465467
}),
466468
});
467469

@@ -488,22 +490,23 @@ export class ControlPlaneClient {
488490
}
489491

490492
try {
491-
const resp = await this.requestAndHandleError("agents/devboxes", {
493+
const resp = await this.requestAndHandleError("agents", {
492494
method: "GET",
493495
});
494496

495497
const agents = (await resp.json()) as any[];
496498

497499
return agents.map((agent: any) => ({
498500
id: agent.id,
499-
name: agent.name || null,
501+
name: agent.name || agent.metadata?.name || null,
500502
status: agent.status,
501-
repoUrl: agent.repo_url || agent.repoUrl || "",
502-
createdAt: new Date(
503-
agent.created_at || agent.create_time_ms,
504-
).toISOString(),
503+
repoUrl: agent.metadata?.repo_url || agent.repo_url || "",
504+
createdAt:
505+
agent.created_at || agent.create_time_ms
506+
? new Date(agent.created_at || agent.create_time_ms).toISOString()
507+
: new Date().toISOString(),
505508
metadata: {
506-
github_repo: agent.metadata?.github_repo || agent.repo_url,
509+
github_repo: agent.metadata?.github_repo || agent.metadata?.repo_url,
507510
},
508511
}));
509512
} catch (e) {

extensions/vscode/src/extension/VsCodeMessenger.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,21 @@ export class VsCodeMessenger {
336336
return;
337337
}
338338

339+
// Generate a name from the prompt (first 50 chars, cleaned up)
340+
let name = prompt.substring(0, 50).replace(/\n/g, " ").trim();
341+
if (prompt.length > 50) {
342+
name += "...";
343+
}
344+
// Fallback to a generic name if prompt is too short
345+
if (name.length < 3) {
346+
const repoName = await this.ide.getRepoName(workspaceDir);
347+
name = `Agent for ${repoName || "repository"}`;
348+
}
349+
339350
// Create the background agent
340351
try {
341352
console.log("Creating background agent with:", {
353+
name,
342354
prompt: prompt.substring(0, 50) + "...",
343355
repoUrl,
344356
branch,
@@ -348,6 +360,7 @@ export class VsCodeMessenger {
348360
await configHandler.controlPlaneClient.createBackgroundAgent(
349361
prompt,
350362
repoUrl,
363+
name,
351364
branch,
352365
);
353366

0 commit comments

Comments
 (0)