( agentDefinitions?: AgentDefinitionsResult, )
| 7 | * Calculate cumulative token estimate for agent descriptions |
| 8 | */ |
| 9 | export function getAgentDescriptionsTotalTokens( |
| 10 | agentDefinitions?: AgentDefinitionsResult, |
| 11 | ): number { |
| 12 | if (!agentDefinitions) return 0 |
| 13 | |
| 14 | return agentDefinitions.activeAgents |
| 15 | .filter(a => a.source !== 'built-in') |
| 16 | .reduce((total, agent) => { |
| 17 | const description = `${agent.agentType}: ${agent.whenToUse}` |
| 18 | return total + roughTokenCountEstimation(description) |
| 19 | }, 0) |
| 20 | } |
| 21 |
no test coverage detected