( tools: Tools, getToolPermissionContext: () => Promise<ToolPermissionContext>, agentInfo: AgentDefinitionsResult | null, )
| 519 | } |
| 520 | |
| 521 | async function countSlashCommandTokens( |
| 522 | tools: Tools, |
| 523 | getToolPermissionContext: () => Promise<ToolPermissionContext>, |
| 524 | agentInfo: AgentDefinitionsResult | null, |
| 525 | ): Promise<{ |
| 526 | slashCommandTokens: number |
| 527 | commandInfo: { totalCommands: number; includedCommands: number } |
| 528 | }> { |
| 529 | const info = await getSlashCommandInfo(getCwd()) |
| 530 | |
| 531 | const slashCommandTool = findSkillTool(tools) |
| 532 | if (!slashCommandTool) { |
| 533 | return { |
| 534 | slashCommandTokens: 0, |
| 535 | commandInfo: { totalCommands: 0, includedCommands: 0 }, |
| 536 | } |
| 537 | } |
| 538 | |
| 539 | const slashCommandTokens = await countToolDefinitionTokens( |
| 540 | [slashCommandTool], |
| 541 | getToolPermissionContext, |
| 542 | agentInfo, |
| 543 | ) |
| 544 | |
| 545 | return { |
| 546 | slashCommandTokens, |
| 547 | commandInfo: { |
| 548 | totalCommands: info.totalCommands, |
| 549 | includedCommands: info.includedCommands, |
| 550 | }, |
| 551 | } |
| 552 | } |
| 553 | |
| 554 | async function countSkillTokens( |
| 555 | tools: Tools, |
no test coverage detected