( options: CreateAgentBlockOptions, )
| 295 | * Creates a new agent content block with standard defaults. |
| 296 | */ |
| 297 | export const createAgentBlock = ( |
| 298 | options: CreateAgentBlockOptions, |
| 299 | ): AgentContentBlock => { |
| 300 | const { agentId, agentType, prompt, params, spawnToolCallId, spawnIndex, parentAgentType } = options |
| 301 | const shouldCollapse = |
| 302 | shouldCollapseByDefault(agentType || '') || |
| 303 | shouldCollapseForParent(agentType || '', parentAgentType) |
| 304 | return { |
| 305 | type: 'agent', |
| 306 | agentId, |
| 307 | agentName: agentType || 'Agent', |
| 308 | agentType: agentType || 'unknown', |
| 309 | content: '', |
| 310 | status: 'running' as const, |
| 311 | blocks: [] as ContentBlock[], |
| 312 | initialPrompt: prompt || '', |
| 313 | ...(params && { params }), |
| 314 | ...(spawnToolCallId && { spawnToolCallId }), |
| 315 | ...(spawnIndex !== undefined && { spawnIndex }), |
| 316 | ...(shouldCollapse && { isCollapsed: true }), |
| 317 | } |
| 318 | } |
| 319 | |
| 320 | /** |
| 321 | * Helper function to recursively update blocks by target agent ID. |
no test coverage detected