Skip to content

Commit 579bcbf

Browse files
authored
Merge pull request #8259 from continuedev/dallin/agent-file-model-fixes
fix: loading of blocks with inputs. in CLI flags
2 parents 619dd12 + 9bec1f0 commit 579bcbf

27 files changed

+2784
-1790
lines changed

extensions/cli/src/commands/remote.test.ts

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,32 @@ describe("remote command", () => {
353353
expect(mockFetch).toHaveBeenCalledWith(
354354
new URL("agents", mockEnv.env.apiBase),
355355
expect.objectContaining({
356-
body: expect.stringContaining(`"agent":"${testConfig}"`),
356+
body: expect.stringContaining(`"config":"${testConfig}"`),
357+
}),
358+
);
359+
});
360+
361+
it("should include agent in request body when agent option is provided", async () => {
362+
const testAgent = "test-agent";
363+
364+
await remote("test prompt", { agent: testAgent });
365+
366+
expect(mockFetch).toHaveBeenCalledWith(
367+
new URL("agents", mockEnv.env.apiBase),
368+
expect.objectContaining({
369+
method: "POST",
370+
headers: {
371+
"Content-Type": "application/json",
372+
Authorization: "Bearer test-token",
373+
},
374+
body: expect.stringContaining(`"agent":"${testAgent}"`),
375+
}),
376+
);
377+
378+
expect(mockFetch).toHaveBeenCalledWith(
379+
new URL("agents", mockEnv.env.apiBase),
380+
expect.objectContaining({
381+
body: expect.stringContaining(`"agent":"${testAgent}"`),
357382
}),
358383
);
359384
});
@@ -375,11 +400,31 @@ describe("remote command", () => {
375400
name: expect.stringMatching(/^devbox-\d+$/),
376401
prompt: "test prompt",
377402
idempotencyKey: testIdempotencyKey,
378-
agent: testConfig,
379403
config: testConfig,
380404
});
381405
});
382406

407+
it("should handle proper request body structure with agent field", async () => {
408+
const testAgent = "my-agent";
409+
const testIdempotencyKey = "test-with-config";
410+
411+
await remote("test prompt", {
412+
agent: testAgent,
413+
idempotencyKey: testIdempotencyKey,
414+
});
415+
416+
const fetchCall = mockFetch.mock.calls[0];
417+
const requestBody = JSON.parse(fetchCall[1].body);
418+
419+
expect(requestBody).toEqual({
420+
repoUrl: "https://github.com/user/test-repo.git",
421+
name: expect.stringMatching(/^devbox-\d+$/),
422+
prompt: "test prompt",
423+
idempotencyKey: testIdempotencyKey,
424+
agent: testAgent,
425+
});
426+
});
427+
383428
it("should not include config in request body when config option is not provided", async () => {
384429
await remote("test prompt", {});
385430

extensions/cli/src/commands/remote.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ type RemoteCommandOptions = {
2121
branch?: string;
2222
repo?: string;
2323
config?: string;
24+
agent?: string;
2425
};
2526

2627
type TunnelResponse = {
@@ -169,7 +170,7 @@ function buildAgentRequestBody(
169170
repoUrl: options.repo ?? getRepoUrl(),
170171
name: `devbox-${Date.now()}`,
171172
prompt,
172-
agent: options.config,
173+
agent: options.agent,
173174
config: options.config,
174175
};
175176

0 commit comments

Comments
 (0)