1+ import { ASYNC_AGENTS_ENABLED } from '@codebuff/common/constants'
12import { CodebuffMessage } from '@codebuff/common/types/message'
23import {
34 AgentState ,
@@ -12,7 +13,6 @@ import { agentRegistry } from '../../templates/agent-registry'
1213import { AgentTemplate } from '../../templates/types'
1314import { logger } from '../../util/logger'
1415import { CodebuffToolCall , CodebuffToolHandlerFunction } from '../constants'
15- import { ASYNC_AGENTS_ENABLED } from '@codebuff/common/constants'
1616import { handleSpawnAgents } from './spawn-agents'
1717
1818export const handleSpawnAgentsAsync = ( ( params : {
@@ -92,15 +92,6 @@ export const handleSpawnAgentsAsync = ((params: {
9292 agentRegistry . initialize ( fileContext )
9393 const allTemplates = agentRegistry . getAllTemplates ( )
9494
95- const conversationHistoryMessage : CoreMessage = {
96- role : 'user' ,
97- content : `For context, the following is the conversation history between the user and an assistant:\n\n${ JSON . stringify (
98- mutableState . messages ,
99- null ,
100- 2
101- ) } `,
102- }
103-
10495 const triggerSpawnAgentsAsync = async ( ) => {
10596 const results : Array < {
10697 agentType : string
@@ -109,6 +100,15 @@ export const handleSpawnAgentsAsync = ((params: {
109100 error ?: string
110101 } > = [ ]
111102
103+ const conversationHistoryMessage : CoreMessage = {
104+ role : 'user' ,
105+ content : `For context, the following is the conversation history between the user and an assistant:\n\n${ JSON . stringify (
106+ mutableState . messages ,
107+ null ,
108+ 2
109+ ) } `,
110+ }
111+
112112 // Validate and spawn agents asynchronously
113113 for ( const { agent_type : agentTypeStr , prompt, params } of agents ) {
114114 try {
0 commit comments