@@ -4,6 +4,7 @@ import { getAgentTemplate } from './agent-registry'
44
55import type { AgentTemplate } from '@codebuff/common/types/agent-template'
66import type { AgentTemplateType } from '@codebuff/common/types/session-state'
7+ import { buildArray } from '@codebuff/common/util/array'
78
89export async function buildSpawnableAgentsDescription (
910 spawnableAgents : AgentTemplateType [ ] ,
@@ -31,15 +32,19 @@ prompt: {"description": "A coding task to complete", "type": "string"}
3132params: None`
3233 }
3334 const { inputSchema } = agentTemplate
34- if ( ! inputSchema ) {
35- return `- ${ agentType } : ${ agentTemplate . spawnerPrompt }
36- prompt: None
37- params: None`
38- }
39- const { prompt, params } = inputSchema
40- return `- ${ agentType } : ${ agentTemplate . spawnerPrompt }
41- prompt: ${ schemaToJsonStr ( prompt ) }
42- params: ${ schemaToJsonStr ( params ) } `
35+ const inputSchemaStr = inputSchema
36+ ? [
37+ `prompt: ${ schemaToJsonStr ( inputSchema . prompt ) } ` ,
38+ `params: ${ schemaToJsonStr ( inputSchema . params ) } ` ,
39+ ] . join ( '\n' )
40+ : [ 'prompt: None' , 'params: None' ] . join ( '\n' )
41+
42+ return buildArray (
43+ `- ${ agentType } : ${ agentTemplate . spawnerPrompt } ` ,
44+ agentTemplate . includeMessageHistory &&
45+ 'This agent can see the current message history.' ,
46+ inputSchemaStr ,
47+ ) . join ( '\n' )
4348 } )
4449 . filter ( Boolean )
4550 . join ( '\n\n' )
0 commit comments