Skip to content

Commit 45f2df6

Browse files
committed
migrated from agent-template to agent-config
1 parent b174f96 commit 45f2df6

File tree

7 files changed

+17
-13
lines changed

7 files changed

+17
-13
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Import these types in your agent files to get full type safety and IntelliSense.
66
*
77
* Usage:
8-
* import { AgentConfig, ToolName, ModelName } from './agent-template'
8+
* import { AgentConfig, ToolName, ModelName } from './agent-config'
99
*
1010
* const config: AgentConfig = {
1111
* // Your agent configuration with full type safety

.agents/brainstormer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
AgentStepContext,
44
ToolResult,
55
ToolCall,
6-
} from './agent-template'
6+
} from './agent-config'
77

88
const config: AgentConfig = {
99
id: 'brainstormer',

.agents/git-committer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
AgentStepContext,
44
ToolResult,
55
ToolCall,
6-
} from './agent-template'
6+
} from './agent-config'
77

88
const config: AgentConfig = {
99
id: 'git-committer',

.agents/knowledge-keeper.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import { AgentConfig, AgentStepContext, ToolResult, ToolCall } from './agent-template'
1+
import {
2+
AgentConfig,
3+
AgentStepContext,
4+
ToolResult,
5+
ToolCall,
6+
} from './agent-config'
27

38
const config: AgentConfig = {
49
id: 'knowledge-keeper',

backend/src/templates/agents/agent-builder.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
Model,
66
openrouterModels,
77
AGENT_TEMPLATES_DIR,
8+
AGENT_CONFIG_FILE,
89
} from '@codebuff/common/constants'
910
import { ToolName } from '@codebuff/common/constants/tools'
1011
import { AgentTemplateTypes } from '@codebuff/common/types/session-state'
@@ -13,26 +14,23 @@ import z from 'zod/v4'
1314
import { AgentTemplate } from '../types'
1415

1516
const 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
1920
import(TEMPLATE_RELATIVE_PATH)
2021

2122
const TEMPLATE_PATH = path.join(__dirname, TEMPLATE_RELATIVE_PATH)
2223
const 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

2826
export 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: {

common/src/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export const EXISTING_CODE_MARKER = '[[**REPLACE_WITH_EXISTING_CODE**]]'
44

55
// Directory where agent template override files are stored
66
export const AGENT_TEMPLATES_DIR = '.agents/'
7+
export const AGENT_CONFIG_FILE = 'agent-config.d.ts'
78

89
// Enable async agents to run tool calls even when main user input is cancelled
910
export const ASYNC_AGENTS_ENABLED = true
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Import these types in your agent files to get full type safety and IntelliSense.
66
*
77
* Usage:
8-
* import { AgentConfig, ToolName, ModelName } from './agent-template'
8+
* import { AgentConfig, ToolName, ModelName } from './agent-config'
99
*
1010
* const config: AgentConfig = {
1111
* // Your agent configuration with full type safety

0 commit comments

Comments
 (0)