@@ -42,6 +42,42 @@ const mockAgentStream = (streamOutput: string) => {
4242}
4343
4444describe ( 'mainPrompt' , ( ) => {
45+ let mockLocalAgentTemplates : Record < string , any >
46+
47+ beforeEach ( ( ) => {
48+ // Setup common mock agent templates
49+ mockLocalAgentTemplates = {
50+ base : {
51+ id : 'base' ,
52+ displayName : 'Base Agent' ,
53+ outputMode : 'last_message' ,
54+ inputSchema : { } ,
55+ parentPrompt : '' ,
56+ model : 'gpt-4o-mini' ,
57+ includeMessageHistory : true ,
58+ toolNames : [ 'write_file' , 'run_terminal_command' ] ,
59+ subagents : [ ] ,
60+ systemPrompt : '' ,
61+ instructionsPrompt : '' ,
62+ stepPrompt : '' ,
63+ } ,
64+ base_max : {
65+ id : 'base_max' ,
66+ displayName : 'Base Max Agent' ,
67+ outputMode : 'last_message' ,
68+ inputSchema : { } ,
69+ parentPrompt : '' ,
70+ model : 'gpt-4o' ,
71+ includeMessageHistory : true ,
72+ toolNames : [ 'write_file' , 'run_terminal_command' ] ,
73+ subagents : [ ] ,
74+ systemPrompt : '' ,
75+ instructionsPrompt : '' ,
76+ stepPrompt : '' ,
77+ } ,
78+ }
79+ } )
80+
4581 beforeAll ( ( ) => {
4682 // Mock logger
4783 mockModule ( '@codebuff/backend/util/logger' , ( ) => ( {
@@ -219,6 +255,36 @@ describe('mainPrompt', () => {
219255 userId : TEST_USER_ID ,
220256 clientSessionId : 'test-session' ,
221257 onResponseChunk : ( ) => { } ,
258+ localAgentTemplates : {
259+ base : {
260+ id : 'base' ,
261+ displayName : 'Base Agent' ,
262+ outputMode : 'last_message' ,
263+ inputSchema : { } ,
264+ parentPrompt : '' ,
265+ model : 'gpt-4o-mini' ,
266+ includeMessageHistory : true ,
267+ toolNames : [ 'write_file' , 'run_terminal_command' ] ,
268+ subagents : [ ] ,
269+ systemPrompt : '' ,
270+ instructionsPrompt : '' ,
271+ stepPrompt : '' ,
272+ } ,
273+ base_max : {
274+ id : 'base_max' ,
275+ displayName : 'Base Max Agent' ,
276+ outputMode : 'last_message' ,
277+ inputSchema : { } ,
278+ parentPrompt : '' ,
279+ model : 'gpt-4o' ,
280+ includeMessageHistory : true ,
281+ toolNames : [ 'write_file' , 'run_terminal_command' ] ,
282+ subagents : [ ] ,
283+ systemPrompt : '' ,
284+ instructionsPrompt : '' ,
285+ stepPrompt : '' ,
286+ } ,
287+ } ,
222288 } ,
223289 )
224290
@@ -271,6 +337,7 @@ describe('mainPrompt', () => {
271337 userId : TEST_USER_ID ,
272338 clientSessionId : 'test-session' ,
273339 onResponseChunk : ( ) => { } ,
340+ localAgentTemplates : mockLocalAgentTemplates ,
274341 } ,
275342 )
276343
@@ -329,6 +396,36 @@ describe('mainPrompt', () => {
329396 userId : TEST_USER_ID ,
330397 clientSessionId : 'test-session' ,
331398 onResponseChunk : ( ) => { } ,
399+ localAgentTemplates : {
400+ base : {
401+ id : 'base' ,
402+ displayName : 'Base Agent' ,
403+ outputMode : 'last_message' ,
404+ inputSchema : { } ,
405+ parentPrompt : '' ,
406+ model : 'gpt-4o-mini' ,
407+ includeMessageHistory : true ,
408+ toolNames : [ 'write_file' , 'run_terminal_command' ] ,
409+ subagents : [ ] ,
410+ systemPrompt : '' ,
411+ instructionsPrompt : '' ,
412+ stepPrompt : '' ,
413+ } ,
414+ base_max : {
415+ id : 'base_max' ,
416+ displayName : 'Base Max Agent' ,
417+ outputMode : 'last_message' ,
418+ inputSchema : { } ,
419+ parentPrompt : '' ,
420+ model : 'gpt-4o' ,
421+ includeMessageHistory : true ,
422+ toolNames : [ 'write_file' , 'run_terminal_command' ] ,
423+ subagents : [ ] ,
424+ systemPrompt : '' ,
425+ instructionsPrompt : '' ,
426+ stepPrompt : '' ,
427+ } ,
428+ } ,
332429 } )
333430
334431 // Assert that requestToolCall was called exactly once
@@ -374,6 +471,7 @@ describe('mainPrompt', () => {
374471 userId : TEST_USER_ID ,
375472 clientSessionId : 'test-session' ,
376473 onResponseChunk : ( ) => { } ,
474+ localAgentTemplates : mockLocalAgentTemplates ,
377475 } ,
378476 )
379477
@@ -401,6 +499,7 @@ describe('mainPrompt', () => {
401499 userId : TEST_USER_ID ,
402500 clientSessionId : 'test-session' ,
403501 onResponseChunk : ( ) => { } ,
502+ localAgentTemplates : mockLocalAgentTemplates ,
404503 } ,
405504 )
406505
@@ -432,6 +531,7 @@ describe('mainPrompt', () => {
432531 userId : TEST_USER_ID ,
433532 clientSessionId : 'test-session' ,
434533 onResponseChunk : ( ) => { } ,
534+ localAgentTemplates : mockLocalAgentTemplates ,
435535 } ,
436536 )
437537
@@ -461,6 +561,7 @@ describe('mainPrompt', () => {
461561 userId : TEST_USER_ID ,
462562 clientSessionId : 'test-session' ,
463563 onResponseChunk : ( ) => { } ,
564+ localAgentTemplates : mockLocalAgentTemplates ,
464565 } ,
465566 )
466567
@@ -498,6 +599,7 @@ describe('mainPrompt', () => {
498599 userId : TEST_USER_ID ,
499600 clientSessionId : 'test-session' ,
500601 onResponseChunk : ( ) => { } ,
602+ localAgentTemplates : mockLocalAgentTemplates ,
501603 } )
502604
503605 // Assert that requestToolCall was called exactly once
0 commit comments