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