(
enabled: boolean,
mode: ToolSearchMode,
reason: string,
extraProps?: Record<string, number>,
)
| 393 | |
| 394 | // Helper to log the mode decision event |
| 395 | function logModeDecision( |
| 396 | enabled: boolean, |
| 397 | mode: ToolSearchMode, |
| 398 | reason: string, |
| 399 | extraProps?: Record<string, number>, |
| 400 | ): void { |
| 401 | logEvent('tengu_tool_search_mode_decision', { |
| 402 | enabled, |
| 403 | mode: mode as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, |
| 404 | reason: |
| 405 | reason as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, |
| 406 | // Log the actual model being checked, not the session's main model. |
| 407 | // This is important for debugging subagent tool search decisions where |
| 408 | // the subagent model (e.g., haiku) differs from the session model (e.g., opus). |
| 409 | checkedModel: |
| 410 | model as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, |
| 411 | mcpToolCount, |
| 412 | userType: (process.env.USER_TYPE ?? |
| 413 | 'external') as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, |
| 414 | ...extraProps, |
| 415 | }) |
| 416 | } |
| 417 | |
| 418 | // Check if model supports tool_reference |
| 419 | if (!modelSupportsToolReference(model)) { |
no test coverage detected