55 Model ,
66 openrouterModels ,
77 AGENT_TEMPLATES_DIR ,
8+ AGENT_CONFIG_FILE ,
89} from '@codebuff/common/constants'
910import { ToolName } from '@codebuff/common/constants/tools'
1011import { AgentTemplateTypes } from '@codebuff/common/types/session-state'
@@ -13,26 +14,23 @@ import z from 'zod/v4'
1314import { AgentTemplate } from '../types'
1415
1516const TEMPLATE_RELATIVE_PATH =
16- ' ../../../../common/src/templates/agent-template.d.ts' as const
17+ ` ../../../../common/src/util/ ${ AGENT_CONFIG_FILE } ` as const
1718
1819// Import to validate path exists at compile time
1920import ( TEMPLATE_RELATIVE_PATH )
2021
2122const TEMPLATE_PATH = path . join ( __dirname , TEMPLATE_RELATIVE_PATH )
2223const DEFAULT_MODEL = openrouterModels . openrouter_claude_sonnet_4
23- const TEMPLATE_TYPES_PATH = path . join (
24- AGENT_TEMPLATES_DIR ,
25- 'agent-template.d.ts'
26- )
24+ const TEMPLATE_TYPES_PATH = path . join ( AGENT_TEMPLATES_DIR , AGENT_CONFIG_FILE )
2725
2826export const agentBuilder = ( model : Model ) : Omit < AgentTemplate , 'id' > => {
29- // Read the agent-template.d.ts file content dynamically
27+ // Read the AGENT_CONFIG_FILE content dynamically
3028 // The import above ensures this path exists at compile time
3129 let agentTemplateContent = ''
3230 try {
3331 agentTemplateContent = fs . readFileSync ( TEMPLATE_PATH , 'utf8' )
3432 } catch ( error ) {
35- console . warn ( ' Could not read agent-template.d.ts:' , error )
33+ console . warn ( ` Could not read ${ AGENT_CONFIG_FILE } :` , error )
3634 agentTemplateContent = '// Agent template types not available'
3735 }
3836
@@ -161,7 +159,7 @@ IMPORTANT: Always end your response with the end_turn tool when you have complet
161159 } ,
162160 }
163161
164- // Step 2: Write the agent-template.d.ts file with the template content
162+ // Step 2: Write the AGENT_CONFIG_FILE with the template content
165163 yield {
166164 toolName : 'write_file' ,
167165 args : {
0 commit comments