|
6 | 6 | openrouterModels, |
7 | 7 | AGENT_DEFINITION_FILE, |
8 | 8 | } from '@codebuff/common/constants' |
9 | | -import { AgentTemplateTypes } from '@codebuff/common/types/session-state' |
10 | 9 | import z from 'zod/v4' |
11 | 10 |
|
12 | 11 | import type { AgentTemplate } from '../types' |
@@ -64,7 +63,10 @@ export const agentBuilder = ( |
64 | 63 |
|
65 | 64 | files |
66 | 65 | .filter( |
67 | | - (file) => file.endsWith('.ts') && file.startsWith('diff-reviewer'), |
| 66 | + (file) => |
| 67 | + file.endsWith('.ts') && |
| 68 | + (file.startsWith('diff-reviewer') || |
| 69 | + file === 'your-custom-agent.ts'), |
68 | 70 | ) |
69 | 71 | .forEach((filename) => { |
70 | 72 | try { |
@@ -119,15 +121,7 @@ export const agentBuilder = ( |
119 | 121 | 'set_output', |
120 | 122 | 'end_turn', |
121 | 123 | ] satisfies ToolName[], |
122 | | - spawnableAgents: allAvailableAgents |
123 | | - ? (allAvailableAgents as any[]) |
124 | | - : [ |
125 | | - AgentTemplateTypes.file_picker, |
126 | | - AgentTemplateTypes.researcher, |
127 | | - AgentTemplateTypes.thinker, |
128 | | - AgentTemplateTypes.reviewer, |
129 | | - AgentTemplateTypes.agent_builder, |
130 | | - ], |
| 124 | + spawnableAgents: [], |
131 | 125 |
|
132 | 126 | systemPrompt: [ |
133 | 127 | '# Bob the Agent Builder', |
@@ -270,11 +264,17 @@ IMPORTANT: Always end your response with the end_turn tool when you have complet |
270 | 264 | // Step 5: Copy example agent files to .agents/ directory |
271 | 265 | for (const [filename, content] of Object.entries(exampleAgentContents)) { |
272 | 266 | if (content) { |
| 267 | + // Copy your-custom-agent.ts to top level .agents directory, others to examples |
| 268 | + const targetPath = |
| 269 | + filename === 'your-custom-agent.ts' |
| 270 | + ? `${AGENT_TEMPLATES_DIR}/${filename}` |
| 271 | + : `${EXAMPLES_DIR}/${filename}` |
| 272 | + |
273 | 273 | yield { |
274 | 274 | toolName: 'write_file', |
275 | 275 | args: { |
276 | | - path: `${EXAMPLES_DIR}/${filename}`, |
277 | | - instructions: `Copy example agent file ${filename}`, |
| 276 | + path: targetPath, |
| 277 | + instructions: `Copy ${filename === 'your-custom-agent.ts' ? 'custom agent template' : 'example agent'} file ${filename}`, |
278 | 278 | content: content, |
279 | 279 | }, |
280 | 280 | } |
|
0 commit comments