(results: (SearchResult | string | null | undefined)[])
| 6 | import { truncate } from '../../utils/format.js'; |
| 7 | import type { Output, SearchResult, WebSearchProgress } from './WebSearchTool.js'; |
| 8 | function getSearchSummary(results: (SearchResult | string | null | undefined)[]): { |
| 9 | searchCount: number; |
| 10 | totalResultCount: number; |
| 11 | } { |
| 12 | let searchCount = 0; |
| 13 | let totalResultCount = 0; |
| 14 | for (const result of results) { |
| 15 | if (result != null && typeof result !== 'string') { |
| 16 | searchCount++; |
| 17 | totalResultCount += result.content?.length ?? 0; |
| 18 | } |
| 19 | } |
| 20 | return { |
| 21 | searchCount, |
| 22 | totalResultCount |
| 23 | }; |
| 24 | } |
| 25 | export function renderToolUseMessage({ |
| 26 | query, |
| 27 | allowed_domains, |
no outgoing calls
no test coverage detected