@@ -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 ( / ^ d e v b o x - \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 ( / ^ d e v b o x - \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
0 commit comments