@@ -232,23 +232,27 @@ describe('file-picker agent', () => {
232232 // First yield is spawn_agents
233233 generator . next ( )
234234
235- // Mock spawn_agents result - wrapped in toolResult object
235+ // Mock spawn_agents result - wrapped in toolResult object with production structure
236236 const mockToolResult = {
237237 agentState : createMockAgentState ( ) ,
238238 toolResult : [
239239 {
240240 type : 'json' as const ,
241241 value : [
242242 {
243- type : 'lastMessage' ,
244- value : [
245- {
246- role : 'assistant' ,
247- content : [
248- { type : 'text' , text : 'src/auth.ts\nsrc/login.ts' } ,
249- ] ,
250- } ,
251- ] ,
243+ agentName : 'File Lister' ,
244+ agentType : 'file-lister' ,
245+ value : {
246+ type : 'lastMessage' ,
247+ value : [
248+ {
249+ role : 'assistant' ,
250+ content : [
251+ { type : 'text' , text : 'src/auth.ts\nsrc/login.ts' } ,
252+ ] ,
253+ } ,
254+ ] ,
255+ } ,
252256 } ,
253257 ] ,
254258 } ,
@@ -282,23 +286,27 @@ describe('file-picker agent', () => {
282286
283287 generator . next ( )
284288
285- // Result with duplicate paths - wrapped in toolResult
289+ // Result with duplicate paths - wrapped in toolResult with production structure
286290 const mockToolResult = {
287291 agentState : createMockAgentState ( ) ,
288292 toolResult : [
289293 {
290294 type : 'json' as const ,
291295 value : [
292296 {
293- type : 'lastMessage' ,
294- value : [
295- {
296- role : 'assistant' ,
297- content : [
298- { type : 'text' , text : 'src/file.ts\nsrc/file.ts\nsrc/other.ts' } ,
299- ] ,
300- } ,
301- ] ,
297+ agentName : 'File Lister' ,
298+ agentType : 'file-lister' ,
299+ value : {
300+ type : 'lastMessage' ,
301+ value : [
302+ {
303+ role : 'assistant' ,
304+ content : [
305+ { type : 'text' , text : 'src/file.ts\nsrc/file.ts\nsrc/other.ts' } ,
306+ ] ,
307+ } ,
308+ ] ,
309+ } ,
302310 } ,
303311 ] ,
304312 } ,
@@ -341,13 +349,17 @@ describe('file-picker agent', () => {
341349 type : 'json' as const ,
342350 value : [
343351 {
344- type : 'lastMessage' ,
345- value : [
346- {
347- role : 'assistant' ,
348- content : [ { type : 'text' , text : 'src/file.ts' } ] ,
349- } ,
350- ] ,
352+ agentName : 'File Lister' ,
353+ agentType : 'file-lister' ,
354+ value : {
355+ type : 'lastMessage' ,
356+ value : [
357+ {
358+ role : 'assistant' ,
359+ content : [ { type : 'text' , text : 'src/file.ts' } ] ,
360+ } ,
361+ ] ,
362+ } ,
351363 } ,
352364 ] ,
353365 } ,
@@ -381,16 +393,20 @@ describe('file-picker agent', () => {
381393
382394 generator . next ( )
383395
384- // Result with error - wrapped in toolResult
396+ // Result with error - wrapped in toolResult with production structure
385397 const mockToolResult = {
386398 agentState : createMockAgentState ( ) ,
387399 toolResult : [
388400 {
389401 type : 'json' as const ,
390402 value : [
391403 {
392- type : 'error' ,
393- message : 'File lister failed' ,
404+ agentName : 'File Lister' ,
405+ agentType : 'file-lister' ,
406+ value : {
407+ type : 'error' ,
408+ message : 'File lister failed' ,
409+ } ,
394410 } ,
395411 ] ,
396412 } ,
@@ -456,34 +472,42 @@ describe('file-picker agent', () => {
456472
457473 generator . next ( )
458474
459- // Mock result with two spawned agent results - wrapped in toolResult
475+ // Mock result with two spawned agent results - wrapped in toolResult with production structure
460476 const mockToolResult = {
461477 agentState : createMockAgentState ( ) ,
462478 toolResult : [
463479 {
464480 type : 'json' as const ,
465481 value : [
466482 {
467- type : 'lastMessage' ,
468- value : [
469- {
470- role : 'assistant' ,
471- content : [
472- { type : 'text' , text : 'src/auth.ts\nsrc/login.ts' } ,
473- ] ,
474- } ,
475- ] ,
483+ agentName : 'File Lister' ,
484+ agentType : 'file-lister' ,
485+ value : {
486+ type : 'lastMessage' ,
487+ value : [
488+ {
489+ role : 'assistant' ,
490+ content : [
491+ { type : 'text' , text : 'src/auth.ts\nsrc/login.ts' } ,
492+ ] ,
493+ } ,
494+ ] ,
495+ } ,
476496 } ,
477497 {
478- type : 'lastMessage' ,
479- value : [
480- {
481- role : 'assistant' ,
482- content : [
483- { type : 'text' , text : 'src/user.ts\nsrc/auth.ts' } , // auth.ts is duplicate
484- ] ,
485- } ,
486- ] ,
498+ agentName : 'File Lister' ,
499+ agentType : 'file-lister' ,
500+ value : {
501+ type : 'lastMessage' ,
502+ value : [
503+ {
504+ role : 'assistant' ,
505+ content : [
506+ { type : 'text' , text : 'src/user.ts\nsrc/auth.ts' } , // auth.ts is duplicate
507+ ] ,
508+ } ,
509+ ] ,
510+ } ,
487511 } ,
488512 ] ,
489513 } ,
@@ -520,25 +544,33 @@ describe('file-picker agent', () => {
520544
521545 generator . next ( )
522546
523- // One success, one error - wrapped in toolResult
547+ // One success, one error - wrapped in toolResult with production structure
524548 const mockToolResult = {
525549 agentState : createMockAgentState ( ) ,
526550 toolResult : [
527551 {
528552 type : 'json' as const ,
529553 value : [
530554 {
531- type : 'lastMessage' ,
532- value : [
533- {
534- role : 'assistant' ,
535- content : [ { type : 'text' , text : 'src/file.ts' } ] ,
536- } ,
537- ] ,
555+ agentName : 'File Lister' ,
556+ agentType : 'file-lister' ,
557+ value : {
558+ type : 'lastMessage' ,
559+ value : [
560+ {
561+ role : 'assistant' ,
562+ content : [ { type : 'text' , text : 'src/file.ts' } ] ,
563+ } ,
564+ ] ,
565+ } ,
538566 } ,
539567 {
540- type : 'error' ,
541- message : 'Second file-lister failed' ,
568+ agentName : 'File Lister' ,
569+ agentType : 'file-lister' ,
570+ value : {
571+ type : 'error' ,
572+ message : 'Second file-lister failed' ,
573+ } ,
542574 } ,
543575 ] ,
544576 } ,
0 commit comments